@redsift/popovers 10.3.0-alpha.1 → 10.3.0-alpha.11
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/CONTRIBUTING.md +4 -4
- package/index.d.ts +105 -39
- package/index.js +202 -153
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { baseContainer, Theme, useBoundingClientRect, baseStyling, baseFlexbox, useId, Skeleton, Heading, Icon, AppContainerContext, useTheme, useMessageFormatter, partitionComponents, isComponent, IconButton, ThemeProvider as ThemeProvider$1, Flexbox, Text, RedsiftTypographyFontWeightSemiBold, Spinner, NotificationsColorPalette, Button, IconButtonLink } from '@redsift/design-system';
|
|
2
|
+
import React, { forwardRef, useContext, useRef, useState, useEffect, useCallback } from 'react';
|
|
1
3
|
import { FloatingOverlay, useMergeRefs, useTransitionStyles, FloatingPortal, FloatingFocusManager, useFloating, useDismiss, useRole, useInteractions, offset, flip, shift, size, autoUpdate, arrow, useHover, safePolygon, useFocus } from '@floating-ui/react';
|
|
2
4
|
export { FloatingPortal, useMergeRefs } from '@floating-ui/react';
|
|
3
|
-
import React, { forwardRef, useContext, useRef, useState, useEffect, useCallback } from 'react';
|
|
4
|
-
import { baseContainer, Theme, useBoundingClientRect, baseStyling, baseFlexbox, useId, Skeleton, Heading, Icon, AppContainerContext, useTheme, useMessageFormatter, partitionComponents, isComponent, IconButton, ThemeProvider as ThemeProvider$1, Flexbox, Text, RedsiftTypographyFontWeightSemiBold, Spinner, NotificationsColorPalette } from '@redsift/design-system';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import { mdiClose, mdiAlert, mdiCheckCircle, mdiAlertCircle, mdiInformation } from '@redsift/icons';
|
|
7
6
|
import styled, { css } from 'styled-components';
|
|
7
|
+
import { mdiClose, mdiAlert, mdiCheckCircle, mdiAlertCircle, mdiInformation } from '@redsift/icons';
|
|
8
8
|
import { ToastContainer as ToastContainer$1, Slide, toast } from 'react-toastify';
|
|
9
9
|
|
|
10
10
|
const DialogContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -215,12 +215,9 @@ const StyledDialogContentActions = styled.div`
|
|
|
215
215
|
}
|
|
216
216
|
`;
|
|
217
217
|
|
|
218
|
-
const _excluded$
|
|
218
|
+
const _excluded$a = ["children", "className", "flexDirection"];
|
|
219
219
|
const COMPONENT_NAME$d = 'DialogContentActions';
|
|
220
220
|
const CLASSNAME$d = 'redsift-dialog-content-actions';
|
|
221
|
-
const DEFAULT_PROPS$d = {
|
|
222
|
-
flexDirection: 'row'
|
|
223
|
-
};
|
|
224
221
|
|
|
225
222
|
/**
|
|
226
223
|
* The DialogContentActions component.
|
|
@@ -228,21 +225,23 @@ const DEFAULT_PROPS$d = {
|
|
|
228
225
|
const DialogContentActions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
229
226
|
const {
|
|
230
227
|
children,
|
|
231
|
-
className
|
|
228
|
+
className,
|
|
229
|
+
flexDirection = 'row'
|
|
232
230
|
} = props,
|
|
233
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
231
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$a);
|
|
234
232
|
const {
|
|
235
233
|
actionsRef,
|
|
236
234
|
initialFocus
|
|
237
235
|
} = useDialogContext();
|
|
238
|
-
return /*#__PURE__*/React.createElement(StyledDialogContentActions, _extends({
|
|
236
|
+
return /*#__PURE__*/React.createElement(StyledDialogContentActions, _extends({
|
|
237
|
+
flexDirection: flexDirection
|
|
238
|
+
}, forwardedProps, {
|
|
239
239
|
className: classNames(DialogContentActions.className, className),
|
|
240
240
|
ref: useMergeRefs([ref, actionsRef]),
|
|
241
241
|
tabIndex: initialFocus === 'actions' ? -1 : undefined
|
|
242
242
|
}), children);
|
|
243
243
|
});
|
|
244
244
|
DialogContentActions.className = CLASSNAME$d;
|
|
245
|
-
DialogContentActions.defaultProps = DEFAULT_PROPS$d;
|
|
246
245
|
DialogContentActions.displayName = COMPONENT_NAME$d;
|
|
247
246
|
|
|
248
247
|
/**
|
|
@@ -305,10 +304,9 @@ const StyledDialogContentBody = styled.div`
|
|
|
305
304
|
}
|
|
306
305
|
`;
|
|
307
306
|
|
|
308
|
-
const _excluded$
|
|
307
|
+
const _excluded$9 = ["children", "className"];
|
|
309
308
|
const COMPONENT_NAME$c = 'DialogContentBody';
|
|
310
309
|
const CLASSNAME$c = 'redsift-dialog-content-body';
|
|
311
|
-
const DEFAULT_PROPS$c = {};
|
|
312
310
|
|
|
313
311
|
/**
|
|
314
312
|
* The DialogContentBody component.
|
|
@@ -318,7 +316,7 @@ const DialogContentBody = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
318
316
|
children,
|
|
319
317
|
className
|
|
320
318
|
} = props,
|
|
321
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
319
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$9);
|
|
322
320
|
const {
|
|
323
321
|
actionsRef,
|
|
324
322
|
bodyRef,
|
|
@@ -343,7 +341,6 @@ const DialogContentBody = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
343
341
|
}), children);
|
|
344
342
|
});
|
|
345
343
|
DialogContentBody.className = CLASSNAME$c;
|
|
346
|
-
DialogContentBody.defaultProps = DEFAULT_PROPS$c;
|
|
347
344
|
DialogContentBody.displayName = COMPONENT_NAME$c;
|
|
348
345
|
|
|
349
346
|
/**
|
|
@@ -372,10 +369,9 @@ const StyledDialogContentHeader = styled.div`
|
|
|
372
369
|
}
|
|
373
370
|
`;
|
|
374
371
|
|
|
375
|
-
const _excluded$
|
|
372
|
+
const _excluded$8 = ["children", "className", "header", "headingProps", "icon", "iconProps", "isLoading", "subheader", "theme"];
|
|
376
373
|
const COMPONENT_NAME$b = 'DialogContentHeader';
|
|
377
374
|
const CLASSNAME$b = 'redsift-dialog-content-header';
|
|
378
|
-
const DEFAULT_PROPS$b = {};
|
|
379
375
|
|
|
380
376
|
/**
|
|
381
377
|
* The DialogContentHeader component.
|
|
@@ -392,7 +388,7 @@ const DialogContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
392
388
|
subheader,
|
|
393
389
|
theme
|
|
394
390
|
} = props,
|
|
395
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
391
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$8);
|
|
396
392
|
const {
|
|
397
393
|
setLabelId,
|
|
398
394
|
setDescriptionId,
|
|
@@ -447,13 +443,11 @@ const DialogContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
447
443
|
}, children) : null);
|
|
448
444
|
});
|
|
449
445
|
DialogContentHeader.className = CLASSNAME$b;
|
|
450
|
-
DialogContentHeader.defaultProps = DEFAULT_PROPS$b;
|
|
451
446
|
DialogContentHeader.displayName = COMPONENT_NAME$b;
|
|
452
447
|
|
|
453
|
-
const _excluded$
|
|
448
|
+
const _excluded$7 = ["children", "className", "style", "theme"];
|
|
454
449
|
const COMPONENT_NAME$a = 'DialogContent';
|
|
455
450
|
const CLASSNAME$a = 'redsift-dialog-content';
|
|
456
|
-
const DEFAULT_PROPS$a = {};
|
|
457
451
|
const sizeToDimension = size => {
|
|
458
452
|
if (typeof size !== 'string') {
|
|
459
453
|
return size;
|
|
@@ -486,9 +480,10 @@ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
486
480
|
const {
|
|
487
481
|
children,
|
|
488
482
|
className,
|
|
483
|
+
style,
|
|
489
484
|
theme: propsTheme
|
|
490
485
|
} = props,
|
|
491
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
486
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$7);
|
|
492
487
|
const appContainerState = useContext(AppContainerContext);
|
|
493
488
|
const {
|
|
494
489
|
context: floatingContext,
|
|
@@ -532,7 +527,7 @@ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
532
527
|
"aria-labelledby": labelId,
|
|
533
528
|
"aria-describedby": descriptionId
|
|
534
529
|
}, getFloatingProps(props), {
|
|
535
|
-
style: styles,
|
|
530
|
+
style: _objectSpread2(_objectSpread2({}, styles), style),
|
|
536
531
|
$width: width
|
|
537
532
|
}), header || hasCloseButton ? /*#__PURE__*/React.createElement("div", {
|
|
538
533
|
className: `${BaseDialogContent.className}__header`
|
|
@@ -548,7 +543,6 @@ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
548
543
|
}, body, actions) : null))));
|
|
549
544
|
});
|
|
550
545
|
BaseDialogContent.className = CLASSNAME$a;
|
|
551
|
-
BaseDialogContent.defaultProps = DEFAULT_PROPS$a;
|
|
552
546
|
BaseDialogContent.displayName = COMPONENT_NAME$a;
|
|
553
547
|
const DialogContent = Object.assign(BaseDialogContent, {
|
|
554
548
|
Header: DialogContentHeader,
|
|
@@ -558,7 +552,6 @@ const DialogContent = Object.assign(BaseDialogContent, {
|
|
|
558
552
|
|
|
559
553
|
const COMPONENT_NAME$9 = 'DialogTrigger';
|
|
560
554
|
const CLASSNAME$9 = 'redsift-dialog-trigger';
|
|
561
|
-
const DEFAULT_PROPS$9 = {};
|
|
562
555
|
|
|
563
556
|
/**
|
|
564
557
|
* The DialogTrigger component.
|
|
@@ -572,30 +565,32 @@ const DialogTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
572
565
|
isOpen,
|
|
573
566
|
handleOpen,
|
|
574
567
|
refs,
|
|
575
|
-
triggerClassName
|
|
568
|
+
triggerClassName,
|
|
569
|
+
color
|
|
576
570
|
} = useDialogContext();
|
|
577
571
|
const childrenRef = children.ref;
|
|
578
572
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
579
|
-
if (isComponent('Button')(children) || isComponent('IconButton')(children) || isComponent('LinkButton')(children) || isComponent('Checkbox')(children)) {
|
|
573
|
+
if (isComponent('Button')(children) || isComponent('IconButton')(children) || isComponent('LinkButton')(children) || isComponent('Checkbox')(children) || isComponent('Switch')(children) || isComponent('Radio')(children) || isComponent('Item')(children)) {
|
|
580
574
|
var _children$props$child;
|
|
581
575
|
return /*#__PURE__*/React.cloneElement(children, _objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
582
576
|
ref: triggerRef
|
|
583
577
|
}, props), children.props), {}, {
|
|
584
578
|
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
585
579
|
}))), {}, {
|
|
586
|
-
onClick: () => handleOpen(!isOpen),
|
|
580
|
+
onClick: props.onClick ? props.onClick : () => handleOpen(!isOpen),
|
|
587
581
|
isActive: isOpen,
|
|
588
|
-
className: classNames(children.props.className, triggerClassName)
|
|
582
|
+
className: classNames(children.props.className, triggerClassName),
|
|
583
|
+
color: color !== null && color !== void 0 ? color : children.props.color
|
|
589
584
|
}));
|
|
590
585
|
}
|
|
591
586
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
592
587
|
});
|
|
593
588
|
DialogTrigger.className = CLASSNAME$9;
|
|
594
|
-
DialogTrigger.defaultProps = DEFAULT_PROPS$9;
|
|
595
589
|
DialogTrigger.displayName = COMPONENT_NAME$9;
|
|
596
590
|
|
|
597
591
|
function useDialog(_ref) {
|
|
598
592
|
let {
|
|
593
|
+
color,
|
|
599
594
|
defaultOpen,
|
|
600
595
|
hasCloseButton,
|
|
601
596
|
initialFocus,
|
|
@@ -632,6 +627,7 @@ function useDialog(_ref) {
|
|
|
632
627
|
const role = useRole(context);
|
|
633
628
|
const interactions = useInteractions([dismiss, role]);
|
|
634
629
|
return React.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
630
|
+
color,
|
|
635
631
|
isOpen,
|
|
636
632
|
handleOpen
|
|
637
633
|
}, interactions), data), {}, {
|
|
@@ -646,33 +642,31 @@ function useDialog(_ref) {
|
|
|
646
642
|
bodyRef,
|
|
647
643
|
actionsRef,
|
|
648
644
|
triggerClassName
|
|
649
|
-
}), [isOpen, handleOpen, interactions, data, labelId, descriptionId, hasCloseButton, initialFocus, size, headerRef, bodyRef, actionsRef, triggerClassName]);
|
|
645
|
+
}), [color, isOpen, handleOpen, interactions, data, labelId, descriptionId, hasCloseButton, initialFocus, size, headerRef, bodyRef, actionsRef, triggerClassName]);
|
|
650
646
|
}
|
|
651
647
|
|
|
652
648
|
const COMPONENT_NAME$8 = 'Dialog';
|
|
653
649
|
const CLASSNAME$8 = 'redsift-dialog';
|
|
654
|
-
const DEFAULT_PROPS$8 = {
|
|
655
|
-
hasCloseButton: true,
|
|
656
|
-
size: DialogSize.medium
|
|
657
|
-
};
|
|
658
650
|
|
|
659
651
|
/**
|
|
660
652
|
* The Dialog component.
|
|
661
653
|
*/
|
|
662
654
|
const BaseDialog = props => {
|
|
663
655
|
const {
|
|
656
|
+
color,
|
|
664
657
|
children,
|
|
665
658
|
defaultOpen,
|
|
666
|
-
hasCloseButton =
|
|
659
|
+
hasCloseButton = true,
|
|
667
660
|
initialFocus,
|
|
668
661
|
isOpen,
|
|
669
662
|
onOpen,
|
|
670
|
-
size,
|
|
663
|
+
size = DialogSize.medium,
|
|
671
664
|
theme: propsTheme,
|
|
672
665
|
triggerClassName
|
|
673
666
|
} = props;
|
|
674
667
|
const theme = useTheme(propsTheme);
|
|
675
668
|
const dialog = useDialog({
|
|
669
|
+
color,
|
|
676
670
|
defaultOpen,
|
|
677
671
|
hasCloseButton,
|
|
678
672
|
initialFocus,
|
|
@@ -691,7 +685,6 @@ const BaseDialog = props => {
|
|
|
691
685
|
}, trigger && isComponent('DialogTrigger')(trigger) ? trigger : null, content && isComponent('DialogContent')(content) ? content : null));
|
|
692
686
|
};
|
|
693
687
|
BaseDialog.className = CLASSNAME$8;
|
|
694
|
-
BaseDialog.defaultProps = DEFAULT_PROPS$8;
|
|
695
688
|
BaseDialog.displayName = COMPONENT_NAME$8;
|
|
696
689
|
const Dialog = Object.assign(BaseDialog, {
|
|
697
690
|
Trigger: DialogTrigger,
|
|
@@ -888,10 +881,9 @@ const StyledPopoverContent = styled.div`
|
|
|
888
881
|
}
|
|
889
882
|
`;
|
|
890
883
|
|
|
891
|
-
const _excluded$
|
|
884
|
+
const _excluded$6 = ["children", "className", "style", "theme"];
|
|
892
885
|
const COMPONENT_NAME$7 = 'PopoverContent';
|
|
893
886
|
const CLASSNAME$7 = 'redsift-popover-content';
|
|
894
|
-
const DEFAULT_PROPS$7 = {};
|
|
895
887
|
|
|
896
888
|
/**
|
|
897
889
|
* The PopoverContent component.
|
|
@@ -903,7 +895,7 @@ const PopoverContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
903
895
|
style,
|
|
904
896
|
theme: propsTheme
|
|
905
897
|
} = props,
|
|
906
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
898
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$6);
|
|
907
899
|
const appContainerState = useContext(AppContainerContext);
|
|
908
900
|
const {
|
|
909
901
|
context: floatingContext,
|
|
@@ -913,37 +905,37 @@ const PopoverContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
913
905
|
refs,
|
|
914
906
|
strategy,
|
|
915
907
|
x,
|
|
916
|
-
y
|
|
908
|
+
y,
|
|
909
|
+
hideInsteadOfClose
|
|
917
910
|
} = usePopoverContext();
|
|
918
911
|
const theme = useTheme(propsTheme);
|
|
919
912
|
const popoverRef = useMergeRefs([refs.setFloating, ref]);
|
|
920
913
|
const RenderedPopoverContent = /*#__PURE__*/React.createElement(StyledPopoverContent, _extends({
|
|
921
|
-
$theme: theme
|
|
914
|
+
$theme: theme
|
|
915
|
+
}, getFloatingProps(props), {
|
|
922
916
|
style: _objectSpread2({
|
|
923
917
|
position: strategy,
|
|
924
918
|
top: y !== null && y !== void 0 ? y : 0,
|
|
925
919
|
left: x !== null && x !== void 0 ? x : 0,
|
|
926
|
-
width: 'fit-content'
|
|
927
|
-
|
|
928
|
-
|
|
920
|
+
width: 'fit-content',
|
|
921
|
+
display: hideInsteadOfClose && !isOpen ? 'none' : 'flex'
|
|
922
|
+
}, style),
|
|
929
923
|
className: classNames(PopoverContent.className, className)
|
|
930
924
|
}, forwardedProps, {
|
|
931
925
|
ref: popoverRef
|
|
932
926
|
}), children);
|
|
933
927
|
return /*#__PURE__*/React.createElement(FloatingPortal, {
|
|
934
928
|
root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
|
|
935
|
-
}, isOpen
|
|
929
|
+
}, isOpen || hideInsteadOfClose ? /*#__PURE__*/React.createElement(FloatingFocusManager, {
|
|
936
930
|
context: floatingContext,
|
|
937
931
|
modal: isModal
|
|
938
|
-
}, RenderedPopoverContent));
|
|
932
|
+
}, RenderedPopoverContent) : null);
|
|
939
933
|
});
|
|
940
934
|
PopoverContent.className = CLASSNAME$7;
|
|
941
|
-
PopoverContent.defaultProps = DEFAULT_PROPS$7;
|
|
942
935
|
PopoverContent.displayName = COMPONENT_NAME$7;
|
|
943
936
|
|
|
944
937
|
const COMPONENT_NAME$6 = 'PopoverTrigger';
|
|
945
938
|
const CLASSNAME$6 = 'redsift-popover-trigger';
|
|
946
|
-
const DEFAULT_PROPS$6 = {};
|
|
947
939
|
|
|
948
940
|
/**
|
|
949
941
|
* The PopoverTrigger component.
|
|
@@ -957,40 +949,45 @@ const PopoverTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
957
949
|
isOpen,
|
|
958
950
|
handleOpen,
|
|
959
951
|
refs,
|
|
960
|
-
triggerClassName
|
|
952
|
+
triggerClassName,
|
|
953
|
+
color
|
|
961
954
|
} = usePopoverContext();
|
|
962
955
|
const childrenRef = children.ref;
|
|
963
956
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
964
|
-
if (isComponent('Button')(children) || isComponent('IconButton')(children) || isComponent('LinkButton')(children)) {
|
|
957
|
+
if (isComponent('Button')(children) || isComponent('IconButton')(children) || isComponent('LinkButton')(children) || isComponent('Checkbox')(children) || isComponent('Switch')(children) || isComponent('Radio')(children) || isComponent('Item')(children)) {
|
|
965
958
|
var _children$props$child;
|
|
966
959
|
return /*#__PURE__*/React.cloneElement(children, _objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
967
960
|
ref: triggerRef
|
|
968
961
|
}, props), children.props), {}, {
|
|
969
|
-
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
970
|
-
className: classNames(children.props.className, triggerClassName)
|
|
962
|
+
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
971
963
|
}))), {}, {
|
|
972
|
-
onClick: () => handleOpen(!isOpen),
|
|
973
|
-
isActive: isOpen
|
|
964
|
+
onClick: props.onClick ? props.onClick : () => handleOpen(!isOpen),
|
|
965
|
+
isActive: isOpen,
|
|
966
|
+
className: classNames(children.props.className, triggerClassName),
|
|
967
|
+
color: color !== null && color !== void 0 ? color : children.props.color
|
|
974
968
|
}));
|
|
975
969
|
}
|
|
976
970
|
return null;
|
|
977
971
|
});
|
|
978
972
|
PopoverTrigger.className = CLASSNAME$6;
|
|
979
|
-
PopoverTrigger.defaultProps = DEFAULT_PROPS$6;
|
|
980
973
|
PopoverTrigger.displayName = COMPONENT_NAME$6;
|
|
981
974
|
|
|
982
975
|
function usePopover(_ref) {
|
|
983
976
|
let {
|
|
977
|
+
color,
|
|
984
978
|
defaultOpen,
|
|
985
979
|
isModal,
|
|
986
980
|
isOpen: propsIsOpen,
|
|
987
981
|
maxWidth,
|
|
988
982
|
minWidth,
|
|
983
|
+
offset: propsOffset,
|
|
989
984
|
onOpen,
|
|
990
985
|
placement,
|
|
991
986
|
role: propsRole,
|
|
992
987
|
triggerClassName,
|
|
993
|
-
width
|
|
988
|
+
width,
|
|
989
|
+
setHideInsteadOfClose,
|
|
990
|
+
hideInsteadOfClose
|
|
994
991
|
} = _ref;
|
|
995
992
|
const [isOpen, setIsOpen] = useState(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
996
993
|
useEffect(() => {
|
|
@@ -1004,7 +1001,7 @@ function usePopover(_ref) {
|
|
|
1004
1001
|
setIsOpen(collapsed);
|
|
1005
1002
|
}
|
|
1006
1003
|
}, [onOpen]);
|
|
1007
|
-
const middleware = [offset(2), flip({
|
|
1004
|
+
const middleware = [offset(propsOffset !== null && propsOffset !== void 0 ? propsOffset : 2), flip({
|
|
1008
1005
|
fallbackAxisSideDirection: 'end'
|
|
1009
1006
|
}), shift({
|
|
1010
1007
|
padding: 2
|
|
@@ -1031,14 +1028,7 @@ function usePopover(_ref) {
|
|
|
1031
1028
|
const data = useFloating({
|
|
1032
1029
|
placement,
|
|
1033
1030
|
open: isOpen,
|
|
1034
|
-
onOpenChange:
|
|
1035
|
-
if (propsIsOpen === undefined || propsIsOpen === null) {
|
|
1036
|
-
setIsOpen(open);
|
|
1037
|
-
if (onOpen) {
|
|
1038
|
-
onOpen(open);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1031
|
+
onOpenChange: handleOpen,
|
|
1042
1032
|
whileElementsMounted: autoUpdate,
|
|
1043
1033
|
middleware
|
|
1044
1034
|
});
|
|
@@ -1049,21 +1039,19 @@ function usePopover(_ref) {
|
|
|
1049
1039
|
});
|
|
1050
1040
|
const interactions = useInteractions([dismiss, role]);
|
|
1051
1041
|
return React.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
1042
|
+
color,
|
|
1052
1043
|
isOpen,
|
|
1053
1044
|
handleOpen
|
|
1054
1045
|
}, interactions), data), {}, {
|
|
1055
1046
|
isModal,
|
|
1056
|
-
triggerClassName
|
|
1057
|
-
|
|
1047
|
+
triggerClassName,
|
|
1048
|
+
setHideInsteadOfClose,
|
|
1049
|
+
hideInsteadOfClose
|
|
1050
|
+
}), [color, isOpen, handleOpen, interactions, data, isModal, triggerClassName, setHideInsteadOfClose, hideInsteadOfClose]);
|
|
1058
1051
|
}
|
|
1059
1052
|
|
|
1060
1053
|
const COMPONENT_NAME$5 = 'Popover';
|
|
1061
1054
|
const CLASSNAME$5 = 'redsift-popover';
|
|
1062
|
-
const DEFAULT_PROPS$5 = {
|
|
1063
|
-
isModal: false,
|
|
1064
|
-
placement: PopoverPlacement.bottom,
|
|
1065
|
-
role: 'dialog'
|
|
1066
|
-
};
|
|
1067
1055
|
|
|
1068
1056
|
/**
|
|
1069
1057
|
* The Popover component.
|
|
@@ -1072,30 +1060,37 @@ const BasePopover = props => {
|
|
|
1072
1060
|
var _overrideDisplayName$, _overrideDisplayName$2, _overrideDisplayName$3, _overrideDisplayName$4;
|
|
1073
1061
|
const {
|
|
1074
1062
|
children,
|
|
1063
|
+
color,
|
|
1075
1064
|
defaultOpen,
|
|
1076
|
-
isModal,
|
|
1065
|
+
isModal = false,
|
|
1077
1066
|
isOpen,
|
|
1078
1067
|
maxWidth,
|
|
1079
1068
|
minWidth,
|
|
1069
|
+
offset,
|
|
1080
1070
|
onOpen,
|
|
1081
1071
|
overrideDisplayName,
|
|
1082
|
-
placement,
|
|
1083
|
-
role,
|
|
1072
|
+
placement = PopoverPlacement.bottom,
|
|
1073
|
+
role = 'dialog',
|
|
1084
1074
|
theme: propsTheme,
|
|
1085
1075
|
triggerClassName,
|
|
1086
1076
|
width
|
|
1087
1077
|
} = props;
|
|
1088
1078
|
const theme = useTheme(propsTheme);
|
|
1079
|
+
const [hideInsteadOfClose, setHideInsteadOfClose] = useState(false);
|
|
1089
1080
|
const popover = usePopover({
|
|
1081
|
+
color,
|
|
1090
1082
|
defaultOpen,
|
|
1091
1083
|
isModal,
|
|
1092
1084
|
isOpen,
|
|
1093
1085
|
maxWidth,
|
|
1094
1086
|
minWidth,
|
|
1087
|
+
offset,
|
|
1095
1088
|
onOpen,
|
|
1096
1089
|
placement,
|
|
1097
1090
|
role,
|
|
1098
1091
|
triggerClassName,
|
|
1092
|
+
setHideInsteadOfClose,
|
|
1093
|
+
hideInsteadOfClose,
|
|
1099
1094
|
width
|
|
1100
1095
|
});
|
|
1101
1096
|
const [[trigger], [content]] = partitionComponents(React.Children.toArray(children), [isComponent((_overrideDisplayName$ = overrideDisplayName === null || overrideDisplayName === void 0 ? void 0 : overrideDisplayName.trigger) !== null && _overrideDisplayName$ !== void 0 ? _overrideDisplayName$ : 'PopoverTrigger'), isComponent((_overrideDisplayName$2 = overrideDisplayName === null || overrideDisplayName === void 0 ? void 0 : overrideDisplayName.content) !== null && _overrideDisplayName$2 !== void 0 ? _overrideDisplayName$2 : 'PopoverContent')]);
|
|
@@ -1108,7 +1103,6 @@ const BasePopover = props => {
|
|
|
1108
1103
|
}, trigger && isComponent((_overrideDisplayName$3 = overrideDisplayName === null || overrideDisplayName === void 0 ? void 0 : overrideDisplayName.trigger) !== null && _overrideDisplayName$3 !== void 0 ? _overrideDisplayName$3 : 'PopoverTrigger')(trigger) ? trigger : null, content && isComponent((_overrideDisplayName$4 = overrideDisplayName === null || overrideDisplayName === void 0 ? void 0 : overrideDisplayName.content) !== null && _overrideDisplayName$4 !== void 0 ? _overrideDisplayName$4 : 'PopoverContent')(content) ? content : null));
|
|
1109
1104
|
};
|
|
1110
1105
|
BasePopover.className = CLASSNAME$5;
|
|
1111
|
-
BasePopover.defaultProps = DEFAULT_PROPS$5;
|
|
1112
1106
|
BasePopover.displayName = COMPONENT_NAME$5;
|
|
1113
1107
|
const Popover = Object.assign(BasePopover, {
|
|
1114
1108
|
Trigger: PopoverTrigger,
|
|
@@ -1201,13 +1195,9 @@ const StyledToast = styled.div`
|
|
|
1201
1195
|
}}
|
|
1202
1196
|
`;
|
|
1203
1197
|
|
|
1204
|
-
const _excluded$
|
|
1198
|
+
const _excluded$5 = ["children", "className", "closeButton", "closeToast", "theme", "title", "variant"];
|
|
1205
1199
|
const COMPONENT_NAME$4 = 'Toast';
|
|
1206
1200
|
const CLASSNAME$4 = 'redsift-toast';
|
|
1207
|
-
const DEFAULT_PROPS$4 = {
|
|
1208
|
-
variant: 'info',
|
|
1209
|
-
closeButton: true
|
|
1210
|
-
};
|
|
1211
1201
|
const getVariant = variant => {
|
|
1212
1202
|
switch (variant) {
|
|
1213
1203
|
case ToastVariant.info:
|
|
@@ -1245,13 +1235,13 @@ const Toast = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1245
1235
|
const {
|
|
1246
1236
|
children,
|
|
1247
1237
|
className,
|
|
1238
|
+
closeButton = true,
|
|
1248
1239
|
closeToast,
|
|
1249
|
-
|
|
1240
|
+
theme: propsTheme,
|
|
1250
1241
|
title,
|
|
1251
|
-
variant
|
|
1252
|
-
theme: propsTheme
|
|
1242
|
+
variant = 'info'
|
|
1253
1243
|
} = props,
|
|
1254
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
1244
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$5);
|
|
1255
1245
|
const theme = useTheme(propsTheme);
|
|
1256
1246
|
const format = useMessageFormatter(intlMessages);
|
|
1257
1247
|
const icon = getVariant(variant);
|
|
@@ -1292,7 +1282,6 @@ const Toast = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1292
1282
|
}) : null));
|
|
1293
1283
|
});
|
|
1294
1284
|
Toast.className = CLASSNAME$4;
|
|
1295
|
-
Toast.defaultProps = DEFAULT_PROPS$4;
|
|
1296
1285
|
Toast.displayName = COMPONENT_NAME$4;
|
|
1297
1286
|
|
|
1298
1287
|
const ReactToastify = styled.div`
|
|
@@ -2025,27 +2014,30 @@ const StyledToastContainer = styled(ToastContainer$1)`
|
|
|
2025
2014
|
}
|
|
2026
2015
|
`;
|
|
2027
2016
|
|
|
2028
|
-
const _excluded$
|
|
2017
|
+
const _excluded$4 = ["autoClose", "closeOnClick", "draggable", "pauseOnFocusLoss", "pauseOnHover", "placement"];
|
|
2029
2018
|
const COMPONENT_NAME$3 = 'ToastContainer';
|
|
2030
2019
|
const CLASSNAME$3 = 'redsift-toast-container';
|
|
2031
|
-
const DEFAULT_PROPS$3 = {
|
|
2032
|
-
autoClose: 5000,
|
|
2033
|
-
closeOnClick: false,
|
|
2034
|
-
draggable: true,
|
|
2035
|
-
pauseOnFocusLoss: true,
|
|
2036
|
-
pauseOnHover: true,
|
|
2037
|
-
placement: 'top-right'
|
|
2038
|
-
};
|
|
2039
2020
|
|
|
2040
2021
|
/**
|
|
2041
2022
|
* The ToastContainer component.
|
|
2042
2023
|
*/
|
|
2043
2024
|
const ToastContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2044
2025
|
const {
|
|
2045
|
-
|
|
2026
|
+
autoClose = 5000,
|
|
2027
|
+
closeOnClick = false,
|
|
2028
|
+
draggable = true,
|
|
2029
|
+
pauseOnFocusLoss = true,
|
|
2030
|
+
pauseOnHover = true,
|
|
2031
|
+
placement = 'top-right'
|
|
2046
2032
|
} = props,
|
|
2047
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
2048
|
-
return /*#__PURE__*/React.createElement(ReactToastify, null, /*#__PURE__*/React.createElement(StyledToastContainer, _extends({
|
|
2033
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$4);
|
|
2034
|
+
return /*#__PURE__*/React.createElement(ReactToastify, null, /*#__PURE__*/React.createElement(StyledToastContainer, _extends({
|
|
2035
|
+
autoClose: autoClose,
|
|
2036
|
+
closeOnClick: closeOnClick,
|
|
2037
|
+
draggable: draggable,
|
|
2038
|
+
pauseOnFocusLoss: pauseOnFocusLoss,
|
|
2039
|
+
pauseOnHover: pauseOnHover
|
|
2040
|
+
}, forwardedProps, {
|
|
2049
2041
|
className: ToastContainer.className,
|
|
2050
2042
|
closeButton: false,
|
|
2051
2043
|
icon: false,
|
|
@@ -2057,10 +2049,9 @@ const ToastContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2057
2049
|
})));
|
|
2058
2050
|
});
|
|
2059
2051
|
ToastContainer.className = CLASSNAME$3;
|
|
2060
|
-
ToastContainer.defaultProps = DEFAULT_PROPS$3;
|
|
2061
2052
|
ToastContainer.displayName = COMPONENT_NAME$3;
|
|
2062
2053
|
|
|
2063
|
-
const _excluded = ["content", "closeButton", "placement", "title", "variant"],
|
|
2054
|
+
const _excluded$3 = ["content", "closeButton", "placement", "title", "variant"],
|
|
2064
2055
|
_excluded2 = ["content", "closeButton", "placement", "title", "variant"],
|
|
2065
2056
|
_excluded3 = ["closeButton", "placement"];
|
|
2066
2057
|
const notify = (_ref, props) => {
|
|
@@ -2071,7 +2062,7 @@ const notify = (_ref, props) => {
|
|
|
2071
2062
|
title,
|
|
2072
2063
|
variant = 'info'
|
|
2073
2064
|
} = _ref,
|
|
2074
|
-
options = _objectWithoutProperties(_ref, _excluded);
|
|
2065
|
+
options = _objectWithoutProperties(_ref, _excluded$3);
|
|
2075
2066
|
return toast( /*#__PURE__*/React.createElement(Toast, _extends({
|
|
2076
2067
|
title: title,
|
|
2077
2068
|
variant: variant,
|
|
@@ -2209,34 +2200,6 @@ const useToast = () => {
|
|
|
2209
2200
|
};
|
|
2210
2201
|
};
|
|
2211
2202
|
|
|
2212
|
-
const TooltipContext = /*#__PURE__*/React.createContext(null);
|
|
2213
|
-
|
|
2214
|
-
/**
|
|
2215
|
-
* Context props.
|
|
2216
|
-
*/
|
|
2217
|
-
|
|
2218
|
-
/**
|
|
2219
|
-
* Component variant.
|
|
2220
|
-
*/
|
|
2221
|
-
const TooltipPlacement = {
|
|
2222
|
-
top: 'top',
|
|
2223
|
-
right: 'right',
|
|
2224
|
-
bottom: 'bottom',
|
|
2225
|
-
left: 'left',
|
|
2226
|
-
'top-start': 'top-start',
|
|
2227
|
-
'top-end': 'top-end',
|
|
2228
|
-
'right-start': 'right-start',
|
|
2229
|
-
'right-end': 'right-end',
|
|
2230
|
-
'bottom-start': 'bottom-start',
|
|
2231
|
-
'bottom-end': 'bottom-end',
|
|
2232
|
-
'left-start': 'left-start',
|
|
2233
|
-
'left-end': 'left-end'
|
|
2234
|
-
};
|
|
2235
|
-
|
|
2236
|
-
/**
|
|
2237
|
-
* Component props.
|
|
2238
|
-
*/
|
|
2239
|
-
|
|
2240
2203
|
/**
|
|
2241
2204
|
* Component style.
|
|
2242
2205
|
*/
|
|
@@ -2360,7 +2323,6 @@ const StyledTooltipContent = styled.div`
|
|
|
2360
2323
|
|
|
2361
2324
|
const COMPONENT_NAME$2 = 'TooltipContent';
|
|
2362
2325
|
const CLASSNAME$2 = 'redsift-tooltip-content';
|
|
2363
|
-
const DEFAULT_PROPS$2 = {};
|
|
2364
2326
|
|
|
2365
2327
|
/**
|
|
2366
2328
|
* The TooltipContent component.
|
|
@@ -2404,14 +2366,14 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2404
2366
|
}, isOpen && /*#__PURE__*/React.createElement(StyledTooltipContent, _extends({
|
|
2405
2367
|
className: classNames(TooltipContent.className, className),
|
|
2406
2368
|
ref: popoverRef,
|
|
2407
|
-
$theme: theme
|
|
2369
|
+
$theme: theme
|
|
2370
|
+
}, getFloatingProps(props), {
|
|
2408
2371
|
style: _objectSpread2({
|
|
2409
2372
|
position: strategy,
|
|
2410
2373
|
top: y !== null && y !== void 0 ? y : 0,
|
|
2411
2374
|
left: x !== null && x !== void 0 ? x : 0,
|
|
2412
2375
|
visibility: x == null ? 'hidden' : 'visible'
|
|
2413
|
-
}, style)
|
|
2414
|
-
}, getFloatingProps(props), {
|
|
2376
|
+
}, style),
|
|
2415
2377
|
$placement: placement
|
|
2416
2378
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2417
2379
|
ref: arrowRef,
|
|
@@ -2426,12 +2388,10 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2426
2388
|
}, children)));
|
|
2427
2389
|
});
|
|
2428
2390
|
TooltipContent.className = CLASSNAME$2;
|
|
2429
|
-
TooltipContent.defaultProps = DEFAULT_PROPS$2;
|
|
2430
2391
|
TooltipContent.displayName = COMPONENT_NAME$2;
|
|
2431
2392
|
|
|
2432
2393
|
const COMPONENT_NAME$1 = 'TooltipTrigger';
|
|
2433
2394
|
const CLASSNAME$1 = 'redsift-tooltip-trigger';
|
|
2434
|
-
const DEFAULT_PROPS$1 = {};
|
|
2435
2395
|
|
|
2436
2396
|
/**
|
|
2437
2397
|
* The TooltipTrigger component.
|
|
@@ -2444,31 +2404,62 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2444
2404
|
getReferenceProps,
|
|
2445
2405
|
refs,
|
|
2446
2406
|
tooltipId,
|
|
2447
|
-
triggerClassName
|
|
2407
|
+
triggerClassName,
|
|
2408
|
+
color
|
|
2448
2409
|
} = useTooltipContext();
|
|
2449
2410
|
const childrenRef = children.ref;
|
|
2450
2411
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
2451
2412
|
if ( /*#__PURE__*/React.isValidElement(children)) {
|
|
2452
2413
|
var _children$props$child;
|
|
2453
|
-
return /*#__PURE__*/React.cloneElement(children, _objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
2414
|
+
return /*#__PURE__*/React.cloneElement(children, _objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
2454
2415
|
ref: triggerRef
|
|
2455
2416
|
}, props), {}, {
|
|
2456
2417
|
'aria-describedby': tooltipId
|
|
2457
2418
|
}, children.props), {}, {
|
|
2458
|
-
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
2459
|
-
|
|
2460
|
-
|
|
2419
|
+
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
2420
|
+
}))), {}, {
|
|
2421
|
+
className: classNames(children.props.className, triggerClassName),
|
|
2422
|
+
color: color !== null && color !== void 0 ? color : children.props.color
|
|
2423
|
+
}));
|
|
2461
2424
|
}
|
|
2462
2425
|
return /*#__PURE__*/React.createElement("span", _extends({
|
|
2463
2426
|
ref: triggerRef
|
|
2464
2427
|
}, getReferenceProps(props)), children);
|
|
2465
2428
|
});
|
|
2466
2429
|
TooltipTrigger.className = CLASSNAME$1;
|
|
2467
|
-
TooltipTrigger.defaultProps = DEFAULT_PROPS$1;
|
|
2468
2430
|
TooltipTrigger.displayName = COMPONENT_NAME$1;
|
|
2469
2431
|
|
|
2432
|
+
const TooltipContext = /*#__PURE__*/React.createContext(null);
|
|
2433
|
+
|
|
2434
|
+
/**
|
|
2435
|
+
* Context props.
|
|
2436
|
+
*/
|
|
2437
|
+
|
|
2438
|
+
/**
|
|
2439
|
+
* Component variant.
|
|
2440
|
+
*/
|
|
2441
|
+
const TooltipPlacement = {
|
|
2442
|
+
top: 'top',
|
|
2443
|
+
right: 'right',
|
|
2444
|
+
bottom: 'bottom',
|
|
2445
|
+
left: 'left',
|
|
2446
|
+
'top-start': 'top-start',
|
|
2447
|
+
'top-end': 'top-end',
|
|
2448
|
+
'right-start': 'right-start',
|
|
2449
|
+
'right-end': 'right-end',
|
|
2450
|
+
'bottom-start': 'bottom-start',
|
|
2451
|
+
'bottom-end': 'bottom-end',
|
|
2452
|
+
'left-start': 'left-start',
|
|
2453
|
+
'left-end': 'left-end'
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2456
|
+
/**
|
|
2457
|
+
* Component props.
|
|
2458
|
+
*/
|
|
2459
|
+
|
|
2470
2460
|
function useTooltip(_ref) {
|
|
2471
2461
|
let {
|
|
2462
|
+
color,
|
|
2472
2463
|
defaultOpen,
|
|
2473
2464
|
delay,
|
|
2474
2465
|
placement,
|
|
@@ -2521,13 +2512,14 @@ function useTooltip(_ref) {
|
|
|
2521
2512
|
});
|
|
2522
2513
|
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
2523
2514
|
return React.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2515
|
+
color,
|
|
2524
2516
|
isOpen,
|
|
2525
2517
|
handleOpen
|
|
2526
2518
|
}, interactions), data), {}, {
|
|
2527
2519
|
arrowRef,
|
|
2528
2520
|
tooltipId,
|
|
2529
2521
|
triggerClassName
|
|
2530
|
-
}), [isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
2522
|
+
}), [color, isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
2531
2523
|
}
|
|
2532
2524
|
|
|
2533
2525
|
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -2535,10 +2527,6 @@ const ThemeProvider = ThemeContext.Provider;
|
|
|
2535
2527
|
|
|
2536
2528
|
const COMPONENT_NAME = 'Tooltip';
|
|
2537
2529
|
const CLASSNAME = 'redsift-tooltip';
|
|
2538
|
-
const DEFAULT_PROPS = {
|
|
2539
|
-
delay: 500,
|
|
2540
|
-
placement: TooltipPlacement.top
|
|
2541
|
-
};
|
|
2542
2530
|
|
|
2543
2531
|
/**
|
|
2544
2532
|
* The Tooltip component.
|
|
@@ -2546,17 +2534,19 @@ const DEFAULT_PROPS = {
|
|
|
2546
2534
|
const BaseTooltip = props => {
|
|
2547
2535
|
const {
|
|
2548
2536
|
children,
|
|
2537
|
+
color,
|
|
2549
2538
|
defaultOpen,
|
|
2550
|
-
delay,
|
|
2539
|
+
delay = 500,
|
|
2551
2540
|
isOpen,
|
|
2552
2541
|
onOpen,
|
|
2553
|
-
placement,
|
|
2554
|
-
tooltipId,
|
|
2542
|
+
placement = TooltipPlacement.top,
|
|
2555
2543
|
theme: propsTheme,
|
|
2544
|
+
tooltipId,
|
|
2556
2545
|
triggerClassName
|
|
2557
2546
|
} = props;
|
|
2558
2547
|
const theme = useTheme ? useTheme(propsTheme) : undefined;
|
|
2559
2548
|
const tooltip = useTooltip({
|
|
2549
|
+
color,
|
|
2560
2550
|
defaultOpen,
|
|
2561
2551
|
delay,
|
|
2562
2552
|
placement,
|
|
@@ -2576,13 +2566,66 @@ const BaseTooltip = props => {
|
|
|
2576
2566
|
}, trigger && isComponent('TooltipTrigger')(trigger) ? trigger : null, content && isComponent('TooltipContent')(content) ? content : null));
|
|
2577
2567
|
};
|
|
2578
2568
|
BaseTooltip.className = CLASSNAME;
|
|
2579
|
-
BaseTooltip.defaultProps = DEFAULT_PROPS;
|
|
2580
2569
|
BaseTooltip.displayName = COMPONENT_NAME;
|
|
2581
2570
|
const Tooltip = Object.assign(BaseTooltip, {
|
|
2582
2571
|
Trigger: TooltipTrigger,
|
|
2583
2572
|
Content: TooltipContent
|
|
2584
2573
|
});
|
|
2585
2574
|
|
|
2575
|
+
const _excluded$2 = ["tooltip", "tooltipProps", "tooltipTriggerProps", "tooltipContentProps"];
|
|
2576
|
+
const ButtonWithTooltip = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
2577
|
+
let {
|
|
2578
|
+
tooltip,
|
|
2579
|
+
tooltipProps,
|
|
2580
|
+
tooltipTriggerProps,
|
|
2581
|
+
tooltipContentProps
|
|
2582
|
+
} = _ref,
|
|
2583
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
2584
|
+
return /*#__PURE__*/React.createElement(Tooltip, tooltipProps, /*#__PURE__*/React.createElement(Tooltip.Trigger, tooltipTriggerProps, /*#__PURE__*/React.createElement(Button, _extends({
|
|
2585
|
+
"aria-label": tooltip
|
|
2586
|
+
}, props, {
|
|
2587
|
+
"aria-describedby": undefined,
|
|
2588
|
+
ref: ref
|
|
2589
|
+
}))), /*#__PURE__*/React.createElement(Tooltip.Content, tooltipContentProps, tooltip));
|
|
2590
|
+
});
|
|
2591
|
+
ButtonWithTooltip.displayName = 'Button';
|
|
2592
|
+
|
|
2593
|
+
const _excluded$1 = ["tooltip", "tooltipProps", "tooltipTriggerProps", "tooltipContentProps"];
|
|
2594
|
+
const IconButtonLinkWithTooltip = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
2595
|
+
let {
|
|
2596
|
+
tooltip,
|
|
2597
|
+
tooltipProps,
|
|
2598
|
+
tooltipTriggerProps,
|
|
2599
|
+
tooltipContentProps
|
|
2600
|
+
} = _ref,
|
|
2601
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
2602
|
+
return /*#__PURE__*/React.createElement(Tooltip, tooltipProps, /*#__PURE__*/React.createElement(Tooltip.Trigger, tooltipTriggerProps, /*#__PURE__*/React.createElement(IconButtonLink, _extends({
|
|
2603
|
+
"aria-label": tooltip
|
|
2604
|
+
}, props, {
|
|
2605
|
+
"aria-describedby": undefined,
|
|
2606
|
+
ref: ref
|
|
2607
|
+
}))), /*#__PURE__*/React.createElement(Tooltip.Content, tooltipContentProps, tooltip));
|
|
2608
|
+
});
|
|
2609
|
+
IconButtonLinkWithTooltip.displayName = 'IconButtonLink';
|
|
2610
|
+
|
|
2611
|
+
const _excluded = ["tooltip", "tooltipProps", "tooltipTriggerProps", "tooltipContentProps"];
|
|
2612
|
+
const IconButtonWithTooltip = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
2613
|
+
let {
|
|
2614
|
+
tooltip,
|
|
2615
|
+
tooltipProps,
|
|
2616
|
+
tooltipTriggerProps,
|
|
2617
|
+
tooltipContentProps
|
|
2618
|
+
} = _ref,
|
|
2619
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
2620
|
+
return /*#__PURE__*/React.createElement(Tooltip, tooltipProps, /*#__PURE__*/React.createElement(Tooltip.Trigger, tooltipTriggerProps, /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
2621
|
+
"aria-label": tooltip
|
|
2622
|
+
}, props, {
|
|
2623
|
+
"aria-describedby": undefined,
|
|
2624
|
+
ref: ref
|
|
2625
|
+
}))), /*#__PURE__*/React.createElement(Tooltip.Content, tooltipContentProps, tooltip));
|
|
2626
|
+
});
|
|
2627
|
+
IconButtonWithTooltip.displayName = 'IconButton';
|
|
2628
|
+
|
|
2586
2629
|
const useTooltipContext = () => {
|
|
2587
2630
|
const context = React.useContext(TooltipContext);
|
|
2588
2631
|
if (context == null) {
|
|
@@ -2591,5 +2634,11 @@ const useTooltipContext = () => {
|
|
|
2591
2634
|
return context;
|
|
2592
2635
|
};
|
|
2593
2636
|
|
|
2594
|
-
|
|
2637
|
+
const WithTooltip = {
|
|
2638
|
+
Button: ButtonWithTooltip,
|
|
2639
|
+
IconButton: IconButtonWithTooltip,
|
|
2640
|
+
IconButtonLink: IconButtonLinkWithTooltip
|
|
2641
|
+
};
|
|
2642
|
+
|
|
2643
|
+
export { BaseDialog, BaseDialogContent, BasePopover, BaseTooltip, ButtonWithTooltip, Dialog, DialogContent, DialogContentActions, DialogContentBody, DialogContentHeader, DialogContext, DialogSize, DialogTrigger, IconButtonLinkWithTooltip, IconButtonWithTooltip, Popover, PopoverContent, PopoverContext, PopoverPlacement, PopoverTrigger, StyledPopoverContent, Toast, ToastContainer, ToastPlacement, ToastVariant, Tooltip, TooltipContent, TooltipContext, TooltipPlacement, TooltipTrigger, WithTooltip, sizeToDimension, useDialog, useDialogContext, usePopover, usePopoverContext, useToast, useTooltip, useTooltipContext };
|
|
2595
2644
|
//# sourceMappingURL=index.js.map
|