@synerise/ds-input 0.18.17 → 0.18.20

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,37 @@
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.20](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.19...@synerise/ds-input@0.18.20) (2022-09-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **input:** add option to control width of input in stories ([6c67ecc](https://github.com/synerise/synerise-design/commit/6c67ecc3d97c1a60e5bd6e1a4703a71becd88ea1))
12
+ * **input:** fix styles of propa autoResize ([bb38df3](https://github.com/synerise/synerise-design/commit/bb38df33ebf425947d3a2f3df657d7fe044a09bb))
13
+
14
+
15
+
16
+
17
+
18
+ ## [0.18.19](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.18...@synerise/ds-input@0.18.19) (2022-08-31)
19
+
20
+ **Note:** Version bump only for package @synerise/ds-input
21
+
22
+
23
+
24
+
25
+
26
+ ## [0.18.18](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.17...@synerise/ds-input@0.18.18) (2022-08-29)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **input:** add new prop autoResize and styles to change width ([ea2a53f](https://github.com/synerise/synerise-design/commit/ea2a53f2f30cd00cb6df159d04b75344e1c7544d))
32
+
33
+
34
+
35
+
36
+
6
37
  ## [0.18.17](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@0.18.16...@synerise/ds-input@0.18.17) (2022-08-25)
7
38
 
8
39
  **Note:** Version bump only for package @synerise/ds-input
package/README.md CHANGED
@@ -46,6 +46,7 @@ Input UI Component
46
46
  | tooltipConfig | Config of tooltip | [TooltipProps](https://design.synerise.com/docs/components/tooltip#api) | - |
47
47
  | type | The type of input, see: [MDN](https://developer.mozilla.org/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)(use `Input.TextArea` instead of `type="textarea"`) | string | `text` |
48
48
  | value | The input content value | string | |
49
+ | autoResize | 'resize' width of the input based on width of the text in input | boolean | `false` |
49
50
 
50
51
  #### MaskedInput
51
52
 
package/dist/Input.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["className", "errorText", "label", "description", "counterLimit", "tooltip", "tooltipConfig", "icon1", "icon1Tooltip", "icon2", "icon2Tooltip", "resetMargin", "handleInputRef", "prefixel", "suffixel", "error"];
1
+ var _excluded = ["className", "errorText", "label", "description", "counterLimit", "tooltip", "tooltipConfig", "icon1", "icon1Tooltip", "autoResize", "icon2", "icon2Tooltip", "resetMargin", "handleInputRef", "prefixel", "suffixel", "error"];
2
2
 
3
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
4
 
@@ -32,6 +32,7 @@ var enhancedInput = function enhancedInput(WrappedComponent, _ref) {
32
32
  tooltipConfig = _ref2.tooltipConfig,
33
33
  icon1 = _ref2.icon1,
34
34
  icon1Tooltip = _ref2.icon1Tooltip,
35
+ autoResize = _ref2.autoResize,
35
36
  icon2 = _ref2.icon2,
36
37
  icon2Tooltip = _ref2.icon2Tooltip,
37
38
  resetMargin = _ref2.resetMargin,
@@ -78,6 +79,7 @@ var enhancedInput = function enhancedInput(WrappedComponent, _ref) {
78
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);
79
80
  }, [inputRef]);
80
81
  return /*#__PURE__*/React.createElement(S.OuterWrapper, {
82
+ autoResize: autoResize,
81
83
  className: className,
82
84
  resetMargin: resetMargin
83
85
  }, (label || counterLimit) && /*#__PURE__*/React.createElement(S.ContentAbove, null, /*#__PURE__*/React.createElement(Label, {
@@ -111,7 +113,11 @@ var enhancedInput = function enhancedInput(WrappedComponent, _ref) {
111
113
  className: className
112
114
  }, icon2 && React.cloneElement(icon2, {
113
115
  className: 'icon icon2'
114
- }))))), /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, antdInputProps, {
116
+ }))))), /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, antdInputProps, autoResize ? {
117
+ style: {
118
+ width: (antdInputProps.value && antdInputProps.value.toString().length + 1) + "3px"
119
+ }
120
+ } : {}, {
115
121
  className: hasErrorMessage || error ? 'error' : undefined,
116
122
  addonBefore: !!prefixel && /*#__PURE__*/React.createElement(S.AddonWrapper, {
117
123
  className: "ds-input-prefix",
@@ -3,8 +3,18 @@ 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 = {
7
+ autoResize?: boolean | {
8
+ minWidth: string;
9
+ maxWidth: string;
10
+ };
11
+ };
6
12
  export declare const OuterWrapper: import("styled-components").StyledComponent<"div", any, {
7
13
  resetMargin?: boolean | undefined;
14
+ autoResize?: boolean | {
15
+ minWidth: string;
16
+ maxWidth: string;
17
+ } | undefined;
8
18
  }, never>;
9
19
  export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
10
20
  interface InputWrapperProps {
@@ -15,10 +15,21 @@ 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
+ function autoresizeConfObjToCss(_ref) {
19
+ var autoResize = _ref.autoResize;
20
+ if (!autoResize) return '';
21
+
22
+ if (typeof autoResize === 'object') {
23
+ return "max-width: " + autoResize.maxWidth + "; min-width: " + autoResize.minWidth;
24
+ }
25
+
26
+ return "max-width: 400px; min-width: 150px;";
27
+ }
28
+
18
29
  export var OuterWrapper = styled.div.withConfig({
19
30
  displayName: "Inputstyles__OuterWrapper",
20
31
  componentId: "dc57an-0"
21
- })(["margin:", ";&.active{&&{input{box-shadow:inset 0 0 0 1px ", ";border-color:", ";background-color:", ";}}}"], function (props) {
32
+ })(["margin:", ";&.active{&&{input{box-shadow:inset 0 0 0 1px ", ";border-color:", ";background-color:", ";}}}input{", "}"], function (props) {
22
33
  return props.resetMargin ? '0' : '0 0 16px 0';
23
34
  }, function (props) {
24
35
  return props.theme.palette['blue-600'];
@@ -26,6 +37,8 @@ export var OuterWrapper = styled.div.withConfig({
26
37
  return props.theme.palette['blue-600'];
27
38
  }, function (props) {
28
39
  return props.theme.palette['blue-050'];
40
+ }, function (props) {
41
+ return autoresizeConfObjToCss(props);
29
42
  });
30
43
  export var Wrapper = styled.div.withConfig({
31
44
  displayName: "Inputstyles__Wrapper",
@@ -64,9 +77,9 @@ export var IconWrapper = styled.div.withConfig({
64
77
  return props.theme.palette['blue-600'];
65
78
  });
66
79
  export var AntdInput = styled(React.forwardRef( // eslint-disable-next-line
67
- function (_ref, ref) {
68
- var error = _ref.error,
69
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
80
+ function (_ref2, ref) {
81
+ var error = _ref2.error,
82
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded);
70
83
 
71
84
  return (
72
85
  /*#__PURE__*/
@@ -90,10 +103,10 @@ function (_ref, ref) {
90
103
  return props.size === 'large' ? "2.49" : "1.29";
91
104
  });
92
105
  export var AntdMaskedInput = styled(React.forwardRef( // eslint-disable-next-line
93
- function (_ref2, ref) {
94
- var error = _ref2.error,
95
- mask = _ref2.mask,
96
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
106
+ function (_ref3, ref) {
107
+ var error = _ref3.error,
108
+ mask = _ref3.mask,
109
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded2);
97
110
 
98
111
  return (
99
112
  /*#__PURE__*/
@@ -116,9 +129,9 @@ function (_ref2, ref) {
116
129
  return props.theme.palette['grey-700'];
117
130
  });
118
131
  export var AntdTextArea = styled(React.forwardRef( // eslint-disable-next-line
119
- function (_ref3, ref) {
120
- var error = _ref3.error,
121
- props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
132
+ function (_ref4, ref) {
133
+ var error = _ref4.error,
134
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
122
135
 
123
136
  return (
124
137
  /*#__PURE__*/
@@ -20,5 +20,6 @@ export interface Props {
20
20
  handleInputRef?: (ref: React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | undefined>) => void;
21
21
  prefixel?: React.ReactNode;
22
22
  suffixel?: React.ReactNode;
23
+ autoResize?: boolean;
23
24
  }
24
25
  export declare type EnhancedProps = Props & (InputProps | TextAreaProps | MaskedInputProps);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-input",
3
- "version": "0.18.17",
3
+ "version": "0.18.20",
4
4
  "description": "Input UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -32,9 +32,9 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-icon": "^0.50.0",
36
- "@synerise/ds-scrollbar": "^0.5.1",
37
- "@synerise/ds-tooltip": "^0.11.16",
35
+ "@synerise/ds-icon": "^0.51.0",
36
+ "@synerise/ds-scrollbar": "^0.5.2",
37
+ "@synerise/ds-tooltip": "^0.11.17",
38
38
  "@synerise/ds-typography": "^0.12.7",
39
39
  "@synerise/ds-utils": "^0.19.0",
40
40
  "antd-mask-input": "^0.1.13",
@@ -45,5 +45,5 @@
45
45
  "antd": "^4",
46
46
  "react": ">=16.9.0 < 17.0.0"
47
47
  },
48
- "gitHead": "c9530f0548fa244796b0c6b1ea5fa3d6330e84ea"
48
+ "gitHead": "428157b5217485a8d335e54a54e95bec93a768a7"
49
49
  }