@sproutsocial/racine 11.2.5 → 11.3.0-beta.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.
Files changed (178) hide show
  1. package/CHANGELOG.md +0 -6
  2. package/__flow__/Input/index.js +126 -67
  3. package/__flow__/Input/index.stories.js +33 -0
  4. package/__flow__/Input/index.test.js +199 -1
  5. package/__flow__/Input/styles.js +1 -1
  6. package/commonjs/Avatar/index.js +7 -4
  7. package/commonjs/Badge/index.js +3 -1
  8. package/commonjs/Badge/styles.js +1 -1
  9. package/commonjs/Banner/index.js +3 -1
  10. package/commonjs/Banner/styles.js +1 -1
  11. package/commonjs/Box/styles.js +1 -1
  12. package/commonjs/Breadcrumb/index.js +5 -2
  13. package/commonjs/Button/index.js +3 -1
  14. package/commonjs/Card/index.js +3 -1
  15. package/commonjs/Card/styles.js +3 -3
  16. package/commonjs/CharacterCounter/index.js +3 -1
  17. package/commonjs/CharacterCounter/styles.js +1 -1
  18. package/commonjs/ChartLegend/index.js +3 -1
  19. package/commonjs/ChartLegend/styles.js +3 -3
  20. package/commonjs/Checkbox/index.js +3 -1
  21. package/commonjs/Checkbox/styles.js +1 -1
  22. package/commonjs/Collapsible/index.js +5 -2
  23. package/commonjs/DatePicker/DateRangePicker.js +3 -1
  24. package/commonjs/DatePicker/SingleDatePicker.js +3 -1
  25. package/commonjs/DatePicker/StatefulDateRangePicker.js +3 -1
  26. package/commonjs/DatePicker/StatefulSingleDatePicker.js +3 -1
  27. package/commonjs/DatePicker/common.js +1 -1
  28. package/commonjs/DatePicker/styles.js +2 -6
  29. package/commonjs/Drawer/SlideTransition.js +3 -1
  30. package/commonjs/Drawer/index.js +9 -4
  31. package/commonjs/Drawer/styles.js +2 -2
  32. package/commonjs/EmptyState/index.js +3 -1
  33. package/commonjs/Fieldset/index.js +7 -3
  34. package/commonjs/FormField/index.js +3 -1
  35. package/commonjs/Icon/index.js +5 -2
  36. package/commonjs/Icon/styles.js +1 -1
  37. package/commonjs/Image/index.js +3 -1
  38. package/commonjs/Image/styles.js +1 -1
  39. package/commonjs/Indicator/index.js +3 -1
  40. package/commonjs/Input/index.js +80 -29
  41. package/commonjs/Input/styles.js +3 -3
  42. package/commonjs/KeyboardKey/index.js +3 -1
  43. package/commonjs/Label/index.js +4 -2
  44. package/commonjs/Link/index.js +3 -1
  45. package/commonjs/Link/styles.js +1 -1
  46. package/commonjs/Listbox/index.js +7 -4
  47. package/commonjs/Loader/index.js +3 -1
  48. package/commonjs/Loader/styles.js +2 -2
  49. package/commonjs/LoaderButton/index.js +3 -1
  50. package/commonjs/Menu/constants.js +1 -1
  51. package/commonjs/Menu/descendants.js +10 -7
  52. package/commonjs/Menu/hooks.js +1 -1
  53. package/commonjs/Menu/index.js +22 -16
  54. package/commonjs/Menu/styles.js +2 -2
  55. package/commonjs/Message/index.js +3 -1
  56. package/commonjs/Message/styles.js +1 -1
  57. package/commonjs/Modal/index.js +7 -3
  58. package/commonjs/Modal/styles.js +4 -6
  59. package/commonjs/Numeral/constants.js +1 -1
  60. package/commonjs/Numeral/index.js +3 -1
  61. package/commonjs/Numeral/styles.js +3 -3
  62. package/commonjs/OverflowList/styles.js +1 -1
  63. package/commonjs/Popout/index.js +7 -3
  64. package/commonjs/Popout/styles.js +1 -1
  65. package/commonjs/Radio/index.js +3 -1
  66. package/commonjs/Radio/styles.js +4 -4
  67. package/commonjs/SegmentedControl/index.js +5 -2
  68. package/commonjs/Select/index.js +3 -1
  69. package/commonjs/Stack/index.js +3 -1
  70. package/commonjs/Switch/index.js +3 -1
  71. package/commonjs/Switch/styles.js +1 -1
  72. package/commonjs/Table/index.js +10 -5
  73. package/commonjs/TableCell/index.js +3 -1
  74. package/commonjs/TableHeaderCell/index.js +3 -1
  75. package/commonjs/TableRowAccordion/index.js +3 -1
  76. package/commonjs/Tabs/index.js +5 -2
  77. package/commonjs/Tabs/styles.js +4 -4
  78. package/commonjs/Text/index.js +3 -1
  79. package/commonjs/Text/styles.js +1 -1
  80. package/commonjs/Textarea/index.js +3 -1
  81. package/commonjs/Toast/index.js +15 -15
  82. package/commonjs/Toast/styles.js +4 -7
  83. package/commonjs/ToggleHint/index.js +3 -1
  84. package/commonjs/Token/index.js +3 -1
  85. package/commonjs/Token/styles.js +1 -1
  86. package/commonjs/TokenInput/index.js +3 -1
  87. package/commonjs/Tooltip/index.js +5 -2
  88. package/commonjs/Tooltip/styles.js +1 -1
  89. package/commonjs/VisuallyHidden/index.js +1 -1
  90. package/commonjs/index.js +1 -1
  91. package/commonjs/themes/dark/decorative-palettes.js +1 -1
  92. package/commonjs/themes/dark/theme.js +1 -1
  93. package/commonjs/themes/light/decorative-palettes.js +1 -1
  94. package/commonjs/themes/light/theme.js +1 -1
  95. package/commonjs/utils/hooks.js +3 -2
  96. package/commonjs/utils/mixins.js +1 -1
  97. package/commonjs/utils/system-props.js +1 -1
  98. package/dist/themes/dark/dark.scss +5 -5
  99. package/dist/themes/light/light.scss +95 -95
  100. package/lib/Avatar/index.js +7 -4
  101. package/lib/Badge/index.js +3 -1
  102. package/lib/Badge/styles.js +1 -1
  103. package/lib/Banner/index.js +3 -1
  104. package/lib/Banner/styles.js +1 -1
  105. package/lib/Box/styles.js +1 -1
  106. package/lib/Breadcrumb/index.js +5 -2
  107. package/lib/Button/index.js +3 -1
  108. package/lib/Card/index.js +3 -1
  109. package/lib/Card/styles.js +2 -2
  110. package/lib/CharacterCounter/index.js +3 -1
  111. package/lib/CharacterCounter/styles.js +1 -1
  112. package/lib/ChartLegend/index.js +3 -1
  113. package/lib/ChartLegend/styles.js +3 -3
  114. package/lib/Checkbox/index.js +3 -1
  115. package/lib/Collapsible/index.js +5 -2
  116. package/lib/DatePicker/DateRangePicker.js +3 -1
  117. package/lib/DatePicker/SingleDatePicker.js +3 -1
  118. package/lib/DatePicker/StatefulDateRangePicker.js +3 -1
  119. package/lib/DatePicker/StatefulSingleDatePicker.js +3 -1
  120. package/lib/DatePicker/styles.js +2 -6
  121. package/lib/Drawer/SlideTransition.js +3 -1
  122. package/lib/Drawer/index.js +9 -4
  123. package/lib/Drawer/styles.js +2 -2
  124. package/lib/EmptyState/index.js +3 -1
  125. package/lib/Fieldset/index.js +7 -3
  126. package/lib/FormField/index.js +3 -1
  127. package/lib/Icon/index.js +5 -2
  128. package/lib/Icon/styles.js +1 -1
  129. package/lib/Image/index.js +3 -1
  130. package/lib/Image/styles.js +1 -1
  131. package/lib/Indicator/index.js +3 -1
  132. package/lib/Input/index.js +73 -28
  133. package/lib/Input/styles.js +3 -3
  134. package/lib/KeyboardKey/index.js +3 -1
  135. package/lib/Label/index.js +4 -2
  136. package/lib/Link/index.js +3 -1
  137. package/lib/Link/styles.js +1 -1
  138. package/lib/Listbox/index.js +6 -3
  139. package/lib/Loader/index.js +3 -1
  140. package/lib/Loader/styles.js +2 -2
  141. package/lib/LoaderButton/index.js +3 -1
  142. package/lib/Menu/descendants.js +5 -2
  143. package/lib/Menu/index.js +20 -16
  144. package/lib/Menu/styles.js +2 -2
  145. package/lib/Message/index.js +3 -1
  146. package/lib/Modal/index.js +7 -3
  147. package/lib/Modal/styles.js +3 -5
  148. package/lib/Numeral/index.js +3 -1
  149. package/lib/Numeral/styles.js +2 -2
  150. package/lib/OverflowList/styles.js +1 -1
  151. package/lib/Popout/index.js +7 -3
  152. package/lib/Popout/styles.js +1 -1
  153. package/lib/Radio/index.js +3 -1
  154. package/lib/Radio/styles.js +4 -4
  155. package/lib/SegmentedControl/index.js +5 -2
  156. package/lib/Select/index.js +3 -1
  157. package/lib/Stack/index.js +3 -1
  158. package/lib/Switch/index.js +3 -1
  159. package/lib/Switch/styles.js +1 -1
  160. package/lib/Table/index.js +9 -4
  161. package/lib/TableCell/index.js +3 -1
  162. package/lib/TableHeaderCell/index.js +3 -1
  163. package/lib/TableRowAccordion/index.js +3 -1
  164. package/lib/Tabs/index.js +5 -2
  165. package/lib/Tabs/styles.js +3 -3
  166. package/lib/Text/index.js +3 -1
  167. package/lib/Text/styles.js +1 -1
  168. package/lib/Textarea/index.js +3 -1
  169. package/lib/Toast/index.js +14 -14
  170. package/lib/Toast/styles.js +3 -7
  171. package/lib/ToggleHint/index.js +3 -1
  172. package/lib/Token/index.js +3 -1
  173. package/lib/Token/styles.js +1 -1
  174. package/lib/TokenInput/index.js +3 -1
  175. package/lib/Tooltip/index.js +5 -2
  176. package/lib/Tooltip/styles.js +1 -1
  177. package/lib/VisuallyHidden/index.js +1 -1
  178. package/package.json +1 -1
@@ -3,7 +3,7 @@ import Button from "../Button";
3
3
  import Box from "../Box";
4
4
  var Container = styled(Box).withConfig({
5
5
  displayName: "styles__Container",
6
- componentId: "p098yi-0"
6
+ componentId: "sc-p098yi-0"
7
7
  })(["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) {
8
8
  return props.theme.radii.outer;
9
9
  }, function (props) {
@@ -17,6 +17,6 @@ var Container = styled(Box).withConfig({
17
17
  });
18
18
  var ClickableArea = styled(Button).withConfig({
19
19
  displayName: "styles__ClickableArea",
20
- componentId: "p098yi-1"
20
+ componentId: "sc-p098yi-1"
21
21
  })(["position:absolute !important;top:0;bottom:0;left:0;right:0;width:100%;"]);
22
22
  export { Container, ClickableArea };
@@ -1,3 +1,5 @@
1
+ var _excluded = ["size"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -21,7 +23,7 @@ var CharacterCounter = /*#__PURE__*/function (_React$Component) {
21
23
  _proto.render = function render() {
22
24
  var _this$props = this.props,
23
25
  size = _this$props.size,
24
- rest = _objectWithoutPropertiesLoose(_this$props, ["size"]);
26
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
25
27
 
26
28
  var remaining = this.props.maxValue - this.props.currentValue;
27
29
  return (
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
2
2
  import { COMMON } from "../utils/system-props";
3
3
  var Container = styled.div.withConfig({
4
4
  displayName: "styles__Container",
5
- componentId: "do9szx-0"
5
+ componentId: "sc-do9szx-0"
6
6
  })(["font-family:", ";", ";font-weight:", ";line-height:1;font-variant-numeric:tabular-nums;color:", ";", " ", ""], function (props) {
7
7
  return props.theme.fontFamily;
8
8
  }, function (props) {
@@ -1,3 +1,5 @@
1
+ var _excluded = ["legendLabels", "stacked", "theme"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -32,7 +34,7 @@ var ChartLegend = function ChartLegend(props) {
32
34
  stacked = props.stacked,
33
35
  _props$theme = props.theme,
34
36
  theme = _props$theme === void 0 ? "compare" : _props$theme,
35
- rest = _objectWithoutPropertiesLoose(props, ["legendLabels", "stacked", "theme"]);
37
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
36
38
 
37
39
  return /*#__PURE__*/React.createElement(Container, _extends({
38
40
  inline: !stacked,
@@ -2,13 +2,13 @@ import styled, { css } from "styled-components";
2
2
  import { COMMON, LAYOUT } from "../utils/system-props";
3
3
  export var Label = styled.span.withConfig({
4
4
  displayName: "styles__Label",
5
- componentId: "se0ijc-0"
5
+ componentId: "sc-se0ijc-0"
6
6
  })(["display:flex;align-items:center;color:", ";white-space:nowrap;text-transform:capitalize;"], function (props) {
7
7
  return props.theme.colors.text.subtext;
8
8
  });
9
9
  export var Swatch = styled.span.withConfig({
10
10
  displayName: "styles__Swatch",
11
- componentId: "se0ijc-1"
11
+ componentId: "sc-se0ijc-1"
12
12
  })(["margin-right:", ";width:", ";height:", ";border-radius:4px;", ""], function (props) {
13
13
  return props.theme.space[300];
14
14
  }, function (props) {
@@ -18,7 +18,7 @@ export var Swatch = styled.span.withConfig({
18
18
  }, COMMON);
19
19
  var Container = styled.div.withConfig({
20
20
  displayName: "styles__Container",
21
- componentId: "se0ijc-2"
21
+ componentId: "sc-se0ijc-2"
22
22
  })(["", " ", " ", ""], function (props) {
23
23
  return props.inline && css(["display:flex;justify-content:center;", " + ", "{margin-left:", ";}"], Label, Label, function (props) {
24
24
  return props.theme.space[450];
@@ -1,3 +1,5 @@
1
+ var _excluded = ["id", "value", "name", "label", "checked", "disabled", "indeterminate", "onChange", "ariaLabel", "appearance", "qa", "tabIndex", "inputProps"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -63,7 +65,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
63
65
  tabIndex = _this$props.tabIndex,
64
66
  _this$props$inputProp = _this$props.inputProps,
65
67
  inputProps = _this$props$inputProp === void 0 ? {} : _this$props$inputProp,
66
- rest = _objectWithoutPropertiesLoose(_this$props, ["id", "value", "name", "label", "checked", "disabled", "indeterminate", "onChange", "ariaLabel", "appearance", "qa", "tabIndex", "inputProps"]);
68
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
67
69
 
68
70
  var isPill = appearance === "pill"; // TODO: Refactor pill checkboxes to use fewer elements for performance gains
69
71
 
@@ -1,3 +1,6 @@
1
+ var _excluded = ["children"],
2
+ _excluded2 = ["children"];
3
+
1
4
  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); }
2
5
 
3
6
  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; }
@@ -48,7 +51,7 @@ var determineMaxHeight = function determineMaxHeight(isHidden, openHeight, compu
48
51
 
49
52
  var Trigger = function Trigger(_ref2) {
50
53
  var children = _ref2.children,
51
- rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
54
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
52
55
 
53
56
  var _useContext = useContext(CollapsibleContext),
54
57
  isOpen = _useContext.isOpen,
@@ -62,7 +65,7 @@ var Trigger = function Trigger(_ref2) {
62
65
 
63
66
  var Panel = function Panel(_ref3) {
64
67
  var children = _ref3.children,
65
- rest = _objectWithoutPropertiesLoose(_ref3, ["children"]);
68
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded2);
66
69
 
67
70
  var _useContext2 = useContext(CollapsibleContext),
68
71
  isOpen = _useContext2.isOpen,
@@ -1,3 +1,5 @@
1
+ var _excluded = ["startDate", "endDate", "onDatesChange"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -11,7 +13,7 @@ var DateRangePicker = function DateRangePicker(_ref) {
11
13
  var startDate = _ref.startDate,
12
14
  endDate = _ref.endDate,
13
15
  onDatesChange = _ref.onDatesChange,
14
- rest = _objectWithoutPropertiesLoose(_ref, ["startDate", "endDate", "onDatesChange"]);
16
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
15
17
 
16
18
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ReactDatesCssOverrides, null), /*#__PURE__*/React.createElement(DayPickerRangeController, _extends({
17
19
  startDate: startDate,
@@ -1,3 +1,5 @@
1
+ var _excluded = ["onDateChange", "date"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -10,7 +12,7 @@ import { commonDatePickerProps } from "./common";
10
12
  var SingleDatePicker = function SingleDatePicker(_ref) {
11
13
  var onDateChange = _ref.onDateChange,
12
14
  date = _ref.date,
13
- rest = _objectWithoutPropertiesLoose(_ref, ["onDateChange", "date"]);
15
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
14
16
 
15
17
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ReactDatesCssOverrides, null), /*#__PURE__*/React.createElement(DayPickerSingleDateController, _extends({
16
18
  date: date,
@@ -1,3 +1,5 @@
1
+ var _excluded = ["startDate", "endDate", "onDatesChange", "onFocusChange"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -10,7 +12,7 @@ export var StatefulDateRangePicker = function StatefulDateRangePicker(_ref) {
10
12
  endDate = _ref.endDate,
11
13
  onDatesChange = _ref.onDatesChange,
12
14
  onFocusChange = _ref.onFocusChange,
13
- rest = _objectWithoutPropertiesLoose(_ref, ["startDate", "endDate", "onDatesChange", "onFocusChange"]);
15
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
14
16
 
15
17
  var _useState = useState({
16
18
  startDate: startDate,
@@ -1,3 +1,5 @@
1
+ var _excluded = ["date", "onDateChange"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -7,7 +9,7 @@ import SingleDatePicker from "./SingleDatePicker";
7
9
  export var StatefulSingleDatePicker = function StatefulSingleDatePicker(_ref) {
8
10
  var date = _ref.date,
9
11
  onDateChange = _ref.onDateChange,
10
- rest = _objectWithoutPropertiesLoose(_ref, ["date", "onDateChange"]);
12
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
11
13
 
12
14
  var _useState = useState(date),
13
15
  stateDate = _useState[0],
@@ -1,7 +1,3 @@
1
- var _templateObject;
2
-
3
- function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
-
5
1
  import styled, { createGlobalStyle, css } from "styled-components";
6
2
  import moment from "moment";
7
3
  import Box from "../Box";
@@ -56,7 +52,7 @@ var shouldHaveRightPill = function shouldHaveRightPill(modifiers, day) {
56
52
 
57
53
  export var CalendarDay = styled(Box).withConfig({
58
54
  displayName: "styles__CalendarDay",
59
- componentId: "fso9yi-0"
55
+ componentId: "sc-fso9yi-0"
60
56
  })(["", ";"], function (_ref) {
61
57
  var modifiers = _ref.modifiers,
62
58
  day = _ref.day,
@@ -72,7 +68,7 @@ export var CalendarDay = styled(Box).withConfig({
72
68
  return css(["color:", ";", ";"], theme.colors.text.subtext, disabled);
73
69
  }
74
70
  });
75
- export var ReactDatesCssOverrides = 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) {
71
+ export var ReactDatesCssOverrides = createGlobalStyle([".DayPicker{box-sizing:content-box;font-weight:", ";font-family:", ";&_transitionContainer{height:228px !important;}&_weekHeader{color:", ";border-bottom:1px solid ", ";top:26px;width:230px;&_ul{padding-left:10px;}}&_weekHeaders__horizontal{margin-left:0}&_weekHeader_li{", " color:", ";font-weight:", ";margin:0;}&__horizontal{box-shadow:none;background:", ";}}.CalendarDay{background-color:transparent;&__selected,&__selected_span,&:hover{background-color:transparent;}&__default{color:", ";}&__default,&__default:hover{border:none;color:", ";}}.CalendarMonth{", " background:", ";padding:0 15px;&_caption{", " color:", ";padding-top:0;background:", ";strong{font-weight:", ";}}&_table{line-height:21.333px;tr{vertical-align:middle;}td{padding:0;border-bottom:none;}}}.CalendarMonthGrid{background:", ";}.DayPickerNavigation_button__horizontal{color:", ";top:-4px;padding:7px 8px;position:absolute;line-height:0.78;border-radius:9999px;border:none;background:", ";&:nth-child(1){left:22px;}&:nth-child(2){right:22px;}&:hover{background:", ";}}"], function (_ref2) {
76
72
  var theme = _ref2.theme;
77
73
  return theme.fontWeights.normal;
78
74
  }, function (props) {
@@ -1,3 +1,5 @@
1
+ var _excluded = ["isVisible", "children", "width", "direction"];
2
+
1
3
  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; }
2
4
 
3
5
  import * as React from "react";
@@ -8,7 +10,7 @@ export var SlideTransition = function SlideTransition(_ref) {
8
10
  children = _ref.children,
9
11
  width = _ref.width,
10
12
  direction = _ref.direction,
11
- rest = _objectWithoutPropertiesLoose(_ref, ["isVisible", "children", "width", "direction"]);
13
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
12
14
 
13
15
  var offset = width * (direction === "left" ? -1 : 1);
14
16
  var transitions = useTransition(isVisible, null, {
@@ -1,3 +1,8 @@
1
+ var _excluded = ["title", "children", "render"],
2
+ _excluded2 = ["children"],
3
+ _excluded3 = ["id", "style", "offset", "direction", "children", "disableCloseOnClickOutside", "onClose", "zIndex", "closeTargets"],
4
+ _excluded4 = ["children", "closeButtonLabel", "direction", "disableCloseOnClickOutside", "id", "isOpen", "offset", "onClose", "zIndex", "closeTargets"];
5
+
1
6
  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; }
2
7
 
3
8
  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); }
@@ -53,7 +58,7 @@ var DrawerHeader = function DrawerHeader(_ref) {
53
58
  title = _ref$title === void 0 ? "" : _ref$title,
54
59
  children = _ref.children,
55
60
  render = _ref.render,
56
- rest = _objectWithoutPropertiesLoose(_ref, ["title", "children", "render"]);
61
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
57
62
 
58
63
  var drawerContext = useContext(DrawerContext);
59
64
 
@@ -79,7 +84,7 @@ var DrawerHeader = function DrawerHeader(_ref) {
79
84
 
80
85
  var DrawerContent = function DrawerContent(_ref2) {
81
86
  var children = _ref2.children,
82
- rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
87
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
83
88
 
84
89
  return (
85
90
  /*#__PURE__*/
@@ -102,7 +107,7 @@ var Drawer = function Drawer(_ref3) {
102
107
  onClose = _ref3.onClose,
103
108
  zIndex = _ref3.zIndex,
104
109
  closeTargets = _ref3.closeTargets,
105
- rest = _objectWithoutPropertiesLoose(_ref3, ["id", "style", "offset", "direction", "children", "disableCloseOnClickOutside", "onClose", "zIndex", "closeTargets"]);
110
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
106
111
 
107
112
  var drawerRef = useRef(null);
108
113
  useEffect(function () {
@@ -174,7 +179,7 @@ var DrawerContainer = function DrawerContainer(_ref4) {
174
179
  zIndex = _ref4$zIndex === void 0 ? 7 : _ref4$zIndex,
175
180
  _ref4$closeTargets = _ref4.closeTargets,
176
181
  closeTargets = _ref4$closeTargets === void 0 ? [] : _ref4$closeTargets,
177
- rest = _objectWithoutPropertiesLoose(_ref4, ["children", "closeButtonLabel", "direction", "disableCloseOnClickOutside", "id", "isOpen", "offset", "onClose", "zIndex", "closeTargets"]);
182
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded4);
178
183
 
179
184
  return /*#__PURE__*/React.createElement(Portal, {
180
185
  id: id
@@ -3,11 +3,11 @@ import { COMMON } from "../utils/system-props";
3
3
  import Box from "../Box";
4
4
  export var Content = styled(Box).withConfig({
5
5
  displayName: "styles__Content",
6
- componentId: "bo5voc-0"
6
+ componentId: "sc-bo5voc-0"
7
7
  })(["overflow-y:auto;"]);
8
8
  var Container = styled.div.withConfig({
9
9
  displayName: "styles__Container",
10
- componentId: "bo5voc-1"
10
+ componentId: "sc-bo5voc-1"
11
11
  })(["display:flex;flex-direction:column;position:fixed;top:0;height:100%;width:", "px;background-color:", ";box-shadow:", ";filter:blur(0);", " ", ""], function (props) {
12
12
  return props.width;
13
13
  }, function (props) {
@@ -1,3 +1,5 @@
1
+ var _excluded = ["media", "headline", "subtext", "primaryAction", "secondaryAction"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -12,7 +14,7 @@ var EmptyState = function EmptyState(_ref) {
12
14
  subtext = _ref.subtext,
13
15
  primaryAction = _ref.primaryAction,
14
16
  secondaryAction = _ref.secondaryAction,
15
- rest = _objectWithoutPropertiesLoose(_ref, ["media", "headline", "subtext", "primaryAction", "secondaryAction"]);
17
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
16
18
 
17
19
  return (
18
20
  /*#__PURE__*/
@@ -1,3 +1,7 @@
1
+ var _excluded = ["layout", "label", "helperText", "children"],
2
+ _excluded2 = ["children"],
3
+ _excluded3 = ["children"];
4
+
1
5
  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); }
2
6
 
3
7
  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; }
@@ -16,7 +20,7 @@ var Fieldset = function Fieldset(_ref) {
16
20
  label = _ref.label,
17
21
  helperText = _ref.helperText,
18
22
  children = _ref.children,
19
- rest = _objectWithoutPropertiesLoose(_ref, ["layout", "label", "helperText", "children"]);
23
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
20
24
 
21
25
  return (
22
26
  /*#__PURE__*/
@@ -39,7 +43,7 @@ var Fieldset = function Fieldset(_ref) {
39
43
 
40
44
  var FieldsetLegend = function FieldsetLegend(_ref2) {
41
45
  var children = _ref2.children,
42
- rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
46
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
43
47
 
44
48
  return /*#__PURE__*/React.createElement(Text, _extends({
45
49
  as: "legend",
@@ -52,7 +56,7 @@ var FieldsetLegend = function FieldsetLegend(_ref2) {
52
56
 
53
57
  var FieldsetHelperText = function FieldsetHelperText(_ref3) {
54
58
  var children = _ref3.children,
55
- rest = _objectWithoutPropertiesLoose(_ref3, ["children"]);
59
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
56
60
 
57
61
  return /*#__PURE__*/React.createElement(Text, _extends({
58
62
  as: "p",
@@ -1,5 +1,7 @@
1
1
  "no babel-plugin-flow-react-proptypes";
2
2
 
3
+ var _excluded = ["children", "error", "helperText", "id", "isInvalid", "label", "mb", "qa", "isLabelHidden"];
4
+
3
5
  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); }
4
6
 
5
7
  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; }
@@ -27,7 +29,7 @@ var FormField = function FormField(_ref) {
27
29
  qa = _ref.qa,
28
30
  _ref$isLabelHidden = _ref.isLabelHidden,
29
31
  isLabelHidden = _ref$isLabelHidden === void 0 ? false : _ref$isLabelHidden,
30
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "error", "helperText", "id", "isInvalid", "label", "mb", "qa", "isLabelHidden"]);
32
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
31
33
 
32
34
  var _useState = useState(identifier || "FormField-" + idCounter++),
33
35
  id = _useState[0];
package/lib/Icon/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ var _excluded = ["name", "size", "fixedWidth", "ariaLabel"],
2
+ _excluded2 = ["activeName", "inactiveName", "isActive", "size", "fixedWidth", "ariaLabel"];
3
+
1
4
  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); }
2
5
 
3
6
  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; }
@@ -16,7 +19,7 @@ var Icon = function Icon(_ref) {
16
19
  _ref$fixedWidth = _ref.fixedWidth,
17
20
  fixedWidth = _ref$fixedWidth === void 0 ? false : _ref$fixedWidth,
18
21
  ariaLabel = _ref.ariaLabel,
19
- rest = _objectWithoutPropertiesLoose(_ref, ["name", "size", "fixedWidth", "ariaLabel"]);
22
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
20
23
 
21
24
  var iconName = deprecatedIcons[name] || name;
22
25
  var iconViewBox = iconViewBoxes[iconName];
@@ -57,7 +60,7 @@ var IconToggle = function IconToggle(_ref2) {
57
60
  _ref2$fixedWidth = _ref2.fixedWidth,
58
61
  fixedWidth = _ref2$fixedWidth === void 0 ? false : _ref2$fixedWidth,
59
62
  ariaLabel = _ref2.ariaLabel,
60
- rest = _objectWithoutPropertiesLoose(_ref2, ["activeName", "inactiveName", "isActive", "size", "fixedWidth", "ariaLabel"]);
63
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
61
64
 
62
65
  return (
63
66
  /*#__PURE__*/
@@ -19,7 +19,7 @@ var Container = styled.span.attrs({
19
19
  className: "Icon"
20
20
  }).withConfig({
21
21
  displayName: "styles__Container",
22
- componentId: "x0vwa5-0"
22
+ componentId: "sc-x0vwa5-0"
23
23
  })(["display:inline-block;color:inherit;vertical-align:middle;", " ", " ", ""], function (props) {
24
24
  return stylesForSize(sizes[props.iconSize], props.fixedWidth);
25
25
  }, COMMON, verticalAlign);
@@ -1,3 +1,5 @@
1
+ var _excluded = ["alt", "title", "onClick", "onError", "onLoad", "src", "qa"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -85,7 +87,7 @@ var Image = /*#__PURE__*/function (_React$Component) {
85
87
  onLoad = _this$props.onLoad,
86
88
  src = _this$props.src,
87
89
  qa = _this$props.qa,
88
- rest = _objectWithoutPropertiesLoose(_this$props, ["alt", "title", "onClick", "onError", "onLoad", "src", "qa"]);
90
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
89
91
 
90
92
  return /*#__PURE__*/React.createElement(ImageContainer, _extends({
91
93
  isLoading: !this.state.didLoad,
@@ -5,7 +5,7 @@ var ImageContainer = styled.img.attrs({
5
5
  className: "Image"
6
6
  }).withConfig({
7
7
  displayName: "styles__ImageContainer",
8
- componentId: "ub2idf-0"
8
+ componentId: "sc-ub2idf-0"
9
9
  })(["display:block;", " ", " ", ""], function (props) {
10
10
  return props.isLoading && css(["visibility:hidden;"]);
11
11
  }, COMMON, LAYOUT);
@@ -1,3 +1,5 @@
1
+ var _excluded = ["tooltip"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -22,7 +24,7 @@ var Indicator = /*#__PURE__*/function (_React$Component) {
22
24
  _proto.render = function render() {
23
25
  var _this$props = this.props,
24
26
  tooltip = _this$props.tooltip,
25
- rest = _objectWithoutPropertiesLoose(_this$props, ["tooltip"]);
27
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
26
28
 
27
29
  return /*#__PURE__*/React.createElement(Container, _extends({
28
30
  "data-tip": tooltip,
@@ -1,3 +1,5 @@
1
+ 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"];
2
+
1
3
  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); }
2
4
 
3
5
  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; }
@@ -8,6 +10,38 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
8
10
 
9
11
  import * as React from "react";
10
12
  import Container, { Accessory } from "./styles";
13
+ import Button from "../Button";
14
+ import Icon from "../Icon";
15
+ var InputContext = /*#__PURE__*/React.createContext({});
16
+
17
+ var ClearButton = function ClearButton() {
18
+ var _React$useContext = React.useContext(InputContext),
19
+ handleClear = _React$useContext.handleClear,
20
+ clearButtonLabel = _React$useContext.clearButtonLabel,
21
+ hasValue = _React$useContext.hasValue; // Hide the button when there is no text to clear.
22
+
23
+
24
+ if (!hasValue) {
25
+ return null;
26
+ }
27
+
28
+ return /*#__PURE__*/React.createElement(Button, {
29
+ onClick: handleClear
30
+ }, /*#__PURE__*/React.createElement(Icon, {
31
+ name: "circlex",
32
+ title: clearButtonLabel || "Clear"
33
+ }));
34
+ }; // Used for positioning elementAfter. This logic will detect if the element is a ClearButton,
35
+ // regardless of whether it was manually passed as elemAfter or automatically added to a search Input.
36
+
37
+
38
+ var isClearButton = function isClearButton(elem) {
39
+ if (elem != null && elem.type) {
40
+ return elem.type.displayName === "Input.ClearButton";
41
+ }
42
+
43
+ return false;
44
+ };
11
45
 
12
46
  var Input = /*#__PURE__*/function (_React$Component) {
13
47
  _inheritsLoose(Input, _React$Component);
@@ -22,39 +56,31 @@ var Input = /*#__PURE__*/function (_React$Component) {
22
56
  _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
23
57
 
24
58
  _this.handleBlur = function (e) {
25
- if (_this.props.onBlur) {
26
- _this.props.onBlur(e);
27
- }
59
+ return _this.props.onBlur == null ? void 0 : _this.props.onBlur(e);
60
+ };
61
+
62
+ _this.handleClear = function (e) {
63
+ return _this.props.onClear == null ? void 0 : _this.props.onClear(e);
28
64
  };
29
65
 
30
66
  _this.handleChange = function (e) {
31
- if (_this.props.onChange) {
32
- _this.props.onChange(e, e.currentTarget.value);
33
- }
67
+ return _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
34
68
  };
35
69
 
36
70
  _this.handleFocus = function (e) {
37
- if (_this.props.onFocus) {
38
- _this.props.onFocus(e);
39
- }
71
+ return _this.props.onFocus == null ? void 0 : _this.props.onFocus(e);
40
72
  };
41
73
 
42
74
  _this.handleKeyDown = function (e) {
43
- if (_this.props.onKeyDown) {
44
- _this.props.onKeyDown(e, e.currentTarget.value);
45
- }
75
+ return _this.props.onKeyDown == null ? void 0 : _this.props.onKeyDown(e, e.currentTarget.value);
46
76
  };
47
77
 
48
78
  _this.handleKeyUp = function (e) {
49
- if (_this.props.onKeyUp) {
50
- _this.props.onKeyUp(e, e.currentTarget.value);
51
- }
79
+ return _this.props.onKeyUp == null ? void 0 : _this.props.onKeyUp(e, e.currentTarget.value);
52
80
  };
53
81
 
54
82
  _this.handlePaste = function (e) {
55
- if (_this.props.onPaste) {
56
- _this.props.onPaste(e, e.currentTarget.value);
57
- }
83
+ return _this.props.onPaste == null ? void 0 : _this.props.onPaste(e, e.currentTarget.value);
58
84
  };
59
85
 
60
86
  return _this;
@@ -81,9 +107,11 @@ var Input = /*#__PURE__*/function (_React$Component) {
81
107
  maxLength = _this$props.maxLength,
82
108
  ariaLabel = _this$props.ariaLabel,
83
109
  ariaDescribedby = _this$props.ariaDescribedby,
110
+ clearButtonLabel = _this$props.clearButtonLabel,
84
111
  innerRef = _this$props.innerRef,
85
112
  onBlur = _this$props.onBlur,
86
113
  onChange = _this$props.onChange,
114
+ onClear = _this$props.onClear,
87
115
  onFocus = _this$props.onFocus,
88
116
  onKeyDown = _this$props.onKeyDown,
89
117
  onKeyUp = _this$props.onKeyUp,
@@ -93,25 +121,39 @@ var Input = /*#__PURE__*/function (_React$Component) {
93
121
  _this$props$qa = _this$props.qa,
94
122
  qa = _this$props$qa === void 0 ? {} : _this$props$qa,
95
123
  appearance = _this$props.appearance,
96
- rest = _objectWithoutPropertiesLoose(_this$props, ["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"]);
124
+ rest = _objectWithoutPropertiesLoose(_this$props, _excluded); // Convert autoComplete from a boolean prop to a string value.
125
+
97
126
 
98
127
  var autoCompleteValue = undefined;
99
128
 
100
129
  if (autoComplete !== undefined) {
101
130
  autoCompleteValue = autoComplete ? "on" : "off";
102
- }
131
+ } // Add default elemBefore and elemAfter elements if type is search.
103
132
 
133
+
134
+ var elementBefore = type === "search" && !elemBefore ? /*#__PURE__*/React.createElement(Icon, {
135
+ name: "search",
136
+ ariaHidden: true
137
+ }) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
138
+
139
+ var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
104
140
  return /*#__PURE__*/React.createElement(Container, _extends({
105
- hasBeforeElement: !!elemBefore,
106
- hasAfterElement: !!elemAfter,
141
+ hasBeforeElement: !!elementBefore,
142
+ hasAfterElement: !!elementAfter,
107
143
  disabled: disabled,
108
144
  invalid: !!isInvalid,
109
145
  warning: hasWarning,
110
146
  appearance: appearance // $FlowIssue - upgrade v0.112.0
111
147
 
112
- }, rest), elemBefore && /*#__PURE__*/React.createElement(Accessory, {
148
+ }, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
149
+ value: {
150
+ handleClear: this.handleClear,
151
+ clearButtonLabel: clearButtonLabel,
152
+ hasValue: !!value
153
+ }
154
+ }, elementBefore && /*#__PURE__*/React.createElement(Accessory, {
113
155
  before: true
114
- }, elemBefore), /*#__PURE__*/React.createElement("input", _extends({
156
+ }, elementBefore), /*#__PURE__*/React.createElement("input", _extends({
115
157
  "aria-invalid": !!isInvalid,
116
158
  "aria-label": ariaLabel,
117
159
  "aria-describedby": ariaDescribedby,
@@ -136,9 +178,10 @@ var Input = /*#__PURE__*/function (_React$Component) {
136
178
  "data-qa-input": name || "",
137
179
  "data-qa-input-isdisabled": disabled === true,
138
180
  "data-qa-input-isrequired": required === true
139
- }, qa, inputProps)), elemAfter && /*#__PURE__*/React.createElement(Accessory, {
140
- after: true
141
- }, elemAfter));
181
+ }, qa, inputProps)), elementAfter && /*#__PURE__*/React.createElement(Accessory, {
182
+ after: true,
183
+ isClearButton: isClearButton(elementAfter)
184
+ }, elementAfter)));
142
185
  };
143
186
 
144
187
  return Input;
@@ -151,4 +194,6 @@ Input.defaultProps = {
151
194
  size: "default",
152
195
  appearance: "primary"
153
196
  };
154
- export { Input as default };
197
+ Input.ClearButton = ClearButton;
198
+ Input.ClearButton.displayName = "Input.ClearButton";
199
+ export default Input;