@synerise/ds-input 1.3.1 → 1.3.3
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 +608 -1809
- package/README.md +13 -13
- package/dist/AutosizeInput/AutosizeInput.js +1 -1
- package/dist/AutosizeInput/AutosizeInput.types.d.ts +1 -1
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +13 -12
- package/dist/Input.styles.d.ts +5 -5
- package/dist/Input.styles.js +8 -10
- package/dist/Input.types.d.ts +1 -1
- package/dist/InputGroup.d.ts +1 -1
- package/dist/InputGroup.js +1 -1
- package/dist/InputGroup.types.d.ts +1 -1
- package/dist/InputMultivalue/Elements/Value.js +29 -33
- package/dist/InputMultivalue/Elements/Value.types.d.ts +2 -2
- package/dist/InputMultivalue/InputMultivalue.d.ts +1 -1
- package/dist/InputMultivalue/InputMultivalue.js +5 -8
- package/dist/InputMultivalue/InputMultivalue.types.d.ts +1 -1
- package/dist/TextArea.d.ts +1 -1
- package/dist/TextArea.js +5 -5
- package/dist/Textarea/Textarea.d.ts +1 -1
- package/dist/Textarea/Textarea.js +1 -1
- package/dist/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/Textarea/Textarea.styles.js +12 -4
- package/dist/Textarea/Textarea.types.d.ts +3 -3
- package/dist/components/ElementIcons.d.ts +2 -2
- package/dist/components/ElementIcons.js +1 -1
- package/dist/components/ExpandableWrapper.d.ts +2 -2
- package/dist/components/ExpandableWrapper.js +1 -1
- package/dist/hooks/useCounterLimit.d.ts +2 -2
- package/dist/hooks/useElementFocus.d.ts +1 -1
- package/dist/hooks/useInputAddonHeight.d.ts +1 -1
- package/dist/hooks/useInputAddonHeight.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils/getCharCount.d.ts +2 -2
- package/dist/utils/getCharCount.js +3 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -50,19 +50,19 @@ Input UI Component
|
|
|
50
50
|
|
|
51
51
|
```
|
|
52
52
|
type AutoResizeProp = `boolean` | {
|
|
53
|
-
minWidth: string;
|
|
54
|
-
maxWidth?: string;
|
|
55
|
-
stretchToFit?: boolean
|
|
53
|
+
minWidth: string;
|
|
54
|
+
maxWidth?: string;
|
|
55
|
+
stretchToFit?: boolean
|
|
56
56
|
};
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Setting `stretchToFit: true` will make the field stretch to fit the containing element. The component observes the width of the wrapper and adjusts the maxWidth accordingly.
|
|
60
|
-
**Important** if the Input is within a flex-item then there is necessary CSS that needs to be applied to the flex-item containers in order for the flex-item to grow to fill the allowed space, but at the same time not stretch the flex container (identical issue happens when text-overflow needs to happen inside a flex-item).
|
|
60
|
+
**Important** if the Input is within a flex-item then there is necessary CSS that needs to be applied to the flex-item containers in order for the flex-item to grow to fill the allowed space, but at the same time not stretch the flex container (identical issue happens when text-overflow needs to happen inside a flex-item).
|
|
61
61
|
|
|
62
62
|
```css
|
|
63
63
|
$flexItemSurroundingTheInput {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
min-width: 0;
|
|
65
|
+
flex-grow: 1;
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -77,10 +77,10 @@ See https://css-tricks.com/flexbox-truncated-text/ for more details.
|
|
|
77
77
|
|
|
78
78
|
#### TextArea
|
|
79
79
|
|
|
80
|
-
| Property
|
|
81
|
-
|
|
|
82
|
-
| autoSize
|
|
83
|
-
| errorText
|
|
84
|
-
| error
|
|
85
|
-
| resize
|
|
86
|
-
| wrapperStyle
|
|
80
|
+
| Property | Description | Type | Default |
|
|
81
|
+
| ------------ | ---------------------------------------------------------------------- | ------------------------------------------------------------------- | ------- |
|
|
82
|
+
| autoSize | Autosizing the height to fit the content | `{ minRows: number; maxRows: number; }` | - |
|
|
83
|
+
| errorText | Error message, if provided textarea will be set in error state | string | - |
|
|
84
|
+
| error | If provided textarea will be set in error state, without error message | boolean | - |
|
|
85
|
+
| resize | 'resize' CSS property passed to the textarea component | `none` / `both` / `horizontal` / `vertical` / `initial` / `inherit` | - |
|
|
86
|
+
| wrapperStyle | CSS properties passed to the textarea component wrapper | `React.CSSProperties` | - |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useResizeObserver } from '@synerise/ds-utils';
|
|
4
4
|
import { calculateInputWidth } from './utils';
|
|
5
5
|
var sizerStyle = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CSSProperties, InputHTMLAttributes, MutableRefObject, ReactNode, RefObject } from 'react';
|
|
2
2
|
export type AutosizeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
3
3
|
placeholderIsMinWidth?: boolean;
|
|
4
4
|
wrapperClassName?: string;
|
package/dist/Input.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@synerise/ds-core/dist/js/style';
|
|
3
|
-
import './style/index.less';
|
|
4
3
|
import type { InputProps } from './Input.types';
|
|
4
|
+
import './style/index.less';
|
|
5
5
|
export declare const Input: ({ className, errorText, label, description, counterLimit, tooltip, tooltipConfig, icon1, icon1Tooltip, autoResize, icon2, icon2Tooltip, resetMargin, handleInputRef, prefixel, suffixel, error, expandable, expandableTooltip, renderCustomCounter, autoResizeProps, ...antdInputProps }: InputProps) => React.JSX.Element;
|
|
6
6
|
export declare const RawInput: (props: InputProps) => React.JSX.Element;
|
|
7
7
|
export { default as InputGroup } from './InputGroup';
|
package/dist/Input.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var _excluded = ["className", "errorText", "label", "description", "counterLimit", "tooltip", "tooltipConfig", "icon1", "icon1Tooltip", "autoResize", "icon2", "icon2Tooltip", "resetMargin", "handleInputRef", "prefixel", "suffixel", "error", "expandable", "expandableTooltip", "renderCustomCounter", "autoResizeProps"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { v4 as uuid } from 'uuid';
|
|
6
|
-
import { useResizeObserver } from '@synerise/ds-utils';
|
|
7
|
-
import FormField from '@synerise/ds-form-field';
|
|
8
6
|
import '@synerise/ds-core/dist/js/style';
|
|
9
|
-
import
|
|
7
|
+
import FormField from '@synerise/ds-form-field';
|
|
8
|
+
import { useResizeObserver } from '@synerise/ds-utils';
|
|
10
9
|
import * as S from './Input.styles';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { getCharCount } from './utils';
|
|
10
|
+
import { AutosizeWrapper, ElementIcons, ExpandableWrapper } from './components';
|
|
11
|
+
import { useElementFocus, useInputAddonHeight } from './hooks';
|
|
14
12
|
import { useCounterLimit } from './hooks/useCounterLimit';
|
|
13
|
+
import "./style/index.css";
|
|
14
|
+
import { getCharCount } from './utils';
|
|
15
15
|
var VERTICAL_BORDER_OFFSET = 2;
|
|
16
16
|
export var Input = function Input(_ref) {
|
|
17
17
|
var className = _ref.className,
|
|
@@ -92,7 +92,6 @@ export var Input = function Input(_ref) {
|
|
|
92
92
|
if (counterLimit && newValue.length > counterLimit) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
// @ts-ignore
|
|
96
95
|
antdInputProps.onChange && antdInputProps.onChange(event);
|
|
97
96
|
};
|
|
98
97
|
var handleExpandableTextareaBlur = function handleExpandableTextareaBlur(event) {
|
|
@@ -106,8 +105,9 @@ export var Input = function Input(_ref) {
|
|
|
106
105
|
var handleExpandIconClick = function handleExpandIconClick(event) {
|
|
107
106
|
event.stopPropagation();
|
|
108
107
|
if (inputRef.current && expandableTextAreaRef.current) {
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
var _inputRef$current$inp;
|
|
109
|
+
// @ts-expect-error Property 'value' does not exist on type 'TextAreaRef'.
|
|
110
|
+
expandableTextAreaRef.current.value = (_inputRef$current$inp = inputRef.current.input) == null ? void 0 : _inputRef$current$inp.value;
|
|
111
111
|
expandableTextAreaRef.current.focus();
|
|
112
112
|
}
|
|
113
113
|
setExpanded(true);
|
|
@@ -126,8 +126,9 @@ export var Input = function Input(_ref) {
|
|
|
126
126
|
if (!autoResize && expandable && isNowOverflown !== overflown) {
|
|
127
127
|
setOverflown(isNowOverflown);
|
|
128
128
|
}
|
|
129
|
-
if (counterLimit && newValue.length > counterLimit)
|
|
130
|
-
|
|
129
|
+
if (counterLimit && newValue.length > counterLimit) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
131
132
|
antdInputProps.onChange && antdInputProps.onChange(event);
|
|
132
133
|
}, [antdInputProps, autoResize, counterLimit, expandable, overflown]);
|
|
133
134
|
var stretchToFit = autoResize && autoResize !== true && Boolean(autoResize.stretchToFit);
|
package/dist/Input.styles.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { type SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
|
+
import { type InputProps, type InputRef } from 'antd/lib/input';
|
|
3
|
+
import { type TextAreaProps, type TextAreaRef } from 'antd/lib/input/TextArea';
|
|
1
4
|
import React from 'react';
|
|
2
|
-
import { FlattenSimpleInterpolation } from 'styled-components';
|
|
3
|
-
import { InputProps, InputRef } from 'antd/lib/input';
|
|
4
|
-
import { TextAreaProps, TextAreaRef } from 'antd/lib/input/TextArea';
|
|
5
|
-
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
5
|
+
import { type FlattenSimpleInterpolation } from 'styled-components';
|
|
6
6
|
import type { AutoResizeProp } from './Input.types';
|
|
7
7
|
type AutoSizeConfProps = {
|
|
8
8
|
autoResize?: AutoResizeProp;
|
|
9
9
|
boxSizing?: 'content-box' | 'border-box';
|
|
10
10
|
iconCount?: number;
|
|
11
11
|
};
|
|
12
|
-
export declare function autoresizeConfObjToCss({ autoResize, iconCount, boxSizing }: AutoSizeConfProps): FlattenSimpleInterpolation | "";
|
|
12
|
+
export declare function autoresizeConfObjToCss({ autoResize, iconCount, boxSizing, }: AutoSizeConfProps): FlattenSimpleInterpolation | "";
|
|
13
13
|
export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
14
|
export declare const InputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
15
15
|
iconCount?: number | undefined;
|
package/dist/Input.styles.js
CHANGED
|
@@ -2,10 +2,10 @@ var _excluded = ["error"],
|
|
|
2
2
|
_excluded2 = ["error"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
6
|
-
import styled, { css } from 'styled-components';
|
|
7
5
|
import BaseAntInput from 'antd/lib/input';
|
|
8
6
|
import TextArea from 'antd/lib/input/TextArea';
|
|
7
|
+
import React, { forwardRef } from 'react';
|
|
8
|
+
import styled, { css } from 'styled-components';
|
|
9
9
|
import { TextareaWrapper } from './Textarea/Textarea.styles';
|
|
10
10
|
var errorInputStyle = function errorInputStyle(props) {
|
|
11
11
|
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";
|
|
@@ -24,7 +24,9 @@ export function autoresizeConfObjToCss(_ref) {
|
|
|
24
24
|
// autosized inputs have box-sizing set to content-box!
|
|
25
25
|
var elementPadding = boxSizing === 'content-box' ? 2 * (INPUT_PADDING + INPUT_BORDER) : 0;
|
|
26
26
|
var finalPadding = getIconsWidth(iconCount || 0) + elementPadding;
|
|
27
|
-
if (!autoResize)
|
|
27
|
+
if (!autoResize) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
28
30
|
if (typeof autoResize === 'object') {
|
|
29
31
|
return css(["", " min-width:calc(", " - ", "px);"], autoResize.maxWidth ? "max-width: calc(" + autoResize.maxWidth + " - " + finalPadding + "px);" : '', autoResize.minWidth, finalPadding);
|
|
30
32
|
}
|
|
@@ -79,9 +81,7 @@ export var IconWrapper = styled.div.withConfig({
|
|
|
79
81
|
})([".icon:hover{svg{fill:", ";cursor:pointer;}}"], function (props) {
|
|
80
82
|
return props.theme.palette['blue-600'];
|
|
81
83
|
});
|
|
82
|
-
export var AntdInput = styled(/*#__PURE__*/forwardRef(
|
|
83
|
-
// eslint-disable-next-line
|
|
84
|
-
function (_ref2, ref) {
|
|
84
|
+
export var AntdInput = styled(/*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
85
85
|
var error = _ref2.error,
|
|
86
86
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
87
87
|
return /*#__PURE__*/React.createElement(BaseAntInput, _extends({
|
|
@@ -107,9 +107,7 @@ function (_ref2, ref) {
|
|
|
107
107
|
theme = _ref3.theme;
|
|
108
108
|
return readOnly ? "\n &:hover {\n border-color: " + theme.palette['grey-300'] + ";\n }\n &:focus {\n border-color: " + theme.palette['grey-300'] + ";\n box-shadow: none;\n background: #fff;\n }\n " : '';
|
|
109
109
|
});
|
|
110
|
-
export var AntdTextArea = styled(/*#__PURE__*/forwardRef(
|
|
111
|
-
// eslint-disable-next-line
|
|
112
|
-
function (_ref4, ref) {
|
|
110
|
+
export var AntdTextArea = styled(/*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
113
111
|
var error = _ref4.error,
|
|
114
112
|
props = _objectWithoutPropertiesLoose(_ref4, _excluded2);
|
|
115
113
|
return /*#__PURE__*/React.createElement(TextArea, _extends({
|
|
@@ -172,5 +170,5 @@ export var AddonWrapper = styled.div.withConfig({
|
|
|
172
170
|
})(["background:", ";display:flex;align-items:center;height:", ";"], function (props) {
|
|
173
171
|
return props.theme.palette['grey-050'];
|
|
174
172
|
}, function (props) {
|
|
175
|
-
return props.height + "px"
|
|
173
|
+
return props.height ? props.height + "px" : '30px';
|
|
176
174
|
});
|
package/dist/Input.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode, ReactElement, MutableRefObject } from 'react';
|
|
2
1
|
import type { InputProps as AntdInputProps, TextAreaProps as AntdTextAreaProps } from 'antd/lib/input';
|
|
2
|
+
import type { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import type { FormFieldCommonProps } from '@synerise/ds-form-field';
|
|
4
4
|
import type { AutosizeInputProps } from './AutosizeInput/AutosizeInput.types';
|
|
5
5
|
export type AutoResizeProp = boolean | {
|
package/dist/InputGroup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Props } from './InputGroup.types';
|
|
2
|
+
import { type Props } from './InputGroup.types';
|
|
3
3
|
declare const InputGroup: ({ children, label, errors, description, resetMargin, tooltip, tooltipConfig, ...antdInputGroupProps }: Props) => React.JSX.Element;
|
|
4
4
|
export default InputGroup;
|
package/dist/InputGroup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _excluded = ["children", "label", "errors", "description", "resetMargin", "tooltip", "tooltipConfig"];
|
|
2
2
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
3
|
+
import Input from 'antd/lib/input';
|
|
3
4
|
import React, { Children } from 'react';
|
|
4
5
|
import FormField from '@synerise/ds-form-field';
|
|
5
|
-
import Input from 'antd/lib/input';
|
|
6
6
|
import * as InputStyles from './Input.styles';
|
|
7
7
|
import * as S from './InputGroup.styles';
|
|
8
8
|
var InputGroup = function InputGroup(_ref) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _excluded = ["disabled", "key", "onRemoveClick", "value", "focused", "className"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
4
|
import classnames from 'classnames';
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
6
|
import Icon, { CloseS } from '@synerise/ds-icon';
|
|
7
7
|
import Tooltip from '@synerise/ds-tooltip';
|
|
8
8
|
import * as S from '../InputMultivalue.styles';
|
|
@@ -18,37 +18,33 @@ var Value = function Value(_ref) {
|
|
|
18
18
|
hovered = _useState[0],
|
|
19
19
|
setHovered = _useState[1];
|
|
20
20
|
var mergedClassName = classnames('ds-input-value-wrapper', className);
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
className: "remove",
|
|
50
|
-
component: /*#__PURE__*/React.createElement(CloseS, null)
|
|
51
|
-
})))
|
|
52
|
-
);
|
|
21
|
+
return /*#__PURE__*/React.createElement(S.ValueWrapper, _extends({
|
|
22
|
+
"data-testid": "ds-input-value-wrapper",
|
|
23
|
+
className: mergedClassName,
|
|
24
|
+
onMouseOver: function onMouseOver() {
|
|
25
|
+
focused && setHovered(true);
|
|
26
|
+
},
|
|
27
|
+
onMouseLeave: function onMouseLeave() {
|
|
28
|
+
setHovered(false);
|
|
29
|
+
},
|
|
30
|
+
disabled: disabled,
|
|
31
|
+
key: key,
|
|
32
|
+
shrink: hovered
|
|
33
|
+
}, rest), /*#__PURE__*/React.createElement(Tooltip, {
|
|
34
|
+
align: {
|
|
35
|
+
offset: [8, 0]
|
|
36
|
+
},
|
|
37
|
+
offset: "small",
|
|
38
|
+
title: value,
|
|
39
|
+
visible: focused && hovered
|
|
40
|
+
}, /*#__PURE__*/React.createElement(S.ValueText, {
|
|
41
|
+
shrink: hovered,
|
|
42
|
+
disabled: disabled
|
|
43
|
+
}, value)), /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
44
|
+
onClick: onRemoveClick
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
46
|
+
className: "remove",
|
|
47
|
+
component: /*#__PURE__*/React.createElement(CloseS, null)
|
|
48
|
+
})));
|
|
53
49
|
};
|
|
54
50
|
export default Value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
3
|
export type ValueProps = WithHTMLAttributes<HTMLDivElement, {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
key?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InputMultivalueProps } from './InputMultivalue.types';
|
|
2
|
+
import { type InputMultivalueProps } from './InputMultivalue.types';
|
|
3
3
|
declare const InputMultivalue: (props: InputMultivalueProps) => React.JSX.Element;
|
|
4
4
|
export default InputMultivalue;
|
|
@@ -2,8 +2,8 @@ var _excluded = ["className", "errorText", "label", "description", "values", "on
|
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import * as S from './InputMultivalue.styles';
|
|
6
5
|
import Value from './Elements/Value';
|
|
6
|
+
import * as S from './InputMultivalue.styles';
|
|
7
7
|
var emptyValue = '';
|
|
8
8
|
var InputMultivalue = function InputMultivalue(props) {
|
|
9
9
|
var className = props.className,
|
|
@@ -54,15 +54,12 @@ var InputMultivalue = function InputMultivalue(props) {
|
|
|
54
54
|
disabled: disabled
|
|
55
55
|
}), selectedValues.map(function (val, index) {
|
|
56
56
|
return /*#__PURE__*/React.createElement(Value, {
|
|
57
|
-
disabled: disabled
|
|
58
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
59
|
-
,
|
|
57
|
+
disabled: disabled,
|
|
60
58
|
key: val + "-" + index,
|
|
61
59
|
onRemoveClick: function onRemoveClick() {
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
handleNewValue(filteredValues);
|
|
60
|
+
var filteredItems = [].concat(selectedValues);
|
|
61
|
+
filteredItems.splice(index, 1);
|
|
62
|
+
handleNewValue(filteredItems);
|
|
66
63
|
},
|
|
67
64
|
value: val,
|
|
68
65
|
focused: isFocused
|
package/dist/TextArea.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@synerise/ds-core/dist/js/style';
|
|
3
|
+
import { type TextareaProps } from './TextArea.types';
|
|
3
4
|
import './style/index.less';
|
|
4
|
-
import { TextareaProps } from './TextArea.types';
|
|
5
5
|
export declare const TextArea: ({ className, errorText, label, description, counterLimit, tooltip, tooltipConfig, icon1, icon1Tooltip, icon2, icon2Tooltip, resetMargin, handleInputRef, prefixel, suffixel, error, renderCustomCounter, ...antdTextareaProps }: TextareaProps) => React.JSX.Element;
|
|
6
6
|
export declare const RawTextArea: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("antd/lib/input").TextAreaProps & {
|
|
7
7
|
error?: boolean | undefined;
|
package/dist/TextArea.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var _excluded = ["className", "errorText", "label", "description", "counterLimit", "tooltip", "tooltipConfig", "icon1", "icon1Tooltip", "icon2", "icon2Tooltip", "resetMargin", "handleInputRef", "prefixel", "suffixel", "error", "renderCustomCounter"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
5
|
import { v4 as uuid } from 'uuid';
|
|
6
|
-
import FormField from '@synerise/ds-form-field';
|
|
7
6
|
import '@synerise/ds-core/dist/js/style';
|
|
8
|
-
import
|
|
7
|
+
import FormField from '@synerise/ds-form-field';
|
|
9
8
|
import * as S from './Input.styles';
|
|
10
|
-
import { ElementIcons } from './components';
|
|
11
9
|
import DSTextArea from './Textarea/Textarea';
|
|
10
|
+
import { ElementIcons } from './components/ElementIcons';
|
|
12
11
|
import { useElementFocus } from './hooks';
|
|
13
|
-
import { getCharCount } from './utils';
|
|
14
12
|
import { useCounterLimit } from './hooks/useCounterLimit';
|
|
13
|
+
import "./style/index.css";
|
|
14
|
+
import { getCharCount } from './utils';
|
|
15
15
|
export var TextArea = function TextArea(_ref) {
|
|
16
16
|
var className = _ref.className,
|
|
17
17
|
errorText = _ref.errorText,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { TextAreaRef } from 'antd/lib/input/TextArea';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
export declare const RawTextArea: React.ForwardRefExoticComponent<import("antd/lib/input/TextArea").TextAreaProps & {
|
|
4
4
|
error?: boolean | undefined;
|
|
5
5
|
errorText?: React.ReactNode;
|
|
@@ -3,8 +3,8 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, useState } from 'react';
|
|
5
5
|
import Scrollbar from '@synerise/ds-scrollbar';
|
|
6
|
-
import * as S from './Textarea.styles';
|
|
7
6
|
import * as InputStyles from '../Input.styles';
|
|
7
|
+
import * as S from './Textarea.styles';
|
|
8
8
|
export var RawTextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
9
9
|
var disabled = _ref.disabled,
|
|
10
10
|
error = _ref.error,
|
|
@@ -5,9 +5,17 @@ export var TextareaWrapper = styled.div.withConfig({
|
|
|
5
5
|
})(["position:relative;overflow:hidden;resize:", ";border-radius:3px;transition:background-color 0.3s ease-in-out,border 0.3s ease-in-out,box-shadow 0.3s ease-in-out;", " .scrollbar-container{height:100%;top:1px;bottom:0;right:1px;.ps__rail-y,.ps__thumb-x,.ps__rail-x{height:calc(100% - 1px);max-height:9px;}& > .textarea-scrollbar{&,& > div{height:calc(100% - 2px);}}}&&&{textarea{position:relative;min-height:100%;resize:none;background:transparent;border:0;box-shadow:none;outline:0;word-wrap:break-word;overflow-wrap:break-word;font-variant-numeric:normal;::placeholder,::-webkit-input-placeholder{line-height:1.38;}:-ms-input-placeholder{line-height:1.38;}}.ant-input-textarea{height:100%;}}"], function (props) {
|
|
6
6
|
return props.resize ? props.resize : 'vertical';
|
|
7
7
|
}, function (props) {
|
|
8
|
-
if (props.isReadOnly)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (props.
|
|
8
|
+
if (props.isReadOnly) {
|
|
9
|
+
return css(["border:1px solid ", ";background-color:", ";"], props.theme.palette['grey-300'], props.theme.palette['grey-050']);
|
|
10
|
+
}
|
|
11
|
+
if (props.isDisabled) {
|
|
12
|
+
return css(["border:1px solid #dbe0e3;background-color:#f9fafb;cursor:not-allowed;"]);
|
|
13
|
+
}
|
|
14
|
+
if (props.isFocused) {
|
|
15
|
+
return css(["box-shadow:inset 0 0 0 1px ", ";border:1px solid ", ";background-color:", ";&&&{textarea{&::-webkit-scrollbar-thumb{background-color:#e1e3e6;border:4px solid ", " !important;}}}"], props.theme.palette['blue-600'], props.theme.palette['blue-600'], props.theme.palette['blue-050'], props.theme.palette['blue-050']);
|
|
16
|
+
}
|
|
17
|
+
if (props.hasError) {
|
|
18
|
+
return css(["background-color:", ";box-shadow:inset 0 0 0 1px ", ";border:1px solid ", ";"], props.theme.palette['red-050'], props.theme.palette['red-600'], props.theme.palette['red-600']);
|
|
19
|
+
}
|
|
12
20
|
return css(["border:1px solid #dbe0e3;background-color:#fff;"]);
|
|
13
21
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { type TextAreaProps as AntdTextAreaProps } from 'antd/lib/input';
|
|
2
|
+
import { type ResizeProperty } from 'csstype';
|
|
3
|
+
import type React from 'react';
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use RawTextAreaProps instead.
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { MouseEvent } from 'react';
|
|
2
|
-
import { BaseProps } from '../Input.types';
|
|
1
|
+
import React, { type MouseEvent } from 'react';
|
|
2
|
+
import { type BaseProps } from '../Input.types';
|
|
3
3
|
type IconProps = Pick<BaseProps, 'icon1' | 'icon1Tooltip' | 'icon2' | 'icon2Tooltip' | 'className' | 'expandable' | 'expandableTooltip'> & {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
handleIconsClick: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { cloneElement } from 'react';
|
|
3
|
-
import Tooltip from '@synerise/ds-tooltip/dist/Tooltip';
|
|
4
3
|
import Icon, { ResizeArrowM } from '@synerise/ds-icon';
|
|
4
|
+
import Tooltip from '@synerise/ds-tooltip/dist/Tooltip';
|
|
5
5
|
import * as S from '../Input.styles';
|
|
6
6
|
export var ElementIcons = function ElementIcons(_ref) {
|
|
7
7
|
var handleIconsClick = _ref.handleIconsClick,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { ChangeEvent, FocusEvent, ReactNode } from 'react';
|
|
2
1
|
import type { TextAreaRef } from 'antd/lib/input/TextArea';
|
|
3
|
-
import {
|
|
2
|
+
import React, { type ChangeEvent, type FocusEvent, type ReactNode } from 'react';
|
|
3
|
+
import { type InputProps } from '../Input.types';
|
|
4
4
|
export declare const ExpandableWrapper: React.ForwardRefExoticComponent<Pick<InputProps, "value"> & {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
expanded: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import Textarea from '../Textarea/Textarea';
|
|
3
2
|
import * as S from '../Input.styles';
|
|
3
|
+
import Textarea from '../Textarea/Textarea';
|
|
4
4
|
export var ExpandableWrapper = /*#__PURE__*/forwardRef(function (_ref, expandableTextAreaRef) {
|
|
5
5
|
var children = _ref.children,
|
|
6
6
|
value = _ref.value,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InputProps } from '../Input.types';
|
|
2
|
+
import { type InputProps } from '../Input.types';
|
|
3
3
|
type UseCounterLimitOptions = Pick<InputProps, 'counterLimit' | 'renderCustomCounter'> & {
|
|
4
4
|
charCount?: number;
|
|
5
5
|
};
|
|
6
|
-
export declare const useCounterLimit: ({ charCount, counterLimit, renderCustomCounter }: UseCounterLimitOptions) => React.JSX.Element | undefined;
|
|
6
|
+
export declare const useCounterLimit: ({ charCount, counterLimit, renderCustomCounter, }: UseCounterLimitOptions) => React.JSX.Element | undefined;
|
|
7
7
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
1
|
import type { InputRef } from 'antd/lib/input';
|
|
2
|
+
import { type MutableRefObject } from 'react';
|
|
3
3
|
export declare const useElementFocus: (ref: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | InputRef | null>) => () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { RawTextArea as DSRawTextArea } from './Textarea/Textarea';
|
|
|
8
8
|
export type { TextareaProps } from './TextArea.types';
|
|
9
9
|
export type { InputMultivalueProps } from './InputMultivalue/InputMultivalue.types';
|
|
10
10
|
export * as InputStyles from './Input.styles';
|
|
11
|
-
export type { BaseProps, EnhancedProps, InputProps, AutoResizeProp } from './Input.types';
|
|
11
|
+
export type { BaseProps, EnhancedProps, InputProps, AutoResizeProp, } from './Input.types';
|
|
12
12
|
export { default as AutosizeInput } from './AutosizeInput/AutosizeInput';
|
|
13
13
|
export type { AutosizeInputProps, AutosizeWrapperProps, AutosizeInputRefType, } from './AutosizeInput/AutosizeInput.types';
|
|
14
14
|
export { AutosizeWrapper } from './components/AutosizeWrapper';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { InputProps as AntdInputProps } from 'antd/lib/input';
|
|
2
|
-
import { TextareaProps } from '../TextArea.types';
|
|
1
|
+
import { type InputProps as AntdInputProps } from 'antd/lib/input';
|
|
2
|
+
import { type TextareaProps } from '../TextArea.types';
|
|
3
3
|
export declare const getCharCount: (value?: AntdInputProps['value'] | TextareaProps['value'], limit?: number) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-input",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Input UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-form-field": "^1.1.
|
|
38
|
-
"@synerise/ds-icon": "^1.5.
|
|
39
|
-
"@synerise/ds-scrollbar": "^1.1.
|
|
40
|
-
"@synerise/ds-tooltip": "^1.1.
|
|
41
|
-
"@synerise/ds-utils": "^1.3.
|
|
37
|
+
"@synerise/ds-form-field": "^1.1.9",
|
|
38
|
+
"@synerise/ds-icon": "^1.5.4",
|
|
39
|
+
"@synerise/ds-scrollbar": "^1.1.2",
|
|
40
|
+
"@synerise/ds-tooltip": "^1.1.12",
|
|
41
|
+
"@synerise/ds-utils": "^1.3.1",
|
|
42
42
|
"classnames": "^2.3.2",
|
|
43
43
|
"csstype": "^2.6.9",
|
|
44
44
|
"uuid": "^8.3.2"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"react": ">=16.9.0 <= 18.3.1",
|
|
50
50
|
"styled-components": "^5.3.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "8db1900bf3f7b0782c834ff82f628199530cd934"
|
|
53
53
|
}
|