@doist/reactist 15.2.0 → 16.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/dist/reactist.cjs.development.js +654 -201
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/components/color-picker/color-picker.js +10 -10
- package/es/components/color-picker/color-picker.js.map +1 -1
- package/es/components/deprecated-button/deprecated-button.js +4 -4
- package/es/components/deprecated-button/deprecated-button.js.map +1 -1
- package/es/components/deprecated-dropdown/dropdown.js +9 -9
- package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/es/components/deprecated-input/input.js +3 -3
- package/es/components/deprecated-input/input.js.map +1 -1
- package/es/components/{notification/notification.js → deprecated-notification/deprecated-notification.js} +12 -12
- package/es/components/deprecated-notification/deprecated-notification.js.map +1 -0
- package/es/components/deprecated-select/select.js +3 -3
- package/es/components/deprecated-select/select.js.map +1 -1
- package/es/components/icons/CloseIcon.svg.js +3 -3
- package/es/components/icons/CloseIcon.svg.js.map +1 -1
- package/es/components/key-capturer/key-capturer.js +2 -2
- package/es/components/key-capturer/key-capturer.js.map +1 -1
- package/es/components/menu/menu.js +1 -1
- package/es/components/progress-bar/progress-bar.js +4 -4
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/time/time.js +5 -5
- package/es/components/time/time.js.map +1 -1
- package/es/components/tooltip/tooltip.js +10 -10
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/index.js +5 -2
- package/es/index.js.map +1 -1
- package/es/new-components/avatar/avatar.js +2 -2
- package/es/new-components/avatar/avatar.js.map +1 -1
- package/es/new-components/badge/badge.js +22 -0
- package/es/new-components/badge/badge.js.map +1 -0
- package/es/new-components/badge/badge.module.css.js +4 -0
- package/es/new-components/badge/badge.module.css.js.map +1 -0
- package/es/new-components/box/box.js.map +1 -1
- package/es/new-components/box/box.module.css.js +1 -1
- package/es/new-components/loading/loading.js +3 -3
- package/es/new-components/loading/loading.js.map +1 -1
- package/es/new-components/modal/modal.js +1 -1
- package/es/new-components/password-field/password-field.js +1 -1
- package/es/new-components/toast/static-toast.js +86 -0
- package/es/new-components/toast/static-toast.js.map +1 -0
- package/es/new-components/toast/toast-animation.js +175 -0
- package/es/new-components/toast/toast-animation.js.map +1 -0
- package/es/new-components/toast/toast.module.css.js +4 -0
- package/es/new-components/toast/toast.module.css.js.map +1 -0
- package/es/new-components/toast/use-toasts.js +195 -0
- package/es/new-components/toast/use-toasts.js.map +1 -0
- package/lib/components/color-picker/color-picker.d.ts +1 -1
- package/lib/components/color-picker/color-picker.js +1 -1
- package/lib/components/color-picker/color-picker.js.map +1 -1
- package/lib/components/deprecated-button/deprecated-button.d.ts +1 -1
- package/lib/components/deprecated-button/deprecated-button.js +1 -1
- package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
- package/lib/components/deprecated-dropdown/dropdown.d.ts +1 -1
- package/lib/components/deprecated-dropdown/dropdown.js +1 -1
- package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/lib/components/deprecated-input/input.d.ts +1 -1
- package/lib/components/deprecated-input/input.js +1 -1
- package/lib/components/deprecated-input/input.js.map +1 -1
- package/lib/components/{notification/notification.d.ts → deprecated-notification/deprecated-notification.d.ts} +5 -5
- package/lib/components/deprecated-notification/deprecated-notification.js +2 -0
- package/lib/components/deprecated-notification/deprecated-notification.js.map +1 -0
- package/lib/components/{notification/notification.test.d.ts → deprecated-notification/deprecated-notification.test.d.ts} +0 -0
- package/lib/components/deprecated-notification/index.d.ts +1 -0
- package/lib/components/deprecated-select/select.js +1 -1
- package/lib/components/deprecated-select/select.js.map +1 -1
- package/lib/components/icons/CloseIcon.svg.js +1 -1
- package/lib/components/icons/CloseIcon.svg.js.map +1 -1
- package/lib/components/key-capturer/key-capturer.d.ts +1 -1
- package/lib/components/key-capturer/key-capturer.js +1 -1
- package/lib/components/key-capturer/key-capturer.js.map +1 -1
- package/lib/components/menu/menu.js +1 -1
- package/lib/components/progress-bar/progress-bar.js +1 -1
- package/lib/components/progress-bar/progress-bar.js.map +1 -1
- package/lib/components/time/time.d.ts +1 -1
- package/lib/components/time/time.js +1 -1
- package/lib/components/time/time.js.map +1 -1
- package/lib/components/tooltip/tooltip.d.ts +1 -1
- package/lib/components/tooltip/tooltip.js +1 -1
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1 -1
- package/lib/new-components/avatar/avatar.js +1 -1
- package/lib/new-components/avatar/avatar.js.map +1 -1
- package/lib/new-components/badge/badge.d.ts +7 -0
- package/lib/new-components/badge/badge.js +2 -0
- package/lib/new-components/badge/badge.js.map +1 -0
- package/lib/new-components/badge/badge.module.css.js +2 -0
- package/lib/new-components/badge/badge.module.css.js.map +1 -0
- package/lib/new-components/badge/index.d.ts +1 -0
- package/lib/new-components/box/box.d.ts +5 -3
- package/lib/new-components/box/box.js.map +1 -1
- package/lib/new-components/box/box.module.css.js +1 -1
- package/lib/new-components/loading/loading.js +1 -1
- package/lib/new-components/loading/loading.js.map +1 -1
- package/lib/new-components/modal/modal.js +1 -1
- package/lib/new-components/password-field/password-field.js +1 -1
- package/lib/new-components/test-helpers.d.ts +2 -1
- package/lib/new-components/toast/index.d.ts +4 -0
- package/lib/new-components/toast/static-toast.d.ts +61 -0
- package/lib/new-components/toast/static-toast.js +2 -0
- package/lib/new-components/toast/static-toast.js.map +1 -0
- package/lib/new-components/toast/toast-animation.d.ts +50 -0
- package/lib/new-components/toast/toast-animation.js +2 -0
- package/lib/new-components/toast/toast-animation.js.map +1 -0
- package/lib/new-components/toast/toast.module.css.js +2 -0
- package/lib/new-components/toast/toast.module.css.js.map +1 -0
- package/lib/new-components/toast/toast.test.d.ts +1 -0
- package/lib/new-components/toast/use-toasts.d.ts +128 -0
- package/lib/new-components/toast/use-toasts.js +2 -0
- package/lib/new-components/toast/use-toasts.js.map +1 -0
- package/package.json +1 -1
- package/styles/alert.css +1 -1
- package/styles/avatar.css +1 -1
- package/styles/badge.css +5 -0
- package/styles/badge.module.css.css +1 -0
- package/styles/base-button.css +1 -1
- package/styles/base-field.css +1 -1
- package/styles/box.css +1 -1
- package/styles/box.module.css.css +1 -1
- package/styles/checkbox-field.css +1 -1
- package/styles/columns.css +1 -1
- package/styles/{notification.css → deprecated-notification.css} +0 -0
- package/styles/divider.css +1 -1
- package/styles/heading.css +1 -1
- package/styles/hidden-visually.css +1 -1
- package/styles/hidden.css +1 -1
- package/styles/inline.css +1 -1
- package/styles/loading.css +1 -1
- package/styles/modal.css +2 -2
- package/styles/modal.module.css.css +1 -1
- package/styles/notice.css +1 -1
- package/styles/password-field.css +1 -1
- package/styles/progress-bar.css +1 -1
- package/styles/reactist.css +5 -3
- package/styles/select-field.css +1 -1
- package/styles/stack.css +1 -1
- package/styles/static-toast.css +11 -0
- package/styles/switch-field.css +1 -1
- package/styles/tabs.css +1 -1
- package/styles/text-area.css +1 -1
- package/styles/text-field.css +1 -1
- package/styles/text-link.css +1 -1
- package/styles/text.css +1 -1
- package/styles/toast.module.css.css +1 -0
- package/styles/use-toasts.css +11 -0
- package/es/components/notification/notification.js.map +0 -1
- package/lib/components/notification/notification.js +0 -2
- package/lib/components/notification/notification.js.map +0 -1
|
@@ -9,11 +9,11 @@ var React__default = _interopDefault(React);
|
|
|
9
9
|
var classNames = _interopDefault(require('classnames'));
|
|
10
10
|
var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
|
|
11
11
|
var tooltip = require('ariakit/tooltip');
|
|
12
|
+
var portal = require('ariakit/portal');
|
|
12
13
|
var ariakitUtils = require('ariakit-utils');
|
|
13
14
|
var FocusLock = _interopDefault(require('react-focus-lock'));
|
|
14
15
|
var ariaHidden = require('aria-hidden');
|
|
15
16
|
var dialog = require('ariakit/dialog');
|
|
16
|
-
var portal = require('ariakit/portal');
|
|
17
17
|
var tab = require('ariakit/tab');
|
|
18
18
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
19
19
|
var dayjs = _interopDefault(require('dayjs'));
|
|
@@ -195,7 +195,7 @@ function mapResponsiveProp(fromValue, mapper) {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
var modules_54d944f2 = {"box":"
|
|
198
|
+
var modules_54d944f2 = {"box":"aa9a5a15","position-absolute":"_8e8803b9","position-fixed":"e11a8cf1","position-relative":"_5e6c2a17","position-sticky":"_125d4a65","tablet-position-absolute":"_8cbc0cd3","tablet-position-fixed":"_4b5e0b30","tablet-position-relative":"_32636b2c","tablet-position-sticky":"_3c8df1b2","desktop-position-absolute":"_0fc96c32","desktop-position-fixed":"_86f2af8d","desktop-position-relative":"_9ca81d89","desktop-position-sticky":"_7ddb76a3","display-block":"_1f239253","display-flex":"d3c9028a","display-inline":"_7804dae4","display-inlineBlock":"_2011b4f7","display-inlineFlex":"_84d1c5e9","display-none":"ecffd994","tablet-display-block":"_858d10e6","tablet-display-flex":"_048e1351","tablet-display-inline":"_4ad22f53","tablet-display-inlineBlock":"_9bdcf7c5","tablet-display-inlineFlex":"_086af02f","tablet-display-none":"e6d66504","desktop-display-block":"_42a60b7f","desktop-display-flex":"_75f9923b","desktop-display-inline":"_89fe8b6b","desktop-display-inlineBlock":"f5044459","desktop-display-inlineFlex":"c4bb937b","desktop-display-none":"_155e67e3","flexDirection-column":"_8b7928cc","flexDirection-row":"_5d86bbce","tablet-flexDirection-column":"_056ba2f7","tablet-flexDirection-row":"_68a9954e","desktop-flexDirection-column":"febb3bff","desktop-flexDirection-row":"e32ba18f","flexWrap-wrap":"bf057363","flexWrap-nowrap":"c12b5de4","flexShrink-0":"_1b0fdede","flexGrow-0":"_74d96364","flexGrow-1":"_8085a81a","alignItems-flexStart":"d646b895","alignItems-center":"_7eb6fbcd","alignItems-flexEnd":"aa0f1674","alignItems-baseline":"_5f712321","tablet-alignItems-flexStart":"_9cba71cc","tablet-alignItems-center":"_8803e1ed","tablet-alignItems-flexEnd":"dd23ad40","tablet-alignItems-baseline":"b6e66958","desktop-alignItems-flexStart":"_3cf6aa44","desktop-alignItems-center":"c455cc71","desktop-alignItems-flexEnd":"d72d7865","desktop-alignItems-baseline":"d856f657","justifyContent-flexStart":"e99eaf27","justifyContent-center":"f9927840","justifyContent-flexEnd":"_318ae7a4","justifyContent-spaceAround":"_792f21bb","justifyContent-spaceBetween":"c563d133","justifyContent-spaceEvenly":"_88fa03eb","tablet-justifyContent-flexStart":"_10110808","tablet-justifyContent-center":"_39532d47","tablet-justifyContent-flexEnd":"_6f28967b","tablet-justifyContent-spaceAround":"_61cf0e53","tablet-justifyContent-spaceBetween":"d9eb935c","tablet-justifyContent-spaceEvenly":"_2c34f330","desktop-justifyContent-flexStart":"_0d99cfa4","desktop-justifyContent-center":"a8e50b37","desktop-justifyContent-flexEnd":"_5c59c692","desktop-justifyContent-spaceBetween":"_2367b5bf","alignSelf-stretch":"da53b153","alignSelf-flexStart":"e7504e05","alignSelf-center":"_31910485","alignSelf-flexEnd":"f9deb037","alignSelf-baseline":"d2e0b600","tablet-alignSelf-stretch":"_322b2d4c","tablet-alignSelf-flexStart":"_8c3ace8c","tablet-alignSelf-center":"_3784fff8","tablet-alignSelf-flexEnd":"_7d7054cd","tablet-alignSelf-baseline":"_24e72f72","desktop-alignSelf-stretch":"_805f09a3","desktop-alignSelf-flexStart":"c124aecf","desktop-alignSelf-center":"_7f550538","desktop-alignSelf-flexEnd":"f1a1ea25","desktop-alignSelf-baseline":"a47a5534","overflow-hidden":"_79330f2d","overflow-auto":"_2d735aa4","overflow-visible":"_2d2dc480","overflow-scroll":"eae7bf85","height-full":"_3bd4b4e5","bg-default":"cdd56ed4","bg-aside":"ace3a6e9","bg-highlight":"_69ba9d50","bg-selected":"d3c85356","bg-toast":"_54ff8cfc","borderRadius-standard":"a010e6ce","borderRadius-full":"c7f4eef5","border-primary":"_0133b2bb","border-secondary":"_10ddcd6f","border-tertiary":"b1dd5c24","textAlign-start":"_3692c550","textAlign-center":"_917de8e0","textAlign-end":"f1f1808a","textAlign-justify":"_70cadb46","tablet-textAlign-start":"c009a023","tablet-textAlign-center":"_994025e9","tablet-textAlign-end":"da09b74f","tablet-textAlign-justify":"cedd005b","desktop-textAlign-start":"_6fb085b1","desktop-textAlign-center":"_742b34ba","desktop-textAlign-end":"_8d252912","desktop-textAlign-justify":"_081ee438"};
|
|
199
199
|
|
|
200
200
|
var modules_b537a8ee = {"paddingTop-xsmall":"c4803194","paddingTop-small":"_4e9ab24b","paddingTop-medium":"_1d226e27","paddingTop-large":"eb6097f1","paddingTop-xlarge":"d3229ba4","paddingTop-xxlarge":"_47978ba4","tablet-paddingTop-xsmall":"f987719c","tablet-paddingTop-small":"_8dbc4b4d","tablet-paddingTop-medium":"ae44fe07","tablet-paddingTop-large":"ffe9548d","tablet-paddingTop-xlarge":"f2b76a44","tablet-paddingTop-xxlarge":"c6eb8f43","desktop-paddingTop-xsmall":"_8699b560","desktop-paddingTop-small":"_02c374b7","desktop-paddingTop-medium":"_0dd0332f","desktop-paddingTop-large":"da55f1f6","desktop-paddingTop-xlarge":"_8ef2a278","desktop-paddingTop-xxlarge":"_8b493b28","paddingRight-xsmall":"_211eebc7","paddingRight-small":"ad0ccf15","paddingRight-medium":"a03e39af","paddingRight-large":"f0941ead","paddingRight-xlarge":"e47c5a43","paddingRight-xxlarge":"e849a5cf","tablet-paddingRight-xsmall":"_85374228","tablet-paddingRight-small":"_89df37b9","tablet-paddingRight-medium":"_1cc50ebe","tablet-paddingRight-large":"_1060982b","tablet-paddingRight-xlarge":"be58847d","tablet-paddingRight-xxlarge":"_45093484","desktop-paddingRight-xsmall":"f8d99d6a","desktop-paddingRight-small":"efa076d9","desktop-paddingRight-medium":"e59caa64","desktop-paddingRight-large":"da42f46a","desktop-paddingRight-xlarge":"b3ee2580","desktop-paddingRight-xxlarge":"_3ef94658","paddingBottom-xsmall":"b0e6eab4","paddingBottom-small":"_9510d053","paddingBottom-medium":"d7af60c9","paddingBottom-large":"b75f86cd","paddingBottom-xlarge":"fbd4ce29","paddingBottom-xxlarge":"_33e3ad63","tablet-paddingBottom-xsmall":"f0302da7","tablet-paddingBottom-small":"_4f9b8012","tablet-paddingBottom-medium":"_4333e20e","tablet-paddingBottom-large":"_30bbc76c","tablet-paddingBottom-xlarge":"ba5a4008","tablet-paddingBottom-xxlarge":"_423a3b1a","desktop-paddingBottom-xsmall":"b40139b7","desktop-paddingBottom-small":"f96071fa","desktop-paddingBottom-medium":"fe803c9a","desktop-paddingBottom-large":"_01686eb9","desktop-paddingBottom-xlarge":"afa763d8","desktop-paddingBottom-xxlarge":"a95785f1","paddingLeft-xsmall":"cad4e2ec","paddingLeft-small":"d70b3c17","paddingLeft-medium":"_8c851bd6","paddingLeft-large":"_078feb3c","paddingLeft-xlarge":"_76ab968c","paddingLeft-xxlarge":"aaca85d7","tablet-paddingLeft-xsmall":"_5eb0e5aa","tablet-paddingLeft-small":"_0384fb4f","tablet-paddingLeft-medium":"edffff6f","tablet-paddingLeft-large":"_873b9a46","tablet-paddingLeft-xlarge":"_89105db5","tablet-paddingLeft-xxlarge":"db1966fe","desktop-paddingLeft-xsmall":"b17f826b","desktop-paddingLeft-small":"_6dc83610","desktop-paddingLeft-medium":"_3421b8b2","desktop-paddingLeft-large":"_68cec7a6","desktop-paddingLeft-xlarge":"_94bde020","desktop-paddingLeft-xxlarge":"b94ee579"};
|
|
201
201
|
|
|
@@ -459,7 +459,7 @@ const HIDE_DELAY = 100;
|
|
|
459
459
|
function useDelayedTooltipState(initialState) {
|
|
460
460
|
const tooltipState = tooltip.useTooltipState(initialState);
|
|
461
461
|
const delay = useDelay();
|
|
462
|
-
return
|
|
462
|
+
return React.useMemo(() => _objectSpread2(_objectSpread2({}, tooltipState), {}, {
|
|
463
463
|
show: delay(() => tooltipState.show(), SHOW_DELAY),
|
|
464
464
|
hide: delay(() => tooltipState.hide(), HIDE_DELAY)
|
|
465
465
|
}), [delay, tooltipState]);
|
|
@@ -479,7 +479,7 @@ function Tooltip(_ref) {
|
|
|
479
479
|
placement: position,
|
|
480
480
|
gutter: gapSize
|
|
481
481
|
});
|
|
482
|
-
const child =
|
|
482
|
+
const child = React.Children.only(children);
|
|
483
483
|
|
|
484
484
|
if (!content || !child) {
|
|
485
485
|
return child;
|
|
@@ -519,7 +519,7 @@ function Tooltip(_ref) {
|
|
|
519
519
|
child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.onFocus == null ? void 0 : _child$props.onFocus(event);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
return /*#__PURE__*/
|
|
522
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(tooltip.TooltipAnchor, {
|
|
523
523
|
state: state,
|
|
524
524
|
ref: child.ref,
|
|
525
525
|
onFocus: handleFocus
|
|
@@ -527,8 +527,8 @@ function Tooltip(_ref) {
|
|
|
527
527
|
// Let child props override anchor props so user can specify attributes like tabIndex
|
|
528
528
|
// Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems
|
|
529
529
|
// by applying the replacement component/element twice
|
|
530
|
-
return /*#__PURE__*/
|
|
531
|
-
}), state.visible ? /*#__PURE__*/
|
|
530
|
+
return /*#__PURE__*/React.cloneElement(child, _objectSpread2(_objectSpread2({}, anchorProps), child.props));
|
|
531
|
+
}), state.visible ? /*#__PURE__*/React.createElement(tooltip.Tooltip, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
532
532
|
state: state,
|
|
533
533
|
className: classNames('reactist_tooltip', className)
|
|
534
534
|
}), typeof content === 'function' ? content() : content) : null);
|
|
@@ -548,15 +548,15 @@ function Tooltip(_ref) {
|
|
|
548
548
|
*/
|
|
549
549
|
|
|
550
550
|
function useDelay() {
|
|
551
|
-
const timeoutRef =
|
|
552
|
-
const clearTimeouts =
|
|
551
|
+
const timeoutRef = React.useRef();
|
|
552
|
+
const clearTimeouts = React.useCallback(function clearTimeouts() {
|
|
553
553
|
if (timeoutRef.current != null) {
|
|
554
554
|
clearTimeout(timeoutRef.current);
|
|
555
555
|
}
|
|
556
556
|
}, []); // Runs clearTimeouts when the component is unmounted
|
|
557
557
|
|
|
558
|
-
|
|
559
|
-
return
|
|
558
|
+
React.useEffect(() => clearTimeouts, [clearTimeouts]);
|
|
559
|
+
return React.useCallback(function delay(fn, delay) {
|
|
560
560
|
return () => {
|
|
561
561
|
clearTimeouts();
|
|
562
562
|
timeoutRef.current = setTimeout(fn, delay);
|
|
@@ -829,14 +829,14 @@ function Loading(_ref) {
|
|
|
829
829
|
|
|
830
830
|
const numericSize = (_sizeMapping$size = sizeMapping[size]) != null ? _sizeMapping$size : sizeMapping.small;
|
|
831
831
|
const ariaLabel = props['aria-label'] ? props['aria-label'] : !props['aria-labelledby'] ? 'Loading…' : undefined;
|
|
832
|
-
return /*#__PURE__*/
|
|
832
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
833
833
|
"aria-label": ariaLabel,
|
|
834
834
|
className: exceptionallySetClassName,
|
|
835
835
|
display: "flex",
|
|
836
836
|
alignItems: "center",
|
|
837
837
|
justifyContent: "center",
|
|
838
838
|
role: "progressbar"
|
|
839
|
-
}), /*#__PURE__*/
|
|
839
|
+
}), /*#__PURE__*/React.createElement(Spinner, {
|
|
840
840
|
size: numericSize,
|
|
841
841
|
"aria-hidden": true
|
|
842
842
|
}));
|
|
@@ -866,66 +866,517 @@ function Notice({
|
|
|
866
866
|
}, children))));
|
|
867
867
|
}
|
|
868
868
|
|
|
869
|
-
var
|
|
869
|
+
var modules_a9637dd3 = {"text":"a83bd4e0","size-caption":"_266d6623","size-copy":"a8d37c6e","size-subtitle":"_39f4eb1f","weight-semibold":"_7be5c531","weight-bold":"e214ff2e","tone-secondary":"_6a3e5ade","tone-danger":"_8f5b5f2b","tone-positive":"_9ae47ae4","lineClampMultipleLines":"_969f18f7","lineClamp-1":"_2f303ac3","lineClamp-2":"d3e04245","lineClamp-3":"_33411704","lineClamp-4":"bfc32640","lineClamp-5":"f813c82f"};
|
|
870
870
|
|
|
871
|
-
const _excluded$b = ["
|
|
872
|
-
const
|
|
871
|
+
const _excluded$b = ["as", "size", "weight", "tone", "align", "children", "lineClamp", "exceptionallySetClassName"];
|
|
872
|
+
const Text = /*#__PURE__*/polymorphicComponent(function Text(_ref, ref) {
|
|
873
873
|
let {
|
|
874
|
-
|
|
874
|
+
as,
|
|
875
|
+
size = 'body',
|
|
875
876
|
weight = 'regular',
|
|
876
|
-
size,
|
|
877
877
|
tone = 'normal',
|
|
878
|
+
align,
|
|
878
879
|
children,
|
|
879
880
|
lineClamp,
|
|
880
|
-
align,
|
|
881
881
|
exceptionallySetClassName
|
|
882
882
|
} = _ref,
|
|
883
883
|
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
884
884
|
|
|
885
|
-
|
|
886
|
-
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types
|
|
887
|
-
const headingElementName = "h" + level;
|
|
888
|
-
const lineClampMultipleLines = typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1;
|
|
885
|
+
const lineClampMultipleLines = typeof lineClamp === 'string' ? Number(lineClamp) > 1 : (lineClamp != null ? lineClamp : 1) > 1;
|
|
889
886
|
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
890
|
-
|
|
887
|
+
as: as,
|
|
888
|
+
className: [exceptionallySetClassName, modules_a9637dd3.text, size !== 'body' ? getClassNames(modules_a9637dd3, 'size', size) : null, weight !== 'regular' ? getClassNames(modules_a9637dd3, 'weight', weight) : null, tone !== 'normal' ? getClassNames(modules_a9637dd3, 'tone', tone) : null, lineClampMultipleLines ? modules_a9637dd3.lineClampMultipleLines : null, lineClamp ? getClassNames(modules_a9637dd3, 'lineClamp', lineClamp.toString()) : null],
|
|
891
889
|
textAlign: align,
|
|
892
890
|
// Prevents emojis from being cut-off
|
|
893
891
|
// See https://github.com/Doist/reactist/pull/528
|
|
894
892
|
paddingRight: lineClamp ? 'xsmall' : undefined,
|
|
895
|
-
as: headingElementName,
|
|
896
893
|
ref: ref
|
|
897
894
|
}), children);
|
|
898
895
|
});
|
|
899
896
|
|
|
900
|
-
var
|
|
897
|
+
var modules_d11e18f0 = {"stackedToastsView":"_8e9f0a55","toastContainer":"_121b9429","slot":"_6a2a04c5"};
|
|
901
898
|
|
|
902
|
-
const _excluded$c = ["
|
|
903
|
-
|
|
899
|
+
const _excluded$c = ["message", "description", "icon", "action", "onDismiss", "dismissLabel"];
|
|
900
|
+
/**
|
|
901
|
+
* A toast that shows a message, and an optional action associated with it.
|
|
902
|
+
*
|
|
903
|
+
* This component is generally not meant to be used directly. Most of the time you'll want to use
|
|
904
|
+
* toasts generated via `useToasts` instead. However, this component is available in case you need
|
|
905
|
+
* to take control of rendering a toast under different circumstances than that of notification-like
|
|
906
|
+
* floating toasts.
|
|
907
|
+
*
|
|
908
|
+
* This component makes no assumptions outwardly about how it is positioned on the screen. That is,
|
|
909
|
+
* it will not be shown floating or fixed to the viewport edges, as toasts normally show up. It only
|
|
910
|
+
* provides the toast look and feel, but you are responsible for positioning it as you want.
|
|
911
|
+
*
|
|
912
|
+
* @see useToasts
|
|
913
|
+
*/
|
|
914
|
+
|
|
915
|
+
const StaticToast = /*#__PURE__*/React__default.forwardRef(function Toast(_ref, ref) {
|
|
904
916
|
let {
|
|
905
|
-
|
|
906
|
-
|
|
917
|
+
message,
|
|
918
|
+
description,
|
|
919
|
+
icon,
|
|
920
|
+
action,
|
|
921
|
+
onDismiss,
|
|
922
|
+
dismissLabel = 'Close'
|
|
923
|
+
} = _ref,
|
|
924
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
925
|
+
|
|
926
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2({
|
|
927
|
+
ref: ref,
|
|
928
|
+
role: "alert",
|
|
929
|
+
"aria-live": "polite",
|
|
930
|
+
borderRadius: "full",
|
|
931
|
+
width: "fitContent",
|
|
932
|
+
background: "toast",
|
|
933
|
+
display: "flex",
|
|
934
|
+
padding: "large",
|
|
935
|
+
alignItems: "center",
|
|
936
|
+
className: modules_d11e18f0.toastContainer
|
|
937
|
+
}, props), icon ? /*#__PURE__*/React__default.createElement(ToastContentSlot, null, icon) : null, /*#__PURE__*/React__default.createElement(Box, {
|
|
938
|
+
flexGrow: 1,
|
|
939
|
+
maxWidth: "small"
|
|
940
|
+
}, description ? /*#__PURE__*/React__default.createElement(Stack, {
|
|
941
|
+
space: "small"
|
|
942
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
943
|
+
weight: "bold"
|
|
944
|
+
}, message, " "), /*#__PURE__*/React__default.createElement(Text, null, description)) : /*#__PURE__*/React__default.createElement(Text, null, message)), action ? /*#__PURE__*/React__default.createElement(ToastContentSlot, null, isActionObject(action) ? /*#__PURE__*/React__default.createElement(Button, {
|
|
945
|
+
variant: "tertiary",
|
|
946
|
+
size: "small",
|
|
947
|
+
onClick: action.onClick
|
|
948
|
+
}, action.label) : action) : null, onDismiss ? /*#__PURE__*/React__default.createElement(ToastContentSlot, null, /*#__PURE__*/React__default.createElement(Button, {
|
|
949
|
+
variant: "quaternary",
|
|
950
|
+
size: "small",
|
|
951
|
+
onClick: onDismiss,
|
|
952
|
+
"aria-label": dismissLabel,
|
|
953
|
+
icon: /*#__PURE__*/React__default.createElement(CloseIcon, null)
|
|
954
|
+
})) : null);
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
function isActionObject(action) {
|
|
958
|
+
return action != null && typeof action === 'object' && 'label' in action && 'onClick' in action && typeof action.label === 'string' && typeof action.onClick === 'function';
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
function ToastContentSlot({
|
|
962
|
+
children
|
|
963
|
+
}) {
|
|
964
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
965
|
+
display: "flex",
|
|
966
|
+
alignItems: "center",
|
|
967
|
+
justifyContent: "center",
|
|
968
|
+
marginX: "-xsmall",
|
|
969
|
+
marginY: "-medium",
|
|
970
|
+
className: modules_d11e18f0.slot
|
|
971
|
+
}, children);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
let uid = 0;
|
|
975
|
+
|
|
976
|
+
function uniqueId() {
|
|
977
|
+
return uid++;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
function generateElementId(prefix) {
|
|
981
|
+
const num = uniqueId();
|
|
982
|
+
return prefix + "-" + num;
|
|
983
|
+
}
|
|
984
|
+
function useId(providedId) {
|
|
985
|
+
const ref = React.useRef(providedId != null ? providedId : null);
|
|
986
|
+
|
|
987
|
+
if (!ref.current) {
|
|
988
|
+
ref.current = generateElementId('element');
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return ref.current;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Adapted with minor changes from https://github.com/seek-oss/braid-design-system/blob/7a5ebccb/packages/braid-design-system/lib/components/useToast/useFlipList.ts
|
|
996
|
+
*
|
|
997
|
+
* MIT License
|
|
998
|
+
*
|
|
999
|
+
* Copyright (c) 2018 SEEK
|
|
1000
|
+
*
|
|
1001
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1002
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1003
|
+
* in the Software without restriction, including without limitation the rights
|
|
1004
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1005
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1006
|
+
* furnished to do so, subject to the following conditions:
|
|
1007
|
+
*
|
|
1008
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
1009
|
+
* copies or substantial portions of the Software.
|
|
1010
|
+
*
|
|
1011
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1012
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1013
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1014
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1015
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1016
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1017
|
+
* SOFTWARE.
|
|
1018
|
+
*/
|
|
1019
|
+
const ANIMATION_TIMEOUT = 400;
|
|
1020
|
+
const ENTRANCE_TRANSITION = 'transform 0.3s ease, opacity 0.3s ease';
|
|
1021
|
+
const EXIT_TRANSITION = 'opacity 0.2s ease';
|
|
1022
|
+
/**
|
|
1023
|
+
* Applies the "from" value of given CSS properties, and also sets a transition CSS property. Then
|
|
1024
|
+
* it waits an animation frame before setting the same CSS properties to the target "to" value. This
|
|
1025
|
+
* triggers the browser to perform the CSS transition on them.
|
|
1026
|
+
*
|
|
1027
|
+
* At the end of the animation, it cleans up, unsetting all the CSS properties (including the
|
|
1028
|
+
* transition), and calls the "done" callback, if given.
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
1031
|
+
function animate({
|
|
1032
|
+
element,
|
|
1033
|
+
transforms,
|
|
1034
|
+
transition,
|
|
1035
|
+
done
|
|
1036
|
+
}) {
|
|
1037
|
+
const fallbackTimeout = setTimeout(() => {
|
|
1038
|
+
done == null ? void 0 : done();
|
|
1039
|
+
}, ANIMATION_TIMEOUT);
|
|
1040
|
+
transforms.forEach(({
|
|
1041
|
+
property,
|
|
1042
|
+
from = ''
|
|
1043
|
+
}) => {
|
|
1044
|
+
element.style.setProperty(property, from);
|
|
1045
|
+
});
|
|
1046
|
+
element.style.setProperty('transition', '');
|
|
1047
|
+
|
|
1048
|
+
function transitionEndHandler(event) {
|
|
1049
|
+
if (event.target !== element) {
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
element.style.setProperty('transition', '');
|
|
1054
|
+
done == null ? void 0 : done();
|
|
1055
|
+
element.removeEventListener('transitionend', transitionEndHandler);
|
|
1056
|
+
clearTimeout(fallbackTimeout);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
element.addEventListener('transitionend', transitionEndHandler); // Call requestAnimationFrame twice to make sure we have a full animation frame at our disposal
|
|
1060
|
+
|
|
1061
|
+
window.requestAnimationFrame(() => {
|
|
1062
|
+
window.requestAnimationFrame(() => {
|
|
1063
|
+
element.style.setProperty('transition', transition);
|
|
1064
|
+
transforms.forEach(({
|
|
1065
|
+
property,
|
|
1066
|
+
to = ''
|
|
1067
|
+
}) => {
|
|
1068
|
+
element.style.setProperty(property, to);
|
|
1069
|
+
});
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Provides the functionality of animating the stacked toasts when they appear and before they
|
|
1075
|
+
* disappear.
|
|
1076
|
+
*
|
|
1077
|
+
* It works by keeping a mapping from toast IDs to the toast elements, and keeping a mapping from
|
|
1078
|
+
* toast IDs to their top position. Then, on every single re-render, it compares the new DOM
|
|
1079
|
+
* situation with the previously stored one in these mappings. With this information, it applies
|
|
1080
|
+
* animations that smoothly transitions between both states.
|
|
1081
|
+
*/
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
function useToastsAnimation() {
|
|
1085
|
+
const refs = React.useMemo(() => new Map(), []);
|
|
1086
|
+
const positions = React.useMemo(() => new Map(), []);
|
|
1087
|
+
React.useLayoutEffect(() => {
|
|
1088
|
+
const animations = [];
|
|
1089
|
+
Array.from(refs.entries()).forEach(([id, element]) => {
|
|
1090
|
+
if (!element) {
|
|
1091
|
+
refs.delete(id);
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
const prevTop = positions.get(id);
|
|
1096
|
+
const {
|
|
1097
|
+
top,
|
|
1098
|
+
height
|
|
1099
|
+
} = element.getBoundingClientRect();
|
|
1100
|
+
|
|
1101
|
+
if (typeof prevTop === 'number' && prevTop !== top) {
|
|
1102
|
+
// Move animation
|
|
1103
|
+
animations.push({
|
|
1104
|
+
element,
|
|
1105
|
+
transition: ENTRANCE_TRANSITION,
|
|
1106
|
+
transforms: [{
|
|
1107
|
+
property: 'transform',
|
|
1108
|
+
from: "translateY(" + (prevTop - top) + "px)"
|
|
1109
|
+
}]
|
|
1110
|
+
});
|
|
1111
|
+
} else if (typeof prevTop !== 'number') {
|
|
1112
|
+
// Enter animation
|
|
1113
|
+
animations.push({
|
|
1114
|
+
element,
|
|
1115
|
+
transition: ENTRANCE_TRANSITION,
|
|
1116
|
+
transforms: [{
|
|
1117
|
+
property: 'transform',
|
|
1118
|
+
from: "translateY(" + height + "px)"
|
|
1119
|
+
}, {
|
|
1120
|
+
property: 'opacity',
|
|
1121
|
+
from: '0'
|
|
1122
|
+
}]
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
positions.set(id, element.getBoundingClientRect().top);
|
|
1127
|
+
});
|
|
1128
|
+
animations.forEach(({
|
|
1129
|
+
element,
|
|
1130
|
+
transforms,
|
|
1131
|
+
transition
|
|
1132
|
+
}) => {
|
|
1133
|
+
animate({
|
|
1134
|
+
element,
|
|
1135
|
+
transforms,
|
|
1136
|
+
transition
|
|
1137
|
+
});
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
const animateRemove = React.useCallback(function animateRemove(id, onAnimationDone) {
|
|
1141
|
+
const element = refs.get(id);
|
|
1142
|
+
|
|
1143
|
+
if (element) {
|
|
1144
|
+
// Removal animation
|
|
1145
|
+
animate({
|
|
1146
|
+
element,
|
|
1147
|
+
transforms: [{
|
|
1148
|
+
property: 'opacity',
|
|
1149
|
+
to: '0'
|
|
1150
|
+
}],
|
|
1151
|
+
transition: EXIT_TRANSITION,
|
|
1152
|
+
done: onAnimationDone
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
}, [refs]);
|
|
1156
|
+
const mappedRef = React.useCallback(id => ref => {
|
|
1157
|
+
refs.set(id, ref);
|
|
1158
|
+
}, [refs]);
|
|
1159
|
+
return {
|
|
1160
|
+
mappedRef,
|
|
1161
|
+
animateRemove
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
const _excluded$d = ["toastId"];
|
|
1166
|
+
/** @private */
|
|
1167
|
+
|
|
1168
|
+
const InternalToast = /*#__PURE__*/React__default.forwardRef(function InternalToast({
|
|
1169
|
+
message,
|
|
1170
|
+
description,
|
|
1171
|
+
icon,
|
|
1172
|
+
action,
|
|
1173
|
+
autoDismissDelay,
|
|
1174
|
+
dismissLabel,
|
|
1175
|
+
showDismissButton = true,
|
|
1176
|
+
toastId,
|
|
1177
|
+
onDismiss,
|
|
1178
|
+
onRemoveToast
|
|
1179
|
+
}, ref) {
|
|
1180
|
+
const [timeoutRunning, setTimeoutRunning] = React__default.useState(Boolean(autoDismissDelay));
|
|
1181
|
+
const timeoutRef = React__default.useRef();
|
|
1182
|
+
const startTimeout = React__default.useCallback(function startTimeout() {
|
|
1183
|
+
setTimeoutRunning(true);
|
|
1184
|
+
}, []);
|
|
1185
|
+
const stopTimeout = React__default.useCallback(function stopTimeout() {
|
|
1186
|
+
setTimeoutRunning(false);
|
|
1187
|
+
clearTimeout(timeoutRef.current);
|
|
1188
|
+
timeoutRef.current = undefined;
|
|
1189
|
+
}, []);
|
|
1190
|
+
React__default.useEffect(function setupAutoDismiss() {
|
|
1191
|
+
if (!timeoutRunning || !autoDismissDelay) return;
|
|
1192
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
1193
|
+
onRemoveToast(toastId);
|
|
1194
|
+
onDismiss == null ? void 0 : onDismiss();
|
|
1195
|
+
}, autoDismissDelay * 1000);
|
|
1196
|
+
return stopTimeout;
|
|
1197
|
+
}, [autoDismissDelay, onDismiss, onRemoveToast, toastId, stopTimeout, timeoutRunning]);
|
|
1198
|
+
return /*#__PURE__*/React__default.createElement(StaticToast, {
|
|
1199
|
+
ref: ref,
|
|
1200
|
+
message: message,
|
|
1201
|
+
description: description,
|
|
1202
|
+
icon: icon,
|
|
1203
|
+
action: action,
|
|
1204
|
+
onDismiss: showDismissButton ? () => {
|
|
1205
|
+
onDismiss == null ? void 0 : onDismiss();
|
|
1206
|
+
onRemoveToast(toastId);
|
|
1207
|
+
} : undefined,
|
|
1208
|
+
dismissLabel: dismissLabel,
|
|
1209
|
+
// @ts-expect-error
|
|
1210
|
+
onMouseEnter: stopTimeout,
|
|
1211
|
+
onMouseLeave: startTimeout
|
|
1212
|
+
});
|
|
1213
|
+
});
|
|
1214
|
+
const ToastsContext = /*#__PURE__*/React__default.createContext(() => () => undefined);
|
|
1215
|
+
/**
|
|
1216
|
+
* Provides the state management and rendering of the toasts currently active.
|
|
1217
|
+
*
|
|
1218
|
+
* You need to render this near the top of your app components tree, in order to `useToasts`.
|
|
1219
|
+
*
|
|
1220
|
+
* @see useToasts
|
|
1221
|
+
*/
|
|
1222
|
+
|
|
1223
|
+
function ToastsProvider({
|
|
1224
|
+
children,
|
|
1225
|
+
padding = 'large',
|
|
1226
|
+
defaultAutoDismissDelay = 10
|
|
1227
|
+
/* seconds */
|
|
1228
|
+
,
|
|
1229
|
+
defaultDismissLabel = 'Close'
|
|
1230
|
+
}) {
|
|
1231
|
+
const [toasts, setToasts] = React__default.useState([]);
|
|
1232
|
+
const {
|
|
1233
|
+
mappedRef,
|
|
1234
|
+
animateRemove
|
|
1235
|
+
} = useToastsAnimation();
|
|
1236
|
+
const removeToast = React__default.useCallback(function onRemoveToast(toastId) {
|
|
1237
|
+
animateRemove(toastId, () => {
|
|
1238
|
+
setToasts(list => {
|
|
1239
|
+
const index = list.findIndex(n => n.toastId === toastId);
|
|
1240
|
+
if (index < 0) return list;
|
|
1241
|
+
const copy = [...list];
|
|
1242
|
+
copy.splice(index, 1);
|
|
1243
|
+
return copy;
|
|
1244
|
+
});
|
|
1245
|
+
});
|
|
1246
|
+
}, [animateRemove]);
|
|
1247
|
+
const showToast = React__default.useCallback(function showToast(props) {
|
|
1248
|
+
const toastId = generateElementId('toast');
|
|
1249
|
+
|
|
1250
|
+
const newToast = _objectSpread2(_objectSpread2({
|
|
1251
|
+
autoDismissDelay: defaultAutoDismissDelay,
|
|
1252
|
+
dismissLabel: defaultDismissLabel
|
|
1253
|
+
}, props), {}, {
|
|
1254
|
+
toastId
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
setToasts(list => [...list, newToast]);
|
|
1258
|
+
return () => removeToast(toastId);
|
|
1259
|
+
}, [defaultAutoDismissDelay, defaultDismissLabel, removeToast]);
|
|
1260
|
+
return /*#__PURE__*/React__default.createElement(ToastsContext.Provider, {
|
|
1261
|
+
value: showToast
|
|
1262
|
+
}, children, /*#__PURE__*/React__default.createElement(portal.Portal, null, toasts.length === 0 ? null : /*#__PURE__*/React__default.createElement(Box, {
|
|
1263
|
+
className: modules_d11e18f0.stackedToastsView,
|
|
1264
|
+
position: "fixed",
|
|
1265
|
+
width: "full",
|
|
1266
|
+
paddingX: padding,
|
|
1267
|
+
paddingBottom: padding
|
|
1268
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
1269
|
+
space: "medium"
|
|
1270
|
+
}, toasts.map(_ref => {
|
|
1271
|
+
let {
|
|
1272
|
+
toastId
|
|
1273
|
+
} = _ref,
|
|
1274
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
1275
|
+
|
|
1276
|
+
return /*#__PURE__*/React__default.createElement(InternalToast, _objectSpread2({
|
|
1277
|
+
key: toastId,
|
|
1278
|
+
ref: mappedRef(toastId),
|
|
1279
|
+
toastId: toastId,
|
|
1280
|
+
onRemoveToast: removeToast
|
|
1281
|
+
}, props));
|
|
1282
|
+
})))));
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Provides a function `showToast` that shows a new toast every time you call it.
|
|
1286
|
+
*
|
|
1287
|
+
* ```jsx
|
|
1288
|
+
* const showToast = useToasts()
|
|
1289
|
+
*
|
|
1290
|
+
* <button onClick={() => showToast({ message: 'Hello' })}>
|
|
1291
|
+
* Say hello
|
|
1292
|
+
* </button>
|
|
1293
|
+
* ```
|
|
1294
|
+
*
|
|
1295
|
+
* All toasts fired via this function are rendered in a global fixed location, and stacked one on
|
|
1296
|
+
* top of the other.
|
|
1297
|
+
*
|
|
1298
|
+
* When called, `showToast` returns a function that dismisses the toast when called.
|
|
1299
|
+
*
|
|
1300
|
+
* @see ToastsProvider
|
|
1301
|
+
*/
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
function useToasts() {
|
|
1305
|
+
return React__default.useContext(ToastsContext);
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Adds a toast to be rendered, stacked alongside any other currently active toasts.
|
|
1309
|
+
*
|
|
1310
|
+
* For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.
|
|
1311
|
+
* This component is provided for convenience to render toasts in the markup, but it has some
|
|
1312
|
+
* peculiarities, which are discussed below.
|
|
1313
|
+
*
|
|
1314
|
+
* Internally, this calls `showToast`. It is provided for two reasons:
|
|
1315
|
+
*
|
|
1316
|
+
* 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that
|
|
1317
|
+
* toasts rendered in this way will be removed from view when the context where it is rendered
|
|
1318
|
+
* is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either
|
|
1319
|
+
* by the user or after a delay. They'll still be animated on their way out, though.
|
|
1320
|
+
* 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and
|
|
1321
|
+
* `autoDismissDelay={false}` it provides a way to show "permanent" toasts that only go away when
|
|
1322
|
+
* the component ceases to be rendered).
|
|
1323
|
+
*
|
|
1324
|
+
* This is useful for cases when the consumer wants to control when a toast is visible, and to keep
|
|
1325
|
+
* it visible based on an app-specific condition.
|
|
1326
|
+
*
|
|
1327
|
+
* Something important to note about this component is that it triggers the toast based on the props
|
|
1328
|
+
* passed when first rendered, and it does not update the toast if these props change on subsequent
|
|
1329
|
+
* renders. In this sense, this is an imperative component, more than a descriptive one. This is
|
|
1330
|
+
* done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a
|
|
1331
|
+
* toast imperatively, and you loose control over it. It remains rendered according to the props you
|
|
1332
|
+
* first passed.
|
|
1333
|
+
*
|
|
1334
|
+
* @see useToasts
|
|
1335
|
+
*/
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
function Toast(props) {
|
|
1339
|
+
const showToast = useToasts();
|
|
1340
|
+
const propsRef = React__default.useRef(props);
|
|
1341
|
+
React__default.useEffect(() => {
|
|
1342
|
+
const dismissToast = showToast(propsRef.current);
|
|
1343
|
+
return dismissToast;
|
|
1344
|
+
}, [showToast]);
|
|
1345
|
+
return null;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
var modules_949d2ff4 = {"heading":"_71a1610c","weight-light":"_63750f40","tone-secondary":"_9ce984cf","tone-danger":"_1acad35e","size-largest":"_3da27a00","size-larger":"df220733","size-smaller":"eb373739","lineClampMultipleLines":"f53cfd2b","lineClamp-1":"e4819fc9","lineClamp-2":"a0ed6177","lineClamp-3":"_180d433e","lineClamp-4":"_40826ad9","lineClamp-5":"_5999b247"};
|
|
1349
|
+
|
|
1350
|
+
const _excluded$e = ["level", "weight", "size", "tone", "children", "lineClamp", "align", "exceptionallySetClassName"];
|
|
1351
|
+
const Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
|
|
1352
|
+
let {
|
|
1353
|
+
level,
|
|
907
1354
|
weight = 'regular',
|
|
1355
|
+
size,
|
|
908
1356
|
tone = 'normal',
|
|
909
|
-
align,
|
|
910
1357
|
children,
|
|
911
1358
|
lineClamp,
|
|
1359
|
+
align,
|
|
912
1360
|
exceptionallySetClassName
|
|
913
1361
|
} = _ref,
|
|
914
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1362
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
915
1363
|
|
|
916
|
-
|
|
1364
|
+
// In TypeScript v4.1, this would be properly recognized without needing the type assertion
|
|
1365
|
+
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types
|
|
1366
|
+
const headingElementName = "h" + level;
|
|
1367
|
+
const lineClampMultipleLines = typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1;
|
|
917
1368
|
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
918
|
-
|
|
919
|
-
className: [exceptionallySetClassName, modules_a9637dd3.text, size !== 'body' ? getClassNames(modules_a9637dd3, 'size', size) : null, weight !== 'regular' ? getClassNames(modules_a9637dd3, 'weight', weight) : null, tone !== 'normal' ? getClassNames(modules_a9637dd3, 'tone', tone) : null, lineClampMultipleLines ? modules_a9637dd3.lineClampMultipleLines : null, lineClamp ? getClassNames(modules_a9637dd3, 'lineClamp', lineClamp.toString()) : null],
|
|
1369
|
+
className: [exceptionallySetClassName, modules_949d2ff4.heading, weight !== 'regular' ? getClassNames(modules_949d2ff4, 'weight', weight) : null, tone !== 'normal' ? getClassNames(modules_949d2ff4, 'tone', tone) : null, getClassNames(modules_949d2ff4, 'size', size), lineClampMultipleLines ? modules_949d2ff4.lineClampMultipleLines : null, lineClamp ? getClassNames(modules_949d2ff4, 'lineClamp', lineClamp.toString()) : null],
|
|
920
1370
|
textAlign: align,
|
|
921
1371
|
// Prevents emojis from being cut-off
|
|
922
1372
|
// See https://github.com/Doist/reactist/pull/528
|
|
923
1373
|
paddingRight: lineClamp ? 'xsmall' : undefined,
|
|
1374
|
+
as: headingElementName,
|
|
924
1375
|
ref: ref
|
|
925
1376
|
}), children);
|
|
926
1377
|
});
|
|
927
1378
|
|
|
928
|
-
const _excluded$
|
|
1379
|
+
const _excluded$f = ["as", "variant", "tone", "size", "exceptionallySetClassName", "openInNewTab"];
|
|
929
1380
|
/**
|
|
930
1381
|
* A semantic link that looks like a button, exactly matching the `Button` component in all visual
|
|
931
1382
|
* aspects.
|
|
@@ -942,7 +1393,7 @@ const ButtonLink = /*#__PURE__*/polymorphicComponent(function ButtonLink(_ref, r
|
|
|
942
1393
|
exceptionallySetClassName,
|
|
943
1394
|
openInNewTab = false
|
|
944
1395
|
} = _ref,
|
|
945
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1396
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
946
1397
|
|
|
947
1398
|
return /*#__PURE__*/React.createElement(BaseButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
948
1399
|
as: as,
|
|
@@ -958,14 +1409,14 @@ const ButtonLink = /*#__PURE__*/polymorphicComponent(function ButtonLink(_ref, r
|
|
|
958
1409
|
|
|
959
1410
|
var modules_3d05deee = {"container":"_232127ef"};
|
|
960
1411
|
|
|
961
|
-
const _excluded$
|
|
1412
|
+
const _excluded$g = ["as", "openInNewTab", "exceptionallySetClassName"];
|
|
962
1413
|
const TextLink = /*#__PURE__*/polymorphicComponent(function TextLink(_ref, ref) {
|
|
963
1414
|
let {
|
|
964
1415
|
as = 'a',
|
|
965
1416
|
openInNewTab = false,
|
|
966
1417
|
exceptionallySetClassName
|
|
967
1418
|
} = _ref,
|
|
968
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1419
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
969
1420
|
|
|
970
1421
|
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
971
1422
|
as: as,
|
|
@@ -977,7 +1428,7 @@ const TextLink = /*#__PURE__*/polymorphicComponent(function TextLink(_ref, ref)
|
|
|
977
1428
|
}));
|
|
978
1429
|
});
|
|
979
1430
|
|
|
980
|
-
const _excluded$
|
|
1431
|
+
const _excluded$h = ["checked", "indeterminate", "disabled"];
|
|
981
1432
|
const svgPath = {
|
|
982
1433
|
checked: 'M18 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12zm-2.457 4.293l-5.293 5.293-1.793-1.793a1 1 0 1 0-1.414 1.414l2.5 2.5a1 1 0 0 0 1.414 0l6-6a1 1 0 1 0-1.414-1.414z',
|
|
983
1434
|
unchecked: 'M18 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12zm0 1H6a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1z',
|
|
@@ -1016,7 +1467,7 @@ function CheckboxIcon(_ref) {
|
|
|
1016
1467
|
indeterminate,
|
|
1017
1468
|
disabled
|
|
1018
1469
|
} = _ref,
|
|
1019
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1470
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
1020
1471
|
|
|
1021
1472
|
const pathKey = getPathKey({
|
|
1022
1473
|
checked,
|
|
@@ -1037,7 +1488,7 @@ function CheckboxIcon(_ref) {
|
|
|
1037
1488
|
|
|
1038
1489
|
var modules_664a6a80 = {"container":"_96c4d12f","disabled":"_5048e2a5","checked":"_42187b48","keyFocused":"_3510166f"};
|
|
1039
1490
|
|
|
1040
|
-
const _excluded$
|
|
1491
|
+
const _excluded$i = ["label", "disabled", "indeterminate", "defaultChecked", "onChange"];
|
|
1041
1492
|
const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, ref) {
|
|
1042
1493
|
var _ref2, _props$checked, _props$checked2;
|
|
1043
1494
|
|
|
@@ -1048,7 +1499,7 @@ const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref,
|
|
|
1048
1499
|
defaultChecked,
|
|
1049
1500
|
onChange
|
|
1050
1501
|
} = _ref,
|
|
1051
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1502
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
|
1052
1503
|
|
|
1053
1504
|
const isControlledComponent = typeof props.checked === 'boolean';
|
|
1054
1505
|
|
|
@@ -1107,26 +1558,6 @@ const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref,
|
|
|
1107
1558
|
}), label ? /*#__PURE__*/React.createElement(Text, null, label) : null);
|
|
1108
1559
|
});
|
|
1109
1560
|
|
|
1110
|
-
let uid = 0;
|
|
1111
|
-
|
|
1112
|
-
function uniqueId() {
|
|
1113
|
-
return uid++;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
function generateElementId(prefix) {
|
|
1117
|
-
const num = uniqueId();
|
|
1118
|
-
return prefix + "-" + num;
|
|
1119
|
-
}
|
|
1120
|
-
function useId(providedId) {
|
|
1121
|
-
const ref = React.useRef(providedId != null ? providedId : null);
|
|
1122
|
-
|
|
1123
|
-
if (!ref.current) {
|
|
1124
|
-
ref.current = generateElementId('element');
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
return ref.current;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
1561
|
var modules_540a88ff = {"container":"_2e189908","auxiliaryLabel":"_83051e0a","bordered":"fd20ef50","error":"d1a17d92","primaryLabel":"_75e0afa0","secondaryLabel":"d04a867d","messageIcon":"_77b2107e"};
|
|
1131
1562
|
|
|
1132
1563
|
function FieldHint(props) {
|
|
@@ -1276,7 +1707,7 @@ var modules_3f03ead6 = {"inputWrapper":"_66b448b3"};
|
|
|
1276
1707
|
|
|
1277
1708
|
var modules_aaf25250 = {"inputWrapper":"_9d172ece","bordered":"c59d0239","error":"_7e63ee20"};
|
|
1278
1709
|
|
|
1279
|
-
const _excluded$
|
|
1710
|
+
const _excluded$j = ["variant", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
|
|
1280
1711
|
const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, ref) {
|
|
1281
1712
|
let {
|
|
1282
1713
|
variant = 'default',
|
|
@@ -1291,7 +1722,7 @@ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref,
|
|
|
1291
1722
|
hidden,
|
|
1292
1723
|
'aria-describedby': ariaDescribedBy
|
|
1293
1724
|
} = _ref,
|
|
1294
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1725
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
1295
1726
|
|
|
1296
1727
|
const id = useId(props.id);
|
|
1297
1728
|
const internalRef = React.useRef(null);
|
|
@@ -1340,7 +1771,7 @@ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref,
|
|
|
1340
1771
|
|
|
1341
1772
|
var modules_1fa9b208 = {"selectWrapper":"_07e75293","error":"f147bcea"};
|
|
1342
1773
|
|
|
1343
|
-
const _excluded$
|
|
1774
|
+
const _excluded$k = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "children", "hidden", "aria-describedby"];
|
|
1344
1775
|
const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref) {
|
|
1345
1776
|
let {
|
|
1346
1777
|
id,
|
|
@@ -1355,7 +1786,7 @@ const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref
|
|
|
1355
1786
|
hidden,
|
|
1356
1787
|
'aria-describedby': ariaDescribedBy
|
|
1357
1788
|
} = _ref,
|
|
1358
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1789
|
+
props = _objectWithoutProperties(_ref, _excluded$k);
|
|
1359
1790
|
|
|
1360
1791
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1361
1792
|
id: id,
|
|
@@ -1391,7 +1822,7 @@ function SelectChevron(props) {
|
|
|
1391
1822
|
|
|
1392
1823
|
var modules_8e05f7c9 = {"container":"ec63c3f1","disabled":"_7de9c06d","checked":"a37981fc","toggle":"_2a17ac45","label":"_68cc9707","handle":"_91409c7f","keyFocused":"a6490371"};
|
|
1393
1824
|
|
|
1394
|
-
const _excluded$
|
|
1825
|
+
const _excluded$l = ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "aria-label", "aria-labelledby", "onChange"];
|
|
1395
1826
|
const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref) {
|
|
1396
1827
|
var _ref2, _props$checked, _props$checked2;
|
|
1397
1828
|
|
|
@@ -1407,7 +1838,7 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
|
|
|
1407
1838
|
'aria-labelledby': originalAriaLabelledby,
|
|
1408
1839
|
onChange
|
|
1409
1840
|
} = _ref,
|
|
1410
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1841
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
1411
1842
|
|
|
1412
1843
|
const id = useId(originalId);
|
|
1413
1844
|
const hintId = useId();
|
|
@@ -1467,7 +1898,7 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
|
|
|
1467
1898
|
|
|
1468
1899
|
var modules_2728c236 = {"textAreaContainer":"_61447829","bordered":"_76f4ad88","error":"_4df3452b"};
|
|
1469
1900
|
|
|
1470
|
-
const _excluded$
|
|
1901
|
+
const _excluded$m = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "hidden", "aria-describedby"];
|
|
1471
1902
|
|
|
1472
1903
|
function TextArea(_ref) {
|
|
1473
1904
|
let {
|
|
@@ -1483,7 +1914,7 @@ function TextArea(_ref) {
|
|
|
1483
1914
|
hidden,
|
|
1484
1915
|
'aria-describedby': ariaDescribedBy
|
|
1485
1916
|
} = _ref,
|
|
1486
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1917
|
+
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
1487
1918
|
|
|
1488
1919
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1489
1920
|
variant: variant,
|
|
@@ -1504,7 +1935,7 @@ function TextArea(_ref) {
|
|
|
1504
1935
|
}, /*#__PURE__*/React.createElement("textarea", _objectSpread2(_objectSpread2({}, props), extraProps))));
|
|
1505
1936
|
}
|
|
1506
1937
|
|
|
1507
|
-
const _excluded$
|
|
1938
|
+
const _excluded$n = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "type", "maxWidth", "hidden", "aria-describedby"];
|
|
1508
1939
|
const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
1509
1940
|
let {
|
|
1510
1941
|
variant = 'default',
|
|
@@ -1520,7 +1951,7 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
|
1520
1951
|
hidden,
|
|
1521
1952
|
'aria-describedby': ariaDescribedBy
|
|
1522
1953
|
} = _ref,
|
|
1523
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1954
|
+
props = _objectWithoutProperties(_ref, _excluded$n);
|
|
1524
1955
|
|
|
1525
1956
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1526
1957
|
variant: variant,
|
|
@@ -1571,7 +2002,7 @@ function emailToIndex(email, maxIndex) {
|
|
|
1571
2002
|
|
|
1572
2003
|
var modules_08f3eeac = {"avatar":"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
|
|
1573
2004
|
|
|
1574
|
-
const _excluded$
|
|
2005
|
+
const _excluded$o = ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"];
|
|
1575
2006
|
const AVATAR_COLORS = ['#fcc652', '#e9952c', '#e16b2d', '#d84b40', '#e8435a', '#e5198a', '#ad3889', '#86389c', '#a8a8a8', '#98be2f', '#5d9d50', '#5f9f85', '#5bbcb6', '#32a3bf', '#2bafeb', '#2d88c3', '#3863cc', '#5e5e5e'];
|
|
1576
2007
|
|
|
1577
2008
|
function Avatar(_ref) {
|
|
@@ -1583,7 +2014,7 @@ function Avatar(_ref) {
|
|
|
1583
2014
|
colorList = AVATAR_COLORS,
|
|
1584
2015
|
exceptionallySetClassName
|
|
1585
2016
|
} = _ref,
|
|
1586
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2017
|
+
props = _objectWithoutProperties(_ref, _excluded$o);
|
|
1587
2018
|
|
|
1588
2019
|
const userInitials = getInitials(user.name) || getInitials(user.email);
|
|
1589
2020
|
const avatarSize = size ? size : 'l';
|
|
@@ -1595,7 +2026,7 @@ function Avatar(_ref) {
|
|
|
1595
2026
|
backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
|
|
1596
2027
|
};
|
|
1597
2028
|
const sizeClassName = getClassNames(modules_08f3eeac, 'size', avatarSize);
|
|
1598
|
-
return /*#__PURE__*/
|
|
2029
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2({
|
|
1599
2030
|
className: [className, modules_08f3eeac.avatar, sizeClassName, exceptionallySetClassName],
|
|
1600
2031
|
style: style
|
|
1601
2032
|
}, props), userInitials);
|
|
@@ -1603,9 +2034,26 @@ function Avatar(_ref) {
|
|
|
1603
2034
|
|
|
1604
2035
|
Avatar.displayName = 'Avatar';
|
|
1605
2036
|
|
|
2037
|
+
var modules_33c7c985 = {"badge":"d05d2b62","badge-neutral":"a14691f3","badge-positive":"_4e255fdb","badge-color":"a58624e2"};
|
|
2038
|
+
|
|
2039
|
+
const _excluded$p = ["variant", "children"];
|
|
2040
|
+
|
|
2041
|
+
function Badge(_ref) {
|
|
2042
|
+
let {
|
|
2043
|
+
variant = 'neutral',
|
|
2044
|
+
children
|
|
2045
|
+
} = _ref,
|
|
2046
|
+
rest = _objectWithoutProperties(_ref, _excluded$p);
|
|
2047
|
+
|
|
2048
|
+
const variantClassName = modules_33c7c985["badge-" + variant];
|
|
2049
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
2050
|
+
className: [modules_33c7c985.badge, variantClassName]
|
|
2051
|
+
}), children);
|
|
2052
|
+
}
|
|
2053
|
+
|
|
1606
2054
|
var modules_8f59d13b = {"overlay":"_868392ae","fadein":"_63d7ee15","fitContent":"b8548bf2","container":"_31956461","full":"_1007df83","large":"_10c275aa","medium":"_0ac526b4","small":"_30f38fdb","xlarge":"_54868e8b","expand":"c0bc68bc","buttonContainer":"_6527332a","headerContent":"_4750dc1b"};
|
|
1607
2055
|
|
|
1608
|
-
const _excluded$
|
|
2056
|
+
const _excluded$q = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
1609
2057
|
_excluded2$1 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
1610
2058
|
_excluded3 = ["exceptionallySetClassName", "children"],
|
|
1611
2059
|
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
@@ -1639,7 +2087,7 @@ function Modal(_ref) {
|
|
|
1639
2087
|
autoFocus = true,
|
|
1640
2088
|
children
|
|
1641
2089
|
} = _ref,
|
|
1642
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2090
|
+
props = _objectWithoutProperties(_ref, _excluded$q);
|
|
1643
2091
|
|
|
1644
2092
|
const setVisible = React.useCallback(visible => {
|
|
1645
2093
|
if (!visible) {
|
|
@@ -1883,7 +2331,7 @@ function usePrevious(value) {
|
|
|
1883
2331
|
|
|
1884
2332
|
var modules_40c67f5b = {"tab":"a1064a3b","track":"_06f1b8a1","tab-neutral":"dabbec7d","tab-themed":"e6f5ae4e","track-neutral":"_43913ce5","track-themed":"_39bdfdde","track-xsmall":"_1c148f4e","track-small":"_2a370df5","track-medium":"_77430437","track-large":"_33db5352","track-xlarge":"_60bf9564","track-xxlarge":"_29a35080"};
|
|
1885
2333
|
|
|
1886
|
-
const _excluded$
|
|
2334
|
+
const _excluded$r = ["as", "children", "id", "exceptionallySetClassName"],
|
|
1887
2335
|
_excluded2$2 = ["children", "space"],
|
|
1888
2336
|
_excluded3$1 = ["children", "id", "as", "render"];
|
|
1889
2337
|
const TabsContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -1933,7 +2381,7 @@ const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
|
|
|
1933
2381
|
id,
|
|
1934
2382
|
exceptionallySetClassName
|
|
1935
2383
|
} = _ref,
|
|
1936
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2384
|
+
props = _objectWithoutProperties(_ref, _excluded$r);
|
|
1937
2385
|
|
|
1938
2386
|
const tabContextValue = React.useContext(TabsContext);
|
|
1939
2387
|
|
|
@@ -2042,12 +2490,12 @@ function TabAwareSlot({
|
|
|
2042
2490
|
}) : null;
|
|
2043
2491
|
}
|
|
2044
2492
|
|
|
2045
|
-
const _excluded$
|
|
2493
|
+
const _excluded$s = ["type", "variant", "size", "loading", "disabled", "tooltip", "onClick", "children"];
|
|
2046
2494
|
/**
|
|
2047
2495
|
* @deprecated
|
|
2048
2496
|
*/
|
|
2049
2497
|
|
|
2050
|
-
const Button$1 = /*#__PURE__*/
|
|
2498
|
+
const Button$1 = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
2051
2499
|
let {
|
|
2052
2500
|
type = 'button',
|
|
2053
2501
|
variant,
|
|
@@ -2058,19 +2506,19 @@ const Button$1 = /*#__PURE__*/React__default.forwardRef(function Button(_ref, re
|
|
|
2058
2506
|
onClick,
|
|
2059
2507
|
children
|
|
2060
2508
|
} = _ref,
|
|
2061
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2509
|
+
props = _objectWithoutProperties(_ref, _excluded$s);
|
|
2062
2510
|
|
|
2063
2511
|
const className = classNames('reactist_button', variant ? "reactist_button--" + variant : null, size !== 'default' ? "reactist_button--" + size : null, {
|
|
2064
2512
|
'reactist_button--loading': loading
|
|
2065
2513
|
}, props.className);
|
|
2066
|
-
const button = /*#__PURE__*/
|
|
2514
|
+
const button = /*#__PURE__*/React.createElement("button", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2067
2515
|
ref: ref,
|
|
2068
2516
|
type: type,
|
|
2069
2517
|
className: className,
|
|
2070
2518
|
"aria-disabled": disabled || loading,
|
|
2071
2519
|
onClick: disabled || loading ? undefined : onClick
|
|
2072
2520
|
}), children);
|
|
2073
|
-
return tooltip ? /*#__PURE__*/
|
|
2521
|
+
return tooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
2074
2522
|
content: tooltip
|
|
2075
2523
|
}, button) : button;
|
|
2076
2524
|
});
|
|
@@ -2081,9 +2529,9 @@ Button$1.defaultProps = {
|
|
|
2081
2529
|
disabled: false
|
|
2082
2530
|
};
|
|
2083
2531
|
|
|
2084
|
-
const _excluded$
|
|
2532
|
+
const _excluded$t = ["children", "onClick", "tooltip", "className"];
|
|
2085
2533
|
|
|
2086
|
-
class Box$1 extends
|
|
2534
|
+
class Box$1 extends React.Component {
|
|
2087
2535
|
constructor(props, context) {
|
|
2088
2536
|
super(props, context);
|
|
2089
2537
|
this._timeout = void 0;
|
|
@@ -2170,7 +2618,7 @@ class Box$1 extends React__default.Component {
|
|
|
2170
2618
|
|
|
2171
2619
|
const _trigger = (_this$props$children = this.props.children) == null ? void 0 : _this$props$children[0];
|
|
2172
2620
|
|
|
2173
|
-
return _trigger ? /*#__PURE__*/
|
|
2621
|
+
return _trigger ? /*#__PURE__*/React.cloneElement(_trigger, {
|
|
2174
2622
|
onClick: this._toggleShowBody
|
|
2175
2623
|
}) : undefined;
|
|
2176
2624
|
} // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components
|
|
@@ -2200,8 +2648,8 @@ class Box$1 extends React__default.Component {
|
|
|
2200
2648
|
bottom: !top
|
|
2201
2649
|
});
|
|
2202
2650
|
const body = children == null ? void 0 : children[1];
|
|
2203
|
-
const contentMarkup = typeof body === 'function' ? body(props) : body ? /*#__PURE__*/
|
|
2204
|
-
return /*#__PURE__*/
|
|
2651
|
+
const contentMarkup = typeof body === 'function' ? body(props) : body ? /*#__PURE__*/React.cloneElement(body, props) : undefined;
|
|
2652
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2205
2653
|
className: className,
|
|
2206
2654
|
style: {
|
|
2207
2655
|
position: 'relative'
|
|
@@ -2214,7 +2662,7 @@ class Box$1 extends React__default.Component {
|
|
|
2214
2662
|
const {
|
|
2215
2663
|
top
|
|
2216
2664
|
} = this.state;
|
|
2217
|
-
return /*#__PURE__*/
|
|
2665
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2218
2666
|
style: {
|
|
2219
2667
|
display: 'inline-block'
|
|
2220
2668
|
},
|
|
@@ -2227,14 +2675,14 @@ class Box$1 extends React__default.Component {
|
|
|
2227
2675
|
|
|
2228
2676
|
Box$1.displayName = void 0;
|
|
2229
2677
|
Box$1.displayName = 'Dropdown.Box';
|
|
2230
|
-
const Trigger = /*#__PURE__*/
|
|
2678
|
+
const Trigger = /*#__PURE__*/React.forwardRef(function Trigger(_ref, ref) {
|
|
2231
2679
|
let {
|
|
2232
2680
|
children,
|
|
2233
2681
|
onClick,
|
|
2234
2682
|
tooltip,
|
|
2235
2683
|
className
|
|
2236
2684
|
} = _ref,
|
|
2237
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2685
|
+
props = _objectWithoutProperties(_ref, _excluded$t);
|
|
2238
2686
|
|
|
2239
2687
|
function handleClick(event) {
|
|
2240
2688
|
event.preventDefault();
|
|
@@ -2242,7 +2690,7 @@ const Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, re
|
|
|
2242
2690
|
if (onClick) onClick(event);
|
|
2243
2691
|
}
|
|
2244
2692
|
|
|
2245
|
-
return /*#__PURE__*/
|
|
2693
|
+
return /*#__PURE__*/React.createElement(Button$1, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2246
2694
|
className: classNames('trigger', className),
|
|
2247
2695
|
onClick: handleClick,
|
|
2248
2696
|
tooltip: tooltip,
|
|
@@ -2273,7 +2721,7 @@ function Body({
|
|
|
2273
2721
|
style.left = 0;
|
|
2274
2722
|
}
|
|
2275
2723
|
|
|
2276
|
-
return /*#__PURE__*/
|
|
2724
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2277
2725
|
ref: setPosition,
|
|
2278
2726
|
style: style,
|
|
2279
2727
|
className: "body",
|
|
@@ -2304,26 +2752,26 @@ function ColorPicker({
|
|
|
2304
2752
|
onChange,
|
|
2305
2753
|
colorList = COLORS
|
|
2306
2754
|
}) {
|
|
2307
|
-
return /*#__PURE__*/
|
|
2755
|
+
return /*#__PURE__*/React.createElement(Dropdown.Box, {
|
|
2308
2756
|
right: true,
|
|
2309
2757
|
className: "reactist_color_picker"
|
|
2310
|
-
}, /*#__PURE__*/
|
|
2758
|
+
}, /*#__PURE__*/React.createElement(Dropdown.Trigger, null, (() => {
|
|
2311
2759
|
const backgroundColor = _getColor(colorList, color);
|
|
2312
2760
|
|
|
2313
|
-
return /*#__PURE__*/
|
|
2761
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
2314
2762
|
className: classNames('color_trigger', {
|
|
2315
2763
|
small
|
|
2316
2764
|
}),
|
|
2317
2765
|
style: {
|
|
2318
2766
|
backgroundColor: _isNamedColor(backgroundColor) ? backgroundColor.color : backgroundColor
|
|
2319
2767
|
}
|
|
2320
|
-
}, /*#__PURE__*/
|
|
2768
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
2321
2769
|
className: "color_trigger--inner_ring"
|
|
2322
2770
|
}));
|
|
2323
|
-
})()), /*#__PURE__*/
|
|
2771
|
+
})()), /*#__PURE__*/React.createElement(Dropdown.Body, null, /*#__PURE__*/React.createElement("div", {
|
|
2324
2772
|
className: "color_options"
|
|
2325
2773
|
}, colorList.reduce((items, currentColor, currentIndex) => {
|
|
2326
|
-
items.push( /*#__PURE__*/
|
|
2774
|
+
items.push( /*#__PURE__*/React.createElement(ColorItem, {
|
|
2327
2775
|
isActive: color >= colorList.length ? currentIndex === 0 : currentIndex === color,
|
|
2328
2776
|
key: currentIndex,
|
|
2329
2777
|
color: _isNamedColor(currentColor) ? currentColor.color : currentColor,
|
|
@@ -2344,24 +2792,24 @@ function ColorItem({
|
|
|
2344
2792
|
onClick,
|
|
2345
2793
|
tooltip
|
|
2346
2794
|
}) {
|
|
2347
|
-
const item = /*#__PURE__*/
|
|
2795
|
+
const item = /*#__PURE__*/React.createElement("span", {
|
|
2348
2796
|
"data-testid": "reactist-color-item",
|
|
2349
2797
|
className: 'reactist color_item' + (isActive ? ' active' : ''),
|
|
2350
2798
|
style: {
|
|
2351
2799
|
backgroundColor: color
|
|
2352
2800
|
},
|
|
2353
2801
|
onClick: () => onClick == null ? void 0 : onClick(colorIndex)
|
|
2354
|
-
}, /*#__PURE__*/
|
|
2802
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
2355
2803
|
className: "color_item--inner_ring"
|
|
2356
2804
|
}));
|
|
2357
|
-
return tooltip ? /*#__PURE__*/
|
|
2805
|
+
return tooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
2358
2806
|
content: tooltip
|
|
2359
2807
|
}, item) : item;
|
|
2360
2808
|
}
|
|
2361
2809
|
|
|
2362
2810
|
ColorItem.displayName = 'ColorItem';
|
|
2363
2811
|
|
|
2364
|
-
const _excluded$
|
|
2812
|
+
const _excluded$u = ["children", "className", "translateKey", "isMac"];
|
|
2365
2813
|
// Support for setting up how to translate modifiers globally.
|
|
2366
2814
|
//
|
|
2367
2815
|
|
|
@@ -2443,7 +2891,7 @@ function KeyboardShortcut(_ref) {
|
|
|
2443
2891
|
translateKey = globalTranslateKey,
|
|
2444
2892
|
isMac = (_navigator$platform$t = (_navigator$platform = navigator.platform) == null ? void 0 : _navigator$platform.toUpperCase().includes('MAC')) != null ? _navigator$platform$t : false
|
|
2445
2893
|
} = _ref,
|
|
2446
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2894
|
+
props = _objectWithoutProperties(_ref, _excluded$u);
|
|
2447
2895
|
|
|
2448
2896
|
const shortcuts = typeof children === 'string' ? [children] : children;
|
|
2449
2897
|
return /*#__PURE__*/React.createElement("span", _objectSpread2({
|
|
@@ -2634,7 +3082,7 @@ function KeyCapturer(props) {
|
|
|
2634
3082
|
}
|
|
2635
3083
|
}
|
|
2636
3084
|
|
|
2637
|
-
return /*#__PURE__*/
|
|
3085
|
+
return /*#__PURE__*/React.cloneElement(children, _objectSpread2({
|
|
2638
3086
|
[eventName]: handleKeyEvent
|
|
2639
3087
|
}, composingEventHandlers));
|
|
2640
3088
|
}
|
|
@@ -2646,14 +3094,14 @@ function ProgressBar({
|
|
|
2646
3094
|
}) {
|
|
2647
3095
|
const finalClassName = classNames('reactist_progress_bar', className);
|
|
2648
3096
|
const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage;
|
|
2649
|
-
return /*#__PURE__*/
|
|
3097
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2650
3098
|
className: finalClassName
|
|
2651
|
-
}, /*#__PURE__*/
|
|
3099
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2652
3100
|
className: "inner",
|
|
2653
3101
|
style: {
|
|
2654
3102
|
width: width + "%"
|
|
2655
3103
|
}
|
|
2656
|
-
}), /*#__PURE__*/
|
|
3104
|
+
}), /*#__PURE__*/React.createElement(HiddenVisually, null, /*#__PURE__*/React.createElement("progress", {
|
|
2657
3105
|
value: width,
|
|
2658
3106
|
max: 100,
|
|
2659
3107
|
"aria-valuetext": ariaValuetext != null ? ariaValuetext : undefined
|
|
@@ -2732,7 +3180,7 @@ const TimeUtils = {
|
|
|
2732
3180
|
|
|
2733
3181
|
const DELAY = 60000;
|
|
2734
3182
|
|
|
2735
|
-
class Time extends
|
|
3183
|
+
class Time extends React.Component {
|
|
2736
3184
|
constructor(props) {
|
|
2737
3185
|
super(props);
|
|
2738
3186
|
this.refreshInterval = void 0;
|
|
@@ -2821,13 +3269,13 @@ class Time extends React__default.Component {
|
|
|
2821
3269
|
|
|
2822
3270
|
const timeComponent = this._renderTime(this.props.config);
|
|
2823
3271
|
|
|
2824
|
-
return /*#__PURE__*/
|
|
3272
|
+
return /*#__PURE__*/React.createElement("time", {
|
|
2825
3273
|
className: className,
|
|
2826
3274
|
onMouseEnter: event => this._setHovered(true, event),
|
|
2827
3275
|
onMouseLeave: event => this._setHovered(false, event)
|
|
2828
|
-
}, this.props.tooltipOnHover ? /*#__PURE__*/
|
|
3276
|
+
}, this.props.tooltipOnHover ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
2829
3277
|
content: this.props.tooltip || this.props.time && TimeUtils.formatTimeLong(this.props.time, this.props.config)
|
|
2830
|
-
}, /*#__PURE__*/
|
|
3278
|
+
}, /*#__PURE__*/React.createElement("span", null, timeComponent)) : timeComponent);
|
|
2831
3279
|
}
|
|
2832
3280
|
|
|
2833
3281
|
}
|
|
@@ -2849,83 +3297,7 @@ Time.defaultProps = {
|
|
|
2849
3297
|
}
|
|
2850
3298
|
};
|
|
2851
3299
|
|
|
2852
|
-
const
|
|
2853
|
-
width: "24",
|
|
2854
|
-
height: "24",
|
|
2855
|
-
viewBox: "0 0 24 24"
|
|
2856
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
2857
|
-
fill: "gray",
|
|
2858
|
-
fillRule: "evenodd",
|
|
2859
|
-
d: "M11.293 12L5.146 5.854a.5.5 0 1 1 .708-.708L12 11.293l6.146-6.147a.5.5 0 0 1 .708.708L12.707 12l6.147 6.146a.5.5 0 0 1-.708.708L12 12.707l-6.146 6.147a.5.5 0 0 1-.708-.708L11.293 12z"
|
|
2860
|
-
}));
|
|
2861
|
-
|
|
2862
|
-
const _excluded$s = ["id", "icon", "title", "subtitle", "children", "customCloseButton", "onClick", "onClose", "closeAltText", "className", "aria-live"];
|
|
2863
|
-
|
|
2864
|
-
function Notification(_ref) {
|
|
2865
|
-
let {
|
|
2866
|
-
id,
|
|
2867
|
-
icon,
|
|
2868
|
-
title,
|
|
2869
|
-
subtitle,
|
|
2870
|
-
children,
|
|
2871
|
-
customCloseButton,
|
|
2872
|
-
onClick,
|
|
2873
|
-
onClose,
|
|
2874
|
-
closeAltText = 'Close',
|
|
2875
|
-
className,
|
|
2876
|
-
'aria-live': ariaLive = 'polite'
|
|
2877
|
-
} = _ref,
|
|
2878
|
-
rest = _objectWithoutProperties(_ref, _excluded$s);
|
|
2879
|
-
|
|
2880
|
-
const titleId = title ? id + "-title" : null;
|
|
2881
|
-
const titleIdAttribute = titleId ? {
|
|
2882
|
-
id: titleId
|
|
2883
|
-
} : null;
|
|
2884
|
-
const subtitleId = subtitle ? id + "-subtitle" : null;
|
|
2885
|
-
const subtitleIdAttribute = subtitleId ? {
|
|
2886
|
-
id: subtitleId
|
|
2887
|
-
} : null;
|
|
2888
|
-
const contentId = children ? id + "-content" : null;
|
|
2889
|
-
const contentIdAttribute = children ? {
|
|
2890
|
-
id: id + "-content"
|
|
2891
|
-
} : null;
|
|
2892
|
-
const ariaLabelledBy = contentId ? {
|
|
2893
|
-
'aria-labelledby': contentId
|
|
2894
|
-
} : titleId ? {
|
|
2895
|
-
'aria-labelledby': titleId
|
|
2896
|
-
} : null;
|
|
2897
|
-
const ariaDescribedBy = subtitleId && !children ? {
|
|
2898
|
-
'aria-describedby': subtitleId
|
|
2899
|
-
} : null;
|
|
2900
|
-
const notificationContent = /*#__PURE__*/React__default.createElement("div", _objectSpread2({
|
|
2901
|
-
className: "reactist-notification__content"
|
|
2902
|
-
}, contentIdAttribute), children != null ? children : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title ? /*#__PURE__*/React__default.createElement("h3", _objectSpread2({
|
|
2903
|
-
className: "reactist-notification__title"
|
|
2904
|
-
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/React__default.createElement("p", _objectSpread2({
|
|
2905
|
-
className: "reactist-notification__subtitle"
|
|
2906
|
-
}, subtitleIdAttribute), subtitle) : null));
|
|
2907
|
-
const notificationBody = /*#__PURE__*/React__default.createElement("div", {
|
|
2908
|
-
className: "reactist-notification__icon-content-group"
|
|
2909
|
-
}, icon != null ? icon : null, notificationContent);
|
|
2910
|
-
return /*#__PURE__*/React__default.createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2911
|
-
id: id,
|
|
2912
|
-
role: "alert",
|
|
2913
|
-
className: classNames('reactist-notification', className, {
|
|
2914
|
-
'reactist-notification--with-button': Boolean(onClick),
|
|
2915
|
-
'reactist-notification--with-close-button': Boolean(onClose)
|
|
2916
|
-
}),
|
|
2917
|
-
"aria-live": ariaLive
|
|
2918
|
-
}, ariaLabelledBy), ariaDescribedBy), rest), onClick ? /*#__PURE__*/React__default.createElement("button", {
|
|
2919
|
-
className: "reactist-notification__button",
|
|
2920
|
-
onClick: onClick
|
|
2921
|
-
}, notificationBody) : notificationBody, onClose ? /*#__PURE__*/React__default.createElement("button", {
|
|
2922
|
-
className: "reactist-notification__close-button",
|
|
2923
|
-
onClick: onClose,
|
|
2924
|
-
"aria-label": closeAltText
|
|
2925
|
-
}, customCloseButton != null ? customCloseButton : /*#__PURE__*/React__default.createElement(CloseIcon$1, null)) : null);
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
const _excluded$t = ["children", "onItemSelect"],
|
|
3300
|
+
const _excluded$v = ["children", "onItemSelect"],
|
|
2929
3301
|
_excluded2$3 = ["exceptionallySetClassName"],
|
|
2930
3302
|
_excluded3$2 = ["exceptionallySetClassName"],
|
|
2931
3303
|
_excluded4$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
@@ -2947,7 +3319,7 @@ function Menu(_ref) {
|
|
|
2947
3319
|
children,
|
|
2948
3320
|
onItemSelect
|
|
2949
3321
|
} = _ref,
|
|
2950
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3322
|
+
props = _objectWithoutProperties(_ref, _excluded$v);
|
|
2951
3323
|
|
|
2952
3324
|
const state = Ariakit.useMenuState(_objectSpread2({
|
|
2953
3325
|
focusLoop: true,
|
|
@@ -3125,16 +3497,16 @@ const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref5, re
|
|
|
3125
3497
|
}, label) : null, children);
|
|
3126
3498
|
});
|
|
3127
3499
|
|
|
3128
|
-
const Input = /*#__PURE__*/
|
|
3500
|
+
const Input = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
3129
3501
|
const className = classNames('reactist_input', props.className);
|
|
3130
|
-
return /*#__PURE__*/
|
|
3502
|
+
return /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3131
3503
|
className: className,
|
|
3132
3504
|
ref: ref
|
|
3133
3505
|
}));
|
|
3134
3506
|
});
|
|
3135
3507
|
Input.displayName = 'Input';
|
|
3136
3508
|
|
|
3137
|
-
const _excluded$
|
|
3509
|
+
const _excluded$w = ["value", "options", "onChange", "disabled", "className", "defaultValue"];
|
|
3138
3510
|
|
|
3139
3511
|
function Select(_ref) {
|
|
3140
3512
|
let {
|
|
@@ -3145,18 +3517,18 @@ function Select(_ref) {
|
|
|
3145
3517
|
className = '',
|
|
3146
3518
|
defaultValue
|
|
3147
3519
|
} = _ref,
|
|
3148
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
3520
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$w);
|
|
3149
3521
|
|
|
3150
3522
|
const selectClassName = classNames('reactist_select', {
|
|
3151
3523
|
disabled
|
|
3152
3524
|
}, className);
|
|
3153
|
-
return /*#__PURE__*/
|
|
3525
|
+
return /*#__PURE__*/React.createElement("select", _objectSpread2({
|
|
3154
3526
|
className: selectClassName,
|
|
3155
3527
|
value: value,
|
|
3156
3528
|
onChange: event => onChange ? onChange(event.target.value) : undefined,
|
|
3157
3529
|
disabled: disabled,
|
|
3158
3530
|
defaultValue: defaultValue
|
|
3159
|
-
}, otherProps), options == null ? void 0 : options.map(option => /*#__PURE__*/
|
|
3531
|
+
}, otherProps), options == null ? void 0 : options.map(option => /*#__PURE__*/React.createElement("option", {
|
|
3160
3532
|
key: option.key || option.value,
|
|
3161
3533
|
value: option.value,
|
|
3162
3534
|
disabled: option.disabled
|
|
@@ -3169,9 +3541,85 @@ Select.defaultProps = {
|
|
|
3169
3541
|
disabled: false
|
|
3170
3542
|
};
|
|
3171
3543
|
|
|
3544
|
+
const CloseIcon$1 = () => /*#__PURE__*/React.createElement("svg", {
|
|
3545
|
+
width: "24",
|
|
3546
|
+
height: "24",
|
|
3547
|
+
viewBox: "0 0 24 24"
|
|
3548
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3549
|
+
fill: "gray",
|
|
3550
|
+
fillRule: "evenodd",
|
|
3551
|
+
d: "M11.293 12L5.146 5.854a.5.5 0 1 1 .708-.708L12 11.293l6.146-6.147a.5.5 0 0 1 .708.708L12.707 12l6.147 6.146a.5.5 0 0 1-.708.708L12 12.707l-6.146 6.147a.5.5 0 0 1-.708-.708L11.293 12z"
|
|
3552
|
+
}));
|
|
3553
|
+
|
|
3554
|
+
const _excluded$x = ["id", "icon", "title", "subtitle", "children", "customCloseButton", "onClick", "onClose", "closeAltText", "className", "aria-live"];
|
|
3555
|
+
|
|
3556
|
+
function DeprecatedNotification(_ref) {
|
|
3557
|
+
let {
|
|
3558
|
+
id,
|
|
3559
|
+
icon,
|
|
3560
|
+
title,
|
|
3561
|
+
subtitle,
|
|
3562
|
+
children,
|
|
3563
|
+
customCloseButton,
|
|
3564
|
+
onClick,
|
|
3565
|
+
onClose,
|
|
3566
|
+
closeAltText = 'Close',
|
|
3567
|
+
className,
|
|
3568
|
+
'aria-live': ariaLive = 'polite'
|
|
3569
|
+
} = _ref,
|
|
3570
|
+
rest = _objectWithoutProperties(_ref, _excluded$x);
|
|
3571
|
+
|
|
3572
|
+
const titleId = title ? id + "-title" : null;
|
|
3573
|
+
const titleIdAttribute = titleId ? {
|
|
3574
|
+
id: titleId
|
|
3575
|
+
} : null;
|
|
3576
|
+
const subtitleId = subtitle ? id + "-subtitle" : null;
|
|
3577
|
+
const subtitleIdAttribute = subtitleId ? {
|
|
3578
|
+
id: subtitleId
|
|
3579
|
+
} : null;
|
|
3580
|
+
const contentId = children ? id + "-content" : null;
|
|
3581
|
+
const contentIdAttribute = children ? {
|
|
3582
|
+
id: id + "-content"
|
|
3583
|
+
} : null;
|
|
3584
|
+
const ariaLabelledBy = contentId ? {
|
|
3585
|
+
'aria-labelledby': contentId
|
|
3586
|
+
} : titleId ? {
|
|
3587
|
+
'aria-labelledby': titleId
|
|
3588
|
+
} : null;
|
|
3589
|
+
const ariaDescribedBy = subtitleId && !children ? {
|
|
3590
|
+
'aria-describedby': subtitleId
|
|
3591
|
+
} : null;
|
|
3592
|
+
const notificationContent = /*#__PURE__*/React.createElement("div", _objectSpread2({
|
|
3593
|
+
className: "reactist-notification__content"
|
|
3594
|
+
}, contentIdAttribute), children != null ? children : /*#__PURE__*/React.createElement(React.Fragment, null, title ? /*#__PURE__*/React.createElement("h3", _objectSpread2({
|
|
3595
|
+
className: "reactist-notification__title"
|
|
3596
|
+
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/React.createElement("p", _objectSpread2({
|
|
3597
|
+
className: "reactist-notification__subtitle"
|
|
3598
|
+
}, subtitleIdAttribute), subtitle) : null));
|
|
3599
|
+
const notificationBody = /*#__PURE__*/React.createElement("div", {
|
|
3600
|
+
className: "reactist-notification__icon-content-group"
|
|
3601
|
+
}, icon != null ? icon : null, notificationContent);
|
|
3602
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
3603
|
+
id: id,
|
|
3604
|
+
role: "alert",
|
|
3605
|
+
className: classNames('reactist-notification', className, {
|
|
3606
|
+
'reactist-notification--with-button': Boolean(onClick),
|
|
3607
|
+
'reactist-notification--with-close-button': Boolean(onClose)
|
|
3608
|
+
}),
|
|
3609
|
+
"aria-live": ariaLive
|
|
3610
|
+
}, ariaLabelledBy), ariaDescribedBy), rest), onClick ? /*#__PURE__*/React.createElement("button", {
|
|
3611
|
+
className: "reactist-notification__button",
|
|
3612
|
+
onClick: onClick
|
|
3613
|
+
}, notificationBody) : notificationBody, onClose ? /*#__PURE__*/React.createElement("button", {
|
|
3614
|
+
className: "reactist-notification__close-button",
|
|
3615
|
+
onClick: onClose,
|
|
3616
|
+
"aria-label": closeAltText
|
|
3617
|
+
}, customCloseButton != null ? customCloseButton : /*#__PURE__*/React.createElement(CloseIcon$1, null)) : null);
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3172
3620
|
var modules_8f59d13b$1 = {"reach-portal":"_37bef8d8","fadein":"_77f9687f","fitContent":"bcc4e0a5","container":"d4832c2d","full":"b0c3b021","large":"_573d6aa5","medium":"_8550d996","small":"_43bb18f5","xlarge":"_57b4159d","overlay":"cb63f300","expand":"e741893e","buttonContainer":"bb1ce281","headerContent":"c5ef989c"};
|
|
3173
3621
|
|
|
3174
|
-
const _excluded$
|
|
3622
|
+
const _excluded$y = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
3175
3623
|
_excluded2$4 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
3176
3624
|
_excluded3$3 = ["exceptionallySetClassName", "children"],
|
|
3177
3625
|
_excluded4$2 = ["exceptionallySetClassName", "withDivider"],
|
|
@@ -3206,7 +3654,7 @@ function DeprecatedModal(_ref) {
|
|
|
3206
3654
|
autoFocus = true,
|
|
3207
3655
|
children
|
|
3208
3656
|
} = _ref,
|
|
3209
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3657
|
+
props = _objectWithoutProperties(_ref, _excluded$y);
|
|
3210
3658
|
|
|
3211
3659
|
const contextValue = React.useMemo(() => ({
|
|
3212
3660
|
onDismiss,
|
|
@@ -3377,6 +3825,7 @@ function DeprecatedModalActions(_ref5) {
|
|
|
3377
3825
|
|
|
3378
3826
|
exports.Alert = Alert;
|
|
3379
3827
|
exports.Avatar = Avatar;
|
|
3828
|
+
exports.Badge = Badge;
|
|
3380
3829
|
exports.Box = Box;
|
|
3381
3830
|
exports.Button = Button;
|
|
3382
3831
|
exports.ButtonLink = ButtonLink;
|
|
@@ -3394,6 +3843,7 @@ exports.DeprecatedModalBody = DeprecatedModalBody;
|
|
|
3394
3843
|
exports.DeprecatedModalCloseButton = DeprecatedModalCloseButton;
|
|
3395
3844
|
exports.DeprecatedModalFooter = DeprecatedModalFooter;
|
|
3396
3845
|
exports.DeprecatedModalHeader = DeprecatedModalHeader;
|
|
3846
|
+
exports.DeprecatedNotification = DeprecatedNotification;
|
|
3397
3847
|
exports.DeprecatedSelect = Select;
|
|
3398
3848
|
exports.Divider = Divider;
|
|
3399
3849
|
exports.Heading = Heading;
|
|
@@ -3415,12 +3865,12 @@ exports.ModalCloseButton = ModalCloseButton;
|
|
|
3415
3865
|
exports.ModalFooter = ModalFooter;
|
|
3416
3866
|
exports.ModalHeader = ModalHeader;
|
|
3417
3867
|
exports.Notice = Notice;
|
|
3418
|
-
exports.Notification = Notification;
|
|
3419
3868
|
exports.PasswordField = PasswordField;
|
|
3420
3869
|
exports.ProgressBar = ProgressBar;
|
|
3421
3870
|
exports.SUPPORTED_KEYS = SUPPORTED_KEYS;
|
|
3422
3871
|
exports.SelectField = SelectField;
|
|
3423
3872
|
exports.Stack = Stack;
|
|
3873
|
+
exports.StaticToast = StaticToast;
|
|
3424
3874
|
exports.SubMenu = SubMenu;
|
|
3425
3875
|
exports.SwitchField = SwitchField;
|
|
3426
3876
|
exports.Tab = Tab;
|
|
@@ -3433,6 +3883,9 @@ exports.TextArea = TextArea;
|
|
|
3433
3883
|
exports.TextField = TextField;
|
|
3434
3884
|
exports.TextLink = TextLink;
|
|
3435
3885
|
exports.Time = Time;
|
|
3886
|
+
exports.Toast = Toast;
|
|
3887
|
+
exports.ToastsProvider = ToastsProvider;
|
|
3436
3888
|
exports.Tooltip = Tooltip;
|
|
3437
3889
|
exports.usePrevious = usePrevious;
|
|
3890
|
+
exports.useToasts = useToasts;
|
|
3438
3891
|
//# sourceMappingURL=reactist.cjs.development.js.map
|