@sproutsocial/racine 11.3.0-beta.2 → 11.3.1-beta-deps.0
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 +1 -0
- package/__flow__/Button/index.stories.js +51 -67
- package/__flow__/EmptyState/index.test.js +1 -1
- package/__flow__/Input/index.js +67 -126
- package/__flow__/Input/index.stories.js +0 -33
- package/__flow__/Input/index.test.js +1 -199
- package/__flow__/Input/styles.js +1 -1
- package/__flow__/Link/index.js +1 -2
- package/__flow__/Menu/__snapshots__/index.test.js.snap +3 -3
- 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/DatePicker/styles.js +5 -1
- package/commonjs/Input/index.js +30 -79
- 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/DatePicker/styles.js +5 -1
- package/lib/Input/index.js +29 -72
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "jest-styled-components";
|
|
3
|
-
import { render, fireEvent
|
|
3
|
+
import { render, fireEvent } from "../utils/react-testing-library";
|
|
4
4
|
import Input from "./";
|
|
5
5
|
import Text from "../Text";
|
|
6
6
|
|
|
@@ -69,204 +69,6 @@ describe("Input", () => {
|
|
|
69
69
|
expect(getByText("After")).toBeTruthy();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
describe("Input.ClearButton", () => {
|
|
73
|
-
describe("Input type=search", () => {
|
|
74
|
-
it("should render a clear button for search Inputs", () => {
|
|
75
|
-
const { getByRole } = render(
|
|
76
|
-
<Input
|
|
77
|
-
id="name"
|
|
78
|
-
name="name"
|
|
79
|
-
value="mic"
|
|
80
|
-
type="search"
|
|
81
|
-
onClear={jest.fn()}
|
|
82
|
-
clearButtonLabel="Clear search"
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
expect(getByRole("button")).toBeTruthy();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("should not override an elemAfter prop if passed", () => {
|
|
89
|
-
const { getByText, queryByTitle } = render(
|
|
90
|
-
<Input
|
|
91
|
-
id="name"
|
|
92
|
-
name="name"
|
|
93
|
-
value="mic"
|
|
94
|
-
type="search"
|
|
95
|
-
onClear={jest.fn()}
|
|
96
|
-
elemAfter={<Text>After</Text>}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
expect(getByText("After")).toBeTruthy();
|
|
100
|
-
expect(queryByTitle("Clear")).not.toBeInTheDocument();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("should use the fallback title if clearButtonLabel is not provided", () => {
|
|
104
|
-
const { getByTitle } = render(
|
|
105
|
-
<Input
|
|
106
|
-
id="name"
|
|
107
|
-
name="name"
|
|
108
|
-
value="mic"
|
|
109
|
-
type="search"
|
|
110
|
-
onClear={jest.fn()}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
expect(getByTitle("Clear")).toBeTruthy();
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it("should call onClear when clicked", () => {
|
|
117
|
-
const mockOnClear = jest.fn();
|
|
118
|
-
const { getByRole } = render(
|
|
119
|
-
<Input
|
|
120
|
-
id="name"
|
|
121
|
-
name="name"
|
|
122
|
-
value="mic"
|
|
123
|
-
type="search"
|
|
124
|
-
onClear={mockOnClear}
|
|
125
|
-
clearButtonLabel="Clear search"
|
|
126
|
-
/>
|
|
127
|
-
);
|
|
128
|
-
fireEvent.click(getByRole("button"));
|
|
129
|
-
expect(mockOnClear).toHaveBeenCalled();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("should allow keyboard access to and Space key triggering of the clear button", () => {
|
|
133
|
-
const mockOnClear = jest.fn();
|
|
134
|
-
const { getByRole } = render(
|
|
135
|
-
<Input
|
|
136
|
-
id="name"
|
|
137
|
-
name="name"
|
|
138
|
-
value="mic"
|
|
139
|
-
type="search"
|
|
140
|
-
onClear={mockOnClear}
|
|
141
|
-
clearButtonLabel="Clear search"
|
|
142
|
-
/>
|
|
143
|
-
);
|
|
144
|
-
const input = getByRole("searchbox");
|
|
145
|
-
const button = getByRole("button");
|
|
146
|
-
userEvent.tab();
|
|
147
|
-
expect(input).toHaveFocus();
|
|
148
|
-
userEvent.tab();
|
|
149
|
-
expect(button).toHaveFocus();
|
|
150
|
-
userEvent.keyboard("{space}");
|
|
151
|
-
expect(mockOnClear).toHaveBeenCalled();
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it("should allow keyboard access to and Enter key triggering of the clear button", () => {
|
|
155
|
-
const mockOnClear = jest.fn();
|
|
156
|
-
const { getByRole } = render(
|
|
157
|
-
<Input
|
|
158
|
-
id="name"
|
|
159
|
-
name="name"
|
|
160
|
-
value="mic"
|
|
161
|
-
type="search"
|
|
162
|
-
onClear={mockOnClear}
|
|
163
|
-
clearButtonLabel="Clear search"
|
|
164
|
-
/>
|
|
165
|
-
);
|
|
166
|
-
const input = getByRole("searchbox");
|
|
167
|
-
const button = getByRole("button");
|
|
168
|
-
userEvent.tab();
|
|
169
|
-
expect(input).toHaveFocus();
|
|
170
|
-
userEvent.tab();
|
|
171
|
-
expect(button).toHaveFocus();
|
|
172
|
-
userEvent.keyboard("{enter}");
|
|
173
|
-
expect(mockOnClear).toHaveBeenCalled();
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
describe("Manual Input.ClearButton usage", () => {
|
|
178
|
-
it("should render a clear button when passed with elemAfter", () => {
|
|
179
|
-
const { getByRole } = render(
|
|
180
|
-
<Input
|
|
181
|
-
id="name"
|
|
182
|
-
name="name"
|
|
183
|
-
value="mic"
|
|
184
|
-
type="text"
|
|
185
|
-
elemAfter={<Input.ClearButton />}
|
|
186
|
-
clearButtonLabel="Clear search"
|
|
187
|
-
/>
|
|
188
|
-
);
|
|
189
|
-
expect(getByRole("button")).toBeTruthy();
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it("should use the fallback title if clearButtonLabel is not provided", () => {
|
|
193
|
-
const { getByTitle } = render(
|
|
194
|
-
<Input
|
|
195
|
-
id="name"
|
|
196
|
-
name="name"
|
|
197
|
-
value="mic"
|
|
198
|
-
type="text"
|
|
199
|
-
elemAfter={<Input.ClearButton />}
|
|
200
|
-
/>
|
|
201
|
-
);
|
|
202
|
-
expect(getByTitle("Clear")).toBeTruthy();
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it("should call onClear when Input.ClearButton is clicked", () => {
|
|
206
|
-
const mockOnClear = jest.fn();
|
|
207
|
-
const { getByRole } = render(
|
|
208
|
-
<Input
|
|
209
|
-
id="name"
|
|
210
|
-
name="name"
|
|
211
|
-
value="mic"
|
|
212
|
-
type="text"
|
|
213
|
-
elemAfter={<Input.ClearButton />}
|
|
214
|
-
onClear={mockOnClear}
|
|
215
|
-
clearButtonLabel="Clear search"
|
|
216
|
-
/>
|
|
217
|
-
);
|
|
218
|
-
fireEvent.click(getByRole("button"));
|
|
219
|
-
expect(mockOnClear).toHaveBeenCalled();
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it("should allow keyboard access to and Space key triggering of the clear button", () => {
|
|
223
|
-
const mockOnClear = jest.fn();
|
|
224
|
-
const { getByRole } = render(
|
|
225
|
-
<Input
|
|
226
|
-
id="name"
|
|
227
|
-
name="name"
|
|
228
|
-
value="mic"
|
|
229
|
-
type="text"
|
|
230
|
-
elemAfter={<Input.ClearButton />}
|
|
231
|
-
onClear={mockOnClear}
|
|
232
|
-
clearButtonLabel="Clear search"
|
|
233
|
-
/>
|
|
234
|
-
);
|
|
235
|
-
const input = getByRole("textbox");
|
|
236
|
-
const button = getByRole("button");
|
|
237
|
-
userEvent.tab();
|
|
238
|
-
expect(input).toHaveFocus();
|
|
239
|
-
userEvent.tab();
|
|
240
|
-
expect(button).toHaveFocus();
|
|
241
|
-
userEvent.keyboard("{space}");
|
|
242
|
-
expect(mockOnClear).toHaveBeenCalled();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it("should allow keyboard access to and Enter key triggering of the clear button", () => {
|
|
246
|
-
const mockOnClear = jest.fn();
|
|
247
|
-
const { getByRole } = render(
|
|
248
|
-
<Input
|
|
249
|
-
id="name"
|
|
250
|
-
name="name"
|
|
251
|
-
value="mic"
|
|
252
|
-
type="text"
|
|
253
|
-
elemAfter={<Input.ClearButton />}
|
|
254
|
-
onClear={mockOnClear}
|
|
255
|
-
clearButtonLabel="Clear search"
|
|
256
|
-
/>
|
|
257
|
-
);
|
|
258
|
-
const input = getByRole("textbox");
|
|
259
|
-
const button = getByRole("button");
|
|
260
|
-
userEvent.tab();
|
|
261
|
-
expect(input).toHaveFocus();
|
|
262
|
-
userEvent.tab();
|
|
263
|
-
expect(button).toHaveFocus();
|
|
264
|
-
userEvent.keyboard("{enter}");
|
|
265
|
-
expect(mockOnClear).toHaveBeenCalled();
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
|
|
270
72
|
describe("autoComplete prop", () => {
|
|
271
73
|
it("should not have autoComplete attribute when passed prop is not passed", () => {
|
|
272
74
|
const { getByDataQaLabel } = render(<Input id="name" name="name" />);
|
package/__flow__/Input/styles.js
CHANGED
package/__flow__/Link/index.js
CHANGED
|
@@ -8,11 +8,10 @@ type TypeProps = {
|
|
|
8
8
|
/** Optional prop to make the URL open in a new tab */
|
|
9
9
|
external?: boolean,
|
|
10
10
|
children: React.Node,
|
|
11
|
-
/** Setting this prop will cause the component to be rendered as a link */
|
|
12
11
|
href?: string,
|
|
13
12
|
/** Disables user action and applies a disabled style to the component */
|
|
14
13
|
disabled?: boolean,
|
|
15
|
-
/**
|
|
14
|
+
/** Setting this prop will cause the component to be rendered as a button instead of an anchor) */
|
|
16
15
|
onClick?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
17
16
|
as?: $PropertyType<TypeStyledComponentsCommonProps, "as">,
|
|
18
17
|
underline?: boolean,
|
|
@@ -14,12 +14,12 @@ exports[`Menu AsMenuButton should match snapshot 1`] = `
|
|
|
14
14
|
fill: currentColor;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
_:-ms-fullscreen .
|
|
17
|
+
_:-ms-fullscreen .c2,
|
|
18
18
|
html .c3 {
|
|
19
19
|
width: 16px;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.pdf-page .
|
|
22
|
+
.pdf-page .c2 {
|
|
23
23
|
width: 16px;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -96,7 +96,7 @@ html .c3 {
|
|
|
96
96
|
aria-expanded="false"
|
|
97
97
|
aria-haspopup="true"
|
|
98
98
|
aria-label="Open Menu"
|
|
99
|
-
class="c1"
|
|
99
|
+
class="c1 container"
|
|
100
100
|
data-qa-button=""
|
|
101
101
|
data-qa-button-isdisabled="false"
|
|
102
102
|
id="MenuButton-7"
|
package/__flow__/setupTests.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`layout system props display 1`] = `
|
|
4
|
-
.c0 {
|
|
5
|
-
display: -webkit-string;
|
|
6
|
-
display: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
<div>
|
|
10
|
-
<div
|
|
11
|
-
class="c0"
|
|
12
|
-
display="string"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
3
|
exports[`layout system props height 1`] = `
|
|
18
4
|
.c0 {
|
|
19
5
|
height: string;
|
|
@@ -10,15 +10,6 @@ describe("layout system props", () => {
|
|
|
10
10
|
${layoutSystemProps}
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
|
-
test("display", () => {
|
|
14
|
-
const { container } = render(
|
|
15
|
-
<>
|
|
16
|
-
<Component display="string" />
|
|
17
|
-
</>
|
|
18
|
-
);
|
|
19
|
-
expect(container).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
13
|
test("height", () => {
|
|
23
14
|
const { container } = render(
|
|
24
15
|
<>
|
package/commonjs/Button/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var Button = function Button(_ref) {
|
|
|
46
46
|
|
|
47
47
|
var appearanceCheck = appearance === "default" ? "unstyled" : appearance;
|
|
48
48
|
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
49
|
+
className: "container",
|
|
49
50
|
title: title,
|
|
50
51
|
active: active,
|
|
51
52
|
href: href,
|
|
@@ -11,12 +11,16 @@ var _Box = _interopRequireDefault(require("../Box"));
|
|
|
11
11
|
|
|
12
12
|
var _mixins = require("../utils/mixins");
|
|
13
13
|
|
|
14
|
+
var _templateObject;
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
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); }
|
|
17
19
|
|
|
18
20
|
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; }
|
|
19
21
|
|
|
22
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
23
|
+
|
|
20
24
|
/*
|
|
21
25
|
* Partial list of modifiers given to renderDayContents by airbnb/react-dates. There may be more.
|
|
22
26
|
*
|
|
@@ -83,7 +87,7 @@ var CalendarDay = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
|
83
87
|
}
|
|
84
88
|
});
|
|
85
89
|
exports.CalendarDay = CalendarDay;
|
|
86
|
-
var ReactDatesCssOverrides = (0, _styledComponents.createGlobalStyle)([".DayPicker{
|
|
90
|
+
var ReactDatesCssOverrides = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\t.DayPicker {\n\t\tbox-sizing: content-box;\n\t\tfont-weight: ", ";\n\t\tfont-family: ", ";\n\n\t\t/* override react-dates height to better reflect how tall the component actually is */\n\t\t/* adding margin/padding will be more truer to our seeds system because the height */\n\t\t/* of the calendar adds an extra row of padding if we do not override it */\n\t\t&_transitionContainer {\n\t\t\t/* need !important because react-dates sets height on the element itself */\n\t\t\theight: 228px !important;\n\t\t}\n\n\t\t&_weekHeader {\n\t\t\tcolor: ", ";\n\t\t\tborder-bottom: 1px solid ", ";\n\n \t\t\t/* Magic number to match position of .CalendarMonth_caption */\n\t\t\ttop: 26px;\n\n\t\t\t/* Magic number to make the bottom border line stretch the full width */\n\t\t\twidth: 230px;\n\n\t\t\t&_ul {\n \t\t\t\t/* Magic number to line up day name headings over the correct numbers */\n\t\t\t\tpadding-left: 10px;\n\t\t\t}\n\t\t}\n\n\t\t&_weekHeaders__horizontal {\n\t\t\tmargin-left: 0\n\t\t}\n\n\t\t&_weekHeader_li {\n\t\t\t", "\n\t\t\tcolor: ", ";\n\t\t\tfont-weight: ", ";\n\t\t\tmargin: 0;\n\t\t}\n\n\t\t&__horizontal {\n\t\t\tbox-shadow: none;\n\t\t\tbackground: ", ";\n\t\t}\n\t}\n\n .CalendarDay {\n\t\tbackground-color: transparent;\n\n &__selected, &__selected_span, &:hover {\n background-color: transparent;\n\t\t}\n\n\t\t&__default {\n\t\t\tcolor: ", ";\n\t\t}\n\t\t&__default,\n\t\t&__default:hover {\n\t\t\tborder: none;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n\n .CalendarMonth {\n\t\t", "\n\t\tbackground: ", ";\n\n \t\t/* spacing between visible months and months off canvas */\n\t\tpadding: 0 15px;\n\n\t\t&_caption {\n\t\t\t", "\n\t\t\tcolor: ", ";\n\t\t\tpadding-top: 0;\n\t\t\tbackground: ", ";\n\n\t\t\tstrong {\n\t\t\t\tfont-weight: ", ";\n\t\t\t}\n\n\t\t}\n\t\t&_table {\n\t\t\tline-height: 21.333px;\n\t\t\ttr {\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t\ttd {\n\t\t\t\tpadding: 0;\n\t\t\t\tborder-bottom: none;\n\t\t\t}\n\t\t}\n\t}\n\n\t.CalendarMonthGrid {\n\t\tbackground: ", ";\n\t}\n\n\t/* Left and Right Arrow Buttons to navigate months */\n\t.DayPickerNavigation_button__horizontal {\n\t\tcolor: ", ";\n\t\ttop: -4px;\n\t\tpadding: 7px 8px;\n\t\tposition: absolute;\n\t\tline-height: 0.78;\n\t\tborder-radius: 9999px;\n\t\tborder: none;\n\t\tbackground: ", ";\n\n\t\t&:nth-child(1) {\n\t\t\tleft: 22px;\n\t\t}\n\t\t&:nth-child(2) {\n\t\t\tright: 22px;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground: ", ";\n\t\t}\n\t}\n"])), function (_ref2) {
|
|
87
91
|
var theme = _ref2.theme;
|
|
88
92
|
return theme.fontWeights.normal;
|
|
89
93
|
}, function (props) {
|
package/commonjs/Input/index.js
CHANGED
|
@@ -7,13 +7,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _styles = _interopRequireWildcard(require("./styles"));
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
-
|
|
14
|
-
var _excluded = ["autoComplete", "autoFocus", "disabled", "readOnly", "isInvalid", "hasWarning", "id", "name", "placeholder", "type", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "clearButtonLabel", "innerRef", "onBlur", "onChange", "onClear", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "appearance"];
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
var _excluded = ["autoComplete", "autoFocus", "disabled", "readOnly", "isInvalid", "hasWarning", "id", "name", "placeholder", "type", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "innerRef", "onBlur", "onChange", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "appearance"];
|
|
17
11
|
|
|
18
12
|
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); }
|
|
19
13
|
|
|
@@ -27,37 +21,6 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea
|
|
|
27
21
|
|
|
28
22
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
23
|
|
|
30
|
-
var InputContext = /*#__PURE__*/React.createContext({});
|
|
31
|
-
|
|
32
|
-
var ClearButton = function ClearButton() {
|
|
33
|
-
var _React$useContext = React.useContext(InputContext),
|
|
34
|
-
handleClear = _React$useContext.handleClear,
|
|
35
|
-
clearButtonLabel = _React$useContext.clearButtonLabel,
|
|
36
|
-
hasValue = _React$useContext.hasValue; // Hide the button when there is no text to clear.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!hasValue) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return /*#__PURE__*/React.createElement(_Button.default, {
|
|
44
|
-
onClick: handleClear
|
|
45
|
-
}, /*#__PURE__*/React.createElement(_Icon.default, {
|
|
46
|
-
name: "circlex",
|
|
47
|
-
title: clearButtonLabel || "Clear"
|
|
48
|
-
}));
|
|
49
|
-
}; // Used for positioning elementAfter. This logic will detect if the element is a ClearButton,
|
|
50
|
-
// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var isClearButton = function isClearButton(elem) {
|
|
54
|
-
if (elem != null && elem.type) {
|
|
55
|
-
return elem.type.displayName === "Input.ClearButton";
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return false;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
24
|
var Input = /*#__PURE__*/function (_React$Component) {
|
|
62
25
|
_inheritsLoose(Input, _React$Component);
|
|
63
26
|
|
|
@@ -71,31 +34,39 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
71
34
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
72
35
|
|
|
73
36
|
_this.handleBlur = function (e) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
_this.handleClear = function (e) {
|
|
78
|
-
return _this.props.onClear == null ? void 0 : _this.props.onClear(e);
|
|
37
|
+
if (_this.props.onBlur) {
|
|
38
|
+
_this.props.onBlur(e);
|
|
39
|
+
}
|
|
79
40
|
};
|
|
80
41
|
|
|
81
42
|
_this.handleChange = function (e) {
|
|
82
|
-
|
|
43
|
+
if (_this.props.onChange) {
|
|
44
|
+
_this.props.onChange(e, e.currentTarget.value);
|
|
45
|
+
}
|
|
83
46
|
};
|
|
84
47
|
|
|
85
48
|
_this.handleFocus = function (e) {
|
|
86
|
-
|
|
49
|
+
if (_this.props.onFocus) {
|
|
50
|
+
_this.props.onFocus(e);
|
|
51
|
+
}
|
|
87
52
|
};
|
|
88
53
|
|
|
89
54
|
_this.handleKeyDown = function (e) {
|
|
90
|
-
|
|
55
|
+
if (_this.props.onKeyDown) {
|
|
56
|
+
_this.props.onKeyDown(e, e.currentTarget.value);
|
|
57
|
+
}
|
|
91
58
|
};
|
|
92
59
|
|
|
93
60
|
_this.handleKeyUp = function (e) {
|
|
94
|
-
|
|
61
|
+
if (_this.props.onKeyUp) {
|
|
62
|
+
_this.props.onKeyUp(e, e.currentTarget.value);
|
|
63
|
+
}
|
|
95
64
|
};
|
|
96
65
|
|
|
97
66
|
_this.handlePaste = function (e) {
|
|
98
|
-
|
|
67
|
+
if (_this.props.onPaste) {
|
|
68
|
+
_this.props.onPaste(e, e.currentTarget.value);
|
|
69
|
+
}
|
|
99
70
|
};
|
|
100
71
|
|
|
101
72
|
return _this;
|
|
@@ -122,11 +93,9 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
122
93
|
maxLength = _this$props.maxLength,
|
|
123
94
|
ariaLabel = _this$props.ariaLabel,
|
|
124
95
|
ariaDescribedby = _this$props.ariaDescribedby,
|
|
125
|
-
clearButtonLabel = _this$props.clearButtonLabel,
|
|
126
96
|
innerRef = _this$props.innerRef,
|
|
127
97
|
onBlur = _this$props.onBlur,
|
|
128
98
|
onChange = _this$props.onChange,
|
|
129
|
-
onClear = _this$props.onClear,
|
|
130
99
|
onFocus = _this$props.onFocus,
|
|
131
100
|
onKeyDown = _this$props.onKeyDown,
|
|
132
101
|
onKeyUp = _this$props.onKeyUp,
|
|
@@ -136,39 +105,25 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
136
105
|
_this$props$qa = _this$props.qa,
|
|
137
106
|
qa = _this$props$qa === void 0 ? {} : _this$props$qa,
|
|
138
107
|
appearance = _this$props.appearance,
|
|
139
|
-
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
140
|
-
|
|
108
|
+
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
141
109
|
|
|
142
110
|
var autoCompleteValue = undefined;
|
|
143
111
|
|
|
144
112
|
if (autoComplete !== undefined) {
|
|
145
113
|
autoCompleteValue = autoComplete ? "on" : "off";
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
var elementBefore = type === "search" && !elemBefore ? /*#__PURE__*/React.createElement(_Icon.default, {
|
|
150
|
-
name: "search",
|
|
151
|
-
ariaHidden: true
|
|
152
|
-
}) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
|
|
114
|
+
}
|
|
153
115
|
|
|
154
|
-
var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
|
|
155
116
|
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
156
|
-
hasBeforeElement: !!
|
|
157
|
-
hasAfterElement: !!
|
|
117
|
+
hasBeforeElement: !!elemBefore,
|
|
118
|
+
hasAfterElement: !!elemAfter,
|
|
158
119
|
disabled: disabled,
|
|
159
120
|
invalid: !!isInvalid,
|
|
160
121
|
warning: hasWarning,
|
|
161
122
|
appearance: appearance // $FlowIssue - upgrade v0.112.0
|
|
162
123
|
|
|
163
|
-
}, rest), /*#__PURE__*/React.createElement(
|
|
164
|
-
value: {
|
|
165
|
-
handleClear: this.handleClear,
|
|
166
|
-
clearButtonLabel: clearButtonLabel,
|
|
167
|
-
hasValue: !!value
|
|
168
|
-
}
|
|
169
|
-
}, elementBefore && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
124
|
+
}, rest), elemBefore && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
170
125
|
before: true
|
|
171
|
-
},
|
|
126
|
+
}, elemBefore), /*#__PURE__*/React.createElement("input", _extends({
|
|
172
127
|
"aria-invalid": !!isInvalid,
|
|
173
128
|
"aria-label": ariaLabel,
|
|
174
129
|
"aria-describedby": ariaDescribedby,
|
|
@@ -193,23 +148,19 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
193
148
|
"data-qa-input": name || "",
|
|
194
149
|
"data-qa-input-isdisabled": disabled === true,
|
|
195
150
|
"data-qa-input-isrequired": required === true
|
|
196
|
-
}, qa, inputProps)),
|
|
197
|
-
after: true
|
|
198
|
-
|
|
199
|
-
}, elementAfter)));
|
|
151
|
+
}, qa, inputProps)), elemAfter && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
152
|
+
after: true
|
|
153
|
+
}, elemAfter));
|
|
200
154
|
};
|
|
201
155
|
|
|
202
156
|
return Input;
|
|
203
157
|
}(React.Component);
|
|
204
158
|
|
|
159
|
+
exports.default = Input;
|
|
205
160
|
Input.defaultProps = {
|
|
206
161
|
autoFocus: false,
|
|
207
162
|
disabled: false,
|
|
208
163
|
type: "text",
|
|
209
164
|
size: "default",
|
|
210
165
|
appearance: "primary"
|
|
211
|
-
};
|
|
212
|
-
Input.ClearButton = ClearButton;
|
|
213
|
-
Input.ClearButton.displayName = "Input.ClearButton";
|
|
214
|
-
var _default = Input;
|
|
215
|
-
exports.default = _default;
|
|
166
|
+
};
|
package/commonjs/Input/styles.js
CHANGED
|
@@ -86,7 +86,7 @@ var Accessory = _styledComponents.default.div.withConfig({
|
|
|
86
86
|
}, function (props) {
|
|
87
87
|
return props.before && (0, _styledComponents.css)(["left:", ";"], props.theme.space[350]);
|
|
88
88
|
}, function (props) {
|
|
89
|
-
return props.after && (0, _styledComponents.css)(["right:", ";"], props.
|
|
89
|
+
return props.after && (0, _styledComponents.css)(["right:", ";"], props.theme.space[350]);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
exports.Accessory = Accessory;
|
package/commonjs/Menu/index.js
CHANGED
|
@@ -267,6 +267,13 @@ var MenuRadio = function MenuRadio(props) {
|
|
|
267
267
|
|
|
268
268
|
exports.MenuRadio = MenuRadio;
|
|
269
269
|
|
|
270
|
+
var _StyledText = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
271
|
+
displayName: "Menu___StyledText",
|
|
272
|
+
componentId: "sc-1p3rdnp-0"
|
|
273
|
+
})(["", ""], function (p) {
|
|
274
|
+
return p._css;
|
|
275
|
+
});
|
|
276
|
+
|
|
270
277
|
var MenuGroup = function MenuGroup(_ref2) {
|
|
271
278
|
var children = _ref2.children,
|
|
272
279
|
title = _ref2.title,
|
|
@@ -286,7 +293,7 @@ var MenuGroup = function MenuGroup(_ref2) {
|
|
|
286
293
|
fontWeight: 600,
|
|
287
294
|
mt: 350,
|
|
288
295
|
color: "text.headline",
|
|
289
|
-
|
|
296
|
+
_css: isDisabled && _mixins.disabled
|
|
290
297
|
}, title)), /*#__PURE__*/React.createElement(_Box.default, _extends({}, props, {
|
|
291
298
|
p: 300,
|
|
292
299
|
role: "group"
|
|
@@ -436,7 +443,7 @@ Menu.Divider.displayName = "Menu.Divider";
|
|
|
436
443
|
Menu.FilterInput.displayName = "Menu.FilterInput";
|
|
437
444
|
var CustomPopoutContent = (0, _styledComponents.default)(_Popout.default.Content).withConfig({
|
|
438
445
|
displayName: "Menu__CustomPopoutContent",
|
|
439
|
-
componentId: "sc-1p3rdnp-
|
|
446
|
+
componentId: "sc-1p3rdnp-1"
|
|
440
447
|
})(["padding:0;margin-left:0;margin-right:0;"]);
|
|
441
448
|
|
|
442
449
|
var MenuButton = function MenuButton(_ref5) {
|
|
@@ -494,11 +501,4 @@ var MenuButton = function MenuButton(_ref5) {
|
|
|
494
501
|
|
|
495
502
|
exports.MenuButton = MenuButton;
|
|
496
503
|
var _default = Menu;
|
|
497
|
-
exports.default = _default;
|
|
498
|
-
|
|
499
|
-
var _StyledText = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
500
|
-
displayName: "Menu___StyledText",
|
|
501
|
-
componentId: "sc-1p3rdnp-1"
|
|
502
|
-
})(["", ""], function (p) {
|
|
503
|
-
return p.$_css;
|
|
504
|
-
});
|
|
504
|
+
exports.default = _default;
|
package/commonjs/Modal/styles.js
CHANGED
|
@@ -15,6 +15,8 @@ var _Box = _interopRequireDefault(require("../Box"));
|
|
|
15
15
|
|
|
16
16
|
var _systemProps = require("../utils/system-props");
|
|
17
17
|
|
|
18
|
+
var _templateObject;
|
|
19
|
+
|
|
18
20
|
var _excluded = ["className"];
|
|
19
21
|
|
|
20
22
|
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); }
|
|
@@ -23,6 +25,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
28
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
29
|
+
|
|
26
30
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
31
|
|
|
28
32
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -51,7 +55,7 @@ function ReactModalAdapter(_ref) {
|
|
|
51
55
|
}, props));
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
var Body = (0, _styledComponents.createGlobalStyle)([".ReactModal__Body--open{overflow:hidden
|
|
58
|
+
var Body = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n .ReactModal__Body--open {\n overflow: hidden;\n }\n"]))); // eslint-disable-next-line prettier/prettier
|
|
55
59
|
|
|
56
60
|
exports.Body = Body;
|
|
57
61
|
var Container = (0, _styledComponents.default)(ReactModalAdapter).withConfig({
|
package/commonjs/Toast/index.js
CHANGED
|
@@ -82,14 +82,26 @@ function toast(options) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
var _StyledBox = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
86
|
+
displayName: "Toast___StyledBox",
|
|
87
|
+
componentId: "sc-1vii3dq-0"
|
|
88
|
+
})(["", ""], function (p) {
|
|
89
|
+
return p._css;
|
|
90
|
+
});
|
|
91
|
+
|
|
85
92
|
var IconBox = function IconBox(props) {
|
|
86
93
|
return /*#__PURE__*/React.createElement(_StyledBox, _extends({
|
|
87
94
|
display: "inline-block"
|
|
88
95
|
}, props, {
|
|
89
|
-
|
|
96
|
+
_css: "line-height: 1;"
|
|
90
97
|
}));
|
|
91
98
|
};
|
|
92
99
|
|
|
100
|
+
var _StyledBox2 = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
101
|
+
displayName: "Toast___StyledBox2",
|
|
102
|
+
componentId: "sc-1vii3dq-1"
|
|
103
|
+
})(["transform:translateY(1px);"]);
|
|
104
|
+
|
|
93
105
|
var Toast = function Toast(_ref) {
|
|
94
106
|
var content = _ref.content,
|
|
95
107
|
theme = _ref.theme,
|
|
@@ -128,16 +140,4 @@ var Toast = function Toast(_ref) {
|
|
|
128
140
|
};
|
|
129
141
|
|
|
130
142
|
var _default = ToastContainer;
|
|
131
|
-
exports.default = _default;
|
|
132
|
-
|
|
133
|
-
var _StyledBox = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
134
|
-
displayName: "Toast___StyledBox",
|
|
135
|
-
componentId: "sc-1vii3dq-0"
|
|
136
|
-
})(["", ""], function (p) {
|
|
137
|
-
return p.$_css;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
var _StyledBox2 = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
141
|
-
displayName: "Toast___StyledBox2",
|
|
142
|
-
componentId: "sc-1vii3dq-1"
|
|
143
|
-
})(["transform:translateY(1px);"]);
|
|
143
|
+
exports.default = _default;
|