@spectrum-web-components/status-light 1.7.0-snapshot.20250519200040 → 1.7.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 +74 -21
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
##
|
1
|
+
## Overview
|
2
2
|
|
3
|
-
An `<sp-status-light>` is a great way to convey semantic meaning, such as statuses and categories.
|
3
|
+
An `<sp-status-light>` is a great way to convey semantic meaning, such as statuses and categories. It provides visual indicators through colored dots accompanied by descriptive text.
|
4
4
|
|
5
5
|
### Usage
|
6
6
|
|
7
7
|
[](https://www.npmjs.com/package/@spectrum-web-components/status-light)
|
8
8
|
[](https://bundlephobia.com/result?p=@spectrum-web-components/status-light)
|
9
|
-
[](https://stackblitz.com/edit/vitejs-vite-y2kz1rkx)
|
10
10
|
|
11
11
|
```
|
12
12
|
yarn add @spectrum-web-components/status-light
|
@@ -24,7 +24,17 @@ When looking to leverage the `StatusLight` base class as a type and/or for exten
|
|
24
24
|
import { StatusLight } from '@spectrum-web-components/status-light';
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
### Anatomy
|
28
|
+
|
29
|
+
A status light consists of a colored dot indicator and a required text label. The dot's color represents the status or category, while the text provides additional context.
|
30
|
+
|
31
|
+
```html
|
32
|
+
<sp-status-light variant="positive">approved</sp-status-light>
|
33
|
+
```
|
34
|
+
|
35
|
+
### Options
|
36
|
+
|
37
|
+
#### Sizes
|
28
38
|
|
29
39
|
<sp-tabs selected="m" auto label="Size Attribute Options">
|
30
40
|
<sp-tab value="s">Small</sp-tab>
|
@@ -61,27 +71,70 @@ import { StatusLight } from '@spectrum-web-components/status-light';
|
|
61
71
|
</sp-tab-panel>
|
62
72
|
</sp-tabs>
|
63
73
|
|
64
|
-
|
74
|
+
#### Variants
|
75
|
+
|
76
|
+
Status lights come in various semantic and non-semantic variants to convey different meanings. The `variant` attribute controls the main variant of the status light, with `neutral` being the default.
|
77
|
+
|
78
|
+
<sp-tabs selected="semantic" auto label="Variants">
|
79
|
+
<sp-tab value="semantic">Semantic</sp-tab>
|
80
|
+
<sp-tab-panel value="semantic">
|
81
|
+
|
82
|
+
```html
|
83
|
+
<sp-status-light variant="neutral">
|
84
|
+
use for default state
|
85
|
+
</sp-status-light>
|
86
|
+
<sp-status-light variant="positive">
|
87
|
+
use for success or approval
|
88
|
+
</sp-status-light>
|
89
|
+
<sp-status-light variant="negative">
|
90
|
+
use for error or rejection
|
91
|
+
</sp-status-light>
|
92
|
+
<sp-status-light variant="notice">
|
93
|
+
use for warning or attention needed
|
94
|
+
</sp-status-light>
|
95
|
+
<sp-status-light variant="info">
|
96
|
+
use for information or neutral state
|
97
|
+
</sp-status-light>
|
98
|
+
```
|
99
|
+
|
100
|
+
</sp-tab-panel>
|
101
|
+
<sp-tab value="non-semantic">Non-semantic</sp-tab>
|
102
|
+
<sp-tab-panel value="non-semantic">
|
103
|
+
|
104
|
+
```html
|
105
|
+
<sp-status-light variant="yellow">yellow status</sp-status-light>
|
106
|
+
<sp-status-light variant="fuchsia">fuchsia status</sp-status-light>
|
107
|
+
<sp-status-light variant="indigo">indigo status</sp-status-light>
|
108
|
+
<sp-status-light variant="seafoam">seafoam status</sp-status-light>
|
109
|
+
<sp-status-light variant="chartreuse">chartreuse status</sp-status-light>
|
110
|
+
<sp-status-light variant="magenta">magenta status</sp-status-light>
|
111
|
+
<sp-status-light variant="celery">celery status</sp-status-light>
|
112
|
+
<sp-status-light variant="purple">purple status</sp-status-light>
|
113
|
+
```
|
114
|
+
|
115
|
+
</sp-tab-panel>
|
116
|
+
</sp-tabs>
|
65
117
|
|
66
|
-
|
67
|
-
attribute controls the main variant of the status light, and `neutral` being the default. Following are the supported variants:
|
118
|
+
### States
|
68
119
|
|
69
|
-
|
70
|
-
- negative
|
71
|
-
- notice
|
72
|
-
- info
|
73
|
-
- neutral
|
74
|
-
- yellow
|
75
|
-
- fuchsia
|
76
|
-
- indigo
|
77
|
-
- seafoam
|
78
|
-
- chartreuse
|
79
|
-
- magenta
|
80
|
-
- celery
|
81
|
-
- purple
|
120
|
+
#### Disabled
|
82
121
|
|
83
|
-
|
122
|
+
A status light in a disabled state shows that a status exists, but is not available in that circumstance. This can be used to maintain layout continuity and communicate that a status may become available later.
|
84
123
|
|
85
124
|
```html
|
86
125
|
<sp-status-light variant="positive" disabled>disabled</sp-status-light>
|
87
126
|
```
|
127
|
+
|
128
|
+
### Accessibility
|
129
|
+
|
130
|
+
The status light component implements several accessibility features:
|
131
|
+
|
132
|
+
- **ARIA Support**: When disabled, the component automatically sets `aria-disabled="true"`.
|
133
|
+
- **Color Meaning**: Colors are used in combination with text labels to ensure that status information is not conveyed through color alone.
|
134
|
+
|
135
|
+
#### Best Practices
|
136
|
+
|
137
|
+
- Use semantic variants (`positive`, `negative`, `notice`, `info`, `neutral`) when the status has specific meaning
|
138
|
+
- Include a clear, descriptive text label that explains the status
|
139
|
+
- Consider the disabled state for statuses that exist but are temporarily unavailable
|
140
|
+
- Ensure sufficient color contrast between the status light and its background
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spectrum-web-components/status-light",
|
3
|
-
"version": "1.7.0
|
3
|
+
"version": "1.7.0",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -64,7 +64,7 @@
|
|
64
64
|
"css"
|
65
65
|
],
|
66
66
|
"dependencies": {
|
67
|
-
"@spectrum-web-components/base": "1.7.0
|
67
|
+
"@spectrum-web-components/base": "1.7.0"
|
68
68
|
},
|
69
69
|
"types": "./src/index.d.ts",
|
70
70
|
"customElements": "custom-elements.json",
|