@nightshadeui/core 2.0.0-dev.3 → 2.0.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/package.json +1 -2
- package/src/Btn.vue +0 -342
- package/src/HGroup.vue +0 -78
- package/src/InputBase.vue +0 -278
- package/src/InputGroup.vue +0 -36
- package/src/InputSelect.vue +0 -154
- package/src/InputText.vue +0 -87
- package/src/InputTextarea.vue +0 -114
- package/src/Sizer.vue +0 -16
- package/src/Tab.vue +0 -113
- package/src/TabCap.vue +0 -42
- package/src/Toggle.vue +0 -228
- package/src/VGroup.vue +0 -72
- package/src/index.ts +0 -27
- package/src/types.d.ts +0 -6
package/src/InputGroup.vue
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="tagName"
|
|
4
|
-
class="InputGroup">
|
|
5
|
-
<slot />
|
|
6
|
-
</component>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
export default {
|
|
11
|
-
|
|
12
|
-
props: {
|
|
13
|
-
tagName: { type: String, default: 'div' },
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<style scoped>
|
|
20
|
-
.InputGroup {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-flow: row nowrap;
|
|
23
|
-
align-items: end;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.InputGroup:deep(> .InputElement:not(:first-child)) {
|
|
27
|
-
border-start-start-radius: 0;
|
|
28
|
-
border-end-start-radius: 0;
|
|
29
|
-
margin-left: calc(-1 * var(--input-border-size));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.InputGroup:deep(> .InputElement:not(:last-child)) {
|
|
33
|
-
border-start-end-radius: 0;
|
|
34
|
-
border-end-end-radius: 0;
|
|
35
|
-
}
|
|
36
|
-
</style>
|
package/src/InputSelect.vue
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<InputBase
|
|
3
|
-
class="InputSelect"
|
|
4
|
-
v-bind="{
|
|
5
|
-
...$props
|
|
6
|
-
}"
|
|
7
|
-
tabindex="0"
|
|
8
|
-
@click="show()">
|
|
9
|
-
<slot name="before" />
|
|
10
|
-
<i
|
|
11
|
-
v-if="itemIcon"
|
|
12
|
-
class="Icon"
|
|
13
|
-
:class="itemIcon" />
|
|
14
|
-
<span
|
|
15
|
-
v-if="selectedItem"
|
|
16
|
-
class="Value">
|
|
17
|
-
{{ itemTitle }}
|
|
18
|
-
</span>
|
|
19
|
-
<span
|
|
20
|
-
v-if="!selectedItem"
|
|
21
|
-
class="Placeholder">
|
|
22
|
-
{{ placeholder }}
|
|
23
|
-
</span>
|
|
24
|
-
<div
|
|
25
|
-
ref="icon"
|
|
26
|
-
class="DropdownIcon">
|
|
27
|
-
<slot name="iconDropdown">
|
|
28
|
-
<i :class="iconDropdown" />
|
|
29
|
-
</slot>
|
|
30
|
-
</div>
|
|
31
|
-
<ContextMenu
|
|
32
|
-
v-if="!disabled && menuShown"
|
|
33
|
-
anchorRef="icon"
|
|
34
|
-
:items="getMenuItems()"
|
|
35
|
-
:search="search"
|
|
36
|
-
:overlayShown="false"
|
|
37
|
-
@hide="menuShown = false" />
|
|
38
|
-
<slot name="after" />
|
|
39
|
-
</InputBase>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script>
|
|
43
|
-
import InputBase from './InputBase.vue';
|
|
44
|
-
|
|
45
|
-
export default {
|
|
46
|
-
|
|
47
|
-
props: {
|
|
48
|
-
...InputBase.props,
|
|
49
|
-
modelValue: {},
|
|
50
|
-
items: { type: Array, default: () => [] },
|
|
51
|
-
placeholder: { type: String },
|
|
52
|
-
readonly: { type: Boolean },
|
|
53
|
-
search: { type: Boolean, default: false },
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
emits: [
|
|
57
|
-
'focus',
|
|
58
|
-
'blur',
|
|
59
|
-
'update:modelValue'
|
|
60
|
-
],
|
|
61
|
-
|
|
62
|
-
data() {
|
|
63
|
-
return {
|
|
64
|
-
menuShown: false,
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
computed: {
|
|
69
|
-
|
|
70
|
-
selectedItem() {
|
|
71
|
-
return this.items.find(item => (item.value ?? item) === this.modelValue);
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
itemTitle() {
|
|
75
|
-
const { selectedItem } = this;
|
|
76
|
-
return selectedItem?.title ?? selectedItem;
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
itemIcon() {
|
|
80
|
-
const { selectedItem } = this;
|
|
81
|
-
return selectedItem?.icon;
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
iconDropdown() {
|
|
85
|
-
return this.$nightshadeIcons?.dropdown ?? 'fas fa-angle-down';
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
methods: {
|
|
91
|
-
|
|
92
|
-
onInput(ev) {
|
|
93
|
-
this.$emit('update:modelValue', ev.target.value);
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
selectValue(value) {
|
|
97
|
-
this.$emit('update:modelValue', value);
|
|
98
|
-
this.menuShown = false;
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
getMenuItems() {
|
|
102
|
-
return this.items.map(item => {
|
|
103
|
-
const title = typeof item === 'string' ? item : item.title;
|
|
104
|
-
const value = typeof item === 'string' ? item : item.value;
|
|
105
|
-
return {
|
|
106
|
-
title,
|
|
107
|
-
checked: value === this.modelValue,
|
|
108
|
-
disabled: item.disabled,
|
|
109
|
-
description: item.description,
|
|
110
|
-
icon: item.icon ?? undefined,
|
|
111
|
-
activate: () => {
|
|
112
|
-
if (this.disabled) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
this.selectValue(value);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
show() {
|
|
122
|
-
if (!this.disabled) {
|
|
123
|
-
this.menuShown = true;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
};
|
|
130
|
-
</script>
|
|
131
|
-
|
|
132
|
-
<style scoped>
|
|
133
|
-
.Icon {
|
|
134
|
-
opacity: 0.5;
|
|
135
|
-
width: var(--sp2);
|
|
136
|
-
display: flex;
|
|
137
|
-
align-items: center;
|
|
138
|
-
justify-content: center;
|
|
139
|
-
padding-right: var(--sphalf);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.Value, .Placeholder {
|
|
143
|
-
line-height: var(--input-size);
|
|
144
|
-
flex: 1 1 auto;
|
|
145
|
-
white-space: nowrap;
|
|
146
|
-
text-overflow: ellipsis;
|
|
147
|
-
overflow: hidden;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.DropdownIcon {
|
|
151
|
-
color: var(--color-text-2);
|
|
152
|
-
font-size: var(--font-size-small);
|
|
153
|
-
}
|
|
154
|
-
</style>
|
package/src/InputText.vue
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<InputBase
|
|
3
|
-
class="InputText"
|
|
4
|
-
v-bind="{
|
|
5
|
-
...$props
|
|
6
|
-
}">
|
|
7
|
-
<slot name="before" />
|
|
8
|
-
<input
|
|
9
|
-
ref="input"
|
|
10
|
-
:value="modelValue"
|
|
11
|
-
:type="type"
|
|
12
|
-
:placeholder="placeholder"
|
|
13
|
-
:readonly="readonly"
|
|
14
|
-
:disabled="disabled"
|
|
15
|
-
:min="min"
|
|
16
|
-
:max="max"
|
|
17
|
-
:step="step"
|
|
18
|
-
autocomplete="off"
|
|
19
|
-
@input="onInput($event)"
|
|
20
|
-
@focus="$emit('focus', $event)"
|
|
21
|
-
@blur="$emit('blur', $event)" />
|
|
22
|
-
<slot name="after" />
|
|
23
|
-
</InputBase>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
import InputBase from './InputBase.vue';
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
|
|
31
|
-
props: {
|
|
32
|
-
...InputBase.props,
|
|
33
|
-
modelValue: { type: [String, Number] },
|
|
34
|
-
type: { type: String },
|
|
35
|
-
placeholder: { type: String },
|
|
36
|
-
min: { type: Number },
|
|
37
|
-
max: { type: Number },
|
|
38
|
-
step: { type: Number },
|
|
39
|
-
autoFocus: { type: Boolean },
|
|
40
|
-
readonly: { type: Boolean },
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
emits: [
|
|
44
|
-
'focus',
|
|
45
|
-
'blur',
|
|
46
|
-
'input',
|
|
47
|
-
'update:modelValue'
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
mounted() {
|
|
51
|
-
if (this.autoFocus) {
|
|
52
|
-
this.$refs.input?.focus();
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
methods: {
|
|
57
|
-
|
|
58
|
-
onInput(ev) {
|
|
59
|
-
this.$emit('update:modelValue', ev.target.value);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<style scoped>
|
|
68
|
-
.InputText {
|
|
69
|
-
--InputBase-padding: var(--sp1-5);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
input, textarea {
|
|
73
|
-
-webkit-appearance: none;
|
|
74
|
-
box-sizing: border-box;
|
|
75
|
-
flex: 1;
|
|
76
|
-
padding: 0;
|
|
77
|
-
border: 0;
|
|
78
|
-
width: 100%;
|
|
79
|
-
min-width: 0;
|
|
80
|
-
outline: 0;
|
|
81
|
-
user-select: text;
|
|
82
|
-
background: transparent;
|
|
83
|
-
color: inherit;
|
|
84
|
-
font: inherit;
|
|
85
|
-
cursor: inherit;
|
|
86
|
-
}
|
|
87
|
-
</style>
|
package/src/InputTextarea.vue
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<InputBase
|
|
3
|
-
class="InputTextarea"
|
|
4
|
-
v-bind="{
|
|
5
|
-
...$props
|
|
6
|
-
}"
|
|
7
|
-
:fixedHeight="false">
|
|
8
|
-
<slot name="before" />
|
|
9
|
-
<textarea
|
|
10
|
-
ref="input"
|
|
11
|
-
:value="modelValue"
|
|
12
|
-
:placeholder="placeholder"
|
|
13
|
-
:readonly="readonly"
|
|
14
|
-
:disabled="disabled"
|
|
15
|
-
:rows="rows"
|
|
16
|
-
resize="none"
|
|
17
|
-
autocomplete="off"
|
|
18
|
-
@input="onInput($event)"
|
|
19
|
-
@focus="$emit('focus', $event)"
|
|
20
|
-
@blur="$emit('blur', $event)" />
|
|
21
|
-
<slot name="after" />
|
|
22
|
-
</InputBase>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script>
|
|
26
|
-
import InputBase from './InputBase.vue';
|
|
27
|
-
|
|
28
|
-
export default {
|
|
29
|
-
|
|
30
|
-
props: {
|
|
31
|
-
...InputBase.props,
|
|
32
|
-
modelValue: { type: String },
|
|
33
|
-
placeholder: { type: String },
|
|
34
|
-
rows: { type: Number },
|
|
35
|
-
autoSize: { type: Boolean, default: true },
|
|
36
|
-
autoFocus: { type: Boolean },
|
|
37
|
-
readonly: { type: Boolean },
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
emits: [
|
|
41
|
-
'focus',
|
|
42
|
-
'blur',
|
|
43
|
-
'input',
|
|
44
|
-
'update:modelValue'
|
|
45
|
-
],
|
|
46
|
-
|
|
47
|
-
watch: {
|
|
48
|
-
|
|
49
|
-
modelValue: {
|
|
50
|
-
handler() {
|
|
51
|
-
const textarea = this.$refs.input;
|
|
52
|
-
if (this.autoSize && textarea) {
|
|
53
|
-
textarea.style.height = 'auto';
|
|
54
|
-
textarea.style.height = textarea.scrollHeight + 'px';
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
mounted() {
|
|
62
|
-
this.$nextTick(() => {
|
|
63
|
-
const textarea = this.$refs.input;
|
|
64
|
-
if (this.autoFocus) {
|
|
65
|
-
textarea.focus();
|
|
66
|
-
}
|
|
67
|
-
if (this.autoSize) {
|
|
68
|
-
textarea.style.height = textarea.scrollHeight + 'px';
|
|
69
|
-
textarea.style.overflowY = 'hidden';
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
methods: {
|
|
75
|
-
|
|
76
|
-
onInput(ev) {
|
|
77
|
-
this.$emit('update:modelValue', ev.target.value);
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style scoped>
|
|
86
|
-
.InputTextarea {
|
|
87
|
-
--InputBase-padding: var(--sp1) var(--sp1-5);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
input, textarea {
|
|
91
|
-
-webkit-appearance: none;
|
|
92
|
-
box-sizing: border-box;
|
|
93
|
-
flex: 1;
|
|
94
|
-
padding: 0;
|
|
95
|
-
border: 0;
|
|
96
|
-
width: 100%;
|
|
97
|
-
min-width: 0;
|
|
98
|
-
outline: 0;
|
|
99
|
-
user-select: text;
|
|
100
|
-
background: transparent;
|
|
101
|
-
color: inherit;
|
|
102
|
-
font: inherit;
|
|
103
|
-
cursor: inherit;
|
|
104
|
-
resize: none;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.InputBase:deep(.Container) {
|
|
108
|
-
overflow-y: auto;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
textarea {
|
|
112
|
-
align-self: flex-start;
|
|
113
|
-
}
|
|
114
|
-
</style>
|
package/src/Sizer.vue
DELETED
package/src/Tab.vue
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="Tab"
|
|
4
|
-
:class="[
|
|
5
|
-
`Tab-${dir}`,
|
|
6
|
-
`Tab-${orientation}`,
|
|
7
|
-
]">
|
|
8
|
-
<TabCap
|
|
9
|
-
class="TabCap"
|
|
10
|
-
:dir="dir"
|
|
11
|
-
type="start" />
|
|
12
|
-
<div class="Content">
|
|
13
|
-
<slot>
|
|
14
|
-
<div
|
|
15
|
-
v-if="label"
|
|
16
|
-
class="TabLabel"
|
|
17
|
-
:title="label">
|
|
18
|
-
{{ label }}
|
|
19
|
-
</div>
|
|
20
|
-
</slot>
|
|
21
|
-
</div>
|
|
22
|
-
<TabCap
|
|
23
|
-
class="TabCap"
|
|
24
|
-
:dir="dir"
|
|
25
|
-
type="end" />
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
export default {
|
|
31
|
-
|
|
32
|
-
props: {
|
|
33
|
-
dir: { type: String, default: 'top' },
|
|
34
|
-
label: { type: String },
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
computed: {
|
|
38
|
-
|
|
39
|
-
orientation() {
|
|
40
|
-
return this.dir === 'top' || this.dir === 'bottom' ? 'h' : 'v';
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<style scoped>
|
|
49
|
-
.Tab {
|
|
50
|
-
--Tab-size: var(--sp3);
|
|
51
|
-
--Tab-cap-size: var(--sp4);
|
|
52
|
-
--Tab-surface: var(--color-base-1);
|
|
53
|
-
--Tab-color: var(--color-text-0);
|
|
54
|
-
--Tab-shadow-size: 0.5px;
|
|
55
|
-
--Tab-shadow-color: var(--shadow-color-medium);
|
|
56
|
-
--Tab-shadow-offset-x: 0;
|
|
57
|
-
--Tab-shadow-offset-y: 0;
|
|
58
|
-
|
|
59
|
-
display: flex;
|
|
60
|
-
cursor: pointer;
|
|
61
|
-
position: relative;
|
|
62
|
-
filter: drop-shadow(var(--Tab-shadow-offset-x) var(--Tab-shadow-offset-y) var(--Tab-shadow-size) var(--Tab-shadow-color));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.TabCap, .Content {
|
|
66
|
-
position: relative;
|
|
67
|
-
z-index: 2;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.Content {
|
|
71
|
-
min-width: 0;
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
background: var(--Tab-surface);
|
|
75
|
-
color: var(--Tab-color);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.TabLabel {
|
|
79
|
-
white-space: nowrap;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
text-overflow: ellipsis;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.Tab-h {
|
|
85
|
-
flex-flow: row;
|
|
86
|
-
height: var(--Tab-size);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.Tab-v {
|
|
90
|
-
flex-flow: column;
|
|
91
|
-
width: var(--Tab-size);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.Tab-v .Content {
|
|
95
|
-
writing-mode: vertical-lr;
|
|
96
|
-
text-orientation: sideways-right;
|
|
97
|
-
transform: rotate(180deg);
|
|
98
|
-
transform-origin: 50% 50%;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.TabCap {
|
|
102
|
-
flex: 0 0 var(--Tab-cap-size);
|
|
103
|
-
fill: var(--Tab-surface);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.Tab-h .TabCap {
|
|
107
|
-
width: var(--Tab-cap-size);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.Tab-v .TabCap {
|
|
111
|
-
height: var(--Tab-cap-size);
|
|
112
|
-
}
|
|
113
|
-
</style>
|
package/src/TabCap.vue
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
3
|
-
class="TabCap"
|
|
4
|
-
:class="[
|
|
5
|
-
`TabCap-${dir}`,
|
|
6
|
-
`TabCap-${type}`,
|
|
7
|
-
]"
|
|
8
|
-
viewBox="0 0 32 32"
|
|
9
|
-
preserveAspectRatio="none">
|
|
10
|
-
<path d="M0 32 C 16 32 16 0 32 0 L 32 32 z" />
|
|
11
|
-
</svg>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
|
|
17
|
-
props: {
|
|
18
|
-
dir: { type: String, default: 'top' },
|
|
19
|
-
type: { type: String, default: 'start' },
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<style scoped>
|
|
26
|
-
.TabCap {}
|
|
27
|
-
|
|
28
|
-
path {
|
|
29
|
-
transform-origin: 50% 50%;
|
|
30
|
-
stroke: none;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.TabCap-top.TabCap-start path { transform: scale(1, 1) }
|
|
34
|
-
.TabCap-top.TabCap-end path { transform: scale(-1, 1) }
|
|
35
|
-
.TabCap-bottom.TabCap-start path { transform: scale(1, -1) }
|
|
36
|
-
.TabCap-bottom.TabCap-end path { transform: scale(-1, -1) }
|
|
37
|
-
|
|
38
|
-
.TabCap-right.TabCap-start path { transform: scale(1, 1) rotate(90deg) }
|
|
39
|
-
.TabCap-right.TabCap-end path { transform: scale(-1, 1) rotate(-90deg) }
|
|
40
|
-
.TabCap-left.TabCap-start path { transform: scale(1, -1) rotate(-90deg) }
|
|
41
|
-
.TabCap-left.TabCap-end path { transform: scale(-1, -1) rotate(90deg) }
|
|
42
|
-
</style>
|