@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,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ModalOverlay
|
|
3
|
+
:overlayEnabled="resolvedProps.overlayEnabled"
|
|
4
|
+
:overlayShown="resolvedProps.overlayShown"
|
|
5
|
+
@hide="hide">
|
|
6
|
+
<Bubble
|
|
7
|
+
v-if="ready"
|
|
8
|
+
:dir="actualDir"
|
|
9
|
+
:align="actualAlign"
|
|
10
|
+
:style="bubbleStyle"
|
|
11
|
+
:arrowShown="resolvedProps.arrowShown"
|
|
12
|
+
@mouseenter="$emit('mouseenter')"
|
|
13
|
+
@mouseleave="$emit('mouseleave')"
|
|
14
|
+
@click.stop="">
|
|
15
|
+
<slot />
|
|
16
|
+
</Bubble>
|
|
17
|
+
</ModalOverlay>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { nightshadeMixin } from '../helpers/props.js';
|
|
22
|
+
import ModalOverlay from './ModalOverlay.vue';
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
|
|
26
|
+
components: {
|
|
27
|
+
ModalOverlay,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
mixins: [nightshadeMixin],
|
|
31
|
+
|
|
32
|
+
props: {
|
|
33
|
+
dir: { type: String, default: 'v' },
|
|
34
|
+
align: { type: String, default: 'auto' },
|
|
35
|
+
anchorRef: { type: String },
|
|
36
|
+
anchorDir: { type: String, default: 'middle' },
|
|
37
|
+
overlayEnabled: { type: Boolean, default: true },
|
|
38
|
+
overlayShown: { type: Boolean, default: true },
|
|
39
|
+
arrowShown: { type: Boolean, default: true },
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
emits: ['hide', 'mouseenter', 'mouseleave', 'ready'],
|
|
43
|
+
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
pos: { x: 0, y: 0 },
|
|
47
|
+
actualDir: 'bottom',
|
|
48
|
+
actualAlign: 'start',
|
|
49
|
+
ready: false,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
computed: {
|
|
54
|
+
|
|
55
|
+
bubbleStyle() {
|
|
56
|
+
const { x, y } = this.pos;
|
|
57
|
+
return {
|
|
58
|
+
left: `${x}px`,
|
|
59
|
+
top: `${y}px`,
|
|
60
|
+
'pointer-events': 'auto',
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
mounted() {
|
|
67
|
+
this.$nextTick(() => this.calcPos());
|
|
68
|
+
window.addEventListener('resize', this.onResize);
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
beforeUnmount() {
|
|
72
|
+
window.removeEventListener('resize', this.onResize);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
methods: {
|
|
76
|
+
|
|
77
|
+
hide() {
|
|
78
|
+
this.$emit('hide');
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
calcPos() {
|
|
82
|
+
const anchorEl = this.getAnchorEl();
|
|
83
|
+
if (!anchorEl) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.pos = this.getAnchorPoint(anchorEl, this.resolvedProps.anchorDir);
|
|
87
|
+
this.calcDirAlign();
|
|
88
|
+
this.ready = true;
|
|
89
|
+
this.$nextTick(() => this.$emit('ready'));
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
calcDirAlign() {
|
|
93
|
+
const atTop = this.pos.y < window.innerHeight * 0.5;
|
|
94
|
+
const atLeft = this.pos.x < window.innerWidth * 0.5;
|
|
95
|
+
const { align, dir } = this.resolvedProps;
|
|
96
|
+
if (align === 'auto') {
|
|
97
|
+
const verticalDir = ['top', 'bottom', 'v'].includes(dir);
|
|
98
|
+
if (verticalDir) {
|
|
99
|
+
this.actualAlign = atLeft ? 'start' : 'end';
|
|
100
|
+
} else {
|
|
101
|
+
this.actualAlign = atTop ? 'start' : 'end';
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
this.actualAlign = align;
|
|
105
|
+
}
|
|
106
|
+
if (dir === 'v') {
|
|
107
|
+
this.actualDir = atTop ? 'bottom' : 'top';
|
|
108
|
+
} else if (dir === 'h') {
|
|
109
|
+
this.actualDir = atLeft ? 'right' : 'left';
|
|
110
|
+
} else {
|
|
111
|
+
this.actualDir = dir;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
getAnchorEl() {
|
|
116
|
+
if (this.resolvedProps.anchorRef) {
|
|
117
|
+
const ref = this.findRef(this.$parent, this.resolvedProps.anchorRef);
|
|
118
|
+
if (ref) {
|
|
119
|
+
return ref;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return this.$el.parentElement;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
findRef(component, refKey) {
|
|
126
|
+
if (!component) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const ref = component.$refs[refKey];
|
|
130
|
+
if (ref) {
|
|
131
|
+
const el = ref.$el ?? ref;
|
|
132
|
+
if (el instanceof HTMLElement) {
|
|
133
|
+
return el;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (component.$parent) {
|
|
137
|
+
return this.findRef(component.$parent, refKey);
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
getAnchorPoint(el, dir) {
|
|
143
|
+
const { top, left, width, height } = el.getBoundingClientRect();
|
|
144
|
+
switch (dir) {
|
|
145
|
+
case 'left':
|
|
146
|
+
return { x: left, y: top + height * 0.5 };
|
|
147
|
+
case 'right':
|
|
148
|
+
return { x: left + width, y: top + height * 0.5 };
|
|
149
|
+
case 'top':
|
|
150
|
+
return { x: left + width * 0.5, y: top };
|
|
151
|
+
case 'bottom':
|
|
152
|
+
return { x: left + width * 0.5, y: top + height };
|
|
153
|
+
case 'middle':
|
|
154
|
+
default:
|
|
155
|
+
return { x: left + width * 0.5, y: top + height * 0.5 };
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
onResize() {
|
|
160
|
+
this.calcPos();
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
};
|
|
166
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="Filler"
|
|
4
|
+
:class="[
|
|
5
|
+
`Filler-${resolvedProps.fill}`,
|
|
6
|
+
]" />
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { nightshadeMixin } from '../helpers/props.js';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
|
|
14
|
+
mixins: [nightshadeMixin],
|
|
15
|
+
|
|
16
|
+
props: {
|
|
17
|
+
fill: { type: String, default: 'none' },
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.Filler {
|
|
25
|
+
--Filler-border: var(--border-base);
|
|
26
|
+
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-width: 0;
|
|
29
|
+
min-height: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.Filler-dotted {
|
|
33
|
+
border-bottom: 2px dotted var(--Filler-border);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.Filler-dashed {
|
|
37
|
+
border-bottom: 2px dashed var(--Filler-border);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.Filler-solid {
|
|
41
|
+
border-bottom: 2px solid var(--Filler-border);
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="resolvedProps.tagName"
|
|
4
|
+
class="HGroup"
|
|
5
|
+
:class="[
|
|
6
|
+
`HGroup-align-${resolvedProps.align}`,
|
|
7
|
+
`HGroup-justify-${resolvedProps.justify}`,
|
|
8
|
+
`HGroup-gap-${resolvedProps.gap}`,
|
|
9
|
+
{
|
|
10
|
+
'HGroup-wrap': resolvedProps.wrap,
|
|
11
|
+
}
|
|
12
|
+
]">
|
|
13
|
+
<slot />
|
|
14
|
+
</component>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { nightshadeMixin } from '../helpers/props.js';
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
|
|
22
|
+
mixins: [nightshadeMixin],
|
|
23
|
+
|
|
24
|
+
props: {
|
|
25
|
+
tagName: { type: String, default: 'div' },
|
|
26
|
+
align: { type: String, default: 'center' },
|
|
27
|
+
justify: { type: String },
|
|
28
|
+
gap: { type: String, default: '1' },
|
|
29
|
+
wrap: { type: Boolean, default: false },
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
};
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style scoped>
|
|
36
|
+
.HGroup {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-flow: row nowrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.HGroup-align-stretch { align-items: stretch; }
|
|
42
|
+
.HGroup-align-baseline { align-items: baseline; }
|
|
43
|
+
.HGroup-align-center { align-items: center; }
|
|
44
|
+
.HGroup-align-start { align-items: flex-start; }
|
|
45
|
+
.HGroup-align-end { align-items: flex-end; }
|
|
46
|
+
|
|
47
|
+
.HGroup-justify-center { justify-content: center; }
|
|
48
|
+
.HGroup-justify-start { justify-content: flex-start; }
|
|
49
|
+
.HGroup-justify-end { justify-content: flex-end; }
|
|
50
|
+
.HGroup-justify-space-around { justify-content: space-around; }
|
|
51
|
+
.HGroup-justify-space-between { justify-content: space-between; }
|
|
52
|
+
|
|
53
|
+
.HGroup-gap-0 { gap: 0 }
|
|
54
|
+
.HGroup-gap-0-25 { gap: var(--sp0-25) }
|
|
55
|
+
.HGroup-gap-0-5 { gap: var(--sp0-5) }
|
|
56
|
+
.HGroup-gap-1 { gap: var(--sp1) }
|
|
57
|
+
.HGroup-gap-1-5 { gap: var(--sp1-5) }
|
|
58
|
+
.HGroup-gap-2 { gap: var(--sp2) }
|
|
59
|
+
.HGroup-gap-2-5 { gap: var(--sp2-5) }
|
|
60
|
+
.HGroup-gap-3 { gap: var(--sp3) }
|
|
61
|
+
.HGroup-gap-4 { gap: var(--sp4) }
|
|
62
|
+
.HGroup-gap-5 { gap: var(--sp5) }
|
|
63
|
+
.HGroup-gap-6 { gap: var(--sp6) }
|
|
64
|
+
.HGroup-gap-7 { gap: var(--sp7) }
|
|
65
|
+
.HGroup-gap-8 { gap: var(--sp8) }
|
|
66
|
+
.HGroup-gap-9 { gap: var(--sp9) }
|
|
67
|
+
.HGroup-gap-10 { gap: var(--sp10) }
|
|
68
|
+
.HGroup-gap-12 { gap: var(--sp12) }
|
|
69
|
+
.HGroup-gap-16 { gap: var(--sp16) }
|
|
70
|
+
.HGroup-gap-24 { gap: var(--sp24) }
|
|
71
|
+
.HGroup-gap-32 { gap: var(--sp32) }
|
|
72
|
+
|
|
73
|
+
.HGroup-wrap { flex-wrap: wrap; }
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="resolvedProps.tagName"
|
|
4
|
+
class="InputBase"
|
|
5
|
+
:class="[
|
|
6
|
+
effectiveStyle.tone && `tone-${effectiveStyle.tone}`,
|
|
7
|
+
effectiveStyle.size && `input-size-${effectiveStyle.size}`,
|
|
8
|
+
{
|
|
9
|
+
'InputBase-fixedHeight': resolvedProps.fixedHeight,
|
|
10
|
+
'InputBase-flat': effectiveStyle.flat,
|
|
11
|
+
'InputBase-round': effectiveStyle.round,
|
|
12
|
+
'InputBase-disabled': resolvedProps.disabled,
|
|
13
|
+
'InputBase-forceFocus': resolvedProps.forceFocus,
|
|
14
|
+
'InputBase-forceHover': resolvedProps.forceHover,
|
|
15
|
+
}
|
|
16
|
+
]"
|
|
17
|
+
@mouseenter="hover = true"
|
|
18
|
+
@mouseleave="hover = false"
|
|
19
|
+
@focusin="focus = true"
|
|
20
|
+
@focusout="focus = false">
|
|
21
|
+
<template v-if="resolvedProps.label">
|
|
22
|
+
<Tab
|
|
23
|
+
v-if="resolvedProps.labelStyle === 'tab'"
|
|
24
|
+
class="Label TabLabel"
|
|
25
|
+
:label="resolvedProps.label"
|
|
26
|
+
:tone="effectiveStyle.tone" />
|
|
27
|
+
<div
|
|
28
|
+
v-if="resolvedProps.labelStyle === 'text'"
|
|
29
|
+
class="Label TextLabel">
|
|
30
|
+
{{ resolvedProps.label }}
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
v-if="resolvedProps.labelStyle === 'inline'"
|
|
34
|
+
class="Label InlineLabel">
|
|
35
|
+
{{ resolvedProps.label }}
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<div class="InputElement Container">
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</component>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import {
|
|
46
|
+
nightshadeMixin,
|
|
47
|
+
} from '../helpers/props.js';
|
|
48
|
+
import Tab from './Tab.vue';
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
|
|
52
|
+
components: {
|
|
53
|
+
Tab,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
mixins: [nightshadeMixin],
|
|
57
|
+
|
|
58
|
+
props: {
|
|
59
|
+
tagName: { default: 'label' },
|
|
60
|
+
tone: { type: String },
|
|
61
|
+
label: { type: String },
|
|
62
|
+
labelStyle: { type: String, default: 'inline' },
|
|
63
|
+
|
|
64
|
+
size: { type: String },
|
|
65
|
+
fixedHeight: { type: Boolean, default: true },
|
|
66
|
+
flat: { type: Boolean, default: false },
|
|
67
|
+
round: { type: Boolean, default: false },
|
|
68
|
+
outline: { type: Boolean, default: false },
|
|
69
|
+
|
|
70
|
+
disabled: { type: Boolean, default: false },
|
|
71
|
+
forceFocus: { type: Boolean, default: false },
|
|
72
|
+
forceHover: { type: Boolean, default: false },
|
|
73
|
+
|
|
74
|
+
hoverOverrides: { type: Object },
|
|
75
|
+
focusOverrides: { type: Object },
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
data() {
|
|
79
|
+
return {
|
|
80
|
+
hover: false,
|
|
81
|
+
focus: false,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
computed: {
|
|
86
|
+
|
|
87
|
+
baseStyle() {
|
|
88
|
+
const { resolvedProps } = this;
|
|
89
|
+
return {
|
|
90
|
+
tone: resolvedProps.tone,
|
|
91
|
+
size: resolvedProps.size,
|
|
92
|
+
flat: resolvedProps.flat,
|
|
93
|
+
round: resolvedProps.round,
|
|
94
|
+
outline: resolvedProps.outline,
|
|
95
|
+
labelStyle: resolvedProps.labelStyle,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
effectiveStyle() {
|
|
100
|
+
const {
|
|
101
|
+
baseStyle,
|
|
102
|
+
hoverOverrides = {},
|
|
103
|
+
focusOverrides = {},
|
|
104
|
+
hover,
|
|
105
|
+
focus,
|
|
106
|
+
resolvedProps,
|
|
107
|
+
} = this;
|
|
108
|
+
const { forceHover, forceFocus } = resolvedProps;
|
|
109
|
+
const style = Object.assign({}, baseStyle);
|
|
110
|
+
if (hover || forceHover) {
|
|
111
|
+
Object.assign(style, hoverOverrides);
|
|
112
|
+
}
|
|
113
|
+
if (focus || forceFocus) {
|
|
114
|
+
Object.assign(style, focusOverrides);
|
|
115
|
+
}
|
|
116
|
+
return style;
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
};
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style scoped>
|
|
124
|
+
.InputBase {
|
|
125
|
+
--InputBase-size: var(--input-major-height);
|
|
126
|
+
--InputBase-padding-x: var(--input-major-padding);
|
|
127
|
+
--InputBase-padding-y: var(--input-minor-padding);
|
|
128
|
+
--InputBase-gap: var(--input-gap);
|
|
129
|
+
--InputBase-font-size: var(--input-font-size);
|
|
130
|
+
|
|
131
|
+
--InputBase-text: var(--text-base);
|
|
132
|
+
--InputBase-background: var(--surface-base);
|
|
133
|
+
|
|
134
|
+
--InputBase-outline: transparent;
|
|
135
|
+
--InputBase-outline-size: var(--input-outline-size);
|
|
136
|
+
--InputBase-outline-offset: var(--input-outline-offset);
|
|
137
|
+
|
|
138
|
+
--InputBase-border-size: var(--input-border-size);
|
|
139
|
+
--InputBase-border: var(--tone-border);
|
|
140
|
+
--InputBase-radius: var(--radius-m);
|
|
141
|
+
|
|
142
|
+
--InputBase-shadow: var(--shadow-light);
|
|
143
|
+
--InputBase-box-shadow: 0 1px 5px -1px var(--InputBase-shadow) inset;
|
|
144
|
+
|
|
145
|
+
--InputBase-label-text: var(--text-base);
|
|
146
|
+
--InputBase-label-font-size: var(--font-size-s);
|
|
147
|
+
|
|
148
|
+
position: relative;
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-flow: column nowrap;
|
|
151
|
+
outline: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.Container {
|
|
155
|
+
position: relative;
|
|
156
|
+
z-index: 1;
|
|
157
|
+
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
padding:
|
|
162
|
+
calc(var(--InputBase-padding-y) - var(--InputBase-border-size))
|
|
163
|
+
calc(var(--InputBase-padding-x) - var(--InputBase-border-size));
|
|
164
|
+
gap: var(--InputBase-gap);
|
|
165
|
+
width: 100%;
|
|
166
|
+
min-height: var(--InputBase-size);
|
|
167
|
+
|
|
168
|
+
color: var(--InputBase-text);
|
|
169
|
+
background: var(--InputBase-background);
|
|
170
|
+
box-shadow: var(--InputBase-box-shadow);
|
|
171
|
+
|
|
172
|
+
outline: var(--InputBase-outline-size) solid var(--InputBase-outline);
|
|
173
|
+
outline-offset: var(--InputBase-outline-offset);
|
|
174
|
+
|
|
175
|
+
border: var(--InputBase-border-size) solid var(--InputBase-border);
|
|
176
|
+
border-radius: var(--InputBase-radius);
|
|
177
|
+
|
|
178
|
+
font-size: var(--InputBase-font-size);
|
|
179
|
+
|
|
180
|
+
transition: color .3s, outline .3s, border-radius .3s, filter .3s;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* States */
|
|
184
|
+
|
|
185
|
+
.InputBase:not(.InputBase-disabled):focus-within, .InputBase.InputBase-forceFocus {
|
|
186
|
+
z-index: 10;
|
|
187
|
+
--InputBase-outline: var(--tone-focus-outline);
|
|
188
|
+
--InputBase-border: var(--tone-focus-border);
|
|
189
|
+
--InputBase-label-text: var(--tone-focus-border);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.InputBase-disabled {
|
|
193
|
+
--InputBase-background: var(--surface-deep);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.InputBase-disabled .Container {
|
|
197
|
+
opacity: var(--input-disabled-opacity);
|
|
198
|
+
filter: var(--input-disabled-filter);
|
|
199
|
+
cursor: not-allowed;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Styles */
|
|
203
|
+
|
|
204
|
+
.InputBase-fixedHeight .Container {
|
|
205
|
+
height: var(--InputBase-size);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.InputBase-round {
|
|
209
|
+
--InputBase-radius: calc(.5 * var(--InputBase-size));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.InputBase-flat {
|
|
213
|
+
--InputBase-box-shadow: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Labels */
|
|
217
|
+
|
|
218
|
+
.Label {
|
|
219
|
+
max-width: calc(100% - 2 * var(--sp2));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.Label.TabLabel {
|
|
223
|
+
align-self: flex-start;
|
|
224
|
+
position: relative;
|
|
225
|
+
z-index: 0;
|
|
226
|
+
margin: 0 var(--sp2);
|
|
227
|
+
|
|
228
|
+
--Tab-size: calc(.75 * var(--InputBase-size));
|
|
229
|
+
--Tab-cap-size: calc(.75 * var(--InputBase-size));
|
|
230
|
+
--Tab-font-size: var(--InputBase-font-size);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.Label.TextLabel {
|
|
234
|
+
margin: 0 var(--InputBase-padding-x);
|
|
235
|
+
height: var(--sp3);
|
|
236
|
+
line-height: 1.5;
|
|
237
|
+
font-size: var(--InputBase-label-font-size);
|
|
238
|
+
|
|
239
|
+
color: var(--InputBase-text);
|
|
240
|
+
|
|
241
|
+
white-space: nowrap;
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
text-overflow: ellipsis;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.Label.InlineLabel {
|
|
247
|
+
position: absolute;
|
|
248
|
+
z-index: 2;
|
|
249
|
+
top: -2px;
|
|
250
|
+
left: -2px;
|
|
251
|
+
margin: 0 var(--InputBase-padding-x);
|
|
252
|
+
padding: 0 2px;
|
|
253
|
+
transform: translateY(-50%);
|
|
254
|
+
height: var(--sp2);
|
|
255
|
+
line-height: var(--sp2);
|
|
256
|
+
|
|
257
|
+
font-size: var(--InputBase-label-font-size);
|
|
258
|
+
border-radius: var(--radius-m);
|
|
259
|
+
|
|
260
|
+
color: var(--InputBase-label-text);
|
|
261
|
+
text-shadow:
|
|
262
|
+
0 0 3px var(--InputBase-background),
|
|
263
|
+
0 0 3px var(--InputBase-background),
|
|
264
|
+
0 0 3px var(--InputBase-background),
|
|
265
|
+
0 0 3px var(--InputBase-background),
|
|
266
|
+
0 0 3px var(--InputBase-background),
|
|
267
|
+
0 0 3px var(--InputBase-background),
|
|
268
|
+
0 0 3px var(--InputBase-background),
|
|
269
|
+
0 0 3px var(--InputBase-background),
|
|
270
|
+
0 0 3px var(--InputBase-background),
|
|
271
|
+
0 0 3px var(--InputBase-background);
|
|
272
|
+
|
|
273
|
+
user-select: none;
|
|
274
|
+
white-space: nowrap;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
text-overflow: ellipsis;
|
|
277
|
+
}
|
|
278
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="resolvedProps.tagName"
|
|
4
|
+
class="InputGroup">
|
|
5
|
+
<slot />
|
|
6
|
+
</component>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { nightshadeMixin } from '../helpers/props.js';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
|
|
14
|
+
mixins: [nightshadeMixin],
|
|
15
|
+
|
|
16
|
+
props: {
|
|
17
|
+
tagName: { type: String, default: 'div' },
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.InputGroup {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-flow: row nowrap;
|
|
27
|
+
align-items: end;
|
|
28
|
+
gap: var(--input-border-size);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Joined edges: a control's own frame, or the frame inside a wrapper (`InputText` frames its field in `.InputBase`) */
|
|
32
|
+
.InputGroup:deep(> .InputElement:not(:first-child)),
|
|
33
|
+
.InputGroup:deep(> :not(:first-child) > .InputElement) {
|
|
34
|
+
border-start-start-radius: 0;
|
|
35
|
+
border-end-start-radius: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.InputGroup:deep(> .InputElement:not(:last-child)),
|
|
39
|
+
.InputGroup:deep(> :not(:last-child) > .InputElement) {
|
|
40
|
+
border-start-end-radius: 0;
|
|
41
|
+
border-end-end-radius: 0;
|
|
42
|
+
}
|
|
43
|
+
</style>
|