@rio-cloud/rio-uikit 0.16.4-beta.5 → 0.16.4-beta.7
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/Button.d.ts +2 -27
- package/Button.js +2 -2
- package/DataTab.d.ts +2 -5
- package/DataTab.js +2 -2
- package/DataTabs.d.ts +2 -5
- package/DataTabs.js +2 -2
- package/ToggleButton.d.ts +2 -5
- package/ToggleButton.js +2 -2
- package/components/assetTree/TreeLeaf.d.ts +11 -2
- package/components/assetTree/TreeLeaf.js +1 -11
- package/components/autosuggest/AutoSuggest.d.ts +0 -1
- package/components/autosuggest/AutoSuggest.js +0 -1
- package/components/button/Button.d.ts +121 -56
- package/components/button/Button.js +66 -84
- package/components/button/ToggleButton.d.ts +6 -29
- package/components/button/ToggleButton.js +3 -4
- package/components/dataTabs/DataTab.d.ts +28 -19
- package/components/dataTabs/DataTab.js +11 -19
- package/components/dataTabs/DataTabHeader.d.ts +18 -0
- package/components/dataTabs/DataTabHeader.js +10 -0
- package/components/dataTabs/DataTabs.d.ts +79 -55
- package/components/dataTabs/DataTabs.js +31 -59
- package/components/editableContent/EditableContent.js +0 -1
- package/components/mapMarker/SingleMapMarker.d.ts +6 -0
- package/components/mapMarker/SingleMapMarker.js +8 -4
- package/components/noData/NoData.js +1 -1
- package/components/saveableInput/SaveableInput.js +1 -1
- package/components/table/TableSettingsDialogFooter.js +1 -1
- package/components/tooltip/SimpleTooltip.d.ts +22 -7
- package/components/tooltip/SimpleTooltip.js +3 -2
- package/components/tooltip/Tooltip.d.ts +36 -3
- package/hooks/useAfterMount.d.ts +8 -1
- package/hooks/useAfterMount.js +9 -2
- package/hooks/usePrevious.d.ts +2 -2
- package/hooks/usePrevious.js +9 -8
- package/index.d.ts +8 -8
- package/index.js +8 -8
- package/lib/es/Button.d.ts +2 -27
- package/lib/es/Button.js +3 -2
- package/lib/es/DataTab.d.ts +2 -5
- package/lib/es/DataTab.js +3 -2
- package/lib/es/DataTabs.d.ts +2 -5
- package/lib/es/DataTabs.js +3 -2
- package/lib/es/ToggleButton.d.ts +2 -5
- package/lib/es/ToggleButton.js +3 -2
- package/lib/es/components/assetTree/TreeLeaf.d.ts +11 -2
- package/lib/es/components/assetTree/TreeLeaf.js +1 -11
- package/lib/es/components/autosuggest/AutoSuggest.d.ts +0 -1
- package/lib/es/components/autosuggest/AutoSuggest.js +0 -1
- package/lib/es/components/button/Button.d.ts +121 -56
- package/lib/es/components/button/Button.js +66 -84
- package/lib/es/components/button/ToggleButton.d.ts +6 -29
- package/lib/es/components/button/ToggleButton.js +3 -4
- package/lib/es/components/dataTabs/DataTab.d.ts +28 -19
- package/lib/es/components/dataTabs/DataTab.js +11 -19
- package/lib/es/components/dataTabs/DataTabHeader.d.ts +18 -0
- package/lib/es/components/dataTabs/DataTabHeader.js +13 -0
- package/lib/es/components/dataTabs/DataTabs.d.ts +79 -55
- package/lib/es/components/dataTabs/DataTabs.js +30 -58
- package/lib/es/components/editableContent/EditableContent.js +0 -1
- package/lib/es/components/mapMarker/SingleMapMarker.d.ts +6 -0
- package/lib/es/components/mapMarker/SingleMapMarker.js +8 -4
- package/lib/es/components/noData/NoData.js +1 -1
- package/lib/es/components/saveableInput/SaveableInput.js +1 -1
- package/lib/es/components/table/TableSettingsDialogFooter.js +1 -1
- package/lib/es/components/tooltip/SimpleTooltip.d.ts +22 -7
- package/lib/es/components/tooltip/SimpleTooltip.js +2 -2
- package/lib/es/components/tooltip/Tooltip.d.ts +36 -3
- package/lib/es/hooks/useAfterMount.d.ts +8 -1
- package/lib/es/hooks/useAfterMount.js +8 -2
- package/lib/es/hooks/usePrevious.d.ts +2 -2
- package/lib/es/hooks/usePrevious.js +10 -8
- package/lib/es/index.d.ts +8 -8
- package/lib/es/index.js +16 -12
- package/lib/es/styles/variables/colors.json +73 -73
- package/lib/es/types.d.ts +0 -43
- package/lib/es/useAfterMount.d.ts +1 -4
- package/lib/es/useAfterMount.js +5 -3
- package/lib/es/utils/init.js +10 -5
- package/lib/es/version.json +1 -1
- package/package.json +20 -20
- package/styles/variables/colors.json +73 -73
- package/types.d.ts +0 -43
- package/useAfterMount.d.ts +1 -4
- package/useAfterMount.js +1 -2
- package/utils/init.js +10 -5
- package/version.json +1 -1
package/.DS_Store
ADDED
|
Binary file
|
package/Button.d.ts
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ButtonProps } from './types';
|
|
4
|
-
export default class Button extends React.Component<ButtonProps> {
|
|
5
|
-
// Button styles
|
|
6
|
-
static DEFAULT = 'default';
|
|
7
|
-
static PRIMARY = 'primary';
|
|
8
|
-
static SECONDARY = 'secondary';
|
|
9
|
-
static INFO = 'info';
|
|
10
|
-
static WARNING = 'warning';
|
|
11
|
-
static DANGER = 'danger';
|
|
12
|
-
static SUCCESS = 'success';
|
|
13
|
-
static MUTED = 'muted';
|
|
14
|
-
|
|
15
|
-
// Button Type
|
|
16
|
-
static VARIANT_LINK = 'link';
|
|
17
|
-
static VARIANT_LINK_INLINE = 'link-inline';
|
|
18
|
-
static VARIANT_OUTLINE = 'outline';
|
|
19
|
-
static VARIANT_ACTION = 'action';
|
|
20
|
-
|
|
21
|
-
// Button Size
|
|
22
|
-
static XS = 'xs';
|
|
23
|
-
static SM = 'sm';
|
|
24
|
-
static MD = 'md';
|
|
25
|
-
static LG = 'lg';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
export { default } from './components/button/Button';
|
|
2
|
+
export * from './components/button/Button';
|
package/Button.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { default } from './components/button/Button';
|
|
2
|
+
export * from './components/button/Button';
|
package/DataTab.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DataTabProps } from './types';
|
|
4
|
-
export default class DataTab extends React.Component<DataTabProps> {}
|
|
5
|
-
}
|
|
1
|
+
export { default } from './components/dataTabs/DataTab';
|
|
2
|
+
export * from './components/dataTabs/DataTab';
|
package/DataTab.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { default } from './components/dataTabs/DataTab';
|
|
2
|
+
export * from './components/dataTabs/DataTab';
|
package/DataTabs.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DataTabsProps } from './types';
|
|
4
|
-
export default class DataTabs extends React.Component<DataTabsProps> {}
|
|
5
|
-
}
|
|
1
|
+
export { default } from './components/dataTabs/DataTabs';
|
|
2
|
+
export * from './components/dataTabs/DataTabs';
|
package/DataTabs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { default } from './components/dataTabs/DataTabs';
|
|
2
|
+
export * from './components/dataTabs/DataTabs';
|
package/ToggleButton.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ToggleButtonProps } from './types';
|
|
4
|
-
export default class ToggleButton extends React.Component<ToggleButtonProps> {}
|
|
5
|
-
}
|
|
1
|
+
export { default } from './components/button/ToggleButton';
|
|
2
|
+
export * from './components/button/ToggleButton';
|
package/ToggleButton.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { default } from './components/button/ToggleButton';
|
|
2
|
+
export * from './components/button/ToggleButton';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TreeItem } from '../../types';
|
|
3
|
+
export type TreeLeafProps = {
|
|
4
|
+
item: TreeItem;
|
|
5
|
+
hasMultiselect: boolean;
|
|
6
|
+
showRadioButtons: boolean;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
onSelectItem: VoidFunction;
|
|
9
|
+
onActiveItem: VoidFunction;
|
|
10
|
+
};
|
|
11
|
+
declare const TreeLeaf: React.MemoExoticComponent<(props: TreeLeafProps) => import("react/jsx-runtime").JSX.Element>;
|
|
1
12
|
export default TreeLeaf;
|
|
2
|
-
declare const TreeLeaf: React.NamedExoticComponent<object>;
|
|
3
|
-
import React from "react";
|
|
@@ -1,23 +1,13 @@
|
|
|
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 isObject from 'lodash/fp/isObject';
|
|
6
5
|
import Checkbox from '../checkbox/Checkbox';
|
|
7
6
|
import RadioButton from '../radiobutton/RadioButton';
|
|
8
|
-
const TreeLeaf = React.memo(props => {
|
|
7
|
+
const TreeLeaf = React.memo((props) => {
|
|
9
8
|
const { item, hasMultiselect, showRadioButtons, isSelected, onSelectItem, onActiveItem } = props;
|
|
10
9
|
const treeNodeClassNames = classNames('TreeLeaf', 'form-group margin-bottom-0', isSelected && 'active', item.className && item.className);
|
|
11
10
|
return (_jsxs("div", Object.assign({ className: treeNodeClassNames, "data-key": item.id }, { children: [hasMultiselect && _jsx(Checkbox, { className: 'TreeCheckbox', checked: isSelected, onClick: onSelectItem }), !hasMultiselect && showRadioButtons && (_jsx(RadioButton, { className: 'TreeRadioButton', checked: isSelected, onChange: onSelectItem })), _jsx("span", Object.assign({ className: 'TreeLabel', onClick: onActiveItem }, { children: _jsxs("span", Object.assign({ className: 'TreeLabelName' }, { children: [_jsx("span", { className: `rioglyph rioglyph-${item.type} margin-top--1` }), _jsxs("span", Object.assign({ className: 'TreeLabelNameText' }, { children: [_jsx("span", Object.assign({ className: 'TreeLabelNameTextHeadline' }, { children: isObject(item.name) ? (_jsxs(React.Fragment, { children: [_jsx("span", Object.assign({ className: 'text-light margin-right-3' }, { children: item.name.firstName })), _jsx("span", { children: item.name.lastName })] })) : (_jsx(React.Fragment, { children: item.name })) })), item.info && _jsx("span", Object.assign({ className: 'TreeLabelNameTextSubline' }, { children: item.info }))] }))] })) }))] })));
|
|
12
11
|
});
|
|
13
12
|
TreeLeaf.displayName = 'TreeLeaf';
|
|
14
|
-
TreeLeaf.defaultProps = {};
|
|
15
|
-
TreeLeaf.propTypes = {
|
|
16
|
-
item: PropTypes.object,
|
|
17
|
-
hasMultiselect: PropTypes.bool,
|
|
18
|
-
showRadioButtons: PropTypes.bool,
|
|
19
|
-
isSelected: PropTypes.bool,
|
|
20
|
-
onSelectItem: PropTypes.func,
|
|
21
|
-
onActiveItem: PropTypes.func,
|
|
22
|
-
};
|
|
23
13
|
export default TreeLeaf;
|
|
@@ -1,57 +1,122 @@
|
|
|
1
|
+
import { type PropsWithChildren, type SyntheticEvent } from 'react';
|
|
2
|
+
import type { ObjectValues } from '../../utils/ObjectValues';
|
|
3
|
+
declare const STYLES_MAP: {
|
|
4
|
+
readonly DEFAULT: "default";
|
|
5
|
+
readonly PRIMARY: "primary";
|
|
6
|
+
readonly SECONDARY: "secondary";
|
|
7
|
+
readonly INFO: "info";
|
|
8
|
+
readonly WARNING: "warning";
|
|
9
|
+
readonly DANGER: "danger";
|
|
10
|
+
readonly SUCCESS: "success";
|
|
11
|
+
readonly MUTED: "muted";
|
|
12
|
+
};
|
|
13
|
+
type STYLE = ObjectValues<typeof STYLES_MAP>;
|
|
14
|
+
declare const VARIANTS_MAP: {
|
|
15
|
+
readonly VARIANT_LINK: "link";
|
|
16
|
+
readonly VARIANT_LINK_INLINE: "link-inline";
|
|
17
|
+
readonly VARIANT_OUTLINE: "outline";
|
|
18
|
+
readonly VARIANT_ACTION: "action";
|
|
19
|
+
};
|
|
20
|
+
type VARIANT = ObjectValues<typeof VARIANTS_MAP>;
|
|
21
|
+
declare const SIZES_MAP: {
|
|
22
|
+
readonly XS: "xs";
|
|
23
|
+
readonly SM: "sm";
|
|
24
|
+
readonly MD: "md";
|
|
25
|
+
readonly LG: "lg";
|
|
26
|
+
};
|
|
27
|
+
type SIZE = ObjectValues<typeof SIZES_MAP>;
|
|
28
|
+
type RegularButtonProps = {
|
|
29
|
+
/**
|
|
30
|
+
* Use the button as a toggle button. The toggle state can be controlled via the `active` prop.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
asToggle?: false;
|
|
34
|
+
/**
|
|
35
|
+
* Callback function triggered when clicking the button.
|
|
36
|
+
* @param event The MouseEvent that triggered the click.
|
|
37
|
+
*/
|
|
38
|
+
onClick?: (event: SyntheticEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
39
|
+
};
|
|
40
|
+
type ToggleButtonProps = {
|
|
41
|
+
/**
|
|
42
|
+
* Use the button as a toggle button. The toggle state can be controlled via the `active` prop.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
asToggle: true;
|
|
46
|
+
/**
|
|
47
|
+
* Callback function triggered when clicking the button.
|
|
48
|
+
* @param value The new value of the toggle button.
|
|
49
|
+
*/
|
|
50
|
+
onClick?: (value: boolean) => void;
|
|
51
|
+
};
|
|
52
|
+
export type ButtonProps = {
|
|
53
|
+
/**
|
|
54
|
+
* Set the button toggled. Should be used in combination with "asToggle" prop.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
active?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the button should be disabled.
|
|
60
|
+
*
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Use when the content of the button is an icon only to adapt the button spacing accordingly.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
iconOnly?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Defines whether the button text break into multiple lines when the button space exceeds.
|
|
71
|
+
*
|
|
72
|
+
* Multiline buttons should be used as exception only.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
multiline?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Defines whether the button takes up the full width of the parent element.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
block?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the button style.
|
|
83
|
+
* @default "default"
|
|
84
|
+
*/
|
|
85
|
+
bsStyle?: STYLE;
|
|
86
|
+
/**
|
|
87
|
+
* Sets the button size.
|
|
88
|
+
*/
|
|
89
|
+
bsSize?: SIZE;
|
|
90
|
+
/**
|
|
91
|
+
* Sets the button variant.
|
|
92
|
+
*/
|
|
93
|
+
variant?: VARIANT;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the "ripple" effect should be suppressed on this button.
|
|
96
|
+
*/
|
|
97
|
+
noRippleEffect?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Additional classes to be set on the button element.
|
|
100
|
+
*/
|
|
101
|
+
className?: string;
|
|
102
|
+
} & (RegularButtonProps | ToggleButtonProps);
|
|
103
|
+
declare const Button: {
|
|
104
|
+
(props: PropsWithChildren<ButtonProps>): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
DEFAULT: "default";
|
|
106
|
+
PRIMARY: "primary";
|
|
107
|
+
SECONDARY: "secondary";
|
|
108
|
+
INFO: "info";
|
|
109
|
+
WARNING: "warning";
|
|
110
|
+
DANGER: "danger";
|
|
111
|
+
SUCCESS: "success";
|
|
112
|
+
MUTED: "muted";
|
|
113
|
+
VARIANT_LINK: "link";
|
|
114
|
+
VARIANT_LINK_INLINE: "link-inline";
|
|
115
|
+
VARIANT_OUTLINE: "outline";
|
|
116
|
+
VARIANT_ACTION: "action";
|
|
117
|
+
XS: "xs";
|
|
118
|
+
SM: "sm";
|
|
119
|
+
MD: "md";
|
|
120
|
+
LG: "lg";
|
|
121
|
+
};
|
|
1
122
|
export default Button;
|
|
2
|
-
declare function Button(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare namespace Button {
|
|
4
|
-
const DEFAULT: string;
|
|
5
|
-
const PRIMARY: string;
|
|
6
|
-
const SECONDARY: string;
|
|
7
|
-
const INFO: string;
|
|
8
|
-
const WARNING: string;
|
|
9
|
-
const DANGER: string;
|
|
10
|
-
const SUCCESS: string;
|
|
11
|
-
const MUTED: string;
|
|
12
|
-
const VARIANT_LINK: string;
|
|
13
|
-
const VARIANT_LINK_INLINE: string;
|
|
14
|
-
const VARIANT_OUTLINE: string;
|
|
15
|
-
const VARIANT_ACTION: string;
|
|
16
|
-
const XS: string;
|
|
17
|
-
const SM: string;
|
|
18
|
-
const MD: string;
|
|
19
|
-
const LG: string;
|
|
20
|
-
namespace defaultProps {
|
|
21
|
-
const active: boolean;
|
|
22
|
-
const disabled: boolean;
|
|
23
|
-
const asToggle: boolean;
|
|
24
|
-
const iconOnly: boolean;
|
|
25
|
-
const multiline: boolean;
|
|
26
|
-
const block: boolean;
|
|
27
|
-
const noRippleEffect: boolean;
|
|
28
|
-
function onClick(): void;
|
|
29
|
-
const className: string;
|
|
30
|
-
const bsStyle: string;
|
|
31
|
-
}
|
|
32
|
-
namespace propTypes {
|
|
33
|
-
const active_1: PropTypes.Requireable<boolean>;
|
|
34
|
-
export { active_1 as active };
|
|
35
|
-
const disabled_1: PropTypes.Requireable<boolean>;
|
|
36
|
-
export { disabled_1 as disabled };
|
|
37
|
-
const asToggle_1: PropTypes.Requireable<boolean>;
|
|
38
|
-
export { asToggle_1 as asToggle };
|
|
39
|
-
const iconOnly_1: PropTypes.Requireable<boolean>;
|
|
40
|
-
export { iconOnly_1 as iconOnly };
|
|
41
|
-
const multiline_1: PropTypes.Requireable<boolean>;
|
|
42
|
-
export { multiline_1 as multiline };
|
|
43
|
-
const block_1: PropTypes.Requireable<boolean>;
|
|
44
|
-
export { block_1 as block };
|
|
45
|
-
const onClick_1: PropTypes.Validator<(...args: any[]) => any>;
|
|
46
|
-
export { onClick_1 as onClick };
|
|
47
|
-
const bsStyle_1: PropTypes.Requireable<string>;
|
|
48
|
-
export { bsStyle_1 as bsStyle };
|
|
49
|
-
export const bsSize: PropTypes.Requireable<string>;
|
|
50
|
-
export const variant: PropTypes.Requireable<string>;
|
|
51
|
-
const noRippleEffect_1: PropTypes.Requireable<boolean>;
|
|
52
|
-
export { noRippleEffect_1 as noRippleEffect };
|
|
53
|
-
const className_1: PropTypes.Requireable<string>;
|
|
54
|
-
export { className_1 as className };
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
import PropTypes from "prop-types";
|
|
@@ -1,97 +1,79 @@
|
|
|
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 { useRef, useState } from 'react';
|
|
5
4
|
import classNames from 'classnames';
|
|
5
|
+
import noop from 'lodash/fp/noop';
|
|
6
6
|
import { createButtonRipple } from '../../utils/buttonEffect';
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const STYLES_MAP = {
|
|
8
|
+
DEFAULT: 'default',
|
|
9
|
+
PRIMARY: 'primary',
|
|
10
|
+
SECONDARY: 'secondary',
|
|
11
|
+
INFO: 'info',
|
|
12
|
+
WARNING: 'warning',
|
|
13
|
+
DANGER: 'danger',
|
|
14
|
+
SUCCESS: 'success',
|
|
15
|
+
MUTED: 'muted',
|
|
16
|
+
};
|
|
17
|
+
const VARIANTS_MAP = {
|
|
18
|
+
VARIANT_LINK: 'link',
|
|
19
|
+
VARIANT_LINK_INLINE: 'link-inline',
|
|
20
|
+
VARIANT_OUTLINE: 'outline',
|
|
21
|
+
VARIANT_ACTION: 'action',
|
|
22
|
+
};
|
|
23
|
+
const SIZES_MAP = {
|
|
24
|
+
XS: 'xs',
|
|
25
|
+
SM: 'sm',
|
|
26
|
+
MD: 'md',
|
|
27
|
+
LG: 'lg',
|
|
28
|
+
};
|
|
29
|
+
const Button = (props) => {
|
|
30
|
+
const { active = false, disabled = false, asToggle = false, onClick = noop, bsStyle = 'default', bsSize, variant, iconOnly = false, multiline = false, block = false, className = '', noRippleEffect = false, children } = props, remainingProps = __rest(props, ["active", "disabled", "asToggle", "onClick", "bsStyle", "bsSize", "variant", "iconOnly", "multiline", "block", "className", "noRippleEffect", "children"]);
|
|
9
31
|
const [isToggled, setIsToggled] = useState(active);
|
|
10
|
-
const btnRef = useRef();
|
|
11
|
-
// Update internal toggle state when used as controlled component
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
const btnRef = useRef(null);
|
|
33
|
+
// Update internal toggle state when used as controlled component and outside toggle state changes
|
|
34
|
+
const [previousActive, setPreviousActive] = useState(active);
|
|
35
|
+
if (active !== previousActive) {
|
|
36
|
+
setIsToggled(active);
|
|
37
|
+
setPreviousActive(active);
|
|
38
|
+
}
|
|
39
|
+
const handleClick = (event) => {
|
|
40
|
+
var _a;
|
|
41
|
+
if (!noRippleEffect) {
|
|
42
|
+
createButtonRipple(event.nativeEvent, event.currentTarget);
|
|
43
|
+
}
|
|
44
|
+
if (asToggle) {
|
|
45
|
+
// Intercept click handler only for toggle button to update internal state and blur after click
|
|
46
|
+
const newIsToggled = !isToggled;
|
|
47
|
+
setIsToggled(newIsToggled);
|
|
48
|
+
if (newIsToggled) {
|
|
49
|
+
(_a = btnRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
50
|
+
}
|
|
51
|
+
onClick(newIsToggled);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
onClick(event);
|
|
19
55
|
}
|
|
20
|
-
const mouseListener = btnRef.current.addEventListener('mousedown', createButtonRipple, false);
|
|
21
|
-
const touchListener = btnRef.current.addEventListener('touchstart', createButtonRipple, false);
|
|
22
|
-
return () => {
|
|
23
|
-
mouseListener && btnRef.current.removeEventListener('mousedown', createButtonRipple, false);
|
|
24
|
-
touchListener && btnRef.current.removeEventListener('touchstart', createButtonRipple, false);
|
|
25
|
-
};
|
|
26
|
-
}, [btnRef.current, noRippleEffect]);
|
|
27
|
-
// Intercept click handler only for toggle button to update
|
|
28
|
-
// internal state and blur after click
|
|
29
|
-
const handleClick = () => {
|
|
30
|
-
const newIsToggled = !isToggled;
|
|
31
|
-
setIsToggled(newIsToggled);
|
|
32
|
-
btnRef.current && newIsToggled && btnRef.current.blur();
|
|
33
|
-
onClick(isToggled);
|
|
34
56
|
};
|
|
35
57
|
const buttonClassNames = classNames('btn', `btn-${bsStyle}`, variant === Button.VARIANT_LINK && 'btn-link', variant === Button.VARIANT_LINK_INLINE && 'btn-link btn-link-inline', variant === Button.VARIANT_OUTLINE && 'btn-outline', variant === Button.VARIANT_ACTION && 'btn-action', bsSize && `btn-${bsSize}`, asToggle && 'btn-toggle', isToggled && 'active', iconOnly && 'btn-icon-only', disabled && 'disabled', multiline && 'btn-multiline', block && 'btn-block', 'btn-component', className);
|
|
36
|
-
return (_jsx("button", Object.assign({ ref: btnRef, type: 'button' }, remainingProps, { className: buttonClassNames, onClick:
|
|
58
|
+
return (_jsx("button", Object.assign({ ref: btnRef, type: 'button' }, remainingProps, { className: buttonClassNames, onClick: handleClick }, { children: children })));
|
|
37
59
|
};
|
|
38
60
|
// Button styles
|
|
39
|
-
Button.DEFAULT =
|
|
40
|
-
Button.PRIMARY =
|
|
41
|
-
Button.SECONDARY =
|
|
42
|
-
Button.INFO =
|
|
43
|
-
Button.WARNING =
|
|
44
|
-
Button.DANGER =
|
|
45
|
-
Button.SUCCESS =
|
|
46
|
-
Button.MUTED =
|
|
61
|
+
Button.DEFAULT = STYLES_MAP.DEFAULT;
|
|
62
|
+
Button.PRIMARY = STYLES_MAP.PRIMARY;
|
|
63
|
+
Button.SECONDARY = STYLES_MAP.SECONDARY;
|
|
64
|
+
Button.INFO = STYLES_MAP.INFO;
|
|
65
|
+
Button.WARNING = STYLES_MAP.WARNING;
|
|
66
|
+
Button.DANGER = STYLES_MAP.DANGER;
|
|
67
|
+
Button.SUCCESS = STYLES_MAP.SUCCESS;
|
|
68
|
+
Button.MUTED = STYLES_MAP.MUTED;
|
|
47
69
|
// Button Type
|
|
48
|
-
Button.VARIANT_LINK =
|
|
49
|
-
Button.VARIANT_LINK_INLINE =
|
|
50
|
-
Button.VARIANT_OUTLINE =
|
|
51
|
-
Button.VARIANT_ACTION =
|
|
70
|
+
Button.VARIANT_LINK = VARIANTS_MAP.VARIANT_LINK;
|
|
71
|
+
Button.VARIANT_LINK_INLINE = VARIANTS_MAP.VARIANT_LINK_INLINE;
|
|
72
|
+
Button.VARIANT_OUTLINE = VARIANTS_MAP.VARIANT_OUTLINE;
|
|
73
|
+
Button.VARIANT_ACTION = VARIANTS_MAP.VARIANT_ACTION;
|
|
52
74
|
// Button Size
|
|
53
|
-
Button.XS =
|
|
54
|
-
Button.SM =
|
|
55
|
-
Button.MD =
|
|
56
|
-
Button.LG =
|
|
57
|
-
Button.defaultProps = {
|
|
58
|
-
active: false,
|
|
59
|
-
disabled: false,
|
|
60
|
-
asToggle: false,
|
|
61
|
-
iconOnly: false,
|
|
62
|
-
multiline: false,
|
|
63
|
-
block: false,
|
|
64
|
-
noRippleEffect: false,
|
|
65
|
-
onClick: () => { },
|
|
66
|
-
className: '',
|
|
67
|
-
bsStyle: 'default',
|
|
68
|
-
};
|
|
69
|
-
Button.propTypes = {
|
|
70
|
-
active: PropTypes.bool,
|
|
71
|
-
disabled: PropTypes.bool,
|
|
72
|
-
asToggle: PropTypes.bool,
|
|
73
|
-
iconOnly: PropTypes.bool,
|
|
74
|
-
multiline: PropTypes.bool,
|
|
75
|
-
block: PropTypes.bool,
|
|
76
|
-
onClick: PropTypes.func.isRequired,
|
|
77
|
-
bsStyle: PropTypes.oneOf([
|
|
78
|
-
Button.DEFAULT,
|
|
79
|
-
Button.PRIMARY,
|
|
80
|
-
Button.SECONDARY,
|
|
81
|
-
Button.INFO,
|
|
82
|
-
Button.WARNING,
|
|
83
|
-
Button.DANGER,
|
|
84
|
-
Button.SUCCESS,
|
|
85
|
-
Button.MUTED,
|
|
86
|
-
]),
|
|
87
|
-
bsSize: PropTypes.oneOf([Button.XS, Button.SM, Button.MD, Button.LG]),
|
|
88
|
-
variant: PropTypes.oneOf([
|
|
89
|
-
Button.VARIANT_LINK,
|
|
90
|
-
Button.VARIANT_LINK_INLINE,
|
|
91
|
-
Button.VARIANT_OUTLINE,
|
|
92
|
-
Button.VARIANT_ACTION,
|
|
93
|
-
]),
|
|
94
|
-
noRippleEffect: PropTypes.bool,
|
|
95
|
-
className: PropTypes.string,
|
|
96
|
-
};
|
|
75
|
+
Button.XS = SIZES_MAP.XS;
|
|
76
|
+
Button.SM = SIZES_MAP.SM;
|
|
77
|
+
Button.MD = SIZES_MAP.MD;
|
|
78
|
+
Button.LG = SIZES_MAP.LG;
|
|
97
79
|
export default Button;
|
|
@@ -1,30 +1,7 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ButtonProps } from './Button';
|
|
3
|
+
export type ToggleButtonProps = Omit<ButtonProps, 'asToggle' | 'onClick'> & {
|
|
4
|
+
onClick?: (value: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const ToggleButton: (props: PropsWithChildren<ToggleButtonProps>) => import("react/jsx-runtime").JSX.Element;
|
|
1
7
|
export default ToggleButton;
|
|
2
|
-
declare function ToggleButton(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare namespace ToggleButton {
|
|
4
|
-
const defaultProps: {
|
|
5
|
-
active: boolean;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
asToggle: boolean;
|
|
8
|
-
iconOnly: boolean;
|
|
9
|
-
multiline: boolean;
|
|
10
|
-
block: boolean;
|
|
11
|
-
noRippleEffect: boolean;
|
|
12
|
-
onClick: () => void;
|
|
13
|
-
className: string;
|
|
14
|
-
bsStyle: string;
|
|
15
|
-
};
|
|
16
|
-
const propTypes: {
|
|
17
|
-
active: import("prop-types").Requireable<boolean>;
|
|
18
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
19
|
-
asToggle: import("prop-types").Requireable<boolean>;
|
|
20
|
-
iconOnly: import("prop-types").Requireable<boolean>;
|
|
21
|
-
multiline: import("prop-types").Requireable<boolean>;
|
|
22
|
-
block: import("prop-types").Requireable<boolean>;
|
|
23
|
-
onClick: import("prop-types").Validator<(...args: any[]) => any>;
|
|
24
|
-
bsStyle: import("prop-types").Requireable<string>;
|
|
25
|
-
bsSize: import("prop-types").Requireable<string>;
|
|
26
|
-
variant: import("prop-types").Requireable<string>;
|
|
27
|
-
noRippleEffect: import("prop-types").Requireable<boolean>;
|
|
28
|
-
className: import("prop-types").Requireable<string>;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,7 +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 Button from './Button';
|
|
4
|
-
const ToggleButton = props => _jsx(Button, Object.assign({}, props, { asToggle: true }));
|
|
5
|
-
ToggleButton.defaultProps = Button.defaultProps;
|
|
6
|
-
ToggleButton.propTypes = Button.propTypes;
|
|
5
|
+
const ToggleButton = (props) => _jsx(Button, Object.assign({}, props, { asToggle: true }));
|
|
7
6
|
export default ToggleButton;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
export type DataTabProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether this tab is the one currently active.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
active?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Used to identify the tab.
|
|
11
|
+
*/
|
|
12
|
+
tabKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the transition effect should be disabled.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
disableTransition?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The content for the tab.
|
|
21
|
+
*/
|
|
22
|
+
title: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Additional classes to be set on the element.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
declare const DataTab: (props: PropsWithChildren<DataTabProps>) => import("react/jsx-runtime").JSX.Element | null;
|
|
1
29
|
export default DataTab;
|
|
2
|
-
declare function DataTab(props: any): any;
|
|
3
|
-
declare namespace DataTab {
|
|
4
|
-
namespace defaultProps {
|
|
5
|
-
const active: boolean;
|
|
6
|
-
const disableTransition: boolean;
|
|
7
|
-
const className: string;
|
|
8
|
-
}
|
|
9
|
-
namespace propTypes {
|
|
10
|
-
const disableTransition_1: PropTypes.Requireable<boolean>;
|
|
11
|
-
export { disableTransition_1 as disableTransition };
|
|
12
|
-
const className_1: PropTypes.Requireable<string>;
|
|
13
|
-
export { className_1 as className };
|
|
14
|
-
const active_1: PropTypes.Requireable<boolean>;
|
|
15
|
-
export { active_1 as active };
|
|
16
|
-
export const tabKey: PropTypes.Validator<string>;
|
|
17
|
-
export const children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
import PropTypes from "prop-types";
|
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { createElement as _createElement } from "react";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
import
|
|
4
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
|
+
import 'react';
|
|
6
6
|
import { motion } from 'framer-motion';
|
|
7
|
-
const DataTab = props => {
|
|
8
|
-
const { active, tabKey, disableTransition,
|
|
7
|
+
const DataTab = (props) => {
|
|
8
|
+
const { active = false, tabKey, disableTransition = false, className = '', children } = props, remainingProps = __rest(props, ["active", "tabKey", "disableTransition", "className", "children"]);
|
|
9
9
|
if (disableTransition) {
|
|
10
10
|
return _jsx("div", { children: active && children });
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
if (!active) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
_createElement(motion.div, Object.assign({}, remainingProps, { key: tabKey, initial: { x: 0, y: 0, opacity: 0 }, animate: { x: 0, y: 0, opacity: 1 }, exit: { x: 0, y: 0, opacity: 0 }, transition: { duration: 0.1 },
|
|
13
18
|
// TODO: added "fade in" for backwards compatibility for service tests
|
|
14
19
|
// To be removed for next major version
|
|
15
|
-
className: 'fade in' }), children))
|
|
16
|
-
};
|
|
17
|
-
DataTab.defaultProps = {
|
|
18
|
-
active: false,
|
|
19
|
-
disableTransition: false,
|
|
20
|
-
className: '',
|
|
21
|
-
};
|
|
22
|
-
DataTab.propTypes = {
|
|
23
|
-
// Props are injected from the wrapping DataTabs component
|
|
24
|
-
disableTransition: PropTypes.bool,
|
|
25
|
-
className: PropTypes.string,
|
|
26
|
-
active: PropTypes.bool,
|
|
27
|
-
tabKey: PropTypes.string.isRequired,
|
|
28
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
20
|
+
className: 'fade in' }), children));
|
|
29
21
|
};
|
|
30
22
|
export default DataTab;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DataTabHeaderProps = {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
tabKey: string;
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
onSelectTab?: (event: React.MouseEvent<HTMLLIElement>) => void;
|
|
7
|
+
isFirstTab?: boolean;
|
|
8
|
+
isLastTab?: boolean;
|
|
9
|
+
tabFirstChildClassName?: string;
|
|
10
|
+
tabLastChildClassName?: string;
|
|
11
|
+
tabClassName?: string;
|
|
12
|
+
tabHoverClassName?: string;
|
|
13
|
+
tabActiveClassName?: string;
|
|
14
|
+
arrowClassName?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const DataTabHeader: (props: DataTabHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default DataTabHeader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
const DataTabHeader = (props) => {
|
|
5
|
+
const { tabKey, title, isActive, isFirstTab, isLastTab, onSelectTab, tabFirstChildClassName, tabLastChildClassName, tabClassName, tabHoverClassName, tabActiveClassName, arrowClassName, className, } = props;
|
|
6
|
+
const [isHovering, setIsHovering] = useState(false);
|
|
7
|
+
const tabClassNames = classNames('DataTab', 'tab', isFirstTab && tabFirstChildClassName, isLastTab && tabLastChildClassName, !isHovering && !isActive && tabClassName, isHovering && !isActive && tabHoverClassName, isActive && `active ${tabActiveClassName}`, !isActive && 'cursor-pointer', className && className);
|
|
8
|
+
return (_jsxs("li", Object.assign({ className: tabClassNames, onClick: onSelectTab, "data-tabkey": tabKey, onMouseEnter: () => setIsHovering(true), onMouseLeave: () => setIsHovering(false) }, { children: [title, _jsx("div", { className: `arrow ${arrowClassName} ${isActive ? 'in' : ''}` })] }), tabKey));
|
|
9
|
+
};
|
|
10
|
+
export default DataTabHeader;
|