@m3e/core 1.0.0-rc.1 → 1.0.0-rc.2
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 +1 -2
- package/dist/a11y.js +6 -18
- package/dist/a11y.js.map +1 -1
- package/dist/a11y.min.js +5 -5
- package/dist/a11y.min.js.map +1 -1
- package/dist/custom-elements.json +3449 -3429
- package/dist/html-custom-data.json +14 -6
- package/dist/index.js +198 -29
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +87 -87
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -58
- package/dist/src/a11y/AriaDescriber.d.ts +0 -31
- package/dist/src/a11y/AriaDescriber.d.ts.map +0 -1
- package/dist/src/a11y/FocusTrapElement.d.ts +0 -25
- package/dist/src/a11y/FocusTrapElement.d.ts.map +0 -1
- package/dist/src/a11y/InteractivityChecker.d.ts +0 -22
- package/dist/src/a11y/InteractivityChecker.d.ts.map +0 -1
- package/dist/src/a11y/LiveAnnouncer.d.ts +0 -56
- package/dist/src/a11y/LiveAnnouncer.d.ts.map +0 -1
- package/dist/src/a11y/aria-reference.d.ts +0 -30
- package/dist/src/a11y/aria-reference.d.ts.map +0 -1
- package/dist/src/a11y/index.d.ts +0 -8
- package/dist/src/a11y/index.d.ts.map +0 -1
- package/dist/src/a11y/keycodes/KeyCode.d.ts +0 -118
- package/dist/src/a11y/keycodes/KeyCode.d.ts.map +0 -1
- package/dist/src/a11y/keycodes/ModifierKeys.d.ts +0 -5
- package/dist/src/a11y/keycodes/ModifierKeys.d.ts.map +0 -1
- package/dist/src/a11y/keycodes/getKeyCode.d.ts +0 -7
- package/dist/src/a11y/keycodes/getKeyCode.d.ts.map +0 -1
- package/dist/src/a11y/keycodes/hasModifierKey.d.ts +0 -9
- package/dist/src/a11y/keycodes/hasModifierKey.d.ts.map +0 -1
- package/dist/src/a11y/keycodes/index.d.ts +0 -6
- package/dist/src/a11y/keycodes/index.d.ts.map +0 -1
- package/dist/src/a11y/keycodes/isModifierAllowed.d.ts +0 -9
- package/dist/src/a11y/keycodes/isModifierAllowed.d.ts.map +0 -1
- package/dist/src/a11y/list-key/FocusKeyManager.d.ts +0 -17
- package/dist/src/a11y/list-key/FocusKeyManager.d.ts.map +0 -1
- package/dist/src/a11y/list-key/ListKeyManager.d.ts +0 -114
- package/dist/src/a11y/list-key/ListKeyManager.d.ts.map +0 -1
- package/dist/src/a11y/list-key/ListManager.d.ts +0 -37
- package/dist/src/a11y/list-key/ListManager.d.ts.map +0 -1
- package/dist/src/a11y/list-key/RadioKeyManager.d.ts +0 -20
- package/dist/src/a11y/list-key/RadioKeyManager.d.ts.map +0 -1
- package/dist/src/a11y/list-key/RovingTabIndexManager.d.ts +0 -22
- package/dist/src/a11y/list-key/RovingTabIndexManager.d.ts.map +0 -1
- package/dist/src/a11y/list-key/SelectionManager.d.ts +0 -46
- package/dist/src/a11y/list-key/SelectionManager.d.ts.map +0 -1
- package/dist/src/a11y/list-key/Typeahead.d.ts +0 -64
- package/dist/src/a11y/list-key/Typeahead.d.ts.map +0 -1
- package/dist/src/a11y/list-key/index.d.ts +0 -8
- package/dist/src/a11y/list-key/index.d.ts.map +0 -1
- package/dist/src/a11y/visuallyHide.d.ts +0 -6
- package/dist/src/a11y/visuallyHide.d.ts.map +0 -1
- package/dist/src/anchoring/AnchorOptions.d.ts +0 -15
- package/dist/src/anchoring/AnchorOptions.d.ts.map +0 -1
- package/dist/src/anchoring/AnchorPosition.d.ts +0 -3
- package/dist/src/anchoring/AnchorPosition.d.ts.map +0 -1
- package/dist/src/anchoring/index.d.ts +0 -4
- package/dist/src/anchoring/index.d.ts.map +0 -1
- package/dist/src/anchoring/positionAnchor.d.ts +0 -12
- package/dist/src/anchoring/positionAnchor.d.ts.map +0 -1
- package/dist/src/bidi/Directionality.d.ts +0 -27
- package/dist/src/bidi/Directionality.d.ts.map +0 -1
- package/dist/src/bidi/index.d.ts +0 -2
- package/dist/src/bidi/index.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/layout/Breakpoint.d.ts +0 -26
- package/dist/src/layout/Breakpoint.d.ts.map +0 -1
- package/dist/src/layout/BreakpointObserver.d.ts +0 -18
- package/dist/src/layout/BreakpointObserver.d.ts.map +0 -1
- package/dist/src/layout/index.d.ts +0 -3
- package/dist/src/layout/index.d.ts.map +0 -1
- package/dist/src/platform/Platform.d.ts +0 -34
- package/dist/src/platform/Platform.d.ts.map +0 -1
- package/dist/src/platform/index.d.ts +0 -2
- package/dist/src/platform/index.d.ts.map +0 -1
- package/dist/src/shared/controllers/FocusController.d.ts +0 -30
- package/dist/src/shared/controllers/FocusController.d.ts.map +0 -1
- package/dist/src/shared/controllers/HoverController.d.ts +0 -40
- package/dist/src/shared/controllers/HoverController.d.ts.map +0 -1
- package/dist/src/shared/controllers/IntersectionController.d.ts +0 -40
- package/dist/src/shared/controllers/IntersectionController.d.ts.map +0 -1
- package/dist/src/shared/controllers/LongPressController.d.ts +0 -32
- package/dist/src/shared/controllers/LongPressController.d.ts.map +0 -1
- package/dist/src/shared/controllers/MonitorControllerBase.d.ts +0 -62
- package/dist/src/shared/controllers/MonitorControllerBase.d.ts.map +0 -1
- package/dist/src/shared/controllers/MutationController.d.ts +0 -37
- package/dist/src/shared/controllers/MutationController.d.ts.map +0 -1
- package/dist/src/shared/controllers/PressedController.d.ts +0 -45
- package/dist/src/shared/controllers/PressedController.d.ts.map +0 -1
- package/dist/src/shared/controllers/ResizeController.d.ts +0 -40
- package/dist/src/shared/controllers/ResizeController.d.ts.map +0 -1
- package/dist/src/shared/controllers/ScrollController.d.ts +0 -34
- package/dist/src/shared/controllers/ScrollController.d.ts.map +0 -1
- package/dist/src/shared/controllers/index.d.ts +0 -9
- package/dist/src/shared/controllers/index.d.ts.map +0 -1
- package/dist/src/shared/decorators/debounce.d.ts +0 -7
- package/dist/src/shared/decorators/debounce.d.ts.map +0 -1
- package/dist/src/shared/decorators/index.d.ts +0 -2
- package/dist/src/shared/decorators/index.d.ts.map +0 -1
- package/dist/src/shared/directives/index.d.ts +0 -2
- package/dist/src/shared/directives/index.d.ts.map +0 -1
- package/dist/src/shared/directives/safeStyleMap.d.ts +0 -44
- package/dist/src/shared/directives/safeStyleMap.d.ts.map +0 -1
- package/dist/src/shared/index.d.ts +0 -8
- package/dist/src/shared/index.d.ts.map +0 -1
- package/dist/src/shared/mixins/AttachInternals.d.ts +0 -24
- package/dist/src/shared/mixins/AttachInternals.d.ts.map +0 -1
- package/dist/src/shared/mixins/Checked.d.ts +0 -24
- package/dist/src/shared/mixins/Checked.d.ts.map +0 -1
- package/dist/src/shared/mixins/CheckedIndeterminate.d.ts +0 -25
- package/dist/src/shared/mixins/CheckedIndeterminate.d.ts.map +0 -1
- package/dist/src/shared/mixins/CheckedOrSelected.d.ts +0 -23
- package/dist/src/shared/mixins/CheckedOrSelected.d.ts.map +0 -1
- package/dist/src/shared/mixins/ConstraintValidation.d.ts +0 -48
- package/dist/src/shared/mixins/ConstraintValidation.d.ts.map +0 -1
- package/dist/src/shared/mixins/Constructor.d.ts +0 -3
- package/dist/src/shared/mixins/Constructor.d.ts.map +0 -1
- package/dist/src/shared/mixins/Dirty.d.ts +0 -27
- package/dist/src/shared/mixins/Dirty.d.ts.map +0 -1
- package/dist/src/shared/mixins/Disabled.d.ts +0 -25
- package/dist/src/shared/mixins/Disabled.d.ts.map +0 -1
- package/dist/src/shared/mixins/DisabledInteractive.d.ts +0 -25
- package/dist/src/shared/mixins/DisabledInteractive.d.ts.map +0 -1
- package/dist/src/shared/mixins/EventAttribute.d.ts +0 -11
- package/dist/src/shared/mixins/EventAttribute.d.ts.map +0 -1
- package/dist/src/shared/mixins/Focusable.d.ts +0 -11
- package/dist/src/shared/mixins/Focusable.d.ts.map +0 -1
- package/dist/src/shared/mixins/FormAssociated.d.ts +0 -34
- package/dist/src/shared/mixins/FormAssociated.d.ts.map +0 -1
- package/dist/src/shared/mixins/FormSubmitter.d.ts +0 -31
- package/dist/src/shared/mixins/FormSubmitter.d.ts.map +0 -1
- package/dist/src/shared/mixins/HtmlFor.d.ts +0 -30
- package/dist/src/shared/mixins/HtmlFor.d.ts.map +0 -1
- package/dist/src/shared/mixins/KeyboardClick.d.ts +0 -11
- package/dist/src/shared/mixins/KeyboardClick.d.ts.map +0 -1
- package/dist/src/shared/mixins/Labelled.d.ts +0 -22
- package/dist/src/shared/mixins/Labelled.d.ts.map +0 -1
- package/dist/src/shared/mixins/LinkButton.d.ts +0 -36
- package/dist/src/shared/mixins/LinkButton.d.ts.map +0 -1
- package/dist/src/shared/mixins/ReadOnly.d.ts +0 -25
- package/dist/src/shared/mixins/ReadOnly.d.ts.map +0 -1
- package/dist/src/shared/mixins/Required.d.ts +0 -26
- package/dist/src/shared/mixins/Required.d.ts.map +0 -1
- package/dist/src/shared/mixins/RequiredConstraintValidation.d.ts +0 -21
- package/dist/src/shared/mixins/RequiredConstraintValidation.d.ts.map +0 -1
- package/dist/src/shared/mixins/Role.d.ts +0 -13
- package/dist/src/shared/mixins/Role.d.ts.map +0 -1
- package/dist/src/shared/mixins/Selected.d.ts +0 -24
- package/dist/src/shared/mixins/Selected.d.ts.map +0 -1
- package/dist/src/shared/mixins/Touched.d.ts +0 -27
- package/dist/src/shared/mixins/Touched.d.ts.map +0 -1
- package/dist/src/shared/mixins/Vertical.d.ts +0 -24
- package/dist/src/shared/mixins/Vertical.d.ts.map +0 -1
- package/dist/src/shared/mixins/hasKeys.d.ts +0 -9
- package/dist/src/shared/mixins/hasKeys.d.ts.map +0 -1
- package/dist/src/shared/mixins/index.d.ts +0 -25
- package/dist/src/shared/mixins/index.d.ts.map +0 -1
- package/dist/src/shared/primitives/CollapsibleElement.d.ts +0 -58
- package/dist/src/shared/primitives/CollapsibleElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/ElevationElement.d.ts +0 -88
- package/dist/src/shared/primitives/ElevationElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/ElevationLevel.d.ts +0 -3
- package/dist/src/shared/primitives/ElevationLevel.d.ts.map +0 -1
- package/dist/src/shared/primitives/ElevationToken.d.ts +0 -15
- package/dist/src/shared/primitives/ElevationToken.d.ts.map +0 -1
- package/dist/src/shared/primitives/FocusRingElement.d.ts +0 -78
- package/dist/src/shared/primitives/FocusRingElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/FocusRingToken.d.ts +0 -17
- package/dist/src/shared/primitives/FocusRingToken.d.ts.map +0 -1
- package/dist/src/shared/primitives/PseudoCheckboxElement.d.ts +0 -50
- package/dist/src/shared/primitives/PseudoCheckboxElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/PseudoRadioElement.d.ts +0 -41
- package/dist/src/shared/primitives/PseudoRadioElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/RippleElement.d.ts +0 -110
- package/dist/src/shared/primitives/RippleElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/RippleToken.d.ts +0 -12
- package/dist/src/shared/primitives/RippleToken.d.ts.map +0 -1
- package/dist/src/shared/primitives/ScrollContainerElement.d.ts +0 -64
- package/dist/src/shared/primitives/ScrollContainerElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/ScrollDividers.d.ts +0 -3
- package/dist/src/shared/primitives/ScrollDividers.d.ts.map +0 -1
- package/dist/src/shared/primitives/SlideElement.d.ts +0 -48
- package/dist/src/shared/primitives/SlideElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/StateLayerElement.d.ts +0 -77
- package/dist/src/shared/primitives/StateLayerElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/StateLayerToken.d.ts +0 -13
- package/dist/src/shared/primitives/StateLayerToken.d.ts.map +0 -1
- package/dist/src/shared/primitives/TextOverflowElement.d.ts +0 -39
- package/dist/src/shared/primitives/TextOverflowElement.d.ts.map +0 -1
- package/dist/src/shared/primitives/index.d.ts +0 -13
- package/dist/src/shared/primitives/index.d.ts.map +0 -1
- package/dist/src/shared/tokens/ColorToken.d.ts +0 -96
- package/dist/src/shared/tokens/ColorToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/DensityToken.d.ts +0 -15
- package/dist/src/shared/tokens/DensityToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/DesignToken.d.ts +0 -366
- package/dist/src/shared/tokens/DesignToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/ElevationToken.d.ts +0 -16
- package/dist/src/shared/tokens/ElevationToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/MotionToken.d.ts +0 -69
- package/dist/src/shared/tokens/MotionToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/ScrollbarToken.d.ts +0 -10
- package/dist/src/shared/tokens/ScrollbarToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/ShapeToken.d.ts +0 -79
- package/dist/src/shared/tokens/ShapeToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/StateToken.d.ts +0 -10
- package/dist/src/shared/tokens/StateToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/TypescaleToken.d.ts +0 -220
- package/dist/src/shared/tokens/TypescaleToken.d.ts.map +0 -1
- package/dist/src/shared/tokens/index.d.ts +0 -2
- package/dist/src/shared/tokens/index.d.ts.map +0 -1
- package/dist/src/shared/utils/getTextContent.d.ts +0 -8
- package/dist/src/shared/utils/getTextContent.d.ts.map +0 -1
- package/dist/src/shared/utils/guid.d.ts +0 -6
- package/dist/src/shared/utils/guid.d.ts.map +0 -1
- package/dist/src/shared/utils/hasAssignedNodes.d.ts +0 -7
- package/dist/src/shared/utils/hasAssignedNodes.d.ts.map +0 -1
- package/dist/src/shared/utils/index.d.ts +0 -6
- package/dist/src/shared/utils/index.d.ts.map +0 -1
- package/dist/src/shared/utils/prefersReducedMotion.d.ts +0 -6
- package/dist/src/shared/utils/prefersReducedMotion.d.ts.map +0 -1
- package/dist/src/shared/utils/scrollIntoViewIfNeeded.d.ts +0 -8
- package/dist/src/shared/utils/scrollIntoViewIfNeeded.d.ts.map +0 -1
- package/eslint.config.mjs +0 -21
- package/rollup.config.js +0 -132
- package/src/a11y/AriaDescriber.ts +0 -130
- package/src/a11y/FocusTrapElement.ts +0 -136
- package/src/a11y/InteractivityChecker.ts +0 -62
- package/src/a11y/LiveAnnouncer.ts +0 -143
- package/src/a11y/aria-reference.ts +0 -51
- package/src/a11y/index.ts +0 -8
- package/src/a11y/keycodes/KeyCode.ts +0 -128
- package/src/a11y/keycodes/ModifierKeys.ts +0 -5
- package/src/a11y/keycodes/getKeyCode.ts +0 -8
- package/src/a11y/keycodes/hasModifierKey.ts +0 -11
- package/src/a11y/keycodes/index.ts +0 -5
- package/src/a11y/keycodes/isModifierAllowed.ts +0 -12
- package/src/a11y/list-key/FocusKeyManager.ts +0 -25
- package/src/a11y/list-key/ListKeyManager.ts +0 -350
- package/src/a11y/list-key/ListManager.ts +0 -66
- package/src/a11y/list-key/RadioKeyManager.ts +0 -49
- package/src/a11y/list-key/RovingTabIndexManager.ts +0 -56
- package/src/a11y/list-key/SelectionManager.ts +0 -132
- package/src/a11y/list-key/Typeahead.ts +0 -131
- package/src/a11y/list-key/index.ts +0 -7
- package/src/a11y/visuallyHide.ts +0 -18
- package/src/anchoring/AnchorOptions.ts +0 -19
- package/src/anchoring/AnchorPosition.ts +0 -14
- package/src/anchoring/index.ts +0 -3
- package/src/anchoring/positionAnchor.ts +0 -53
- package/src/bidi/Directionality.ts +0 -85
- package/src/bidi/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/layout/Breakpoint.ts +0 -26
- package/src/layout/BreakpointObserver.ts +0 -44
- package/src/layout/index.ts +0 -2
- package/src/platform/Platform.ts +0 -67
- package/src/platform/index.ts +0 -1
- package/src/shared/controllers/FocusController.ts +0 -60
- package/src/shared/controllers/HoverController.ts +0 -140
- package/src/shared/controllers/IntersectionController.ts +0 -81
- package/src/shared/controllers/LongPressController.ts +0 -87
- package/src/shared/controllers/MonitorControllerBase.ts +0 -99
- package/src/shared/controllers/MutationController.ts +0 -89
- package/src/shared/controllers/PressedController.ts +0 -137
- package/src/shared/controllers/ResizeController.ts +0 -83
- package/src/shared/controllers/ScrollController.ts +0 -100
- package/src/shared/controllers/index.ts +0 -8
- package/src/shared/decorators/debounce.ts +0 -19
- package/src/shared/decorators/index.ts +0 -1
- package/src/shared/directives/index.ts +0 -1
- package/src/shared/directives/safeStyleMap.ts +0 -108
- package/src/shared/index.ts +0 -7
- package/src/shared/mixins/AttachInternals.ts +0 -48
- package/src/shared/mixins/Checked.ts +0 -50
- package/src/shared/mixins/CheckedIndeterminate.ts +0 -47
- package/src/shared/mixins/CheckedOrSelected.ts +0 -36
- package/src/shared/mixins/ConstraintValidation.ts +0 -213
- package/src/shared/mixins/Constructor.ts +0 -2
- package/src/shared/mixins/Dirty.ts +0 -71
- package/src/shared/mixins/Disabled.ts +0 -49
- package/src/shared/mixins/DisabledInteractive.ts +0 -78
- package/src/shared/mixins/EventAttribute.ts +0 -25
- package/src/shared/mixins/Focusable.ts +0 -52
- package/src/shared/mixins/FormAssociated.ts +0 -152
- package/src/shared/mixins/FormSubmitter.ts +0 -123
- package/src/shared/mixins/HtmlFor.ts +0 -89
- package/src/shared/mixins/KeyboardClick.ts +0 -46
- package/src/shared/mixins/Labelled.ts +0 -88
- package/src/shared/mixins/LinkButton.ts +0 -169
- package/src/shared/mixins/ReadOnly.ts +0 -48
- package/src/shared/mixins/Required.ts +0 -50
- package/src/shared/mixins/RequiredConstraintValidation.ts +0 -45
- package/src/shared/mixins/Role.ts +0 -134
- package/src/shared/mixins/Selected.ts +0 -50
- package/src/shared/mixins/Touched.ts +0 -71
- package/src/shared/mixins/Vertical.ts +0 -44
- package/src/shared/mixins/hasKeys.ts +0 -10
- package/src/shared/mixins/index.ts +0 -24
- package/src/shared/primitives/CollapsibleElement.ts +0 -227
- package/src/shared/primitives/ElevationElement.ts +0 -254
- package/src/shared/primitives/ElevationLevel.ts +0 -2
- package/src/shared/primitives/ElevationToken.ts +0 -18
- package/src/shared/primitives/FocusRingElement.ts +0 -199
- package/src/shared/primitives/FocusRingToken.ts +0 -24
- package/src/shared/primitives/PseudoCheckboxElement.ts +0 -116
- package/src/shared/primitives/PseudoRadioElement.ts +0 -83
- package/src/shared/primitives/RippleElement.ts +0 -289
- package/src/shared/primitives/RippleToken.ts +0 -15
- package/src/shared/primitives/ScrollContainerElement.ts +0 -151
- package/src/shared/primitives/ScrollDividers.ts +0 -2
- package/src/shared/primitives/SlideElement.ts +0 -128
- package/src/shared/primitives/StateLayerElement.ts +0 -191
- package/src/shared/primitives/StateLayerToken.ts +0 -16
- package/src/shared/primitives/TextOverflowElement.ts +0 -60
- package/src/shared/primitives/index.ts +0 -12
- package/src/shared/tokens/ColorToken.ts +0 -142
- package/src/shared/tokens/DensityToken.ts +0 -23
- package/src/shared/tokens/DesignToken.ts +0 -35
- package/src/shared/tokens/ElevationToken.ts +0 -115
- package/src/shared/tokens/MotionToken.ts +0 -107
- package/src/shared/tokens/ScrollbarToken.ts +0 -13
- package/src/shared/tokens/ShapeToken.ts +0 -138
- package/src/shared/tokens/StateToken.ts +0 -13
- package/src/shared/tokens/TypescaleToken.ts +0 -230
- package/src/shared/tokens/index.ts +0 -1
- package/src/shared/utils/getTextContent.ts +0 -31
- package/src/shared/utils/guid.ts +0 -11
- package/src/shared/utils/hasAssignedNodes.ts +0 -8
- package/src/shared/utils/index.ts +0 -5
- package/src/shared/utils/prefersReducedMotion.ts +0 -9
- package/src/shared/utils/scrollIntoViewIfNeeded.ts +0 -18
- package/tsconfig.json +0 -9
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement, PropertyValues, unsafeCSS } from "lit";
|
|
2
|
-
import { customElement, property, query } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { FocusController, HoverController, PressedController } from "../controllers";
|
|
5
|
-
import { HtmlFor, Role } from "../mixins";
|
|
6
|
-
|
|
7
|
-
import { ElevationLevel } from "./ElevationLevel";
|
|
8
|
-
import { ElevationToken } from "./ElevationToken";
|
|
9
|
-
import { DesignToken } from "../tokens";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @summary
|
|
13
|
-
* Visually depicts elevation using a shadow.
|
|
14
|
-
*
|
|
15
|
-
* @description
|
|
16
|
-
* The `m3e-elevation` component is an absolute positioned element used to depict elevation using a shadow.
|
|
17
|
-
* The parenting element must be a relative positioned element and allow for overflow. Use the `level` attribute
|
|
18
|
-
* to specify the elevation level.
|
|
19
|
-
*
|
|
20
|
-
* The component can also be attached to another element using the `for` attribute. When attached, elevation will
|
|
21
|
-
* be lifted by 1 level on hover. This can be disabled using the `disabled` attribute.
|
|
22
|
-
*
|
|
23
|
-
* Alternately, use the `attach` and `detach` methods to programmatically attach and detach this element to another.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* The following example illustrates basic markup. Note how the parenting element's position is `relative`. A parenting
|
|
27
|
-
* element's position must be `relative` and overflow must be visible.
|
|
28
|
-
*
|
|
29
|
-
* ```html
|
|
30
|
-
* <div style="position: relative;">
|
|
31
|
-
* <m3e-elevation level="1"></m3e-elevation>
|
|
32
|
-
* <div>
|
|
33
|
-
* ```
|
|
34
|
-
* @example
|
|
35
|
-
* The following example illustrates attaching elevation to an interactive element. In this example, the parenting div
|
|
36
|
-
* is given an `id` referenced by `m3e-elevation` using the `for` attribute. Note that `#myDiv` is not used when
|
|
37
|
-
* specifying the attached element's identifier. The `#` is inferred.
|
|
38
|
-
*
|
|
39
|
-
* ```html
|
|
40
|
-
* <div id="myDiv" style="position: relative;">
|
|
41
|
-
* <m3e-elevation for="myDiv" level="1"></m3e-elevation>
|
|
42
|
-
* <div>
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @tag m3e-elevation
|
|
46
|
-
*
|
|
47
|
-
* @attr disabled - Whether hover and press events will not trigger changes in elevation, when attached to an interactive element.
|
|
48
|
-
* @attr for - The identifier of the interactive control to which this element is attached.
|
|
49
|
-
* @attr level - The level at which to visually depict elevation.
|
|
50
|
-
*
|
|
51
|
-
* @cssprop --m3e-elevation-color - Color used to depict elevation.
|
|
52
|
-
* @cssprop --m3e-elevation-lift-duration - Duration when lifting.
|
|
53
|
-
* @cssprop --m3e-elevation-lift-easing - Easing curve when lifting.
|
|
54
|
-
* @cssprop --m3e-elevation-settle-duration - Duration when settling.
|
|
55
|
-
* @cssprop --m3e-elevation-settle-easing - Easing curve when settling.
|
|
56
|
-
* @cssprop --m3e-elevation-level - Elevation when resting (box-shadow).
|
|
57
|
-
* @cssprop --m3e-elevation-hover-level - Elevation on hover (box-shadow).
|
|
58
|
-
* @cssprop --m3e-elevation-focus-level - Elevation on focus (box-shadow).
|
|
59
|
-
* @cssprop --m3e-elevation-pressed-level - Elevation on pressed (box-shadow).
|
|
60
|
-
*/
|
|
61
|
-
@customElement("m3e-elevation")
|
|
62
|
-
export class M3eElevationElement extends HtmlFor(Role(LitElement, "none")) {
|
|
63
|
-
/** The styles of the element. */
|
|
64
|
-
static override styles: CSSResultGroup = css`
|
|
65
|
-
:host {
|
|
66
|
-
display: block;
|
|
67
|
-
}
|
|
68
|
-
:host,
|
|
69
|
-
.shadow {
|
|
70
|
-
position: absolute;
|
|
71
|
-
left: 0;
|
|
72
|
-
top: 0;
|
|
73
|
-
right: 0;
|
|
74
|
-
bottom: 0;
|
|
75
|
-
pointer-events: none;
|
|
76
|
-
border-radius: inherit;
|
|
77
|
-
}
|
|
78
|
-
.shadow.resting,
|
|
79
|
-
.shadow.focus,
|
|
80
|
-
.shadow.pressed {
|
|
81
|
-
will-change: box-shadow;
|
|
82
|
-
transition: ${unsafeCSS(`box-shadow ${ElevationToken.settleDuration} ${ElevationToken.settleEasing};`)};
|
|
83
|
-
}
|
|
84
|
-
.shadow.hover {
|
|
85
|
-
will-change: box-shadow;
|
|
86
|
-
transition: ${unsafeCSS(`box-shadow ${ElevationToken.liftDuration} ${ElevationToken.liftEasing};`)};
|
|
87
|
-
}
|
|
88
|
-
.shadow {
|
|
89
|
-
box-shadow: ${ElevationToken.level};
|
|
90
|
-
}
|
|
91
|
-
.shadow.focus {
|
|
92
|
-
box-shadow: ${ElevationToken.focusLevel};
|
|
93
|
-
}
|
|
94
|
-
.shadow.hover {
|
|
95
|
-
box-shadow: ${ElevationToken.hoverLevel};
|
|
96
|
-
}
|
|
97
|
-
.shadow.pressed {
|
|
98
|
-
box-shadow: ${ElevationToken.pressedLevel};
|
|
99
|
-
}
|
|
100
|
-
:host([level="0"]) .shadow {
|
|
101
|
-
--m3e-elevation-level: ${DesignToken.elevation.level0};
|
|
102
|
-
--m3e-elevation-hover-level: ${DesignToken.elevation.level1};
|
|
103
|
-
}
|
|
104
|
-
:host([level="1"]) .shadow {
|
|
105
|
-
--m3e-elevation-level: ${DesignToken.elevation.level1};
|
|
106
|
-
--m3e-elevation-hover-level: ${DesignToken.elevation.level2};
|
|
107
|
-
}
|
|
108
|
-
:host([level="2"]) .shadow {
|
|
109
|
-
--m3e-elevation-level: ${DesignToken.elevation.level2};
|
|
110
|
-
--m3e-elevation-hover-level: ${DesignToken.elevation.level3};
|
|
111
|
-
}
|
|
112
|
-
:host([level="3"]) .shadow {
|
|
113
|
-
--m3e-elevation-level: ${DesignToken.elevation.level3};
|
|
114
|
-
--m3e-elevation-hover-level: ${DesignToken.elevation.level4};
|
|
115
|
-
}
|
|
116
|
-
:host([level="4"]) .shadow {
|
|
117
|
-
--m3e-elevation-level: ${DesignToken.elevation.level4};
|
|
118
|
-
--m3e-elevation-hover-level: ${DesignToken.elevation.level5};
|
|
119
|
-
}
|
|
120
|
-
:host([level="5"]) .shadow {
|
|
121
|
-
--m3e-elevation-level: ${DesignToken.elevation.level5};
|
|
122
|
-
--m3e-elevation-hover-level: ${ElevationToken.level};
|
|
123
|
-
}
|
|
124
|
-
:host([level]) .shadow {
|
|
125
|
-
--m3e-elevation-focus-level: ${ElevationToken.level};
|
|
126
|
-
--m3e-elevation-pressed-level: ${ElevationToken.level};
|
|
127
|
-
}
|
|
128
|
-
@media (prefers-reduced-motion) {
|
|
129
|
-
.shadow.resting,
|
|
130
|
-
.shadow.pressed,
|
|
131
|
-
.shadow.focus,
|
|
132
|
-
.shadow.hover {
|
|
133
|
-
transition: none;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
@media (forced-colors: active) {
|
|
137
|
-
.shadow {
|
|
138
|
-
display: none;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
`;
|
|
142
|
-
|
|
143
|
-
/** @private */
|
|
144
|
-
readonly #hoverController = new HoverController(this, {
|
|
145
|
-
target: null,
|
|
146
|
-
callback: (hovering) => this.#handleHoverChange(hovering),
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
/** @private */
|
|
150
|
-
readonly #focusController = new FocusController(this, {
|
|
151
|
-
target: null,
|
|
152
|
-
callback: (focused) => this.#handleFocusChange(focused),
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
/** @private */
|
|
156
|
-
readonly #pressedController = new PressedController(this, {
|
|
157
|
-
target: null,
|
|
158
|
-
callback: (pressed) => this.#handlePressedChange(pressed),
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
@query(".shadow") private readonly _shadow?: HTMLElement;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Whether hover and press events will not trigger changes in elevation, when attached to an interactive element.
|
|
165
|
-
* @default false
|
|
166
|
-
*/
|
|
167
|
-
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* The level at which to visually depict elevation.
|
|
171
|
-
* @default null
|
|
172
|
-
*/
|
|
173
|
-
@property({ type: Number, reflect: true }) level: ElevationLevel | null = null;
|
|
174
|
-
|
|
175
|
-
/** @inheritdoc */
|
|
176
|
-
override attach(control: HTMLElement): void {
|
|
177
|
-
super.attach(control);
|
|
178
|
-
|
|
179
|
-
this.#hoverController.observe(control);
|
|
180
|
-
this.#focusController.observe(control);
|
|
181
|
-
this.#pressedController.observe(control);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/** @inheritdoc */
|
|
185
|
-
override detach(): void {
|
|
186
|
-
if (this.control) {
|
|
187
|
-
this.#hoverController.unobserve(this.control);
|
|
188
|
-
this.#focusController.unobserve(this.control);
|
|
189
|
-
this.#pressedController.unobserve(this.control);
|
|
190
|
-
}
|
|
191
|
-
super.detach();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/** @inheritdoc */
|
|
195
|
-
override connectedCallback(): void {
|
|
196
|
-
this.ariaHidden = "true";
|
|
197
|
-
super.connectedCallback();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/** @inheritdoc */
|
|
201
|
-
override disconnectedCallback(): void {
|
|
202
|
-
super.disconnectedCallback();
|
|
203
|
-
|
|
204
|
-
this._shadow?.classList.toggle("hover", false);
|
|
205
|
-
this._shadow?.classList.toggle("focus", false);
|
|
206
|
-
this._shadow?.classList.toggle("pressed", false);
|
|
207
|
-
this._shadow?.classList.toggle("resting", false);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/** @inheritdoc */
|
|
211
|
-
protected override updated(_changedProperties: PropertyValues<this>): void {
|
|
212
|
-
super.updated(_changedProperties);
|
|
213
|
-
|
|
214
|
-
if (_changedProperties.has("disabled") && this.disabled) {
|
|
215
|
-
this._shadow?.classList.toggle("hover", false);
|
|
216
|
-
this._shadow?.classList.toggle("focus", false);
|
|
217
|
-
this._shadow?.classList.toggle("pressed", false);
|
|
218
|
-
this._shadow?.classList.toggle("resting", true);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/** @inheritdoc */
|
|
223
|
-
protected override render(): unknown {
|
|
224
|
-
return html`<div class="shadow"></div>`;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/** @private */
|
|
228
|
-
#handleHoverChange(hovering: boolean): void {
|
|
229
|
-
if (!this.disabled) {
|
|
230
|
-
this._shadow?.classList.toggle("hover", hovering);
|
|
231
|
-
this._shadow?.classList.toggle("resting", !hovering);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/** @private */
|
|
236
|
-
#handleFocusChange(focused: boolean): void {
|
|
237
|
-
if (!this.disabled) {
|
|
238
|
-
this._shadow?.classList.toggle("focus", focused);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/** @private */
|
|
243
|
-
#handlePressedChange(pressed: boolean): void {
|
|
244
|
-
if (!this.disabled) {
|
|
245
|
-
this._shadow?.classList.toggle("pressed", pressed);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
declare global {
|
|
251
|
-
interface HTMLElementTagNameMap {
|
|
252
|
-
"m3e-elevation": M3eElevationElement;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { unsafeCSS } from "lit";
|
|
2
|
-
|
|
3
|
-
import { DesignToken } from "../tokens";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Component design tokens that control the `M3eElevationElement`.
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const ElevationToken = {
|
|
10
|
-
liftDuration: unsafeCSS(`var(--m3e-elevation-lift-duration, ${DesignToken.motion.duration.short4})`),
|
|
11
|
-
liftEasing: unsafeCSS(`var(--m3e-elevation-lift-easing, ${DesignToken.motion.easing.standard})`),
|
|
12
|
-
settleDuration: unsafeCSS(`var(--m3e-elevation-settle-duration, ${DesignToken.motion.duration.short3})`),
|
|
13
|
-
settleEasing: unsafeCSS(`var(--m3e-elevation-settle-easing, ${DesignToken.motion.easing.standardAccelerate})`),
|
|
14
|
-
level: unsafeCSS(`var(--m3e-elevation-level, ${DesignToken.elevation.level0})`),
|
|
15
|
-
hoverLevel: unsafeCSS(`var(--m3e-elevation-hover-level, ${DesignToken.elevation.level0})`),
|
|
16
|
-
focusLevel: unsafeCSS(`var(--m3e-elevation-focus-level, ${DesignToken.elevation.level0})`),
|
|
17
|
-
pressedLevel: unsafeCSS(`var(--m3e-elevation-pressed-level, ${DesignToken.elevation.level0})`),
|
|
18
|
-
} as const;
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
|
2
|
-
import { customElement, property, query } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { FocusController } from "../controllers";
|
|
5
|
-
import { HtmlFor, Role } from "../mixins";
|
|
6
|
-
|
|
7
|
-
import { FocusRingToken } from "./FocusRingToken";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @summary
|
|
11
|
-
* A focus ring used to depict a strong focus indicator.
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* The `m3e-focus-ring` component is an absolute positioned element used to provide a strong focus indicator.
|
|
15
|
-
* The parenting element must be a relative positioned focusable element and allow for overflow.
|
|
16
|
-
*
|
|
17
|
-
* The component can be attached to an interactive element using the `for` attribute or programmatically using the `attach` method.
|
|
18
|
-
* The focus ring is displayed when the interactive element receives visible focus and hidden when focus is lost.
|
|
19
|
-
* This can be disabled using the `disabled` attribute.
|
|
20
|
-
*
|
|
21
|
-
* Alternately, you can use the `show` and `hide` methods to programmatically control the focus ring.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* The following example illustrates attaching a focus ring to an interactive element. In this example, the parenting div
|
|
25
|
-
* has relative positioning and is given an `id` referenced by `m3e-focus-ring` using the `for` attribute. Note that `#myDiv`
|
|
26
|
-
* is not used when specifying the attached element's identifier. The `#` is inferred.
|
|
27
|
-
*
|
|
28
|
-
* ```html
|
|
29
|
-
* <div id="myDiv" tabindex="0" style="position: relative;">
|
|
30
|
-
* <m3e-focus-ring for="myDiv"></m3e-focus-ring>
|
|
31
|
-
* <div>
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @tag m3e-focus-ring
|
|
35
|
-
*
|
|
36
|
-
* @attr disabled - Whether the focus events will not trigger the focus ring. Focus rings can be still controlled manually by using the `show` and `hide` methods.
|
|
37
|
-
* @attr inward - Whether the focus ring animates inward instead of outward.
|
|
38
|
-
*
|
|
39
|
-
* @cssprop --m3e-focus-ring-color - The color of the focus ring.
|
|
40
|
-
* @cssprop --m3e-focus-ring-duration - The duration of the focus ring animation.
|
|
41
|
-
* @cssprop --m3e-focus-ring-growth-factor - The factor by which the focus ring grows.
|
|
42
|
-
* @cssprop --m3e-focus-ring-thickness - The thickness of the focus ring.
|
|
43
|
-
* @cssprop --m3e-focus-ring-visibility - The visibility of the focus ring.
|
|
44
|
-
*/
|
|
45
|
-
@customElement("m3e-focus-ring")
|
|
46
|
-
export class M3eFocusRingElement extends HtmlFor(Role(LitElement, "none")) {
|
|
47
|
-
/** The styles of the element. */
|
|
48
|
-
static override styles: CSSResultGroup = css`
|
|
49
|
-
:host {
|
|
50
|
-
display: block;
|
|
51
|
-
position: absolute;
|
|
52
|
-
left: 0;
|
|
53
|
-
top: 0;
|
|
54
|
-
right: 0;
|
|
55
|
-
bottom: 0;
|
|
56
|
-
pointer-events: none;
|
|
57
|
-
border-radius: inherit;
|
|
58
|
-
outline: none;
|
|
59
|
-
}
|
|
60
|
-
.outline {
|
|
61
|
-
position: absolute;
|
|
62
|
-
left: 0;
|
|
63
|
-
top: 0;
|
|
64
|
-
right: 0;
|
|
65
|
-
bottom: 0;
|
|
66
|
-
pointer-events: none;
|
|
67
|
-
border-radius: inherit;
|
|
68
|
-
z-index: 1;
|
|
69
|
-
outline-color: ${FocusRingToken.color};
|
|
70
|
-
outline-width: ${FocusRingToken.thickness};
|
|
71
|
-
visibility: ${FocusRingToken.visibility};
|
|
72
|
-
}
|
|
73
|
-
.outline.visible {
|
|
74
|
-
outline-style: solid;
|
|
75
|
-
}
|
|
76
|
-
:host(:not([inward])) .outline {
|
|
77
|
-
outline-offset: calc(${FocusRingToken.thickness} / ${FocusRingToken.growthFactor});
|
|
78
|
-
}
|
|
79
|
-
:host([inward]) .outline {
|
|
80
|
-
outline-offset: calc(0px - ${FocusRingToken.thickness});
|
|
81
|
-
}
|
|
82
|
-
:host(:not([inward])) .outline.visible {
|
|
83
|
-
animation: grow-shrink ${FocusRingToken.duration};
|
|
84
|
-
}
|
|
85
|
-
:host([inward]) .outline.visible {
|
|
86
|
-
animation: shrink-grow ${FocusRingToken.duration};
|
|
87
|
-
}
|
|
88
|
-
@keyframes grow-shrink {
|
|
89
|
-
50% {
|
|
90
|
-
outline-width: calc(${FocusRingToken.thickness} * ${FocusRingToken.growthFactor});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
@keyframes shrink-grow {
|
|
94
|
-
50% {
|
|
95
|
-
outline-offset: calc(0px - calc(${FocusRingToken.thickness} * ${FocusRingToken.growthFactor}));
|
|
96
|
-
outline-width: calc(${FocusRingToken.thickness} * ${FocusRingToken.growthFactor});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
@media (prefers-reduced-motion) {
|
|
100
|
-
:host(:not([inward])) .outline.visible,
|
|
101
|
-
:host([inward]) .outline.visible {
|
|
102
|
-
animation: none;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
@media (forced-colors: active) {
|
|
106
|
-
.outline {
|
|
107
|
-
outline-color: Highlight;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
/** @private */
|
|
113
|
-
readonly #focusController = new FocusController(this, {
|
|
114
|
-
target: null,
|
|
115
|
-
callback: (_, focusVisible) => this.#handleFocusChange(focusVisible),
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
/** @private */ @query(".outline") private readonly _outline?: HTMLElement;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Whether the focus ring animates inward instead of outward.
|
|
122
|
-
* @default false
|
|
123
|
-
*/
|
|
124
|
-
@property({ type: Boolean, reflect: true }) inward = false;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Whether the focus events will not trigger the focus ring.
|
|
128
|
-
* Focus rings can be still controlled manually by using the `show` and `hide` methods.
|
|
129
|
-
* @default false
|
|
130
|
-
*/
|
|
131
|
-
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
132
|
-
|
|
133
|
-
/** Launches a manual focus ring. */
|
|
134
|
-
show(): void {
|
|
135
|
-
this._outline?.classList.toggle("visible", true);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/** Hides the focus ring. */
|
|
139
|
-
hide(): void {
|
|
140
|
-
this._outline?.classList.toggle("visible", false);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/** @inheritdoc */
|
|
144
|
-
override attach(control: HTMLElement): void {
|
|
145
|
-
super.attach(control);
|
|
146
|
-
this.#focusController.observe(control);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/** @inheritdoc */
|
|
150
|
-
override detach(): void {
|
|
151
|
-
if (this.control) {
|
|
152
|
-
this.#focusController.unobserve(this.control);
|
|
153
|
-
}
|
|
154
|
-
super.detach();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** @inheritdoc */
|
|
158
|
-
override connectedCallback(): void {
|
|
159
|
-
this.ariaHidden = "true";
|
|
160
|
-
super.connectedCallback();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** @inheritdoc */
|
|
164
|
-
override disconnectedCallback(): void {
|
|
165
|
-
super.disconnectedCallback();
|
|
166
|
-
this.hide();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** @inheritdoc */
|
|
170
|
-
protected override render(): unknown {
|
|
171
|
-
return html`<div class="outline"></div>`;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/** @inheritdoc */
|
|
175
|
-
protected override updated(_changedProperties: PropertyValues<this>): void {
|
|
176
|
-
super.updated(_changedProperties);
|
|
177
|
-
|
|
178
|
-
if (_changedProperties.has("disabled") && this.disabled) {
|
|
179
|
-
this.hide();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** @private */
|
|
184
|
-
#handleFocusChange(focusVisible: boolean): void {
|
|
185
|
-
if (!this.disabled) {
|
|
186
|
-
if (focusVisible) {
|
|
187
|
-
this.show();
|
|
188
|
-
} else {
|
|
189
|
-
this.hide();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
declare global {
|
|
196
|
-
interface HTMLElementTagNameMap {
|
|
197
|
-
"m3e-focus-ring": M3eFocusRingElement;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { unsafeCSS } from "lit";
|
|
2
|
-
|
|
3
|
-
import { DesignToken } from "../tokens";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Component design tokens that control the `M3eFocusRingElement`.
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const FocusRingToken = {
|
|
10
|
-
/** The color of the focus ring. */
|
|
11
|
-
color: unsafeCSS(`var(--m3e-focus-ring-color, ${DesignToken.color.secondary})`),
|
|
12
|
-
|
|
13
|
-
/** The duration of the focus ring animation. */
|
|
14
|
-
duration: unsafeCSS(`var(--m3e-focus-ring-duration, ${DesignToken.motion.duration.long2})`),
|
|
15
|
-
|
|
16
|
-
/** The thickness of the focus ring. */
|
|
17
|
-
thickness: unsafeCSS(`var(--m3e-focus-ring-thickness, 0.1875rem)`),
|
|
18
|
-
|
|
19
|
-
/** The visibility of the focus ring. */
|
|
20
|
-
visibility: unsafeCSS(`var(--m3e-focus-ring-visibility, visible)`),
|
|
21
|
-
|
|
22
|
-
/** The factor by which the focus ring grows. */
|
|
23
|
-
growthFactor: unsafeCSS(`var(--m3e-focus-ring-growth-factor, 2)`),
|
|
24
|
-
} as const;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
|
2
|
-
import { customElement } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { CheckedIndeterminate, Disabled, Role } from "../mixins";
|
|
5
|
-
import { DesignToken } from "../tokens";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @summary
|
|
9
|
-
* An element which looks like a checkbox.
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* The `m3e-pseudo-checkbox` component is a pseudo-checkbox supporting checked, indeterminate, and disabled
|
|
13
|
-
* states. It is customizable via CSS properties for expressive, accessible UI design.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* The following example illustrates how to render a checked pseudo-checkbox.
|
|
17
|
-
* ```html
|
|
18
|
-
* <m3e-pseudo-checkbox checked></m3e-pseudo-checkbox>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @tag m3e-pseudo-checkbox
|
|
22
|
-
*
|
|
23
|
-
* @attr checked - A value indicating whether the element is checked.
|
|
24
|
-
* @attr disabled - A value indicating whether the element is disabled.
|
|
25
|
-
* @attr indeterminate - A value indicating whether the element's checked state is indeterminate.
|
|
26
|
-
*
|
|
27
|
-
* @cssprop --m3e-checkbox-icon-size - Size of the checkbox icon.
|
|
28
|
-
* @cssprop --m3e-checkbox-container-shape - Border radius of the checkbox container.
|
|
29
|
-
* @cssprop --m3e-checkbox-unselected-outline-thickness - Outline thickness for unselected state.
|
|
30
|
-
* @cssprop --m3e-checkbox-unselected-outline-color - Outline color for unselected state.
|
|
31
|
-
* @cssprop --m3e-checkbox-selected-container-color - Background color for selected state.
|
|
32
|
-
* @cssprop --m3e-checkbox-selected-icon-color - Icon color for selected state.
|
|
33
|
-
* @cssprop --m3e-checkbox-unselected-disabled-outline-color - Outline color for unselected disabled state.
|
|
34
|
-
* @cssprop --m3e-checkbox-unselected-disabled-outline-opacity - Outline opacity for unselected disabled state.
|
|
35
|
-
* @cssprop --m3e-checkbox-selected-disabled-container-color - Background color for selected disabled state.
|
|
36
|
-
* @cssprop --m3e-checkbox-selected-disabled-container-opacity - Background opacity for selected disabled state.
|
|
37
|
-
* @cssprop --m3e-checkbox-selected-disabled-icon-color - Icon color for selected disabled state.
|
|
38
|
-
* @cssprop --m3e-checkbox-selected-disabled-icon-opacity - Icon opacity for selected disabled state.
|
|
39
|
-
*/
|
|
40
|
-
@customElement("m3e-pseudo-checkbox")
|
|
41
|
-
export class M3ePseudoCheckboxElement extends CheckedIndeterminate(Disabled(Role(LitElement, "none"))) {
|
|
42
|
-
/** The styles of the element. */
|
|
43
|
-
static override styles: CSSResultGroup = css`
|
|
44
|
-
:host {
|
|
45
|
-
display: inline-block;
|
|
46
|
-
vertical-align: middle;
|
|
47
|
-
width: var(--m3e-checkbox-icon-size, 1.125rem);
|
|
48
|
-
height: var(--m3e-checkbox-icon-size, 1.125rem);
|
|
49
|
-
border-radius: var(--m3e-checkbox-container-shape, 0.125rem);
|
|
50
|
-
box-sizing: border-box;
|
|
51
|
-
flex: none;
|
|
52
|
-
}
|
|
53
|
-
:host(:not([checked]):not([indeterminate])) {
|
|
54
|
-
border-width: var(--m3e-checkbox-unselected-outline-thickness, 0.125rem);
|
|
55
|
-
border-style: solid;
|
|
56
|
-
}
|
|
57
|
-
:host(:not([disabled])[checked]),
|
|
58
|
-
:host(:not([disabled])[indeterminate]) {
|
|
59
|
-
background-color: var(--m3e-checkbox-selected-container-color, ${DesignToken.color.primary});
|
|
60
|
-
color: var(--m3e-checkbox-selected-icon-color, ${DesignToken.color.onPrimary});
|
|
61
|
-
}
|
|
62
|
-
:host(:not([disabled]):not([checked]):not([indeterminate])) {
|
|
63
|
-
border-color: var(--m3e-checkbox-unselected-outline-color, ${DesignToken.color.onSurfaceVariant});
|
|
64
|
-
}
|
|
65
|
-
:host([disabled]:not([checked]):not([indeterminate])) {
|
|
66
|
-
border-color: color-mix(
|
|
67
|
-
in srgb,
|
|
68
|
-
var(--m3e-checkbox-unselected-disabled-outline-color, ${DesignToken.color.onSurface})
|
|
69
|
-
var(--m3e-checkbox-unselected-disabled-outline-opacity, 38%),
|
|
70
|
-
transparent
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
:host([disabled][checked]),
|
|
74
|
-
:host([disabled][indeterminate]) {
|
|
75
|
-
background-color: color-mix(
|
|
76
|
-
in srgb,
|
|
77
|
-
var(--m3e-checkbox-selected-disabled-container-color, ${DesignToken.color.onSurface})
|
|
78
|
-
var(--m3e-checkbox-selected-disabled-container-opacity, 38%),
|
|
79
|
-
transparent
|
|
80
|
-
);
|
|
81
|
-
color: color-mix(
|
|
82
|
-
in srgb,
|
|
83
|
-
var(--m3e-checkbox-selected-disabled-icon-color, ${DesignToken.color.surface})
|
|
84
|
-
var(--m3e-checkbox-selected-disabled-icon-opacity, 100%),
|
|
85
|
-
transparent
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
/** @inheritdoc */
|
|
91
|
-
override connectedCallback(): void {
|
|
92
|
-
super.connectedCallback();
|
|
93
|
-
this.ariaHidden = "true";
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** @inheritdoc */
|
|
97
|
-
protected override render(): unknown {
|
|
98
|
-
if (this.indeterminate) {
|
|
99
|
-
return html`<svg viewBox="0 -960 960 960" fill="currentColor">
|
|
100
|
-
<path Required d="M240-440v-80h480v80H240Z" />
|
|
101
|
-
</svg>`;
|
|
102
|
-
}
|
|
103
|
-
if (this.checked) {
|
|
104
|
-
return html`<svg viewBox="0 -960 960 960" fill="currentColor">
|
|
105
|
-
<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
106
|
-
</svg>`;
|
|
107
|
-
}
|
|
108
|
-
return nothing;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
declare global {
|
|
113
|
-
interface HTMLElementTagNameMap {
|
|
114
|
-
"m3e-pseudo-checkbox": M3ePseudoCheckboxElement;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement } from "lit";
|
|
2
|
-
import { customElement } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { Checked, Disabled, Role } from "../mixins";
|
|
5
|
-
import { DesignToken } from "../tokens";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @summary
|
|
9
|
-
* An element which looks like a radio button.
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* The `m3e-pseudo-radio` component is a pseudo-radio supporting checked and disabled
|
|
13
|
-
* states. It is customizable via CSS properties for expressive, accessible UI design.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* The following example illustrates how to render a checked pseudo-radio.
|
|
17
|
-
* ```html
|
|
18
|
-
* <m3e-pseudo-radio checked></m3e-pseudo-radio>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @tag m3e-pseudo-radio
|
|
22
|
-
*
|
|
23
|
-
* @attr checked - A value indicating whether the element is checked.
|
|
24
|
-
* @attr disabled - A value indicating whether the element is disabled.
|
|
25
|
-
*
|
|
26
|
-
* @cssprop --m3e-radio-icon-size - Size of the radio icon.
|
|
27
|
-
* @cssprop --m3e-radio-unselected-icon-color - Color of the unselected radio icon.
|
|
28
|
-
* @cssprop --m3e-radio-selected-icon-color - Color of the selected radio icon.
|
|
29
|
-
* @cssprop --m3e-radio-disabled-icon-color - Color of the disabled radio icon.
|
|
30
|
-
*/
|
|
31
|
-
@customElement("m3e-pseudo-radio")
|
|
32
|
-
export class M3ePseudoRadioElement extends Checked(Disabled(Role(LitElement, "none"))) {
|
|
33
|
-
/** The styles of the element. */
|
|
34
|
-
static override styles: CSSResultGroup = css`
|
|
35
|
-
:host {
|
|
36
|
-
display: inline-block;
|
|
37
|
-
vertical-align: middle;
|
|
38
|
-
box-sizing: border-box;
|
|
39
|
-
width: var(--m3e-radio-icon-size, 1.25rem);
|
|
40
|
-
height: var(--m3e-radio-icon-size, 1.25rem);
|
|
41
|
-
flex: none;
|
|
42
|
-
}
|
|
43
|
-
.circle {
|
|
44
|
-
fill: currentColor;
|
|
45
|
-
}
|
|
46
|
-
:host(:not([checked])) .circle.inner {
|
|
47
|
-
opacity: 0;
|
|
48
|
-
}
|
|
49
|
-
:host(:not([checked])) {
|
|
50
|
-
color: var(--m3e-radio-unselected-icon-color, ${DesignToken.color.onSurfaceVariant});
|
|
51
|
-
}
|
|
52
|
-
:host([checked]) {
|
|
53
|
-
color: var(--m3e-radio-selected-icon-color, ${DesignToken.color.primary});
|
|
54
|
-
}
|
|
55
|
-
:host([disabled]) {
|
|
56
|
-
color: color-mix(in srgb, var(--m3e-radio-disabled-icon-color, ${DesignToken.color.onSurface}) 38%, transparent);
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
/** @inheritdoc */
|
|
61
|
-
override connectedCallback(): void {
|
|
62
|
-
super.connectedCallback();
|
|
63
|
-
this.ariaHidden = "true";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** @inheritdoc */
|
|
67
|
-
protected override render(): unknown {
|
|
68
|
-
return html`<svg class="icon" viewBox="0 0 20 20">
|
|
69
|
-
<mask id="cutout2">
|
|
70
|
-
<rect width="100%" height="100%" fill="white"></rect>
|
|
71
|
-
<circle cx="10" cy="10" r="8" fill="black"></circle>
|
|
72
|
-
</mask>
|
|
73
|
-
<circle class="outer circle" cx="10" cy="10" r="10" mask="url(#cutout2)"></circle>
|
|
74
|
-
<circle class="inner circle" cx="10" cy="10" r="5"></circle>
|
|
75
|
-
</svg>`;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
declare global {
|
|
80
|
-
interface HTMLElementTagNameMap {
|
|
81
|
-
"m3e-pseudo-radio": M3ePseudoRadioElement;
|
|
82
|
-
}
|
|
83
|
-
}
|