@clayui/label 3.39.0 → 3.56.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/README.md +19 -0
- package/lib/index.d.ts +25 -0
- package/package.json +6 -6
- package/README.mdx +0 -49
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# `@clayui/label`
|
|
2
|
+
|
|
3
|
+
Labels are a visual pattern used to categorize information providing quick and easy recognition.
|
|
4
|
+
|
|
5
|
+
- [Documentation](https://clayui.com/docs/components/label.html)
|
|
6
|
+
- [Changelog](./CHANGELOG.md)
|
|
7
|
+
- [Breaking change schedule](./BREAKING.md)
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Run `yarn`
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
yarn add @clayui/label
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Contribute
|
|
18
|
+
|
|
19
|
+
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,42 @@
|
|
|
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
|
declare const ClayLabelItemExpand: React.ForwardRefExoticComponent<React.BaseHTMLAttributes<HTMLAnchorElement | HTMLSpanElement> & React.RefAttributes<HTMLAnchorElement | HTMLSpanElement>>;
|
|
3
7
|
declare type DisplayType = 'secondary' | 'info' | 'warning' | 'danger' | 'success' | 'unstyled';
|
|
4
8
|
interface IBaseProps extends React.BaseHTMLAttributes<HTMLSpanElement> {
|
|
9
|
+
/**
|
|
10
|
+
* Flag to indicate if `label-dismissible` class should be applied.
|
|
11
|
+
*/
|
|
5
12
|
dismissible?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Determines the style of the label.
|
|
15
|
+
*/
|
|
6
16
|
displayType?: DisplayType;
|
|
17
|
+
/**
|
|
18
|
+
* Flag to indicate if the label should be of the `large` variant.
|
|
19
|
+
*/
|
|
7
20
|
large?: boolean;
|
|
8
21
|
}
|
|
9
22
|
interface IProps extends IBaseProps {
|
|
23
|
+
/**
|
|
24
|
+
* HTML properties that are applied to the 'x' button.
|
|
25
|
+
*/
|
|
10
26
|
closeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
11
27
|
ref?: (instance: HTMLButtonElement | null) => void;
|
|
12
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Pros to add to the inner label item
|
|
31
|
+
*/
|
|
13
32
|
innerElementProps?: React.ComponentProps<typeof ClayLabelItemExpand>;
|
|
33
|
+
/**
|
|
34
|
+
* Path to the location of the spritemap resource used for Icon.
|
|
35
|
+
*/
|
|
14
36
|
spritemap?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Flag to indicate if component should include the close button
|
|
39
|
+
*/
|
|
15
40
|
withClose?: boolean;
|
|
16
41
|
}
|
|
17
42
|
declare const _default: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLAnchorElement | HTMLSpanElement>> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clayui/label",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.56.0",
|
|
4
4
|
"description": "ClayLabel 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": "babel src --root-mode upward --out-dir lib --extensions .ts,.tsx",
|
|
20
|
-
"
|
|
21
|
-
"prepublishOnly": "yarn build && yarn
|
|
20
|
+
"buildTypes": "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,8 +26,8 @@
|
|
|
26
26
|
"react"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@clayui/icon": "^3.
|
|
30
|
-
"@clayui/link": "^3.
|
|
29
|
+
"@clayui/icon": "^3.56.0",
|
|
30
|
+
"@clayui/link": "^3.56.0",
|
|
31
31
|
"classnames": "^2.2.6"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"browserslist": [
|
|
39
39
|
"extends browserslist-config-clay"
|
|
40
40
|
],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "1c33d9c709d8ce071862f0087c76ac23ce11465b"
|
|
42
42
|
}
|
package/README.mdx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 'Label'
|
|
3
|
-
description: 'Labels are a visual pattern used to categorize information providing quick and easy recognition.'
|
|
4
|
-
lexiconDefinition: 'https://liferay.design/lexicon/core-components/labels/'
|
|
5
|
-
packageNpm: '@clayui/label'
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
Label,
|
|
10
|
-
LabelClosingActions,
|
|
11
|
-
LabelDisplayTypes,
|
|
12
|
-
} from '$packages/clay-label/docs/index';
|
|
13
|
-
|
|
14
|
-
<div class="nav-toc-absolute">
|
|
15
|
-
<div class="nav-toc">
|
|
16
|
-
|
|
17
|
-
- [Display Types](#display-types)
|
|
18
|
-
- [Closing Actions](#closing-actions)
|
|
19
|
-
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
## Overview
|
|
24
|
-
|
|
25
|
-
`ClayLabel` offers two different APIs for use by toggling the prop `withClose`. By default(`withClose={true}`), `ClayLabel` behaves like a high-level component. If you want to use the lower-level components and compose multiple parts to your label, all you need to do is set `withClose={false}`.
|
|
26
|
-
|
|
27
|
-
Check out [this storybook example](storybook.clayui.com/?path=/story/components-claylabel--w-content-before) for a demo.
|
|
28
|
-
|
|
29
|
-
## Display Types
|
|
30
|
-
|
|
31
|
-
Using [`displayType`](#api-displayType) property you can use these color variations on Label component:
|
|
32
|
-
|
|
33
|
-
<LabelDisplayTypes />
|
|
34
|
-
|
|
35
|
-
## Closing Actions
|
|
36
|
-
|
|
37
|
-
<div class="clay-site-alert alert alert-warning">
|
|
38
|
-
This property is mandatory if you want make your label dismissible.
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
Use [`closeButtonProps`](#api-closeButtonProps) property for applying custom properties to the button that wraps the closing icon.
|
|
42
|
-
|
|
43
|
-
In this example, an Id was settled for the closing element:
|
|
44
|
-
|
|
45
|
-
<LabelClosingActions />
|
|
46
|
-
|
|
47
|
-
You can also set a state for the visibility of the ClayLabel for example, handling `onClick` property on the closing element.
|
|
48
|
-
|
|
49
|
-
<Label />
|