@ui-sdk/web 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +202 -0
- package/README.md +10 -2
- package/browser/web/accordion.js +1 -0
- package/browser/web/alert-dialog.js +1 -0
- package/browser/web/autocomplete.js +1 -0
- package/browser/web/avatar.js +1 -0
- package/browser/web/button.js +1 -0
- package/browser/web/calendar.js +1 -0
- package/browser/web/carousel.js +1 -0
- package/browser/web/checkbox.js +1 -0
- package/browser/web/chunks/0eRGibL6.js +1 -0
- package/browser/web/chunks/2bIEUO6_.js +1 -0
- package/browser/web/chunks/5A9w2ULz.js +1 -0
- package/browser/web/chunks/5RSyydjV.js +1 -0
- package/browser/web/chunks/9pWTy2wl.js +1 -0
- package/browser/web/chunks/B0f2j6zz.js +1 -0
- package/browser/web/chunks/B1rux6br.js +1 -0
- package/browser/web/chunks/B3-APaNf.js +1 -0
- package/browser/web/chunks/B7EgSgjQ.js +1 -0
- package/browser/web/chunks/B8QcOzJU.js +1 -0
- package/browser/web/chunks/BFueEkwm.js +3 -0
- package/browser/web/chunks/BJj3oS29.js +1 -0
- package/browser/web/chunks/BNSvTCpr.js +1 -0
- package/browser/web/chunks/BPD0kAZB.js +1 -0
- package/browser/web/chunks/BQeduZqT.js +1 -0
- package/browser/web/chunks/B_CVFyiz.js +1 -0
- package/browser/web/chunks/B_ns1YHO.js +1 -0
- package/browser/web/chunks/BcwkVTsR.js +1 -0
- package/browser/web/chunks/BeaQ6TYM.js +1 -0
- package/browser/web/chunks/BgBB013u.js +1 -0
- package/browser/web/chunks/BgsKhHDm.js +1 -0
- package/browser/web/chunks/BjMcbuhi.js +9 -0
- package/browser/web/chunks/Bjiy_F2N.js +1 -0
- package/browser/web/chunks/BqScCLwv.js +1 -0
- package/browser/web/chunks/BqX3Utqx.js +1 -0
- package/browser/web/chunks/BtVkQf3z.js +1 -0
- package/browser/web/chunks/By30h-7B.js +1 -0
- package/browser/web/chunks/C1zqYpy2.js +1 -0
- package/browser/web/chunks/C436juFf.js +1 -0
- package/browser/web/chunks/C4_bULs1.js +1 -0
- package/browser/web/chunks/C4omqJEz.js +1 -0
- package/browser/web/chunks/C7tt0T3n.js +1 -0
- package/browser/web/chunks/C8w7s5dg.js +1 -0
- package/browser/web/chunks/CElY4erO.js +1 -0
- package/browser/web/chunks/CFODo-m2.js +1 -0
- package/browser/web/chunks/CL4wjam9.js +1 -0
- package/browser/web/chunks/CMg-8UVf.js +1 -0
- package/browser/web/chunks/COWKfakj.js +1 -0
- package/browser/web/chunks/CQBU0qZ4.js +1 -0
- package/browser/web/chunks/CV6uABgc.js +1 -0
- package/browser/web/chunks/C_SWFpWQ.js +1 -0
- package/browser/web/chunks/C_Uanbrl.js +1 -0
- package/browser/web/chunks/Ce_CSanC.js +1 -0
- package/browser/web/chunks/Cg-ZmRhS.js +1 -0
- package/browser/web/chunks/Cgf2wPI_.js +1 -0
- package/browser/web/chunks/Cuep_3Vf.js +1 -0
- package/browser/web/chunks/D02PaHn6.js +1 -0
- package/browser/web/chunks/D5LiaI5R.js +1 -0
- package/browser/web/chunks/D9UgVYvF.js +1 -0
- package/browser/web/chunks/DC08tnkE.js +2 -0
- package/browser/web/chunks/DG8YGSvu.js +1 -0
- package/browser/web/chunks/DIQd0FYD.js +1 -0
- package/browser/web/chunks/DMLqacE8.js +1 -0
- package/browser/web/chunks/DSUI3yI-.js +1 -0
- package/browser/web/chunks/DT3Hb76X.js +1 -0
- package/browser/web/chunks/DY75g3-W.js +1 -0
- package/browser/web/chunks/DZpNQKZ9.js +1 -0
- package/browser/web/chunks/Db-W1wrC.js +1 -0
- package/browser/web/chunks/Dc1xK3Ii.js +1 -0
- package/browser/web/chunks/DdF6awFs.js +1 -0
- package/browser/web/chunks/DdaCLml8.js +1 -0
- package/browser/web/chunks/Dh8MLjQO.js +1 -0
- package/browser/web/chunks/DiuslJRy.js +1 -0
- package/browser/web/chunks/DjRcw3Y0.js +1 -0
- package/browser/web/chunks/Djdv-16J.js +1 -0
- package/browser/web/chunks/DnFXe_lF.js +1 -0
- package/browser/web/chunks/DneGv1oC.js +1 -0
- package/browser/web/chunks/DsVxP-p-.js +1 -0
- package/browser/web/chunks/DwDilCo2.js +1 -0
- package/browser/web/chunks/DwV48AXv.js +1 -0
- package/browser/web/chunks/F37aF4-L.js +1 -0
- package/browser/web/chunks/LyB6XIbN.js +1 -0
- package/browser/web/chunks/NKnbYGjC.js +1 -0
- package/browser/web/chunks/Vk-rVi16.js +1 -0
- package/browser/web/chunks/XsM0J1Ex.js +1 -0
- package/browser/web/chunks/asSN9iEp.js +1 -0
- package/browser/web/chunks/c-AjHfdF.js +1 -0
- package/browser/web/chunks/dR-12TPY.js +1 -0
- package/browser/web/chunks/hR4xM0EC.js +1 -0
- package/browser/web/chunks/hqOaBxAg.js +1 -0
- package/browser/web/chunks/kMKqqeG4.js +1 -0
- package/browser/web/chunks/kXboBcfi.js +1 -0
- package/browser/web/chunks/l4aQIg22.js +1 -0
- package/browser/web/chunks/tJC0JSU4.js +1 -0
- package/browser/web/chunks/wHdS_QYM.js +1 -0
- package/browser/web/chunks/yv8dTvNI.js +1 -0
- package/browser/web/chunks/yw9M3nfi.js +1 -0
- package/browser/web/collapsible.js +1 -0
- package/browser/web/color-picker.js +1 -0
- package/browser/web/combobox.js +2 -0
- package/browser/web/command.js +1 -0
- package/browser/web/core.js +5 -0
- package/browser/web/date-input.js +1 -0
- package/browser/web/date-picker.js +1 -0
- package/browser/web/dialog.js +1 -0
- package/browser/web/drawer.js +1 -0
- package/browser/web/field.js +1 -0
- package/browser/web/file-input.js +1 -0
- package/browser/web/hover-card.js +1 -0
- package/browser/web/image-cropper.js +1 -0
- package/browser/web/input.js +1 -0
- package/browser/web/label.js +1 -0
- package/browser/web/listbox.js +1 -0
- package/browser/web/menu.js +1 -0
- package/browser/web/menubar.js +1 -0
- package/browser/web/meter.js +1 -0
- package/browser/web/navigation-menu.js +1 -0
- package/browser/web/number-input.js +1 -0
- package/browser/web/otp-input.js +2 -0
- package/browser/web/overlays.js +1 -0
- package/browser/web/pagination.js +1 -0
- package/browser/web/password-input.js +1 -0
- package/browser/web/popover.js +1 -0
- package/browser/web/preferences.js +1 -0
- package/browser/web/progress.js +1 -0
- package/browser/web/radio.js +1 -0
- package/browser/web/rating.js +1 -0
- package/browser/web/resizable.js +1 -0
- package/browser/web/scroll-area.js +1 -0
- package/browser/web/segmented-control.js +1 -0
- package/browser/web/select.js +1 -0
- package/browser/web/separator.js +1 -0
- package/browser/web/slider.js +1 -0
- package/browser/web/switch.js +1 -0
- package/browser/web/tabs.js +1 -0
- package/browser/web/textarea.js +1 -0
- package/browser/web/time-input.js +1 -0
- package/browser/web/timeline.js +1 -0
- package/browser/web/toast.js +1 -0
- package/browser/web/toggle.js +1 -0
- package/browser/web/token-input.js +8 -0
- package/browser/web/toolbar.js +1 -0
- package/browser/web/tooltip.js +1 -0
- package/browser/web/tree.js +1 -0
- package/browser/web/trigger-menu.js +4 -0
- package/browser/web/waterfall.js +1 -0
- package/browser/web.css +3378 -0
- package/browser/web.js +3 -0
- package/custom-elements.json +32315 -0
- package/dist/accordion.d.ts +2 -0
- package/dist/accordion.js +57 -0
- package/dist/action.d.ts +16 -0
- package/dist/action.js +39 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +7 -0
- package/dist/autocomplete.d.ts +2 -0
- package/dist/autocomplete.js +120 -0
- package/dist/autoload.d.ts +18 -0
- package/dist/autoload.js +63 -0
- package/dist/avatar.d.ts +2 -0
- package/dist/avatar.js +27 -0
- package/dist/browser-core.d.ts +2 -0
- package/dist/browser-core.js +8 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +35 -0
- package/dist/calendar.d.ts +23 -0
- package/dist/calendar.js +429 -0
- package/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +54 -0
- package/dist/checkbox.d.ts +4 -0
- package/dist/checkbox.js +75 -0
- package/dist/collapsible.d.ts +2 -0
- package/dist/collapsible.js +28 -0
- package/dist/color-picker.d.ts +2 -0
- package/dist/color-picker.js +64 -0
- package/dist/combobox.d.ts +2 -0
- package/dist/combobox.js +334 -0
- package/dist/command.d.ts +2 -0
- package/dist/command.js +122 -0
- package/dist/date-input.d.ts +3 -0
- package/dist/date-input.js +87 -0
- package/dist/date-picker.d.ts +2 -0
- package/dist/date-picker.js +174 -0
- package/dist/default-text.d.ts +3 -0
- package/dist/default-text.js +24 -0
- package/dist/define-element.d.ts +404 -0
- package/dist/define-element.js +1489 -0
- package/dist/dialog.d.ts +3 -0
- package/dist/dialog.js +94 -0
- package/dist/drawer.d.ts +2 -0
- package/dist/drawer.js +96 -0
- package/dist/entries/accordion.d.ts +3 -0
- package/dist/entries/accordion.js +7 -0
- package/dist/entries/alert-dialog.d.ts +3 -0
- package/dist/entries/alert-dialog.js +13 -0
- package/dist/entries/autocomplete.d.ts +3 -0
- package/dist/entries/autocomplete.js +7 -0
- package/dist/entries/avatar.d.ts +2 -0
- package/dist/entries/avatar.js +3 -0
- package/dist/entries/button.d.ts +2 -0
- package/dist/entries/button.js +3 -0
- package/dist/entries/calendar.d.ts +3 -0
- package/dist/entries/calendar.js +7 -0
- package/dist/entries/carousel.d.ts +3 -0
- package/dist/entries/carousel.js +7 -0
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.js +15 -0
- package/dist/entries/collapsible.d.ts +3 -0
- package/dist/entries/collapsible.js +7 -0
- package/dist/entries/color-picker.d.ts +3 -0
- package/dist/entries/color-picker.js +7 -0
- package/dist/entries/combobox.d.ts +3 -0
- package/dist/entries/combobox.js +7 -0
- package/dist/entries/command.d.ts +3 -0
- package/dist/entries/command.js +7 -0
- package/dist/entries/date-input.d.ts +3 -0
- package/dist/entries/date-input.js +7 -0
- package/dist/entries/date-picker.d.ts +3 -0
- package/dist/entries/date-picker.js +7 -0
- package/dist/entries/dialog.d.ts +3 -0
- package/dist/entries/dialog.js +7 -0
- package/dist/entries/drawer.d.ts +3 -0
- package/dist/entries/drawer.js +8 -0
- package/dist/entries/field.d.ts +2 -0
- package/dist/entries/field.js +3 -0
- package/dist/entries/file-input.d.ts +3 -0
- package/dist/entries/file-input.js +13 -0
- package/dist/entries/hover-card.d.ts +3 -0
- package/dist/entries/hover-card.js +7 -0
- package/dist/entries/image-cropper.d.ts +3 -0
- package/dist/entries/image-cropper.js +7 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.js +8 -0
- package/dist/entries/label.d.ts +2 -0
- package/dist/entries/label.js +3 -0
- package/dist/entries/listbox.d.ts +3 -0
- package/dist/entries/listbox.js +7 -0
- package/dist/entries/menu.d.ts +3 -0
- package/dist/entries/menu.js +7 -0
- package/dist/entries/menubar.d.ts +3 -0
- package/dist/entries/menubar.js +7 -0
- package/dist/entries/meter.d.ts +2 -0
- package/dist/entries/meter.js +3 -0
- package/dist/entries/navigation-menu.d.ts +3 -0
- package/dist/entries/navigation-menu.js +7 -0
- package/dist/entries/number-input.d.ts +3 -0
- package/dist/entries/number-input.js +7 -0
- package/dist/entries/otp-input.d.ts +3 -0
- package/dist/entries/otp-input.js +7 -0
- package/dist/entries/overlays.d.ts +2 -0
- package/dist/entries/overlays.js +3 -0
- package/dist/entries/pagination.d.ts +3 -0
- package/dist/entries/pagination.js +11 -0
- package/dist/entries/password-input.d.ts +3 -0
- package/dist/entries/password-input.js +7 -0
- package/dist/entries/popover.d.ts +3 -0
- package/dist/entries/popover.js +7 -0
- package/dist/entries/preferences.d.ts +3 -0
- package/dist/entries/preferences.js +13 -0
- package/dist/entries/progress.d.ts +2 -0
- package/dist/entries/progress.js +3 -0
- package/dist/entries/radio.d.ts +3 -0
- package/dist/entries/radio.js +7 -0
- package/dist/entries/rating.d.ts +3 -0
- package/dist/entries/rating.js +8 -0
- package/dist/entries/resizable.d.ts +3 -0
- package/dist/entries/resizable.js +11 -0
- package/dist/entries/scroll-area.d.ts +3 -0
- package/dist/entries/scroll-area.js +7 -0
- package/dist/entries/segmented-control.d.ts +3 -0
- package/dist/entries/segmented-control.js +7 -0
- package/dist/entries/select.d.ts +3 -0
- package/dist/entries/select.js +7 -0
- package/dist/entries/separator.d.ts +2 -0
- package/dist/entries/separator.js +3 -0
- package/dist/entries/slider.d.ts +3 -0
- package/dist/entries/slider.js +7 -0
- package/dist/entries/switch.d.ts +3 -0
- package/dist/entries/switch.js +7 -0
- package/dist/entries/tabs.d.ts +3 -0
- package/dist/entries/tabs.js +7 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.js +7 -0
- package/dist/entries/time-input.d.ts +3 -0
- package/dist/entries/time-input.js +7 -0
- package/dist/entries/timeline.d.ts +3 -0
- package/dist/entries/timeline.js +7 -0
- package/dist/entries/toast.d.ts +2 -0
- package/dist/entries/toast.js +3 -0
- package/dist/entries/toggle.d.ts +3 -0
- package/dist/entries/toggle.js +12 -0
- package/dist/entries/token-input.d.ts +3 -0
- package/dist/entries/token-input.js +17 -0
- package/dist/entries/toolbar.d.ts +3 -0
- package/dist/entries/toolbar.js +7 -0
- package/dist/entries/tooltip.d.ts +3 -0
- package/dist/entries/tooltip.js +7 -0
- package/dist/entries/tree.d.ts +3 -0
- package/dist/entries/tree.js +17 -0
- package/dist/entries/trigger-menu.d.ts +3 -0
- package/dist/entries/trigger-menu.js +11 -0
- package/dist/entries/waterfall.d.ts +3 -0
- package/dist/entries/waterfall.js +11 -0
- package/dist/events.d.ts +1658 -0
- package/dist/events.js +0 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +101 -0
- package/dist/file-input.d.ts +2 -0
- package/dist/file-input.js +140 -0
- package/dist/forward-attributes.d.ts +2 -0
- package/dist/forward-attributes.js +22 -0
- package/dist/history.d.ts +2 -0
- package/dist/history.js +11 -0
- package/dist/hover-card.d.ts +2 -0
- package/dist/hover-card.js +31 -0
- package/dist/image-cropper.d.ts +2 -0
- package/dist/image-cropper.js +66 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +269 -0
- package/dist/input.d.ts +3 -0
- package/dist/input.js +69 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +11 -0
- package/dist/list.d.ts +40 -0
- package/dist/list.js +192 -0
- package/dist/listbox.d.ts +2 -0
- package/dist/listbox.js +84 -0
- package/dist/menu.d.ts +4 -0
- package/dist/menu.js +295 -0
- package/dist/menubar.d.ts +4 -0
- package/dist/menubar.js +30 -0
- package/dist/meter.d.ts +2 -0
- package/dist/meter.js +22 -0
- package/dist/navigation-menu.d.ts +2 -0
- package/dist/navigation-menu.js +114 -0
- package/dist/number-input.d.ts +2 -0
- package/dist/number-input.js +73 -0
- package/dist/observe.d.ts +2 -0
- package/dist/observe.js +7 -0
- package/dist/otp-input.d.ts +2 -0
- package/dist/otp-input.js +72 -0
- package/dist/overlays.d.ts +13 -0
- package/dist/overlays.js +156 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/pagination.js +127 -0
- package/dist/password-input.d.ts +2 -0
- package/dist/password-input.js +57 -0
- package/dist/popover.d.ts +2 -0
- package/dist/popover.js +64 -0
- package/dist/popup.d.ts +40 -0
- package/dist/popup.js +112 -0
- package/dist/preferences.d.ts +2 -0
- package/dist/preferences.js +56 -0
- package/dist/progress.d.ts +2 -0
- package/dist/progress.js +22 -0
- package/dist/radio.d.ts +2 -0
- package/dist/radio.js +33 -0
- package/dist/rating.d.ts +2 -0
- package/dist/rating.js +64 -0
- package/dist/resizable.d.ts +2 -0
- package/dist/resizable.js +42 -0
- package/dist/scroll-area.d.ts +2 -0
- package/dist/scroll-area.js +45 -0
- package/dist/segmented-control.d.ts +2 -0
- package/dist/segmented-control.js +28 -0
- package/dist/select.d.ts +2 -0
- package/dist/select.js +239 -0
- package/dist/separator.d.ts +2 -0
- package/dist/separator.js +11 -0
- package/dist/slider.d.ts +2 -0
- package/dist/slider.js +77 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +37 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +27 -0
- package/dist/toast.d.ts +20 -0
- package/dist/toast.js +177 -0
- package/dist/toggle.d.ts +3 -0
- package/dist/toggle.js +64 -0
- package/dist/token-input.d.ts +2 -0
- package/dist/token-input.js +103 -0
- package/dist/toolbar.d.ts +2 -0
- package/dist/toolbar.js +36 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +35 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.js +147 -0
- package/dist/trigger-menu.d.ts +2 -0
- package/dist/trigger-menu.js +133 -0
- package/dist/waterfall.d.ts +2 -0
- package/dist/waterfall.js +140 -0
- package/docs/README.md +89 -0
- package/docs/agents.md +1523 -0
- package/docs/components/accordion.md +1401 -0
- package/docs/components/alert-dialog.md +788 -0
- package/docs/components/autocomplete.md +1692 -0
- package/docs/components/avatar.md +261 -0
- package/docs/components/button.md +441 -0
- package/docs/components/calendar.md +1536 -0
- package/docs/components/carousel.md +1055 -0
- package/docs/components/checkbox.md +1045 -0
- package/docs/components/collapsible.md +535 -0
- package/docs/components/color-picker.md +651 -0
- package/docs/components/combobox.md +3274 -0
- package/docs/components/command.md +1431 -0
- package/docs/components/date-input.md +563 -0
- package/docs/components/date-picker.md +1136 -0
- package/docs/components/dialog.md +1360 -0
- package/docs/components/drawer.md +1201 -0
- package/docs/components/field.md +519 -0
- package/docs/components/file-input.md +617 -0
- package/docs/components/hover-card.md +486 -0
- package/docs/components/image-cropper.md +489 -0
- package/docs/components/input.md +327 -0
- package/docs/components/label.md +208 -0
- package/docs/components/listbox.md +1015 -0
- package/docs/components/menu.md +1212 -0
- package/docs/components/menubar.md +460 -0
- package/docs/components/meter.md +298 -0
- package/docs/components/navigation-menu.md +1573 -0
- package/docs/components/number-input.md +1087 -0
- package/docs/components/otp-input.md +558 -0
- package/docs/components/pagination.md +639 -0
- package/docs/components/password-input.md +649 -0
- package/docs/components/popover.md +1433 -0
- package/docs/components/preferences.md +243 -0
- package/docs/components/progress.md +406 -0
- package/docs/components/radio.md +855 -0
- package/docs/components/rating.md +431 -0
- package/docs/components/resizable.md +866 -0
- package/docs/components/scroll-area.md +898 -0
- package/docs/components/segmented-control.md +421 -0
- package/docs/components/select.md +1957 -0
- package/docs/components/separator.md +238 -0
- package/docs/components/slider.md +1018 -0
- package/docs/components/switch.md +583 -0
- package/docs/components/tabs.md +948 -0
- package/docs/components/textarea.md +331 -0
- package/docs/components/time-input.md +235 -0
- package/docs/components/timeline.md +622 -0
- package/docs/components/toast.md +1223 -0
- package/docs/components/toggle.md +522 -0
- package/docs/components/token-input.md +854 -0
- package/docs/components/toolbar.md +815 -0
- package/docs/components/tooltip.md +860 -0
- package/docs/components/tree.md +1243 -0
- package/docs/components/trigger-menu.md +1110 -0
- package/docs/components/waterfall.md +709 -0
- package/docs/controllers.md +66 -0
- package/docs/core.md +8027 -0
- package/docs/custom-parts.md +91 -0
- package/docs/first-component.md +88 -0
- package/docs/forms.md +125 -0
- package/docs/installation.md +141 -0
- package/docs/introduction.md +32 -0
- package/docs/lists-and-menus.md +166 -0
- package/docs/llms.txt +1566 -0
- package/docs/parts-and-composition.md +57 -0
- package/docs/popups.md +92 -0
- package/docs/rendering.md +71 -0
- package/docs/server-rendering.md +118 -0
- package/docs/state-and-events.md +134 -0
- package/docs/styling-and-animation.md +104 -0
- package/docs/utilities/async-options.md +332 -0
- package/docs/utilities/shortcuts.md +184 -0
- package/html-custom-data.json +14792 -0
- package/package.json +302 -3
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Meter
|
|
2
|
+
|
|
3
|
+
Show a measurement within a known range, such as storage used or an account quota.
|
|
4
|
+
|
|
5
|
+
Use a Meter for a value within a known range, such as storage used, a battery level or an account quota. It fills a track to show the value, and screen readers announce the same value.
|
|
6
|
+
|
|
7
|
+
```ts title="basic.ts"
|
|
8
|
+
import "@ui-sdk/web/meter"
|
|
9
|
+
|
|
10
|
+
function mount(root: HTMLElement) {
|
|
11
|
+
root.innerHTML = `
|
|
12
|
+
<ui-meter value="68">
|
|
13
|
+
<ui-meter-label>Storage used</ui-meter-label>
|
|
14
|
+
<ui-meter-value></ui-meter-value>
|
|
15
|
+
<ui-meter-track>
|
|
16
|
+
<ui-meter-indicator></ui-meter-indicator>
|
|
17
|
+
</ui-meter-track>
|
|
18
|
+
</ui-meter>
|
|
19
|
+
`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { mount }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Read the storage meter. The label names it, and both the visible value and screen reader value report 68%.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @ui-sdk/web @ui-sdk/core
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Importing the component defines its elements. On the server the import does nothing.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import "@ui-sdk/web/meter"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Composition
|
|
40
|
+
|
|
41
|
+
Use the following composition to build a `ui-meter`:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
ui-meter
|
|
45
|
+
├── ui-meter-label
|
|
46
|
+
├── ui-meter-value
|
|
47
|
+
└── ui-meter-track
|
|
48
|
+
└── ui-meter-indicator
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- `ui-meter` holds the value and range.
|
|
52
|
+
- `ui-meter-label` gives it a visible name. You can use `aria-label` on the root instead.
|
|
53
|
+
- `ui-meter-value` displays the formatted value.
|
|
54
|
+
- `ui-meter-track` gives the bar its size, and `ui-meter-indicator` fills it.
|
|
55
|
+
|
|
56
|
+
The value is already part of the root's accessible description. The visible value is hidden from screen readers to avoid reading it twice.
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
Import the parts and put them together:
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<script type="module">
|
|
64
|
+
import "@ui-sdk/web/meter"
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<ui-meter value="40">
|
|
68
|
+
<ui-meter-label></ui-meter-label>
|
|
69
|
+
<ui-meter-value></ui-meter-value>
|
|
70
|
+
<ui-meter-track>
|
|
71
|
+
<ui-meter-indicator></ui-meter-indicator>
|
|
72
|
+
</ui-meter-track>
|
|
73
|
+
</ui-meter>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Build Your Own
|
|
77
|
+
|
|
78
|
+
`@ui-sdk/web/meter` comes with ready-made `ui-meter` elements. If you'd like to build your own, with your own element names, start from the `meter` primitive in `@ui-sdk/core`:
|
|
79
|
+
|
|
80
|
+
```ts title="quota-elements.ts"
|
|
81
|
+
import { meter } from "@ui-sdk/core/meter"
|
|
82
|
+
import { createParts } from "@ui-sdk/web"
|
|
83
|
+
|
|
84
|
+
createParts(meter, {
|
|
85
|
+
root: { tag: "quota-meter", display: "block" },
|
|
86
|
+
label: "quota-label",
|
|
87
|
+
value: "quota-value",
|
|
88
|
+
track: { tag: "quota-track", display: "block" },
|
|
89
|
+
indicator: { tag: "quota-fill", display: "block" },
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<quota-meter value="68">
|
|
95
|
+
<quota-label>Storage</quota-label>
|
|
96
|
+
<quota-value>68%</quota-value>
|
|
97
|
+
<quota-track>
|
|
98
|
+
<quota-fill></quota-fill>
|
|
99
|
+
</quota-track>
|
|
100
|
+
</quota-meter>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`ui-meter-value` fills in the formatted value for you. An element from `createParts` shows only what you put in it, so write the text yourself when you set the value, like `68%` here.
|
|
104
|
+
|
|
105
|
+
Each element keeps the behavior, state and data attributes of its ready-made counterpart: the root is the `meter`, and the indicator sets its width from the value. See [Rendering](../rendering.md) and [Custom Parts](../custom-parts.md) for more.
|
|
106
|
+
|
|
107
|
+
## Bounds
|
|
108
|
+
|
|
109
|
+
`min` and `max` set the range. They default to 0 and 100. A value outside the range is clamped for the fill, the percentage and `aria-valuenow`, but the state's `value` and a format other than percent keep it as you passed it. Here, 720 sits about 76% of the way from 300 to 850. Decimal formatting keeps the visible value as 720.
|
|
110
|
+
|
|
111
|
+
```ts title="min-max.ts"
|
|
112
|
+
import type { UiMeterElement } from "@ui-sdk/web"
|
|
113
|
+
import "@ui-sdk/web/meter"
|
|
114
|
+
|
|
115
|
+
function mount(root: HTMLElement) {
|
|
116
|
+
root.innerHTML = `
|
|
117
|
+
<ui-meter value="720" min="300" max="850">
|
|
118
|
+
<ui-meter-label>Credit score</ui-meter-label>
|
|
119
|
+
<ui-meter-value></ui-meter-value>
|
|
120
|
+
<ui-meter-track>
|
|
121
|
+
<ui-meter-indicator></ui-meter-indicator>
|
|
122
|
+
</ui-meter-track>
|
|
123
|
+
</ui-meter>
|
|
124
|
+
`
|
|
125
|
+
const meter = root.querySelector("ui-meter") as UiMeterElement
|
|
126
|
+
meter.format = { style: "decimal" }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { mount }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Compare the score with the filled track. The number shows 720; the fill shows its position between 300 and 850.
|
|
133
|
+
|
|
134
|
+
## Format and Locale
|
|
135
|
+
|
|
136
|
+
Pass `Intl.NumberFormat` options to `format` for units, currency, or decimal places. A function can return custom text, such as the number of occupied seats.
|
|
137
|
+
|
|
138
|
+
```ts title="format.ts"
|
|
139
|
+
import type { UiMeterElement } from "@ui-sdk/web"
|
|
140
|
+
import "@ui-sdk/web/meter"
|
|
141
|
+
|
|
142
|
+
const meters = [
|
|
143
|
+
{
|
|
144
|
+
label: "Storage",
|
|
145
|
+
value: 120,
|
|
146
|
+
max: 250,
|
|
147
|
+
format: { style: "unit", unit: "gigabyte" },
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
label: "Budget",
|
|
151
|
+
value: 1840,
|
|
152
|
+
max: 2500,
|
|
153
|
+
format: { style: "currency", currency: "USD", maximumFractionDigits: 0 },
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: "Seats",
|
|
157
|
+
value: 18,
|
|
158
|
+
max: 25,
|
|
159
|
+
format: (seats: number) => `${seats} of 25 seats`,
|
|
160
|
+
},
|
|
161
|
+
{ label: "Auslastung", value: 40, locale: "de-DE" },
|
|
162
|
+
] satisfies {
|
|
163
|
+
label: string
|
|
164
|
+
value: number
|
|
165
|
+
max?: number
|
|
166
|
+
format?: Intl.NumberFormatOptions | ((value: number) => string)
|
|
167
|
+
locale?: string
|
|
168
|
+
}[]
|
|
169
|
+
|
|
170
|
+
function mount(root: HTMLElement) {
|
|
171
|
+
const items = meters.map(
|
|
172
|
+
(meter) => `
|
|
173
|
+
<ui-meter value="${meter.value}" ${"max" in meter ? `max="${meter.max}"` : ""} ${"locale" in meter ? `locale="${meter.locale}"` : ""}>
|
|
174
|
+
<ui-meter-label>${meter.label}</ui-meter-label>
|
|
175
|
+
<ui-meter-value></ui-meter-value>
|
|
176
|
+
<ui-meter-track>
|
|
177
|
+
<ui-meter-indicator></ui-meter-indicator>
|
|
178
|
+
</ui-meter-track>
|
|
179
|
+
</ui-meter>`
|
|
180
|
+
)
|
|
181
|
+
root.innerHTML = `<div data-slot="stack">${items.join("")}</div>`
|
|
182
|
+
root
|
|
183
|
+
.querySelectorAll<UiMeterElement>("ui-meter")
|
|
184
|
+
.forEach((element, index) => {
|
|
185
|
+
const meter = meters[index]
|
|
186
|
+
if ("format" in meter) {
|
|
187
|
+
element.format = meter.format
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export { mount }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Compare the readings. Each meter formats its own value as a unit, currency, custom text, or localized percentage.
|
|
196
|
+
|
|
197
|
+
A percent format reports the value's position between `min` and `max`. Other formats use the value itself.
|
|
198
|
+
|
|
199
|
+
`locale` controls digits and separators. If you omit it, the component reads the page's language after it mounts, with the browser's language as a fallback. The initial server and client render use English.
|
|
200
|
+
|
|
201
|
+
Set `dir="rtl"` on the surrounding content to fill the track from the right.
|
|
202
|
+
|
|
203
|
+
Set `format` and `getValueLabel` as element properties because they accept objects or functions. `locale` is an attribute.
|
|
204
|
+
|
|
205
|
+
## Value Label
|
|
206
|
+
|
|
207
|
+
Use `getValueLabel` when a screen reader needs more context than the visible number. It receives the value and details containing `formatted`, `percent`, `min`, and `max`.
|
|
208
|
+
|
|
209
|
+
```ts title="value-label.ts"
|
|
210
|
+
import type { UiMeterElement } from "@ui-sdk/web"
|
|
211
|
+
import "@ui-sdk/web/meter"
|
|
212
|
+
|
|
213
|
+
function mount(root: HTMLElement) {
|
|
214
|
+
root.innerHTML = `
|
|
215
|
+
<ui-meter value="750" max="1000">
|
|
216
|
+
<ui-meter-label>API requests</ui-meter-label>
|
|
217
|
+
<ui-meter-value>750 / 1,000</ui-meter-value>
|
|
218
|
+
<ui-meter-track>
|
|
219
|
+
<ui-meter-indicator></ui-meter-indicator>
|
|
220
|
+
</ui-meter-track>
|
|
221
|
+
</ui-meter>
|
|
222
|
+
`
|
|
223
|
+
const meter = root.querySelector("ui-meter") as UiMeterElement
|
|
224
|
+
meter.getValueLabel = (value, details) =>
|
|
225
|
+
`${value} of ${details.max} requests, ${details.formatted}`
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { mount }
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Read API requests with a screen reader. It announces 750 of 1000 requests and 75%, while the visible value stays compact.
|
|
232
|
+
|
|
233
|
+
## Changing the Value
|
|
234
|
+
|
|
235
|
+
Pass a new `value` when your reading changes. Meter follows your state and has no `valuechange` event.
|
|
236
|
+
|
|
237
|
+
Use [Progress](./progress.md) for a task that is working toward completion, such as an upload.
|
|
238
|
+
|
|
239
|
+
## Custom Rendering
|
|
240
|
+
|
|
241
|
+
See [Parts and Composition](../parts-and-composition.md) for choosing the elements parts bind. Use `format` for text that should be shared by the visible value and screen readers.
|
|
242
|
+
|
|
243
|
+
## Styling
|
|
244
|
+
|
|
245
|
+
Give the track a height, background, and width. The indicator sets its width as an inline percentage of the track. Both styling options are shown in each example's Code tab.
|
|
246
|
+
|
|
247
|
+
Each part has a `data-slot`, such as `meter-indicator`, and no state attributes: the reading is in `--meter-value` and the indicator's width.
|
|
248
|
+
|
|
249
|
+
### `<ui-meter>`
|
|
250
|
+
The root exposes a CSS variable for positioning other content alongside the reading.
|
|
251
|
+
|
|
252
|
+
- `--meter-value`: Where the value sits between `min` and `max`, as a percentage, like 40%.
|
|
253
|
+
|
|
254
|
+
## API Reference
|
|
255
|
+
|
|
256
|
+
Props are attributes, like `value`, `min`, `max` and `locale`. `format` and `getValueLabel` are properties.
|
|
257
|
+
|
|
258
|
+
### Meter
|
|
259
|
+
|
|
260
|
+
- `min?` (`number`): The lowest value.
|
|
261
|
+
- `max?` (`number`): The highest value.
|
|
262
|
+
- `format?` (`NumberFormat`): How the value reads, for screen readers and the Value part: `Intl.NumberFormat` options, or a function of the value. A percent style shows where the value sits between `min` and `max`; any other style shows the value itself, like `{ style: "unit", unit: "gigabyte" }`.
|
|
263
|
+
- `locale?` (`string`): The locale the value is formatted in. Defaults to the page's `lang`, or the browser's language without one, once the page is interactive. Server markup uses English until then, so it never disagrees with the client.
|
|
264
|
+
- `getValueLabel?` (`((value: number, details: GaugeLabelDetails<number>) => string)`): The text screen readers announce for the value, when the formatted value says too little, like "3 of 12 files". It receives the value, null while a progress bar is indeterminate, and details: the `formatted` value, its `percent`, `min` and `max`.
|
|
265
|
+
- `value` (`number`): The reading, between `min` and `max`. Outside them, the fill, the percentage and `aria-valuenow` are clamped, while the state keeps the value as given. A meter always has a value, since there's no busy state.
|
|
266
|
+
- `debug?` (`boolean`): Logs every state change with its reason to the console, in development builds.
|
|
267
|
+
|
|
268
|
+
### State
|
|
269
|
+
|
|
270
|
+
The root shows the value in `aria-valuenow` and the `--meter-value` variable.
|
|
271
|
+
|
|
272
|
+
- `value` (`number`): The value, as given.
|
|
273
|
+
- `percent` (`number`): Where the value sits between `min` and `max`, from 0 to 100.
|
|
274
|
+
|
|
275
|
+
`ui-meter-value` adds the formatted text:
|
|
276
|
+
|
|
277
|
+
- `value` (`number`): The value, as given.
|
|
278
|
+
- `percent` (`number`): Where the value sits between `min` and `max`, from 0 to 100.
|
|
279
|
+
- `text` (`string`): The formatted value, like "40%".
|
|
280
|
+
|
|
281
|
+
## Accessibility
|
|
282
|
+
|
|
283
|
+
Name the component with `ui-meter-label` or `aria-label`. It exposes the range and formatted value through the `meter` role. Use `getValueLabel` when that value needs more explanation.
|
|
284
|
+
|
|
285
|
+
### Tested Behavior
|
|
286
|
+
|
|
287
|
+
Every line below is an automated test.
|
|
288
|
+
|
|
289
|
+
- A meter is named by its label and reads its value.
|
|
290
|
+
- The value part shows the formatted value.
|
|
291
|
+
- The indicator is as wide as the value.
|
|
292
|
+
- A new value updates the meter.
|
|
293
|
+
- Min and max set where the value sits.
|
|
294
|
+
- A unit format reads the value itself.
|
|
295
|
+
- A value label replaces the formatted value for screen readers.
|
|
296
|
+
- A value above the maximum reads as the maximum and fills the track.
|
|
297
|
+
|
|
298
|
+
Runs in React, Vue and web components.
|