@salesforcedevs/dx-components 1.3.356 → 1.3.358-alpha

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
@@ -91,6 +91,7 @@
91
91
  "dx/stepSequenceStep",
92
92
  "dx/tabPanel",
93
93
  "dx/tabPanelList",
94
+ "dx/tabbedCodeBlock",
94
95
  "dx/tbidAvatarButton",
95
96
  "dx/toast",
96
97
  "dx/toc",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.356",
3
+ "version": "1.3.358-alpha",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -45,6 +45,5 @@
45
45
  },
46
46
  "volta": {
47
47
  "node": "18.18.0"
48
- },
49
- "gitHead": "05824ad8bbc6c2fa350149baf24b8f48d0af32a8"
48
+ }
50
49
  }
@@ -9,6 +9,7 @@
9
9
 
10
10
  pre {
11
11
  margin: 0 !important;
12
+ height: var(--dx-code-block-height, unset);
12
13
  }
13
14
 
14
15
  .copyta {
@@ -19,7 +20,7 @@ pre {
19
20
  }
20
21
 
21
22
  .toolbar {
22
- border-radius: 0.3em 0.3em 0 0;
23
+ border-radius: var(--dx-code-block-toolbar-border-radius, 0.3em 0.3em 0 0);
23
24
  opacity: 1;
24
25
  display: flex;
25
26
  align-items: center;
@@ -39,14 +39,14 @@ prism.languages.sql_docs_template = sqlDocsTemplate;
39
39
  // Used for remove enclosing <pre> tag's (if occurs)
40
40
  const preTagRegexp: RegExp = /^<pre.*?>(.*)<\/pre>$/is;
41
41
 
42
- const LIGHT = "light";
43
- const DARK = "dark";
42
+ export const LIGHT = "light";
43
+ export const DARK = "dark";
44
44
  const themes: CodeBlockTheme[] = [LIGHT, DARK];
45
45
  const LOCAL_STORAGE_KEY = "dx-codeblock-theme";
46
46
 
47
47
  export default class CodeBlock extends LightningElement {
48
48
  @api defaultTheme: CodeBlockTheme = LIGHT;
49
- @api header: string = "title";
49
+ @api header: string = "";
50
50
  @api sourceLink: string = "";
51
51
  @api language: string = "";
52
52
  // if it is true, it renders code as is coming instead of wrapping it into html/xml comments tags.
@@ -6,7 +6,6 @@
6
6
  :host {
7
7
  width: 100%;
8
8
 
9
- /* --dx-c-featured-content-header-background-color */
10
9
  --dx-c-tree-graphic-color: var(--dx-g-indigo-vibrant-40);
11
10
  --dx-c-featured-content-header-padding-horizontal: var(
12
11
  --dx-g-page-padding-horizontal
@@ -44,26 +43,24 @@
44
43
  --bottom-spacing: var(--dx-g-spacing-4xl);
45
44
  --item-spacing: var(--dx-g-spacing-xl);
46
45
  --swoop-height: var(--dx-c-featured-content-header-swoop-height);
47
- --swoop-inset: calc(2.5 * var(--vertical-padding));
48
46
  --swoop-z-index: 11;
49
- --label-color: var(--dx-g-indigo-vibrant-40);
47
+ --label-color: var(--dx-themed-featured-content-header-text-color);
50
48
 
49
+ background: var(--dx-themed-featured-content-header-background-swoop) cover
50
+ repeat-x;
51
+ background-size: auto 100%;
51
52
  position: relative;
52
- background: var(
53
- --dx-c-featured-content-header-background-color,
54
- var(--dx-g-indigo-vibrant-90)
55
- );
56
53
  }
57
54
 
58
55
  .container-layout {
59
56
  padding: var(--dx-c-featured-content-header-padding-vertical)
60
57
  var(--dx-c-featured-content-header-padding-horizontal);
61
- background-image: var(--background-image);
58
+ background-image: var(--dx-c-featured-content-header-background-image);
59
+ background-size: var(--dx-c-featured-content-header-background-image-size);
62
60
  background-repeat: no-repeat;
63
61
  background-position: var(
64
62
  --dx-c-featured-content-header-background-image-position
65
63
  );
66
- background-size: var(--dx-c-featured-content-header-background-image-size);
67
64
  }
68
65
 
69
66
  /* LAYOUTS */
@@ -76,8 +73,6 @@
76
73
  }
77
74
 
78
75
  .img-placement_below .container-layout {
79
- --swoop-inset: calc(80px + 38vw);
80
-
81
76
  margin-bottom: calc(var(--dx-c-bottom-image-height) / 2);
82
77
  }
83
78
 
@@ -350,7 +345,7 @@ a.image-container > img {
350
345
 
351
346
  .label {
352
347
  grid-area: label;
353
- color: var(--dx-c-featured-content-label-color, var(--label-color));
348
+ color: var(--label-color);
354
349
  padding-bottom: var(--dx-g-spacing-lg);
355
350
  }
356
351
 
@@ -386,15 +381,31 @@ dx-image-and-label {
386
381
  padding-right: var(--dx-g-spacing-lg);
387
382
  }
388
383
 
389
- /* DARK VARIANT */
384
+ /* SHARED LINK HOVERING */
385
+
386
+ .container.link-hovered a.image-container > img {
387
+ filter: var(--dx-g-button-image-filter-hover);
388
+ }
389
+
390
+ .container.link-hovered .title-link {
391
+ color: var(
392
+ --dx-themed-featured-content-header-title-link-light-hover-color
393
+ );
394
+ }
395
+
396
+ .container.link-hovered.variant_dark .title-link {
397
+ color: var(
398
+ --dx-themed-featured-content-header-title-link-intense-hover-color
399
+ );
400
+ }
390
401
 
391
402
  .variant_dark {
392
- --label-color: rgb(190 199 246);
403
+ --label-color: var(--dx-themed-featured-content-header-intense-label-color);
393
404
 
394
405
  background: var(
395
- --dx-c-featured-content-header-background-color,
396
- linear-gradient(-180deg, rgb(40 23 153) 0%, rgb(46 43 182) 100%)
397
- );
406
+ --dx-themed-featured-content-header-background-swoop-intense
407
+ )
408
+ center repeat-x;
398
409
  }
399
410
 
400
411
  .variant_dark dx-image-and-label {
@@ -406,30 +417,6 @@ dx-image-and-label {
406
417
  color: white;
407
418
  }
408
419
 
409
- /* SHARED LINK HOVERING */
410
-
411
- .container.link-hovered a.image-container > img {
412
- filter: var(--dx-g-button-image-filter-hover);
413
- }
414
-
415
- .container.link-hovered .title-link {
416
- color: var(--dx-g-link-hover-color);
417
- }
418
-
419
- .container.link-hovered.variant_dark .title-link {
420
- color: var(--dx-g-indigo-vibrant-90);
421
- }
422
-
423
- @media screen and (min-width: 1920px) {
424
- .swoop-container,
425
- .swoop-silhouette {
426
- left: initial;
427
- right: 0;
428
- transform: initial;
429
- width: 1920px;
430
- }
431
- }
432
-
433
420
  @media screen and (max-width: 1401px) {
434
421
  .img-placement_below .image-container {
435
422
  padding-top: var(--dx-c-featured-content-header-image-padding-top);
@@ -442,23 +429,17 @@ dx-image-and-label {
442
429
  }
443
430
  }
444
431
 
445
- @media screen and (min-width: 1400px) {
446
- .img-placement_below {
447
- --swoop-inset: 680px;
432
+ @media screen and (max-width: 1024px) {
433
+ div.container {
434
+ background-size: center;
448
435
  }
449
- }
450
436
 
451
- @media screen and (max-width: 1024px) {
452
437
  .container {
453
438
  --vertical-padding: 80px;
454
439
  --bottom-spacing: var(--dx-g-spacing-2xl);
455
440
  --item-spacing: var(--dx-g-spacing-md);
456
441
  }
457
442
 
458
- .container:not(.img-placement_below) {
459
- --swoop-inset: 64px;
460
- }
461
-
462
443
  .img-placement_inline .container-layout {
463
444
  display: grid;
464
445
  grid-template-areas: "label" "image" "main";
@@ -93,40 +93,6 @@
93
93
  >
94
94
  <img src={imgSrc} alt={imgAlt} />
95
95
  </a>
96
- <template if:false={noSwoop}>
97
- <svg
98
- class="swoop-silhouette"
99
- width="1920px"
100
- height="331px"
101
- viewBox="0 0 1920 331"
102
- version="1.1"
103
- xmlns="http://www.w3.org/2000/svg"
104
- preserveAspectRatio="none"
105
- >
106
- <defs>
107
- <path
108
- d="M1920,330 L76.7313881,330.008182 C51.2800917,330.255837 25.7029624,330.372286 0,330.357528 L0,330 L76.7313881,330.008182 C789.975765,323.067922 1404.39864,213.086385 1920,0.0635708029 L1920,0.0635708029 L1920,330 Z"
109
- id="path-1"
110
- ></path>
111
- </defs>
112
- <g
113
- id="Documentation-landing-page"
114
- stroke="none"
115
- stroke-width="1"
116
- fill="none"
117
- fill-rule="evenodd"
118
- >
119
- <mask id="mask-2" fill="white">
120
- <use xlink:href="#path-1"></use>
121
- </mask>
122
- <use
123
- id="Combined-Shape"
124
- fill={swoopUnderColor}
125
- xlink:href="#path-1"
126
- ></use>
127
- </g>
128
- </svg>
129
- </template>
130
96
  </div>
131
97
  <div class="blue-circle" if:true={hasIcon}>
132
98
  <dx-icon
@@ -21,7 +21,6 @@ export default class FeaturedContentHeader extends LightningElement {
21
21
  @api imgSrc?: string;
22
22
  @api imgAlt?: string = "Featured content image";
23
23
  @api imgPlacement?: "inline" | "below" = "inline";
24
- @api dark: boolean = false;
25
24
  @api href?: string;
26
25
  @api target?: string | null = null;
27
26
  @api header!: string;
@@ -35,8 +34,9 @@ export default class FeaturedContentHeader extends LightningElement {
35
34
  | "big-moon"
36
35
  | null = null;
37
36
  @api noSwoop: boolean = false;
37
+ @api dark: boolean = false;
38
38
  @api icon: string = "";
39
- @api swoopUnderColor: string = "#FFFFFF";
39
+ @api swoopUnderColor: string = "var(--dx-g-fch-swoop-under-color)";
40
40
 
41
41
  private _authors?: Array<ImageAndLabel>;
42
42
  private isSlotEmpty: boolean = true;
@@ -58,14 +58,6 @@ a:hover {
58
58
  --dx-c-breadcrumb-hover-color: var(--dx-g-cloud-blue-vibrant-40);
59
59
  }
60
60
 
61
- .helmet.variant_dark {
62
- background-color: var(--dx-g-blue-vibrant-40);
63
-
64
- --dx-c-home-link-color: white;
65
- --dx-c-breadcrumb-color: var(--dx-g-blue-vibrant-90);
66
- --dx-c-breadcrumb-hover-color: var(--dx-g-cloud-blue-vibrant-80);
67
- }
68
-
69
61
  .helmet.variant_light {
70
62
  background-color: var(--dx-g-cloud-blue-vibrant-95);
71
63
 
@@ -6,7 +6,7 @@
6
6
  font-size: var(--dx-g-text-base);
7
7
  font-weight: var(--dx-g-font-normal);
8
8
  line-height: var(--dx-g-spacing-lg);
9
- padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-lg);
9
+ padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-lg);
10
10
  border-top-left-radius: var(--dx-g-spacing-sm);
11
11
  border-top-right-radius: var(--dx-g-spacing-sm);
12
12
  border-bottom: var(--dx-g-spacing-xs) solid transparent;
@@ -0,0 +1,8 @@
1
+ dx-code-block {
2
+ --dx-code-block-height: 320px;
3
+ --dx-code-block-toolbar-border-radius: 0;
4
+ }
5
+
6
+ dx-tab-panel-list {
7
+ --dx-c-tab-panel-list-horizontal-padding: 0;
8
+ }
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <dx-tab-panel-list tabs={tabs}>
3
+ <template for:each={_codeBlocks} for:item="codeBlockItem">
4
+ <dx-tab-panel key={codeBlockItem.header}>
5
+ <!-- The header attribute is not passed intentionally because the tab title uses the header value. -->
6
+ <dx-code-block
7
+ default-theme={defaultTheme}
8
+ code-block={codeBlockItem.codeBlock}
9
+ language={codeBlockItem.language}
10
+ source-link={codeBlockItem.sourceLink}
11
+ is-encoded={codeBlockItem.isEncoded}
12
+ ></dx-code-block>
13
+ </dx-tab-panel>
14
+ </template>
15
+ </dx-tab-panel-list>
16
+ </template>
@@ -0,0 +1,44 @@
1
+ import { LightningElement, api } from "lwc";
2
+ import { CodeBlockItem } from "typings/custom";
3
+ import { safeDecodeURI, toJson } from "dxUtils/normalizers";
4
+ import { DARK } from "dx/codeBlock";
5
+
6
+ export default class TabbedCodeBlock extends LightningElement {
7
+ _codeBlocks: CodeBlockItem[] = [];
8
+
9
+ // By default, we want a dark theme for the tabbed code block; however, if the user changes the theme of any code block, it updates the same across the entire website.
10
+ @api defaultTheme = DARK;
11
+
12
+ get tabs(): string {
13
+ // Use the code block headers to create a tabs array as a JSON string
14
+ return JSON.stringify(
15
+ this._codeBlocks.map((codeBlock) => ({ label: codeBlock.header }))
16
+ );
17
+ }
18
+
19
+ // We need to pass the attribute as decodedURI(JSON.stringify(codeBlocksArray)) to avoid issues with single and double quotes in the code block content.
20
+ @api
21
+ set codeBlocks(value: string) {
22
+ if (value) {
23
+ // Decode the encoded code block JSON string
24
+ const decodeCodeBlockJson = safeDecodeURI(value);
25
+ try {
26
+ const codeBlockItems = toJson(decodeCodeBlockJson);
27
+ this._codeBlocks = codeBlockItems.map(
28
+ (codeBlock: CodeBlockItem) => {
29
+ return {
30
+ ...codeBlock,
31
+ defaultTheme: this.defaultTheme
32
+ };
33
+ }
34
+ );
35
+ } catch (exception) {
36
+ console.log("Invalid codeblock items json", exception);
37
+ }
38
+ }
39
+ }
40
+
41
+ get codeBlocks(): CodeBlockItem[] {
42
+ return this._codeBlocks;
43
+ }
44
+ }
@@ -76,3 +76,15 @@ export const normalizeBoolean = (
76
76
  export const normalizeDomId = (id: string): string => {
77
77
  return id.replace(/^[^a-z]+|[^\w.-]+/gi, "");
78
78
  };
79
+
80
+ export const safeDecodeURI = (value: string): string => {
81
+ try {
82
+ // Check if the value contains URI encoding patterns
83
+ return typeof value === "string" && value.includes("%")
84
+ ? decodeURIComponent(value)
85
+ : value;
86
+ } catch (error) {
87
+ // In case of any errors, return the original value
88
+ return value;
89
+ }
90
+ };
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.