@rio-cloud/rio-uikit 1.2.2 → 1.3.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/.DS_Store +0 -0
- package/DateRangePicker.d.ts +6 -7
- package/DateRangePicker.js +7 -3
- package/README.md +3 -3
- package/components/actionBarItem/ActionBarItem.js +5 -1
- package/components/actionBarItem/ActionBarItemIcon.d.ts +6 -8
- package/components/actionBarItem/ActionBarItemIcon.js +4 -4
- package/components/actionBarItem/ActionBarOverlay.d.ts +3 -2
- package/components/actionBarItem/ActionBarOverlay.js +7 -7
- package/components/applicationLayout/ApplicationLayout.js +1 -0
- package/components/applicationLayout/ApplicationLayoutHeader.js +0 -4
- package/components/assetTree/TreeOptions.js +1 -1
- package/components/assetTree/treeUtils.js +1 -1
- package/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/components/calendarStripe/CalendarStripe.js +7 -4
- package/components/dataTabs/DataTab.js +2 -1
- package/components/dialog/SimpleDialog.d.ts +2 -2
- package/components/dialog/SplitDialog.d.ts +6 -0
- package/components/expander/ExpanderList.js +2 -1
- package/components/listMenu/ListMenu.js +1 -1
- package/components/onboarding/OnboardingTip.d.ts +2 -2
- package/components/onboarding/OnboardingTip.js +2 -0
- package/components/overlay/OverlayTrigger.d.ts +92 -3
- package/components/overlay/OverlayTrigger.js +140 -8
- package/components/popover/Popover.d.ts +27 -9
- package/components/popover/Popover.js +18 -5
- package/components/slider/RangeSlider.d.ts +7 -0
- package/components/slider/RangeSlider.js +10 -4
- package/components/slider/Slider.d.ts +7 -0
- package/components/slider/Slider.js +5 -3
- package/components/states/CustomState.js +4 -5
- package/components/switch/Switch.d.ts +7 -0
- package/components/switch/Switch.js +4 -3
- package/components/tooltip/SimpleTooltip.d.ts +2 -2
- package/components/tooltip/Tooltip.d.ts +2 -2
- package/components/tooltip/Tooltip.js +6 -2
- package/hooks/useClickOutside.d.ts +1 -0
- package/hooks/useClickOutside.js +9 -3
- package/hooks/useElapsedTime.d.ts +26 -0
- package/hooks/useElapsedTime.js +36 -0
- package/hooks/useEvent.d.ts +1 -1
- package/hooks/useTimeout.d.ts +5 -0
- package/hooks/useTimeout.js +39 -1
- package/hooks/useUncontrollable.d.ts +13 -0
- package/hooks/useUncontrollable.js +41 -0
- package/lib/es/DateRangePicker.d.ts +6 -7
- package/lib/es/DateRangePicker.js +5 -1
- package/lib/es/components/actionBarItem/ActionBarItem.js +5 -1
- package/lib/es/components/actionBarItem/ActionBarItemIcon.d.ts +6 -8
- package/lib/es/components/actionBarItem/ActionBarItemIcon.js +4 -4
- package/lib/es/components/actionBarItem/ActionBarOverlay.d.ts +3 -2
- package/lib/es/components/actionBarItem/ActionBarOverlay.js +7 -7
- package/lib/es/components/applicationLayout/ApplicationLayout.js +1 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutHeader.js +0 -4
- package/lib/es/components/assetTree/TreeOptions.js +1 -1
- package/lib/es/components/assetTree/treeUtils.js +1 -1
- package/lib/es/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/lib/es/components/calendarStripe/CalendarStripe.js +7 -4
- package/lib/es/components/dataTabs/DataTab.js +2 -1
- package/lib/es/components/dialog/SimpleDialog.d.ts +2 -2
- package/lib/es/components/dialog/SplitDialog.d.ts +6 -0
- package/lib/es/components/expander/ExpanderList.js +2 -1
- package/lib/es/components/listMenu/ListMenu.js +1 -1
- package/lib/es/components/onboarding/OnboardingTip.d.ts +2 -2
- package/lib/es/components/onboarding/OnboardingTip.js +2 -0
- package/lib/es/components/overlay/OverlayTrigger.d.ts +92 -3
- package/lib/es/components/overlay/OverlayTrigger.js +139 -7
- package/lib/es/components/popover/Popover.d.ts +27 -9
- package/lib/es/components/popover/Popover.js +20 -6
- package/lib/es/components/slider/RangeSlider.d.ts +7 -0
- package/lib/es/components/slider/RangeSlider.js +10 -4
- package/lib/es/components/slider/Slider.d.ts +7 -0
- package/lib/es/components/slider/Slider.js +5 -3
- package/lib/es/components/states/CustomState.js +4 -5
- package/lib/es/components/switch/Switch.d.ts +7 -0
- package/lib/es/components/switch/Switch.js +4 -3
- package/lib/es/components/tooltip/SimpleTooltip.d.ts +2 -2
- package/lib/es/components/tooltip/Tooltip.d.ts +2 -2
- package/lib/es/components/tooltip/Tooltip.js +5 -1
- package/lib/es/hooks/useClickOutside.d.ts +1 -0
- package/lib/es/hooks/useClickOutside.js +11 -3
- package/lib/es/hooks/useElapsedTime.d.ts +26 -0
- package/lib/es/hooks/useElapsedTime.js +38 -0
- package/lib/es/hooks/useEvent.d.ts +1 -1
- package/lib/es/hooks/useTimeout.d.ts +5 -0
- package/lib/es/hooks/useTimeout.js +40 -0
- package/lib/es/hooks/useUncontrollable.d.ts +13 -0
- package/lib/es/hooks/useUncontrollable.js +46 -0
- package/lib/es/styles/variables/colors/colors.json +3 -3
- package/lib/es/useElapsedTime.d.ts +2 -0
- package/lib/es/useElapsedTime.js +7 -0
- package/lib/es/utils/currentColors.d.ts +3 -0
- package/lib/es/utils/currentColors.js +14 -0
- package/lib/es/utils/hasUtilityClass.d.ts +30 -0
- package/lib/es/utils/hasUtilityClass.js +71 -0
- package/lib/es/utils/init/initCSS.js +12 -0
- package/lib/es/utils/mergeRefs.d.ts +1 -1
- package/lib/es/values/Trigger.d.ts +1 -2
- package/lib/es/version.json +1 -1
- package/package.json +18 -12
- package/styles/variables/colors/colors.json +3 -3
- package/useElapsedTime.d.ts +2 -0
- package/useElapsedTime.js +2 -0
- package/utils/currentColors.d.ts +3 -0
- package/utils/currentColors.js +10 -0
- package/utils/hasUtilityClass.d.ts +30 -0
- package/utils/hasUtilityClass.js +40 -0
- package/utils/init/initCSS.js +12 -0
- package/utils/mergeRefs.d.ts +1 -1
- package/values/Trigger.d.ts +1 -2
- package/version.json +1 -1
- package/components/.DS_Store +0 -0
- package/components/feedback/Feedback.d.ts +0 -2
- package/components/feedback/Feedback.js +0 -5
- package/components/map/.DS_Store +0 -0
- package/components/map/components/.DS_Store +0 -0
- package/lib/.DS_Store +0 -0
- package/lib/es/.DS_Store +0 -0
- package/lib/es/components/.DS_Store +0 -0
- package/lib/es/components/feedback/Feedback.d.ts +0 -2
- package/lib/es/components/feedback/Feedback.js +0 -7
|
@@ -99,7 +99,7 @@ const ActionBarItemBase = (props) => {
|
|
|
99
99
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { className: classes, ref: clickOutsideRef }, { children: [react_1.default.cloneElement(itemIcon, { onClick: onToggle }), (0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: () => setIsShown(false) }, { children: (0, jsx_runtime_1.jsx)(Dialog_1.default, { show: isShown, onClose: () => setIsShown(false), body: itemPopover, bodyClassName: mobileDialogBodyClassName, title: title }) })), childrenWithoutPopoverAndIcon] })));
|
|
100
100
|
}
|
|
101
101
|
const overlay = ((0, jsx_runtime_1.jsx)(ActionBarOverlay_1.default, Object.assign({ id: id, title: title, width: popoverWidth, preRender: useOffscreen, show: isShown }, { children: itemPopover }), 'child'));
|
|
102
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { className: classes, ref: clickOutsideRef }, { children: [(0, jsx_runtime_1.jsx)(OverlayTrigger_1.default, Object.assign({ onToggle: onToggle, show: isShown || useOffscreen, placement: OverlayTrigger_1.default.BOTTOM_END, overlay: overlay, trigger: 'click',
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { className: classes, ref: clickOutsideRef }, { children: [(0, jsx_runtime_1.jsx)(OverlayTrigger_1.default, Object.assign({ onToggle: onToggle, show: isShown || useOffscreen, placement: OverlayTrigger_1.default.BOTTOM_END, overlay: overlay, rootClose: false, trigger: 'click', popperConfig: {
|
|
103
103
|
modifiers: [
|
|
104
104
|
{
|
|
105
105
|
name: 'offset',
|
|
@@ -107,6 +107,10 @@ const ActionBarItemBase = (props) => {
|
|
|
107
107
|
offset: [0, 5],
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
name: 'arrow',
|
|
112
|
+
options: {},
|
|
113
|
+
},
|
|
110
114
|
],
|
|
111
115
|
} }, { children: itemIcon })), childrenWithoutPopoverAndIcon] })));
|
|
112
116
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
className?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
displayName: string;
|
|
8
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const ActionBarItemIcon: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
7
|
export default ActionBarItemIcon;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
6
|
-
require("react");
|
|
6
|
+
const react_1 = require("react");
|
|
7
7
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
|
-
const ActionBarItemIcon = (props) => {
|
|
8
|
+
const ActionBarItemIcon = (0, react_1.forwardRef)((props, ref) => {
|
|
9
9
|
const { className, children } = props, remainingProps = tslib_1.__rest(props, ["className", "children"]);
|
|
10
10
|
const classes = (0, classnames_1.default)('ActionBarItemIcon', className);
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, remainingProps, { className: classes }, { children: children })));
|
|
12
|
-
};
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, remainingProps, { className: classes, ref: ref }, { children: children })));
|
|
12
|
+
});
|
|
13
13
|
// The displayName is used in ActionBarItem for checking the component "isActionBarItemIcon"
|
|
14
14
|
ActionBarItemIcon.displayName = 'ActionBarItemIcon';
|
|
15
15
|
exports.default = ActionBarItemIcon;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PLACEMENT_MAP } from '../popover/Popover';
|
|
3
|
+
import type { ObjectValues } from '../../utils/ObjectValues';
|
|
3
4
|
export type ActionBarOverlayWidth = 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500;
|
|
4
5
|
export type ActionBarOverlayProps = {
|
|
5
6
|
id: string;
|
|
@@ -9,7 +10,7 @@ export type ActionBarOverlayProps = {
|
|
|
9
10
|
width?: ActionBarOverlayWidth;
|
|
10
11
|
onClick?: () => void;
|
|
11
12
|
style?: object;
|
|
12
|
-
placement?:
|
|
13
|
+
placement?: ObjectValues<typeof PLACEMENT_MAP>;
|
|
13
14
|
className?: string;
|
|
14
15
|
};
|
|
15
16
|
declare const ActionBarOverlay: React.ForwardRefExoticComponent<ActionBarOverlayProps & {
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
7
|
-
const Popover_1 = tslib_1.__importDefault(require("react-bootstrap/Popover"));
|
|
8
8
|
const noop_1 = tslib_1.__importDefault(require("lodash/fp/noop"));
|
|
9
|
-
const
|
|
10
|
-
const DEFAULT_PLACEMENT =
|
|
9
|
+
const Popover_1 = tslib_1.__importStar(require("../popover/Popover"));
|
|
10
|
+
const DEFAULT_PLACEMENT = Popover_1.PLACEMENT_MAP.BOTTOM;
|
|
11
11
|
const DEFAULT_WIDTH = 250;
|
|
12
12
|
const ActionBarOverlay = (0, react_1.forwardRef)((props, ref) => {
|
|
13
|
-
const { children, show, preRender, id, title, onClick = noop_1.default, width = DEFAULT_WIDTH, style = {}, className, placement = DEFAULT_PLACEMENT } = props,
|
|
13
|
+
const { children, show, preRender, id, title, onClick = noop_1.default, width = DEFAULT_WIDTH, style = {}, className, placement = DEFAULT_PLACEMENT } = props, remainingProps = tslib_1.__rest(props, ["children", "show", "preRender", "id", "title", "onClick", "width", "style", "className", "placement"]);
|
|
14
14
|
const adjustedStyles = Object.assign(Object.assign({}, style), { width });
|
|
15
15
|
const adjustedClassName = preRender && !show ? (0, classnames_1.default)(className, 'position-offscreen') : className;
|
|
16
|
-
const popoverTitleClasses = (0, classnames_1.default)('ActionBarItemPopover
|
|
17
|
-
const popoverContentClasses = (0, classnames_1.default)('ActionBarItemPopover
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)(Popover_1.default, Object.assign({ ref: ref, id: id, onClick: onClick, placement: placement },
|
|
16
|
+
const popoverTitleClasses = (0, classnames_1.default)('ActionBarItemPopover text-color-dark', className);
|
|
17
|
+
const popoverContentClasses = (0, classnames_1.default)('ActionBarItemPopover', className);
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(Popover_1.default, Object.assign({ ref: ref, id: id, onClick: onClick, placement: placement }, remainingProps, { style: adjustedStyles, className: adjustedClassName }, { children: [title && (0, jsx_runtime_1.jsx)(Popover_1.default.Title, Object.assign({ className: popoverTitleClasses }, { children: title })), (0, jsx_runtime_1.jsx)(Popover_1.default.Content, Object.assign({ className: popoverContentClasses }, { children: children }))] })));
|
|
19
19
|
});
|
|
20
20
|
exports.default = ActionBarOverlay;
|
|
@@ -9,6 +9,7 @@ const ApplicationLayoutHeader_1 = tslib_1.__importDefault(require("./Application
|
|
|
9
9
|
const ApplicationLayoutSidebar_1 = tslib_1.__importDefault(require("./ApplicationLayoutSidebar"));
|
|
10
10
|
const ApplicationLayoutBody_1 = tslib_1.__importDefault(require("./ApplicationLayoutBody"));
|
|
11
11
|
const initDocumentBootstrapping_1 = require("../../utils/init/initDocumentBootstrapping");
|
|
12
|
+
require("../../utils/init/initConfig");
|
|
12
13
|
// initializes document bootstrapping - keep the import to avoid being tree-shaken
|
|
13
14
|
// noinspection JSIgnoredPromiseFromCall
|
|
14
15
|
(0, initDocumentBootstrapping_1.initDocumentBootstrapping)();
|
|
@@ -3,14 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const prop_types_1 = tslib_1.__importDefault(require("prop-types"));
|
|
7
6
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
7
|
const ApplicationLayoutHeader = (0, react_1.forwardRef)((props, ref) => {
|
|
9
8
|
const { className, children } = props, remainingProps = tslib_1.__rest(props, ["className", "children"]);
|
|
10
9
|
const classes = (0, classnames_1.default)('ApplicationLayoutHeader', className);
|
|
11
10
|
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref }, remainingProps, { className: classes, id: 'ApplicationLayoutHeader' }, { children: children })));
|
|
12
11
|
});
|
|
13
|
-
ApplicationLayoutHeader.propTypes = {
|
|
14
|
-
className: prop_types_1.default.string,
|
|
15
|
-
};
|
|
16
12
|
exports.default = ApplicationLayoutHeader;
|
|
@@ -15,7 +15,7 @@ const TreeOptions = (props) => {
|
|
|
15
15
|
}
|
|
16
16
|
const dropdownClasses = (0, classnames_1.default)('display-flex flex-column gap-10', 'width-250', 'padding-15', className);
|
|
17
17
|
const customDropdown = (0, jsx_runtime_1.jsx)("div", Object.assign({ className: dropdownClasses }, { children: treeOptions }));
|
|
18
|
-
const dropdown = ((0, jsx_runtime_1.jsx)(ButtonDropdown_1.default, { title: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-option-vertical', "aria-hidden": 'true' }), bsStyle: 'default', bsSize: 'sm', customDropdown: customDropdown, toggleClassName: 'hover-bg-white border-none text-color-gray hover-text-color-dark', className: 'TreeHeaderOptions', pullRight: true, iconOnly: true }));
|
|
18
|
+
const dropdown = ((0, jsx_runtime_1.jsx)(ButtonDropdown_1.default, { title: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-option-vertical', "aria-hidden": 'true' }), bsStyle: 'default', bsSize: 'sm', customDropdown: customDropdown, toggleClassName: 'hover-bg-white border-none text-color-gray hover-text-color-dark', className: 'TreeHeaderOptions height-20', pullRight: true, iconOnly: true }));
|
|
19
19
|
if (treeOptionsTooltip) {
|
|
20
20
|
return ((0, jsx_runtime_1.jsx)(SimpleTooltip_1.default, Object.assign({ content: treeOptionsTooltip, placement: 'bottom', delay: { show: 1000, hide: 0 }, popperConfig: {
|
|
21
21
|
modifiers: [
|
|
@@ -38,7 +38,7 @@ const orderByName = (0, orderBy_1.default)([
|
|
|
38
38
|
var _a;
|
|
39
39
|
return isNameObject(item)
|
|
40
40
|
? item.name.lastName.toLowerCase()
|
|
41
|
-
: (_a = item.name.toLowerCase()) !== null && _a !== void 0 ? _a : '';
|
|
41
|
+
: ((_a = item.name.toLowerCase()) !== null && _a !== void 0 ? _a : '');
|
|
42
42
|
},
|
|
43
43
|
], ['asc']);
|
|
44
44
|
// TODO: extend to use provided external search function instead?
|
|
@@ -62,6 +62,14 @@ export type CalendarStripeProps = {
|
|
|
62
62
|
* Additional classes set to the calendar element.
|
|
63
63
|
*/
|
|
64
64
|
className?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Additional classes set to the days wrapper element.
|
|
67
|
+
*/
|
|
68
|
+
daysWrapperClassName?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Additional classes set to the days wrapper element.
|
|
71
|
+
*/
|
|
72
|
+
dayWrapperClassName?: string;
|
|
65
73
|
};
|
|
66
74
|
declare const CalendarStripe: React.ForwardRefExoticComponent<CalendarStripeProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
75
|
export default CalendarStripe;
|
|
@@ -9,6 +9,7 @@ const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
|
9
9
|
const useAfterMount_1 = tslib_1.__importDefault(require("../../hooks/useAfterMount"));
|
|
10
10
|
const useElementSize_1 = tslib_1.__importDefault(require("../../hooks/useElementSize"));
|
|
11
11
|
const usePrevious_1 = tslib_1.__importDefault(require("../../hooks/usePrevious"));
|
|
12
|
+
const hasUtilityClass_1 = require("../../utils/hasUtilityClass");
|
|
12
13
|
const DEFAULT_MIN_WITH = 200;
|
|
13
14
|
const DEFAULT_MIN_DAYS = 1;
|
|
14
15
|
const DEFAULT_MAX_DAYS = 7;
|
|
@@ -31,7 +32,7 @@ const getFirstColumnItem = (node) => {
|
|
|
31
32
|
return getFirstColumnItem(node.children[0]);
|
|
32
33
|
};
|
|
33
34
|
const CalendarStripe = (0, react_1.forwardRef)((props, ref) => {
|
|
34
|
-
const { minDayWith = DEFAULT_MIN_WITH, minDays = DEFAULT_MIN_DAYS, maxDays = DEFAULT_MAX_DAYS, render, renderDay, skipWeekends = false, startDate = new Date(), onNextClick = noop_1.default, onPreviousClick = noop_1.default, buttonClassName = '', className = '', } = props;
|
|
35
|
+
const { minDayWith = DEFAULT_MIN_WITH, minDays = DEFAULT_MIN_DAYS, maxDays = DEFAULT_MAX_DAYS, render, renderDay, skipWeekends = false, startDate = new Date(), onNextClick = noop_1.default, onPreviousClick = noop_1.default, buttonClassName = '', className = '', daysWrapperClassName = '', dayWrapperClassName = '', } = props;
|
|
35
36
|
if (render) {
|
|
36
37
|
console.warn('CalendarStripe has set the "render" prop deprecated. This will be removed in the upcoming releases,' +
|
|
37
38
|
' Please use the "renderDay" prop instead.');
|
|
@@ -117,8 +118,10 @@ const CalendarStripe = (0, react_1.forwardRef)((props, ref) => {
|
|
|
117
118
|
addDays = false;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
|
|
121
|
+
const wrapperClassNames = (0, classnames_1.default)('CalenderStripe', !(0, hasUtilityClass_1.hasDisplayClass)(className) && 'display-flex', !(0, hasUtilityClass_1.hasAlignItemsClass)(className) && 'align-items-center', !(0, hasUtilityClass_1.hasOverflowClass)(className) && 'overflow-hidden', !(0, hasUtilityClass_1.hasBgClass)(className) && 'bg-white', !(0, hasUtilityClass_1.hasBorderClass)(className) && 'border', !(0, hasUtilityClass_1.hasRoundedClass)(className) && 'rounded', className);
|
|
122
|
+
const baseButtonClassNames = (0, classnames_1.default)(!(0, hasUtilityClass_1.hasAlignItemsClass)(buttonClassName) && 'align-items-center', !(0, hasUtilityClass_1.hasDisplayClass)(buttonClassName) && 'display-flex', !(0, hasUtilityClass_1.hasHoverScaleClass)(buttonClassName) && 'hover-scale-105', !(0, hasUtilityClass_1.hasHoverTextColorClass)(buttonClassName) && 'hover-text-color-darkest', !(0, hasUtilityClass_1.hasPaddingClass)(buttonClassName) && 'padding-10', !(0, hasUtilityClass_1.hasCursorClass)(buttonClassName) && 'cursor-pointer', !(0, hasUtilityClass_1.hasTextColorClass)(buttonClassName) && 'text-color-darker', !(0, hasUtilityClass_1.hasTextSizeClass)(buttonClassName) && 'text-size-12', !(0, hasUtilityClass_1.hasAlignSelfClass)(buttonClassName) && 'align-self-stretch', buttonClassName);
|
|
123
|
+
const daysWrapperClassNames = (0, classnames_1.default)(!(0, hasUtilityClass_1.hasDisplayClass)(daysWrapperClassName) && 'display-flex', !(0, hasUtilityClass_1.hasSpaceClass)(daysWrapperClassName) && 'space-x--1', !(0, hasUtilityClass_1.hasUserSelectClass)(daysWrapperClassName) && 'user-select-none', daysWrapperClassName);
|
|
124
|
+
const dayWrapperClassNames = (0, classnames_1.default)(ITEM_NAME, !(0, hasUtilityClass_1.hasFlexClass)(dayWrapperClassName) && 'flex-1-1-0', !(0, hasUtilityClass_1.hasSpaceClass)(dayWrapperClassName) && 'space-x--1', !(0, hasUtilityClass_1.hasUserSelectClass)(dayWrapperClassName) && 'user-select-none', dayWrapperClassName);
|
|
125
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: wrapperClassNames }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: baseButtonClassNames, onClick: handlePrev }, { children: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-chevron-left' }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'flex-1-1 overflow-hidden', ref: columnWrapperRef }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, Object.assign({ exitBeforeEnter: true, custom: animationDirection }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ variants: variants, initial: enableInitialAnimation ? 'pageEnter' : false, animate: 'pageCenter', custom: animationDirection, transition: { duration: ANIMATION_DURATION } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: daysWrapperClassNames }, { children: dates.map(date => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: dayWrapperClassNames }, { children: [renderDay ? renderDay(date) : null, render && react_1.default.cloneElement((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: render }), { date })] }), `${getDateString(date)}`))) })) }), getDateString(firstDate)) })) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: baseButtonClassNames, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-chevron-right' }) }))] })));
|
|
123
126
|
});
|
|
124
127
|
exports.default = CalendarStripe;
|
|
@@ -7,7 +7,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
require("react");
|
|
8
8
|
const framer_motion_1 = require("framer-motion");
|
|
9
9
|
const DataTab = (props) => {
|
|
10
|
-
const { active = false,
|
|
10
|
+
const { active = false, title, // exclude from remainingProps to avoid being set to the div element
|
|
11
|
+
tabKey, disableTransition = false, className = '', children } = props, remainingProps = tslib_1.__rest(props, ["active", "title", "tabKey", "disableTransition", "className", "children"]);
|
|
11
12
|
if (disableTransition) {
|
|
12
13
|
return (0, jsx_runtime_1.jsx)("div", { children: active && children });
|
|
13
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
export type SimpleDialogProps =
|
|
2
|
+
import { type DialogProps } from './Dialog';
|
|
3
|
+
export type SimpleDialogProps = Omit<DialogProps, 'body'> & {
|
|
4
4
|
/**
|
|
5
5
|
* The content of the dialog body itself.
|
|
6
6
|
*/
|
|
@@ -25,6 +25,12 @@ export type SplitDialogProps = BaseDialogProps & {
|
|
|
25
25
|
* Additional classes for the modal-footer element.
|
|
26
26
|
*/
|
|
27
27
|
footerClassName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A callback function to be executed before closing the dialog. If the function returns
|
|
30
|
+
* `false` the dialog will not be closed
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
onCloseValidation?: () => boolean;
|
|
28
34
|
};
|
|
29
35
|
declare const SplitDialog: (props: SplitDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
36
|
export default SplitDialog;
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const isEqual_1 = tslib_1.__importDefault(require("lodash/fp/isEqual"));
|
|
7
7
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
8
|
const Collapse_1 = tslib_1.__importDefault(require("../collapse/Collapse"));
|
|
9
|
+
const hasUtilityClass_1 = require("../../utils/hasUtilityClass");
|
|
9
10
|
const getRandomString = () => (Math.random() + 1).toString(36).toUpperCase().substring(2);
|
|
10
11
|
// Generate a unique id (if not present) instead of using the index for the key as it will create
|
|
11
12
|
// side effects when removing items from the list and re-render the ExpanderList.
|
|
@@ -41,7 +42,7 @@ const ExpanderList = (props) => {
|
|
|
41
42
|
});
|
|
42
43
|
setListItems(updatedListItems);
|
|
43
44
|
};
|
|
44
|
-
const listClassNames = (0, classnames_1.default)('expander-list list-group', rounded && 'rounded', bordered && 'border', className);
|
|
45
|
+
const listClassNames = (0, classnames_1.default)('expander-list list-group', rounded && !(0, hasUtilityClass_1.hasRoundedClass)(className) && 'rounded', bordered && !(0, hasUtilityClass_1.hasBorderClass)(className) && 'border', className);
|
|
45
46
|
return ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: listClassNames }, { children: listItems.map(item => {
|
|
46
47
|
const isOpen = item.open;
|
|
47
48
|
const itemClassNames = (0, classnames_1.default)('list-group-item', item.className && item.className, item.body && 'expandable', isOpen && 'open');
|
|
@@ -68,7 +68,7 @@ const ListMenu = (props) => {
|
|
|
68
68
|
setIsExpanderOpen(false);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
const formClassNames = (0, classnames_1.default)('form-group', 'margin-bottom-5', 'padding-left-15', 'padding-right-15', 'padding-bottom-15', 'position-sticky', 'top-0');
|
|
71
|
+
const formClassNames = (0, classnames_1.default)('form-group', 'margin-top-5', 'margin-bottom-5', 'padding-left-15', 'padding-right-15', 'padding-bottom-15', 'position-sticky', 'top-0');
|
|
72
72
|
const listMenu = ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { className: `ListMenu ${className}`, ref: listRef }, { children: [enableFilter && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: formClassNames }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'input-group width-100pct' }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'input-group-addon' }, { children: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-search', "aria-hidden": 'true' }) })), (0, jsx_runtime_1.jsx)(ClearableInput_1.default, { value: filterValue, inputRef: inputRef, placeholder: filterPlaceholder, onChange: handleFilterChange, onClear: handleClear }), trailingInputAddon && trailingInputAddon] })) }))), !hasMenuItems(filteredMenuItems) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'padding-top-25 text-center text-color-gray' }, { children: notFoundMessage }))), filteredMenuItems.map(menuGroup => ((0, jsx_runtime_1.jsx)(ListMenuGroup_1.default, { className: groupClassName, menuGroup: menuGroup }, crypto.randomUUID())))] })));
|
|
73
73
|
if (responsive && isMobileMode) {
|
|
74
74
|
return ((0, jsx_runtime_1.jsx)(ExpanderPanel_1.default, Object.assign({ title: mobileHeader, bsStyle: 'default', open: isExpanderOpen, onToggle: () => setIsExpanderOpen(!isExpanderOpen), unmountOnExit: false, className: 'shadow-default' }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: handleExpanderBodyClick }, { children: listMenu })) })));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Options } from '@popperjs/core';
|
|
3
3
|
import { type TooltipWidth } from '../tooltip/Tooltip';
|
|
4
4
|
import { type TextAlignment } from '../../values/TextAlignment';
|
|
5
5
|
import { type Placement } from '../../values/Placement';
|
|
6
|
-
type PopperConfig = OverlayProps['popperConfig'];
|
|
7
6
|
export type OnboardingButton = {
|
|
8
7
|
text: string | React.ReactNode;
|
|
9
8
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
9
|
iconName?: string;
|
|
11
10
|
};
|
|
11
|
+
type PopperConfig = Partial<Options>;
|
|
12
12
|
export type OnboardingTipProps = {
|
|
13
13
|
/**
|
|
14
14
|
* The ID of the DOM element.
|
|
@@ -24,6 +24,8 @@ const OnboardingTip = (props) => {
|
|
|
24
24
|
// Popper.js default is false but we enable it by default
|
|
25
25
|
options: { altAxis: preventOverflow },
|
|
26
26
|
},
|
|
27
|
+
// Use an arrow modifier, the arrow ref will be injected in OverlayTrigger with the right props
|
|
28
|
+
{ name: 'arrow', options: {} },
|
|
27
29
|
],
|
|
28
30
|
};
|
|
29
31
|
const trigger = ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.default, Object.assign({ placement: placement, trigger: 'click', overlay: overlay, onToggle: onHide, show: show, rootClose: false, popperConfig: actualPopperConfig }, { children: children })));
|
|
@@ -1,6 +1,95 @@
|
|
|
1
|
-
import { type PropsWithChildren } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
import type { Options } from '@popperjs/core';
|
|
3
|
+
import { type Placement } from '../../values/Placement';
|
|
4
|
+
import { type TriggerType } from '../../values/Trigger';
|
|
5
|
+
type PopperConfig = Partial<Options>;
|
|
6
|
+
export type OverlayTriggerProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The visibility of the Overlay. `show` is a _controlled_ prop so should be paired
|
|
9
|
+
* with `onToggle` to avoid breaking user interactions.
|
|
10
|
+
*
|
|
11
|
+
* Manually toggling `show` does **not** wait for `delay` to change the visibility.
|
|
12
|
+
*
|
|
13
|
+
* @controllable onToggle
|
|
14
|
+
* @default: false
|
|
15
|
+
*/
|
|
16
|
+
show?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The initial visibility state of the Overlay.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
defaultShow?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the usage of React Portal.
|
|
25
|
+
*
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
enablePortal?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Specify which action or actions trigger Overlay visibility
|
|
31
|
+
*
|
|
32
|
+
* The `click` trigger ignores the configured `delay`.
|
|
33
|
+
*
|
|
34
|
+
* @default 'hover'
|
|
35
|
+
*/
|
|
36
|
+
trigger?: TriggerType;
|
|
37
|
+
/**
|
|
38
|
+
* A millisecond delay amount to show and hide the Overlay once triggered
|
|
39
|
+
*/
|
|
40
|
+
delay?: number | {
|
|
41
|
+
show?: number;
|
|
42
|
+
hide?: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An element or text to overlay next to the target.
|
|
46
|
+
*/
|
|
47
|
+
overlay: React.ReactElement;
|
|
48
|
+
/**
|
|
49
|
+
* The placement of the Overlay in relation to it's `target`.
|
|
50
|
+
*
|
|
51
|
+
* @default 'top'
|
|
52
|
+
*/
|
|
53
|
+
placement?: Placement;
|
|
54
|
+
/**
|
|
55
|
+
* A Popper.js config object passed to the underlying popper instance.
|
|
56
|
+
* If no custom config is provided, a default config will be used. This default config
|
|
57
|
+
* includes an arrow element. In case you want to use a custom config and an arrow, include the arrow
|
|
58
|
+
* modifier so the correct arrow element can be injected for the arrow modifier.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* popperConfig={{
|
|
62
|
+
* modifiers: [
|
|
63
|
+
* {
|
|
64
|
+
* name: 'offset',
|
|
65
|
+
* options: {
|
|
66
|
+
* offset: [0, 5],
|
|
67
|
+
* },
|
|
68
|
+
* },
|
|
69
|
+
* {
|
|
70
|
+
* name: 'arrow',
|
|
71
|
+
* options: {},
|
|
72
|
+
* },
|
|
73
|
+
* ],
|
|
74
|
+
* }}
|
|
75
|
+
*/
|
|
76
|
+
popperConfig?: PopperConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Specify whether the overlay should trigger onHide when the user clicks outside the overlay.
|
|
79
|
+
*
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
rootClose?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* A callback that fires when the user triggers a change in tooltip visibility.
|
|
85
|
+
*
|
|
86
|
+
* `onToggle` is called with the desired next `show`, and generally should be passed
|
|
87
|
+
* back to the `show` prop. `onToggle` fires _after_ the configured `delay`
|
|
88
|
+
*
|
|
89
|
+
* @controllable `show`
|
|
90
|
+
*/
|
|
91
|
+
onToggle?: (show: boolean) => void;
|
|
92
|
+
};
|
|
4
93
|
declare const OverlayTrigger: {
|
|
5
94
|
(props: PropsWithChildren<OverlayTriggerProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
95
|
TRIGGER_CLICK: "click";
|
|
@@ -3,16 +3,148 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
6
|
-
require("react");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
|
|
8
|
+
const react_popper_1 = require("react-popper");
|
|
9
9
|
const Placement_1 = require("../../values/Placement");
|
|
10
10
|
const Trigger_1 = require("../../values/Trigger");
|
|
11
|
+
const mergeRefs_1 = tslib_1.__importDefault(require("../../utils/mergeRefs"));
|
|
12
|
+
const useClickOutside_1 = require("../../hooks/useClickOutside");
|
|
13
|
+
const useTimeout_1 = require("../../hooks/useTimeout");
|
|
14
|
+
const useUncontrollable_1 = require("../../hooks/useUncontrollable");
|
|
11
15
|
const OverlayTrigger = (props) => {
|
|
12
|
-
|
|
13
|
-
const { children } = props;
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const { show: propsShow, defaultShow = false, enablePortal = true, trigger = Trigger_1.TRIGGER.HOVER, delay, overlay, placement = 'top', popperConfig, onToggle = () => { }, rootClose = true, children, } = props;
|
|
18
|
+
// Use a hook to handle controlled props that work in pairs like in this case the "show" and "onToggle"
|
|
19
|
+
// props. It returns a setter function that automatically triggers the callback.
|
|
20
|
+
const [show, setShow] = (0, useUncontrollable_1.useUncontrolledProp)(propsShow, defaultShow, onToggle);
|
|
21
|
+
const hoverStateRef = (0, react_1.useRef)('');
|
|
22
|
+
const timeout = (0, useTimeout_1.useChainedTimeout)();
|
|
23
|
+
const { onFocus, onBlur, onClick } = typeof children !== 'function' ? react_1.default.Children.only(children).props : {};
|
|
24
|
+
// Simple implementation of mouseEnter and mouseLeave.
|
|
25
|
+
// React's built version is broken: https://github.com/facebook/react/issues/4251
|
|
26
|
+
// for cases when the trigger is disabled and mouseOut/Over can cause flicker
|
|
27
|
+
// moving from one child element to another.
|
|
28
|
+
const handleMouseOverOut = (handler, args, relatedNative) => {
|
|
29
|
+
const [event] = args;
|
|
30
|
+
const target = event.currentTarget;
|
|
31
|
+
const related = event.relatedTarget;
|
|
32
|
+
if ((!related || related !== target) && !target.contains(related)) {
|
|
33
|
+
handler(...args);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const handleShow = () => {
|
|
37
|
+
timeout.clear();
|
|
38
|
+
hoverStateRef.current = 'show';
|
|
39
|
+
if (typeof delay === 'number' || !(delay === null || delay === void 0 ? void 0 : delay.show)) {
|
|
40
|
+
setShow(true);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
timeout.set(() => {
|
|
44
|
+
if (hoverStateRef.current === 'show') {
|
|
45
|
+
setShow(true);
|
|
46
|
+
}
|
|
47
|
+
}, typeof delay === 'number' ? delay : delay === null || delay === void 0 ? void 0 : delay.show);
|
|
48
|
+
};
|
|
49
|
+
const handleHide = () => {
|
|
50
|
+
timeout.clear();
|
|
51
|
+
hoverStateRef.current = 'hide';
|
|
52
|
+
if (typeof delay === 'number' || !(delay === null || delay === void 0 ? void 0 : delay.hide)) {
|
|
53
|
+
setShow(false);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
timeout.set(() => {
|
|
57
|
+
if (hoverStateRef.current === 'hide') {
|
|
58
|
+
setShow(false);
|
|
59
|
+
}
|
|
60
|
+
}, typeof delay === 'number' ? delay : delay === null || delay === void 0 ? void 0 : delay.hide);
|
|
61
|
+
};
|
|
62
|
+
const handleFocus = (0, react_1.useCallback)((...args) => {
|
|
63
|
+
handleShow();
|
|
64
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(...args);
|
|
65
|
+
}, [handleShow, onFocus]);
|
|
66
|
+
const handleBlur = (0, react_1.useCallback)((...args) => {
|
|
67
|
+
handleHide();
|
|
68
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(...args);
|
|
69
|
+
}, [handleHide, onBlur]);
|
|
70
|
+
const handleClick = (0, react_1.useCallback)((...args) => {
|
|
71
|
+
setShow(!show);
|
|
72
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(...args);
|
|
73
|
+
}, [onClick, setShow, show]);
|
|
74
|
+
const handleMouseOver = (0, react_1.useCallback)((...args) => {
|
|
75
|
+
handleMouseOverOut(handleShow, args, 'fromElement');
|
|
76
|
+
}, [handleShow]);
|
|
77
|
+
const handleMouseOut = (0, react_1.useCallback)((...args) => {
|
|
78
|
+
handleMouseOverOut(handleHide, args, 'toElement');
|
|
79
|
+
}, [handleHide]);
|
|
80
|
+
const [triggerNode, setTriggerNode] = (0, react_1.useState)(null);
|
|
81
|
+
const [popperElement, setPopperElement] = (0, react_1.useState)(null);
|
|
82
|
+
const [arrowElement, setArrowElement] = (0, react_1.useState)(null);
|
|
83
|
+
const [arrowPlacement, setArrowPlacement] = (0, react_1.useState)(placement);
|
|
84
|
+
const handleClickOutside = (0, react_1.useCallback)((event) => {
|
|
85
|
+
const isToggleTarget = triggerNode === null || triggerNode === void 0 ? void 0 : triggerNode.contains(event.target);
|
|
86
|
+
const isOverlayTarget = popperElement === null || popperElement === void 0 ? void 0 : popperElement.contains(event.target);
|
|
87
|
+
// Check if the click occurred outside the trigger element. Clicking on the trigger
|
|
88
|
+
// itself is handled by the onClick handler
|
|
89
|
+
if (show && rootClose && !isToggleTarget && !isOverlayTarget) {
|
|
90
|
+
handleHide();
|
|
91
|
+
}
|
|
92
|
+
}, [triggerNode, popperElement, rootClose, handleHide]);
|
|
93
|
+
(0, useClickOutside_1.useClickOutsideWithRef)(triggerNode, handleClickOutside);
|
|
94
|
+
const triggerProps = {
|
|
95
|
+
ref: (0, mergeRefs_1.default)([children.ref, setTriggerNode]),
|
|
96
|
+
};
|
|
97
|
+
if (trigger === 'click') {
|
|
98
|
+
triggerProps.onClick = handleClick;
|
|
99
|
+
}
|
|
100
|
+
else if (trigger === 'focus') {
|
|
101
|
+
triggerProps.onFocus = handleFocus;
|
|
102
|
+
triggerProps.onBlur = handleBlur;
|
|
103
|
+
}
|
|
104
|
+
else if (trigger === 'hover') {
|
|
105
|
+
triggerProps.onMouseOver = handleMouseOver;
|
|
106
|
+
triggerProps.onMouseOut = handleMouseOut;
|
|
107
|
+
}
|
|
108
|
+
const defaultPopperConfig = {
|
|
109
|
+
placement,
|
|
110
|
+
modifiers: [
|
|
111
|
+
{
|
|
112
|
+
name: 'arrow',
|
|
113
|
+
options: {
|
|
114
|
+
element: arrowElement,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'flip',
|
|
119
|
+
options: {
|
|
120
|
+
fallbackPlacements: ['right', 'left', 'top'],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
if (popperConfig) {
|
|
126
|
+
popperConfig.placement = placement;
|
|
127
|
+
// if it has an arrow modifier, inject the arrow element
|
|
128
|
+
const updatedModifiers = [];
|
|
129
|
+
(_a = popperConfig.modifiers) === null || _a === void 0 ? void 0 : _a.forEach((mod) => {
|
|
130
|
+
if (mod.name !== 'arrow') {
|
|
131
|
+
return updatedModifiers.push(mod);
|
|
132
|
+
}
|
|
133
|
+
return updatedModifiers.push(Object.assign(Object.assign({}, mod), { options: Object.assign(Object.assign({}, mod.options), { element: arrowElement }) }));
|
|
134
|
+
});
|
|
135
|
+
popperConfig.modifiers = updatedModifiers;
|
|
136
|
+
}
|
|
137
|
+
const popper = (0, react_popper_1.usePopper)(triggerNode, popperElement, popperConfig || defaultPopperConfig);
|
|
138
|
+
// In case the overlay causes an overflow and the "flip" modifier
|
|
139
|
+
// changes the overlays placement, we nee to update the arrow placement as well
|
|
140
|
+
(0, react_1.useEffect)(() => {
|
|
141
|
+
if (popper.state) {
|
|
142
|
+
// Adjust arrow styles based on placement if necessary
|
|
143
|
+
setArrowPlacement(popper.state.placement);
|
|
144
|
+
}
|
|
145
|
+
}, [(_b = popper.state) === null || _b === void 0 ? void 0 : _b.placement]);
|
|
146
|
+
const overlayElement = react_1.default.cloneElement(overlay, Object.assign(Object.assign({}, popper.attributes.popper), { ref: setPopperElement, placement: arrowPlacement, style: Object.assign({}, popper.styles.popper), arrowProps: Object.assign(Object.assign({}, popper.attributes.arrow), { style: popper.styles.arrow, ref: setArrowElement }) }));
|
|
147
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [show && (enablePortal ? react_dom_1.default.createPortal(overlayElement, document.body) : overlayElement), react_1.default.cloneElement(children, triggerProps)] }));
|
|
16
148
|
};
|
|
17
149
|
OverlayTrigger.TRIGGER_CLICK = Trigger_1.TRIGGER.CLICK;
|
|
18
150
|
OverlayTrigger.TRIGGER_HOVER = Trigger_1.TRIGGER.HOVER;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { type ForwardRefExoticComponent, type RefAttributes, type PropsWithChildren, type ReactNode, type ComponentProps } from 'react';
|
|
2
|
+
export declare const PLACEMENT_MAP: {
|
|
3
|
+
readonly AUTO: "auto";
|
|
4
|
+
readonly TOP: "top";
|
|
5
|
+
readonly RIGHT: "right";
|
|
6
|
+
readonly BOTTOM: "bottom";
|
|
7
|
+
readonly LEFT: "left";
|
|
8
|
+
};
|
|
9
|
+
export type PopoverProps = Omit<ComponentProps<'div'>, 'title'> & {
|
|
4
10
|
/**
|
|
5
11
|
* HTML ID attribute, necessary for accessibility.
|
|
6
12
|
*/
|
|
@@ -18,6 +24,10 @@ export type PopoverProps = {
|
|
|
18
24
|
* - `left`
|
|
19
25
|
*/
|
|
20
26
|
placement?: 'auto' | 'top' | 'right' | 'bottom' | 'left';
|
|
27
|
+
/**
|
|
28
|
+
* Additional props assigned to the arrow element. Internally used.
|
|
29
|
+
*/
|
|
30
|
+
arrowProps?: Record<string, unknown>;
|
|
21
31
|
/**
|
|
22
32
|
* Any element to be rendered as the title of the Popover.
|
|
23
33
|
*
|
|
@@ -32,12 +42,20 @@ export type PopoverProps = {
|
|
|
32
42
|
* Additional classes to be set on the `Popover.Content` element.
|
|
33
43
|
*/
|
|
34
44
|
contentClassName?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Additional class names for the wrapper element.
|
|
47
|
+
*/
|
|
48
|
+
className?: string;
|
|
35
49
|
};
|
|
36
|
-
declare const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
declare const PopoverTitle: ({ className, children }: React.PropsWithChildren<{
|
|
51
|
+
className?: string | undefined;
|
|
52
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
declare const PopoverContent: ({ className, children }: React.PropsWithChildren<{
|
|
54
|
+
className?: string | undefined;
|
|
55
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
type PopoverType = ForwardRefExoticComponent<PropsWithChildren<PopoverProps> & RefAttributes<HTMLDivElement>> & {
|
|
57
|
+
Title: typeof PopoverTitle;
|
|
58
|
+
Content: typeof PopoverContent;
|
|
42
59
|
};
|
|
60
|
+
declare const Popover: PopoverType;
|
|
43
61
|
export default Popover;
|