@salesforcedevs/docs-components 1.3.325-rnbtab-alpha1 → 1.3.325-rnbtab-alpha2

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 CHANGED
@@ -9,6 +9,7 @@
9
9
  "doc/breadcrumbs",
10
10
  "doc/content",
11
11
  "doc/contentCallout",
12
+ "doc/doDont",
12
13
  "doc/contentLayout",
13
14
  "doc/contentMedia",
14
15
  "doc/docXmlContent",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.325-rnbtab-alpha1",
3
+ "version": "1.3.325-rnbtab-alpha2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -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
- title: "", // Default no title.
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
- title: type,
176
+ header: type,
177
177
  variant: typeLower
178
178
  });
179
179
  // eslint-disable-next-line no-use-before-define
@@ -104,7 +104,7 @@ export default class ContentLayout extends LightningElement {
104
104
  }
105
105
 
106
106
  get showTabBasedRNB() {
107
- const tabPanelListItem: any = this.selectTabElement();
107
+ const tabPanelListItem: any = this.getTabPanelItems();
108
108
  return tabPanelListItem?.id === RNB_BY_TAB ? true : false;
109
109
  }
110
110
 
@@ -112,7 +112,7 @@ export default class ContentLayout extends LightningElement {
112
112
  this.updateRNB();
113
113
  };
114
114
 
115
- private selectTabElement() {
115
+ private getTabPanelItems() {
116
116
  return document.querySelector("dx-tab-panel-list");
117
117
  }
118
118
 
@@ -127,7 +127,7 @@ export default class ContentLayout extends LightningElement {
127
127
  private getHeadingElements() {
128
128
  let headingElements = document.querySelectorAll(TOC_HEADER_TAG);
129
129
  if (this.showTabBasedRNB) {
130
- const tabPanelListItem: any = this.selectTabElement();
130
+ const tabPanelListItem: any = this.getTabPanelItems();
131
131
  const tabPanels =
132
132
  tabPanelListItem?.querySelectorAll("dx-tab-panel");
133
133
  for (const tabPanelItem of tabPanels) {
@@ -142,26 +142,19 @@ export default class ContentLayout extends LightningElement {
142
142
  }
143
143
 
144
144
  private updateURL() {
145
- const tabPanelListItem: any = this.selectTabElement();
146
- if (tabPanelListItem?.shadowRoot) {
147
- const tabPanelItems =
148
- tabPanelListItem.shadowRoot.querySelectorAll(
149
- "dx-tab-panel-item"
150
- );
151
- if (tabPanelItems) {
152
- tabPanelItems.forEach((tabPanelItem: any) => {
153
- const tab = tabPanelItem.shadowRoot.querySelector("button");
154
- if (tab?.getAttribute("aria-selected") === "true") {
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
- }
145
+ const tabs = this.getAllTabs();
146
+ if (tabs.length > 0) {
147
+ tabs.forEach((tab: any) => {
148
+ if (tab?.getAttribute("aria-selected") === "true") {
149
+ const tabID = tab?.getAttribute("aria-label");
150
+ const url = new URL(window.location.href);
151
+ if (url.searchParams.get("type") !== tabID) {
152
+ url.searchParams.set("type", tabID);
153
+ url.hash = "";
154
+ window.history.pushState({}, "", url.toString());
162
155
  }
163
- });
164
- }
156
+ }
157
+ });
165
158
  }
166
159
  }
167
160
 
@@ -228,23 +221,29 @@ export default class ContentLayout extends LightningElement {
228
221
  }
229
222
  }
230
223
 
224
+ private getAllTabs(): any[] {
225
+ const tabPanelListItem: any = this.getTabPanelItems();
226
+ if (tabPanelListItem?.shadowRoot) {
227
+ return Array.from(
228
+ tabPanelListItem.shadowRoot.querySelectorAll(
229
+ "dx-tab-panel-item"
230
+ )
231
+ ).map((tabPanelItem: any) =>
232
+ tabPanelItem.shadowRoot.querySelector("button")
233
+ );
234
+ }
235
+ return [];
236
+ }
237
+
231
238
  private selectTabById(tabId: string) {
232
239
  requestAnimationFrame(() => {
233
- const tabPanelListItem: any = this.selectTabElement();
234
- if (tabPanelListItem?.shadowRoot) {
235
- const tabPanelItems =
236
- tabPanelListItem.shadowRoot.querySelectorAll(
237
- "dx-tab-panel-item"
238
- );
239
- if (tabPanelItems) {
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
- }
240
+ const tabs = this.getAllTabs();
241
+ if (tabs.length > 0) {
242
+ tabs.forEach((tab: any) => {
243
+ if (tab?.getAttribute("aria-label") === tabId) {
244
+ tab?.click();
245
+ }
246
+ });
248
247
  }
249
248
  });
250
249
  }
@@ -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
+ }