@salesforcedevs/dx-components 1.3.289-tab-alpha → 1.3.295

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/LICENSE ADDED
@@ -0,0 +1,12 @@
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.289-tab-alpha",
3
+ "version": "1.3.295",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -45,5 +45,6 @@
45
45
  },
46
46
  "volta": {
47
47
  "node": "16.19.1"
48
- }
48
+ },
49
+ "gitHead": "28b69bedaad36b818efa7359c19cd88628a4b11d"
49
50
  }
@@ -2,42 +2,29 @@
2
2
 
3
3
  .tab {
4
4
  color: var(--dx-g-blue-vibrant-20);
5
- font-family: var(--dx-g-font-sans);
6
- font-size: var(--dx-g-text-base);
7
- font-weight: var(--dx-g-font-normal);
8
- line-height: var(--dx-g-spacing-lg);
9
- padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-lg);
5
+ font-family: var(--dx-g-font-display);
6
+ font-size: var(--dx-g-text-lg);
7
+ font-weight: var(--dx-g-font-bold);
8
+ padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-xl)
9
+ var(--dx-g-spacing-sm);
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;
13
13
  white-space: nowrap;
14
- margin-right: var(--dx-g-spacing-md);
15
- }
16
-
17
- button:focus {
18
- outline: none;
19
14
  }
20
15
 
21
16
  .tab:hover {
22
17
  background-color: var(--dx-g-blue-vibrant-95);
23
- color: var(--dx-g-blue-vibrant-20);
24
18
  }
25
19
 
26
20
  .tab-active {
27
21
  color: var(--dx-g-blue-vibrant-50);
28
- font-weight: var(--dx-g-font-bold);
29
22
  border-bottom: var(--dx-g-spacing-xs) solid var(--dx-g-blue-vibrant-50);
30
23
  }
31
24
 
32
- .tab-active:hover {
33
- border-bottom: var(--dx-g-spacing-xs) solid var(--dx-g-blue-vibrant-20);
34
- color: var(--dx-g-blue-vibrant-20);
35
- }
36
-
37
- .tab:focus-visible {
38
- background: var(--dx-g-cloud-blue-vibrant-95);
39
- color: var(--dx-g-blue-vibrant-20);
40
- outline: 2px solid var(--dx-g-blue-vibrant-60);
25
+ .tab:hover,
26
+ .tab-active {
27
+ font-weight: var(--dx-g-font-bold);
41
28
  }
42
29
 
43
30
  @media screen and (max-width: 640px) {
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  buildSearchEngine as _buildSearchEngine,
3
3
  SearchAppState,
4
- SearchEngineOptions
4
+ SearchEngineOptions,
5
+ getOrganizationEndpoints
5
6
  } from "@coveo/headless";
6
7
 
7
8
  export const buildSearchEngine = ({
@@ -24,7 +25,8 @@ export const buildSearchEngine = ({
24
25
  const configuration = {
25
26
  accessToken: publicAccessToken,
26
27
  organizationId,
27
- search
28
+ search,
29
+ organizationEndpoints: getOrganizationEndpoints(organizationId)
28
30
  };
29
31
 
30
32
  const engineConfiguration: SearchEngineOptions = preloadedState
@@ -1,62 +0,0 @@
1
- @import "dxHelpers/reset";
2
-
3
- /* DESKTOP */
4
-
5
- :host {
6
- --toggle-width: var(--dx-g-spacing-5xl);
7
- }
8
-
9
- .desktop_search-container {
10
- position: relative;
11
- display: flex;
12
- height: var(--dx-g-spacing-xl);
13
- font-size: var(--dx-g-text-sm);
14
- font-family: var(--dx-g-font-sans);
15
- color: var(--dx-g-gray-50);
16
- }
17
-
18
- .desktop_search-container dx-input {
19
- --dx-c-input-width: calc(
20
- var(--dx-c-header-search-width) - var(--toggle-width)
21
- );
22
- }
23
-
24
- /* MOBILE */
25
-
26
- .mobile_search-button {
27
- position: relative;
28
- z-index: 3;
29
- }
30
-
31
- .mobile_search-dropdown {
32
- --dx-c-popover-border-radius: 0;
33
- --dx-c-popover-border: none;
34
- }
35
-
36
- .mobile_search-input {
37
- position: absolute;
38
- top: 0;
39
- left: 0;
40
- height: 100%;
41
- width: 100%;
42
- transition: var(--dx-g-transition-hue-1x);
43
- opacity: 0;
44
- pointer-events: none;
45
-
46
- --dx-c-input-border: none;
47
- --dx-c-input-border-radius: 0;
48
- --dx-c-input-border-active: none;
49
- --dx-c-input-icon-color: var(--dx-g-blue-vibrant-20);
50
- --dx-c-input-padding: 0 var(--dx-g-spacing-4xl) 0 var(--dx-g-spacing-md);
51
- --dx-c-input-background: var(--dx-g-brand-current-color-background-2);
52
- --dx-c-input-background-active: var(
53
- --dx-g-brand-current-color-background-2
54
- );
55
- --dx-c-input-height: 100% !important;
56
- --dx-c-input-width: 100%;
57
- }
58
-
59
- .mobile_search-input.state-open {
60
- opacity: 1;
61
- pointer-events: auto;
62
- }
@@ -1,59 +0,0 @@
1
- <template>
2
- <div class={className} role="search" aria-label="Records Search">
3
- <!-- MOBILE -->
4
- <template if:true={mobile}>
5
- <dx-dropdown
6
- class="mobile_search-dropdown"
7
- open={isDropdownOpen}
8
- options={suggestions}
9
- onrequestclose={onDropdownRequestClose}
10
- full-width
11
- page-padding="0"
12
- >
13
- <dx-input
14
- class={mobileSearchInputClassName}
15
- icon-size="large"
16
- icon-symbol="search"
17
- onchange={onInputChange}
18
- onclear={onInputEscape}
19
- onsubmit={onInputSubmit}
20
- onfocus={openDropdown}
21
- placeholder="Search"
22
- size="override"
23
- type="search"
24
- ></dx-input>
25
- </dx-dropdown>
26
- <dx-button
27
- class="mobile_search-button"
28
- aria-label={mobileSearchButtonAriaLabel}
29
- icon-size="large"
30
- icon-symbol={mobileSearchButtonIcon}
31
- onclick={onMobileSearchButtonClick}
32
- variant="tertiary"
33
- ></dx-button>
34
- </template>
35
-
36
- <!-- DESKTOP -->
37
- <template if:false={mobile}>
38
- <dx-dropdown
39
- options={suggestions}
40
- open={isDropdownOpen}
41
- onrequestclose={onDropdownRequestClose}
42
- offset="small"
43
- full-width
44
- >
45
- <dx-input
46
- icon-symbol="search"
47
- onchange={onInputChange}
48
- onclear={onInputEscape}
49
- onsubmit={onInputSubmit}
50
- onfocus={openDropdown}
51
- placeholder="Search"
52
- shortcut-key="k"
53
- size="small"
54
- type="search"
55
- ></dx-input>
56
- </dx-dropdown>
57
- </template>
58
- </div>
59
- </template>
@@ -1,159 +0,0 @@
1
- import { LightningElement, api } from "lwc";
2
- import cx from "classnames";
3
- import { PopoverRequestCloseType, OptionWithLink } from "typings/custom";
4
- import { buildSearchEngine } from "dxUtils/coveo";
5
- import {
6
- StandaloneSearchBox as StandaloneSearchBoxType,
7
- StandaloneSearchBoxState,
8
- buildStandaloneSearchBox,
9
- StandaloneSearchBoxOptions
10
- } from "@coveo/headless";
11
-
12
- const baseSearchHref = `/search`;
13
-
14
- export default class HeaderSearch extends LightningElement {
15
- @api mobile!: boolean;
16
- @api coveoOrganizationId!: string;
17
- @api coveoPublicAccessToken!: string;
18
- @api coveoSearchPipeline!: string;
19
- @api coveoSearchHub!: string;
20
-
21
- private input: HTMLElement | null = null;
22
- private isDropdownOpen: boolean = false;
23
- private isMobileSearchOpen: boolean = false;
24
- private searchBox: StandaloneSearchBoxType | null = null;
25
- private searchState: StandaloneSearchBoxState | null = null;
26
-
27
- private get className() {
28
- return this.mobile ? null : "desktop_search-container";
29
- }
30
-
31
- private get suggestions(): OptionWithLink[] {
32
- if (this.searchState) {
33
- return this.searchState.suggestions.map(
34
- ({ highlightedValue }: { highlightedValue: string }) => ({
35
- id: highlightedValue,
36
- label: highlightedValue,
37
- link: {
38
- href: this.createSearchHref(highlightedValue),
39
- target: null
40
- }
41
- })
42
- );
43
- }
44
- return [];
45
- }
46
-
47
- private get mobileSearchInputClassName() {
48
- return cx(
49
- "mobile_search-input",
50
- this.isMobileSearchOpen && "state-open"
51
- );
52
- }
53
-
54
- private get mobileSearchButtonIcon() {
55
- return this.isMobileSearchOpen ? "close" : "search";
56
- }
57
-
58
- private get mobileSearchButtonAriaLabel() {
59
- return this.isMobileSearchOpen
60
- ? "Hide mobile search"
61
- : "Show mobile search";
62
- }
63
-
64
- connectedCallback() {
65
- this.instantiateSearchbox();
66
- }
67
-
68
- private onDropdownRequestClose(e: CustomEvent) {
69
- switch (e.detail as PopoverRequestCloseType) {
70
- case "interact-outside":
71
- case "keypress-escape":
72
- this.closeDropdown();
73
- break;
74
- default:
75
- break;
76
- }
77
- }
78
-
79
- private instantiateSearchbox() {
80
- try {
81
- const options: StandaloneSearchBoxOptions = {
82
- numberOfSuggestions: 3,
83
- redirectionUrl: "https://developer.salesforce.com"
84
- };
85
-
86
- const engine = buildSearchEngine({
87
- organizationId: this.coveoOrganizationId,
88
- publicAccessToken: this.coveoPublicAccessToken,
89
- searchPipeline: this.coveoSearchPipeline,
90
- searchHub: this.coveoSearchHub
91
- });
92
-
93
- this.searchBox = buildStandaloneSearchBox(engine, { options });
94
-
95
- this.searchBox?.subscribe(() => {
96
- if (this.searchBox) {
97
- this.searchState = this.searchBox.state;
98
- }
99
- });
100
- } catch (e) {
101
- console.error(`Coveo searchbox failed to initialize (${e})`);
102
- }
103
- }
104
-
105
- private createSearchHref = (value: string | null = "") => {
106
- return `${baseSearchHref}#q=${value}`;
107
- };
108
-
109
- private onInputChange(e: CustomEvent) {
110
- if (this.searchBox) {
111
- this.searchBox.updateText(e.detail);
112
- }
113
- }
114
-
115
- private onInputSubmit(e: CustomEvent) {
116
- const href = this.createSearchHref(e.detail || "");
117
- window.location.assign(href);
118
- }
119
-
120
- private onMobileSearchButtonClick() {
121
- this.isMobileSearchOpen = !this.isMobileSearchOpen;
122
- const input = this.template.querySelector("dx-input");
123
- if (this.isMobileSearchOpen && input) {
124
- input.focus();
125
- this.openDropdown();
126
- } else {
127
- this.closeDropdown();
128
- }
129
- if (!this.isMobileSearchOpen && this.searchBox) {
130
- this.searchBox.updateText("");
131
- }
132
- }
133
-
134
- private openDropdown() {
135
- this.isDropdownOpen = true;
136
- this.isMobileSearchOpen = true;
137
- this.reportState<boolean>(true);
138
- }
139
-
140
- private closeDropdown() {
141
- this.isDropdownOpen = false;
142
- this.isMobileSearchOpen = false;
143
- this.reportState<boolean>(false);
144
- }
145
-
146
- private onInputEscape() {
147
- this.closeDropdown();
148
- }
149
-
150
- private reportState<T>(state: T) {
151
- this.dispatchEvent(
152
- new CustomEvent("statechange", {
153
- detail: state,
154
- bubbles: true,
155
- composed: true
156
- })
157
- );
158
- }
159
- }