@burh/nuxt-core 1.0.132 → 1.0.133

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.
@@ -1,183 +1,187 @@
1
1
  <template>
2
- <div>
3
- <div
4
- :class="[
5
- { 'col-md-4': vertical && !tabNavWrapperClasses },
6
- { 'col-12': centered && !tabNavWrapperClasses },
7
- tabNavWrapperClasses
8
- ]"
9
- >
10
- <ul
11
- class="nav nav-pills"
12
- role="tablist"
13
- :class="[
14
- `nav-pills-${type}`,
15
- { 'flex-column': vertical },
16
- { 'justify-content-center': centered },
17
- tabNavClasses
18
- ]"
19
- :title="navTitle"
20
- >
21
- <li
22
- v-for="tab in tabs"
23
- class="nav-item active"
24
- data-toggle="tab"
25
- role="tablist"
26
- aria-expanded="true"
27
- :key="tab.id"
2
+ <div>
3
+ <div
4
+ :class="[
5
+ { 'col-md-4': vertical && !tabNavWrapperClasses },
6
+ { 'col-12': centered && !tabNavWrapperClasses },
7
+ tabNavWrapperClasses
8
+ ]"
28
9
  >
29
- <a
30
- data-toggle="tab"
31
- role="tablist"
32
- :href="`#${tab.id}`"
33
- @click.prevent="activateTab(tab)"
34
- :aria-expanded="tab.active"
35
- class="nav-link"
36
- :class="{ active: tab.active }"
37
- >
38
- <tab-item-content :tab="tab"> </tab-item-content>
39
- </a>
40
- </li>
41
- </ul>
42
- </div>
43
- <div
44
- class="tab-content"
45
- :class="[
46
- { 'tab-space': !vertical },
47
- { 'col-md-8': vertical && !tabContentClasses },
48
- tabContentClasses
49
- ]"
50
- >
51
- <slot></slot>
10
+ <ul
11
+ class="nav nav-pills"
12
+ role="tablist"
13
+ :class="[
14
+ `nav-pills-${type}`,
15
+ { 'flex-column': vertical },
16
+ { 'justify-content-center': centered },
17
+ tabNavClasses
18
+ ]"
19
+ :title="navTitle"
20
+ >
21
+ <li
22
+ v-for="tab in tabs"
23
+ class="nav-item"
24
+ data-toggle="tab"
25
+ role="tablist"
26
+ aria-expanded="true"
27
+ :key="tab.id"
28
+ >
29
+ <a
30
+ data-toggle="tab"
31
+ role="tablist"
32
+ :href="`#${tab.id}`"
33
+ @click.prevent="activateTab(tab)"
34
+ :aria-expanded="tab.active"
35
+ class="nav-link"
36
+ :class="{ active: tab.active }"
37
+ >
38
+ <tab-item-content :tab="tab"> </tab-item-content>
39
+ </a>
40
+ </li>
41
+ </ul>
42
+ </div>
43
+ <div
44
+ class="tab-content"
45
+ :class="[
46
+ { 'tab-space': !vertical },
47
+ { 'col-md-8': vertical && !tabContentClasses },
48
+ tabContentClasses
49
+ ]"
50
+ >
51
+ <slot></slot>
52
+ </div>
52
53
  </div>
53
- </div>
54
54
  </template>
55
55
 
56
56
  <script>
57
57
  import { isMobile, isMobileOnly } from 'mobile-device-detect';
58
58
 
59
59
  export default {
60
- name: 'tabs',
61
- components: {
62
- TabItemContent: {
63
- props: ['tab'],
64
- render(h) {
65
- return h('div', [this.tab.$slots.title || this.tab.title]);
66
- }
67
- }
68
- },
69
- provide() {
70
- return {
71
- addTab: this.addTab,
72
- removeTab: this.removeTab
73
- };
74
- },
75
- props: {
76
- type: {
77
- type: String,
78
- default: 'primary',
79
- validator: value => {
80
- let acceptedValues = [
81
- 'primary',
82
- 'info',
83
- 'success',
84
- 'warning',
85
- 'danger'
86
- ];
87
- return acceptedValues.indexOf(value) !== -1;
88
- }
89
- },
90
- activeTab: {
91
- type: String,
92
- default: '',
93
- description: 'Active tab name'
94
- },
95
- noActiveTabOnStart: {
96
- type: Boolean,
97
- default: true,
98
- description: 'Start with no active tab'
99
- },
100
- tabNavWrapperClasses: {
101
- type: [String, Object],
102
- default: '',
103
- description: 'ul wrapper css classes'
60
+ name: 'tabs',
61
+ components: {
62
+ TabItemContent: {
63
+ props: ['tab'],
64
+ render(h) {
65
+ return h('div', [this.tab.$slots.title || this.tab.title]);
66
+ }
67
+ }
104
68
  },
105
- tabNavClasses: {
106
- type: [String, Object],
107
- default: '',
108
- description: 'ul css classes'
69
+ provide() {
70
+ return {
71
+ addTab: this.addTab,
72
+ removeTab: this.removeTab
73
+ };
109
74
  },
110
- tabContentClasses: {
111
- type: [String, Object],
112
- default: '',
113
- description: 'tab content css classes'
75
+ props: {
76
+ type: {
77
+ type: String,
78
+ default: 'primary',
79
+ validator: value => {
80
+ let acceptedValues = [
81
+ 'primary',
82
+ 'info',
83
+ 'success',
84
+ 'warning',
85
+ 'danger'
86
+ ];
87
+ return acceptedValues.indexOf(value) !== -1;
88
+ }
89
+ },
90
+ activeTab: {
91
+ type: String,
92
+ default: '',
93
+ description: 'Active tab name'
94
+ },
95
+ noActiveTabOnStart: {
96
+ type: Boolean,
97
+ default: true,
98
+ description: 'Start with no active tab'
99
+ },
100
+ tabNavWrapperClasses: {
101
+ type: [String, Object],
102
+ default: '',
103
+ description: 'ul wrapper css classes'
104
+ },
105
+ tabNavClasses: {
106
+ type: [String, Object],
107
+ default: '',
108
+ description: 'ul css classes'
109
+ },
110
+ tabContentClasses: {
111
+ type: [String, Object],
112
+ default: '',
113
+ description: 'tab content css classes'
114
+ },
115
+ vertical: Boolean,
116
+ centered: Boolean,
117
+ value: String,
118
+ navTitle: String
114
119
  },
115
- vertical: Boolean,
116
- centered: Boolean,
117
- value: String,
118
- navTitle: String
119
- },
120
- data() {
121
- return {
122
- tabs: [],
123
- isMobileOnlyWatch: isMobileOnly
124
- };
125
- },
126
- methods: {
127
- findAndActivateTab(title) {
128
- let tabToActivate = this.tabs.find(t => t.title === title);
129
- if (tabToActivate) {
130
- this.activateTab(tabToActivate);
131
- }
120
+ data() {
121
+ return {
122
+ tabs: [],
123
+ isMobileOnlyWatch: isMobileOnly
124
+ };
132
125
  },
133
- activateTab(tab) {
134
- if (this.handleClick) {
135
- this.handleClick(tab);
136
- }
137
- this.deactivateTabs();
138
- tab.active = true;
126
+ methods: {
127
+ findAndActivateTab(title) {
128
+ let tabToActivate = this.tabs.find(t => t.title === title);
129
+ if (tabToActivate) {
130
+ this.activateTab(tabToActivate);
131
+ }
132
+ },
133
+ activateTab(tab) {
134
+ if (this.handleClick) {
135
+ this.handleClick(tab);
136
+ }
137
+ this.deactivateTabs();
138
+ tab.active = true;
139
139
 
140
- if(this.isMobileOnlyWatch){
141
- if(!document.querySelector('html').classList.contains('no-scroll')){
142
- document.querySelector('html').classList.add('no-scroll');
140
+ if (this.isMobileOnlyWatch) {
141
+ if (
142
+ !document
143
+ .querySelector('html')
144
+ .classList.contains('no-scroll')
145
+ ) {
146
+ document.querySelector('html').classList.add('no-scroll');
147
+ }
148
+ }
149
+ },
150
+ deactivateTabs() {
151
+ this.tabs.forEach(tab => {
152
+ tab.active = false;
153
+ });
154
+ },
155
+ addTab(tab) {
156
+ const index = this.$slots.default.indexOf(tab.$vnode);
157
+ if (!this.activeTab && index === 0 && !this.noActiveTabOnStart) {
158
+ tab.active = true;
159
+ }
160
+ if (this.activeTab === tab.name && !this.noActiveTabOnStart) {
161
+ tab.active = true;
162
+ }
163
+ this.tabs.splice(index, 0, tab);
164
+ },
165
+ removeTab(tab) {
166
+ const tabs = this.tabs;
167
+ const index = tabs.indexOf(tab);
168
+ if (index > -1) {
169
+ tabs.splice(index, 1);
170
+ }
143
171
  }
144
- }
145
- },
146
- deactivateTabs() {
147
- this.tabs.forEach(tab => {
148
- tab.active = false;
149
- });
150
172
  },
151
- addTab(tab) {
152
- const index = this.$slots.default.indexOf(tab.$vnode);
153
- if (!this.activeTab && index === 0 && !this.noActiveTabOnStart) {
154
- tab.active = true;
155
- }
156
- if (this.activeTab === tab.name && !this.noActiveTabOnStart) {
157
- tab.active = true;
158
- }
159
- this.tabs.splice(index, 0, tab);
173
+ mounted() {
174
+ this.$nextTick(() => {
175
+ if (this.value) {
176
+ this.findAndActivateTab(this.value);
177
+ }
178
+ });
160
179
  },
161
- removeTab(tab) {
162
- const tabs = this.tabs;
163
- const index = tabs.indexOf(tab);
164
- if (index > -1) {
165
- tabs.splice(index, 1);
166
- }
167
- }
168
- },
169
- mounted() {
170
- this.$nextTick(() => {
171
- if (this.value) {
172
- this.findAndActivateTab(this.value);
173
- }
174
- });
175
- },
176
- watch: {
177
- value(newVal) {
178
- this.findAndActivateTab(newVal);
180
+ watch: {
181
+ value(newVal) {
182
+ this.findAndActivateTab(newVal);
183
+ }
179
184
  }
180
- }
181
185
  };
182
186
  </script>
183
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.132",
3
+ "version": "1.0.133",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {