@leapdev/gui 0.2.235 → 0.2.241

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.
Files changed (60) hide show
  1. package/dist/auth-leap-addin.js +96 -0
  2. package/dist/auth-leap-desktop.js +96 -0
  3. package/dist/auth-leap-web.js +96 -0
  4. package/dist/bs-lawconnect.js +2 -2
  5. package/dist/bs-leap-slim.js +2 -2
  6. package/dist/bs-leap.js +2 -2
  7. package/dist/bs-titlex.js +2 -2
  8. package/dist/css/auth-leap-addin.css +1 -0
  9. package/dist/css/auth-leap-desktop.css +1 -0
  10. package/dist/css/auth-leap-web.css +1 -0
  11. package/dist/images/leap-auth/auth-bg.png +0 -0
  12. package/dist/images/leap-auth/auth-icons.svg +9 -0
  13. package/dist/images/leap-auth/auth-logo.svg +6 -0
  14. package/dist/index.html +2 -2
  15. package/dist/scss/auth/bootstrap/_bootstrap.scss +16 -0
  16. package/dist/scss/auth/product/leap-4d.scss +22 -0
  17. package/dist/scss/auth/product/leap.scss +21 -0
  18. package/dist/scss/auth/product/office-addin.scss +21 -0
  19. package/dist/scss/auth/theme/bootstrap-variables/_avatar.scss +8 -0
  20. package/dist/scss/auth/theme/bootstrap-variables/_badges.scss +5 -0
  21. package/dist/scss/auth/theme/bootstrap-variables/_breadcrumbs.scss +8 -0
  22. package/dist/scss/auth/theme/bootstrap-variables/_buttons.scss +7 -0
  23. package/dist/scss/auth/theme/bootstrap-variables/_colours.scss +60 -0
  24. package/dist/scss/auth/theme/bootstrap-variables/_components.scss +18 -0
  25. package/dist/scss/auth/theme/bootstrap-variables/_dropdowns.scss +24 -0
  26. package/dist/scss/auth/theme/bootstrap-variables/_grid.scss +21 -0
  27. package/dist/scss/auth/theme/bootstrap-variables/_input-box.scss +53 -0
  28. package/dist/scss/auth/theme/bootstrap-variables/_input-group.scss +0 -0
  29. package/dist/scss/auth/theme/bootstrap-variables/_input-options.scss +18 -0
  30. package/dist/scss/auth/theme/bootstrap-variables/_nav.scss +20 -0
  31. package/dist/scss/auth/theme/bootstrap-variables/_opacity.scss +6 -0
  32. package/dist/scss/auth/theme/bootstrap-variables/_select.scss +8 -0
  33. package/dist/scss/auth/theme/bootstrap-variables/_switch.scss +9 -0
  34. package/dist/scss/auth/theme/bootstrap-variables/_typography.scss +40 -0
  35. package/dist/scss/auth/theme/bootstrap-variables/_variables.scss +16 -0
  36. package/dist/scss/auth/theme/components/_badge.scss +34 -0
  37. package/dist/scss/auth/theme/components/_buttons.scss +92 -0
  38. package/dist/scss/auth/theme/components/_components.scss +12 -0
  39. package/dist/scss/auth/theme/components/_divider.scss +14 -0
  40. package/dist/scss/auth/theme/components/_dropdown.scss +40 -0
  41. package/dist/scss/auth/theme/components/_icons.scss +27 -0
  42. package/dist/scss/auth/theme/components/_nav.scss +79 -0
  43. package/dist/scss/auth/theme/components/_toastr.scss +24 -0
  44. package/dist/scss/auth/theme/components/forms/_checkbox.scss +73 -0
  45. package/dist/scss/auth/theme/components/forms/_form-control.scss +60 -0
  46. package/dist/scss/auth/theme/components/forms/_form-group.scss +8 -0
  47. package/dist/scss/auth/theme/components/forms/_forms.scss +4 -0
  48. package/dist/scss/auth/theme/components/forms/_input-group.scss +43 -0
  49. package/dist/scss/auth/theme/css-variables/_leap-4d.scss +74 -0
  50. package/dist/scss/auth/theme/css-variables/_leap.scss +77 -0
  51. package/dist/scss/auth/theme/css-variables/_office-addin.scss +73 -0
  52. package/dist/scss/auth/theme/features/_auth.scss +290 -0
  53. package/dist/scss/auth/theme/mixins/_badge.scss +12 -0
  54. package/dist/scss/auth/theme/mixins/_icons.scss +7 -0
  55. package/dist/scss/auth/theme/mixins/_mixins.scss +2 -0
  56. package/dist/scss/product/auth-leap-addin.scss +21 -0
  57. package/dist/scss/product/auth-leap-desktop.scss +22 -0
  58. package/dist/scss/product/auth-leap-web.scss +21 -0
  59. package/dist/scss/xsf-crx/sf-leap.js +174 -50
  60. package/package.json +3 -2
@@ -0,0 +1,290 @@
1
+ html {
2
+ height: 100%;
3
+ }
4
+
5
+ .auth-page {
6
+ background-color: var(--leap-body-background-color);
7
+ // display: grid;
8
+ // place-items: center;
9
+ display: flex;
10
+ align-items: center;
11
+ min-height: 100%;
12
+ padding-left: 1rem;
13
+ padding-right: 1rem;
14
+
15
+ @media screen and (min-height: 850px) {
16
+ background-image: url(https://unpkg.com/@leapdev/gui@latest/dist/images/leap-auth/auth-bg.png);
17
+ background-position: bottom left;
18
+ background-repeat: no-repeat;
19
+ background-size: 1194px;
20
+ }
21
+
22
+ > .container {
23
+ align-self: center;
24
+ display: flex;
25
+ }
26
+ }
27
+
28
+
29
+ .auth {
30
+ margin: 0 auto;
31
+ padding-bottom: 16vh;
32
+ height: auto;
33
+
34
+ @media screen and (min-width: 577px) {
35
+ max-width: 21.25rem;
36
+ }
37
+
38
+ @media screen and (max-height: 849px) {
39
+ padding-bottom: 0;
40
+ }
41
+
42
+ &_container {
43
+ margin: auto;
44
+ }
45
+
46
+ &_logo {
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ margin-bottom: 3.5rem;
51
+
52
+ @media screen and (max-height: 849px) {
53
+ height: auto;
54
+ margin-bottom: 4vh;
55
+ margin-top: 4vh;
56
+
57
+ > svg {
58
+ height: 100%;
59
+ }
60
+ }
61
+ }
62
+
63
+ &_title {
64
+ font-size: $h2-font-size;
65
+ color: var(--leap-heading-color);
66
+ font-weight: $font-weight-bold;
67
+ margin-bottom: 1rem;
68
+ }
69
+
70
+ &_form {
71
+ margin: auto;
72
+ .input-group-text,
73
+ .form-control {
74
+ border-radius: var(--leap-border-radius) !important;
75
+ }
76
+ }
77
+
78
+ &_links {
79
+ display: flex;
80
+ margin-top: 2rem;
81
+ color: $text-muted;
82
+ text-align: center;
83
+ justify-content: space-between;
84
+
85
+ a {
86
+ text-decoration: none;
87
+ font-size: $font-size-sm;
88
+ font-weight: 400;
89
+ &:hover, &:focus {
90
+ text-decoration: underline;
91
+ }
92
+ }
93
+ }
94
+
95
+ @media screen and (max-width: 376px) {
96
+ &_links {
97
+ flex-wrap: wrap;
98
+ margin-bottom: 2rem;
99
+
100
+ .nav {
101
+ width: 100%;
102
+
103
+ > li {
104
+ display: block;
105
+ white-space: wrap;
106
+ width: 100%;
107
+ padding-top: 0.25rem;
108
+ padding-bottom: 0.25rem;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ &_or {
115
+ $or-dim: 2.25rem;
116
+ width: 100%;
117
+ height: $or-dim !important;
118
+ margin: 1.5rem 0;
119
+ display: flex;
120
+ flex-wrap: nowrap;
121
+ align-items: center;
122
+ position: relative;
123
+ user-select: none;
124
+ overflow: hidden;
125
+ > span {
126
+ color: var(--leap-label-color);
127
+ display: block;
128
+ font-weight: 600;
129
+ font-size: 0.875rem;
130
+ text-align: center;
131
+ width: $or-dim;
132
+ height: $or-dim;
133
+ padding-top: 0.25rem;
134
+ border: 2px solid var(--leap-border-color);
135
+ border-radius: $or-dim;
136
+ }
137
+
138
+ &::before, &::after {
139
+ content: '';
140
+ display: inline-block;
141
+ width: calc(50% - #{$or-dim / 2});
142
+ height: 0.125rem;
143
+ background-color: var(--leap-border-color);
144
+ }
145
+ }
146
+
147
+ &_btn_microsoft {
148
+ display: flex;
149
+ justify-content: center;
150
+ align-items: center;
151
+ }
152
+
153
+ $icon_microsoft_dimension: 1.25rem;
154
+ &_icon_microsoft {
155
+ width: $icon_microsoft_dimension;
156
+ height: $icon_microsoft_dimension;
157
+ margin-top: -0.0625rem;
158
+ margin-right: 0.5rem;
159
+ $microsoft-icon: str-replace(url("data:image/svg+xml,%3Csvg width='20' height='21' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0_2_21)'%3E%3Cpath d='M0 0.125H20V20.125H0V0.125Z' fill='%23F3F3F3'/%3E%3Cpath d='M0.869568 0.994564H9.56522V9.69022H0.869568V0.994564Z' fill='%23F35325'/%3E%3Cpath d='M10.4348 0.994564H19.1304V9.69022H10.4348V0.994564Z' fill='%2381BC06'/%3E%3Cpath d='M0.869568 10.5598H9.56522V19.2554H0.869568V10.5598Z' fill='%2305A6F0'/%3E%3Cpath d='M10.4348 10.5598H19.1304V19.2554H10.4348V10.5598Z' fill='%23FFBA08'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_2_21'%3E%3Crect width='20' height='20' fill='white' transform='translate(0 0.125)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A"), "#", "%23");
160
+ &::before {
161
+ width: $icon_microsoft_dimension;
162
+ height: $icon_microsoft_dimension;
163
+ display: inline-block;
164
+ background-repeat: no-repeat;
165
+ background-size: 100%;
166
+ content: '';
167
+ background-image: $microsoft-icon;
168
+
169
+ }
170
+ }
171
+
172
+ &_permissions {
173
+ padding-top: 0.25rem;
174
+ padding-right: 0.25rem;
175
+ padding-bottom: 0.25rem;
176
+ background-color: #f7f7f7;
177
+ border-radius: var(--leap-border-radius);
178
+ margin-bottom: 1rem;
179
+
180
+ &:hover > .auth_permissions_list::-webkit-scrollbar-thumb {
181
+ background-color: #333;
182
+ transition: all 0.25s ease-out;
183
+ }
184
+ }
185
+
186
+ &_permissions_list {
187
+ list-style-type: none;
188
+ padding-left: 0;
189
+ margin-bottom: 0;
190
+ background-color: #f7f7f7;
191
+ padding: 0.75rem 0.75rem 0.75rem 1rem;
192
+ overflow-y: auto;
193
+ min-height: 200px;
194
+ max-height: 30vh;
195
+ -webkit-overflow-scrolling: touch;
196
+
197
+ &::-webkit-scrollbar {
198
+ width: 0.5rem;
199
+ border-top-right-radius: 4px;
200
+ }
201
+
202
+ &::-webkit-scrollbar-thumb {
203
+ border-radius: 8px;
204
+ background-color: var(--leap-border-color);
205
+ transition: all 0.25s ease-out;
206
+ &:hover {
207
+ background-color: #333;
208
+ transition: all 0.25s ease-out;
209
+ }
210
+ }
211
+
212
+ > li {
213
+ &:not(:first-child) {
214
+ margin-top: 1rem;
215
+ }
216
+
217
+ > ul {
218
+ list-style-type: none;
219
+ padding-left: 0;
220
+ }
221
+
222
+ > ul li {
223
+ &::before {
224
+ display: inline-block;
225
+ content: '-';
226
+ margin-right: 0.25rem;
227
+ }
228
+ margin-bottom: 0.25rem;
229
+ }
230
+ }
231
+ }
232
+
233
+ // @media screen and (min-width: 577px) {
234
+ &_support_tabcontent {
235
+ min-height: 21.5rem;
236
+ }
237
+ // }
238
+
239
+ &_firm_id {
240
+ position: relative;
241
+
242
+ .form-control {
243
+ z-index: 1;
244
+ padding-right: 3rem;
245
+
246
+ @if not $is-desktop {
247
+ padding-left: 1rem;
248
+ }
249
+ @else {
250
+ padding-left: 0.5rem;
251
+ }
252
+ }
253
+
254
+ .btn-icon-only {
255
+ height: auto;
256
+ padding: 0.5rem;
257
+ position: absolute;
258
+ z-index: 2;
259
+
260
+ @if $is-desktop {
261
+ right: 0;
262
+ top: 0;
263
+ bottom: 0;
264
+ }
265
+ @else {
266
+ right: 0.25rem;
267
+ top: 0.25rem;
268
+ bottom: 0.25rem;
269
+ }
270
+
271
+ .icon {
272
+ width: 1.2rem;
273
+ height: 1.2rem;
274
+ }
275
+ }
276
+ }
277
+
278
+ &_reason {
279
+ @if $is-desktop {
280
+ > span.input-group-text {
281
+ height: 60% !important;
282
+ }
283
+ }
284
+ @else {
285
+ > span.input-group-text {
286
+ height: 71% !important;
287
+ }
288
+ }
289
+ }
290
+ }
@@ -0,0 +1,12 @@
1
+ @mixin badge-variant-outline($bg, $color, $border) {
2
+ color: $color;
3
+ background-color: rgba($bg, 0.12);
4
+ border: 1px solid $border;
5
+
6
+ &[href]:hover,
7
+ &[href]:focus {
8
+ color: $color;
9
+ text-decoration: none;
10
+ background-color: rgba($bg, 0.2);
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ @mixin icon-sizing($map) {
2
+ @each $size, $value in $map {
3
+ .icon-#{$size} {
4
+ font-size: $value;
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ @import './icons';
2
+ @import './badge';
@@ -0,0 +1,21 @@
1
+ //
2
+ // Theme
3
+ //
4
+ // Custom variables followed by theme variables followed by Bootstrap variables
5
+ // to ensure cascade of styles.
6
+ //
7
+
8
+ // Bootstrap functions
9
+ @import '~bootstrap/scss/functions';
10
+
11
+ // Custom theme variables override
12
+ @import '../auth/theme/css-variables/office-addin';
13
+ @import '../auth/theme/bootstrap-variables/variables';
14
+
15
+ // Bootstrap core
16
+ @import '../auth/bootstrap/bootstrap';
17
+
18
+ // Custom theme core including mixins / utilities / features
19
+ @import '../auth/theme/mixins/mixins';
20
+ @import '../auth/theme/components/components';
21
+ @import '../auth/theme/features/auth';
@@ -0,0 +1,22 @@
1
+ //
2
+ // Theme
3
+ //
4
+ // Custom variables followed by theme variables followed by Bootstrap variables
5
+ // to ensure cascade of styles.
6
+ //
7
+
8
+ // Bootstrap functions
9
+ @import '~bootstrap/scss/functions';
10
+
11
+ // Custom theme variables override
12
+ @import '../auth/theme/css-variables/leap-4d';
13
+ @import '../auth/theme/bootstrap-variables/variables';
14
+
15
+ // Bootstrap core
16
+ @import '../auth/bootstrap/bootstrap';
17
+
18
+ // Custom theme core including mixins / utilities / features
19
+ @import '../auth/theme/mixins/mixins';
20
+ @import '../auth/theme/components/components';
21
+ @import '../auth/theme/features/auth';
22
+
@@ -0,0 +1,21 @@
1
+ //
2
+ // Theme
3
+ //
4
+ // Custom variables followed by theme variables followed by Bootstrap variables
5
+ // to ensure cascade of styles.
6
+ //
7
+
8
+ // Bootstrap functions
9
+ @import '~bootstrap/scss/functions';
10
+
11
+ // Custom theme variables override
12
+ @import '../auth/theme/css-variables/leap';
13
+ @import '../auth/theme/bootstrap-variables/variables';
14
+
15
+ // Bootstrap core
16
+ @import '../auth/bootstrap/bootstrap';
17
+
18
+ // Custom theme core including mixins / utilities / features
19
+ @import '../auth/theme/mixins/mixins';
20
+ @import '../auth/theme/components/components';
21
+ @import '../auth/theme/features/auth';
@@ -1,16 +1,58 @@
1
- (function () {
2
- var getChildren = function (n, skipMe) {
3
- var r = [];
4
- for (; n; n = n.nextSibling)
5
- if (n.nodeType == 1 && n != skipMe) r.push(n);
6
- return r;
7
- };
1
+ // Mutation Observer for Accordion and Tabs
2
+ //https://gist.github.com/matthewmorrone/da487467501e8b815430
3
+ (function (win) {
4
+ 'use strict';
8
5
 
9
- var getSiblings = function (n) {
10
- return getChildren(n.parentNode.firstChild, n);
11
- };
6
+ var listeners = [],
7
+ doc = win.document,
8
+ MutationObserver = win.MutationObserver || win.WebKitMutationObserver,
9
+ observer;
10
+
11
+ function ready(selector, fn) {
12
+ // Store the selector and callback to be monitored
13
+ listeners.push({
14
+ selector: selector,
15
+ fn: fn
16
+ });
17
+ if (!observer) {
18
+ // Watch for changes in the document
19
+ observer = new MutationObserver(check);
20
+ observer.observe(doc.documentElement, {
21
+ childList: true,
22
+ subtree: true
23
+ });
24
+ }
25
+ // Check if the element is currently in the DOM
26
+ check();
27
+ }
28
+
29
+ function check() {
30
+ // Check the DOM for elements matching a stored selector
31
+ for (var i = 0, len = listeners.length, listener, elements; i < len; i++) {
32
+ listener = listeners[i];
33
+ // Query for elements matching the specified selector
34
+ elements = doc.querySelectorAll(listener.selector);
35
+ for (var j = 0, jLen = elements.length, element; j < jLen; j++) {
36
+ element = elements[j];
37
+ // Make sure the callback isn't invoked with the
38
+ // same element more than once
39
+ if (!element.ready) {
40
+ element.ready = true;
41
+ // Invoke the callback with the element
42
+ listener.fn.call(element, element);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ // Expose `ready`
48
+ win.ready = ready;
49
+ })(this);
12
50
 
13
- var getClosestParent = function (elem, selector) {
51
+ //LEAP Help Centre JS for Components generated via Chrome Extension
52
+ (function () {
53
+ const topicsTabAccordion = {};
54
+
55
+ const getClosestParent = function (elem, selector) {
14
56
  if (!Element.prototype.matches) {
15
57
  Element.prototype.matches =
16
58
  Element.prototype.matchesSelector ||
@@ -33,15 +75,18 @@
33
75
  return null;
34
76
  };
35
77
 
36
- // For Version 1 the order of Hash appendages is Tab -> Accordion -> Subaccordion
37
- var appendHash = function (str) {
38
- window.location.hash = (() => {
39
- const lowercasedStr = str.toLowerCase();
40
- return lowercasedStr.split(' ').join('-');
41
- })();
78
+ const getChildren = function (n, skipMe) {
79
+ let r = [];
80
+ for (; n; n = n.nextSibling)
81
+ if (n.nodeType == 1 && n != skipMe) r.push(n);
82
+ return r;
83
+ };
84
+
85
+ const getSiblings = function (n) {
86
+ return getChildren(n.parentNode.firstChild, n);
42
87
  };
43
88
 
44
- var getDeviceType = function () {
89
+ const getDeviceType = function () {
45
90
  const ua = navigator.userAgent;
46
91
  const isiOS = () => {
47
92
  return /iPad|iPhone/.test(ua) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
@@ -59,14 +104,28 @@
59
104
  return;
60
105
  };
61
106
 
107
+ // #@desktop:accordion-2;sub-accordion-1@parent-accordion-1
108
+ const urlHash = {
109
+ list: window.location.hash,
110
+ init: function () {
111
+ this.openedTopics = window.location.hash.substring(1).split('@').splice(1);
112
+ },
113
+ setItem: function (id) {
114
+ const childText = topicsTabAccordion[id].isMainParent ? '' : (':' + topicsTabAccordion[id].text);
115
+ const parentText = topicsTabAccordion[id].isMainParent ? topicsTabAccordion[id].text : topicsTabAccordion[id].parentLabel;
116
+ return `@${parentText}${childText}`;
117
+ }
118
+ };
119
+
120
+ // Tab and Accordion Toggling
62
121
  document.addEventListener('click', function (event) {
63
- var
122
+ const
64
123
  targetElem = event.target,
65
124
  className = targetElem.classList;
66
125
 
67
126
  if (className.value.indexOf('sf-tab-item-link') !== -1) {
68
127
  event.preventDefault();
69
- var targetID,
128
+ let targetID,
70
129
  activeTabBtn,
71
130
  targetTab,
72
131
  targetTabSiblings,
@@ -82,8 +141,6 @@
82
141
  activeTabBtn.classList.add('active');
83
142
  targetTab.classList.add('in');
84
143
 
85
- appendHash(targetElem.textContent);
86
-
87
144
  activeBtnTabSiblings.forEach(function (element) {
88
145
  if (element.classList.value.indexOf('active') !== -1) element.classList.remove('active');
89
146
  });
@@ -93,61 +150,128 @@
93
150
  }
94
151
 
95
152
  if (className.value.indexOf('sf-accordion-toggle') !== -1) {
96
- appendHash(targetElem.querySelector('.sf-accordion-text').textContent);
97
- className.value.indexOf('in') == -1 ?
98
- className.add('in') : className.remove('in');
153
+ className.value.indexOf('in') == -1 ? className.add('in') : className.remove('in');
154
+ }
155
+
156
+ if (
157
+ className.value.indexOf('sf-tab-item-link') !== -1 ||
158
+ className.value.indexOf('sf-accordion-toggle') !== -1
159
+ ) {
160
+ window.location.hash = urlHash.setItem(targetElem.id);
99
161
  }
100
162
 
101
163
  return false;
102
164
  }, false);
103
165
 
104
- // Set default tab via URL hash or device type if present on tabs
105
- document.addEventListener('DOMContentLoaded', function () {
106
- const tabs = document.querySelectorAll('.sf-tabs');
107
- const accordion = document.querySelectorAll('.sf-accordion-toggle');
108
- const urlHashList = window.location.hash !== '' ? window.location.hash.substring(1).split('#') : undefined;
166
+ // Set default tab via URL hash parameters or device type if present on tabs
167
+ let articleTabsInit = false;
168
+ let articleAccordionInit = false;
109
169
 
110
- const openParent = (childElement) => {
111
- const closestTab = getClosestParent(childElement, '.sf-tab-content');
112
- const closestAccordion = getClosestParent(childElement, '.sf-accordion-content');
170
+ urlHash.init();
113
171
 
114
- if (closestTab !== null) {
115
- document.getElementById(`target_${closestTab.id}`).click();
172
+ const closestParent = (child) => {
173
+ const tabContent = getClosestParent(child, '.sf-tab-content');
174
+ const accordionContent = getClosestParent(child, '.sf-accordion-content');
175
+ const parentLabel = () => {
176
+ if (tabContent !== null) {
177
+ return document.getElementById(`target_${tabContent.id}`).textContent;
116
178
  }
117
- if (closestAccordion !== null) {
118
- document.getElementById(`target_${closestAccordion.id}`).click();
179
+ else if (accordionContent !== null) {
180
+ return document.getElementById(`target_${accordionContent.id}`).querySelector('.sf-accordion-text').textContent;
119
181
  }
182
+ else {
183
+ return '';
184
+ }
185
+ };
186
+ return {
187
+ parentLabel: parentLabel().split(' ').join('-').toLowerCase(),
188
+ flag: tabContent !== null || accordionContent !== null ? false : true
120
189
  };
190
+ };
191
+
192
+ ready('.sf-tabs', function () {
193
+ if (!articleTabsInit) {
194
+
195
+ const toggleTabs = (params) => {
196
+ // Remove existing active CSS classes
197
+ const currentTabContentID = params.tabNav.querySelector('.sf-tab-item.active').firstElementChild.id.substring(7);
198
+ params.tabNav.querySelector('.sf-tab-item.active').classList.remove('active');
199
+ document.getElementById(currentTabContentID).classList.remove('in');
121
200
 
122
- if (tabs.length !== 0) {
123
- tabs.forEach(tab => {
201
+ //Update tab according to device with active and in css class
202
+ params.targetTabLink.parentNode.classList.add('active');
203
+ document.getElementById(params.targetTabLink.id.substring(7)).classList.add('in');
204
+ };
205
+
206
+ document.querySelectorAll('.sf-tabs').forEach(tab => {
124
207
  const deviceType = getDeviceType();
125
208
  tab.querySelectorAll('.sf-tab-item-link').forEach(tabitem => {
126
209
  const tabItemText = tabitem.textContent.toLowerCase().replace(/\s/g, '');
127
210
 
128
- if (tabItemText === deviceType && typeof (urlHashList) === 'undefined') {
129
- tabitem.click();
211
+ const _closestParent = closestParent(tabitem);
212
+
213
+ topicsTabAccordion[tabitem.id] = {
214
+ text: tabItemText,
215
+ isMainParent: _closestParent.flag,
216
+ parentLabel: _closestParent.parentLabel
217
+ };
218
+
219
+ // If URL hash is not present, we locate the name of the device tab
220
+ const sfTabNav = tabitem.parentNode.parentNode;
221
+ if (tabItemText === deviceType && urlHash.list === '') {
222
+ if (sfTabNav.querySelector('.sf-tab-item.active').classList.contains('active')) {
223
+ toggleTabs({
224
+ targetTabLink: tabitem,
225
+ tabNav: sfTabNav
226
+ });
227
+ }
130
228
  }
131
- else if (typeof (urlHashList) !== 'undefined' && urlHashList.includes(tabItemText)) {
132
- openParent(tabitem);
133
- tabitem.click();
229
+
230
+ if (urlHash.list !== '' && urlHash.list.search(tabItemText) > -1) {
231
+ Object.keys(topicsTabAccordion).forEach(key => {
232
+ if (tabItemText == topicsTabAccordion[key].text) {
233
+ toggleTabs({
234
+ targetTabLink: tabitem,
235
+ tabNav: sfTabNav
236
+ });
237
+ }
238
+ });
134
239
  }
135
240
  });
136
241
  });
242
+
243
+ articleTabsInit = true;
244
+ console.log(topicsTabAccordion);
137
245
  }
246
+ });
138
247
 
139
- if (accordion.length !== 0) {
140
- accordion.forEach(accordionToggle => {
248
+ ready('.sf-accordion', function () {
249
+ if (!articleAccordionInit) {
250
+ const urlHashList = window.location.hash;
251
+ document.querySelectorAll('.sf-accordion-toggle').forEach(accordionToggle => {
141
252
  const accordionText = accordionToggle
142
253
  .querySelector('.sf-accordion-text')
143
254
  .textContent.split(' ').join('-').toLowerCase();
144
255
 
145
- if (typeof (urlHashList) !== 'undefined' && urlHashList.includes(accordionText)) {
146
- openParent(accordionToggle);
147
- accordionToggle.click();
256
+ const _closestParent = closestParent(accordionToggle);
257
+
258
+ topicsTabAccordion[accordionToggle.id] = {
259
+ text: accordionText,
260
+ isMainParent: _closestParent.flag,
261
+ parentLabel: _closestParent.parentLabel
262
+ };
263
+
264
+ if (urlHashList !== '' && urlHash.list.search(accordionText) > -1) {
265
+ Object.keys(topicsTabAccordion).forEach(key => {
266
+ if (accordionText == topicsTabAccordion[key].text) {
267
+ document.getElementById(key).classList.add('in');
268
+ return;
269
+ }
270
+ });
148
271
  }
149
272
  });
273
+
274
+ articleAccordionInit = true;
150
275
  }
151
276
  });
152
-
153
277
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapdev/gui",
3
- "version": "0.2.235",
3
+ "version": "0.2.241",
4
4
  "description": "LEAP GUI",
5
5
  "author": "LEAP Dev",
6
6
  "license": "ISC",
@@ -48,5 +48,6 @@
48
48
  "webpack": "^4.44.1",
49
49
  "webpack-cli": "^3.3.12",
50
50
  "webpack-dev-server": "^3.11.0"
51
- }
51
+ },
52
+ "dependencies": {}
52
53
  }