@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43
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/dist/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
- package/dist/app-shell.js +1 -1
- package/dist/attachment-TZykYNu5.js +300 -0
- package/dist/attachment.js +2 -2
- package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
- package/dist/avatar-group.js +1 -1
- package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
- package/dist/command-palette.js +1 -1
- package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
- package/dist/data-list.js +1 -1
- package/dist/detail-panel-Cke3ZFU3.js +342 -0
- package/dist/detail-panel.js +2 -2
- package/dist/docs/action-bar.examples.md +768 -0
- package/dist/docs/action-bar.json +74 -50
- package/dist/docs/action-bar.md +49 -311
- package/dist/docs/app-shell.examples.md +1221 -64
- package/dist/docs/app-shell.json +92 -60
- package/dist/docs/app-shell.md +92 -57
- package/dist/docs/attachment.examples.md +689 -0
- package/dist/docs/attachment.json +69 -37
- package/dist/docs/attachment.md +44 -203
- package/dist/docs/avatar-group.json +111 -23
- package/dist/docs/avatar-group.md +487 -28
- package/dist/docs/button-group.json +98 -2
- package/dist/docs/button-group.md +411 -8
- package/dist/docs/calendar.examples.md +512 -0
- package/dist/docs/calendar.json +72 -24
- package/dist/docs/calendar.md +18 -147
- package/dist/docs/carousel.examples.md +868 -0
- package/dist/docs/carousel.json +58 -50
- package/dist/docs/carousel.md +66 -300
- package/dist/docs/cascader.examples.md +1269 -0
- package/dist/docs/cascader.json +72 -16
- package/dist/docs/cascader.md +78 -154
- package/dist/docs/chart.examples.md +734 -24
- package/dist/docs/chart.json +93 -13
- package/dist/docs/chart.md +28 -7
- package/dist/docs/clock.json +71 -15
- package/dist/docs/clock.md +326 -21
- package/dist/docs/code-block.json +79 -55
- package/dist/docs/code-block.md +417 -74
- package/dist/docs/color-picker.json +60 -12
- package/dist/docs/color-picker.md +245 -22
- package/dist/docs/column-manager.examples.md +764 -0
- package/dist/docs/column-manager.json +68 -12
- package/dist/docs/column-manager.md +44 -203
- package/dist/docs/command-palette.examples.md +747 -0
- package/dist/docs/command-palette.json +48 -24
- package/dist/docs/command-palette.md +60 -339
- package/dist/docs/currency-field.examples.md +355 -73
- package/dist/docs/currency-field.json +96 -64
- package/dist/docs/currency-field.md +57 -50
- package/dist/docs/dashboard-grid.examples.md +629 -0
- package/dist/docs/dashboard-grid.json +64 -16
- package/dist/docs/dashboard-grid.md +34 -152
- package/dist/docs/data-list.examples.md +1556 -0
- package/dist/docs/data-list.json +58 -18
- package/dist/docs/data-list.md +139 -224
- package/dist/docs/date-field.examples.md +543 -0
- package/dist/docs/date-field.json +64 -24
- package/dist/docs/date-field.md +22 -168
- package/dist/docs/datetime-field.examples.md +699 -0
- package/dist/docs/datetime-field.json +79 -31
- package/dist/docs/datetime-field.md +24 -269
- package/dist/docs/datetime-range-picker.examples.md +682 -0
- package/dist/docs/datetime-range-picker.json +117 -61
- package/dist/docs/datetime-range-picker.md +59 -224
- package/dist/docs/description-list.examples.md +652 -0
- package/dist/docs/description-list.json +49 -25
- package/dist/docs/description-list.md +33 -188
- package/dist/docs/detail-panel.examples.md +1177 -0
- package/dist/docs/detail-panel.json +69 -53
- package/dist/docs/detail-panel.md +114 -324
- package/dist/docs/entity-picker.examples.md +1037 -0
- package/dist/docs/entity-picker.json +66 -18
- package/dist/docs/entity-picker.md +56 -246
- package/dist/docs/event-calendar.examples.md +749 -49
- package/dist/docs/event-calendar.json +46 -22
- package/dist/docs/event-calendar.md +81 -11
- package/dist/docs/field-group.examples.md +554 -0
- package/dist/docs/field-group.json +98 -34
- package/dist/docs/field-group.md +55 -133
- package/dist/docs/filter-bar.examples.md +772 -0
- package/dist/docs/filter-bar.json +41 -25
- package/dist/docs/filter-bar.md +42 -246
- package/dist/docs/form.examples.md +579 -0
- package/dist/docs/form.json +87 -39
- package/dist/docs/form.md +53 -177
- package/dist/docs/fullscreen.examples.md +558 -0
- package/dist/docs/fullscreen.json +58 -18
- package/dist/docs/fullscreen.md +50 -169
- package/dist/docs/highlight.json +57 -25
- package/dist/docs/highlight.md +402 -50
- package/dist/docs/icon.json +85 -5
- package/dist/docs/icon.md +401 -10
- package/dist/docs/image.examples.md +670 -0
- package/dist/docs/image.json +44 -28
- package/dist/docs/image.md +24 -176
- package/dist/docs/import-export-center.examples.md +1280 -0
- package/dist/docs/import-export-center.json +67 -27
- package/dist/docs/import-export-center.md +121 -226
- package/dist/docs/list-item.examples.md +769 -0
- package/dist/docs/list-item.json +110 -38
- package/dist/docs/list-item.md +84 -201
- package/dist/docs/listbox.examples.md +858 -0
- package/dist/docs/listbox.json +76 -28
- package/dist/docs/listbox.md +41 -263
- package/dist/docs/markdown.json +79 -55
- package/dist/docs/markdown.md +581 -85
- package/dist/docs/media-viewer.examples.md +1038 -0
- package/dist/docs/media-viewer.json +70 -15
- package/dist/docs/media-viewer.md +84 -135
- package/dist/docs/message-scroller.examples.md +1193 -0
- package/dist/docs/message-scroller.json +41 -17
- package/dist/docs/message-scroller.md +80 -134
- package/dist/docs/message.examples.md +944 -0
- package/dist/docs/message.json +64 -16
- package/dist/docs/message.md +34 -326
- package/dist/docs/meter.json +58 -26
- package/dist/docs/meter.md +312 -32
- package/dist/docs/navigation-menu.examples.md +1107 -0
- package/dist/docs/navigation-menu.json +57 -41
- package/dist/docs/navigation-menu.md +105 -298
- package/dist/docs/notification-center.examples.md +1045 -0
- package/dist/docs/notification-center.json +71 -15
- package/dist/docs/notification-center.md +76 -266
- package/dist/docs/otp-input.examples.md +490 -0
- package/dist/docs/otp-input.json +65 -25
- package/dist/docs/otp-input.md +20 -191
- package/dist/docs/page-header.examples.md +1041 -0
- package/dist/docs/page-header.json +75 -43
- package/dist/docs/page-header.md +79 -291
- package/dist/docs/page.examples.md +633 -0
- package/dist/docs/page.json +48 -16
- package/dist/docs/page.md +62 -129
- package/dist/docs/prompt-composer.examples.md +630 -0
- package/dist/docs/prompt-composer.json +66 -18
- package/dist/docs/prompt-composer.md +35 -161
- package/dist/docs/prose.json +69 -37
- package/dist/docs/prose.md +393 -75
- package/dist/docs/rating.examples.md +525 -0
- package/dist/docs/rating.json +92 -28
- package/dist/docs/rating.md +27 -241
- package/dist/docs/saved-views.examples.md +1108 -0
- package/dist/docs/saved-views.json +53 -21
- package/dist/docs/saved-views.md +86 -171
- package/dist/docs/scroll-area.examples.md +837 -0
- package/dist/docs/scroll-area.json +64 -24
- package/dist/docs/scroll-area.md +57 -140
- package/dist/docs/section.examples.md +676 -0
- package/dist/docs/section.json +68 -20
- package/dist/docs/section.md +39 -162
- package/dist/docs/segmented-control.examples.md +480 -0
- package/dist/docs/segmented-control.json +76 -28
- package/dist/docs/segmented-control.md +20 -191
- package/dist/docs/side-navigation.examples.md +1468 -0
- package/dist/docs/side-navigation.json +53 -53
- package/dist/docs/side-navigation.md +79 -354
- package/dist/docs/slider.examples.md +505 -0
- package/dist/docs/slider.json +91 -51
- package/dist/docs/slider.md +47 -212
- package/dist/docs/sparkline.json +60 -36
- package/dist/docs/sparkline.md +447 -71
- package/dist/docs/split-button.examples.md +509 -0
- package/dist/docs/split-button.json +73 -41
- package/dist/docs/split-button.md +64 -194
- package/dist/docs/splitter.examples.md +921 -0
- package/dist/docs/splitter.json +94 -46
- package/dist/docs/splitter.md +75 -182
- package/dist/docs/stat-card.examples.md +725 -0
- package/dist/docs/stat-card.json +89 -41
- package/dist/docs/stat-card.md +55 -227
- package/dist/docs/status-indicator.json +80 -32
- package/dist/docs/status-indicator.md +409 -65
- package/dist/docs/stepper.json +53 -21
- package/dist/docs/stepper.md +369 -48
- package/dist/docs/table-of-contents.examples.md +550 -0
- package/dist/docs/table-of-contents.json +60 -28
- package/dist/docs/table-of-contents.md +70 -205
- package/dist/docs/tags-input.examples.md +541 -0
- package/dist/docs/tags-input.json +64 -16
- package/dist/docs/tags-input.md +15 -262
- package/dist/docs/time-field.examples.md +587 -0
- package/dist/docs/time-field.json +69 -29
- package/dist/docs/time-field.md +21 -223
- package/dist/docs/time-picker.json +117 -53
- package/dist/docs/time-picker.md +499 -54
- package/dist/docs/time-range-picker.examples.md +750 -0
- package/dist/docs/time-range-picker.json +139 -75
- package/dist/docs/time-range-picker.md +63 -225
- package/dist/docs/timeline.examples.md +617 -0
- package/dist/docs/timeline.json +44 -28
- package/dist/docs/timeline.md +34 -208
- package/dist/docs/toolbar.json +56 -16
- package/dist/docs/toolbar.md +357 -63
- package/dist/docs/top-navigation.examples.md +1206 -140
- package/dist/docs/top-navigation.json +49 -33
- package/dist/docs/top-navigation.md +87 -36
- package/dist/docs/tour.examples.md +960 -0
- package/dist/docs/tour.json +57 -25
- package/dist/docs/tour.md +60 -244
- package/dist/docs/transfer.examples.md +631 -0
- package/dist/docs/transfer.json +80 -16
- package/dist/docs/transfer.md +41 -170
- package/dist/docs/typography.json +96 -0
- package/dist/docs/typography.md +352 -4
- package/dist/docs/upload.examples.md +555 -53
- package/dist/docs/upload.json +62 -30
- package/dist/docs/upload.md +46 -11
- package/dist/docs/wizard.examples.md +1389 -0
- package/dist/docs/wizard.json +89 -49
- package/dist/docs/wizard.md +122 -263
- package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +58 -58
- package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
- package/dist/markdown.js +1 -1
- package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
- package/dist/media-viewer.js +2 -2
- package/dist/message-P91bEGyV.js +455 -0
- package/dist/message.js +2 -2
- package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
- package/dist/page-header.js +1 -1
- package/dist/section-CVTQdWBl.js +216 -0
- package/dist/section.js +2 -2
- package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
- package/dist/side-navigation.js +1 -1
- package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
- package/dist/stat-card.js +1 -1
- package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
- package/dist/stepper.js +2 -2
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
- package/dist/timeline.js +1 -1
- package/dist/top-navigation-YSEQzBhD.js +744 -0
- package/dist/top-navigation.js +2 -2
- package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
- package/dist/transfer.js +1 -1
- package/dist/types/attachment/attachment-parts.d.ts +24 -11
- package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
- package/dist/types/attachment/attachment.d.ts +3 -3
- package/dist/types/attachment/attachment.d.ts.map +1 -1
- package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/types/carousel/carousel-parts.d.ts +2 -2
- package/dist/types/command-palette/command-palette.d.ts.map +1 -1
- package/dist/types/data-list/data-list.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
- package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
- package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
- package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
- package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
- package/dist/types/media-viewer/index.d.ts +2 -2
- package/dist/types/media-viewer/index.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
- package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
- package/dist/types/message/message-parts.d.ts +7 -0
- package/dist/types/message/message-parts.d.ts.map +1 -1
- package/dist/types/message/message.d.ts.map +1 -1
- package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
- package/dist/types/section/section-parts.d.ts +16 -8
- package/dist/types/section/section-parts.d.ts.map +1 -1
- package/dist/types/section/section.d.ts.map +1 -1
- package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
- package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
- package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper-parts.d.ts +11 -2
- package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper.d.ts.map +1 -1
- package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
- package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
- package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/attachment-MqczA38F.js +0 -292
- package/dist/detail-panel-EImAtksY.js +0 -327
- package/dist/message-D1Dd6Y2k.js +0 -452
- package/dist/section-D_qOfdxR.js +0 -213
- package/dist/top-navigation-D8IHPOmm.js +0 -744
package/dist/docs/meter.json
CHANGED
|
@@ -79,90 +79,90 @@
|
|
|
79
79
|
"type": "number",
|
|
80
80
|
"defaultValue": "—",
|
|
81
81
|
"appliesTo": "Meter",
|
|
82
|
-
"description": "The reading. A value outside the range is drawn at its end"
|
|
82
|
+
"description": "The reading. A value outside the range is drawn at its end."
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"name": "min",
|
|
86
86
|
"type": "number",
|
|
87
87
|
"defaultValue": "0",
|
|
88
88
|
"appliesTo": "Meter",
|
|
89
|
-
"description": "The start of the range"
|
|
89
|
+
"description": "The start of the range."
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
"name": "max",
|
|
93
93
|
"type": "number",
|
|
94
94
|
"defaultValue": "100",
|
|
95
95
|
"appliesTo": "Meter",
|
|
96
|
-
"description": "The end of the range"
|
|
96
|
+
"description": "The end of the range."
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "low, high, optimum",
|
|
100
100
|
"type": "number",
|
|
101
101
|
"defaultValue": "—",
|
|
102
102
|
"appliesTo": "Meter",
|
|
103
|
-
"description": "The marks that split the range into regions; with any of them the region the value falls in picks the tone"
|
|
103
|
+
"description": "The marks that split the range into regions; with any of them the region the value falls in picks the tone."
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"name": "tone",
|
|
107
107
|
"type": "'accent' | 'secondary' | 'neutral' | 'info' | 'success' | 'warning' | 'danger'",
|
|
108
108
|
"defaultValue": "accent",
|
|
109
109
|
"appliesTo": "Meter",
|
|
110
|
-
"description": "The ink of the indicator. Wins over the regions"
|
|
110
|
+
"description": "The ink of the indicator. Wins over the regions."
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"name": "size",
|
|
114
114
|
"type": "'sm' | 'md' | 'lg'",
|
|
115
115
|
"defaultValue": "md",
|
|
116
116
|
"appliesTo": "Meter",
|
|
117
|
-
"description": "The thickness of the track"
|
|
117
|
+
"description": "The thickness of the track."
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
"name": "decorative",
|
|
121
121
|
"type": "boolean",
|
|
122
122
|
"defaultValue": "false",
|
|
123
123
|
"appliesTo": "Meter",
|
|
124
|
-
"description": "No role and aria-hidden, for a meter beside words that state its value"
|
|
124
|
+
"description": "No role and aria-hidden, for a meter beside words that state its value."
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
"name": "valueText",
|
|
128
128
|
"type": "string",
|
|
129
129
|
"defaultValue": "—",
|
|
130
130
|
"appliesTo": "Meter",
|
|
131
|
-
"description": "The whole aria-valuetext, replacing the share"
|
|
131
|
+
"description": "The whole aria-valuetext, replacing the share."
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
"name": "formatOptions",
|
|
135
135
|
"type": "Intl.NumberFormatOptions",
|
|
136
|
-
"defaultValue": "{ style: 'percent' }",
|
|
136
|
+
"defaultValue": "{ style: 'percent', maximumFractionDigits: 2 }",
|
|
137
137
|
"appliesTo": "Meter",
|
|
138
|
-
"description": "How the share is written in aria-valuetext"
|
|
138
|
+
"description": "How the share is written in aria-valuetext."
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
"name": "locale",
|
|
142
142
|
"type": "string",
|
|
143
143
|
"defaultValue": "—",
|
|
144
144
|
"appliesTo": "Meter",
|
|
145
|
-
"description": "The locale of the share; the language in force when absent"
|
|
145
|
+
"description": "The locale of the share; the language in force when absent."
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
"name": "render",
|
|
149
149
|
"type": "(props: MeterRootProps) => ReactNode",
|
|
150
150
|
"defaultValue": "—",
|
|
151
151
|
"appliesTo": "Meter",
|
|
152
|
-
"description": "Substitutes the root element"
|
|
152
|
+
"description": "Substitutes the root element."
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
"name": "MeterDefaultsProvider",
|
|
156
156
|
"type": "MeterDefaults",
|
|
157
157
|
"defaultValue": "—",
|
|
158
158
|
"appliesTo": "Application",
|
|
159
|
-
"description": "Sets size and formatOptions once for everything below it; a prop still wins"
|
|
159
|
+
"description": "Sets size and formatOptions once for everything below it; a prop still wins."
|
|
160
160
|
}
|
|
161
161
|
],
|
|
162
162
|
"composition": [],
|
|
163
163
|
"events": [],
|
|
164
164
|
"accessibility": [
|
|
165
|
-
"The root carries role=\"meter\", the role the APG and the HTML meter element give a static value in a range. A progressbar announces a task under way, and a page that drew a share with one read as still loading to a screen reader
|
|
165
|
+
"The root carries role=\"meter\", the role the APG and the HTML meter element give a static value in a range. A progressbar announces a task under way, and a page that drew a share with one read as still loading to a screen reader.",
|
|
166
166
|
"aria-valuenow, aria-valuemin and aria-valuemax state the reading; aria-valuetext states the share in the locale of the language in force, because 4380 out of 10000 is heard as 43.8% rather than as four thousand three hundred and eighty.",
|
|
167
167
|
"The meter needs a name: aria-label or aria-labelledby, which pass through to the root.",
|
|
168
168
|
"decorative removes the role and hides the root, for a meter whose value is written beside it: the reader hears the number once.",
|
|
@@ -205,42 +205,74 @@
|
|
|
205
205
|
{
|
|
206
206
|
"id": "tones",
|
|
207
207
|
"title": "What the reading means",
|
|
208
|
-
"note": "A tone paints the indicator in
|
|
208
|
+
"note": "A tone paints the indicator in its ink over a ground mixed from the same ink, so a pale track never reads as a filled one. secondary and neutral take the strong border step.",
|
|
209
209
|
"language": "tsx",
|
|
210
|
-
"source": "
|
|
211
|
-
"verdict": "
|
|
210
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst READINGS = [\n { tone: 'accent', label: 'Orders picked', value: 74 },\n { tone: 'secondary', label: 'Returns processed', value: 52 },\n { tone: 'neutral', label: 'Draft invoices reviewed', value: 38 },\n { tone: 'info', label: 'Inbound containers unloaded', value: 61 },\n { tone: 'success', label: 'Carrier on-time rate', value: 94 },\n { tone: 'warning', label: 'Quarterly budget used', value: 82 },\n { tone: 'danger', label: 'Backorder limit reached', value: 97 },\n] as const;\n\nexport default function MeterTones() {\n return (\n <Stack gap={4}>\n {READINGS.map(({ label, tone, value }) => (\n <Stack gap={1} key={tone}>\n <Text size=\"sm\">\n {label}, {tone}\n </Text>\n <Meter aria-label={label} tone={tone} value={value} />\n </Stack>\n ))}\n </Stack>\n );\n}\n",
|
|
211
|
+
"verdict": "example"
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
"id": "sizes",
|
|
215
215
|
"title": "Three thicknesses, and the length is the container’s",
|
|
216
216
|
"note": "sm is four pixels for a dense row, md six for a card, lg eight for a summary that leads a page. The length is always what the cell or the column gave, never less than 4rem.",
|
|
217
217
|
"language": "tsx",
|
|
218
|
-
"source": "
|
|
219
|
-
"verdict": "
|
|
218
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst SIZES = [\n { size: 'sm', label: 'Pick accuracy, sm', value: 35 },\n { size: 'md', label: 'Dock utilization, md', value: 58 },\n { size: 'lg', label: 'Quarterly fill rate, lg', value: 72 },\n] as const;\n\nexport default function MeterSizes() {\n return (\n <Stack gap={4}>\n {SIZES.map(({ label, size, value }) => (\n <Stack gap={1} key={size}>\n <Text size=\"sm\">{label}</Text>\n <Meter aria-label={label} size={size} value={value} />\n </Stack>\n ))}\n </Stack>\n );\n}\n",
|
|
219
|
+
"verdict": "example"
|
|
220
220
|
},
|
|
221
221
|
{
|
|
222
222
|
"id": "regions",
|
|
223
223
|
"title": "Regions that pick the tone",
|
|
224
|
-
"note": "low, high and optimum split the range as the HTML meter element does: a disk with optimum at
|
|
224
|
+
"note": "low, high and optimum split the range as the HTML meter element does: a disk with optimum at 0 is success below 60%, warning up to 85% and danger past it. A stated tone wins.",
|
|
225
225
|
"language": "tsx",
|
|
226
|
-
"source": "<Meter aria-label
|
|
227
|
-
"verdict": "
|
|
226
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst VOLUMES = [\n { name: 'Archive', used: 41 },\n { name: 'Orders database', used: 72 },\n { name: 'Application logs', used: 93 },\n] as const;\n\nexport default function MeterRegions() {\n return (\n <Stack gap={4}>\n {VOLUMES.map(({ name, used }) => (\n <Stack gap={1} key={name}>\n <Text size=\"sm\">\n {name}, {used}% used\n </Text>\n <Meter aria-label={`${name} disk usage`} high={85} low={60} optimum={0} value={used} />\n </Stack>\n ))}\n <Stack gap={1}>\n <Text size=\"sm\">Scratch space, 93% used, tone info</Text>\n <Meter\n aria-label=\"Scratch space disk usage\"\n high={85}\n low={60}\n optimum={0}\n tone=\"info\"\n value={93}\n />\n </Stack>\n </Stack>\n );\n}\n",
|
|
227
|
+
"verdict": "example"
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
230
|
"id": "in-table",
|
|
231
231
|
"title": "A share column",
|
|
232
232
|
"note": "The meter’s home: a decorative bar in the column after the exact percentage, filling the cell of an auto-layout table, so a reader hears the number once and sees the proportion beside it.",
|
|
233
233
|
"language": "tsx",
|
|
234
|
-
"source": "<TableCell numeric>
|
|
235
|
-
"verdict": "
|
|
234
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableColumnHeader,\n TableContent,\n TableHead,\n TableRow,\n TableRowHeader,\n} from '@slotted/react/table';\n\nconst WAREHOUSES = [\n { name: 'Reno', used: 68 },\n { name: 'Columbus', used: 91 },\n { name: 'Savannah', used: 45 },\n { name: 'Memphis', used: 23 },\n] as const;\n\nexport default function MeterInTable() {\n return (\n <Table columns={3}>\n <TableContent>\n <TableCaption>Warehouse capacity in use</TableCaption>\n <TableHead>\n <TableRow>\n <TableColumnHeader>Warehouse</TableColumnHeader>\n <TableColumnHeader numeric>Used</TableColumnHeader>\n <TableColumnHeader>Proportion</TableColumnHeader>\n </TableRow>\n </TableHead>\n <TableBody>\n {WAREHOUSES.map(({ name, used }) => (\n <TableRow key={name}>\n <TableRowHeader>{name}</TableRowHeader>\n <TableCell numeric>{used}%</TableCell>\n <TableCell>\n <Meter decorative value={used} />\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </TableContent>\n </Table>\n );\n}\n",
|
|
235
|
+
"verdict": "example"
|
|
236
236
|
},
|
|
237
237
|
{
|
|
238
238
|
"id": "accessibility",
|
|
239
239
|
"title": "What a reader hears",
|
|
240
240
|
"note": "The root is a meter named by its aria-label, read as “Fixed income, meter, 43.8%”: the share in the locale of the language in force, or the valueText given in its place.",
|
|
241
241
|
"language": "tsx",
|
|
242
|
-
"source": "<Meter aria-label=\"Used storage\" max={5} value={3} valueText=\"3 of 5 GB\"
|
|
243
|
-
"verdict": "
|
|
242
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst WHOLE_PERCENT = { maximumFractionDigits: 0, style: 'percent' } as const;\n\nexport default function MeterAccessibility() {\n return (\n <Stack gap={4}>\n <Stack gap={1}>\n <Text size=\"sm\">Fixed income, read as 43.8%</Text>\n <Meter aria-label=\"Fixed income\" max={10000} value={4380} />\n </Stack>\n <Stack gap={1}>\n <Text size=\"sm\">Used storage, read as 3 of 5 GB</Text>\n <Meter aria-label=\"Used storage\" max={5} value={3} valueText=\"3 of 5 GB\" />\n </Stack>\n <Stack gap={1}>\n <Text size=\"sm\">Fixed income in pt-BR, read with a decimal comma</Text>\n <Meter aria-label=\"Fixed income in pt-BR\" locale=\"pt-BR\" max={10000} value={4380} />\n </Stack>\n <Stack gap={1}>\n <Text size=\"sm\">Equities, read as 31%</Text>\n <Meter aria-label=\"Equities\" formatOptions={WHOLE_PERCENT} max={10000} value={3120} />\n </Stack>\n </Stack>\n );\n}\n",
|
|
243
|
+
"verdict": "example"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"id": "basic",
|
|
247
|
+
"title": "basic.tsx",
|
|
248
|
+
"note": null,
|
|
249
|
+
"language": "tsx",
|
|
250
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nexport default function MeterBasic() {\n return (\n <Stack gap={2}>\n <Text>Reno warehouse capacity</Text>\n <Meter aria-label=\"Reno warehouse capacity\" max={2400} value={1632} />\n <Text size=\"sm\" tone=\"muted\">\n 1,632 of 2,400 pallet positions in use.\n </Text>\n </Stack>\n );\n}\n",
|
|
251
|
+
"verdict": "example"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"id": "defaults",
|
|
255
|
+
"title": "defaults.tsx",
|
|
256
|
+
"note": null,
|
|
257
|
+
"language": "tsx",
|
|
258
|
+
"source": "import { Meter, MeterDefaultsProvider } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nexport default function MeterDefaultsExample() {\n return (\n <MeterDefaultsProvider size=\"lg\">\n <Stack gap={4}>\n <Stack gap={1}>\n <Text size=\"sm\">Pick rate, lg from the provider</Text>\n <Meter aria-label=\"Pick rate\" value={64} />\n </Stack>\n <Stack gap={1}>\n <Text size=\"sm\">Pack rate, lg from the provider</Text>\n <Meter aria-label=\"Pack rate\" value={81} />\n </Stack>\n <Stack gap={1}>\n <Text size=\"sm\">Ship rate, sm stated on the meter</Text>\n <Meter aria-label=\"Ship rate\" size=\"sm\" value={47} />\n </Stack>\n </Stack>\n </MeterDefaultsProvider>\n );\n}\n",
|
|
259
|
+
"verdict": "example"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"id": "optimum",
|
|
263
|
+
"title": "optimum.tsx",
|
|
264
|
+
"note": null,
|
|
265
|
+
"language": "tsx",
|
|
266
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst SUPPLIES = [\n { name: 'Pallet wrap', level: 80 },\n { name: 'Shipping labels', level: 45 },\n { name: 'Packing tape', level: 15 },\n] as const;\n\nexport default function MeterOptimum() {\n return (\n <Stack gap={4}>\n {SUPPLIES.map(({ level, name }) => (\n <Stack gap={1} key={name}>\n <Text size=\"sm\">\n {name}, {level}% of the bin\n </Text>\n <Meter\n aria-label={`${name} stock level`}\n high={60}\n low={25}\n optimum={100}\n value={level}\n />\n </Stack>\n ))}\n </Stack>\n );\n}\n",
|
|
267
|
+
"verdict": "example"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "range",
|
|
271
|
+
"title": "range.tsx",
|
|
272
|
+
"note": null,
|
|
273
|
+
"language": "tsx",
|
|
274
|
+
"source": "import { Meter } from '@slotted/react/meter';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nexport default function MeterRange() {\n return (\n <Stack gap={5}>\n <Stack gap={1}>\n <Text>Truck 14 load</Text>\n <Meter aria-label=\"Truck 14 load\" max={24} value={18} />\n <Text size=\"sm\" tone=\"muted\">\n 18 of 24 pallets.\n </Text>\n </Stack>\n <Stack gap={1}>\n <Text>Cold room 3 temperature</Text>\n <Meter aria-label=\"Cold room 3 temperature\" max={0} min={-25} value={-18} />\n <Text size=\"sm\" tone=\"muted\">\n -18 °C on a scale from -25 °C to 0 °C.\n </Text>\n </Stack>\n <Stack gap={1}>\n <Text>Returns bay overflow</Text>\n <Meter aria-label=\"Returns bay overflow\" max={40} value={46} />\n <Text size=\"sm\" tone=\"muted\">\n 46 of 40 positions. A value past the range is drawn at its end.\n </Text>\n </Stack>\n </Stack>\n );\n}\n",
|
|
275
|
+
"verdict": "example"
|
|
244
276
|
}
|
|
245
277
|
]
|
|
246
278
|
}
|
package/dist/docs/meter.md
CHANGED
|
@@ -11,10 +11,24 @@ import { Meter, MeterDefaultsProvider } from '@slotted/react';
|
|
|
11
11
|
|
|
12
12
|
## Minimal example
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Example
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
|
-
|
|
17
|
+
import { Meter } from '@slotted/react/meter';
|
|
18
|
+
import { Stack } from '@slotted/react/stack';
|
|
19
|
+
import { Text } from '@slotted/react/typography';
|
|
20
|
+
|
|
21
|
+
export default function MeterBasic() {
|
|
22
|
+
return (
|
|
23
|
+
<Stack gap={2}>
|
|
24
|
+
<Text>Reno warehouse capacity</Text>
|
|
25
|
+
<Meter aria-label="Reno warehouse capacity" max={2400} value={1632} />
|
|
26
|
+
<Text size="sm" tone="muted">
|
|
27
|
+
1,632 of 2,400 pallet positions in use.
|
|
28
|
+
</Text>
|
|
29
|
+
</Stack>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
18
32
|
```
|
|
19
33
|
|
|
20
34
|
## Anatomy
|
|
@@ -29,18 +43,18 @@ Excerpt — not a complete module
|
|
|
29
43
|
|
|
30
44
|
| Name | Type | Default | Applies to | Description |
|
|
31
45
|
| --- | --- | --- | --- | --- |
|
|
32
|
-
| `value` | `number` | — | Meter | The reading. A value outside the range is drawn at its end |
|
|
33
|
-
| `min` | `number` | 0 | Meter | The start of the range |
|
|
34
|
-
| `max` | `number` | 100 | Meter | The end of the range |
|
|
35
|
-
| `low, high, optimum` | `number` | — | Meter | The marks that split the range into regions; with any of them the region the value falls in picks the tone |
|
|
36
|
-
| `tone` | `'accent' \| 'secondary' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'danger'` | accent | Meter | The ink of the indicator. Wins over the regions |
|
|
37
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | md | Meter | The thickness of the track |
|
|
38
|
-
| `decorative` | `boolean` | false | Meter | No role and aria-hidden, for a meter beside words that state its value |
|
|
39
|
-
| `valueText` | `string` | — | Meter | The whole aria-valuetext, replacing the share |
|
|
40
|
-
| `formatOptions` | `Intl.NumberFormatOptions` | { style: 'percent' } | Meter | How the share is written in aria-valuetext |
|
|
41
|
-
| `locale` | `string` | — | Meter | The locale of the share; the language in force when absent |
|
|
42
|
-
| `render` | `(props: MeterRootProps) => ReactNode` | — | Meter | Substitutes the root element |
|
|
43
|
-
| `MeterDefaultsProvider` | `MeterDefaults` | — | Application | Sets size and formatOptions once for everything below it; a prop still wins |
|
|
46
|
+
| `value` | `number` | — | Meter | The reading. A value outside the range is drawn at its end. |
|
|
47
|
+
| `min` | `number` | 0 | Meter | The start of the range. |
|
|
48
|
+
| `max` | `number` | 100 | Meter | The end of the range. |
|
|
49
|
+
| `low, high, optimum` | `number` | — | Meter | The marks that split the range into regions; with any of them the region the value falls in picks the tone. |
|
|
50
|
+
| `tone` | `'accent' \| 'secondary' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'danger'` | accent | Meter | The ink of the indicator. Wins over the regions. |
|
|
51
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | md | Meter | The thickness of the track. |
|
|
52
|
+
| `decorative` | `boolean` | false | Meter | No role and aria-hidden, for a meter beside words that state its value. |
|
|
53
|
+
| `valueText` | `string` | — | Meter | The whole aria-valuetext, replacing the share. |
|
|
54
|
+
| `formatOptions` | `Intl.NumberFormatOptions` | { style: 'percent', maximumFractionDigits: 2 } | Meter | How the share is written in aria-valuetext. |
|
|
55
|
+
| `locale` | `string` | — | Meter | The locale of the share; the language in force when absent. |
|
|
56
|
+
| `render` | `(props: MeterRootProps) => ReactNode` | — | Meter | Substitutes the root element. |
|
|
57
|
+
| `MeterDefaultsProvider` | `MeterDefaults` | — | Application | Sets size and formatOptions once for everything below it; a prop still wins. |
|
|
44
58
|
|
|
45
59
|
## Axes and defaults
|
|
46
60
|
|
|
@@ -51,7 +65,7 @@ Excerpt — not a complete module
|
|
|
51
65
|
|
|
52
66
|
## Rules
|
|
53
67
|
|
|
54
|
-
- The root carries role="meter", the role the APG and the HTML meter element give a static value in a range. A progressbar announces a task under way, and a page that drew a share with one read as still loading to a screen reader
|
|
68
|
+
- The root carries role="meter", the role the APG and the HTML meter element give a static value in a range. A progressbar announces a task under way, and a page that drew a share with one read as still loading to a screen reader.
|
|
55
69
|
- aria-valuenow, aria-valuemin and aria-valuemax state the reading; aria-valuetext states the share in the locale of the language in force, because 4380 out of 10000 is heard as 43.8% rather than as four thousand three hundred and eighty.
|
|
56
70
|
- The meter needs a name: aria-label or aria-labelledby, which pass through to the root.
|
|
57
71
|
- decorative removes the role and hides the root, for a meter whose value is written beside it: the reader hears the number once.
|
|
@@ -63,57 +77,323 @@ Excerpt — not a complete module
|
|
|
63
77
|
|
|
64
78
|
## Examples
|
|
65
79
|
|
|
66
|
-
###
|
|
80
|
+
### Playground
|
|
67
81
|
|
|
68
|
-
|
|
82
|
+
One reading against its range: change the value, the range and the size, and inspect the root for the value text a screen reader hears.
|
|
69
83
|
|
|
70
84
|
Excerpt — not a complete module
|
|
71
85
|
|
|
72
86
|
```tsx
|
|
73
|
-
<Meter aria-label="
|
|
74
|
-
|
|
87
|
+
<Meter aria-label="Share of the total" value={41} />;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### What the reading means
|
|
91
|
+
|
|
92
|
+
A tone paints the indicator in its ink over a ground mixed from the same ink, so a pale track never reads as a filled one. secondary and neutral take the strong border step.
|
|
93
|
+
|
|
94
|
+
Example
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { Meter } from '@slotted/react/meter';
|
|
98
|
+
import { Stack } from '@slotted/react/stack';
|
|
99
|
+
import { Text } from '@slotted/react/typography';
|
|
100
|
+
|
|
101
|
+
const READINGS = [
|
|
102
|
+
{ tone: 'accent', label: 'Orders picked', value: 74 },
|
|
103
|
+
{ tone: 'secondary', label: 'Returns processed', value: 52 },
|
|
104
|
+
{ tone: 'neutral', label: 'Draft invoices reviewed', value: 38 },
|
|
105
|
+
{ tone: 'info', label: 'Inbound containers unloaded', value: 61 },
|
|
106
|
+
{ tone: 'success', label: 'Carrier on-time rate', value: 94 },
|
|
107
|
+
{ tone: 'warning', label: 'Quarterly budget used', value: 82 },
|
|
108
|
+
{ tone: 'danger', label: 'Backorder limit reached', value: 97 },
|
|
109
|
+
] as const;
|
|
110
|
+
|
|
111
|
+
export default function MeterTones() {
|
|
112
|
+
return (
|
|
113
|
+
<Stack gap={4}>
|
|
114
|
+
{READINGS.map(({ label, tone, value }) => (
|
|
115
|
+
<Stack gap={1} key={tone}>
|
|
116
|
+
<Text size="sm">
|
|
117
|
+
{label}, {tone}
|
|
118
|
+
</Text>
|
|
119
|
+
<Meter aria-label={label} tone={tone} value={value} />
|
|
120
|
+
</Stack>
|
|
121
|
+
))}
|
|
122
|
+
</Stack>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
75
125
|
```
|
|
76
126
|
|
|
77
127
|
### Three thicknesses, and the length is the container’s
|
|
78
128
|
|
|
79
129
|
sm is four pixels for a dense row, md six for a card, lg eight for a summary that leads a page. The length is always what the cell or the column gave, never less than 4rem.
|
|
80
130
|
|
|
81
|
-
|
|
131
|
+
Example
|
|
82
132
|
|
|
83
133
|
```tsx
|
|
84
|
-
|
|
85
|
-
|
|
134
|
+
import { Meter } from '@slotted/react/meter';
|
|
135
|
+
import { Stack } from '@slotted/react/stack';
|
|
136
|
+
import { Text } from '@slotted/react/typography';
|
|
137
|
+
|
|
138
|
+
const SIZES = [
|
|
139
|
+
{ size: 'sm', label: 'Pick accuracy, sm', value: 35 },
|
|
140
|
+
{ size: 'md', label: 'Dock utilization, md', value: 58 },
|
|
141
|
+
{ size: 'lg', label: 'Quarterly fill rate, lg', value: 72 },
|
|
142
|
+
] as const;
|
|
143
|
+
|
|
144
|
+
export default function MeterSizes() {
|
|
145
|
+
return (
|
|
146
|
+
<Stack gap={4}>
|
|
147
|
+
{SIZES.map(({ label, size, value }) => (
|
|
148
|
+
<Stack gap={1} key={size}>
|
|
149
|
+
<Text size="sm">{label}</Text>
|
|
150
|
+
<Meter aria-label={label} size={size} value={value} />
|
|
151
|
+
</Stack>
|
|
152
|
+
))}
|
|
153
|
+
</Stack>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
86
156
|
```
|
|
87
157
|
|
|
88
158
|
### Regions that pick the tone
|
|
89
159
|
|
|
90
|
-
low, high and optimum split the range as the HTML meter element does: a disk with optimum at
|
|
160
|
+
low, high and optimum split the range as the HTML meter element does: a disk with optimum at 0 is success below 60%, warning up to 85% and danger past it. A stated tone wins.
|
|
91
161
|
|
|
92
|
-
|
|
162
|
+
Example
|
|
93
163
|
|
|
94
164
|
```tsx
|
|
95
|
-
|
|
165
|
+
import { Meter } from '@slotted/react/meter';
|
|
166
|
+
import { Stack } from '@slotted/react/stack';
|
|
167
|
+
import { Text } from '@slotted/react/typography';
|
|
168
|
+
|
|
169
|
+
const VOLUMES = [
|
|
170
|
+
{ name: 'Archive', used: 41 },
|
|
171
|
+
{ name: 'Orders database', used: 72 },
|
|
172
|
+
{ name: 'Application logs', used: 93 },
|
|
173
|
+
] as const;
|
|
174
|
+
|
|
175
|
+
export default function MeterRegions() {
|
|
176
|
+
return (
|
|
177
|
+
<Stack gap={4}>
|
|
178
|
+
{VOLUMES.map(({ name, used }) => (
|
|
179
|
+
<Stack gap={1} key={name}>
|
|
180
|
+
<Text size="sm">
|
|
181
|
+
{name}, {used}% used
|
|
182
|
+
</Text>
|
|
183
|
+
<Meter aria-label={`${name} disk usage`} high={85} low={60} optimum={0} value={used} />
|
|
184
|
+
</Stack>
|
|
185
|
+
))}
|
|
186
|
+
<Stack gap={1}>
|
|
187
|
+
<Text size="sm">Scratch space, 93% used, tone info</Text>
|
|
188
|
+
<Meter
|
|
189
|
+
aria-label="Scratch space disk usage"
|
|
190
|
+
high={85}
|
|
191
|
+
low={60}
|
|
192
|
+
optimum={0}
|
|
193
|
+
tone="info"
|
|
194
|
+
value={93}
|
|
195
|
+
/>
|
|
196
|
+
</Stack>
|
|
197
|
+
</Stack>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
96
200
|
```
|
|
97
201
|
|
|
98
202
|
### A share column
|
|
99
203
|
|
|
100
204
|
The meter’s home: a decorative bar in the column after the exact percentage, filling the cell of an auto-layout table, so a reader hears the number once and sees the proportion beside it.
|
|
101
205
|
|
|
102
|
-
|
|
206
|
+
Example
|
|
103
207
|
|
|
104
208
|
```tsx
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
209
|
+
import { Meter } from '@slotted/react/meter';
|
|
210
|
+
import {
|
|
211
|
+
Table,
|
|
212
|
+
TableBody,
|
|
213
|
+
TableCaption,
|
|
214
|
+
TableCell,
|
|
215
|
+
TableColumnHeader,
|
|
216
|
+
TableContent,
|
|
217
|
+
TableHead,
|
|
218
|
+
TableRow,
|
|
219
|
+
TableRowHeader,
|
|
220
|
+
} from '@slotted/react/table';
|
|
221
|
+
|
|
222
|
+
const WAREHOUSES = [
|
|
223
|
+
{ name: 'Reno', used: 68 },
|
|
224
|
+
{ name: 'Columbus', used: 91 },
|
|
225
|
+
{ name: 'Savannah', used: 45 },
|
|
226
|
+
{ name: 'Memphis', used: 23 },
|
|
227
|
+
] as const;
|
|
228
|
+
|
|
229
|
+
export default function MeterInTable() {
|
|
230
|
+
return (
|
|
231
|
+
<Table columns={3}>
|
|
232
|
+
<TableContent>
|
|
233
|
+
<TableCaption>Warehouse capacity in use</TableCaption>
|
|
234
|
+
<TableHead>
|
|
235
|
+
<TableRow>
|
|
236
|
+
<TableColumnHeader>Warehouse</TableColumnHeader>
|
|
237
|
+
<TableColumnHeader numeric>Used</TableColumnHeader>
|
|
238
|
+
<TableColumnHeader>Proportion</TableColumnHeader>
|
|
239
|
+
</TableRow>
|
|
240
|
+
</TableHead>
|
|
241
|
+
<TableBody>
|
|
242
|
+
{WAREHOUSES.map(({ name, used }) => (
|
|
243
|
+
<TableRow key={name}>
|
|
244
|
+
<TableRowHeader>{name}</TableRowHeader>
|
|
245
|
+
<TableCell numeric>{used}%</TableCell>
|
|
246
|
+
<TableCell>
|
|
247
|
+
<Meter decorative value={used} />
|
|
248
|
+
</TableCell>
|
|
249
|
+
</TableRow>
|
|
250
|
+
))}
|
|
251
|
+
</TableBody>
|
|
252
|
+
</TableContent>
|
|
253
|
+
</Table>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
109
256
|
```
|
|
110
257
|
|
|
111
258
|
### What a reader hears
|
|
112
259
|
|
|
113
260
|
The root is a meter named by its aria-label, read as “Fixed income, meter, 43.8%”: the share in the locale of the language in force, or the valueText given in its place.
|
|
114
261
|
|
|
115
|
-
|
|
262
|
+
Example
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
import { Meter } from '@slotted/react/meter';
|
|
266
|
+
import { Stack } from '@slotted/react/stack';
|
|
267
|
+
import { Text } from '@slotted/react/typography';
|
|
268
|
+
|
|
269
|
+
const WHOLE_PERCENT = { maximumFractionDigits: 0, style: 'percent' } as const;
|
|
270
|
+
|
|
271
|
+
export default function MeterAccessibility() {
|
|
272
|
+
return (
|
|
273
|
+
<Stack gap={4}>
|
|
274
|
+
<Stack gap={1}>
|
|
275
|
+
<Text size="sm">Fixed income, read as 43.8%</Text>
|
|
276
|
+
<Meter aria-label="Fixed income" max={10000} value={4380} />
|
|
277
|
+
</Stack>
|
|
278
|
+
<Stack gap={1}>
|
|
279
|
+
<Text size="sm">Used storage, read as 3 of 5 GB</Text>
|
|
280
|
+
<Meter aria-label="Used storage" max={5} value={3} valueText="3 of 5 GB" />
|
|
281
|
+
</Stack>
|
|
282
|
+
<Stack gap={1}>
|
|
283
|
+
<Text size="sm">Fixed income in pt-BR, read with a decimal comma</Text>
|
|
284
|
+
<Meter aria-label="Fixed income in pt-BR" locale="pt-BR" max={10000} value={4380} />
|
|
285
|
+
</Stack>
|
|
286
|
+
<Stack gap={1}>
|
|
287
|
+
<Text size="sm">Equities, read as 31%</Text>
|
|
288
|
+
<Meter aria-label="Equities" formatOptions={WHOLE_PERCENT} max={10000} value={3120} />
|
|
289
|
+
</Stack>
|
|
290
|
+
</Stack>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### defaults.tsx
|
|
296
|
+
|
|
297
|
+
Example
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
import { Meter, MeterDefaultsProvider } from '@slotted/react/meter';
|
|
301
|
+
import { Stack } from '@slotted/react/stack';
|
|
302
|
+
import { Text } from '@slotted/react/typography';
|
|
303
|
+
|
|
304
|
+
export default function MeterDefaultsExample() {
|
|
305
|
+
return (
|
|
306
|
+
<MeterDefaultsProvider size="lg">
|
|
307
|
+
<Stack gap={4}>
|
|
308
|
+
<Stack gap={1}>
|
|
309
|
+
<Text size="sm">Pick rate, lg from the provider</Text>
|
|
310
|
+
<Meter aria-label="Pick rate" value={64} />
|
|
311
|
+
</Stack>
|
|
312
|
+
<Stack gap={1}>
|
|
313
|
+
<Text size="sm">Pack rate, lg from the provider</Text>
|
|
314
|
+
<Meter aria-label="Pack rate" value={81} />
|
|
315
|
+
</Stack>
|
|
316
|
+
<Stack gap={1}>
|
|
317
|
+
<Text size="sm">Ship rate, sm stated on the meter</Text>
|
|
318
|
+
<Meter aria-label="Ship rate" size="sm" value={47} />
|
|
319
|
+
</Stack>
|
|
320
|
+
</Stack>
|
|
321
|
+
</MeterDefaultsProvider>
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### optimum.tsx
|
|
327
|
+
|
|
328
|
+
Example
|
|
329
|
+
|
|
330
|
+
```tsx
|
|
331
|
+
import { Meter } from '@slotted/react/meter';
|
|
332
|
+
import { Stack } from '@slotted/react/stack';
|
|
333
|
+
import { Text } from '@slotted/react/typography';
|
|
334
|
+
|
|
335
|
+
const SUPPLIES = [
|
|
336
|
+
{ name: 'Pallet wrap', level: 80 },
|
|
337
|
+
{ name: 'Shipping labels', level: 45 },
|
|
338
|
+
{ name: 'Packing tape', level: 15 },
|
|
339
|
+
] as const;
|
|
340
|
+
|
|
341
|
+
export default function MeterOptimum() {
|
|
342
|
+
return (
|
|
343
|
+
<Stack gap={4}>
|
|
344
|
+
{SUPPLIES.map(({ level, name }) => (
|
|
345
|
+
<Stack gap={1} key={name}>
|
|
346
|
+
<Text size="sm">
|
|
347
|
+
{name}, {level}% of the bin
|
|
348
|
+
</Text>
|
|
349
|
+
<Meter
|
|
350
|
+
aria-label={`${name} stock level`}
|
|
351
|
+
high={60}
|
|
352
|
+
low={25}
|
|
353
|
+
optimum={100}
|
|
354
|
+
value={level}
|
|
355
|
+
/>
|
|
356
|
+
</Stack>
|
|
357
|
+
))}
|
|
358
|
+
</Stack>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### range.tsx
|
|
364
|
+
|
|
365
|
+
Example
|
|
116
366
|
|
|
117
367
|
```tsx
|
|
118
|
-
|
|
368
|
+
import { Meter } from '@slotted/react/meter';
|
|
369
|
+
import { Stack } from '@slotted/react/stack';
|
|
370
|
+
import { Text } from '@slotted/react/typography';
|
|
371
|
+
|
|
372
|
+
export default function MeterRange() {
|
|
373
|
+
return (
|
|
374
|
+
<Stack gap={5}>
|
|
375
|
+
<Stack gap={1}>
|
|
376
|
+
<Text>Truck 14 load</Text>
|
|
377
|
+
<Meter aria-label="Truck 14 load" max={24} value={18} />
|
|
378
|
+
<Text size="sm" tone="muted">
|
|
379
|
+
18 of 24 pallets.
|
|
380
|
+
</Text>
|
|
381
|
+
</Stack>
|
|
382
|
+
<Stack gap={1}>
|
|
383
|
+
<Text>Cold room 3 temperature</Text>
|
|
384
|
+
<Meter aria-label="Cold room 3 temperature" max={0} min={-25} value={-18} />
|
|
385
|
+
<Text size="sm" tone="muted">
|
|
386
|
+
-18 °C on a scale from -25 °C to 0 °C.
|
|
387
|
+
</Text>
|
|
388
|
+
</Stack>
|
|
389
|
+
<Stack gap={1}>
|
|
390
|
+
<Text>Returns bay overflow</Text>
|
|
391
|
+
<Meter aria-label="Returns bay overflow" max={40} value={46} />
|
|
392
|
+
<Text size="sm" tone="muted">
|
|
393
|
+
46 of 40 positions. A value past the range is drawn at its end.
|
|
394
|
+
</Text>
|
|
395
|
+
</Stack>
|
|
396
|
+
</Stack>
|
|
397
|
+
);
|
|
398
|
+
}
|
|
119
399
|
```
|