@rio-cloud/rio-uikit 0.16.4-beta.21 → 0.16.4-beta.22
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/AssetTree.d.ts +2 -5
- package/AssetTree.js +2 -2
- package/ButtonDropdown.d.ts +2 -5
- package/ButtonDropdown.js +2 -2
- package/DropdownSubmenu.d.ts +2 -5
- package/DropdownSubmenu.js +2 -2
- package/MenuItem.d.ts +2 -5
- package/MenuItem.js +2 -2
- package/MenuItemList.d.ts +2 -0
- package/MenuItemList.js +2 -0
- package/MenuItems.d.ts +2 -0
- package/MenuItems.js +2 -0
- package/Page.d.ts +2 -0
- package/Page.js +2 -0
- package/Sidebar.d.ts +1 -0
- package/Sidebar.js +1 -0
- package/SimpleButtonDropdown.d.ts +2 -5
- package/SimpleButtonDropdown.js +2 -2
- package/SingleButtonDropdown.d.ts +2 -5
- package/SingleButtonDropdown.js +2 -2
- package/SplitButtonDropdown.d.ts +2 -5
- package/SplitButtonDropdown.js +2 -2
- package/Tree.d.ts +2 -5
- package/Tree.js +2 -2
- package/TreeCategory.d.ts +2 -5
- package/TreeCategory.js +2 -2
- package/TreeOption.d.ts +2 -5
- package/TreeOption.js +2 -2
- package/TreeSearch.d.ts +2 -5
- package/TreeSearch.js +2 -2
- package/TreeSummary.d.ts +2 -5
- package/TreeSummary.js +2 -2
- package/TreeSummaryRow.d.ts +2 -0
- package/TreeSummaryRow.js +2 -0
- package/TypeCounter.d.ts +2 -5
- package/TypeCounter.js +2 -2
- package/components/assetTree/AssetTree.d.ts +84 -2
- package/components/assetTree/AssetTree.js +41 -61
- package/components/assetTree/Tree.d.ts +195 -2
- package/components/assetTree/Tree.js +70 -256
- package/components/assetTree/TreeCategory.d.ts +24 -11
- package/components/assetTree/TreeCategory.js +1 -8
- package/components/assetTree/TreeLeaf.d.ts +1 -1
- package/components/assetTree/TreeLeaf.js +3 -2
- package/components/assetTree/TreeLeafList.d.ts +3 -3
- package/components/assetTree/TreeLeafList.js +4 -3
- package/components/assetTree/TreeNode.d.ts +12 -2
- package/components/assetTree/TreeNode.js +2 -17
- package/components/assetTree/TreeNodeContainer.d.ts +10 -12
- package/components/assetTree/TreeNodeContainer.js +9 -8
- package/components/assetTree/TreeNothingFound.d.ts +3 -2
- package/components/assetTree/TreeNothingFound.js +1 -7
- package/components/assetTree/TreeOption.d.ts +27 -17
- package/components/assetTree/TreeOption.js +5 -14
- package/components/assetTree/TreeOptions.d.ts +9 -13
- package/components/assetTree/TreeOptions.js +4 -11
- package/components/assetTree/TreeRoot.d.ts +9 -11
- package/components/assetTree/TreeRoot.js +8 -8
- package/components/assetTree/TreeSearch.d.ts +23 -2
- package/components/assetTree/TreeSearch.js +4 -12
- package/components/assetTree/TreeSelectAll.d.ts +14 -26
- package/components/assetTree/TreeSelectAll.js +7 -22
- package/components/assetTree/TreeSidebar.d.ts +10 -2
- package/components/assetTree/TreeSidebar.js +4 -35
- package/components/assetTree/TreeSidebarCategories.d.ts +11 -0
- package/components/assetTree/TreeSidebarCategories.js +34 -0
- package/components/assetTree/TreeSummary.d.ts +44 -2
- package/components/assetTree/TreeSummary.js +6 -19
- package/components/assetTree/TreeSummaryRow.d.ts +15 -0
- package/components/assetTree/TreeSummaryRow.js +6 -0
- package/components/assetTree/TypeCounter.d.ts +45 -2
- package/components/assetTree/TypeCounter.js +14 -23
- package/components/assetTree/treeReducer.d.ts +47 -0
- package/components/assetTree/treeReducer.js +34 -0
- package/components/assetTree/treeUtils.d.ts +20 -0
- package/components/assetTree/treeUtils.js +88 -0
- package/components/button/Button.d.ts +14 -9
- package/components/button/Button.js +7 -7
- package/components/button/ToggleButton.d.ts +2 -4
- package/components/datepicker/DatePicker.d.ts +9 -9
- package/components/datepicker/DatePicker.js +4 -2
- package/components/dialog/Dialog.js +6 -2
- package/components/dropdown/ButtonDropdown.d.ts +115 -65
- package/components/dropdown/ButtonDropdown.js +14 -60
- package/components/dropdown/Caret.d.ts +1 -1
- package/components/dropdown/Caret.js +2 -1
- package/components/dropdown/DropdownSubmenu.d.ts +21 -18
- package/components/dropdown/DropdownSubmenu.js +26 -19
- package/components/dropdown/DropdownToggleButton.d.ts +14 -2
- package/components/dropdown/DropdownToggleButton.js +6 -14
- package/components/dropdown/SimpleButtonDropdown.d.ts +3 -1
- package/components/dropdown/SimpleButtonDropdown.js +3 -2
- package/components/dropdown/SingleButtonDropdown.d.ts +3 -1
- package/components/dropdown/SingleButtonDropdown.js +3 -2
- package/components/dropdown/SplitButtonDropdown.d.ts +3 -1
- package/components/dropdown/SplitButtonDropdown.js +3 -2
- package/components/dropdown/SplitCaretButton.d.ts +12 -2
- package/components/dropdown/SplitCaretButton.js +6 -11
- package/components/menuItems/MenuItem.d.ts +16 -0
- package/components/menuItems/MenuItem.js +1 -0
- package/components/menuItems/MenuItemList.d.ts +7 -0
- package/components/menuItems/MenuItemList.js +10 -0
- package/components/menuItems/MenuItems.d.ts +7 -2
- package/components/menuItems/MenuItems.js +10 -9
- package/components/numberInput/NumberInput.js +1 -1
- package/components/page/Page.d.ts +10 -0
- package/components/page/Page.js +18 -0
- package/components/timepicker/TimePicker.js +2 -1
- package/hooks/usePrevious.d.ts +1 -1
- package/hooks/usePrevious.js +6 -7
- package/index.d.ts +34 -26
- package/index.js +34 -26
- package/lib/es/AssetTree.d.ts +2 -5
- package/lib/es/AssetTree.js +3 -2
- package/lib/es/ButtonDropdown.d.ts +2 -5
- package/lib/es/ButtonDropdown.js +3 -2
- package/lib/es/DropdownSubmenu.d.ts +2 -5
- package/lib/es/DropdownSubmenu.js +3 -2
- package/lib/es/MenuItem.d.ts +2 -5
- package/lib/es/MenuItem.js +3 -2
- package/lib/es/MenuItemList.d.ts +2 -0
- package/lib/es/MenuItemList.js +7 -0
- package/lib/es/MenuItems.d.ts +2 -0
- package/lib/es/MenuItems.js +7 -0
- package/lib/es/Page.d.ts +2 -0
- package/lib/es/Page.js +7 -0
- package/lib/es/Sidebar.d.ts +1 -0
- package/lib/es/Sidebar.js +3 -4
- package/lib/es/SimpleButtonDropdown.d.ts +2 -5
- package/lib/es/SimpleButtonDropdown.js +3 -2
- package/lib/es/SingleButtonDropdown.d.ts +2 -5
- package/lib/es/SingleButtonDropdown.js +3 -2
- package/lib/es/SplitButtonDropdown.d.ts +2 -5
- package/lib/es/SplitButtonDropdown.js +3 -2
- package/lib/es/Tree.d.ts +2 -5
- package/lib/es/Tree.js +3 -2
- package/lib/es/TreeCategory.d.ts +2 -5
- package/lib/es/TreeCategory.js +3 -2
- package/lib/es/TreeOption.d.ts +2 -5
- package/lib/es/TreeOption.js +3 -2
- package/lib/es/TreeSearch.d.ts +2 -5
- package/lib/es/TreeSearch.js +3 -2
- package/lib/es/TreeSummary.d.ts +2 -5
- package/lib/es/TreeSummary.js +3 -2
- package/lib/es/TreeSummaryRow.d.ts +2 -0
- package/lib/es/TreeSummaryRow.js +7 -0
- package/lib/es/TypeCounter.d.ts +2 -5
- package/lib/es/TypeCounter.js +3 -2
- package/lib/es/components/assetTree/AssetTree.d.ts +84 -2
- package/lib/es/components/assetTree/AssetTree.js +40 -60
- package/lib/es/components/assetTree/Tree.d.ts +195 -2
- package/lib/es/components/assetTree/Tree.js +103 -286
- package/lib/es/components/assetTree/TreeCategory.d.ts +24 -11
- package/lib/es/components/assetTree/TreeCategory.js +1 -9
- package/lib/es/components/assetTree/TreeLeaf.d.ts +1 -1
- package/lib/es/components/assetTree/TreeLeaf.js +2 -1
- package/lib/es/components/assetTree/TreeLeafList.d.ts +3 -3
- package/lib/es/components/assetTree/TreeLeafList.js +4 -3
- package/lib/es/components/assetTree/TreeNode.d.ts +12 -2
- package/lib/es/components/assetTree/TreeNode.js +2 -17
- package/lib/es/components/assetTree/TreeNodeContainer.d.ts +10 -12
- package/lib/es/components/assetTree/TreeNodeContainer.js +9 -8
- package/lib/es/components/assetTree/TreeNothingFound.d.ts +3 -2
- package/lib/es/components/assetTree/TreeNothingFound.js +1 -7
- package/lib/es/components/assetTree/TreeOption.d.ts +27 -17
- package/lib/es/components/assetTree/TreeOption.js +5 -14
- package/lib/es/components/assetTree/TreeOptions.d.ts +9 -13
- package/lib/es/components/assetTree/TreeOptions.js +4 -11
- package/lib/es/components/assetTree/TreeRoot.d.ts +9 -11
- package/lib/es/components/assetTree/TreeRoot.js +8 -8
- package/lib/es/components/assetTree/TreeSearch.d.ts +23 -2
- package/lib/es/components/assetTree/TreeSearch.js +4 -12
- package/lib/es/components/assetTree/TreeSelectAll.d.ts +14 -26
- package/lib/es/components/assetTree/TreeSelectAll.js +7 -22
- package/lib/es/components/assetTree/TreeSidebar.d.ts +10 -2
- package/lib/es/components/assetTree/TreeSidebar.js +5 -36
- package/lib/es/components/assetTree/TreeSidebarCategories.d.ts +11 -0
- package/lib/es/components/assetTree/TreeSidebarCategories.js +37 -0
- package/lib/es/components/assetTree/TreeSummary.d.ts +44 -2
- package/lib/es/components/assetTree/TreeSummary.js +6 -19
- package/lib/es/components/assetTree/TreeSummaryRow.d.ts +15 -0
- package/lib/es/components/assetTree/TreeSummaryRow.js +10 -0
- package/lib/es/components/assetTree/TypeCounter.d.ts +45 -2
- package/lib/es/components/assetTree/TypeCounter.js +14 -23
- package/lib/es/components/assetTree/autoAnimateFrames.d.ts +1 -0
- package/lib/es/components/assetTree/autoAnimateFrames.js +55 -0
- package/lib/es/components/assetTree/treeReducer.d.ts +47 -0
- package/lib/es/components/assetTree/treeReducer.js +47 -0
- package/lib/es/components/assetTree/treeUtils.d.ts +20 -0
- package/lib/es/components/assetTree/treeUtils.js +106 -0
- package/lib/es/components/button/Button.d.ts +14 -9
- package/lib/es/components/button/Button.js +12 -11
- package/lib/es/components/button/ToggleButton.d.ts +2 -4
- package/lib/es/components/datepicker/DatePicker.d.ts +9 -9
- package/lib/es/components/datepicker/DatePicker.js +4 -2
- package/lib/es/components/dialog/Dialog.js +5 -1
- package/lib/es/components/dropdown/ButtonDropdown.d.ts +115 -65
- package/lib/es/components/dropdown/ButtonDropdown.js +13 -59
- package/lib/es/components/dropdown/Caret.d.ts +1 -1
- package/lib/es/components/dropdown/Caret.js +2 -2
- package/lib/es/components/dropdown/DropdownSubmenu.d.ts +21 -18
- package/lib/es/components/dropdown/DropdownSubmenu.js +26 -19
- package/lib/es/components/dropdown/DropdownToggleButton.d.ts +14 -2
- package/lib/es/components/dropdown/DropdownToggleButton.js +6 -14
- package/lib/es/components/dropdown/SimpleButtonDropdown.d.ts +3 -1
- package/lib/es/components/dropdown/SimpleButtonDropdown.js +3 -2
- package/lib/es/components/dropdown/SingleButtonDropdown.d.ts +3 -1
- package/lib/es/components/dropdown/SingleButtonDropdown.js +3 -2
- package/lib/es/components/dropdown/SplitButtonDropdown.d.ts +3 -1
- package/lib/es/components/dropdown/SplitButtonDropdown.js +3 -2
- package/lib/es/components/dropdown/SplitCaretButton.d.ts +12 -2
- package/lib/es/components/dropdown/SplitCaretButton.js +6 -11
- package/lib/es/components/menuItems/MenuItem.d.ts +16 -0
- package/lib/es/components/menuItems/MenuItem.js +1 -0
- package/lib/es/components/menuItems/MenuItemList.d.ts +7 -0
- package/lib/es/components/menuItems/MenuItemList.js +12 -0
- package/lib/es/components/menuItems/MenuItems.d.ts +7 -2
- package/lib/es/components/menuItems/MenuItems.js +9 -7
- package/lib/es/components/numberInput/NumberInput.js +1 -1
- package/lib/es/components/page/Page.d.ts +10 -0
- package/lib/es/components/page/Page.js +21 -0
- package/lib/es/components/timepicker/TimePicker.js +2 -1
- package/lib/es/hooks/usePrevious.d.ts +1 -1
- package/lib/es/hooks/usePrevious.js +5 -6
- package/lib/es/index.d.ts +34 -26
- package/lib/es/index.js +55 -30
- package/lib/es/types.d.ts +1 -140
- package/lib/es/utils/init.js +1 -0
- package/lib/es/utils/mergeRefs.d.ts +3 -0
- package/lib/es/utils/mergeRefs.js +18 -0
- package/lib/es/utils/searchNormalized.d.ts +2 -2
- package/lib/es/utils/searchNormalized.js +1 -1
- package/lib/es/version.json +1 -1
- package/package.json +39 -36
- package/types.d.ts +1 -140
- package/utils/init.js +1 -0
- package/utils/mergeRefs.d.ts +3 -0
- package/utils/mergeRefs.js +16 -0
- package/utils/searchNormalized.d.ts +2 -2
- package/utils/searchNormalized.js +1 -1
- package/version.json +1 -1
|
@@ -1,66 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MenuItemProps as MenuItem } from '../menuItems/MenuItem';
|
|
3
|
+
import type { STYLES_MAP, SIZES_MAP, VARIANTS_MAP } from '../button/Button';
|
|
4
|
+
import type { ObjectValues } from '../../utils/ObjectValues';
|
|
5
|
+
export type ButtonDropdownProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Unique button id. If not present a random id is generated.
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The button title. This may be also a node, like a <span> or a <FormattedMessage>.
|
|
12
|
+
*/
|
|
13
|
+
title: string | React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Defined weather or not the menu is rendered.
|
|
16
|
+
* Use this to control the component from the outside.
|
|
17
|
+
*
|
|
18
|
+
* @default undefined
|
|
19
|
+
*/
|
|
20
|
+
open?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Defines whether the dropdown opens above or below.
|
|
23
|
+
* Set it to "true" additionally disables the automatic position feature.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
dropup?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Defines whether the dropdown opens right aligned to the dropdown or not.
|
|
30
|
+
*/
|
|
31
|
+
pullRight?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Defines how large the button will be rendered.
|
|
34
|
+
*/
|
|
35
|
+
bsSize?: ObjectValues<typeof SIZES_MAP>;
|
|
36
|
+
/**
|
|
37
|
+
* Defines the button color.
|
|
38
|
+
*/
|
|
39
|
+
bsStyle?: ObjectValues<typeof STYLES_MAP>;
|
|
40
|
+
/**
|
|
41
|
+
* Defines the variation of the button design.
|
|
42
|
+
*/
|
|
43
|
+
variant?: ObjectValues<typeof VARIANTS_MAP>;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop to defines whether the dropdown title is icon only which
|
|
46
|
+
* applies different padding so the button is a square.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
iconOnly?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Defines whether the caret is shown or not.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
noCaret?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Defines whether the dropdown-toggle (with caret) should be in a separate button.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
splitButton?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Renders the dropdown into a dedicated react portal
|
|
65
|
+
*
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
usePortal?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Items to display in the dropdown menu. If you use a custom dropdown you can skip this prop.
|
|
71
|
+
*/
|
|
72
|
+
items?: MenuItem[];
|
|
73
|
+
/**
|
|
74
|
+
* Disables the dropdown button.
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Callback for splitButton label button click.
|
|
81
|
+
*/
|
|
82
|
+
onLabelButtonClick?: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Callback for when the toggle button was clicked to open it.
|
|
85
|
+
* @param event
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
onOpen?: (event?: React.MouseEvent<HTMLButtonElement>) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Callback for when the toggle button was clicked to close it.
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
onClose?: () => void;
|
|
94
|
+
/**
|
|
95
|
+
* Allows to pass in custom dropdown menu content.
|
|
96
|
+
*/
|
|
97
|
+
customDropdown?: React.ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Define custom popper.js configuration for dropdown placement and modifiers.
|
|
100
|
+
*/
|
|
101
|
+
popperConfig?: object;
|
|
102
|
+
/**
|
|
103
|
+
* Additional classes to be set on the dropdown-toggle button.
|
|
104
|
+
*/
|
|
105
|
+
toggleClassName?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Additional classes to be set on the dropdown.
|
|
108
|
+
*/
|
|
109
|
+
dropdownClassName?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Additional classes to be set to the wrapper element.
|
|
112
|
+
*/
|
|
113
|
+
className?: string;
|
|
114
|
+
};
|
|
115
|
+
declare const ButtonDropdown: (props: ButtonDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
116
|
export default ButtonDropdown;
|
|
2
|
-
declare function ButtonDropdown(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare namespace ButtonDropdown {
|
|
4
|
-
namespace defaultProps {
|
|
5
|
-
export const id: string;
|
|
6
|
-
export const items: never[];
|
|
7
|
-
export const iconOnly: boolean;
|
|
8
|
-
export const noCaret: boolean;
|
|
9
|
-
export const pullRight: boolean;
|
|
10
|
-
export const splitButton: boolean;
|
|
11
|
-
export const dropup: boolean;
|
|
12
|
-
export const bsStyle: string;
|
|
13
|
-
export const disabled: boolean;
|
|
14
|
-
export { noop as onOpen };
|
|
15
|
-
export { noop as onClose };
|
|
16
|
-
export { noop as onLabelButtonClick };
|
|
17
|
-
export const toggleClassName: string;
|
|
18
|
-
export const usePortal: boolean;
|
|
19
|
-
export const className: string;
|
|
20
|
-
}
|
|
21
|
-
namespace propTypes {
|
|
22
|
-
const id_1: PropTypes.Requireable<string>;
|
|
23
|
-
export { id_1 as id };
|
|
24
|
-
export const title: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
25
|
-
export const open: PropTypes.Requireable<boolean>;
|
|
26
|
-
const dropup_1: PropTypes.Requireable<boolean>;
|
|
27
|
-
export { dropup_1 as dropup };
|
|
28
|
-
const pullRight_1: PropTypes.Requireable<boolean>;
|
|
29
|
-
export { pullRight_1 as pullRight };
|
|
30
|
-
export const bsSize: PropTypes.Requireable<string>;
|
|
31
|
-
const bsStyle_1: PropTypes.Requireable<string>;
|
|
32
|
-
export { bsStyle_1 as bsStyle };
|
|
33
|
-
const iconOnly_1: PropTypes.Requireable<boolean>;
|
|
34
|
-
export { iconOnly_1 as iconOnly };
|
|
35
|
-
const noCaret_1: PropTypes.Requireable<boolean>;
|
|
36
|
-
export { noCaret_1 as noCaret };
|
|
37
|
-
const splitButton_1: PropTypes.Requireable<boolean>;
|
|
38
|
-
export { splitButton_1 as splitButton };
|
|
39
|
-
const usePortal_1: PropTypes.Requireable<boolean>;
|
|
40
|
-
export { usePortal_1 as usePortal };
|
|
41
|
-
const items_1: PropTypes.Validator<(PropTypes.InferProps<{
|
|
42
|
-
value: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
43
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
44
|
-
divider: PropTypes.Requireable<boolean>;
|
|
45
|
-
header: PropTypes.Requireable<boolean>;
|
|
46
|
-
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
-
}> | null | undefined)[]>;
|
|
48
|
-
export { items_1 as items };
|
|
49
|
-
const disabled_1: PropTypes.Requireable<boolean>;
|
|
50
|
-
export { disabled_1 as disabled };
|
|
51
|
-
const className_1: PropTypes.Requireable<string>;
|
|
52
|
-
export { className_1 as className };
|
|
53
|
-
export const dropdownClassName: PropTypes.Requireable<string>;
|
|
54
|
-
const toggleClassName_1: PropTypes.Requireable<string>;
|
|
55
|
-
export { toggleClassName_1 as toggleClassName };
|
|
56
|
-
export const onLabelButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
57
|
-
export const customDropdown: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
58
|
-
export const popperConfig: PropTypes.Requireable<object>;
|
|
59
|
-
export const enableOnClickOutside: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
|
-
export const disableOnClickOutside: PropTypes.Requireable<(...args: any[]) => any>;
|
|
61
|
-
export const onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
62
|
-
export const onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
import noop from "lodash/fp/noop";
|
|
66
|
-
import PropTypes from "prop-types";
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import { usePopper } from 'react-popper';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
7
|
import isNil from 'lodash/fp/isNil';
|
|
9
8
|
import noop from 'lodash/fp/noop';
|
|
10
|
-
import logDeprecatedWarnings from '../../utils/logDeprecatedWarnings';
|
|
11
9
|
import { getOrCreatePortalRoot } from '../../utils/portalRoot';
|
|
12
10
|
import useClickOutside from '../../hooks/useClickOutside';
|
|
13
|
-
import getMenuItems from '../menuItems/getMenuItems';
|
|
14
11
|
import MenuItems from '../menuItems/MenuItems';
|
|
15
|
-
import
|
|
12
|
+
import MenuItemList from '../menuItems/MenuItemList';
|
|
16
13
|
import DropdownToggleButton from './DropdownToggleButton';
|
|
17
14
|
import SplitCaretButton from './SplitCaretButton';
|
|
18
15
|
import Caret from './Caret';
|
|
@@ -28,12 +25,12 @@ const getPlacement = (pullRight, dropup) => {
|
|
|
28
25
|
}
|
|
29
26
|
return 'bottom-start';
|
|
30
27
|
};
|
|
31
|
-
const ButtonDropdown = props => {
|
|
32
|
-
const { id, items, bsSize, bsStyle, disabled, iconOnly, title, splitButton
|
|
28
|
+
const ButtonDropdown = (props) => {
|
|
29
|
+
const { id = Math.random().toString(36).substr(2, 16), items = [], bsSize = 'md', bsStyle = 'default', disabled = false, iconOnly = false, title, splitButton = false, customDropdown, open, dropup = false, pullRight = false, noCaret = false, onOpen = noop, onClose = noop, onLabelButtonClick = noop, usePortal = false, popperConfig, toggleClassName = '', dropdownClassName, className = '' } = props, remainingProps = __rest(props, ["id", "items", "bsSize", "bsStyle", "disabled", "iconOnly", "title", "splitButton", "customDropdown", "open", "dropup", "pullRight", "noCaret", "onOpen", "onClose", "onLabelButtonClick", "usePortal", "popperConfig", "toggleClassName", "dropdownClassName", "className"]);
|
|
33
30
|
const [internalOpen, setInternalOpen] = useState(open);
|
|
34
|
-
const [refDropdownToggle, setRefDropdownToggle] =
|
|
35
|
-
const [refDropdownMenu, setRefDropdownMenu] =
|
|
36
|
-
const [refSplitButtonToggle, setRefSplitButtonToggle] =
|
|
31
|
+
const [refDropdownToggle, setRefDropdownToggle] = useState(null);
|
|
32
|
+
const [refDropdownMenu, setRefDropdownMenu] = useState(null);
|
|
33
|
+
const [refSplitButtonToggle, setRefSplitButtonToggle] = useState(null);
|
|
37
34
|
const defaultPopperConfig = {
|
|
38
35
|
placement: getPlacement(pullRight, dropup),
|
|
39
36
|
modifiers: [],
|
|
@@ -46,20 +43,19 @@ const ButtonDropdown = props => {
|
|
|
46
43
|
const shouldShowCaret = !noCaret && !splitButton && !iconOnly;
|
|
47
44
|
useEffect(() => {
|
|
48
45
|
if (!isUncontrolled) {
|
|
49
|
-
// console.log('update open from outside: ' + open);
|
|
50
46
|
setInternalOpen(open);
|
|
51
47
|
}
|
|
52
48
|
}, [isUncontrolled, open]);
|
|
53
|
-
const toggleOpen = event => {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
49
|
+
const toggleOpen = (event) => {
|
|
50
|
+
const isDropdownOpen = isUncontrolled ? internalOpen : open;
|
|
51
|
+
if (isDropdownOpen) {
|
|
56
52
|
closeMenu();
|
|
57
53
|
}
|
|
58
54
|
else {
|
|
59
55
|
openMenu(event);
|
|
60
56
|
}
|
|
61
57
|
};
|
|
62
|
-
const openMenu = event => {
|
|
58
|
+
const openMenu = (event) => {
|
|
63
59
|
if (isUncontrolled) {
|
|
64
60
|
setInternalOpen(true);
|
|
65
61
|
}
|
|
@@ -79,49 +75,7 @@ const ButtonDropdown = props => {
|
|
|
79
75
|
const isOpen = isUncontrolled ? internalOpen : open;
|
|
80
76
|
const wrapperClasses = classNames('dropdown', 'btn-group', isOpen && 'open', className);
|
|
81
77
|
const dropdownClasses = classNames(usePortal && 'dropdown-portal', splitButton && pullRight && 'pull-right', dropdownClassName);
|
|
82
|
-
const dropdownMenu = (_jsx(
|
|
83
|
-
return (_jsxs("div", Object.assign({}, remainingProps, { className: wrapperClasses, ref: wrapperRef }, { children: [_jsx(DropdownToggleButton, Object.assign({ id: id, splitButton: splitButton, bsStyle: bsStyle, bsSize: bsSize, iconOnly: iconOnly, disabled: disabled, ref: setRefDropdownToggle, onClick: handleDropdownButtonClick, className: toggleClassName }, { children: _jsxs(
|
|
84
|
-
};
|
|
85
|
-
ButtonDropdown.defaultProps = {
|
|
86
|
-
id: Math.random().toString(36).substr(2, 16),
|
|
87
|
-
items: [],
|
|
88
|
-
iconOnly: false,
|
|
89
|
-
noCaret: false,
|
|
90
|
-
pullRight: false,
|
|
91
|
-
splitButton: false,
|
|
92
|
-
dropup: false,
|
|
93
|
-
bsStyle: 'default',
|
|
94
|
-
disabled: false,
|
|
95
|
-
onOpen: noop,
|
|
96
|
-
onClose: noop,
|
|
97
|
-
onLabelButtonClick: noop,
|
|
98
|
-
toggleClassName: '',
|
|
99
|
-
usePortal: false,
|
|
100
|
-
className: '',
|
|
101
|
-
};
|
|
102
|
-
ButtonDropdown.propTypes = {
|
|
103
|
-
id: PropTypes.string,
|
|
104
|
-
title: PropTypes.oneOfType([PropTypes.node, PropTypes.string]).isRequired,
|
|
105
|
-
open: PropTypes.bool,
|
|
106
|
-
dropup: PropTypes.bool,
|
|
107
|
-
pullRight: PropTypes.bool,
|
|
108
|
-
bsSize: PropTypes.oneOf(['xs', 'sm', 'lg']),
|
|
109
|
-
bsStyle: PropTypes.oneOf(['default', 'primary', 'info', 'warning', 'danger', 'success', 'link', 'muted']),
|
|
110
|
-
iconOnly: PropTypes.bool,
|
|
111
|
-
noCaret: PropTypes.bool,
|
|
112
|
-
splitButton: PropTypes.bool,
|
|
113
|
-
usePortal: PropTypes.bool,
|
|
114
|
-
items: menuItemsPropTypes.isRequired,
|
|
115
|
-
disabled: PropTypes.bool,
|
|
116
|
-
className: PropTypes.string,
|
|
117
|
-
dropdownClassName: PropTypes.string,
|
|
118
|
-
toggleClassName: PropTypes.string,
|
|
119
|
-
onLabelButtonClick: PropTypes.func,
|
|
120
|
-
customDropdown: PropTypes.node,
|
|
121
|
-
popperConfig: PropTypes.object,
|
|
122
|
-
enableOnClickOutside: PropTypes.func,
|
|
123
|
-
disableOnClickOutside: PropTypes.func,
|
|
124
|
-
onOpen: PropTypes.func,
|
|
125
|
-
onClose: PropTypes.func,
|
|
78
|
+
const dropdownMenu = (_jsx(MenuItemList, Object.assign({ className: dropdownClasses, ref: setRefDropdownMenu, style: styles.popper }, attributes.popper, { children: customDropdown ? customDropdown : _jsx(MenuItems, { items: items, closeMenu: toggleOpen }) })));
|
|
79
|
+
return (_jsxs("div", Object.assign({}, remainingProps, { className: wrapperClasses, ref: wrapperRef }, { children: [_jsx(DropdownToggleButton, Object.assign({ id: id, splitButton: splitButton, bsStyle: bsStyle, bsSize: bsSize, iconOnly: iconOnly, disabled: disabled, ref: setRefDropdownToggle, onClick: handleDropdownButtonClick, className: toggleClassName }, { children: _jsxs(_Fragment, { children: [title, shouldShowCaret && _jsx(Caret, {})] }) })), splitButton && (_jsx(SplitCaretButton, { id: id, bsStyle: bsStyle, bsSize: bsSize, disabled: disabled, className: toggleClassName, onClick: toggleOpen, ref: setRefSplitButtonToggle })), isOpen && usePortal && ReactDOM.createPortal(dropdownMenu, dropdownRoot), isOpen && !usePortal && dropdownMenu] })));
|
|
126
80
|
};
|
|
127
81
|
export default ButtonDropdown;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MenuItemProps as MenuItem } from '../menuItems/MenuItem';
|
|
3
|
+
export type DropdownSubmenuProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Displayed button title.
|
|
6
|
+
*/
|
|
7
|
+
title?: string | React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Items to display in the dropdown sub menu.
|
|
10
|
+
*/
|
|
11
|
+
items?: MenuItem[];
|
|
12
|
+
/**
|
|
13
|
+
* Disables every entry on the title list item.
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Additional classes to be set on the dropdown-submenu element.
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
declare const DropdownSubmenu: (props: DropdownSubmenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
22
|
export default DropdownSubmenu;
|
|
2
|
-
declare function DropdownSubmenu(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare namespace DropdownSubmenu {
|
|
4
|
-
namespace defaultProps {
|
|
5
|
-
const title: string;
|
|
6
|
-
const items: never[];
|
|
7
|
-
const disabled: boolean;
|
|
8
|
-
}
|
|
9
|
-
namespace propTypes {
|
|
10
|
-
const title_1: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
11
|
-
export { title_1 as title };
|
|
12
|
-
export { menuItemsPropTypes as items };
|
|
13
|
-
const disabled_1: PropTypes.Requireable<boolean>;
|
|
14
|
-
export { disabled_1 as disabled };
|
|
15
|
-
export const className: PropTypes.Requireable<string>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
import PropTypes from "prop-types";
|
|
19
|
-
import menuItemsPropTypes from "./menuItemsPropTypes";
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
3
|
+
import { useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
|
-
import
|
|
7
|
-
import menuItemsPropTypes from './menuItemsPropTypes';
|
|
5
|
+
import { usePopper } from 'react-popper';
|
|
8
6
|
import MenuItems from '../menuItems/MenuItems';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
import MenuItemList from '../menuItems/MenuItemList';
|
|
8
|
+
const DropdownSubmenu = (props) => {
|
|
9
|
+
const { title = '', items = [], disabled = false, className } = props, remainingProps = __rest(props, ["title", "items", "disabled", "className"]);
|
|
10
|
+
const classes = classNames('dropdown-submenu', disabled && 'disabled', className);
|
|
11
|
+
const [refParentPopper, setRefParentPopper] = useState(null);
|
|
12
|
+
const [refDropdownSubmenu, setRefDropdownSubmenu] = useState(null);
|
|
13
|
+
// We have to use the workaround of checking the hover state as popper may render
|
|
14
|
+
// the sub menu on an odd place and fixes it's position on the next render cycle
|
|
15
|
+
const [isHover, setIsHover] = useState(false);
|
|
16
|
+
const handleMouseEnter = () => setIsHover(true);
|
|
17
|
+
const handleMouseLeave = () => setIsHover(false);
|
|
18
|
+
const { styles, attributes } = usePopper(refParentPopper, refDropdownSubmenu, {
|
|
19
|
+
placement: 'right-start',
|
|
20
|
+
modifiers: [
|
|
21
|
+
{
|
|
22
|
+
name: 'offset',
|
|
23
|
+
options: {
|
|
24
|
+
offset: [-4, 0],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
// return a list item that is also automatically the new toggle for the submenu
|
|
30
|
+
return (_jsxs("li", Object.assign({ ref: setRefParentPopper }, remainingProps, { className: classes, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, { children: [_jsxs("a", Object.assign({ className: 'submenu-title', role: 'menuitem' }, { children: [_jsx("span", Object.assign({ className: 'submenu-title-text' }, { children: title })), _jsx("span", { className: 'rioglyph rioglyph-chevron-right' })] })), isHover && !disabled && (_jsx(MenuItemList, Object.assign({ ref: setRefDropdownSubmenu, style: styles.popper }, attributes.popper, { children: _jsx(MenuItems, { items: items }) })))] })));
|
|
24
31
|
};
|
|
25
32
|
export default DropdownSubmenu;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import React, { type HTMLProps } from 'react';
|
|
2
|
+
import type { ObjectValues } from '../../utils/ObjectValues';
|
|
3
|
+
import { type SIZES_MAP, type STYLES_MAP } from '../button/Button';
|
|
4
|
+
export type DropdownToggleButtonProps = HTMLProps<HTMLButtonElement> & {
|
|
5
|
+
id?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
splitButton?: boolean;
|
|
8
|
+
iconOnly?: boolean;
|
|
9
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
bsSize: ObjectValues<typeof SIZES_MAP>;
|
|
11
|
+
bsStyle: ObjectValues<typeof STYLES_MAP>;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const DropdownToggleButton: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<DropdownToggleButtonProps>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1
15
|
export default DropdownToggleButton;
|
|
2
|
-
declare const DropdownToggleButton: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const labelButtonClasses = classNames(!splitButton && 'dropdown-toggle', 'btn', `btn-${bsStyle}`, getSizeClassName(bsSize), iconOnly && 'btn-icon-only', disabled && 'disabled', className && !splitButton && className);
|
|
12
|
-
return (_jsx("button", Object.assign({}, remainingProps, { id: splitButton ? `button-${id}` : id, role: 'button', type: 'button', className: labelButtonClasses, ref: ref }, { children: children })));
|
|
5
|
+
import Button from '../button/Button';
|
|
6
|
+
const DropdownToggleButton = forwardRef((props, ref) => {
|
|
7
|
+
const { id, disabled, bsSize, bsStyle, splitButton = false, onClick, className = '', children } = props, remainingProps = __rest(props, ["id", "disabled", "bsSize", "bsStyle", "splitButton", "onClick", "className", "children"]);
|
|
8
|
+
const labelButtonClasses = classNames(!splitButton && 'dropdown-toggle', !splitButton && className);
|
|
9
|
+
return (_jsx(Button, Object.assign({}, remainingProps, { id: splitButton ? `button-${id}` : id, type: 'button', ref: ref, disabled: disabled, bsStyle: bsStyle, bsSize: bsSize, onClick: onClick, className: labelButtonClasses }, { children: children })));
|
|
13
10
|
});
|
|
14
11
|
export default DropdownToggleButton;
|
|
15
|
-
DropdownToggleButton.propTypes = {
|
|
16
|
-
disabled: PropTypes.bool,
|
|
17
|
-
bsStyle: PropTypes.oneOf(['default', 'primary', 'info', 'warning', 'danger', 'success', 'link', 'muted']),
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { type ButtonDropdownProps } from './ButtonDropdown';
|
|
2
|
+
export type SimpleButtonDropdownProps = ButtonDropdownProps;
|
|
3
|
+
declare const SimpleButtonDropdown: (props: SimpleButtonDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
4
|
export default SimpleButtonDropdown;
|
|
2
|
-
declare function SimpleButtonDropdown(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
3
4
|
import ButtonDropdown from './ButtonDropdown';
|
|
4
|
-
const SimpleButtonDropdown = props => _jsx(ButtonDropdown, Object.assign({}, props, { noCaret: true }));
|
|
5
|
+
const SimpleButtonDropdown = (props) => _jsx(ButtonDropdown, Object.assign({}, props, { noCaret: true }));
|
|
5
6
|
export default SimpleButtonDropdown;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { type ButtonDropdownProps } from './ButtonDropdown';
|
|
2
|
+
export type SingleButtonDropdownProps = ButtonDropdownProps;
|
|
3
|
+
declare const SingleButtonDropdown: (props: SingleButtonDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
4
|
export default SingleButtonDropdown;
|
|
2
|
-
declare function SingleButtonDropdown(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
3
4
|
import ButtonDropdown from './ButtonDropdown';
|
|
4
|
-
const SingleButtonDropdown = props => _jsx(ButtonDropdown, Object.assign({}, props));
|
|
5
|
+
const SingleButtonDropdown = (props) => _jsx(ButtonDropdown, Object.assign({}, props));
|
|
5
6
|
export default SingleButtonDropdown;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { type ButtonDropdownProps } from './ButtonDropdown';
|
|
2
|
+
export type SplitButtonDropdownProps = ButtonDropdownProps;
|
|
3
|
+
declare const SplitButtonDropdown: (props: SplitButtonDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
4
|
export default SplitButtonDropdown;
|
|
2
|
-
declare function SplitButtonDropdown(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
3
4
|
import ButtonDropdown from './ButtonDropdown';
|
|
4
|
-
const SplitButtonDropdown = props => _jsx(ButtonDropdown, Object.assign({}, props, { splitButton: true }));
|
|
5
|
+
const SplitButtonDropdown = (props) => _jsx(ButtonDropdown, Object.assign({}, props, { splitButton: true }));
|
|
5
6
|
export default SplitButtonDropdown;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import React, { type HTMLProps } from 'react';
|
|
2
|
+
import type { ObjectValues } from '../../utils/ObjectValues';
|
|
3
|
+
import { type SIZES_MAP, type STYLES_MAP } from '../button/Button';
|
|
4
|
+
export type SplitCaretButtonProps = HTMLProps<HTMLButtonElement> & {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
iconOnly?: boolean;
|
|
7
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
8
|
+
bsSize: ObjectValues<typeof SIZES_MAP>;
|
|
9
|
+
bsStyle: ObjectValues<typeof STYLES_MAP>;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const SplitCaretButton: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<SplitCaretButtonProps>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1
13
|
export default SplitCaretButton;
|
|
2
|
-
declare const SplitCaretButton: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import Caret from './Caret';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
6
|
+
import Button from '../button/Button';
|
|
7
|
+
const SplitCaretButton = forwardRef((props, ref) => {
|
|
8
|
+
const { disabled = false, bsStyle, bsSize, onClick, className } = props, remainingProps = __rest(props, ["disabled", "bsStyle", "bsSize", "onClick", "className"]);
|
|
9
|
+
const splitCaretButtonClasses = classNames('dropdown-toggle', className);
|
|
10
|
+
return (_jsx(Button, Object.assign({}, remainingProps, { type: 'button', ref: ref, disabled: disabled, bsStyle: bsStyle, bsSize: bsSize, onClick: onClick, className: splitCaretButtonClasses }, { children: _jsx(Caret, {}) })));
|
|
11
11
|
});
|
|
12
12
|
export default SplitCaretButton;
|
|
13
|
-
SplitCaretButton.propTypes = {
|
|
14
|
-
disabled: PropTypes.bool,
|
|
15
|
-
bsStyle: PropTypes.oneOf(['default', 'primary', 'info', 'warning', 'danger', 'success', 'link', 'muted']),
|
|
16
|
-
className: PropTypes.string,
|
|
17
|
-
};
|
|
@@ -3,9 +3,25 @@ export type MenuItemProps = {
|
|
|
3
3
|
index?: number;
|
|
4
4
|
value?: string | React.ReactNode;
|
|
5
5
|
active?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Setting "disabled" to true will disable the respective item.
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
6
11
|
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Will add a divider line between the items inside the dropdown.
|
|
14
|
+
*
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
7
17
|
divider?: boolean;
|
|
8
18
|
header?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Callback function triggered when an item is selected.
|
|
21
|
+
* @param value
|
|
22
|
+
* @param event
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
9
25
|
onSelect?: (value: number | undefined, event: React.MouseEvent<HTMLLIElement>) => void;
|
|
10
26
|
closeMenu?: VoidFunction;
|
|
11
27
|
onMouseEnter?: (event: React.MouseEvent<HTMLLIElement>) => void;
|
|
@@ -12,6 +12,7 @@ const MenuItem = (props) => {
|
|
|
12
12
|
}
|
|
13
13
|
const role = divider ? 'separator' : 'presentation';
|
|
14
14
|
const classes = classNames(divider && 'divider pointer-events-none', disabled && 'disabled', active && 'active');
|
|
15
|
+
// biome-ignore lint/a11y/useValidAnchor: <explanation>
|
|
15
16
|
const menuLink = _jsx("a", Object.assign({ role: 'menuitem' }, { children: value }));
|
|
16
17
|
const handleSelectItem = (event) => {
|
|
17
18
|
if (!disabled) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { type HTMLProps } from 'react';
|
|
2
|
+
type MenuItemListProps = {
|
|
3
|
+
pullRight?: boolean;
|
|
4
|
+
className?: string;
|
|
5
|
+
} & HTMLProps<HTMLUListElement>;
|
|
6
|
+
declare const MenuItemList: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<MenuItemListProps>, "ref"> & React.RefAttributes<HTMLUListElement>>;
|
|
7
|
+
export default MenuItemList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
const MenuItemList = forwardRef((props, ref) => {
|
|
6
|
+
const { pullRight, className, children } = props, remainingProps = __rest(props, ["pullRight", "className", "children"]);
|
|
7
|
+
const dropdownMenuClasses = classNames('dropdown-menu', pullRight && 'pull-right', className);
|
|
8
|
+
return (_jsx("ul", Object.assign({}, remainingProps, { className: dropdownMenuClasses, ref: ref, role: 'menu' }, { children: children })));
|
|
9
|
+
});
|
|
10
|
+
export default MenuItemList;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { type MenuItemProps as MenuItem } from './MenuItem';
|
|
2
|
+
export type MenuItemsProps = {
|
|
3
|
+
items: MenuItem[];
|
|
4
|
+
closeMenu?: () => void;
|
|
5
|
+
onMouseEnter?: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare const MenuItems: ({ items, closeMenu, onMouseEnter }: MenuItemsProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
8
|
export default MenuItems;
|
|
2
|
-
declare const MenuItems: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
-
import React from "react";
|