@nightshadeui/components 0.0.0-stage → 3.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/components/BaseMenu.vue.d.ts +314 -0
- package/dist/components/BaseMenu.vue.d.ts.map +1 -0
- package/dist/components/Btn.vue.d.ts +215 -0
- package/dist/components/Btn.vue.d.ts.map +1 -0
- package/dist/components/Bubble.vue.d.ts +42 -0
- package/dist/components/Bubble.vue.d.ts.map +1 -0
- package/dist/components/Checkbox.vue.d.ts +137 -0
- package/dist/components/Checkbox.vue.d.ts.map +1 -0
- package/dist/components/Chip.vue.d.ts +120 -0
- package/dist/components/Chip.vue.d.ts.map +1 -0
- package/dist/components/ContextMenu.vue.d.ts +479 -0
- package/dist/components/ContextMenu.vue.d.ts.map +1 -0
- package/dist/components/ContextPopup.vue.d.ts +142 -0
- package/dist/components/ContextPopup.vue.d.ts.map +1 -0
- package/dist/components/Filler.vue.d.ts +24 -0
- package/dist/components/Filler.vue.d.ts.map +1 -0
- package/dist/components/HGroup.vue.d.ts +57 -0
- package/dist/components/HGroup.vue.d.ts.map +1 -0
- package/dist/components/InputBase.vue.d.ts +196 -0
- package/dist/components/InputBase.vue.d.ts.map +1 -0
- package/dist/components/InputGroup.vue.d.ts +24 -0
- package/dist/components/InputGroup.vue.d.ts.map +1 -0
- package/dist/components/InputSelect.vue.d.ts +228 -0
- package/dist/components/InputSelect.vue.d.ts.map +1 -0
- package/dist/components/InputText.vue.d.ts +218 -0
- package/dist/components/InputText.vue.d.ts.map +1 -0
- package/dist/components/InputTextarea.vue.d.ts +218 -0
- package/dist/components/InputTextarea.vue.d.ts.map +1 -0
- package/dist/components/ModalOverlay.vue.d.ts +38 -0
- package/dist/components/ModalOverlay.vue.d.ts.map +1 -0
- package/dist/components/RouterBtn.vue.d.ts +229 -0
- package/dist/components/RouterBtn.vue.d.ts.map +1 -0
- package/dist/components/Slider.vue.d.ts +293 -0
- package/dist/components/Slider.vue.d.ts.map +1 -0
- package/dist/components/Tab.vue.d.ts +53 -0
- package/dist/components/Tab.vue.d.ts.map +1 -0
- package/dist/components/TabCap.vue.d.ts +33 -0
- package/dist/components/TabCap.vue.d.ts.map +1 -0
- package/dist/components/Toggle.vue.d.ts +138 -0
- package/dist/components/Toggle.vue.d.ts.map +1 -0
- package/dist/components/ToolPanel.vue.d.ts +48 -0
- package/dist/components/ToolPanel.vue.d.ts.map +1 -0
- package/dist/components/VGroup.vue.d.ts +48 -0
- package/dist/components/VGroup.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components.css +1 -0
- package/dist/components.mjs +1719 -0
- package/dist/glyphs/GlyphCheck.vue.d.ts +3 -0
- package/dist/glyphs/GlyphCheck.vue.d.ts.map +1 -0
- package/dist/glyphs/GlyphXmark.vue.d.ts +3 -0
- package/dist/glyphs/GlyphXmark.vue.d.ts.map +1 -0
- package/dist/glyphs/index.d.ts +4 -0
- package/dist/glyphs/index.d.ts.map +1 -0
- package/dist/helpers/props.d.ts +13 -0
- package/dist/helpers/props.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/types/MenuItem.d.ts +13 -0
- package/dist/types/MenuItem.d.ts.map +1 -0
- package/dist/types/SelectOption.d.ts +6 -0
- package/dist/types/SelectOption.d.ts.map +1 -0
- package/package.json +36 -5
- package/src/components/BaseMenu.vue +173 -0
- package/src/components/Btn.vue +385 -0
- package/src/components/Bubble.vue +143 -0
- package/src/components/Checkbox.vue +256 -0
- package/src/components/Chip.vue +189 -0
- package/src/components/ContextMenu.vue +71 -0
- package/src/components/ContextPopup.vue +166 -0
- package/src/components/Filler.vue +43 -0
- package/src/components/HGroup.vue +74 -0
- package/src/components/InputBase.vue +278 -0
- package/src/components/InputGroup.vue +43 -0
- package/src/components/InputSelect.vue +180 -0
- package/src/components/InputText.vue +103 -0
- package/src/components/InputTextarea.vue +130 -0
- package/src/components/ModalOverlay.vue +74 -0
- package/src/components/RouterBtn.vue +52 -0
- package/src/components/Slider.vue +689 -0
- package/src/components/Tab.vue +129 -0
- package/src/components/TabCap.vue +46 -0
- package/src/components/Toggle.vue +238 -0
- package/src/components/ToolPanel.vue +83 -0
- package/src/components/VGroup.vue +68 -0
- package/src/components/index.ts +47 -0
- package/src/glyphs/GlyphCheck.vue +12 -0
- package/src/glyphs/GlyphXmark.vue +12 -0
- package/src/glyphs/index.ts +7 -0
- package/src/helpers/props.ts +60 -0
- package/src/index.ts +10 -0
- package/src/types/MenuItem.ts +12 -0
- package/src/types/SelectOption.ts +5 -0
- package/src/types.d.ts +6 -0
- package/README.md +0 -3
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputBase
|
|
3
|
+
class="InputSelect"
|
|
4
|
+
v-bind="inputBaseProps"
|
|
5
|
+
@click="onBaseClick($event)">
|
|
6
|
+
<slot name="before" />
|
|
7
|
+
<select
|
|
8
|
+
ref="input"
|
|
9
|
+
:value="resolvedProps.modelValue"
|
|
10
|
+
:disabled="resolvedProps.disabled"
|
|
11
|
+
:aria-readonly="resolvedProps.readonly"
|
|
12
|
+
@input="onInput($event)"
|
|
13
|
+
@change="onChange($event)"
|
|
14
|
+
@focus="$emit('focus', $event)"
|
|
15
|
+
@blur="$emit('blur', $event)">
|
|
16
|
+
<template v-if="hasGroupedOptions">
|
|
17
|
+
<optgroup
|
|
18
|
+
v-for="group in groupedOptions"
|
|
19
|
+
:key="group.label"
|
|
20
|
+
:label="group.label">
|
|
21
|
+
<option
|
|
22
|
+
v-for="option in group.options"
|
|
23
|
+
:key="optionKey(option)"
|
|
24
|
+
:value="option.value">
|
|
25
|
+
{{ optionLabel(option) }}
|
|
26
|
+
</option>
|
|
27
|
+
</optgroup>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-else>
|
|
30
|
+
<option
|
|
31
|
+
v-for="option in resolvedProps.options"
|
|
32
|
+
:key="optionKey(option)"
|
|
33
|
+
:value="option.value">
|
|
34
|
+
{{ optionLabel(option) }}
|
|
35
|
+
</option>
|
|
36
|
+
</template>
|
|
37
|
+
</select>
|
|
38
|
+
<slot name="after" />
|
|
39
|
+
</InputBase>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import {
|
|
44
|
+
collectProps,
|
|
45
|
+
nightshadeMixin,
|
|
46
|
+
} from '../helpers/props.js';
|
|
47
|
+
import InputBase from './InputBase.vue';
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
|
|
51
|
+
components: {
|
|
52
|
+
InputBase,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
mixins: [nightshadeMixin],
|
|
56
|
+
|
|
57
|
+
props: {
|
|
58
|
+
...InputBase.props,
|
|
59
|
+
tagName: { type: String, default: 'label' },
|
|
60
|
+
modelValue: { type: [String, Number] },
|
|
61
|
+
options: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: () => [],
|
|
64
|
+
},
|
|
65
|
+
autoFocus: { type: Boolean },
|
|
66
|
+
readonly: { type: Boolean },
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
emits: [
|
|
70
|
+
'focus',
|
|
71
|
+
'blur',
|
|
72
|
+
'input',
|
|
73
|
+
'change',
|
|
74
|
+
'update:modelValue'
|
|
75
|
+
],
|
|
76
|
+
|
|
77
|
+
computed: {
|
|
78
|
+
|
|
79
|
+
inputBaseProps() {
|
|
80
|
+
return collectProps(this, InputBase);
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
hasGroupedOptions() {
|
|
84
|
+
return this.resolvedProps.options.some(option => option?.group);
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
groupedOptions() {
|
|
88
|
+
const groups = [{
|
|
89
|
+
label: '',
|
|
90
|
+
options: [],
|
|
91
|
+
}];
|
|
92
|
+
for (const option of this.resolvedProps.options) {
|
|
93
|
+
const groupLabel = option?.group ?? '';
|
|
94
|
+
const group = groups.find(group => group.label === groupLabel);
|
|
95
|
+
if (group) {
|
|
96
|
+
group.options.push(option);
|
|
97
|
+
} else {
|
|
98
|
+
groups.push({
|
|
99
|
+
label: groupLabel,
|
|
100
|
+
options: [option],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return groups;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
mounted() {
|
|
109
|
+
if (this.resolvedProps.autoFocus) {
|
|
110
|
+
this.$refs.input?.focus();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
methods: {
|
|
115
|
+
|
|
116
|
+
onInput(ev) {
|
|
117
|
+
this.$emit('input', ev);
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
onChange(ev) {
|
|
121
|
+
if (this.resolvedProps.readonly) {
|
|
122
|
+
ev.target.value = this.resolvedProps.modelValue;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.$emit('change', ev);
|
|
126
|
+
this.$emit('update:modelValue', ev.target.value);
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
optionLabel(option) {
|
|
130
|
+
return String(option?.label ?? option?.value ?? '');
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
optionKey(option) {
|
|
134
|
+
return `${option?.group ?? ''}:${String(option?.value ?? '')}`;
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
onBaseClick(ev) {
|
|
138
|
+
const select = this.$refs.input;
|
|
139
|
+
if (ev.target === select) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
ev.preventDefault();
|
|
143
|
+
if (typeof select.showPicker === 'function') {
|
|
144
|
+
select.showPicker();
|
|
145
|
+
} else {
|
|
146
|
+
select.click();
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
};
|
|
153
|
+
</script>
|
|
154
|
+
|
|
155
|
+
<style scoped>
|
|
156
|
+
.InputSelect:not(.InputSelect-disabled) {
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
select {
|
|
161
|
+
-webkit-appearance: none;
|
|
162
|
+
appearance: none;
|
|
163
|
+
box-sizing: border-box;
|
|
164
|
+
flex: 1;
|
|
165
|
+
padding: 0;
|
|
166
|
+
border: 0;
|
|
167
|
+
width: 100%;
|
|
168
|
+
min-width: 0;
|
|
169
|
+
outline: 0;
|
|
170
|
+
user-select: text;
|
|
171
|
+
background: transparent;
|
|
172
|
+
color: inherit;
|
|
173
|
+
font: inherit;
|
|
174
|
+
cursor: inherit;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
select[aria-readonly='true'] {
|
|
178
|
+
pointer-events: none;
|
|
179
|
+
}
|
|
180
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputBase
|
|
3
|
+
class="InputText"
|
|
4
|
+
v-bind="inputBaseProps">
|
|
5
|
+
<slot name="before" />
|
|
6
|
+
<input
|
|
7
|
+
ref="input"
|
|
8
|
+
:value="resolvedProps.modelValue"
|
|
9
|
+
:type="resolvedProps.type"
|
|
10
|
+
:placeholder="resolvedProps.placeholder"
|
|
11
|
+
:readonly="resolvedProps.readonly"
|
|
12
|
+
:disabled="resolvedProps.disabled"
|
|
13
|
+
:min="resolvedProps.min"
|
|
14
|
+
:max="resolvedProps.max"
|
|
15
|
+
:step="resolvedProps.step"
|
|
16
|
+
autocomplete="off"
|
|
17
|
+
@input="onInput($event)"
|
|
18
|
+
@focus="$emit('focus', $event)"
|
|
19
|
+
@blur="$emit('blur', $event)" />
|
|
20
|
+
<slot name="after" />
|
|
21
|
+
</InputBase>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import {
|
|
26
|
+
collectProps,
|
|
27
|
+
nightshadeMixin,
|
|
28
|
+
} from '../helpers/props.js';
|
|
29
|
+
import InputBase from './InputBase.vue';
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
|
|
33
|
+
components: {
|
|
34
|
+
InputBase,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
mixins: [nightshadeMixin],
|
|
38
|
+
|
|
39
|
+
props: {
|
|
40
|
+
...InputBase.props,
|
|
41
|
+
tagName: { type: String, default: 'label' },
|
|
42
|
+
modelValue: { type: [String, Number] },
|
|
43
|
+
type: { type: String },
|
|
44
|
+
placeholder: { type: String },
|
|
45
|
+
min: { type: Number },
|
|
46
|
+
max: { type: Number },
|
|
47
|
+
step: { type: Number },
|
|
48
|
+
autoFocus: { type: Boolean },
|
|
49
|
+
readonly: { type: Boolean },
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
emits: [
|
|
53
|
+
'focus',
|
|
54
|
+
'blur',
|
|
55
|
+
'input',
|
|
56
|
+
'update:modelValue'
|
|
57
|
+
],
|
|
58
|
+
|
|
59
|
+
computed: {
|
|
60
|
+
inputBaseProps() {
|
|
61
|
+
return collectProps(this, InputBase);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
mounted() {
|
|
66
|
+
if (this.resolvedProps.autoFocus) {
|
|
67
|
+
this.$refs.input?.focus();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
methods: {
|
|
72
|
+
|
|
73
|
+
onInput(ev) {
|
|
74
|
+
this.$emit('input', ev);
|
|
75
|
+
this.$emit('update:modelValue', ev.target.value);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
};
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<style scoped>
|
|
84
|
+
.InputText:not(.InputText-disabled) {
|
|
85
|
+
cursor: text;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
input, textarea {
|
|
89
|
+
-webkit-appearance: none;
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
flex: 1;
|
|
92
|
+
padding: 0;
|
|
93
|
+
border: 0;
|
|
94
|
+
width: 100%;
|
|
95
|
+
min-width: 0;
|
|
96
|
+
outline: 0;
|
|
97
|
+
user-select: text;
|
|
98
|
+
background: transparent;
|
|
99
|
+
color: inherit;
|
|
100
|
+
font: inherit;
|
|
101
|
+
cursor: inherit;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputBase
|
|
3
|
+
class="InputTextarea"
|
|
4
|
+
v-bind="inputBaseProps"
|
|
5
|
+
:fixedHeight="false">
|
|
6
|
+
<slot name="before" />
|
|
7
|
+
<textarea
|
|
8
|
+
ref="input"
|
|
9
|
+
:value="resolvedProps.modelValue"
|
|
10
|
+
:placeholder="resolvedProps.placeholder"
|
|
11
|
+
:readonly="resolvedProps.readonly"
|
|
12
|
+
:disabled="resolvedProps.disabled"
|
|
13
|
+
:rows="resolvedProps.rows"
|
|
14
|
+
resize="none"
|
|
15
|
+
autocomplete="off"
|
|
16
|
+
@input="onInput($event)"
|
|
17
|
+
@focus="$emit('focus', $event)"
|
|
18
|
+
@blur="$emit('blur', $event)" />
|
|
19
|
+
<slot name="after" />
|
|
20
|
+
</InputBase>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import {
|
|
25
|
+
collectProps,
|
|
26
|
+
nightshadeMixin,
|
|
27
|
+
} from '../helpers/props.js';
|
|
28
|
+
import InputBase from './InputBase.vue';
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
|
|
32
|
+
components: {
|
|
33
|
+
InputBase,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
mixins: [nightshadeMixin],
|
|
37
|
+
|
|
38
|
+
props: {
|
|
39
|
+
...InputBase.props,
|
|
40
|
+
tagName: { type: String, default: 'label' },
|
|
41
|
+
modelValue: { type: String },
|
|
42
|
+
placeholder: { type: String },
|
|
43
|
+
rows: { type: Number },
|
|
44
|
+
autoSize: { type: Boolean, default: true },
|
|
45
|
+
autoFocus: { type: Boolean },
|
|
46
|
+
readonly: { type: Boolean },
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
emits: [
|
|
50
|
+
'focus',
|
|
51
|
+
'blur',
|
|
52
|
+
'input',
|
|
53
|
+
'update:modelValue'
|
|
54
|
+
],
|
|
55
|
+
|
|
56
|
+
computed: {
|
|
57
|
+
inputBaseProps() {
|
|
58
|
+
return collectProps(this, InputBase);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
watch: {
|
|
63
|
+
|
|
64
|
+
modelValue: {
|
|
65
|
+
handler() {
|
|
66
|
+
const textarea = this.$refs.input;
|
|
67
|
+
if (this.resolvedProps.autoSize && textarea) {
|
|
68
|
+
textarea.style.height = 'auto';
|
|
69
|
+
textarea.style.height = textarea.scrollHeight + 'px';
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
mounted() {
|
|
77
|
+
this.$nextTick(() => {
|
|
78
|
+
const textarea = this.$refs.input;
|
|
79
|
+
if (this.resolvedProps.autoFocus) {
|
|
80
|
+
textarea.focus();
|
|
81
|
+
}
|
|
82
|
+
if (this.resolvedProps.autoSize) {
|
|
83
|
+
textarea.style.height = textarea.scrollHeight + 'px';
|
|
84
|
+
textarea.style.overflowY = 'hidden';
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
methods: {
|
|
90
|
+
|
|
91
|
+
onInput(ev) {
|
|
92
|
+
this.$emit('input', ev);
|
|
93
|
+
this.$emit('update:modelValue', ev.target.value);
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<style scoped>
|
|
102
|
+
.InputTextarea:not(.InputTextarea-disabled) {
|
|
103
|
+
cursor: text;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
input, textarea {
|
|
107
|
+
-webkit-appearance: none;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
flex: 1;
|
|
110
|
+
padding: 0;
|
|
111
|
+
border: 0;
|
|
112
|
+
width: 100%;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
outline: 0;
|
|
115
|
+
user-select: text;
|
|
116
|
+
background: transparent;
|
|
117
|
+
color: inherit;
|
|
118
|
+
font: inherit;
|
|
119
|
+
cursor: inherit;
|
|
120
|
+
resize: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.InputBase:deep(.Container) {
|
|
124
|
+
overflow-y: auto;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
textarea {
|
|
128
|
+
align-self: flex-start;
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<teleport to="#overlays">
|
|
3
|
+
<div
|
|
4
|
+
class="ModalOverlay"
|
|
5
|
+
:class="{
|
|
6
|
+
'ModalOverlay-enabled': resolvedProps.overlayEnabled,
|
|
7
|
+
'ModalOverlay-shown': resolvedProps.overlayShown,
|
|
8
|
+
}"
|
|
9
|
+
@click.stop="hide">
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</teleport>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { nightshadeMixin } from '../helpers/props.js';
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
|
|
20
|
+
mixins: [nightshadeMixin],
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
overlayEnabled: { type: Boolean, default: true },
|
|
24
|
+
overlayShown: { type: Boolean, default: true },
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
emits: ['hide'],
|
|
28
|
+
|
|
29
|
+
mounted() {
|
|
30
|
+
window.addEventListener('keydown', this.onKeyDown);
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
beforeUnmount() {
|
|
34
|
+
window.removeEventListener('keydown', this.onKeyDown);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
methods: {
|
|
38
|
+
|
|
39
|
+
hide() {
|
|
40
|
+
this.$emit('hide');
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
onKeyDown(ev) {
|
|
44
|
+
if (ev.key === 'Escape') {
|
|
45
|
+
ev.preventDefault();
|
|
46
|
+
this.hide();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.ModalOverlay {
|
|
57
|
+
--ModalOverlay-background: var(--surface-overlay);
|
|
58
|
+
|
|
59
|
+
position: fixed;
|
|
60
|
+
z-index: 2000;
|
|
61
|
+
inset: 0;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ModalOverlay-enabled {
|
|
66
|
+
pointer-events: auto;
|
|
67
|
+
overscroll-behavior: none;
|
|
68
|
+
overflow: auto;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ModalOverlay-shown {
|
|
72
|
+
background: var(--ModalOverlay-background);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<RouterLink
|
|
3
|
+
v-slot="{ href, navigate, isActive, isExactActive }"
|
|
4
|
+
:to="resolvedProps.to"
|
|
5
|
+
custom>
|
|
6
|
+
<Btn
|
|
7
|
+
tagName="a"
|
|
8
|
+
:href="href"
|
|
9
|
+
v-bind="actualProps(isActive, isExactActive)"
|
|
10
|
+
@click="navigate" />
|
|
11
|
+
</RouterLink>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import {
|
|
16
|
+
collectProps,
|
|
17
|
+
nightshadeMixin,
|
|
18
|
+
} from '../helpers/props.js';
|
|
19
|
+
import Btn from './Btn.vue';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
|
|
23
|
+
components: {
|
|
24
|
+
Btn,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
mixins: [nightshadeMixin],
|
|
28
|
+
|
|
29
|
+
props: {
|
|
30
|
+
...Btn.props,
|
|
31
|
+
to: { required: true },
|
|
32
|
+
baseProps: { type: Object },
|
|
33
|
+
activeProps: { type: Object },
|
|
34
|
+
exactActiveProps: { type: Object },
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
methods: {
|
|
38
|
+
|
|
39
|
+
actualProps(isActive, isExactActive) {
|
|
40
|
+
const btnProps = collectProps(this, Btn);
|
|
41
|
+
return {
|
|
42
|
+
...btnProps,
|
|
43
|
+
...this.resolvedProps.baseProps,
|
|
44
|
+
...(isActive ? this.resolvedProps.activeProps : {}),
|
|
45
|
+
...(isExactActive ? this.resolvedProps.exactActiveProps : {}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
};
|
|
52
|
+
</script>
|