@synerise/ds-input 1.6.8 → 1.6.10
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 +8 -0
- package/README.md +86 -24
- package/dist/AutosizeInput/AutosizeInput.d.ts +2 -2
- package/dist/AutosizeInput/AutosizeInput.js +80 -95
- package/dist/AutosizeInput/AutosizeInput.types.d.ts +1 -1
- package/dist/AutosizeInput/AutosizeInput.types.js +1 -1
- package/dist/AutosizeInput/utils/calculateInputWidth.d.ts +1 -1
- package/dist/AutosizeInput/utils/calculateInputWidth.js +13 -11
- package/dist/AutosizeInput/utils/index.js +4 -1
- package/dist/Input.d.ts +5 -7
- package/dist/Input.js +117 -174
- package/dist/Input.styles.d.ts +22 -22
- package/dist/Input.styles.js +98 -122
- package/dist/Input.types.d.ts +5 -5
- package/dist/Input.types.js +1 -1
- package/dist/InputGroup.d.ts +2 -2
- package/dist/InputGroup.js +21 -38
- package/dist/InputGroup.styles.d.ts +2 -2
- package/dist/InputGroup.styles.js +8 -8
- package/dist/InputGroup.types.d.ts +2 -2
- package/dist/InputGroup.types.js +1 -1
- package/dist/InputMultivalue/Elements/Value.d.ts +2 -2
- package/dist/InputMultivalue/Elements/Value.js +22 -34
- package/dist/InputMultivalue/Elements/Value.types.d.ts +2 -2
- package/dist/InputMultivalue/Elements/Value.types.js +1 -1
- package/dist/InputMultivalue/InputMultivalue.d.ts +2 -2
- package/dist/InputMultivalue/InputMultivalue.js +52 -74
- package/dist/InputMultivalue/InputMultivalue.styles.d.ts +10 -10
- package/dist/InputMultivalue/InputMultivalue.styles.js +48 -67
- package/dist/InputMultivalue/InputMultivalue.types.d.ts +1 -1
- package/dist/InputMultivalue/InputMultivalue.types.js +1 -1
- package/dist/PasswordInput.d.ts +2 -2
- package/dist/PasswordInput.js +31 -45
- package/dist/PasswordInput.types.d.ts +2 -2
- package/dist/PasswordInput.types.js +1 -1
- package/dist/TextArea.d.ts +4 -6
- package/dist/TextArea.js +53 -75
- package/dist/TextArea.types.d.ts +2 -2
- package/dist/TextArea.types.js +1 -1
- package/dist/Textarea/Textarea.d.ts +4 -4
- package/dist/Textarea/Textarea.js +32 -51
- package/dist/Textarea/Textarea.styles.d.ts +2 -2
- package/dist/Textarea/Textarea.styles.js +10 -9
- package/dist/Textarea/Textarea.types.d.ts +3 -3
- package/dist/Textarea/Textarea.types.js +1 -1
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/components/AutosizeWrapper.d.ts +2 -2
- package/dist/components/AutosizeWrapper.js +16 -18
- package/dist/components/ElementIcons.d.ts +2 -2
- package/dist/components/ElementIcons.js +37 -51
- package/dist/components/ExpandableWrapper.d.ts +3 -3
- package/dist/components/ExpandableWrapper.js +20 -21
- package/dist/components/index.js +8 -3
- package/dist/hooks/index.js +6 -2
- package/dist/hooks/useCounterLimit.d.ts +2 -2
- package/dist/hooks/useCounterLimit.js +19 -14
- package/dist/hooks/useElementFocus.d.ts +2 -2
- package/dist/hooks/useElementFocus.js +6 -3
- package/dist/hooks/useInputAddonHeight.d.ts +2 -2
- package/dist/hooks/useInputAddonHeight.js +10 -10
- package/dist/index.js +24 -12
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/getCharCount.d.ts +2 -2
- package/dist/utils/getCharCount.js +5 -2
- package/dist/utils/index.js +4 -1
- package/package.json +9 -9
|
@@ -1,52 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
resize: resize,
|
|
30
|
-
style: _extends({
|
|
31
|
-
height: autoSize ? 'auto' : rows * 17 + "px"
|
|
32
|
-
}, wrapperStyle)
|
|
33
|
-
}, /*#__PURE__*/React.createElement(Scrollbar, {
|
|
34
|
-
absolute: true,
|
|
35
|
-
classes: "textarea-scrollbar"
|
|
36
|
-
}, /*#__PURE__*/React.createElement(InputStyles.AntdTextArea, _extends({
|
|
37
|
-
autoSize: autoSize
|
|
38
|
-
}, props, {
|
|
39
|
-
ref: ref,
|
|
40
|
-
disabled: disabled,
|
|
41
|
-
readOnly: readOnly,
|
|
42
|
-
onFocus: function onFocus(e) {
|
|
43
|
-
_onFocus && _onFocus(e);
|
|
44
|
-
setFocus(true);
|
|
45
|
-
},
|
|
46
|
-
onBlur: function onBlur(e) {
|
|
47
|
-
_onBlur && _onBlur(e);
|
|
48
|
-
setFocus(false);
|
|
49
|
-
}
|
|
50
|
-
}))));
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState } from "react";
|
|
3
|
+
import Scrollbar from "@synerise/ds-scrollbar";
|
|
4
|
+
import { AntdTextArea } from "../Input.styles.js";
|
|
5
|
+
import { TextareaWrapper } from "./Textarea.styles.js";
|
|
6
|
+
const RawTextArea = forwardRef(({
|
|
7
|
+
disabled,
|
|
8
|
+
error,
|
|
9
|
+
rows = 4,
|
|
10
|
+
wrapperStyle,
|
|
11
|
+
onBlur,
|
|
12
|
+
onFocus,
|
|
13
|
+
resize,
|
|
14
|
+
autoSize,
|
|
15
|
+
readOnly,
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const [focus, setFocus] = useState(false);
|
|
19
|
+
return /* @__PURE__ */ jsx(TextareaWrapper, { className: "ds-textarea", isDisabled: Boolean(disabled), isFocused: focus, isReadOnly: readOnly, hasError: Boolean(error), resize, style: {
|
|
20
|
+
height: autoSize ? "auto" : `${rows * 17}px`,
|
|
21
|
+
...wrapperStyle
|
|
22
|
+
}, children: /* @__PURE__ */ jsx(Scrollbar, { absolute: true, classes: "textarea-scrollbar", children: /* @__PURE__ */ jsx(AntdTextArea, { autoSize, ...props, ref, disabled, readOnly, onFocus: (e) => {
|
|
23
|
+
onFocus && onFocus(e);
|
|
24
|
+
setFocus(true);
|
|
25
|
+
}, onBlur: (e) => {
|
|
26
|
+
onBlur && onBlur(e);
|
|
27
|
+
setFocus(false);
|
|
28
|
+
} }) }) });
|
|
51
29
|
});
|
|
52
|
-
export
|
|
30
|
+
export {
|
|
31
|
+
RawTextArea,
|
|
32
|
+
RawTextArea as default
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const TextareaWrapper: import(
|
|
1
|
+
import { ResizeProperty } from 'csstype';
|
|
2
|
+
export declare const TextareaWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
3
3
|
resize?: ResizeProperty;
|
|
4
4
|
isDisabled: boolean;
|
|
5
5
|
isFocused: boolean;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const TextareaWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "Textareastyles__TextareaWrapper",
|
|
4
4
|
componentId: "sc-23480t-0"
|
|
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%;}}"],
|
|
6
|
-
return props.resize ? props.resize : 'vertical';
|
|
7
|
-
}, function (props) {
|
|
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%;}}"], (props) => props.resize ? props.resize : "vertical", (props) => {
|
|
8
6
|
if (props.isReadOnly) {
|
|
9
|
-
return css(["border:1px solid ", ";background-color:", ";"], props.theme.palette[
|
|
7
|
+
return css(["border:1px solid ", ";background-color:", ";"], props.theme.palette["grey-300"], props.theme.palette["grey-050"]);
|
|
10
8
|
}
|
|
11
9
|
if (props.isDisabled) {
|
|
12
10
|
return css(["border:1px solid #dbe0e3;background-color:#f9fafb;cursor:not-allowed;"]);
|
|
13
11
|
}
|
|
14
12
|
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[
|
|
13
|
+
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
14
|
}
|
|
17
15
|
if (props.hasError) {
|
|
18
|
-
return css(["background-color:", ";box-shadow:inset 0 0 0 1px ", ";border:1px solid ", ";"], props.theme.palette[
|
|
16
|
+
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
17
|
}
|
|
20
18
|
return css(["border:1px solid #dbe0e3;background-color:#fff;"]);
|
|
21
|
-
});
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
TextareaWrapper
|
|
22
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { TextAreaProps as AntdTextAreaProps } from 'antd/lib/input';
|
|
2
|
+
import { ResizeProperty } from 'csstype';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use RawTextAreaProps instead.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AutosizeInputRefType } from '../AutosizeInput/AutosizeInput.types';
|
|
3
3
|
export declare const AutosizeWrapper: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
4
4
|
placeholderIsMinWidth?: boolean;
|
|
5
5
|
wrapperClassName?: string;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children = _ref.children,
|
|
12
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import AutosizeInput from "../AutosizeInput/AutosizeInput.js";
|
|
4
|
+
const AUTOSIZE_EXTRA_WIDTH = 2;
|
|
5
|
+
const AutosizeWrapper = forwardRef(({
|
|
6
|
+
autoResize,
|
|
7
|
+
extraWidth = AUTOSIZE_EXTRA_WIDTH,
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => {
|
|
13
11
|
if (autoResize) {
|
|
14
|
-
return
|
|
15
|
-
ref: ref,
|
|
16
|
-
extraWidth: extraWidth
|
|
17
|
-
}, props), children);
|
|
12
|
+
return /* @__PURE__ */ jsx(AutosizeInput, { ref, extraWidth, ...props, children });
|
|
18
13
|
}
|
|
19
|
-
return
|
|
20
|
-
});
|
|
14
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
AutosizeWrapper
|
|
18
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
import {
|
|
1
|
+
import { default as React, MouseEvent } from 'react';
|
|
2
|
+
import { 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,51 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import Icon, { ResizeArrowM } from
|
|
4
|
-
import Tooltip from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, icon1 && /*#__PURE__*/cloneElement(icon1, _extends({
|
|
39
|
-
className: 'icon icon1'
|
|
40
|
-
}, icon2 && {
|
|
41
|
-
style: {
|
|
42
|
-
marginRight: '4px'
|
|
43
|
-
}
|
|
44
|
-
})))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
45
|
-
title: icon2Tooltip
|
|
46
|
-
}, /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
47
|
-
className: className
|
|
48
|
-
}, icon2 && /*#__PURE__*/cloneElement(icon2, {
|
|
49
|
-
className: 'icon icon2'
|
|
50
|
-
}))))) : /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
51
|
-
};
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement } from "react";
|
|
3
|
+
import Icon, { ResizeArrowM } from "@synerise/ds-icon";
|
|
4
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
5
|
+
import { IconsWrapper, IconsFlexContainer, IconWrapper } from "../Input.styles.js";
|
|
6
|
+
const ElementIcons = ({
|
|
7
|
+
handleIconsClick,
|
|
8
|
+
disabled,
|
|
9
|
+
icon1Tooltip,
|
|
10
|
+
icon1,
|
|
11
|
+
icon2,
|
|
12
|
+
icon2Tooltip,
|
|
13
|
+
className,
|
|
14
|
+
type,
|
|
15
|
+
expandable,
|
|
16
|
+
overflown,
|
|
17
|
+
expandableTooltip,
|
|
18
|
+
handleExpandIconClick
|
|
19
|
+
}) => {
|
|
20
|
+
return icon1 || icon2 || expandable ? /* @__PURE__ */ jsx(IconsWrapper, { onClick: handleIconsClick, disabled, children: /* @__PURE__ */ jsxs(IconsFlexContainer, { type, children: [
|
|
21
|
+
expandable && /* @__PURE__ */ jsx(Tooltip, { title: expandableTooltip, children: /* @__PURE__ */ jsx(IconWrapper, { onClick: handleExpandIconClick, className, children: expandable && overflown && /* @__PURE__ */ jsx(Icon, { className: "icon icon3", component: /* @__PURE__ */ jsx(ResizeArrowM, { "data-testid": "ds-input-icon-expand" }) }) }) }),
|
|
22
|
+
/* @__PURE__ */ jsx(Tooltip, { title: icon1Tooltip, children: /* @__PURE__ */ jsx(IconWrapper, { className, children: icon1 && cloneElement(icon1, {
|
|
23
|
+
className: "icon icon1",
|
|
24
|
+
...icon2 && {
|
|
25
|
+
style: {
|
|
26
|
+
marginRight: "4px"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}) }) }),
|
|
30
|
+
/* @__PURE__ */ jsx(Tooltip, { title: icon2Tooltip, children: /* @__PURE__ */ jsx(IconWrapper, { className, children: icon2 && cloneElement(icon2, {
|
|
31
|
+
className: "icon icon2"
|
|
32
|
+
}) }) })
|
|
33
|
+
] }) }) : /* @__PURE__ */ jsx(Fragment, {});
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
ElementIcons
|
|
37
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React,
|
|
3
|
-
import {
|
|
1
|
+
import { TextAreaRef } from 'antd/lib/input/TextArea';
|
|
2
|
+
import { default as React, ChangeEvent, FocusEvent, ReactNode } from 'react';
|
|
3
|
+
import { InputProps } from '../Input.types';
|
|
4
4
|
export declare const ExpandableWrapper: React.ForwardRefExoticComponent<Pick<InputProps, "value"> & {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
expanded: boolean;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
autoSize: {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { ExpandableWrapper as ExpandableWrapper$1 } from "../Input.styles.js";
|
|
4
|
+
import { RawTextArea } from "../Textarea/Textarea.js";
|
|
5
|
+
const ExpandableWrapper = forwardRef(({
|
|
6
|
+
children,
|
|
7
|
+
value,
|
|
8
|
+
expanded,
|
|
9
|
+
onChange,
|
|
10
|
+
onBlur
|
|
11
|
+
}, expandableTextAreaRef) => {
|
|
12
|
+
return /* @__PURE__ */ jsxs(ExpandableWrapper$1, { expanded, children: [
|
|
13
|
+
children,
|
|
14
|
+
/* @__PURE__ */ jsx(RawTextArea, { "data-testid": "inputExpandTextarea", onChange, autoSize: {
|
|
16
15
|
minRows: 2,
|
|
17
16
|
maxRows: 6
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
17
|
+
}, onBlur, ref: expandableTextAreaRef, value })
|
|
18
|
+
] });
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
ExpandableWrapper
|
|
22
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ElementIcons } from "./ElementIcons.js";
|
|
2
|
+
import { ExpandableWrapper } from "./ExpandableWrapper.js";
|
|
3
|
+
import { AutosizeWrapper } from "./AutosizeWrapper.js";
|
|
4
|
+
export {
|
|
5
|
+
AutosizeWrapper,
|
|
6
|
+
ElementIcons,
|
|
7
|
+
ExpandableWrapper
|
|
8
|
+
};
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { useElementFocus } from "./useElementFocus.js";
|
|
2
|
+
import { useInputAddonHeight } from "./useInputAddonHeight.js";
|
|
3
|
+
export {
|
|
4
|
+
useElementFocus,
|
|
5
|
+
useInputAddonHeight
|
|
6
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InputProps } from '../Input.types';
|
|
3
3
|
type UseCounterLimitOptions = Pick<InputProps, 'counterLimit' | 'renderCustomCounter'> & {
|
|
4
4
|
charCount?: number;
|
|
5
5
|
};
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Counter } from "../Input.styles.js";
|
|
4
|
+
const useCounterLimit = ({
|
|
5
|
+
charCount,
|
|
6
|
+
counterLimit,
|
|
7
|
+
renderCustomCounter
|
|
8
|
+
}) => {
|
|
9
|
+
return useMemo(() => {
|
|
8
10
|
if (renderCustomCounter) {
|
|
9
|
-
return
|
|
10
|
-
"data-testid": "custom-counter"
|
|
11
|
-
}, renderCustomCounter(charCount));
|
|
11
|
+
return /* @__PURE__ */ jsx(Counter, { "data-testid": "custom-counter", children: renderCustomCounter(charCount) });
|
|
12
12
|
}
|
|
13
|
-
return counterLimit ?
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
return counterLimit ? /* @__PURE__ */ jsxs(Counter, { "data-testid": "counter", children: [
|
|
14
|
+
charCount,
|
|
15
|
+
"/",
|
|
16
|
+
counterLimit
|
|
17
|
+
] }) : void 0;
|
|
16
18
|
}, [charCount, counterLimit, renderCustomCounter]);
|
|
17
|
-
};
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
useCounterLimit
|
|
22
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { InputRef } from 'antd/lib/input';
|
|
2
|
+
import { MutableRefObject } from 'react';
|
|
3
3
|
export declare const useElementFocus: (ref: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | InputRef | null>) => () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { InputRef } from 'antd/lib/input';
|
|
2
|
+
import { MutableRefObject } from 'react';
|
|
3
3
|
export declare const useInputAddonHeight: (inputRef: MutableRefObject<InputRef | null>) => {
|
|
4
4
|
inputAddonHeight: number;
|
|
5
5
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
useEffect(function () {
|
|
7
|
-
var _inputRef$current$inp, _inputRef$current$inp2;
|
|
8
|
-
inputRef.current && ((_inputRef$current$inp = inputRef.current.input) == null ? void 0 : _inputRef$current$inp.offsetHeight) && setInputAddonHeight((_inputRef$current$inp2 = inputRef.current.input) == null ? void 0 : _inputRef$current$inp2.offsetHeight);
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const useInputAddonHeight = (inputRef) => {
|
|
3
|
+
const [inputAddonHeight, setInputAddonHeight] = useState(0);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
inputRef.current && inputRef.current.input?.offsetHeight && setInputAddonHeight(inputRef.current.input?.offsetHeight);
|
|
9
6
|
}, [inputRef]);
|
|
10
7
|
return {
|
|
11
|
-
inputAddonHeight
|
|
8
|
+
inputAddonHeight
|
|
12
9
|
};
|
|
13
|
-
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
useInputAddonHeight
|
|
13
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
|
|
1
|
+
import { FormFieldLabel } from "@synerise/ds-form-field";
|
|
2
|
+
import { Input, RawInput } from "./Input.js";
|
|
3
|
+
import { RawTextArea, TextArea } from "./TextArea.js";
|
|
4
|
+
import { RawTextArea as RawTextArea2 } from "./Textarea/Textarea.js";
|
|
5
|
+
import * as Input_styles from "./Input.styles.js";
|
|
6
|
+
import { default as default2 } from "./AutosizeInput/AutosizeInput.js";
|
|
7
|
+
import { AutosizeWrapper } from "./components/AutosizeWrapper.js";
|
|
8
|
+
import { PasswordInput } from "./PasswordInput.js";
|
|
9
|
+
import { default as default3 } from "./InputGroup.js";
|
|
10
|
+
import { default as default4 } from "./InputMultivalue/InputMultivalue.js";
|
|
11
|
+
export {
|
|
12
|
+
default2 as AutosizeInput,
|
|
13
|
+
AutosizeWrapper,
|
|
14
|
+
RawTextArea2 as DSRawTextArea,
|
|
15
|
+
Input,
|
|
16
|
+
default3 as InputGroup,
|
|
17
|
+
default4 as InputMultivalue,
|
|
18
|
+
Input_styles as InputStyles,
|
|
19
|
+
FormFieldLabel as Label,
|
|
20
|
+
PasswordInput,
|
|
21
|
+
RawInput,
|
|
22
|
+
RawTextArea,
|
|
23
|
+
TextArea
|
|
24
|
+
};
|
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { InputProps as AntdInputProps } from 'antd/lib/input';
|
|
2
|
+
import { TextareaProps } from '../TextArea.types';
|
|
3
3
|
export declare const getCharCount: (value?: AntdInputProps["value"] | TextareaProps["value"], limit?: number) => number;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
const getCharCount = (value, limit) => {
|
|
2
2
|
if (limit && value && value.toString().length > limit) {
|
|
3
3
|
return limit;
|
|
4
4
|
}
|
|
5
5
|
return value ? value.toString().length : 0;
|
|
6
|
-
};
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
getCharCount
|
|
9
|
+
};
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-input",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
4
4
|
"description": "Input UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/react": "^0.27.16",
|
|
39
|
-
"@synerise/ds-form-field": "^1.3.
|
|
40
|
-
"@synerise/ds-icon": "^1.
|
|
41
|
-
"@synerise/ds-scrollbar": "^1.2.
|
|
42
|
-
"@synerise/ds-tooltip": "^1.4.
|
|
43
|
-
"@synerise/ds-utils": "^1.
|
|
39
|
+
"@synerise/ds-form-field": "^1.3.10",
|
|
40
|
+
"@synerise/ds-icon": "^1.15.1",
|
|
41
|
+
"@synerise/ds-scrollbar": "^1.2.17",
|
|
42
|
+
"@synerise/ds-tooltip": "^1.4.10",
|
|
43
|
+
"@synerise/ds-utils": "^1.7.1",
|
|
44
44
|
"classnames": "^2.3.2",
|
|
45
45
|
"csstype": "^2.6.9",
|
|
46
46
|
"uuid": "^8.3.2"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react-intl": ">= 3.12.0 <= 6.8",
|
|
56
56
|
"styled-components": "^5.3.3"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
59
59
|
}
|