wimui 0.68.0 → 0.69.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/useAnnounce.cjs +2 -0
- package/dist/components/_internal/useAnnounce.d.ts +39 -0
- package/dist/components/_internal/useAnnounce.js +41 -0
- package/dist/components/data-display/AvatarGroup/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup/AvatarGroup.js +4 -4
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +61 -65
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +78 -74
- package/dist/components/data-display/DataGrid/useFixedColumns.cjs +1 -1
- package/dist/components/data-display/DataGrid/useFixedColumns.d.ts +6 -1
- package/dist/components/data-display/DataGrid/useFixedColumns.js +22 -17
- package/dist/components/data-display/SelectionBar/SelectionBar.cjs +2 -0
- package/dist/components/data-display/SelectionBar/SelectionBar.d.ts +77 -0
- package/dist/components/data-display/SelectionBar/SelectionBar.js +68 -0
- package/dist/components/data-display/SelectionBar/selection-bar.module.cjs +2 -0
- package/dist/components/data-display/SelectionBar/selection-bar.module.js +10 -0
- package/dist/components/data-display/Table/table.module.cjs +1 -1
- package/dist/components/data-display/Table/table.module.js +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/feedback/Snackbar/Snackbar.js +8 -9
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.js +60 -71
- package/dist/components/form/Cascader/Cascader.cjs +1 -1
- package/dist/components/form/Cascader/Cascader.js +4 -4
- package/dist/components/form/Combobox/Combobox.cjs +1 -1
- package/dist/components/form/Combobox/Combobox.js +11 -11
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +4 -4
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +13 -18
- package/dist/components/form/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/form/MultiSelect/MultiSelect.js +66 -66
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +114 -114
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.js +84 -88
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +4 -4
- package/dist/components/layout/SimpleGrid/SimpleGrid.cjs +1 -1
- package/dist/components/layout/SimpleGrid/SimpleGrid.js +1 -1
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.d.ts +15 -0
- package/dist/components/layout/Toolbar/Toolbar.js +85 -60
- package/dist/components/layout/Toolbar/toolbar.module.cjs +1 -1
- package/dist/components/layout/Toolbar/toolbar.module.js +8 -6
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.js +46 -47
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +24 -24
- package/dist/components/navigation/Menubar/Menubar.cjs +1 -1
- package/dist/components/navigation/Menubar/Menubar.js +10 -10
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +110 -112
- package/dist/data-display-core.d.ts +1 -0
- package/dist/data-display.cjs +1 -1
- package/dist/data-display.js +2 -1
- package/dist/i18n/generated/components.d.ts +1 -1
- package/dist/i18n/generated/data-display.cjs +1 -1
- package/dist/i18n/generated/data-display.d.ts +1 -1
- package/dist/i18n/generated/data-display.js +21 -3
- package/dist/i18n/generated/keys.d.ts +2 -1
- package/dist/i18n/generated/layout.cjs +2 -0
- package/dist/i18n/generated/layout.d.ts +3 -0
- package/dist/i18n/generated/layout.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +41 -40
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +3 -3
- package/dist/llms-full.txt +22 -1
- package/dist/llms.txt +2 -1
- package/dist/locales/en/components.json +2 -1
- package/dist/locales/en/data-display.json +6 -0
- package/dist/locales/ja/components.json +2 -1
- package/dist/locales/ja/data-display.json +6 -0
- package/dist/locales/pt/components.json +2 -1
- package/dist/locales/pt/data-display.json +6 -0
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +11 -8
|
@@ -2,113 +2,113 @@
|
|
|
2
2
|
import { useMergedRef as e } from "../../../hooks/useMergedRef.js";
|
|
3
3
|
import t from "../../../icon/check.js";
|
|
4
4
|
import { Icon as n } from "../../media/Icon/Icon.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useInlineFloating as r } from "../../_internal/useInlineFloating.js";
|
|
6
|
+
import { BaseListItem as i } from "../../_internal/BaseListItem/BaseListItem.js";
|
|
7
|
+
import { InputBase as a } from "../InputBase/InputBase.js";
|
|
8
8
|
import { FieldTemplate as o } from "../FieldTemplate/FieldTemplate.js";
|
|
9
9
|
import { Chip as s } from "../../data-display/Chip/Chip.js";
|
|
10
10
|
import c from "./multiselect.module.js";
|
|
11
11
|
import { useEffect as l, useId as u, useRef as d, useState as f } from "react";
|
|
12
12
|
import p from "classnames";
|
|
13
|
-
import { jsx as m, jsxs as
|
|
13
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/form/MultiSelect/MultiSelect.tsx
|
|
15
|
-
var
|
|
16
|
-
let [
|
|
15
|
+
var g = ({ options: g = [], value: _, onChange: v, placeholder: y, label: b, error: x, required: S, layout: C, className: w, disabled: T = !1, defaultValue: ee = [], allowClear: te = !1, id: E, width: D, fullWidth: O = !1, ...k }) => {
|
|
16
|
+
let [A, j] = f(!1), [M, N] = f(ee), [P, F] = f(-1), [ne, I] = f(!1), L = d(null), R = d(null), z = d(null), B = u(), V = E || `wim-multiselect-${B}`, H = `${V}-list`, U = b ? `${V}-label` : void 0, W = x ? `${V}-error` : void 0, G = `${V}-trigger`, K = _ !== void 0, q = K ? _ : M;
|
|
17
17
|
l(() => {
|
|
18
18
|
let e = (e) => {
|
|
19
|
-
L.current && !L.current.contains(e.target) &&
|
|
19
|
+
L.current && !L.current.contains(e.target) && j(!1);
|
|
20
20
|
};
|
|
21
21
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
22
22
|
}, []);
|
|
23
23
|
let J = (e) => {
|
|
24
|
-
if (
|
|
25
|
-
let t = !
|
|
26
|
-
|
|
24
|
+
if (T || e && e.target.closest("[data-chip-delete]")) return;
|
|
25
|
+
let t = !A;
|
|
26
|
+
j(t), F(t ? 0 : -1);
|
|
27
27
|
}, Y = (e) => {
|
|
28
|
-
if (
|
|
28
|
+
if (T) return;
|
|
29
29
|
let t;
|
|
30
|
-
t = q?.includes(e) ? q.filter((t) => t !== e) : [...q || [], e], K ||
|
|
30
|
+
t = q?.includes(e) ? q.filter((t) => t !== e) : [...q || [], e], K || N(t), v && v(t);
|
|
31
31
|
}, X = (e, t) => {
|
|
32
|
-
if (e.stopPropagation(),
|
|
32
|
+
if (e.stopPropagation(), T) return;
|
|
33
33
|
let n = (q || []).filter((e) => e !== t);
|
|
34
|
-
K ||
|
|
34
|
+
K || N(n), v && v(n);
|
|
35
35
|
}, re = (e) => {
|
|
36
|
-
e?.stopPropagation(), !
|
|
37
|
-
}, Z =
|
|
38
|
-
if (I(!0), !
|
|
36
|
+
e?.stopPropagation(), !T && (K || N([]), v && v([]));
|
|
37
|
+
}, Z = g.filter((e) => q?.includes(e.value)), ie = (e) => {
|
|
38
|
+
if (I(!0), !T) switch (e.key) {
|
|
39
39
|
case "ArrowDown":
|
|
40
|
-
e.preventDefault(),
|
|
40
|
+
e.preventDefault(), A ? F((e) => e < g.length - 1 ? e + 1 : 0) : (j(!0), F(0));
|
|
41
41
|
break;
|
|
42
42
|
case "ArrowUp":
|
|
43
|
-
e.preventDefault(),
|
|
43
|
+
e.preventDefault(), A && F((e) => e > 0 ? e - 1 : g.length - 1);
|
|
44
44
|
break;
|
|
45
45
|
case "Enter":
|
|
46
46
|
case " ":
|
|
47
|
-
e.preventDefault(),
|
|
47
|
+
e.preventDefault(), A ? P >= 0 && Y(g[P].value) : (j(!0), F(0));
|
|
48
48
|
break;
|
|
49
49
|
case "Escape":
|
|
50
|
-
|
|
50
|
+
A && (e.preventDefault(), j(!1), F(-1), z.current?.focus());
|
|
51
51
|
break;
|
|
52
52
|
case "Home":
|
|
53
|
-
|
|
53
|
+
A && (e.preventDefault(), F(0));
|
|
54
54
|
break;
|
|
55
55
|
case "End":
|
|
56
|
-
|
|
56
|
+
A && (e.preventDefault(), F(g.length - 1));
|
|
57
57
|
break;
|
|
58
|
-
case "Tab":
|
|
58
|
+
case "Tab": A && (j(!1), F(-1));
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
l(() => {
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
let { "aria-label":
|
|
62
|
+
A && P >= 0 && R.current && R.current.children[P]?.scrollIntoView({ block: "nearest" });
|
|
63
|
+
}, [P, A]);
|
|
64
|
+
let { "aria-label": ae, "aria-labelledby": Q, "aria-describedby": oe, ...$ } = k, { setReference: se, setFloating: ce, floatingProps: le } = r({ open: A && !T }), ue = e(L, se), de = e(R, ce);
|
|
65
65
|
return /* @__PURE__ */ m(o, {
|
|
66
|
-
label:
|
|
67
|
-
error:
|
|
68
|
-
required:
|
|
69
|
-
layout:
|
|
66
|
+
label: b,
|
|
67
|
+
error: x,
|
|
68
|
+
required: S,
|
|
69
|
+
layout: C,
|
|
70
70
|
labelId: U,
|
|
71
71
|
htmlFor: G,
|
|
72
72
|
errorId: W,
|
|
73
|
-
className:
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
className: p("wim-multi-select", c.root,
|
|
73
|
+
className: w,
|
|
74
|
+
children: /* @__PURE__ */ h("div", {
|
|
75
|
+
className: p("wim-multi-select", c.root, O && c.fullWidth),
|
|
76
76
|
ref: ue,
|
|
77
77
|
onMouseMove: () => I(!1),
|
|
78
|
-
"data-keyboard-nav":
|
|
79
|
-
|
|
80
|
-
children: [/* @__PURE__ */ m(
|
|
81
|
-
disabled:
|
|
78
|
+
"data-keyboard-nav": ne,
|
|
79
|
+
...$,
|
|
80
|
+
children: [/* @__PURE__ */ m(a, {
|
|
81
|
+
disabled: T,
|
|
82
82
|
allowClear: te,
|
|
83
83
|
hasValue: q && q.length > 0,
|
|
84
84
|
onClear: re,
|
|
85
|
-
intent:
|
|
86
|
-
width:
|
|
87
|
-
fullWidth:
|
|
85
|
+
intent: x ? "danger" : "default",
|
|
86
|
+
width: D,
|
|
87
|
+
fullWidth: O,
|
|
88
88
|
rightIcons: [{
|
|
89
89
|
name: "ChevronDownIcon",
|
|
90
|
-
rotated:
|
|
90
|
+
rotated: A
|
|
91
91
|
}],
|
|
92
|
-
className: p(
|
|
92
|
+
className: p(A && c.open),
|
|
93
93
|
children: /* @__PURE__ */ m("div", {
|
|
94
94
|
id: G,
|
|
95
95
|
"data-testid": "multiselect-trigger",
|
|
96
|
-
className: p(c.trigger,
|
|
96
|
+
className: p(c.trigger, T && c.disabled),
|
|
97
97
|
onClick: J,
|
|
98
|
-
tabIndex:
|
|
98
|
+
tabIndex: T ? -1 : 0,
|
|
99
99
|
role: "combobox",
|
|
100
|
-
"aria-expanded":
|
|
100
|
+
"aria-expanded": A,
|
|
101
101
|
"aria-haspopup": "listbox",
|
|
102
|
-
"aria-controls":
|
|
103
|
-
"aria-disabled":
|
|
104
|
-
"aria-labelledby": U ||
|
|
105
|
-
"aria-describedby": W ||
|
|
106
|
-
"aria-required":
|
|
107
|
-
"aria-invalid": !!
|
|
108
|
-
"aria-label":
|
|
102
|
+
"aria-controls": A ? H : void 0,
|
|
103
|
+
"aria-disabled": T,
|
|
104
|
+
"aria-labelledby": U || Q,
|
|
105
|
+
"aria-describedby": W || oe,
|
|
106
|
+
"aria-required": S,
|
|
107
|
+
"aria-invalid": !!x,
|
|
108
|
+
"aria-label": b ? void 0 : ae || y,
|
|
109
109
|
onKeyDown: ie,
|
|
110
110
|
ref: z,
|
|
111
|
-
"aria-activedescendant":
|
|
111
|
+
"aria-activedescendant": A && P >= 0 ? `${V}-option-${P}` : void 0,
|
|
112
112
|
children: /* @__PURE__ */ m("div", {
|
|
113
113
|
className: p(c.value, Z.length === 0 && c.placeholder),
|
|
114
114
|
children: Z.length > 0 ? Z.map((e) => /* @__PURE__ */ m(s, {
|
|
@@ -116,30 +116,30 @@ var h = ({ options: h = [], value: g, onChange: _, placeholder: v, label: y, err
|
|
|
116
116
|
size: "sm",
|
|
117
117
|
intent: "neutral",
|
|
118
118
|
variant: "solid",
|
|
119
|
-
disabled:
|
|
120
|
-
onDelete:
|
|
119
|
+
disabled: T,
|
|
120
|
+
onDelete: T ? void 0 : (t) => X(t, e.value),
|
|
121
121
|
children: e.label
|
|
122
|
-
}, e.value)) :
|
|
122
|
+
}, e.value)) : y
|
|
123
123
|
})
|
|
124
124
|
})
|
|
125
|
-
}),
|
|
125
|
+
}), A && !T && /* @__PURE__ */ m("ul", {
|
|
126
126
|
id: H,
|
|
127
127
|
ref: de,
|
|
128
128
|
className: c.list,
|
|
129
129
|
...le,
|
|
130
130
|
role: "listbox",
|
|
131
131
|
"aria-multiselectable": "true",
|
|
132
|
-
"aria-labelledby": U ||
|
|
133
|
-
children:
|
|
134
|
-
let a = q?.includes(e.value), o =
|
|
135
|
-
return /* @__PURE__ */ m(
|
|
132
|
+
"aria-labelledby": U || Q || void 0,
|
|
133
|
+
children: g.map((e, r) => {
|
|
134
|
+
let a = q?.includes(e.value), o = r === P;
|
|
135
|
+
return /* @__PURE__ */ m(i, {
|
|
136
136
|
asChild: !0,
|
|
137
|
-
id: `${V}-option-${
|
|
137
|
+
id: `${V}-option-${r}`,
|
|
138
138
|
className: p(c.option, a && c.selected),
|
|
139
139
|
active: o,
|
|
140
140
|
disabled: e.disabled,
|
|
141
141
|
onClick: () => !e.disabled && Y(e.value),
|
|
142
|
-
onMouseEnter: () =>
|
|
142
|
+
onMouseEnter: () => F(r),
|
|
143
143
|
rightSection: a ? /* @__PURE__ */ m(n, {
|
|
144
144
|
component: t,
|
|
145
145
|
size: "sm"
|
|
@@ -154,6 +154,6 @@ var h = ({ options: h = [], value: g, onChange: _, placeholder: v, label: y, err
|
|
|
154
154
|
})
|
|
155
155
|
});
|
|
156
156
|
};
|
|
157
|
-
|
|
157
|
+
g.displayName = "MultiSelect";
|
|
158
158
|
//#endregion
|
|
159
|
-
export {
|
|
159
|
+
export { g as MultiSelect };
|
|
@@ -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/
|
|
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/useInlineFloating.cjs"),a=require("../../_internal/BaseListItem/BaseListItem.cjs"),o=require("../InputBase/InputBase.cjs"),s=require("../../../i18n/generated/form.cjs"),c=require("../FieldTemplate/FieldTemplate.cjs"),l=require("../../_internal/mergeRefs.cjs"),u=require("./select.module.cjs"),d=require("./useSelect.cjs"),ee=require("../../_internal/VisualUppercase.cjs");let f=require("react");f=e.__toESM(f,1);let p=require("classnames");p=e.__toESM(p,1);let m=require("react/jsx-runtime");var h=(0,f.forwardRef)(({options:e=[],value:h,onChange:te,placeholder:g,label:_,error:v,required:y,layout:ne,className:b,disabled:x=!1,defaultValue:re,searchable:S=!1,searchPlaceholder:C,filterOption:w,grouped:T=!1,allowClear:ie=!1,fullWidth:E=!1,intent:ae=`default`,id:oe,noOptionsFoundLabel:se,width:ce,styles:D,asChild:O=!1,children:le,...ue},k)=>{let{t:de}=n.useWimTranslation(s.formNs),fe=(0,f.useId)(),A=oe||`wim-select-${fe}`,j=_?`${A}-label`:void 0,M=v?`${A}-error`:void 0,N=`${A}-list`,P=`${A}-trigger`,F=v?`danger`:ae,{isOpen:I,searchValue:L,setSearchValue:R,focusedIndex:z,setFocusedIndex:B,isKeyboardNavigating:pe,setIsKeyboardNavigating:me,containerRef:V,triggerRef:he,searchInputRef:ge,listItemsRef:H,currentValue:U,filteredOptions:W,selectedOption:G,focusedOption:K,handleToggle:_e,handleSelect:q,handleClear:ve,handleKeyDown:J}=d.useSelect({options:e,value:h,onChange:te,defaultValue:re,searchable:S,grouped:T,disabled:x,filterOption:w}),{setReference:Y,setFloating:X,floatingProps:ye}=i.useInlineFloating({open:I&&!x}),be=(0,f.useMemo)(()=>l.mergeRefs(V,k,Y),[V,k,Y]),xe=()=>{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,m.jsxs)(f.default.Fragment,{children:[(0,m.jsx)(`li`,{className:(0,p.default)(u.default.groupLabel,D?.groupLabel),role:`presentation`,children:(0,m.jsx)(ee.VisualUppercase,{children:e.label})}),r.map((e,r)=>{let i=t++;if(e.type===`separator`)return(0,m.jsx)(`li`,{className:(0,p.default)(u.default.separator,D?.separator),role:`presentation`},`sep-${n}-${r}`);let o=i===z,s=U===e.value,c=`wim-select-option-${A}-${e.value}`;return(0,m.jsx)(a.BaseListItem,{asChild:!0,id:c,ref:e=>{H.current[i]=e},active:o,disabled:e.disabled,className:(0,p.default)(u.default.option,s&&u.default.selected,D?.option),onClick:t=>{t.stopPropagation(),q(e)},onMouseEnter:()=>B(i),role:`option`,"aria-selected":s,children:(0,m.jsx)(`li`,{children:e.label})},e.value)})]},n)}):W.map((e,n)=>{let r=t++;if(e.type===`separator`)return(0,m.jsx)(`li`,{className:(0,p.default)(u.default.separator,D?.separator),role:`presentation`},`sep-${n}`);let i=r===z,o=U===e.value,s=`wim-select-option-${A}-${e.value}`;return(0,m.jsx)(a.BaseListItem,{asChild:!0,id:s,ref:e=>{H.current[r]=e},active:i,disabled:e.disabled,className:(0,p.default)(u.default.option,o&&u.default.selected,D?.option),onClick:t=>{t.stopPropagation(),q(e)},onMouseEnter:()=>B(r),role:`option`,"aria-selected":o,children:(0,m.jsx)(`li`,{children:e.label})},e.value)})},Z=K&&K.type!==`separator`?`wim-select-option-${A}-${K.value}`:void 0,{"aria-label":Q,"aria-labelledby":$,"aria-describedby":Se,...Ce}=ue;return(0,m.jsx)(c.FieldTemplate,{label:_,error:v,required:y,layout:ne,labelId:j,htmlFor:P,errorId:M,className:b,children:(0,m.jsxs)(O?t.Root:`div`,{className:(0,p.default)(`wim-select`,u.default.root,E&&u.default.fullWidth,D?.root),ref:be,onMouseMove:()=>me(!1),"data-keyboard-nav":pe,...Ce,children:[(0,m.jsx)(o.InputBase,{disabled:x,allowClear:ie,hasValue:!!U,onClear:ve,intent:F,rightIcons:[{name:`ChevronDownIcon`,rotated:I}],width:ce,fullWidth:E,styles:D?.inputBase,children:(0,m.jsx)(`div`,{id:P,className:(0,p.default)(u.default.trigger,I&&u.default.open,x&&u.default.disabled,D?.trigger),onClick:_e,onKeyDown:J,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":_?void 0:typeof Q==`string`?Q:typeof g==`string`?g:void 0,"aria-describedby":M||Se,"aria-required":y?`true`:void 0,"aria-invalid":F===`danger`?`true`:`false`,"aria-activedescendant":I?Z:void 0,ref:he,children:(0,m.jsx)(`div`,{className:(0,p.default)(u.default.value,!G&&u.default.placeholder,D?.value),children:G?G.label:g})})}),(0,m.jsxs)(r.Transition,{show:I&&!x,preset:`fade`,className:(0,p.default)(u.default.dropdown,D?.dropdown),ref:X,...ye,children:[S&&(0,m.jsx)(`div`,{className:(0,p.default)(u.default.search,D?.search),children:(0,m.jsx)(`input`,{ref:ge,type:`text`,className:(0,p.default)(u.default.searchInput,D?.searchInput),placeholder:C,value:L,onChange:e=>{R(e.target.value),B(-1)},onClick:e=>e.stopPropagation(),onKeyDown:J,"aria-label":C,"aria-controls":N,"aria-activedescendant":Z})}),(0,m.jsx)(`ul`,{id:N,className:(0,p.default)(u.default.list,D?.list),role:`listbox`,"aria-labelledby":_?j:$||void 0,children:W.length===0?(0,m.jsx)(`li`,{className:(0,p.default)(u.default.empty,D?.empty),role:`option`,"aria-selected":`false`,children:se??de(`select.no_options`)}):xe()})]}),(0,m.jsx)(t.Slottable,{children:le})]})})});h.displayName=`Select`,exports.Select=h,exports.default=h;
|
|
@@ -2,186 +2,186 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useInlineFloating as i } from "../../_internal/useInlineFloating.js";
|
|
6
|
+
import { BaseListItem as a } from "../../_internal/BaseListItem/BaseListItem.js";
|
|
7
|
+
import { InputBase as o } from "../InputBase/InputBase.js";
|
|
8
8
|
import { formNs as s } from "../../../i18n/generated/form.js";
|
|
9
9
|
import { FieldTemplate as c } from "../FieldTemplate/FieldTemplate.js";
|
|
10
|
-
import { mergeRefs as
|
|
11
|
-
import
|
|
12
|
-
import { useSelect as
|
|
13
|
-
import { VisualUppercase as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { jsx as
|
|
10
|
+
import { mergeRefs as l } from "../../_internal/mergeRefs.js";
|
|
11
|
+
import u from "./select.module.js";
|
|
12
|
+
import { useSelect as ee } from "./useSelect.js";
|
|
13
|
+
import { VisualUppercase as d } from "../../_internal/VisualUppercase.js";
|
|
14
|
+
import te, { forwardRef as f, useId as ne, useMemo as re } from "react";
|
|
15
|
+
import p from "classnames";
|
|
16
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
17
17
|
//#region src/components/form/Select/Select.tsx
|
|
18
|
-
var
|
|
19
|
-
let { t:
|
|
20
|
-
options:
|
|
21
|
-
value:
|
|
22
|
-
onChange:
|
|
23
|
-
defaultValue:
|
|
24
|
-
searchable:
|
|
25
|
-
grouped:
|
|
26
|
-
disabled:
|
|
27
|
-
filterOption:
|
|
28
|
-
}), { setReference: X, setFloating: Se, floatingProps: Ce } =
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
var g = f(({ options: f = [], value: g, onChange: ie, placeholder: _, label: v, error: y, required: b, layout: x, className: S, disabled: C = !1, defaultValue: ae, searchable: w = !1, searchPlaceholder: T, filterOption: E, grouped: D = !1, allowClear: O = !1, fullWidth: k = !1, intent: oe = "default", id: se, noOptionsFoundLabel: ce, width: le, styles: A, asChild: ue = !1, children: de, ...fe }, j) => {
|
|
19
|
+
let { t: pe } = n(s), me = ne(), M = se || `wim-select-${me}`, N = v ? `${M}-label` : void 0, P = y ? `${M}-error` : void 0, F = `${M}-list`, I = `${M}-trigger`, L = y ? "danger" : oe, { isOpen: R, searchValue: z, setSearchValue: he, focusedIndex: B, setFocusedIndex: V, isKeyboardNavigating: ge, setIsKeyboardNavigating: _e, containerRef: H, triggerRef: ve, searchInputRef: ye, listItemsRef: U, currentValue: W, filteredOptions: G, selectedOption: K, focusedOption: q, handleToggle: be, handleSelect: J, handleClear: xe, handleKeyDown: Y } = ee({
|
|
20
|
+
options: f,
|
|
21
|
+
value: g,
|
|
22
|
+
onChange: ie,
|
|
23
|
+
defaultValue: ae,
|
|
24
|
+
searchable: w,
|
|
25
|
+
grouped: D,
|
|
26
|
+
disabled: C,
|
|
27
|
+
filterOption: E
|
|
28
|
+
}), { setReference: X, setFloating: Se, floatingProps: Ce } = i({ open: R && !C }), we = re(() => l(H, j, X), [
|
|
29
|
+
H,
|
|
30
|
+
j,
|
|
31
31
|
X
|
|
32
32
|
]), Te = () => {
|
|
33
33
|
let e = 0;
|
|
34
|
-
return
|
|
35
|
-
let r = t.options.filter((e) => e.type === "separator" || !
|
|
36
|
-
return r.length === 0 ? null : /* @__PURE__ */
|
|
37
|
-
className:
|
|
34
|
+
return D && f.length > 0 && "options" in f[0] ? f.map((t, n) => {
|
|
35
|
+
let r = t.options.filter((e) => e.type === "separator" || !z || (E || ((e, t) => (typeof e.label == "string" ? e.label : "").toLowerCase().includes(t.toLowerCase())))(e, z));
|
|
36
|
+
return r.length === 0 ? null : /* @__PURE__ */ h(te.Fragment, { children: [/* @__PURE__ */ m("li", {
|
|
37
|
+
className: p(u.groupLabel, A?.groupLabel),
|
|
38
38
|
role: "presentation",
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ m(d, { children: t.label })
|
|
40
40
|
}), r.map((t, r) => {
|
|
41
|
-
let
|
|
42
|
-
if (t.type === "separator") return /* @__PURE__ */
|
|
43
|
-
className:
|
|
41
|
+
let i = e++;
|
|
42
|
+
if (t.type === "separator") return /* @__PURE__ */ m("li", {
|
|
43
|
+
className: p(u.separator, A?.separator),
|
|
44
44
|
role: "presentation"
|
|
45
45
|
}, `sep-${n}-${r}`);
|
|
46
|
-
let o =
|
|
47
|
-
return /* @__PURE__ */
|
|
46
|
+
let o = i === B, s = W === t.value, c = `wim-select-option-${M}-${t.value}`;
|
|
47
|
+
return /* @__PURE__ */ m(a, {
|
|
48
48
|
asChild: !0,
|
|
49
49
|
id: c,
|
|
50
50
|
ref: (e) => {
|
|
51
|
-
|
|
51
|
+
U.current[i] = e;
|
|
52
52
|
},
|
|
53
53
|
active: o,
|
|
54
54
|
disabled: t.disabled,
|
|
55
|
-
className:
|
|
55
|
+
className: p(u.option, s && u.selected, A?.option),
|
|
56
56
|
onClick: (e) => {
|
|
57
|
-
e.stopPropagation(),
|
|
57
|
+
e.stopPropagation(), J(t);
|
|
58
58
|
},
|
|
59
|
-
onMouseEnter: () =>
|
|
59
|
+
onMouseEnter: () => V(i),
|
|
60
60
|
role: "option",
|
|
61
61
|
"aria-selected": s,
|
|
62
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ m("li", { children: t.label })
|
|
63
63
|
}, t.value);
|
|
64
64
|
})] }, n);
|
|
65
|
-
}) :
|
|
65
|
+
}) : G.map((t, n) => {
|
|
66
66
|
let r = e++;
|
|
67
|
-
if (t.type === "separator") return /* @__PURE__ */
|
|
68
|
-
className:
|
|
67
|
+
if (t.type === "separator") return /* @__PURE__ */ m("li", {
|
|
68
|
+
className: p(u.separator, A?.separator),
|
|
69
69
|
role: "presentation"
|
|
70
70
|
}, `sep-${n}`);
|
|
71
|
-
let
|
|
72
|
-
return /* @__PURE__ */
|
|
71
|
+
let i = r === B, o = W === t.value, s = `wim-select-option-${M}-${t.value}`;
|
|
72
|
+
return /* @__PURE__ */ m(a, {
|
|
73
73
|
asChild: !0,
|
|
74
74
|
id: s,
|
|
75
75
|
ref: (e) => {
|
|
76
|
-
|
|
76
|
+
U.current[r] = e;
|
|
77
77
|
},
|
|
78
|
-
active:
|
|
78
|
+
active: i,
|
|
79
79
|
disabled: t.disabled,
|
|
80
|
-
className:
|
|
80
|
+
className: p(u.option, o && u.selected, A?.option),
|
|
81
81
|
onClick: (e) => {
|
|
82
|
-
e.stopPropagation(),
|
|
82
|
+
e.stopPropagation(), J(t);
|
|
83
83
|
},
|
|
84
|
-
onMouseEnter: () =>
|
|
84
|
+
onMouseEnter: () => V(r),
|
|
85
85
|
role: "option",
|
|
86
86
|
"aria-selected": o,
|
|
87
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ m("li", { children: t.label })
|
|
88
88
|
}, t.value);
|
|
89
89
|
});
|
|
90
|
-
}, Z =
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
label:
|
|
93
|
-
error:
|
|
94
|
-
required:
|
|
95
|
-
layout:
|
|
96
|
-
labelId:
|
|
97
|
-
htmlFor:
|
|
98
|
-
errorId:
|
|
99
|
-
className:
|
|
100
|
-
children: /* @__PURE__ */
|
|
101
|
-
className:
|
|
90
|
+
}, Z = q && q.type !== "separator" ? `wim-select-option-${M}-${q.value}` : void 0, { "aria-label": Q, "aria-labelledby": $, "aria-describedby": Ee, ...De } = fe;
|
|
91
|
+
return /* @__PURE__ */ m(c, {
|
|
92
|
+
label: v,
|
|
93
|
+
error: y,
|
|
94
|
+
required: b,
|
|
95
|
+
layout: x,
|
|
96
|
+
labelId: N,
|
|
97
|
+
htmlFor: I,
|
|
98
|
+
errorId: P,
|
|
99
|
+
className: S,
|
|
100
|
+
children: /* @__PURE__ */ h(ue ? e : "div", {
|
|
101
|
+
className: p("wim-select", u.root, k && u.fullWidth, A?.root),
|
|
102
102
|
ref: we,
|
|
103
|
-
onMouseMove: () =>
|
|
104
|
-
"data-keyboard-nav":
|
|
103
|
+
onMouseMove: () => _e(!1),
|
|
104
|
+
"data-keyboard-nav": ge,
|
|
105
105
|
...De,
|
|
106
106
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
disabled:
|
|
109
|
-
allowClear:
|
|
110
|
-
hasValue: !!
|
|
111
|
-
onClear:
|
|
112
|
-
intent:
|
|
107
|
+
/* @__PURE__ */ m(o, {
|
|
108
|
+
disabled: C,
|
|
109
|
+
allowClear: O,
|
|
110
|
+
hasValue: !!W,
|
|
111
|
+
onClear: xe,
|
|
112
|
+
intent: L,
|
|
113
113
|
rightIcons: [{
|
|
114
114
|
name: "ChevronDownIcon",
|
|
115
|
-
rotated:
|
|
115
|
+
rotated: R
|
|
116
116
|
}],
|
|
117
|
-
width:
|
|
118
|
-
fullWidth:
|
|
119
|
-
styles:
|
|
120
|
-
children: /* @__PURE__ */
|
|
121
|
-
id:
|
|
122
|
-
className:
|
|
123
|
-
onClick:
|
|
117
|
+
width: le,
|
|
118
|
+
fullWidth: k,
|
|
119
|
+
styles: A?.inputBase,
|
|
120
|
+
children: /* @__PURE__ */ m("div", {
|
|
121
|
+
id: I,
|
|
122
|
+
className: p(u.trigger, R && u.open, C && u.disabled, A?.trigger),
|
|
123
|
+
onClick: be,
|
|
124
124
|
onKeyDown: Y,
|
|
125
|
-
tabIndex:
|
|
125
|
+
tabIndex: C ? -1 : 0,
|
|
126
126
|
role: "combobox",
|
|
127
|
-
"aria-expanded":
|
|
127
|
+
"aria-expanded": R,
|
|
128
128
|
"aria-haspopup": "listbox",
|
|
129
|
-
"aria-controls":
|
|
130
|
-
"aria-disabled":
|
|
131
|
-
"aria-labelledby":
|
|
132
|
-
"aria-label":
|
|
133
|
-
"aria-describedby":
|
|
134
|
-
"aria-required":
|
|
135
|
-
"aria-invalid":
|
|
136
|
-
"aria-activedescendant":
|
|
137
|
-
ref:
|
|
138
|
-
children: /* @__PURE__ */
|
|
139
|
-
className:
|
|
140
|
-
children:
|
|
129
|
+
"aria-controls": R ? F : void 0,
|
|
130
|
+
"aria-disabled": C,
|
|
131
|
+
"aria-labelledby": N || $,
|
|
132
|
+
"aria-label": v ? void 0 : typeof Q == "string" ? Q : typeof _ == "string" ? _ : void 0,
|
|
133
|
+
"aria-describedby": P || Ee,
|
|
134
|
+
"aria-required": b ? "true" : void 0,
|
|
135
|
+
"aria-invalid": L === "danger" ? "true" : "false",
|
|
136
|
+
"aria-activedescendant": R ? Z : void 0,
|
|
137
|
+
ref: ve,
|
|
138
|
+
children: /* @__PURE__ */ m("div", {
|
|
139
|
+
className: p(u.value, !K && u.placeholder, A?.value),
|
|
140
|
+
children: K ? K.label : _
|
|
141
141
|
})
|
|
142
142
|
})
|
|
143
143
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
show:
|
|
144
|
+
/* @__PURE__ */ h(r, {
|
|
145
|
+
show: R && !C,
|
|
146
146
|
preset: "fade",
|
|
147
|
-
className:
|
|
147
|
+
className: p(u.dropdown, A?.dropdown),
|
|
148
148
|
ref: Se,
|
|
149
149
|
...Ce,
|
|
150
|
-
children: [
|
|
151
|
-
className:
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
ref:
|
|
150
|
+
children: [w && /* @__PURE__ */ m("div", {
|
|
151
|
+
className: p(u.search, A?.search),
|
|
152
|
+
children: /* @__PURE__ */ m("input", {
|
|
153
|
+
ref: ye,
|
|
154
154
|
type: "text",
|
|
155
|
-
className:
|
|
156
|
-
placeholder:
|
|
157
|
-
value:
|
|
155
|
+
className: p(u.searchInput, A?.searchInput),
|
|
156
|
+
placeholder: T,
|
|
157
|
+
value: z,
|
|
158
158
|
onChange: (e) => {
|
|
159
|
-
|
|
159
|
+
he(e.target.value), V(-1);
|
|
160
160
|
},
|
|
161
161
|
onClick: (e) => e.stopPropagation(),
|
|
162
162
|
onKeyDown: Y,
|
|
163
|
-
"aria-label":
|
|
164
|
-
"aria-controls":
|
|
163
|
+
"aria-label": T,
|
|
164
|
+
"aria-controls": F,
|
|
165
165
|
"aria-activedescendant": Z
|
|
166
166
|
})
|
|
167
|
-
}), /* @__PURE__ */
|
|
168
|
-
id:
|
|
169
|
-
className:
|
|
167
|
+
}), /* @__PURE__ */ m("ul", {
|
|
168
|
+
id: F,
|
|
169
|
+
className: p(u.list, A?.list),
|
|
170
170
|
role: "listbox",
|
|
171
|
-
"aria-labelledby":
|
|
172
|
-
children:
|
|
173
|
-
className:
|
|
171
|
+
"aria-labelledby": v ? N : $ || void 0,
|
|
172
|
+
children: G.length === 0 ? /* @__PURE__ */ m("li", {
|
|
173
|
+
className: p(u.empty, A?.empty),
|
|
174
174
|
role: "option",
|
|
175
175
|
"aria-selected": "false",
|
|
176
|
-
children:
|
|
176
|
+
children: ce ?? pe("select.no_options")
|
|
177
177
|
}) : Te()
|
|
178
178
|
})]
|
|
179
179
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ m(t, { children: de })
|
|
181
181
|
]
|
|
182
182
|
})
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
|
-
|
|
185
|
+
g.displayName = "Select";
|
|
186
186
|
//#endregion
|
|
187
|
-
export {
|
|
187
|
+
export { g as Select, g as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../Button/Button.cjs"),r=require("../../_internal/BaseListItem/BaseListItem.cjs"),i=require("../../../i18n/generated/form.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("../Checkbox/Checkbox.cjs"),s=require("../../_internal/useAnnounce.cjs"),c=require("../../data-display/VirtualList/VirtualList.cjs"),l=require("./transfer.module.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=36,m=50,h=({data:e,title:n,listType:a,id:s,disabled:h,selectedKeys:g,focusedKey:_,setFocusedKey:v,onSelect:y,onSelectAll:b,onKeyDown:x,labels:S={},className:C})=>{let{t:w}=t.useWimTranslation(i.formNs),{noData:T=w(`transfer.no_data`)}=S,E=(0,u.useRef)(null),D=(0,u.useRef)(null),[O,k]=(0,u.useState)(0);(0,u.useEffect)(()=>{let e=E.current;if(!e)return;let t=new ResizeObserver(([e])=>{k(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[]),(0,u.useEffect)(()=>{if(!_||!D.current||O===0)return;let t=e.findIndex(e=>e.key===_);if(t===-1)return;let n=D.current,r=t*p,i=r+p;r<n.scrollTop?n.scrollTop=r:i>n.scrollTop+O&&(n.scrollTop=i-O)},[_,e,O]);let A=e.filter(e=>!e.disabled).map(e=>e.key),j=g.filter(e=>A.includes(e)),M=A.length>0&&j.length===A.length,N=j.length>0&&j.length<A.length,P=_&&e.some(e=>e.key===_)?`${s}-${a}-option-${_}`:void 0,F=e.length>=m&&O>0,I=(t,n)=>(0,f.jsx)(r.BaseListItem,{id:`${s}-${a}-option-${t.key}`,className:(0,d.default)(l.default.item,_===t.key&&l.default.active),disabled:h||t.disabled,active:_===t.key,onClick:()=>{t.disabled||(v(t.key),y(t.key))},role:`option`,"aria-selected":g.includes(t.key),"aria-disabled":h||t.disabled,"aria-setsize":F?e.length:void 0,"aria-posinset":F?n+1:void 0,icon:(0,f.jsx)(`div`,{className:(0,d.default)(l.default.checkboxVisual,g.includes(t.key)&&l.default.checked,(h||t.disabled)&&l.default.disabled),"aria-hidden":`true`}),children:t.title},t.key),L=typeof n==`string`?n:``;return(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.list,C),children:[(0,f.jsxs)(`div`,{className:l.default.header,children:[(0,f.jsx)(o.Checkbox,{checked:M,indeterminate:N,onChange:()=>b(A,a),disabled:h||A.length===0,children:(0,f.jsx)(`span`,{className:l.default.headerTitle,title:L,children:n})}),(0,f.jsxs)(`span`,{className:l.default.headerCount,children:[j.length,`/`,e.length]})]}),(0,f.jsx)(`div`,{ref:E,className:l.default.body,role:e.length>0?`listbox`:`group`,"aria-multiselectable":e.length>0?`true`:void 0,"aria-label":L,"aria-activedescendant":e.length>0?P:void 0,"aria-disabled":h||void 0,tabIndex:e.length===0?-1:0,onKeyDown:t=>x(t,a,e),onFocus:()=>{if(!_){let t=e.find(e=>!e.disabled);t&&v(t.key)}},style:F?{overflow:`hidden`,padding:0}:void 0,children:e.length===0?(0,f.jsx)(`div`,{className:l.default.empty,"aria-live":`polite`,children:T}):F?(0,f.jsx)(c.VirtualList,{items:e,itemHeight:p,height:O,renderItem:I,itemRole:`none`,ref:D,role:`presentation`}):e.map((e,t)=>I(e,t))})]})},g=({dataSource:e=[],targetKeys:r,onChange:o,titles:c,className:p,style:m,disabled:g=!1,label:_,error:v,required:y,layout:b=`vertical`,labels:x={},"aria-label":S,"aria-labelledby":C,"aria-describedby":w})=>{let{t:T}=t.useWimTranslation(i.formNs),E=c??[T(`transfer.source`),T(`transfer.target`)],{moveToTarget:D=T(`transfer.move_to_target`),moveToSource:O=T(`transfer.move_to_source`),statusMovedToTarget:k=e=>T(`transfer.status_moved_to_target`,{count:e}),statusMovedToSource:A=e=>T(`transfer.status_moved_to_source`,{count:e})}=x,[j,M]=(0,u.useState)([]),[N,P]=(0,u.useState)(r||[]),F=`wim-transfer-${(0,u.useId)()}`,I=_?`${F}-label`:void 0,L=v?`${F}-error`:void 0,R=r!==void 0&&!!o,z=R?r:N,B=(0,u.useMemo)(()=>e.filter(e=>!z.includes(e.key)),[e,z]),V=(0,u.useMemo)(()=>e.filter(e=>z.includes(e.key)),[e,z]),[H,U]=(0,u.useState)(null),[W,G]=(0,u.useState)(null),{announce:K,region:q}=s.useAnnounce();H&&!B.some(e=>e.key===H)&&U(null),W&&!V.some(e=>e.key===W)&&G(null);let J=e=>{g||M(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},Y=(e,t)=>{if(g)return;let n=e;n.every(e=>j.includes(e))?M(e=>e.filter(e=>!n.includes(e))):M(e=>[...new Set([...e,...n])])},X=e=>{if(g)return;let t=e===`toRight`?B.map(e=>e.key):V.map(e=>e.key),n=j.filter(e=>t.includes(e));if(n.length===0)return;let r=e===`toRight`?[...z,...n]:z.filter(e=>!n.includes(e));R||P(r),o&&o(r,e,n),M(e=>e.filter(e=>!n.includes(e)));let i=e===`toRight`?k(n.length):A(n.length);K(i,{delay:50})},Z=(e,t,n)=>{let r=e.filter(e=>!e.disabled);if(r.length===0)return null;if(t===null)return n===1?r[0].key:r[r.length-1].key;let i=r.findIndex(e=>e.key===t);return i===-1?r[0].key:r[(i+n+r.length)%r.length].key},Q=(e,t,n)=>{if(g)return;let r=t===`source`?H:W,i=t===`source`?U:G;if(e.key===`ArrowDown`)e.preventDefault(),i(Z(n,r,1));else if(e.key===`ArrowUp`)e.preventDefault(),i(Z(n,r,-1));else if(e.key===`Home`){e.preventDefault();let t=n.find(e=>!e.disabled);t&&i(t.key)}else if(e.key===`End`){e.preventDefault();let t=[...n].reverse().find(e=>!e.disabled);t&&i(t.key)}else if(e.key===` `){e.preventDefault();let t=n.find(e=>e.key===r);t&&!t.disabled&&J(t.key)}else e.key===`Enter`&&(e.preventDefault(),X(t===`source`?`toRight`:`toLeft`))},$=j.filter(e=>B.some(t=>t.key===e)).length===0,ee=j.filter(e=>V.some(t=>t.key===e)).length===0;return(0,f.jsx)(a.FieldTemplate,{label:_,error:v,required:y,layout:b,labelId:I,errorId:L,className:p,children:(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.container,`wim-transfer`),children:[q,(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.root,g&&l.default.disabled),style:m,role:`group`,"aria-labelledby":_?I:C,"aria-label":_||C?void 0:S,"aria-describedby":[w,L].filter(Boolean).join(` `)||void 0,children:[(0,f.jsx)(h,{className:`wim-transfer__list`,data:B,title:E[0],listType:`source`,id:F,disabled:g,selectedKeys:j,focusedKey:H,setFocusedKey:U,onSelect:J,onSelectAll:Y,onKeyDown:Q,labels:x}),(0,f.jsxs)(`div`,{className:(0,d.default)(l.default.operation,`wim-transfer__operation`),children:[(0,f.jsx)(n.Button,{variant:`outline`,size:`sm`,className:l.default.button,onClick:()=>X(`toRight`),disabled:g||$,icon:`ChevronRightIcon`,"aria-label":D}),(0,f.jsx)(n.Button,{variant:`outline`,size:`sm`,className:l.default.button,onClick:()=>X(`toLeft`),disabled:g||ee,icon:`ChevronLeftIcon`,"aria-label":O})]}),(0,f.jsx)(h,{className:`wim-transfer__list`,data:V,title:E[1],listType:`target`,id:F,disabled:g,selectedKeys:j,focusedKey:W,setFocusedKey:G,onSelect:J,onSelectAll:Y,onKeyDown:Q,labels:x})]})]})})};exports.Transfer=g;
|