linear-react-components-ui 1.1.0-beta.3 → 1.1.0-beta.5
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/lib/assets/styles/dialog.scss +10 -4
- package/lib/assets/styles/drawers.scss +9 -6
- package/lib/assets/styles/tabs.scss +22 -17
- package/lib/dialog/base/Header.js +3 -1
- package/lib/dialog/base/index.js +9 -5
- package/lib/dialog/types.d.ts +1 -1
- package/lib/drawer/Header.js +3 -2
- package/lib/index.d.ts +1 -1
- package/lib/panel/Content.d.ts +1 -1
- package/lib/panel/DangerPanel.d.ts +1 -1
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Header.d.ts +1 -1
- package/lib/panel/InfoPanel.d.ts +1 -1
- package/lib/panel/PrimaryPanel.d.ts +1 -1
- package/lib/panel/SuccessPanel.d.ts +1 -1
- package/lib/panel/ToolBar.d.ts +1 -1
- package/lib/panel/WarningPanel.d.ts +1 -1
- package/lib/panel/helpers.d.ts +7 -2
- package/lib/panel/helpers.js +0 -13
- package/lib/panel/index.d.ts +1 -1
- package/lib/panel/types.d.ts +46 -5
- package/lib/tabs/DropdownTabs.d.ts +11 -0
- package/lib/tabs/DropdownTabs.js +75 -0
- package/lib/tabs/Menu.d.ts +1 -1
- package/lib/tabs/Menu.js +27 -15
- package/lib/tabs/{DropdownItems.d.ts → MenuTabs.d.ts} +3 -3
- package/lib/tabs/MenuTabs.js +90 -0
- package/lib/tabs/Panel.js +62 -39
- package/lib/tabs/context.d.ts +12 -0
- package/lib/tabs/context.js +161 -0
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +24 -198
- package/lib/tabs/tabHelpers.d.ts +4 -14
- package/lib/tabs/tabHelpers.js +30 -48
- package/lib/tabs/types.d.ts +45 -14
- package/lib/tabs/useTabs.d.ts +11 -0
- package/lib/tabs/useTabs.js +11 -0
- package/package.json +2 -1
- package/tsconfig.json +1 -0
- package/lib/tabs/DropdownItems.js +0 -64
- package/lib/tabs/MenuItems.d.ts +0 -11
- package/lib/tabs/MenuItems.js +0 -75
- package/lib/types-exUmt06D.d.ts +0 -50
|
@@ -66,11 +66,17 @@
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
.close-button {
|
|
69
|
-
color: #777;
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
font-size: 16px;
|
|
72
|
-
text-shadow: 0 1px 0 $default-color;
|
|
73
69
|
margin-left: auto;
|
|
70
|
+
line-height: 0;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
> svg {
|
|
73
|
+
fill: #252424;
|
|
74
|
+
pointer-events: fill;
|
|
75
|
+
transition: 0.2s fill;
|
|
76
|
+
&:hover {
|
|
77
|
+
fill: rgba(0, 0, 0, 0.164);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
.footer {
|
|
@@ -94,6 +94,8 @@
|
|
|
94
94
|
}
|
|
95
95
|
.right {
|
|
96
96
|
margin-left: 2px;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
97
99
|
&.modal-title {
|
|
98
100
|
color: #4e4c4c;
|
|
99
101
|
font-weight: 600;
|
|
@@ -101,12 +103,13 @@
|
|
|
101
103
|
}
|
|
102
104
|
.closebutton {
|
|
103
105
|
cursor: pointer;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
> svg {
|
|
107
|
+
fill: #252424;
|
|
108
|
+
pointer-events: fill;
|
|
109
|
+
transition: 0.2s fill;
|
|
110
|
+
&:hover {
|
|
111
|
+
fill: rgba(0, 0, 0, 0.164);
|
|
112
|
+
}
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
@import "colors.scss";
|
|
2
2
|
|
|
3
|
+
$dropdown-width: 38px;
|
|
4
|
+
|
|
3
5
|
%tab-closepanel {
|
|
4
6
|
background-color: transparent;
|
|
5
7
|
border: 0;
|
|
@@ -11,7 +13,6 @@
|
|
|
11
13
|
visibility: hidden;
|
|
12
14
|
transition: all 0.2s ease-in-out;
|
|
13
15
|
border-radius: 4px;
|
|
14
|
-
|
|
15
16
|
&:after {
|
|
16
17
|
content: "×";
|
|
17
18
|
font-size: 20px;
|
|
@@ -19,10 +20,8 @@
|
|
|
19
20
|
color: $font-color-soft;
|
|
20
21
|
transition: all 0.2s ease-in-out;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
23
|
&:hover {
|
|
24
24
|
background-color: $color-light-dark;
|
|
25
|
-
|
|
26
25
|
&:after {
|
|
27
26
|
color: $font-color-second;
|
|
28
27
|
}
|
|
@@ -30,20 +29,18 @@
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
%tab-component-menus {
|
|
32
|
+
-webkit-box-shadow: 0px -1px 0px $component-border-color inset;
|
|
33
|
+
-moz-box-shadow: 0px -1px 0px $component-border-color inset;
|
|
34
|
+
box-shadow: 0px -1px 0px $component-border-color inset;
|
|
33
35
|
.menu {
|
|
34
|
-
-webkit-box-shadow: 0px -1px 0px $component-border-color inset;
|
|
35
|
-
-moz-box-shadow: 0px -1px 0px $component-border-color inset;
|
|
36
|
-
box-shadow: 0px -1px 0px $component-border-color inset;
|
|
37
36
|
display: flex;
|
|
38
|
-
flex-wrap: nowrap;
|
|
39
|
-
justify-content: center;
|
|
40
37
|
flex: 1;
|
|
38
|
+
overflow: hidden;
|
|
41
39
|
|
|
42
40
|
&.-firsttabident>.menuitem:first-child {
|
|
43
41
|
margin-left: 15px;
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
|
|
47
44
|
.menu>.menuitem {
|
|
48
45
|
border-bottom: 0;
|
|
49
46
|
border-radius: 5px 5px 0px 0px;
|
|
@@ -55,10 +52,10 @@
|
|
|
55
52
|
margin-right: 1px;
|
|
56
53
|
padding: 0;
|
|
57
54
|
width: auto;
|
|
55
|
+
min-width: 100px;
|
|
58
56
|
display: flex;
|
|
59
57
|
justify-content: space-between;
|
|
60
58
|
align-items: center;
|
|
61
|
-
|
|
62
59
|
&.selected {
|
|
63
60
|
border: 1px solid $component-border-color;
|
|
64
61
|
background: $font-color-second;
|
|
@@ -66,9 +63,7 @@
|
|
|
66
63
|
border-top: 2px solid $component-selected-color;
|
|
67
64
|
box-shadow: 0;
|
|
68
65
|
font-weight: bold;
|
|
69
|
-
/* z-index: 2; */
|
|
70
66
|
}
|
|
71
|
-
|
|
72
67
|
&.selected>.closepanel,
|
|
73
68
|
&:hover>.closepanel {
|
|
74
69
|
visibility: visible;
|
|
@@ -103,18 +98,28 @@
|
|
|
103
98
|
height: 100%;
|
|
104
99
|
overflow: auto;
|
|
105
100
|
@extend %tab-component-menus;
|
|
106
|
-
|
|
107
101
|
>.menucontainer {
|
|
108
|
-
display: flex;
|
|
109
|
-
flex-wrap: nowrap;
|
|
110
102
|
width: 100%;
|
|
103
|
+
display: flex;
|
|
111
104
|
min-height: 35px;
|
|
112
105
|
overflow: hidden;
|
|
113
106
|
@extend %tab-component-menus;
|
|
114
|
-
|
|
115
107
|
>.dropdownbutton {
|
|
116
108
|
border-bottom: 1px solid $component-border-color;
|
|
117
|
-
padding: 0
|
|
109
|
+
padding: 0;
|
|
110
|
+
width: $dropdown-width;
|
|
111
|
+
visibility: hidden;
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
opacity: 0;
|
|
114
|
+
&.show {
|
|
115
|
+
visibility: visible;
|
|
116
|
+
pointer-events: all;
|
|
117
|
+
opacity: 1;
|
|
118
|
+
}
|
|
119
|
+
> svg {
|
|
120
|
+
margin: 0;
|
|
121
|
+
float: none;
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -18,7 +18,9 @@ var getCloseButton = function getCloseButton(handleClose) {
|
|
|
18
18
|
onClick: handleClose,
|
|
19
19
|
role: "button",
|
|
20
20
|
tabIndex: 0
|
|
21
|
-
}, "
|
|
21
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons["default"], {
|
|
22
|
+
name: "cancel2"
|
|
23
|
+
}));
|
|
22
24
|
};
|
|
23
25
|
var getIcon = function getIcon(titleIcon, icon) {
|
|
24
26
|
if (icon) {
|
package/lib/dialog/base/index.js
CHANGED
|
@@ -32,7 +32,8 @@ var BaseDialog = function BaseDialog(props) {
|
|
|
32
32
|
openProp = props.open,
|
|
33
33
|
onOpenChange = props.onOpenChange,
|
|
34
34
|
_props$zIndex = props.zIndex,
|
|
35
|
-
zIndex = _props$zIndex === void 0 ? 0 : _props$zIndex
|
|
35
|
+
zIndex = _props$zIndex === void 0 ? 0 : _props$zIndex,
|
|
36
|
+
handlerClose = props.handlerClose;
|
|
36
37
|
var _useContext = (0, _react.useContext)(_form.FormDialogContext),
|
|
37
38
|
headerRef = _useContext.headerRef;
|
|
38
39
|
var wrapperEl = (0, _react.useRef)(null);
|
|
@@ -52,6 +53,7 @@ var BaseDialog = function BaseDialog(props) {
|
|
|
52
53
|
if (openProp !== undefined && onOpenChange) {
|
|
53
54
|
onOpenChange(false);
|
|
54
55
|
} else {
|
|
56
|
+
if (handlerClose) handlerClose();
|
|
55
57
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
56
58
|
setOpen(false);
|
|
57
59
|
}
|
|
@@ -134,15 +136,17 @@ var BaseDialog = function BaseDialog(props) {
|
|
|
134
136
|
};
|
|
135
137
|
}, [open, closeOnEsc]);
|
|
136
138
|
(0, _react.useEffect)(function () {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
if (open) {
|
|
140
|
+
document.addEventListener('mousedown', onMouseDown);
|
|
141
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
142
|
+
if (isDragging) document.addEventListener('mousemove', onMouseMove);
|
|
143
|
+
}
|
|
140
144
|
return function () {
|
|
141
145
|
document.removeEventListener('mousedown', onMouseDown);
|
|
142
146
|
document.removeEventListener('mouseup', onMouseUp);
|
|
143
147
|
document.removeEventListener('mousemove', onMouseMove);
|
|
144
148
|
};
|
|
145
|
-
}, [isDragging]);
|
|
149
|
+
}, [isDragging, open]);
|
|
146
150
|
if (!open) return null;
|
|
147
151
|
return /*#__PURE__*/_react["default"].createElement(DialogContext.Provider, {
|
|
148
152
|
value: {
|
package/lib/dialog/types.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ interface IBaseProps {
|
|
|
29
29
|
zIndex?: number | string;
|
|
30
30
|
open?: boolean;
|
|
31
31
|
onOpenChange?: (open: boolean) => void;
|
|
32
|
+
handlerClose?: () => void;
|
|
32
33
|
}
|
|
33
34
|
interface IFormProps extends Omit<IBaseProps, 'textAlign' | 'zIndex' | 'wrapperClassName'> {
|
|
34
35
|
buttons?: JSX.Element[];
|
|
@@ -38,7 +39,6 @@ interface IFormProps extends Omit<IBaseProps, 'textAlign' | 'zIndex' | 'wrapperC
|
|
|
38
39
|
isWaiting?: boolean;
|
|
39
40
|
icon?: JSX.Element;
|
|
40
41
|
content?: ReactNode;
|
|
41
|
-
handlerClose?: () => void;
|
|
42
42
|
}
|
|
43
43
|
interface ICommonDialogProps {
|
|
44
44
|
onConfirmClick?: () => void;
|
package/lib/drawer/Header.js
CHANGED
|
@@ -16,10 +16,11 @@ var getCloseButton = function getCloseButton(handlerClose) {
|
|
|
16
16
|
"data-testid": "header-closebutton",
|
|
17
17
|
className: "closebutton",
|
|
18
18
|
onClick: handlerClose,
|
|
19
|
-
onKeyPress: undefined,
|
|
20
19
|
role: "button",
|
|
21
20
|
tabIndex: 0
|
|
22
|
-
}, "
|
|
21
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons["default"], {
|
|
22
|
+
name: "cancel2"
|
|
23
|
+
}));
|
|
23
24
|
};
|
|
24
25
|
var getIcon = function getIcon(titleIcon, icon) {
|
|
25
26
|
if (titleIcon || icon) {
|
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { default as List } from './list/index.js';
|
|
|
7
7
|
export { default as Radio } from './radio/index.js';
|
|
8
8
|
export { default as Tab } from './tabs/index.js';
|
|
9
9
|
export { default as Dialog } from './dialog/base/index.js';
|
|
10
|
-
import './types
|
|
10
|
+
import './panel/types.js';
|
|
11
11
|
import 'react';
|
|
12
12
|
import './@types/PermissionAttr.js';
|
|
13
13
|
import './internals/colorStyles.js';
|
package/lib/panel/Content.d.ts
CHANGED
package/lib/panel/Default.d.ts
CHANGED
package/lib/panel/Header.d.ts
CHANGED
package/lib/panel/InfoPanel.d.ts
CHANGED
package/lib/panel/ToolBar.d.ts
CHANGED
package/lib/panel/helpers.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ContextProps } from './types.js';
|
|
3
3
|
import '../@types/PermissionAttr.js';
|
|
4
4
|
import '../internals/colorStyles.js';
|
|
5
5
|
import '../@types/Icon.js';
|
|
6
6
|
import '../icons/helper.js';
|
|
7
|
+
|
|
8
|
+
declare function getCurrentThreshold(scrollableElement: HTMLDivElement, scrollThreshold: number): number;
|
|
9
|
+
declare const PanelContext: React__default.Context<ContextProps>;
|
|
10
|
+
|
|
11
|
+
export { PanelContext as default, getCurrentThreshold };
|
package/lib/panel/helpers.js
CHANGED
|
@@ -5,21 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
exports.getCurrentThreshold = getCurrentThreshold;
|
|
8
|
-
exports.numberAroundZeroAndOne = numberAroundZeroAndOne;
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
function numberAroundZeroAndOne(_ref) {
|
|
12
|
-
var props = _ref.props,
|
|
13
|
-
propName = _ref.propName,
|
|
14
|
-
componentName = _ref.componentName;
|
|
15
|
-
if (props[propName]) {
|
|
16
|
-
var value = props[propName];
|
|
17
|
-
if (typeof value === 'number') {
|
|
18
|
-
return value >= 0 && value <= 1 ? value : new Error("invalid value of ".concat(propName, " in ").concat(componentName, " component, is not between 0 and 1"));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
10
|
function getCurrentThreshold(scrollableElement, scrollThreshold) {
|
|
24
11
|
var MIN_THRESHOLD = 0;
|
|
25
12
|
var MAX_THRESHOLD = 1;
|
package/lib/panel/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { default as SuccessPanel } from './SuccessPanel.js';
|
|
|
6
6
|
export { default as InfoPanel } from './InfoPanel.js';
|
|
7
7
|
export { default as PanelHeader } from './Header.js';
|
|
8
8
|
export { default as PanelContent } from './Content.js';
|
|
9
|
-
import '
|
|
9
|
+
import './types.js';
|
|
10
10
|
import 'react';
|
|
11
11
|
import '../@types/PermissionAttr.js';
|
|
12
12
|
import '../internals/colorStyles.js';
|
package/lib/panel/types.d.ts
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import '../@types/Icon.js';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode, ReactElement } from 'react';
|
|
2
|
+
import { PermissionAttr } from '../@types/PermissionAttr.js';
|
|
3
|
+
import ColorStyles from '../internals/colorStyles.js';
|
|
4
|
+
import { IconNames } from '../@types/Icon.js';
|
|
6
5
|
import '../icons/helper.js';
|
|
6
|
+
|
|
7
|
+
type Func = () => void;
|
|
8
|
+
type AsyncFunc = () => Promise<void>;
|
|
9
|
+
interface IPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'> {
|
|
10
|
+
customClass?: string;
|
|
11
|
+
startOpened?: boolean;
|
|
12
|
+
toggleable?: boolean;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
colorStyle?: typeof ColorStyles | string;
|
|
15
|
+
gridCols?: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
onEndReached?: Func | AsyncFunc;
|
|
18
|
+
onEndReachedThreshold?: number;
|
|
19
|
+
permissionAttr?: PermissionAttr | PermissionAttr[];
|
|
20
|
+
}
|
|
21
|
+
interface IPanelContentProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'> {
|
|
22
|
+
customClass?: string;
|
|
23
|
+
}
|
|
24
|
+
interface IPanelHeaderProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'> {
|
|
25
|
+
title?: string;
|
|
26
|
+
icon?: ReactElement;
|
|
27
|
+
titleIcon?: IconNames;
|
|
28
|
+
customClass?: string;
|
|
29
|
+
styleForTitle?: object;
|
|
30
|
+
customClassForTitle?: string;
|
|
31
|
+
headerColored?: boolean;
|
|
32
|
+
}
|
|
33
|
+
type ContextProps = {
|
|
34
|
+
toggleable: boolean;
|
|
35
|
+
handlerToggleable: () => void;
|
|
36
|
+
opened: boolean;
|
|
37
|
+
hideContent: boolean;
|
|
38
|
+
onEndReached?: Func | AsyncFunc;
|
|
39
|
+
onEndReachedThreshold: number;
|
|
40
|
+
};
|
|
41
|
+
interface IParameterFunction {
|
|
42
|
+
props: any;
|
|
43
|
+
propName: string | number;
|
|
44
|
+
componentName: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type { AsyncFunc, ContextProps, Func, IPanelContentProps, IPanelHeaderProps, IPanelProps, IParameterFunction };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DropdownProps } from './types.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../@types/Size.js';
|
|
4
|
+
import '../@types/Position.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../@types/Icon.js';
|
|
7
|
+
import '../icons/helper.js';
|
|
8
|
+
|
|
9
|
+
declare const DropdownTabs: ({ tabs, tabMenuSize, }: DropdownProps) => JSX.Element | null;
|
|
10
|
+
|
|
11
|
+
export { DropdownTabs as default };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _buttons = _interopRequireDefault(require("../buttons"));
|
|
10
|
+
var _list = _interopRequireWildcard(require("../list"));
|
|
11
|
+
var _useTabs2 = require("./useTabs");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
var DropdownTab = function DropdownTab(_ref) {
|
|
17
|
+
var id = _ref.id,
|
|
18
|
+
title = _ref.title,
|
|
19
|
+
closeable = _ref.closeable,
|
|
20
|
+
iconAlign = _ref.iconAlign,
|
|
21
|
+
icon = _ref.icon,
|
|
22
|
+
iconName = _ref.iconName,
|
|
23
|
+
disabled = _ref.disabled,
|
|
24
|
+
tabMenuSize = _ref.tabMenuSize;
|
|
25
|
+
var _useTabs = (0, _useTabs2.useTabs)(),
|
|
26
|
+
selectTab = _useTabs.selectTab,
|
|
27
|
+
removeTab = _useTabs.removeTab;
|
|
28
|
+
return /*#__PURE__*/_react["default"].createElement(_list.ListItem, {
|
|
29
|
+
key: id
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
31
|
+
className: "menuitem"
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_buttons["default"], {
|
|
33
|
+
className: "btn menubutton",
|
|
34
|
+
boxShadow: false,
|
|
35
|
+
onClick: function onClick() {
|
|
36
|
+
return selectTab(id);
|
|
37
|
+
},
|
|
38
|
+
iconAlign: iconAlign,
|
|
39
|
+
iconName: iconName,
|
|
40
|
+
icon: icon,
|
|
41
|
+
disabled: disabled,
|
|
42
|
+
label: title,
|
|
43
|
+
size: tabMenuSize,
|
|
44
|
+
transparent: true
|
|
45
|
+
}), closeable && /*#__PURE__*/_react["default"].createElement("button", {
|
|
46
|
+
className: "closepanel",
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
return removeTab(id);
|
|
49
|
+
}
|
|
50
|
+
})));
|
|
51
|
+
};
|
|
52
|
+
var DropdownTabs = function DropdownTabs(_ref2) {
|
|
53
|
+
var _ref2$tabs = _ref2.tabs,
|
|
54
|
+
tabs = _ref2$tabs === void 0 ? [] : _ref2$tabs,
|
|
55
|
+
_ref2$tabMenuSize = _ref2.tabMenuSize,
|
|
56
|
+
tabMenuSize = _ref2$tabMenuSize === void 0 ? 'medium' : _ref2$tabMenuSize;
|
|
57
|
+
var hasTabs = tabs.length > 0;
|
|
58
|
+
if (tabs.length === 0) return null;
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement(_buttons["default"], {
|
|
60
|
+
dropdown: true,
|
|
61
|
+
dropdownAlign: "right",
|
|
62
|
+
transparent: true,
|
|
63
|
+
boxShadow: false,
|
|
64
|
+
size: "large",
|
|
65
|
+
customClass: "dropdownbutton ".concat(hasTabs ? 'show' : '')
|
|
66
|
+
}, /*#__PURE__*/_react["default"].createElement(_list["default"], {
|
|
67
|
+
customClass: "dropdown-hide-tabs"
|
|
68
|
+
}, tabs.map(function (tab) {
|
|
69
|
+
return /*#__PURE__*/_react["default"].createElement(DropdownTab, _extends({
|
|
70
|
+
key: tab.id,
|
|
71
|
+
tabMenuSize: tabMenuSize
|
|
72
|
+
}, tab));
|
|
73
|
+
})));
|
|
74
|
+
};
|
|
75
|
+
var _default = exports["default"] = DropdownTabs;
|
package/lib/tabs/Menu.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ import '../@types/PermissionAttr.js';
|
|
|
6
6
|
import '../@types/Icon.js';
|
|
7
7
|
import '../icons/helper.js';
|
|
8
8
|
|
|
9
|
-
declare const Menu: ({
|
|
9
|
+
declare const Menu: ({ toolbar, customClassForToolBar, tabWidth, ...props }: MenuProps) => JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { Menu as default };
|
package/lib/tabs/Menu.js
CHANGED
|
@@ -5,29 +5,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
8
|
+
var _MenuTabs = _interopRequireDefault(require("./MenuTabs"));
|
|
9
|
+
var _DropdownTabs = _interopRequireDefault(require("./DropdownTabs"));
|
|
10
|
+
var _useTabs2 = require("./useTabs");
|
|
11
|
+
var _excluded = ["toolbar", "customClassForToolBar", "tabWidth"];
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
13
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
15
|
var Menu = function Menu(_ref) {
|
|
15
|
-
var
|
|
16
|
-
toolbar = _ref.toolbar,
|
|
17
|
-
toolBarRef = _ref.toolBarRef,
|
|
16
|
+
var toolbar = _ref.toolbar,
|
|
18
17
|
_ref$customClassForTo = _ref.customClassForToolBar,
|
|
19
18
|
customClassForToolBar = _ref$customClassForTo === void 0 ? '' : _ref$customClassForTo,
|
|
19
|
+
_ref$tabWidth = _ref.tabWidth,
|
|
20
|
+
tabWidth = _ref$tabWidth === void 0 ? 'auto' : _ref$tabWidth,
|
|
20
21
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _useTabs = (0, _useTabs2.useTabs)(),
|
|
23
|
+
menuTabs = _useTabs.menuTabs,
|
|
24
|
+
menuRef = _useTabs.menuRef,
|
|
25
|
+
dropdownTabs = _useTabs.dropdownTabs;
|
|
21
26
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
22
|
-
className: "menucontainer"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
className: "menucontainer"
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuTabs["default"], {
|
|
29
|
+
tabs: menuTabs,
|
|
30
|
+
tabWidth: tabWidth,
|
|
31
|
+
tabMenuSize: props.tabMenuSize,
|
|
32
|
+
tabMenuAlign: props.tabMenuAlign,
|
|
33
|
+
firstTabIdent: props.firstTabIdent,
|
|
34
|
+
ref: menuRef
|
|
35
|
+
}), /*#__PURE__*/_react["default"].createElement(_DropdownTabs["default"], {
|
|
36
|
+
tabs: dropdownTabs,
|
|
37
|
+
tabWidth: tabWidth,
|
|
38
|
+
tabMenuSize: props.tabMenuSize,
|
|
39
|
+
tabMenuAlign: props.tabMenuAlign,
|
|
40
|
+
firstTabIdent: props.firstTabIdent
|
|
41
|
+
}), toolbar && /*#__PURE__*/_react["default"].cloneElement(toolbar, {
|
|
42
|
+
customClass: "menubar ".concat(customClassForToolBar)
|
|
31
43
|
}));
|
|
32
44
|
};
|
|
33
45
|
var _default = exports["default"] = Menu;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
1
2
|
import { MenuProps } from './types.js';
|
|
2
|
-
import 'react';
|
|
3
3
|
import '../@types/Size.js';
|
|
4
4
|
import '../@types/Position.js';
|
|
5
5
|
import '../@types/PermissionAttr.js';
|
|
6
6
|
import '../@types/Icon.js';
|
|
7
7
|
import '../icons/helper.js';
|
|
8
8
|
|
|
9
|
-
declare const
|
|
9
|
+
declare const MenuTabs: React__default.ForwardRefExoticComponent<MenuProps & React__default.RefAttributes<HTMLUListElement>>;
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { MenuTabs as default };
|