@salesforcedevs/dx-components 0.10.0 → 0.10.1-alpha.100

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 (88) hide show
  1. package/lwc.config.json +3 -3
  2. package/package.json +3 -4
  3. package/src/.DS_Store +0 -0
  4. package/src/assets/svg/docs-empty-state-small.svg +72 -0
  5. package/src/assets/svg/sidebar-loading.svg +34 -0
  6. package/src/modules/.DS_Store +0 -0
  7. package/src/modules/dx/.DS_Store +0 -0
  8. package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +78 -148
  9. package/src/modules/dx/cardGrid/cardGrid.css +0 -32
  10. package/src/modules/dx/cardGrid/cardGrid.html +5 -11
  11. package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +47 -5
  12. package/src/modules/dx/codeBlock/codeBlock.stories.ts +2 -69
  13. package/src/modules/dx/codeBlock/codeBlock.ts +43 -22
  14. package/src/modules/dx/codeBlock/darkTheme.css +0 -1
  15. package/src/modules/dx/codeBlock/lightTheme.css +0 -1
  16. package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +29 -10
  17. package/src/modules/dx/emptyState/__tests__/mockProps.ts +1 -3
  18. package/src/modules/dx/emptyState/emptyState.css +45 -13
  19. package/src/modules/dx/emptyState/emptyState.html +6 -4
  20. package/src/modules/dx/emptyState/emptyState.stories.ts +18 -38
  21. package/src/modules/dx/emptyState/emptyState.ts +11 -20
  22. package/src/modules/dx/footer/links.ts +3 -5
  23. package/src/modules/dx/header/__tests__/mockProps.ts +7 -1
  24. package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +2 -4
  25. package/src/modules/dx/headerNav/headerNav.html +8 -6
  26. package/src/modules/dx/headerNav/headerNav.ts +2 -2
  27. package/src/modules/dx/headerSearch/headerSearch.html +2 -4
  28. package/src/modules/dx/headerSearch/headerSearch.ts +19 -25
  29. package/src/modules/dx/newsletterForm/newsletterForm.html +5 -3
  30. package/src/modules/dx/popover/popover.ts +11 -7
  31. package/src/modules/dx/searchResults/coveo.css +314 -111
  32. package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -70
  33. package/src/modules/dx/sidebar/sidebar.css +42 -23
  34. package/src/modules/dx/sidebar/sidebar.html +62 -40
  35. package/src/modules/dx/sidebar/sidebar.stories.ts +54 -4
  36. package/src/modules/dx/sidebar/sidebar.ts +126 -66
  37. package/src/modules/dx/sidebarSearch/__tests__/preloadedState.ts +3459 -0
  38. package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +44 -0
  39. package/src/modules/dx/sidebarSearch/sidebarSearch.css +3 -0
  40. package/src/modules/dx/sidebarSearch/sidebarSearch.html +26 -0
  41. package/src/modules/dx/sidebarSearch/sidebarSearch.ts +358 -0
  42. package/src/modules/dx/sidebarSearch/utils.ts +2 -0
  43. package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +55 -0
  44. package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +36 -0
  45. package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +14 -0
  46. package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +56 -0
  47. package/src/modules/dx/spinner/__tests__/spinner.test.ts +37 -0
  48. package/src/modules/dx/spinner/spinner.css +750 -0
  49. package/src/modules/dx/spinner/spinner.html +6 -0
  50. package/src/modules/dx/spinner/spinner.stories.ts +69 -0
  51. package/src/modules/dx/spinner/spinner.ts +20 -0
  52. package/src/modules/dx/tab/__tests__/tab.test.ts +112 -54
  53. package/src/modules/dx/tab/tab.css +91 -16
  54. package/src/modules/dx/tab/tab.html +10 -12
  55. package/src/modules/dx/tab/tab.stories.ts +57 -0
  56. package/src/modules/dx/tab/tab.ts +35 -28
  57. package/src/modules/dx/tooltip/tippy.css +1 -0
  58. package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +1 -1
  59. package/src/modules/dx/treeTile/treeTile.css +3 -19
  60. package/src/modules/dx/treeTile/treeTile.html +4 -1
  61. package/src/modules/dx/treeTile/treeTile.ts +2 -2
  62. package/src/modules/helpers/sidebar/sidebar.css +21 -0
  63. package/src/modules/helpers/table/table.css +23 -7
  64. package/src/modules/utils/coveo/coveo.ts +60 -0
  65. package/src/modules/utils/highlight/highlight.ts +31 -0
  66. package/src/modules/utils/normalizers/normalizers.ts +3 -0
  67. package/src/modules/utils/recentSearches/__tests__/recentSearches.test.ts +79 -0
  68. package/src/modules/utils/recentSearches/recentSearches.ts +57 -0
  69. package/src/modules/utils/regexps/regexps.ts +5 -0
  70. package/LICENSE +0 -12
  71. package/src/modules/dx/headerNavOption/__tests__/headerNavOption.test.ts +0 -113
  72. package/src/modules/dx/headerNavOption/headerNavOption.css +0 -91
  73. package/src/modules/dx/headerNavOption/headerNavOption.html +0 -9
  74. package/src/modules/dx/headerNavOption/headerNavOption.ts +0 -31
  75. package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -11
  76. package/src/modules/dx/tab/__tests__/mockProps.ts +0 -4
  77. package/src/modules/dx/tabPanel/__tests__/mockProps.ts +0 -4
  78. package/src/modules/dx/tabPanel/__tests__/tabPanel.test.ts +0 -46
  79. package/src/modules/dx/tabPanel/tabPanel.css +0 -9
  80. package/src/modules/dx/tabPanel/tabPanel.html +0 -13
  81. package/src/modules/dx/tabPanel/tabPanel.ts +0 -27
  82. package/src/modules/dx/tabs/__tests__/mockProps.ts +0 -3
  83. package/src/modules/dx/tabs/__tests__/tabs.test.ts +0 -47
  84. package/src/modules/dx/tabs/tabs.css +0 -7
  85. package/src/modules/dx/tabs/tabs.html +0 -21
  86. package/src/modules/dx/tabs/tabs.stories.ts +0 -74
  87. package/src/modules/dx/tabs/tabs.ts +0 -112
  88. package/src/modules/dx/tabs/uniqueId.ts +0 -6
@@ -1,5 +1,7 @@
1
1
  table {
2
2
  --table-border-radius: 4px;
3
+ --table-cell-text-base: var(--dx-g-text-sm);
4
+ --table-cell-line-height: var(--dx-g-text-lg);
3
5
 
4
6
  display: block;
5
7
  overflow-x: scroll;
@@ -16,13 +18,13 @@ table tr {
16
18
  th,
17
19
  td {
18
20
  padding: var(--dx-g-spacing-md);
19
- font-size: var(--dx-g-text-sm);
20
- line-height: var(--dx-g-text-lg);
21
+ font-size: var(--table-cell-text-base);
22
+ line-height: var(--table-cell-line-height);
21
23
  }
22
24
 
23
25
  th {
24
26
  background-color: var(--dx-g-indigo-vibrant-95);
25
- font-weight: inherit;
27
+ font-weight: var(--dx-g-font-bold);
26
28
  border-bottom: 3px solid var(--dx-g-indigo-vibrant-30);
27
29
  }
28
30
 
@@ -40,10 +42,6 @@ table tbody tr td {
40
42
  border-bottom: 1px solid var(--dx-g-gray-90);
41
43
  }
42
44
 
43
- th:first-of-type {
44
- font-weight: var(--dx-g-font-bold);
45
- }
46
-
47
45
  tr th:first-of-type,
48
46
  td:first-of-type {
49
47
  min-width: 110px;
@@ -85,6 +83,24 @@ tr td[colspan]:not([colspan="1"]) {
85
83
  text-align: center;
86
84
  }
87
85
 
86
+ /**
87
+ * Inside of a <td>, we want font size not to increase as it otherwise would
88
+ * for standard inline/"prose-level" elements (e.g., <p>, <li>). But we *do*
89
+ * want to leave font size increases in place for *other* elements inside <td>,
90
+ * like callouts, headings (<h1>, <h2>, etc.), and so on. In order not to
91
+ * "stomp" on too much -- and because we don't control the markup, so can't
92
+ * easily add new CSS classes, etc. -- we try to pick out the specific
93
+ * structures only here. (See https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE0000081MGTYA2/view)
94
+ */
95
+ td :is(.li, p, .p, dd) {
96
+ font-size: var(--table-cell-text-base);
97
+ }
98
+
99
+ td doc-content-callout :is(.li, p, .p, dd) {
100
+ /* Override/reset for callouts -- see https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE0000081MGTYA2/view */
101
+ font-size: var(--dx-g-text-base);
102
+ }
103
+
88
104
  table :not(thead + tbody) tr:first-of-type td:first-of-type {
89
105
  border-top-left-radius: var(--table-border-radius);
90
106
  }
@@ -0,0 +1,60 @@
1
+ import {
2
+ buildSearchEngine as _buildSearchEngine,
3
+ SearchAppState,
4
+ SearchEngineOptions
5
+ } from "@coveo/headless";
6
+
7
+ export const buildSearchEngine = ({
8
+ organizationId,
9
+ preloadedState,
10
+ publicAccessToken,
11
+ searchHub,
12
+ searchPipeline
13
+ }: {
14
+ organizationId: string;
15
+ publicAccessToken: string;
16
+ searchPipeline?: string;
17
+ searchHub: string;
18
+ preloadedState?: SearchAppState;
19
+ }) => {
20
+ const search = searchPipeline
21
+ ? { pipeline: searchPipeline, searchHub }
22
+ : { searchHub };
23
+
24
+ const configuration = {
25
+ accessToken: publicAccessToken,
26
+ organizationId,
27
+ search
28
+ };
29
+
30
+ const engineConfiguration: SearchEngineOptions = preloadedState
31
+ ? { configuration, preloadedState }
32
+ : { configuration };
33
+
34
+ return _buildSearchEngine(engineConfiguration);
35
+ };
36
+
37
+ export const getSidebarSearchParams = () =>
38
+ new URLSearchParams(window.location.search).get("q");
39
+
40
+ export const coveoXMLDocsConfig = {
41
+ coveoOrganizationId: "coveosalesforcetestakshatha",
42
+ coveoPublicAccessToken: "xxfeb39525-e402-4e41-a870-7132441f7875",
43
+ coveoSearchHub: "Developer_Docs_SS",
44
+ coveoAdvancedQueryConfig: JSON.stringify({
45
+ objecttype: "HTDeveloperDocumentsC",
46
+ sflanguage: "en_US",
47
+ sfrelease__c: "232.0",
48
+ sfdelivarable__c: "apexcode"
49
+ })
50
+ };
51
+
52
+ export const coveoSFDocsConfig = {
53
+ coveoOrganizationId: "coveosalesforcetestakshatha",
54
+ coveoPublicAccessToken: "xxfeb39525-e402-4e41-a870-7132441f7875",
55
+ coveoSearchHub: "Developer_MdDocs_SS",
56
+ coveoAdvancedQueryConfig: JSON.stringify({
57
+ source: "Sitemap - Developer Docs",
58
+ path_segment_3: "pardot"
59
+ })
60
+ };
@@ -0,0 +1,31 @@
1
+ import { createSearchRegExp } from "utils/regexps";
2
+
3
+ const MARK_TAGS = /<\/?mark>/gi;
4
+
5
+ export const highlightTerms = (
6
+ elements: Array<HTMLElement>,
7
+ searchTerm: string
8
+ ): void => {
9
+ searchTerm = searchTerm.trim();
10
+ const searchExp = createSearchRegExp(searchTerm);
11
+ elements.forEach((element) => {
12
+ if (
13
+ element?.innerHTML.includes("<dx-") ||
14
+ element?.innerHTML.includes("<doc-")
15
+ ) {
16
+ return;
17
+ }
18
+
19
+ let innerHtml = element.innerHTML.replace(
20
+ // Remove previously added mark tags
21
+ MARK_TAGS,
22
+ ""
23
+ );
24
+
25
+ if (searchTerm) {
26
+ innerHtml = innerHtml.replace(searchExp, "<mark>$&</mark>");
27
+ }
28
+
29
+ element.innerHTML = innerHtml;
30
+ });
31
+ };
@@ -86,3 +86,6 @@ export const normalizePost = ({
86
86
  id,
87
87
  title
88
88
  });
89
+
90
+ export const normalizeBoolean = (value: string | boolean | number): boolean =>
91
+ typeof value === "string" ? value === "true" : !!value;
@@ -0,0 +1,79 @@
1
+ import { RecentSearches, LOCAL_STORAGE_KEY, LIMIT } from "utils/recentSearches";
2
+
3
+ describe("recentSearches", () => {
4
+ beforeEach(() => {
5
+ window.localStorage.clear();
6
+ });
7
+
8
+ it("initializes correctly from local storage", () => {
9
+ const initial = ["test", "test1", "test2"];
10
+
11
+ window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(initial));
12
+ const Searches = new RecentSearches();
13
+
14
+ expect(Searches.get()).toEqual(initial);
15
+ });
16
+
17
+ it("ignores exact duplicate additions", () => {
18
+ const Searches = new RecentSearches();
19
+
20
+ const item = "test";
21
+
22
+ Searches.add(item);
23
+ Searches.add(item);
24
+
25
+ expect(Searches.get().length).toEqual(1);
26
+ });
27
+
28
+ it("ignores duplicate additions with extraneous white space", () => {
29
+ const Searches = new RecentSearches();
30
+
31
+ const item1 = "test";
32
+ const item2 = " test ";
33
+
34
+ Searches.add(item1);
35
+ Searches.add(item2);
36
+
37
+ expect(Searches.get().length).toEqual(1);
38
+ expect(Searches.get()[0]).toEqual(item1);
39
+ });
40
+
41
+ it("prioritizes the last searched item", () => {
42
+ const Searches = new RecentSearches();
43
+
44
+ const item1 = "test1";
45
+ const item2 = "test2";
46
+
47
+ Searches.add(item1);
48
+ Searches.add(item2);
49
+
50
+ expect(Searches.get().length).toEqual(2);
51
+
52
+ expect(Searches.get()[0]).toEqual(item2);
53
+ expect(Searches.get()[1]).toEqual(item1);
54
+
55
+ Searches.add(item1);
56
+
57
+ expect(Searches.get().length).toEqual(2);
58
+ expect(Searches.get()[0]).toEqual(item1);
59
+ expect(Searches.get()[1]).toEqual(item2);
60
+ });
61
+
62
+ it("will not exceed the limit", () => {
63
+ const Searches = new RecentSearches();
64
+
65
+ Array.apply(null, Array(LIMIT + 1)).forEach((_, i) => {
66
+ Searches.add(i.toString());
67
+ });
68
+
69
+ expect(Searches.get().length).toEqual(LIMIT);
70
+ });
71
+
72
+ it("doesn't add a bogus value", () => {
73
+ const Searches = new RecentSearches();
74
+
75
+ [null, "", " ", " ", 5].forEach((v) => Searches.add(v));
76
+
77
+ expect(Searches.get().length).toEqual(0);
78
+ });
79
+ });
@@ -0,0 +1,57 @@
1
+ export const LOCAL_STORAGE_KEY = "dx-sidebar-recent-searches";
2
+
3
+ export const LIMIT = 5;
4
+
5
+ export class RecentSearches {
6
+ items: string[] = [];
7
+
8
+ constructor() {
9
+ this._init();
10
+ }
11
+
12
+ get() {
13
+ return this.items;
14
+ }
15
+
16
+ add(item: string | undefined) {
17
+ if (!item || typeof item !== "string") {
18
+ return;
19
+ }
20
+ const normalized = item.trim();
21
+ if (normalized === "") {
22
+ return;
23
+ }
24
+ this._prepend(normalized);
25
+ this._removeDuplicates(normalized);
26
+ this._cutOffExcess();
27
+ this._addToStorage();
28
+ }
29
+
30
+ // private
31
+ _init() {
32
+ this.items = JSON.parse(
33
+ window.localStorage.getItem(LOCAL_STORAGE_KEY) || "[]"
34
+ );
35
+ }
36
+
37
+ _prepend(item: string) {
38
+ this.items.unshift(item);
39
+ }
40
+
41
+ _removeDuplicates(item: string) {
42
+ while (this.items.lastIndexOf(item) > 0) {
43
+ this.items.splice(this.items.lastIndexOf(item), 1);
44
+ }
45
+ }
46
+
47
+ _cutOffExcess() {
48
+ this.items = this.items.slice(0, LIMIT);
49
+ }
50
+
51
+ _addToStorage() {
52
+ window.localStorage.setItem(
53
+ LOCAL_STORAGE_KEY,
54
+ JSON.stringify(this.items)
55
+ );
56
+ }
57
+ }
@@ -0,0 +1,5 @@
1
+ const escapeRegExp = (text: string) =>
2
+ text.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&");
3
+
4
+ export const createSearchRegExp = (searchTerm: string): RegExp =>
5
+ new RegExp(`(?:${escapeRegExp(searchTerm)})(?![^<>]*>)`, "gi");
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.
@@ -1,113 +0,0 @@
1
- import HeaderNavOption from "dx/headerNavOption";
2
- import Icon from "dx/icon";
3
- import { createRenderComponent } from "utils/tests";
4
-
5
- const TAG = "dx-header-nav-option";
6
- const render = createRenderComponent(TAG, HeaderNavOption);
7
-
8
- const PROPS = {
9
- label: "documentation",
10
- href: "/test"
11
- };
12
-
13
- describe(TAG, () => {
14
- it("renders a single link with a label", () => {
15
- const element = render(PROPS);
16
-
17
- const links: Array<HTMLAnchorElement> = element.shadowRoot.querySelectorAll(
18
- "a"
19
- );
20
-
21
- expect(links.length).toEqual(1);
22
- const [singleLink] = links;
23
- expect(singleLink.href).toMatch(PROPS.href);
24
- expect(singleLink.classList).toHaveLength(2);
25
- expect(singleLink.classList).toContain("nav-list-item");
26
- expect(singleLink.classList).toContain("nav-list-item_default");
27
-
28
- const span: HTMLElement = singleLink.querySelector("span")!;
29
- expect(span.textContent).toBe(PROPS.label);
30
-
31
- expect(element.shadowRoot.querySelector("button")).toBeNull();
32
-
33
- return expect(element).toBeAccessible();
34
- });
35
-
36
- it("renders a link as active and small variant", () => {
37
- const element = render({ ...PROPS, isActive: true, variant: "small" });
38
-
39
- const link: HTMLAnchorElement = element.shadowRoot.querySelector("a");
40
-
41
- expect(link.href).toMatch(PROPS.href);
42
- expect(link.classList).toHaveLength(3);
43
- expect(link.classList).toContain("nav-list-item");
44
- expect(link.classList).toContain("nav-list-item_small");
45
- expect(link.classList).toContain("state-active");
46
-
47
- expect(element.shadowRoot.querySelector("button")).toBeNull();
48
-
49
- return expect(element).toBeAccessible();
50
- });
51
-
52
- it("renders a button if no href provided", () => {
53
- const label = "test button";
54
- const element = render({ label });
55
-
56
- const buttons: Array<HTMLButtonElement> = element.shadowRoot.querySelectorAll(
57
- "button"
58
- );
59
-
60
- expect(buttons).toHaveLength(1);
61
- const [singleButton] = buttons;
62
-
63
- expect(singleButton.classList).toHaveLength(2);
64
- expect(singleButton.classList).toContain("nav-list-item");
65
- expect(singleButton.classList).toContain("nav-list-item_default");
66
-
67
- const span: HTMLElement = singleButton.querySelector("span")!;
68
- expect(span.textContent).toBe(label);
69
- const icon: Element & Icon = singleButton.querySelector("dx-icon")!;
70
- expect(icon).not.toBeNull();
71
- expect(icon.size).toBe("small");
72
-
73
- return expect(element).toBeAccessible();
74
- });
75
-
76
- it("renders a button with label only if variant is small", () => {
77
- const label = "test button";
78
- const element = render({ label, variant: "small" });
79
-
80
- const button: HTMLButtonElement = element.shadowRoot.querySelector(
81
- "button"
82
- );
83
-
84
- expect(button.classList).toHaveLength(2);
85
- expect(button.classList).toContain("nav-list-item");
86
- expect(button.classList).toContain("nav-list-item_small");
87
-
88
- const span: HTMLElement = button.querySelector("span")!;
89
- expect(span.textContent).toBe(label);
90
-
91
- const icon: Element & Icon = button.querySelector("dx-icon")!;
92
- expect(icon).not.toBeNull();
93
- expect(icon.size).toBe("xsmall");
94
-
95
- return expect(element).toBeAccessible();
96
- });
97
-
98
- it("fires sendGtm function when button is clicked", () => {
99
- const sendGtmMock = jest.fn();
100
- const element = render({
101
- ...PROPS,
102
- onclick: sendGtmMock
103
- });
104
-
105
- const link = element.shadowRoot.querySelector("a");
106
-
107
- link.click();
108
-
109
- expect(sendGtmMock).toHaveBeenCalled();
110
-
111
- return expect(element).toBeAccessible();
112
- });
113
- });
@@ -1,91 +0,0 @@
1
- @import "helpers/reset";
2
-
3
- a {
4
- text-decoration: none;
5
- }
6
-
7
- .nav-list-item {
8
- --horizontal-spacing: var(--dx-g-spacing-md);
9
-
10
- position: relative;
11
- display: flex;
12
- align-items: center;
13
- height: var(--dx-g-spacing-xl);
14
- font-family: var(--dx-g-font-display);
15
- white-space: nowrap;
16
- color: var(--dx-g-blue-vibrant-20);
17
- transition: var(--dx-g-transition-hue-1x);
18
- cursor: pointer;
19
- outline-offset: -1px;
20
- }
21
-
22
- .nav-list-item_default {
23
- border: 0;
24
- border-radius: var(--dx-g-spacing-md);
25
- font-size: var(--dx-g-text-sm);
26
- padding: 0 var(--horizontal-spacing);
27
- }
28
-
29
- .nav-list-item_small {
30
- --border-color: transparent;
31
-
32
- border-bottom: 2px solid var(--border-color);
33
- font-size: var(--dx-g-text-xs);
34
- height: calc(var(--dx-g-spacing-xl) - 2px);
35
- margin: 0 var(--horizontal-spacing);
36
- }
37
-
38
- .nav-list-item > span {
39
- margin-top: var(--dx-g-spacing-xs);
40
- }
41
-
42
- button.nav-list-item_default > dx-icon {
43
- margin-left: var(--dx-g-spacing-sm);
44
- }
45
-
46
- button.nav-list-item_small > dx-icon {
47
- margin-left: var(--dx-g-spacing-xs);
48
- }
49
-
50
- .nav-list-item_default:hover,
51
- .nav-list-item_default:active,
52
- :host([aria-expanded="true"]) button.nav-list-item_default {
53
- background: var(--dx-g-brand-current-button-color-background-inactive);
54
- }
55
-
56
- button.nav-list-item:hover > *:last-child,
57
- button.nav-list-item:active > *:last-child,
58
- :host([aria-expanded="true"]) button.nav-list-item > *:last-child {
59
- transform: rotateX(180deg);
60
- }
61
-
62
- .nav-list-item_small:hover,
63
- .nav-list-item_small:active,
64
- :host([aria-expanded="true"]) button.nav-list-item_small {
65
- --border-color: var(--dx-g-blue-vibrant-40);
66
-
67
- color: var(--dx-g-blue-vibrant-40);
68
- }
69
-
70
- .nav-list-item_small.state-active {
71
- --border-color: var(--dx-g-blue-vibrant-50);
72
-
73
- color: var(--dx-g-blue-vibrant-50);
74
- }
75
-
76
- .nav-list-item_default.state-active {
77
- background: var(--dx-g-brand-current-button-color-background-active);
78
- color: var(--dx-g-brand-current-color);
79
- }
80
-
81
- @media (max-width: 1160px) {
82
- .nav-list-item_small {
83
- --horizontal-spacing: var(--dx-g-spacing-smd);
84
- }
85
- }
86
-
87
- @media (max-width: 1090px) {
88
- .nav-list-item_small {
89
- --horizontal-spacing: var(--dx-g-spacing-sm);
90
- }
91
- }
@@ -1,9 +0,0 @@
1
- <template>
2
- <a if:true={href} class={className} href={href} onclick={sendGtm}>
3
- <span>{label}</span>
4
- </a>
5
- <button if:false={href} class={className}>
6
- <span>{label}</span>
7
- <dx-icon symbol="chevrondown" size={iconSize}></dx-icon>
8
- </button>
9
- </template>
@@ -1,31 +0,0 @@
1
- import { LightningElement, api } from "lwc";
2
- import { track } from "dx/instrumentation";
3
- import cx from "classnames";
4
- import { HeaderNavVariant } from "typings/custom";
5
-
6
- export default class HeaderNavOption extends LightningElement {
7
- @api isActive: boolean = false;
8
- @api label: string | null = null;
9
- @api href: string | null = null;
10
- @api variant: HeaderNavVariant = "default";
11
-
12
- private sendGtm(e: PointerEvent) {
13
- track(e.currentTarget!, "custEv_topNavLinkClick", {
14
- navHeading: this.label || undefined,
15
- clickText: this.href || undefined,
16
- pageLocation: window.location.pathname || undefined
17
- });
18
- }
19
-
20
- get className() {
21
- return cx(
22
- "nav-list-item",
23
- this.isActive && "state-active",
24
- `nav-list-item_${this.variant}`
25
- );
26
- }
27
-
28
- get iconSize() {
29
- return this.variant === "small" ? "xsmall" : "small";
30
- }
31
- }
@@ -1,11 +0,0 @@
1
- export const coveoConfig = {
2
- coveoOrganizationId: "coveosalesforcetestakshatha",
3
- coveoPublicAccessToken: "xx8d9c92ef-1018-4d92-a3c7-647dff01c21c",
4
- coveoSearchPipeline: "salesforcedevdoc",
5
- coveoSearchHub: "salesforcedevdoc"
6
- };
7
-
8
- export default {
9
- mobile: false,
10
- ...coveoConfig
11
- };
@@ -1,4 +0,0 @@
1
- export default {
2
- index: 0,
3
- groupId: "1"
4
- };
@@ -1,4 +0,0 @@
1
- export default {
2
- index: 0,
3
- groupId: "1"
4
- };
@@ -1,46 +0,0 @@
1
- import TabPanel from "dx/tabPanel";
2
- import { createRenderComponent } from "utils/tests";
3
- import mockProps from "./mockProps";
4
-
5
- const TAG = "dx-tab-panel";
6
- const render = createRenderComponent(TAG, TabPanel);
7
-
8
- describe(TAG, () => {
9
- it("renders an active panel", () => {
10
- const element = render({
11
- ...mockProps,
12
- active: true
13
- });
14
-
15
- const divEl = element.shadowRoot.querySelector("div");
16
- expect(divEl).not.toBeNull();
17
- // Using `startsWith` here instead of exactly matching the attribute
18
- // because something is auto-suffixing the id an incrementing `-${index}`
19
- expect(
20
- divEl.getAttribute("id").startsWith("tabs--1--panel--0")
21
- ).toEqual(true);
22
- expect(
23
- divEl.getAttribute("aria-labelledby").startsWith("tabs--1--tab--0")
24
- ).toEqual(true);
25
- expect(divEl.hasAttribute("hidden")).toEqual(false);
26
- expect(divEl.getAttribute("tabindex")).toEqual("0");
27
- expect(divEl.getAttribute("class")).toContain("tabpanel-active");
28
-
29
- return expect(element).toBeAccessible();
30
- });
31
-
32
- it("renders an inactive panel", () => {
33
- const element = render({
34
- ...mockProps,
35
- active: false
36
- });
37
-
38
- const divEl = element.shadowRoot.querySelector("div");
39
- expect(divEl).not.toBeNull();
40
- expect(divEl.hasAttribute("hidden")).toEqual(true);
41
- expect(divEl.getAttribute("tabindex")).toEqual("-1");
42
- expect(divEl.getAttribute("class")).not.toContain("tabpanel-active");
43
-
44
- return expect(element).toBeAccessible();
45
- });
46
- });
@@ -1,9 +0,0 @@
1
- @import "helpers/reset";
2
-
3
- .tabpanel {
4
- display: none;
5
- }
6
-
7
- .tabpanel-active {
8
- display: block;
9
- }
@@ -1,13 +0,0 @@
1
- <template>
2
- <div
3
- role="tabpanel"
4
- part="tabpanel"
5
- id={panelId}
6
- class={className}
7
- tabindex={activeTabIndex}
8
- aria-labelledby={tabId}
9
- hidden={panelHidden}
10
- >
11
- <slot></slot>
12
- </div>
13
- </template>