@semcore/select 16.1.1 → 16.1.2-prerelease.1
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/README.md +1 -31
- package/lib/cjs/InputSearch.js +33 -34
- package/lib/cjs/InputSearch.js.map +1 -1
- package/lib/cjs/Select.js +54 -56
- package/lib/cjs/Select.js.map +1 -1
- package/lib/cjs/context.js +2 -3
- package/lib/cjs/context.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +2 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/InputSearch.js +29 -29
- package/lib/es6/InputSearch.js.map +1 -1
- package/lib/es6/Select.js +53 -54
- package/lib/es6/Select.js.map +1 -1
- package/lib/es6/context.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/InputSearch.mjs +31 -29
- package/lib/esm/Select.mjs +56 -49
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +13 -11
- package/package.json +16 -16
package/lib/esm/InputSearch.mjs
CHANGED
|
@@ -1,60 +1,63 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
5
7
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
9
|
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
10
|
+
import { ButtonLink } from "@semcore/button";
|
|
11
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
12
|
import CloseM from "@semcore/icon/Close/m";
|
|
13
|
+
import SearchM from "@semcore/icon/Search/m";
|
|
12
14
|
import Input from "@semcore/input";
|
|
13
|
-
import
|
|
15
|
+
import React from "react";
|
|
14
16
|
import { selectContext } from "./context.mjs";
|
|
15
|
-
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
16
17
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
18
|
+
function _callSuper(t, o, e) {
|
|
19
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
20
|
+
}
|
|
17
21
|
/*!__reshadow-styles__:"./style/input-search.shadow.css"*/
|
|
18
22
|
var style = (
|
|
19
23
|
/*__reshadow_css_start__*/
|
|
20
24
|
(sstyled.insert(
|
|
21
25
|
/*__inner_css_start__*/
|
|
22
|
-
".
|
|
26
|
+
".___SInputSearch_1jla1_gg_._size_m_1jla1_gg_{height:32px}.___SSearchClear_1jla1_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SSearchClear_1jla1_gg_.__hide_1jla1_gg_{visibility:hidden}.___SOutline_1jla1_gg_{top:-1px;left:-1px;width:100%;border-radius:var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0 0;box-sizing:content-box}",
|
|
23
27
|
/*__inner_css_end__*/
|
|
24
|
-
"
|
|
28
|
+
"1jla1_gg_"
|
|
25
29
|
), /*__reshadow_css_end__*/
|
|
26
30
|
{
|
|
27
|
-
"__SInputSearch": "
|
|
28
|
-
"_size_m": "
|
|
29
|
-
"__SSearchClear": "
|
|
30
|
-
"_hide": "
|
|
31
|
-
"__SOutline": "
|
|
31
|
+
"__SInputSearch": "___SInputSearch_1jla1_gg_",
|
|
32
|
+
"_size_m": "_size_m_1jla1_gg_",
|
|
33
|
+
"__SSearchClear": "___SSearchClear_1jla1_gg_",
|
|
34
|
+
"_hide": "__hide_1jla1_gg_",
|
|
35
|
+
"__SOutline": "___SOutline_1jla1_gg_"
|
|
32
36
|
})
|
|
33
37
|
);
|
|
34
38
|
var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
35
|
-
_inherits(InputSearchRoot2, _Component);
|
|
36
|
-
var _super = _createSuper(InputSearchRoot2);
|
|
37
39
|
function InputSearchRoot2() {
|
|
38
40
|
var _this;
|
|
39
41
|
_classCallCheck(this, InputSearchRoot2);
|
|
40
42
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
43
|
args[_key] = arguments[_key];
|
|
42
44
|
}
|
|
43
|
-
_this =
|
|
44
|
-
_defineProperty(
|
|
45
|
-
_defineProperty(
|
|
46
|
-
_defineProperty(
|
|
45
|
+
_this = _callSuper(this, InputSearchRoot2, [].concat(args));
|
|
46
|
+
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
47
|
+
_defineProperty(_this, "closeIconRef", /* @__PURE__ */ React.createRef());
|
|
48
|
+
_defineProperty(_this, "handleClear", function(e) {
|
|
47
49
|
_this.handlers.value("", e);
|
|
48
50
|
setTimeout(function() {
|
|
49
51
|
if (document.activeElement === document.body || document.activeElement === _this.closeIconRef.current) {
|
|
50
52
|
var _this$inputRef$curren;
|
|
51
|
-
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0
|
|
53
|
+
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 || _this$inputRef$curren.focus();
|
|
52
54
|
}
|
|
53
55
|
}, 0);
|
|
54
56
|
});
|
|
55
57
|
return _this;
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
_inherits(InputSearchRoot2, _Component);
|
|
60
|
+
return _createClass(InputSearchRoot2, [{
|
|
58
61
|
key: "uncontrolledProps",
|
|
59
62
|
value: function uncontrolledProps() {
|
|
60
63
|
return {
|
|
@@ -67,10 +70,10 @@ var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
|
67
70
|
var _this$asProps = this.asProps, value = _this$asProps.value, onChange = _this$asProps.onChange, getI18nText = _this$asProps.getI18nText, hasChildren = _this$asProps.children;
|
|
68
71
|
return {
|
|
69
72
|
value,
|
|
70
|
-
onChange: hasChildren ? onChange : void 0,
|
|
71
|
-
autoFocus: true,
|
|
72
|
-
ref: this.inputRef,
|
|
73
|
-
placeholder: getI18nText("Select.InputSearch.Value:placeholder"),
|
|
73
|
+
"onChange": hasChildren ? onChange : void 0,
|
|
74
|
+
"autoFocus": true,
|
|
75
|
+
"ref": this.inputRef,
|
|
76
|
+
"placeholder": getI18nText("Select.InputSearch.Value:placeholder"),
|
|
74
77
|
"aria-label": getI18nText("Select.InputSearch.Value:aria-label")
|
|
75
78
|
};
|
|
76
79
|
}
|
|
@@ -79,12 +82,12 @@ var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
|
79
82
|
value: function getClearProps() {
|
|
80
83
|
var _this$asProps2 = this.asProps, value = _this$asProps2.value, getI18nText = _this$asProps2.getI18nText;
|
|
81
84
|
return {
|
|
82
|
-
ref: this.closeIconRef,
|
|
85
|
+
"ref": this.closeIconRef,
|
|
83
86
|
/* hide through css because the width of the input changes */
|
|
84
|
-
hide: !value,
|
|
87
|
+
"hide": !value,
|
|
85
88
|
"aria-hidden": !value,
|
|
86
89
|
"aria-label": getI18nText("clearSearch"),
|
|
87
|
-
onClick: this.handleClear
|
|
90
|
+
"onClick": this.handleClear
|
|
88
91
|
};
|
|
89
92
|
}
|
|
90
93
|
}, {
|
|
@@ -100,7 +103,6 @@ var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
|
100
103
|
}), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref5.cn("Children", {})) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputSearch.SearchIcon, null), /* @__PURE__ */ React.createElement(Value, _ref5.cn("Value", _objectSpread({}, assignProps({}, _ref)))), /* @__PURE__ */ React.createElement(InputSearch.Clear, null)));
|
|
101
104
|
}
|
|
102
105
|
}]);
|
|
103
|
-
return InputSearchRoot2;
|
|
104
106
|
}(Component);
|
|
105
107
|
_defineProperty(InputSearchRoot, "displayName", "InputSearch");
|
|
106
108
|
_defineProperty(InputSearchRoot, "style", style);
|
package/lib/esm/Select.mjs
CHANGED
|
@@ -4,47 +4,56 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
6
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
|
|
9
9
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
10
|
+
import _get from "@babel/runtime/helpers/esm/get";
|
|
10
11
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
11
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
12
12
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
13
13
|
import { sstyled, createComponent, lastInteraction, assignProps } from "@semcore/core";
|
|
14
|
-
import React from "react";
|
|
15
|
-
import cn from "classnames";
|
|
16
|
-
import DropdownMenu from "@semcore/dropdown-menu";
|
|
17
|
-
import Dropdown, { enhance, selectedIndexContext, AbstractDropdown } from "@semcore/dropdown";
|
|
18
14
|
import { ButtonTrigger } from "@semcore/base-trigger";
|
|
19
|
-
import
|
|
15
|
+
import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
|
|
16
|
+
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
17
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
20
18
|
import findComponent, { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
21
19
|
import logger from "@semcore/core/lib/utils/logger";
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
20
|
+
import Divider from "@semcore/divider";
|
|
21
|
+
import Dropdown, { enhance, selectedIndexContext, AbstractDropdown } from "@semcore/dropdown";
|
|
22
|
+
import DropdownMenu from "@semcore/dropdown-menu";
|
|
25
23
|
import { useBox } from "@semcore/flex-box";
|
|
24
|
+
import { isInputTriggerTag } from "@semcore/popper";
|
|
25
|
+
import cn from "classnames";
|
|
26
|
+
import React from "react";
|
|
26
27
|
import { selectContext } from "./context.mjs";
|
|
28
|
+
import InputSearch from "./InputSearch.mjs";
|
|
27
29
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
28
|
-
import { isInputTriggerTag } from "@semcore/popper";
|
|
29
|
-
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
30
30
|
var _excluded = ["Children", "options", "multiselect", "value", "uid", "forcedAdvancedMode"];
|
|
31
|
+
function _callSuper(t, o, e) {
|
|
32
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
33
|
+
}
|
|
34
|
+
function _superPropGet(t, o, e, r) {
|
|
35
|
+
var p = _get(_getPrototypeOf(t.prototype), o, e);
|
|
36
|
+
return "function" == typeof p ? function(t2) {
|
|
37
|
+
return p.apply(e, t2);
|
|
38
|
+
} : p;
|
|
39
|
+
}
|
|
31
40
|
/*!__reshadow-styles__:"./style/select.shadow.css"*/
|
|
32
41
|
var style = (
|
|
33
42
|
/*__reshadow_css_start__*/
|
|
34
43
|
(sstyled.insert(
|
|
35
44
|
/*__inner_css_start__*/
|
|
36
|
-
'.
|
|
45
|
+
'.___SOptionCheckbox_119jy_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_119jy_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_119jy_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_119jy_gg_.__selected_119jy_gg_::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNyIgdmlld0JveD0iMCAwIDEwIDciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik04LjI1IDFMNCA1LjI1TDEuNzUgMyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_119jy_gg_._size_l_119jy_gg_{width:20px;height:20px}.___SOptionCheckbox_119jy_gg_._size_l_119jy_gg_.__selected_119jy_gg_::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMSAxLjVMNC43NSA3Ljc1TDEgNCIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_119jy_gg_.__indeterminate_119jy_gg_:before,.___SOptionCheckbox_119jy_gg_.__selected_119jy_gg_:before{background-color:var(--intergalactic-control-primary-info, #008ff8);border-color:var(--intergalactic-control-primary-info, #008ff8)}.___SOptionCheckbox_119jy_gg_.__theme_119jy_gg_:before{border-color:var(--theme_119jy)}.___SOptionCheckbox_119jy_gg_.__theme_119jy_gg_.__indeterminate_119jy_gg_:before,.___SOptionCheckbox_119jy_gg_.__theme_119jy_gg_.__selected_119jy_gg_:before{background-color:var(--theme_119jy);border-color:var(--theme_119jy)}.___SOptionCheckbox_119jy_gg_.__selected_119jy_gg_{background-color:var(--intergalactic-dropdown-menu-item-selected, rgba(196, 229, 254, 0.7))}@media (hover:hover){.___SOptionCheckbox_119jy_gg_.__selected_119jy_gg_:hover{background-color:var(--intergalactic-dropdown-menu-item-selected-hover, #c4e5fe)}}.___SOptionCheckbox_119jy_gg_.__indeterminate_119jy_gg_:after{background-color:#fff;background-image:none;margin:auto;border-radius:1px}.___SOptionCheckbox_119jy_gg_.__indeterminate_119jy_gg_._size_l_119jy_gg_:after{width:12px;height:2px}.___SOptionCheckbox_119jy_gg_.__indeterminate_119jy_gg_._size_m_119jy_gg_:after{width:8px;height:2px}',
|
|
37
46
|
/*__inner_css_end__*/
|
|
38
|
-
"
|
|
47
|
+
"119jy_gg_"
|
|
39
48
|
), /*__reshadow_css_end__*/
|
|
40
49
|
{
|
|
41
|
-
"__SOptionCheckbox": "
|
|
42
|
-
"_selected": "
|
|
43
|
-
"_size_l": "
|
|
44
|
-
"_indeterminate": "
|
|
45
|
-
"_theme": "
|
|
46
|
-
"--theme": "--
|
|
47
|
-
"_size_m": "
|
|
50
|
+
"__SOptionCheckbox": "___SOptionCheckbox_119jy_gg_",
|
|
51
|
+
"_selected": "__selected_119jy_gg_",
|
|
52
|
+
"_size_l": "_size_l_119jy_gg_",
|
|
53
|
+
"_indeterminate": "__indeterminate_119jy_gg_",
|
|
54
|
+
"_theme": "__theme_119jy_gg_",
|
|
55
|
+
"--theme": "--theme_119jy",
|
|
56
|
+
"_size_m": "_size_m_119jy_gg_"
|
|
48
57
|
})
|
|
49
58
|
);
|
|
50
59
|
function isSelectedOption(value, valueOption) {
|
|
@@ -57,17 +66,15 @@ function getEmptyValue(multiselect) {
|
|
|
57
66
|
return multiselect ? [] : null;
|
|
58
67
|
}
|
|
59
68
|
var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
60
|
-
_inherits(RootSelect2, _AbstractDropdown);
|
|
61
|
-
var _super = _createSuper(RootSelect2);
|
|
62
69
|
function RootSelect2() {
|
|
63
70
|
var _this;
|
|
64
71
|
_classCallCheck(this, RootSelect2);
|
|
65
72
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
66
73
|
args[_key] = arguments[_key];
|
|
67
74
|
}
|
|
68
|
-
_this =
|
|
69
|
-
_defineProperty(
|
|
70
|
-
_defineProperty(
|
|
75
|
+
_this = _callSuper(this, RootSelect2, [].concat(args));
|
|
76
|
+
_defineProperty(_this, "role", "listbox");
|
|
77
|
+
_defineProperty(_this, "bindHandlerOptionClick", function(optionValue, _index) {
|
|
71
78
|
return function(e) {
|
|
72
79
|
var newValue = optionValue;
|
|
73
80
|
var _this$asProps = _this.asProps, value = _this$asProps.value, multiselect = _this$asProps.multiselect;
|
|
@@ -87,7 +94,7 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
87
94
|
}
|
|
88
95
|
};
|
|
89
96
|
});
|
|
90
|
-
_defineProperty(
|
|
97
|
+
_defineProperty(_this, "handlerClear", function(e) {
|
|
91
98
|
var value = _this.asProps.value;
|
|
92
99
|
var emptyValue = getEmptyValue(Array.isArray(value));
|
|
93
100
|
_this.handlers.value(emptyValue, e);
|
|
@@ -95,10 +102,11 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
95
102
|
});
|
|
96
103
|
return _this;
|
|
97
104
|
}
|
|
98
|
-
|
|
105
|
+
_inherits(RootSelect2, _AbstractDropdown);
|
|
106
|
+
return _createClass(RootSelect2, [{
|
|
99
107
|
key: "itemRef",
|
|
100
108
|
value: function itemRef(props, index, node) {
|
|
101
|
-
|
|
109
|
+
_superPropGet(RootSelect2, "itemRef", this)([props, index, node]);
|
|
102
110
|
var highlightedIndex = this.asProps.highlightedIndex;
|
|
103
111
|
var isHighlighted = index === highlightedIndex;
|
|
104
112
|
if (isHighlighted) {
|
|
@@ -109,7 +117,7 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
109
117
|
key: "uncontrolledProps",
|
|
110
118
|
value: function uncontrolledProps() {
|
|
111
119
|
var _this2 = this;
|
|
112
|
-
return _objectSpread(_objectSpread({},
|
|
120
|
+
return _objectSpread(_objectSpread({}, _superPropGet(RootSelect2, "uncontrolledProps", this)([])), {}, {
|
|
113
121
|
visible: [null, function(visible) {
|
|
114
122
|
if (visible === true) {
|
|
115
123
|
var hasInputSearch = isAdvanceMode(_this2.asProps.Children, [Select.InputSearch.displayName], true);
|
|
@@ -141,31 +149,31 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
141
149
|
var _this$asProps2 = this.asProps, disabled = _this$asProps2.disabled, visible = _this$asProps2.visible, state = _this$asProps2.state, placeholder = _this$asProps2.placeholder, value = _this$asProps2.value, options = _this$asProps2.options, forwardRef = _this$asProps2.forwardRef, name = _this$asProps2.name, multiselect = _this$asProps2.multiselect, getI18nText = _this$asProps2.getI18nText, highlightedIndex = _this$asProps2.highlightedIndex, uid = _this$asProps2.uid, Children = _this$asProps2.Children, hasChildren = _this$asProps2.children;
|
|
142
150
|
var isMenu = isAdvanceMode(Children, [Select.Menu.displayName], true) || !hasChildren;
|
|
143
151
|
var ariaControls = isMenu ? "igc-".concat(uid, "-list") : "igc-".concat(uid, "-popper");
|
|
144
|
-
return _objectSpread(_objectSpread({},
|
|
145
|
-
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleArrowKeyDown.bind(this)),
|
|
152
|
+
return _objectSpread(_objectSpread({}, _superPropGet(RootSelect2, "getTriggerProps", this)([])), {}, {
|
|
153
|
+
"onKeyDown": callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleArrowKeyDown.bind(this)),
|
|
146
154
|
"aria-controls": visible ? ariaControls : void 0,
|
|
147
155
|
"aria-haspopup": isMenu ? "listbox" : "dialog",
|
|
148
156
|
"aria-disabled": disabled ? "true" : "false",
|
|
149
157
|
"aria-activedescendant": visible && highlightedIndex !== null && this.itemRefs[highlightedIndex] ? "igc-".concat(uid, "-option-").concat(highlightedIndex) : void 0,
|
|
150
|
-
empty: isEmptyValue(value),
|
|
158
|
+
"empty": isEmptyValue(value),
|
|
151
159
|
value,
|
|
152
160
|
name,
|
|
153
|
-
$hiddenRef: forwardRef,
|
|
161
|
+
"$hiddenRef": forwardRef,
|
|
154
162
|
multiselect,
|
|
155
163
|
state,
|
|
156
164
|
placeholder,
|
|
157
165
|
disabled,
|
|
158
|
-
active: visible,
|
|
159
|
-
onClear: this.handlerClear,
|
|
160
|
-
children: this.renderChildrenTrigger(value, options),
|
|
166
|
+
"active": visible,
|
|
167
|
+
"onClear": this.handlerClear,
|
|
168
|
+
"children": this.renderChildrenTrigger(value, options),
|
|
161
169
|
getI18nText,
|
|
162
|
-
onBlur: function onBlur() {
|
|
170
|
+
"onBlur": function onBlur() {
|
|
163
171
|
if (_this3.asProps.visible) {
|
|
164
172
|
_this3.prevHighlightedIndex = _this3.asProps.highlightedIndex;
|
|
165
173
|
_this3.handlers.highlightedIndex(null);
|
|
166
174
|
}
|
|
167
175
|
},
|
|
168
|
-
onFocus: function onFocus() {
|
|
176
|
+
"onFocus": function onFocus() {
|
|
169
177
|
if (_this3.asProps.visible) {
|
|
170
178
|
var index = _this3.prevHighlightedIndex;
|
|
171
179
|
_this3.handlers.highlightedIndex(index);
|
|
@@ -177,14 +185,14 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
177
185
|
key: "getListProps",
|
|
178
186
|
value: function getListProps() {
|
|
179
187
|
var multiselect = this.asProps.multiselect;
|
|
180
|
-
return _objectSpread(_objectSpread({},
|
|
188
|
+
return _objectSpread(_objectSpread({}, _superPropGet(RootSelect2, "getListProps", this)([])), {}, {
|
|
181
189
|
"aria-multiselectable": multiselect ? "true" : void 0
|
|
182
190
|
});
|
|
183
191
|
}
|
|
184
192
|
}, {
|
|
185
193
|
key: "getPopperProps",
|
|
186
194
|
value: function getPopperProps() {
|
|
187
|
-
return _objectSpread(_objectSpread({},
|
|
195
|
+
return _objectSpread(_objectSpread({}, _superPropGet(RootSelect2, "getPopperProps", this)([])), {}, {
|
|
188
196
|
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this), this.handleArrowKeyDown.bind(this))
|
|
189
197
|
});
|
|
190
198
|
}
|
|
@@ -195,14 +203,14 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
195
203
|
var _this$asProps3 = this.asProps, value = _this$asProps3.value, highlightedIndex = _this$asProps3.highlightedIndex, _this$asProps3$size = _this$asProps3.size, size = _this$asProps3$size === void 0 ? "m" : _this$asProps3$size;
|
|
196
204
|
var highlighted = index === highlightedIndex && lastInteraction.isKeyboard() && !props.disabled;
|
|
197
205
|
var selected = (_props$selected = props.selected) !== null && _props$selected !== void 0 ? _props$selected : isSelectedOption(value, props.value);
|
|
198
|
-
return _objectSpread(_objectSpread({},
|
|
206
|
+
return _objectSpread(_objectSpread({}, _superPropGet(RootSelect2, "getItemProps", this)([props, index])), {}, {
|
|
199
207
|
highlighted,
|
|
200
208
|
selected,
|
|
201
209
|
"aria-selected": selected ? "true" : "false",
|
|
202
210
|
"aria-disabled": props.disabled ? "true" : "false",
|
|
203
|
-
role: "option",
|
|
204
|
-
onClick: this.bindHandlerOptionClick(props.value, index),
|
|
205
|
-
ref: function ref(node) {
|
|
211
|
+
"role": "option",
|
|
212
|
+
"onClick": this.bindHandlerOptionClick(props.value, index),
|
|
213
|
+
"ref": function ref(node) {
|
|
206
214
|
return _this4.itemRef(props, index, node);
|
|
207
215
|
},
|
|
208
216
|
size
|
|
@@ -221,7 +229,7 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
221
229
|
key: "getDividerProps",
|
|
222
230
|
value: function getDividerProps() {
|
|
223
231
|
return {
|
|
224
|
-
my: 1,
|
|
232
|
+
"my": 1,
|
|
225
233
|
"aria-disabled": "true"
|
|
226
234
|
};
|
|
227
235
|
}
|
|
@@ -267,7 +275,6 @@ var RootSelect = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
|
267
275
|
return /* @__PURE__ */ React.createElement(DropdownMenu, assignProps({}, _ref2), /* @__PURE__ */ React.createElement(Children, null));
|
|
268
276
|
}
|
|
269
277
|
}]);
|
|
270
|
-
return RootSelect2;
|
|
271
278
|
}(AbstractDropdown);
|
|
272
279
|
_defineProperty(RootSelect, "displayName", "Select");
|
|
273
280
|
_defineProperty(RootSelect, "style", style);
|
|
@@ -301,7 +308,7 @@ function Trigger(_ref8) {
|
|
|
301
308
|
"placeholder": getI18nText("selectPlaceholder"),
|
|
302
309
|
"role": "combobox",
|
|
303
310
|
"aria-autocomplete": hasInputTrigger && "list" || void 0
|
|
304
|
-
}, _ref3))), addonTextChildren(Children, Tag.Text ||
|
|
311
|
+
}, _ref3))), addonTextChildren(Children, Tag.Text || Tag.Value || ButtonTrigger.Text, Tag.Addon || ButtonTrigger.Addon, true), name && /* @__PURE__ */ React.createElement("input", _ref6.cn("input", {
|
|
305
312
|
"type": "hidden",
|
|
306
313
|
"defaultValue": value,
|
|
307
314
|
"name": name,
|
|
@@ -6,12 +6,12 @@ import it from "./it.json.mjs";
|
|
|
6
6
|
import ja from "./ja.json.mjs";
|
|
7
7
|
import ko from "./ko.json.mjs";
|
|
8
8
|
import nl from "./nl.json.mjs";
|
|
9
|
+
import pl from "./pl.json.mjs";
|
|
9
10
|
import pt from "./pt.json.mjs";
|
|
11
|
+
import sv from "./sv.json.mjs";
|
|
10
12
|
import tr from "./tr.json.mjs";
|
|
11
13
|
import vi from "./vi.json.mjs";
|
|
12
14
|
import zh from "./zh.json.mjs";
|
|
13
|
-
import pl from "./pl.json.mjs";
|
|
14
|
-
import sv from "./sv.json.mjs";
|
|
15
15
|
var localizedMessages = {
|
|
16
16
|
de,
|
|
17
17
|
en,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
3
|
-
import
|
|
1
|
+
import type { ButtonTrigger, BaseTriggerProps, ButtonTriggerProps } from '@semcore/base-trigger';
|
|
2
|
+
import type { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
3
|
+
import type Divider from '@semcore/divider';
|
|
4
|
+
import type Dropdown from '@semcore/dropdown';
|
|
5
|
+
import type {
|
|
4
6
|
DropdownMenuContext,
|
|
5
7
|
DropdownMenuItemProps,
|
|
6
8
|
DropdownMenuProps,
|
|
7
9
|
DropdownMenuHandlers,
|
|
8
10
|
DropdownMenuTriggerProps,
|
|
9
11
|
} from '@semcore/dropdown-menu';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import Input
|
|
14
|
-
import
|
|
12
|
+
import type DropdownMenu from '@semcore/dropdown-menu';
|
|
13
|
+
import type { BoxProps, Flex } from '@semcore/flex-box';
|
|
14
|
+
import type { InputValueProps } from '@semcore/input';
|
|
15
|
+
import type Input from '@semcore/input';
|
|
16
|
+
import type React from 'react';
|
|
15
17
|
|
|
16
18
|
/** @deprecated */
|
|
17
19
|
export interface ISelectInputSearch extends SelectInputSearch, UnknownProperties {}
|
|
@@ -131,9 +133,9 @@ type IntergalacticSelectComponent<PropsExtending = {}> = (<
|
|
|
131
133
|
SelectContext,
|
|
132
134
|
[handlers: SelectHandlers]
|
|
133
135
|
> &
|
|
134
|
-
|
|
136
|
+
PropsExtending,
|
|
135
137
|
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
136
|
-
|
|
138
|
+
Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', SelectProps>;
|
|
137
139
|
|
|
138
140
|
declare const Select: IntergalacticSelectComponent & {
|
|
139
141
|
Trigger: Intergalactic.Component<
|
|
@@ -178,7 +180,7 @@ declare const wrapSelect: <PropsExtending extends {}>(
|
|
|
178
180
|
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
179
181
|
Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticSelectComponent>
|
|
180
182
|
> &
|
|
181
|
-
|
|
183
|
+
PropsExtending,
|
|
182
184
|
) => React.ReactNode,
|
|
183
185
|
) => IntergalacticSelectComponent<PropsExtending>;
|
|
184
186
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/select",
|
|
3
3
|
"description": "Semrush Select Component",
|
|
4
|
-
"version": "16.1.1",
|
|
4
|
+
"version": "16.1.2-prerelease.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
"types": "./lib/types/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@semcore/base-trigger": "16.2.
|
|
17
|
-
"@semcore/button": "16.0.1",
|
|
18
|
-
"@semcore/checkbox": "16.0.1",
|
|
19
|
-
"@semcore/divider": "16.0.1",
|
|
20
|
-
"@semcore/dropdown
|
|
21
|
-
"@semcore/dropdown": "16.
|
|
22
|
-
"@semcore/
|
|
23
|
-
"@semcore/
|
|
24
|
-
"@semcore/
|
|
25
|
-
"@semcore/
|
|
16
|
+
"@semcore/base-trigger": "16.2.1-prerelease.1",
|
|
17
|
+
"@semcore/button": "16.0.2-prerelease.1",
|
|
18
|
+
"@semcore/checkbox": "16.0.2-prerelease.1",
|
|
19
|
+
"@semcore/divider": "16.0.2-prerelease.1",
|
|
20
|
+
"@semcore/dropdown": "16.0.2-prerelease.1",
|
|
21
|
+
"@semcore/dropdown-menu": "16.1.2-prerelease.1",
|
|
22
|
+
"@semcore/flex-box": "16.0.2-prerelease.1",
|
|
23
|
+
"@semcore/icon": "16.2.1-prerelease.1",
|
|
24
|
+
"@semcore/input": "16.0.2-prerelease.1",
|
|
25
|
+
"@semcore/popper": "16.0.2-prerelease.1",
|
|
26
26
|
"classnames": "2.2.6"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@semcore/base-components": "^16.0.
|
|
29
|
+
"@semcore/base-components": "^16.0.2-prerelease.1"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"directory": "semcore/select"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/react": "18.0.21",
|
|
38
37
|
"@types/classnames": "2.2.6",
|
|
39
|
-
"@semcore/
|
|
40
|
-
"@semcore/
|
|
41
|
-
"@semcore/
|
|
38
|
+
"@semcore/core": "16.0.0",
|
|
39
|
+
"@semcore/flex-box": "16.0.2-prerelease.1",
|
|
40
|
+
"@semcore/typography": "16.1.2-prerelease.1",
|
|
41
|
+
"@semcore/testing-utils": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|