@semcore/select 4.50.1 → 16.0.0-prerelease.2
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/CHANGELOG.md +6 -0
- package/lib/cjs/InputSearch.js +9 -11
- package/lib/cjs/InputSearch.js.map +1 -1
- package/lib/cjs/Select.js +16 -18
- package/lib/cjs/Select.js.map +1 -1
- package/lib/es6/InputSearch.js +9 -9
- package/lib/es6/InputSearch.js.map +1 -1
- package/lib/es6/Select.js +17 -18
- package/lib/es6/Select.js.map +1 -1
- package/lib/esm/InputSearch.mjs +48 -49
- package/lib/esm/Select.mjs +147 -148
- package/package.json +12 -15
package/lib/esm/Select.mjs
CHANGED
|
@@ -1,100 +1,99 @@
|
|
|
1
|
-
import
|
|
1
|
+
import B from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import M from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import J from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import u from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import Q from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
6
|
import V from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
-
import
|
|
7
|
+
import D from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
8
8
|
import y from "@babel/runtime/helpers/esm/get";
|
|
9
9
|
import C from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
10
10
|
import U from "@babel/runtime/helpers/esm/inherits";
|
|
11
11
|
import X from "@babel/runtime/helpers/esm/createSuper";
|
|
12
|
-
import
|
|
13
|
-
import { sstyled as F } from "@semcore/
|
|
14
|
-
import
|
|
15
|
-
import m from "react";
|
|
12
|
+
import b from "@babel/runtime/helpers/esm/defineProperty";
|
|
13
|
+
import { sstyled as w, createComponent as F, lastInteraction as q, assignProps as S } from "@semcore/core";
|
|
14
|
+
import g from "react";
|
|
16
15
|
import Y from "classnames";
|
|
17
16
|
import f from "@semcore/dropdown-menu";
|
|
18
|
-
import
|
|
17
|
+
import T, { enhance as ee, selectedIndexContext as te, AbstractDropdown as re } from "@semcore/dropdown";
|
|
19
18
|
import { ButtonTrigger as I } from "@semcore/base-trigger";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
19
|
+
import ne from "@semcore/divider";
|
|
20
|
+
import ie, { isAdvanceMode as k } from "@semcore/core/lib/utils/findComponent";
|
|
21
|
+
import oe from "@semcore/core/lib/utils/logger";
|
|
22
|
+
import le from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
23
|
+
import ae from "@semcore/core/lib/utils/addonTextChildren";
|
|
24
|
+
import z from "./InputSearch.mjs";
|
|
26
25
|
import { useBox as de } from "@semcore/flex-box";
|
|
27
26
|
import { selectContext as se } from "./context.mjs";
|
|
28
27
|
import { localizedMessages as ce } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
29
28
|
import { isInputTriggerTag as _e } from "@semcore/popper";
|
|
30
|
-
import { callAllEventHandlers as N } from "@semcore/
|
|
31
|
-
var
|
|
29
|
+
import { callAllEventHandlers as N } from "@semcore/core/lib/utils/assignProps";
|
|
30
|
+
var ge = ["Children", "options", "multiselect", "value", "uid", "forcedAdvancedMode"], he = (
|
|
32
31
|
/*__reshadow_css_start__*/
|
|
33
|
-
(
|
|
32
|
+
(w.insert(
|
|
34
33
|
/*__inner_css_start__*/
|
|
35
|
-
'.
|
|
36
|
-
"
|
|
34
|
+
'.___SOptionCheckbox_1dlne_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-right:var(--intergalactic-spacing-2x, 8px);margin-bottom:auto;position:relative;flex-shrink:0;width:16px;height:16px}.___SOptionCheckbox_1dlne_gg_::before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid;border-radius:var(--intergalactic-addon-rounded, 4px);border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SOptionCheckbox_1dlne_gg_::after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;margin:0 var(--intergalactic-spacing-05x, 2px);background-repeat:no-repeat;background-position:center center}.___SOptionCheckbox_1dlne_gg_.__selected_1dlne_gg_::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNyIgdmlld0JveD0iMCAwIDEwIDciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik04LjI1IDFMNCA1LjI1TDEuNzUgMyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_1dlne_gg_._size_l_1dlne_gg_{width:20px;height:20px}.___SOptionCheckbox_1dlne_gg_._size_l_1dlne_gg_.__selected_1dlne_gg_::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMSAxLjVMNC43NSA3Ljc1TDEgNCIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_1dlne_gg_.__indeterminate_1dlne_gg_:before,.___SOptionCheckbox_1dlne_gg_.__selected_1dlne_gg_:before{background-color:var(--intergalactic-control-primary-info, #008ff8);border-color:var(--intergalactic-control-primary-info, #008ff8)}.___SOptionCheckbox_1dlne_gg_.__theme_1dlne_gg_:before{border-color:var(--theme_1dlne)}.___SOptionCheckbox_1dlne_gg_.__theme_1dlne_gg_.__indeterminate_1dlne_gg_:before,.___SOptionCheckbox_1dlne_gg_.__theme_1dlne_gg_.__selected_1dlne_gg_:before{background-color:var(--theme_1dlne);border-color:var(--theme_1dlne)}.___SOptionCheckbox_1dlne_gg_.__selected_1dlne_gg_{background-color:var(--intergalactic-dropdown-menu-item-selected, rgba(196, 229, 254, 0.7))}@media (hover:hover){.___SOptionCheckbox_1dlne_gg_.__selected_1dlne_gg_:hover{background-color:var(--intergalactic-dropdown-menu-item-selected-hover, #c4e5fe)}}.___SOptionCheckbox_1dlne_gg_.__indeterminate_1dlne_gg_:after{background-color:#fff;background-image:none;margin:auto;border-radius:1px}.___SOptionCheckbox_1dlne_gg_.__indeterminate_1dlne_gg_._size_l_1dlne_gg_:after{width:12px;height:2px}.___SOptionCheckbox_1dlne_gg_.__indeterminate_1dlne_gg_._size_m_1dlne_gg_:after{width:8px;height:2px}',
|
|
35
|
+
"1dlne_gg_"
|
|
37
36
|
), {
|
|
38
|
-
__SOptionCheckbox: "
|
|
39
|
-
_selected: "
|
|
40
|
-
_size_l: "
|
|
41
|
-
_indeterminate: "
|
|
42
|
-
_theme: "
|
|
43
|
-
"--theme": "--
|
|
44
|
-
_size_m: "
|
|
37
|
+
__SOptionCheckbox: "___SOptionCheckbox_1dlne_gg_",
|
|
38
|
+
_selected: "__selected_1dlne_gg_",
|
|
39
|
+
_size_l: "_size_l_1dlne_gg_",
|
|
40
|
+
_indeterminate: "__indeterminate_1dlne_gg_",
|
|
41
|
+
_theme: "__theme_1dlne_gg_",
|
|
42
|
+
"--theme": "--theme_1dlne",
|
|
43
|
+
_size_m: "_size_m_1dlne_gg_"
|
|
45
44
|
})
|
|
46
45
|
);
|
|
47
|
-
function E(
|
|
48
|
-
return Array.isArray(
|
|
46
|
+
function E(n, a) {
|
|
47
|
+
return Array.isArray(n) ? n.includes(a) : a === n;
|
|
49
48
|
}
|
|
50
|
-
function ue(
|
|
51
|
-
return Array.isArray(
|
|
49
|
+
function ue(n) {
|
|
50
|
+
return Array.isArray(n) ? n.length === 0 : n === null;
|
|
52
51
|
}
|
|
53
|
-
function $(
|
|
54
|
-
return
|
|
52
|
+
function $(n) {
|
|
53
|
+
return n ? [] : null;
|
|
55
54
|
}
|
|
56
|
-
var O = /* @__PURE__ */ function(
|
|
57
|
-
U(
|
|
58
|
-
var
|
|
59
|
-
function
|
|
60
|
-
var
|
|
61
|
-
Q(this,
|
|
55
|
+
var O = /* @__PURE__ */ function(n) {
|
|
56
|
+
U(i, n);
|
|
57
|
+
var a = X(i);
|
|
58
|
+
function i() {
|
|
59
|
+
var o;
|
|
60
|
+
Q(this, i);
|
|
62
61
|
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
63
62
|
t[r] = arguments[r];
|
|
64
|
-
return
|
|
63
|
+
return o = a.call.apply(a, [this].concat(t)), b(D(o), "role", "listbox"), b(D(o), "bindHandlerOptionClick", function(l, d) {
|
|
65
64
|
return function(s) {
|
|
66
|
-
var
|
|
67
|
-
Array.isArray(
|
|
68
|
-
return
|
|
69
|
-
}) :
|
|
65
|
+
var c = l, h = o.asProps, _ = h.value, v = h.multiselect;
|
|
66
|
+
Array.isArray(_) && (_.includes(l) ? c = _.filter(function(m) {
|
|
67
|
+
return m !== l;
|
|
68
|
+
}) : c = _.concat(l)), o.handlers.value(c, s), v || (o.handlers.visible(!1), s.preventDefault());
|
|
70
69
|
};
|
|
71
|
-
}),
|
|
72
|
-
var d =
|
|
73
|
-
|
|
74
|
-
}),
|
|
70
|
+
}), b(D(o), "handlerClear", function(l) {
|
|
71
|
+
var d = o.asProps.value, s = $(Array.isArray(d));
|
|
72
|
+
o.handlers.value(s, l), o.handlers.visible(!1);
|
|
73
|
+
}), o;
|
|
75
74
|
}
|
|
76
|
-
return V(
|
|
75
|
+
return V(i, [{
|
|
77
76
|
key: "itemRef",
|
|
78
77
|
value: function(e, t, r) {
|
|
79
|
-
y(C(
|
|
80
|
-
var
|
|
78
|
+
y(C(i.prototype), "itemRef", this).call(this, e, t, r);
|
|
79
|
+
var l = this.asProps.highlightedIndex, d = t === l;
|
|
81
80
|
d && this.scrollToNode(r);
|
|
82
81
|
}
|
|
83
82
|
}, {
|
|
84
83
|
key: "uncontrolledProps",
|
|
85
84
|
value: function() {
|
|
86
85
|
var e = this;
|
|
87
|
-
return u(u({}, y(C(
|
|
86
|
+
return u(u({}, y(C(i.prototype), "uncontrolledProps", this).call(this)), {}, {
|
|
88
87
|
visible: [null, function(t) {
|
|
89
88
|
if (t === !0) {
|
|
90
|
-
var r = k(e.asProps.Children, [
|
|
91
|
-
e.handlers.highlightedIndex(
|
|
92
|
-
var d, s,
|
|
93
|
-
if (
|
|
94
|
-
e.scrollToNode(
|
|
95
|
-
for (var
|
|
96
|
-
if (_
|
|
97
|
-
e.handlers.highlightedIndex(
|
|
89
|
+
var r = k(e.asProps.Children, [p.InputSearch.displayName], !0), l = r ? null : e.props.defaultHighlightedIndex;
|
|
90
|
+
e.handlers.highlightedIndex(l), setTimeout(function() {
|
|
91
|
+
var d, s, c = (d = e.menuRef.current) === null || d === void 0 ? void 0 : d.querySelectorAll('[role="option"]'), h = (s = e.menuRef.current) === null || s === void 0 ? void 0 : s.querySelector('[aria-selected="true"]');
|
|
92
|
+
if (h && c) {
|
|
93
|
+
e.scrollToNode(h);
|
|
94
|
+
for (var _ = 0; _ < c.length; _++)
|
|
95
|
+
if (c[_] === h) {
|
|
96
|
+
e.handlers.highlightedIndex(_);
|
|
98
97
|
break;
|
|
99
98
|
}
|
|
100
99
|
}
|
|
@@ -107,32 +106,32 @@ var O = /* @__PURE__ */ function(i) {
|
|
|
107
106
|
}, {
|
|
108
107
|
key: "getTriggerProps",
|
|
109
108
|
value: function() {
|
|
110
|
-
var e = this, t = this.asProps, r = t.disabled,
|
|
111
|
-
return u(u({}, y(C(
|
|
109
|
+
var e = this, t = this.asProps, r = t.disabled, l = t.visible, d = t.state, s = t.placeholder, c = t.value, h = t.options, _ = t.forwardRef, v = t.name, m = t.multiselect, x = t.getI18nText, P = t.highlightedIndex, A = t.uid, G = t.Children, Z = t.children, R = k(G, [p.Menu.displayName], !0) || !Z, j = R ? "igc-".concat(A, "-list") : "igc-".concat(A, "-popper");
|
|
110
|
+
return u(u({}, y(C(i.prototype), "getTriggerProps", this).call(this)), {}, {
|
|
112
111
|
onKeyDown: N(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleArrowKeyDown.bind(this)),
|
|
113
|
-
"aria-controls":
|
|
114
|
-
"aria-haspopup":
|
|
112
|
+
"aria-controls": l ? j : void 0,
|
|
113
|
+
"aria-haspopup": R ? "listbox" : "dialog",
|
|
115
114
|
"aria-disabled": r ? "true" : "false",
|
|
116
|
-
"aria-activedescendant":
|
|
117
|
-
empty: ue(
|
|
118
|
-
value:
|
|
115
|
+
"aria-activedescendant": l && P !== null && this.itemRefs[P] ? "igc-".concat(A, "-option-").concat(P) : void 0,
|
|
116
|
+
empty: ue(c),
|
|
117
|
+
value: c,
|
|
119
118
|
name: v,
|
|
120
|
-
$hiddenRef:
|
|
121
|
-
multiselect:
|
|
119
|
+
$hiddenRef: _,
|
|
120
|
+
multiselect: m,
|
|
122
121
|
state: d,
|
|
123
122
|
placeholder: s,
|
|
124
123
|
disabled: r,
|
|
125
|
-
active:
|
|
124
|
+
active: l,
|
|
126
125
|
onClear: this.handlerClear,
|
|
127
|
-
children: this.renderChildrenTrigger(
|
|
128
|
-
getI18nText:
|
|
126
|
+
children: this.renderChildrenTrigger(c, h),
|
|
127
|
+
getI18nText: x,
|
|
129
128
|
onBlur: function() {
|
|
130
129
|
e.asProps.visible && (e.prevHighlightedIndex = e.asProps.highlightedIndex, e.handlers.highlightedIndex(null));
|
|
131
130
|
},
|
|
132
131
|
onFocus: function() {
|
|
133
132
|
if (e.asProps.visible) {
|
|
134
|
-
var
|
|
135
|
-
e.handlers.highlightedIndex(
|
|
133
|
+
var W = e.prevHighlightedIndex;
|
|
134
|
+
e.handlers.highlightedIndex(W);
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
137
|
});
|
|
@@ -141,32 +140,32 @@ var O = /* @__PURE__ */ function(i) {
|
|
|
141
140
|
key: "getListProps",
|
|
142
141
|
value: function() {
|
|
143
142
|
var e = this.asProps.multiselect;
|
|
144
|
-
return u(u({}, y(C(
|
|
143
|
+
return u(u({}, y(C(i.prototype), "getListProps", this).call(this)), {}, {
|
|
145
144
|
"aria-multiselectable": e ? "true" : void 0
|
|
146
145
|
});
|
|
147
146
|
}
|
|
148
147
|
}, {
|
|
149
148
|
key: "getPopperProps",
|
|
150
149
|
value: function() {
|
|
151
|
-
return u(u({}, y(C(
|
|
150
|
+
return u(u({}, y(C(i.prototype), "getPopperProps", this).call(this)), {}, {
|
|
152
151
|
onKeyDown: N(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this), this.handleArrowKeyDown.bind(this))
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
}, {
|
|
156
155
|
key: "getOptionProps",
|
|
157
156
|
value: function(e, t) {
|
|
158
|
-
var r,
|
|
159
|
-
return u(u({}, y(C(
|
|
160
|
-
highlighted:
|
|
161
|
-
selected:
|
|
162
|
-
"aria-selected":
|
|
157
|
+
var r, l = this, d = this.asProps, s = d.value, c = d.highlightedIndex, h = d.size, _ = h === void 0 ? "m" : h, v = t === c && q.isKeyboard() && !e.disabled, m = (r = e.selected) !== null && r !== void 0 ? r : E(s, e.value);
|
|
158
|
+
return u(u({}, y(C(i.prototype), "getItemProps", this).call(this, e, t)), {}, {
|
|
159
|
+
highlighted: v,
|
|
160
|
+
selected: m,
|
|
161
|
+
"aria-selected": m ? "true" : "false",
|
|
163
162
|
"aria-disabled": e.disabled ? "true" : "false",
|
|
164
163
|
role: "option",
|
|
165
164
|
onClick: this.bindHandlerOptionClick(e.value, t),
|
|
166
165
|
ref: function(P) {
|
|
167
|
-
return
|
|
166
|
+
return l.itemRef(e, t, P);
|
|
168
167
|
},
|
|
169
|
-
size:
|
|
168
|
+
size: _
|
|
170
169
|
});
|
|
171
170
|
}
|
|
172
171
|
}, {
|
|
@@ -189,125 +188,125 @@ var O = /* @__PURE__ */ function(i) {
|
|
|
189
188
|
}, {
|
|
190
189
|
key: "renderChildrenTrigger",
|
|
191
190
|
value: function(e, t) {
|
|
192
|
-
return t ? [].concat(e).reduce(function(r,
|
|
191
|
+
return t ? [].concat(e).reduce(function(r, l) {
|
|
193
192
|
var d = t.find(function(s) {
|
|
194
|
-
return E(
|
|
193
|
+
return E(l, s.value);
|
|
195
194
|
});
|
|
196
195
|
return d && (r.length && r.push(", "), r.push(d.label || d.value)), r;
|
|
197
|
-
}, []) : Array.isArray(e) ? e.reduce(function(r,
|
|
198
|
-
return r.length && r.push(", "), r.push(
|
|
196
|
+
}, []) : Array.isArray(e) ? e.reduce(function(r, l) {
|
|
197
|
+
return r.length && r.push(", "), r.push(l), r;
|
|
199
198
|
}, []) : e;
|
|
200
199
|
}
|
|
201
200
|
}, {
|
|
202
201
|
key: "render",
|
|
203
202
|
value: function() {
|
|
204
|
-
var e = this.asProps, t = this.asProps, r = t.Children,
|
|
203
|
+
var e = this.asProps, t = this.asProps, r = t.Children, l = t.options, d = t.multiselect;
|
|
205
204
|
t.value;
|
|
206
|
-
var s = t.uid,
|
|
207
|
-
if (
|
|
205
|
+
var s = t.uid, c = t.forcedAdvancedMode, h = J(t, ge), _ = c || ie(r, [p.Trigger.displayName, p.Popper.displayName]);
|
|
206
|
+
if (oe.warn(l && _, "Don't use at the same time 'options' property and '<Select.Trigger/>/<Select.Popper/>'", h["data-ui-name"] || p.displayName), this.itemProps = [], l) {
|
|
208
207
|
var v = this.asProps;
|
|
209
|
-
return /* @__PURE__ */
|
|
210
|
-
return /* @__PURE__ */
|
|
211
|
-
key:
|
|
212
|
-
id: "igc-".concat(s, "-option-").concat(
|
|
213
|
-
},
|
|
208
|
+
return /* @__PURE__ */ g.createElement(f, S({}, v), /* @__PURE__ */ g.createElement(p.Trigger, h), /* @__PURE__ */ g.createElement(p.Menu, null, l.map(function(m, x) {
|
|
209
|
+
return /* @__PURE__ */ g.createElement(p.Option, M({
|
|
210
|
+
key: m.value,
|
|
211
|
+
id: "igc-".concat(s, "-option-").concat(x)
|
|
212
|
+
}, m), d && /* @__PURE__ */ g.createElement(p.Option.Checkbox, null), m.children);
|
|
214
213
|
})));
|
|
215
214
|
}
|
|
216
|
-
return /* @__PURE__ */
|
|
215
|
+
return /* @__PURE__ */ g.createElement(f, S({}, e), /* @__PURE__ */ g.createElement(r, null));
|
|
217
216
|
}
|
|
218
|
-
}]),
|
|
217
|
+
}]), i;
|
|
219
218
|
}(re);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
var
|
|
219
|
+
b(O, "displayName", "Select");
|
|
220
|
+
b(O, "style", he);
|
|
221
|
+
b(O, "enhance", Object.values(ee).concat([le()]));
|
|
222
|
+
b(O, "defaultProps", function(n) {
|
|
223
|
+
var a, i, o, e, t = n.children && k(n.children, [p.InputSearch.displayName], !0), r = t ? null : 0;
|
|
225
224
|
return {
|
|
226
|
-
placeholder:
|
|
225
|
+
placeholder: n.multiselect ? "Select options" : "Select option",
|
|
227
226
|
size: "m",
|
|
228
|
-
defaultValue: $(
|
|
227
|
+
defaultValue: $(n.multiselect),
|
|
229
228
|
defaultVisible: !1,
|
|
230
|
-
defaultHighlightedIndex: (
|
|
231
|
-
defaultSelectedIndex: (
|
|
229
|
+
defaultHighlightedIndex: (a = n.highlightedIndex) !== null && a !== void 0 ? a : r,
|
|
230
|
+
defaultSelectedIndex: (i = n.selectedIndex) !== null && i !== void 0 ? i : r,
|
|
232
231
|
scrollToSelected: !0,
|
|
233
232
|
i18n: ce,
|
|
234
233
|
locale: "en",
|
|
235
|
-
interaction: (
|
|
234
|
+
interaction: (o = n.interaction) !== null && o !== void 0 ? o : "click",
|
|
236
235
|
inlineActions: !1,
|
|
237
|
-
timeout: (e =
|
|
236
|
+
timeout: (e = n.timeout) !== null && e !== void 0 ? e : 0
|
|
238
237
|
};
|
|
239
238
|
});
|
|
240
|
-
function
|
|
241
|
-
var
|
|
242
|
-
return
|
|
239
|
+
function pe(n) {
|
|
240
|
+
var a = arguments[0], i, o = n.Children, e = n.name, t = n.value, r = n.styles, l = n.$hiddenRef, d = n.tag, s = d === void 0 ? I : d, c = n.getI18nText, h = _e(s), _ = T.Trigger;
|
|
241
|
+
return i = w(r), /* @__PURE__ */ g.createElement(_, i.cn("SSelectTrigger", u({}, S({
|
|
243
242
|
tag: s,
|
|
244
|
-
placeholder:
|
|
243
|
+
placeholder: c("selectPlaceholder"),
|
|
245
244
|
role: "combobox",
|
|
246
|
-
"aria-autocomplete":
|
|
247
|
-
},
|
|
245
|
+
"aria-autocomplete": h && "list" || void 0
|
|
246
|
+
}, a))), ae(o, s.Text || I.Text, s.Value || I.Text, s.Addon || I.Addon, !0), e && /* @__PURE__ */ g.createElement("input", i.cn("input", {
|
|
248
247
|
type: "hidden",
|
|
249
248
|
defaultValue: t,
|
|
250
249
|
name: e,
|
|
251
|
-
ref:
|
|
250
|
+
ref: l
|
|
252
251
|
})));
|
|
253
252
|
}
|
|
254
|
-
var L = /* @__PURE__ */
|
|
255
|
-
function
|
|
256
|
-
var
|
|
257
|
-
return
|
|
258
|
-
value:
|
|
259
|
-
}, r && !
|
|
253
|
+
var L = /* @__PURE__ */ g.createContext({});
|
|
254
|
+
function me(n) {
|
|
255
|
+
var a = arguments[0], i, o = T.Item, e = n.styles, t = n.Children, r = k(t, [p.Option.Checkbox.displayName]), l = k(t, [p.Option.Content.displayName]);
|
|
256
|
+
return i = w(e), /* @__PURE__ */ g.createElement(o, i.cn("SSelectOption", u({}, S({}, a))), /* @__PURE__ */ g.createElement(L.Provider, {
|
|
257
|
+
value: n
|
|
258
|
+
}, r && !l ? /* @__PURE__ */ g.createElement(p.Option.Content, null, /* @__PURE__ */ g.createElement(t, i.cn("Children", {}))) : /* @__PURE__ */ g.createElement(t, i.cn("Children", {}))));
|
|
260
259
|
}
|
|
261
|
-
function ve(
|
|
262
|
-
var
|
|
260
|
+
function ve(n) {
|
|
261
|
+
var a = g.useContext(L), i = g.useMemo(function() {
|
|
263
262
|
return u({
|
|
264
|
-
selected:
|
|
265
|
-
disabled:
|
|
266
|
-
size:
|
|
267
|
-
},
|
|
268
|
-
}, [
|
|
269
|
-
size:
|
|
270
|
-
"use:theme":
|
|
271
|
-
indeterminate:
|
|
263
|
+
selected: a == null ? void 0 : a.selected,
|
|
264
|
+
disabled: a == null ? void 0 : a.disabled,
|
|
265
|
+
size: a == null ? void 0 : a.size
|
|
266
|
+
}, n || {});
|
|
267
|
+
}, [n, a]), o = de(i, i.forwardRef), e = B(o, 2), t = e[0], r = e[1], l = i.size, d = i.theme, s = i.selected, c = i.resolveColor, h = i.indeterminate, _ = w(i.styles), v = _.cn("SOptionCheckbox", {
|
|
268
|
+
size: l,
|
|
269
|
+
"use:theme": c(d),
|
|
270
|
+
indeterminate: h,
|
|
272
271
|
selected: s
|
|
273
|
-
}),
|
|
274
|
-
return /* @__PURE__ */
|
|
275
|
-
className: Y(
|
|
276
|
-
style: u(u({},
|
|
272
|
+
}), m = v.className, x = v.style;
|
|
273
|
+
return /* @__PURE__ */ g.createElement(t, M({}, r, {
|
|
274
|
+
className: Y(m, r.className) || void 0,
|
|
275
|
+
style: u(u({}, x), r.style),
|
|
277
276
|
tabIndex: -1
|
|
278
277
|
}));
|
|
279
278
|
}
|
|
280
279
|
var H = function() {
|
|
281
|
-
var
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
-
},
|
|
284
|
-
Trigger: [
|
|
280
|
+
var a = arguments[0];
|
|
281
|
+
return /* @__PURE__ */ g.createElement(z, S({}, a));
|
|
282
|
+
}, p = F(O, {
|
|
283
|
+
Trigger: [pe, {
|
|
285
284
|
Addon: I.Addon,
|
|
286
285
|
Text: I.Text
|
|
287
286
|
}],
|
|
288
|
-
Popper:
|
|
287
|
+
Popper: T.Popper,
|
|
289
288
|
List: f.List,
|
|
290
289
|
Menu: f.Menu,
|
|
291
|
-
Option: [
|
|
290
|
+
Option: [me, {
|
|
292
291
|
Addon: f.Item.Addon,
|
|
293
292
|
Content: f.Item.Content,
|
|
294
293
|
Hint: f.Item.Hint,
|
|
295
294
|
Checkbox: ve
|
|
296
295
|
}],
|
|
297
|
-
Group:
|
|
296
|
+
Group: T.Group,
|
|
298
297
|
OptionTitle: f.ItemTitle,
|
|
299
298
|
OptionHint: f.ItemHint,
|
|
300
|
-
Divider:
|
|
301
|
-
InputSearch: [H,
|
|
302
|
-
Input: [H,
|
|
299
|
+
Divider: ne,
|
|
300
|
+
InputSearch: [H, z._______childrenComponents],
|
|
301
|
+
Input: [H, z._______childrenComponents]
|
|
303
302
|
}, {
|
|
304
303
|
parent: f,
|
|
305
304
|
context: se
|
|
306
|
-
}),
|
|
307
|
-
return
|
|
305
|
+
}), Qe = function(a) {
|
|
306
|
+
return a;
|
|
308
307
|
};
|
|
309
|
-
|
|
308
|
+
p.selectedIndexContext = te;
|
|
310
309
|
export {
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
p as default,
|
|
311
|
+
Qe as wrapSelect
|
|
313
312
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/select",
|
|
3
3
|
"description": "Semrush Select Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "16.0.0-prerelease.2",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -13,23 +13,20 @@
|
|
|
13
13
|
"types": "./lib/types/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@semcore/base-trigger": "
|
|
17
|
-
"@semcore/button": "
|
|
18
|
-
"@semcore/checkbox": "
|
|
19
|
-
"@semcore/divider": "
|
|
20
|
-
"@semcore/dropdown-menu": "
|
|
21
|
-
"@semcore/dropdown": "
|
|
22
|
-
"@semcore/
|
|
23
|
-
"@semcore/
|
|
24
|
-
"@semcore/
|
|
25
|
-
"@semcore/
|
|
26
|
-
"@semcore/utils": "4.48.1",
|
|
16
|
+
"@semcore/base-trigger": "16.0.0-prerelease.2",
|
|
17
|
+
"@semcore/button": "16.0.0-prerelease.2",
|
|
18
|
+
"@semcore/checkbox": "16.0.0-prerelease.2",
|
|
19
|
+
"@semcore/divider": "16.0.0-prerelease.2",
|
|
20
|
+
"@semcore/dropdown-menu": "16.0.0-prerelease.2",
|
|
21
|
+
"@semcore/dropdown": "16.0.0-prerelease.2",
|
|
22
|
+
"@semcore/icon": "16.0.0-prerelease.2",
|
|
23
|
+
"@semcore/input": "16.0.0-prerelease.2",
|
|
24
|
+
"@semcore/popper": "16.0.0-prerelease.2",
|
|
25
|
+
"@semcore/flex-box": "16.0.0-prerelease.2",
|
|
27
26
|
"classnames": "2.2.6"
|
|
28
27
|
},
|
|
29
28
|
"peerDependencies": {
|
|
30
|
-
"@semcore/
|
|
31
|
-
"react": "16.8 - 18",
|
|
32
|
-
"react-dom": "16.8 - 18"
|
|
29
|
+
"@semcore/base-components": "^16.0.0-prerelease.2"
|
|
33
30
|
},
|
|
34
31
|
"repository": {
|
|
35
32
|
"type": "git",
|