@clayui/label 3.141.2-alpha.0 → 3.142.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/index.d.ts +49 -0
- package/lib/index.js +110 -0
- package/package.json +11 -14
- package/lib/cjs/index.js +0 -105
- package/lib/esm/index.js +0 -100
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
3
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export declare const ItemAfter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
export declare const ItemBefore: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
export declare const ItemExpand: React.ForwardRefExoticComponent<React.BaseHTMLAttributes<HTMLSpanElement | HTMLAnchorElement> & React.RefAttributes<HTMLSpanElement | HTMLAnchorElement>>;
|
|
9
|
+
interface IBaseProps extends React.BaseHTMLAttributes<HTMLSpanElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Flag to indicate if `label-dismissible` class should be applied.
|
|
12
|
+
*/
|
|
13
|
+
dismissible?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Determines the style of the label.
|
|
16
|
+
*/
|
|
17
|
+
displayType?: 'secondary' | 'info' | 'warning' | 'danger' | 'success' | 'unstyled';
|
|
18
|
+
/**
|
|
19
|
+
* Flag to indicate if the label should be of the `large` variant.
|
|
20
|
+
*/
|
|
21
|
+
large?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface IProps extends IBaseProps {
|
|
24
|
+
/**
|
|
25
|
+
* HTML properties that are applied to the 'x' button.
|
|
26
|
+
*/
|
|
27
|
+
closeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
28
|
+
ref?: (instance: HTMLButtonElement | null) => void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Pros to add to the inner label item
|
|
32
|
+
*/
|
|
33
|
+
innerElementProps?: React.ComponentProps<typeof ItemExpand>;
|
|
34
|
+
/**
|
|
35
|
+
* Path to the location of the spritemap resource used for Icon.
|
|
36
|
+
*/
|
|
37
|
+
spritemap?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Flag to indicate if component should include the close button
|
|
40
|
+
*/
|
|
41
|
+
withClose?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface IForwardRef<T, P = {}> extends React.ForwardRefExoticComponent<P & React.RefAttributes<T>> {
|
|
44
|
+
ItemAfter: typeof ItemAfter;
|
|
45
|
+
ItemBefore: typeof ItemBefore;
|
|
46
|
+
ItemExpand: typeof ItemExpand;
|
|
47
|
+
}
|
|
48
|
+
declare const Label: IForwardRef<HTMLSpanElement | HTMLAnchorElement, IProps>;
|
|
49
|
+
export default Label;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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 = exports.ItemExpand = exports.ItemBefore = exports.ItemAfter = void 0;
|
|
8
|
+
var _icon = _interopRequireDefault(require("@clayui/icon"));
|
|
9
|
+
var _link = _interopRequireDefault(require("@clayui/link"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _excluded = ["children", "className"],
|
|
13
|
+
_excluded2 = ["children", "className"],
|
|
14
|
+
_excluded3 = ["children", "className", "href"],
|
|
15
|
+
_excluded4 = ["children", "className", "dismissible", "displayType", "large"],
|
|
16
|
+
_excluded5 = ["children", "closeButtonProps", "href", "innerElementProps", "withClose", "spritemap"];
|
|
17
|
+
/**
|
|
18
|
+
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
19
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
+
*/
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
24
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
26
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) { o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
27
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } } return t; }
|
|
28
|
+
var ItemAfter = exports.ItemAfter = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
className = _ref.className,
|
|
31
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
|
|
33
|
+
className: (0, _classnames.default)(className, 'label-item label-item-after'),
|
|
34
|
+
ref: ref
|
|
35
|
+
}), children);
|
|
36
|
+
});
|
|
37
|
+
ItemAfter.displayName = 'ClayLabelItemAfter';
|
|
38
|
+
var ItemBefore = exports.ItemBefore = /*#__PURE__*/_react.default.forwardRef(function (_ref2, ref) {
|
|
39
|
+
var children = _ref2.children,
|
|
40
|
+
className = _ref2.className,
|
|
41
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
|
|
43
|
+
className: (0, _classnames.default)(className, 'label-item label-item-before'),
|
|
44
|
+
ref: ref
|
|
45
|
+
}), children);
|
|
46
|
+
});
|
|
47
|
+
ItemBefore.displayName = 'ClayLabelItemBefore';
|
|
48
|
+
var ItemExpand = exports.ItemExpand = /*#__PURE__*/_react.default.forwardRef(function (_ref3, ref) {
|
|
49
|
+
var children = _ref3.children,
|
|
50
|
+
className = _ref3.className,
|
|
51
|
+
href = _ref3.href,
|
|
52
|
+
otherProps = _objectWithoutProperties(_ref3, _excluded3);
|
|
53
|
+
var TagName = href ? _link.default : 'span';
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(TagName, _extends({}, otherProps, {
|
|
55
|
+
className: (0, _classnames.default)(className, 'label-item label-item-expand'),
|
|
56
|
+
href: href,
|
|
57
|
+
ref: ref
|
|
58
|
+
}), children);
|
|
59
|
+
});
|
|
60
|
+
ItemExpand.displayName = 'ClayLabelItemExpand';
|
|
61
|
+
var OldLabel = /*#__PURE__*/_react.default.forwardRef(function (_ref4, ref) {
|
|
62
|
+
var children = _ref4.children,
|
|
63
|
+
className = _ref4.className,
|
|
64
|
+
dismissible = _ref4.dismissible,
|
|
65
|
+
_ref4$displayType = _ref4.displayType,
|
|
66
|
+
displayType = _ref4$displayType === void 0 ? 'secondary' : _ref4$displayType,
|
|
67
|
+
_ref4$large = _ref4.large,
|
|
68
|
+
large = _ref4$large === void 0 ? false : _ref4$large,
|
|
69
|
+
otherProps = _objectWithoutProperties(_ref4, _excluded4);
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
|
|
71
|
+
className: (0, _classnames.default)('label', className, _defineProperty({
|
|
72
|
+
'label-dismissible': dismissible,
|
|
73
|
+
'label-lg': large
|
|
74
|
+
}, "label-".concat(displayType), displayType)),
|
|
75
|
+
ref: ref
|
|
76
|
+
}), children);
|
|
77
|
+
});
|
|
78
|
+
OldLabel.displayName = 'ClayLabel';
|
|
79
|
+
function forwardRef(component) {
|
|
80
|
+
return /*#__PURE__*/_react.default.forwardRef(component);
|
|
81
|
+
}
|
|
82
|
+
var Label = forwardRef(function (_ref5, ref) {
|
|
83
|
+
var children = _ref5.children,
|
|
84
|
+
closeButtonProps = _ref5.closeButtonProps,
|
|
85
|
+
href = _ref5.href,
|
|
86
|
+
_ref5$innerElementPro = _ref5.innerElementProps,
|
|
87
|
+
innerElementProps = _ref5$innerElementPro === void 0 ? {} : _ref5$innerElementPro,
|
|
88
|
+
_ref5$withClose = _ref5.withClose,
|
|
89
|
+
withClose = _ref5$withClose === void 0 ? true : _ref5$withClose,
|
|
90
|
+
spritemap = _ref5.spritemap,
|
|
91
|
+
otherProps = _objectWithoutProperties(_ref5, _excluded5);
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(OldLabel, _extends({
|
|
93
|
+
dismissible: withClose && !!closeButtonProps
|
|
94
|
+
}, otherProps, {
|
|
95
|
+
ref: ref
|
|
96
|
+
}), !withClose && children, withClose && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ItemExpand, _extends({}, innerElementProps, {
|
|
97
|
+
href: href
|
|
98
|
+
}), children), closeButtonProps && /*#__PURE__*/_react.default.createElement(ItemAfter, null, /*#__PURE__*/_react.default.createElement("button", _extends({}, closeButtonProps, {
|
|
99
|
+
className: (0, _classnames.default)(closeButtonProps.className, 'close'),
|
|
100
|
+
type: "button"
|
|
101
|
+
}), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
102
|
+
spritemap: spritemap,
|
|
103
|
+
symbol: "times-small"
|
|
104
|
+
})))));
|
|
105
|
+
});
|
|
106
|
+
Label.displayName = 'ClayLabel';
|
|
107
|
+
Label.ItemAfter = ItemAfter;
|
|
108
|
+
Label.ItemBefore = ItemBefore;
|
|
109
|
+
Label.ItemExpand = ItemExpand;
|
|
110
|
+
var _default = exports.default = Label;
|
package/package.json
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clayui/label",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.142.0",
|
|
4
4
|
"description": "ClayLabel component",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"repository": "https://github.com/liferay/clay",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"import": "./lib/esm/index.js",
|
|
11
|
-
"require": "./lib/cjs/index.js"
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=0.12.0",
|
|
9
|
+
"npm": ">=3.0.0"
|
|
12
10
|
},
|
|
11
|
+
"main": "lib/index.js",
|
|
13
12
|
"types": "lib/index.d.ts",
|
|
14
13
|
"ts:main": "src/index.tsx",
|
|
15
14
|
"files": [
|
|
16
15
|
"lib"
|
|
17
16
|
],
|
|
18
17
|
"scripts": {
|
|
19
|
-
"build": "
|
|
20
|
-
"build:cjs": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib/cjs --extensions .ts,.tsx",
|
|
21
|
-
"build:esm": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib/esm --extensions .ts,.tsx --env-name esm",
|
|
18
|
+
"build": "babel src --root-mode upward --out-dir lib --extensions .ts,.tsx",
|
|
22
19
|
"buildTypes": "tsc --project ./tsconfig.declarations.json",
|
|
23
20
|
"test": "jest --config ../../jest.config.js"
|
|
24
21
|
},
|
|
@@ -27,17 +24,17 @@
|
|
|
27
24
|
"react"
|
|
28
25
|
],
|
|
29
26
|
"dependencies": {
|
|
30
|
-
"@clayui/icon": "^3.
|
|
31
|
-
"@clayui/link": "^3.
|
|
27
|
+
"@clayui/icon": "^3.129.0",
|
|
28
|
+
"@clayui/link": "^3.142.0",
|
|
32
29
|
"classnames": "^2.2.6"
|
|
33
30
|
},
|
|
34
31
|
"peerDependencies": {
|
|
35
32
|
"@clayui/css": "3.x",
|
|
36
|
-
"react": "^
|
|
37
|
-
"react-dom": "^
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0"
|
|
38
35
|
},
|
|
39
36
|
"browserslist": [
|
|
40
37
|
"extends browserslist-config-clay"
|
|
41
38
|
],
|
|
42
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "f563be12a87d6fcf03706d235618e5512de63463"
|
|
43
40
|
}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ItemExpand = exports.ItemBefore = exports.ItemAfter = void 0;
|
|
7
|
-
var _icon = _interopRequireDefault(require("@clayui/icon"));
|
|
8
|
-
var _link = _interopRequireDefault(require("@clayui/link"));
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /**
|
|
13
|
-
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
14
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
15
|
-
*/
|
|
16
|
-
const ItemAfter = exports.ItemAfter = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
17
|
-
let {
|
|
18
|
-
children,
|
|
19
|
-
className,
|
|
20
|
-
...otherProps
|
|
21
|
-
} = _ref;
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
|
|
23
|
-
className: (0, _classnames.default)(className, 'label-item label-item-after'),
|
|
24
|
-
ref: ref
|
|
25
|
-
}), children);
|
|
26
|
-
});
|
|
27
|
-
ItemAfter.displayName = 'ClayLabelItemAfter';
|
|
28
|
-
const ItemBefore = exports.ItemBefore = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
29
|
-
let {
|
|
30
|
-
children,
|
|
31
|
-
className,
|
|
32
|
-
...otherProps
|
|
33
|
-
} = _ref2;
|
|
34
|
-
return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
|
|
35
|
-
className: (0, _classnames.default)(className, 'label-item label-item-before'),
|
|
36
|
-
ref: ref
|
|
37
|
-
}), children);
|
|
38
|
-
});
|
|
39
|
-
ItemBefore.displayName = 'ClayLabelItemBefore';
|
|
40
|
-
const ItemExpand = exports.ItemExpand = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
41
|
-
let {
|
|
42
|
-
children,
|
|
43
|
-
className,
|
|
44
|
-
href,
|
|
45
|
-
...otherProps
|
|
46
|
-
} = _ref3;
|
|
47
|
-
const TagName = href ? _link.default : 'span';
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(TagName, _extends({}, otherProps, {
|
|
49
|
-
className: (0, _classnames.default)(className, 'label-item label-item-expand'),
|
|
50
|
-
href: href,
|
|
51
|
-
ref: ref
|
|
52
|
-
}), children);
|
|
53
|
-
});
|
|
54
|
-
ItemExpand.displayName = 'ClayLabelItemExpand';
|
|
55
|
-
const OldLabel = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
|
|
56
|
-
let {
|
|
57
|
-
children,
|
|
58
|
-
className,
|
|
59
|
-
dismissible,
|
|
60
|
-
displayType = 'secondary',
|
|
61
|
-
large = false,
|
|
62
|
-
...otherProps
|
|
63
|
-
} = _ref4;
|
|
64
|
-
return /*#__PURE__*/_react.default.createElement("span", _extends({}, otherProps, {
|
|
65
|
-
className: (0, _classnames.default)('label', className, {
|
|
66
|
-
'label-dismissible': dismissible,
|
|
67
|
-
'label-lg': large,
|
|
68
|
-
[`label-${displayType}`]: displayType
|
|
69
|
-
}),
|
|
70
|
-
ref: ref
|
|
71
|
-
}), children);
|
|
72
|
-
});
|
|
73
|
-
OldLabel.displayName = 'ClayLabel';
|
|
74
|
-
function forwardRef(component) {
|
|
75
|
-
return /*#__PURE__*/_react.default.forwardRef(component);
|
|
76
|
-
}
|
|
77
|
-
const Label = forwardRef((_ref5, ref) => {
|
|
78
|
-
let {
|
|
79
|
-
children,
|
|
80
|
-
closeButtonProps,
|
|
81
|
-
href,
|
|
82
|
-
innerElementProps = {},
|
|
83
|
-
withClose = true,
|
|
84
|
-
spritemap,
|
|
85
|
-
...otherProps
|
|
86
|
-
} = _ref5;
|
|
87
|
-
return /*#__PURE__*/_react.default.createElement(OldLabel, _extends({
|
|
88
|
-
dismissible: withClose && !!closeButtonProps
|
|
89
|
-
}, otherProps, {
|
|
90
|
-
ref: ref
|
|
91
|
-
}), !withClose && children, withClose && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ItemExpand, _extends({}, innerElementProps, {
|
|
92
|
-
href: href
|
|
93
|
-
}), children), closeButtonProps && /*#__PURE__*/_react.default.createElement(ItemAfter, null, /*#__PURE__*/_react.default.createElement("button", _extends({}, closeButtonProps, {
|
|
94
|
-
className: (0, _classnames.default)(closeButtonProps.className, 'close'),
|
|
95
|
-
type: "button"
|
|
96
|
-
}), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
97
|
-
spritemap: spritemap,
|
|
98
|
-
symbol: "times-small"
|
|
99
|
-
})))));
|
|
100
|
-
});
|
|
101
|
-
Label.displayName = 'ClayLabel';
|
|
102
|
-
Label.ItemAfter = ItemAfter;
|
|
103
|
-
Label.ItemBefore = ItemBefore;
|
|
104
|
-
Label.ItemExpand = ItemExpand;
|
|
105
|
-
var _default = exports.default = Label;
|
package/lib/esm/index.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
/**
|
|
3
|
-
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import ClayIcon from '@clayui/icon';
|
|
8
|
-
import ClayLink from '@clayui/link';
|
|
9
|
-
import classNames from 'classnames';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
export const ItemAfter = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
12
|
-
let {
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
...otherProps
|
|
16
|
-
} = _ref;
|
|
17
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, otherProps, {
|
|
18
|
-
className: classNames(className, 'label-item label-item-after'),
|
|
19
|
-
ref: ref
|
|
20
|
-
}), children);
|
|
21
|
-
});
|
|
22
|
-
ItemAfter.displayName = 'ClayLabelItemAfter';
|
|
23
|
-
export const ItemBefore = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
24
|
-
let {
|
|
25
|
-
children,
|
|
26
|
-
className,
|
|
27
|
-
...otherProps
|
|
28
|
-
} = _ref2;
|
|
29
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, otherProps, {
|
|
30
|
-
className: classNames(className, 'label-item label-item-before'),
|
|
31
|
-
ref: ref
|
|
32
|
-
}), children);
|
|
33
|
-
});
|
|
34
|
-
ItemBefore.displayName = 'ClayLabelItemBefore';
|
|
35
|
-
export const ItemExpand = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
36
|
-
let {
|
|
37
|
-
children,
|
|
38
|
-
className,
|
|
39
|
-
href,
|
|
40
|
-
...otherProps
|
|
41
|
-
} = _ref3;
|
|
42
|
-
const TagName = href ? ClayLink : 'span';
|
|
43
|
-
return /*#__PURE__*/React.createElement(TagName, _extends({}, otherProps, {
|
|
44
|
-
className: classNames(className, 'label-item label-item-expand'),
|
|
45
|
-
href: href,
|
|
46
|
-
ref: ref
|
|
47
|
-
}), children);
|
|
48
|
-
});
|
|
49
|
-
ItemExpand.displayName = 'ClayLabelItemExpand';
|
|
50
|
-
const OldLabel = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
51
|
-
let {
|
|
52
|
-
children,
|
|
53
|
-
className,
|
|
54
|
-
dismissible,
|
|
55
|
-
displayType = 'secondary',
|
|
56
|
-
large = false,
|
|
57
|
-
...otherProps
|
|
58
|
-
} = _ref4;
|
|
59
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, otherProps, {
|
|
60
|
-
className: classNames('label', className, {
|
|
61
|
-
'label-dismissible': dismissible,
|
|
62
|
-
'label-lg': large,
|
|
63
|
-
[`label-${displayType}`]: displayType
|
|
64
|
-
}),
|
|
65
|
-
ref: ref
|
|
66
|
-
}), children);
|
|
67
|
-
});
|
|
68
|
-
OldLabel.displayName = 'ClayLabel';
|
|
69
|
-
function forwardRef(component) {
|
|
70
|
-
return /*#__PURE__*/React.forwardRef(component);
|
|
71
|
-
}
|
|
72
|
-
const Label = forwardRef((_ref5, ref) => {
|
|
73
|
-
let {
|
|
74
|
-
children,
|
|
75
|
-
closeButtonProps,
|
|
76
|
-
href,
|
|
77
|
-
innerElementProps = {},
|
|
78
|
-
withClose = true,
|
|
79
|
-
spritemap,
|
|
80
|
-
...otherProps
|
|
81
|
-
} = _ref5;
|
|
82
|
-
return /*#__PURE__*/React.createElement(OldLabel, _extends({
|
|
83
|
-
dismissible: withClose && !!closeButtonProps
|
|
84
|
-
}, otherProps, {
|
|
85
|
-
ref: ref
|
|
86
|
-
}), !withClose && children, withClose && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ItemExpand, _extends({}, innerElementProps, {
|
|
87
|
-
href: href
|
|
88
|
-
}), children), closeButtonProps && /*#__PURE__*/React.createElement(ItemAfter, null, /*#__PURE__*/React.createElement("button", _extends({}, closeButtonProps, {
|
|
89
|
-
className: classNames(closeButtonProps.className, 'close'),
|
|
90
|
-
type: "button"
|
|
91
|
-
}), /*#__PURE__*/React.createElement(ClayIcon, {
|
|
92
|
-
spritemap: spritemap,
|
|
93
|
-
symbol: "times-small"
|
|
94
|
-
})))));
|
|
95
|
-
});
|
|
96
|
-
Label.displayName = 'ClayLabel';
|
|
97
|
-
Label.ItemAfter = ItemAfter;
|
|
98
|
-
Label.ItemBefore = ItemBefore;
|
|
99
|
-
Label.ItemExpand = ItemExpand;
|
|
100
|
-
export default Label;
|