@momentum-design/components 0.134.20 → 0.134.21
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/browser/index.js.map +2 -2
- package/dist/components/accordion/accordion.component.d.ts +15 -5
- package/dist/components/accordionbutton/accordionbutton.component.d.ts +14 -26
- package/dist/components/accordionbutton/accordionbutton.component.js +0 -22
- package/dist/components/accordiongroup/accordiongroup.component.d.ts +12 -16
- package/dist/components/accordiongroup/accordiongroup.component.js +0 -14
- package/dist/components/alertchip/alertchip.component.d.ts +15 -11
- package/dist/components/alertchip/alertchip.component.js +0 -7
- package/dist/components/animation/animation.component.d.ts +14 -6
- package/dist/components/animation/animation.component.js +0 -5
- package/dist/components/announcementdialog/announcementdialog.component.d.ts +18 -25
- package/dist/components/announcementdialog/announcementdialog.component.js +1 -20
- package/dist/components/appheader/appheader.component.d.ts +13 -12
- package/dist/components/appheader/appheader.component.js +0 -9
- package/dist/components/avatar/avatar.component.d.ts +14 -34
- package/dist/components/avatar/avatar.component.js +1 -31
- package/dist/components/avatarbutton/avatarbutton.component.d.ts +15 -14
- package/dist/components/avatarbutton/avatarbutton.component.js +1 -10
- package/dist/components/badge/badge.component.d.ts +16 -20
- package/dist/components/badge/badge.component.js +1 -17
- package/dist/components/banner/banner.component.d.ts +17 -17
- package/dist/components/banner/banner.component.js +1 -13
- package/dist/components/brandvisual/brandvisual.component.d.ts +15 -12
- package/dist/components/brandvisual/brandvisual.component.js +0 -10
- package/dist/components/bullet/bullet.component.d.ts +15 -16
- package/dist/components/bullet/bullet.component.js +0 -15
- package/dist/components/button/button.component.d.ts +21 -52
- package/dist/components/button/button.component.js +1 -47
- package/dist/components/buttongroup/buttongroup.component.d.ts +17 -20
- package/dist/components/buttongroup/buttongroup.component.js +0 -17
- package/dist/components/buttonlink/buttonlink.component.d.ts +19 -16
- package/dist/components/buttonlink/buttonlink.component.js +1 -11
- package/dist/components/buttonsimple/buttonsimple.component.d.ts +16 -25
- package/dist/components/buttonsimple/buttonsimple.component.js +0 -22
- package/dist/components/calendar/calendar.component.d.ts +17 -11
- package/dist/components/calendar/calendar.component.js +0 -8
- package/dist/components/card/card.component.d.ts +18 -17
- package/dist/components/card/card.component.js +0 -13
- package/dist/components/cardbutton/cardbutton.component.d.ts +20 -14
- package/dist/components/cardbutton/cardbutton.component.js +0 -9
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +20 -19
- package/dist/components/cardcheckbox/cardcheckbox.component.js +0 -14
- package/dist/components/cardradio/cardradio.component.d.ts +20 -20
- package/dist/components/cardradio/cardradio.component.js +0 -15
- package/dist/components/checkbox/checkbox.component.d.ts +22 -26
- package/dist/components/checkbox/checkbox.component.js +1 -22
- package/dist/components/chip/chip.component.d.ts +20 -13
- package/dist/components/chip/chip.component.js +0 -9
- package/dist/components/coachmark/coachmark.component.d.ts +22 -22
- package/dist/components/coachmark/coachmark.component.js +1 -18
- package/dist/components/combobox/combobox.component.d.ts +27 -37
- package/dist/components/combobox/combobox.component.js +1 -32
- package/dist/components/controltypeprovider/controltypeprovider.component.d.ts +19 -11
- package/dist/components/controltypeprovider/controltypeprovider.component.js +0 -10
- package/dist/components/datepicker/datepicker.component.d.ts +20 -14
- package/dist/components/datepicker/datepicker.component.js +0 -9
- package/dist/components/dialog/dialog.component.d.ts +25 -40
- package/dist/components/dialog/dialog.component.js +1 -35
- package/dist/components/divider/divider.component.d.ts +23 -25
- package/dist/components/divider/divider.component.js +0 -23
- package/dist/components/filterchip/filterchip.component.d.ts +20 -9
- package/dist/components/filterchip/filterchip.component.js +0 -5
- package/dist/components/formfieldgroup/formfieldgroup.component.d.ts +18 -19
- package/dist/components/formfieldgroup/formfieldgroup.component.js +0 -15
- package/dist/components/formfieldwrapper/formfieldwrapper.component.d.ts +16 -8
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +0 -4
- package/dist/components/icon/icon.component.d.ts +16 -41
- package/dist/components/icon/icon.component.js +0 -39
- package/dist/components/iconprovider/iconprovider.component.d.ts +14 -24
- package/dist/components/iconprovider/iconprovider.component.js +0 -23
- package/dist/components/illustration/illustration.component.d.ts +16 -32
- package/dist/components/illustration/illustration.component.js +0 -30
- package/dist/components/illustrationprovider/illustrationprovider.component.d.ts +14 -24
- package/dist/components/illustrationprovider/illustrationprovider.component.js +0 -23
- package/dist/components/input/input.component.d.ts +21 -16
- package/dist/components/input/input.component.js +0 -11
- package/dist/components/inputchip/inputchip.component.d.ts +19 -13
- package/dist/components/inputchip/inputchip.component.js +0 -7
- package/dist/components/link/link.component.d.ts +18 -12
- package/dist/components/link/link.component.js +1 -9
- package/dist/components/linkbutton/linkbutton.component.d.ts +19 -12
- package/dist/components/linkbutton/linkbutton.component.js +1 -8
- package/dist/components/linksimple/linksimple.component.d.ts +17 -10
- package/dist/components/linksimple/linksimple.component.js +0 -7
- package/dist/components/list/list.component.d.ts +17 -7
- package/dist/components/list/list.component.js +0 -5
- package/dist/components/listbox/listbox.component.d.ts +21 -16
- package/dist/components/listbox/listbox.component.js +1 -11
- package/dist/components/listheader/listheader.component.d.ts +14 -6
- package/dist/components/listheader/listheader.component.js +0 -3
- package/dist/components/listitem/listitem.component.d.ts +20 -18
- package/dist/components/listitem/listitem.component.js +0 -13
- package/dist/components/marker/marker.component.d.ts +15 -16
- package/dist/components/marker/marker.component.js +0 -15
- package/dist/components/menubar/menubar.component.d.ts +12 -19
- package/dist/components/menubar/menubar.component.js +0 -19
- package/dist/components/menuitem/menuitem.component.d.ts +18 -19
- package/dist/components/menuitem/menuitem.component.js +1 -15
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +19 -30
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +1 -25
- package/dist/components/menuitemradio/menuitemradio.component.d.ts +18 -31
- package/dist/components/menuitemradio/menuitemradio.component.js +1 -26
- package/dist/components/menupopover/menupopover.component.d.ts +16 -38
- package/dist/components/menupopover/menupopover.component.js +0 -34
- package/dist/components/menusection/menusection.component.d.ts +16 -12
- package/dist/components/menusection/menusection.component.js +0 -8
- package/dist/components/navmenuitem/navmenuitem.component.d.ts +16 -15
- package/dist/components/navmenuitem/navmenuitem.component.js +0 -11
- package/dist/components/optgroup/optgroup.component.d.ts +17 -7
- package/dist/components/optgroup/optgroup.component.js +1 -3
- package/dist/components/option/option.component.d.ts +17 -19
- package/dist/components/option/option.component.js +1 -15
- package/dist/components/password/password.component.d.ts +18 -17
- package/dist/components/password/password.component.js +0 -11
- package/dist/components/popover/popover.component.d.ts +20 -52
- package/dist/components/popover/popover.component.js +1 -47
- package/dist/components/presence/presence.component.d.ts +17 -10
- package/dist/components/presence/presence.component.js +1 -7
- package/dist/components/progressbar/progressbar.component.d.ts +17 -13
- package/dist/components/progressbar/progressbar.component.js +0 -9
- package/dist/components/progressspinner/progressspinner.component.d.ts +14 -19
- package/dist/components/progressspinner/progressspinner.component.js +0 -17
- package/dist/components/radio/radio.component.d.ts +19 -41
- package/dist/components/radio/radio.component.js +1 -37
- package/dist/components/radiogroup/radiogroup.component.d.ts +12 -5
- package/dist/components/radiogroup/radiogroup.component.js +0 -4
- package/dist/components/responsivesettingsprovider/responsivesettingsprovider.component.d.ts +11 -29
- package/dist/components/responsivesettingsprovider/responsivesettingsprovider.component.js +0 -29
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.d.ts +12 -51
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +0 -51
- package/dist/components/searchfield/searchfield.component.d.ts +16 -24
- package/dist/components/searchfield/searchfield.component.js +0 -20
- package/dist/components/searchpopover/searchpopover.component.d.ts +16 -20
- package/dist/components/searchpopover/searchpopover.component.js +0 -16
- package/dist/components/select/select.component.d.ts +23 -19
- package/dist/components/select/select.component.js +1 -14
- package/dist/components/selectlistbox/selectlistbox.component.d.ts +12 -8
- package/dist/components/selectlistbox/selectlistbox.component.js +0 -7
- package/dist/components/sidenavigation/sidenavigation.component.d.ts +21 -41
- package/dist/components/sidenavigation/sidenavigation.component.js +1 -35
- package/dist/components/skeleton/skeleton.component.d.ts +14 -15
- package/dist/components/skeleton/skeleton.component.js +0 -13
- package/dist/components/slider/slider.component.d.ts +17 -15
- package/dist/components/slider/slider.component.js +0 -11
- package/dist/components/spatialnavigationprovider/spatialnavigationprovider.component.d.ts +15 -215
- package/dist/components/spatialnavigationprovider/spatialnavigationprovider.component.js +1 -215
- package/dist/components/spinner/spinner.component.d.ts +15 -27
- package/dist/components/spinner/spinner.component.js +0 -25
- package/dist/components/staticcheckbox/staticcheckbox.component.d.ts +16 -21
- package/dist/components/staticcheckbox/staticcheckbox.component.js +0 -17
- package/dist/components/staticchip/staticchip.component.d.ts +17 -8
- package/dist/components/staticchip/staticchip.component.js +0 -5
- package/dist/components/staticradio/staticradio.component.d.ts +15 -19
- package/dist/components/staticradio/staticradio.component.js +0 -16
- package/dist/components/statictoggle/statictoggle.component.d.ts +16 -21
- package/dist/components/statictoggle/statictoggle.component.js +0 -17
- package/dist/components/stepper/stepper.component.d.ts +13 -5
- package/dist/components/stepper/stepper.component.js +0 -3
- package/dist/components/stepperconnector/stepperconnector.component.d.ts +13 -6
- package/dist/components/stepperconnector/stepperconnector.component.js +0 -4
- package/dist/components/stepperitem/stepperitem.component.d.ts +16 -14
- package/dist/components/stepperitem/stepperitem.component.js +1 -10
- package/dist/components/tab/tab.component.d.ts +20 -23
- package/dist/components/tab/tab.component.js +1 -16
- package/dist/components/tablist/tablist.component.d.ts +18 -30
- package/dist/components/tablist/tablist.component.js +0 -24
- package/dist/components/text/text.component.d.ts +12 -13
- package/dist/components/text/text.component.js +0 -12
- package/dist/components/textarea/textarea.component.d.ts +17 -39
- package/dist/components/textarea/textarea.component.js +0 -34
- package/dist/components/themeprovider/themeprovider.component.d.ts +13 -27
- package/dist/components/themeprovider/themeprovider.component.js +0 -25
- package/dist/components/timepicker/timepicker.component.d.ts +17 -19
- package/dist/components/timepicker/timepicker.component.js +0 -14
- package/dist/components/toast/toast.component.d.ts +20 -12
- package/dist/components/toast/toast.component.js +1 -7
- package/dist/components/toggle/toggle.component.d.ts +18 -24
- package/dist/components/toggle/toggle.component.js +1 -21
- package/dist/components/toggletip/toggletip.component.d.ts +18 -28
- package/dist/components/toggletip/toggletip.component.js +1 -24
- package/dist/components/tooltip/tooltip.component.d.ts +16 -16
- package/dist/components/tooltip/tooltip.component.js +0 -13
- package/dist/components/typewriter/typewriter.component.d.ts +18 -34
- package/dist/components/typewriter/typewriter.component.js +1 -31
- package/dist/components/verticaltablist/verticaltablist.component.d.ts +17 -30
- package/dist/components/verticaltablist/verticaltablist.component.js +0 -26
- package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +16 -58
- package/dist/components/virtualizedlist/virtualizedlist.component.js +0 -55
- package/dist/custom-elements.json +190 -190
- package/dist/react/accordion/index.d.ts +15 -5
- package/dist/react/accordionbutton/index.d.ts +14 -26
- package/dist/react/accordionbutton/index.js +0 -22
- package/dist/react/accordiongroup/index.d.ts +12 -16
- package/dist/react/accordiongroup/index.js +0 -14
- package/dist/react/alertchip/index.d.ts +15 -11
- package/dist/react/alertchip/index.js +0 -7
- package/dist/react/animation/index.d.ts +14 -6
- package/dist/react/animation/index.js +0 -5
- package/dist/react/announcementdialog/index.d.ts +18 -25
- package/dist/react/announcementdialog/index.js +1 -20
- package/dist/react/appheader/index.d.ts +13 -12
- package/dist/react/appheader/index.js +0 -9
- package/dist/react/avatar/index.d.ts +14 -34
- package/dist/react/avatar/index.js +1 -31
- package/dist/react/avatarbutton/index.d.ts +15 -14
- package/dist/react/avatarbutton/index.js +1 -10
- package/dist/react/badge/index.d.ts +16 -20
- package/dist/react/badge/index.js +1 -17
- package/dist/react/banner/index.d.ts +17 -17
- package/dist/react/banner/index.js +1 -13
- package/dist/react/brandvisual/index.d.ts +15 -12
- package/dist/react/brandvisual/index.js +0 -10
- package/dist/react/bullet/index.d.ts +15 -16
- package/dist/react/bullet/index.js +0 -15
- package/dist/react/button/index.d.ts +21 -52
- package/dist/react/button/index.js +1 -47
- package/dist/react/buttongroup/index.d.ts +17 -20
- package/dist/react/buttongroup/index.js +0 -17
- package/dist/react/buttonlink/index.d.ts +19 -16
- package/dist/react/buttonlink/index.js +1 -11
- package/dist/react/buttonsimple/index.d.ts +16 -25
- package/dist/react/buttonsimple/index.js +0 -22
- package/dist/react/calendar/index.d.ts +17 -11
- package/dist/react/calendar/index.js +0 -8
- package/dist/react/card/index.d.ts +18 -17
- package/dist/react/card/index.js +0 -13
- package/dist/react/cardbutton/index.d.ts +20 -14
- package/dist/react/cardbutton/index.js +0 -9
- package/dist/react/cardcheckbox/index.d.ts +20 -19
- package/dist/react/cardcheckbox/index.js +0 -14
- package/dist/react/cardradio/index.d.ts +20 -20
- package/dist/react/cardradio/index.js +0 -15
- package/dist/react/checkbox/index.d.ts +22 -26
- package/dist/react/checkbox/index.js +1 -22
- package/dist/react/chip/index.d.ts +20 -13
- package/dist/react/chip/index.js +0 -9
- package/dist/react/coachmark/index.d.ts +22 -22
- package/dist/react/coachmark/index.js +1 -18
- package/dist/react/combobox/index.d.ts +27 -37
- package/dist/react/combobox/index.js +1 -32
- package/dist/react/controltypeprovider/index.d.ts +19 -11
- package/dist/react/controltypeprovider/index.js +0 -10
- package/dist/react/datepicker/index.d.ts +20 -14
- package/dist/react/datepicker/index.js +0 -9
- package/dist/react/dialog/index.d.ts +25 -40
- package/dist/react/dialog/index.js +1 -35
- package/dist/react/divider/index.d.ts +23 -25
- package/dist/react/divider/index.js +0 -23
- package/dist/react/filterchip/index.d.ts +20 -9
- package/dist/react/filterchip/index.js +0 -5
- package/dist/react/formfieldgroup/index.d.ts +18 -19
- package/dist/react/formfieldgroup/index.js +0 -15
- package/dist/react/formfieldwrapper/index.d.ts +16 -8
- package/dist/react/formfieldwrapper/index.js +0 -4
- package/dist/react/icon/index.d.ts +16 -41
- package/dist/react/icon/index.js +0 -39
- package/dist/react/iconprovider/index.d.ts +14 -24
- package/dist/react/iconprovider/index.js +0 -23
- package/dist/react/illustration/index.d.ts +16 -32
- package/dist/react/illustration/index.js +0 -30
- package/dist/react/illustrationprovider/index.d.ts +14 -24
- package/dist/react/illustrationprovider/index.js +0 -23
- package/dist/react/input/index.d.ts +21 -16
- package/dist/react/input/index.js +0 -11
- package/dist/react/inputchip/index.d.ts +19 -13
- package/dist/react/inputchip/index.js +0 -7
- package/dist/react/link/index.d.ts +18 -12
- package/dist/react/link/index.js +1 -9
- package/dist/react/linkbutton/index.d.ts +19 -12
- package/dist/react/linkbutton/index.js +1 -8
- package/dist/react/linksimple/index.d.ts +17 -10
- package/dist/react/linksimple/index.js +0 -7
- package/dist/react/list/index.d.ts +17 -7
- package/dist/react/list/index.js +0 -5
- package/dist/react/listbox/index.d.ts +21 -16
- package/dist/react/listbox/index.js +1 -11
- package/dist/react/listheader/index.d.ts +14 -6
- package/dist/react/listheader/index.js +0 -3
- package/dist/react/listitem/index.d.ts +20 -18
- package/dist/react/listitem/index.js +0 -13
- package/dist/react/marker/index.d.ts +15 -16
- package/dist/react/marker/index.js +0 -15
- package/dist/react/menubar/index.d.ts +12 -19
- package/dist/react/menubar/index.js +0 -19
- package/dist/react/menuitem/index.d.ts +18 -19
- package/dist/react/menuitem/index.js +1 -15
- package/dist/react/menuitemcheckbox/index.d.ts +19 -30
- package/dist/react/menuitemcheckbox/index.js +1 -25
- package/dist/react/menuitemradio/index.d.ts +18 -31
- package/dist/react/menuitemradio/index.js +1 -26
- package/dist/react/menupopover/index.d.ts +16 -38
- package/dist/react/menupopover/index.js +0 -34
- package/dist/react/menusection/index.d.ts +16 -12
- package/dist/react/menusection/index.js +0 -8
- package/dist/react/navmenuitem/index.d.ts +16 -15
- package/dist/react/navmenuitem/index.js +0 -11
- package/dist/react/optgroup/index.d.ts +17 -7
- package/dist/react/optgroup/index.js +1 -3
- package/dist/react/option/index.d.ts +17 -19
- package/dist/react/option/index.js +1 -15
- package/dist/react/password/index.d.ts +18 -17
- package/dist/react/password/index.js +0 -11
- package/dist/react/popover/index.d.ts +20 -52
- package/dist/react/popover/index.js +1 -47
- package/dist/react/presence/index.d.ts +17 -10
- package/dist/react/presence/index.js +1 -7
- package/dist/react/progressbar/index.d.ts +17 -13
- package/dist/react/progressbar/index.js +0 -9
- package/dist/react/progressspinner/index.d.ts +14 -19
- package/dist/react/progressspinner/index.js +0 -17
- package/dist/react/radio/index.d.ts +19 -41
- package/dist/react/radio/index.js +1 -37
- package/dist/react/radiogroup/index.d.ts +12 -5
- package/dist/react/radiogroup/index.js +0 -4
- package/dist/react/responsivesettingsprovider/index.d.ts +11 -29
- package/dist/react/responsivesettingsprovider/index.js +0 -29
- package/dist/react/screenreaderannouncer/index.d.ts +12 -51
- package/dist/react/screenreaderannouncer/index.js +0 -51
- package/dist/react/searchfield/index.d.ts +16 -24
- package/dist/react/searchfield/index.js +0 -20
- package/dist/react/searchpopover/index.d.ts +16 -20
- package/dist/react/searchpopover/index.js +0 -16
- package/dist/react/select/index.d.ts +23 -19
- package/dist/react/select/index.js +1 -14
- package/dist/react/selectlistbox/index.d.ts +12 -8
- package/dist/react/selectlistbox/index.js +0 -7
- package/dist/react/sidenavigation/index.d.ts +21 -41
- package/dist/react/sidenavigation/index.js +1 -35
- package/dist/react/skeleton/index.d.ts +14 -15
- package/dist/react/skeleton/index.js +0 -13
- package/dist/react/slider/index.d.ts +17 -15
- package/dist/react/slider/index.js +0 -11
- package/dist/react/spatialnavigationprovider/index.d.ts +15 -215
- package/dist/react/spatialnavigationprovider/index.js +1 -214
- package/dist/react/spinner/index.d.ts +15 -27
- package/dist/react/spinner/index.js +0 -25
- package/dist/react/staticcheckbox/index.d.ts +16 -21
- package/dist/react/staticcheckbox/index.js +0 -17
- package/dist/react/staticchip/index.d.ts +17 -8
- package/dist/react/staticchip/index.js +0 -5
- package/dist/react/staticradio/index.d.ts +15 -19
- package/dist/react/staticradio/index.js +0 -16
- package/dist/react/statictoggle/index.d.ts +16 -21
- package/dist/react/statictoggle/index.js +0 -17
- package/dist/react/stepper/index.d.ts +13 -5
- package/dist/react/stepper/index.js +0 -3
- package/dist/react/stepperconnector/index.d.ts +13 -6
- package/dist/react/stepperconnector/index.js +0 -4
- package/dist/react/stepperitem/index.d.ts +16 -14
- package/dist/react/stepperitem/index.js +1 -10
- package/dist/react/tab/index.d.ts +20 -23
- package/dist/react/tab/index.js +1 -16
- package/dist/react/tablist/index.d.ts +18 -30
- package/dist/react/tablist/index.js +0 -24
- package/dist/react/text/index.d.ts +12 -13
- package/dist/react/text/index.js +0 -12
- package/dist/react/textarea/index.d.ts +17 -39
- package/dist/react/textarea/index.js +0 -34
- package/dist/react/themeprovider/index.d.ts +13 -27
- package/dist/react/themeprovider/index.js +0 -25
- package/dist/react/timepicker/index.d.ts +17 -19
- package/dist/react/timepicker/index.js +0 -14
- package/dist/react/toast/index.d.ts +20 -12
- package/dist/react/toast/index.js +1 -7
- package/dist/react/toggle/index.d.ts +18 -24
- package/dist/react/toggle/index.js +1 -21
- package/dist/react/toggletip/index.d.ts +18 -28
- package/dist/react/toggletip/index.js +1 -24
- package/dist/react/tooltip/index.d.ts +16 -16
- package/dist/react/tooltip/index.js +0 -13
- package/dist/react/typewriter/index.d.ts +18 -34
- package/dist/react/typewriter/index.js +1 -31
- package/dist/react/verticaltablist/index.d.ts +17 -30
- package/dist/react/verticaltablist/index.js +0 -26
- package/dist/react/virtualizedlist/index.d.ts +16 -58
- package/dist/react/virtualizedlist/index.js +0 -55
- package/package.json +1 -1
|
@@ -1,219 +1,21 @@
|
|
|
1
1
|
import { Provider } from '../../models';
|
|
2
2
|
import { ShortestDistanceWeights, SpatialNavigationContextValue, SpatialNavigationActionToKeyMap } from './spatialnavigationprovider.types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* 1. Handle `keydown` in the capture phase.
|
|
21
|
-
* - When the active element has a `data-spatial-{direction}` attribute, call the provider's own `keydown` handler (see step 3).
|
|
22
|
-
* Falls back to component navigation provider did not handle the event.
|
|
23
|
-
* - When the active element's parent is scrollable and it is not fully visible in the given direction, and it does not
|
|
24
|
-
* have a `data-spatial-noscroll` attribute, prevent all navigation and scroll in the given direction half-size of the
|
|
25
|
-
* scroll view.
|
|
26
|
-
* 2. Component own `keydown` handler executed (bubble phase) (e.g., list moves focus internally) it it was not
|
|
27
|
-
* prevented.
|
|
28
|
-
* 3. Spatial Navigation Provider's `keydown` handler executed (bubble phase)
|
|
29
|
-
* - If a key event was not prevented in step 1. emit `navbeforeprocess` to check if any component wants to handle
|
|
30
|
-
* the key event itself. If `navbeforeprocess` event is prevented, stop here.
|
|
31
|
-
* - If the component did not handle `keydown`, it calculates the next focusable item
|
|
32
|
-
* - If the active element has a `data-spatial-{direction}` attribute,
|
|
33
|
-
* - Evaluate the attribute value, try element ID, and falls back to css selector if needed
|
|
34
|
-
* - If it is focusable, move the focus there.
|
|
35
|
-
* - If it is not focusable and contains focusable elements, calculate the next focused item within that element subtree.
|
|
36
|
-
* - Otherwise calculate the next focused item based on the direction and distances.
|
|
37
|
-
* - If there is no next item, it emits `navnotarget` event
|
|
38
|
-
* - Otherwise emit `navbeforefocus`,
|
|
39
|
-
* - If this event is prevented, nothing happens
|
|
40
|
-
* - Otherwise the focus moves to the next element
|
|
41
|
-
*
|
|
42
|
-
* ### Determine next focus
|
|
43
|
-
*
|
|
44
|
-
* The provider uses multiple ways to determine the next focused element. The order defined in the "Steps" section.
|
|
45
|
-
*
|
|
46
|
-
* #### Calculated focus
|
|
47
|
-
*
|
|
48
|
-
* By default, the next focus target is computed from element positions:
|
|
49
|
-
*
|
|
50
|
-
* 1. Find the nearest focus area (scrollable container or active focus trap) relative to the current element.
|
|
51
|
-
* 2. Collect focusable elements in that area.
|
|
52
|
-
* 3. Compute distances from the current element to candidates using the W3C "find the shortest
|
|
53
|
-
* distance" algorithm: https://www.w3.org/TR/css-nav-1/#find-the-shortest-distance
|
|
54
|
-
* 4. If no candidates are found, repeat from step 1, skipping areas already checked.
|
|
55
|
-
* 5. Focus on the closest candidate.
|
|
56
|
-
*
|
|
57
|
-
* Elements with `data-spatial-focusable` are treated as focusable even if they do otherwise not be
|
|
58
|
-
* (e.g., `tabindex="-1"`).
|
|
59
|
-
*
|
|
60
|
-
* Elements with `data-spatial-exclude` are excluded (with its subtree) from the navigation, even if they
|
|
61
|
-
* are focusable.
|
|
62
|
-
*
|
|
63
|
-
* Note: The algorithm is distance-based, so the UI should be designed to focusable elements are
|
|
64
|
-
* predictably reachable. Relative element positions should remain stable; responsive layouts can
|
|
65
|
-
* make navigation unpredictable. This is less of an issue on fixed-size TV UIs but can show unexpected
|
|
66
|
-
* behavior in Storybook when resizing. See the "Limitations" section.
|
|
67
|
-
*
|
|
68
|
-
* #### Overwrite the next element
|
|
69
|
-
*
|
|
70
|
-
* Override calculated navigation by adding one of these attributes to a focusable element:
|
|
71
|
-
*
|
|
72
|
-
* - `data-spatial-up`
|
|
73
|
-
* - `data-spatial-down`
|
|
74
|
-
* - `data-spatial-left`
|
|
75
|
-
* - `data-spatial-right`
|
|
76
|
-
*
|
|
77
|
-
* Each attribute value must be the id of the element to focus when the corresponding key is pressed.
|
|
78
|
-
*
|
|
79
|
-
* #### Element internal navigation
|
|
80
|
-
*
|
|
81
|
-
* Complex components (List, Combobox, Tree, etc.) may handle their own navigation. For example, a List moves
|
|
82
|
-
* focus internally on Down until the last item, after which Down should fall back to provider navigation.
|
|
83
|
-
*
|
|
84
|
-
* To prevent the provider from handling a key, listen to `navbeforeprocess` and call `event.preventDefault()`.
|
|
85
|
-
* This event fires after the component handles `keydown`.
|
|
86
|
-
*
|
|
87
|
-
* ### Cancel focus change
|
|
88
|
-
*
|
|
89
|
-
* Before focusing a computed target, the provider dispatches `navbeforefocus` on the current element. Call
|
|
90
|
-
* `event.preventDefault()` on this event to cancel the focus change.
|
|
91
|
-
*
|
|
92
|
-
* ## Enter action
|
|
93
|
-
*
|
|
94
|
-
* Pressing Enter triggers `.click()` on the currently focused element.
|
|
95
|
-
*
|
|
96
|
-
* You can prevent this by listening to `navbeforeprocess` and calling `event.preventDefault()`.
|
|
97
|
-
*
|
|
98
|
-
* ## Escape/Back action
|
|
99
|
-
*
|
|
100
|
-
* Pressing Escape tries to find a focusable element with `data-spatial-go-back` and clicks it. If none exists,
|
|
101
|
-
* the provider calls `history.back()`.
|
|
102
|
-
*
|
|
103
|
-
* You can prevent this by listening to `navbeforeprocess` and calling `event.preventDefault()`.
|
|
104
|
-
*
|
|
105
|
-
* You can also intercept the back click by listening to `navback` and calling `event.preventDefault()`.
|
|
106
|
-
*
|
|
107
|
-
* ## Control data attributes
|
|
108
|
-
*
|
|
109
|
-
* Supported data attributes:
|
|
110
|
-
*
|
|
111
|
-
* | Attribute | Value | Default | Description |
|
|
112
|
-
* |------------------------------|------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------|
|
|
113
|
-
* | `data-spatial-left` | empty string / id / selector | N/A | Prevent native navigation in the Left direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
114
|
-
* | `data-spatial-up` | empty string / id / selector | N/A | Prevent native navigation in Up direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
115
|
-
* | `data-spatial-right` | empty string / id / selector | N/A | Prevent native navigation in the Right direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
116
|
-
* | `data-spatial-down` | empty string / id / selector | N/A | Prevent native navigation in Down direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
117
|
-
* | `data-spatial-go-back` | N/A | N/A | First focusable element with this attribute is clicked on Back/Escape |
|
|
118
|
-
* | `data-spatial-focusable` | N/A | N/A | Treat element as focusable even if it normally is not (e.g., `tabindex="-1"`) |
|
|
119
|
-
* | `data-spatial-exclude` | N/A | N/A | Exclude focusable element (and its subtree) from the navigation |
|
|
120
|
-
* | `data-spatial-noscroll` | N/A | N/A | Prevent scroll for active element in scrollable area even if the is not fit in view |
|
|
121
|
-
* | `data-spatial-scroll-parent` | N/A | N/A | When the focusable item in not a direct child of the scrollable aria use this attribute to mark scrollable area element |
|
|
122
|
-
*
|
|
123
|
-
* ## Event emitting order
|
|
124
|
-
*
|
|
125
|
-
* On a navigation key press, events fire in this order:
|
|
126
|
-
*
|
|
127
|
-
* 1. `navbeforeprocess` on the currently focused element.
|
|
128
|
-
* 2. If not prevented:
|
|
129
|
-
* a. Arrow keys: `navbeforefocus` on the currently focused element.
|
|
130
|
-
* b. Enter: `.click()` on the currently focused element.
|
|
131
|
-
* c. Escape/Back: `navback` on the provider, then `.click()` on the go-back element or `history.back()`.
|
|
132
|
-
* 3. If no target is found in the requested direction: `navnotarget` on the provider.
|
|
133
|
-
*
|
|
134
|
-
* ## Handle complex components
|
|
135
|
-
*
|
|
136
|
-
* ### Generic components
|
|
137
|
-
*
|
|
138
|
-
* Components that handle navigation internally should prevent the provider from acting. Handle `navbeforeprocess`
|
|
139
|
-
* and call `event.preventDefault()` for keys you process yourself.
|
|
140
|
-
*
|
|
141
|
-
* ### Form inputs
|
|
142
|
-
*
|
|
143
|
-
* Native inputs often submit on Enter, which is not desirable here. Enter should toggle or activate the control
|
|
144
|
-
* (e.g., check/uncheck). Provide a dedicated submit button users can navigate to and press Enter on.
|
|
145
|
-
*
|
|
146
|
-
* ### Utilities for complex components
|
|
147
|
-
*
|
|
148
|
-
* #### KeyToActionMixin
|
|
149
|
-
*
|
|
150
|
-
* Maps key events to action names. Call `getActionForKeyEvent` to get the action for a keyboard event. Also provides
|
|
151
|
-
* `getKeyboardNavMode` to check whether navigation is spatial or default.
|
|
152
|
-
*
|
|
153
|
-
* #### KeyDownHandledMixin
|
|
154
|
-
*
|
|
155
|
-
* Notify the provider when a component handled `keydown` internally. Call `keyDownEventHandled` whenever you process
|
|
156
|
-
* keydown yourself.
|
|
157
|
-
*
|
|
158
|
-
* ## Platform specific behaviors
|
|
159
|
-
*
|
|
160
|
-
* Consider remote/gamepad constraints. Often focus alone is not enough, and users press Enter to "enter" an interactive mode:
|
|
161
|
-
* - Select: Enter opens options rather than arrow keys opening a popover.
|
|
162
|
-
* - Text inputs: see the next section.
|
|
163
|
-
* - Slider: Enter to start adjusting, arrow keys to change value, Enter/Escape to stop.
|
|
164
|
-
*
|
|
165
|
-
* ### Text inputs
|
|
166
|
-
*
|
|
167
|
-
* On TV-like platforms without physical keyboards, Enter/focus on an input should open a virtual keyboard instead of submitting
|
|
168
|
-
* the form. Users must close the keyboard (Escape) to continue spatial navigation.
|
|
169
|
-
*
|
|
170
|
-
* If navigation keys are mapped to letters (e.g., `w/a/s/d`), they should navigate, not change input values. Inputs should
|
|
171
|
-
* be edited via the virtual keyboard.
|
|
172
|
-
*
|
|
173
|
-
* Note: Stories do not emulate virtual keyboards, so letter-based navigation may change input values in Storybook.
|
|
174
|
-
*
|
|
175
|
-
* ## Debugging
|
|
176
|
-
*
|
|
177
|
-
* ### Storybook toolbar
|
|
178
|
-
*
|
|
179
|
-
* Enable "Spatial navigation" in the toolbar. Key mapping:
|
|
180
|
-
* - Up - ArrowUp
|
|
181
|
-
* - Left - ArrowLeft
|
|
182
|
-
* - Down - ArrowDown
|
|
183
|
-
* - Right - ArrowRight
|
|
184
|
-
* - Enter - Enter
|
|
185
|
-
* - Escape - Escape
|
|
186
|
-
*
|
|
187
|
-
* With wrapper: wraps the component in a 3x3 grid with surrounding buttons for testing.
|
|
188
|
-
* Without a wrapper: renders the component alone.
|
|
189
|
-
*
|
|
190
|
-
* ### Visual debugger
|
|
191
|
-
*
|
|
192
|
-
* With spatial navigation enabled, press Shift + navigation key to visualize calculations:
|
|
193
|
-
*
|
|
194
|
-
* - Star: next active element
|
|
195
|
-
* - `#{number}`: candidate order by distance
|
|
196
|
-
* - `D: {distance}`: computed distance
|
|
197
|
-
*
|
|
198
|
-
* ## Limitations
|
|
199
|
-
*
|
|
200
|
-
* ### Completeness
|
|
201
|
-
*
|
|
202
|
-
* The algorithm cannot guarantee reachability to all elements using the four directions. Some components can be isolated.
|
|
203
|
-
*
|
|
204
|
-
* Workarounds:
|
|
205
|
-
* - Use data attributes to explicitly link navigation targets.
|
|
206
|
-
* - Arrange DOM to improve spatial consistency:
|
|
207
|
-
* - Group focusable elements using dedicated components (lists, menus, etc.).
|
|
208
|
-
* - Avoid complex grid-like layouts with variable-sized items.
|
|
209
|
-
* - Avoid overlap along horizontal or vertical axes.
|
|
210
|
-
* - Avoid nested focusable elements where possible.
|
|
211
|
-
* - Tune algorithm weights to match your UI layout.
|
|
212
|
-
*
|
|
213
|
-
* ### Nested providers
|
|
214
|
-
*
|
|
215
|
-
* Only one provider instance is supported in the application at a time.
|
|
216
|
-
*
|
|
4
|
+
* The spatial navigation provider implements [spatial navigation](https://en.wikipedia.org/wiki/Spatial_navigation): it lets users move focus between elements on a 2D plane using arrow keys, Enter, and Escape, the way TV remotes and game controllers do. It listens to keyboard events at the document level, computes the next focus target from element positions, and dispatches cancellable events around every navigation step.
|
|
5
|
+
*
|
|
6
|
+
* Only one instance is supported per application, placed at the root.
|
|
7
|
+
*
|
|
8
|
+
* **When to use**
|
|
9
|
+
*
|
|
10
|
+
* - Use `mdc-spatialnavigationprovider` for TV, set-top-box, console, or kiosk apps where the primary input is a remote or directional pad.
|
|
11
|
+
* - Use it when consumers should be able to override or intercept focus movement via data attributes or DOM events.
|
|
12
|
+
*
|
|
13
|
+
* **When not to use**
|
|
14
|
+
*
|
|
15
|
+
* - Do not use it in a typical pointer-and-keyboard web app where browser-native focus order is sufficient.
|
|
16
|
+
* - Do not nest providers — only one instance per application is supported.
|
|
17
|
+
*
|
|
18
|
+
* @tagname mdc-spatialnavigationprovider
|
|
217
19
|
* @event navbeforeprocess - (React: onNavBeforeProcess) This event dispatched before spatial navigation process any key event.
|
|
218
20
|
* It can be canceled to prevent any action from spatial navigation, e.g.: back, click or calculating the next candidate.
|
|
219
21
|
* @event navbeforefocus - (React: onNavBeforeFocus) This event is dispatched before the focus is changing to the next element.
|
|
@@ -223,8 +25,6 @@ import { ShortestDistanceWeights, SpatialNavigationContextValue, SpatialNavigati
|
|
|
223
25
|
* action on the goBackElement.
|
|
224
26
|
* @event navnotarget - (React: onNavNoTarget) This event is dispatched when there is no target to focus in the current focus area and
|
|
225
27
|
* in the given direction .
|
|
226
|
-
*
|
|
227
|
-
* @tagname mdc-spatialnavigationprovider
|
|
228
28
|
*/
|
|
229
29
|
declare class SpatialNavigationProvider extends Provider<SpatialNavigationContextValue> {
|
|
230
30
|
/**
|
|
@@ -15,221 +15,8 @@ import SpatialNavigationProviderContext from './spatialnavigationprovider.contex
|
|
|
15
15
|
import { DATA_ATTRIBUTES, DEFAULTS } from './spatialnavigationprovider.constants';
|
|
16
16
|
import { orderElementsByDistance } from './spatialnavigationprovider.utils';
|
|
17
17
|
import { SpatialNavigationEvent } from './spatialnavigationprovider.events';
|
|
18
|
-
// AI-Assisted
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* [Spatial navigation](https://en.wikipedia.org/wiki/Spatial_navigation) lets users move focus among
|
|
23
|
-
* elements on a 2D plane, common on TVs and game consoles with remotes or gamepads.
|
|
24
|
-
*
|
|
25
|
-
* It should have only one instance, and it should be placed at the root of the application.
|
|
26
|
-
*
|
|
27
|
-
* ## Focus management
|
|
28
|
-
*
|
|
29
|
-
* The provider listens to keyboard events and moves focus among elements based on arrow key input.
|
|
30
|
-
* You can influence or override this behavior.
|
|
31
|
-
*
|
|
32
|
-
* ### Steps
|
|
33
|
-
*
|
|
34
|
-
* Spatial navigation goes through the following steps after each keydown:
|
|
35
|
-
*
|
|
36
|
-
* 1. Handle `keydown` in the capture phase.
|
|
37
|
-
* - When the active element has a `data-spatial-{direction}` attribute, call the provider's own `keydown` handler (see step 3).
|
|
38
|
-
* Falls back to component navigation provider did not handle the event.
|
|
39
|
-
* - When the active element's parent is scrollable and it is not fully visible in the given direction, and it does not
|
|
40
|
-
* have a `data-spatial-noscroll` attribute, prevent all navigation and scroll in the given direction half-size of the
|
|
41
|
-
* scroll view.
|
|
42
|
-
* 2. Component own `keydown` handler executed (bubble phase) (e.g., list moves focus internally) it it was not
|
|
43
|
-
* prevented.
|
|
44
|
-
* 3. Spatial Navigation Provider's `keydown` handler executed (bubble phase)
|
|
45
|
-
* - If a key event was not prevented in step 1. emit `navbeforeprocess` to check if any component wants to handle
|
|
46
|
-
* the key event itself. If `navbeforeprocess` event is prevented, stop here.
|
|
47
|
-
* - If the component did not handle `keydown`, it calculates the next focusable item
|
|
48
|
-
* - If the active element has a `data-spatial-{direction}` attribute,
|
|
49
|
-
* - Evaluate the attribute value, try element ID, and falls back to css selector if needed
|
|
50
|
-
* - If it is focusable, move the focus there.
|
|
51
|
-
* - If it is not focusable and contains focusable elements, calculate the next focused item within that element subtree.
|
|
52
|
-
* - Otherwise calculate the next focused item based on the direction and distances.
|
|
53
|
-
* - If there is no next item, it emits `navnotarget` event
|
|
54
|
-
* - Otherwise emit `navbeforefocus`,
|
|
55
|
-
* - If this event is prevented, nothing happens
|
|
56
|
-
* - Otherwise the focus moves to the next element
|
|
57
|
-
*
|
|
58
|
-
* ### Determine next focus
|
|
59
|
-
*
|
|
60
|
-
* The provider uses multiple ways to determine the next focused element. The order defined in the "Steps" section.
|
|
61
|
-
*
|
|
62
|
-
* #### Calculated focus
|
|
63
|
-
*
|
|
64
|
-
* By default, the next focus target is computed from element positions:
|
|
65
|
-
*
|
|
66
|
-
* 1. Find the nearest focus area (scrollable container or active focus trap) relative to the current element.
|
|
67
|
-
* 2. Collect focusable elements in that area.
|
|
68
|
-
* 3. Compute distances from the current element to candidates using the W3C "find the shortest
|
|
69
|
-
* distance" algorithm: https://www.w3.org/TR/css-nav-1/#find-the-shortest-distance
|
|
70
|
-
* 4. If no candidates are found, repeat from step 1, skipping areas already checked.
|
|
71
|
-
* 5. Focus on the closest candidate.
|
|
72
|
-
*
|
|
73
|
-
* Elements with `data-spatial-focusable` are treated as focusable even if they do otherwise not be
|
|
74
|
-
* (e.g., `tabindex="-1"`).
|
|
75
|
-
*
|
|
76
|
-
* Elements with `data-spatial-exclude` are excluded (with its subtree) from the navigation, even if they
|
|
77
|
-
* are focusable.
|
|
78
|
-
*
|
|
79
|
-
* Note: The algorithm is distance-based, so the UI should be designed to focusable elements are
|
|
80
|
-
* predictably reachable. Relative element positions should remain stable; responsive layouts can
|
|
81
|
-
* make navigation unpredictable. This is less of an issue on fixed-size TV UIs but can show unexpected
|
|
82
|
-
* behavior in Storybook when resizing. See the "Limitations" section.
|
|
83
|
-
*
|
|
84
|
-
* #### Overwrite the next element
|
|
85
|
-
*
|
|
86
|
-
* Override calculated navigation by adding one of these attributes to a focusable element:
|
|
87
|
-
*
|
|
88
|
-
* - `data-spatial-up`
|
|
89
|
-
* - `data-spatial-down`
|
|
90
|
-
* - `data-spatial-left`
|
|
91
|
-
* - `data-spatial-right`
|
|
92
|
-
*
|
|
93
|
-
* Each attribute value must be the id of the element to focus when the corresponding key is pressed.
|
|
94
|
-
*
|
|
95
|
-
* #### Element internal navigation
|
|
96
|
-
*
|
|
97
|
-
* Complex components (List, Combobox, Tree, etc.) may handle their own navigation. For example, a List moves
|
|
98
|
-
* focus internally on Down until the last item, after which Down should fall back to provider navigation.
|
|
99
|
-
*
|
|
100
|
-
* To prevent the provider from handling a key, listen to `navbeforeprocess` and call `event.preventDefault()`.
|
|
101
|
-
* This event fires after the component handles `keydown`.
|
|
102
|
-
*
|
|
103
|
-
* ### Cancel focus change
|
|
104
|
-
*
|
|
105
|
-
* Before focusing a computed target, the provider dispatches `navbeforefocus` on the current element. Call
|
|
106
|
-
* `event.preventDefault()` on this event to cancel the focus change.
|
|
107
|
-
*
|
|
108
|
-
* ## Enter action
|
|
109
|
-
*
|
|
110
|
-
* Pressing Enter triggers `.click()` on the currently focused element.
|
|
111
|
-
*
|
|
112
|
-
* You can prevent this by listening to `navbeforeprocess` and calling `event.preventDefault()`.
|
|
113
|
-
*
|
|
114
|
-
* ## Escape/Back action
|
|
115
|
-
*
|
|
116
|
-
* Pressing Escape tries to find a focusable element with `data-spatial-go-back` and clicks it. If none exists,
|
|
117
|
-
* the provider calls `history.back()`.
|
|
118
|
-
*
|
|
119
|
-
* You can prevent this by listening to `navbeforeprocess` and calling `event.preventDefault()`.
|
|
120
|
-
*
|
|
121
|
-
* You can also intercept the back click by listening to `navback` and calling `event.preventDefault()`.
|
|
122
|
-
*
|
|
123
|
-
* ## Control data attributes
|
|
124
|
-
*
|
|
125
|
-
* Supported data attributes:
|
|
126
|
-
*
|
|
127
|
-
* | Attribute | Value | Default | Description |
|
|
128
|
-
* |------------------------------|------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------|
|
|
129
|
-
* | `data-spatial-left` | empty string / id / selector | N/A | Prevent native navigation in the Left direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
130
|
-
* | `data-spatial-up` | empty string / id / selector | N/A | Prevent native navigation in Up direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
131
|
-
* | `data-spatial-right` | empty string / id / selector | N/A | Prevent native navigation in the Right direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
132
|
-
* | `data-spatial-down` | empty string / id / selector | N/A | Prevent native navigation in Down direction, focus it if it's focusable otherwise limit the search in the selected container. |
|
|
133
|
-
* | `data-spatial-go-back` | N/A | N/A | First focusable element with this attribute is clicked on Back/Escape |
|
|
134
|
-
* | `data-spatial-focusable` | N/A | N/A | Treat element as focusable even if it normally is not (e.g., `tabindex="-1"`) |
|
|
135
|
-
* | `data-spatial-exclude` | N/A | N/A | Exclude focusable element (and its subtree) from the navigation |
|
|
136
|
-
* | `data-spatial-noscroll` | N/A | N/A | Prevent scroll for active element in scrollable area even if the is not fit in view |
|
|
137
|
-
* | `data-spatial-scroll-parent` | N/A | N/A | When the focusable item in not a direct child of the scrollable aria use this attribute to mark scrollable area element |
|
|
138
|
-
*
|
|
139
|
-
* ## Event emitting order
|
|
140
|
-
*
|
|
141
|
-
* On a navigation key press, events fire in this order:
|
|
142
|
-
*
|
|
143
|
-
* 1. `navbeforeprocess` on the currently focused element.
|
|
144
|
-
* 2. If not prevented:
|
|
145
|
-
* a. Arrow keys: `navbeforefocus` on the currently focused element.
|
|
146
|
-
* b. Enter: `.click()` on the currently focused element.
|
|
147
|
-
* c. Escape/Back: `navback` on the provider, then `.click()` on the go-back element or `history.back()`.
|
|
148
|
-
* 3. If no target is found in the requested direction: `navnotarget` on the provider.
|
|
149
|
-
*
|
|
150
|
-
* ## Handle complex components
|
|
151
|
-
*
|
|
152
|
-
* ### Generic components
|
|
153
|
-
*
|
|
154
|
-
* Components that handle navigation internally should prevent the provider from acting. Handle `navbeforeprocess`
|
|
155
|
-
* and call `event.preventDefault()` for keys you process yourself.
|
|
156
|
-
*
|
|
157
|
-
* ### Form inputs
|
|
158
|
-
*
|
|
159
|
-
* Native inputs often submit on Enter, which is not desirable here. Enter should toggle or activate the control
|
|
160
|
-
* (e.g., check/uncheck). Provide a dedicated submit button users can navigate to and press Enter on.
|
|
161
|
-
*
|
|
162
|
-
* ### Utilities for complex components
|
|
163
|
-
*
|
|
164
|
-
* #### KeyToActionMixin
|
|
165
|
-
*
|
|
166
|
-
* Maps key events to action names. Call `getActionForKeyEvent` to get the action for a keyboard event. Also provides
|
|
167
|
-
* `getKeyboardNavMode` to check whether navigation is spatial or default.
|
|
168
|
-
*
|
|
169
|
-
* #### KeyDownHandledMixin
|
|
170
|
-
*
|
|
171
|
-
* Notify the provider when a component handled `keydown` internally. Call `keyDownEventHandled` whenever you process
|
|
172
|
-
* keydown yourself.
|
|
173
|
-
*
|
|
174
|
-
* ## Platform specific behaviors
|
|
175
|
-
*
|
|
176
|
-
* Consider remote/gamepad constraints. Often focus alone is not enough, and users press Enter to "enter" an interactive mode:
|
|
177
|
-
* - Select: Enter opens options rather than arrow keys opening a popover.
|
|
178
|
-
* - Text inputs: see the next section.
|
|
179
|
-
* - Slider: Enter to start adjusting, arrow keys to change value, Enter/Escape to stop.
|
|
180
|
-
*
|
|
181
|
-
* ### Text inputs
|
|
182
|
-
*
|
|
183
|
-
* On TV-like platforms without physical keyboards, Enter/focus on an input should open a virtual keyboard instead of submitting
|
|
184
|
-
* the form. Users must close the keyboard (Escape) to continue spatial navigation.
|
|
185
|
-
*
|
|
186
|
-
* If navigation keys are mapped to letters (e.g., `w/a/s/d`), they should navigate, not change input values. Inputs should
|
|
187
|
-
* be edited via the virtual keyboard.
|
|
188
|
-
*
|
|
189
|
-
* Note: Stories do not emulate virtual keyboards, so letter-based navigation may change input values in Storybook.
|
|
190
|
-
*
|
|
191
|
-
* ## Debugging
|
|
192
|
-
*
|
|
193
|
-
* ### Storybook toolbar
|
|
194
|
-
*
|
|
195
|
-
* Enable "Spatial navigation" in the toolbar. Key mapping:
|
|
196
|
-
* - Up - ArrowUp
|
|
197
|
-
* - Left - ArrowLeft
|
|
198
|
-
* - Down - ArrowDown
|
|
199
|
-
* - Right - ArrowRight
|
|
200
|
-
* - Enter - Enter
|
|
201
|
-
* - Escape - Escape
|
|
202
|
-
*
|
|
203
|
-
* With wrapper: wraps the component in a 3x3 grid with surrounding buttons for testing.
|
|
204
|
-
* Without a wrapper: renders the component alone.
|
|
205
|
-
*
|
|
206
|
-
* ### Visual debugger
|
|
207
|
-
*
|
|
208
|
-
* With spatial navigation enabled, press Shift + navigation key to visualize calculations:
|
|
209
|
-
*
|
|
210
|
-
* - Star: next active element
|
|
211
|
-
* - `#{number}`: candidate order by distance
|
|
212
|
-
* - `D: {distance}`: computed distance
|
|
213
|
-
*
|
|
214
|
-
* ## Limitations
|
|
215
|
-
*
|
|
216
|
-
* ### Completeness
|
|
217
|
-
*
|
|
218
|
-
* The algorithm cannot guarantee reachability to all elements using the four directions. Some components can be isolated.
|
|
219
|
-
*
|
|
220
|
-
* Workarounds:
|
|
221
|
-
* - Use data attributes to explicitly link navigation targets.
|
|
222
|
-
* - Arrange DOM to improve spatial consistency:
|
|
223
|
-
* - Group focusable elements using dedicated components (lists, menus, etc.).
|
|
224
|
-
* - Avoid complex grid-like layouts with variable-sized items.
|
|
225
|
-
* - Avoid overlap along horizontal or vertical axes.
|
|
226
|
-
* - Avoid nested focusable elements where possible.
|
|
227
|
-
* - Tune algorithm weights to match your UI layout.
|
|
228
|
-
*
|
|
229
|
-
* ### Nested providers
|
|
230
|
-
*
|
|
231
|
-
* Only one provider instance is supported in the application at a time.
|
|
232
|
-
*
|
|
19
|
+
* @tagname mdc-spatialnavigationprovider
|
|
233
20
|
* @event navbeforeprocess - (React: onNavBeforeProcess) This event dispatched before spatial navigation process any key event.
|
|
234
21
|
* It can be canceled to prevent any action from spatial navigation, e.g.: back, click or calculating the next candidate.
|
|
235
22
|
* @event navbeforefocus - (React: onNavBeforeFocus) This event is dispatched before the focus is changing to the next element.
|
|
@@ -240,7 +27,6 @@ import { SpatialNavigationEvent } from './spatialnavigationprovider.events';
|
|
|
240
27
|
* @event navnotarget - (React: onNavNoTarget) This event is dispatched when there is no target to focus in the current focus area and
|
|
241
28
|
* in the given direction .
|
|
242
29
|
*
|
|
243
|
-
* @tagname mdc-spatialnavigationprovider
|
|
244
30
|
*/
|
|
245
31
|
class SpatialNavigationProvider extends Provider {
|
|
246
32
|
/**
|
|
@@ -2,38 +2,26 @@ import { CSSResult } from 'lit';
|
|
|
2
2
|
import { Component } from '../../models';
|
|
3
3
|
import { SpinnerSize, SpinnerVariant } from './spinner.types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size
|
|
20
|
-
* CSS property.
|
|
21
|
-
*
|
|
22
|
-
* Spinner Colors:
|
|
23
|
-
* - **Default**: Use for most use cases.
|
|
24
|
-
* - **Inverted**: Only to be used within inverted components, such as coachmarks.
|
|
25
|
-
*
|
|
26
|
-
* Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role
|
|
27
|
-
* will be unset
|
|
28
|
-
* and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.
|
|
29
|
-
*
|
|
5
|
+
* The spinner is an indeterminate progress indicator, best suited for cases where the duration or progress of an operation is variable or unknown. It is rendered as a rotating circular arc and supports multiple sizes, two colour variants, and a button-friendly variant for in-button loading states.
|
|
6
|
+
*
|
|
7
|
+
* **When to use**
|
|
8
|
+
*
|
|
9
|
+
* - Use `mdc-spinner` to signal that something is happening but you cannot communicate concrete progress.
|
|
10
|
+
* - Use the `button` variant inside `mdc-button` to indicate that the button's action is in progress.
|
|
11
|
+
* - Use the small size inline with loading text, the midsize for most cases, and the large size for full-region or full-page loading.
|
|
12
|
+
*
|
|
13
|
+
* **When not to use**
|
|
14
|
+
*
|
|
15
|
+
* - Use `mdc-progressbar` when you can show concrete, measurable progress.
|
|
16
|
+
* - Use `mdc-skeleton` when you want a placeholder that matches the layout of the content being loaded.
|
|
17
|
+
*
|
|
30
18
|
* @tagname mdc-spinner
|
|
31
|
-
*
|
|
19
|
+
*
|
|
32
20
|
* @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.
|
|
33
21
|
* @cssproperty --mdc-spinner-inverted-color - Allows customization of the inverted spinner color.
|
|
34
22
|
* @cssproperty --mdc-spinner-button-variant-color - Allows customization of the spinner Button variant color.
|
|
35
23
|
* @cssproperty --mdc-spinner-size - Allows customization of the spinner size.
|
|
36
|
-
*
|
|
24
|
+
*
|
|
37
25
|
* @csspart container - The svg which contains the circle spinner.
|
|
38
26
|
* @csspart circle - The circle of the spinner.
|
|
39
27
|
*/
|
|
@@ -14,31 +14,6 @@ import { ROLE } from '../../utils/roles';
|
|
|
14
14
|
import styles from './spinner.styles';
|
|
15
15
|
import { DEFAULTS } from './spinner.constants';
|
|
16
16
|
/**
|
|
17
|
-
* `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning
|
|
18
|
-
* it's best for cases where the progress or duration of a process is variable or unknown.
|
|
19
|
-
*
|
|
20
|
-
* Spinner Variants:
|
|
21
|
-
* - **Standalone (Default)**: Track has a blue color.
|
|
22
|
-
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
|
23
|
-
* To ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s
|
|
24
|
-
* icon or label text.
|
|
25
|
-
*
|
|
26
|
-
* Spinner Sizes:
|
|
27
|
-
* - **Large (96px)**: Use when replacing entire regions or pages that are still loading
|
|
28
|
-
* - **MidSize (48px) (Default)**: Use for most use cases.
|
|
29
|
-
* - **Small (24px)**: Use for inline with loading text.
|
|
30
|
-
*
|
|
31
|
-
* Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size
|
|
32
|
-
* CSS property.
|
|
33
|
-
*
|
|
34
|
-
* Spinner Colors:
|
|
35
|
-
* - **Default**: Use for most use cases.
|
|
36
|
-
* - **Inverted**: Only to be used within inverted components, such as coachmarks.
|
|
37
|
-
*
|
|
38
|
-
* Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role
|
|
39
|
-
* will be unset
|
|
40
|
-
* and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.
|
|
41
|
-
*
|
|
42
17
|
* @tagname mdc-spinner
|
|
43
18
|
*
|
|
44
19
|
* @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.
|
|
@@ -2,35 +2,30 @@ import { CSSResult } from 'lit';
|
|
|
2
2
|
import { Component } from '../../models';
|
|
3
3
|
declare const StaticCheckbox_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `mdc-checkbox`
|
|
16
|
-
*
|
|
17
|
-
* ## Accessibility
|
|
18
|
-
* - StaticCheckbox is decorative and non-interactive by design
|
|
19
|
-
* - Always pair with descriptive text labels in the default slot
|
|
20
|
-
* - Do not use this as a replacement for interactive checkboxes in forms
|
|
21
|
-
*
|
|
5
|
+
* The static checkbox is a decorative, non-interactive checkbox used to display checkbox states in read-only contexts (summary views, confirmation screens, historical form data). It supports checked, indeterminate, disabled, soft-disabled, and read-only visual states but does not handle user interaction or participate in forms.
|
|
6
|
+
*
|
|
7
|
+
* **When to use**
|
|
8
|
+
*
|
|
9
|
+
* - Use `mdc-staticcheckbox` to render the visual shape of a checkbox in read-only UIs such as summary screens, confirmation screens, or historical form data.
|
|
10
|
+
* - Use it inside lists or cards where the checkbox is part of the display, not a control.
|
|
11
|
+
*
|
|
12
|
+
* **When not to use**
|
|
13
|
+
*
|
|
14
|
+
* - Use `mdc-checkbox` for any interactive checkbox in a form.
|
|
15
|
+
* - Do not use `mdc-staticcheckbox` as a replacement for `mdc-checkbox` — it cannot be focused, toggled, or submitted with a form.
|
|
16
|
+
*
|
|
22
17
|
* @tagname mdc-staticcheckbox
|
|
23
|
-
*
|
|
18
|
+
*
|
|
24
19
|
* @dependency mdc-icon
|
|
25
|
-
*
|
|
20
|
+
*
|
|
26
21
|
* @cssproperty --mdc-staticcheckbox-border-color - Border color of the checkbox.
|
|
27
22
|
* @cssproperty --mdc-staticcheckbox-background-color - Background color of the checkbox.
|
|
28
23
|
* @cssproperty --mdc-staticcheckbox-icon-color - Icon color of the checkbox.
|
|
29
24
|
* @cssproperty --mdc-staticcheckbox-size - Size of the checkbox.
|
|
30
|
-
*
|
|
25
|
+
*
|
|
31
26
|
* @csspart icon-container - The container for the checkbox icon.
|
|
32
27
|
* @csspart checkbox-icon - The checkbox icon element.
|
|
33
|
-
*
|
|
28
|
+
*
|
|
34
29
|
* @slot - Default slot for label text.
|
|
35
30
|
*/
|
|
36
31
|
declare class StaticCheckbox extends StaticCheckbox_base {
|
|
@@ -14,23 +14,6 @@ import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
|
|
14
14
|
import styles from './staticcheckbox.styles';
|
|
15
15
|
import { ICON_NAME } from './staticcheckbox.constants';
|
|
16
16
|
/**
|
|
17
|
-
* The StaticCheckbox component is a decorative, non-interactive checkbox used for visual
|
|
18
|
-
* presentation in read-only scenarios. Unlike the interactive `mdc-checkbox`, it does not
|
|
19
|
-
* handle user interactions or form submissions.
|
|
20
|
-
*
|
|
21
|
-
* This component supports multiple visual states: checked, indeterminate, disabled, readonly,
|
|
22
|
-
* and soft-disabled.
|
|
23
|
-
*
|
|
24
|
-
* ## When to use
|
|
25
|
-
* Use StaticCheckbox to display checkbox states in read-only contexts such as summary views,
|
|
26
|
-
* confirmation screens, or when showing historical form data. For interactive checkboxes, use
|
|
27
|
-
* `mdc-checkbox` instead.
|
|
28
|
-
*
|
|
29
|
-
* ## Accessibility
|
|
30
|
-
* - StaticCheckbox is decorative and non-interactive by design
|
|
31
|
-
* - Always pair with descriptive text labels in the default slot
|
|
32
|
-
* - Do not use this as a replacement for interactive checkboxes in forms
|
|
33
|
-
*
|
|
34
17
|
* @tagname mdc-staticcheckbox
|
|
35
18
|
*
|
|
36
19
|
* @dependency mdc-icon
|