@sproutsocial/racine 22.5.1 → 23.0.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 +12 -0
- package/__flow__/Toast/Toast.flow.js +4 -0
- package/commonjs/Avatar/Avatar.js +24 -16
- package/commonjs/Badge/Badge.js +20 -13
- package/commonjs/Banner/Banner.js +35 -25
- package/commonjs/Box/Box.js +7 -2
- package/commonjs/Breadcrumb/Breadcrumb.js +36 -23
- package/commonjs/Button/Button.js +11 -3
- package/commonjs/Card/Card.js +25 -18
- package/commonjs/Card/subComponents.js +32 -15
- package/commonjs/CharacterCounter/CharacterCounter.js +7 -3
- package/commonjs/ChartLegend/ChartLegend.js +10 -3
- package/commonjs/ChartLegend/useChartLabels.js +12 -10
- package/commonjs/Checkbox/Checkbox.js +55 -45
- package/commonjs/Checkbox/styles.js +20 -17
- package/commonjs/Collapsible/Collapsible.js +22 -16
- package/commonjs/DatePicker/DateRangePicker/DateRangePicker.js +26 -16
- package/commonjs/DatePicker/DateRangePicker/StatefulDateRangePicker.js +7 -2
- package/commonjs/DatePicker/SingleDatePicker/SingleDatePicker.js +24 -14
- package/commonjs/DatePicker/SingleDatePicker/StatefulSingleDatePicker.js +7 -2
- package/commonjs/DatePicker/common.js +8 -6
- package/commonjs/Drawer/Drawer.js +160 -113
- package/commonjs/EmptyState/EmptyState.js +44 -31
- package/commonjs/Fieldset/Fieldset.js +31 -14
- package/commonjs/FormField/FormField.js +37 -31
- package/commonjs/Icon/Icon.js +35 -30
- package/commonjs/Image/Image.js +5 -3
- package/commonjs/Indicator/Indicator.js +12 -6
- package/commonjs/Input/Input.js +57 -51
- package/commonjs/KeyboardKey/KeyboardKey.js +12 -3
- package/commonjs/Label/Label.js +15 -9
- package/commonjs/Link/Link.js +10 -3
- package/commonjs/Listbox/Listbox.js +16 -13
- package/commonjs/Loader/Loader.js +9 -3
- package/commonjs/LoaderButton/LoaderButton.js +28 -18
- package/commonjs/Menu/Menu.js +128 -107
- package/commonjs/Menu/utils/descendants.js +6 -6
- package/commonjs/Message/Message.js +79 -59
- package/commonjs/Modal/Modal.js +54 -31
- package/commonjs/Modal/styles.js +8 -4
- package/commonjs/Numeral/Numeral.js +27 -11
- package/commonjs/PartnerLogo/PartnerLogo.js +22 -12
- package/commonjs/Radio/Radio.js +28 -22
- package/commonjs/SegmentedControl/SegmentedControl.js +38 -24
- package/commonjs/Select/Select.js +32 -25
- package/commonjs/SpotIllustration/SpotIllustration.js +13 -5
- package/commonjs/Stack/Stack.js +15 -8
- package/commonjs/Switch/Switch.js +14 -7
- package/commonjs/Table/Table.js +65 -45
- package/commonjs/TableCell/TableCell.js +6 -3
- package/commonjs/TableHeaderCell/TableHeaderCell.js +20 -12
- package/commonjs/TableRowAccordion/TableRowAccordion.js +35 -29
- package/commonjs/Tabs/Tabs.js +37 -30
- package/commonjs/Text/Text.js +10 -3
- package/commonjs/Textarea/Textarea.js +37 -32
- package/commonjs/ThemeProvider/index.js +8 -5
- package/commonjs/Toast/Toast.js +127 -91
- package/commonjs/Toast/index.js +15 -15
- package/commonjs/Toast/styles.js +56 -30
- package/commonjs/ToggleHint/ToggleHint.js +11 -5
- package/commonjs/Token/Token.js +39 -25
- package/commonjs/TokenInput/TokenInput.js +55 -47
- package/commonjs/TokenInput/TokenScreenReaderStatus.js +5 -3
- package/commonjs/Tooltip/Tooltip.js +34 -27
- package/dist/types/Drawer/Drawer.d.ts.map +1 -1
- package/dist/types/Drawer/DrawerTypes.d.ts +6 -3
- package/dist/types/Drawer/DrawerTypes.d.ts.map +1 -1
- package/dist/types/Listbox/ListboxTypes.d.ts +1 -1
- package/dist/types/Listbox/ListboxTypes.d.ts.map +1 -1
- package/dist/types/Menu/MenuTypes.d.ts +4 -4
- package/dist/types/Menu/MenuTypes.d.ts.map +1 -1
- package/dist/types/ThemeProvider/index.d.ts +1 -1
- package/dist/types/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/Toast/Toast.d.ts +23 -2
- package/dist/types/Toast/Toast.d.ts.map +1 -1
- package/dist/types/Toast/ToastTypes.d.ts +27 -13
- package/dist/types/Toast/ToastTypes.d.ts.map +1 -1
- package/dist/types/Toast/index.d.ts +2 -4
- package/dist/types/Toast/index.d.ts.map +1 -1
- package/dist/types/Toast/styles.d.ts +11 -15
- package/dist/types/Toast/styles.d.ts.map +1 -1
- package/dist/types/Tooltip/TooltipTypes.d.ts +2 -2
- package/dist/types/Tooltip/TooltipTypes.d.ts.map +1 -1
- package/dist/types/utils/react-testing-library.d.ts +61 -121
- package/dist/types/utils/react-testing-library.d.ts.map +1 -1
- package/lib/Avatar/Avatar.js +25 -16
- package/lib/Badge/Badge.js +22 -13
- package/lib/Banner/Banner.js +37 -25
- package/lib/Box/Box.js +8 -2
- package/lib/Breadcrumb/Breadcrumb.js +37 -23
- package/lib/Button/Button.js +11 -3
- package/lib/Card/Card.js +17 -8
- package/lib/Card/subComponents.js +35 -15
- package/lib/CharacterCounter/CharacterCounter.js +7 -3
- package/lib/ChartLegend/ChartLegend.js +11 -3
- package/lib/ChartLegend/useChartLabels.js +13 -10
- package/lib/Checkbox/Checkbox.js +56 -45
- package/lib/Checkbox/styles.js +20 -17
- package/lib/Collapsible/Collapsible.js +22 -16
- package/lib/DatePicker/DateRangePicker/DateRangePicker.js +29 -16
- package/lib/DatePicker/DateRangePicker/StatefulDateRangePicker.js +8 -2
- package/lib/DatePicker/SingleDatePicker/SingleDatePicker.js +27 -14
- package/lib/DatePicker/SingleDatePicker/StatefulSingleDatePicker.js +8 -2
- package/lib/DatePicker/common.js +8 -6
- package/lib/Drawer/Drawer.js +159 -111
- package/lib/EmptyState/EmptyState.js +46 -31
- package/lib/Fieldset/Fieldset.js +33 -14
- package/lib/FormField/FormField.js +38 -31
- package/lib/Icon/Icon.js +36 -30
- package/lib/Image/Image.js +5 -3
- package/lib/Indicator/Indicator.js +13 -6
- package/lib/Input/Input.js +57 -49
- package/lib/KeyboardKey/KeyboardKey.js +12 -3
- package/lib/Label/Label.js +16 -9
- package/lib/Link/Link.js +11 -3
- package/lib/Listbox/Listbox.js +17 -13
- package/lib/Loader/Loader.js +9 -3
- package/lib/LoaderButton/LoaderButton.js +30 -18
- package/lib/Menu/Menu.js +128 -104
- package/lib/Menu/utils/descendants.js +5 -4
- package/lib/Message/Message.js +80 -59
- package/lib/Modal/Modal.js +56 -31
- package/lib/Modal/styles.js +8 -2
- package/lib/Numeral/Numeral.js +30 -11
- package/lib/PartnerLogo/PartnerLogo.js +22 -12
- package/lib/Radio/Radio.js +29 -22
- package/lib/SegmentedControl/SegmentedControl.js +40 -24
- package/lib/Select/Select.js +33 -25
- package/lib/SpotIllustration/SpotIllustration.js +13 -5
- package/lib/Stack/Stack.js +17 -8
- package/lib/Switch/Switch.js +15 -7
- package/lib/Table/Table.js +65 -43
- package/lib/TableCell/TableCell.js +5 -2
- package/lib/TableHeaderCell/TableHeaderCell.js +20 -11
- package/lib/TableRowAccordion/TableRowAccordion.js +35 -28
- package/lib/Tabs/Tabs.js +37 -30
- package/lib/Text/Text.js +11 -3
- package/lib/Textarea/Textarea.js +37 -30
- package/lib/ThemeProvider/index.js +8 -3
- package/lib/Toast/Toast.js +130 -90
- package/lib/Toast/index.js +3 -5
- package/lib/Toast/styles.js +55 -26
- package/lib/ToggleHint/ToggleHint.js +12 -5
- package/lib/Token/Token.js +42 -25
- package/lib/TokenInput/TokenInput.js +56 -47
- package/lib/TokenInput/TokenScreenReaderStatus.js +5 -3
- package/lib/Tooltip/Tooltip.js +34 -27
- package/package.json +37 -33
- package/commonjs/Drawer/SlideTransition.js +0 -47
- package/commonjs/Popout/Popout.js +0 -313
- package/commonjs/Popout/PopoutTypes.js +0 -5
- package/commonjs/Popout/index.js +0 -30
- package/commonjs/Popout/styles.js +0 -13
- package/dist/types/Drawer/SlideTransition.d.ts +0 -15
- package/dist/types/Drawer/SlideTransition.d.ts.map +0 -1
- package/dist/types/Popout/Popout.d.ts +0 -14
- package/dist/types/Popout/Popout.d.ts.map +0 -1
- package/dist/types/Popout/PopoutTypes.d.ts +0 -90
- package/dist/types/Popout/PopoutTypes.d.ts.map +0 -1
- package/dist/types/Popout/index.d.ts +0 -5
- package/dist/types/Popout/index.d.ts.map +0 -1
- package/dist/types/Popout/styles.d.ts +0 -2
- package/dist/types/Popout/styles.d.ts.map +0 -1
- package/lib/Drawer/SlideTransition.js +0 -38
- package/lib/Popout/Popout.js +0 -303
- package/lib/Popout/PopoutTypes.js +0 -1
- package/lib/Popout/index.js +0 -4
- package/lib/Popout/styles.js +0 -6
package/commonjs/Tabs/Tabs.js
CHANGED
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _styles = _interopRequireWildcard(require("./styles"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
var _excluded = ["children", "id"],
|
|
10
11
|
_excluded2 = ["children", "qa", "onSelect"];
|
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
14
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
-
function
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
17
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
18
|
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; }
|
|
17
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -72,26 +74,28 @@ var TabItemButton = /*#__PURE__*/function (_React$Component) {
|
|
|
72
74
|
onActivate = _this$context4.onActivate,
|
|
73
75
|
fullWidth = _this$context4.fullWidth;
|
|
74
76
|
var isSelected = selectedId === id;
|
|
75
|
-
return /*#__PURE__*/
|
|
76
|
-
key: id,
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabItem, {
|
|
77
78
|
fullWidth: fullWidth,
|
|
78
|
-
isSelected: isSelected
|
|
79
|
-
}, /*#__PURE__*/React.createElement(_styles.TabButton, _extends({
|
|
80
|
-
innerRef: this.buttonRef,
|
|
81
|
-
id: id,
|
|
82
|
-
onClick: function onClick() {
|
|
83
|
-
return onActivate === null || onActivate === void 0 ? void 0 : onActivate(id);
|
|
84
|
-
},
|
|
85
79
|
isSelected: isSelected,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.TabButton, _objectSpread(_objectSpread({
|
|
81
|
+
innerRef: this.buttonRef,
|
|
82
|
+
id: id,
|
|
83
|
+
onClick: function onClick() {
|
|
84
|
+
return onActivate === null || onActivate === void 0 ? void 0 : onActivate(id);
|
|
85
|
+
},
|
|
86
|
+
isSelected: isSelected,
|
|
87
|
+
tabIndex: isSelected ? 0 : -1,
|
|
88
|
+
fullWidth: fullWidth,
|
|
89
|
+
"data-qa-tab-button": id,
|
|
90
|
+
"data-qa-tab-button-state": isSelected,
|
|
91
|
+
"aria-selected": isSelected,
|
|
92
|
+
role: "tab"
|
|
93
|
+
// TODO: Add a TabPanel subcomponent for use with tabs
|
|
94
|
+
// aria-controls={tabPanelId}
|
|
95
|
+
}, rest), {}, {
|
|
96
|
+
children: children
|
|
97
|
+
}))
|
|
98
|
+
}, id);
|
|
95
99
|
}
|
|
96
100
|
}]);
|
|
97
101
|
return TabItemButton;
|
|
@@ -185,21 +189,24 @@ var Tabs = /*#__PURE__*/function (_React$Component2) {
|
|
|
185
189
|
qa = _this$props2.qa,
|
|
186
190
|
onSelect = _this$props2.onSelect,
|
|
187
191
|
rest = _objectWithoutProperties(_this$props2, _excluded2);
|
|
188
|
-
return /*#__PURE__*/
|
|
192
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.default, _objectSpread(_objectSpread(_objectSpread({
|
|
189
193
|
"data-qa-tabs": "",
|
|
190
194
|
onKeyUp: this.keyHandler,
|
|
191
195
|
onSelect: onSelect,
|
|
192
196
|
role: "tablist"
|
|
193
|
-
}, qa, rest),
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
}, qa), rest), {}, {
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TabButtonContext.Provider, {
|
|
199
|
+
value: {
|
|
200
|
+
selectedId: this.getSelectedId(),
|
|
201
|
+
fullWidth: this.props.fullWidth,
|
|
202
|
+
onActivate: this.onActivate,
|
|
203
|
+
onTabMount: this.onTabMount,
|
|
204
|
+
onTabUpdate: this.onTabUpdate,
|
|
205
|
+
onTabUnmount: this.onTabUnmount
|
|
206
|
+
},
|
|
207
|
+
children: children
|
|
208
|
+
})
|
|
209
|
+
}));
|
|
203
210
|
}
|
|
204
211
|
}]);
|
|
205
212
|
return Tabs;
|
package/commonjs/Text/Text.js
CHANGED
|
@@ -8,11 +8,16 @@ exports.default = void 0;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
10
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
var _excluded = ["fontSize", "children", "qa", "color"];
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
function
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
21
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
22
|
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; }
|
|
18
23
|
var Headline = (0, _styledComponents.default)(_styles.default).withConfig({
|
|
@@ -84,7 +89,7 @@ var Text = function Text(_ref) {
|
|
|
84
89
|
color = _ref.color,
|
|
85
90
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
86
91
|
var qaText = typeof children === "string" ? children : undefined;
|
|
87
|
-
return /*#__PURE__*/
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.default, _objectSpread(_objectSpread(_objectSpread({
|
|
88
93
|
typeScale: fontSize,
|
|
89
94
|
"data-qa-text": qaText
|
|
90
95
|
// TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.
|
|
@@ -92,7 +97,9 @@ var Text = function Text(_ref) {
|
|
|
92
97
|
// @ts-ignore
|
|
93
98
|
,
|
|
94
99
|
color: color
|
|
95
|
-
}, qa, rest),
|
|
100
|
+
}, qa), rest), {}, {
|
|
101
|
+
children: children
|
|
102
|
+
}));
|
|
96
103
|
};
|
|
97
104
|
Headline.displayName = "Text.Headline";
|
|
98
105
|
SubHeadline.displayName = "Text.SubHeadline";
|
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _styles = _interopRequireWildcard(require("./styles"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
var _excluded = ["autoFocus", "disabled", "readOnly", "isInvalid", "id", "name", "placeholder", "value", "enableSpellcheck", "enableResize", "required", "rows", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "innerRef", "onBlur", "onChange", "onFocus", "onKeyDown", "onKeyUp", "color", "qa", "inputProps"];
|
|
10
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
13
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
-
function
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
16
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
17
|
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
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -25,8 +27,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
25
27
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
26
28
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable @typescript-eslint/no-unused-vars */
|
|
29
|
-
/**
|
|
30
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable @typescript-eslint/no-unused-vars */ /**
|
|
30
31
|
* @deprecated Use TypeTextareaProps from root instead
|
|
31
32
|
*/
|
|
32
33
|
var Textarea = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
@@ -98,7 +99,7 @@ var Textarea = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
98
99
|
_this$props$inputProp = _this$props.inputProps,
|
|
99
100
|
inputProps = _this$props$inputProp === void 0 ? {} : _this$props$inputProp,
|
|
100
101
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
101
|
-
return /*#__PURE__*/
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.default, _objectSpread(_objectSpread(_objectSpread({
|
|
102
103
|
hasBeforeElement: !!elemBefore,
|
|
103
104
|
hasAfterElement: !!elemAfter,
|
|
104
105
|
disabled: disabled,
|
|
@@ -113,34 +114,38 @@ var Textarea = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
113
114
|
"data-qa-textarea-isdisabled": disabled === true,
|
|
114
115
|
"data-qa-textarea-isrequired": required === true,
|
|
115
116
|
"data-qa-textarea-isinvalid": isInvalid === true
|
|
116
|
-
}, qa, rest),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
}, qa), rest), {}, {
|
|
118
|
+
children: [elemBefore && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Accessory, {
|
|
119
|
+
before: true,
|
|
120
|
+
children: elemBefore
|
|
121
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", _objectSpread({
|
|
122
|
+
id: id,
|
|
123
|
+
"aria-label": ariaLabel,
|
|
124
|
+
"aria-describedby": ariaDescribedby,
|
|
125
|
+
"aria-invalid": isInvalid,
|
|
126
|
+
value: value,
|
|
127
|
+
name: name,
|
|
128
|
+
placeholder: placeholder,
|
|
129
|
+
rows: rows,
|
|
130
|
+
disabled: disabled,
|
|
131
|
+
readOnly: Boolean(readOnly),
|
|
132
|
+
autoFocus: autoFocus,
|
|
133
|
+
spellCheck: enableSpellcheck,
|
|
134
|
+
required: required,
|
|
135
|
+
maxLength: maxLength,
|
|
136
|
+
onChange: this.handleChange,
|
|
137
|
+
onKeyUp: this.handleKeyUp,
|
|
138
|
+
onKeyDown: this.handleKeyDown,
|
|
139
|
+
onBlur: this.handleBlur,
|
|
140
|
+
onFocus: this.handleFocus,
|
|
141
|
+
ref: innerRef,
|
|
142
|
+
"data-qa-textarea-input": "",
|
|
143
|
+
"data-qa-input": name
|
|
144
|
+
}, inputProps)), elemAfter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Accessory, {
|
|
145
|
+
after: true,
|
|
146
|
+
children: elemAfter
|
|
147
|
+
})]
|
|
148
|
+
}));
|
|
144
149
|
}
|
|
145
150
|
}]);
|
|
146
151
|
return Textarea;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,13 +7,17 @@ exports.default = void 0;
|
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _styledComponents = require("styled-components");
|
|
10
9
|
var _seedsReactTheme = require("@sproutsocial/seeds-react-theme");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // We can append additional themes types here
|
|
16
19
|
var ThemeProvider = function ThemeProvider(props) {
|
|
17
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledComponents.ThemeProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
18
21
|
theme: props.theme || _seedsReactTheme.theme
|
|
19
22
|
}));
|
|
20
23
|
};
|
package/commonjs/Toast/Toast.js
CHANGED
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.ToastHighlight = exports.ToastContentContainer = exports.ToastContainer = void 0;
|
|
8
7
|
exports.toast = toast;
|
|
8
|
+
exports.toastUpdate = exports.toastIsActive = exports.toastDismiss = void 0;
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _reactToastify = require("react-toastify");
|
|
12
|
-
var _seedsMotionUnitless = require("@sproutsocial/seeds-motion/dist/seeds-motion-unitless");
|
|
13
11
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
14
12
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
15
13
|
var _Text = _interopRequireDefault(require("../Text"));
|
|
16
|
-
var _styles =
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
var _styles = require("./styles");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _excluded = ["closeOnClick", "content", "onClose", "persist", "toastId", "useTransition", "position", "autoClose", "transition"];
|
|
19
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
function
|
|
18
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
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; }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
var toastDismiss = exports.toastDismiss = function toastDismiss() {
|
|
27
|
+
return _reactToastify.toast.dismiss.apply(_reactToastify.toast, arguments);
|
|
28
|
+
};
|
|
29
|
+
var toastIsActive = exports.toastIsActive = function toastIsActive() {
|
|
30
|
+
return _reactToastify.toast.isActive.apply(_reactToastify.toast, arguments);
|
|
31
|
+
};
|
|
32
|
+
var toastUpdate = exports.toastUpdate = function toastUpdate() {
|
|
33
|
+
return _reactToastify.toast.update.apply(_reactToastify.toast, arguments);
|
|
34
|
+
};
|
|
21
35
|
var NoTransition = (0, _reactToastify.cssTransition)({
|
|
22
|
-
enter: "",
|
|
23
|
-
exit: ""
|
|
24
|
-
duration: [0, 0],
|
|
25
|
-
collapseDuration: 0
|
|
36
|
+
enter: "SproutToast__none-in",
|
|
37
|
+
exit: "SproutToast__none-out"
|
|
26
38
|
});
|
|
27
|
-
var
|
|
28
|
-
enter: "
|
|
29
|
-
exit: "
|
|
30
|
-
duration: [_seedsMotionUnitless.MOTION_DURATION_MEDIUM * 1000, _seedsMotionUnitless.MOTION_DURATION_SLOW * 1000]
|
|
39
|
+
var SproutZoomTransition = (0, _reactToastify.cssTransition)({
|
|
40
|
+
enter: "SproutToast__zoom-in",
|
|
41
|
+
exit: "SproutToast__zoom-out"
|
|
31
42
|
});
|
|
32
|
-
var ToastContainer = function ToastContainer() {
|
|
33
|
-
return /*#__PURE__*/
|
|
34
|
-
className: "Toastify-container-overrides",
|
|
35
|
-
toastClassName: "Toastify-toast-overrides",
|
|
36
|
-
hideProgressBar: true,
|
|
37
|
-
closeButton: false,
|
|
38
|
-
position: _reactToastify.toast.POSITION.BOTTOM_RIGHT
|
|
39
|
-
}));
|
|
43
|
+
var ToastContainer = exports.ToastContainer = function ToastContainer(props) {
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ToastRoot, _objectSpread({}, props));
|
|
40
45
|
};
|
|
41
46
|
var themeIcon = {
|
|
42
47
|
success: "circle-check-outline",
|
|
@@ -45,86 +50,117 @@ var themeIcon = {
|
|
|
45
50
|
error: "triangle-exclamation-outline"
|
|
46
51
|
};
|
|
47
52
|
function toast(options) {
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
content
|
|
51
|
-
color: options.color,
|
|
52
|
-
icon: options.icon
|
|
53
|
-
};
|
|
54
|
-
var autoClose = options.persist ? false : 6000;
|
|
55
|
-
var content = options.content,
|
|
53
|
+
var _options$closeOnClick = options.closeOnClick,
|
|
54
|
+
closeOnClick = _options$closeOnClick === void 0 ? true : _options$closeOnClick,
|
|
55
|
+
content = options.content,
|
|
56
56
|
onClose = options.onClose,
|
|
57
|
+
persist = options.persist,
|
|
58
|
+
inputToastId = options.toastId,
|
|
57
59
|
_options$useTransitio = options.useTransition,
|
|
58
|
-
useTransition = _options$useTransitio === void 0 ? true : _options$useTransitio
|
|
59
|
-
|
|
60
|
+
useTransition = _options$useTransitio === void 0 ? true : _options$useTransitio,
|
|
61
|
+
_options$position = options.position,
|
|
62
|
+
position = _options$position === void 0 ? "bottom-right" : _options$position,
|
|
63
|
+
_options$autoClose = options.autoClose,
|
|
64
|
+
autoClose = _options$autoClose === void 0 ? persist ? false : 6000 : _options$autoClose,
|
|
65
|
+
_options$transition = options.transition,
|
|
66
|
+
transition = _options$transition === void 0 ? useTransition ? SproutZoomTransition : NoTransition : _options$transition,
|
|
67
|
+
rest = _objectWithoutProperties(options, _excluded);
|
|
68
|
+
var toastId = inputToastId;
|
|
60
69
|
if (!toastId && typeof content === "string") {
|
|
61
70
|
toastId = content;
|
|
62
71
|
}
|
|
63
|
-
var
|
|
64
|
-
|
|
72
|
+
var renderToast = function renderToast(toastInput) {
|
|
73
|
+
var renderedContent = typeof content === "function" ? content(toastInput) : content;
|
|
74
|
+
if (options.theme === "custom") {
|
|
75
|
+
return renderedContent;
|
|
76
|
+
}
|
|
77
|
+
var theme = options.theme || "info";
|
|
78
|
+
var iconName = options.icon || themeIcon[theme];
|
|
79
|
+
var containerColor = options.color || {
|
|
80
|
+
success: "container.border.success",
|
|
81
|
+
error: "container.border.error",
|
|
82
|
+
info: "container.border.info",
|
|
83
|
+
warning: "container.border.warning"
|
|
84
|
+
}[theme];
|
|
85
|
+
var iconColor = options.color || {
|
|
86
|
+
success: "icon.success",
|
|
87
|
+
error: "icon.error",
|
|
88
|
+
info: "icon.info",
|
|
89
|
+
warning: "icon.warning"
|
|
90
|
+
}[theme];
|
|
91
|
+
return (
|
|
92
|
+
/*#__PURE__*/
|
|
93
|
+
// TODO: if this closes when clicked, there should be a label saying "Click to close" that can be overridden
|
|
94
|
+
(0, _jsxRuntime.jsx)(ToastContentContainer, {
|
|
95
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
96
|
+
name: iconName,
|
|
97
|
+
color: iconColor
|
|
98
|
+
}),
|
|
99
|
+
close: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
100
|
+
name: "x-outline",
|
|
101
|
+
color: "icon.base",
|
|
102
|
+
"aria-hidden": true
|
|
103
|
+
}),
|
|
104
|
+
highlightColor: containerColor,
|
|
105
|
+
children: renderedContent
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
var toastOptions = _objectSpread(_objectSpread({
|
|
65
110
|
autoClose: autoClose,
|
|
111
|
+
closeOnClick: closeOnClick,
|
|
66
112
|
onClose: onClose,
|
|
67
|
-
toastId: toastId,
|
|
68
|
-
transition: transition
|
|
113
|
+
toastId: toastId || undefined,
|
|
114
|
+
transition: transition,
|
|
115
|
+
position: position
|
|
116
|
+
}, rest), {}, {
|
|
117
|
+
icon: undefined,
|
|
118
|
+
color: undefined
|
|
69
119
|
});
|
|
120
|
+
if (toastId && toastIsActive(toastId)) {
|
|
121
|
+
_reactToastify.toast.update(toastId, _objectSpread(_objectSpread({}, toastOptions), {}, {
|
|
122
|
+
render: renderToast
|
|
123
|
+
}));
|
|
124
|
+
} else {
|
|
125
|
+
toastId = (0, _reactToastify.toast)(renderToast, toastOptions);
|
|
126
|
+
}
|
|
127
|
+
return toastId;
|
|
70
128
|
}
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
/*#__PURE__*/
|
|
83
|
-
// TODO: if this closes when clicked, there should be a label saying "Click to close" that can be overriden
|
|
84
|
-
React.createElement(_styles.default, {
|
|
85
|
-
type: theme || "info",
|
|
86
|
-
customColor: color,
|
|
87
|
-
borderLeft: "2px solid",
|
|
88
|
-
"data-qa-toast": ""
|
|
89
|
-
}, /*#__PURE__*/React.createElement(_Box.default, {
|
|
90
|
-
display: "flex",
|
|
91
|
-
minHeight: "48px",
|
|
92
|
-
maxHeight: "800px",
|
|
93
|
-
p: 350,
|
|
94
|
-
alignItems: "flex-start",
|
|
95
|
-
m: "auto",
|
|
96
|
-
width: 1
|
|
97
|
-
}, /*#__PURE__*/React.createElement(IconBox, null, /*#__PURE__*/React.createElement(_styles.CustomIcon, {
|
|
98
|
-
type: theme || "info"
|
|
99
|
-
// TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
,
|
|
103
|
-
color: color,
|
|
104
|
-
customColor: color,
|
|
105
|
-
name: theme ? themeIcon[theme] : icon || themeIcon["info"],
|
|
106
|
-
fixedWidth: true,
|
|
107
|
-
"aria-hidden": true
|
|
108
|
-
})), /*#__PURE__*/React.createElement(_StyledBox2, {
|
|
109
|
-
flex: 1
|
|
110
|
-
}, /*#__PURE__*/React.createElement(_Text.default, {
|
|
111
|
-
as: "div",
|
|
112
|
-
color: "text.body",
|
|
113
|
-
"data-qa-toast-content": ""
|
|
114
|
-
}, content)), /*#__PURE__*/React.createElement(IconBox, null, /*#__PURE__*/React.createElement(_Icon.default, {
|
|
115
|
-
name: "x-outline",
|
|
116
|
-
ml: 400,
|
|
117
|
-
color: "icon.base",
|
|
129
|
+
var _default = exports.default = ToastContainer;
|
|
130
|
+
var ToastContentContainer = exports.ToastContentContainer = function ToastContentContainer(_ref) {
|
|
131
|
+
var children = _ref.children,
|
|
132
|
+
icon = _ref.icon,
|
|
133
|
+
close = _ref.close,
|
|
134
|
+
highlightColor = _ref.highlightColor;
|
|
135
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
136
|
+
"data-qa-toast": "",
|
|
137
|
+
children: [highlightColor ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ToastHighlight, {
|
|
138
|
+
bg: highlightColor,
|
|
118
139
|
"aria-hidden": true
|
|
119
|
-
}))
|
|
120
|
-
|
|
140
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledBox, {
|
|
141
|
+
children: icon
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
143
|
+
flex: 1,
|
|
144
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
145
|
+
as: "div",
|
|
146
|
+
color: "text.body",
|
|
147
|
+
"data-qa-toast-content": "",
|
|
148
|
+
children: children
|
|
149
|
+
})
|
|
150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledBox2, {
|
|
151
|
+
children: close
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
121
154
|
};
|
|
122
|
-
var
|
|
155
|
+
var ToastHighlight = exports.ToastHighlight = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
156
|
+
displayName: "Toast__ToastHighlight",
|
|
157
|
+
componentId: "sc-1k2tvgq-0"
|
|
158
|
+
})(["position:absolute;top:0;bottom:0;left:0;width:2px;"]);
|
|
123
159
|
var _StyledBox = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
124
160
|
displayName: "Toast___StyledBox",
|
|
125
|
-
componentId: "sc-1k2tvgq-
|
|
161
|
+
componentId: "sc-1k2tvgq-1"
|
|
126
162
|
})(["line-height:1;"]);
|
|
127
163
|
var _StyledBox2 = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
128
164
|
displayName: "Toast___StyledBox2",
|
|
129
|
-
componentId: "sc-1k2tvgq-
|
|
130
|
-
})(["
|
|
165
|
+
componentId: "sc-1k2tvgq-2"
|
|
166
|
+
})(["line-height:1;"]);
|
package/commonjs/Toast/index.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
var _exportNames = {
|
|
8
|
-
|
|
9
|
-
toast: true
|
|
7
|
+
TOAST_Z_INDEX: true
|
|
10
8
|
};
|
|
11
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "TOAST_Z_INDEX", {
|
|
12
10
|
enumerable: true,
|
|
13
11
|
get: function get() {
|
|
14
|
-
return
|
|
12
|
+
return _styles.TOAST_Z_INDEX;
|
|
15
13
|
}
|
|
16
14
|
});
|
|
17
|
-
|
|
18
|
-
Object.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
var _Toast = require("./Toast");
|
|
16
|
+
Object.keys(_Toast).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
+
if (key in exports && exports[key] === _Toast[key]) return;
|
|
20
|
+
Object.defineProperty(exports, key, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _Toast[key];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
23
26
|
});
|
|
24
|
-
var _Toast = _interopRequireWildcard(require("./Toast"));
|
|
25
27
|
var _ToastTypes = require("./ToastTypes");
|
|
26
28
|
Object.keys(_ToastTypes).forEach(function (key) {
|
|
27
29
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -34,6 +36,4 @@ Object.keys(_ToastTypes).forEach(function (key) {
|
|
|
34
36
|
}
|
|
35
37
|
});
|
|
36
38
|
});
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
39
|
-
var _default = exports.default = _Toast.default;
|
|
39
|
+
var _styles = require("./styles");
|