@rio-cloud/rio-uikit 1.2.2 → 1.4.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/ChartLabel.d.ts +2 -0
- package/ChartLabel.js +2 -0
- package/ComposedChart.d.ts +2 -0
- package/ComposedChart.js +2 -0
- package/DateRangePicker.d.ts +6 -7
- package/DateRangePicker.js +7 -3
- package/GroupedItemList.d.ts +2 -0
- package/GroupedItemList.js +2 -0
- package/LicensePlate.d.ts +2 -0
- package/LicensePlate.js +2 -0
- package/README.md +3 -3
- package/ReferenceLine.d.ts +2 -0
- package/ReferenceLine.js +2 -0
- 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 +8 -4
- package/components/assetTree/treeUtils.js +1 -1
- package/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/components/calendarStripe/CalendarStripe.js +7 -4
- package/components/charts/Area.d.ts +5 -0
- package/components/charts/Area.js +1 -9
- package/components/charts/AreaChart.d.ts +2 -0
- package/components/charts/AreaChart.js +9 -6
- package/components/charts/BarChart.js +4 -4
- package/components/charts/ChartLabel.d.ts +5 -0
- package/components/charts/ChartLabel.js +2 -0
- package/components/charts/ComposedChart.d.ts +34 -0
- package/components/charts/ComposedChart.js +30 -0
- package/components/charts/Legend.d.ts +8 -10
- package/components/charts/Legend.js +3 -12
- package/components/charts/Line.d.ts +5 -0
- package/components/charts/Line.js +1 -9
- package/components/charts/LineChart.d.ts +2 -0
- package/components/charts/LineChart.js +8 -5
- package/components/charts/PieChart.js +5 -5
- package/components/charts/RadialBarChart.js +5 -5
- package/components/charts/ReferenceLine.d.ts +7 -0
- package/components/charts/ReferenceLine.js +2 -0
- package/components/dataTabs/DataTab.js +2 -1
- package/components/dialog/Dialog.d.ts +12 -4
- 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/groupedItemList/GroupedItemList.d.ts +79 -0
- package/components/groupedItemList/GroupedItemList.js +77 -0
- package/components/licensePlate/LicensePlate.d.ts +19 -0
- package/components/licensePlate/LicensePlate.js +14 -0
- 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/selects/BaseSelectDropdown.d.ts +1 -0
- package/components/selects/BaseSelectDropdown.js +16 -14
- package/components/selects/Multiselect.d.ts +5 -0
- package/components/selects/Multiselect.js +2 -2
- package/components/selects/Select.d.ts +5 -0
- package/components/selects/Select.js +2 -2
- 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/useKey.d.ts +7 -4
- package/hooks/useKey.js +36 -8
- 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/ChartLabel.d.ts +2 -0
- package/lib/es/ChartLabel.js +7 -0
- package/lib/es/ComposedChart.d.ts +2 -0
- package/lib/es/ComposedChart.js +7 -0
- package/lib/es/DateRangePicker.d.ts +6 -7
- package/lib/es/DateRangePicker.js +5 -1
- package/lib/es/GroupedItemList.d.ts +2 -0
- package/lib/es/GroupedItemList.js +7 -0
- package/lib/es/LicensePlate.d.ts +2 -0
- package/lib/es/LicensePlate.js +7 -0
- package/lib/es/ReferenceLine.d.ts +2 -0
- package/lib/es/ReferenceLine.js +7 -0
- 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 +8 -4
- 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/charts/Area.d.ts +5 -0
- package/lib/es/components/charts/Area.js +1 -9
- package/lib/es/components/charts/AreaChart.d.ts +2 -0
- package/lib/es/components/charts/AreaChart.js +7 -4
- package/lib/es/components/charts/BarChart.js +3 -3
- package/lib/es/components/charts/ChartLabel.d.ts +5 -0
- package/lib/es/components/charts/ChartLabel.js +4 -0
- package/lib/es/components/charts/ComposedChart.d.ts +34 -0
- package/lib/es/components/charts/ComposedChart.js +32 -0
- package/lib/es/components/charts/Legend.d.ts +8 -10
- package/lib/es/components/charts/Legend.js +5 -12
- package/lib/es/components/charts/Line.d.ts +5 -0
- package/lib/es/components/charts/Line.js +1 -9
- package/lib/es/components/charts/LineChart.d.ts +2 -0
- package/lib/es/components/charts/LineChart.js +7 -4
- package/lib/es/components/charts/PieChart.js +4 -4
- package/lib/es/components/charts/RadialBarChart.js +4 -4
- package/lib/es/components/charts/ReferenceLine.d.ts +7 -0
- package/lib/es/components/charts/ReferenceLine.js +4 -0
- package/lib/es/components/dataTabs/DataTab.js +2 -1
- package/lib/es/components/dialog/Dialog.d.ts +12 -4
- 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/groupedItemList/GroupedItemList.d.ts +79 -0
- package/lib/es/components/groupedItemList/GroupedItemList.js +80 -0
- package/lib/es/components/licensePlate/LicensePlate.d.ts +19 -0
- package/lib/es/components/licensePlate/LicensePlate.js +16 -0
- 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/selects/BaseSelectDropdown.d.ts +1 -0
- package/lib/es/components/selects/BaseSelectDropdown.js +16 -14
- package/lib/es/components/selects/Multiselect.d.ts +5 -0
- package/lib/es/components/selects/Multiselect.js +2 -2
- package/lib/es/components/selects/Select.d.ts +5 -0
- package/lib/es/components/selects/Select.js +2 -2
- 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/useKey.d.ts +7 -4
- package/lib/es/hooks/useKey.js +35 -7
- 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/colorScheme.js +10 -8
- 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 +26 -20
- package/styles/variables/colors/colors.json +3 -3
- package/useElapsedTime.d.ts +2 -0
- package/useElapsedTime.js +2 -0
- package/utils/colorScheme.js +10 -8
- 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
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SortDirectionType } from '../../SortUtils';
|
|
3
|
+
export type Group = {
|
|
4
|
+
groupKey: string;
|
|
5
|
+
items: any[];
|
|
6
|
+
};
|
|
7
|
+
export type GroupedItemListProps<T> = {
|
|
8
|
+
/**
|
|
9
|
+
* The list of items to be grouped and rendered.
|
|
10
|
+
*
|
|
11
|
+
* By default, the component assumes an item object containing an 'id' and 'name' property
|
|
12
|
+
* plus some other attributes.
|
|
13
|
+
*/
|
|
14
|
+
items: T[];
|
|
15
|
+
/**
|
|
16
|
+
* The property of the items to group by as a string, or a custom group function.
|
|
17
|
+
* Defaults to 'name' if not provided.
|
|
18
|
+
*
|
|
19
|
+
* @default 'name'
|
|
20
|
+
*/
|
|
21
|
+
groupBy?: keyof T | ((item: T) => string);
|
|
22
|
+
/**
|
|
23
|
+
* The order in which to sort the groups. Accepts 'asc' for ascending or 'desc' for descending.
|
|
24
|
+
* @default 'asc'.
|
|
25
|
+
*/
|
|
26
|
+
groupSortOrder?: SortDirectionType;
|
|
27
|
+
/**
|
|
28
|
+
* The order in which to sort the items inside a group. Accepts 'asc' for ascending or 'desc' for descending.
|
|
29
|
+
* @default 'asc'.
|
|
30
|
+
*/
|
|
31
|
+
itemSortOrder?: SortDirectionType;
|
|
32
|
+
/**
|
|
33
|
+
* Sorting function for the groups.
|
|
34
|
+
*/
|
|
35
|
+
groupSortFunction?: (groups: Group[]) => Group[];
|
|
36
|
+
/**
|
|
37
|
+
* Sorting function for the items within each group.
|
|
38
|
+
*/
|
|
39
|
+
itemSortFunction?: (items: T[]) => T[];
|
|
40
|
+
/**
|
|
41
|
+
* A custom render function for the group divider.
|
|
42
|
+
* Receives the group key (e.g., letter or date) as a parameter.
|
|
43
|
+
*/
|
|
44
|
+
renderDivider?: (groupKey: string) => React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* A custom render function for individual list items.
|
|
47
|
+
* Receives an item as a parameter.
|
|
48
|
+
*/
|
|
49
|
+
renderItem?: (item: T) => React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the HTML element to use for the list inside each group.
|
|
52
|
+
* Default is 'div'. Use 'ul' for rendering the list items as `<li>` elements.
|
|
53
|
+
*/
|
|
54
|
+
listElement?: 'div' | 'ul';
|
|
55
|
+
/**
|
|
56
|
+
* Optional class name for the list element inside each group.
|
|
57
|
+
* Applied to the `div` or `ul` wrapping the items.
|
|
58
|
+
*/
|
|
59
|
+
listElementClassName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional class name for the divider element in each group.
|
|
62
|
+
* Applied to the `div` wrapping each group divider.
|
|
63
|
+
*/
|
|
64
|
+
dividerElementClassName?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional class name for the outer wrapper element.
|
|
67
|
+
* Applied to the outer `div` wrapping the entire component.
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A React component that groups and renders a list of items based on a specified property.
|
|
73
|
+
* The component can be customized to render dividers and list items in different styles.
|
|
74
|
+
*
|
|
75
|
+
* @param {GroupedItemListProps} props - The props for the component.
|
|
76
|
+
* @returns {JSX.Element} The grouped and rendered list component.
|
|
77
|
+
*/
|
|
78
|
+
declare const GroupedItemList: <T>(props: GroupedItemListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export default GroupedItemList;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const SortUtils_1 = require("../../SortUtils");
|
|
7
|
+
/**
|
|
8
|
+
* A React component that groups and renders a list of items based on a specified property.
|
|
9
|
+
* The component can be customized to render dividers and list items in different styles.
|
|
10
|
+
*
|
|
11
|
+
* @param {GroupedItemListProps} props - The props for the component.
|
|
12
|
+
* @returns {JSX.Element} The grouped and rendered list component.
|
|
13
|
+
*/
|
|
14
|
+
const GroupedItemList = (props) => {
|
|
15
|
+
const { items, groupBy = 'name', groupSortOrder = 'asc', // Default to ascending order if not specified
|
|
16
|
+
groupSortFunction, itemSortFunction, itemSortOrder = 'asc', // Default to ascending order if not specified
|
|
17
|
+
renderDivider, renderItem, listElement = 'div', // Default to 'div' if not specified
|
|
18
|
+
listElementClassName, dividerElementClassName, className, } = props;
|
|
19
|
+
// Default group sorting function or specific function provided
|
|
20
|
+
const groupSortFn = groupSortFunction
|
|
21
|
+
? groupSortFunction
|
|
22
|
+
: (groups) => (0, SortUtils_1.naturalSortByProperty)(groups, 'groupKey', groupSortOrder);
|
|
23
|
+
// Default item sorting within groups or specific function provided
|
|
24
|
+
const itemSortFn = itemSortFunction
|
|
25
|
+
? itemSortFunction
|
|
26
|
+
: (itemsToSort) => (0, SortUtils_1.sortByProperty)(itemsToSort, groupBy, itemSortOrder);
|
|
27
|
+
// Determine the grouping function based on the type of groupBy
|
|
28
|
+
// const getGroupKey = (item: T): string => {
|
|
29
|
+
// if (typeof groupBy === 'string') {
|
|
30
|
+
// if (groupBy === 'name') {
|
|
31
|
+
// return (item as any).name?.[0]?.toUpperCase() ?? '';
|
|
32
|
+
// }
|
|
33
|
+
// return (item as any)[groupBy]?.toString() ?? '';
|
|
34
|
+
// } else if (typeof groupBy === 'function') {
|
|
35
|
+
// return groupBy(item);
|
|
36
|
+
// }
|
|
37
|
+
// throw new Error('Please define a "groupBy" property as a string or function.');
|
|
38
|
+
// };
|
|
39
|
+
const getGroupKey = typeof groupBy === 'function'
|
|
40
|
+
? groupBy
|
|
41
|
+
: (item) => { var _a, _b, _c; return (_c = (_b = (_a = item[groupBy]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : ''; };
|
|
42
|
+
// Group items by the specified property
|
|
43
|
+
// const allGroups = useMemo(
|
|
44
|
+
// () =>
|
|
45
|
+
// items.reduce<Record<string, T[]>>((acc, item) => {
|
|
46
|
+
// const groupKey = getGroupKey(item);
|
|
47
|
+
// if (!acc[groupKey]) {
|
|
48
|
+
// acc[groupKey] = [];
|
|
49
|
+
// }
|
|
50
|
+
// acc[groupKey].push(item);
|
|
51
|
+
// return acc;
|
|
52
|
+
// }, {}),
|
|
53
|
+
// [items, getGroupKey]
|
|
54
|
+
// );
|
|
55
|
+
// Group items by the specified property
|
|
56
|
+
const groupedItems = (0, react_1.useMemo)(() => {
|
|
57
|
+
// Explicitly typing the accumulator as Record<string, T[]>
|
|
58
|
+
const groups = items.reduce((acc, item) => {
|
|
59
|
+
const groupKey = getGroupKey(item);
|
|
60
|
+
if (!acc[groupKey]) {
|
|
61
|
+
acc[groupKey] = [];
|
|
62
|
+
}
|
|
63
|
+
acc[groupKey].push(item);
|
|
64
|
+
return acc;
|
|
65
|
+
}, {});
|
|
66
|
+
return Object.keys(groups).map(groupKey => ({
|
|
67
|
+
groupKey,
|
|
68
|
+
items: groups[groupKey],
|
|
69
|
+
}));
|
|
70
|
+
}, [items, getGroupKey]);
|
|
71
|
+
// Assign the specified list element ('div' or 'ul')
|
|
72
|
+
const ListElement = listElement;
|
|
73
|
+
// Sort groups using the provided sort function
|
|
74
|
+
const sortedGroups = (0, react_1.useMemo)(() => groupSortFn(groupedItems), [groupedItems, groupSortFn]);
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `grouped-item-list ${className !== null && className !== void 0 ? className : ''}` }, { children: sortedGroups.map(group => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: `group-divider ${dividerElementClassName !== null && dividerElementClassName !== void 0 ? dividerElementClassName : ''}` }, { children: renderDivider ? renderDivider(group.groupKey) : group.groupKey })), (0, jsx_runtime_1.jsx)(ListElement, Object.assign({ className: listElementClassName }, { children: itemSortFn(group.items).map(item => {
|
|
76
|
+
var _a;
|
|
77
|
+
return renderItem ? (renderItem(item)) : ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'item-name' }, { children: item.name })) }, (_a = item.id) !== null && _a !== void 0 ? _a : crypto.randomUUID()));
|
|
78
|
+
}) }))] }, group.groupKey))) })));
|
|
79
|
+
};
|
|
80
|
+
exports.default = GroupedItemList;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
export type LicensePlateProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The country code.
|
|
5
|
+
*
|
|
6
|
+
* Should be a string with 1-3 capital letters.
|
|
7
|
+
*/
|
|
8
|
+
countryCode?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the EU stars should be hidden.
|
|
11
|
+
*/
|
|
12
|
+
hideStars?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Additional classes added to the wrapping element.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const LicensePlate: (props: PropsWithChildren<LicensePlateProps>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default LicensePlate;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
|
+
require("react");
|
|
6
|
+
const euStars = ((0, jsx_runtime_1.jsx)("svg", Object.assign({ xmlns: 'http://www.w3.org/2000/svg', width: '10', height: '10' }, { children: (0, jsx_runtime_1.jsx)("path", { fill: '#FFC200', fillRule: 'nonzero', d: 'M5.143.439H5.6L5.23.71l.141.438L5 .88l-.371.27.14-.438L4.4.439h.459L5 0zm2.198.594h.458l-.37.272.141.44-.371-.271-.372.27.142-.439-.372-.271h.46l.142-.44zm1.607 1.625h.458l-.37.272.141.44-.371-.271-.372.27.142-.438-.371-.272.459-.001.142-.438zm.593 2.208H10l-.37.272.14.44-.37-.272-.372.271.14-.438-.37-.272.46-.001.141-.438zm-.59 2.214h.459l-.37.271.14.44-.37-.271-.372.271.141-.439-.371-.271.46-.001.141-.439zM7.337 8.701h.459l-.371.272.141.44-.371-.27-.371.27.14-.44-.37-.27.459-.002.142-.438zm-2.201.588h.458l-.37.272.141.439-.371-.27-.372.27.142-.439-.372-.271.46-.001.142-.438zM2.938 8.7h.458l-.37.273.141.439-.371-.27-.372.27.141-.44-.37-.27h.459l.142-.44zM1.33 7.083h.458l-.37.272.14.44-.371-.271-.372.27.142-.439-.37-.271h.458l.143-.44zM.743 4.869H1.2l-.37.272.141.439-.371-.27-.372.27.142-.439L0 4.87l.459-.001L.6 4.43zm.581-2.217h.459l-.37.272.14.439-.37-.27-.372.27.14-.439-.37-.271h.459l.142-.44zM2.94 1.03h.459l-.37.272.14.44-.37-.272-.372.271.14-.439-.37-.271.458-.001.143-.439z' }) })));
|
|
7
|
+
const LicensePlate = (props) => {
|
|
8
|
+
const { countryCode, hideStars, className = '', children } = props;
|
|
9
|
+
let letterCount = '';
|
|
10
|
+
if ((countryCode === null || countryCode === void 0 ? void 0 : countryCode.length) === 2)
|
|
11
|
+
letterCount = 'two-letters';
|
|
12
|
+
if ((countryCode === null || countryCode === void 0 ? void 0 : countryCode.length) === 3)
|
|
13
|
+
letterCount = 'three-letters';
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `license-plate ${className}` }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'plate-content' }, { children: [countryCode && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'plate-country' }, { children: [!hideStars && (0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'stars' }, { children: euStars })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: `plate-country-code ${letterCount}` }, { children: countryCode }))] }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'plate-number' }, { children: children }))] })) })));
|
|
15
|
+
};
|
|
16
|
+
exports.default = LicensePlate;
|
|
@@ -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;
|
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLACEMENT_MAP = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
require("framer-motion");
|
|
7
8
|
const Placement_1 = require("../../values/Placement");
|
|
8
|
-
|
|
9
|
+
exports.PLACEMENT_MAP = {
|
|
9
10
|
AUTO: Placement_1.PLACEMENT.AUTO,
|
|
10
11
|
TOP: Placement_1.PLACEMENT.TOP,
|
|
11
12
|
RIGHT: Placement_1.PLACEMENT.RIGHT,
|
|
12
13
|
BOTTOM: Placement_1.PLACEMENT.BOTTOM,
|
|
13
14
|
LEFT: Placement_1.PLACEMENT.LEFT,
|
|
14
15
|
};
|
|
16
|
+
const PopoverTitle = ({ className = '', children }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `popover-header popover-title ${className}` }, { children: children })));
|
|
17
|
+
const PopoverContent = ({ className = '', children }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `popover-content popover-body ${className}` }, { children: children })));
|
|
18
|
+
const isPopoverTitleOrContent = (element) => {
|
|
19
|
+
return (0, react_1.isValidElement)(element) && (element.type === PopoverTitle || element.type === PopoverContent);
|
|
20
|
+
};
|
|
15
21
|
const Popover = (0, react_1.forwardRef)((props, ref) => {
|
|
16
|
-
const { title, titleClassName = '', contentClassName = '', children } = props, remainingProps = tslib_1.__rest(props, ["title", "titleClassName", "contentClassName", "children"]);
|
|
17
|
-
|
|
22
|
+
const { placement = 'bottom', arrowProps, title, titleClassName = '', contentClassName = '', children, className = '' } = props, remainingProps = tslib_1.__rest(props, ["placement", "arrowProps", "title", "titleClassName", "contentClassName", "children", "className"]);
|
|
23
|
+
const hasTitle = !!title;
|
|
24
|
+
const hasCustomContent = react_1.default.Children.toArray(children).some(isPopoverTitleOrContent);
|
|
25
|
+
// Mount the component but don't show it yet via CSS.
|
|
26
|
+
// After it is mounted, we set the visibility class to use CSS animation
|
|
27
|
+
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
28
|
+
(0, react_1.useEffect)(() => setIsMounted(true), []);
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, remainingProps, { role: 'tooltip', "x-placement": placement, ref: ref, className: `popover fade ${isMounted ? 'show' : ''} ${className}` }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'arrow' }, arrowProps)), hasTitle && (0, jsx_runtime_1.jsx)(PopoverTitle, Object.assign({ className: titleClassName }, { children: title })), hasCustomContent ? children : (0, jsx_runtime_1.jsx)(PopoverContent, Object.assign({ className: contentClassName }, { children: children }))] })));
|
|
18
30
|
});
|
|
19
|
-
|
|
31
|
+
Popover.Title = PopoverTitle;
|
|
32
|
+
Popover.Content = PopoverContent;
|
|
33
|
+
Object.assign(Popover, exports.PLACEMENT_MAP);
|
|
20
34
|
exports.default = Popover;
|
|
@@ -36,6 +36,7 @@ export type SelectOption = {
|
|
|
36
36
|
export type BaseSelectDropdownProps<T extends SelectOption> = {
|
|
37
37
|
options?: T[];
|
|
38
38
|
isOpen?: boolean;
|
|
39
|
+
isLoading?: boolean;
|
|
39
40
|
updateDOMValues?: (values: OptionDOMValue[] | undefined) => void;
|
|
40
41
|
onOpen?: (hasDropup: boolean) => void;
|
|
41
42
|
onSelect?: (selectedItem: T | undefined) => void;
|