@semcore/select 16.0.0-prerelease.6 → 16.0.0-prerelease.9

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.
@@ -1,119 +1,139 @@
1
- import h from "@babel/runtime/helpers/esm/objectSpread2";
2
- import x from "@babel/runtime/helpers/esm/classCallCheck";
3
- import P from "@babel/runtime/helpers/esm/createClass";
4
- import S from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import V from "@babel/runtime/helpers/esm/inherits";
6
- import E from "@babel/runtime/helpers/esm/createSuper";
7
- import i from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled as u, createComponent as z, assignProps as p, Component as b } from "@semcore/core";
9
- import t from "react";
10
- import R from "@semcore/icon/Search/m";
11
- import T from "@semcore/icon/Close/m";
12
- import f from "@semcore/input";
13
- import { ButtonLink as k } from "@semcore/button";
14
- import { selectContext as M } from "./context.mjs";
15
- import O from "@semcore/core/lib/utils/enhances/i18nEnhance";
16
- import { localizedMessages as v } from "./translations/__intergalactic-dynamic-locales.mjs";
17
- var w = (
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
- (u.insert(
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
- ), s = /* @__PURE__ */ function(_) {
31
- V(n, _);
32
- var o = E(n);
33
- function n() {
34
- var e;
35
- x(this, n);
36
- for (var a = arguments.length, r = new Array(a), l = 0; l < a; l++)
37
- r[l] = arguments[l];
38
- return e = o.call.apply(o, [this].concat(r)), i(S(e), "inputRef", /* @__PURE__ */ t.createRef()), i(S(e), "closeIconRef", /* @__PURE__ */ t.createRef()), i(S(e), "handleClear", function(m) {
39
- e.handlers.value("", m), setTimeout(function() {
40
- if (document.activeElement === document.body || document.activeElement === e.closeIconRef.current) {
41
- var c;
42
- (c = e.inputRef.current) === null || c === void 0 || c.focus();
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
- }), e;
51
+ });
52
+ return _this;
46
53
  }
47
- return P(n, [{
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 a = this.asProps, r = a.value, l = a.getI18nText;
63
+ value: function getValueProps() {
64
+ var _this$asProps = this.asProps, value = _this$asProps.value, getI18nText = _this$asProps.getI18nText;
58
65
  return {
59
- value: r,
66
+ value,
60
67
  onChange: this.handlers.value,
61
- autoFocus: !0,
68
+ autoFocus: true,
62
69
  ref: this.inputRef,
63
- placeholder: l("Select.InputSearch.Value:placeholder"),
64
- "aria-label": l("Select.InputSearch.Value: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 a = this.asProps, r = a.value, l = a.getI18nText;
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: !r,
75
- "aria-hidden": !r,
76
- "aria-label": l("clearSearch"),
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 a = this.asProps, r, l = d.Value, m = f, c = this.asProps, y = c.size, g = c.styles, C = c.children, I = c.Children;
84
- return r = u(g), /* @__PURE__ */ t.createElement(m, r.cn("SInputSearch", {
85
- size: y || this.context.size || "m",
86
- styles: g
87
- }), C ? /* @__PURE__ */ t.createElement(I, r.cn("Children", {})) : /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(d.SearchIcon, null), /* @__PURE__ */ t.createElement(l, r.cn("Value", h({}, p({}, a)))), /* @__PURE__ */ t.createElement(d.Clear, null)));
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
- }]), n;
90
- }(b);
91
- i(s, "displayName", "InputSearch");
92
- i(s, "style", w);
93
- i(s, "enhance", [O(v)]);
94
- i(s, "defaultProps", {
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: v,
107
+ i18n: localizedMessages,
97
108
  locale: "en"
98
109
  });
99
- i(s, "contextType", M);
100
- var A = function(o) {
101
- var n = arguments[0], e, a = f.Addon, r = o.styles;
102
- return e = u(r), /* @__PURE__ */ t.createElement(a, e.cn("SSearchIcon", h({}, p({}, n))), /* @__PURE__ */ t.createElement(R, e.cn("SearchM", {})));
103
- }, F = function(o) {
104
- var n = arguments[0], e, a = f.Value, r = o.styles;
105
- return e = u(r), /* @__PURE__ */ t.createElement(a, e.cn("SSearchValue", h({}, p({}, n))));
106
- }, L = function(o) {
107
- var n = arguments[0], e, a = k, r = o.styles;
108
- return e = u(r), /* @__PURE__ */ t.createElement(a, e.cn("SSearchClear", h({}, p({
109
- addonLeft: T,
110
- use: "secondary"
111
- }, n))));
112
- }, d = z(s, {
113
- SearchIcon: A,
114
- Value: F,
115
- Clear: L
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
- d as default
138
+ InputSearch as default
119
139
  };