@semcore/select 16.0.0-prerelease.4 → 16.0.0-prerelease.7
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/lib/esm/InputSearch.mjs +101 -81
- package/lib/esm/Select.mjs +293 -227
- package/lib/esm/context.mjs +3 -3
- package/lib/esm/index.mjs +5 -5
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +8 -6
- package/lib/esm/translations/en.json.mjs +8 -6
- package/lib/esm/translations/es.json.mjs +8 -6
- package/lib/esm/translations/fr.json.mjs +8 -6
- package/lib/esm/translations/it.json.mjs +8 -6
- package/lib/esm/translations/ja.json.mjs +8 -6
- package/lib/esm/translations/ko.json.mjs +8 -6
- package/lib/esm/translations/nl.json.mjs +8 -6
- package/lib/esm/translations/pl.json.mjs +8 -6
- package/lib/esm/translations/pt.json.mjs +8 -6
- package/lib/esm/translations/sv.json.mjs +8 -6
- package/lib/esm/translations/tr.json.mjs +8 -6
- package/lib/esm/translations/vi.json.mjs +8 -6
- package/lib/esm/translations/zh.json.mjs +8 -6
- package/package.json +12 -12
package/lib/esm/InputSearch.mjs
CHANGED
|
@@ -1,119 +1,139 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { ButtonLink
|
|
14
|
-
import { selectContext
|
|
15
|
-
import
|
|
16
|
-
import { localizedMessages
|
|
17
|
-
var
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import SearchM from "@semcore/icon/Search/m";
|
|
11
|
+
import CloseM from "@semcore/icon/Close/m";
|
|
12
|
+
import Input from "@semcore/input";
|
|
13
|
+
import { ButtonLink } from "@semcore/button";
|
|
14
|
+
import { selectContext } from "./context.mjs";
|
|
15
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
16
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
17
|
+
var style = (
|
|
18
18
|
/*__reshadow_css_start__*/
|
|
19
|
-
(
|
|
19
|
+
(sstyled.insert(
|
|
20
20
|
/*__inner_css_start__*/
|
|
21
21
|
".___SInputSearch_l5y2o_gg_._size_m_l5y2o_gg_{height:32px}.___SSearchClear_l5y2o_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SSearchClear_l5y2o_gg_.__hide_l5y2o_gg_{visibility:hidden}.___SOutline_l5y2o_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}",
|
|
22
22
|
"l5y2o_gg_"
|
|
23
23
|
), {
|
|
24
|
-
__SInputSearch: "___SInputSearch_l5y2o_gg_",
|
|
25
|
-
_size_m: "_size_m_l5y2o_gg_",
|
|
26
|
-
__SSearchClear: "___SSearchClear_l5y2o_gg_",
|
|
27
|
-
_hide: "__hide_l5y2o_gg_",
|
|
28
|
-
__SOutline: "___SOutline_l5y2o_gg_"
|
|
24
|
+
"__SInputSearch": "___SInputSearch_l5y2o_gg_",
|
|
25
|
+
"_size_m": "_size_m_l5y2o_gg_",
|
|
26
|
+
"__SSearchClear": "___SSearchClear_l5y2o_gg_",
|
|
27
|
+
"_hide": "__hide_l5y2o_gg_",
|
|
28
|
+
"__SOutline": "___SOutline_l5y2o_gg_"
|
|
29
29
|
})
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
);
|
|
31
|
+
var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
32
|
+
_inherits(InputSearchRoot2, _Component);
|
|
33
|
+
var _super = _createSuper(InputSearchRoot2);
|
|
34
|
+
function InputSearchRoot2() {
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, InputSearchRoot2);
|
|
37
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
+
args[_key] = arguments[_key];
|
|
39
|
+
}
|
|
40
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "inputRef", /* @__PURE__ */ React.createRef());
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "closeIconRef", /* @__PURE__ */ React.createRef());
|
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "handleClear", function(e) {
|
|
44
|
+
_this.handlers.value("", e);
|
|
45
|
+
setTimeout(function() {
|
|
46
|
+
if (document.activeElement === document.body || document.activeElement === _this.closeIconRef.current) {
|
|
47
|
+
var _this$inputRef$curren;
|
|
48
|
+
(_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 ? void 0 : _this$inputRef$curren.focus();
|
|
43
49
|
}
|
|
44
50
|
}, 0);
|
|
45
|
-
})
|
|
51
|
+
});
|
|
52
|
+
return _this;
|
|
46
53
|
}
|
|
47
|
-
|
|
54
|
+
_createClass(InputSearchRoot2, [{
|
|
48
55
|
key: "uncontrolledProps",
|
|
49
|
-
value: function() {
|
|
56
|
+
value: function uncontrolledProps() {
|
|
50
57
|
return {
|
|
51
58
|
value: null
|
|
52
59
|
};
|
|
53
60
|
}
|
|
54
61
|
}, {
|
|
55
62
|
key: "getValueProps",
|
|
56
|
-
value: function() {
|
|
57
|
-
var
|
|
63
|
+
value: function getValueProps() {
|
|
64
|
+
var _this$asProps = this.asProps, value = _this$asProps.value, getI18nText = _this$asProps.getI18nText;
|
|
58
65
|
return {
|
|
59
|
-
value
|
|
66
|
+
value,
|
|
60
67
|
onChange: this.handlers.value,
|
|
61
|
-
autoFocus:
|
|
68
|
+
autoFocus: true,
|
|
62
69
|
ref: this.inputRef,
|
|
63
|
-
placeholder:
|
|
64
|
-
"aria-label":
|
|
70
|
+
placeholder: getI18nText("Select.InputSearch.Value:placeholder"),
|
|
71
|
+
"aria-label": getI18nText("Select.InputSearch.Value:aria-label")
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
}, {
|
|
68
75
|
key: "getClearProps",
|
|
69
|
-
value: function() {
|
|
70
|
-
var
|
|
76
|
+
value: function getClearProps() {
|
|
77
|
+
var _this$asProps2 = this.asProps, value = _this$asProps2.value, getI18nText = _this$asProps2.getI18nText;
|
|
71
78
|
return {
|
|
72
79
|
ref: this.closeIconRef,
|
|
73
80
|
/* hide through css because the width of the input changes */
|
|
74
|
-
hide: !
|
|
75
|
-
"aria-hidden": !
|
|
76
|
-
"aria-label":
|
|
81
|
+
hide: !value,
|
|
82
|
+
"aria-hidden": !value,
|
|
83
|
+
"aria-label": getI18nText("clearSearch"),
|
|
77
84
|
onClick: this.handleClear
|
|
78
85
|
};
|
|
79
86
|
}
|
|
80
87
|
}, {
|
|
81
88
|
key: "render",
|
|
82
|
-
value: function() {
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
value: function render() {
|
|
90
|
+
var _ref = this.asProps, _ref5;
|
|
91
|
+
var Value = InputSearch.Value;
|
|
92
|
+
var SInputSearch = Input;
|
|
93
|
+
var _this$asProps3 = this.asProps, size = _this$asProps3.size, styles = _this$asProps3.styles, hasChildren = _this$asProps3.children, Children = _this$asProps3.Children;
|
|
94
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SInputSearch, _ref5.cn("SInputSearch", {
|
|
95
|
+
"size": size || this.context.size || "m",
|
|
96
|
+
"styles": styles
|
|
97
|
+
}), 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)));
|
|
88
98
|
}
|
|
89
|
-
}])
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
}]);
|
|
100
|
+
return InputSearchRoot2;
|
|
101
|
+
}(Component);
|
|
102
|
+
_defineProperty(InputSearchRoot, "displayName", "InputSearch");
|
|
103
|
+
_defineProperty(InputSearchRoot, "style", style);
|
|
104
|
+
_defineProperty(InputSearchRoot, "enhance", [i18nEnhance(localizedMessages)]);
|
|
105
|
+
_defineProperty(InputSearchRoot, "defaultProps", {
|
|
95
106
|
defaultValue: "",
|
|
96
|
-
i18n:
|
|
107
|
+
i18n: localizedMessages,
|
|
97
108
|
locale: "en"
|
|
98
109
|
});
|
|
99
|
-
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
_defineProperty(InputSearchRoot, "contextType", selectContext);
|
|
111
|
+
var SearchIcon = function SearchIcon2(props) {
|
|
112
|
+
var _ref2 = arguments[0], _ref6;
|
|
113
|
+
var SSearchIcon = Input.Addon;
|
|
114
|
+
var styles = props.styles;
|
|
115
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SSearchIcon, _ref6.cn("SSearchIcon", _objectSpread({}, assignProps({}, _ref2))), /* @__PURE__ */ React.createElement(SearchM, _ref6.cn("SearchM", {})));
|
|
116
|
+
};
|
|
117
|
+
var SearchValue = function SearchValue2(props) {
|
|
118
|
+
var _ref3 = arguments[0], _ref7;
|
|
119
|
+
var SSearchValue = Input.Value;
|
|
120
|
+
var styles = props.styles;
|
|
121
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SSearchValue, _ref7.cn("SSearchValue", _objectSpread({}, assignProps({}, _ref3))));
|
|
122
|
+
};
|
|
123
|
+
var SearchClear = function SearchClear2(props) {
|
|
124
|
+
var _ref4 = arguments[0], _ref8;
|
|
125
|
+
var SSearchClear = ButtonLink;
|
|
126
|
+
var styles = props.styles;
|
|
127
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SSearchClear, _ref8.cn("SSearchClear", _objectSpread({}, assignProps({
|
|
128
|
+
"addonLeft": CloseM,
|
|
129
|
+
"use": "secondary"
|
|
130
|
+
}, _ref4))));
|
|
131
|
+
};
|
|
132
|
+
var InputSearch = createComponent(InputSearchRoot, {
|
|
133
|
+
SearchIcon,
|
|
134
|
+
Value: SearchValue,
|
|
135
|
+
Clear: SearchClear
|
|
116
136
|
});
|
|
117
137
|
export {
|
|
118
|
-
|
|
138
|
+
InputSearch as default
|
|
119
139
|
};
|