@itfin/components 1.0.67 → 1.0.72
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<a :href="href" class="itf-tab" :data-test="`itf-tab-${id || _uid}`" @click="setActive" :class="{ active }">
|
|
3
3
|
<span><slot /></span>
|
|
4
|
-
</
|
|
4
|
+
</a>
|
|
5
5
|
</template>
|
|
6
6
|
<style lang="scss" scoped>
|
|
7
7
|
.itf-tab {
|
|
@@ -21,6 +21,14 @@ class itfTab extends Vue {
|
|
|
21
21
|
@Prop() id;
|
|
22
22
|
@Prop() to;
|
|
23
23
|
|
|
24
|
+
get href() {
|
|
25
|
+
if (this.to) {
|
|
26
|
+
const route = this.$router.resolve(this.to);
|
|
27
|
+
return route && route.href;
|
|
28
|
+
}
|
|
29
|
+
return 'javascript:;';
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
get active() {
|
|
25
33
|
if (this.to) {
|
|
26
34
|
const route = this.$router.resolve(this.to);
|
|
@@ -29,11 +37,12 @@ class itfTab extends Vue {
|
|
|
29
37
|
return this.tabsManager && this.tabsManager.getValue() === this.id;
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
setActive() {
|
|
40
|
+
setActive(e) {
|
|
33
41
|
if (this.to) {
|
|
34
42
|
this.$router.push(this.to);
|
|
43
|
+
e.preventDefault();
|
|
35
44
|
}
|
|
36
|
-
this.tabsManager.setValue(id);
|
|
45
|
+
this.tabsManager.setValue(this.id || this._uid);
|
|
37
46
|
}
|
|
38
47
|
}
|
|
39
48
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-show="tabsManager && tabsManager.getValue() === id" :class="{ filled }" class="itf-tab-content" :data-test="`itf-tab-content-${id}`">
|
|
2
|
+
<div v-show="tabsManager && tabsManager.getValue() === id" :class="{ filled }" class="itf-tab-content" :data-test="`itf-tab-content-${id || _uid}`">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {
|
|
3
|
-
Vue, Component, Provide, Model, Emit,
|
|
3
|
+
Vue, Component, Provide, Model, Emit, Prop
|
|
4
4
|
} from 'vue-property-decorator';
|
|
5
5
|
import itfTab from './Tab';
|
|
6
6
|
import './tabs.scss';
|
|
@@ -15,6 +15,7 @@ class itfTabs extends Vue {
|
|
|
15
15
|
@Provide() tabsManager = this;
|
|
16
16
|
|
|
17
17
|
@Model('input') value;
|
|
18
|
+
@Prop(Boolean) vertical;
|
|
18
19
|
|
|
19
20
|
tabNodes;
|
|
20
21
|
|
|
@@ -22,8 +23,12 @@ class itfTabs extends Vue {
|
|
|
22
23
|
const [tabNodes, contents] = parseNodes(this.$slots);
|
|
23
24
|
this.tabNodes = tabNodes;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
let staticClass = 'itf-tabs';
|
|
27
|
+
if (this.vertical) {
|
|
28
|
+
staticClass += ' itf-tabs__vertical';
|
|
29
|
+
}
|
|
30
|
+
return createElement('div', { staticClass }, [
|
|
31
|
+
createElement('div', { staticClass: 'itf-tabs-panel' }, this.vertical ? tabNodes : tabNodes.reverse()),
|
|
27
32
|
createElement('div', { staticClass: 'itf-tabs-content' }, contents)
|
|
28
33
|
]);
|
|
29
34
|
|
|
@@ -45,14 +45,21 @@ storiesOf('Common', module)
|
|
|
45
45
|
<itf-tabs v-model="tab">
|
|
46
46
|
<itf-tab id="Test1">
|
|
47
47
|
Content 1
|
|
48
|
+
<div class="text-muted">Coming soon...</div>
|
|
48
49
|
</itf-tab>
|
|
49
50
|
<itf-tab id="Test2">
|
|
50
51
|
Content 2
|
|
51
52
|
</itf-tab>
|
|
52
|
-
<itf-tab
|
|
53
|
+
<itf-tab id="Test3">
|
|
54
|
+
Content 3
|
|
55
|
+
</itf-tab>
|
|
56
|
+
<itf-tab id="Test4">
|
|
57
|
+
Content 4
|
|
58
|
+
</itf-tab>
|
|
59
|
+
<itf-tab-content id="Test1" filled>
|
|
53
60
|
asd
|
|
54
61
|
</itf-tab-content>
|
|
55
|
-
<itf-tab-content id="Test2">
|
|
62
|
+
<itf-tab-content id="Test2" filled>
|
|
56
63
|
asd123
|
|
57
64
|
</itf-tab-content>
|
|
58
65
|
</itf-tabs>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:root {
|
|
6
6
|
--itf-tabs-active-bg: #fff;
|
|
7
7
|
--itf-tabs-active-color: #222;
|
|
8
|
-
--itf-tabs-active-border-color: #
|
|
8
|
+
--itf-tabs-active-border-color: #{$primary};
|
|
9
9
|
--itf-tabs-inactive-bg: #fafafa;
|
|
10
10
|
--itf-tabs-inactive-color: #222;
|
|
11
11
|
--itf-tabs-inactive-border-color: rgba(0, 0, 0, .1);
|
|
@@ -15,18 +15,83 @@
|
|
|
15
15
|
--itf-tabs-tab-padding: 10px;
|
|
16
16
|
|
|
17
17
|
--itf-tabs-content-bg: #fff;
|
|
18
|
+
--itf-tabs-panel-width: 300px;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.itf-tabs {
|
|
22
|
+
|
|
23
|
+
&.itf-tabs__vertical {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row-reverse;
|
|
26
|
+
|
|
27
|
+
.itf-tabs-panel {
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
width: var(--itf-tabs-panel-width);
|
|
30
|
+
padding-top: 6px;
|
|
31
|
+
padding-left: 0;
|
|
32
|
+
margin-right: 0;
|
|
33
|
+
padding-bottom: calc(var(--itf-tabs-tab-padding) * 3);
|
|
34
|
+
|
|
35
|
+
.itf-tab {
|
|
36
|
+
padding: var(--itf-tabs-tab-padding) 10px 0;
|
|
37
|
+
width: calc(100% - 2px);
|
|
38
|
+
margin-bottom: calc(var(--itf-tabs-tab-padding) * 1.5);
|
|
39
|
+
|
|
40
|
+
&, &:before, &:after {
|
|
41
|
+
border-top: 0 none;
|
|
42
|
+
border-right: 1px solid var(--itf-tabs-inactive-border-color);
|
|
43
|
+
}
|
|
44
|
+
&:after {
|
|
45
|
+
border-radius: 0 8px 0 0;
|
|
46
|
+
top: -5px;
|
|
47
|
+
box-shadow: rgb(0 0 0 / 10%) 2px -3px 5px, inset rgb(255 255 255 / 9%) 0 1px;
|
|
48
|
+
}
|
|
49
|
+
&:before {
|
|
50
|
+
border-radius: 0 0 8px 0;
|
|
51
|
+
transform: skew(0deg, -1deg);
|
|
52
|
+
top: auto;
|
|
53
|
+
bottom: -12px;
|
|
54
|
+
box-shadow: rgba(0,0,0,.1) 2px 3px 5px, inset rgba(255,255,255,.09) 0 -1px;
|
|
55
|
+
}
|
|
56
|
+
&:before, &:after {
|
|
57
|
+
height: calc(var(--itf-tabs-tab-padding) * 4);
|
|
58
|
+
width: calc(100% + 2px);
|
|
59
|
+
left: -1px;
|
|
60
|
+
border-top: 0 none;
|
|
61
|
+
border-right: 1px solid var(--itf-tabs-inactive-border-color);
|
|
62
|
+
}
|
|
63
|
+
&.active {
|
|
64
|
+
&, &:before, &:after {
|
|
65
|
+
border-top: 0 none;
|
|
66
|
+
border-right: 1px solid var(--itf-tabs-active-border-color);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
&:hover, &:hover:before, &:hover:after,
|
|
70
|
+
&:focus, &:focus:before, &:focus:after {
|
|
71
|
+
border-top: 0 none;
|
|
72
|
+
border-right: 1px solid var(--itf-tabs-hover-border-color);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.itf-tabs-content {
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
z-index: 1;
|
|
79
|
+
margin-right: -1px;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
21
83
|
.itf-tabs-panel {
|
|
22
|
-
margin:
|
|
23
|
-
padding:
|
|
84
|
+
margin: 0;
|
|
85
|
+
padding: 0;
|
|
24
86
|
overflow: hidden;
|
|
25
87
|
padding-left: calc(var(--itf-tabs-tab-padding) * 2.1);
|
|
26
|
-
list-style-type: none;
|
|
27
88
|
display: flex;
|
|
89
|
+
flex-direction: row-reverse;
|
|
90
|
+
justify-content: start;
|
|
91
|
+
flex-wrap: wrap;
|
|
28
92
|
|
|
29
93
|
.itf-tab {
|
|
94
|
+
white-space: nowrap;
|
|
30
95
|
display: block;
|
|
31
96
|
//float: right;
|
|
32
97
|
padding: 10px var(--itf-tabs-tab-padding) 8px;
|
|
@@ -39,11 +104,15 @@
|
|
|
39
104
|
background-color: var(--itf-tabs-inactive-bg);
|
|
40
105
|
color: var(--itf-tabs-inactive-color);
|
|
41
106
|
border-top: 1px solid var(--itf-tabs-inactive-border-color);
|
|
42
|
-
|
|
107
|
+
tab-index: 0;
|
|
108
|
+
text-decoration: none;
|
|
109
|
+
outline: 0 none;
|
|
43
110
|
|
|
44
111
|
& > span {
|
|
45
112
|
position: relative;
|
|
46
113
|
z-index: 4;
|
|
114
|
+
opacity: .5;
|
|
115
|
+
display: block;
|
|
47
116
|
}
|
|
48
117
|
&:before, &:after {
|
|
49
118
|
display: block;
|
|
@@ -69,25 +138,34 @@
|
|
|
69
138
|
//transform: skew(-30deg, 0deg);
|
|
70
139
|
box-shadow: rgba(0,0,0,.1) -3px 2px 5px, inset rgba(255,255,255,.09) 1px 0;
|
|
71
140
|
}
|
|
72
|
-
&:hover, &:hover:before, &:hover:after
|
|
141
|
+
&:hover, &:hover:before, &:hover:after,
|
|
142
|
+
&:focus, &:focus:before, &:focus:after {
|
|
73
143
|
background-color: var(--itf-tabs-hover-bg);
|
|
74
144
|
color: var(--itf-tabs-hover-color);
|
|
75
145
|
border-top: 1px solid var(--itf-tabs-hover-border-color);
|
|
146
|
+
|
|
147
|
+
& > span {
|
|
148
|
+
opacity: 1;
|
|
149
|
+
}
|
|
76
150
|
}
|
|
77
151
|
&.active {
|
|
78
152
|
z-index: 3;
|
|
79
153
|
|
|
154
|
+
& > span {
|
|
155
|
+
opacity: 1;
|
|
156
|
+
}
|
|
80
157
|
&, &:before, &:after {
|
|
81
158
|
background-color: var(--itf-tabs-active-bg);
|
|
82
159
|
color: var(--itf-tabs-active-color);
|
|
83
160
|
border-top: 1px solid var(--itf-tabs-active-border-color);
|
|
84
|
-
border-bottom: 0 none;
|
|
85
161
|
}
|
|
86
162
|
}
|
|
87
163
|
}
|
|
88
164
|
}
|
|
89
165
|
.itf-tabs-content {
|
|
90
166
|
.itf-tab-content {
|
|
167
|
+
height: 100%;
|
|
168
|
+
|
|
91
169
|
&.filled {
|
|
92
170
|
background: var(--itf-tabs-content-bg);
|
|
93
171
|
border: 1px solid var(--itf-tabs-inactive-border-color);
|