@synerise/ds-input 0.18.24 → 0.18.26

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 CHANGED
@@ -3,6 +3,32 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.18.26](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.25...@synerise/ds-input@0.18.26) (2022-11-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **input:** change width of input when window is max 960px ([1446c0d](https://github.com/synerise/synerise-design/commit/1446c0dcf7a369b5cbc62b4895a3c8b134c56caa))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.18.25](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.24...@synerise/ds-input@0.18.25) (2022-11-08)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **input:** fix prop autoresize and change his functionality ([f825a8f](https://github.com/synerise/synerise-design/commit/f825a8f3864a1246f31fa52301a3d5d00fbbf884))
23
+ * **input:** fix spacebar in input autoresize ([1a53665](https://github.com/synerise/synerise-design/commit/1a536655ec0cf8195fdbddf1be4e07f227960929))
24
+ * **input:** fix styles ([4a36016](https://github.com/synerise/synerise-design/commit/4a360160004686ecfcb2482180f76f60999865f5))
25
+ * **input:** fix styles ([bf4a026](https://github.com/synerise/synerise-design/commit/bf4a026827594c31524a3b26b91d3aac4a3fef0f))
26
+ * **input:** fix styles and add new story AutoResizeInModal ([27b88fb](https://github.com/synerise/synerise-design/commit/27b88fb48791c74124c266870f83027eb371177d))
27
+
28
+
29
+
30
+
31
+
6
32
  ## [0.18.24](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.23...@synerise/ds-input@0.18.24) (2022-10-11)
7
33
 
8
34
 
package/dist/Input.d.ts CHANGED
@@ -49,21 +49,6 @@ export declare const MaskedInput: (React.ComponentClass<(object & Props & InputP
49
49
  }) | (object & Props & TextAreaProps)> & {
50
50
  displayName: string;
51
51
  });
52
- export declare const AutoResizeInput: (React.ComponentClass<(object & Props & InputProps) | (object & Props & InputProps & {
53
- mask: string;
54
- formatCharacters?: object | undefined;
55
- placeholderChar?: string | undefined;
56
- value?: string | undefined;
57
- }) | (object & Props & TextAreaProps), any> & {
58
- displayName: string;
59
- }) | (React.FunctionComponent<(object & Props & InputProps) | (object & Props & InputProps & {
60
- mask: string;
61
- formatCharacters?: object | undefined;
62
- placeholderChar?: string | undefined;
63
- value?: string | undefined;
64
- }) | (object & Props & TextAreaProps)> & {
65
- displayName: string;
66
- });
67
52
  export declare const RawMaskedInput: StyledComponent<React.ForwardRefExoticComponent<{
68
53
  error?: boolean | undefined;
69
54
  mask: string;
@@ -78,3 +63,5 @@ export declare const RawTextArea: StyledComponent<React.ForwardRefExoticComponen
78
63
  error?: boolean | undefined;
79
64
  }, never>;
80
65
  export { default as InputMultivalue } from './InputMultivalue/InputMultivalue';
66
+ export declare const AutoResize: any;
67
+ export declare const WrapperAutoResize: any;
package/dist/Input.js CHANGED
@@ -1,13 +1,13 @@
1
1
  var _excluded = ["className", "errorText", "label", "description", "counterLimit", "tooltip", "tooltipConfig", "icon1", "icon1Tooltip", "autoResize", "icon2", "icon2Tooltip", "resetMargin", "handleInputRef", "prefixel", "suffixel", "error"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
-
5
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
4
 
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
6
 
9
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
8
 
9
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10
+
11
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
12
 
13
13
  import * as React from 'react';
@@ -78,6 +78,28 @@ var enhancedInput = function enhancedInput(WrappedComponent, _ref) {
78
78
  // @ts-ignore
79
79
  inputRef.current && setInputAddonHeight(inputRef == null ? void 0 : (_inputRef$current = inputRef.current) == null ? void 0 : (_inputRef$current$inp = _inputRef$current.input) == null ? void 0 : _inputRef$current$inp.offsetHeight);
80
80
  }, [inputRef]);
81
+
82
+ var renderInputComponent = function renderInputComponent() {
83
+ return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, antdInputProps, {
84
+ autoResize: autoResize,
85
+ className: hasErrorMessage || error ? 'error' : undefined,
86
+ addonBefore: !!prefixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
87
+ className: "ds-input-prefix",
88
+ height: inputAddonHeight - VERTICAL_BORDER_OFFSET
89
+ }, prefixel),
90
+ addonAfter: !!suffixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
91
+ className: "ds-input-suffix",
92
+ height: inputAddonHeight - VERTICAL_BORDER_OFFSET
93
+ }, suffixel),
94
+ error: hasErrorMessage || error,
95
+ onChange: handleChange,
96
+ value: antdInputProps.value,
97
+ id: id,
98
+ ref: inputRef,
99
+ autoComplete: "off"
100
+ }));
101
+ };
102
+
81
103
  return /*#__PURE__*/React.createElement(S.OuterWrapper, {
82
104
  autoResize: autoResize,
83
105
  className: className,
@@ -113,23 +135,15 @@ var enhancedInput = function enhancedInput(WrappedComponent, _ref) {
113
135
  className: className
114
136
  }, icon2 && React.cloneElement(icon2, {
115
137
  className: 'icon icon2'
116
- }))))), /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, antdInputProps, autoResize, {
117
- className: hasErrorMessage || error ? 'error' : undefined,
118
- addonBefore: !!prefixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
119
- className: "ds-input-prefix",
120
- height: inputAddonHeight - VERTICAL_BORDER_OFFSET
121
- }, prefixel),
122
- addonAfter: !!suffixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
123
- className: "ds-input-suffix",
124
- height: inputAddonHeight - VERTICAL_BORDER_OFFSET
125
- }, suffixel),
126
- error: hasErrorMessage || error,
127
- onChange: handleChange,
128
- value: antdInputProps.value,
129
- id: id,
130
- ref: inputRef,
131
- autoComplete: "off"
132
- }))), (hasErrorMessage || description) && /*#__PURE__*/React.createElement(S.ContentBelow, null, hasErrorMessage && /*#__PURE__*/React.createElement(S.ErrorText, null, errorText), description && /*#__PURE__*/React.createElement(S.Description, null, description)));
138
+ }))))), autoResize ? /*#__PURE__*/React.createElement(S.WrapperAutoResize, {
139
+ autoResize: autoResize
140
+ }, renderInputComponent(), /*#__PURE__*/React.createElement(S.AutoResize, {
141
+ icon1: icon1,
142
+ icon2: icon2,
143
+ suffixel: suffixel,
144
+ prefixel: prefixel,
145
+ autoResize: autoResize
146
+ }, antdInputProps.value)) : renderInputComponent()), (hasErrorMessage || description) && /*#__PURE__*/React.createElement(S.ContentBelow, null, hasErrorMessage && /*#__PURE__*/React.createElement(S.ErrorText, null, errorText), description && /*#__PURE__*/React.createElement(S.Description, null, description)));
133
147
  };
134
148
  };
135
149
 
@@ -148,11 +162,6 @@ export var MaskedInput = Object.assign(enhancedInput(S.AntdMaskedInput, {
148
162
  }), {
149
163
  displayName: 'MaskedInput'
150
164
  });
151
- export var AutoResizeInput = Object.assign(enhancedInput(S.AutoResizeInput, {
152
- type: 'input'
153
- }), {
154
- displayName: 'AutoResizeInput'
155
- });
156
165
  export var RawMaskedInput = S.AntdMaskedInput;
157
166
  export { default as InputGroup } from './InputGroup';
158
167
  export var RawInput = function RawInput(props) {
@@ -162,4 +171,6 @@ export var RawInput = function RawInput(props) {
162
171
  }, props));
163
172
  };
164
173
  export var RawTextArea = S.AntdTextArea;
165
- export { default as InputMultivalue } from './InputMultivalue/InputMultivalue';
174
+ export { default as InputMultivalue } from './InputMultivalue/InputMultivalue';
175
+ export var AutoResize = Object.assign(S.AutoResize);
176
+ export var WrapperAutoResize = Object.assign(S.WrapperAutoResize);
@@ -3,12 +3,15 @@ import TextArea from 'antd/lib/input/TextArea';
3
3
  import * as React from 'react';
4
4
  import MaskedInput from 'antd-mask-input';
5
5
  import { SizeType } from 'antd/es/config-provider/SizeContext';
6
- import AutosizeInput from 'react-input-autosize';
7
- export declare type AutoResizeProps = {
6
+ export declare type AutoResizeInputProps = {
8
7
  autoResize?: boolean | {
9
8
  minWidth: string;
10
9
  maxWidth: string;
11
10
  };
11
+ suffixel?: boolean | React.ReactNode;
12
+ prefixel?: boolean | React.ReactNode;
13
+ icon1?: boolean | React.ReactNode;
14
+ icon2?: boolean | React.ReactNode;
12
15
  };
13
16
  export declare const OuterWrapper: import("styled-components").StyledComponent<"div", any, {
14
17
  resetMargin?: boolean | undefined;
@@ -47,16 +50,14 @@ export declare const AntdTextArea: import("styled-components").StyledComponent<R
47
50
  } & React.RefAttributes<TextArea>>, any, {
48
51
  error?: boolean | undefined;
49
52
  }, never>;
50
- export declare const AutoResizeInput: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<{
51
- error?: boolean | undefined;
52
- } & React.RefAttributes<AutosizeInput>>, any, {
53
- error?: boolean | undefined;
53
+ export declare const ContentBelow: import("styled-components").StyledComponent<"div", any, {}, never>;
54
+ export declare const WrapperAutoResize: import("styled-components").StyledComponent<"div", any, {
54
55
  autoResize?: boolean | {
55
56
  minWidth: string;
56
57
  maxWidth: string;
57
58
  } | undefined;
58
59
  }, never>;
59
- export declare const ContentBelow: import("styled-components").StyledComponent<"div", any, {}, never>;
60
+ export declare const AutoResize: import("styled-components").StyledComponent<"div", any, AutoResizeInputProps, never>;
60
61
  export declare const ErrorText: import("styled-components").StyledComponent<"div", any, {}, never>;
61
62
  export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
62
63
  export declare const Counter: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,7 +1,6 @@
1
1
  var _excluded = ["error"],
2
2
  _excluded2 = ["error", "mask"],
3
- _excluded3 = ["error"],
4
- _excluded4 = ["error"];
3
+ _excluded3 = ["error"];
5
4
 
6
5
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
7
6
 
@@ -11,24 +10,21 @@ import styled, { css } from 'styled-components';
11
10
  import BaseAntInput from 'antd/lib/input';
12
11
  import * as React from 'react';
13
12
  import MaskedInput from 'antd-mask-input';
14
- import AutosizeInput from 'react-input-autosize';
15
13
 
16
14
  var errorInputStyle = function errorInputStyle(props) {
17
15
  return "\n &&&, && .ant-input {\n border-color: " + props.theme.palette['red-600'] + ";\n box-shadow: inset 0 0 0 1px " + props.theme.palette['red-600'] + ";\n background: " + props.theme.palette['red-050'] + ";\n }\n";
18
16
  };
19
17
 
20
- var errorAutoSizeInputStyle = function errorAutoSizeInputStyle(props) {
21
- return "\n border-color: " + props.theme.palette['red-600'] + ";\n box-shadow: inset 0 0 0 1px " + props.theme.palette['red-600'] + ";\n background: " + props.theme.palette['red-050'] + ";\n";
22
- };
18
+ var getPaddingAutoResize = function getPaddingAutoResize(props) {
19
+ if (props.prefixel || props.suffixel) {
20
+ return '0 43px';
21
+ }
23
22
 
24
- var active = function active() {
25
- return css(["transition:box-shadow 0.2s ease-in-out;box-shadow:inset 0 0 0 1px ", ";border:1px solid ", ";background-color:", ";"], function (props) {
26
- return props.theme.palette['blue-600'];
27
- }, function (props) {
28
- return props.theme.palette['blue-600'];
29
- }, function (props) {
30
- return props.theme.palette['blue-050'];
31
- });
23
+ if (props.icon1 || props.icon2) {
24
+ return '0 25px';
25
+ }
26
+
27
+ return '0 13px';
32
28
  };
33
29
 
34
30
  function autoresizeConfObjToCss(_ref) {
@@ -45,7 +41,7 @@ function autoresizeConfObjToCss(_ref) {
45
41
  export var OuterWrapper = styled.div.withConfig({
46
42
  displayName: "Inputstyles__OuterWrapper",
47
43
  componentId: "dc57an-0"
48
- })(["margin:", ";&.active{&&{input{box-shadow:inset 0 0 0 1px ", ";border-color:", ";background-color:", ";}}}input{", "}"], function (props) {
44
+ })(["margin:", ";&.active{&&{input{box-shadow:inset 0 0 0 1px ", ";border-color:", ";background-color:", ";}}}input{", " @media (max-width:960px){max-width:150px;}}"], function (props) {
49
45
  return props.resetMargin ? '0' : '0 0 16px 0';
50
46
  }, function (props) {
51
47
  return props.theme.palette['blue-600'];
@@ -109,7 +105,7 @@ function (_ref2, ref) {
109
105
  })).withConfig({
110
106
  displayName: "Inputstyles__AntdInput",
111
107
  componentId: "dc57an-6"
112
- })(["", ";&&&{min-height:32px;color:", ";z-index:1;&::placeholder{color:", ";}&::-moz-placeholder{line-height:", ";}.ds-input-prefix{border-top-left-radius:3px;border-bottom-left-radius:3px;}.ds-input-suffix{border-top-right-radius:3px;border-bottom-right-radius:3px;}}"], function (props) {
108
+ })(["", ";&&&{min-height:32px;grid-area:1 / 1;color:", ";z-index:1;&::placeholder{color:", ";}&::-moz-placeholder{line-height:", ";}.ds-input-prefix{border-top-left-radius:3px;border-bottom-left-radius:3px;}.ds-input-suffix{border-top-right-radius:3px;border-bottom-right-radius:3px;}}"], function (props) {
113
109
  return props.error ? errorInputStyle(props) : '';
114
110
  }, function (props) {
115
111
  return props.theme.palette['grey-700'];
@@ -166,67 +162,53 @@ function (_ref4, ref) {
166
162
  }, function (props) {
167
163
  return props.theme.palette['grey-700'];
168
164
  });
169
- export var AutoResizeInput = styled(React.forwardRef( // eslint-disable-next-line
170
- function (_ref5) {
171
- var error = _ref5.error,
172
- props = _objectWithoutPropertiesLoose(_ref5, _excluded4);
173
-
174
- return (
175
- /*#__PURE__*/
176
- // eslint-disable-next-line
177
- React.createElement(AutosizeInput, props)
178
- );
179
- })).withConfig({
180
- displayName: "Inputstyles__AutoResizeInput",
181
- componentId: "dc57an-9"
182
- })(["input{border:1px solid ", ";", ";border-radius:3px;font-size:13px;line-height:17px;", " padding:7px 12px 6px;color:", ";::placeholder{color:", ";}&:hover{border:1px solid ", ";&:disabled{cursor:not-allowed;border:1px solid ", ";}}&.active{", "}&:focus{", " &:hover{", "}}}"], function (props) {
183
- return props.theme.palette['grey-300'];
184
- }, function (props) {
185
- return props.error ? errorAutoSizeInputStyle(props) : '';
186
- }, function (props) {
187
- return autoresizeConfObjToCss(props);
188
- }, function (props) {
189
- return props.theme.palette['grey-600'];
190
- }, function (props) {
191
- return props.theme.palette['grey-500'];
192
- }, function (props) {
193
- return props.theme.palette['grey-400'];
194
- }, function (props) {
195
- return props.theme.palette['grey-300'];
196
- }, active(), active(), active());
197
165
  export var ContentBelow = styled.div.withConfig({
198
166
  displayName: "Inputstyles__ContentBelow",
199
- componentId: "dc57an-10"
167
+ componentId: "dc57an-9"
200
168
  })(["margin-top:8px;"]);
169
+ export var WrapperAutoResize = styled.div.withConfig({
170
+ displayName: "Inputstyles__WrapperAutoResize",
171
+ componentId: "dc57an-10"
172
+ })(["display:inline-grid;align-items:center justify-items:start;", ""], function (props) {
173
+ return autoresizeConfObjToCss(props);
174
+ });
175
+ export var AutoResize = styled.div.withConfig({
176
+ displayName: "Inputstyles__AutoResize",
177
+ componentId: "dc57an-11"
178
+ })(["max-height:32px;grid-area:1 / 1;visibility:hidden;white-space:pre;padding:", ";", ";@media (max-width:960px){max-width:150px;}"], function (props) {
179
+ return getPaddingAutoResize(props);
180
+ }, function (props) {
181
+ return props.autoResize && props.suffixel ? autoresizeConfObjToCss(props) : '';
182
+ });
201
183
  export var ErrorText = styled.div.withConfig({
202
184
  displayName: "Inputstyles__ErrorText",
203
- componentId: "dc57an-11"
185
+ componentId: "dc57an-12"
204
186
  })(["color:", ";margin-bottom:4px;"], function (props) {
205
187
  return props.theme.palette['red-600'];
206
188
  });
207
189
  export var Label = styled.label.withConfig({
208
190
  displayName: "Inputstyles__Label",
209
- componentId: "dc57an-12"
191
+ componentId: "dc57an-13"
210
192
  })(["color:", ";font-weight:500;display:block;"], function (props) {
211
193
  return props.theme.palette['grey-800'];
212
194
  });
213
195
  export var Counter = styled.div.withConfig({
214
196
  displayName: "Inputstyles__Counter",
215
- componentId: "dc57an-13"
197
+ componentId: "dc57an-14"
216
198
  })(["font-weight:500;"]);
217
199
  export var Description = styled.div.withConfig({
218
200
  displayName: "Inputstyles__Description",
219
- componentId: "dc57an-14"
201
+ componentId: "dc57an-15"
220
202
  })(["color:", ";"], function (props) {
221
203
  return props.theme.palette['grey-600'];
222
204
  });
223
205
  export var ContentAbove = styled.div.withConfig({
224
206
  displayName: "Inputstyles__ContentAbove",
225
- componentId: "dc57an-15"
207
+ componentId: "dc57an-16"
226
208
  })(["display:flex;justify-content:space-between;margin-bottom:8px;min-height:18px;"]);
227
209
  export var AddonWrapper = styled.div.withConfig({
228
210
  displayName: "Inputstyles__AddonWrapper",
229
- componentId: "dc57an-16"
211
+ componentId: "dc57an-17"
230
212
  })(["background:", ";display:flex;align-items:center;height:", ";"], function (props) {
231
213
  return props.theme.palette['grey-050'];
232
214
  }, function (props) {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { EnhancedProps } from './Input.types';
2
2
  export { default as Label } from './Label/Label';
3
- export { Input, TextArea, RawInput, RawTextArea, InputGroup, MaskedInput, InputMultivalue, RawMaskedInput, AutoResizeInput, } from './Input';
3
+ export { Input, TextArea, RawInput, RawTextArea, InputGroup, MaskedInput, InputMultivalue, RawMaskedInput, AutoResize, WrapperAutoResize, } from './Input';
4
4
  export type { EnhancedProps };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as Label } from './Label/Label';
2
- export { Input, TextArea, RawInput, RawTextArea, InputGroup, MaskedInput, InputMultivalue, RawMaskedInput, AutoResizeInput } from './Input';
2
+ export { Input, TextArea, RawInput, RawTextArea, InputGroup, MaskedInput, InputMultivalue, RawMaskedInput, AutoResize, WrapperAutoResize } from './Input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-input",
3
- "version": "0.18.24",
3
+ "version": "0.18.26",
4
4
  "description": "Input UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -45,5 +45,5 @@
45
45
  "antd": "^4",
46
46
  "react": ">=16.9.0 < 17.0.0"
47
47
  },
48
- "gitHead": "41d417bdee4ee513979582394f0b4cdcdb2fed2f"
48
+ "gitHead": "6b0b6e27c72584c59317a83a8922a3fbf9aaf81f"
49
49
  }