wave-ui 4.0.2 → 4.1.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/dist/wave-ui.cjs.js +3 -3
- package/dist/wave-ui.css +1 -1
- package/dist/wave-ui.esm.js +1289 -1151
- package/dist/wave-ui.umd.js +3 -3
- package/package.json +1 -1
- package/src/wave-ui/components/w-accordion/item.vue +7 -1
- package/src/wave-ui/components/w-autocomplete.vue +3 -1
- package/src/wave-ui/components/w-button/index.vue +11 -2
- package/src/wave-ui/components/w-checkbox.vue +3 -1
- package/src/wave-ui/components/w-checkboxes.vue +9 -0
- package/src/wave-ui/components/w-dialog.vue +6 -0
- package/src/wave-ui/components/w-drawer.vue +15 -2
- package/src/wave-ui/components/w-input.vue +3 -1
- package/src/wave-ui/components/w-list.vue +10 -1
- package/src/wave-ui/components/w-menu.vue +7 -0
- package/src/wave-ui/components/w-overlay.vue +44 -8
- package/src/wave-ui/components/w-radio.vue +3 -1
- package/src/wave-ui/components/w-radios.vue +9 -0
- package/src/wave-ui/components/w-rating.vue +7 -0
- package/src/wave-ui/components/w-select.vue +10 -1
- package/src/wave-ui/components/w-slider.vue +4 -1
- package/src/wave-ui/components/w-switch.vue +3 -1
- package/src/wave-ui/components/w-tabs/index.vue +16 -1
- package/src/wave-ui/components/w-tag.vue +9 -1
- package/src/wave-ui/components/w-textarea.vue +4 -1
- package/src/wave-ui/components/w-tree.vue +8 -0
- package/src/wave-ui/core.js +2 -2
- package/src/wave-ui/mixins/focusable.js +13 -0
- package/src/wave-ui/scss/_base.scss +4 -0
- package/src/wave-ui/utils/focus.js +39 -0
|
@@ -88,6 +88,8 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
:root[data-theme="light"] {
|
|
91
|
+
color-scheme: light;
|
|
92
|
+
|
|
91
93
|
--w-base-bg-color: #fff;
|
|
92
94
|
--w-base-color: #000;
|
|
93
95
|
--w-contrast-bg-color: #000;
|
|
@@ -97,6 +99,8 @@
|
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
:root[data-theme="dark"] {
|
|
102
|
+
color-scheme: dark;
|
|
103
|
+
|
|
100
104
|
--w-base-bg-color: #222;
|
|
101
105
|
--w-base-color: #fff;
|
|
102
106
|
--w-contrast-bg-color: #fff;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { nextTick } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function focusElement (el) {
|
|
4
|
+
el?.focus?.()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function guardFocusable (vm) {
|
|
8
|
+
if (vm.isDisabled || vm.isReadonly) return false
|
|
9
|
+
return true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resolve focus() from a directive host. On components, `vnode` is the root element
|
|
14
|
+
* VNode (no `vnode.component`); the DOM owner is on `el.__vueParentComponent`.
|
|
15
|
+
* Walk up when the root is a wrapper (e.g. `w-form-element` around `w-input`).
|
|
16
|
+
*/
|
|
17
|
+
export function resolveFocusFn (vnode, el) {
|
|
18
|
+
let instance = vnode?.component ?? el?.__vueParentComponent
|
|
19
|
+
while (instance) {
|
|
20
|
+
const focusFn = instance.exposed?.focus ?? instance.proxy?.focus
|
|
21
|
+
if (typeof focusFn === 'function') return focusFn
|
|
22
|
+
instance = instance.parent
|
|
23
|
+
}
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function callFocus (vnode, el) {
|
|
28
|
+
const focusFn = resolveFocusFn(vnode, el)
|
|
29
|
+
if (typeof focusFn === 'function') {
|
|
30
|
+
focusFn()
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
focusElement(el)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Schedule focus after mount so template refs exist on the host component. */
|
|
37
|
+
export function scheduleFocus (vnode, el) {
|
|
38
|
+
nextTick(() => callFocus(vnode, el))
|
|
39
|
+
}
|