@rio-cloud/rio-uikit 1.2.1 → 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/map/components/features/settings/MapSettingsTile.js +1 -1
- package/components/map/components/features/settings/items/MapSettingsDropdownHeader.d.ts +4 -1
- package/components/map/components/features/settings/items/MapSettingsDropdownHeader.js +1 -0
- 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/map/components/features/settings/MapSettingsTile.js +1 -1
- package/lib/es/components/map/components/features/settings/items/MapSettingsDropdownHeader.d.ts +4 -1
- package/lib/es/components/map/components/features/settings/items/MapSettingsDropdownHeader.js +1 -0
- 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
package/hooks/useTimeout.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
// See www.joshwcomeau.com/snippets/react-hooks/use-timeout/
|
|
3
3
|
/**
|
|
4
4
|
* A custom hook for handling timeout events.
|
|
@@ -31,4 +31,42 @@ const useTimeout = (callback, delay) => {
|
|
|
31
31
|
}, [delay]);
|
|
32
32
|
return timeoutRef;
|
|
33
33
|
};
|
|
34
|
+
export const useChainedTimeout = () => {
|
|
35
|
+
const MAX_DELAY_MS = Math.pow(2, 31) - 1;
|
|
36
|
+
const setChainedTimeout = (ref, fn, timeoutAtMs) => {
|
|
37
|
+
const delayMs = timeoutAtMs - Date.now();
|
|
38
|
+
ref.current =
|
|
39
|
+
delayMs <= MAX_DELAY_MS
|
|
40
|
+
? setTimeout(fn, delayMs)
|
|
41
|
+
: setTimeout(() => setChainedTimeout(ref, fn, timeoutAtMs), MAX_DELAY_MS);
|
|
42
|
+
};
|
|
43
|
+
const handleRef = useRef();
|
|
44
|
+
const { set, clear } = useMemo(() => {
|
|
45
|
+
const clear = () => clearTimeout(handleRef.current);
|
|
46
|
+
const set = (fn, delayMs = 0) => {
|
|
47
|
+
clear();
|
|
48
|
+
if (delayMs <= MAX_DELAY_MS) {
|
|
49
|
+
// For simplicity, if the timeout is short, just set a normal timeout.
|
|
50
|
+
handleRef.current = setTimeout(fn, delayMs);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setChainedTimeout(handleRef, fn, Date.now() + delayMs);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
set,
|
|
58
|
+
clear,
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
return () => {
|
|
63
|
+
clear();
|
|
64
|
+
};
|
|
65
|
+
}, [clear]);
|
|
66
|
+
return {
|
|
67
|
+
set,
|
|
68
|
+
clear,
|
|
69
|
+
handleRef,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
34
72
|
export default useTimeout;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Handler = (value: any, ...args: any[]) => any;
|
|
2
|
+
export declare function defaultKey(key: string): string;
|
|
3
|
+
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue: TProp, handler?: THandler): readonly [TProp, THandler];
|
|
4
|
+
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue?: TProp | undefined, handler?: THandler): readonly [TProp | undefined, (...args: Parameters<THandler>) => ReturnType<THandler> | void];
|
|
5
|
+
export { useUncontrolledProp };
|
|
6
|
+
type FilterFlags<Base, Condition> = {
|
|
7
|
+
[Key in keyof Base]: NonNullable<Base[Key]> extends Condition ? Key : never;
|
|
8
|
+
};
|
|
9
|
+
type AllowedNames<Base, Condition> = FilterFlags<Base, Condition>[keyof Base];
|
|
10
|
+
type ConfigMap<TProps extends object> = {
|
|
11
|
+
[p in keyof TProps]?: AllowedNames<TProps, Function>;
|
|
12
|
+
};
|
|
13
|
+
export declare function useUncontrolled<TProps extends object, TDefaults extends string = never>(props: TProps, config: ConfigMap<TProps>): Omit<TProps, TDefaults>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
3
|
+
// forked from https://github.com/jquense/uncontrollable/blob/master/src/index.ts
|
|
4
|
+
import { useCallback, useRef, useState } from 'react';
|
|
5
|
+
export function defaultKey(key) {
|
|
6
|
+
return 'default' + key.charAt(0).toUpperCase() + key.substr(1);
|
|
7
|
+
}
|
|
8
|
+
function useUncontrolledProp(propValue, defaultValue, handler) {
|
|
9
|
+
const wasPropRef = useRef(propValue !== undefined);
|
|
10
|
+
const [stateValue, setState] = useState(defaultValue);
|
|
11
|
+
const isProp = propValue !== undefined;
|
|
12
|
+
const wasProp = wasPropRef.current;
|
|
13
|
+
wasPropRef.current = isProp;
|
|
14
|
+
/**
|
|
15
|
+
* If a prop switches from controlled to Uncontrolled
|
|
16
|
+
* reset its value to the defaultValue
|
|
17
|
+
*/
|
|
18
|
+
if (!isProp && wasProp && stateValue !== defaultValue) {
|
|
19
|
+
setState(defaultValue);
|
|
20
|
+
}
|
|
21
|
+
return [
|
|
22
|
+
isProp ? propValue : stateValue,
|
|
23
|
+
useCallback((...args) => {
|
|
24
|
+
const [value, ...rest] = args;
|
|
25
|
+
const returnValue = handler === null || handler === void 0 ? void 0 : handler(value, ...rest);
|
|
26
|
+
setState(value);
|
|
27
|
+
return returnValue;
|
|
28
|
+
}, [handler]),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
export { useUncontrolledProp };
|
|
32
|
+
export function useUncontrolled(props, config) {
|
|
33
|
+
return Object.keys(config).reduce((result, fieldName) => {
|
|
34
|
+
const _a = result, _b = defaultKey(fieldName), defaultValue = _a[_b], _c = fieldName, propsValue = _a[_c], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + "", typeof _c === "symbol" ? _c : _c + ""]);
|
|
35
|
+
// @ts-ignore-next-line
|
|
36
|
+
const handlerName = config[fieldName];
|
|
37
|
+
// @ts-ignore-next-line
|
|
38
|
+
const [value, handler] = useUncontrolledProp(propsValue, defaultValue, props[handlerName]);
|
|
39
|
+
return Object.assign(Object.assign({}, rest), { [fieldName]: value, [handlerName]: handler });
|
|
40
|
+
}, props);
|
|
41
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JSX, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import type { Moment } from 'moment/moment';
|
|
3
|
-
export
|
|
3
|
+
export type DateRangePickerCustomPresets = {
|
|
4
4
|
startValue: Moment;
|
|
5
5
|
endValue: Moment;
|
|
6
6
|
text: string | JSX.Element;
|
|
7
7
|
onSelect?: Function;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
};
|
|
9
|
+
export type DateRangePickerProps = {
|
|
10
10
|
startValue?: Moment;
|
|
11
11
|
endValue?: Moment;
|
|
12
12
|
defaultStartValue?: Moment;
|
|
@@ -34,11 +34,10 @@ export interface DateRangePickerProps {
|
|
|
34
34
|
dropup?: boolean;
|
|
35
35
|
pullRight?: boolean;
|
|
36
36
|
autoDropDirection?: boolean;
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
39
|
* Wrapper component for React-Datetime.
|
|
40
40
|
*
|
|
41
41
|
* @deprecated This will be removed from the UIKIT at some time.
|
|
42
42
|
*/
|
|
43
|
-
declare const DateRangePicker:
|
|
44
|
-
export { DateRangePicker };
|
|
43
|
+
export declare const DateRangePicker: (props: PropsWithChildren<DateRangePickerProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DateRangePicker = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const DateRangePicker_1 = tslib_1.__importDefault(require("./components/datepicker/DateRangePicker"));
|
|
6
7
|
/**
|
|
7
8
|
* Wrapper component for React-Datetime.
|
|
8
9
|
*
|
|
9
10
|
* @deprecated This will be removed from the UIKIT at some time.
|
|
10
11
|
*/
|
|
11
|
-
const DateRangePicker =
|
|
12
|
+
const DateRangePicker = (props) => {
|
|
13
|
+
const { children } = props, remainingProps = tslib_1.__rest(props, ["children"]);
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(DateRangePicker_1.default, Object.assign({}, remainingProps, { children: children }));
|
|
15
|
+
};
|
|
12
16
|
exports.DateRangePicker = DateRangePicker;
|
|
@@ -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 })) })));
|
|
@@ -71,7 +71,7 @@ const MapSettingsTile = (props) => {
|
|
|
71
71
|
className: inactiveIconClassNames,
|
|
72
72
|
})] })));
|
|
73
73
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: wrapperClasses, ref: buttonRef }, remainingProps, { children: [!items && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [tooltip && !isOpen ? getComponentWithTooltip(button, tooltip) : button, (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'overflow-hidden' }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: isOpen && panel && panel }) }))] })), items && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'MapSettingsTile-inner position-relative', ref: setToggleRef }, { children: [tooltip && !isOpen ? getComponentWithTooltip(button, tooltip) : button, (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'dropdown', ref: dropdownWrapperRef }, { children: isOpen && items && ((0, jsx_runtime_1.jsx)(MenuItemList_1.default, Object.assign({ className: 'margin-bottom-10 shadow-smooth border-none', ref: setRefDropdownMenu, style: Object.assign(Object.assign({}, styles.popper), { minWidth: '180px' }) }, attributes.popper, { children: items === null || items === void 0 ? void 0 : items.map((item, index) => {
|
|
74
|
-
if (item.type.
|
|
74
|
+
if (item.type.isMapSettingsDropdownHeader) {
|
|
75
75
|
return item;
|
|
76
76
|
}
|
|
77
77
|
return (0, jsx_runtime_1.jsx)(MenuItem_1.default, { value: item }, index);
|
package/lib/es/components/map/components/features/settings/items/MapSettingsDropdownHeader.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type DropdownHeaderProps } from '../../../../../selects/DropdownHeader';
|
|
2
2
|
export type MapSettingsDropdownHeaderProps = DropdownHeaderProps & {};
|
|
3
|
-
declare const MapSettingsDropdownHeader:
|
|
3
|
+
declare const MapSettingsDropdownHeader: {
|
|
4
|
+
(props: MapSettingsDropdownHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
isMapSettingsDropdownHeader: boolean;
|
|
6
|
+
};
|
|
4
7
|
export default MapSettingsDropdownHeader;
|
package/lib/es/components/map/components/features/settings/items/MapSettingsDropdownHeader.js
CHANGED
|
@@ -8,4 +8,5 @@ const MapSettingsDropdownHeader = (props) => {
|
|
|
8
8
|
const remainingProps = tslib_1.__rest(props, []);
|
|
9
9
|
return (0, jsx_runtime_1.jsx)(DropdownHeader_1.default, Object.assign({ className: 'MapSettingsDropdownHeader' }, remainingProps));
|
|
10
10
|
};
|
|
11
|
+
MapSettingsDropdownHeader.isMapSettingsDropdownHeader = true;
|
|
11
12
|
exports.default = MapSettingsDropdownHeader;
|
|
@@ -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";
|