glints-aries 4.1.7 → 4.1.9
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/es/@next/Input/Input.d.ts +8 -0
- package/es/@next/Input/Input.js +27 -5
- package/es/@next/Input/InputStyle.d.ts +15 -2
- package/es/@next/Input/InputStyle.js +36 -3
- package/es/@next/NumberInput/NumberInput.d.ts +12 -2
- package/es/@next/NumberInput/NumberInput.js +20 -2
- package/es/@next/Pagination/PaginationStyle.d.ts +6 -1
- package/es/@next/PasswordInput/PasswordInput.d.ts +16 -0
- package/es/@next/PasswordInput/PasswordInput.js +18 -2
- package/es/@next/Select/Select.d.ts +7 -1
- package/es/@next/Select/Select.js +27 -7
- package/es/@next/Select/Select.stories.d.ts +2 -0
- package/es/@next/Select/components/Activator/ActivatorSelect.d.ts +7 -1
- package/es/@next/Select/components/Activator/ActivatorSelect.js +22 -7
- package/es/@next/Select/components/Activator/ActivatorStyle.d.ts +15 -0
- package/es/@next/Select/components/Activator/ActivatorStyle.js +16 -2
- package/es/@next/Select/components/Activator/ActivatorTextInput.d.ts +6 -1
- package/es/@next/Select/components/Activator/ActivatorTextInput.js +17 -3
- package/es/@next/Select/components/SearchableSelectInput/ClearSelected.d.ts +2 -1
- package/es/@next/Select/components/SearchableSelectInput/ClearSelected.js +5 -2
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInput.d.ts +12 -0
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInput.js +29 -9
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.d.ts +11 -2
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.js +11 -2
- package/es/@next/TextArea/TextArea.d.ts +14 -0
- package/es/@next/TextArea/TextArea.js +25 -4
- package/es/@next/TextArea/TextArea.stories.d.ts +1 -0
- package/es/@next/TextArea/TextAreaStyle.d.ts +3 -0
- package/es/@next/TextArea/TextAreaStyle.js +13 -3
- package/es/@next/TextInput/TextInput.d.ts +16 -0
- package/es/@next/TextInput/TextInput.js +18 -2
- package/es/@next/TextInput/TextInput.stories.d.ts +1 -0
- package/es/Input/PhoneNumberInput/PhoneNumberInput.d.ts +4 -1
- package/es/Input/PhoneNumberInput/PhoneNumberInput.js +12 -6
- package/es/Input/PhoneNumberInput/PhoneNumberInput.stories.d.ts +1 -0
- package/es/Input/PhoneNumberInput/PhoneNumberInputStyles.d.ts +3 -1
- package/es/Input/PhoneNumberInput/PhoneNumberInputStyles.js +9 -6
- package/lib/@next/Input/Input.d.ts +8 -0
- package/lib/@next/Input/Input.js +26 -4
- package/lib/@next/Input/InputStyle.d.ts +15 -2
- package/lib/@next/Input/InputStyle.js +40 -5
- package/lib/@next/NumberInput/NumberInput.d.ts +12 -2
- package/lib/@next/NumberInput/NumberInput.js +20 -2
- package/lib/@next/Pagination/PaginationStyle.d.ts +6 -1
- package/lib/@next/PasswordInput/PasswordInput.d.ts +16 -0
- package/lib/@next/PasswordInput/PasswordInput.js +18 -2
- package/lib/@next/Select/Select.d.ts +7 -1
- package/lib/@next/Select/Select.js +27 -7
- package/lib/@next/Select/Select.stories.d.ts +2 -0
- package/lib/@next/Select/components/Activator/ActivatorSelect.d.ts +7 -1
- package/lib/@next/Select/components/Activator/ActivatorSelect.js +21 -6
- package/lib/@next/Select/components/Activator/ActivatorStyle.d.ts +15 -0
- package/lib/@next/Select/components/Activator/ActivatorStyle.js +18 -3
- package/lib/@next/Select/components/Activator/ActivatorTextInput.d.ts +6 -1
- package/lib/@next/Select/components/Activator/ActivatorTextInput.js +17 -3
- package/lib/@next/Select/components/SearchableSelectInput/ClearSelected.d.ts +2 -1
- package/lib/@next/Select/components/SearchableSelectInput/ClearSelected.js +5 -2
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInput.d.ts +12 -0
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInput.js +28 -8
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.d.ts +11 -2
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.js +11 -2
- package/lib/@next/TextArea/TextArea.d.ts +14 -0
- package/lib/@next/TextArea/TextArea.js +25 -4
- package/lib/@next/TextArea/TextArea.stories.d.ts +1 -0
- package/lib/@next/TextArea/TextAreaStyle.d.ts +3 -0
- package/lib/@next/TextArea/TextAreaStyle.js +13 -3
- package/lib/@next/TextInput/TextInput.d.ts +16 -0
- package/lib/@next/TextInput/TextInput.js +18 -2
- package/lib/@next/TextInput/TextInput.stories.d.ts +1 -0
- package/lib/Input/PhoneNumberInput/PhoneNumberInput.d.ts +4 -1
- package/lib/Input/PhoneNumberInput/PhoneNumberInput.js +12 -6
- package/lib/Input/PhoneNumberInput/PhoneNumberInput.stories.d.ts +1 -0
- package/lib/Input/PhoneNumberInput/PhoneNumberInputStyles.d.ts +3 -1
- package/lib/Input/PhoneNumberInput/PhoneNumberInputStyles.js +9 -6
- package/package.json +1 -1
|
@@ -4,7 +4,8 @@ import { ClearSelectedContainer } from './SearchableSelectInputStyle';
|
|
|
4
4
|
export var ClearSelected = function ClearSelected(_ref) {
|
|
5
5
|
var onSelect = _ref.onSelect,
|
|
6
6
|
handleClearIconClick = _ref.handleClearIconClick,
|
|
7
|
-
updateInputValue = _ref.updateInputValue
|
|
7
|
+
updateInputValue = _ref.updateInputValue,
|
|
8
|
+
height = _ref.height;
|
|
8
9
|
var onClearIconClick = function onClearIconClick() {
|
|
9
10
|
updateInputValue('');
|
|
10
11
|
onSelect({
|
|
@@ -12,7 +13,9 @@ export var ClearSelected = function ClearSelected(_ref) {
|
|
|
12
13
|
});
|
|
13
14
|
handleClearIconClick();
|
|
14
15
|
};
|
|
15
|
-
return /*#__PURE__*/React.createElement(ClearSelectedContainer,
|
|
16
|
+
return /*#__PURE__*/React.createElement(ClearSelectedContainer, {
|
|
17
|
+
height: height
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
16
19
|
name: "ri-close-circle-fill",
|
|
17
20
|
style: {
|
|
18
21
|
cursor: 'pointer'
|
|
@@ -20,6 +20,12 @@ export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onCh
|
|
|
20
20
|
updateSearchableSelectState?: (newState: SearchableSelectState) => void;
|
|
21
21
|
options?: Option[];
|
|
22
22
|
updateMenuOptions?: (newState: Option[]) => void;
|
|
23
|
+
border?: string;
|
|
24
|
+
borderRadius?: string;
|
|
25
|
+
floatingFontSize?: string;
|
|
26
|
+
isPlaceholderFloating?: boolean;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
height?: string;
|
|
23
29
|
};
|
|
24
30
|
export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "onSelect"> & {
|
|
25
31
|
canClear?: boolean;
|
|
@@ -35,4 +41,10 @@ export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit
|
|
|
35
41
|
updateSearchableSelectState?: (newState: SearchableSelectState) => void;
|
|
36
42
|
options?: Option[];
|
|
37
43
|
updateMenuOptions?: (newState: Option[]) => void;
|
|
44
|
+
border?: string;
|
|
45
|
+
borderRadius?: string;
|
|
46
|
+
floatingFontSize?: string;
|
|
47
|
+
isPlaceholderFloating?: boolean;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
height?: string;
|
|
38
50
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onInputChange", "onBlur", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
|
|
3
|
+
var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onInputChange", "onBlur", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions", "border", "borderRadius", "floatingFontSize", "isPlaceholderFloating", "required", "height"];
|
|
4
4
|
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { StyledInput, StyledPrefixContainer } from '../../../Input/InputStyle';
|
|
5
|
+
import { AsteriskIcon, FloatingLabel, StyledInput, StyledPrefixContainer } from '../../../Input/InputStyle';
|
|
6
6
|
import { ClearSelected } from './ClearSelected';
|
|
7
7
|
import { InputContainer, StyledContainer, StyledSelected, StyledSelectedValue } from './SearchableSelectInputStyle';
|
|
8
8
|
export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSelectInput(_ref, ref) {
|
|
@@ -28,6 +28,12 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
28
28
|
updateSearchableSelectState = _ref.updateSearchableSelectState,
|
|
29
29
|
options = _ref.options,
|
|
30
30
|
updateMenuOptions = _ref.updateMenuOptions,
|
|
31
|
+
border = _ref.border,
|
|
32
|
+
borderRadius = _ref.borderRadius,
|
|
33
|
+
floatingFontSize = _ref.floatingFontSize,
|
|
34
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
35
|
+
required = _ref.required,
|
|
36
|
+
height = _ref.height,
|
|
31
37
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
38
|
var inputRef = useRef(null);
|
|
33
39
|
var _useState = useState(false),
|
|
@@ -36,6 +42,7 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
36
42
|
var _useState2 = useState(false),
|
|
37
43
|
isSelectedClicked = _useState2[0],
|
|
38
44
|
setIsSelectedClicked = _useState2[1];
|
|
45
|
+
var isShowPlaceholder = showPlaceholder && !isPlaceholderFloating;
|
|
39
46
|
var handleFocus = function handleFocus(e) {
|
|
40
47
|
if (disabled) return;
|
|
41
48
|
setIsSelectedClicked(false);
|
|
@@ -119,6 +126,7 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
119
126
|
showPlaceholder: true
|
|
120
127
|
});
|
|
121
128
|
}, [selectedValue, handleUpdateSearchableSelectState]);
|
|
129
|
+
var selectedPlaceholder = required ? placeholder + "*" : placeholder;
|
|
122
130
|
return /*#__PURE__*/React.createElement(StyledContainer, {
|
|
123
131
|
className: "select-input-container",
|
|
124
132
|
ref: ref,
|
|
@@ -126,23 +134,35 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
126
134
|
"data-disabled": disabled,
|
|
127
135
|
prefixWidth: 37,
|
|
128
136
|
suffixWidth: 33,
|
|
129
|
-
width: width
|
|
130
|
-
|
|
137
|
+
width: width,
|
|
138
|
+
height: height,
|
|
139
|
+
isPlaceholderFloating: isPlaceholderFloating
|
|
140
|
+
}, /*#__PURE__*/React.createElement(StyledPrefixContainer, {
|
|
141
|
+
height: height
|
|
142
|
+
}, prefix), showSelected && /*#__PURE__*/React.createElement(StyledSelectedValue, {
|
|
131
143
|
className: "searchable-select",
|
|
132
|
-
onClick: handleSelectedClick
|
|
144
|
+
onClick: handleSelectedClick,
|
|
145
|
+
border: border,
|
|
146
|
+
borderRadius: borderRadius
|
|
133
147
|
}, /*#__PURE__*/React.createElement(StyledSelected, null, ((_options$find = options.find(function (option) {
|
|
134
148
|
return option.value === selectedValue;
|
|
135
149
|
})) == null ? void 0 : _options$find.label) || selectedValue)), showInput && /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(StyledInput, _extends({
|
|
136
150
|
ref: inputRef,
|
|
137
151
|
onChange: handleInputChange,
|
|
138
152
|
disabled: disabled,
|
|
139
|
-
placeholder:
|
|
153
|
+
placeholder: isShowPlaceholder ? selectedPlaceholder : null,
|
|
140
154
|
value: inputValue,
|
|
141
155
|
onBlur: handleInputBlur,
|
|
142
|
-
onFocus: handleFocus
|
|
156
|
+
onFocus: handleFocus,
|
|
157
|
+
border: border,
|
|
158
|
+
borderRadius: borderRadius
|
|
143
159
|
}, props))), showClear && !disabled && /*#__PURE__*/React.createElement(ClearSelected, {
|
|
144
160
|
onSelect: onSelect,
|
|
145
161
|
handleClearIconClick: handleClearIconClick,
|
|
146
|
-
updateInputValue: updateInputValue
|
|
147
|
-
|
|
162
|
+
updateInputValue: updateInputValue,
|
|
163
|
+
height: height
|
|
164
|
+
}), isPlaceholderFloating && /*#__PURE__*/React.createElement(FloatingLabel, {
|
|
165
|
+
"data-testid": "textarea-label",
|
|
166
|
+
fontSize: floatingFontSize
|
|
167
|
+
}, placeholder, required && /*#__PURE__*/React.createElement(AsteriskIcon, null, "*")));
|
|
148
168
|
});
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export declare const StyledContainer: import("styled-components").StyledComponent<"div", any, import("../../../Input/Input").InputProps & import("../../../Input/InputStyle").PreffixSuffixWidthProps, never>;
|
|
2
2
|
export declare const StyledSelected: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
export declare const StyledSelectedValue: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
export declare const StyledSelectedValue: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
border?: string;
|
|
5
|
+
borderRadius?: string;
|
|
6
|
+
}, never>;
|
|
4
7
|
export declare const InputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export declare const ClearSelectedContainer: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
export declare const ClearSelectedContainer: import("styled-components").StyledComponent<"div", any, {
|
|
9
|
+
height?: string;
|
|
10
|
+
} & {
|
|
11
|
+
height?: string;
|
|
12
|
+
} & {
|
|
13
|
+
height?: string;
|
|
14
|
+
}, never>;
|
|
@@ -7,7 +7,7 @@ import { borderRadius4 } from '../../../utilities/borderRadius';
|
|
|
7
7
|
export var StyledContainer = styled(StyledInputContainer).withConfig({
|
|
8
8
|
displayName: "SearchableSelectInputStyle__StyledContainer",
|
|
9
9
|
componentId: "sc-1oj168h-0"
|
|
10
|
-
})(["position:relative;height:36px;width:", ";background:", ";box-shadow:0px 1px 0px rgba(0,0,0,0.05);box-sizing:border-box;display:grid;input{background:transparent;z-index:1;width:", ";}&:has(> div > input:focus) > .searchable-select{color:", ";}.searchable-select{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.searchable-select,input{padding-left:", "px;padding-right:", "px;}&[data-error='true'] .searchable-select{border:1px solid ", ";}&[data-error='true'] .searchable-select:focus{box-shadow:none;}&[data-disabled='true'] .searchable-select{border:1px solid ", ";background:", ";color:", ";}"], function (props) {
|
|
10
|
+
})(["position:relative;height:36px;width:", ";background:", ";box-shadow:0px 1px 0px rgba(0,0,0,0.05);box-sizing:border-box;display:grid;input{background:transparent;z-index:1;width:", ";}&:has(> div > input:focus) > .searchable-select{color:", ";}.searchable-select{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.searchable-select,input{padding-left:", "px;padding-right:", "px;height:", ";}&[data-error='true'] .searchable-select{border:1px solid ", ";}&[data-error='true'] .searchable-select:focus{box-shadow:none;}&[data-disabled='true'] .searchable-select{border:1px solid ", ";background:", ";color:", ";}"], function (props) {
|
|
11
11
|
return props.width;
|
|
12
12
|
}, Neutral.B100, function (props) {
|
|
13
13
|
return props.width;
|
|
@@ -15,6 +15,9 @@ export var StyledContainer = styled(StyledInputContainer).withConfig({
|
|
|
15
15
|
return props.prefixWidth;
|
|
16
16
|
}, function (props) {
|
|
17
17
|
return props.suffixWidth;
|
|
18
|
+
}, function (props) {
|
|
19
|
+
var _props$height;
|
|
20
|
+
return (_props$height = props.height) != null ? _props$height : '36px';
|
|
18
21
|
}, Red.B93, Neutral.B85, Neutral.B95, Neutral.B85);
|
|
19
22
|
export var StyledSelected = styled.span.withConfig({
|
|
20
23
|
displayName: "SearchableSelectInputStyle__StyledSelected",
|
|
@@ -23,7 +26,13 @@ export var StyledSelected = styled.span.withConfig({
|
|
|
23
26
|
export var StyledSelectedValue = styled.div.withConfig({
|
|
24
27
|
displayName: "SearchableSelectInputStyle__StyledSelectedValue",
|
|
25
28
|
componentId: "sc-1oj168h-2"
|
|
26
|
-
})(["border:
|
|
29
|
+
})(["border:", ";border-radius:", ";background:transparent;box-sizing:border-box;padding:0 12px;height:36px;display:flex;align-items:center;grid-column:1 / 1;grid-row:1 / 1;font-family:", ",sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:150%;color:", ";@media (max-width:", "){font-size:14px;}"], function (_ref) {
|
|
30
|
+
var border = _ref.border;
|
|
31
|
+
return border != null ? border : "1px solid " + Neutral.B68;
|
|
32
|
+
}, function (_ref2) {
|
|
33
|
+
var borderRadius = _ref2.borderRadius;
|
|
34
|
+
return borderRadius != null ? borderRadius : borderRadius4;
|
|
35
|
+
}, NotoSans, Neutral.B18, Breakpoints.large);
|
|
27
36
|
export var InputContainer = styled.div.withConfig({
|
|
28
37
|
displayName: "SearchableSelectInputStyle__InputContainer",
|
|
29
38
|
componentId: "sc-1oj168h-3"
|
|
@@ -13,6 +13,13 @@ export declare type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElem
|
|
|
13
13
|
* **defaults to** `true`
|
|
14
14
|
*/
|
|
15
15
|
canExceedMaxLength: boolean;
|
|
16
|
+
border?: string;
|
|
17
|
+
borderRadius?: string;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
isPlaceholderFloating?: boolean;
|
|
20
|
+
floatingFontSize?: string;
|
|
21
|
+
floatingPlaceholderTop?: number;
|
|
22
|
+
placeholderColor?: string;
|
|
16
23
|
};
|
|
17
24
|
export declare const TextArea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> & {
|
|
18
25
|
value: string;
|
|
@@ -28,4 +35,11 @@ export declare const TextArea: React.ForwardRefExoticComponent<Omit<React.Textar
|
|
|
28
35
|
* **defaults to** `true`
|
|
29
36
|
*/
|
|
30
37
|
canExceedMaxLength: boolean;
|
|
38
|
+
border?: string;
|
|
39
|
+
borderRadius?: string;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
isPlaceholderFloating?: boolean;
|
|
42
|
+
floatingFontSize?: string;
|
|
43
|
+
floatingPlaceholderTop?: number;
|
|
44
|
+
placeholderColor?: string;
|
|
31
45
|
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["value", "rows", "maxLength", "error", "disabled", "width", "onChange", "forwardedRef", "canExceedMaxLength"];
|
|
3
|
+
var _excluded = ["value", "rows", "maxLength", "error", "disabled", "width", "onChange", "forwardedRef", "canExceedMaxLength", "required", "border", "borderRadius", "isPlaceholderFloating", "floatingFontSize", "placeholder", "floatingPlaceholderTop", "placeholderColor"];
|
|
4
4
|
import React, { useRef, useState } from 'react';
|
|
5
5
|
import { StyledTextAreaContainer, StyledTextArea, StyledWordCountContainer } from './TextAreaStyle';
|
|
6
6
|
import { Typography } from '../Typography';
|
|
7
|
+
import { AsteriskIcon, FloatingLabel } from '../Input/InputStyle';
|
|
7
8
|
var _TextArea = function _TextArea(_ref) {
|
|
8
9
|
var value = _ref.value,
|
|
9
10
|
_ref$rows = _ref.rows,
|
|
@@ -19,6 +20,14 @@ var _TextArea = function _TextArea(_ref) {
|
|
|
19
20
|
forwardedRef = _ref.forwardedRef,
|
|
20
21
|
_ref$canExceedMaxLeng = _ref.canExceedMaxLength,
|
|
21
22
|
canExceedMaxLength = _ref$canExceedMaxLeng === void 0 ? true : _ref$canExceedMaxLeng,
|
|
23
|
+
required = _ref.required,
|
|
24
|
+
border = _ref.border,
|
|
25
|
+
borderRadius = _ref.borderRadius,
|
|
26
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
27
|
+
floatingFontSize = _ref.floatingFontSize,
|
|
28
|
+
placeholder = _ref.placeholder,
|
|
29
|
+
floatingPlaceholderTop = _ref.floatingPlaceholderTop,
|
|
30
|
+
placeholderColor = _ref.placeholderColor,
|
|
22
31
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
32
|
var _useState = useState(false),
|
|
24
33
|
isFocused = _useState[0],
|
|
@@ -43,7 +52,10 @@ var _TextArea = function _TextArea(_ref) {
|
|
|
43
52
|
"data-focus": isFocused,
|
|
44
53
|
"data-has-counter": hasMaxLengthEnforced,
|
|
45
54
|
width: width,
|
|
46
|
-
onClick: handleContainerClick
|
|
55
|
+
onClick: handleContainerClick,
|
|
56
|
+
border: border,
|
|
57
|
+
borderRadius: borderRadius,
|
|
58
|
+
isPlaceholderFloating: isPlaceholderFloating
|
|
47
59
|
}, /*#__PURE__*/React.createElement(StyledTextArea, _extends({
|
|
48
60
|
ref: textAreaInputRef,
|
|
49
61
|
value: value,
|
|
@@ -57,14 +69,23 @@ var _TextArea = function _TextArea(_ref) {
|
|
|
57
69
|
},
|
|
58
70
|
onBlur: function onBlur() {
|
|
59
71
|
return setIsFocused(false);
|
|
60
|
-
}
|
|
72
|
+
},
|
|
73
|
+
border: border,
|
|
74
|
+
borderRadius: borderRadius,
|
|
75
|
+
placeholder: isPlaceholderFloating && !disabled ? undefined : placeholder
|
|
61
76
|
}, props)), hasMaxLengthEnforced && /*#__PURE__*/React.createElement(StyledWordCountContainer, {
|
|
62
77
|
"data-disabled": disabled,
|
|
63
78
|
"data-error": hasError
|
|
64
79
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
65
80
|
as: "span",
|
|
66
81
|
variant: "overline"
|
|
67
|
-
}, charCount, " / ", maxLength))
|
|
82
|
+
}, charCount, " / ", maxLength)), isPlaceholderFloating && !disabled && /*#__PURE__*/React.createElement(FloatingLabel, {
|
|
83
|
+
"data-testid": "textarea-label",
|
|
84
|
+
"data-error": error,
|
|
85
|
+
fontSize: floatingFontSize,
|
|
86
|
+
color: placeholderColor,
|
|
87
|
+
top: floatingPlaceholderTop
|
|
88
|
+
}, placeholder, required && /*#__PURE__*/React.createElement(AsteriskIcon, null, "*")));
|
|
68
89
|
};
|
|
69
90
|
var forwardRef = function forwardRef(props, ref) {
|
|
70
91
|
return /*#__PURE__*/React.createElement(_TextArea, _extends({}, props, {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
interface TextAreaProp {
|
|
2
2
|
width: string;
|
|
3
|
+
border?: string;
|
|
4
|
+
borderRadius?: string;
|
|
5
|
+
isPlaceholderFloating?: boolean;
|
|
3
6
|
}
|
|
4
7
|
export declare const StyledTextAreaContainer: import("styled-components").StyledComponent<"div", any, TextAreaProp, never>;
|
|
5
8
|
export declare const StyledTextArea: import("styled-components").StyledComponent<"textarea", any, TextAreaProp, never>;
|
|
@@ -2,16 +2,26 @@ import styled from 'styled-components';
|
|
|
2
2
|
import { borderRadius4 } from '../utilities/borderRadius';
|
|
3
3
|
import { Neutral, Red } from '../utilities/colors';
|
|
4
4
|
import { body1 as typographyBody1 } from '../Typography/TypographyStyles';
|
|
5
|
+
import { FloatingLabel } from '../Input/InputStyle';
|
|
5
6
|
export var StyledTextAreaContainer = styled.div.withConfig({
|
|
6
7
|
displayName: "TextAreaStyle__StyledTextAreaContainer",
|
|
7
8
|
componentId: "sc-1cq0fhw-0"
|
|
8
|
-
})(["position:relative;width:", ";border:
|
|
9
|
+
})(["position:relative;width:", ";border:", ";border-radius:", ";padding:8px 12px 25px 12px;cursor:text;&:not([data-has-counter='true']){padding-bottom:8px;}&[data-focus='true']{outline:none;box-shadow:0px 0px 0px 1px ", ",0px 0px 0px 3px #6ac9ec;}&[data-error='true']{border:1px solid ", ";&[data-focus='true']{box-shadow:none;}}&[data-disabled='true']{border:1px solid ", ";background:", ";}"], function (props) {
|
|
9
10
|
return props.width;
|
|
10
|
-
},
|
|
11
|
+
}, function (_ref) {
|
|
12
|
+
var border = _ref.border;
|
|
13
|
+
return border != null ? border : "1px solid " + Neutral.B68;
|
|
14
|
+
}, function (_ref2) {
|
|
15
|
+
var borderRadius = _ref2.borderRadius;
|
|
16
|
+
return borderRadius != null ? borderRadius : borderRadius4;
|
|
17
|
+
}, Neutral.B100, Red.B93, Neutral.B85, Neutral.B95);
|
|
11
18
|
export var StyledTextArea = styled.textarea.withConfig({
|
|
12
19
|
displayName: "TextAreaStyle__StyledTextArea",
|
|
13
20
|
componentId: "sc-1cq0fhw-1"
|
|
14
|
-
})(["background:", ";box-sizing:border-box;border:none;", " color:", ";resize:none;width:100%;::-webkit-scrollbar{width:4px;}::-webkit-scrollbar-thumb{background-color:", ";border-radius:2px;}::-webkit-scrollbar-thumb:hover{background-color:", ";}&::placeholder{color:", ";}&:focus{outline:none;}:disabled{background:", ";::placeholder{color:", ";}}"], Neutral.B100,
|
|
21
|
+
})(["background:", ";box-sizing:border-box;border:none;", " ", " color:", ";resize:none;width:100%;::-webkit-scrollbar{width:4px;}::-webkit-scrollbar-thumb{background-color:", ";border-radius:2px;}::-webkit-scrollbar-thumb:hover{background-color:", ";}&::placeholder{color:", ";}&:focus{outline:none;}:disabled{background:", ";::placeholder{color:", ";}}"], Neutral.B100, function (_ref3) {
|
|
22
|
+
var isPlaceholderFloating = _ref3.isPlaceholderFloating;
|
|
23
|
+
return isPlaceholderFloating && FloatingLabel;
|
|
24
|
+
}, typographyBody1, Neutral.B18, Neutral.B68, Neutral.B40, Neutral.B68, Neutral.B95, Neutral.B85);
|
|
15
25
|
export var StyledWordCountContainer = styled.div.withConfig({
|
|
16
26
|
displayName: "TextAreaStyle__StyledWordCountContainer",
|
|
17
27
|
componentId: "sc-1cq0fhw-2"
|
|
@@ -3,8 +3,24 @@ import { InputProps } from '../Input/Input';
|
|
|
3
3
|
export declare type TextInputProps = Omit<InputProps, 'type' | 'onChange'> & {
|
|
4
4
|
canClear?: boolean;
|
|
5
5
|
onChange?: (value: string) => void;
|
|
6
|
+
height?: string;
|
|
7
|
+
border?: string;
|
|
8
|
+
borderRadius?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
isPlaceholderFloating?: boolean;
|
|
11
|
+
floatingFontSize?: string;
|
|
12
|
+
placeholderColor?: string;
|
|
13
|
+
floatingPlaceholderTop?: number;
|
|
6
14
|
};
|
|
7
15
|
export declare const TextInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange"> & {
|
|
8
16
|
canClear?: boolean;
|
|
9
17
|
onChange?: (value: string) => void;
|
|
18
|
+
height?: string;
|
|
19
|
+
border?: string;
|
|
20
|
+
borderRadius?: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
isPlaceholderFloating?: boolean;
|
|
23
|
+
floatingFontSize?: string;
|
|
24
|
+
placeholderColor?: string;
|
|
25
|
+
floatingPlaceholderTop?: number;
|
|
10
26
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["canClear", "suffix", "value", "onChange", "error"];
|
|
3
|
+
var _excluded = ["canClear", "suffix", "value", "onChange", "error", "height", "border", "borderRadius", "required", "floatingFontSize", "isPlaceholderFloating", "placeholderColor", "floatingPlaceholderTop"];
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
import { Input } from '../Input/Input';
|
|
@@ -10,6 +10,14 @@ export var TextInput = /*#__PURE__*/React.forwardRef(function TextInput(_ref, re
|
|
|
10
10
|
value = _ref.value,
|
|
11
11
|
onChange = _ref.onChange,
|
|
12
12
|
error = _ref.error,
|
|
13
|
+
height = _ref.height,
|
|
14
|
+
border = _ref.border,
|
|
15
|
+
borderRadius = _ref.borderRadius,
|
|
16
|
+
required = _ref.required,
|
|
17
|
+
floatingFontSize = _ref.floatingFontSize,
|
|
18
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
19
|
+
placeholderColor = _ref.placeholderColor,
|
|
20
|
+
floatingPlaceholderTop = _ref.floatingPlaceholderTop,
|
|
13
21
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
14
22
|
var ClearIcon = function ClearIcon() {
|
|
15
23
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -44,6 +52,14 @@ export var TextInput = /*#__PURE__*/React.forwardRef(function TextInput(_ref, re
|
|
|
44
52
|
suffix: suffixValue,
|
|
45
53
|
value: value,
|
|
46
54
|
onChange: handleChange,
|
|
47
|
-
error: error
|
|
55
|
+
error: error,
|
|
56
|
+
border: border,
|
|
57
|
+
borderRadius: borderRadius,
|
|
58
|
+
floatingFontSize: floatingFontSize,
|
|
59
|
+
isPlaceholderFloating: isPlaceholderFloating,
|
|
60
|
+
placeholderColor: placeholderColor,
|
|
61
|
+
floatingPlaceholderTop: floatingPlaceholderTop,
|
|
62
|
+
required: required,
|
|
63
|
+
height: height
|
|
48
64
|
}, props));
|
|
49
65
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
export declare const PhoneNumberInput: ({ value, onChange, onFocus, onBlur, callingCodeOptions: callingCodeOptionsExternal, onInputChange, filterValue, isLoadingCallingCodeOptions, label, featuredOptionsLabel, otherOptionsLabel, callingCodeFilterInputPlaceholder, callingCodeNoOptionsLabel, error, addon, ...restProps }: Props) => JSX.Element;
|
|
2
|
+
export declare const PhoneNumberInput: ({ value, onChange, onFocus, onBlur, callingCodeOptions: callingCodeOptionsExternal, onInputChange, filterValue, isLoadingCallingCodeOptions, label, featuredOptionsLabel, otherOptionsLabel, callingCodeFilterInputPlaceholder, callingCodeNoOptionsLabel, isDisableCallingCode, isPlaceholderFloating, isRequired, error, addon, ...restProps }: Props) => JSX.Element;
|
|
3
3
|
export interface Props {
|
|
4
4
|
value: PhoneNumber;
|
|
5
5
|
onChange: (value: PhoneNumber) => void;
|
|
@@ -17,6 +17,9 @@ export interface Props {
|
|
|
17
17
|
otherOptionsLabel: string;
|
|
18
18
|
callingCodeFilterInputPlaceholder: string;
|
|
19
19
|
callingCodeNoOptionsLabel: string;
|
|
20
|
+
isDisableCallingCode?: boolean;
|
|
21
|
+
isPlaceholderFloating?: boolean;
|
|
22
|
+
isRequired?: boolean;
|
|
20
23
|
}
|
|
21
24
|
export interface PhoneNumber {
|
|
22
25
|
callingCode: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["value", "onChange", "onFocus", "onBlur", "callingCodeOptions", "onInputChange", "filterValue", "isLoadingCallingCodeOptions", "label", "featuredOptionsLabel", "otherOptionsLabel", "callingCodeFilterInputPlaceholder", "callingCodeNoOptionsLabel", "error", "addon"];
|
|
3
|
+
var _excluded = ["value", "onChange", "onFocus", "onBlur", "callingCodeOptions", "onInputChange", "filterValue", "isLoadingCallingCodeOptions", "label", "featuredOptionsLabel", "otherOptionsLabel", "callingCodeFilterInputPlaceholder", "callingCodeNoOptionsLabel", "isDisableCallingCode", "isPlaceholderFloating", "isRequired", "error", "addon"];
|
|
4
4
|
import { useCombobox } from 'downshift';
|
|
5
5
|
import { find, orderBy } from 'lodash-es';
|
|
6
6
|
import React, { useEffect, useRef, useState } from 'react';
|
|
@@ -9,6 +9,7 @@ import { ArrowDownIcon, ArrowUpIcon } from '../../General/Icon/components';
|
|
|
9
9
|
import { Flex } from '../../Layout/Flex';
|
|
10
10
|
import { useOutsideAlerter } from '../../Utils/useOutsideAlerter';
|
|
11
11
|
import * as S from './PhoneNumberInputStyles';
|
|
12
|
+
import { AsteriskIcon } from '../../@next/Input/InputStyle';
|
|
12
13
|
|
|
13
14
|
// Downshift wants a ref to this, but we need one ourselves, and there is no way
|
|
14
15
|
// to share.
|
|
@@ -31,6 +32,9 @@ export var PhoneNumberInput = function PhoneNumberInput(_ref) {
|
|
|
31
32
|
otherOptionsLabel = _ref.otherOptionsLabel,
|
|
32
33
|
callingCodeFilterInputPlaceholder = _ref.callingCodeFilterInputPlaceholder,
|
|
33
34
|
callingCodeNoOptionsLabel = _ref.callingCodeNoOptionsLabel,
|
|
35
|
+
isDisableCallingCode = _ref.isDisableCallingCode,
|
|
36
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
37
|
+
isRequired = _ref.isRequired,
|
|
34
38
|
error = _ref.error,
|
|
35
39
|
addon = _ref.addon,
|
|
36
40
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -82,15 +86,16 @@ export var PhoneNumberInput = function PhoneNumberInput(_ref) {
|
|
|
82
86
|
useOutsideAlerter(containerRef, closeCallingCodeInput);
|
|
83
87
|
var _useId = useId(1, 'significant-number-input-'),
|
|
84
88
|
significantNumberInputId = _useId[0];
|
|
89
|
+
var placeholder = isRequired ? label + "*" : label;
|
|
85
90
|
return /*#__PURE__*/React.createElement(S.PhoneNumberInputContainer, _extends({
|
|
86
91
|
ref: containerRef
|
|
87
92
|
}, restProps), /*#__PURE__*/React.createElement(S.TopRow, {
|
|
88
93
|
"data-invalid": Boolean(error)
|
|
89
94
|
}, /*#__PURE__*/React.createElement(S.CallingCodeInputToggle, _extends({}, getToggleButtonProps(), {
|
|
90
95
|
type: "button",
|
|
91
|
-
onClick: toggleIsCallingCodeOpen,
|
|
96
|
+
onClick: isDisableCallingCode ? undefined : toggleIsCallingCodeOpen,
|
|
92
97
|
"data-testid": "calling-code-input-toggle"
|
|
93
|
-
}), "+", value.callingCode, /*#__PURE__*/React.createElement(S.CallingCodeInputOpenIndicator, null, isCallingCodeInputOpen ? /*#__PURE__*/React.createElement(ArrowUpIcon, null) : /*#__PURE__*/React.createElement(ArrowDownIcon, null))), /*#__PURE__*/React.createElement(S.SignificantNumberInput, {
|
|
98
|
+
}), "+", value.callingCode, /*#__PURE__*/React.createElement(S.CallingCodeInputOpenIndicator, null, isDisableCallingCode ? /*#__PURE__*/React.createElement("span", null, "\xA0") : isCallingCodeInputOpen ? /*#__PURE__*/React.createElement(ArrowUpIcon, null) : /*#__PURE__*/React.createElement(ArrowDownIcon, null))), /*#__PURE__*/React.createElement(S.SignificantNumberInput, {
|
|
94
99
|
id: significantNumberInputId,
|
|
95
100
|
"data-testid": "significant-number-input",
|
|
96
101
|
type: "tel",
|
|
@@ -102,12 +107,13 @@ export var PhoneNumberInput = function PhoneNumberInput(_ref) {
|
|
|
102
107
|
},
|
|
103
108
|
onFocus: onFocus,
|
|
104
109
|
onBlur: onBlur,
|
|
105
|
-
placeholder:
|
|
110
|
+
placeholder: isPlaceholderFloating ? undefined : placeholder,
|
|
106
111
|
"data-invalid": Boolean(error),
|
|
107
|
-
"aria-label": label
|
|
112
|
+
"aria-label": label,
|
|
113
|
+
isPlaceholderFloating: isPlaceholderFloating
|
|
108
114
|
}), /*#__PURE__*/React.createElement(S.Label, {
|
|
109
115
|
htmlFor: significantNumberInputId
|
|
110
|
-
}, label), /*#__PURE__*/React.createElement(S.TopRowAddon, {
|
|
116
|
+
}, label, isRequired && /*#__PURE__*/React.createElement(AsteriskIcon, null)), /*#__PURE__*/React.createElement(S.TopRowAddon, {
|
|
111
117
|
"data-testid": "addon"
|
|
112
118
|
}, addon)), /*#__PURE__*/React.createElement(S.CallingCodeInput, _extends({
|
|
113
119
|
isOpen: isCallingCodeInputOpen
|
|
@@ -4,7 +4,9 @@ export declare const TopRow: import("styled-components").StyledComponent<"div",
|
|
|
4
4
|
export declare const CallingCodeInputToggle: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
5
5
|
export declare const CallingCodeInputOpenIndicator: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
6
|
export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
7
|
-
export declare const SignificantNumberInput: import("styled-components").StyledComponent<"input", any, {
|
|
7
|
+
export declare const SignificantNumberInput: import("styled-components").StyledComponent<"input", any, {
|
|
8
|
+
isPlaceholderFloating?: boolean;
|
|
9
|
+
}, never>;
|
|
8
10
|
export declare const TopRowAddon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
11
|
export declare const CallingCodeInput: import("styled-components").StyledComponent<"div", any, {
|
|
10
12
|
isOpen: boolean;
|
|
@@ -21,14 +21,17 @@ export var CallingCodeInputOpenIndicator = styled.span.withConfig({
|
|
|
21
21
|
export var Label = styled.label.withConfig({
|
|
22
22
|
displayName: "PhoneNumberInputStyles__Label",
|
|
23
23
|
componentId: "sc-80kraj-4"
|
|
24
|
-
})(["position:absolute;left:0.5em;top:-
|
|
24
|
+
})(["position:absolute;left:0.5em;top:-1.25em;visibility:hidden;padding:0 0.3em;background:white;color:", ";"], Greyscale.devilsgrey);
|
|
25
25
|
var visibleLabel = css(["+ ", "{visibility:visible;color:#646464;font-size:12px;}"], Label);
|
|
26
26
|
export var SignificantNumberInput = styled.input.withConfig({
|
|
27
27
|
displayName: "PhoneNumberInputStyles__SignificantNumberInput",
|
|
28
28
|
componentId: "sc-80kraj-5"
|
|
29
|
-
})(["border:none;width:100%;font-size:16px;padding:12px;&:focus{outline:2px solid ", ";::placeholder{color:transparent;}", "}", " &[data-invalid='true']:focus{outline:2px solid ", ";}"], SecondaryColor.actionblue, visibleLabel, function (_ref) {
|
|
29
|
+
})(["border:none;width:100%;font-size:16px;padding:12px;&:focus{outline:2px solid ", ";::placeholder{color:transparent;}", "}", " ", " &[data-invalid='true']:focus{outline:2px solid ", ";}"], SecondaryColor.actionblue, visibleLabel, function (_ref) {
|
|
30
30
|
var value = _ref.value;
|
|
31
31
|
return value && visibleLabel;
|
|
32
|
+
}, function (_ref2) {
|
|
33
|
+
var isPlaceholderFloating = _ref2.isPlaceholderFloating;
|
|
34
|
+
return isPlaceholderFloating && visibleLabel;
|
|
32
35
|
}, PrimaryColor.glintsred);
|
|
33
36
|
export var TopRowAddon = styled.div.withConfig({
|
|
34
37
|
displayName: "PhoneNumberInputStyles__TopRowAddon",
|
|
@@ -37,8 +40,8 @@ export var TopRowAddon = styled.div.withConfig({
|
|
|
37
40
|
export var CallingCodeInput = styled.div.withConfig({
|
|
38
41
|
displayName: "PhoneNumberInputStyles__CallingCodeInput",
|
|
39
42
|
componentId: "sc-80kraj-7"
|
|
40
|
-
})(["position:absolute;display:none;z-index:2;background:white;margin-top:4px;width:100%;border:1px solid ", ";box-shadow:", ";", ""], Greyscale.lightgrey, Shadow.down1, function (
|
|
41
|
-
var isOpen =
|
|
43
|
+
})(["position:absolute;display:none;z-index:2;background:white;margin-top:4px;width:100%;border:1px solid ", ";box-shadow:", ";", ""], Greyscale.lightgrey, Shadow.down1, function (_ref3) {
|
|
44
|
+
var isOpen = _ref3.isOpen;
|
|
42
45
|
return isOpen && css(["display:initial;"]);
|
|
43
46
|
});
|
|
44
47
|
var CALLING_CODE_INPUT_MARGIN = '8px';
|
|
@@ -58,8 +61,8 @@ export var CallingCodeOptionsList = styled.ol.withConfig({
|
|
|
58
61
|
displayName: "PhoneNumberInputStyles__CallingCodeOptionsList",
|
|
59
62
|
componentId: "sc-80kraj-11"
|
|
60
63
|
})(["list-style:none;margin:0;padding:0;max-height:260px;overflow:auto;font-size:16px;"]);
|
|
61
|
-
var getGroupHeaderStyles = function getGroupHeaderStyles(
|
|
62
|
-
var withGroupHeader =
|
|
64
|
+
var getGroupHeaderStyles = function getGroupHeaderStyles(_ref4) {
|
|
65
|
+
var withGroupHeader = _ref4.withGroupHeader;
|
|
63
66
|
return withGroupHeader && css(["content:'", "';display:block;padding:4px 8px;color:", ";font-size:8px;border-bottom:1px solid ", ";text-transform:uppercase;background:white;cursor:default;"], withGroupHeader, Greyscale.devilsgrey, Greyscale.softgrey);
|
|
64
67
|
};
|
|
65
68
|
export var CallingCodeOption = styled.li.withConfig({
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> {
|
|
3
3
|
error?: boolean;
|
|
4
|
+
height?: string;
|
|
5
|
+
border?: string;
|
|
6
|
+
borderRadius?: string;
|
|
7
|
+
floatingFontSize?: string;
|
|
8
|
+
isPlaceholderFloating?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
placeholderColor?: string;
|
|
11
|
+
floatingPlaceholderTop?: number;
|
|
4
12
|
prefix?: React.ReactNode;
|
|
5
13
|
suffix?: React.ReactNode;
|
|
6
14
|
inputRef?: React.Ref<HTMLInputElement>;
|
package/lib/@next/Input/Input.js
CHANGED
|
@@ -7,7 +7,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
7
7
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _InputStyle = require("./InputStyle");
|
|
10
|
-
var _excluded = ["error", "disabled", "prefix", "suffix", "inputRef"];
|
|
10
|
+
var _excluded = ["error", "disabled", "prefix", "suffix", "inputRef", "height", "border", "borderRadius", "floatingFontSize", "isPlaceholderFloating", "placeholder", "required", "placeholderColor", "floatingPlaceholderTop"];
|
|
11
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
13
|
var Input = /*#__PURE__*/_react["default"].forwardRef(function Input(_ref, ref) {
|
|
@@ -16,6 +16,15 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function Input(_ref, ref)
|
|
|
16
16
|
prefix = _ref.prefix,
|
|
17
17
|
suffix = _ref.suffix,
|
|
18
18
|
inputRef = _ref.inputRef,
|
|
19
|
+
height = _ref.height,
|
|
20
|
+
border = _ref.border,
|
|
21
|
+
borderRadius = _ref.borderRadius,
|
|
22
|
+
floatingFontSize = _ref.floatingFontSize,
|
|
23
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
24
|
+
placeholder = _ref.placeholder,
|
|
25
|
+
required = _ref.required,
|
|
26
|
+
placeholderColor = _ref.placeholderColor,
|
|
27
|
+
floatingPlaceholderTop = _ref.floatingPlaceholderTop,
|
|
19
28
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
20
29
|
var hasPrefix = !!prefix;
|
|
21
30
|
var hasSuffix = !!suffix;
|
|
@@ -23,12 +32,14 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function Input(_ref, ref)
|
|
|
23
32
|
var suffixRef = (0, _react.useRef)(null);
|
|
24
33
|
var Prefix = function Prefix() {
|
|
25
34
|
return hasPrefix ? /*#__PURE__*/_react["default"].createElement(_InputStyle.StyledPrefixContainer, {
|
|
26
|
-
ref: prefixRef
|
|
35
|
+
ref: prefixRef,
|
|
36
|
+
height: height
|
|
27
37
|
}, prefix) : null;
|
|
28
38
|
};
|
|
29
39
|
var Suffix = function Suffix() {
|
|
30
40
|
return hasSuffix ? /*#__PURE__*/_react["default"].createElement(_InputStyle.StyledSuffixContainer, {
|
|
31
|
-
ref: suffixRef
|
|
41
|
+
ref: suffixRef,
|
|
42
|
+
height: height
|
|
32
43
|
}, suffix) : null;
|
|
33
44
|
};
|
|
34
45
|
var _React$useState = _react["default"].useState(0),
|
|
@@ -49,6 +60,7 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function Input(_ref, ref)
|
|
|
49
60
|
setSuffixWidth(_suffixWidth);
|
|
50
61
|
}
|
|
51
62
|
}, [hasSuffix, suffix]);
|
|
63
|
+
var selectedPlaceholder = required ? placeholder + "*" : placeholder;
|
|
52
64
|
return /*#__PURE__*/_react["default"].createElement(_InputStyle.StyledContainer, {
|
|
53
65
|
ref: ref,
|
|
54
66
|
"data-prefix": hasPrefix,
|
|
@@ -59,7 +71,17 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function Input(_ref, ref)
|
|
|
59
71
|
suffixWidth: suffixWidth
|
|
60
72
|
}, /*#__PURE__*/_react["default"].createElement(Prefix, null), /*#__PURE__*/_react["default"].createElement(_InputStyle.StyledInput, (0, _extends2["default"])({
|
|
61
73
|
ref: inputRef,
|
|
74
|
+
placeholder: isPlaceholderFloating && !disabled ? undefined : selectedPlaceholder,
|
|
75
|
+
borderRadius: borderRadius,
|
|
76
|
+
border: border,
|
|
77
|
+
height: height,
|
|
62
78
|
disabled: disabled
|
|
63
|
-
}, props)), /*#__PURE__*/_react["default"].createElement(
|
|
79
|
+
}, props)), isPlaceholderFloating && !disabled && /*#__PURE__*/_react["default"].createElement(_InputStyle.FloatingLabel, {
|
|
80
|
+
"data-testid": "textarea-label",
|
|
81
|
+
"data-error": error,
|
|
82
|
+
fontSize: floatingFontSize,
|
|
83
|
+
color: placeholderColor,
|
|
84
|
+
top: floatingPlaceholderTop
|
|
85
|
+
}, placeholder, required && /*#__PURE__*/_react["default"].createElement(_InputStyle.AsteriskIcon, null, "*")), /*#__PURE__*/_react["default"].createElement(Suffix, null));
|
|
64
86
|
});
|
|
65
87
|
exports.Input = Input;
|