@mcwv/dialog
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -9,2 +9,3 @@ import { cssClasses } from './constants'; | ||
isDefault: Boolean, | ||
isInitialFocus: Boolean, | ||
}, | ||
@@ -15,3 +16,3 @@ | ||
{ | ||
props: { action, isDefault }, | ||
props: { action, isDefault, isInitialFocus }, | ||
data: { staticClass, attrs }, | ||
@@ -24,8 +25,9 @@ scopedSlots, | ||
{ | ||
class: [ | ||
staticClass, | ||
cssClasses.BUTTON, | ||
{ [cssClasses.DEFAULT_BUTTON]: isDefault }, | ||
], | ||
attrs: { ...attrs, 'data-mdc-dialog-action': action }, | ||
class: [staticClass, cssClasses.BUTTON], | ||
attrs: { | ||
...attrs, | ||
'data-mdc-dialog-action': action, | ||
'data-mdc-dialog-button-default': isDefault, | ||
'data-mdc-dialog-initial-focus': isInitialFocus, | ||
}, | ||
}, | ||
@@ -36,2 +38,1 @@ scopedSlots.default && scopedSlots.default(), | ||
}; | ||
2; |
/* eslint-disable quote-props */ | ||
import mcwDialogFoundation from '@material/dialog/foundation'; | ||
import MDCDialogFoundation from '@material/dialog/foundation'; | ||
import * as util from '@material/dialog/util'; | ||
@@ -42,3 +42,3 @@ import { closest, matches } from '@material/dom/ponyfill'; | ||
mounted() { | ||
const strings = mcwDialogFoundation.strings; | ||
const strings = MDCDialogFoundation.strings; | ||
@@ -49,3 +49,3 @@ const { open, autoStackButtons, escapeKeyAction, scrimClickAction } = this; | ||
this.defaultButton = this.$el.querySelector( | ||
`.${cssClasses.DEFAULT_BUTTON}`, | ||
`[${strings.BUTTON_DEFAULT_ATTRIBUTE}]`, | ||
); | ||
@@ -60,4 +60,5 @@ | ||
eventTargetMatches: (target, selector) => matches(target, selector), | ||
trapFocus: () => this.focusTrap && this.focusTrap.activate(), | ||
trapFocus: initialFocusEl => this.focusTrap && this.focusTrap.activate(), | ||
releaseFocus: () => this.focusTrap && this.focusTrap.deactivate(), | ||
getInitialFocusEl: () => this.getInitialFocusEl_(), | ||
isContentScrollable: () => | ||
@@ -112,3 +113,3 @@ !!this.$refs.contentEl && util.isScrollable(this.$refs.contentEl), | ||
this.foundation = new mcwDialogFoundation(adapter); | ||
this.foundation = new MDCDialogFoundation(adapter); | ||
@@ -142,6 +143,15 @@ this.foundation.init(); | ||
}, | ||
getInitialFocusEl_() { | ||
return document.querySelector( | ||
`[${MDCDialogFoundation.strings.INITIAL_FOCUS_ATTRIBUTE}]`, | ||
); | ||
}, | ||
onOpen_(value) { | ||
if (value) { | ||
if (this.$refs.container) { | ||
this.focusTrap = util.createFocusTrapInstance(this.$el); | ||
this.focusTrap = util.createFocusTrapInstance( | ||
this.$el, | ||
void 0, | ||
this.getInitialFocusEl_() || void 0, | ||
); | ||
} | ||
@@ -153,3 +163,2 @@ this.foundation.open(); | ||
}, | ||
onCancel() { | ||
@@ -244,4 +253,4 @@ if (this.$listeners['validateCancel']) { | ||
on: { | ||
click: evt => this.foundation.handleInteraction(evt), | ||
keydown: evt => this.foundation.handleInteraction(evt), | ||
click: evt => this.foundation.handleClick(evt), | ||
keydown: evt => this.foundation.handleKeydown(evt), | ||
}, | ||
@@ -248,0 +257,0 @@ }, |
{ | ||
"name": "@mcwv/dialog", | ||
"description": "The Vue Material Adapter for the web dialog component", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"license": "MIT", | ||
@@ -19,7 +19,7 @@ "main": "dist/mcwv.dialog.min.js", | ||
"dependencies": { | ||
"@material/dialog": "^2.3.0", | ||
"@mcwv/base": "^0.9.0", | ||
"@mcwv/button": "^0.9.0" | ||
"@material/dialog": "^3.0.0", | ||
"@mcwv/base": "^0.10.0", | ||
"@mcwv/button": "^0.10.0" | ||
}, | ||
"gitHead": "c1c18cf24c280b8345c7810d22a3f635ee49730b" | ||
"gitHead": "43f9928f7e26c14fa6f8809e51ab81592fd082c4" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14094
442
+ Added@material/animation@3.1.0(transitive)
+ Added@material/base@3.1.0(transitive)
+ Added@material/button@3.2.0(transitive)
+ Added@material/dialog@3.2.0(transitive)
+ Added@material/dom@3.1.0(transitive)
+ Added@material/elevation@3.1.0(transitive)
+ Added@material/feature-targeting@3.1.0(transitive)
+ Added@material/ripple@3.2.0(transitive)
+ Added@material/rtl@3.2.0(transitive)
+ Added@material/shape@3.1.0(transitive)
+ Added@material/theme@3.1.0(transitive)
+ Added@material/typography@3.1.0(transitive)
+ Added@mcwv/base@0.10.0(transitive)
+ Added@mcwv/button@0.10.0(transitive)
+ Added@mcwv/ripple@0.10.0(transitive)
- Removed@material/animation@1.0.0(transitive)
- Removed@material/base@1.0.0(transitive)
- Removed@material/button@2.3.0(transitive)
- Removed@material/dialog@2.3.0(transitive)
- Removed@material/dom@1.1.0(transitive)
- Removed@material/elevation@1.1.0(transitive)
- Removed@material/feature-targeting@0.44.1(transitive)
- Removed@material/ripple@2.3.0(transitive)
- Removed@material/rtl@0.42.0(transitive)
- Removed@material/shape@1.1.1(transitive)
- Removed@material/theme@1.1.0(transitive)
- Removed@material/typography@2.3.0(transitive)
- Removed@mcwv/base@0.9.0(transitive)
- Removed@mcwv/button@0.9.0(transitive)
- Removed@mcwv/ripple@0.9.0(transitive)
Updated@material/dialog@^3.0.0
Updated@mcwv/base@^0.10.0
Updated@mcwv/button@^0.10.0