@sproutsocial/racine 11.2.0 → 11.3.0-beta.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.
Files changed (185) hide show
  1. package/CHANGELOG.md +0 -6
  2. package/__flow__/Badge/index.js +32 -58
  3. package/__flow__/Badge/index.stories.js +42 -35
  4. package/__flow__/Badge/index.test.js +32 -34
  5. package/__flow__/Badge/styles.js +42 -22
  6. package/__flow__/Input/index.js +124 -66
  7. package/__flow__/Input/index.stories.js +33 -0
  8. package/__flow__/Input/index.test.js +224 -1
  9. package/__flow__/Input/styles.js +1 -1
  10. package/commonjs/Avatar/index.js +7 -4
  11. package/commonjs/Badge/index.js +39 -39
  12. package/commonjs/Badge/styles.js +32 -16
  13. package/commonjs/Banner/index.js +3 -1
  14. package/commonjs/Banner/styles.js +1 -1
  15. package/commonjs/Box/styles.js +1 -1
  16. package/commonjs/Breadcrumb/index.js +5 -2
  17. package/commonjs/Button/index.js +3 -1
  18. package/commonjs/Card/index.js +3 -1
  19. package/commonjs/Card/styles.js +3 -3
  20. package/commonjs/CharacterCounter/index.js +3 -1
  21. package/commonjs/CharacterCounter/styles.js +1 -1
  22. package/commonjs/ChartLegend/index.js +3 -1
  23. package/commonjs/ChartLegend/styles.js +3 -3
  24. package/commonjs/Checkbox/index.js +3 -1
  25. package/commonjs/Checkbox/styles.js +1 -1
  26. package/commonjs/Collapsible/index.js +5 -2
  27. package/commonjs/DatePicker/DateRangePicker.js +3 -1
  28. package/commonjs/DatePicker/SingleDatePicker.js +3 -1
  29. package/commonjs/DatePicker/StatefulDateRangePicker.js +3 -1
  30. package/commonjs/DatePicker/StatefulSingleDatePicker.js +3 -1
  31. package/commonjs/DatePicker/common.js +1 -1
  32. package/commonjs/DatePicker/styles.js +2 -6
  33. package/commonjs/Drawer/SlideTransition.js +3 -1
  34. package/commonjs/Drawer/index.js +9 -4
  35. package/commonjs/Drawer/styles.js +2 -2
  36. package/commonjs/EmptyState/index.js +3 -1
  37. package/commonjs/Fieldset/index.js +7 -3
  38. package/commonjs/FormField/index.js +3 -1
  39. package/commonjs/Icon/index.js +5 -2
  40. package/commonjs/Icon/styles.js +1 -1
  41. package/commonjs/Image/index.js +3 -1
  42. package/commonjs/Image/styles.js +1 -1
  43. package/commonjs/Indicator/index.js +3 -1
  44. package/commonjs/Input/index.js +69 -28
  45. package/commonjs/Input/styles.js +3 -3
  46. package/commonjs/KeyboardKey/index.js +3 -1
  47. package/commonjs/Label/index.js +4 -2
  48. package/commonjs/Link/index.js +3 -1
  49. package/commonjs/Link/styles.js +1 -1
  50. package/commonjs/Listbox/index.js +7 -4
  51. package/commonjs/Loader/index.js +3 -1
  52. package/commonjs/Loader/styles.js +2 -2
  53. package/commonjs/LoaderButton/index.js +3 -1
  54. package/commonjs/Menu/constants.js +1 -1
  55. package/commonjs/Menu/descendants.js +10 -7
  56. package/commonjs/Menu/hooks.js +1 -1
  57. package/commonjs/Menu/index.js +22 -16
  58. package/commonjs/Menu/styles.js +2 -2
  59. package/commonjs/Message/index.js +3 -1
  60. package/commonjs/Message/styles.js +1 -1
  61. package/commonjs/Modal/index.js +7 -3
  62. package/commonjs/Modal/styles.js +4 -6
  63. package/commonjs/Numeral/constants.js +1 -1
  64. package/commonjs/Numeral/index.js +3 -1
  65. package/commonjs/Numeral/styles.js +3 -3
  66. package/commonjs/OverflowList/styles.js +1 -1
  67. package/commonjs/Popout/index.js +7 -3
  68. package/commonjs/Popout/styles.js +1 -1
  69. package/commonjs/Radio/index.js +3 -1
  70. package/commonjs/Radio/styles.js +4 -4
  71. package/commonjs/SegmentedControl/index.js +5 -2
  72. package/commonjs/Select/index.js +3 -1
  73. package/commonjs/Stack/index.js +3 -1
  74. package/commonjs/Switch/index.js +3 -1
  75. package/commonjs/Switch/styles.js +1 -1
  76. package/commonjs/Table/index.js +10 -5
  77. package/commonjs/TableCell/index.js +3 -1
  78. package/commonjs/TableHeaderCell/index.js +3 -1
  79. package/commonjs/TableRowAccordion/index.js +3 -1
  80. package/commonjs/Tabs/index.js +5 -2
  81. package/commonjs/Tabs/styles.js +4 -4
  82. package/commonjs/Text/index.js +3 -1
  83. package/commonjs/Text/styles.js +1 -1
  84. package/commonjs/Textarea/index.js +3 -1
  85. package/commonjs/Toast/index.js +15 -15
  86. package/commonjs/Toast/styles.js +4 -7
  87. package/commonjs/ToggleHint/index.js +3 -1
  88. package/commonjs/Token/index.js +3 -1
  89. package/commonjs/Token/styles.js +1 -1
  90. package/commonjs/TokenInput/index.js +3 -1
  91. package/commonjs/Tooltip/index.js +5 -2
  92. package/commonjs/Tooltip/styles.js +1 -1
  93. package/commonjs/VisuallyHidden/index.js +1 -1
  94. package/commonjs/index.js +1 -1
  95. package/commonjs/themes/dark/decorative-palettes.js +1 -1
  96. package/commonjs/themes/dark/theme.js +1 -1
  97. package/commonjs/themes/light/decorative-palettes.js +1 -1
  98. package/commonjs/themes/light/theme.js +1 -1
  99. package/commonjs/utils/hooks.js +3 -2
  100. package/commonjs/utils/mixins.js +1 -1
  101. package/commonjs/utils/system-props.js +1 -1
  102. package/dist/themes/dark/dark.scss +5 -5
  103. package/dist/themes/light/light.scss +95 -95
  104. package/lib/Avatar/index.js +7 -4
  105. package/lib/Badge/index.js +40 -37
  106. package/lib/Badge/styles.js +28 -13
  107. package/lib/Banner/index.js +3 -1
  108. package/lib/Banner/styles.js +1 -1
  109. package/lib/Box/styles.js +1 -1
  110. package/lib/Breadcrumb/index.js +5 -2
  111. package/lib/Button/index.js +3 -1
  112. package/lib/Card/index.js +3 -1
  113. package/lib/Card/styles.js +2 -2
  114. package/lib/CharacterCounter/index.js +3 -1
  115. package/lib/CharacterCounter/styles.js +1 -1
  116. package/lib/ChartLegend/index.js +3 -1
  117. package/lib/ChartLegend/styles.js +3 -3
  118. package/lib/Checkbox/index.js +3 -1
  119. package/lib/Collapsible/index.js +5 -2
  120. package/lib/DatePicker/DateRangePicker.js +3 -1
  121. package/lib/DatePicker/SingleDatePicker.js +3 -1
  122. package/lib/DatePicker/StatefulDateRangePicker.js +3 -1
  123. package/lib/DatePicker/StatefulSingleDatePicker.js +3 -1
  124. package/lib/DatePicker/styles.js +2 -6
  125. package/lib/Drawer/SlideTransition.js +3 -1
  126. package/lib/Drawer/index.js +9 -4
  127. package/lib/Drawer/styles.js +2 -2
  128. package/lib/EmptyState/index.js +3 -1
  129. package/lib/Fieldset/index.js +7 -3
  130. package/lib/FormField/index.js +3 -1
  131. package/lib/Icon/index.js +5 -2
  132. package/lib/Icon/styles.js +1 -1
  133. package/lib/Image/index.js +3 -1
  134. package/lib/Image/styles.js +1 -1
  135. package/lib/Indicator/index.js +3 -1
  136. package/lib/Input/index.js +62 -27
  137. package/lib/Input/styles.js +3 -3
  138. package/lib/KeyboardKey/index.js +3 -1
  139. package/lib/Label/index.js +4 -2
  140. package/lib/Link/index.js +3 -1
  141. package/lib/Link/styles.js +1 -1
  142. package/lib/Listbox/index.js +6 -3
  143. package/lib/Loader/index.js +3 -1
  144. package/lib/Loader/styles.js +2 -2
  145. package/lib/LoaderButton/index.js +3 -1
  146. package/lib/Menu/descendants.js +5 -2
  147. package/lib/Menu/index.js +20 -16
  148. package/lib/Menu/styles.js +2 -2
  149. package/lib/Message/index.js +3 -1
  150. package/lib/Modal/index.js +7 -3
  151. package/lib/Modal/styles.js +3 -5
  152. package/lib/Numeral/index.js +3 -1
  153. package/lib/Numeral/styles.js +2 -2
  154. package/lib/OverflowList/styles.js +1 -1
  155. package/lib/Popout/index.js +7 -3
  156. package/lib/Popout/styles.js +1 -1
  157. package/lib/Radio/index.js +3 -1
  158. package/lib/Radio/styles.js +4 -4
  159. package/lib/SegmentedControl/index.js +5 -2
  160. package/lib/Select/index.js +3 -1
  161. package/lib/Stack/index.js +3 -1
  162. package/lib/Switch/index.js +3 -1
  163. package/lib/Switch/styles.js +1 -1
  164. package/lib/Table/index.js +9 -4
  165. package/lib/TableCell/index.js +3 -1
  166. package/lib/TableHeaderCell/index.js +3 -1
  167. package/lib/TableRowAccordion/index.js +3 -1
  168. package/lib/Tabs/index.js +5 -2
  169. package/lib/Tabs/styles.js +3 -3
  170. package/lib/Text/index.js +3 -1
  171. package/lib/Text/styles.js +1 -1
  172. package/lib/Textarea/index.js +3 -1
  173. package/lib/Toast/index.js +14 -14
  174. package/lib/Toast/styles.js +3 -7
  175. package/lib/ToggleHint/index.js +3 -1
  176. package/lib/Token/index.js +3 -1
  177. package/lib/Token/styles.js +1 -1
  178. package/lib/TokenInput/index.js +3 -1
  179. package/lib/Tooltip/index.js +5 -2
  180. package/lib/Tooltip/styles.js +1 -1
  181. package/lib/VisuallyHidden/index.js +1 -1
  182. package/package.json +1 -1
  183. package/__flow__/Badge/constants.js +0 -48
  184. package/commonjs/Badge/constants.js +0 -43
  185. package/lib/Badge/constants.js +0 -38
@@ -141,6 +141,39 @@ 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 nonSearchClearButtonInput = () => {
160
+ return (
161
+ <Input
162
+ type="text"
163
+ placeholder={text("placeholder", "Please enter a value...")}
164
+ value={text("value", "val")}
165
+ onClear={() => window.alert("Cleared!")}
166
+ ariaLabel={text("ariaLabel", "Descriptive label goes here")}
167
+ clearButtonLabel={text("clearButtonLabel", "Clear text")}
168
+ elemAfter={<Input.ClearButton />}
169
+ />
170
+ );
171
+ };
172
+
173
+ nonSearchClearButtonInput.story = {
174
+ name: "Input.ClearButton usage",
175
+ };
176
+
144
177
  export const autofocus = () => (
145
178
  <Input
146
179
  autoFocus
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "jest-styled-components";
3
- import { render, fireEvent } from "../utils/react-testing-library";
3
+ import { render, fireEvent, userEvent } from "../utils/react-testing-library";
4
4
  import Input from "./";
5
5
  import Text from "../Text";
6
6
 
@@ -69,6 +69,229 @@ 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 { getByTitle } = render(
76
+ <Input
77
+ id="name"
78
+ name="name"
79
+ value="mic"
80
+ type="search"
81
+ clearButtonLabel="Clear search"
82
+ />
83
+ );
84
+ expect(getByTitle("Clear search")).toBeTruthy();
85
+ });
86
+
87
+ it("should not override an elemAfter prop if passed", () => {
88
+ const { getByText, queryByTitle } = render(
89
+ <Input
90
+ id="name"
91
+ name="name"
92
+ value="mic"
93
+ type="search"
94
+ elemAfter={<Text>After</Text>}
95
+ />
96
+ );
97
+ expect(getByText("After")).toBeTruthy();
98
+ expect(queryByTitle("Clear")).not.toBeInTheDocument();
99
+ });
100
+
101
+ it("should use the fallback title if clearButtonLabel is not provided", () => {
102
+ const { getByTitle } = render(
103
+ <Input id="name" name="name" value="mic" type="search" />
104
+ );
105
+ expect(getByTitle("Clear")).toBeTruthy();
106
+ });
107
+
108
+ it("should call onClear when clicked", () => {
109
+ const mockOnClear = jest.fn();
110
+ const { getByTitle } = render(
111
+ <Input
112
+ id="name"
113
+ name="name"
114
+ value="mic"
115
+ type="search"
116
+ onClear={mockOnClear}
117
+ clearButtonLabel="Clear search"
118
+ />
119
+ );
120
+ fireEvent.click(getByTitle("Clear search"));
121
+ expect(mockOnClear).toHaveBeenCalled();
122
+ });
123
+
124
+ it("should call onChange when clicked if there is no onClear prop", () => {
125
+ const mockOnChange = jest.fn();
126
+ const { getByTitle } = render(
127
+ <Input
128
+ id="name"
129
+ name="name"
130
+ value="mic"
131
+ type="search"
132
+ onChange={mockOnChange}
133
+ clearButtonLabel="Clear search"
134
+ />
135
+ );
136
+ fireEvent.click(getByTitle("Clear search"));
137
+ expect(mockOnChange).toHaveBeenLastCalledWith(expect.anything(), "");
138
+ });
139
+
140
+ it("should allow keyboard access to and Space key triggering of the clear button", () => {
141
+ const mockOnClear = jest.fn();
142
+ const { getByRole } = render(
143
+ <Input
144
+ id="name"
145
+ name="name"
146
+ value="mic"
147
+ type="search"
148
+ onClear={mockOnClear}
149
+ clearButtonLabel="Clear search"
150
+ />
151
+ );
152
+ const input = getByRole("searchbox");
153
+ const button = getByRole("button");
154
+ userEvent.tab();
155
+ expect(input).toHaveFocus();
156
+ userEvent.tab();
157
+ expect(button).toHaveFocus();
158
+ userEvent.keyboard("{space}");
159
+ expect(mockOnClear).toHaveBeenCalled();
160
+ });
161
+
162
+ it("should allow keyboard access to and Enter key triggering of the clear button", () => {
163
+ const mockOnClear = jest.fn();
164
+ const { getByRole } = render(
165
+ <Input
166
+ id="name"
167
+ name="name"
168
+ value="mic"
169
+ type="search"
170
+ onClear={mockOnClear}
171
+ clearButtonLabel="Clear search"
172
+ />
173
+ );
174
+ const input = getByRole("searchbox");
175
+ const button = getByRole("button");
176
+ userEvent.tab();
177
+ expect(input).toHaveFocus();
178
+ userEvent.tab();
179
+ expect(button).toHaveFocus();
180
+ userEvent.keyboard("{enter}");
181
+ expect(mockOnClear).toHaveBeenCalled();
182
+ });
183
+ });
184
+
185
+ describe("Manual Input.ClearButton usage", () => {
186
+ it("should render a clear button when passed with elemAfter", () => {
187
+ const { getByTitle } = render(
188
+ <Input
189
+ id="name"
190
+ name="name"
191
+ value="mic"
192
+ type="text"
193
+ elemAfter={<Input.ClearButton />}
194
+ clearButtonLabel="Clear search"
195
+ />
196
+ );
197
+ expect(getByTitle("Clear search")).toBeTruthy();
198
+ });
199
+
200
+ it("should use the fallback title if clearButtonLabel is not provided", () => {
201
+ const { getByTitle } = render(
202
+ <Input
203
+ id="name"
204
+ name="name"
205
+ value="mic"
206
+ type="text"
207
+ elemAfter={<Input.ClearButton />}
208
+ />
209
+ );
210
+ expect(getByTitle("Clear")).toBeTruthy();
211
+ });
212
+
213
+ it("should call onClear when Input.ClearButton is clicked", () => {
214
+ const mockOnClear = jest.fn();
215
+ const { getByTitle } = render(
216
+ <Input
217
+ id="name"
218
+ name="name"
219
+ value="mic"
220
+ type="text"
221
+ elemAfter={<Input.ClearButton />}
222
+ onClear={mockOnClear}
223
+ clearButtonLabel="Clear search"
224
+ />
225
+ );
226
+ fireEvent.click(getByTitle("Clear search"));
227
+ expect(mockOnClear).toHaveBeenCalled();
228
+ });
229
+
230
+ it("should call onChange when clicked if there is no onClear prop", () => {
231
+ const mockOnChange = jest.fn();
232
+ const { getByTitle } = render(
233
+ <Input
234
+ id="name"
235
+ name="name"
236
+ value="mic"
237
+ type="text"
238
+ elemAfter={<Input.ClearButton />}
239
+ onChange={mockOnChange}
240
+ clearButtonLabel="Clear search"
241
+ />
242
+ );
243
+ fireEvent.click(getByTitle("Clear search"));
244
+ expect(mockOnChange).toHaveBeenLastCalledWith(expect.anything(), "");
245
+ });
246
+
247
+ it("should allow keyboard access to and Space key triggering of the clear button", () => {
248
+ const mockOnClear = jest.fn();
249
+ const { getByRole } = render(
250
+ <Input
251
+ id="name"
252
+ name="name"
253
+ value="mic"
254
+ type="text"
255
+ elemAfter={<Input.ClearButton />}
256
+ onClear={mockOnClear}
257
+ clearButtonLabel="Clear search"
258
+ />
259
+ );
260
+ const input = getByRole("textbox");
261
+ const button = getByRole("button");
262
+ userEvent.tab();
263
+ expect(input).toHaveFocus();
264
+ userEvent.tab();
265
+ expect(button).toHaveFocus();
266
+ userEvent.keyboard("{space}");
267
+ expect(mockOnClear).toHaveBeenCalled();
268
+ });
269
+
270
+ it("should allow keyboard access to and Enter key triggering of the clear button", () => {
271
+ const mockOnClear = jest.fn();
272
+ const { getByRole } = render(
273
+ <Input
274
+ id="name"
275
+ name="name"
276
+ value="mic"
277
+ type="text"
278
+ elemAfter={<Input.ClearButton />}
279
+ onClear={mockOnClear}
280
+ clearButtonLabel="Clear search"
281
+ />
282
+ );
283
+ const input = getByRole("textbox");
284
+ const button = getByRole("button");
285
+ userEvent.tab();
286
+ expect(input).toHaveFocus();
287
+ userEvent.tab();
288
+ expect(button).toHaveFocus();
289
+ userEvent.keyboard("{enter}");
290
+ expect(mockOnClear).toHaveBeenCalled();
291
+ });
292
+ });
293
+ });
294
+
72
295
  describe("autoComplete prop", () => {
73
296
  it("should not have autoComplete attribute when passed prop is not passed", () => {
74
297
  const { getByDataQaLabel } = render(<Input id="name" name="name" />);
@@ -140,7 +140,7 @@ export const Accessory: StyledComponent<any, TypeTheme, *> = styled.div`
140
140
  ${(props) =>
141
141
  props.after &&
142
142
  css`
143
- right: ${props.theme.space[350]};
143
+ right: ${props.isClearButton ? 0 : props.theme.space[350]};
144
144
  `};
145
145
  `;
146
146
 
@@ -15,6 +15,9 @@ var _Image = _interopRequireDefault(require("../Image"));
15
15
 
16
16
  var _Text = _interopRequireDefault(require("../Text"));
17
17
 
18
+ var _excluded = ["fontSize"],
19
+ _excluded2 = ["appearance", "name", "src", "variant", "type", "size", "bg", "color"];
20
+
18
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
22
 
20
23
  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); }
@@ -27,12 +30,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
27
30
 
28
31
  var AvatarText = (0, _styledComponents.default)(function (_ref) {
29
32
  var fontSize = _ref.fontSize,
30
- rest = _objectWithoutPropertiesLoose(_ref, ["fontSize"]);
33
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
31
34
 
32
35
  return /*#__PURE__*/React.createElement(_Text.default, rest);
33
36
  }).withConfig({
34
37
  displayName: "Avatar__AvatarText",
35
- componentId: "yx873f-0"
38
+ componentId: "sc-yx873f-0"
36
39
  })(["font-size:", "px;color:", "px;"], function (props) {
37
40
  return props.fontSize;
38
41
  }, function (props) {
@@ -40,7 +43,7 @@ var AvatarText = (0, _styledComponents.default)(function (_ref) {
40
43
  });
41
44
  var Container = (0, _styledComponents.default)(_Box.default).withConfig({
42
45
  displayName: "Avatar__Container",
43
- componentId: "yx873f-1"
46
+ componentId: "sc-yx873f-1"
44
47
  })(["", ""], function (_ref2) {
45
48
  var theme = _ref2.theme,
46
49
  type = _ref2.type,
@@ -75,7 +78,7 @@ var Avatar = function Avatar(_ref3) {
75
78
  size = _ref3$size === void 0 ? "40px" : _ref3$size,
76
79
  bg = _ref3.bg,
77
80
  color = _ref3.color,
78
- rest = _objectWithoutPropertiesLoose(_ref3, ["appearance", "name", "src", "variant", "type", "size", "bg", "color"]);
81
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded2);
79
82
 
80
83
  var _useState = (0, React.useState)(false),
81
84
  imageFailedLoading = _useState[0],
@@ -5,11 +5,9 @@ exports.default = void 0;
5
5
 
6
6
  var React = _interopRequireWildcard(require("react"));
7
7
 
8
- var _Icon = _interopRequireDefault(require("../Icon"));
9
-
10
8
  var _styles = _interopRequireDefault(require("./styles"));
11
9
 
12
- var _Box = _interopRequireDefault(require("../Box"));
10
+ var _excluded = ["size", "type", "tip", "text"];
13
11
 
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
13
 
@@ -21,41 +19,43 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
21
19
 
22
20
  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; }
23
21
 
24
- var Badge = function Badge(_ref) {
25
- var children = _ref.children,
26
- text = _ref.text,
27
- iconName = _ref.iconName,
28
- type = _ref.type,
29
- tip = _ref.tip,
30
- _ref$size = _ref.size,
31
- size = _ref$size === void 0 ? "small" : _ref$size,
32
- _ref$badgeColor = _ref.badgeColor,
33
- badgeColor = _ref$badgeColor === void 0 ? "blue" : _ref$badgeColor,
34
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "text", "iconName", "type", "tip", "size", "badgeColor"]);
35
-
36
- if (children && text) {
37
- throw new Error("can't use both `children` and `text` props. Text is deprecated, consider using children.");
22
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
23
+
24
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
25
+
26
+ var Badge = /*#__PURE__*/function (_React$Component) {
27
+ _inheritsLoose(Badge, _React$Component);
28
+
29
+ function Badge() {
30
+ return _React$Component.apply(this, arguments) || this;
38
31
  }
39
32
 
40
- return /*#__PURE__*/React.createElement(_styles.default, _extends({}, rest, {
41
- // size previously included default, which currently maps to small. Once consumers have updated this can be simplified.
42
- size: size === "default" ? "large" : size,
43
- badgeColor: badgeColor,
44
- "data-tip": tip,
45
- "data-qa-badge": text || "",
46
- "data-qa-badge-type": type,
47
- "data-qa-badge-tip": tip || "",
48
- type: type && type
49
- }), /*#__PURE__*/React.createElement(_Box.default, {
50
- display: "flex",
51
- alignItems: "center",
52
- JustifyContent: "center"
53
- }, iconName ? /*#__PURE__*/React.createElement(_Icon.default, {
54
- mr: 200,
55
- name: iconName,
56
- size: size === "small" ? "mini" : "default"
57
- }) : null, children || text));
58
- };
59
-
60
- var _default = Badge;
61
- exports.default = _default;
33
+ var _proto = Badge.prototype;
34
+
35
+ _proto.render = function render() {
36
+ var _this$props = this.props,
37
+ size = _this$props.size,
38
+ type = _this$props.type,
39
+ tip = _this$props.tip,
40
+ text = _this$props.text,
41
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
42
+
43
+ return /*#__PURE__*/React.createElement(_styles.default, _extends({
44
+ type: type,
45
+ small: size === "small",
46
+ "data-tip": tip,
47
+ "data-qa-badge": text || "",
48
+ "data-qa-badge-type": type,
49
+ "data-qa-badge-tip": tip || "" // $FlowIssue - upgrade v0.112.0
50
+
51
+ }, rest), text);
52
+ };
53
+
54
+ return Badge;
55
+ }(React.Component);
56
+
57
+ exports.default = Badge;
58
+ Badge.defaultProps = {
59
+ type: "primary",
60
+ size: "default"
61
+ };
@@ -3,30 +3,46 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
 
6
- var _styledComponents = _interopRequireDefault(require("styled-components"));
6
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
7
7
 
8
8
  var _systemProps = require("../utils/system-props");
9
9
 
10
10
  var _themeGet = require("@styled-system/theme-get");
11
11
 
12
- var _constants = require("./constants");
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); }
13
+
14
+ 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; }
15
+
16
+ var colors = {
17
+ primary: "colors.neutral.0",
18
+ secondary: "colors.neutral.800",
19
+ passive: "colors.neutral.800",
20
+ common: "colors.neutral.0",
21
+ approval: "colors.neutral.800",
22
+ default: "colors.neutral.0",
23
+ suggestion: "colors.neutral.900"
24
+ };
25
+ var backgroundColors = {
26
+ primary: "colors.blue.700",
27
+ secondary: "colors.yellow.500",
28
+ passive: "colors.neutral.200",
29
+ common: "colors.aqua.600",
30
+ approval: "colors.orange.300",
31
+ default: "colors.purple.700",
32
+ suggestion: "colors.blue.300"
33
+ }; // eslint-disable-next-line prettier/prettier
13
34
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- // eslint-disable-next-line prettier/prettier
17
35
  var Container = _styledComponents.default.span.withConfig({
18
36
  displayName: "styles__Container",
19
- componentId: "g1g76b-0"
20
- })(["font-family:", ";", ";border-radius:9999px;line-height:16px;display:inline-block;color:", ";background:", ";padding:", ";", ";"], function (p) {
21
- return p.theme.fontFamily;
22
- }, function (p) {
23
- return p.size === "small" ? p.theme.typography[100] : p.theme.typography[200];
24
- }, function (p) {
25
- return p.type ? (0, _themeGet.themeGet)(_constants.legacyBadgeColors[p.type].color) : p.theme.colors.text.body;
26
- }, function (p) {
27
- return p.type ? (0, _themeGet.themeGet)(_constants.legacyBadgeColors[p.type].background) : p.theme.colors.container.background.decorative[p.badgeColor];
28
- }, function (p) {
29
- return p.size === "small" ? p.theme.space[0] + " " + p.theme.space[200] : "" + p.theme.space[300];
37
+ componentId: "sc-g1g76b-0"
38
+ })(["display:inline-block;text-align:center;border-radius:50px;font-family:", ";padding:", ";", " ", " ", ""], function (props) {
39
+ return props.theme.fontFamily;
40
+ }, function (props) {
41
+ return props.small ? props.theme.space[200] + " " + props.theme.space[300] : props.theme.space[300] + " " + props.theme.space[350];
42
+ }, function (props) {
43
+ return props.small ? props.theme.typography[100] : props.theme.typography[200];
44
+ }, function (props) {
45
+ return (0, _styledComponents.css)(["color:", ";background:", ";"], (0, _themeGet.themeGet)(colors[props.type])(props), (0, _themeGet.themeGet)(backgroundColors[props.type])(props));
30
46
  }, _systemProps.COMMON);
31
47
 
32
48
  var _default = Container;
@@ -11,6 +11,8 @@ var _styles = _interopRequireDefault(require("./styles"));
11
11
 
12
12
  var _Box = _interopRequireDefault(require("../Box"));
13
13
 
14
+ var _excluded = ["type", "text"];
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); }
@@ -81,7 +83,7 @@ var Banner = /*#__PURE__*/function (_React$Component) {
81
83
  var _this$props = this.props,
82
84
  type = _this$props.type,
83
85
  text = _this$props.text,
84
- rest = _objectWithoutPropertiesLoose(_this$props, ["type", "text"]);
86
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
85
87
 
86
88
  return /*#__PURE__*/React.createElement(_styles.default // danger needs to be properly deprecated and removed DS-1094
87
89
  , _extends({
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
13
13
 
14
14
  var Container = _styledComponents.default.div.withConfig({
15
15
  displayName: "styles__Container",
16
- componentId: "q43dr4-0"
16
+ componentId: "sc-q43dr4-0"
17
17
  })(function (props) {
18
18
  return (0, _styledComponents.css)(["display:flex;overflow:hidden;align-items:center;justify-content:space-between;color:", ";border-radius:", ";font-family:", ";", " padding:", ";border:1px solid ", ";background-color:", ";.Icon{align-self:flex-start;margin-top:3px;margin-right:", ";min-width:16px;color:", ";}a,button{font-weight:", ";color:", ";font-size:inherit;&:hover{color:", ";text-decoration:underline;}}> span:not(.Icon){display:block;}", " ", ""], props.theme.colors.text.body, props.theme.radii.outer, props.theme.fontFamily, props.theme.typography[200], props.theme.space[300], props.theme.colors.container.border[props.type], props.theme.colors.container.background[props.type], props.theme.space[400], props.theme.colors.icon[props.type], props.theme.fontWeights.semibold, props.theme.colors.text.body, props.theme.colors.text.body, _systemProps.COMMON, _systemProps.LAYOUT);
19
19
  });
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
11
 
12
12
  var Container = _styledComponents.default.div.withConfig({
13
13
  displayName: "styles__Container",
14
- componentId: "ma8yo6-0"
14
+ componentId: "sc-ma8yo6-0"
15
15
  })(["box-sizing:border-box;font-family:", ";", " ", " ", " ", " ", " ", ""], function (_ref) {
16
16
  var theme = _ref.theme;
17
17
  return theme.fontFamily;
@@ -13,6 +13,9 @@ var _Menu = require("../Menu");
13
13
 
14
14
  var _styles = _interopRequireDefault(require("./styles"));
15
15
 
16
+ var _excluded = ["children", "href"],
17
+ _excluded2 = ["ariaLabel", "overflow", "children"];
18
+
16
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
20
 
18
21
  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); }
@@ -26,7 +29,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
26
29
  var BreadcrumbItem = function BreadcrumbItem(_ref) {
27
30
  var children = _ref.children,
28
31
  href = _ref.href,
29
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "href"]);
32
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
30
33
 
31
34
  return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(_Link.default, _extends({
32
35
  href: href // $FlowIssue - upgrade v0.112.0
@@ -38,7 +41,7 @@ var Breadcrumb = function Breadcrumb(_ref2) {
38
41
  var ariaLabel = _ref2.ariaLabel,
39
42
  overflow = _ref2.overflow,
40
43
  children = _ref2.children,
41
- rest = _objectWithoutPropertiesLoose(_ref2, ["ariaLabel", "overflow", "children"]);
44
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
42
45
 
43
46
  var listItems = React.Children.toArray(children);
44
47
  var lastItem = listItems[listItems.length - 1];
@@ -7,6 +7,8 @@ var React = _interopRequireWildcard(require("react"));
7
7
 
8
8
  var _styles = _interopRequireDefault(require("./styles"));
9
9
 
10
+ var _excluded = ["href", "appearance", "active", "disabled", "external", "children", "size", "innerRef", "onClick", "title", "qa", "as", "ariaLabel"];
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  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); }
@@ -35,7 +37,7 @@ var Button = function Button(_ref) {
35
37
  qa = _ref$qa === void 0 ? {} : _ref$qa,
36
38
  as = _ref.as,
37
39
  ariaLabel = _ref.ariaLabel,
38
- rest = _objectWithoutPropertiesLoose(_ref, ["href", "appearance", "active", "disabled", "external", "children", "size", "innerRef", "onClick", "title", "qa", "as", "ariaLabel"]);
40
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
39
41
 
40
42
  if (!href && external) {
41
43
  console.warn("Warning: external prop cannot be set without a href declaration");
@@ -8,6 +8,8 @@ var React = _interopRequireWildcard(require("react"));
8
8
 
9
9
  var _styles = require("./styles");
10
10
 
11
+ var _excluded = ["onClick", "href", "children", "ariaLabel", "buttonProps", "border", "borderColor", "color", "bg"];
12
+
11
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
14
 
13
15
  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; }
@@ -31,7 +33,7 @@ var Card = function Card(_ref) {
31
33
  color = _ref$color === void 0 ? "text.body" : _ref$color,
32
34
  _ref$bg = _ref.bg,
33
35
  bg = _ref$bg === void 0 ? "container.background.base" : _ref$bg,
34
- rest = _objectWithoutPropertiesLoose(_ref, ["onClick", "href", "children", "ariaLabel", "buttonProps", "border", "borderColor", "color", "bg"]);
36
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
35
37
 
36
38
  return /*#__PURE__*/React.createElement(_styles.Container, _extends({}, rest, {
37
39
  border: border,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.ClickableArea = exports.Container = void 0;
4
+ exports.Container = exports.ClickableArea = void 0;
5
5
 
6
6
  var _styledComponents = _interopRequireDefault(require("styled-components"));
7
7
 
@@ -13,7 +13,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  var Container = (0, _styledComponents.default)(_Box.default).withConfig({
15
15
  displayName: "styles__Container",
16
- componentId: "p098yi-0"
16
+ componentId: "sc-p098yi-0"
17
17
  })(["width:100%;border-radius:", ";position:relative;z-index:0;::after{content:\"\";top:0;left:0;position:absolute;border-radius:", ";z-index:-1;width:100%;height:100%;opacity:0;box-shadow:", ";transition:opacity ", " ", ";}&:hover{&::after{opacity:1;}}[role=\"button\"],[type=\"button\"],a{position:relative;}"], function (props) {
18
18
  return props.theme.radii.outer;
19
19
  }, function (props) {
@@ -28,6 +28,6 @@ var Container = (0, _styledComponents.default)(_Box.default).withConfig({
28
28
  exports.Container = Container;
29
29
  var ClickableArea = (0, _styledComponents.default)(_Button.default).withConfig({
30
30
  displayName: "styles__ClickableArea",
31
- componentId: "p098yi-1"
31
+ componentId: "sc-p098yi-1"
32
32
  })(["position:absolute !important;top:0;bottom:0;left:0;right:0;width:100%;"]);
33
33
  exports.ClickableArea = ClickableArea;
@@ -7,6 +7,8 @@ var React = _interopRequireWildcard(require("react"));
7
7
 
8
8
  var _styles = _interopRequireDefault(require("./styles"));
9
9
 
10
+ var _excluded = ["size"];
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  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); }
@@ -33,7 +35,7 @@ var CharacterCounter = /*#__PURE__*/function (_React$Component) {
33
35
  _proto.render = function render() {
34
36
  var _this$props = this.props,
35
37
  size = _this$props.size,
36
- rest = _objectWithoutPropertiesLoose(_this$props, ["size"]);
38
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
37
39
 
38
40
  var remaining = this.props.maxValue - this.props.currentValue;
39
41
  return (
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
13
13
 
14
14
  var Container = _styledComponents.default.div.withConfig({
15
15
  displayName: "styles__Container",
16
- componentId: "do9szx-0"
16
+ componentId: "sc-do9szx-0"
17
17
  })(["font-family:", ";", ";font-weight:", ";line-height:1;font-variant-numeric:tabular-nums;color:", ";", " ", ""], function (props) {
18
18
  return props.theme.fontFamily;
19
19
  }, function (props) {