@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.
- package/lwc.config.json +3 -3
- package/package.json +3 -4
- package/src/.DS_Store +0 -0
- package/src/assets/svg/docs-empty-state-small.svg +72 -0
- package/src/assets/svg/sidebar-loading.svg +34 -0
- package/src/modules/.DS_Store +0 -0
- package/src/modules/dx/.DS_Store +0 -0
- package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +78 -148
- package/src/modules/dx/cardGrid/cardGrid.css +0 -32
- package/src/modules/dx/cardGrid/cardGrid.html +5 -11
- package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +47 -5
- package/src/modules/dx/codeBlock/codeBlock.stories.ts +2 -69
- package/src/modules/dx/codeBlock/codeBlock.ts +43 -22
- package/src/modules/dx/codeBlock/darkTheme.css +0 -1
- package/src/modules/dx/codeBlock/lightTheme.css +0 -1
- package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +29 -10
- package/src/modules/dx/emptyState/__tests__/mockProps.ts +1 -3
- package/src/modules/dx/emptyState/emptyState.css +45 -13
- package/src/modules/dx/emptyState/emptyState.html +6 -4
- package/src/modules/dx/emptyState/emptyState.stories.ts +18 -38
- package/src/modules/dx/emptyState/emptyState.ts +11 -20
- package/src/modules/dx/footer/links.ts +3 -5
- package/src/modules/dx/header/__tests__/mockProps.ts +7 -1
- package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +2 -4
- package/src/modules/dx/headerNav/headerNav.html +8 -6
- package/src/modules/dx/headerNav/headerNav.ts +2 -2
- package/src/modules/dx/headerSearch/headerSearch.html +2 -4
- package/src/modules/dx/headerSearch/headerSearch.ts +19 -25
- package/src/modules/dx/newsletterForm/newsletterForm.html +5 -3
- package/src/modules/dx/popover/popover.ts +11 -7
- package/src/modules/dx/searchResults/coveo.css +314 -111
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -70
- package/src/modules/dx/sidebar/sidebar.css +42 -23
- package/src/modules/dx/sidebar/sidebar.html +62 -40
- package/src/modules/dx/sidebar/sidebar.stories.ts +54 -4
- package/src/modules/dx/sidebar/sidebar.ts +126 -66
- package/src/modules/dx/sidebarSearch/__tests__/preloadedState.ts +3459 -0
- package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +44 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.css +3 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.html +26 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +358 -0
- package/src/modules/dx/sidebarSearch/utils.ts +2 -0
- package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +55 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +36 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +14 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +56 -0
- package/src/modules/dx/spinner/__tests__/spinner.test.ts +37 -0
- package/src/modules/dx/spinner/spinner.css +750 -0
- package/src/modules/dx/spinner/spinner.html +6 -0
- package/src/modules/dx/spinner/spinner.stories.ts +69 -0
- package/src/modules/dx/spinner/spinner.ts +20 -0
- package/src/modules/dx/tab/__tests__/tab.test.ts +112 -54
- package/src/modules/dx/tab/tab.css +91 -16
- package/src/modules/dx/tab/tab.html +10 -12
- package/src/modules/dx/tab/tab.stories.ts +57 -0
- package/src/modules/dx/tab/tab.ts +35 -28
- package/src/modules/dx/tooltip/tippy.css +1 -0
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +1 -1
- package/src/modules/dx/treeTile/treeTile.css +3 -19
- package/src/modules/dx/treeTile/treeTile.html +4 -1
- package/src/modules/dx/treeTile/treeTile.ts +2 -2
- package/src/modules/helpers/sidebar/sidebar.css +21 -0
- package/src/modules/helpers/table/table.css +23 -7
- package/src/modules/utils/coveo/coveo.ts +60 -0
- package/src/modules/utils/highlight/highlight.ts +31 -0
- package/src/modules/utils/normalizers/normalizers.ts +3 -0
- package/src/modules/utils/recentSearches/__tests__/recentSearches.test.ts +79 -0
- package/src/modules/utils/recentSearches/recentSearches.ts +57 -0
- package/src/modules/utils/regexps/regexps.ts +5 -0
- package/LICENSE +0 -12
- package/src/modules/dx/headerNavOption/__tests__/headerNavOption.test.ts +0 -113
- package/src/modules/dx/headerNavOption/headerNavOption.css +0 -91
- package/src/modules/dx/headerNavOption/headerNavOption.html +0 -9
- package/src/modules/dx/headerNavOption/headerNavOption.ts +0 -31
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/tab/__tests__/mockProps.ts +0 -4
- package/src/modules/dx/tabPanel/__tests__/mockProps.ts +0 -4
- package/src/modules/dx/tabPanel/__tests__/tabPanel.test.ts +0 -46
- package/src/modules/dx/tabPanel/tabPanel.css +0 -9
- package/src/modules/dx/tabPanel/tabPanel.html +0 -13
- package/src/modules/dx/tabPanel/tabPanel.ts +0 -27
- package/src/modules/dx/tabs/__tests__/mockProps.ts +0 -3
- package/src/modules/dx/tabs/__tests__/tabs.test.ts +0 -47
- package/src/modules/dx/tabs/tabs.css +0 -7
- package/src/modules/dx/tabs/tabs.html +0 -21
- package/src/modules/dx/tabs/tabs.stories.ts +0 -74
- package/src/modules/dx/tabs/tabs.ts +0 -112
- package/src/modules/dx/tabs/uniqueId.ts +0 -6
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
<ul class="nav-list">
|
|
4
4
|
<template for:each={navItems} for:item="navItem">
|
|
5
5
|
<li key={navItem.id}>
|
|
6
|
-
<dx-
|
|
6
|
+
<dx-tab
|
|
7
7
|
if:false={navItem.options}
|
|
8
8
|
is-active={navItem.isActive}
|
|
9
9
|
label={navItem.label}
|
|
10
10
|
href={navItem.link.href}
|
|
11
11
|
variant={variant}
|
|
12
|
-
></dx-
|
|
12
|
+
></dx-tab>
|
|
13
13
|
|
|
14
14
|
<!-- DESKTOP "MORE CONTENT" NAV ITEM -->
|
|
15
15
|
<dx-dropdown
|
|
@@ -23,21 +23,23 @@
|
|
|
23
23
|
value={pathname}
|
|
24
24
|
value-path="link.href"
|
|
25
25
|
>
|
|
26
|
-
<dx-
|
|
26
|
+
<dx-tab
|
|
27
27
|
label={navItem.label}
|
|
28
28
|
variant={variant}
|
|
29
|
-
|
|
29
|
+
use-icon
|
|
30
|
+
></dx-tab>
|
|
30
31
|
</dx-dropdown>
|
|
31
32
|
|
|
32
33
|
<!-- MOBILE "MORE CONTENT" NAV ITEM -->
|
|
33
|
-
<dx-
|
|
34
|
+
<dx-tab
|
|
34
35
|
if:true={navItem.options}
|
|
35
36
|
class="nav-list-item-nav-menu"
|
|
36
37
|
data-id={navItem.id}
|
|
37
38
|
label={navItem.label}
|
|
39
|
+
use-icon
|
|
38
40
|
variant={variant}
|
|
39
41
|
onclick={requestOpenNavMenu}
|
|
40
|
-
></dx-
|
|
42
|
+
></dx-tab>
|
|
41
43
|
</li>
|
|
42
44
|
</template>
|
|
43
45
|
</ul>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import {
|
|
2
|
+
import { TabVariant, Option } from "typings/custom";
|
|
3
3
|
export default class HeaderNav extends LightningElement {
|
|
4
4
|
@api pathname: string | null = null;
|
|
5
|
-
@api variant:
|
|
5
|
+
@api variant: TabVariant = "default";
|
|
6
6
|
@api ariaLabel: string = "Navigation Bar";
|
|
7
7
|
|
|
8
8
|
@api
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
open={isDropdownOpen}
|
|
9
9
|
options={suggestions}
|
|
10
10
|
onrequestclose={onDropdownRequestClose}
|
|
11
|
-
onrequestopen={openPopover}
|
|
12
11
|
full-width
|
|
13
12
|
page-padding="0"
|
|
14
13
|
>
|
|
@@ -20,6 +19,7 @@
|
|
|
20
19
|
onchange={onInputChange}
|
|
21
20
|
onclear={onInputEscape}
|
|
22
21
|
onsubmit={onInputSubmit}
|
|
22
|
+
onfocus={openDropdown}
|
|
23
23
|
placeholder="Search"
|
|
24
24
|
size="override"
|
|
25
25
|
type="search"
|
|
@@ -43,10 +43,8 @@
|
|
|
43
43
|
open={isDropdownOpen}
|
|
44
44
|
placement="bottom-end"
|
|
45
45
|
onrequestclose={onDropdownRequestClose}
|
|
46
|
-
onrequestopen={openPopover}
|
|
47
46
|
offset="small"
|
|
48
47
|
full-width
|
|
49
|
-
temp-id="banana"
|
|
50
48
|
>
|
|
51
49
|
<dx-input
|
|
52
50
|
aria-label="Record Search Term"
|
|
@@ -54,7 +52,7 @@
|
|
|
54
52
|
onchange={onInputChange}
|
|
55
53
|
onclear={onInputEscape}
|
|
56
54
|
onsubmit={onInputSubmit}
|
|
57
|
-
onfocus={
|
|
55
|
+
onfocus={openDropdown}
|
|
58
56
|
placeholder="Search"
|
|
59
57
|
shortcut-key="k"
|
|
60
58
|
size="small"
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { PopoverRequestCloseType, Option } from "typings/custom";
|
|
4
|
+
import { buildSearchEngine } from "utils/coveo";
|
|
4
5
|
import {
|
|
5
|
-
HeadlessEngine,
|
|
6
6
|
StandaloneSearchBox as StandaloneSearchBoxType,
|
|
7
|
-
StandaloneSearchBoxOptions,
|
|
8
7
|
StandaloneSearchBoxState,
|
|
9
8
|
buildStandaloneSearchBox,
|
|
10
|
-
|
|
9
|
+
StandaloneSearchBoxOptions
|
|
11
10
|
} from "@coveo/headless";
|
|
12
11
|
|
|
13
12
|
const baseSearchHref = `/search`;
|
|
@@ -32,11 +31,11 @@ export default class HeaderSearch extends LightningElement {
|
|
|
32
31
|
private get suggestions(): Option[] {
|
|
33
32
|
if (this.searchState) {
|
|
34
33
|
return this.searchState.suggestions.map(
|
|
35
|
-
({
|
|
36
|
-
id:
|
|
37
|
-
label:
|
|
34
|
+
({ highlightedValue }: { highlightedValue: string }) => ({
|
|
35
|
+
id: highlightedValue,
|
|
36
|
+
label: highlightedValue,
|
|
38
37
|
link: {
|
|
39
|
-
href: this.createSearchHref(
|
|
38
|
+
href: this.createSearchHref(highlightedValue),
|
|
40
39
|
target: null
|
|
41
40
|
}
|
|
42
41
|
})
|
|
@@ -70,7 +69,7 @@ export default class HeaderSearch extends LightningElement {
|
|
|
70
69
|
switch (e.detail as PopoverRequestCloseType) {
|
|
71
70
|
case "interact-outside":
|
|
72
71
|
case "keypress-escape":
|
|
73
|
-
this.
|
|
72
|
+
this.closeDropdown();
|
|
74
73
|
break;
|
|
75
74
|
default:
|
|
76
75
|
break;
|
|
@@ -83,25 +82,20 @@ export default class HeaderSearch extends LightningElement {
|
|
|
83
82
|
redirectionUrl: "https://developer.salesforce.com"
|
|
84
83
|
};
|
|
85
84
|
|
|
86
|
-
const engine =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
pipeline: this.coveoSearchPipeline,
|
|
92
|
-
searchHub: this.coveoSearchHub
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
reducers: searchAppReducers
|
|
85
|
+
const engine = buildSearchEngine({
|
|
86
|
+
organizationId: this.coveoOrganizationId,
|
|
87
|
+
publicAccessToken: this.coveoPublicAccessToken,
|
|
88
|
+
searchPipeline: this.coveoSearchPipeline,
|
|
89
|
+
searchHub: this.coveoSearchHub
|
|
96
90
|
});
|
|
97
91
|
|
|
98
92
|
this.searchBox = buildStandaloneSearchBox(engine, { options });
|
|
99
|
-
|
|
93
|
+
|
|
94
|
+
this.searchBox?.subscribe(() => {
|
|
100
95
|
if (this.searchBox) {
|
|
101
96
|
this.searchState = this.searchBox.state;
|
|
102
97
|
}
|
|
103
98
|
});
|
|
104
|
-
this.searchBox.updateText("");
|
|
105
99
|
}
|
|
106
100
|
|
|
107
101
|
private createSearchHref = (value: string | null = "") => {
|
|
@@ -124,29 +118,29 @@ export default class HeaderSearch extends LightningElement {
|
|
|
124
118
|
const input = this.template.querySelector("dx-input");
|
|
125
119
|
if (this.isMobileSearchOpen && input) {
|
|
126
120
|
input.focus();
|
|
127
|
-
this.
|
|
121
|
+
this.openDropdown();
|
|
128
122
|
} else {
|
|
129
|
-
this.
|
|
123
|
+
this.closeDropdown();
|
|
130
124
|
}
|
|
131
125
|
if (!this.isMobileSearchOpen && this.searchBox) {
|
|
132
126
|
this.searchBox.updateText("");
|
|
133
127
|
}
|
|
134
128
|
}
|
|
135
129
|
|
|
136
|
-
private
|
|
130
|
+
private openDropdown() {
|
|
137
131
|
this.isDropdownOpen = true;
|
|
138
132
|
this.isMobileSearchOpen = true;
|
|
139
133
|
this.reportState<boolean>(true);
|
|
140
134
|
}
|
|
141
135
|
|
|
142
|
-
private
|
|
136
|
+
private closeDropdown() {
|
|
143
137
|
this.isDropdownOpen = false;
|
|
144
138
|
this.isMobileSearchOpen = false;
|
|
145
139
|
this.reportState<boolean>(false);
|
|
146
140
|
}
|
|
147
141
|
|
|
148
142
|
private onInputEscape() {
|
|
149
|
-
this.
|
|
143
|
+
this.closeDropdown();
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
private reportState<T>(state: T) {
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
onchange={handleChange}
|
|
5
5
|
onkeydown={handleKeyDown}
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<slot name="form-heading">
|
|
8
|
+
<h4 class="newsletter-form-heading dx-text-heading-8">
|
|
9
|
+
Sign up now to receive the newsletter.
|
|
10
|
+
</h4>
|
|
11
|
+
</slot>
|
|
10
12
|
<dx-input
|
|
11
13
|
name="fname"
|
|
12
14
|
value={firstName}
|
|
@@ -212,23 +212,27 @@ export default class Popover extends LightningElement {
|
|
|
212
212
|
};
|
|
213
213
|
|
|
214
214
|
private onControlClick = () => {
|
|
215
|
-
if (this.controlled) {
|
|
215
|
+
if (this.controlled && this.open) {
|
|
216
216
|
this.dispatchRequestCloseEvent("click-control");
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
if (this.controlled && !this.open) {
|
|
221
|
+
this.dispatchEvent(
|
|
222
|
+
new CustomEvent("requestopen", {
|
|
223
|
+
bubbles: true,
|
|
224
|
+
composed: true
|
|
225
|
+
})
|
|
226
|
+
);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
220
230
|
if (this.open) {
|
|
221
231
|
this.closePopover();
|
|
222
232
|
return;
|
|
223
233
|
}
|
|
224
234
|
|
|
225
235
|
this.openPopover();
|
|
226
|
-
this.dispatchEvent(
|
|
227
|
-
new CustomEvent("requestopen", {
|
|
228
|
-
bubbles: true,
|
|
229
|
-
composed: true
|
|
230
|
-
})
|
|
231
|
-
);
|
|
232
236
|
};
|
|
233
237
|
|
|
234
238
|
private onSlotChange(e: LightningSlotElement) {
|