@shortfuse/materialdesignweb 0.7.6 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -90
- package/bin/mdw-css.js +1 -1
- package/components/Badge.js +14 -7
- package/components/Body.js +3 -0
- package/components/BottomAppBar.js +4 -13
- package/components/BottomSheet.js +424 -0
- package/components/Box.js +20 -28
- package/components/Button.js +85 -79
- package/components/Button.md +9 -9
- package/components/Card.js +60 -72
- package/components/Checkbox.js +33 -42
- package/components/CheckboxIcon.js +11 -29
- package/components/Chip.js +13 -11
- package/components/Dialog.js +214 -394
- package/components/DialogActions.js +2 -2
- package/components/Display.js +55 -0
- package/components/Divider.js +3 -3
- package/components/Fab.js +83 -18
- package/components/FabContainer.js +48 -0
- package/components/FilterChip.js +35 -33
- package/components/Grid.js +176 -0
- package/components/Headline.js +5 -28
- package/components/Icon.js +61 -76
- package/components/IconButton.js +72 -126
- package/components/Input.js +859 -1
- package/components/InputChip.js +161 -0
- package/components/Label.js +3 -0
- package/components/List.js +4 -6
- package/components/ListItem.js +46 -30
- package/components/ListOption.js +86 -53
- package/components/Listbox.js +248 -0
- package/components/Menu.js +69 -528
- package/components/MenuItem.js +33 -36
- package/components/NavBar.js +49 -86
- package/components/NavDrawer.js +16 -15
- package/components/NavDrawerItem.js +4 -5
- package/components/NavItem.js +58 -41
- package/components/NavRail.js +30 -20
- package/components/NavRailItem.js +8 -3
- package/components/Page.js +105 -0
- package/components/Pane.js +11 -274
- package/components/Popup.js +29 -0
- package/components/Progress.js +24 -23
- package/components/Radio.js +40 -36
- package/components/RadioIcon.js +12 -16
- package/components/Ripple.js +13 -10
- package/components/Root.js +209 -0
- package/components/Scrim.js +87 -0
- package/components/Search.js +77 -0
- package/components/SegmentedButton.js +33 -45
- package/components/SegmentedButtonGroup.js +25 -13
- package/components/Select.js +10 -11
- package/components/Shape.js +5 -65
- package/components/SideSheet.js +308 -0
- package/components/Slider.js +108 -78
- package/components/Snackbar.js +26 -21
- package/components/SnackbarContainer.js +42 -0
- package/components/Surface.js +17 -12
- package/components/Switch.js +45 -24
- package/components/SwitchIcon.js +49 -39
- package/components/Tab.js +64 -43
- package/components/TabContent.js +5 -3
- package/components/TabList.js +62 -34
- package/components/TabPanel.js +11 -8
- package/components/Table.js +116 -0
- package/components/TextArea.js +54 -50
- package/components/Title.js +4 -9
- package/components/Tooltip.js +44 -22
- package/components/TopAppBar.js +68 -172
- package/constants/shapes.js +36 -0
- package/constants/typography.js +127 -0
- package/core/Composition.js +1164 -645
- package/core/CompositionAdapter.js +314 -0
- package/core/CustomElement.js +701 -286
- package/core/css.js +121 -15
- package/core/customTypes.js +157 -40
- package/core/dom.js +17 -11
- package/{utils → core}/jsonMergePatch.js +42 -18
- package/core/observe.js +343 -244
- package/core/optimizations.js +23 -0
- package/core/template.js +19 -56
- package/core/uid.js +13 -0
- package/dist/index.min.js +85 -184
- package/dist/index.min.js.map +4 -4
- package/dist/meta.json +1 -1
- package/dom/HTMLOptionsCollectionProxy.js +106 -0
- package/loaders/palette.js +13 -0
- package/loaders/theme.js +12 -0
- package/mixins/AriaReflectorMixin.js +53 -14
- package/mixins/AriaToolbarMixin.js +5 -3
- package/mixins/ControlMixin.js +92 -41
- package/mixins/DelegatesFocusMixin.js +54 -0
- package/mixins/DensityMixin.js +2 -3
- package/mixins/ElevationMixin.js +62 -0
- package/mixins/FlexableMixin.js +67 -39
- package/mixins/FormAssociatedMixin.js +71 -16
- package/mixins/HyperlinkMixin.js +66 -0
- package/mixins/InputMixin.js +205 -39
- package/mixins/KeyboardNavMixin.js +22 -7
- package/mixins/NavigationListenerMixin.js +33 -0
- package/mixins/PopupMixin.js +725 -0
- package/mixins/RTLObserverMixin.js +0 -1
- package/mixins/ResizeObserverMixin.js +16 -5
- package/mixins/RippleMixin.js +11 -10
- package/mixins/ScrollListenerMixin.js +42 -33
- package/mixins/SemiStickyMixin.js +97 -0
- package/mixins/ShapeMaskedMixin.js +117 -0
- package/mixins/ShapeMixin.js +17 -194
- package/mixins/StateMixin.js +80 -39
- package/mixins/TextFieldMixin.js +139 -183
- package/mixins/ThemableMixin.js +71 -161
- package/mixins/TooltipTriggerMixin.js +292 -366
- package/mixins/TouchTargetMixin.js +5 -4
- package/mixins/TypographyMixin.js +121 -0
- package/package.json +111 -71
- package/services/rtl.js +10 -0
- package/services/svgAlias.js +17 -0
- package/{theming/index.js → services/theme.js} +25 -175
- package/types/bin/mdw-css.d.ts +3 -0
- package/types/bin/mdw-css.d.ts.map +1 -0
- package/types/components/Badge.d.ts +39 -0
- package/types/components/Badge.d.ts.map +1 -0
- package/types/components/Body.d.ts +29 -0
- package/types/components/Body.d.ts.map +1 -0
- package/types/components/BottomAppBar.d.ts +73 -0
- package/types/components/BottomAppBar.d.ts.map +1 -0
- package/types/components/BottomSheet.d.ts +109 -0
- package/types/components/BottomSheet.d.ts.map +1 -0
- package/types/components/Box.d.ts +16 -0
- package/types/components/Box.d.ts.map +1 -0
- package/types/components/Button.d.ts +714 -0
- package/types/components/Button.d.ts.map +1 -0
- package/types/components/Card.d.ts +412 -0
- package/types/components/Card.d.ts.map +1 -0
- package/types/components/Checkbox.d.ts +205 -0
- package/types/components/Checkbox.d.ts.map +1 -0
- package/types/components/CheckboxIcon.d.ts +44 -0
- package/types/components/CheckboxIcon.d.ts.map +1 -0
- package/types/components/Chip.d.ts +1425 -0
- package/types/components/Chip.d.ts.map +1 -0
- package/types/components/Dialog.d.ts +286 -0
- package/types/components/Dialog.d.ts.map +1 -0
- package/types/components/DialogActions.d.ts +4 -0
- package/types/components/DialogActions.d.ts.map +1 -0
- package/types/components/Display.d.ts +45 -0
- package/types/components/Display.d.ts.map +1 -0
- package/types/components/Divider.d.ts +10 -0
- package/types/components/Divider.d.ts.map +1 -0
- package/types/components/Fab.d.ts +741 -0
- package/types/components/Fab.d.ts.map +1 -0
- package/types/components/FabContainer.d.ts +10 -0
- package/types/components/FabContainer.d.ts.map +1 -0
- package/types/components/FilterChip.d.ts +4283 -0
- package/types/components/FilterChip.d.ts.map +1 -0
- package/types/components/Grid.d.ts +37 -0
- package/types/components/Grid.d.ts.map +1 -0
- package/types/components/Headline.d.ts +47 -0
- package/types/components/Headline.d.ts.map +1 -0
- package/types/components/Icon.d.ts +103 -0
- package/types/components/Icon.d.ts.map +1 -0
- package/types/components/IconButton.d.ts +1486 -0
- package/types/components/IconButton.d.ts.map +1 -0
- package/types/components/Input.d.ts +51288 -0
- package/types/components/Input.d.ts.map +1 -0
- package/types/components/InputChip.d.ts +243 -0
- package/types/components/InputChip.d.ts.map +1 -0
- package/types/components/Label.d.ts +29 -0
- package/types/components/Label.d.ts.map +1 -0
- package/types/components/List.d.ts +31 -0
- package/types/components/List.d.ts.map +1 -0
- package/types/components/ListItem.d.ts +349 -0
- package/types/components/ListItem.d.ts.map +1 -0
- package/types/components/ListOption.d.ts +1493 -0
- package/types/components/ListOption.d.ts.map +1 -0
- package/types/components/Listbox.d.ts +12012 -0
- package/types/components/Listbox.d.ts.map +1 -0
- package/types/components/Menu.d.ts +119 -0
- package/types/components/Menu.d.ts.map +1 -0
- package/types/components/MenuItem.d.ts +3109 -0
- package/types/components/MenuItem.d.ts.map +1 -0
- package/types/components/NavBar.d.ts +18 -0
- package/types/components/NavBar.d.ts.map +1 -0
- package/types/components/NavBarItem.d.ts +186 -0
- package/types/components/NavBarItem.d.ts.map +1 -0
- package/types/components/NavDrawer.d.ts +108 -0
- package/types/components/NavDrawer.d.ts.map +1 -0
- package/types/components/NavDrawerItem.d.ts +186 -0
- package/types/components/NavDrawerItem.d.ts.map +1 -0
- package/types/components/NavItem.d.ts +190 -0
- package/types/components/NavItem.d.ts.map +1 -0
- package/types/components/NavRail.d.ts +109 -0
- package/types/components/NavRail.d.ts.map +1 -0
- package/types/components/NavRailItem.d.ts +186 -0
- package/types/components/NavRailItem.d.ts.map +1 -0
- package/types/components/Page.d.ts +24 -0
- package/types/components/Page.d.ts.map +1 -0
- package/types/components/Pane.d.ts +44 -0
- package/types/components/Pane.d.ts.map +1 -0
- package/types/components/Popup.d.ts +76 -0
- package/types/components/Popup.d.ts.map +1 -0
- package/types/components/Progress.d.ts +19 -0
- package/types/components/Progress.d.ts.map +1 -0
- package/types/components/Radio.d.ts +199 -0
- package/types/components/Radio.d.ts.map +1 -0
- package/types/components/RadioIcon.d.ts +46 -0
- package/types/components/RadioIcon.d.ts.map +1 -0
- package/types/components/Ripple.d.ts +34 -0
- package/types/components/Ripple.d.ts.map +1 -0
- package/types/components/Root.d.ts +68 -0
- package/types/components/Root.d.ts.map +1 -0
- package/types/components/Scrim.d.ts +6 -0
- package/types/components/Scrim.d.ts.map +1 -0
- package/types/components/Search.d.ts +16 -0
- package/types/components/Search.d.ts.map +1 -0
- package/types/components/SegmentedButton.d.ts +718 -0
- package/types/components/SegmentedButton.d.ts.map +1 -0
- package/types/components/SegmentedButtonGroup.d.ts +44 -0
- package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
- package/types/components/Select.d.ts +1361 -0
- package/types/components/Select.d.ts.map +1 -0
- package/types/components/Shape.d.ts +10 -0
- package/types/components/Shape.d.ts.map +1 -0
- package/types/components/SideSheet.d.ts +106 -0
- package/types/components/SideSheet.d.ts.map +1 -0
- package/types/components/Slider.d.ts +382 -0
- package/types/components/Slider.d.ts.map +1 -0
- package/types/components/Snackbar.d.ts +65 -0
- package/types/components/Snackbar.d.ts.map +1 -0
- package/types/components/SnackbarContainer.d.ts +6 -0
- package/types/components/SnackbarContainer.d.ts.map +1 -0
- package/types/components/Surface.d.ts +45 -0
- package/types/components/Surface.d.ts.map +1 -0
- package/types/components/Switch.d.ts +183 -0
- package/types/components/Switch.d.ts.map +1 -0
- package/types/components/SwitchIcon.d.ts +169 -0
- package/types/components/SwitchIcon.d.ts.map +1 -0
- package/types/components/Tab.d.ts +879 -0
- package/types/components/Tab.d.ts.map +1 -0
- package/types/components/TabContent.d.ts +122 -0
- package/types/components/TabContent.d.ts.map +1 -0
- package/types/components/TabList.d.ts +6266 -0
- package/types/components/TabList.d.ts.map +1 -0
- package/types/components/TabPanel.d.ts +28 -0
- package/types/components/TabPanel.d.ts.map +1 -0
- package/types/components/Table.d.ts +2 -0
- package/types/components/Table.d.ts.map +1 -0
- package/types/components/TextArea.d.ts +1394 -0
- package/types/components/TextArea.d.ts.map +1 -0
- package/types/components/Title.d.ts +47 -0
- package/types/components/Title.d.ts.map +1 -0
- package/types/components/Tooltip.d.ts +49 -0
- package/types/components/Tooltip.d.ts.map +1 -0
- package/types/components/TopAppBar.d.ts +130 -0
- package/types/components/TopAppBar.d.ts.map +1 -0
- package/types/constants/colorKeywords.d.ts +2 -0
- package/types/constants/colorKeywords.d.ts.map +1 -0
- package/types/constants/shapes.d.ts +38 -0
- package/types/constants/shapes.d.ts.map +1 -0
- package/types/constants/typography.d.ts +212 -0
- package/types/constants/typography.d.ts.map +1 -0
- package/types/core/Composition.d.ts +252 -0
- package/types/core/Composition.d.ts.map +1 -0
- package/types/core/CompositionAdapter.d.ts +92 -0
- package/types/core/CompositionAdapter.d.ts.map +1 -0
- package/types/core/CustomElement.d.ts +302 -0
- package/types/core/CustomElement.d.ts.map +1 -0
- package/types/core/css.d.ts +44 -0
- package/types/core/css.d.ts.map +1 -0
- package/types/core/customTypes.d.ts +26 -0
- package/types/core/customTypes.d.ts.map +1 -0
- package/types/core/dom.d.ts +32 -0
- package/types/core/dom.d.ts.map +1 -0
- package/types/core/jsonMergePatch.d.ts +31 -0
- package/types/core/jsonMergePatch.d.ts.map +1 -0
- package/types/core/observe.d.ts +113 -0
- package/types/core/observe.d.ts.map +1 -0
- package/types/core/optimizations.d.ts +7 -0
- package/types/core/optimizations.d.ts.map +1 -0
- package/types/core/template.d.ts +47 -0
- package/types/core/template.d.ts.map +1 -0
- package/types/core/uid.d.ts +6 -0
- package/types/core/uid.d.ts.map +1 -0
- package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
- package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
- package/types/index.d.ts +88 -0
- package/types/index.d.ts.map +1 -0
- package/types/loaders/palette.d.ts +2 -0
- package/types/loaders/palette.d.ts.map +1 -0
- package/types/loaders/theme.d.ts +2 -0
- package/types/loaders/theme.d.ts.map +1 -0
- package/types/mixins/AriaReflectorMixin.d.ts +23 -0
- package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
- package/types/mixins/AriaToolbarMixin.d.ts +32 -0
- package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
- package/types/mixins/ControlMixin.d.ts +124 -0
- package/types/mixins/ControlMixin.d.ts.map +1 -0
- package/types/mixins/DelegatesFocusMixin.d.ts +5 -0
- package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
- package/types/mixins/DensityMixin.d.ts +5 -0
- package/types/mixins/DensityMixin.d.ts.map +1 -0
- package/types/mixins/ElevationMixin.d.ts +33 -0
- package/types/mixins/ElevationMixin.d.ts.map +1 -0
- package/types/mixins/FlexableMixin.d.ts +13 -0
- package/types/mixins/FlexableMixin.d.ts.map +1 -0
- package/types/mixins/FormAssociatedMixin.d.ts +122 -0
- package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
- package/types/mixins/HyperlinkMixin.d.ts +22 -0
- package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
- package/types/mixins/InputMixin.d.ts +179 -0
- package/types/mixins/InputMixin.d.ts.map +1 -0
- package/types/mixins/KeyboardNavMixin.d.ts +47 -0
- package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
- package/types/mixins/NavigationListenerMixin.d.ts +8 -0
- package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
- package/types/mixins/PopupMixin.d.ts +82 -0
- package/types/mixins/PopupMixin.d.ts.map +1 -0
- package/types/mixins/RTLObserverMixin.d.ts +7 -0
- package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
- package/types/mixins/ResizeObserverMixin.d.ts +12 -0
- package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
- package/types/mixins/RippleMixin.d.ts +92 -0
- package/types/mixins/RippleMixin.d.ts.map +1 -0
- package/types/mixins/ScrollListenerMixin.d.ts +41 -0
- package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
- package/types/mixins/SemiStickyMixin.d.ts +50 -0
- package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMaskedMixin.d.ts +9 -0
- package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMixin.d.ts +38 -0
- package/types/mixins/ShapeMixin.d.ts.map +1 -0
- package/types/mixins/StateMixin.d.ts +27 -0
- package/types/mixins/StateMixin.d.ts.map +1 -0
- package/types/mixins/TextFieldMixin.d.ts +1354 -0
- package/types/mixins/TextFieldMixin.d.ts.map +1 -0
- package/types/mixins/ThemableMixin.d.ts +9 -0
- package/types/mixins/ThemableMixin.d.ts.map +1 -0
- package/types/mixins/TooltipTriggerMixin.d.ts +106 -0
- package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
- package/types/mixins/TouchTargetMixin.d.ts +3 -0
- package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
- package/types/mixins/TypographyMixin.d.ts +17 -0
- package/types/mixins/TypographyMixin.d.ts.map +1 -0
- package/types/services/rtl.d.ts +3 -0
- package/types/services/rtl.d.ts.map +1 -0
- package/types/services/svgAlias.d.ts +13 -0
- package/types/services/svgAlias.d.ts.map +1 -0
- package/types/services/theme.d.ts +45 -0
- package/types/services/theme.d.ts.map +1 -0
- package/types/utils/cli.d.ts +3 -0
- package/types/utils/cli.d.ts.map +1 -0
- package/types/utils/function.d.ts +3 -0
- package/types/utils/function.d.ts.map +1 -0
- package/types/utils/jsx-runtime.d.ts +20 -0
- package/types/utils/jsx-runtime.d.ts.map +1 -0
- package/types/utils/material-color/blend.d.ts +34 -0
- package/types/utils/material-color/blend.d.ts.map +1 -0
- package/types/utils/material-color/hct/Cam16.d.ts +142 -0
- package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
- package/types/utils/material-color/hct/Hct.d.ts +93 -0
- package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
- package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
- package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
- package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
- package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
- package/types/utils/material-color/helper.d.ts +8 -0
- package/types/utils/material-color/helper.d.ts.map +1 -0
- package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
- package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
- package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
- package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
- package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
- package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
- package/types/utils/material-color/utils/color.d.ts +172 -0
- package/types/utils/material-color/utils/color.d.ts.map +1 -0
- package/types/utils/material-color/utils/math.d.ts +94 -0
- package/types/utils/material-color/utils/math.d.ts.map +1 -0
- package/types/utils/pixelmatch.d.ts +22 -0
- package/types/utils/pixelmatch.d.ts.map +1 -0
- package/types/utils/popup.d.ts +106 -0
- package/types/utils/popup.d.ts.map +1 -0
- package/types/utils/searchParams.d.ts +3 -0
- package/types/utils/searchParams.d.ts.map +1 -0
- package/types/utils/svg.d.ts +7 -0
- package/types/utils/svg.d.ts.map +1 -0
- package/utils/{hct → material-color}/blend.js +8 -10
- package/utils/{hct → material-color/hct}/Cam16.js +196 -69
- package/utils/{hct → material-color/hct}/Hct.js +61 -19
- package/utils/{hct → material-color/hct}/ViewingConditions.js +3 -3
- package/utils/{hct → material-color/hct}/hctSolver.js +9 -16
- package/utils/{hct → material-color}/helper.js +11 -18
- package/utils/{hct → material-color/palettes}/CorePalette.js +79 -19
- package/utils/{hct → material-color/palettes}/TonalPalette.js +12 -4
- package/utils/material-color/scheme/Scheme.js +376 -0
- package/utils/{hct/colorUtils.js → material-color/utils/color.js} +61 -1
- package/utils/pixelmatch.js +360 -0
- package/utils/popup.js +127 -30
- package/utils/searchParams.js +19 -0
- package/components/ExtendedFab.js +0 -36
- package/components/Layout.js +0 -35
- package/components/ListSelect.js +0 -220
- package/components/Nav.js +0 -40
- package/components/Option.js +0 -91
- package/core/ICustomElement.d.ts +0 -291
- package/core/ICustomElement.js +0 -1
- package/core/identify.js +0 -40
- package/core/typings.d.ts +0 -136
- package/core/typings.js +0 -1
- package/mixins/SurfaceMixin.js +0 -181
- package/theming/loader.js +0 -22
- package/utils/hct/Scheme.js +0 -587
- /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
- /package/utils/{hct/mathUtils.js → material-color/utils/math.js} +0 -0
package/components/MenuItem.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// https://www.w3.org/TR/wai-aria-practices/#menu
|
|
2
2
|
|
|
3
|
+
import { isFocused } from '../core/dom.js';
|
|
3
4
|
import FormAssociatedMixin from '../mixins/FormAssociatedMixin.js';
|
|
4
5
|
|
|
5
6
|
import './Icon.js';
|
|
6
7
|
import ListOption from './ListOption.js';
|
|
7
8
|
|
|
8
|
-
export default
|
|
9
|
-
.mixin(FormAssociatedMixin)
|
|
9
|
+
export default ListOption
|
|
10
10
|
.extend()
|
|
11
|
+
.mixin(FormAssociatedMixin)
|
|
11
12
|
.set({
|
|
12
13
|
_cascadeTimeout: null,
|
|
13
14
|
CASCADE_TIMEOUT: 500,
|
|
@@ -96,7 +97,9 @@ export default class MenuItem extends ListOption
|
|
|
96
97
|
cascade() {
|
|
97
98
|
this.unscheduleCascade();
|
|
98
99
|
this._cascading = true;
|
|
99
|
-
|
|
100
|
+
// Dispatch event asking for cascade.
|
|
101
|
+
// Captured by parent mdw-menu and used to track current submenu
|
|
102
|
+
this.dispatchEvent(new CustomEvent('mdw-menu-item:cascade', { detail: this.cascades, bubbles: true }));
|
|
100
103
|
this._cascading = false;
|
|
101
104
|
},
|
|
102
105
|
})
|
|
@@ -119,7 +122,7 @@ export default class MenuItem extends ListOption
|
|
|
119
122
|
.events({
|
|
120
123
|
mouseenter() {
|
|
121
124
|
if (this.disabledState) return;
|
|
122
|
-
if (
|
|
125
|
+
if (!isFocused(this)) {
|
|
123
126
|
this.focus();
|
|
124
127
|
}
|
|
125
128
|
if (!this.cascades) return;
|
|
@@ -170,38 +173,38 @@ export default class MenuItem extends ListOption
|
|
|
170
173
|
blur() {
|
|
171
174
|
if (!this.cascades) return;
|
|
172
175
|
if (this._cascading) return;
|
|
173
|
-
|
|
174
|
-
if (submenuElement.matches(':focus-within')) return;
|
|
175
|
-
console.debug('closing submenu via cascader blur');
|
|
176
|
-
submenuElement.close(false);
|
|
176
|
+
this.dispatchEvent(new CustomEvent('mdw-menu-item:cascader-blur', { detail: this.cascades, bubbles: true }));
|
|
177
177
|
},
|
|
178
178
|
})
|
|
179
|
-
.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
checkboxRef.remove();
|
|
183
|
-
radioRef.remove();
|
|
179
|
+
.recompose(({ inline, html, refs: { checkbox: checkboxRef, radio: radioRef, anchor, trailing, trailingIcon } }) => {
|
|
180
|
+
checkboxRef.remove();
|
|
181
|
+
radioRef.remove();
|
|
184
182
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
anchor.setAttribute('role', inline(({ checkbox, radio }) => {
|
|
184
|
+
if (checkbox != null) return 'menuitemcheckbox';
|
|
185
|
+
if (radio != null) return 'menuitemradio';
|
|
186
|
+
return 'menuitem';
|
|
187
|
+
}));
|
|
190
188
|
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
// MenuItems use checked instead of selected as in list items.
|
|
190
|
+
anchor.setAttribute('ariaChecked', anchor.getAttribute('aria-selected'));
|
|
193
191
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
192
|
+
anchor.after(html`
|
|
193
|
+
<mdw-icon id=selection
|
|
194
|
+
mdw-if=${({ checkbox, radio }) => checkbox ?? radio ?? false}
|
|
195
|
+
class=${({ checkbox, radio }) => checkbox || radio || 'leading'}
|
|
196
|
+
selected={selected} icon=check></mdw-icon>
|
|
197
|
+
`);
|
|
200
198
|
|
|
201
|
-
|
|
199
|
+
trailing.setAttribute('type-style', 'label-large');
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
trailingIcon.setAttribute('mdw-if', '{computeTrailingIcon}');
|
|
202
|
+
trailingIcon.setAttribute('icon', '{computeTrailingIcon}');
|
|
203
|
+
})
|
|
204
|
+
.on({
|
|
205
|
+
_formResetChanged(oldValue, newValue) {
|
|
206
|
+
if (!newValue) return;
|
|
207
|
+
this._selected = this.defaultSelected;
|
|
205
208
|
},
|
|
206
209
|
})
|
|
207
210
|
.css`
|
|
@@ -259,10 +262,4 @@ export default class MenuItem extends ListOption
|
|
|
259
262
|
color: inherit;
|
|
260
263
|
}
|
|
261
264
|
`
|
|
262
|
-
.autoRegister('mdw-menu-item')
|
|
263
|
-
.tsClassFix() {
|
|
264
|
-
formResetCallback() {
|
|
265
|
-
this._selected = this.defaultSelected;
|
|
266
|
-
super.formResetCallback();
|
|
267
|
-
}
|
|
268
|
-
}
|
|
265
|
+
.autoRegister('mdw-menu-item');
|
package/components/NavBar.js
CHANGED
|
@@ -1,66 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import CustomElement from '../core/CustomElement.js';
|
|
2
|
+
import DelegatesFocusMixin from '../mixins/DelegatesFocusMixin.js';
|
|
3
|
+
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
+
import NavItem from './NavItem.js';
|
|
5
6
|
|
|
6
|
-
export default
|
|
7
|
-
.
|
|
7
|
+
export default CustomElement
|
|
8
|
+
.extend()
|
|
9
|
+
.mixin(DelegatesFocusMixin)
|
|
10
|
+
.mixin(ThemableMixin)
|
|
8
11
|
.observe({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.observe({
|
|
14
|
-
_positioningStyle: {
|
|
15
|
-
...ELEMENT_STYLER_TYPE,
|
|
16
|
-
get({ _translateY, _transition }) {
|
|
17
|
-
return {
|
|
18
|
-
styles: {
|
|
19
|
-
transform: `translateY(${_translateY}px)`,
|
|
20
|
-
transition: _transition,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
},
|
|
12
|
+
open: 'boolean',
|
|
13
|
+
autoClose: {
|
|
14
|
+
type: 'float',
|
|
15
|
+
empty: 728,
|
|
24
16
|
},
|
|
25
17
|
})
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Chrome Bug: When window resizes bottom sticky needs to be recomputed
|
|
30
|
-
// Force style recalculation
|
|
31
|
-
this.style.setProperty('bottom', 'auto');
|
|
32
|
-
// eslint-disable-next-line no-unused-expressions
|
|
33
|
-
this.clientHeight;
|
|
34
|
-
this.style.removeProperty('bottom');
|
|
35
|
-
this.propChangedCallback('scrollListenerPositionY', this.scrollListenerPositionY, this.scrollListenerPositionY);
|
|
36
|
-
},
|
|
37
|
-
onScrollIdle() {
|
|
38
|
-
const max = this.scrollHeight;
|
|
39
|
-
const visibility = (max - this._translateY) / max;
|
|
40
|
-
if (visibility <= 0) return;
|
|
41
|
-
if (visibility >= 1) return;
|
|
42
|
-
if (visibility >= 0.5) {
|
|
43
|
-
// Reveal all
|
|
44
|
-
this._translateY = 0;
|
|
45
|
-
this._transition = 'transform 250ms ease-in';
|
|
46
|
-
} else {
|
|
47
|
-
this._translateY = max;
|
|
48
|
-
this._transition = 'transform 200ms ease-out';
|
|
49
|
-
}
|
|
50
|
-
},
|
|
18
|
+
.set({
|
|
19
|
+
color: 'surface-container',
|
|
20
|
+
_ariaRole: 'navigation',
|
|
51
21
|
})
|
|
22
|
+
.html`<slot id=slot></slot>`
|
|
52
23
|
.css`
|
|
53
24
|
/* https://m3.material.io/components/navigation-bar/specs */
|
|
54
25
|
|
|
55
26
|
:host {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
27
|
+
--mdw-bg: var(--mdw-color__surface-container);
|
|
28
|
+
--mdw-ink: var(--mdw-color__on-surface);
|
|
29
|
+
display: none;
|
|
59
30
|
|
|
60
|
-
display: grid;
|
|
61
31
|
align-content: flex-start;
|
|
62
32
|
align-items: flex-start;
|
|
63
33
|
gap: 8px;
|
|
34
|
+
|
|
64
35
|
grid-auto-columns: minmax(48px, 1fr);
|
|
65
36
|
grid-auto-flow: column;
|
|
66
37
|
|
|
@@ -70,54 +41,46 @@ export default Nav
|
|
|
70
41
|
min-block-size: 80px;
|
|
71
42
|
inline-size: 100%;
|
|
72
43
|
|
|
73
|
-
|
|
44
|
+
pointer-events: auto;
|
|
45
|
+
|
|
46
|
+
background-color: rgb(var(--mdw-bg));
|
|
74
47
|
|
|
75
|
-
|
|
48
|
+
color: rgb(var(--mdw-ink));
|
|
76
49
|
|
|
77
|
-
|
|
50
|
+
font: var(--mdw-typescale__label-medium__font);
|
|
51
|
+
letter-spacing: var(--mdw-typescale__label-medium__letter-spacing);
|
|
78
52
|
|
|
79
53
|
text-align: center;
|
|
80
|
-
|
|
81
|
-
will-change: transform;
|
|
82
54
|
}
|
|
83
55
|
|
|
84
|
-
|
|
85
|
-
|
|
56
|
+
:host(:where([open])) {
|
|
57
|
+
display: grid;
|
|
86
58
|
}
|
|
87
|
-
|
|
88
59
|
`
|
|
89
|
-
.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
60
|
+
.methods({
|
|
61
|
+
onWindowResize() {
|
|
62
|
+
const { autoClose } = this;
|
|
63
|
+
const containerWidth = window.innerWidth;
|
|
64
|
+
this.open = (autoClose === -1 || containerWidth < autoClose);
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
.events({
|
|
68
|
+
'~click'(event) {
|
|
69
|
+
// Abort if not child
|
|
70
|
+
if (event.target === this) return;
|
|
71
|
+
if (event.target instanceof NavItem === false) return;
|
|
72
|
+
for (const el of this.querySelectorAll('*')) {
|
|
73
|
+
if (el instanceof NavItem === false) continue;
|
|
74
|
+
el.active = (el === event.target);
|
|
101
75
|
}
|
|
102
76
|
},
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
})
|
|
78
|
+
.on({
|
|
79
|
+
constructed() {
|
|
80
|
+
window.addEventListener('resize', this.onWindowResize.bind(this));
|
|
105
81
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const delta = newValue - oldValue;
|
|
109
|
-
const rate = 1;
|
|
110
|
-
const shift = rate * delta;
|
|
111
|
-
|
|
112
|
-
const bottom = this.getScrollingElementScrollHeight() - this.getScrollingElementClientHeight();
|
|
113
|
-
const breakpoint = bottom - this.scrollHeight;
|
|
114
|
-
let max = this.scrollHeight;
|
|
115
|
-
if (newValue >= breakpoint) {
|
|
116
|
-
// Scrolling to bottom always shows Nav Bar (ensures content isn't occluded)
|
|
117
|
-
max -= (newValue - breakpoint);
|
|
118
|
-
}
|
|
119
|
-
this._transition = 'none';
|
|
120
|
-
this._translateY = Math.max(0, Math.min(this._translateY + shift, max));
|
|
82
|
+
connected() {
|
|
83
|
+
this.onWindowResize();
|
|
121
84
|
},
|
|
122
85
|
})
|
|
123
86
|
.autoRegister('mdw-nav-bar');
|
package/components/NavDrawer.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SideSheet from './SideSheet.js';
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export default SideSheet
|
|
4
4
|
.extend()
|
|
5
5
|
.observe({
|
|
6
6
|
shapeEnd: {
|
|
7
7
|
type: 'boolean',
|
|
8
8
|
empty: true,
|
|
9
9
|
},
|
|
10
|
+
autoOpen: {
|
|
11
|
+
type: 'float',
|
|
12
|
+
empty: 1248,
|
|
13
|
+
},
|
|
14
|
+
fixedBreakpoint: {
|
|
15
|
+
type: 'float',
|
|
16
|
+
empty: 1248,
|
|
17
|
+
},
|
|
10
18
|
})
|
|
11
19
|
.css`
|
|
12
20
|
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
13
|
-
|
|
14
|
-
:host([open]) {
|
|
15
|
-
--mdw-surface__tint: var(--mdw-surface__tint__0);
|
|
16
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint__1);
|
|
21
|
+
:host {
|
|
17
22
|
--mdw-shape__size: var(--mdw-shape__large, 16px);
|
|
18
23
|
--mdw-shape__size__top-start-size: 0px;
|
|
19
24
|
--mdw-shape__size__bottom-start-size: 0px;
|
|
@@ -26,19 +31,15 @@ export default NavRail
|
|
|
26
31
|
--mdw-nav-item__anchor__display: block;
|
|
27
32
|
--mdw-nav-item__indicator__grid-area: auto;
|
|
28
33
|
|
|
29
|
-
display:
|
|
30
|
-
grid-template-rows: min-content;
|
|
31
|
-
grid-template-columns: minmax(360px, min-content);
|
|
34
|
+
display:inline-block;
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
inline-size: 360px;
|
|
37
|
+
max-inline-size: calc(100vw - 56px);
|
|
34
38
|
padding-inline: 12px;
|
|
35
|
-
|
|
36
|
-
box-shadow: none;
|
|
37
|
-
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
::slotted(mdw-divider) {
|
|
42
|
+
padding-inline: 16px;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
`
|
|
@@ -10,7 +10,6 @@ export default NavItem
|
|
|
10
10
|
:host {
|
|
11
11
|
align-self: stretch;
|
|
12
12
|
|
|
13
|
-
display: grid;
|
|
14
13
|
display: flex;
|
|
15
14
|
align-items: center;
|
|
16
15
|
gap: 12px;
|
|
@@ -19,6 +18,8 @@ export default NavItem
|
|
|
19
18
|
/ 24px 1fr minmax(0, min-content);
|
|
20
19
|
justify-items: flex-start;
|
|
21
20
|
|
|
21
|
+
min-block-size: 56px;
|
|
22
|
+
|
|
22
23
|
padding-inline: 16px 24px;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -46,9 +47,7 @@ export default NavItem
|
|
|
46
47
|
z-index: 1;
|
|
47
48
|
}
|
|
48
49
|
`
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
this.refs.badge.replaceWith(html`<span id="badge-text">{badge}</span>`);
|
|
52
|
-
},
|
|
50
|
+
.recompose(({ html, refs: { badge } }) => {
|
|
51
|
+
badge.replaceWith(html`<span id="badge-text">{badge}</span>`);
|
|
53
52
|
})
|
|
54
53
|
.autoRegister('mdw-nav-drawer-item');
|
package/components/NavItem.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import './Icon.js';
|
|
2
2
|
import './Ripple.js';
|
|
3
3
|
import './Badge.js';
|
|
4
|
+
import './Shape.js';
|
|
4
5
|
|
|
5
6
|
import CustomElement from '../core/CustomElement.js';
|
|
7
|
+
import DelegatesFocusMixin from '../mixins/DelegatesFocusMixin.js';
|
|
8
|
+
import HyperlinkMixin from '../mixins/HyperlinkMixin.js';
|
|
6
9
|
import RippleMixin from '../mixins/RippleMixin.js';
|
|
7
|
-
import ShapeMixin from '../mixins/ShapeMixin.js';
|
|
8
10
|
import StateMixin from '../mixins/StateMixin.js';
|
|
9
11
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
10
12
|
|
|
11
13
|
/** @typedef {'charset'|'coords'|'name'|'shape'} DeprecatedHTMLAnchorElementProperties */
|
|
12
14
|
|
|
13
|
-
export default
|
|
15
|
+
export default CustomElement
|
|
16
|
+
.extend()
|
|
14
17
|
.mixin(ThemableMixin)
|
|
15
18
|
.mixin(StateMixin)
|
|
16
19
|
.mixin(RippleMixin)
|
|
17
|
-
.mixin(
|
|
18
|
-
.
|
|
20
|
+
.mixin(HyperlinkMixin)
|
|
21
|
+
.mixin(DelegatesFocusMixin)
|
|
19
22
|
.set({
|
|
20
|
-
delegatesFocus: true,
|
|
21
23
|
stateLayer: true,
|
|
22
24
|
})
|
|
23
25
|
.observe({
|
|
@@ -25,38 +27,45 @@ export default class NavItem extends CustomElement
|
|
|
25
27
|
active: 'boolean',
|
|
26
28
|
icon: 'string',
|
|
27
29
|
src: 'string',
|
|
28
|
-
href: 'string',
|
|
29
30
|
badge: 'string',
|
|
30
31
|
ariaLabel: 'string', // watch attribute and emit callback
|
|
31
32
|
})
|
|
32
33
|
.methods({
|
|
33
|
-
focus
|
|
34
|
-
|
|
34
|
+
/** @type {HTMLElement['focus']} */
|
|
35
|
+
focus(...args) {
|
|
36
|
+
this.refs.anchor.focus(...args);
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
.expressions({
|
|
40
|
+
_anchorAriaCurrent({ active }) {
|
|
41
|
+
return active ? 'page' : null;
|
|
42
|
+
},
|
|
43
|
+
_anchorAriaLabelledby({ ariaLabel }) {
|
|
44
|
+
return ariaLabel ? null : 'slot';
|
|
45
|
+
},
|
|
46
|
+
_anchorHref({ href }) { return href ?? '#'; },
|
|
47
|
+
iconVariation({ active }) {
|
|
48
|
+
return active ? 'filled' : null;
|
|
35
49
|
},
|
|
36
50
|
})
|
|
37
|
-
.html
|
|
38
|
-
<mdw-icon id=icon aria-hidden=true src={src} active={active}
|
|
39
|
-
<a id=anchor
|
|
40
|
-
aria-current=${({ active }) => (active ? 'page' : null)}
|
|
41
|
-
aria-describedby=badge
|
|
42
|
-
aria-label={ariaLabel}
|
|
43
|
-
aria-labelledby=${({ ariaLabel }) => (ariaLabel ? null : 'slot')}
|
|
44
|
-
href=${({ href }) => href ?? '#'}>
|
|
45
|
-
</a>
|
|
51
|
+
.html`
|
|
52
|
+
<mdw-icon id=icon aria-hidden=true src={src} active={active} icon={icon} variation={iconVariation}></mdw-icon>
|
|
46
53
|
<slot id=slot active={active} show-label={showLabel} aria-hidden=true></slot>
|
|
47
54
|
<mdw-badge part=badge id=badge badge={badge} show-label={showLabel} aria-hidden=true>{badge}</mdw-badge>
|
|
48
55
|
`
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
.recompose(({ html, refs: { anchor, state, rippleContainer } }) => {
|
|
57
|
+
anchor.setAttribute('aria-current', '{_anchorAriaCurrent}');
|
|
58
|
+
anchor.setAttribute('aria-describedby', 'badge');
|
|
59
|
+
anchor.setAttribute('aria-label', '{ariaLabel}');
|
|
60
|
+
anchor.setAttribute('aria-labelledby', '{_anchorAriaLabelledby}');
|
|
61
|
+
anchor.setAttribute('href', '{_anchorHref}');
|
|
62
|
+
anchor.before(html`
|
|
63
|
+
<mdw-shape id=shape active={active} shape-style=full>
|
|
53
64
|
<mdw-ripple id=ripple ripple-origin=center keep-alive hold-ripple ripple-state=${({ active }) => ((active) ? null : 'complete')}></mdw-ripple>
|
|
54
65
|
${state}
|
|
55
66
|
${rippleContainer}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
shape.removeAttribute('color');
|
|
59
|
-
},
|
|
67
|
+
</mdw-shape>
|
|
68
|
+
`);
|
|
60
69
|
})
|
|
61
70
|
.css`
|
|
62
71
|
/* https://m3.material.io/components/navigation-bar/specs */
|
|
@@ -71,7 +80,7 @@ export default class NavItem extends CustomElement
|
|
|
71
80
|
|
|
72
81
|
display: grid;
|
|
73
82
|
align-content: center;
|
|
74
|
-
align-items:
|
|
83
|
+
align-items: flex-start;
|
|
75
84
|
grid-auto-flow: row;
|
|
76
85
|
grid-auto-rows: minmax(20px, min-content);
|
|
77
86
|
grid-template-rows: [icon] minmax(32px, 1fr);
|
|
@@ -81,12 +90,11 @@ export default class NavItem extends CustomElement
|
|
|
81
90
|
row-gap: 4px;
|
|
82
91
|
|
|
83
92
|
box-sizing: border-box;
|
|
84
|
-
min-block-size: 56px;
|
|
85
93
|
|
|
86
94
|
padding-inline: 0;
|
|
87
95
|
|
|
88
96
|
cursor: pointer;
|
|
89
|
-
|
|
97
|
+
|
|
90
98
|
user-select: none;
|
|
91
99
|
|
|
92
100
|
font: var(--mdw-typescale__label-large__font);
|
|
@@ -132,6 +140,10 @@ export default class NavItem extends CustomElement
|
|
|
132
140
|
#anchor {
|
|
133
141
|
position: absolute;
|
|
134
142
|
inset: 0;
|
|
143
|
+
|
|
144
|
+
outline: none;
|
|
145
|
+
|
|
146
|
+
z-index: 5;
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
#shape {
|
|
@@ -139,8 +151,14 @@ export default class NavItem extends CustomElement
|
|
|
139
151
|
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
140
152
|
top: 50%;
|
|
141
153
|
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
154
|
+
right: auto;
|
|
155
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
156
|
+
bottom: auto;
|
|
157
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
142
158
|
left: 50%;
|
|
143
159
|
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
|
|
144
162
|
block-size: 100%;
|
|
145
163
|
inline-size: 100%;
|
|
146
164
|
max-inline-size: 56px;
|
|
@@ -149,7 +167,6 @@ export default class NavItem extends CustomElement
|
|
|
149
167
|
grid-row: 1 / 1;
|
|
150
168
|
|
|
151
169
|
transform: translateX(-50%) translateY(-50%) translateY(var(--mdw-nav-item__offset-y));
|
|
152
|
-
z-index: 0;
|
|
153
170
|
|
|
154
171
|
background-color: transparent;
|
|
155
172
|
|
|
@@ -169,7 +186,6 @@ export default class NavItem extends CustomElement
|
|
|
169
186
|
color: rgb(var(--mdw-color__on-surface-variant));
|
|
170
187
|
|
|
171
188
|
font-size: 24px;
|
|
172
|
-
font-variation-settings: 'FILL' 0;
|
|
173
189
|
|
|
174
190
|
transition: transform 200ms;
|
|
175
191
|
will-change: transform;
|
|
@@ -182,8 +198,10 @@ export default class NavItem extends CustomElement
|
|
|
182
198
|
#badge {
|
|
183
199
|
--mdw-badge__scale: 0;
|
|
184
200
|
position: absolute;
|
|
185
|
-
|
|
186
|
-
|
|
201
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
202
|
+
top: 50%;
|
|
203
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
204
|
+
left: 50%;
|
|
187
205
|
|
|
188
206
|
overflow: hidden;
|
|
189
207
|
|
|
@@ -225,8 +243,6 @@ export default class NavItem extends CustomElement
|
|
|
225
243
|
|
|
226
244
|
#icon[active] {
|
|
227
245
|
color: rgb(var(--mdw-ink));
|
|
228
|
-
|
|
229
|
-
font-variation-settings: 'FILL' 1;
|
|
230
246
|
}
|
|
231
247
|
|
|
232
248
|
#slot[active] {
|
|
@@ -254,10 +270,11 @@ export default class NavItem extends CustomElement
|
|
|
254
270
|
},
|
|
255
271
|
},
|
|
256
272
|
})
|
|
257
|
-
.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
273
|
+
.extend((Base) => class NavItem extends Base {
|
|
274
|
+
/** @type {InstanceType<ReturnType<RippleMixin>>['addRipple']} */
|
|
275
|
+
addRipple(...args) {
|
|
276
|
+
if (!this.active) return null;
|
|
277
|
+
return super.addRipple(...args);
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
.autoRegister('mdw-nav-item');
|
package/components/NavRail.js
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SideSheet from './SideSheet.js';
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export default SideSheet
|
|
4
4
|
.extend()
|
|
5
5
|
.observe({
|
|
6
6
|
align: { value: /** @type {'start'|'center'|'end'} */ (null) },
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
autoOpen: {
|
|
8
|
+
type: 'float',
|
|
9
|
+
empty: 728,
|
|
10
|
+
},
|
|
11
|
+
autoClose: {
|
|
12
|
+
type: 'float',
|
|
13
|
+
empty: 1248,
|
|
14
|
+
},
|
|
15
|
+
fixedBreakpoint: {
|
|
16
|
+
type: 'float',
|
|
17
|
+
empty: 728,
|
|
13
18
|
},
|
|
14
19
|
})
|
|
20
|
+
.recompose(({ html, refs: { slot } }) => {
|
|
21
|
+
slot.before(html`<slot id=start name=start></slot>`);
|
|
22
|
+
slot.setAttribute('align', '{align}');
|
|
23
|
+
})
|
|
15
24
|
.css`
|
|
16
25
|
/* https://m3.material.io/components/navigation-rail/specs */
|
|
17
26
|
|
|
18
27
|
:host{
|
|
19
|
-
|
|
28
|
+
align-self: flex-start;
|
|
29
|
+
|
|
30
|
+
display: inline-grid;
|
|
20
31
|
align-content: flex-start;
|
|
21
32
|
flex-direction: column;
|
|
22
|
-
|
|
23
|
-
grid-template-
|
|
33
|
+
gap:0;
|
|
34
|
+
grid-template-rows: auto minmax(auto,1fr);
|
|
35
|
+
grid-template-columns: 100%;
|
|
24
36
|
justify-items: stretch;
|
|
37
|
+
overscroll-behavior: none;
|
|
38
|
+
overscroll-behavior: contain;
|
|
39
|
+
|
|
40
|
+
min-block-size: 0;
|
|
25
41
|
|
|
26
42
|
text-align: center;
|
|
27
43
|
}
|
|
@@ -31,9 +47,7 @@ export default Nav
|
|
|
31
47
|
align-items: center;
|
|
32
48
|
flex-direction: column;
|
|
33
49
|
gap: 12px;
|
|
34
|
-
|
|
35
|
-
padding-block-start: 12px;
|
|
36
|
-
|
|
50
|
+
justify-content: center;
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
#slot {
|
|
@@ -43,14 +57,11 @@ export default Nav
|
|
|
43
57
|
align-items: stretch;
|
|
44
58
|
flex-direction: column;
|
|
45
59
|
gap: 12px;
|
|
46
|
-
overflow-x: clip;
|
|
47
|
-
overflow-y: auto;
|
|
48
60
|
|
|
49
61
|
box-sizing: border-box;
|
|
62
|
+
max-block-size: 100%;
|
|
63
|
+
inline-size: min-content;
|
|
50
64
|
|
|
51
|
-
inline-size: 100%;
|
|
52
|
-
|
|
53
|
-
padding-block: 12px;
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
#slot[align="start"] {
|
|
@@ -60,6 +71,5 @@ export default Nav
|
|
|
60
71
|
#slot[align="end"] {
|
|
61
72
|
align-self: flex-end;
|
|
62
73
|
}
|
|
63
|
-
|
|
64
74
|
`
|
|
65
75
|
.autoRegister('mdw-nav-rail');
|
|
@@ -7,11 +7,16 @@ export default NavItem
|
|
|
7
7
|
.css`
|
|
8
8
|
:host {
|
|
9
9
|
grid-auto-flow: row;
|
|
10
|
-
grid-auto-rows: minmax(20px,
|
|
10
|
+
grid-auto-rows: minmax(20px, auto);
|
|
11
11
|
grid-template-rows: [icon] minmax(32px, 1fr);
|
|
12
|
-
grid-template-columns: [icon] minmax(
|
|
12
|
+
grid-template-columns: [icon] minmax(72px, 1fr);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
min-block-size: 56px;
|
|
15
|
+
flex: none;
|
|
16
|
+
padding-inline: 4px;
|
|
17
|
+
|
|
18
|
+
font: var(--mdw-typescale__label-medium__font);
|
|
19
|
+
letter-spacing: var(--mdw-typescale__label-medium__letter-spacing);
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
#slot {
|