@semcore/input 16.1.1-prerelease.5 → 16.1.2-prerelease.8

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/Input.mjs CHANGED
@@ -1,181 +1,183 @@
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 _callSuper from "@babel/runtime/helpers/esm/callSuper";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import { createComponent, sstyled, assignProps, Component, lastInteraction } from "@semcore/core";
8
- import autoFocusEnhance from "@semcore/core/lib/utils/enhances/autoFocusEnhance";
9
- import { Box, InvalidStateBox } from "@semcore/flex-box";
10
- import NeighborLocation from "@semcore/neighbor-location";
2
+ import { createComponent, sstyled, Component, lastInteraction, assignProps } from "@semcore/core";
3
+ import { NeighborLocation, Box, InvalidStateBox } from "@semcore/base-components";
11
4
  import React from "react";
12
5
  /*!__reshadow-styles__:"./style/input.shadow.css"*/
13
- var style = (
6
+ const style = (
14
7
  /*__reshadow_css_start__*/
15
8
  (sstyled.insert(
16
9
  /*__inner_css_start__*/
17
- ".___SInput_1qrmt_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_1qrmt_gg_ input:-webkit-autofill{border-radius:var(--intergalactic-control-rounded, 6px);-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_1qrmt_gg_ input:-webkit-autofill~.___SOutline_1qrmt_gg_{background-color:#faffbd}.___SInput_1qrmt_gg_ .___SValue_1qrmt_gg_:focus,.___SInput_1qrmt_gg_ .___SValue_1qrmt_gg_:focus-visible,.___SInput_1qrmt_gg_ .___SValue_1qrmt_gg_:focus-visible::after,.___SInput_1qrmt_gg_ .___SValue_1qrmt_gg_:focus::after{outline:0}.___SValue_1qrmt_gg_{min-width:0;width:100%;height:100%;padding:0;border:0;box-sizing:border-box;color:var(--intergalactic-text-primary, #191b23);font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:0 0}.___SValue_1qrmt_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1qrmt_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1qrmt_gg_:not(:disabled):-moz-read-only~.___SOutline_1qrmt_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1qrmt_gg_:not(:disabled):read-only~.___SOutline_1qrmt_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1qrmt_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SInput_1qrmt_gg_.__disabled_1qrmt_gg_ .___SOutline_1qrmt_gg_,.___SValue_1qrmt_gg_:disabled~.___SOutline_1qrmt_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SOutline_1qrmt_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:var(--intergalactic-control-rounded, 6px);z-index:-1;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SAddon_1qrmt_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 var(--intergalactic-spacing-2x, 8px);height:100%;color:var(--intergalactic-icon-secondary-neutral, #a9abb6)}.___SAddon_1qrmt_gg_.__interactive_1qrmt_gg_{cursor:pointer}@media (hover:hover){.___SAddon_1qrmt_gg_.__interactive_1qrmt_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SAddon_1qrmt_gg_.__disabled_1qrmt_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SAddon_1qrmt_gg_._size_m_1qrmt_gg_:not(.___SButton_1qrmt_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)}.___SAddon_1qrmt_gg_._size_l_1qrmt_gg_:not(.___SButton_1qrmt_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1qrmt_gg_ .___SAddon_1qrmt_gg_:nth-last-child(2){margin-right:-1px}.___SValue_1qrmt_gg_._size_m_1qrmt_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SValue_1qrmt_gg_._size_l_1qrmt_gg_{padding:0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1qrmt_gg_._size_m_1qrmt_gg_{font-size:var(--intergalactic-fs-200, 14px);height:var(--intergalactic-form-control-m, 28px)}.___SInput_1qrmt_gg_._size_l_1qrmt_gg_{font-size:var(--intergalactic-fs-300, 16px);height:var(--intergalactic-form-control-l, 40px)}.___SInput_1qrmt_gg_:has(.___SValue_1qrmt_gg_:focus-visible){z-index:1}.___SInput_1qrmt_gg_._state_normal_1qrmt_gg_ .___SOutline_1qrmt_gg_{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SInput_1qrmt_gg_._state_normal_1qrmt_gg_:has(.___SValue_1qrmt_gg_:focus-visible) .___SOutline_1qrmt_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width;border-color:var(--intergalactic-border-info-active, #006dca)}.___SInput_1qrmt_gg_._state_valid_1qrmt_gg_ .___SOutline_1qrmt_gg_{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInput_1qrmt_gg_._state_valid_1qrmt_gg_:has(.___SValue_1qrmt_gg_:focus-visible) .___SOutline_1qrmt_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width;border-color:var(--intergalactic-border-success-active, #007c65);outline-color:var(--intergalactic-keyboard-focus-valid-outline, #009f81)}.___SInput_1qrmt_gg_._state_invalid_1qrmt_gg_ .___SOutline_1qrmt_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInput_1qrmt_gg_._state_invalid_1qrmt_gg_:has(.___SValue_1qrmt_gg_:focus-visible) .___SOutline_1qrmt_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width;border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SInput_1qrmt_gg_._neighborLocation_right_1qrmt_gg_ .___SOutline_1qrmt_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_1qrmt_gg_._neighborLocation_both_1qrmt_gg_ .___SOutline_1qrmt_gg_{border-radius:0;border-left:none}.___SInput_1qrmt_gg_._neighborLocation_left_1qrmt_gg_ .___SOutline_1qrmt_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SValue_1qrmt_gg_._neighborLocation_right_1qrmt_gg_{padding-right:0}.___SValue_1qrmt_gg_._neighborLocation_both_1qrmt_gg_{padding-left:0;padding-right:0}.___SValue_1qrmt_gg_._neighborLocation_left_1qrmt_gg_{padding-left:0}",
10
+ ".___SInput_1yq06_gg_{display:inline-flex;width:100%;align-items:center;position:relative;z-index:0;vertical-align:middle;padding:1px;box-sizing:border-box}.___SInput_1yq06_gg_ input:-webkit-autofill{border-radius:var(--intergalactic-control-rounded, 6px);-webkit-box-shadow:0 0 0 30px #faffbd inset}.___SInput_1yq06_gg_ input:-webkit-autofill~.___SOutline_1yq06_gg_{background-color:#faffbd}.___SInput_1yq06_gg_ .___SValue_1yq06_gg_:focus,.___SInput_1yq06_gg_ .___SValue_1yq06_gg_:focus-visible,.___SInput_1yq06_gg_ .___SValue_1yq06_gg_:focus-visible::after,.___SInput_1yq06_gg_ .___SValue_1yq06_gg_:focus::after{outline:0}.___SValue_1yq06_gg_{min-width:0;width:100%;height:100%;padding:0;border:0;box-sizing:border-box;color:var(--intergalactic-text-primary, #191b23);font-size:inherit;text-overflow:ellipsis;font-family:inherit;background:0 0}.___SValue_1yq06_gg_::-moz-placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1yq06_gg_::placeholder{color:var(--intergalactic-text-placeholder, #8a8e9b)}.___SValue_1yq06_gg_:not(:disabled):-moz-read-only~.___SOutline_1yq06_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1yq06_gg_:not(:disabled):read-only~.___SOutline_1yq06_gg_{background:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SValue_1yq06_gg_:disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SInput_1yq06_gg_.__disabled_1yq06_gg_ .___SOutline_1yq06_gg_,.___SValue_1yq06_gg_:disabled~.___SOutline_1yq06_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SOutline_1yq06_gg_{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:var(--intergalactic-control-rounded, 6px);z-index:-1;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SAddon_1yq06_gg_{display:inline-flex;justify-content:center;align-items:center;flex:0 0 auto;padding:0 var(--intergalactic-spacing-2x, 8px);height:100%;color:var(--intergalactic-icon-secondary-neutral, #a9abb6)}.___SAddon_1yq06_gg_.__interactive_1yq06_gg_{cursor:pointer}@media (hover:hover){.___SAddon_1yq06_gg_.__interactive_1yq06_gg_:hover{color:var(--intergalactic-icon-secondary-neutral-hover-active, #878992)}}.___SAddon_1yq06_gg_.__disabled_1yq06_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SAddon_1yq06_gg_._size_m_1yq06_gg_:not(.___SButton_1yq06_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)}.___SAddon_1yq06_gg_._size_l_1yq06_gg_._neighborLocation_right_1yq06_gg_:not(.___SButton_1yq06_gg_){padding:0 var(--intergalactic-spacing-2x, 8px)0 var(--intergalactic-spacing-3x, 12px)}.___SAddon_1yq06_gg_._size_l_1yq06_gg_._neighborLocation_left_1yq06_gg_:not(.___SButton_1yq06_gg_){padding:0 var(--intergalactic-spacing-3x, 12px)0 var(--intergalactic-spacing-2x, 8px)}.___SInput_1yq06_gg_ .___SAddon_1yq06_gg_:nth-last-child(2){margin-right:-1px}.___SValue_1yq06_gg_._size_m_1yq06_gg_{padding:0 var(--intergalactic-spacing-2x, 8px)}.___SValue_1yq06_gg_._size_l_1yq06_gg_{padding:0 var(--intergalactic-spacing-3x, 12px)}.___SInput_1yq06_gg_._size_m_1yq06_gg_{font-size:var(--intergalactic-fs-200, 14px);height:var(--intergalactic-form-control-m, 28px)}.___SInput_1yq06_gg_._size_l_1yq06_gg_{font-size:var(--intergalactic-fs-300, 16px);height:var(--intergalactic-form-control-l, 40px)}.___SInput_1yq06_gg_:has(.___SValue_1yq06_gg_:focus-visible){z-index:1}.___SInput_1yq06_gg_._state_normal_1yq06_gg_ .___SOutline_1yq06_gg_{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SInput_1yq06_gg_._state_normal_1yq06_gg_:has(.___SValue_1yq06_gg_:focus-visible) .___SOutline_1yq06_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width;border-color:var(--intergalactic-border-info-active, #006dca)}.___SInput_1yq06_gg_._state_valid_1yq06_gg_ .___SOutline_1yq06_gg_{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInput_1yq06_gg_._state_valid_1yq06_gg_:has(.___SValue_1yq06_gg_:focus-visible) .___SOutline_1yq06_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width;border-color:var(--intergalactic-border-success-active, #007c65);outline-color:var(--intergalactic-keyboard-focus-valid-outline, #009f81)}.___SInput_1yq06_gg_._state_invalid_1yq06_gg_ .___SOutline_1yq06_gg_{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SInput_1yq06_gg_._state_invalid_1yq06_gg_:has(.___SValue_1yq06_gg_:focus-visible) .___SOutline_1yq06_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width;border-color:var(--intergalactic-border-critical-active, #d1002f);outline-color:var(--intergalactic-keyboard-focus-invalid-outline, #ff4953)}.___SInput_1yq06_gg_._neighborLocation_right_1yq06_gg_ .___SOutline_1yq06_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SInput_1yq06_gg_._neighborLocation_both_1yq06_gg_ .___SOutline_1yq06_gg_{border-radius:0;border-left:none}.___SInput_1yq06_gg_._neighborLocation_left_1yq06_gg_ .___SOutline_1yq06_gg_{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.___SValue_1yq06_gg_._neighborLocation_right_1yq06_gg_{padding-right:0}.___SValue_1yq06_gg_._neighborLocation_both_1yq06_gg_{padding-left:0;padding-right:0}.___SValue_1yq06_gg_._neighborLocation_left_1yq06_gg_{padding-left:0}",
18
11
  /*__inner_css_end__*/
19
- "1qrmt_gg_"
12
+ "1yq06_gg_"
20
13
  ), /*__reshadow_css_end__*/
21
14
  {
22
- "__SInput": "___SInput_1qrmt_gg_",
23
- "_disabled": "__disabled_1qrmt_gg_",
24
- "__SOutline": "___SOutline_1qrmt_gg_",
25
- "__SValue": "___SValue_1qrmt_gg_",
26
- "__SAddon": "___SAddon_1qrmt_gg_",
27
- "_size_m": "_size_m_1qrmt_gg_",
28
- "__SButton": "___SButton_1qrmt_gg_",
29
- "_size_l": "_size_l_1qrmt_gg_",
30
- "_neighborLocation_right": "_neighborLocation_right_1qrmt_gg_",
31
- "_neighborLocation_both": "_neighborLocation_both_1qrmt_gg_",
32
- "_neighborLocation_left": "_neighborLocation_left_1qrmt_gg_",
33
- "_interactive": "__interactive_1qrmt_gg_",
34
- "_state_normal": "_state_normal_1qrmt_gg_",
35
- "_state_valid": "_state_valid_1qrmt_gg_",
36
- "_state_invalid": "_state_invalid_1qrmt_gg_"
15
+ "__SInput": "___SInput_1yq06_gg_",
16
+ "_disabled": "__disabled_1yq06_gg_",
17
+ "__SOutline": "___SOutline_1yq06_gg_",
18
+ "__SValue": "___SValue_1yq06_gg_",
19
+ "__SAddon": "___SAddon_1yq06_gg_",
20
+ "_size_m": "_size_m_1yq06_gg_",
21
+ "__SButton": "___SButton_1yq06_gg_",
22
+ "_size_l": "_size_l_1yq06_gg_",
23
+ "_neighborLocation_right": "_neighborLocation_right_1yq06_gg_",
24
+ "_neighborLocation_left": "_neighborLocation_left_1yq06_gg_",
25
+ "_neighborLocation_both": "_neighborLocation_both_1yq06_gg_",
26
+ "_interactive": "__interactive_1yq06_gg_",
27
+ "_state_normal": "_state_normal_1yq06_gg_",
28
+ "_state_valid": "_state_valid_1yq06_gg_",
29
+ "_state_invalid": "_state_invalid_1yq06_gg_"
37
30
  })
38
31
  );
39
- var Input = /* @__PURE__ */ (function(_Component) {
40
- function Input2() {
41
- var _this;
42
- _classCallCheck(this, Input2);
43
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
- args[_key] = arguments[_key];
45
- }
46
- _this = _callSuper(this, Input2, [].concat(args));
47
- _defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
48
- _defineProperty(_this, "handleMouseDownAddon", function(event) {
49
- var _this$inputRef$curren;
32
+ class Input extends Component {
33
+ constructor(...args) {
34
+ super(...args);
35
+ _defineProperty(this, "inputRef", /* @__PURE__ */ React.createRef());
36
+ _defineProperty(this, "handleMouseDownAddon", (event) => {
37
+ var _a;
50
38
  event.preventDefault();
51
- (_this$inputRef$curren = _this.inputRef.current) === null || _this$inputRef$curren === void 0 || _this$inputRef$curren.focus();
39
+ (_a = this.inputRef.current) == null ? void 0 : _a.focus();
52
40
  });
53
- _defineProperty(_this, "handleClick", function() {
41
+ _defineProperty(this, "handleClick", () => {
54
42
  if (!lastInteraction.isKeyboard) return;
55
- setTimeout(function() {
43
+ setTimeout(() => {
44
+ var _a;
56
45
  if (document.activeElement === document.body) {
57
- var _this$inputRef$curren2;
58
- (_this$inputRef$curren2 = _this.inputRef.current) === null || _this$inputRef$curren2 === void 0 || _this$inputRef$curren2.focus();
46
+ (_a = this.inputRef.current) == null ? void 0 : _a.focus();
59
47
  }
60
48
  }, 0);
61
49
  });
62
- return _this;
63
50
  }
64
- _inherits(Input2, _Component);
65
- return _createClass(Input2, [{
66
- key: "getAddonProps",
67
- value: function getAddonProps() {
68
- var _this$asProps = this.asProps, disabled = _this$asProps.disabled, size = _this$asProps.size;
69
- return {
70
- disabled,
71
- onMouseDown: this.handleMouseDownAddon,
72
- onClick: this.handleClick,
73
- size
74
- };
75
- }
76
- }, {
77
- key: "getValueProps",
78
- value: function getValueProps() {
79
- var _this$asProps2 = this.asProps, size = _this$asProps2.size, disabled = _this$asProps2.disabled, state = _this$asProps2.state, role = _this$asProps2.role, placeholder = _this$asProps2.placeholder, ariaHaspopup = _this$asProps2["aria-haspopup"], ariaControls = _this$asProps2["aria-controls"], ariaExpanded = _this$asProps2["aria-expanded"], ariaAutocomplete = _this$asProps2["aria-autocomplete"], ariaOwns = _this$asProps2["aria-owns"], ariaActivedescendant = _this$asProps2["aria-activedescendant"];
80
- return {
81
- "ref": this.inputRef,
82
- size,
83
- disabled,
84
- state,
85
- role,
86
- placeholder,
87
- "aria-haspopup": ariaHaspopup,
88
- "aria-controls": ariaControls,
89
- "aria-expanded": ariaExpanded,
90
- "aria-autocomplete": ariaAutocomplete,
91
- "aria-owns": ariaOwns,
92
- "aria-activedescendant": ariaActivedescendant
93
- };
94
- }
95
- }, {
96
- key: "render",
97
- value: function render() {
98
- var _ref = this.asProps;
99
- var SInput = Box;
100
- var SOutline = "div";
101
- var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, styles = _this$asProps3.styles, neighborLocation = _this$asProps3.neighborLocation, controlsLength = _this$asProps3.controlsLength, state = _this$asProps3.state;
102
- return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
103
- neighborLocation
104
- }, function(neighborLocation2) {
105
- var _ref4;
106
- return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SInput, _ref4.cn("SInput", _objectSpread({}, assignProps({
51
+ getAddonProps() {
52
+ const {
53
+ disabled,
54
+ size
55
+ } = this.asProps;
56
+ return {
57
+ disabled,
58
+ onMouseDown: this.handleMouseDownAddon,
59
+ onClick: this.handleClick,
60
+ size
61
+ };
62
+ }
63
+ getValueProps() {
64
+ const {
65
+ size,
66
+ disabled,
67
+ state,
68
+ role,
69
+ placeholder,
70
+ // these props might be passed from the <Select /> component
71
+ "aria-haspopup": ariaHaspopup,
72
+ "aria-controls": ariaControls,
73
+ "aria-expanded": ariaExpanded,
74
+ "aria-autocomplete": ariaAutocomplete,
75
+ "aria-owns": ariaOwns,
76
+ "aria-activedescendant": ariaActivedescendant
77
+ } = this.asProps;
78
+ return {
79
+ "ref": this.inputRef,
80
+ size,
81
+ disabled,
82
+ state,
83
+ role,
84
+ placeholder,
85
+ "aria-haspopup": ariaHaspopup,
86
+ "aria-controls": ariaControls,
87
+ "aria-expanded": ariaExpanded,
88
+ "aria-autocomplete": ariaAutocomplete,
89
+ "aria-owns": ariaOwns,
90
+ "aria-activedescendant": ariaActivedescendant
91
+ };
92
+ }
93
+ render() {
94
+ var _ref = this.asProps;
95
+ const SInput = Box;
96
+ const SOutline = "div";
97
+ const {
98
+ Children,
99
+ styles,
100
+ neighborLocation,
101
+ controlsLength,
102
+ state
103
+ } = this.asProps;
104
+ return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
105
+ neighborLocation
106
+ }, (neighborLocation2) => {
107
+ var _ref4;
108
+ return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SInput, _ref4.cn("SInput", {
109
+ ...assignProps({
107
110
  "neighborLocation": neighborLocation2,
108
111
  "__excludeProps": ["role", "aria-haspopup", "aria-controls", "aria-expanded", "placeholder", "aria-autocomplete", "aria-owns", "aria-activedescendant", "tabIndex"]
109
- }, _ref))), /* @__PURE__ */ React.createElement(NeighborLocation, _ref4.cn("NeighborLocation", {
110
- "controlsLength": controlsLength
111
- }), /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {}))), /* @__PURE__ */ React.createElement(SOutline, _ref4.cn("SOutline", {}), state === "invalid" && /* @__PURE__ */ React.createElement(InvalidStateBox, _ref4.cn("InvalidStateBox", {}))));
112
- });
113
- }
114
- }]);
115
- })(Component);
112
+ }, _ref)
113
+ }), /* @__PURE__ */ React.createElement(NeighborLocation, _ref4.cn("NeighborLocation", {
114
+ "controlsLength": controlsLength
115
+ }), /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {}))), /* @__PURE__ */ React.createElement(SOutline, _ref4.cn("SOutline", {}), state === "invalid" && /* @__PURE__ */ React.createElement(InvalidStateBox, _ref4.cn("InvalidStateBox", {}))));
116
+ });
117
+ }
118
+ }
116
119
  _defineProperty(Input, "displayName", "Input");
117
120
  _defineProperty(Input, "defaultProps", {
118
121
  size: "m",
119
122
  state: "normal"
120
123
  });
121
124
  _defineProperty(Input, "style", style);
122
- var Value = /* @__PURE__ */ (function(_Component2) {
123
- function Value2() {
124
- _classCallCheck(this, Value2);
125
- return _callSuper(this, Value2, arguments);
125
+ class Value extends Component {
126
+ uncontrolledProps() {
127
+ return {
128
+ value: (e) => e.target.value
129
+ };
126
130
  }
127
- _inherits(Value2, _Component2);
128
- return _createClass(Value2, [{
129
- key: "uncontrolledProps",
130
- value: function uncontrolledProps() {
131
- return {
132
- value: function value(e) {
133
- return e.target.value;
134
- }
135
- };
136
- }
137
- }, {
138
- key: "render",
139
- value: function render() {
140
- var _ref2 = this.asProps;
141
- var SValue = Box;
142
- var _this$asProps4 = this.asProps, styles = _this$asProps4.styles, neighborLocation = _this$asProps4.neighborLocation, state = _this$asProps4.state;
143
- return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
144
- neighborLocation
145
- }, function(neighborLocation2) {
146
- var _ref5;
147
- return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SValue, _ref5.cn("SValue", _objectSpread({}, assignProps({
131
+ render() {
132
+ var _ref2 = this.asProps;
133
+ const SValue = Box;
134
+ const {
135
+ styles,
136
+ neighborLocation,
137
+ state
138
+ } = this.asProps;
139
+ return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
140
+ neighborLocation
141
+ }, (neighborLocation2) => {
142
+ var _ref5;
143
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SValue, _ref5.cn("SValue", {
144
+ ...assignProps({
148
145
  "inAfterOutline": true,
149
146
  "neighborLocation": neighborLocation2,
150
147
  "tag": "input",
151
148
  "type": "text",
152
149
  "aria-invalid": state === "invalid"
153
- }, _ref2))));
154
- });
155
- }
156
- }]);
157
- })(Component);
150
+ }, _ref2)
151
+ }));
152
+ });
153
+ }
154
+ }
158
155
  _defineProperty(Value, "defaultProps", {
159
156
  defaultValue: ""
160
157
  });
161
- _defineProperty(Value, "enhance", [autoFocusEnhance()]);
162
158
  function Addon(props) {
163
159
  var _ref3 = arguments[0];
164
- var SAddon = Box;
165
- var Children = props.Children, styles = props.styles, neighborLocation = props.neighborLocation;
160
+ const SAddon = Box;
161
+ const {
162
+ Children,
163
+ styles,
164
+ neighborLocation
165
+ } = props;
166
166
  return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
167
167
  neighborLocation
168
- }, function(neighborLocation2) {
168
+ }, (neighborLocation2) => {
169
169
  var _ref6;
170
- return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref6.cn("SAddon", _objectSpread({}, assignProps({
171
- "neighborLocation": neighborLocation2
172
- }, _ref3))), /* @__PURE__ */ React.createElement(Children, _ref6.cn("Children", {})));
170
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref6.cn("SAddon", {
171
+ ...assignProps({
172
+ "neighborLocation": neighborLocation2
173
+ }, _ref3)
174
+ }), /* @__PURE__ */ React.createElement(Children, _ref6.cn("Children", {})));
173
175
  });
174
176
  }
175
- const Input$1 = createComponent(Input, {
177
+ const Input_default = createComponent(Input, {
176
178
  Addon,
177
179
  Value
178
180
  });
179
181
  export {
180
- Input$1 as default
182
+ Input_default as default
181
183
  };
@@ -105,10 +105,14 @@ SAddon[size='m']:not(SButton) {
105
105
  padding: 0 var(--intergalactic-spacing-2x, 8px);
106
106
  }
107
107
 
108
- SAddon[size='l']:not(SButton) {
108
+ SAddon[size='l'][neighborLocation='right']:not(SButton) {
109
109
  padding: 0 var(--intergalactic-spacing-2x, 8px) 0 var(--intergalactic-spacing-3x, 12px);
110
110
  }
111
111
 
112
+ SAddon[size='l'][neighborLocation='left']:not(SButton) {
113
+ padding: 0 var(--intergalactic-spacing-3x, 12px) 0 var(--intergalactic-spacing-2x, 8px);
114
+ }
115
+
112
116
  SInput SAddon:nth-last-child(2) {
113
117
  margin-right: -1px;
114
118
  }
@@ -1,13 +1,9 @@
1
- import type { Intergalactic, PropGetterFn, UnknownProperties } from '@semcore/core';
2
- import type { WithAutoFocusEnhanceProps } from '@semcore/core/lib/utils/enhances/autoFocusEnhance';
3
- import type { BoxProps } from '@semcore/flex-box';
4
- import type { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';
1
+ import type { BoxProps, NeighborItemProps, NeighborLocationProps } from '@semcore/base-components';
2
+ import type { Intergalactic, PropGetterFn } from '@semcore/core';
5
3
  import type React from 'react';
6
4
 
7
5
  export type InputSize = 'm' | 'l';
8
6
 
9
- /** @deprecated */
10
- export interface IInputProps extends InputProps, UnknownProperties {}
11
7
  export type InputProps = BoxProps &
12
8
  NeighborItemProps &
13
9
  NeighborLocationProps & {
@@ -27,11 +23,8 @@ export type InputProps = BoxProps &
27
23
  state?: 'normal' | 'invalid' | 'valid';
28
24
  };
29
25
 
30
- /** @deprecated */
31
- export interface IInputValueProps extends InputValueProps, UnknownProperties {}
32
26
  export type InputValueProps = BoxProps &
33
- NeighborItemProps &
34
- WithAutoFocusEnhanceProps & {
27
+ NeighborItemProps & {
35
28
  /**
36
29
  * Input value
37
30
  */
@@ -44,10 +37,6 @@ export type InputValueProps = BoxProps &
44
37
  * Handler for changing the value
45
38
  */
46
39
  onChange?: (value: string, event: React.SyntheticEvent<HTMLInputElement>) => void;
47
- /**
48
- * @deprecated Set `disabled` on `Input` instead.
49
- * */
50
- disabled?: boolean;
51
40
  /**
52
41
  * Sets the input to the read-only state
53
42
  * */
@@ -61,10 +50,13 @@ export type InputValueProps = BoxProps &
61
50
  * Placeholder for input
62
51
  */
63
52
  placeholder?: string;
53
+ /**
54
+ * Flag to enable autofocusing after component mounting
55
+ * @default false
56
+ */
57
+ autoFocus?: boolean;
64
58
  };
65
59
 
66
- /** @deprecated */
67
- export interface IInputAddonProps extends InputAddonProps, UnknownProperties {}
68
60
  export type InputAddonProps = BoxProps &
69
61
  NeighborItemProps & {
70
62
  /**
@@ -82,8 +74,6 @@ export type InputAddonProps = BoxProps &
82
74
  size?: InputSize;
83
75
  };
84
76
 
85
- /** @deprecated */
86
- export interface IInputCtx extends InputCtx, UnknownProperties {}
87
77
  export type InputCtx = {
88
78
  getValueProps: PropGetterFn;
89
79
  getAddonProps: PropGetterFn;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/input",
3
3
  "description": "Semrush Input Component",
4
- "version": "16.1.1-prerelease.5",
4
+ "version": "16.1.2-prerelease.8",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -13,12 +13,8 @@
13
13
  "import": "./lib/esm/index.mjs",
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
- "dependencies": {
17
- "@semcore/flex-box": "16.0.11-prerelease.5",
18
- "@semcore/neighbor-location": "16.0.11-prerelease.5"
19
- },
20
16
  "peerDependencies": {
21
- "@semcore/base-components": "^16.4.1-prerelease.5"
17
+ "@semcore/base-components": "^16.4.3-prerelease.8"
22
18
  },
23
19
  "repository": {
24
20
  "type": "git",
@@ -26,9 +22,10 @@
26
22
  "directory": "semcore/input"
27
23
  },
28
24
  "devDependencies": {
29
- "@semcore/core": "16.5.1-prerelease.5",
25
+ "@semcore/core": "16.5.1",
26
+ "@semcore/base-components": "16.4.3-prerelease.8",
30
27
  "@semcore/testing-utils": "1.0.0",
31
- "@semcore/icon": "16.7.2-prerelease.5"
28
+ "@semcore/icon": "16.7.2-prerelease.8"
32
29
  },
33
30
  "scripts": {
34
31
  "build": "pnpm semcore-builder --source=js && pnpm vite build"