@salesforcedevs/arch-components 1.20.17-alpha2 → 1.20.17-alpha4

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 (77) hide show
  1. package/package.json +1 -1
  2. package/src/modules/common/context/context.ts +14 -14
  3. package/src/modules/common/effectAdapter/__tests__/effectAdapter.test.ts +4 -4
  4. package/src/modules/common/effectAdapter/effectAdapter.ts +13 -7
  5. package/src/modules/common/reflectedElement/__tests__/reflectedElement.test.ts +5 -5
  6. package/src/modules/common/reflectedElement/reflectedElement.ts +1 -1
  7. package/src/modules/common/slot/__tests__/slot.test.ts +12 -12
  8. package/src/modules/common/slot/slot.ts +4 -3
  9. package/src/modules/sa/coverage/coverage.ts +14 -18
  10. package/src/modules/sa/coverage/types.d.ts +12 -12
  11. package/src/modules/sa/explorer/explorer.ts +25 -25
  12. package/src/modules/sa/gallery/gallery.ts +11 -11
  13. package/src/modules/shared/a11y/a11y.ts +5 -5
  14. package/src/modules/shared/color/color.ts +13 -13
  15. package/src/modules/shared/fetch/fetch.ts +6 -6
  16. package/src/modules/shared/helpers/helpers.ts +6 -6
  17. package/src/modules/shared/i18n/i18n.ts +1 -1
  18. package/src/modules/shared/labels/__tests__/helpers.test.ts +3 -3
  19. package/src/modules/shared/labels/__tests__/pointHelpers.test.ts +3 -3
  20. package/src/modules/shared/labels/__tests__/timeHelpers.test.ts +8 -8
  21. package/src/modules/shared/labels/helpers.ts +4 -4
  22. package/src/modules/shared/labels/pointHelpers.ts +2 -2
  23. package/src/modules/shared/labels/timeHelpers.ts +3 -3
  24. package/src/modules/shared/menu/menu.ts +22 -22
  25. package/src/modules/shared/polling-request.ts +2 -2
  26. package/src/modules/shared/testutils.ts +4 -4
  27. package/src/modules/shared/useEffectAttr.ts +5 -5
  28. package/src/modules/tds/appLauncher/__tests__/appLauncher.test.ts +8 -8
  29. package/src/modules/tds/appLauncher/appLauncher.ts +6 -6
  30. package/src/modules/tds/avatar/__tests__/avatar.test.ts +1 -1
  31. package/src/modules/tds/button/__tests__/button.test.ts +5 -5
  32. package/src/modules/tds/buttonIcon/__tests__/buttonIcon.test.ts +1 -1
  33. package/src/modules/tds/buttonLink/__tests__/buttonLink.test.ts +1 -1
  34. package/src/modules/tds/childSummary/childSummary.ts +2 -2
  35. package/src/modules/tds/contentChildListItem/__tests__/contentChildListItem.test.ts +2 -2
  36. package/src/modules/tds/contentIcon/contentIcon.ts +1 -1
  37. package/src/modules/tds/footerLinks/__tests__/footerLinks.test.ts +2 -2
  38. package/src/modules/tds/headerAvatar/__tests__/headerAvatar.test.ts +4 -4
  39. package/src/modules/tds/headerAvatar/headerAvatar.ts +5 -5
  40. package/src/modules/tds/headerHelpButton/__tests__/headerHelpButton.test.ts +2 -2
  41. package/src/modules/tds/heading/__tests__/heading.test.ts +7 -7
  42. package/src/modules/tds/icon/icon.ts +11 -11
  43. package/src/modules/tds/radio/__tests__/radio.test.ts +1 -1
  44. package/src/modules/tds/search/__tests__/search.test.ts +17 -17
  45. package/src/modules/tds/search/lib/__tests__/listbox.test.ts +16 -16
  46. package/src/modules/tds/search/lib/listbox.ts +16 -16
  47. package/src/modules/tds/search/search.ts +10 -10
  48. package/src/modules/tds/select/__tests__/select.test.ts +1 -1
  49. package/src/modules/tds/summary/__tests__/summary.test.ts +16 -16
  50. package/src/modules/tds/summary/summary.ts +2 -2
  51. package/src/modules/tds/themeProvider/themeProvider.ts +4 -4
  52. package/src/modules/th/favoriteButton/__tests__/favoriteButton.test.ts +1 -1
  53. package/src/modules/th/favoriteButton/mocks/index.ts +2 -2
  54. package/src/modules/th/search/__tests__/search.test.ts +2 -2
  55. package/src/modules/th/search/mocks/index.ts +1 -1
  56. package/src/modules/th/search/search.ts +21 -21
  57. package/src/modules/tm/card/card.ts +15 -15
  58. package/src/modules/tm/content/content.ts +11 -11
  59. package/src/modules/tm/endCapA/__tests__/endCapA.test.ts +2 -2
  60. package/src/modules/tm/eventsA/eventsA.ts +1 -1
  61. package/src/modules/tm/faqA/faqA.ts +4 -4
  62. package/src/modules/tm/featureGridA/__tests__/featureGridA.test.ts +2 -2
  63. package/src/modules/tm/footnote/footnote.ts +1 -1
  64. package/src/modules/tm/heroA/__tests__/heroA.test.ts +2 -2
  65. package/src/modules/tm/heroA/heroA.ts +3 -3
  66. package/src/modules/tm/promoA/__tests__/promoA.test.ts +3 -3
  67. package/src/modules/tm/promoA/promoA.ts +4 -4
  68. package/src/modules/tm/sectionA/sectionA.ts +1 -1
  69. package/src/modules/tm/utils/utils.ts +5 -5
  70. package/src/modules/tm/youtube/youtube.ts +2 -2
  71. package/src/modules/ui/focusTrap/focusTrap.ts +7 -7
  72. package/src/modules/ui/focusVisible/focusVisible.ts +7 -7
  73. package/src/modules/th/tbid/__tests__/__snapshots__/tbid.test.ts.snap +0 -3
  74. package/src/modules/th/tbid/__tests__/tbid.test.ts +0 -242
  75. package/src/modules/th/tbid/tbid.html +0 -1
  76. package/src/modules/th/tbid/tbid.stories.mdx +0 -25
  77. package/src/modules/th/tbid/tbid.ts +0 -215
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/arch-components",
3
- "version": "1.20.17-alpha2",
3
+ "version": "1.20.17-alpha4",
4
4
  "description": "Architecture Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -86,23 +86,11 @@ export function createContextAdapter<Value, Config extends Record<string, any>,
86
86
  function compactConfig<T>(config?: T) {
87
87
  return Object.fromEntries(
88
88
  Object.entries({ ...config }).filter(
89
- ([key, value]) => typeof value !== 'undefined' && value !== null
89
+ ([, value]) => typeof value !== 'undefined' && value !== null
90
90
  )
91
91
  );
92
92
  }
93
93
 
94
- export function createBaseContextProviderElement<Value, Config extends Record<string, any>, Context extends Record<string, any>>(
95
- adapterClass: ContextWireAdapterConstructor<Value, Config, Context>
96
- ) {
97
- const contextualizer = createContextProvider(adapterClass as any);
98
-
99
- return class ProviderElement extends BaseProvider<Context> {
100
- public get contextualizer() {
101
- return contextualizer as Contextualizer<Context>;
102
- }
103
- };
104
- }
105
-
106
94
  class BaseProvider<Context extends Record<string, any>> extends LightningElement {
107
95
  public consumers = new Set<ContextConsumer<Context>>();
108
96
 
@@ -114,7 +102,7 @@ class BaseProvider<Context extends Record<string, any>> extends LightningElement
114
102
  localContext: '$localContext'
115
103
  })
116
104
  public updateConsumers({ localContext }: { localContext: Context }) {
117
- for (let consumer of this.consumers) {
105
+ for (const consumer of this.consumers) {
118
106
  consumer.provide(localContext);
119
107
  }
120
108
  }
@@ -135,3 +123,15 @@ class BaseProvider<Context extends Record<string, any>> extends LightningElement
135
123
  });
136
124
  }
137
125
  }
126
+
127
+ export function createBaseContextProviderElement<Value, Config extends Record<string, any>, Context extends Record<string, any>>(
128
+ adapterClass: ContextWireAdapterConstructor<Value, Config, Context>
129
+ ) {
130
+ const contextualizer = createContextProvider(adapterClass as any);
131
+
132
+ return class ProviderElement extends BaseProvider<Context> {
133
+ public get contextualizer() {
134
+ return contextualizer as Contextualizer<Context>;
135
+ }
136
+ };
137
+ }
@@ -2,10 +2,10 @@ import { EffectAdapter } from '../effectAdapter';
2
2
 
3
3
  describe('EffectAdapter', () => {
4
4
  it('calls the handler', async () => {
5
- let value = Symbol();
6
- let setValue = jest.fn();
7
- let adapter = new EffectAdapter(setValue);
8
- let config = { value: value };
5
+ const value = Symbol();
6
+ const setValue = jest.fn();
7
+ const adapter = new EffectAdapter(setValue);
8
+ const config = { value: value };
9
9
  adapter.update(config);
10
10
  expect(setValue).toHaveBeenCalledWith(config);
11
11
  });
@@ -1,18 +1,24 @@
1
1
  import { WireAdapter } from 'lwc';
2
2
 
3
- export type EffectAdapterConfig<T> = {};
3
+ export type EffectAdapterConfig = {};
4
4
 
5
- export class EffectAdapter<T>
5
+ export class EffectAdapter
6
6
  implements
7
- WireAdapter<EffectAdapterConfig<T>, Record<string, any>>
7
+ WireAdapter<EffectAdapterConfig, Record<string, any>>
8
8
  {
9
- constructor(private setValue: (value: EffectAdapterConfig<T>) => void) {}
9
+ constructor(private setValue: (value: EffectAdapterConfig) => void) {
10
+ // Constructor required for WireAdapter interface
11
+ }
10
12
 
11
- connect() {}
13
+ connect() {
14
+ // Required by WireAdapter interface
15
+ }
12
16
 
13
- disconnect() {}
17
+ disconnect() {
18
+ // Required by WireAdapter interface
19
+ }
14
20
 
15
- update(config: EffectAdapterConfig<T>) {
21
+ update(config: EffectAdapterConfig) {
16
22
  this.setValue(config);
17
23
  }
18
24
  }
@@ -16,7 +16,7 @@ describe('reflected-element', () => {
16
16
 
17
17
  // Skip these snapshot tests as LWC slot content doesn't render consistently in tests
18
18
  it.skip('reflects the innerHTML', async () => {
19
- let element = renderIntoBody(
19
+ const element = renderIntoBody(
20
20
  html`
21
21
  <test-select>
22
22
  <option value="a">A</option>
@@ -31,7 +31,7 @@ describe('reflected-element', () => {
31
31
  }, 10000);
32
32
 
33
33
  it.skip('transforms the innerHTML', async () => {
34
- let element = renderIntoBody(
34
+ const element = renderIntoBody(
35
35
  html`
36
36
  <test-select-transform>
37
37
  <option value="a">A</option>
@@ -46,14 +46,14 @@ describe('reflected-element', () => {
46
46
  }, 10000);
47
47
 
48
48
  it('renders components with reflected innerHTML', async () => {
49
- let element = renderIntoBody(html`<test-select></test-select>`);
49
+ const element = renderIntoBody(html`<test-select></test-select>`);
50
50
  await new Promise((resolve) => setTimeout(resolve, 50));
51
51
  expect(element).toBeTruthy();
52
52
  expect(element.shadowRoot!.querySelector('select')).toBeTruthy();
53
53
  }, 10000);
54
54
 
55
55
  it('calls innerHTMLSetCallback', async () => {
56
- let element = renderIntoBody(
56
+ const element = renderIntoBody(
57
57
  html`
58
58
  <test-select-transform>
59
59
  <option value="a">A</option>
@@ -70,6 +70,6 @@ describe('reflected-element', () => {
70
70
  // Due to LWC slot limitations, the count might be 1 or 4
71
71
  // Just verify the callback was called (count attribute exists)
72
72
  expect(select).toHaveAttribute('data-count');
73
- expect(parseInt(count!)).toBeGreaterThan(0);
73
+ expect(parseInt(count!, 10)).toBeGreaterThan(0);
74
74
  }, 10000);
75
75
  });
@@ -15,7 +15,7 @@ export class ReflectedElement extends LightningElement {
15
15
  }
16
16
 
17
17
  connectedCallback() {
18
- this.observer = new MutationObserver((e) => {
18
+ this.observer = new MutationObserver(() => {
19
19
  this.setContent();
20
20
  });
21
21
  this.observer.observe(this.template.host, {
@@ -35,13 +35,13 @@ customElements.define(
35
35
  describe('isSlotAssigned', () => {
36
36
  describe('false', () => {
37
37
  it('test-a', () => {
38
- let element = renderIntoBody(html` <test-a></test-a> `);
39
- let slot = element.shadowRoot!.querySelector('slot')!;
38
+ const element = renderIntoBody(html` <test-a></test-a> `);
39
+ const slot = element.shadowRoot!.querySelector('slot')!;
40
40
  expect(isSlotAssigned(slot)).toBe(false);
41
41
  });
42
42
  it('test-b', () => {
43
- let element = renderIntoBody(html` <test-a></test-a> `);
44
- let slot = element
43
+ const element = renderIntoBody(html` <test-a></test-a> `);
44
+ const slot = element
45
45
  .shadowRoot!.querySelector('test-b')!
46
46
  .shadowRoot!.querySelector('slot')!;
47
47
  expect(isSlotAssigned(slot)).toBe(false);
@@ -49,21 +49,21 @@ describe('isSlotAssigned', () => {
49
49
  });
50
50
  describe('true', () => {
51
51
  it('test-a', () => {
52
- let element = renderIntoBody(html`
52
+ const element = renderIntoBody(html`
53
53
  <test-a>
54
54
  <h1>Hello</h1>
55
55
  </test-a>
56
56
  `);
57
- let slot = element.shadowRoot!.querySelector('slot')!;
57
+ const slot = element.shadowRoot!.querySelector('slot')!;
58
58
  expect(isSlotAssigned(slot)).toBe(true);
59
59
  });
60
60
  it('test-b', () => {
61
- let element = renderIntoBody(html`
61
+ const element = renderIntoBody(html`
62
62
  <test-a>
63
63
  <h1>Hello</h1>
64
64
  </test-a>
65
65
  `);
66
- let slot = element
66
+ const slot = element
67
67
  .shadowRoot!.querySelector('test-b')!
68
68
  .shadowRoot!.querySelector('slot')!;
69
69
  expect(isSlotAssigned(slot)).toBe(true);
@@ -73,23 +73,23 @@ describe('isSlotAssigned', () => {
73
73
 
74
74
  describe('assignedSlotNames', () => {
75
75
  it('test-a', () => {
76
- let element = renderIntoBody(html`
76
+ const element = renderIntoBody(html`
77
77
  <test-a>
78
78
  <h1>Hello</h1>
79
79
  <header slot="header"></header>
80
80
  </test-a>
81
81
  `);
82
- let shadowRoot = element.shadowRoot!;
82
+ const shadowRoot = element.shadowRoot!;
83
83
  expect(assignedSlotNames(shadowRoot)).toEqual(['default', 'header']);
84
84
  });
85
85
  it('test-b', () => {
86
- let element = renderIntoBody(html`
86
+ const element = renderIntoBody(html`
87
87
  <test-a>
88
88
  <h1>Hello</h1>
89
89
  <header slot="header"></header>
90
90
  </test-a>
91
91
  `);
92
- let shadowRoot =
92
+ const shadowRoot =
93
93
  element.shadowRoot!.querySelector('test-b')!.shadowRoot!;
94
94
  expect(assignedSlotNames(shadowRoot)).toEqual(['default', 'header']);
95
95
  });
@@ -1,7 +1,7 @@
1
1
  export function assignedSlotNames(template: {
2
2
  querySelectorAll(selector: string): NodeList;
3
3
  }) {
4
- let slots = Array.from(
4
+ const slots = Array.from(
5
5
  template.querySelectorAll('slot')
6
6
  ) as HTMLSlotElement[];
7
7
  return slots
@@ -10,10 +10,11 @@ export function assignedSlotNames(template: {
10
10
  }
11
11
 
12
12
  export function isSlotAssigned(slot: HTMLSlotElement): boolean {
13
- let [element] = slot.assignedElements();
13
+ const [element] = slot.assignedElements();
14
14
  if (element) {
15
- if (element.tagName === 'SLOT')
15
+ if (element.tagName === 'SLOT') {
16
16
  return isSlotAssigned(element as HTMLSlotElement);
17
+ }
17
18
  return true;
18
19
  }
19
20
  return slot.children.length > 0;
@@ -1,5 +1,5 @@
1
1
  import { LightningElement, api, track } from 'lwc';
2
- import { ProductArea, FeatureArea, RoadmapFeature } from './types';
2
+ import { ProductArea, RoadmapFeature } from './types';
3
3
 
4
4
  export default class coverage extends LightningElement {
5
5
 
@@ -35,17 +35,13 @@ export default class coverage extends LightningElement {
35
35
  inactiveHover: string = '#d3d3d3';
36
36
  selectedPA: ProductArea | undefined;
37
37
 
38
- constructor() {
39
- super();
40
- }
41
-
42
38
  /// this function fires when a component is inserted into the DOM
43
39
  /// we use this function to collect initial data and set up the page:
44
40
  /// gets product and feature json data
45
41
  /// gets roadmap feature data
46
42
  /// adds the chartjs library
47
43
  async connectedCallback() {
48
-
44
+ // Override in subclasses
49
45
  }
50
46
 
51
47
  setupCharts() {
@@ -62,11 +58,11 @@ export default class coverage extends LightningElement {
62
58
  }, 0);
63
59
 
64
60
  // now update the coverage values in the portfolio data
65
- this.paCoverageCount = this.portfolioData.filter(pa => pa.covered == true).length;
61
+ this.paCoverageCount = this.portfolioData.filter(pa => pa.covered === true).length;
66
62
  this.paCoveragePct = this.paCoverageCount / this.totalProductAreas * 100;
67
63
 
68
64
  // add the chartsjs library to the dom
69
- var script = document.createElement('script');
65
+ const script = document.createElement('script');
70
66
  script.src = 'https://cdn.jsdelivr.net/npm/chart.js';
71
67
  document.head.appendChild(script);
72
68
  script.onload = () => {
@@ -136,7 +132,7 @@ export default class coverage extends LightningElement {
136
132
  title: function(context: any) {
137
133
  return context.label;
138
134
  },
139
- label: function(context: any) {
135
+ label: function(_context: any) {
140
136
  return '';
141
137
  }
142
138
  }
@@ -163,8 +159,8 @@ export default class coverage extends LightningElement {
163
159
  (window as any).Chart.register({
164
160
  id: 'center-label',
165
161
  afterDatasetsDraw: function(chart: any) {
166
- if (chart.config.type == 'doughnut') {
167
- var text = chart.config.options.plugins.title.text;
162
+ if (chart.config.type === 'doughnut') {
163
+ const text = chart.config.options.plugins.title.text;
168
164
  const ctx = chart.ctx;
169
165
  ctx.save();
170
166
  const x = chart.getDatasetMeta(0).data[0].x;
@@ -195,7 +191,7 @@ export default class coverage extends LightningElement {
195
191
  return this.getFeatureAreaChartForEntirePortfolio();
196
192
  }
197
193
 
198
- let dataVal = 100/this.selectedPA.feature_areas.length;
194
+ const dataVal = 100/this.selectedPA.feature_areas.length;
199
195
  return {
200
196
  labels: [`${this.selectedPA.feature_areas_covered} of ${this.selectedPA.feature_areas.length}`],
201
197
  datasets: this.selectedPA.feature_areas.map(fa => ({
@@ -261,16 +257,16 @@ export default class coverage extends LightningElement {
261
257
  title: function(context: any) {
262
258
  if (context[0].label.includes(' of ')){
263
259
  return context[0].dataset.label;
264
- } else {
260
+ }
265
261
  return context.label;
266
- }
262
+
267
263
  },
268
264
  label: function(context: any) {
269
265
  if (context.dataset.label) {
270
266
  return '';
271
- } else {
267
+ }
272
268
  return `${context.formattedValue}%`;
273
- }
269
+
274
270
  }
275
271
  }
276
272
  }
@@ -307,7 +303,7 @@ export default class coverage extends LightningElement {
307
303
  selectedIndex = chart.config.data.labels.indexOf(this._selected) as number;
308
304
 
309
305
  // check if there is a selection
310
- if (selectedIndex != -1) {
306
+ if (selectedIndex !== -1) {
311
307
  // hide the center value
312
308
  chart.config.options.plugins.title.text = '';
313
309
 
@@ -357,7 +353,7 @@ export default class coverage extends LightningElement {
357
353
  }
358
354
 
359
355
  // check if there is a product area selected
360
- if (this.selectedPA && this._selected != '') {
356
+ if (this.selectedPA && this._selected !== '') {
361
357
  chart.config.data = this.getFeatureAreaChartForSelectedProductArea();
362
358
  } else {
363
359
  chart.config.data = this.getFeatureAreaChartForEntirePortfolio();
@@ -1,11 +1,7 @@
1
- export type ProductArea = {
2
- name: string;
3
- colors: Colors;
4
- covered: boolean;
5
- feature_areas_covered: number;
6
- feature_area_coverage: number;
7
- feature_areas: FeatureArea[];
8
- };
1
+ export type Colors = {
2
+ xlight: string;
3
+ light: string;
4
+ }
9
5
 
10
6
  export type FeatureArea = {
11
7
  name: string;
@@ -16,10 +12,14 @@ export type FeatureArea = {
16
12
  features: string[];
17
13
  }
18
14
 
19
- export type Colors = {
20
- xlight: string;
21
- light: string;
22
- }
15
+ export type ProductArea = {
16
+ name: string;
17
+ colors: Colors;
18
+ covered: boolean;
19
+ feature_areas_covered: number;
20
+ feature_area_coverage: number;
21
+ feature_areas: FeatureArea[];
22
+ };
23
23
 
24
24
  export type RoadmapFeature = {
25
25
  [key: string]: any;
@@ -99,20 +99,20 @@ export default class Explorer extends LightningElement {
99
99
  private sortPatterns(arr: any[]) {
100
100
  return arr.sort((a, b) => {
101
101
  // Compare by CapabilityWeight
102
- if (a.CapabilityWeight > b.CapabilityWeight) return -1;
103
- if (a.CapabilityWeight < b.CapabilityWeight) return 1;
102
+ if (a.CapabilityWeight > b.CapabilityWeight) {return -1;}
103
+ if (a.CapabilityWeight < b.CapabilityWeight) {return 1;}
104
104
 
105
105
  // If CapabilityWeight is equal, compare by BehaviorWeight
106
- if (a.BehaviorWeight > b.BehaviorWeight) return -1;
107
- if (a.BehaviorWeight < b.BehaviorWeight) return 1;
106
+ if (a.BehaviorWeight > b.BehaviorWeight) {return -1;}
107
+ if (a.BehaviorWeight < b.BehaviorWeight) {return 1;}
108
108
 
109
109
  // If BehaviorWeight is equal, compare by DimensionWeight
110
- if (a.DimensionWeight > b.DimensionWeight) return -1;
111
- if (a.DimensionWeight < b.DimensionWeight) return 1;
110
+ if (a.DimensionWeight > b.DimensionWeight) {return -1;}
111
+ if (a.DimensionWeight < b.DimensionWeight) {return 1;}
112
112
 
113
113
  // If DimensionWeight is equal, compare by ConsiderationWeight
114
- if (a.ConsiderationWeight > b.ConsiderationWeight) return -1;
115
- if (a.ConsiderationWeight < b.ConsiderationWeight) return 1;
114
+ if (a.ConsiderationWeight > b.ConsiderationWeight) {return -1;}
115
+ if (a.ConsiderationWeight < b.ConsiderationWeight) {return 1;}
116
116
 
117
117
  // If all properties are equal, consider the elements equal in this sort context
118
118
  return 0;
@@ -165,25 +165,25 @@ export default class Explorer extends LightningElement {
165
165
 
166
166
  filterChange(evt: any) {
167
167
  if (evt.detail == "-1")
168
- return;
169
- else {
170
- let newFilter: Filter = {
168
+ {return;}
169
+
170
+ const newFilter: Filter = {
171
171
  Type: evt.target.id,
172
172
  Name: evt.detail
173
173
  };
174
174
  // Check if the filter already exists in the array
175
- let filterExists = this.selectedFilters.some(filter => filter.Type === newFilter.Type && filter.Name === newFilter.Name);
175
+ const filterExists = this.selectedFilters.some(filter => filter.Type === newFilter.Type && filter.Name === newFilter.Name);
176
176
  if (!filterExists) {
177
177
  this.selectedFilters.push(newFilter);
178
178
  this.setDimensionOption(newFilter.Type, newFilter.Name, true);
179
179
  }
180
180
 
181
181
  this.applyFilters();
182
- }
182
+
183
183
  }
184
184
 
185
185
  removeFilter(evt: any) {
186
- let index = this.selectedFilters.findIndex(filter => filter.Name === evt.target.innerText);
186
+ const index = this.selectedFilters.findIndex(filter => filter.Name === evt.target.innerText);
187
187
  this.setDimensionOption(this.selectedFilters[index].Type, this.selectedFilters[index].Name, false);
188
188
  this.selectedFilters.splice(index, 1);
189
189
  this.applyFilters();
@@ -205,9 +205,9 @@ export default class Explorer extends LightningElement {
205
205
  try {
206
206
  this.filteredPatterns = [...this.allPatterns];
207
207
  this.filteredAntiPatterns = [...this.allAntiPatterns];
208
- let frameworkFilters = this.selectedFilters.filter(filter => filter.Type !== 'Location' && filter.Type !== 'ProductArea');
209
- let locationFilters = this.selectedFilters.filter(filter => filter.Type === 'Location');
210
- let productAreaFilters = this.selectedFilters.filter(filter => filter.Type === 'ProductArea');
208
+ const frameworkFilters = this.selectedFilters.filter(filter => filter.Type !== 'Location' && filter.Type !== 'ProductArea');
209
+ const locationFilters = this.selectedFilters.filter(filter => filter.Type === 'Location');
210
+ const productAreaFilters = this.selectedFilters.filter(filter => filter.Type === 'ProductArea');
211
211
 
212
212
  if (frameworkFilters.length > 0) {
213
213
  this.filteredPatterns = this.filteredPatterns.filter(pattern =>
@@ -296,13 +296,13 @@ export default class Explorer extends LightningElement {
296
296
  });
297
297
 
298
298
  if (this._keywordFilter.length > 0 && this._keywordFilter !== '')
299
- params.set('keywords', this._keywordFilter);
299
+ {params.set('keywords', this._keywordFilter);}
300
300
 
301
301
  const paramsString = params.toString();
302
302
  let updatedUrl = window.location.pathname;
303
303
 
304
304
  if (paramsString)
305
- updatedUrl += `?${paramsString}`;
305
+ {updatedUrl += `?${paramsString}`;}
306
306
 
307
307
  history.replaceState(history.state, document.title, updatedUrl);
308
308
  this.shareUrl = `${window.location.protocol}//${window.location.hostname}${updatedUrl}`;
@@ -423,7 +423,7 @@ export default class Explorer extends LightningElement {
423
423
  }
424
424
 
425
425
  private get totalPages() {
426
- let totPages = (this.activeTab == 'pattern') ? Math.ceil(this.filteredPatterns.length / this.pageSize) : Math.ceil(this.filteredAntiPatterns.length / this.pageSize);
426
+ const totPages = (this.activeTab == 'pattern') ? Math.ceil(this.filteredPatterns.length / this.pageSize) : Math.ceil(this.filteredAntiPatterns.length / this.pageSize);
427
427
  return totPages;
428
428
  }
429
429
 
@@ -443,10 +443,10 @@ export default class Explorer extends LightningElement {
443
443
  const img = new Image();
444
444
  img.crossOrigin = 'Anonymous';
445
445
  img.onload = () => {
446
- let canvas = document.createElement('canvas');
446
+ const canvas = document.createElement('canvas');
447
447
  canvas.width = img.width;
448
448
  canvas.height = img.height;
449
- let ctx = canvas.getContext('2d');
449
+ const ctx = canvas.getContext('2d');
450
450
  ctx?.drawImage(img, 0, 0);
451
451
  resolve(canvas.toDataURL('image/png'));
452
452
  };
@@ -469,7 +469,7 @@ export default class Explorer extends LightningElement {
469
469
 
470
470
  async handlePdfClick() {
471
471
 
472
- let fileMeta = this.getExportFileMetaData();
472
+ const fileMeta = this.getExportFileMetaData();
473
473
 
474
474
  const margins = {
475
475
  top: 20,
@@ -609,7 +609,7 @@ export default class Explorer extends LightningElement {
609
609
 
610
610
  async handleCsvClick() {
611
611
 
612
- let fileMeta = this.getExportFileMetaData()
612
+ const fileMeta = this.getExportFileMetaData()
613
613
 
614
614
  if (this.activeTab == 'pattern') {
615
615
  this.exportToCSV('What Good Looks Like,Where to Look,Learn More','Pattern,Product Area | Location,Dimension | Consideration' , this.filteredPatterns, fileMeta.fileName);
@@ -626,7 +626,7 @@ export default class Explorer extends LightningElement {
626
626
  csv.push(subheaders);
627
627
  patArray.forEach(pattern => {
628
628
 
629
- let row: String[] = [];
629
+ const row: String[] = [];
630
630
  const description = (typeof pattern.Name === 'undefined' || pattern.Name === '') ? pattern.Description : `${pattern.Name} ${pattern.Description}`;
631
631
  row.push(this.escapeCSVField(description));
632
632
  row.push(this.escapeCSVField(`${pattern.ProductArea} | ${pattern.Location}`));
@@ -122,27 +122,27 @@ export default class gallery extends LightningElement {
122
122
  // update the gallery based on filtering
123
123
  async applyFilters() {
124
124
  this.filteredCards = this.allCards.filter((card: any) => {
125
- let isFilterMatch = (this._selectFilter === '' || (card as any)[this._filterProperty]?.toLowerCase().includes(this._selectFilter.toLocaleLowerCase()));
126
- let isMetaMatch = ((this._showMetaFilter) ? ((this._selectMetaFilter === '' || (card as any)[this._metaFilterProperty]?.toLowerCase().includes(this._selectMetaFilter.toLocaleLowerCase()))) : true);
127
- let isKeywordMatch = (this._keywordFilter === ''
125
+ const isFilterMatch = (this._selectFilter === '' || (card as any)[this._filterProperty]?.toLowerCase().includes(this._selectFilter.toLocaleLowerCase()));
126
+ const isMetaMatch = ((this._showMetaFilter) ? ((this._selectMetaFilter === '' || (card as any)[this._metaFilterProperty]?.toLowerCase().includes(this._selectMetaFilter.toLocaleLowerCase()))) : true);
127
+ const isKeywordMatch = (this._keywordFilter === ''
128
128
  || (card.pretitle && card.pretitle.toLowerCase().includes(this._keywordFilter.toLowerCase()))
129
129
  || (card.title && card.title.toLowerCase().includes(this._keywordFilter.toLowerCase()))
130
130
  || (card.description && card.description.toLowerCase().includes(this._keywordFilter.toLowerCase()))
131
131
  );
132
132
 
133
133
  if (isFilterMatch && isMetaMatch && isKeywordMatch)
134
- return card;
134
+ {return card;}
135
135
  });
136
136
 
137
137
  // Update page state so that we track filters in URL params
138
138
  const params = new URLSearchParams();
139
139
 
140
140
  if (this._selectFilter !== '')
141
- params.set(this._filterLabel, this._selectFilter);
141
+ {params.set(this._filterLabel, this._selectFilter);}
142
142
  if (this._showMetaFilter && this._selectMetaFilter !== '')
143
- params.set(this._metaFilterLabel, this._selectMetaFilter);
143
+ {params.set(this._metaFilterLabel, this._selectMetaFilter);}
144
144
  if (this._keywordFilter !== '')
145
- params.set('keywords', this._keywordFilter);
145
+ {params.set('keywords', this._keywordFilter);}
146
146
 
147
147
  const paramsString = params.toString();
148
148
  let updatedUrl = window.location.pathname;
@@ -151,9 +151,9 @@ export default class gallery extends LightningElement {
151
151
  const hash = this.containerId ? `#${this.containerId}` : window.location.hash.split('?')[0];
152
152
 
153
153
  if (hash)
154
- updatedUrl += hash;
154
+ {updatedUrl += hash;}
155
155
  if (paramsString)
156
- updatedUrl += `?${paramsString}`;
156
+ {updatedUrl += `?${paramsString}`;}
157
157
 
158
158
  history.replaceState(history.state, document.title, updatedUrl);
159
159
  this.shareUrl = `${window.location.protocol}//${window.location.hostname}${updatedUrl}`;
@@ -208,12 +208,12 @@ export default class gallery extends LightningElement {
208
208
  getGridCards(this._content, this._imageHash).then((res) => {
209
209
  this.allCards = this.filteredCards = res;
210
210
  if (this._showMetaFilter) {
211
- let typesArr = [...new Set(this.allCards.map((item: any) => (item as any).type))];
211
+ const typesArr = [...new Set(this.allCards.map((item: any) => (item as any).type))];
212
212
  typesArr.sort((a: string, b: string) => a.localeCompare(b));
213
213
  this.metaFilterOptions = typesArr.map((type: string) => ({ label: type, value: type })) as FilterOption[];
214
214
  }
215
215
  if (this.checkURLParams())
216
- this.applyFilters();
216
+ {this.applyFilters();}
217
217
  });
218
218
  } catch (error: any) {
219
219
  console.error("An error occurred getting the cards:", error?.message || String(error));
@@ -11,15 +11,15 @@ export function getFocusableElements(node: Element): HTMLElement[] {
11
11
  !isDisabled(node as HTMLElement) &&
12
12
  !isHidden(node as HTMLElement)
13
13
  )
14
- return [node] as HTMLElement[];
14
+ {return [node] as HTMLElement[];}
15
15
  if (node.shadowRoot)
16
- return Array.from(node.shadowRoot.children).flatMap(
16
+ {return Array.from(node.shadowRoot.children).flatMap(
17
17
  getFocusableElements
18
- );
18
+ );}
19
19
  if (node instanceof HTMLSlotElement) {
20
- let assignedElements = node.assignedElements();
20
+ const assignedElements = node.assignedElements();
21
21
  if (assignedElements.length)
22
- return assignedElements.flatMap(getFocusableElements);
22
+ {return assignedElements.flatMap(getFocusableElements);}
23
23
  }
24
24
  return Array.from(node.children).flatMap(getFocusableElements);
25
25
  }