@salesforcedevs/docs-components 1.3.325-rnbtab-alpha1 → 1.3.325-rnbtab-alpha3
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/lwc.config.json +1 -0
- package/package.json +1 -1
- package/src/modules/doc/content/content.ts +2 -2
- package/src/modules/doc/contentLayout/contentLayout.ts +37 -48
- package/src/modules/doc/doDont/doDont.css +47 -0
- package/src/modules/doc/doDont/doDont.html +27 -0
- package/src/modules/doc/doDont/doDont.ts +17 -0
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -134,7 +134,7 @@ export default class Content extends LightningElement {
|
|
|
134
134
|
// ! Hot fix for incoming html tags from couchdb for xml blocks, fix me soon please
|
|
135
135
|
language: LANGUAGE_MAP[language] || language,
|
|
136
136
|
theme: this.codeBlockTheme,
|
|
137
|
-
|
|
137
|
+
header: "", // Default no title.
|
|
138
138
|
variant: this.codeBlockType,
|
|
139
139
|
isEncoded: true
|
|
140
140
|
});
|
|
@@ -173,7 +173,7 @@ export default class Content extends LightningElement {
|
|
|
173
173
|
const type = calloutEl.querySelector("h4")!.textContent!;
|
|
174
174
|
const typeLower = type.toLowerCase();
|
|
175
175
|
Object.assign(calloutCompEl, {
|
|
176
|
-
|
|
176
|
+
header: type,
|
|
177
177
|
variant: typeLower
|
|
178
178
|
});
|
|
179
179
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -42,7 +42,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
42
42
|
@api language!: string;
|
|
43
43
|
@api bailHref!: string;
|
|
44
44
|
@api bailLabel!: string;
|
|
45
|
-
@track initialIndex: number = 0;
|
|
46
45
|
|
|
47
46
|
// This is needed for now to prevent failing snapshot tests due to links in the footer
|
|
48
47
|
@api showFooter = false;
|
|
@@ -104,7 +103,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
get showTabBasedRNB() {
|
|
107
|
-
const tabPanelListItem: any = this.
|
|
106
|
+
const tabPanelListItem: any = this.getTabPanelItems();
|
|
108
107
|
return tabPanelListItem?.id === RNB_BY_TAB ? true : false;
|
|
109
108
|
}
|
|
110
109
|
|
|
@@ -112,7 +111,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
112
111
|
this.updateRNB();
|
|
113
112
|
};
|
|
114
113
|
|
|
115
|
-
private
|
|
114
|
+
private getTabPanelItems() {
|
|
116
115
|
return document.querySelector("dx-tab-panel-list");
|
|
117
116
|
}
|
|
118
117
|
|
|
@@ -127,7 +126,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
127
126
|
private getHeadingElements() {
|
|
128
127
|
let headingElements = document.querySelectorAll(TOC_HEADER_TAG);
|
|
129
128
|
if (this.showTabBasedRNB) {
|
|
130
|
-
const tabPanelListItem: any = this.
|
|
129
|
+
const tabPanelListItem: any = this.getTabPanelItems();
|
|
131
130
|
const tabPanels =
|
|
132
131
|
tabPanelListItem?.querySelectorAll("dx-tab-panel");
|
|
133
132
|
for (const tabPanelItem of tabPanels) {
|
|
@@ -142,26 +141,19 @@ export default class ContentLayout extends LightningElement {
|
|
|
142
141
|
}
|
|
143
142
|
|
|
144
143
|
private updateURL() {
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const tabID = tab?.getAttribute("aria-label");
|
|
156
|
-
const url = new URL(window.location.href);
|
|
157
|
-
if (url.searchParams.get("type") !== tabID) {
|
|
158
|
-
url.searchParams.set("type", tabID);
|
|
159
|
-
url.hash = "";
|
|
160
|
-
window.history.pushState({}, "", url.toString());
|
|
161
|
-
}
|
|
144
|
+
const tabs = this.getAllTabs();
|
|
145
|
+
if (tabs.length > 0) {
|
|
146
|
+
tabs.forEach((tab: any) => {
|
|
147
|
+
if (tab?.getAttribute("aria-selected") === "true") {
|
|
148
|
+
const tabID = tab?.getAttribute("aria-label");
|
|
149
|
+
const url = new URL(window.location.href);
|
|
150
|
+
if (url.searchParams.get("type") !== tabID) {
|
|
151
|
+
url.searchParams.set("type", tabID);
|
|
152
|
+
url.hash = "";
|
|
153
|
+
window.history.pushState({}, "", url.toString());
|
|
162
154
|
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
165
157
|
}
|
|
166
158
|
}
|
|
167
159
|
|
|
@@ -228,23 +220,29 @@ export default class ContentLayout extends LightningElement {
|
|
|
228
220
|
}
|
|
229
221
|
}
|
|
230
222
|
|
|
223
|
+
private getAllTabs(): any[] {
|
|
224
|
+
const tabPanelListItem: any = this.getTabPanelItems();
|
|
225
|
+
if (tabPanelListItem?.shadowRoot) {
|
|
226
|
+
return Array.from(
|
|
227
|
+
tabPanelListItem.shadowRoot.querySelectorAll(
|
|
228
|
+
"dx-tab-panel-item"
|
|
229
|
+
)
|
|
230
|
+
).map((tabPanelItem: any) =>
|
|
231
|
+
tabPanelItem.shadowRoot.querySelector("button")
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
|
|
231
237
|
private selectTabById(tabId: string) {
|
|
232
238
|
requestAnimationFrame(() => {
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
tabPanelItems.forEach((tabPanelItem: any) => {
|
|
241
|
-
const tab =
|
|
242
|
-
tabPanelItem.shadowRoot.querySelector("button");
|
|
243
|
-
if (tab?.getAttribute("aria-label") === tabId) {
|
|
244
|
-
tab?.click();
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}
|
|
239
|
+
const tabs = this.getAllTabs();
|
|
240
|
+
if (tabs.length > 0) {
|
|
241
|
+
tabs.forEach((tab: any) => {
|
|
242
|
+
if (tab?.getAttribute("aria-label") === tabId) {
|
|
243
|
+
tab?.click();
|
|
244
|
+
}
|
|
245
|
+
});
|
|
248
246
|
}
|
|
249
247
|
});
|
|
250
248
|
}
|
|
@@ -445,16 +443,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
445
443
|
}
|
|
446
444
|
};
|
|
447
445
|
|
|
448
|
-
onSlotChange(
|
|
449
|
-
const slot = e.target;
|
|
450
|
-
const child = slot.assignedElements();
|
|
451
|
-
const tabComponent = child.find(
|
|
452
|
-
(element: any) =>
|
|
453
|
-
element.tagName.toLowerCase() === "dx-tab-panel-list"
|
|
454
|
-
);
|
|
455
|
-
if (tabComponent) {
|
|
456
|
-
tabComponent.initialIndex = this.initialIndex; // Set the index value on the child component
|
|
457
|
-
}
|
|
446
|
+
onSlotChange(): void {
|
|
458
447
|
this.updateRNB();
|
|
459
448
|
}
|
|
460
449
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
.container {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--dx-g-spacing-md);
|
|
8
|
+
flex: 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.doc-do-dont-header {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--dx-g-spacing-sm);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.doc-do-dont-label {
|
|
18
|
+
font-family: var(--dx-g-font-display);
|
|
19
|
+
font-size: var(--dx-g-spacing-md);
|
|
20
|
+
font-weight: var(--dx-g-font-demi);
|
|
21
|
+
line-height: var(--dx-g-spacing-lg);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.doc-do-color {
|
|
25
|
+
color: var(--dx-g-green-vibrant-50);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.doc-dont-color {
|
|
29
|
+
color: var(--dx-g-red-vibrant-30);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.do-dont-image-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
max-height: 480px;
|
|
35
|
+
min-height: 140px;
|
|
36
|
+
padding: var(--dx-g-spacing-3xl) var(--dx-g-spacing-2xl);
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex: 1;
|
|
41
|
+
border-radius: var(--dx-g-spacing-sm);
|
|
42
|
+
border: 1px solid var(--dx-g-brand-default-color-border-2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.doc-do-dont-img {
|
|
46
|
+
object-fit: contain;
|
|
47
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="doc-do-dont-header">
|
|
4
|
+
<template lwc:if={isDo}>
|
|
5
|
+
<dx-icon
|
|
6
|
+
symbol="success"
|
|
7
|
+
size="large"
|
|
8
|
+
color="green-vibrant-50"
|
|
9
|
+
></dx-icon>
|
|
10
|
+
<div class="doc-do-dont-label doc-do-color">Do</div>
|
|
11
|
+
</template>
|
|
12
|
+
<template lwc:else>
|
|
13
|
+
<dx-icon
|
|
14
|
+
symbol="clear"
|
|
15
|
+
size="large"
|
|
16
|
+
color="red-vibrant-30"
|
|
17
|
+
class="doc-do-dont-icon"
|
|
18
|
+
></dx-icon>
|
|
19
|
+
<div class="doc-do-dont-label doc-dont-color">Don't</div>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="do-dont-image-container">
|
|
23
|
+
<img class="doc-do-dont-img" src={src} alt={caption} />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="dx-text-body-4">{caption}</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
3
|
+
|
|
4
|
+
export default class DoDont extends LightningElement {
|
|
5
|
+
@api caption: string = "";
|
|
6
|
+
@api src!: string;
|
|
7
|
+
_isDo: boolean = false;
|
|
8
|
+
|
|
9
|
+
@api
|
|
10
|
+
get isDo(): boolean {
|
|
11
|
+
return this._isDo;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
set isDo(value) {
|
|
15
|
+
this._isDo = normalizeBoolean(value);
|
|
16
|
+
}
|
|
17
|
+
}
|