@decisiv/ui-components 2.0.1-alpha.219 → 2.0.1-alpha.221
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/components/Badge/styles.js +2 -1
- package/lib/components/Badge/types.d.ts +1 -0
- package/lib/components/Badge/types.d.ts.map +1 -1
- package/lib/components/Badge/types.js +2 -1
- package/lib/components/Drawer/index.d.ts +1 -1
- package/lib/components/Drawer/index.d.ts.map +1 -1
- package/lib/components/Drawer/index.js +13 -6
- package/lib/components/Drawer/index.test.js +37 -12
- package/lib/components/LeftNav/Item/NavExpandedItem/index.js +7 -2
- package/lib/components/LeftNav/index.test.js +35 -19
- package/lib/components/LeftNav/schema.d.ts.map +1 -1
- package/lib/components/LeftNav/schema.js +3 -1
- package/lib/components/LeftNav/types.d.ts +1 -0
- package/lib/components/LeftNav/types.d.ts.map +1 -1
- package/lib/components/Link/DisabledLink.d.ts +1 -1
- package/lib/providers/ConfigProvider/utils/linkRenderer.d.ts +2 -1
- package/lib/providers/ConfigProvider/utils/linkRenderer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -38,7 +38,8 @@ var PALETTE_MAPPER = {
|
|
|
38
38
|
var colorModifiers = function colorModifiers(props) {
|
|
39
39
|
var _props$palette = props.palette,
|
|
40
40
|
palette = _props$palette === void 0 ? 'bright' : _props$palette,
|
|
41
|
-
color = props.color
|
|
41
|
+
_props$color = props.color,
|
|
42
|
+
color = _props$color === void 0 ? 'information' : _props$color;
|
|
42
43
|
|
|
43
44
|
if (color && color in _commonUIColors.commonUIColors) {
|
|
44
45
|
var baseColor = _commonUIColors.commonUIThreeShadeColors[color];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,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,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B;AAED,iBAAS,gBAAgB,CACvB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,SAAS,EACnB,aAAa,EAAE,OAAO,GACrB,KAAK,GAAG,IAAI,CAqBd;AAED,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;CAIxB,CAAC"}
|
|
@@ -14,7 +14,7 @@ export interface DrawerProps extends HeaderProps, FooterProps {
|
|
|
14
14
|
side?: 'left' | 'right';
|
|
15
15
|
zIndex?: number;
|
|
16
16
|
visible?: boolean;
|
|
17
|
-
onClose?: (event: MouseEvent | KeyboardEvent) => void;
|
|
17
|
+
onClose?: (event: React.MouseEvent<HTMLDivElement, MouseEvent> | KeyboardEvent) => void;
|
|
18
18
|
}
|
|
19
19
|
export declare type OverlayProps = Pick<DrawerProps, 'zIndex' | 'side' | 'visible'>;
|
|
20
20
|
declare const Drawer: React.FC<DrawerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAkBhD,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,MAAO,SAAQ,WAAW;IAClC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW,EAAE,WAAW;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG,aAAa,KAChE,IAAI,CAAC;CACX;AAED,oBAAY,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAM5E,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAuHjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -25,12 +25,14 @@ var _styles = require("./styles");
|
|
|
25
25
|
|
|
26
26
|
var _useTranslations = _interopRequireDefault(require("../../utils/useTranslations"));
|
|
27
27
|
|
|
28
|
-
var _useClickOutside = _interopRequireDefault(require("../../utils/useClickOutside"));
|
|
29
|
-
|
|
30
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
29
|
|
|
32
30
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
33
31
|
|
|
32
|
+
var stopPropagation = function stopPropagation(e) {
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
};
|
|
35
|
+
|
|
34
36
|
var Drawer = function Drawer(_ref) {
|
|
35
37
|
var title = _ref.title,
|
|
36
38
|
description = _ref.description,
|
|
@@ -59,8 +61,7 @@ var Drawer = function Drawer(_ref) {
|
|
|
59
61
|
if (onClose && visible) {
|
|
60
62
|
onClose(event);
|
|
61
63
|
}
|
|
62
|
-
}, [onClose, visible]);
|
|
63
|
-
(0, _useClickOutside.default)([contentRef], handleOnClickOutside); // Allow closing the modal by pressing the Escape key
|
|
64
|
+
}, [onClose, visible]); // Allow closing the modal by pressing the Escape key
|
|
64
65
|
|
|
65
66
|
(0, _react.useEffect)(function () {
|
|
66
67
|
if (visible && _canUseDOM.default) {
|
|
@@ -81,12 +82,18 @@ var Drawer = function Drawer(_ref) {
|
|
|
81
82
|
zIndex: zIndex,
|
|
82
83
|
side: side,
|
|
83
84
|
visible: visible,
|
|
84
|
-
"data-testid": "overlay"
|
|
85
|
+
"data-testid": "overlay",
|
|
86
|
+
onClick: handleOnClickOutside,
|
|
87
|
+
role: "presentation",
|
|
88
|
+
tabIndex: -1
|
|
85
89
|
}, _react.default.createElement(_styles.Content, {
|
|
86
90
|
ref: contentRef,
|
|
87
91
|
side: side,
|
|
88
92
|
visible: visible,
|
|
89
|
-
"data-testid": "content"
|
|
93
|
+
"data-testid": "content",
|
|
94
|
+
onClick: stopPropagation,
|
|
95
|
+
"aria-modal": "true",
|
|
96
|
+
role: "dialog"
|
|
90
97
|
}, showHeader && _react.default.createElement(_styles.Header, {
|
|
91
98
|
"data-testid": "drawer-header"
|
|
92
99
|
}, _react.default.createElement(_Flex.default, null, title && _react.default.createElement(_styles.Title, null, title), onClose && _react.default.createElement(_Tooltip.default, {
|
|
@@ -10,6 +10,8 @@ var _ConfigProvider = require("../../providers/ConfigProvider");
|
|
|
10
10
|
|
|
11
11
|
var _ = _interopRequireDefault(require("."));
|
|
12
12
|
|
|
13
|
+
var _Combobox = _interopRequireDefault(require("../Combobox"));
|
|
14
|
+
|
|
13
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
16
|
|
|
15
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
|
@@ -39,16 +41,39 @@ describe('Drawer', function () {
|
|
|
39
41
|
expect(getByTestId(/overlay/i)).toHaveStyleRule('display', 'none');
|
|
40
42
|
});
|
|
41
43
|
});
|
|
44
|
+
it('does not close when clicking on another Portal based component', function () {
|
|
45
|
+
var onClose = jest.fn();
|
|
46
|
+
|
|
47
|
+
var _render2 = render(_react.default.createElement(_.default, {
|
|
48
|
+
visible: true,
|
|
49
|
+
onClose: onClose
|
|
50
|
+
}, _react.default.createElement(_Combobox.default, {
|
|
51
|
+
label: "My Combobox",
|
|
52
|
+
options: [{
|
|
53
|
+
id: '1',
|
|
54
|
+
label: 'My Option',
|
|
55
|
+
value: '1'
|
|
56
|
+
}]
|
|
57
|
+
}))),
|
|
58
|
+
getByLabelText = _render2.getByLabelText,
|
|
59
|
+
getByText = _render2.getByText;
|
|
60
|
+
|
|
61
|
+
_react2.fireEvent.click(getByLabelText('My Combobox'));
|
|
62
|
+
|
|
63
|
+
_react2.fireEvent.click(getByText('My Option'));
|
|
64
|
+
|
|
65
|
+
expect(onClose).not.toHaveBeenCalled();
|
|
66
|
+
});
|
|
42
67
|
});
|
|
43
68
|
describe('title', function () {
|
|
44
69
|
it('renders the text passed as "title" in an h3 tag', function () {
|
|
45
70
|
var title = 'This is the title';
|
|
46
71
|
|
|
47
|
-
var
|
|
72
|
+
var _render3 = render(_react.default.createElement(_.default, {
|
|
48
73
|
visible: true,
|
|
49
74
|
title: title
|
|
50
75
|
})),
|
|
51
|
-
getByText =
|
|
76
|
+
getByText = _render3.getByText;
|
|
52
77
|
|
|
53
78
|
expect(getByText(title, {
|
|
54
79
|
selector: 'h3'
|
|
@@ -58,30 +83,30 @@ describe('Drawer', function () {
|
|
|
58
83
|
describe('onClose', function () {
|
|
59
84
|
var onClose = jest.fn();
|
|
60
85
|
it('renders a close button if "onClose" is passed', function () {
|
|
61
|
-
var
|
|
86
|
+
var _render4 = render(_react.default.createElement(_.default, {
|
|
62
87
|
visible: true,
|
|
63
88
|
onClose: onClose
|
|
64
89
|
})),
|
|
65
|
-
getByLabelText =
|
|
90
|
+
getByLabelText = _render4.getByLabelText;
|
|
66
91
|
|
|
67
92
|
var closeBtn = getByLabelText(/close drawer/i);
|
|
68
93
|
expect(closeBtn).toBeInTheDocument();
|
|
69
94
|
});
|
|
70
95
|
it('does not render a close button if "onClose" is not passed', function () {
|
|
71
|
-
var
|
|
96
|
+
var _render5 = render(_react.default.createElement(_.default, {
|
|
72
97
|
visible: true
|
|
73
98
|
})),
|
|
74
|
-
queryByLabelText =
|
|
99
|
+
queryByLabelText = _render5.queryByLabelText;
|
|
75
100
|
|
|
76
101
|
var closeBtn = queryByLabelText(/close drawer/i);
|
|
77
102
|
expect(closeBtn).not.toBeInTheDocument();
|
|
78
103
|
});
|
|
79
104
|
it('calls the "onClose" function when clicking the close button', function () {
|
|
80
|
-
var
|
|
105
|
+
var _render6 = render(_react.default.createElement(_.default, {
|
|
81
106
|
visible: true,
|
|
82
107
|
onClose: onClose
|
|
83
108
|
})),
|
|
84
|
-
getByLabelText =
|
|
109
|
+
getByLabelText = _render6.getByLabelText;
|
|
85
110
|
|
|
86
111
|
var closeBtn = getByLabelText(/close drawer/i);
|
|
87
112
|
|
|
@@ -104,11 +129,11 @@ describe('Drawer', function () {
|
|
|
104
129
|
onClick: onCancel
|
|
105
130
|
}];
|
|
106
131
|
it('renders the array as buttons in the footer of the Drawer', function () {
|
|
107
|
-
var
|
|
132
|
+
var _render7 = render(_react.default.createElement(_.default, {
|
|
108
133
|
visible: true,
|
|
109
134
|
actions: actions
|
|
110
135
|
})),
|
|
111
|
-
getByText =
|
|
136
|
+
getByText = _render7.getByText;
|
|
112
137
|
|
|
113
138
|
expect(getByText(/submit/i, {
|
|
114
139
|
selector: 'button'
|
|
@@ -123,11 +148,11 @@ describe('Drawer', function () {
|
|
|
123
148
|
it('calls the "onClose" function when clicking outside the Drawer', function () {
|
|
124
149
|
var onClose = jest.fn();
|
|
125
150
|
|
|
126
|
-
var
|
|
151
|
+
var _render8 = render(_react.default.createElement(_.default, {
|
|
127
152
|
visible: true,
|
|
128
153
|
onClose: onClose
|
|
129
154
|
})),
|
|
130
|
-
getByTestId =
|
|
155
|
+
getByTestId = _render8.getByTestId;
|
|
131
156
|
|
|
132
157
|
var overlay = getByTestId(/overlay/i);
|
|
133
158
|
|
|
@@ -37,6 +37,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
37
37
|
|
|
38
38
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
39
39
|
|
|
40
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
41
|
+
|
|
40
42
|
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; }
|
|
41
43
|
|
|
42
44
|
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; }
|
|
@@ -52,7 +54,8 @@ function MenuItem(props) {
|
|
|
52
54
|
toggleExpanded = _useMenuItem.toggleExpanded;
|
|
53
55
|
|
|
54
56
|
var disabled = item.disabled,
|
|
55
|
-
text = item.text
|
|
57
|
+
text = item.text,
|
|
58
|
+
target = item.target;
|
|
56
59
|
|
|
57
60
|
var _useConfig = (0, _ConfigProvider.useConfig)(),
|
|
58
61
|
LinkComponent = _useConfig.linkRenderer;
|
|
@@ -63,7 +66,9 @@ function MenuItem(props) {
|
|
|
63
66
|
_ = _ref.navVariant,
|
|
64
67
|
linkProps = _objectWithoutProperties(_ref, ["active", "navVariant"]);
|
|
65
68
|
|
|
66
|
-
return _react.default.createElement(LinkComponent,
|
|
69
|
+
return _react.default.createElement(LinkComponent, _extends({
|
|
70
|
+
target: target
|
|
71
|
+
}, linkProps));
|
|
67
72
|
}).withConfig({
|
|
68
73
|
displayName: "NavExpandedItem",
|
|
69
74
|
componentId: "ep2orz-0"
|
|
@@ -96,13 +96,29 @@ describe('LeftNav', function () {
|
|
|
96
96
|
|
|
97
97
|
expect(container).toMatchSnapshot();
|
|
98
98
|
});
|
|
99
|
+
it('has the expected target attribute', function () {
|
|
100
|
+
var props = _objectSpread({}, defaultProps, {
|
|
101
|
+
items: [{
|
|
102
|
+
icon: _iconix.default.Home,
|
|
103
|
+
text: 'Home',
|
|
104
|
+
path: '/',
|
|
105
|
+
target: '_blank'
|
|
106
|
+
}]
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
var _render2 = render(_react2.default.createElement(_.default, props)),
|
|
110
|
+
getByText = _render2.getByText;
|
|
111
|
+
|
|
112
|
+
var anchor = getByText('Home').closest('a');
|
|
113
|
+
expect(anchor).toHaveAttribute('target', '_blank');
|
|
114
|
+
});
|
|
99
115
|
describe('opening a sub menu', function () {
|
|
100
116
|
describe('where the top menu item has NO link', function () {
|
|
101
117
|
test('clicking the label toggles the sub menu', function () {
|
|
102
|
-
var
|
|
103
|
-
container =
|
|
104
|
-
getByText =
|
|
105
|
-
queryByText =
|
|
118
|
+
var _render3 = render(_react2.default.createElement(_.default, defaultProps)),
|
|
119
|
+
container = _render3.container,
|
|
120
|
+
getByText = _render3.getByText,
|
|
121
|
+
queryByText = _render3.queryByText;
|
|
106
122
|
|
|
107
123
|
var nonLinkWithSubItems = items[2];
|
|
108
124
|
expect(queryByText(nonLinkWithSubItems.items[0].text)).toBe(null);
|
|
@@ -115,9 +131,9 @@ describe('LeftNav', function () {
|
|
|
115
131
|
});
|
|
116
132
|
describe('where the top menu item has a link', function () {
|
|
117
133
|
test('clicking the label changes route but does not expand the sub menu', function () {
|
|
118
|
-
var
|
|
119
|
-
getByText =
|
|
120
|
-
queryByText =
|
|
134
|
+
var _render4 = render(_react2.default.createElement(_.default, defaultProps)),
|
|
135
|
+
getByText = _render4.getByText,
|
|
136
|
+
queryByText = _render4.queryByText;
|
|
121
137
|
|
|
122
138
|
var linkWithSubItems = items[3];
|
|
123
139
|
expect(queryByText(linkWithSubItems.items[0].text)).toBe(null);
|
|
@@ -127,10 +143,10 @@ describe('LeftNav', function () {
|
|
|
127
143
|
expect(queryByText(linkWithSubItems.items[0].text)).toBe(null);
|
|
128
144
|
});
|
|
129
145
|
test('clicking expander button toggles the sub menu', function () {
|
|
130
|
-
var
|
|
131
|
-
container =
|
|
132
|
-
queryByText =
|
|
133
|
-
getByRole =
|
|
146
|
+
var _render5 = render(_react2.default.createElement(_.default, defaultProps)),
|
|
147
|
+
container = _render5.container,
|
|
148
|
+
queryByText = _render5.queryByText,
|
|
149
|
+
getByRole = _render5.getByRole;
|
|
134
150
|
|
|
135
151
|
var linkWithSubItems = items[3];
|
|
136
152
|
var itemLink = queryByText(linkWithSubItems.text);
|
|
@@ -149,22 +165,22 @@ describe('LeftNav', function () {
|
|
|
149
165
|
(0, _setupTests.mockMatchMedia)(_useNav.MEDIA_QUERIES[1]);
|
|
150
166
|
});
|
|
151
167
|
it('renders as expected', function () {
|
|
152
|
-
var
|
|
153
|
-
container =
|
|
168
|
+
var _render6 = render(_react2.default.createElement(_.default, defaultProps)),
|
|
169
|
+
container = _render6.container;
|
|
154
170
|
|
|
155
171
|
expect(container).toMatchSnapshot();
|
|
156
172
|
});
|
|
157
173
|
describe('when the top menu item has sub items', function () {
|
|
158
174
|
test('focusing on the top menu item shows the sub items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
159
|
-
var
|
|
175
|
+
var _render7, queryByText, linkWithSubItems, itemLink;
|
|
160
176
|
|
|
161
177
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
162
178
|
while (1) {
|
|
163
179
|
switch (_context.prev = _context.next) {
|
|
164
180
|
case 0:
|
|
165
|
-
|
|
181
|
+
_render7 = render(_react2.default.createElement(_.default, _extends({}, defaultProps, {
|
|
166
182
|
navExpandedState: _useNav.NAV_EXPANDED_STATES.COLLAPSED_X
|
|
167
|
-
}))), queryByText =
|
|
183
|
+
}))), queryByText = _render7.queryByText;
|
|
168
184
|
linkWithSubItems = items[3];
|
|
169
185
|
itemLink = queryByText(linkWithSubItems.text);
|
|
170
186
|
expect(queryByText(linkWithSubItems.items[0].text)).not.toBeInTheDocument();
|
|
@@ -199,9 +215,9 @@ describe('LeftNav', function () {
|
|
|
199
215
|
});
|
|
200
216
|
describe('where the top menu item has a link', function () {
|
|
201
217
|
test('clicking the label changes route but does not expand the sub menu', function () {
|
|
202
|
-
var
|
|
203
|
-
getByText =
|
|
204
|
-
queryByText =
|
|
218
|
+
var _render8 = render(_react2.default.createElement(_.default, defaultProps)),
|
|
219
|
+
getByText = _render8.getByText,
|
|
220
|
+
queryByText = _render8.queryByText;
|
|
205
221
|
|
|
206
222
|
var linkWithSubItems = items[3];
|
|
207
223
|
expect(queryByText(linkWithSubItems.items[0].text)).toBe(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/LeftNav/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/LeftNav/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAuC,CAAC;AAmEpD,eAAe,MAAM,CAAC"}
|
|
@@ -23,12 +23,14 @@ schema.propTypes = {
|
|
|
23
23
|
text: _reactDesc.PropTypes.string.description('The label for the menu item.').isRequired,
|
|
24
24
|
path: _reactDesc.PropTypes.string.description('The path for an internal link. Can not be used with a `url` attribute.'),
|
|
25
25
|
url: _reactDesc.PropTypes.string.description('The path for an external link. Can not be used with a `path` attribute.'),
|
|
26
|
+
target: _reactDesc.PropTypes.string.description('Specifies where to open the linked document'),
|
|
26
27
|
items: _reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.shape({
|
|
27
28
|
active: _reactDesc.PropTypes.bool.description('Sets the menu item as active.'),
|
|
28
29
|
disabled: _reactDesc.PropTypes.bool.description('Disables the menu subitem.'),
|
|
29
30
|
text: _reactDesc.PropTypes.string.description('The label for the menu subitem.').isRequired,
|
|
30
31
|
path: _reactDesc.PropTypes.string.description('The path for an internal link. Can not be used with a `url` attribute.'),
|
|
31
|
-
url: _reactDesc.PropTypes.string.description('The path for an external link. Can not be used with a `path` attribute.')
|
|
32
|
+
url: _reactDesc.PropTypes.string.description('The path for an external link. Can not be used with a `path` attribute.'),
|
|
33
|
+
target: _reactDesc.PropTypes.string.description('Specifies where to open the linked document')
|
|
32
34
|
}).description('The definition for a subitem.')).description('An optional array of subitems.')
|
|
33
35
|
}).description('The definition for items.')).description('An array of menu item definitions.').defaultValue('[]')
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/LeftNav/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAA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AAoB,GAAG;IAC/D,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAEF,oBAAY,SAAS,GACjB,eAAe,GACf,uBAAuB,GACvB,2BAA2B,CAAC;AAChC,oBAAY,UAAU,GAAG,SAAS,EAAE,CAAC;AAErC,UAAU,gBAAgB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,OAAO,mBAAmB,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,gBAAgB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,OAAO,mBAAmB,CAAC;IAC9C,OAAO,EAAE,KAAK,CAAC;CAChB;AAED,oBAAY,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,OAAO,mBAAmB,CAAC;IAC3D,gBAAgB,CAAC,EAAE,MAAM,OAAO,mBAAmB,CAAC;IACpD,wBAAwB,CAAC,EAAE,CACzB,gBAAgB,EAAE,MAAM,OAAO,mBAAmB,KAC/C,IAAI,CAAC;CACX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinkRendererProps } from '../../providers/ConfigProvider';
|
|
3
|
-
declare const _default: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Pick<LinkRendererProps, "children" | "to"> & React.RefAttributes<HTMLAnchorElement>>, any, {
|
|
3
|
+
declare const _default: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Pick<LinkRendererProps, "children" | "target" | "to"> & React.RefAttributes<HTMLAnchorElement>>, any, {
|
|
4
4
|
size?: "small" | "medium" | undefined;
|
|
5
5
|
}, never>;
|
|
6
6
|
export default _default;
|
|
@@ -4,7 +4,8 @@ export interface LinkRendererProps {
|
|
|
4
4
|
ref?: Ref<LinkRendererRef>;
|
|
5
5
|
to: string;
|
|
6
6
|
children?: ReactNode;
|
|
7
|
+
target?: HTMLAnchorElement['target'];
|
|
7
8
|
}
|
|
8
|
-
declare const linkRendererWithRef: React.ForwardRefExoticComponent<Pick<LinkRendererProps, "children" | "to"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
9
|
+
declare const linkRendererWithRef: React.ForwardRefExoticComponent<Pick<LinkRendererProps, "children" | "target" | "to"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
9
10
|
export default linkRendererWithRef;
|
|
10
11
|
//# sourceMappingURL=linkRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkRenderer.d.ts","sourceRoot":"","sources":["../../../../src/providers/ConfigProvider/utils/linkRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAE1D,oBAAY,eAAe,GAAG,iBAAiB,CAAC;AAWhD,MAAM,WAAW,iBAAiB;IAEhC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"linkRenderer.d.ts","sourceRoot":"","sources":["../../../../src/providers/ConfigProvider/utils/linkRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAE1D,oBAAY,eAAe,GAAG,iBAAiB,CAAC;AAWhD,MAAM,WAAW,iBAAiB;IAEhC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;CACtC;AAoBD,QAAA,MAAM,mBAAmB,iIAA2B,CAAC;AAErD,eAAe,mBAAmB,CAAC"}
|