@spectrum-web-components/meter 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.
Files changed (2) hide show
  1. package/README.md +74 -20
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,37 +1,62 @@
1
- ## Description
1
+ ## Overview
2
2
 
3
3
  An `<sp-meter>` is a visual representation of a quantity or achievement. The meter's progress is determined by user actions, rather than system actions.
4
4
 
5
- ### Installation
5
+ ### Usage
6
6
 
7
7
  [![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/meter?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/meter)
8
8
  [![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/meter?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/meter)
9
- [![Try it on webcomponents.dev](https://img.shields.io/badge/Try%20it%20on-webcomponents.dev-green?style=for-the-badge)](https://webcomponents.dev/edit/collection/fO75441E1Q5ZlI0e9pgq/NqxNiDV1LXR9zxzocoRh/src/index.ts)
9
+ [![Try it on Stackblitz](https://img.shields.io/badge/Try%20it%20on-Stackblitz-blue?style=for-the-badge)](https://stackblitz.com/edit/vitejs-vite-bccezzju)
10
10
 
11
- ```
11
+ ```bash
12
12
  yarn add @spectrum-web-components/meter
13
13
  ```
14
14
 
15
15
  Import the side-effectful registration of `<sp-meter>` via:
16
16
 
17
- ```
17
+ ```javascript
18
18
  import '@spectrum-web-components/meter/sp-meter.js';
19
19
  ```
20
20
 
21
21
  When looking to leverage the `Meter` base class as a type and/or for extension purposes, do so via:
22
22
 
23
- ```
23
+ ```javascript
24
24
  import { Meter } from '@spectrum-web-components/meter';
25
25
  ```
26
26
 
27
- ## Sizes
27
+ ### Anatomy
28
+
29
+ The meter consists of several key parts:
30
+
31
+ - A label that describes what is being measured
32
+ - A progress track showing the total possible range
33
+ - A fill bar indicating the current progress
34
+ - A percentage value showing the numeric progress
35
+
36
+ ```html
37
+ <sp-meter progress="71">Tasks Completed</sp-meter>
38
+ ```
39
+
40
+ #### Label
41
+
42
+ The label is the text that describes what is being measured. It can be provided either through the default slot or the `label` attribute.
43
+
44
+ ```html
45
+ <sp-meter progress="15">Course Progress</sp-meter>
46
+ <br />
47
+ <sp-meter progress="15" label="Course Progress"></sp-meter>
48
+ ```
49
+
50
+ ### Options
51
+
52
+ #### Sizes
28
53
 
29
54
  <sp-tabs selected="m" auto label="Size Attribute Options">
30
55
  <sp-tab value="s">Small</sp-tab>
31
56
  <sp-tab-panel value="s">
32
57
 
33
58
  ```html
34
- <sp-meter size="s" progress="71">Tasks Completed</sp-meter>
59
+ <sp-meter size="s" progress="25">Tasks Completed</sp-meter>
35
60
  ```
36
61
 
37
62
  </sp-tab-panel>
@@ -39,7 +64,7 @@ import { Meter } from '@spectrum-web-components/meter';
39
64
  <sp-tab-panel value="m">
40
65
 
41
66
  ```html
42
- <sp-meter size="m" progress="71">Tasks Completed</sp-meter>
67
+ <sp-meter size="m" progress="25">Tasks Completed</sp-meter>
43
68
  ```
44
69
 
45
70
  </sp-tab-panel>
@@ -47,7 +72,7 @@ import { Meter } from '@spectrum-web-components/meter';
47
72
  <sp-tab-panel value="l">
48
73
 
49
74
  ```html
50
- <sp-meter size="l" progress="71">Tasks Completed</sp-meter>
75
+ <sp-meter size="l" progress="25">Tasks Completed</sp-meter>
51
76
  ```
52
77
 
53
78
  </sp-tab-panel>
@@ -55,15 +80,19 @@ import { Meter } from '@spectrum-web-components/meter';
55
80
  <sp-tab-panel value="xl">
56
81
 
57
82
  ```html
58
- <sp-meter size="xl" progress="71">Tasks Completed</sp-meter>
83
+ <sp-meter size="xl" progress="25">Tasks Completed</sp-meter>
59
84
  ```
60
85
 
61
86
  </sp-tab-panel>
62
87
  </sp-tabs>
63
88
 
64
- ## Variants
89
+ #### Variants
90
+
91
+ The meter supports several variants to convey different semantic meanings:
65
92
 
66
- ### Informative
93
+ <sp-tabs selected="informative" auto label="Variant Options">
94
+ <sp-tab value="informative">Informative</sp-tab>
95
+ <sp-tab-panel value="informative">
67
96
 
68
97
  By default, the informative variant can be used to represent a neutral or non-semantic value, such as the number of tutorials completed.
69
98
 
@@ -71,16 +100,20 @@ By default, the informative variant can be used to represent a neutral or non-se
71
100
  <sp-meter progress="50">Storage Space</sp-meter>
72
101
  ```
73
102
 
74
- ### Positive
103
+ </sp-tab-panel>
104
+ <sp-tab value="positive">Positive</sp-tab>
105
+ <sp-tab-panel value="positive">
75
106
 
76
- The positive variant can be used to represent a positive semantic value, such as when theres a lot of space remaining.
107
+ The positive variant can be used to represent a positive semantic value, such as when there's a lot of space remaining.
77
108
  Use value `variant="positive"` to define a positive variant.
78
109
 
79
110
  ```html
80
111
  <sp-meter variant="positive" progress="50">Storage Space</sp-meter>
81
112
  ```
82
113
 
83
- ### Notice
114
+ </sp-tab-panel>
115
+ <sp-tab value="notice">Notice</sp-tab>
116
+ <sp-tab-panel value="notice">
84
117
 
85
118
  The notice variant can be used to warn users about a situation that may need to be addressed soon, such as when space remaining is becoming limited.
86
119
  Use value `variant="notice"` to define a notice variant.
@@ -89,7 +122,9 @@ Use value `variant="notice"` to define a notice variant.
89
122
  <sp-meter variant="notice" progress="73">Storage Space</sp-meter>
90
123
  ```
91
124
 
92
- ### Negative
125
+ </sp-tab-panel>
126
+ <sp-tab value="negative">Negative</sp-tab>
127
+ <sp-tab-panel value="negative">
93
128
 
94
129
  The negative variant can be used to warn users about a critical situation that needs their urgent attention, such as when space remaining is becoming very limited.
95
130
  Use value `variant="negative"` to define a negative variant.
@@ -98,10 +133,29 @@ Use value `variant="negative"` to define a negative variant.
98
133
  <sp-meter variant="negative" progress="92">Storage Space</sp-meter>
99
134
  ```
100
135
 
101
- ### Side Label
136
+ </sp-tab-panel>
137
+ </sp-tabs>
138
+
139
+ #### Label Position
102
140
 
103
- A meter can be delivered with its labeling displayed above its visual indicator or to either side. Use the boolean `[side-label]` attribute to define where this content should appear.
141
+ A meter can be delivered with its labeling displayed above its visual indicator or to either side. Use the boolean `side-label` attribute to define where this content should appear.
104
142
 
105
143
  ```html
106
- <sp-meter side-label>Side Label</sp-meter>
144
+ <sp-meter side-label progress="68">Side Label</sp-meter>
107
145
  ```
146
+
147
+ ### Accessibility
148
+
149
+ The `<sp-meter>` element is rendered with `role="meter progressbar"` to ensure proper semantics for assistive technologies. The current progress value is set as a percentager via the `progress` attribute and is exposed to assistive technology via `aria-valuenow`.
150
+
151
+ ```html
152
+ <sp-meter progress="71" label="Download Progress">Download Progress</sp-meter>
153
+ ```
154
+
155
+ #### Include a label
156
+
157
+ A meter is required to have either a visible text label or a `label` attribute.
158
+
159
+ #### Don't override color
160
+
161
+ The meter's variants provide semantic meaning through both color and ARIA attributes, ensuring that information is not conveyed through color alone. The progress track and fill maintain sufficient contrast for visibility.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/meter",
3
- "version": "1.7.0-snapshot.20250519200040",
3
+ "version": "1.7.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -65,10 +65,10 @@
65
65
  "css"
66
66
  ],
67
67
  "dependencies": {
68
- "@spectrum-web-components/base": "1.7.0-snapshot.20250519200040",
69
- "@spectrum-web-components/field-label": "1.7.0-snapshot.20250519200040",
70
- "@spectrum-web-components/reactive-controllers": "1.7.0-snapshot.20250519200040",
71
- "@spectrum-web-components/shared": "1.7.0-snapshot.20250519200040"
68
+ "@spectrum-web-components/base": "1.7.0",
69
+ "@spectrum-web-components/field-label": "1.7.0",
70
+ "@spectrum-web-components/reactive-controllers": "1.7.0",
71
+ "@spectrum-web-components/shared": "1.7.0"
72
72
  },
73
73
  "types": "./src/index.d.ts",
74
74
  "customElements": "custom-elements.json",