wimui 0.60.0 → 0.61.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/_internal/useInlineFloating.cjs +2 -0
- package/dist/components/_internal/useInlineFloating.d.ts +54 -0
- package/dist/components/_internal/useInlineFloating.js +61 -0
- package/dist/components/ai/ModelSelector/ModelSelector.cjs +1 -1
- package/dist/components/ai/ModelSelector/ModelSelector.js +96 -89
- package/dist/components/ai/ModelSelector/model-selector.module.cjs +1 -1
- package/dist/components/ai/ModelSelector/model-selector.module.js +1 -1
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +89 -85
- package/dist/components/form/Cascader/cascader.module.cjs +1 -1
- package/dist/components/form/Cascader/cascader.module.js +6 -6
- package/dist/components/form/Combobox/Combobox.cjs +1 -1
- package/dist/components/form/Combobox/Combobox.js +108 -102
- 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 +90 -85
- package/dist/components/form/DatePicker/date-picker.module.cjs +1 -1
- package/dist/components/form/DatePicker/date-picker.module.js +1 -1
- package/dist/components/form/Mentions/Mentions.cjs +1 -1
- package/dist/components/form/Mentions/Mentions.js +4 -4
- package/dist/components/form/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/form/MultiSelect/MultiSelect.js +80 -77
- package/dist/components/form/MultiSelect/multiselect.module.cjs +1 -1
- package/dist/components/form/MultiSelect/multiselect.module.js +1 -1
- package/dist/components/form/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/form/PhoneInput/PhoneInput.js +117 -111
- package/dist/components/form/PhoneInput/phone-input.module.cjs +1 -1
- package/dist/components/form/PhoneInput/phone-input.module.js +1 -1
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +96 -89
- package/dist/components/form/Select/select.module.cjs +1 -1
- package/dist/components/form/Select/select.module.js +1 -1
- package/dist/components/form/SplitButton/SplitButton.cjs +1 -1
- package/dist/components/form/SplitButton/SplitButton.js +35 -31
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +115 -112
- package/dist/components/form/TreeSelect/tree-select.module.cjs +1 -1
- package/dist/components/form/TreeSelect/tree-select.module.js +6 -6
- package/dist/components/navigation/Anchor/Anchor.cjs +1 -1
- package/dist/components/navigation/Anchor/Anchor.d.ts +5 -1
- package/dist/components/navigation/Anchor/Anchor.js +32 -29
- package/dist/components/navigation/Menubar/Menubar.cjs +1 -1
- package/dist/components/navigation/Menubar/Menubar.js +102 -92
- package/dist/components/navigation/Menubar/menubar.module.cjs +1 -1
- package/dist/components/navigation/Menubar/menubar.module.js +1 -1
- package/dist/components/overlay/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/overlay/BottomSheet/BottomSheet.d.ts +7 -1
- package/dist/components/overlay/BottomSheet/BottomSheet.js +7 -6
- package/dist/components/overlay/HoverCard/HoverCard.cjs +1 -1
- package/dist/components/overlay/HoverCard/HoverCard.js +49 -43
- package/dist/components/overlay/HoverCard/hover-card.module.cjs +1 -1
- package/dist/components/overlay/HoverCard/hover-card.module.js +1 -1
- package/dist/llms-full.txt +3 -1
- package/dist/llms.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +4 -4
|
@@ -4,41 +4,46 @@ import { useWimTranslation as n } from "../../../i18n/useWimTranslation.js";
|
|
|
4
4
|
import { Transition as r } from "../../layout/Transition/Transition.js";
|
|
5
5
|
import { BaseListItem as i } from "../../_internal/BaseListItem/BaseListItem.js";
|
|
6
6
|
import { InputBase as a } from "../InputBase/InputBase.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import l from "
|
|
7
|
+
import { useInlineFloating as o } from "../../_internal/useInlineFloating.js";
|
|
8
|
+
import { formNs as s } from "../../../i18n/generated/form.js";
|
|
9
|
+
import { FieldTemplate as c } from "../FieldTemplate/FieldTemplate.js";
|
|
10
|
+
import { mergeRefs as l } from "../../_internal/mergeRefs.js";
|
|
11
|
+
import u from "./select.module.js";
|
|
11
12
|
import { useSelect as ee } from "./useSelect.js";
|
|
12
|
-
import te, { forwardRef as
|
|
13
|
-
import
|
|
14
|
-
import { jsx as
|
|
13
|
+
import te, { forwardRef as d, useId as f, useMemo as ne } from "react";
|
|
14
|
+
import p from "classnames";
|
|
15
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
15
16
|
//#region src/components/form/Select/Select.tsx
|
|
16
|
-
var
|
|
17
|
-
let { t:
|
|
18
|
-
options:
|
|
19
|
-
value:
|
|
20
|
-
onChange:
|
|
21
|
-
defaultValue:
|
|
22
|
-
searchable:
|
|
23
|
-
grouped:
|
|
24
|
-
disabled:
|
|
25
|
-
filterOption:
|
|
26
|
-
}),
|
|
17
|
+
var g = d(({ options: d = [], value: g, onChange: re, placeholder: _, label: v, error: y, required: b, layout: ie, className: ae, disabled: x = !1, defaultValue: oe, searchable: S = !1, searchPlaceholder: C, filterOption: w, grouped: T = !1, allowClear: E = !1, fullWidth: D = !1, intent: se = "default", id: ce, noOptionsFoundLabel: O, width: k, styles: A, asChild: le = !1, children: ue, ...de }, j) => {
|
|
18
|
+
let { t: fe } = n(s), pe = f(), M = ce || `wim-select-${pe}`, N = v ? `${M}-label` : void 0, P = y ? `${M}-error` : void 0, F = `${M}-list`, I = `${M}-trigger`, L = y ? "danger" : se, { isOpen: R, searchValue: z, setSearchValue: me, focusedIndex: B, setFocusedIndex: V, isKeyboardNavigating: he, setIsKeyboardNavigating: ge, containerRef: H, triggerRef: _e, searchInputRef: ve, listItemsRef: U, currentValue: W, filteredOptions: G, selectedOption: K, focusedOption: q, handleToggle: ye, handleSelect: J, handleClear: be, handleKeyDown: Y } = ee({
|
|
19
|
+
options: d,
|
|
20
|
+
value: g,
|
|
21
|
+
onChange: re,
|
|
22
|
+
defaultValue: oe,
|
|
23
|
+
searchable: S,
|
|
24
|
+
grouped: T,
|
|
25
|
+
disabled: x,
|
|
26
|
+
filterOption: w
|
|
27
|
+
}), { setReference: X, setFloating: xe, floatingProps: Se } = o({ open: R && !x }), Ce = ne(() => l(H, j, X), [
|
|
28
|
+
H,
|
|
29
|
+
j,
|
|
30
|
+
X
|
|
31
|
+
]), we = () => {
|
|
27
32
|
let e = 0;
|
|
28
|
-
return
|
|
29
|
-
let r = t.options.filter((e) => e.type === "separator" || !z || (
|
|
30
|
-
return r.length === 0 ? null : /* @__PURE__ */
|
|
31
|
-
className:
|
|
33
|
+
return T && d.length > 0 && "options" in d[0] ? d.map((t, n) => {
|
|
34
|
+
let r = t.options.filter((e) => e.type === "separator" || !z || (w || ((e, t) => (typeof e.label == "string" ? e.label : "").toLowerCase().includes(t.toLowerCase())))(e, z));
|
|
35
|
+
return r.length === 0 ? null : /* @__PURE__ */ h(te.Fragment, { children: [/* @__PURE__ */ m("li", {
|
|
36
|
+
className: p(u.groupLabel, A?.groupLabel),
|
|
32
37
|
role: "presentation",
|
|
33
38
|
children: t.label
|
|
34
39
|
}), r.map((t, r) => {
|
|
35
40
|
let a = e++;
|
|
36
|
-
if (t.type === "separator") return /* @__PURE__ */
|
|
37
|
-
className:
|
|
41
|
+
if (t.type === "separator") return /* @__PURE__ */ m("li", {
|
|
42
|
+
className: p(u.separator, A?.separator),
|
|
38
43
|
role: "presentation"
|
|
39
44
|
}, `sep-${n}-${r}`);
|
|
40
|
-
let o = a ===
|
|
41
|
-
return /* @__PURE__ */
|
|
45
|
+
let o = a === B, s = W === t.value, c = `wim-select-option-${M}-${t.value}`;
|
|
46
|
+
return /* @__PURE__ */ m(i, {
|
|
42
47
|
asChild: !0,
|
|
43
48
|
id: c,
|
|
44
49
|
ref: (e) => {
|
|
@@ -46,24 +51,24 @@ var m = u(({ options: u = [], value: m, onChange: h, placeholder: g, label: _, e
|
|
|
46
51
|
},
|
|
47
52
|
active: o,
|
|
48
53
|
disabled: t.disabled,
|
|
49
|
-
className:
|
|
54
|
+
className: p(u.option, s && u.selected, A?.option),
|
|
50
55
|
onClick: (e) => {
|
|
51
56
|
e.stopPropagation(), J(t);
|
|
52
57
|
},
|
|
53
|
-
onMouseEnter: () =>
|
|
58
|
+
onMouseEnter: () => V(a),
|
|
54
59
|
role: "option",
|
|
55
60
|
"aria-selected": s,
|
|
56
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ m("li", { children: t.label })
|
|
57
62
|
}, t.value);
|
|
58
63
|
})] }, n);
|
|
59
64
|
}) : G.map((t, n) => {
|
|
60
65
|
let r = e++;
|
|
61
|
-
if (t.type === "separator") return /* @__PURE__ */
|
|
62
|
-
className:
|
|
66
|
+
if (t.type === "separator") return /* @__PURE__ */ m("li", {
|
|
67
|
+
className: p(u.separator, A?.separator),
|
|
63
68
|
role: "presentation"
|
|
64
69
|
}, `sep-${n}`);
|
|
65
|
-
let a = r ===
|
|
66
|
-
return /* @__PURE__ */
|
|
70
|
+
let a = r === B, o = W === t.value, s = `wim-select-option-${M}-${t.value}`;
|
|
71
|
+
return /* @__PURE__ */ m(i, {
|
|
67
72
|
asChild: !0,
|
|
68
73
|
id: s,
|
|
69
74
|
ref: (e) => {
|
|
@@ -71,109 +76,111 @@ var m = u(({ options: u = [], value: m, onChange: h, placeholder: g, label: _, e
|
|
|
71
76
|
},
|
|
72
77
|
active: a,
|
|
73
78
|
disabled: t.disabled,
|
|
74
|
-
className:
|
|
79
|
+
className: p(u.option, o && u.selected, A?.option),
|
|
75
80
|
onClick: (e) => {
|
|
76
81
|
e.stopPropagation(), J(t);
|
|
77
82
|
},
|
|
78
|
-
onMouseEnter: () =>
|
|
83
|
+
onMouseEnter: () => V(r),
|
|
79
84
|
role: "option",
|
|
80
85
|
"aria-selected": o,
|
|
81
|
-
children: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ m("li", { children: t.label })
|
|
82
87
|
}, t.value);
|
|
83
88
|
});
|
|
84
|
-
}, Z = q && q.type !== "separator" ? `wim-select-option-${M}-${q.value}` : void 0, { "aria-label": Q, "aria-labelledby": $, "aria-describedby":
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
-
label:
|
|
87
|
-
error:
|
|
88
|
-
required:
|
|
89
|
-
layout:
|
|
89
|
+
}, Z = q && q.type !== "separator" ? `wim-select-option-${M}-${q.value}` : void 0, { "aria-label": Q, "aria-labelledby": $, "aria-describedby": Te, ...Ee } = de;
|
|
90
|
+
return /* @__PURE__ */ m(c, {
|
|
91
|
+
label: v,
|
|
92
|
+
error: y,
|
|
93
|
+
required: b,
|
|
94
|
+
layout: ie,
|
|
90
95
|
labelId: N,
|
|
91
96
|
htmlFor: I,
|
|
92
97
|
errorId: P,
|
|
93
|
-
className:
|
|
94
|
-
children: /* @__PURE__ */
|
|
95
|
-
className:
|
|
96
|
-
ref:
|
|
97
|
-
onMouseMove: () =>
|
|
98
|
-
"data-keyboard-nav":
|
|
99
|
-
...
|
|
98
|
+
className: ae,
|
|
99
|
+
children: /* @__PURE__ */ h(le ? e : "div", {
|
|
100
|
+
className: p("wim-select", u.root, D && u.fullWidth, A?.root),
|
|
101
|
+
ref: Ce,
|
|
102
|
+
onMouseMove: () => ge(!1),
|
|
103
|
+
"data-keyboard-nav": he,
|
|
104
|
+
...Ee,
|
|
100
105
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
disabled:
|
|
103
|
-
allowClear:
|
|
106
|
+
/* @__PURE__ */ m(a, {
|
|
107
|
+
disabled: x,
|
|
108
|
+
allowClear: E,
|
|
104
109
|
hasValue: !!W,
|
|
105
|
-
onClear:
|
|
110
|
+
onClear: be,
|
|
106
111
|
intent: L,
|
|
107
112
|
rightIcons: [{
|
|
108
113
|
name: "ChevronDownIcon",
|
|
109
114
|
rotated: R
|
|
110
115
|
}],
|
|
111
|
-
width:
|
|
112
|
-
fullWidth:
|
|
113
|
-
styles:
|
|
114
|
-
children: /* @__PURE__ */
|
|
116
|
+
width: k,
|
|
117
|
+
fullWidth: D,
|
|
118
|
+
styles: A?.inputBase,
|
|
119
|
+
children: /* @__PURE__ */ m("div", {
|
|
115
120
|
id: I,
|
|
116
|
-
className:
|
|
117
|
-
onClick:
|
|
121
|
+
className: p(u.trigger, R && u.open, x && u.disabled, A?.trigger),
|
|
122
|
+
onClick: ye,
|
|
118
123
|
onKeyDown: Y,
|
|
119
|
-
tabIndex:
|
|
124
|
+
tabIndex: x ? -1 : 0,
|
|
120
125
|
role: "combobox",
|
|
121
126
|
"aria-expanded": R,
|
|
122
127
|
"aria-haspopup": "listbox",
|
|
123
128
|
"aria-controls": R ? F : void 0,
|
|
124
|
-
"aria-disabled":
|
|
129
|
+
"aria-disabled": x,
|
|
125
130
|
"aria-labelledby": N || $,
|
|
126
|
-
"aria-label":
|
|
127
|
-
"aria-describedby": P ||
|
|
128
|
-
"aria-required":
|
|
131
|
+
"aria-label": v ? void 0 : typeof Q == "string" ? Q : typeof _ == "string" ? _ : void 0,
|
|
132
|
+
"aria-describedby": P || Te,
|
|
133
|
+
"aria-required": b ? "true" : void 0,
|
|
129
134
|
"aria-invalid": L === "danger" ? "true" : "false",
|
|
130
135
|
"aria-activedescendant": R ? Z : void 0,
|
|
131
|
-
ref:
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
className:
|
|
134
|
-
children: K ? K.label :
|
|
136
|
+
ref: _e,
|
|
137
|
+
children: /* @__PURE__ */ m("div", {
|
|
138
|
+
className: p(u.value, !K && u.placeholder, A?.value),
|
|
139
|
+
children: K ? K.label : _
|
|
135
140
|
})
|
|
136
141
|
})
|
|
137
142
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
show: R && !
|
|
143
|
+
/* @__PURE__ */ h(r, {
|
|
144
|
+
show: R && !x,
|
|
140
145
|
preset: "fade",
|
|
141
|
-
className:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
className: p(u.dropdown, A?.dropdown),
|
|
147
|
+
ref: xe,
|
|
148
|
+
...Se,
|
|
149
|
+
children: [S && /* @__PURE__ */ m("div", {
|
|
150
|
+
className: p(u.search, A?.search),
|
|
151
|
+
children: /* @__PURE__ */ m("input", {
|
|
152
|
+
ref: ve,
|
|
146
153
|
type: "text",
|
|
147
|
-
className:
|
|
148
|
-
placeholder:
|
|
154
|
+
className: p(u.searchInput, A?.searchInput),
|
|
155
|
+
placeholder: C,
|
|
149
156
|
value: z,
|
|
150
157
|
onChange: (e) => {
|
|
151
|
-
|
|
158
|
+
me(e.target.value), V(-1);
|
|
152
159
|
},
|
|
153
160
|
onClick: (e) => e.stopPropagation(),
|
|
154
161
|
onKeyDown: Y,
|
|
155
|
-
"aria-label":
|
|
162
|
+
"aria-label": C,
|
|
156
163
|
"aria-controls": F,
|
|
157
164
|
"aria-activedescendant": Z
|
|
158
165
|
})
|
|
159
|
-
}), /* @__PURE__ */
|
|
166
|
+
}), /* @__PURE__ */ m("ul", {
|
|
160
167
|
id: F,
|
|
161
|
-
className:
|
|
168
|
+
className: p(u.list, A?.list),
|
|
162
169
|
role: "listbox",
|
|
163
|
-
"aria-labelledby":
|
|
164
|
-
children: G.length === 0 ? /* @__PURE__ */
|
|
165
|
-
className:
|
|
170
|
+
"aria-labelledby": v ? N : $ || void 0,
|
|
171
|
+
children: G.length === 0 ? /* @__PURE__ */ m("li", {
|
|
172
|
+
className: p(u.empty, A?.empty),
|
|
166
173
|
role: "option",
|
|
167
174
|
"aria-selected": "false",
|
|
168
|
-
children:
|
|
169
|
-
}) :
|
|
175
|
+
children: O ?? fe("select.no_options")
|
|
176
|
+
}) : we()
|
|
170
177
|
})]
|
|
171
178
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ m(t, { children: ue })
|
|
173
180
|
]
|
|
174
181
|
})
|
|
175
182
|
});
|
|
176
183
|
});
|
|
177
|
-
|
|
184
|
+
g.displayName = "Select";
|
|
178
185
|
//#endregion
|
|
179
|
-
export {
|
|
186
|
+
export { g as Select, g as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_root_wjf5o_23`,t=`_fullWidth_wjf5o_37`,n=`_trigger_wjf5o_41`,r=`_disabled_wjf5o_61`,i=`_open_wjf5o_83`,a=`_value_wjf5o_91`,o=`_placeholder_wjf5o_92`,s=`_icon_wjf5o_95`,c=`_icons_wjf5o_108`,l=`_clear_wjf5o_120`,u=`_dropdown_wjf5o_136`,d=`_search_wjf5o_156`,f=`_searchInput_wjf5o_160`,p=`_list_wjf5o_189`,m=`_groupLabel_wjf5o_196`,h=`_option_wjf5o_214`,g=`_selected_wjf5o_214`,_=`_empty_wjf5o_223`,v=`_separator_wjf5o_230`,y=`_native_wjf5o_238`,b=`_nativeWrapper_wjf5o_238`,x=`_select_wjf5o_214`,S={root:e,fullWidth:t,trigger:n,disabled:r,open:i,value:a,placeholder:o,icon:s,icons:c,clear:l,dropdown:u,search:d,searchInput:f,list:p,groupLabel:m,option:h,selected:g,empty:_,separator:v,native:y,nativeWrapper:b,select:x};exports.clear=l,exports.default=S,exports.disabled=r,exports.dropdown=u,exports.empty=_,exports.fullWidth=t,exports.groupLabel=m,exports.icon=s,exports.icons=c,exports.list=p,exports.native=y,exports.nativeWrapper=b,exports.open=i,exports.option=h,exports.placeholder=o,exports.root=e,exports.search=d,exports.searchInput=f,exports.select=x,exports.selected=g,exports.separator=v,exports.trigger=n,exports.value=a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/form/Select/select.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_root_wjf5o_23", t = "_fullWidth_wjf5o_37", n = "_trigger_wjf5o_41", r = "_disabled_wjf5o_61", i = "_open_wjf5o_83", a = "_value_wjf5o_91", o = "_placeholder_wjf5o_92", s = "_icon_wjf5o_95", c = "_icons_wjf5o_108", l = "_clear_wjf5o_120", u = "_dropdown_wjf5o_136", d = "_search_wjf5o_156", f = "_searchInput_wjf5o_160", p = "_list_wjf5o_189", m = "_groupLabel_wjf5o_196", h = "_option_wjf5o_214", g = "_selected_wjf5o_214", _ = "_empty_wjf5o_223", v = "_separator_wjf5o_230", y = "_native_wjf5o_238", b = "_nativeWrapper_wjf5o_238", x = "_select_wjf5o_214", S = {
|
|
4
4
|
root: e,
|
|
5
5
|
fullWidth: t,
|
|
6
6
|
trigger: n,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../media/Icon/Icon.cjs"),n=require("../Button/Button.cjs"),r=require("../../overlay/Dropdown/Dropdown.cjs"),i=require("./split-button.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(({children:e,onClick:a,actions:c,variant:l=`solid`,intent:u=`default`,size:d=`md`,disabled:f=!1,loading:p=!1,toggleLabel:m,className:h,...g},_)=>(0,s.jsxs)(`div`,{ref:_,className:(0,o.default)(`wim-split-button`,i.default.root,i.default[d],i.default[l],h),...g,children:[(0,s.jsx)(n.Button,{className:i.default.main,variant:l,intent:u,size:d,disabled:f,loading:p,onClick:a,children:e}),(0,s.jsxs)(r.Dropdown,{children:[(0,s.jsx)(r.DropdownTrigger,{asChild:!0,children:(0,s.jsx)(n.Button,{className:i.default.toggle,variant:l,intent:u,size:d,disabled:f,"aria-label":m,children:(0,s.jsx)(t.Icon,{name:`ChevronDownIcon`,className:i.default.chevron})})}),(0,s.jsx)(r.DropdownMenu,{children:c.map((e,t)=>(0,s.jsxs)(r.DropdownItem,{disabled:e.disabled,onClick:e.onSelect,children:[e.icon&&(0,s.jsx)(`span`,{className:i.default.itemIcon,children:e.icon}),e.label]},t))})]})]}));c.displayName=`SplitButton`,exports.SplitButton=c;
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../media/Icon/Icon.cjs"),n=require("../Button/Button.cjs"),r=require("../../overlay/Dropdown/Dropdown.cjs"),i=require("./split-button.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(({children:e,onClick:a,actions:c,variant:l=`solid`,intent:u=`default`,size:d=`md`,disabled:f=!1,loading:p=!1,toggleLabel:m,className:h,...g},_)=>{let v=g.role??(g[`aria-label`]||g[`aria-labelledby`]?`group`:void 0);return(0,s.jsxs)(`div`,{ref:_,role:v,className:(0,o.default)(`wim-split-button`,i.default.root,i.default[d],i.default[l],h),...g,children:[(0,s.jsx)(n.Button,{className:i.default.main,variant:l,intent:u,size:d,disabled:f,loading:p,onClick:a,children:e}),(0,s.jsxs)(r.Dropdown,{children:[(0,s.jsx)(r.DropdownTrigger,{asChild:!0,children:(0,s.jsx)(n.Button,{className:i.default.toggle,variant:l,intent:u,size:d,disabled:f,"aria-label":m,children:(0,s.jsx)(t.Icon,{name:`ChevronDownIcon`,className:i.default.chevron})})}),(0,s.jsx)(r.DropdownMenu,{children:c.map((e,t)=>(0,s.jsxs)(r.DropdownItem,{disabled:e.disabled,onClick:e.onSelect,children:[e.icon&&(0,s.jsx)(`span`,{className:i.default.itemIcon,children:e.icon}),e.label]},t))})]})]})});c.displayName=`SplitButton`,exports.SplitButton=c;
|
|
@@ -7,42 +7,46 @@ import s from "react";
|
|
|
7
7
|
import c from "classnames";
|
|
8
8
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/form/SplitButton/SplitButton.tsx
|
|
10
|
-
var d = s.forwardRef(({ children: s, onClick: d, actions: f, variant: p = "solid", intent: m = "default", size: h = "md", disabled: g = !1, loading: _ = !1, toggleLabel: v, className: y, ...b }, x) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: o.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
disabled: g,
|
|
20
|
-
loading: _,
|
|
21
|
-
onClick: d,
|
|
22
|
-
children: s
|
|
23
|
-
}), /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
|
|
24
|
-
asChild: !0,
|
|
25
|
-
children: /* @__PURE__ */ l(t, {
|
|
26
|
-
className: o.toggle,
|
|
10
|
+
var d = s.forwardRef(({ children: s, onClick: d, actions: f, variant: p = "solid", intent: m = "default", size: h = "md", disabled: g = !1, loading: _ = !1, toggleLabel: v, className: y, ...b }, x) => {
|
|
11
|
+
let S = b.role ?? (b["aria-label"] || b["aria-labelledby"] ? "group" : void 0);
|
|
12
|
+
return /* @__PURE__ */ u("div", {
|
|
13
|
+
ref: x,
|
|
14
|
+
role: S,
|
|
15
|
+
className: c("wim-split-button", o.root, o[h], o[p], y),
|
|
16
|
+
...b,
|
|
17
|
+
children: [/* @__PURE__ */ l(t, {
|
|
18
|
+
className: o.main,
|
|
27
19
|
variant: p,
|
|
28
20
|
intent: m,
|
|
29
21
|
size: h,
|
|
30
22
|
disabled: g,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
loading: _,
|
|
24
|
+
onClick: d,
|
|
25
|
+
children: s
|
|
26
|
+
}), /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
|
|
27
|
+
asChild: !0,
|
|
28
|
+
children: /* @__PURE__ */ l(t, {
|
|
29
|
+
className: o.toggle,
|
|
30
|
+
variant: p,
|
|
31
|
+
intent: m,
|
|
32
|
+
size: h,
|
|
33
|
+
disabled: g,
|
|
34
|
+
"aria-label": v,
|
|
35
|
+
children: /* @__PURE__ */ l(e, {
|
|
36
|
+
name: "ChevronDownIcon",
|
|
37
|
+
className: o.chevron
|
|
38
|
+
})
|
|
35
39
|
})
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
})
|
|
40
|
+
}), /* @__PURE__ */ l(i, { children: f.map((e, t) => /* @__PURE__ */ u(r, {
|
|
41
|
+
disabled: e.disabled,
|
|
42
|
+
onClick: e.onSelect,
|
|
43
|
+
children: [e.icon && /* @__PURE__ */ l("span", {
|
|
44
|
+
className: o.itemIcon,
|
|
45
|
+
children: e.icon
|
|
46
|
+
}), e.label]
|
|
47
|
+
}, t)) })] })]
|
|
48
|
+
});
|
|
49
|
+
});
|
|
46
50
|
d.displayName = "SplitButton";
|
|
47
51
|
//#endregion
|
|
48
52
|
export { d as SplitButton };
|
|
@@ -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("../../../hooks/useMergedRef.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("../../layout/Transition/Transition.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),ee=require("../InputBase/InputBase.cjs"),a=require("../../_internal/useInlineFloating.cjs"),o=require("../FieldTemplate/FieldTemplate.cjs"),s=require("../../data-display/TreeView/TreeView.cjs"),c=require("./tree-select.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");function f(e){return e.map(e=>({value:e.value,label:e.label,disabled:e.disabled,icon:e.icon,children:e.children?f(e.children):void 0}))}var p=(0,l.forwardRef)(({treeData:e=[],value:p,onChange:m,placeholder:h,label:g,error:_,required:v,layout:y,className:b,disabled:x=!1,multiple:S=!1,searchable:C=!1,defaultExpandedKeys:w=[],allowClear:T=!1,checkStrategy:E=`cascade`,id:D,width:O,fullWidth:k=!1,asChild:A=!1,children:te,...ne},re)=>{let ie=(0,l.useId)(),j=D||`wim-tree-select-${ie}`,M=g?`${j}-label`:void 0,N=_?`${j}-error`:void 0,P=`${j}-trigger`,F=`${j}-dropdown`,[I,L]=(0,l.useState)(!1),[R,z]=(0,l.useState)(S?[]:``),B=(0,l.useRef)(null),V=(0,l.useRef)(null),H=p!==void 0,U=H?p:R;(0,l.useEffect)(()=>{let e=e=>{B.current&&!B.current.contains(e.target)&&L(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,l.useEffect)(()=>{if(I){let e=setTimeout(()=>{let e=B.current?.querySelector(`[data-testid="tree-view-search-input"]`);e?e.focus():(B.current?.querySelector(`[data-testid="tree-view-root"]`))?.focus()},100);return()=>clearTimeout(e)}},[I]);let W=()=>{if(!x){let e=!I;L(e),e||V.current?.focus()}},G=e=>{if(!x){if(!I){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),L(!0));return}e.key===`Escape`&&(e.preventDefault(),L(!1),V.current?.focus())}},K=(0,l.useMemo)(()=>{let t={},n=e=>{e.forEach(e=>{t[e.value]=e,e.children&&n(e.children)})};return n(e),t},[e]),q=()=>{if(S){let e=Array.isArray(U)?U:[];return e.length===0?null:e.map(e=>K[e]?K[e].label:e).reduce((e,t)=>[e,`, `,t])}{let e=U;return e?K[e]?K[e].label:e:null}},J=e=>{let t;S?t=e:(t=e[0]||``,L(!1),V.current?.focus()),H||z(t),m&&m(t)},ae=()=>{if(x)return;let e=S?[]:``;H||z(e),m&&m(e)},oe=(0,l.useMemo)(()=>f(e),[e]),Y=(0,l.useMemo)(()=>S?Array.isArray(U)?U:[]:U?[U]:[],[U,S]),X=q(),{"aria-label":Z,"aria-labelledby":Q,"aria-describedby":se,...ce}=ne,$=typeof h==`string`?h:`Select`,le=A?t.Root:`div`,{setReference:ue,setFloating:de,floatingProps:fe}=a.useInlineFloating({open:I&&!x}),pe=n.useMergedRef(B,re,ue);return(0,d.jsx)(o.FieldTemplate,{label:g,error:_,required:v,layout:y,labelId:M,errorId:N,className:(0,u.default)(c.default.container,b),children:(0,d.jsxs)(le,{className:(0,u.default)(`wim-tree-select`,c.default.root,k&&c.default.fullWidth),ref:pe,...ce,children:[(0,d.jsx)(t.Slottable,{children:te}),(0,d.jsx)(ee.InputBase,{disabled:x,allowClear:T,hasValue:!!X,onClear:ae,intent:_?`danger`:`default`,width:O,fullWidth:k,rightIcons:[{name:`ChevronDownIcon`,rotated:I,onClick:W,decorative:!0}],className:(0,u.default)(I&&c.default.open),children:(0,d.jsx)(`div`,{id:P,className:(0,u.default)(c.default.trigger,x&&c.default.disabled),onClick:W,onKeyDown:G,tabIndex:x?-1:0,role:`combobox`,"aria-expanded":I,"aria-haspopup":`tree`,"aria-controls":I?F:void 0,"aria-disabled":x,"aria-labelledby":M||Q,"aria-label":g?void 0:Z||$,"aria-describedby":N||se,"aria-required":v,"aria-invalid":!!_,ref:V,children:(0,d.jsx)(`div`,{className:(0,u.default)(c.default.value,!X&&c.default.placeholder),children:X||h})})}),(0,d.jsx)(r.Transition,{show:I&&!x,preset:`fade`,className:c.default.dropdown,ref:de,...fe,children:(0,d.jsx)(`div`,{id:F,children:(0,d.jsx)(i.FocusTrap,{active:I,initialFocus:!1,children:(0,d.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":M||Q,"aria-label":g?void 0:Z||$,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),L(!1),V.current?.focus())},children:(0,d.jsx)(s.TreeView,{multiSelect:S,defaultSelectedValues:Y,defaultCheckedValues:S?Y:[],nodes:oe,onCheckedChange:J,onSelectedChange:J,checkable:S,checkStrategy:E,searchable:C,defaultExpandedValues:w,styles:{root:c.default.treeView,item:c.default.treeViewItem,search:c.default.treeViewSearch}})})})})})]})})});p.displayName=`TreeSelect`,exports.TreeSelect=p;
|