@digigov/react-core 2.0.0-rc.12 → 2.0.0-rc.13
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.
|
@@ -3,7 +3,18 @@ import { NavListItemButtonProps } from '@digigov/react-core/NavListItemButton';
|
|
|
3
3
|
import { NavListItemLinkProps } from '@digigov/react-core/NavListItemLink';
|
|
4
4
|
export type LinkButtonJoinProps = NavListItemLinkProps & NavListItemButtonProps;
|
|
5
5
|
export interface NavListItemActionProps extends LinkButtonJoinProps {
|
|
6
|
+
/**
|
|
7
|
+
* label is optional.
|
|
8
|
+
* The label for the NavListItemAction.
|
|
9
|
+
*/
|
|
6
10
|
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* arrow is optional.
|
|
13
|
+
* use arrow prop if you want to have arrow at the nav list item.
|
|
14
|
+
* @value true
|
|
15
|
+
* @value false
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
7
18
|
arrow?: boolean;
|
|
8
19
|
}
|
|
9
20
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "children"];
|
|
3
|
+
var _excluded = ["label", "arrow", "href", "className", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import NavListItemActionContainer from '@digigov/react-core/NavListItemActionContainer';
|
|
6
6
|
import NavListItemButton from '@digigov/react-core/NavListItemButton';
|
|
@@ -10,15 +10,20 @@ import NavListItemLink from '@digigov/react-core/NavListItemLink';
|
|
|
10
10
|
* This component has a items of NavListItemLink component inside.
|
|
11
11
|
*/
|
|
12
12
|
export var NavListItemAction = /*#__PURE__*/React.forwardRef(function NavListItemAction(_ref, ref) {
|
|
13
|
-
var
|
|
13
|
+
var label = _ref.label,
|
|
14
|
+
_ref$arrow = _ref.arrow,
|
|
15
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
16
|
+
href = _ref.href,
|
|
17
|
+
className = _ref.className,
|
|
14
18
|
children = _ref.children,
|
|
15
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
return /*#__PURE__*/React.createElement(NavListItemActionContainer, null,
|
|
20
|
+
return /*#__PURE__*/React.createElement(NavListItemActionContainer, null, href ? /*#__PURE__*/React.createElement(NavListItemLink, _extends({}, props, {
|
|
17
21
|
className: className,
|
|
18
22
|
ref: ref
|
|
19
|
-
}), children ||
|
|
23
|
+
}), children || label) : /*#__PURE__*/React.createElement(NavListItemButton, _extends({}, props, {
|
|
24
|
+
arrow: arrow,
|
|
20
25
|
className: className,
|
|
21
26
|
ref: ref
|
|
22
|
-
}), children ||
|
|
27
|
+
}), children || label));
|
|
23
28
|
});
|
|
24
29
|
export default NavListItemAction;
|
|
@@ -11,21 +11,26 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _NavListItemActionContainer = _interopRequireDefault(require("@digigov/react-core/NavListItemActionContainer"));
|
|
12
12
|
var _NavListItemButton = _interopRequireDefault(require("@digigov/react-core/NavListItemButton"));
|
|
13
13
|
var _NavListItemLink = _interopRequireDefault(require("@digigov/react-core/NavListItemLink"));
|
|
14
|
-
var _excluded = ["className", "children"];
|
|
14
|
+
var _excluded = ["label", "arrow", "href", "className", "children"];
|
|
15
15
|
/**
|
|
16
16
|
* NavListItemAction must be inside the NavList.
|
|
17
17
|
* This component has a items of NavListItemLink component inside.
|
|
18
18
|
*/
|
|
19
19
|
var NavListItemAction = exports.NavListItemAction = /*#__PURE__*/_react["default"].forwardRef(function NavListItemAction(_ref, ref) {
|
|
20
|
-
var
|
|
20
|
+
var label = _ref.label,
|
|
21
|
+
_ref$arrow = _ref.arrow,
|
|
22
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
23
|
+
href = _ref.href,
|
|
24
|
+
className = _ref.className,
|
|
21
25
|
children = _ref.children,
|
|
22
26
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
23
|
-
return /*#__PURE__*/_react["default"].createElement(_NavListItemActionContainer["default"], null,
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_NavListItemActionContainer["default"], null, href ? /*#__PURE__*/_react["default"].createElement(_NavListItemLink["default"], (0, _extends2["default"])({}, props, {
|
|
24
28
|
className: className,
|
|
25
29
|
ref: ref
|
|
26
|
-
}), children ||
|
|
30
|
+
}), children || label) : /*#__PURE__*/_react["default"].createElement(_NavListItemButton["default"], (0, _extends2["default"])({}, props, {
|
|
31
|
+
arrow: arrow,
|
|
27
32
|
className: className,
|
|
28
33
|
ref: ref
|
|
29
|
-
}), children ||
|
|
34
|
+
}), children || label));
|
|
30
35
|
});
|
|
31
36
|
var _default = exports["default"] = NavListItemAction;
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/react-core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.13",
|
|
4
4
|
"description": "@digigov react core components",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
7
7
|
"main": "./cjs/index.js",
|
|
8
8
|
"module": "./index.js",
|
|
9
9
|
"peerDependencies": {
|
|
10
|
-
"@digigov/css": "2.0.0-rc.
|
|
11
|
-
"@digigov/react-icons": "2.0.0-rc.
|
|
10
|
+
"@digigov/css": "2.0.0-rc.13",
|
|
11
|
+
"@digigov/react-icons": "2.0.0-rc.13",
|
|
12
12
|
"clsx": "1.1.1",
|
|
13
13
|
"react": "^16.8.0 || ^17.0.0",
|
|
14
14
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
@@ -9,7 +9,19 @@ import NavListItemLink, {
|
|
|
9
9
|
|
|
10
10
|
export type LinkButtonJoinProps = NavListItemLinkProps & NavListItemButtonProps;
|
|
11
11
|
export interface NavListItemActionProps extends LinkButtonJoinProps {
|
|
12
|
+
/**
|
|
13
|
+
* label is optional.
|
|
14
|
+
* The label for the NavListItemAction.
|
|
15
|
+
*/
|
|
12
16
|
label?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* arrow is optional.
|
|
20
|
+
* use arrow prop if you want to have arrow at the nav list item.
|
|
21
|
+
* @value true
|
|
22
|
+
* @value false
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
13
25
|
arrow?: boolean;
|
|
14
26
|
}
|
|
15
27
|
/**
|
|
@@ -19,24 +31,28 @@ export interface NavListItemActionProps extends LinkButtonJoinProps {
|
|
|
19
31
|
export const NavListItemAction = React.forwardRef<
|
|
20
32
|
HTMLButtonElement | HTMLAnchorElement,
|
|
21
33
|
NavListItemActionProps
|
|
22
|
-
>(function NavListItemAction(
|
|
34
|
+
>(function NavListItemAction(
|
|
35
|
+
{ label, arrow = false, href, className, children, ...props },
|
|
36
|
+
ref
|
|
37
|
+
) {
|
|
23
38
|
return (
|
|
24
39
|
<NavListItemActionContainer>
|
|
25
|
-
{
|
|
40
|
+
{href ? (
|
|
26
41
|
<NavListItemLink
|
|
27
42
|
{...props}
|
|
28
43
|
className={className}
|
|
29
44
|
ref={ref as ForwardedRef<HTMLAnchorElement>}
|
|
30
45
|
>
|
|
31
|
-
{children ||
|
|
46
|
+
{children || label}
|
|
32
47
|
</NavListItemLink>
|
|
33
48
|
) : (
|
|
34
49
|
<NavListItemButton
|
|
35
50
|
{...props}
|
|
51
|
+
arrow={arrow}
|
|
36
52
|
className={className}
|
|
37
53
|
ref={ref as ForwardedRef<HTMLButtonElement>}
|
|
38
54
|
>
|
|
39
|
-
{children ||
|
|
55
|
+
{children || label}
|
|
40
56
|
</NavListItemButton>
|
|
41
57
|
)}
|
|
42
58
|
</NavListItemActionContainer>
|