@synerise/ds-input 1.6.9 → 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 +4 -0
- 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
package/dist/Input.styles.js
CHANGED
|
@@ -1,174 +1,150 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import BaseAntInput from "antd/lib/input";
|
|
3
|
+
import TextArea from "antd/lib/input/TextArea";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import styled, { css } from "styled-components";
|
|
6
|
+
import { TextareaWrapper } from "./Textarea/Textarea.styles.js";
|
|
7
|
+
const errorInputStyle = (props) => `
|
|
8
|
+
&&&, && .ant-input {
|
|
9
|
+
border-color: ${props.theme.palette["red-600"]};
|
|
10
|
+
box-shadow: inset 0 0 0 1px ${props.theme.palette["red-600"]};
|
|
11
|
+
background: ${props.theme.palette["red-050"]};
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const INPUT_PADDING = 12;
|
|
15
|
+
const INPUT_BORDER = 1;
|
|
16
|
+
const ICON_SIZE = 24;
|
|
17
|
+
const getIconsWidth = (iconCount) => {
|
|
17
18
|
return iconCount > 0 ? iconCount * ICON_SIZE + (iconCount - 1) * 4 : 0;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var finalPadding = getIconsWidth(iconCount || 0) + elementPadding;
|
|
20
|
+
function autoresizeConfObjToCss({
|
|
21
|
+
autoResize,
|
|
22
|
+
iconCount,
|
|
23
|
+
boxSizing = "content-box"
|
|
24
|
+
}) {
|
|
25
|
+
const elementPadding = boxSizing === "content-box" ? 2 * (INPUT_PADDING + INPUT_BORDER) : 0;
|
|
26
|
+
const finalPadding = getIconsWidth(iconCount || 0) + elementPadding;
|
|
27
27
|
if (!autoResize) {
|
|
28
|
-
return
|
|
28
|
+
return "";
|
|
29
29
|
}
|
|
30
|
-
if (typeof autoResize ===
|
|
31
|
-
return css(["", " min-width:calc(", " - ", "px);"], autoResize.maxWidth ?
|
|
30
|
+
if (typeof autoResize === "object") {
|
|
31
|
+
return css(["", " min-width:calc(", " - ", "px);"], autoResize.maxWidth ? `max-width: calc(${autoResize.maxWidth} - ${finalPadding}px);` : "", autoResize.minWidth, finalPadding);
|
|
32
32
|
}
|
|
33
33
|
return css(["max-width:calc(400px - ", "px);min-width:calc(150px - ", "px);"], finalPadding, finalPadding);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const Wrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
36
36
|
displayName: "Inputstyles__Wrapper",
|
|
37
37
|
componentId: "sc-dc57an-0"
|
|
38
38
|
})(["margin-bottom:24px;"]);
|
|
39
|
-
|
|
39
|
+
const InputWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
40
40
|
displayName: "Inputstyles__InputWrapper",
|
|
41
41
|
componentId: "sc-dc57an-1"
|
|
42
|
-
})(["position:relative;&& .ant-input{padding-right:", ";&::placeholder{line-height:1.29;}}.ant-input-group-addon{height:100%;}"],
|
|
43
|
-
return getIconsWidth(props.iconCount || 0) + INPUT_PADDING
|
|
42
|
+
})(["position:relative;&& .ant-input{padding-right:", ";&::placeholder{line-height:1.29;}}.ant-input-group-addon{height:100%;}"], (props) => {
|
|
43
|
+
return `${getIconsWidth(props.iconCount || 0) + INPUT_PADDING}px`;
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
const OuterWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
46
46
|
displayName: "Inputstyles__OuterWrapper",
|
|
47
47
|
componentId: "sc-dc57an-2"
|
|
48
|
-
})(["margin:", ";&.active{&&{input{box-shadow:inset 0 0 0 1px ", ";border-color:", ";background-color:", ";}}}input{padding:7px ", "px;", "}", ""],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return props.theme.palette['blue-600'];
|
|
54
|
-
}, function (props) {
|
|
55
|
-
return props.theme.palette['blue-050'];
|
|
56
|
-
}, INPUT_PADDING, function (props) {
|
|
57
|
-
return autoresizeConfObjToCss(props);
|
|
58
|
-
}, function (props) {
|
|
59
|
-
return props.autoResize && "\n " + InputWrapper + " {\n display: inline-block;\n }";
|
|
60
|
-
});
|
|
61
|
-
export var IconsWrapper = styled.div.withConfig({
|
|
48
|
+
})(["margin:", ";&.active{&&{input{box-shadow:inset 0 0 0 1px ", ";border-color:", ";background-color:", ";}}}input{padding:7px ", "px;", "}", ""], (props) => props.resetMargin ? "0" : "0 0 16px 0", (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-050"], INPUT_PADDING, (props) => autoresizeConfObjToCss(props), (props) => props.autoResize && `
|
|
49
|
+
${InputWrapper} {
|
|
50
|
+
display: inline-block;
|
|
51
|
+
}`);
|
|
52
|
+
const IconsWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
62
53
|
displayName: "Inputstyles__IconsWrapper",
|
|
63
54
|
componentId: "sc-dc57an-3"
|
|
64
|
-
})(["position:absolute;right:8px;top:0;z-index:2;height:100%;.icon{svg{transition:0.3s all;fill:", ";opacity:", ";}}"],
|
|
65
|
-
|
|
66
|
-
}, function (props) {
|
|
67
|
-
return props.disabled ? '0.4' : '';
|
|
68
|
-
});
|
|
69
|
-
export var IconsFlexContainer = styled.div.withConfig({
|
|
55
|
+
})(["position:absolute;right:8px;top:0;z-index:2;height:100%;.icon{svg{transition:0.3s all;fill:", ";opacity:", ";}}"], (props) => props.theme.palette["grey-600"], (props) => props.disabled ? "0.4" : "");
|
|
56
|
+
const IconsFlexContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
70
57
|
displayName: "Inputstyles__IconsFlexContainer",
|
|
71
58
|
componentId: "sc-dc57an-4"
|
|
72
|
-
})(["", ""],
|
|
73
|
-
if (props.type ===
|
|
59
|
+
})(["", ""], (props) => {
|
|
60
|
+
if (props.type === "input") {
|
|
74
61
|
return css(["display:flex;align-items:center;height:100%;"]);
|
|
75
62
|
}
|
|
76
63
|
return css(["display:flex;align-items:flex-end;height:100%;padding-bottom:8px;"]);
|
|
77
64
|
});
|
|
78
|
-
|
|
65
|
+
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
79
66
|
displayName: "Inputstyles__IconWrapper",
|
|
80
67
|
componentId: "sc-dc57an-5"
|
|
81
|
-
})([".icon:hover{svg{fill:", ";cursor:pointer;}}"],
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
87
|
-
return /*#__PURE__*/React.createElement(BaseAntInput, _extends({
|
|
88
|
-
autoComplete: "off"
|
|
89
|
-
}, props, {
|
|
90
|
-
ref: ref
|
|
91
|
-
}));
|
|
92
|
-
})).withConfig({
|
|
68
|
+
})([".icon:hover{svg{fill:", ";cursor:pointer;}}"], (props) => props.theme.palette["blue-600"]);
|
|
69
|
+
const AntdInput = /* @__PURE__ */ styled(forwardRef(({
|
|
70
|
+
error,
|
|
71
|
+
...props
|
|
72
|
+
}, ref) => /* @__PURE__ */ jsx(BaseAntInput, { autoComplete: "off", ...props, ref }))).withConfig({
|
|
93
73
|
displayName: "Inputstyles__AntdInput",
|
|
94
74
|
componentId: "sc-dc57an-6"
|
|
95
|
-
})(["", ";&&&{min-height:", "px;transition:all 0.3s,width 0ms,min-width 0ms,max-width 0ms;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;}", "}"],
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
props = _objectWithoutPropertiesLoose(_ref4, _excluded2);
|
|
113
|
-
return /*#__PURE__*/React.createElement(TextArea, _extends({
|
|
114
|
-
autoComplete: "off"
|
|
115
|
-
}, props, {
|
|
116
|
-
ref: ref
|
|
117
|
-
}));
|
|
118
|
-
})).withConfig({
|
|
75
|
+
})(["", ";&&&{min-height:", "px;transition:all 0.3s,width 0ms,min-width 0ms,max-width 0ms;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;}", "}"], (props) => props.error ? errorInputStyle(props) : "", (props) => props.autoResize ? "16" : "32", (props) => props.disabled ? props.theme.palette["grey-500"] : props.theme.palette["grey-700"], (props) => props.theme.palette["grey-500"], (props) => props.size === "large" ? `2.49` : `1.29`, ({
|
|
76
|
+
readOnly,
|
|
77
|
+
theme
|
|
78
|
+
}) => readOnly ? `
|
|
79
|
+
&:hover {
|
|
80
|
+
border-color: ${theme.palette["grey-300"]};
|
|
81
|
+
}
|
|
82
|
+
&:focus {
|
|
83
|
+
border-color: ${theme.palette["grey-300"]};
|
|
84
|
+
box-shadow: none;
|
|
85
|
+
background: #fff;
|
|
86
|
+
}
|
|
87
|
+
` : "");
|
|
88
|
+
const AntdTextArea = /* @__PURE__ */ styled(forwardRef(({
|
|
89
|
+
error,
|
|
90
|
+
...props
|
|
91
|
+
}, ref) => /* @__PURE__ */ jsx(TextArea, { autoComplete: "off", ...props, ref }))).withConfig({
|
|
119
92
|
displayName: "Inputstyles__AntdTextArea",
|
|
120
93
|
componentId: "sc-dc57an-7"
|
|
121
|
-
})(["", ";&&{color:", ";}"],
|
|
122
|
-
|
|
123
|
-
}, function (props) {
|
|
124
|
-
return props.theme.palette['grey-700'];
|
|
125
|
-
});
|
|
126
|
-
export var ExpandableWrapper = styled.div.withConfig({
|
|
94
|
+
})(["", ";&&{color:", ";}"], (props) => props.error ? errorInputStyle(props) : "", (props) => props.theme.palette["grey-700"]);
|
|
95
|
+
const ExpandableWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
127
96
|
displayName: "Inputstyles__ExpandableWrapper",
|
|
128
97
|
componentId: "sc-dc57an-8"
|
|
129
|
-
})(["position:relative;overflow:visible;", "{position:absolute;top:0;left:0;right:0;z-index:999;resize:none;max-height:124px;min-height:65px;min-width:282px;", "}"], TextareaWrapper,
|
|
98
|
+
})(["position:relative;overflow:visible;", "{position:absolute;top:0;left:0;right:0;z-index:999;resize:none;max-height:124px;min-height:65px;min-width:282px;", "}"], TextareaWrapper, (props) => {
|
|
130
99
|
if (props.expanded) {
|
|
131
100
|
return css(["pointer-events:initial;display:block;"]);
|
|
132
101
|
}
|
|
133
102
|
return css(["pointer-events:none;display:none;"]);
|
|
134
103
|
});
|
|
135
|
-
|
|
104
|
+
const ContentBelow = /* @__PURE__ */ styled.div.withConfig({
|
|
136
105
|
displayName: "Inputstyles__ContentBelow",
|
|
137
106
|
componentId: "sc-dc57an-9"
|
|
138
107
|
})(["margin-top:8px;"]);
|
|
139
|
-
|
|
108
|
+
const ErrorText = /* @__PURE__ */ styled.div.withConfig({
|
|
140
109
|
displayName: "Inputstyles__ErrorText",
|
|
141
110
|
componentId: "sc-dc57an-10"
|
|
142
|
-
})(["color:", ";margin-bottom:4px;"],
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
export var Label = styled.label.withConfig({
|
|
111
|
+
})(["color:", ";margin-bottom:4px;"], (props) => props.theme.palette["red-600"]);
|
|
112
|
+
const Label = /* @__PURE__ */ styled.label.withConfig({
|
|
146
113
|
displayName: "Inputstyles__Label",
|
|
147
114
|
componentId: "sc-dc57an-11"
|
|
148
|
-
})(["color:", ";font-weight:500;display:block;"],
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
export var Counter = styled.div.withConfig({
|
|
115
|
+
})(["color:", ";font-weight:500;display:block;"], (props) => props.theme.palette["grey-800"]);
|
|
116
|
+
const Counter = /* @__PURE__ */ styled.div.withConfig({
|
|
152
117
|
displayName: "Inputstyles__Counter",
|
|
153
118
|
componentId: "sc-dc57an-12"
|
|
154
|
-
})(["font-weight:500;flex:1 0 auto;text-align:end;color:", ";"],
|
|
155
|
-
|
|
156
|
-
});
|
|
157
|
-
export var Description = styled.div.withConfig({
|
|
119
|
+
})(["font-weight:500;flex:1 0 auto;text-align:end;color:", ";"], (props) => props.theme.palette["grey-500"]);
|
|
120
|
+
const Description = /* @__PURE__ */ styled.div.withConfig({
|
|
158
121
|
displayName: "Inputstyles__Description",
|
|
159
122
|
componentId: "sc-dc57an-13"
|
|
160
|
-
})(["color:", ";"],
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
export var ContentAbove = styled.div.withConfig({
|
|
123
|
+
})(["color:", ";"], (props) => props.theme.palette["grey-600"]);
|
|
124
|
+
const ContentAbove = /* @__PURE__ */ styled.div.withConfig({
|
|
164
125
|
displayName: "Inputstyles__ContentAbove",
|
|
165
126
|
componentId: "sc-dc57an-14"
|
|
166
127
|
})(["display:flex;justify-content:space-between;margin-bottom:8px;min-height:18px;"]);
|
|
167
|
-
|
|
128
|
+
const AddonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
168
129
|
displayName: "Inputstyles__AddonWrapper",
|
|
169
130
|
componentId: "sc-dc57an-15"
|
|
170
|
-
})(["background:", ";display:flex;align-items:center;height:", ";"],
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
131
|
+
})(["background:", ";display:flex;align-items:center;height:", ";"], (props) => props.theme.palette["grey-050"], (props) => props.height ? `${props.height}px` : "30px");
|
|
132
|
+
export {
|
|
133
|
+
AddonWrapper,
|
|
134
|
+
AntdInput,
|
|
135
|
+
AntdTextArea,
|
|
136
|
+
ContentAbove,
|
|
137
|
+
ContentBelow,
|
|
138
|
+
Counter,
|
|
139
|
+
Description,
|
|
140
|
+
ErrorText,
|
|
141
|
+
ExpandableWrapper,
|
|
142
|
+
IconWrapper,
|
|
143
|
+
IconsFlexContainer,
|
|
144
|
+
IconsWrapper,
|
|
145
|
+
InputWrapper,
|
|
146
|
+
Label,
|
|
147
|
+
OuterWrapper,
|
|
148
|
+
Wrapper,
|
|
149
|
+
autoresizeConfObjToCss
|
|
150
|
+
};
|
package/dist/Input.types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { InputProps as AntdInputProps, TextAreaProps as AntdTextAreaProps } from 'antd/lib/input';
|
|
2
|
+
import { ForwardRefExoticComponent, MutableRefObject, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
3
|
+
import { StyledComponent } from 'styled-components';
|
|
4
|
+
import { FormFieldCommonProps } from '@synerise/ds-form-field';
|
|
5
|
+
import { AutosizeInputProps } from './AutosizeInput/AutosizeInput.types';
|
|
6
6
|
export type AutoResizeProp = boolean | {
|
|
7
7
|
minWidth: string;
|
|
8
8
|
maxWidth?: string;
|
package/dist/Input.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/dist/InputGroup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { 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,39 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label: label,
|
|
23
|
-
tooltip: tooltip,
|
|
24
|
-
tooltipConfig: tooltipConfig,
|
|
25
|
-
description: description,
|
|
26
|
-
errorText: errors && errors.map(function (error) {
|
|
27
|
-
return /*#__PURE__*/React.createElement(InputStyles.ErrorText, {
|
|
28
|
-
key: error
|
|
29
|
-
}, error);
|
|
30
|
-
})
|
|
31
|
-
}, /*#__PURE__*/React.createElement(Input.Group, antdInputGroupProps, /*#__PURE__*/React.createElement(S.InputGroupWrapper, {
|
|
32
|
-
compact: antdInputGroupProps.compact
|
|
33
|
-
}, Children.map(childrenArray, function (child, index) {
|
|
34
|
-
return /*#__PURE__*/React.createElement(S.InputGroupItem, {
|
|
35
|
-
className: "ds-input-group-item ds-input-group-item-" + index
|
|
36
|
-
}, child);
|
|
37
|
-
})))));
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import BaseAntInput from "antd/lib/input";
|
|
3
|
+
import { Children } from "react";
|
|
4
|
+
import FormField from "@synerise/ds-form-field";
|
|
5
|
+
import { OuterWrapper, ErrorText } from "./Input.styles.js";
|
|
6
|
+
import { InputGroupWrapper, InputGroupItem } from "./InputGroup.styles.js";
|
|
7
|
+
const InputGroup = ({
|
|
8
|
+
children,
|
|
9
|
+
label,
|
|
10
|
+
errors,
|
|
11
|
+
description,
|
|
12
|
+
resetMargin,
|
|
13
|
+
tooltip,
|
|
14
|
+
tooltipConfig,
|
|
15
|
+
...antdInputGroupProps
|
|
16
|
+
}) => {
|
|
17
|
+
const childrenArray = Children.toArray(children);
|
|
18
|
+
return /* @__PURE__ */ jsx(OuterWrapper, { className: "ds-input-group-outer-wrapper", resetMargin, children: /* @__PURE__ */ jsx(FormField, { label, tooltip, tooltipConfig, description, errorText: errors && errors.map((error) => /* @__PURE__ */ jsx(ErrorText, { children: error }, error)), children: /* @__PURE__ */ jsx(BaseAntInput.Group, { ...antdInputGroupProps, children: /* @__PURE__ */ jsx(InputGroupWrapper, { compact: antdInputGroupProps.compact, children: Children.map(childrenArray, (child, index) => /* @__PURE__ */ jsx(InputGroupItem, { className: `ds-input-group-item ds-input-group-item-${index}`, children: child })) }) }) }) });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
InputGroup as default
|
|
38
22
|
};
|
|
39
|
-
export default InputGroup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const InputGroupItem: import(
|
|
2
|
-
export declare const InputGroupWrapper: import(
|
|
1
|
+
export declare const InputGroupItem: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const InputGroupWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
3
3
|
compact?: boolean;
|
|
4
4
|
}, never>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const InputGroupItem = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "InputGroupstyles__InputGroupItem",
|
|
4
4
|
componentId: "sc-1cn2cc5-0"
|
|
5
5
|
})([""]);
|
|
6
|
-
|
|
6
|
+
const InputGroupWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
7
7
|
displayName: "InputGroupstyles__InputGroupWrapper",
|
|
8
8
|
componentId: "sc-1cn2cc5-1"
|
|
9
|
-
})(["&&&{", "{.ds-select-container{margin-bottom:0;}}.ant-input.ant-input{float:none;}display:flex;min-width:0;", ";", "}"], InputGroupItem,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
9
|
+
})(["&&&{", "{.ds-select-container{margin-bottom:0;}}.ant-input.ant-input{float:none;}display:flex;min-width:0;", ";", "}"], InputGroupItem, (props) => props.compact ? "" : "align-items: stretch", (props) => props.compact ? css(["", "{&:only-child{flex-grow:1;}&:not(:only-child){&:not(:last-child){margin-right:-1px;.ant-input,.ant-input-number,.ant-select-selector{border-top-right-radius:0px;border-bottom-right-radius:0px;}}&:last-child{.ant-input,.ant-input-number,.ant-select-selector{border-top-left-radius:0px;border-bottom-left-radius:0px;}flex:auto;}}"], InputGroupItem) : css(["", ":last-child{flex-grow:1;}", ":not(:last-child){margin-right:12px;}"], InputGroupItem, InputGroupItem));
|
|
10
|
+
export {
|
|
11
|
+
InputGroupItem,
|
|
12
|
+
InputGroupWrapper
|
|
13
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { GroupProps } from 'antd/es/input';
|
|
2
|
+
import { FormFieldCommonProps } from '@synerise/ds-form-field';
|
|
3
3
|
export type Props = GroupProps & {
|
|
4
4
|
errors?: string[];
|
|
5
5
|
resetMargin?: boolean;
|
package/dist/InputGroup.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ValueProps } from './Value.types';
|
|
3
3
|
declare const Value: ({ disabled, key, onRemoveClick, value, focused, className, ...rest }: ValueProps) => React.JSX.Element;
|
|
4
4
|
export default Value;
|
|
@@ -1,35 +1,23 @@
|
|
|
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
|
-
className: mergedClassName,
|
|
24
|
-
disabled: disabled,
|
|
25
|
-
key: key
|
|
26
|
-
}, rest), /*#__PURE__*/React.createElement(S.ValueText, {
|
|
27
|
-
disabled: disabled
|
|
28
|
-
}, value), /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
29
|
-
onClick: onRemoveClick
|
|
30
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
31
|
-
className: "remove",
|
|
32
|
-
component: /*#__PURE__*/React.createElement(CloseS, null)
|
|
33
|
-
}))));
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import Icon, { CloseS } from "@synerise/ds-icon";
|
|
4
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
5
|
+
import { ValueWrapper, ValueText, IconWrapper } from "../InputMultivalue.styles.js";
|
|
6
|
+
const Value = ({
|
|
7
|
+
disabled,
|
|
8
|
+
key,
|
|
9
|
+
onRemoveClick,
|
|
10
|
+
value,
|
|
11
|
+
focused,
|
|
12
|
+
className,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const mergedClassName = classnames("ds-input-value-wrapper", className);
|
|
16
|
+
return /* @__PURE__ */ jsx(Tooltip, { offset: "small", title: value, children: /* @__PURE__ */ jsxs(ValueWrapper, { "data-testid": "ds-input-value-wrapper", className: mergedClassName, disabled, ...rest, children: [
|
|
17
|
+
/* @__PURE__ */ jsx(ValueText, { disabled, children: value }),
|
|
18
|
+
/* @__PURE__ */ jsx(IconWrapper, { onClick: onRemoveClick, children: /* @__PURE__ */ jsx(Icon, { className: "remove", component: /* @__PURE__ */ jsx(CloseS, {}) }) })
|
|
19
|
+
] }, key) });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
Value as default
|
|
34
23
|
};
|
|
35
|
-
export default Value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
3
|
export type ValueProps = WithHTMLAttributes<HTMLDivElement, {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
key?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InputMultivalueProps } from './InputMultivalue.types';
|
|
3
3
|
declare const InputMultivalue: (props: InputMultivalueProps) => React.JSX.Element;
|
|
4
4
|
export default InputMultivalue;
|