@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,27 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import Checkbox from '../checkbox/Checkbox';
|
|
6
|
-
const TreeNode = React.memo(props => {
|
|
7
|
-
const { node, hasMultiselect, isSelected, isIndeterminate, onToggleNode, onSelect } = props;
|
|
5
|
+
const TreeNode = React.memo((props) => {
|
|
6
|
+
const { node, hasMultiselect = false, isSelected = false, isIndeterminate = false, onToggleNode, onSelect } = props;
|
|
8
7
|
const treeNodeClassNames = classNames('TreeNode', 'from-group', isSelected && 'checked', node.className && node.className);
|
|
9
8
|
const hasChildren = !!node.items.length;
|
|
10
9
|
return (_jsxs("div", Object.assign({ className: treeNodeClassNames, "data-key": node.id, onClick: () => hasChildren && onToggleNode(node.id) }, { children: [hasMultiselect && (_jsx(Checkbox, { className: 'TreeCheckbox', checked: isSelected, disabled: node.disabled, indeterminate: isIndeterminate, onClick: () => onSelect(node, isIndeterminate) })), _jsxs("span", Object.assign({ className: 'TreeLabel' }, { children: [_jsxs("span", Object.assign({ className: 'TreeLabelName' }, { children: [node.icon && _jsx("span", { className: `rioglyph ${node.icon}` }), _jsx("span", Object.assign({ className: 'TreeLabelNameText' }, { children: _jsx("span", Object.assign({ className: 'TreeLabelNameTextHeadline' }, { children: node.name })) })), _jsx("span", Object.assign({ className: 'TreeLabelCount label label-muted label-filled label-condensed' }, { children: node.items.length }))] })), _jsx("span", { className: `TreeLabelExpander rioglyph rioglyph-chevron-down ${hasChildren ? '' : 'text-color-light'}` })] }))] })));
|
|
11
10
|
});
|
|
12
11
|
TreeNode.displayName = 'TreeNode';
|
|
13
|
-
TreeNode.defaultProps = {
|
|
14
|
-
isSelected: false,
|
|
15
|
-
isIndeterminate: false,
|
|
16
|
-
hasMultiselect: true,
|
|
17
|
-
};
|
|
18
|
-
TreeNode.propTypes = {
|
|
19
|
-
node: PropTypes.object,
|
|
20
|
-
hasMultiselect: PropTypes.bool,
|
|
21
|
-
isSelected: PropTypes.bool,
|
|
22
|
-
isIndeterminate: PropTypes.bool,
|
|
23
|
-
onToggleNode: PropTypes.func,
|
|
24
|
-
onSelect: PropTypes.func,
|
|
25
|
-
className: PropTypes.string,
|
|
26
|
-
};
|
|
27
12
|
export default TreeNode;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
export type TreeNodeContainerProps = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
groupId?: string;
|
|
5
|
+
disableAnimation: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const TreeNodeContainer: {
|
|
8
|
+
(props: PropsWithChildren<TreeNodeContainerProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
1
11
|
export default TreeNodeContainer;
|
|
2
|
-
declare function TreeNodeContainer({ isOpen, groupId, children }: {
|
|
3
|
-
isOpen: any;
|
|
4
|
-
groupId: any;
|
|
5
|
-
children: any;
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
declare namespace TreeNodeContainer {
|
|
8
|
-
const displayName: string;
|
|
9
|
-
namespace propTypes {
|
|
10
|
-
const maxHeight: PropTypes.Requireable<number>;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
import PropTypes from "prop-types";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { useAutoAnimate } from '@formkit/auto-animate/react';
|
|
6
|
+
const TreeNodeContainer = (props) => {
|
|
7
|
+
const { isOpen, groupId, disableAnimation, children } = props;
|
|
8
|
+
const treeNodeContainerClasses = classNames('TreeNodeContainer', 'user-select-none overflow-hidden', isOpen && 'open');
|
|
9
|
+
const [parent, enableAnimations] = useAutoAnimate();
|
|
10
|
+
enableAnimations(!disableAnimation);
|
|
11
|
+
return (_jsx("div", Object.assign({ ref: parent, className: treeNodeContainerClasses, "data-id": groupId }, { children: children })));
|
|
8
12
|
};
|
|
9
13
|
TreeNodeContainer.displayName = 'TreeNodeContainer';
|
|
10
|
-
TreeNodeContainer.propTypes = {
|
|
11
|
-
maxHeight: PropTypes.number,
|
|
12
|
-
};
|
|
13
14
|
export default TreeNodeContainer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TreeNothingFoundProps = {};
|
|
3
|
+
declare const TreeNothingFound: React.MemoExoticComponent<(props: TreeNothingFoundProps) => import("react/jsx-runtime").JSX.Element>;
|
|
1
4
|
export default TreeNothingFound;
|
|
2
|
-
declare const TreeNothingFound: React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const TreeNothingFound = React.memo(() => {
|
|
3
|
+
const TreeNothingFound = React.memo((props) => {
|
|
5
4
|
return (_jsx("div", Object.assign({ className: `TreeTreeNothingFound display-flex justify-content-center text-size-20
|
|
6
5
|
padding-top-25 margin-top-25 margin-bottom-25` }, { children: _jsx("span", { className: 'rioglyph rioglyph-looking-glass-man text-size-400pct text-color-light' }) })));
|
|
7
6
|
});
|
|
8
7
|
TreeNothingFound.displayName = 'TreeNothingFound';
|
|
9
|
-
TreeNothingFound.defaultProps = {};
|
|
10
|
-
TreeNothingFound.propTypes = {
|
|
11
|
-
value: PropTypes.string,
|
|
12
|
-
className: PropTypes.string,
|
|
13
|
-
};
|
|
14
8
|
export default TreeNothingFound;
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TreeOptionProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Defines whether the option is set.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
isChecked?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Callback triggered when option is selected.
|
|
11
|
+
* @param event
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The label for the option.
|
|
17
|
+
*/
|
|
18
|
+
label: string | React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Additional classes added to the wrapping element.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const TreeOption: {
|
|
25
|
+
(props: TreeOptionProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
1
28
|
export default TreeOption;
|
|
2
|
-
declare function TreeOption(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare namespace TreeOption {
|
|
4
|
-
const displayName: string;
|
|
5
|
-
namespace defaultProps {
|
|
6
|
-
const isChecked: boolean;
|
|
7
|
-
function onChange(): void;
|
|
8
|
-
}
|
|
9
|
-
namespace propTypes {
|
|
10
|
-
const isChecked_1: PropTypes.Requireable<boolean>;
|
|
11
|
-
export { isChecked_1 as isChecked };
|
|
12
|
-
const onChange_1: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
-
export { onChange_1 as onChange };
|
|
14
|
-
export const label: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
15
|
-
export const className: PropTypes.Requireable<string>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
import PropTypes from "prop-types";
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
import
|
|
3
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
4
|
+
import 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
+
import noop from 'lodash/fp/noop';
|
|
6
7
|
import Switch from '../switch/Switch';
|
|
7
|
-
const TreeOption = props => {
|
|
8
|
-
const { isChecked, className, label, onChange } = props, remainingProps = __rest(props, ["isChecked", "className", "label", "onChange"]);
|
|
8
|
+
const TreeOption = (props) => {
|
|
9
|
+
const { isChecked = false, className, label, onChange = noop } = props, remainingProps = __rest(props, ["isChecked", "className", "label", "onChange"]);
|
|
9
10
|
const optionClasses = classNames('TreeOption', 'display-flex', 'justify-content-start', 'align-items-center', 'gap-10', 'cursor-pointer', className);
|
|
10
11
|
return (_jsxs("div", Object.assign({}, remainingProps, { className: optionClasses, onClick: onChange }, { children: [_jsx("span", Object.assign({ className: 'flex-1-1' }, { children: label })), _jsx("span", Object.assign({ className: 'pointer-events-none scale-80' }, { children: _jsx(Switch, { keyName: 'TreeOption-switch', checked: isChecked }) }))] })));
|
|
11
12
|
};
|
|
12
13
|
TreeOption.displayName = 'TreeOption';
|
|
13
|
-
TreeOption.defaultProps = {
|
|
14
|
-
isChecked: false,
|
|
15
|
-
onChange: () => { },
|
|
16
|
-
};
|
|
17
|
-
TreeOption.propTypes = {
|
|
18
|
-
isChecked: PropTypes.bool,
|
|
19
|
-
onChange: PropTypes.func,
|
|
20
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
21
|
-
className: PropTypes.string,
|
|
22
|
-
};
|
|
23
14
|
export default TreeOption;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TreeOptionsProps = {
|
|
3
|
+
treeOptions?: React.ReactNode[];
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const TreeOptions: {
|
|
7
|
+
(props: TreeOptionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
1
10
|
export default TreeOptions;
|
|
2
|
-
declare function TreeOptions(props: any): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
-
declare namespace TreeOptions {
|
|
4
|
-
const displayName: string;
|
|
5
|
-
namespace defaultProps {
|
|
6
|
-
const treeOptions: never[];
|
|
7
|
-
}
|
|
8
|
-
namespace propTypes {
|
|
9
|
-
const treeOptions_1: PropTypes.Requireable<PropTypes.ReactNodeLike[]>;
|
|
10
|
-
export { treeOptions_1 as treeOptions };
|
|
11
|
-
export const className: PropTypes.Requireable<string>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
import PropTypes from "prop-types";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { isEmpty } from 'lodash';
|
|
6
6
|
import ButtonDropdown from '../dropdown/ButtonDropdown';
|
|
7
|
-
const TreeOptions = props => {
|
|
8
|
-
const { treeOptions, className } = props;
|
|
7
|
+
const TreeOptions = (props) => {
|
|
8
|
+
const { treeOptions = [], className } = props;
|
|
9
9
|
if (isEmpty(treeOptions)) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
@@ -14,11 +14,4 @@ const TreeOptions = props => {
|
|
|
14
14
|
return (_jsx(ButtonDropdown, { title: _jsx("span", { className: 'rioglyph rioglyph-option-vertical', "aria-hidden": 'true' }), bsStyle: 'muted', customDropdown: customDropdown, className: 'TreeHeaderOptions', pullRight: true, iconOnly: true }));
|
|
15
15
|
};
|
|
16
16
|
TreeOptions.displayName = 'TreeOptions';
|
|
17
|
-
TreeOptions.defaultProps = {
|
|
18
|
-
treeOptions: [],
|
|
19
|
-
};
|
|
20
|
-
TreeOptions.propTypes = {
|
|
21
|
-
treeOptions: PropTypes.arrayOf(PropTypes.node),
|
|
22
|
-
className: PropTypes.string,
|
|
23
|
-
};
|
|
24
17
|
export default TreeOptions;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export type TreeRootProps = {
|
|
3
|
+
disableAnimation: boolean;
|
|
4
|
+
maxHeight?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const TreeRoot: {
|
|
7
|
+
({ maxHeight, disableAnimation, children }: PropsWithChildren<TreeRootProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
1
10
|
export default TreeRoot;
|
|
2
|
-
declare function TreeRoot({ maxHeight, children }: {
|
|
3
|
-
maxHeight: any;
|
|
4
|
-
children: any;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare namespace TreeRoot {
|
|
7
|
-
const displayName: string;
|
|
8
|
-
namespace propTypes {
|
|
9
|
-
const maxHeight: PropTypes.Requireable<number>;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
import PropTypes from "prop-types";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { useAutoAnimate } from '@formkit/auto-animate/react';
|
|
6
|
+
const TreeRoot = ({ maxHeight, disableAnimation, children }) => {
|
|
7
|
+
const treeRootClasses = classNames('TreeRoot', 'user-select-none overflow-hidden');
|
|
8
|
+
const [parent, enableAnimations] = useAutoAnimate();
|
|
9
|
+
enableAnimations(!disableAnimation);
|
|
10
|
+
return (_jsx("div", Object.assign({ ref: parent, className: treeRootClasses, style: { maxHeight } }, { children: children })));
|
|
8
11
|
};
|
|
9
12
|
TreeRoot.displayName = 'TreeRoot';
|
|
10
|
-
TreeRoot.propTypes = {
|
|
11
|
-
maxHeight: PropTypes.number,
|
|
12
|
-
};
|
|
13
13
|
export default TreeRoot;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TreeSearchProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The search value to be shown and used for the search.
|
|
5
|
+
*/
|
|
6
|
+
value?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Callback for when the search value changes.
|
|
9
|
+
* @param newValue
|
|
10
|
+
* @param event
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
onChange?: (newValue: string, event: React.ChangeEvent | React.MouseEvent) => void;
|
|
14
|
+
/**
|
|
15
|
+
* The placeholder text used for the input field.
|
|
16
|
+
*/
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Additional classes added to the wrapping element.
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const TreeSearch: React.MemoExoticComponent<(props: TreeSearchProps) => import("react/jsx-runtime").JSX.Element>;
|
|
1
24
|
export default TreeSearch;
|
|
2
|
-
declare const TreeSearch: React.NamedExoticComponent<object>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
+
import noop from 'lodash/fp/noop';
|
|
5
6
|
import ClearableInput from '../clearableInput/ClearableInput';
|
|
6
|
-
const TreeSearch = React.memo(props => {
|
|
7
|
-
const { value, className, placeholder, onChange } = props;
|
|
7
|
+
const TreeSearch = React.memo((props) => {
|
|
8
|
+
const { value, className, placeholder, onChange = noop } = props;
|
|
8
9
|
const classes = classNames('TreeSearch', className);
|
|
9
10
|
return (_jsx("div", Object.assign({ className: classes }, { children: _jsxs("div", Object.assign({ className: 'input-group flex-1-0' }, { children: [_jsx("span", Object.assign({ className: 'input-group-addon' }, { children: _jsx("span", { className: 'rioglyph rioglyph-search', "aria-hidden": 'true' }) })), _jsx(ClearableInput, { value: value, onChange: onChange, placeholder: placeholder })] })) })));
|
|
10
11
|
});
|
|
11
12
|
TreeSearch.displayName = 'TreeSearch';
|
|
12
|
-
TreeSearch.defaultProps = {
|
|
13
|
-
onChange: () => { },
|
|
14
|
-
};
|
|
15
|
-
TreeSearch.propTypes = {
|
|
16
|
-
value: PropTypes.string,
|
|
17
|
-
onChange: PropTypes.func,
|
|
18
|
-
placeholder: PropTypes.string,
|
|
19
|
-
className: PropTypes.string,
|
|
20
|
-
};
|
|
21
13
|
export default TreeSearch;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
+
export type TreeSelectAllProps = {
|
|
2
|
+
value?: string;
|
|
3
|
+
onSelect?: Function;
|
|
4
|
+
isChecked?: boolean;
|
|
5
|
+
isEnabled?: boolean;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
isIndeterminate?: boolean;
|
|
8
|
+
hasSearchResults?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const TreeSelectAll: {
|
|
12
|
+
(props: TreeSelectAllProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
1
15
|
export default TreeSelectAll;
|
|
2
|
-
declare function TreeSelectAll(props: any): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
-
declare namespace TreeSelectAll {
|
|
4
|
-
const displayName: string;
|
|
5
|
-
namespace defaultProps {
|
|
6
|
-
const isChecked: boolean;
|
|
7
|
-
const isEnabled: boolean;
|
|
8
|
-
const isIndeterminate: boolean;
|
|
9
|
-
const hasSearchResults: boolean;
|
|
10
|
-
function onChange(): void;
|
|
11
|
-
}
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
export const value: PropTypes.Requireable<string>;
|
|
14
|
-
export const onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
const isChecked_1: PropTypes.Requireable<boolean>;
|
|
16
|
-
export { isChecked_1 as isChecked };
|
|
17
|
-
const isEnabled_1: PropTypes.Requireable<boolean>;
|
|
18
|
-
export { isEnabled_1 as isEnabled };
|
|
19
|
-
export const isDisabled: PropTypes.Requireable<boolean>;
|
|
20
|
-
const isIndeterminate_1: PropTypes.Requireable<boolean>;
|
|
21
|
-
export { isIndeterminate_1 as isIndeterminate };
|
|
22
|
-
const hasSearchResults_1: PropTypes.Requireable<boolean>;
|
|
23
|
-
export { hasSearchResults_1 as hasSearchResults };
|
|
24
|
-
export const className: PropTypes.Requireable<string>;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
import PropTypes from "prop-types";
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
4
|
+
import noop from 'lodash/fp/noop';
|
|
4
5
|
import Checkbox from '../checkbox/Checkbox';
|
|
5
|
-
const TreeSelectAll = props => {
|
|
6
|
-
const { isDisabled, isChecked, isEnabled, isIndeterminate,
|
|
7
|
-
|
|
6
|
+
const TreeSelectAll = (props) => {
|
|
7
|
+
const { isDisabled, isChecked = false, isEnabled = true, isIndeterminate = false, hasSearchResults = false, // needed?
|
|
8
|
+
onSelect = noop, } = props;
|
|
9
|
+
const handleSelectAll = (event) => onSelect(event.target.checked, isIndeterminate);
|
|
8
10
|
return isEnabled ? (_jsx("div", Object.assign({ className: 'TreeSelectAll display-flex align-items-center' }, { children: _jsx(Checkbox, { checked: isChecked, onClick: handleSelectAll, disabled: isDisabled, indeterminate: isIndeterminate, className: 'margin-top--1' }) }))) : null;
|
|
9
11
|
};
|
|
10
12
|
TreeSelectAll.displayName = 'TreeSelectAll';
|
|
11
|
-
TreeSelectAll.defaultProps = {
|
|
12
|
-
isChecked: false,
|
|
13
|
-
isEnabled: true,
|
|
14
|
-
isIndeterminate: false,
|
|
15
|
-
hasSearchResults: false,
|
|
16
|
-
onChange: () => { },
|
|
17
|
-
};
|
|
18
|
-
TreeSelectAll.propTypes = {
|
|
19
|
-
value: PropTypes.string,
|
|
20
|
-
onSelect: PropTypes.func,
|
|
21
|
-
isChecked: PropTypes.bool,
|
|
22
|
-
isEnabled: PropTypes.bool,
|
|
23
|
-
isDisabled: PropTypes.bool,
|
|
24
|
-
isIndeterminate: PropTypes.bool,
|
|
25
|
-
hasSearchResults: PropTypes.bool,
|
|
26
|
-
className: PropTypes.string,
|
|
27
|
-
};
|
|
28
13
|
export default TreeSelectAll;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TreeCategoryNode } from './TreeCategory';
|
|
3
|
+
export type TreeSidebarProps = {
|
|
4
|
+
currentCategoryId?: string;
|
|
5
|
+
onSelectCategory?: (selectedCategory: string) => void;
|
|
6
|
+
onClick?: VoidFunction;
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: TreeCategoryNode[];
|
|
9
|
+
};
|
|
10
|
+
declare const TreeSidebar: React.MemoExoticComponent<(props: TreeSidebarProps) => import("react/jsx-runtime").JSX.Element>;
|
|
1
11
|
export default TreeSidebar;
|
|
2
|
-
declare const TreeSidebar: React.NamedExoticComponent<object>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,44 +1,13 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import
|
|
4
|
+
import noop from 'lodash/fp/noop';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const SELECTED_CLASS_NAME = 'selected';
|
|
10
|
-
const LABEL_TOOLTIP_DELAY = 1500;
|
|
11
|
-
const TreeSidebarCategories = ({ children, currentCategoryId, onSelectCategory }) => {
|
|
12
|
-
return children.map(child => {
|
|
13
|
-
const id = child.props.id;
|
|
14
|
-
const icon = child.props.icon || '';
|
|
15
|
-
const label = child.props.label;
|
|
16
|
-
const statusClassName = classNames(currentCategoryId === id ? ACTIVE_CLASS_NAME : '', child.props.hasSelection && SELECTED_CLASS_NAME);
|
|
17
|
-
const handleSelectCategory = event => {
|
|
18
|
-
event.stopPropagation();
|
|
19
|
-
onSelectCategory(id);
|
|
20
|
-
};
|
|
21
|
-
const category = (_jsx("li", Object.assign({ onClick: handleSelectCategory, className: statusClassName }, { children: _jsx("div", Object.assign({ className: 'selection-bubble' }, { children: _jsx("span", { className: `rioglyph ${icon}` }) })) }), id));
|
|
22
|
-
if (label) {
|
|
23
|
-
const tooltip = _jsx("span", { children: label });
|
|
24
|
-
return (_jsx(OverlayTrigger, Object.assign({ placement: Tooltip.RIGHT, delayShow: LABEL_TOOLTIP_DELAY, overlay: _jsx(Tooltip, Object.assign({ id: 'tooltip', width: 'auto' }, { children: tooltip })) }, { children: category }), `category-tooltip-${id}`));
|
|
25
|
-
}
|
|
26
|
-
return category;
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
const TreeSidebar = React.memo(props => {
|
|
30
|
-
const { className, onClick } = props, remainingProps = __rest(props, ["className", "onClick"]);
|
|
6
|
+
import TreeSidebarCategories from './TreeSidebarCategories';
|
|
7
|
+
const TreeSidebar = React.memo((props) => {
|
|
8
|
+
const { className, onClick = noop } = props, remainingProps = __rest(props, ["className", "onClick"]);
|
|
31
9
|
const classes = classNames('TreeSidebar', className);
|
|
32
10
|
return (_jsxs("div", Object.assign({ className: classes }, { children: [_jsx("ul", Object.assign({ className: 'TreeSidebarNavigation', onClick: onClick }, { children: _jsx(TreeSidebarCategories, Object.assign({}, remainingProps)) })), _jsx("div", Object.assign({ className: 'TreeSidebarToggle', onClick: onClick }, { children: _jsx("span", { className: 'rioglyph rioglyph-chevron-left' }) }))] })));
|
|
33
11
|
});
|
|
34
12
|
TreeSidebar.displayName = 'TreeSidebar';
|
|
35
|
-
TreeSidebar.defaultProps = {
|
|
36
|
-
onClick: () => { },
|
|
37
|
-
};
|
|
38
|
-
TreeSidebar.propTypes = {
|
|
39
|
-
currentCategoryId: PropTypes.string,
|
|
40
|
-
children: PropTypes.arrayOf(PropTypes.node),
|
|
41
|
-
onClick: PropTypes.func.isRequired,
|
|
42
|
-
className: PropTypes.string,
|
|
43
|
-
};
|
|
44
13
|
export default TreeSidebar;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TreeCategoryNode } from './TreeCategory';
|
|
2
|
+
export type TreeSidebarCategoriesProps = {
|
|
3
|
+
currentCategoryId?: string;
|
|
4
|
+
onSelectCategory?: (selectedCategory: string) => void;
|
|
5
|
+
children?: TreeCategoryNode[];
|
|
6
|
+
};
|
|
7
|
+
declare const TreeSidebarCategories: {
|
|
8
|
+
(props: TreeSidebarCategoriesProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default TreeSidebarCategories;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import noop from 'lodash/fp/noop';
|
|
6
|
+
import OverlayTrigger from '../overlay/OverlayTrigger';
|
|
7
|
+
import Tooltip from '../tooltip/Tooltip';
|
|
8
|
+
const ACTIVE_CLASS_NAME = 'active';
|
|
9
|
+
const SELECTED_CLASS_NAME = 'selected';
|
|
10
|
+
const TOOLTIP_DELAY = 1500;
|
|
11
|
+
const TreeSidebarCategories = (props) => {
|
|
12
|
+
const { children, currentCategoryId, onSelectCategory = noop } = props;
|
|
13
|
+
if (!children) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return (_jsx(_Fragment, { children: children.map(child => {
|
|
17
|
+
const id = child.props.id;
|
|
18
|
+
const icon = child.props.icon || '';
|
|
19
|
+
const label = child.props.label;
|
|
20
|
+
const statusClassName = classNames(currentCategoryId === id ? ACTIVE_CLASS_NAME : '', child.props.hasSelection && SELECTED_CLASS_NAME);
|
|
21
|
+
const handleSelectCategory = (event) => {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
onSelectCategory(id);
|
|
24
|
+
};
|
|
25
|
+
const category = (_jsx("li", Object.assign({ onClick: handleSelectCategory, className: statusClassName }, { children: _jsx("div", Object.assign({ className: 'selection-bubble' }, { children: _jsx("span", { className: `rioglyph ${icon}` }) })) }), id));
|
|
26
|
+
if (label) {
|
|
27
|
+
const tooltip = _jsx("span", { children: label });
|
|
28
|
+
return (_jsx(OverlayTrigger, Object.assign({ placement: Tooltip.RIGHT, delay: TOOLTIP_DELAY, overlay: _jsx(Tooltip, Object.assign({ id: 'tooltip', width: 'auto' }, { children: tooltip })) }, { children: category }), `category-tooltip-${id}`));
|
|
29
|
+
}
|
|
30
|
+
return category;
|
|
31
|
+
}) }));
|
|
32
|
+
};
|
|
33
|
+
TreeSidebarCategories.displayName = 'TreeSidebarCategories';
|
|
34
|
+
export default TreeSidebarCategories;
|
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
export type AssetType = 'truck' | 'trailer' | 'bus' | 'van' | 'driver';
|
|
3
|
+
export type TreeSummaryCounts = {
|
|
4
|
+
/**
|
|
5
|
+
* The amount of trucks
|
|
6
|
+
*/
|
|
7
|
+
truck?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The amount of trailers
|
|
10
|
+
*/
|
|
11
|
+
trailer?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The amount of buses
|
|
14
|
+
*/
|
|
15
|
+
bus?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The amount of vans
|
|
18
|
+
*/
|
|
19
|
+
van?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The amount of drivers
|
|
22
|
+
*/
|
|
23
|
+
driver?: number;
|
|
24
|
+
};
|
|
25
|
+
export type DefaultAssetCountsProps = {
|
|
26
|
+
assetCounts: TreeSummaryCounts;
|
|
27
|
+
};
|
|
28
|
+
export type TreeSummaryProps = {
|
|
29
|
+
/**
|
|
30
|
+
* The object containing various asset type counter.
|
|
31
|
+
*/
|
|
32
|
+
assetCounts?: TreeSummaryCounts;
|
|
33
|
+
/**
|
|
34
|
+
* The number of grid columns used for the built-in `TreeSummaryRow`.
|
|
35
|
+
*
|
|
36
|
+
* @default 4
|
|
37
|
+
*/
|
|
38
|
+
gridCols?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Additional classes added to the wrapping element.
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
};
|
|
44
|
+
declare const TreeSummary: React.MemoExoticComponent<(props: PropsWithChildren<TreeSummaryProps>) => import("react/jsx-runtime").JSX.Element>;
|
|
1
45
|
export default TreeSummary;
|
|
2
|
-
declare const TreeSummary: React.NamedExoticComponent<object>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import TypeCounter from './TypeCounter';
|
|
6
|
+
import TreeSummaryRow from './TreeSummaryRow';
|
|
6
7
|
const DefaultAssetCounts = ({ assetCounts }) => {
|
|
7
8
|
const { truck, bus, van, trailer, driver } = assetCounts;
|
|
8
9
|
return (_jsxs(_Fragment, { children: [_jsx(TypeCounter, { hideOnZero: true, icon: 'truck-baseline', value: truck }), _jsx(TypeCounter, { hideOnZero: true, icon: 'trailer-baseline', value: trailer }), _jsx(TypeCounter, { hideOnZero: true, icon: 'bus-baseline', value: bus }), _jsx(TypeCounter, { hideOnZero: true, icon: 'van-baseline', value: van }), _jsx(TypeCounter, { hideOnZero: true, icon: 'driver', value: driver })] }));
|
|
9
10
|
};
|
|
10
|
-
const TreeSummary = React.memo(props => {
|
|
11
|
-
const { className, assetCounts, children } = props;
|
|
12
|
-
const classes = classNames('TreeSummary', 'display-flex
|
|
13
|
-
return _jsx("div", Object.assign({ className: classes }, { children: children || _jsx(DefaultAssetCounts, { assetCounts: assetCounts }) }));
|
|
11
|
+
const TreeSummary = React.memo((props) => {
|
|
12
|
+
const { className = '', assetCounts = {}, gridCols, children } = props;
|
|
13
|
+
const classes = classNames('TreeSummary', 'display-flex flex-wrap', 'align-items-center', 'gap-10', 'padding-left-3', className);
|
|
14
|
+
return (_jsx("div", Object.assign({ className: classes }, { children: children || (_jsx(TreeSummaryRow, Object.assign({ gridCols: gridCols }, { children: _jsx(DefaultAssetCounts, { assetCounts: assetCounts }) }))) })));
|
|
14
15
|
});
|
|
15
16
|
TreeSummary.displayName = 'TreeSummary';
|
|
16
|
-
TreeSummary.defaultProps = {
|
|
17
|
-
assetCounts: {},
|
|
18
|
-
className: '',
|
|
19
|
-
};
|
|
20
|
-
TreeSummary.propTypes = {
|
|
21
|
-
assetCounts: PropTypes.shape({
|
|
22
|
-
truck: PropTypes.number,
|
|
23
|
-
trailer: PropTypes.number,
|
|
24
|
-
bus: PropTypes.number,
|
|
25
|
-
van: PropTypes.number,
|
|
26
|
-
driver: PropTypes.number,
|
|
27
|
-
}),
|
|
28
|
-
className: PropTypes.string,
|
|
29
|
-
};
|
|
30
17
|
export default TreeSummary;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
export type TreeSummaryRowProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Defined the number of grid columns for a single row. Note, when the
|
|
5
|
+
* amount of children exceed the columns it will wrap around to a new line.
|
|
6
|
+
*
|
|
7
|
+
* @default 4
|
|
8
|
+
*/
|
|
9
|
+
gridCols?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const TreeSummaryRow: {
|
|
12
|
+
({ gridCols, children }: PropsWithChildren<TreeSummaryRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export default TreeSummaryRow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
|
+
import 'react';
|
|
4
|
+
export const TreeSummaryRow = ({ gridCols = 4, children }) => (_jsx("div", Object.assign({ className: `TreeSummaryRow display-grid grid-cols-${gridCols} gap-10` }, { children: children })));
|
|
5
|
+
TreeSummaryRow.displayName = 'TreeSummaryRow';
|
|
6
|
+
export default TreeSummaryRow;
|