@salesforcedevs/dx-components 0.10.1-alpha.13 → 0.10.1-alpha.133

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 (55) hide show
  1. package/lwc.config.json +3 -1
  2. package/package.json +2 -2
  3. package/src/assets/svg/docs-empty-state-small.svg +72 -0
  4. package/src/assets/svg/sidebar-loading.svg +34 -0
  5. package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +78 -148
  6. package/src/modules/dx/codeBlock/codeBlock.stories.ts +2 -69
  7. package/src/modules/dx/codeBlock/codeBlock.ts +5 -1
  8. package/src/modules/dx/codeBlock/darkTheme.css +0 -1
  9. package/src/modules/dx/codeBlock/lightTheme.css +0 -1
  10. package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +29 -9
  11. package/src/modules/dx/emptyState/emptyState.css +14 -0
  12. package/src/modules/dx/emptyState/emptyState.html +2 -2
  13. package/src/modules/dx/emptyState/emptyState.stories.ts +8 -0
  14. package/src/modules/dx/emptyState/emptyState.ts +14 -0
  15. package/src/modules/dx/footer/links.ts +3 -5
  16. package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +2 -4
  17. package/src/modules/dx/headerNav/headerNav.html +8 -6
  18. package/src/modules/dx/headerNav/headerNav.ts +2 -2
  19. package/src/modules/dx/lazy/lazy.ts +0 -7
  20. package/src/modules/dx/newsletterForm/newsletterForm.html +5 -3
  21. package/src/modules/dx/searchResults/coveo.css +314 -111
  22. package/src/modules/dx/sidebar/__tests__/mockDocContent.ts +48 -0
  23. package/src/modules/dx/sidebar/__tests__/mockPageReference.ts +8 -0
  24. package/src/modules/dx/sidebar/sidebar.css +38 -17
  25. package/src/modules/dx/sidebar/sidebar.html +62 -58
  26. package/src/modules/dx/sidebar/sidebar.stories.ts +53 -54
  27. package/src/modules/dx/sidebar/sidebar.ts +99 -10
  28. package/src/modules/dx/sidebarSearch/__tests__/mockPreloadedState.ts +8843 -0
  29. package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +121 -0
  30. package/src/modules/dx/sidebarSearch/sidebarSearch.ts +282 -120
  31. package/src/modules/dx/sidebarSearch/utils.ts +2 -0
  32. package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +55 -0
  33. package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +12 -2
  34. package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +1 -1
  35. package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +8 -2
  36. package/src/modules/dx/spinner/__tests__/spinner.test.ts +37 -0
  37. package/src/modules/dx/spinner/spinner.css +750 -0
  38. package/src/modules/dx/spinner/spinner.html +6 -0
  39. package/src/modules/dx/spinner/spinner.stories.ts +69 -0
  40. package/src/modules/dx/spinner/spinner.ts +20 -0
  41. package/src/modules/dx/{headerNavOption/__tests__/headerNavOption.test.ts → tab/__tests__/tab.test.ts} +40 -24
  42. package/src/modules/dx/{headerNavOption/headerNavOption.css → tab/tab.css} +24 -9
  43. package/src/modules/dx/{headerNavOption/headerNavOption.html → tab/tab.html} +5 -1
  44. package/src/modules/dx/tab/tab.stories.ts +57 -0
  45. package/src/modules/dx/{headerNavOption/headerNavOption.ts → tab/tab.ts} +26 -5
  46. package/src/modules/helpers/table/table.css +23 -7
  47. package/src/modules/utils/coveo/coveo.ts +50 -12
  48. package/src/modules/utils/highlight/__tests__/highlight.test.ts +154 -0
  49. package/src/modules/utils/highlight/highlight.ts +32 -0
  50. package/src/modules/utils/jest/jest.ts +35 -0
  51. package/src/modules/utils/normalizers/normalizers.ts +3 -0
  52. package/src/modules/utils/recentSearches/__tests__/recentSearches.test.ts +79 -0
  53. package/src/modules/utils/recentSearches/recentSearches.ts +12 -17
  54. package/src/modules/utils/regexps/regexps.ts +5 -0
  55. package/src/modules/utils/tests/tests.ts +18 -11
@@ -7,10 +7,20 @@ a {
7
7
  flex-direction: column;
8
8
  }
9
9
 
10
+ .sidebar-item {
11
+ padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-md);
12
+ }
13
+
10
14
  .search-text {
11
15
  font-size: var(--dx-g-text-xs);
12
16
  font-family: var(--dx-g-font-sans);
13
17
  line-height: 18px;
18
+ overflow-wrap: break-word;
19
+ }
20
+
21
+ .description {
22
+ -webkit-line-clamp: 3;
23
+ overflow-wrap: break-word;
14
24
  }
15
25
 
16
26
  .title {
@@ -18,9 +28,9 @@ a {
18
28
  }
19
29
 
20
30
  .bold {
21
- font-weight: bold;
31
+ font-weight: 700;
22
32
  }
23
33
 
24
34
  a > *:not(:last-child) {
25
- margin-bottom: 6px;
35
+ margin-bottom: 2px;
26
36
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <a class="sidebar-item" href={href}>
2
+ <a class={className} href={href}>
3
3
  <span class="title search-text">
4
4
  <template for:each={titleChunks} for:item="chunk">
5
5
  <span class={chunk.class} key={chunk.id}>{chunk.value}</span>
@@ -1,4 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import cx from "classnames";
2
3
  import { CoveoHighlights } from "typings/custom";
3
4
 
4
5
  const toChunks = (value: string, highlights: CoveoHighlights) => {
@@ -34,11 +35,12 @@ const toChunks = (value: string, highlights: CoveoHighlights) => {
34
35
  };
35
36
 
36
37
  export default class SidebarSearchResult extends LightningElement {
37
- @api title!: string;
38
- @api titleHighlights!: CoveoHighlights;
39
38
  @api description!: string;
40
39
  @api descriptionHighlights!: CoveoHighlights;
41
40
  @api href!: string;
41
+ @api selected!: boolean;
42
+ @api title!: string;
43
+ @api titleHighlights!: CoveoHighlights;
42
44
 
43
45
  private get titleChunks() {
44
46
  return toChunks(this.title, this.titleHighlights);
@@ -47,4 +49,8 @@ export default class SidebarSearchResult extends LightningElement {
47
49
  private get descriptionChunks() {
48
50
  return toChunks(this.description, this.descriptionHighlights);
49
51
  }
52
+
53
+ private get className(): string {
54
+ return cx("sidebar-item", this.selected && "sidebar-item-selected");
55
+ }
50
56
  }
@@ -0,0 +1,37 @@
1
+ import Spinner from "dx/spinner";
2
+ import { createRenderComponent } from "utils/tests";
3
+
4
+ const TAG = "dx-spinner";
5
+ const render = createRenderComponent(TAG, Spinner);
6
+
7
+ describe(TAG, () => {
8
+ it("renders", () => {
9
+ const component: HTMLElement = render();
10
+
11
+ expect(component.classList).toHaveLength(1);
12
+ expect(component.classList).toContain("spinner_container");
13
+ const container = component.shadowRoot!.querySelector(".spinner");
14
+
15
+ expect(container).not.toBeNull();
16
+ expect(container?.classList).toHaveLength(2);
17
+ expect(container?.classList).toContain(`spinner_medium`);
18
+
19
+ return expect(component).toBeAccessible();
20
+ });
21
+
22
+ it("renders with size and variant", () => {
23
+ const size = "large";
24
+ const variant = "inverse";
25
+ const component: HTMLElement = render({
26
+ size,
27
+ variant
28
+ });
29
+
30
+ const container = component.shadowRoot?.querySelector(".spinner");
31
+ expect(container?.classList).toHaveLength(3);
32
+ expect(container?.classList).toContain(`spinner_${size}`);
33
+ expect(container?.classList).toContain(`spinner_${variant}`);
34
+
35
+ return expect(component).toBeAccessible();
36
+ });
37
+ });