@sproutsocial/racine 11.3.0-beta.3 → 11.3.1-beta-deps.2
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 +0 -6
- package/__flow__/Button/index.js +2 -0
- package/__flow__/Button/index.stories.js +51 -67
- package/__flow__/Button/styles.js +1 -1
- package/__flow__/EmptyState/index.test.js +1 -1
- package/__flow__/Input/index.js +66 -141
- package/__flow__/Input/index.stories.js +0 -65
- package/__flow__/Input/index.test.js +1 -227
- package/__flow__/Input/styles.js +1 -1
- package/__flow__/Link/index.js +1 -2
- package/__flow__/Menu/__snapshots__/index.test.js.snap +2 -2
- package/__flow__/setupTests.js +1 -1
- package/__flow__/systemProps/tests/__snapshots__/layout.test.js.snap +0 -14
- package/__flow__/systemProps/tests/layout.test.js +0 -9
- package/commonjs/Button/index.js +1 -0
- package/commonjs/Button/styles.js +1 -0
- package/commonjs/DatePicker/styles.js +5 -1
- package/commonjs/Input/index.js +32 -102
- package/commonjs/Input/styles.js +1 -1
- package/commonjs/Menu/index.js +10 -10
- package/commonjs/Modal/styles.js +5 -1
- package/commonjs/Toast/index.js +14 -14
- package/commonjs/Toast/styles.js +5 -2
- package/lib/Button/index.js +1 -0
- package/lib/Button/styles.js +1 -0
- package/lib/DatePicker/styles.js +5 -1
- package/lib/Input/index.js +31 -95
- package/lib/Input/styles.js +1 -1
- package/lib/Menu/index.js +11 -10
- package/lib/Modal/styles.js +5 -1
- package/lib/Toast/index.js +14 -14
- package/lib/Toast/styles.js +5 -1
- package/package.json +25 -21
- package/__flow__/Button/__snapshots__/index.test.js.snap +0 -511
- package/__flow__/Button/index.test.js +0 -113
package/CHANGELOG.md
CHANGED
package/__flow__/Button/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { boolean, text, number } from "@storybook/addon-knobs";
|
|
3
2
|
import Button from "./index";
|
|
4
3
|
import Icon from "../Icon";
|
|
5
4
|
import Box from "../Box";
|
|
@@ -8,155 +7,140 @@ export default {
|
|
|
8
7
|
title: "Button",
|
|
9
8
|
};
|
|
10
9
|
|
|
11
|
-
export const defaultStory = () => (
|
|
12
|
-
<Button
|
|
13
|
-
appearance={text("appearance", "default")}
|
|
14
|
-
onClick={() => alert("Testing...")}
|
|
15
|
-
>
|
|
10
|
+
export const defaultStory = (args) => (
|
|
11
|
+
<Button {...args} onClick={() => alert("Testing...")}>
|
|
16
12
|
Default
|
|
17
13
|
</Button>
|
|
18
14
|
);
|
|
19
15
|
|
|
16
|
+
defaultStory.args = { appearance: "default" };
|
|
17
|
+
|
|
20
18
|
defaultStory.story = {
|
|
21
19
|
name: "Default",
|
|
22
20
|
};
|
|
23
21
|
|
|
24
|
-
export const primary = () => (
|
|
25
|
-
<Button
|
|
26
|
-
appearance={text("appearance", "primary")}
|
|
27
|
-
onClick={() => alert("Testing...")}
|
|
28
|
-
>
|
|
22
|
+
export const primary = (args) => (
|
|
23
|
+
<Button {...args} onClick={() => alert("Testing...")}>
|
|
29
24
|
Primary Button
|
|
30
25
|
</Button>
|
|
31
26
|
);
|
|
32
27
|
|
|
28
|
+
primary.args = { appearance: "primary" };
|
|
29
|
+
|
|
33
30
|
primary.story = {
|
|
34
31
|
name: "Primary",
|
|
35
32
|
};
|
|
36
33
|
|
|
37
|
-
export const secondary = () =>
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
export const secondary = (args) => <Button {...args}>Secondary Button</Button>;
|
|
35
|
+
|
|
36
|
+
secondary.args = { appearance: "secondary" };
|
|
40
37
|
|
|
41
38
|
secondary.story = {
|
|
42
39
|
name: "Secondary",
|
|
43
40
|
};
|
|
44
41
|
|
|
45
|
-
export const destructive = () => (
|
|
46
|
-
<Button
|
|
47
|
-
Destructive Button
|
|
48
|
-
</Button>
|
|
42
|
+
export const destructive = (args) => (
|
|
43
|
+
<Button {...args}>Destructive Button</Button>
|
|
49
44
|
);
|
|
50
45
|
|
|
46
|
+
destructive.args = { appearance: "destructive" };
|
|
51
47
|
destructive.story = {
|
|
52
48
|
name: "Destructive",
|
|
53
49
|
};
|
|
54
50
|
|
|
55
|
-
export const placeholder = () => (
|
|
56
|
-
<Button
|
|
57
|
-
Placeholder Button
|
|
58
|
-
</Button>
|
|
51
|
+
export const placeholder = (args) => (
|
|
52
|
+
<Button {...args}>Placeholder Button</Button>
|
|
59
53
|
);
|
|
60
54
|
|
|
55
|
+
placeholder.args = { appearance: "placeholder" };
|
|
61
56
|
placeholder.story = {
|
|
62
57
|
name: "Placeholder",
|
|
63
58
|
};
|
|
64
59
|
|
|
65
|
-
export const largeButton = () =>
|
|
66
|
-
|
|
67
|
-
appearance={text("appearance", "primary")}
|
|
68
|
-
size={text("size", "large")}
|
|
69
|
-
>
|
|
70
|
-
Large Button
|
|
71
|
-
</Button>
|
|
72
|
-
);
|
|
60
|
+
export const largeButton = (args) => <Button {...args}>Large Button</Button>;
|
|
61
|
+
largeButton.args = { size: "large", appearance: "primary" };
|
|
73
62
|
|
|
74
63
|
largeButton.story = {
|
|
75
64
|
name: "Large button",
|
|
76
65
|
};
|
|
77
66
|
|
|
78
|
-
export const pillButton = () => (
|
|
67
|
+
export const pillButton = (args) => (
|
|
79
68
|
<Box bg="container.background.base" p={400}>
|
|
80
|
-
<Button
|
|
69
|
+
<Button {...args}>
|
|
81
70
|
<Icon name="reply" mr={350} />
|
|
82
71
|
Pill Button
|
|
83
72
|
</Button>
|
|
84
73
|
</Box>
|
|
85
74
|
);
|
|
86
|
-
|
|
75
|
+
pillButton.args = { appearance: "pill" };
|
|
87
76
|
pillButton.story = {
|
|
88
77
|
name: "Pill button",
|
|
89
78
|
};
|
|
90
79
|
|
|
91
|
-
export const pillIconOnlyButton = () => (
|
|
80
|
+
export const pillIconOnlyButton = (args) => (
|
|
92
81
|
<Box bg="container.background.base" p={400}>
|
|
93
|
-
<Button
|
|
82
|
+
<Button {...args} ariaLabel="This is a label">
|
|
94
83
|
<Icon name="circle-check-outline" />
|
|
95
84
|
</Button>
|
|
96
85
|
</Box>
|
|
97
86
|
);
|
|
98
87
|
|
|
88
|
+
pillIconOnlyButton.args = { appearance: "pill" };
|
|
99
89
|
pillIconOnlyButton.story = {
|
|
100
90
|
name: "Pill icon only button",
|
|
101
91
|
};
|
|
102
92
|
|
|
103
|
-
export const activeButton = () =>
|
|
104
|
-
<Button
|
|
105
|
-
appearance={text("appearance", "secondary")}
|
|
106
|
-
active={boolean("active", true)}
|
|
107
|
-
>
|
|
108
|
-
Active Button
|
|
109
|
-
</Button>
|
|
110
|
-
);
|
|
93
|
+
export const activeButton = (args) => <Button {...args}>Active Button</Button>;
|
|
111
94
|
|
|
95
|
+
activeButton.args = { appearance: "secondary", active: true };
|
|
112
96
|
activeButton.story = {
|
|
113
97
|
name: "Active button",
|
|
114
98
|
};
|
|
115
99
|
|
|
116
|
-
export const buttonAsALink = () => (
|
|
117
|
-
<Button
|
|
118
|
-
href={text("href", "http://sproutsocial.style")}
|
|
119
|
-
external={boolean("external", true)}
|
|
120
|
-
appearance={text("appearance", "primary")}
|
|
121
|
-
>
|
|
122
|
-
Button using anchor element
|
|
123
|
-
</Button>
|
|
100
|
+
export const buttonAsALink = (args) => (
|
|
101
|
+
<Button {...args}>Button using anchor element</Button>
|
|
124
102
|
);
|
|
125
|
-
|
|
103
|
+
buttonAsALink.args = {
|
|
104
|
+
appearance: "primary",
|
|
105
|
+
external: true,
|
|
106
|
+
href: "http://sproutsocial.style",
|
|
107
|
+
};
|
|
126
108
|
buttonAsALink.story = {
|
|
127
109
|
name: "Button as a link",
|
|
128
110
|
};
|
|
129
111
|
|
|
130
|
-
export const disabledButton = () => (
|
|
131
|
-
<Button
|
|
132
|
-
appearance={text("appearance", "primary")}
|
|
133
|
-
disabled={text("disabled", "true")}
|
|
134
|
-
>
|
|
135
|
-
This Button is disabled
|
|
136
|
-
</Button>
|
|
112
|
+
export const disabledButton = (args) => (
|
|
113
|
+
<Button {...args}>This Button is disabled</Button>
|
|
137
114
|
);
|
|
138
|
-
|
|
115
|
+
disabledButton.args = {
|
|
116
|
+
appearance: "primary",
|
|
117
|
+
disabled: true,
|
|
118
|
+
};
|
|
139
119
|
disabledButton.story = {
|
|
140
120
|
name: "Disabled button",
|
|
141
121
|
};
|
|
142
122
|
|
|
143
|
-
export const fullWidthButton = () => (
|
|
144
|
-
<Button
|
|
145
|
-
Full-Width Button
|
|
146
|
-
</Button>
|
|
123
|
+
export const fullWidthButton = (args) => (
|
|
124
|
+
<Button {...args}>Full-Width Button</Button>
|
|
147
125
|
);
|
|
148
|
-
|
|
126
|
+
fullWidthButton.args = {
|
|
127
|
+
appearance: "primary",
|
|
128
|
+
width: 1,
|
|
129
|
+
};
|
|
149
130
|
fullWidthButton.story = {
|
|
150
131
|
name: "Full width button",
|
|
151
132
|
};
|
|
152
133
|
|
|
153
|
-
export const withIcon = () => (
|
|
154
|
-
<Button
|
|
134
|
+
export const withIcon = (args) => (
|
|
135
|
+
<Button {...args}>
|
|
155
136
|
<Icon name="twitter" mr={350} />
|
|
156
137
|
Secondary Button
|
|
157
138
|
</Button>
|
|
158
139
|
);
|
|
159
140
|
|
|
141
|
+
withIcon.args = {
|
|
142
|
+
appearance: "secondary",
|
|
143
|
+
};
|
|
160
144
|
withIcon.story = {
|
|
161
145
|
name: "With icon",
|
|
162
146
|
};
|
package/__flow__/Input/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import Container, { Accessory } from "./styles";
|
|
4
|
-
import Button from "../Button";
|
|
5
|
-
import Icon from "../Icon";
|
|
6
4
|
|
|
7
5
|
type TypeProps = {
|
|
8
6
|
/** ID of the form element, should match the "for" value of the associated label */
|
|
@@ -12,8 +10,6 @@ type TypeProps = {
|
|
|
12
10
|
ariaLabel?: string,
|
|
13
11
|
/** Attribute used to associate other elements that describe the Input, like an error */
|
|
14
12
|
ariaDescribedby?: string,
|
|
15
|
-
/** Label for Input.ClearButton. Required when using <Input type="search"/> or <Input.ClearButton/>. */
|
|
16
|
-
clearButtonLabel?: string,
|
|
17
13
|
/** Placeholder text for when value is undefined or empty */
|
|
18
14
|
placeholder?: string,
|
|
19
15
|
/** Current value of the input */
|
|
@@ -46,8 +42,6 @@ type TypeProps = {
|
|
|
46
42
|
innerRef?: React.Ref<"input">,
|
|
47
43
|
onBlur?: (e: SyntheticFocusEvent<HTMLInputElement>) => void,
|
|
48
44
|
onChange?: (e: SyntheticInputEvent<HTMLInputElement>, value: string) => void,
|
|
49
|
-
/** Called on Input.ClearButton trigger. */
|
|
50
|
-
onClear?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
51
45
|
onFocus?: (e: SyntheticFocusEvent<HTMLInputElement>) => void,
|
|
52
46
|
onKeyDown?: (
|
|
53
47
|
e: SyntheticKeyboardEvent<HTMLInputElement>,
|
|
@@ -60,61 +54,14 @@ type TypeProps = {
|
|
|
60
54
|
onPaste?: (e: SyntheticInputEvent<HTMLInputElement>, value: string) => void,
|
|
61
55
|
size?: "large" | "small" | "default",
|
|
62
56
|
qa?: Object,
|
|
63
|
-
/**
|
|
64
|
-
Controls the styles of the input. Primary is our standard input styles and secondary is a borderless input.
|
|
57
|
+
/**
|
|
58
|
+
Controls the styles of the input. Primary is our standard input styles and secondary is a borderless input.
|
|
65
59
|
Note that this prop should only be used to alter styles and not functionality.
|
|
66
60
|
*/
|
|
67
61
|
appearance?: "primary" | "secondary",
|
|
68
62
|
};
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
// regardless of whether it is manually included as elemAfter or automatically included for type="search" Inputs.
|
|
72
|
-
type TypeInputContext = $Shape<{
|
|
73
|
-
handleClear: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
74
|
-
clearButtonLabel: string,
|
|
75
|
-
hasValue: boolean,
|
|
76
|
-
}>;
|
|
77
|
-
|
|
78
|
-
const InputContext = React.createContext<TypeInputContext>({});
|
|
79
|
-
|
|
80
|
-
const ClearButton = () => {
|
|
81
|
-
const { handleClear, clearButtonLabel, hasValue, size } =
|
|
82
|
-
React.useContext(InputContext);
|
|
83
|
-
|
|
84
|
-
// Hide the button when there is no text to clear.
|
|
85
|
-
if (!hasValue) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Cut down the padding for size small Inputs so that the focus ring won't go outside the bounds of the Input.
|
|
90
|
-
// This adjustment is handled automatically for default and large Inputs via Button's size. There is no "small" Button.
|
|
91
|
-
const py = size === "small" ? 100 : undefined;
|
|
92
|
-
const px = size === "small" ? 200 : undefined;
|
|
93
|
-
const buttonSize = size === "small" ? "default" : size;
|
|
94
|
-
|
|
95
|
-
// Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
|
|
96
|
-
if (!clearButtonLabel) {
|
|
97
|
-
console.warn(
|
|
98
|
-
"Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized label to Input."
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
return (
|
|
102
|
-
<Button onClick={handleClear} size={buttonSize} py={py} px={px}>
|
|
103
|
-
<Icon name="circlex" title={clearButtonLabel || "Clear"} />
|
|
104
|
-
</Button>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// Used for positioning elementAfter. This logic will detect if the element is a ClearButton,
|
|
109
|
-
// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.
|
|
110
|
-
const isClearButton = (elem: any) => {
|
|
111
|
-
if (elem?.type) {
|
|
112
|
-
return elem.type.displayName === "Input.ClearButton";
|
|
113
|
-
}
|
|
114
|
-
return false;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
class Input extends React.Component<TypeProps> {
|
|
64
|
+
export default class Input extends React.Component<TypeProps> {
|
|
118
65
|
static defaultProps = {
|
|
119
66
|
autoFocus: false,
|
|
120
67
|
disabled: false,
|
|
@@ -123,30 +70,41 @@ class Input extends React.Component<TypeProps> {
|
|
|
123
70
|
appearance: "primary",
|
|
124
71
|
};
|
|
125
72
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
handleClear = (e: SyntheticEvent<HTMLButtonElement>) => {
|
|
132
|
-
this.props.onClear?.(e);
|
|
133
|
-
this.props.innerRef?.current?.focus();
|
|
73
|
+
handleBlur = (e: SyntheticFocusEvent<HTMLInputElement>) => {
|
|
74
|
+
if (this.props.onBlur) {
|
|
75
|
+
this.props.onBlur(e);
|
|
76
|
+
}
|
|
134
77
|
};
|
|
135
78
|
|
|
136
|
-
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
137
|
-
this.props.onChange
|
|
79
|
+
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) => {
|
|
80
|
+
if (this.props.onChange) {
|
|
81
|
+
this.props.onChange(e, e.currentTarget.value);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
138
84
|
|
|
139
|
-
handleFocus = (e: SyntheticFocusEvent<HTMLInputElement>) =>
|
|
140
|
-
this.props.onFocus
|
|
85
|
+
handleFocus = (e: SyntheticFocusEvent<HTMLInputElement>) => {
|
|
86
|
+
if (this.props.onFocus) {
|
|
87
|
+
this.props.onFocus(e);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
141
90
|
|
|
142
|
-
handleKeyDown = (e: SyntheticKeyboardEvent<HTMLInputElement>) =>
|
|
143
|
-
this.props.onKeyDown
|
|
91
|
+
handleKeyDown = (e: SyntheticKeyboardEvent<HTMLInputElement>) => {
|
|
92
|
+
if (this.props.onKeyDown) {
|
|
93
|
+
this.props.onKeyDown(e, e.currentTarget.value);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
144
96
|
|
|
145
|
-
handleKeyUp = (e: SyntheticKeyboardEvent<HTMLInputElement>) =>
|
|
146
|
-
this.props.onKeyUp
|
|
97
|
+
handleKeyUp = (e: SyntheticKeyboardEvent<HTMLInputElement>) => {
|
|
98
|
+
if (this.props.onKeyUp) {
|
|
99
|
+
this.props.onKeyUp(e, e.currentTarget.value);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
147
102
|
|
|
148
|
-
handlePaste = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
149
|
-
this.props.onPaste
|
|
103
|
+
handlePaste = (e: SyntheticInputEvent<HTMLInputElement>) => {
|
|
104
|
+
if (this.props.onPaste) {
|
|
105
|
+
this.props.onPaste(e, e.currentTarget.value);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
150
108
|
|
|
151
109
|
render() {
|
|
152
110
|
const {
|
|
@@ -167,11 +125,9 @@ class Input extends React.Component<TypeProps> {
|
|
|
167
125
|
maxLength,
|
|
168
126
|
ariaLabel,
|
|
169
127
|
ariaDescribedby,
|
|
170
|
-
clearButtonLabel,
|
|
171
128
|
innerRef,
|
|
172
129
|
onBlur,
|
|
173
130
|
onChange,
|
|
174
|
-
onClear,
|
|
175
131
|
onFocus,
|
|
176
132
|
onKeyDown,
|
|
177
133
|
onKeyUp,
|
|
@@ -179,89 +135,58 @@ class Input extends React.Component<TypeProps> {
|
|
|
179
135
|
inputProps = {},
|
|
180
136
|
qa = {},
|
|
181
137
|
appearance,
|
|
182
|
-
size,
|
|
183
138
|
...rest
|
|
184
139
|
} = this.props;
|
|
185
140
|
|
|
186
|
-
// Convert autoComplete from a boolean prop to a string value.
|
|
187
141
|
let autoCompleteValue = undefined;
|
|
188
142
|
if (autoComplete !== undefined) {
|
|
189
143
|
autoCompleteValue = autoComplete ? "on" : "off";
|
|
190
144
|
}
|
|
191
145
|
|
|
192
|
-
// Add default elemBefore and elemAfter elements if type is search.
|
|
193
|
-
const elementBefore =
|
|
194
|
-
type === "search" && !elemBefore ? (
|
|
195
|
-
<Icon name="search" ariaHidden color="icon.base" />
|
|
196
|
-
) : (
|
|
197
|
-
elemBefore
|
|
198
|
-
);
|
|
199
|
-
// Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
|
|
200
|
-
const elementAfter =
|
|
201
|
-
type === "search" && onClear && !elemAfter ? <ClearButton /> : elemAfter;
|
|
202
|
-
|
|
203
146
|
return (
|
|
204
147
|
<Container
|
|
205
|
-
hasBeforeElement={!!
|
|
206
|
-
hasAfterElement={!!
|
|
148
|
+
hasBeforeElement={!!elemBefore}
|
|
149
|
+
hasAfterElement={!!elemAfter}
|
|
207
150
|
disabled={disabled}
|
|
208
151
|
invalid={!!isInvalid}
|
|
209
152
|
warning={hasWarning}
|
|
210
153
|
appearance={appearance}
|
|
211
|
-
size={size}
|
|
212
154
|
// $FlowIssue - upgrade v0.112.0
|
|
213
155
|
{...rest}
|
|
214
156
|
>
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
{
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
data-qa-input={name || ""}
|
|
248
|
-
data-qa-input-isdisabled={disabled === true}
|
|
249
|
-
data-qa-input-isrequired={required === true}
|
|
250
|
-
{...qa}
|
|
251
|
-
{...inputProps}
|
|
252
|
-
/>
|
|
253
|
-
|
|
254
|
-
{elementAfter && (
|
|
255
|
-
<Accessory after isClearButton={isClearButton(elementAfter)}>
|
|
256
|
-
{elementAfter}
|
|
257
|
-
</Accessory>
|
|
258
|
-
)}
|
|
259
|
-
</InputContext.Provider>
|
|
157
|
+
{elemBefore && <Accessory before>{elemBefore}</Accessory>}
|
|
158
|
+
|
|
159
|
+
<input
|
|
160
|
+
aria-invalid={!!isInvalid}
|
|
161
|
+
aria-label={ariaLabel}
|
|
162
|
+
aria-describedby={ariaDescribedby}
|
|
163
|
+
autoComplete={autoCompleteValue}
|
|
164
|
+
autoFocus={autoFocus}
|
|
165
|
+
disabled={disabled}
|
|
166
|
+
readOnly={readOnly}
|
|
167
|
+
id={id}
|
|
168
|
+
name={name}
|
|
169
|
+
placeholder={placeholder}
|
|
170
|
+
type={type}
|
|
171
|
+
required={required}
|
|
172
|
+
value={value}
|
|
173
|
+
maxLength={maxLength}
|
|
174
|
+
onBlur={this.handleBlur}
|
|
175
|
+
onChange={this.handleChange}
|
|
176
|
+
onFocus={this.handleFocus}
|
|
177
|
+
onKeyDown={this.handleKeyDown}
|
|
178
|
+
onKeyUp={this.handleKeyUp}
|
|
179
|
+
onPaste={this.handlePaste}
|
|
180
|
+
ref={innerRef}
|
|
181
|
+
data-qa-input={name || ""}
|
|
182
|
+
data-qa-input-isdisabled={disabled === true}
|
|
183
|
+
data-qa-input-isrequired={required === true}
|
|
184
|
+
{...qa}
|
|
185
|
+
{...inputProps}
|
|
186
|
+
/>
|
|
187
|
+
|
|
188
|
+
{elemAfter && <Accessory after>{elemAfter}</Accessory>}
|
|
260
189
|
</Container>
|
|
261
190
|
);
|
|
262
191
|
}
|
|
263
192
|
}
|
|
264
|
-
|
|
265
|
-
Input.ClearButton.displayName = "Input.ClearButton";
|
|
266
|
-
|
|
267
|
-
export default Input;
|
|
@@ -141,71 +141,6 @@ leftAndRightIcons.story = {
|
|
|
141
141
|
name: "Left and right icons",
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
export const searchInput = () => (
|
|
145
|
-
<Input
|
|
146
|
-
type="search"
|
|
147
|
-
placeholder={text("placeholder", "Please enter a value...")}
|
|
148
|
-
value={text("value", "val")}
|
|
149
|
-
onClear={() => window.alert("Cleared!")}
|
|
150
|
-
clearButtonLabel={text("clearButtonLabel", "Clear search")}
|
|
151
|
-
ariaLabel={text("ariaLabel", "Descriptive label goes here")}
|
|
152
|
-
/>
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
searchInput.story = {
|
|
156
|
-
name: "Search Input",
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const smallSearchInput = () => (
|
|
160
|
-
<Input
|
|
161
|
-
type="search"
|
|
162
|
-
size="small"
|
|
163
|
-
placeholder={text("placeholder", "Please enter a value...")}
|
|
164
|
-
value={text("value", "val")}
|
|
165
|
-
onClear={() => window.alert("Cleared!")}
|
|
166
|
-
clearButtonLabel={text("clearButtonLabel", "Clear search")}
|
|
167
|
-
ariaLabel={text("ariaLabel", "Descriptive label goes here")}
|
|
168
|
-
/>
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
smallSearchInput.story = {
|
|
172
|
-
name: "Small Search Input",
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export const largeSearchInput = () => (
|
|
176
|
-
<Input
|
|
177
|
-
type="search"
|
|
178
|
-
size="large"
|
|
179
|
-
placeholder={text("placeholder", "Please enter a value...")}
|
|
180
|
-
value={text("value", "val")}
|
|
181
|
-
onClear={() => window.alert("Cleared!")}
|
|
182
|
-
clearButtonLabel={text("clearButtonLabel", "Clear search")}
|
|
183
|
-
ariaLabel={text("ariaLabel", "Descriptive label goes here")}
|
|
184
|
-
/>
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
largeSearchInput.story = {
|
|
188
|
-
name: "Large Search Input",
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
export const nonSearchClearButtonInput = () => {
|
|
192
|
-
return (
|
|
193
|
-
<Input
|
|
194
|
-
type="text"
|
|
195
|
-
placeholder={text("placeholder", "Please enter a value...")}
|
|
196
|
-
value={text("value", "val")}
|
|
197
|
-
onClear={() => window.alert("Cleared!")}
|
|
198
|
-
ariaLabel={text("ariaLabel", "Descriptive label goes here")}
|
|
199
|
-
clearButtonLabel={text("clearButtonLabel", "Clear text")}
|
|
200
|
-
elemAfter={<Input.ClearButton />}
|
|
201
|
-
/>
|
|
202
|
-
);
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
nonSearchClearButtonInput.story = {
|
|
206
|
-
name: "Manual Input.ClearButton usage",
|
|
207
|
-
};
|
|
208
|
-
|
|
209
144
|
export const autofocus = () => (
|
|
210
145
|
<Input
|
|
211
146
|
autoFocus
|