@synerise/ds-input 0.18.23 → 0.18.25

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,36 @@
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.25](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.24...@synerise/ds-input@0.18.25) (2022-11-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **input:** fix prop autoresize and change his functionality ([f825a8f](https://github.com/synerise/synerise-design/commit/f825a8f3864a1246f31fa52301a3d5d00fbbf884))
12
+ * **input:** fix spacebar in input autoresize ([1a53665](https://github.com/synerise/synerise-design/commit/1a536655ec0cf8195fdbddf1be4e07f227960929))
13
+ * **input:** fix styles ([4a36016](https://github.com/synerise/synerise-design/commit/4a360160004686ecfcb2482180f76f60999865f5))
14
+ * **input:** fix styles ([bf4a026](https://github.com/synerise/synerise-design/commit/bf4a026827594c31524a3b26b91d3aac4a3fef0f))
15
+ * **input:** fix styles and add new story AutoResizeInModal ([27b88fb](https://github.com/synerise/synerise-design/commit/27b88fb48791c74124c266870f83027eb371177d))
16
+
17
+
18
+
19
+
20
+
21
+ ## [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)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **input:** add draft of test ([e15bcf3](https://github.com/synerise/synerise-design/commit/e15bcf339837e76f15450056cf361463a3e833f3))
27
+ * **input:** add new component input autoresize ([c330c02](https://github.com/synerise/synerise-design/commit/c330c02f67f61352304497e5b0e84b3f95c3e6ee))
28
+ * **input:** fix style of animation in input ([0b5dd2a](https://github.com/synerise/synerise-design/commit/0b5dd2ad40189ae1f9ef540cc6534925747e050b))
29
+ * **input:** fix style of text in input ([28bc966](https://github.com/synerise/synerise-design/commit/28bc966a5c62200bbc4ccdfc6dfdbaecf40a6107))
30
+ * **input:** fixes styles ([8b19c28](https://github.com/synerise/synerise-design/commit/8b19c28b8031f9dda6d6392446ca4d167c576868))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [0.18.23](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.22...@synerise/ds-input@0.18.23) (2022-09-28)
7
37
 
8
38
 
package/dist/Input.d.ts CHANGED
@@ -63,3 +63,5 @@ export declare const RawTextArea: StyledComponent<React.ForwardRefExoticComponen
63
63
  error?: boolean | undefined;
64
64
  }, never>;
65
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,27 +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
- style: {
118
- width: (antdInputProps.value && antdInputProps.value.toString().length + 1) + "3px"
119
- }
120
- } : {}, {
121
- className: hasErrorMessage || error ? 'error' : undefined,
122
- addonBefore: !!prefixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
123
- className: "ds-input-prefix",
124
- height: inputAddonHeight - VERTICAL_BORDER_OFFSET
125
- }, prefixel),
126
- addonAfter: !!suffixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
127
- className: "ds-input-suffix",
128
- height: inputAddonHeight - VERTICAL_BORDER_OFFSET
129
- }, suffixel),
130
- error: hasErrorMessage || error,
131
- onChange: handleChange,
132
- value: antdInputProps.value,
133
- id: id,
134
- ref: inputRef,
135
- autoComplete: "off"
136
- }))), (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)));
137
147
  };
138
148
  };
139
149
 
@@ -161,4 +171,6 @@ export var RawInput = function RawInput(props) {
161
171
  }, props));
162
172
  };
163
173
  export var RawTextArea = S.AntdTextArea;
164
- 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,11 +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
- export declare type AutoResizeProps = {
6
+ export declare type AutoResizeInputProps = {
7
7
  autoResize?: boolean | {
8
8
  minWidth: string;
9
9
  maxWidth: string;
10
10
  };
11
+ suffixel?: boolean | React.ReactNode;
12
+ prefixel?: boolean | React.ReactNode;
13
+ icon1?: boolean | React.ReactNode;
14
+ icon2?: boolean | React.ReactNode;
11
15
  };
12
16
  export declare const OuterWrapper: import("styled-components").StyledComponent<"div", any, {
13
17
  resetMargin?: boolean | undefined;
@@ -47,6 +51,13 @@ export declare const AntdTextArea: import("styled-components").StyledComponent<R
47
51
  error?: boolean | undefined;
48
52
  }, never>;
49
53
  export declare const ContentBelow: import("styled-components").StyledComponent<"div", any, {}, never>;
54
+ export declare const WrapperAutoResize: import("styled-components").StyledComponent<"div", any, {
55
+ autoResize?: boolean | {
56
+ minWidth: string;
57
+ maxWidth: string;
58
+ } | undefined;
59
+ }, never>;
60
+ export declare const AutoResize: import("styled-components").StyledComponent<"div", any, AutoResizeInputProps, never>;
50
61
  export declare const ErrorText: import("styled-components").StyledComponent<"div", any, {}, never>;
51
62
  export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
52
63
  export declare const Counter: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -15,6 +15,18 @@ var errorInputStyle = function errorInputStyle(props) {
15
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";
16
16
  };
17
17
 
18
+ var getPaddingAutoResize = function getPaddingAutoResize(props) {
19
+ if (props.prefixel || props.suffixel) {
20
+ return '0 43px';
21
+ }
22
+
23
+ if (props.icon1 || props.icon2) {
24
+ return '0 25px';
25
+ }
26
+
27
+ return '0 13px';
28
+ };
29
+
18
30
  function autoresizeConfObjToCss(_ref) {
19
31
  var autoResize = _ref.autoResize;
20
32
  if (!autoResize) return '';
@@ -93,7 +105,7 @@ function (_ref2, ref) {
93
105
  })).withConfig({
94
106
  displayName: "Inputstyles__AntdInput",
95
107
  componentId: "dc57an-6"
96
- })(["", ";&&&{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) {
97
109
  return props.error ? errorInputStyle(props) : '';
98
110
  }, function (props) {
99
111
  return props.theme.palette['grey-700'];
@@ -154,35 +166,49 @@ export var ContentBelow = styled.div.withConfig({
154
166
  displayName: "Inputstyles__ContentBelow",
155
167
  componentId: "dc57an-9"
156
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:", ";", ";"], function (props) {
179
+ return getPaddingAutoResize(props);
180
+ }, function (props) {
181
+ return props.autoResize && props.suffixel ? autoresizeConfObjToCss(props) : '';
182
+ });
157
183
  export var ErrorText = styled.div.withConfig({
158
184
  displayName: "Inputstyles__ErrorText",
159
- componentId: "dc57an-10"
185
+ componentId: "dc57an-12"
160
186
  })(["color:", ";margin-bottom:4px;"], function (props) {
161
187
  return props.theme.palette['red-600'];
162
188
  });
163
189
  export var Label = styled.label.withConfig({
164
190
  displayName: "Inputstyles__Label",
165
- componentId: "dc57an-11"
191
+ componentId: "dc57an-13"
166
192
  })(["color:", ";font-weight:500;display:block;"], function (props) {
167
193
  return props.theme.palette['grey-800'];
168
194
  });
169
195
  export var Counter = styled.div.withConfig({
170
196
  displayName: "Inputstyles__Counter",
171
- componentId: "dc57an-12"
197
+ componentId: "dc57an-14"
172
198
  })(["font-weight:500;"]);
173
199
  export var Description = styled.div.withConfig({
174
200
  displayName: "Inputstyles__Description",
175
- componentId: "dc57an-13"
201
+ componentId: "dc57an-15"
176
202
  })(["color:", ";"], function (props) {
177
203
  return props.theme.palette['grey-600'];
178
204
  });
179
205
  export var ContentAbove = styled.div.withConfig({
180
206
  displayName: "Inputstyles__ContentAbove",
181
- componentId: "dc57an-14"
207
+ componentId: "dc57an-16"
182
208
  })(["display:flex;justify-content:space-between;margin-bottom:8px;min-height:18px;"]);
183
209
  export var AddonWrapper = styled.div.withConfig({
184
210
  displayName: "Inputstyles__AddonWrapper",
185
- componentId: "dc57an-15"
211
+ componentId: "dc57an-17"
186
212
  })(["background:", ";display:flex;align-items:center;height:", ";"], function (props) {
187
213
  return props.theme.palette['grey-050'];
188
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, } 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 } 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.23",
3
+ "version": "0.18.25",
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": "07b8ee9d3f238ab4a03d04380ab9011620b55ec1"
48
+ "gitHead": "c1fdb8f769bf8c3a529d877a6bd9942a380c3e17"
49
49
  }