@clayui/breadcrumb 3.52.0 → 3.58.0
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/Ellipsis.d.ts +10 -0
- package/lib/Ellipsis.js +0 -21
- package/lib/Item.d.ts +16 -0
- package/lib/index.d.ts +17 -0
- package/package.json +9 -9
- package/src/Ellipsis.tsx +29 -35
package/lib/Ellipsis.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*/
|
|
1
5
|
import React from 'react';
|
|
2
6
|
import Item from './Item';
|
|
3
7
|
interface IEllipsisProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Property to define BreadcrumbEllipsis's items.
|
|
10
|
+
*/
|
|
4
11
|
items: Array<React.ComponentProps<typeof Item>>;
|
|
12
|
+
/**
|
|
13
|
+
* Path to the location of the spritemap resource.
|
|
14
|
+
*/
|
|
5
15
|
spritemap?: string;
|
|
6
16
|
}
|
|
7
17
|
declare const Ellipsis: React.FunctionComponent<IEllipsisProps>;
|
package/lib/Ellipsis.js
CHANGED
|
@@ -19,18 +19,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
|
|
20
20
|
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); }
|
|
21
21
|
|
|
22
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
-
|
|
24
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
|
|
26
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
-
|
|
28
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
-
|
|
30
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
-
|
|
32
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
-
|
|
34
22
|
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; }
|
|
35
23
|
|
|
36
24
|
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; }
|
|
@@ -40,18 +28,9 @@ var Ellipsis = function Ellipsis(_ref) {
|
|
|
40
28
|
spritemap = _ref.spritemap,
|
|
41
29
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
42
30
|
|
|
43
|
-
var _React$useState = _react.default.useState(false),
|
|
44
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
-
active = _React$useState2[0],
|
|
46
|
-
setActive = _React$useState2[1];
|
|
47
|
-
|
|
48
31
|
return /*#__PURE__*/_react.default.createElement(_dropDown.default, _extends({
|
|
49
|
-
active: active,
|
|
50
32
|
className: "breadcrumb-item",
|
|
51
33
|
containerElement: "li",
|
|
52
|
-
onActiveChange: function onActiveChange(newVal) {
|
|
53
|
-
return setActive(newVal);
|
|
54
|
-
},
|
|
55
34
|
trigger: /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
56
35
|
className: "breadcrumb-link",
|
|
57
36
|
displayType: "unstyled"
|
package/lib/Item.d.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*/
|
|
1
5
|
import React from 'react';
|
|
2
6
|
interface IItem extends React.HTMLAttributes<HTMLLIElement> {
|
|
7
|
+
/**
|
|
8
|
+
* Flag to indicate if the Breadcrumb item is active or not.
|
|
9
|
+
*/
|
|
3
10
|
active?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* This value is used to be the target of the link.
|
|
13
|
+
*/
|
|
4
14
|
href?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Label of the Breadcrumb item
|
|
17
|
+
*/
|
|
5
18
|
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Callback for when a Breadcrumb item is clicked.
|
|
21
|
+
*/
|
|
6
22
|
onClick?: (event: React.SyntheticEvent) => void;
|
|
7
23
|
}
|
|
8
24
|
declare const Item: ({ active, href, label, onClick, ...otherProps }: IItem) => JSX.Element;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*/
|
|
1
5
|
import React from 'react';
|
|
2
6
|
import Item from './Item';
|
|
3
7
|
declare type TItem = React.ComponentProps<typeof Item>;
|
|
4
8
|
declare type TItems = Array<TItem>;
|
|
5
9
|
interface IProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
10
|
+
/**
|
|
11
|
+
* The number of Breadcrumb Items to show on each side of the active Breadcrumb Item before
|
|
12
|
+
* using an ellipsis dropdown.
|
|
13
|
+
*/
|
|
6
14
|
ellipsisBuffer?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Use this property for defining `otherProps` that will be passed to ellipsis dropdown trigger.
|
|
17
|
+
*/
|
|
7
18
|
ellipsisProps?: Object;
|
|
19
|
+
/**
|
|
20
|
+
* Property to define Breadcrumb's items.
|
|
21
|
+
*/
|
|
8
22
|
items: TItems;
|
|
23
|
+
/**
|
|
24
|
+
* Path to the location of the spritemap resource.
|
|
25
|
+
*/
|
|
9
26
|
spritemap?: string;
|
|
10
27
|
}
|
|
11
28
|
declare const ClayBreadcrumb: React.FunctionComponent<IProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clayui/breadcrumb",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.58.0",
|
|
4
4
|
"description": "ClayBreadcrumb component",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"repository": "https://github.com/liferay/clay",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib --extensions .ts,.tsx",
|
|
20
|
-
"
|
|
21
|
-
"prepublishOnly": "yarn build && yarn
|
|
20
|
+
"buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
|
|
21
|
+
"prepublishOnly": "yarn build && yarn buildTypes",
|
|
22
22
|
"test": "jest --config ../../jest.config.js"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"react"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@clayui/button": "^3.
|
|
30
|
-
"@clayui/drop-down": "^3.
|
|
31
|
-
"@clayui/icon": "^3.
|
|
32
|
-
"@clayui/link": "^3.
|
|
33
|
-
"@clayui/shared": "^3.
|
|
29
|
+
"@clayui/button": "^3.56.0",
|
|
30
|
+
"@clayui/drop-down": "^3.58.0",
|
|
31
|
+
"@clayui/icon": "^3.56.0",
|
|
32
|
+
"@clayui/link": "^3.56.0",
|
|
33
|
+
"@clayui/shared": "^3.58.0",
|
|
34
34
|
"classnames": "^2.2.6",
|
|
35
35
|
"warning": "^4.0.3"
|
|
36
36
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"browserslist": [
|
|
43
43
|
"extends browserslist-config-clay"
|
|
44
44
|
],
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "db7f178a1a0dff04d700f8dca2b04f6a5321353b"
|
|
46
46
|
}
|
package/src/Ellipsis.tsx
CHANGED
|
@@ -26,41 +26,35 @@ const Ellipsis: React.FunctionComponent<IEllipsisProps> = ({
|
|
|
26
26
|
items,
|
|
27
27
|
spritemap,
|
|
28
28
|
...otherProps
|
|
29
|
-
}) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
}) => (
|
|
30
|
+
<ClayDropDown
|
|
31
|
+
className="breadcrumb-item"
|
|
32
|
+
containerElement="li"
|
|
33
|
+
trigger={
|
|
34
|
+
<ClayButton
|
|
35
|
+
className="breadcrumb-link"
|
|
36
|
+
data-testid="breadcrumbDropdownTrigger"
|
|
37
|
+
displayType="unstyled"
|
|
38
|
+
>
|
|
39
|
+
<ClayIcon spritemap={spritemap} symbol="ellipsis-h" />
|
|
40
|
+
<ClayIcon spritemap={spritemap} symbol="caret-bottom" />
|
|
41
|
+
</ClayButton>
|
|
42
|
+
}
|
|
43
|
+
{...otherProps}
|
|
44
|
+
>
|
|
45
|
+
<ClayDropDown.ItemList>
|
|
46
|
+
{items.map(({href, label, onClick}, i) => (
|
|
47
|
+
<ClayDropDown.Item
|
|
48
|
+
href={href}
|
|
49
|
+
key={`breadcrumbEllipsisItem${i}`}
|
|
50
|
+
onClick={onClick}
|
|
51
|
+
title={label}
|
|
43
52
|
>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<ClayDropDown.ItemList>
|
|
51
|
-
{items.map(({href, label, onClick}, i) => (
|
|
52
|
-
<ClayDropDown.Item
|
|
53
|
-
href={href}
|
|
54
|
-
key={`breadcrumbEllipsisItem${i}`}
|
|
55
|
-
onClick={onClick}
|
|
56
|
-
title={label}
|
|
57
|
-
>
|
|
58
|
-
{label}
|
|
59
|
-
</ClayDropDown.Item>
|
|
60
|
-
))}
|
|
61
|
-
</ClayDropDown.ItemList>
|
|
62
|
-
</ClayDropDown>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
53
|
+
{label}
|
|
54
|
+
</ClayDropDown.Item>
|
|
55
|
+
))}
|
|
56
|
+
</ClayDropDown.ItemList>
|
|
57
|
+
</ClayDropDown>
|
|
58
|
+
);
|
|
65
59
|
|
|
66
60
|
export default Ellipsis;
|