glints-aries 4.1.6 → 4.1.8
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/Icon/components/RiIndeterminateCircleFill.d.ts +3 -0
- package/es/@next/Icon/components/RiIndeterminateCircleFill.js +11 -0
- package/es/@next/Icon/components/RiIndeterminateCircleLine.d.ts +3 -0
- package/es/@next/Icon/components/RiIndeterminateCircleLine.js +11 -0
- package/es/@next/Icon/components/index.d.ts +2 -0
- package/es/@next/Icon/components/index.js +2 -0
- package/es/@next/Icon/icons/icons.d.ts +1 -1
- package/es/@next/Icon/icons/icons.js +2 -2
- package/es/@next/Input/Input.d.ts +6 -0
- package/es/@next/Input/Input.js +22 -5
- package/es/@next/Input/InputStyle.d.ts +14 -2
- package/es/@next/Input/InputStyle.js +33 -3
- package/es/@next/NumberInput/NumberInput.d.ts +12 -2
- package/es/@next/NumberInput/NumberInput.js +14 -2
- package/es/@next/Pagination/PaginationStyle.d.ts +6 -1
- package/es/@next/PasswordInput/PasswordInput.d.ts +10 -0
- package/es/@next/PasswordInput/PasswordInput.js +12 -2
- package/es/@next/Select/Select.d.ts +6 -1
- package/es/@next/Select/Select.js +21 -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 +13 -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 +26 -8
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.d.ts +7 -1
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.js +4 -1
- package/es/@next/TextArea/TextArea.d.ts +10 -0
- package/es/@next/TextArea/TextArea.js +20 -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 +12 -0
- package/es/@next/TextInput/TextInput.js +14 -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/Icon/components/RiIndeterminateCircleFill.d.ts +3 -0
- package/lib/@next/Icon/components/RiIndeterminateCircleFill.js +19 -0
- package/lib/@next/Icon/components/RiIndeterminateCircleLine.d.ts +3 -0
- package/lib/@next/Icon/components/RiIndeterminateCircleLine.js +19 -0
- package/lib/@next/Icon/components/index.d.ts +2 -0
- package/lib/@next/Icon/components/index.js +5 -1
- package/lib/@next/Icon/icons/icons.d.ts +1 -1
- package/lib/@next/Icon/icons/icons.js +2 -2
- package/lib/@next/Input/Input.d.ts +6 -0
- package/lib/@next/Input/Input.js +21 -4
- package/lib/@next/Input/InputStyle.d.ts +14 -2
- package/lib/@next/Input/InputStyle.js +37 -5
- package/lib/@next/NumberInput/NumberInput.d.ts +12 -2
- package/lib/@next/NumberInput/NumberInput.js +14 -2
- package/lib/@next/Pagination/PaginationStyle.d.ts +6 -1
- package/lib/@next/PasswordInput/PasswordInput.d.ts +10 -0
- package/lib/@next/PasswordInput/PasswordInput.js +12 -2
- package/lib/@next/Select/Select.d.ts +6 -1
- package/lib/@next/Select/Select.js +21 -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 +13 -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 +25 -7
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.d.ts +7 -1
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.js +4 -1
- package/lib/@next/TextArea/TextArea.d.ts +10 -0
- package/lib/@next/TextArea/TextArea.js +20 -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 +12 -0
- package/lib/@next/TextInput/TextInput.js +14 -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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["customActivatorIcon", "placeholder", "selectedValues", "onClick", "onRemoveTag", "width", "allowMultiple", "disabled", "onSelectClick", "hasError", "options", "prefix"];
|
|
3
|
+
var _excluded = ["customActivatorIcon", "placeholder", "selectedValues", "onClick", "onRemoveTag", "width", "allowMultiple", "disabled", "onSelectClick", "hasError", "options", "prefix", "required", "border", "borderRadius", "height", "floatingFontSize", "isPlaceholderFloating"];
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Typography } from '../../../Typography';
|
|
6
6
|
import { Blue, Neutral } from '../../../utilities/colors';
|
|
7
|
-
import { StyledIcon, StyledPrefixContainer, StyledSelect, StyledSelectTypography, StyledTag, TagsContainer, WithPrefixContainer } from './ActivatorStyle';
|
|
7
|
+
import { StyledIcon, StyledPrefixContainer, StyledSelect, StyledSelectTypography, StyledTag, SuffixContainer, TagsContainer, WithPrefixContainer } from './ActivatorStyle';
|
|
8
|
+
import { AsteriskIcon, FloatingLabel } from '../../../Input/InputStyle';
|
|
8
9
|
export var ActivatorSelect = function ActivatorSelect(_ref) {
|
|
9
10
|
var customActivatorIcon = _ref.customActivatorIcon,
|
|
10
11
|
placeholder = _ref.placeholder,
|
|
@@ -21,6 +22,12 @@ export var ActivatorSelect = function ActivatorSelect(_ref) {
|
|
|
21
22
|
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
22
23
|
options = _ref.options,
|
|
23
24
|
prefix = _ref.prefix,
|
|
25
|
+
required = _ref.required,
|
|
26
|
+
border = _ref.border,
|
|
27
|
+
borderRadius = _ref.borderRadius,
|
|
28
|
+
height = _ref.height,
|
|
29
|
+
floatingFontSize = _ref.floatingFontSize,
|
|
30
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
24
31
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
32
|
var _useState = useState([]),
|
|
26
33
|
filteredValues = _useState[0],
|
|
@@ -49,11 +56,12 @@ export var ActivatorSelect = function ActivatorSelect(_ref) {
|
|
|
49
56
|
onSelectClick();
|
|
50
57
|
onClick == null ? void 0 : onClick(e);
|
|
51
58
|
};
|
|
52
|
-
var
|
|
59
|
+
var selectedPlaceholder = required ? placeholder + "*" : placeholder;
|
|
60
|
+
var placeholderMarkup = isPlaceholderFloating ? undefined : /*#__PURE__*/React.createElement(Typography, {
|
|
53
61
|
variant: "body1",
|
|
54
62
|
as: "span",
|
|
55
63
|
color: disabled ? Neutral.B85 : Neutral.B68
|
|
56
|
-
},
|
|
64
|
+
}, selectedPlaceholder);
|
|
57
65
|
var tagsMarkup = function tagsMarkup() {
|
|
58
66
|
if (!hasSelectedValues) {
|
|
59
67
|
return placeholderMarkup;
|
|
@@ -76,14 +84,21 @@ export var ActivatorSelect = function ActivatorSelect(_ref) {
|
|
|
76
84
|
"data-error": hasError,
|
|
77
85
|
onClick: handleClick,
|
|
78
86
|
disabled: disabled,
|
|
79
|
-
width: width
|
|
87
|
+
width: width,
|
|
88
|
+
height: height,
|
|
89
|
+
border: border,
|
|
90
|
+
borderRadius: borderRadius,
|
|
91
|
+
isPlaceholderFloating: isPlaceholderFloating
|
|
80
92
|
}), /*#__PURE__*/React.createElement(WithPrefixContainer, null, prefix && /*#__PURE__*/React.createElement(StyledPrefixContainer, null, prefix), allowMultiple ? tagsMarkup() : /*#__PURE__*/React.createElement(StyledSelectTypography, {
|
|
81
93
|
variant: "body1",
|
|
82
94
|
"data-disabled": disabled,
|
|
83
95
|
color: hasSelectedValues ? Neutral.B18 : Neutral.B40
|
|
84
|
-
}, hasSelectedValues ? selectedLabels[0] : placeholderMarkup)), /*#__PURE__*/React.createElement(StyledIcon, {
|
|
96
|
+
}, hasSelectedValues ? selectedLabels[0] : placeholderMarkup)), /*#__PURE__*/React.createElement(SuffixContainer, null, /*#__PURE__*/React.createElement(StyledIcon, {
|
|
85
97
|
height: 24,
|
|
86
98
|
name: customActivatorIcon || 'ri-arrow-m-down-line',
|
|
87
99
|
fill: disabled ? Neutral.B85 : Neutral.B40
|
|
88
|
-
}))
|
|
100
|
+
})), isPlaceholderFloating && /*#__PURE__*/React.createElement(FloatingLabel, {
|
|
101
|
+
"data-testid": "textarea-label",
|
|
102
|
+
fontSize: floatingFontSize
|
|
103
|
+
}, placeholder, required && /*#__PURE__*/React.createElement(AsteriskIcon, null, "*")));
|
|
89
104
|
};
|
|
@@ -6,8 +6,21 @@ export declare const StyledTag: import("styled-components").StyledComponent<impo
|
|
|
6
6
|
export declare const StyledTextInput: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("../../../Input/Input").InputProps, "type" | "onChange"> & {
|
|
7
7
|
canClear?: boolean;
|
|
8
8
|
onChange?: (value: string) => void;
|
|
9
|
+
height?: string;
|
|
10
|
+
border?: string;
|
|
11
|
+
borderRadius?: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
isPlaceholderFloating?: boolean;
|
|
14
|
+
floatingFontSize?: string;
|
|
9
15
|
} & import("react").RefAttributes<HTMLInputElement>>, any, {}, never>;
|
|
10
16
|
export declare const StyledSelectTypography: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("../../../Typography").TypographyProps) => JSX.Element, any, {}, never>;
|
|
11
17
|
export declare const WithPrefixContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
18
|
export declare const StyledPrefixContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
19
|
export declare const StyledIcon: import("styled-components").StyledComponent<({ name, ...props }: import("../../../Icon").IconProps) => JSX.Element, any, {}, never>;
|
|
20
|
+
export declare const SuffixContainer: import("styled-components").StyledComponent<"div", any, {
|
|
21
|
+
height?: string;
|
|
22
|
+
} & {
|
|
23
|
+
height?: string;
|
|
24
|
+
} & {
|
|
25
|
+
height?: string;
|
|
26
|
+
}, never>;
|
|
@@ -8,10 +8,20 @@ import { TextInput } from '../../../TextInput';
|
|
|
8
8
|
import { Tag } from '../../../Tag';
|
|
9
9
|
import { Typography } from '../../../Typography';
|
|
10
10
|
import { Icon } from '../../../Icon';
|
|
11
|
+
import { StyledSuffixContainer } from '../../../Input/InputStyle';
|
|
11
12
|
export var StyledSelect = styled.button.withConfig({
|
|
12
13
|
displayName: "ActivatorStyle__StyledSelect",
|
|
13
14
|
componentId: "sc-rui73p-0"
|
|
14
|
-
})(["display:flex;align-items:center;justify-content:space-between;height:
|
|
15
|
+
})(["position:relative;display:flex;align-items:center;justify-content:space-between;height:", ";cursor:pointer;padding:0px 8px 0px 12px;border:", ";box-shadow:0px 1px 0px rgba(0,0,0,0.05);border-radius:", ";background:", ";width:", ";color:", ";font-family:", ",sans-serif;font-weight:400;font-size:16px;line-height:150%;letter-spacing:0px;@media (max-width:", "){font-size:14px;}&:focus{outline:none;box-shadow:0px 0px 0px 1px #ffffff,0px 0px 0px 3px #6cc9ec;}&:disabled{background:", ";pointer-events:none;cursor:default;border:1px solid ", ";}&[data-error='true']{border:1px solid ", ";border-radius:", ";}"], function (props) {
|
|
16
|
+
var _props$height;
|
|
17
|
+
return (_props$height = props.height) != null ? _props$height : '36px';
|
|
18
|
+
}, function (_ref) {
|
|
19
|
+
var border = _ref.border;
|
|
20
|
+
return border != null ? border : "1px solid " + Neutral.B68;
|
|
21
|
+
}, function (_ref2) {
|
|
22
|
+
var borderRadius = _ref2.borderRadius;
|
|
23
|
+
return borderRadius != null ? borderRadius : borderRadius4;
|
|
24
|
+
}, Neutral.B100, function (props) {
|
|
15
25
|
return props.width;
|
|
16
26
|
}, Neutral.B18, NotoSans, Breakpoints.large, Neutral.B95, Neutral.B85, Red.B93, borderRadius4);
|
|
17
27
|
export var TagsContainer = styled.div.withConfig({
|
|
@@ -43,4 +53,8 @@ export var StyledPrefixContainer = styled.div.withConfig({
|
|
|
43
53
|
export var StyledIcon = styled(Icon).withConfig({
|
|
44
54
|
displayName: "ActivatorStyle__StyledIcon",
|
|
45
55
|
componentId: "sc-rui73p-7"
|
|
46
|
-
})(["margin-left:auto;"]);
|
|
56
|
+
})(["margin-left:auto;"]);
|
|
57
|
+
export var SuffixContainer = styled(StyledSuffixContainer).withConfig({
|
|
58
|
+
displayName: "ActivatorStyle__SuffixContainer",
|
|
59
|
+
componentId: "sc-rui73p-8"
|
|
60
|
+
})(["z-index:2;"]);
|
|
@@ -12,11 +12,16 @@ export interface ActivatorTextInputProps extends Omit<TextInputProps, 'onChange'
|
|
|
12
12
|
}): void;
|
|
13
13
|
selectedValues?: string[];
|
|
14
14
|
width?: string;
|
|
15
|
+
height?: string;
|
|
15
16
|
inputValue?: string;
|
|
16
17
|
updateInputValue?: (newValue: string) => void;
|
|
17
18
|
searchableSelectState?: SearchableSelectState;
|
|
18
19
|
updateSearchableSelectState?: (newState: SearchableSelectState) => void;
|
|
19
20
|
options?: Option[];
|
|
20
21
|
updateMenuOptions?: (newState: Option[]) => void;
|
|
22
|
+
border?: string;
|
|
23
|
+
borderRadius?: string;
|
|
24
|
+
isPlaceholderFloating?: boolean;
|
|
25
|
+
required?: boolean;
|
|
21
26
|
}
|
|
22
|
-
export declare const ActivatorTextInput: ({ allowMultiple, disabled, hasError, onChange, onBlur, onFocus, onSelect, prefix, selectedValues, width, inputValue, updateInputValue, options, updateMenuOptions, ...props }: ActivatorTextInputProps) => JSX.Element;
|
|
27
|
+
export declare const ActivatorTextInput: ({ allowMultiple, disabled, hasError, onChange, onBlur, onFocus, onSelect, prefix, selectedValues, width, inputValue, updateInputValue, options, updateMenuOptions, border, borderRadius, isPlaceholderFloating, required, height, ...props }: ActivatorTextInputProps) => JSX.Element;
|
|
@@ -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 = ["allowMultiple", "disabled", "hasError", "onChange", "onBlur", "onFocus", "onSelect", "prefix", "selectedValues", "width", "inputValue", "updateInputValue", "options", "updateMenuOptions"];
|
|
3
|
+
var _excluded = ["allowMultiple", "disabled", "hasError", "onChange", "onBlur", "onFocus", "onSelect", "prefix", "selectedValues", "width", "inputValue", "updateInputValue", "options", "updateMenuOptions", "border", "borderRadius", "isPlaceholderFloating", "required", "height"];
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Icon } from '../../../Icon';
|
|
6
6
|
import { SearchableSelectInput } from '../SearchableSelectInput/SearchableSelectInput';
|
|
@@ -25,6 +25,11 @@ export var ActivatorTextInput = function ActivatorTextInput(_ref) {
|
|
|
25
25
|
updateInputValue = _ref.updateInputValue,
|
|
26
26
|
options = _ref.options,
|
|
27
27
|
updateMenuOptions = _ref.updateMenuOptions,
|
|
28
|
+
border = _ref.border,
|
|
29
|
+
borderRadius = _ref.borderRadius,
|
|
30
|
+
isPlaceholderFloating = _ref.isPlaceholderFloating,
|
|
31
|
+
required = _ref.required,
|
|
32
|
+
height = _ref.height,
|
|
28
33
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
34
|
var activatorRef = useRef(null);
|
|
30
35
|
var _useState = useState(false),
|
|
@@ -68,7 +73,11 @@ export var ActivatorTextInput = function ActivatorTextInput(_ref) {
|
|
|
68
73
|
onFocus: onFocus,
|
|
69
74
|
error: hasError,
|
|
70
75
|
disabled: disabled,
|
|
71
|
-
width: width
|
|
76
|
+
width: width,
|
|
77
|
+
border: border,
|
|
78
|
+
borderRadius: borderRadius,
|
|
79
|
+
isPlaceholderFloating: isPlaceholderFloating,
|
|
80
|
+
required: required
|
|
72
81
|
})) : /*#__PURE__*/React.createElement(SearchableSelectInput, _extends({}, props, {
|
|
73
82
|
ref: activatorRef,
|
|
74
83
|
prefix: prefix,
|
|
@@ -84,6 +93,11 @@ export var ActivatorTextInput = function ActivatorTextInput(_ref) {
|
|
|
84
93
|
inputValue: inputValue,
|
|
85
94
|
updateInputValue: updateInputValue,
|
|
86
95
|
options: options,
|
|
87
|
-
updateMenuOptions: updateMenuOptions
|
|
96
|
+
updateMenuOptions: updateMenuOptions,
|
|
97
|
+
border: border,
|
|
98
|
+
borderRadius: borderRadius,
|
|
99
|
+
isPlaceholderFloating: isPlaceholderFloating,
|
|
100
|
+
required: required,
|
|
101
|
+
height: height
|
|
88
102
|
})));
|
|
89
103
|
};
|
|
@@ -5,5 +5,6 @@ export interface ClearSelectedProps {
|
|
|
5
5
|
}): void;
|
|
6
6
|
handleClearIconClick?: () => void;
|
|
7
7
|
updateInputValue?(newValue: string): void;
|
|
8
|
+
height?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const ClearSelected: ({ onSelect, handleClearIconClick, updateInputValue, }: ClearSelectedProps) => JSX.Element;
|
|
10
|
+
export declare const ClearSelected: ({ onSelect, handleClearIconClick, updateInputValue, height, }: ClearSelectedProps) => JSX.Element;
|
|
@@ -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,8 +134,12 @@ 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
144
|
onClick: handleSelectedClick
|
|
133
145
|
}, /*#__PURE__*/React.createElement(StyledSelected, null, ((_options$find = options.find(function (option) {
|
|
@@ -136,13 +148,19 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
136
148
|
ref: inputRef,
|
|
137
149
|
onChange: handleInputChange,
|
|
138
150
|
disabled: disabled,
|
|
139
|
-
placeholder:
|
|
151
|
+
placeholder: isShowPlaceholder ? selectedPlaceholder : null,
|
|
140
152
|
value: inputValue,
|
|
141
153
|
onBlur: handleInputBlur,
|
|
142
|
-
onFocus: handleFocus
|
|
154
|
+
onFocus: handleFocus,
|
|
155
|
+
border: border,
|
|
156
|
+
borderRadius: borderRadius
|
|
143
157
|
}, props))), showClear && !disabled && /*#__PURE__*/React.createElement(ClearSelected, {
|
|
144
158
|
onSelect: onSelect,
|
|
145
159
|
handleClearIconClick: handleClearIconClick,
|
|
146
|
-
updateInputValue: updateInputValue
|
|
147
|
-
|
|
160
|
+
updateInputValue: updateInputValue,
|
|
161
|
+
height: height
|
|
162
|
+
}), isPlaceholderFloating && /*#__PURE__*/React.createElement(FloatingLabel, {
|
|
163
|
+
"data-testid": "textarea-label",
|
|
164
|
+
fontSize: floatingFontSize
|
|
165
|
+
}, placeholder, required && /*#__PURE__*/React.createElement(AsteriskIcon, null, "*")));
|
|
148
166
|
});
|
|
@@ -2,4 +2,10 @@ export declare const StyledContainer: import("styled-components").StyledComponen
|
|
|
2
2
|
export declare const StyledSelected: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
3
|
export declare const StyledSelectedValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
export declare const InputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export declare const ClearSelectedContainer: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
export declare const ClearSelectedContainer: import("styled-components").StyledComponent<"div", any, {
|
|
6
|
+
height?: string;
|
|
7
|
+
} & {
|
|
8
|
+
height?: string;
|
|
9
|
+
} & {
|
|
10
|
+
height?: string;
|
|
11
|
+
}, 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",
|
|
@@ -13,6 +13,11 @@ 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;
|
|
16
21
|
};
|
|
17
22
|
export declare const TextArea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> & {
|
|
18
23
|
value: string;
|
|
@@ -28,4 +33,9 @@ export declare const TextArea: React.ForwardRefExoticComponent<Omit<React.Textar
|
|
|
28
33
|
* **defaults to** `true`
|
|
29
34
|
*/
|
|
30
35
|
canExceedMaxLength: boolean;
|
|
36
|
+
border?: string;
|
|
37
|
+
borderRadius?: string;
|
|
38
|
+
required?: boolean;
|
|
39
|
+
isPlaceholderFloating?: boolean;
|
|
40
|
+
floatingFontSize?: string;
|
|
31
41
|
} & 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"];
|
|
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,12 @@ 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,
|
|
22
29
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
30
|
var _useState = useState(false),
|
|
24
31
|
isFocused = _useState[0],
|
|
@@ -43,7 +50,10 @@ var _TextArea = function _TextArea(_ref) {
|
|
|
43
50
|
"data-focus": isFocused,
|
|
44
51
|
"data-has-counter": hasMaxLengthEnforced,
|
|
45
52
|
width: width,
|
|
46
|
-
onClick: handleContainerClick
|
|
53
|
+
onClick: handleContainerClick,
|
|
54
|
+
border: border,
|
|
55
|
+
borderRadius: borderRadius,
|
|
56
|
+
isPlaceholderFloating: isPlaceholderFloating
|
|
47
57
|
}, /*#__PURE__*/React.createElement(StyledTextArea, _extends({
|
|
48
58
|
ref: textAreaInputRef,
|
|
49
59
|
value: value,
|
|
@@ -57,14 +67,20 @@ var _TextArea = function _TextArea(_ref) {
|
|
|
57
67
|
},
|
|
58
68
|
onBlur: function onBlur() {
|
|
59
69
|
return setIsFocused(false);
|
|
60
|
-
}
|
|
70
|
+
},
|
|
71
|
+
border: border,
|
|
72
|
+
borderRadius: borderRadius,
|
|
73
|
+
placeholder: isPlaceholderFloating ? undefined : placeholder
|
|
61
74
|
}, props)), hasMaxLengthEnforced && /*#__PURE__*/React.createElement(StyledWordCountContainer, {
|
|
62
75
|
"data-disabled": disabled,
|
|
63
76
|
"data-error": hasError
|
|
64
77
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
65
78
|
as: "span",
|
|
66
79
|
variant: "overline"
|
|
67
|
-
}, charCount, " / ", maxLength))
|
|
80
|
+
}, charCount, " / ", maxLength)), isPlaceholderFloating && /*#__PURE__*/React.createElement(FloatingLabel, {
|
|
81
|
+
"data-testid": "textarea-label",
|
|
82
|
+
fontSize: floatingFontSize
|
|
83
|
+
}, placeholder, required && /*#__PURE__*/React.createElement(AsteriskIcon, null, "*")));
|
|
68
84
|
};
|
|
69
85
|
var forwardRef = function forwardRef(props, ref) {
|
|
70
86
|
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,20 @@ 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;
|
|
6
12
|
};
|
|
7
13
|
export declare const TextInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange"> & {
|
|
8
14
|
canClear?: boolean;
|
|
9
15
|
onChange?: (value: string) => void;
|
|
16
|
+
height?: string;
|
|
17
|
+
border?: string;
|
|
18
|
+
borderRadius?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
isPlaceholderFloating?: boolean;
|
|
21
|
+
floatingFontSize?: string;
|
|
10
22
|
} & 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"];
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
import { Input } from '../Input/Input';
|
|
@@ -10,6 +10,12 @@ 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,
|
|
13
19
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
14
20
|
var ClearIcon = function ClearIcon() {
|
|
15
21
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -44,6 +50,12 @@ export var TextInput = /*#__PURE__*/React.forwardRef(function TextInput(_ref, re
|
|
|
44
50
|
suffix: suffixValue,
|
|
45
51
|
value: value,
|
|
46
52
|
onChange: handleChange,
|
|
47
|
-
error: error
|
|
53
|
+
error: error,
|
|
54
|
+
border: border,
|
|
55
|
+
borderRadius: borderRadius,
|
|
56
|
+
floatingFontSize: floatingFontSize,
|
|
57
|
+
isPlaceholderFloating: isPlaceholderFloating,
|
|
58
|
+
required: required,
|
|
59
|
+
height: height
|
|
48
60
|
}, props));
|
|
49
61
|
});
|
|
@@ -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
|