@salesforcedevs/arch-components 1.20.17-alpha8 → 1.25.0
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 +12 -0
- package/lwc.config.json +42 -3
- package/package.json +36 -46
- package/src/assets/css/arch-variables.css +512 -0
- package/src/modules/arch/badge/badge.css +22 -0
- package/src/modules/arch/badge/badge.html +5 -0
- package/src/modules/arch/badge/badge.ts +9 -0
- package/src/modules/arch/button/button.css +1 -0
- package/src/modules/arch/button/button.html +20 -0
- package/src/modules/arch/button/button.ts +67 -0
- package/src/modules/arch/buttonLink/buttonLink.css +1 -0
- package/src/modules/arch/buttonLink/buttonLink.html +19 -0
- package/src/modules/arch/buttonLink/buttonLink.stories.js +34 -0
- package/src/modules/arch/buttonLink/buttonLink.ts +8 -0
- package/src/modules/arch/buttonStyles/buttonStyles.css +220 -0
- package/src/modules/arch/card/card.css +128 -0
- package/src/modules/arch/card/card.html +85 -0
- package/src/modules/arch/card/card.ts +277 -0
- package/src/modules/arch/cardBase/cardBase.css +11 -0
- package/src/modules/arch/cardBase/cardBase.html +2 -0
- package/src/modules/arch/cardGridA/cardGridA.css +11 -0
- package/src/modules/arch/cardGridA/cardGridA.html +21 -0
- package/src/modules/arch/cardGridA/cardGridA.stories.js +118 -0
- package/src/modules/arch/cardGridA/cardGridA.ts +24 -0
- package/src/modules/arch/cardGridC/cardGridC.css +24 -0
- package/src/modules/arch/cardGridC/cardGridC.html +22 -0
- package/src/modules/arch/cardGridC/cardGridC.stories.js +51 -0
- package/src/modules/arch/cardGridC/cardGridC.ts +11 -0
- package/src/modules/arch/cardGridD/cardGridD.css +17 -0
- package/src/modules/arch/cardGridD/cardGridD.html +20 -0
- package/src/modules/arch/cardGridD/cardGridD.stories.js +43 -0
- package/src/modules/arch/cardGridD/cardGridD.ts +7 -0
- package/src/modules/arch/cardNew/cardNew.css +31 -0
- package/src/modules/arch/cardNew/cardNew.html +32 -0
- package/src/modules/arch/cardNew/cardNew.ts +66 -0
- package/src/modules/arch/children/children.html +2 -0
- package/src/modules/arch/children/children.ts +31 -0
- package/src/modules/arch/color/color.ts +59 -0
- package/src/modules/arch/content/__fixtures__/index.ts +884 -0
- package/src/modules/arch/content/content.css +643 -0
- package/src/modules/arch/content/content.html +65 -0
- package/src/modules/arch/content/content.stories.js +21 -0
- package/src/modules/arch/content/content.ts +169 -0
- package/src/modules/arch/contentIcon/contentIcon.css +48 -0
- package/src/modules/arch/contentIcon/contentIcon.html +15 -0
- package/src/modules/arch/contentIcon/contentIcon.stories.js +130 -0
- package/src/modules/arch/contentIcon/contentIcon.ts +68 -0
- package/src/{common → modules/arch}/context/context.ts +21 -19
- package/src/modules/arch/contextAdapter/constants.ts +1 -0
- package/src/modules/arch/contextAdapter/contextAdapter.ts +54 -0
- package/src/modules/arch/debounce/debounce.ts +32 -0
- package/src/modules/arch/dialog/dialog.ts +154 -0
- package/src/modules/arch/dialogStyles/dialogStyles.css +90 -0
- package/src/modules/arch/effectAdapter/effectAdapter.html +1 -0
- package/src/modules/arch/effectAdapter/effectAdapter.ts +28 -0
- package/src/modules/arch/explorer/explorer.css +301 -0
- package/src/modules/arch/explorer/explorer.html +418 -0
- package/src/modules/arch/explorer/explorer.ts +718 -0
- package/src/modules/arch/explorer/types.d.ts +60 -0
- package/src/modules/arch/fetch/fetch.ts +55 -0
- package/src/modules/arch/footerMfe/footerMfe.html +3 -0
- package/src/modules/arch/footerMfe/footerMfe.ts +19 -0
- package/src/modules/arch/gallery/gallery.css +365 -0
- package/src/modules/arch/gallery/gallery.html +71 -0
- package/src/modules/arch/gallery/gallery.ts +366 -0
- package/src/modules/arch/gallery/types.d.ts +35 -0
- package/src/modules/arch/heading/heading.css +1 -0
- package/src/modules/arch/heading/heading.html +9 -0
- package/src/modules/arch/heading/heading.ts +36 -0
- package/src/modules/arch/helpers/helpers.ts +141 -0
- package/src/modules/arch/heroA/heroA.css +116 -0
- package/src/modules/arch/heroA/heroA.html +28 -0
- package/src/modules/arch/heroA/heroA.stories.js +60 -0
- package/src/modules/arch/heroA/heroA.ts +53 -0
- package/src/modules/arch/heroB/heroB.css +79 -0
- package/src/modules/arch/heroB/heroB.html +27 -0
- package/src/modules/arch/heroB/heroB.stories.js +55 -0
- package/src/modules/arch/heroB/heroB.ts +26 -0
- package/src/modules/arch/i18n/i18n.ts +78 -0
- package/src/modules/arch/icon/icon.css +28 -0
- package/src/modules/arch/icon/icon.html +17 -0
- package/src/modules/arch/icon/icon.stories.js +26 -0
- package/src/modules/arch/icon/icon.ts +92 -0
- package/src/modules/arch/instrumentation/instrumentation.css +1 -0
- package/src/modules/arch/instrumentation/instrumentation.html +1 -0
- package/src/modules/arch/instrumentation/instrumentation.ts +113 -0
- package/src/modules/arch/labels/helpers.ts +25 -0
- package/src/modules/arch/labels/pointHelpers.ts +47 -0
- package/src/modules/arch/labels/timeHelpers.ts +182 -0
- package/src/modules/arch/labels/types.d.ts +5 -0
- package/src/modules/arch/logger/logger.ts +33 -0
- package/src/modules/arch/menu/menu.ts +260 -0
- package/src/modules/arch/overflow/overflow.ts +71 -0
- package/src/modules/arch/page/page.css +3 -0
- package/src/modules/arch/page/page.html +3 -0
- package/src/modules/arch/page/page.stories.js +19 -0
- package/src/modules/arch/page/page.ts +3 -0
- package/src/modules/arch/pageHeaderA/pageHeaderA.css +82 -0
- package/src/modules/arch/pageHeaderA/pageHeaderA.html +24 -0
- package/src/modules/arch/pageHeaderA/pageHeaderA.stories.js +25 -0
- package/src/modules/arch/pageHeaderA/pageHeaderA.ts +51 -0
- package/src/modules/arch/pill/pill.css +70 -0
- package/src/modules/arch/pill/pill.html +17 -0
- package/src/modules/arch/pill/pill.ts +34 -0
- package/src/modules/arch/polling-request.ts +97 -0
- package/src/modules/arch/reflectedElement/reflectedElement.html +2 -0
- package/src/{common → modules/arch}/reflectedElement/reflectedElement.ts +5 -3
- package/src/modules/arch/reset/reset.css +39 -0
- package/src/modules/arch/searchList/searchList.css +120 -0
- package/src/modules/arch/searchList/searchList.html +46 -0
- package/src/modules/arch/searchList/searchList.ts +53 -0
- package/src/modules/arch/sectionA/sectionA.css +64 -0
- package/src/modules/arch/sectionA/sectionA.html +21 -0
- package/src/modules/arch/sectionA/sectionA.stories.js +25 -0
- package/src/modules/arch/sectionA/sectionA.ts +27 -0
- package/src/modules/arch/select/select.css +40 -0
- package/src/modules/arch/select/select.html +24 -0
- package/src/modules/arch/select/select.ts +64 -0
- package/src/modules/arch/socialShare/socialShare.css +50 -0
- package/src/modules/arch/socialShare/socialShare.html +56 -0
- package/src/modules/arch/socialShare/socialShare.ts +29 -0
- package/src/modules/arch/spinner/spinner.css +195 -0
- package/src/modules/arch/spinner/spinner.html +9 -0
- package/src/modules/arch/spinner/spinner.ts +15 -0
- package/src/modules/arch/styles/styles.css +24 -0
- package/src/modules/arch/summary/summary.css +134 -0
- package/src/modules/arch/summary/summary.html +71 -0
- package/src/modules/arch/summary/summary.stories.js +163 -0
- package/src/modules/arch/summary/summary.ts +96 -0
- package/src/modules/arch/tab/tab.css +3 -0
- package/src/modules/arch/tab/tab.html +5 -0
- package/src/modules/arch/tab/tab.ts +46 -0
- package/src/modules/arch/tabset/tabset.css +112 -0
- package/src/modules/arch/tabset/tabset.html +62 -0
- package/src/modules/arch/tabset/tabset.ts +244 -0
- package/src/modules/arch/testutils.ts +118 -0
- package/src/modules/arch/threeCardGrid/threeCardGrid.css +6 -0
- package/src/modules/arch/threeCardGrid/threeCardGrid.html +5 -0
- package/src/modules/arch/threeCardGrid/threeCardGrid.ts +3 -0
- package/src/modules/arch/track/track.ts +23 -0
- package/src/modules/arch/trailhead.ts +120 -0
- package/src/modules/arch/types.d.ts +1 -0
- package/src/modules/arch/useEffectAttr.ts +16 -0
- package/src/modules/arch/utils/utils.ts +20 -0
- package/src/modules/arch/withState.ts +21 -0
- package/src/modules/arch/xsfMfeEvents/xsfMfeEvents.html +1 -0
- package/src/modules/arch/xsfMfeEvents/xsfMfeEvents.ts +47 -0
- package/src/common/effectAdapter/__tests__/effectAdapter.test.ts +0 -12
- package/src/common/effectAdapter/effectAdapter.ts +0 -18
- package/src/common/reflectedElement/__tests__/modules/test/select/select.html +0 -3
- package/src/common/reflectedElement/__tests__/modules/test/select/select.ts +0 -7
- package/src/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.html +0 -3
- package/src/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.ts +0 -18
- package/src/common/reflectedElement/__tests__/reflectedElement.test.ts +0 -75
- package/src/common/slot/__tests__/slot.test.ts +0 -96
- package/src/common/slot/slot.ts +0 -20
- /package/src/{common → modules/arch}/context/context.html +0 -0
- /package/src/{common/effectAdapter/effectAdapter.html → modules/arch/contextAdapter/contextAdapter.html} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={heroClassName}>
|
|
3
|
+
<div class="content">
|
|
4
|
+
<div class="content-start">
|
|
5
|
+
<h1 class="title">{title}</h1>
|
|
6
|
+
<p if:true={subtitle} class="subtitle">{subtitle}</p>
|
|
7
|
+
<slot name="cta">
|
|
8
|
+
<arch-button-link
|
|
9
|
+
class="cta"
|
|
10
|
+
size="large"
|
|
11
|
+
href={ctaHref}
|
|
12
|
+
target={ctaTarget}
|
|
13
|
+
if:true={ctaHref}
|
|
14
|
+
variant={buttonVariant}
|
|
15
|
+
onclick={handleCtaClick}
|
|
16
|
+
>
|
|
17
|
+
{ctaLabel}
|
|
18
|
+
</arch-button-link>
|
|
19
|
+
</slot>
|
|
20
|
+
</div>
|
|
21
|
+
<div if:true={imgSrc} class={contentEndClassName}>
|
|
22
|
+
<picture>
|
|
23
|
+
<img alt="" src={imgSrc} loading="lazy" decoding="async" />
|
|
24
|
+
</picture>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "arch/arch-hero-a",
|
|
5
|
+
component: "sb-arch-hero-a",
|
|
6
|
+
parameters: {
|
|
7
|
+
chromatic: {
|
|
8
|
+
viewports: [400, 1100, 1199]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
const createStyles = () => html `
|
|
15
|
+
<style>
|
|
16
|
+
sb-arch-hero-a {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
</style>`;
|
|
20
|
+
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
export const Base = () => html` ${createStyles()}
|
|
23
|
+
<sb-arch-hero-a
|
|
24
|
+
cta-href="/"
|
|
25
|
+
cta-label="CTA"
|
|
26
|
+
img-src="/images/hero-a-architect.png"
|
|
27
|
+
img-align="bottom"
|
|
28
|
+
subtitle="Connect to your customers in a whole new way with the world's #1 CRM."
|
|
29
|
+
title="Hello
|
|
30
|
+
Architects"
|
|
31
|
+
></sb-arch-hero-a>
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
// prettier-ignore
|
|
35
|
+
export const Light = () => html` ${createStyles()}
|
|
36
|
+
<sb-arch-hero-a
|
|
37
|
+
background="light"
|
|
38
|
+
cta-href="/"
|
|
39
|
+
cta-label="CTA"
|
|
40
|
+
img-src="/images/hero-a-architect.png"
|
|
41
|
+
img-align="bottom"
|
|
42
|
+
subtitle="Connect to your customers in a whole new way with the world's #1 CRM."
|
|
43
|
+
title="Hello
|
|
44
|
+
Architects"
|
|
45
|
+
></sb-arch-hero-a>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
// prettier-ignore
|
|
49
|
+
export const Dark = () => html` ${createStyles()}
|
|
50
|
+
<sb-arch-hero-a
|
|
51
|
+
background="dark"
|
|
52
|
+
cta-href="/"
|
|
53
|
+
cta-label="CTA"
|
|
54
|
+
img-src="/images/hero-a-architect.png"
|
|
55
|
+
img-align="bottom"
|
|
56
|
+
subtitle="Connect to your customers in a whole new way with the world's #1 CRM."
|
|
57
|
+
title="Hello
|
|
58
|
+
Architects"
|
|
59
|
+
></sb-arch-hero-a>
|
|
60
|
+
`;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { api, LightningElement } from 'lwc';
|
|
2
|
+
import { track } from 'arch/track';
|
|
3
|
+
|
|
4
|
+
const widths = [820, 640, 320, 75];
|
|
5
|
+
|
|
6
|
+
export default class extends LightningElement {
|
|
7
|
+
@api background: 'white' | 'dark' | 'light' = 'white';
|
|
8
|
+
@api ctaHref: string | undefined;
|
|
9
|
+
@api ctaLabel: string | undefined;
|
|
10
|
+
@api ctaTarget: string | undefined;
|
|
11
|
+
@api imgSrc: string | undefined;
|
|
12
|
+
@api imgAlign: 'bottom' | 'center' = 'center';
|
|
13
|
+
@api subtitle: string | undefined;
|
|
14
|
+
@api title: string = '';
|
|
15
|
+
|
|
16
|
+
private get buttonVariant() {
|
|
17
|
+
return this.background === 'dark' ? 'neutral' : 'brand';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private get heroClassName() {
|
|
21
|
+
return `hero hero--${this.background}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private get contentEndClassName() {
|
|
25
|
+
return `content-end content-end--${this.imgAlign}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private handleCtaClick() {
|
|
29
|
+
track(this.template.host, 'cta_clicked', {
|
|
30
|
+
ctaType: 'primary',
|
|
31
|
+
label: this.ctaLabel
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private get imgSrcSetWebP() {
|
|
36
|
+
|
|
37
|
+
if(this.isRemoteImage){
|
|
38
|
+
return this.imgSrc;
|
|
39
|
+
}
|
|
40
|
+
const imgType = this.imgSrc.split('.').pop();
|
|
41
|
+
const imgName = this.imgSrc.replace(`.${imgType}`, '');
|
|
42
|
+
const srcSet: string[] = [];
|
|
43
|
+
widths.forEach((width) => {
|
|
44
|
+
srcSet.push(`${imgName}-${width}w.webp ${width}w`);
|
|
45
|
+
});
|
|
46
|
+
return srcSet.join(',');
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private get isRemoteImage() {
|
|
51
|
+
return /^(https?:\/\/|\/\/)/i.test(this.imgSrc);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
@import "arch/reset";
|
|
2
|
+
|
|
3
|
+
a {
|
|
4
|
+
text-decoration: none;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
img {
|
|
8
|
+
display: block;
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
max-height: 100px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.hero-white {
|
|
14
|
+
background-color: var(--arch-color-white);
|
|
15
|
+
color: var(--arch-color-black);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.hero-dark {
|
|
19
|
+
background-color: var(--arch-color-theme-dark);
|
|
20
|
+
color: var(--arch-color-white);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.hero-blue {
|
|
24
|
+
background-color: var(--arch-color-blue-ninety-five);
|
|
25
|
+
color: var(--arch-color-black);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.hero-light {
|
|
29
|
+
background-color: var(--arch-color-theme-light);
|
|
30
|
+
color: var(--arch-color-black);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.hero-bright {
|
|
34
|
+
background-color: var(--arch-color-theme-bright);
|
|
35
|
+
color: var(--arch-color-black);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.content {
|
|
39
|
+
align-items: center;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
padding: var(--arch-spacing-6) 0;
|
|
44
|
+
text-align: center;
|
|
45
|
+
min-height: 448px;
|
|
46
|
+
max-width: 600px;
|
|
47
|
+
margin: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.content > * + * {
|
|
51
|
+
margin-top: var(--arch-spacing-4);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.title {
|
|
55
|
+
font-family: Neutraface, sans-serif;
|
|
56
|
+
font-size: var(--arch-font-size-6xl);
|
|
57
|
+
line-height: 1;
|
|
58
|
+
white-space: pre-line;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.subtitle {
|
|
62
|
+
line-height: 1.5;
|
|
63
|
+
margin: var(--arch-spacing-2) 0;
|
|
64
|
+
font-size: var(--arch-font-size-xl);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.cta {
|
|
68
|
+
margin-top: var(--arch-spacing-2);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media screen and (max-width: 1280px) {
|
|
72
|
+
.hero {
|
|
73
|
+
padding: 0 var(--arch-spacing-4);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media screen and (max-width: 768px) {
|
|
78
|
+
/* Empty media query block */
|
|
79
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={heroClassName} style={backgroundStyle}>
|
|
3
|
+
<div class="content">
|
|
4
|
+
<img
|
|
5
|
+
alt=""
|
|
6
|
+
if:true={imgSrc}
|
|
7
|
+
src={imgSrc}
|
|
8
|
+
loading="lazy"
|
|
9
|
+
decoding="async"
|
|
10
|
+
/>
|
|
11
|
+
<h1 class="title">{title}</h1>
|
|
12
|
+
<p class="subtitle" if:true={subtitle}>{subtitle}</p>
|
|
13
|
+
<slot name="cta">
|
|
14
|
+
<arch-button-link
|
|
15
|
+
class="cta"
|
|
16
|
+
size="large"
|
|
17
|
+
href={ctaHref}
|
|
18
|
+
target={ctaTarget}
|
|
19
|
+
if:true={ctaHref}
|
|
20
|
+
variant={buttonVariant}
|
|
21
|
+
>
|
|
22
|
+
{ctaLabel}
|
|
23
|
+
</arch-button-link>
|
|
24
|
+
</slot>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "arch/arch-hero-b",
|
|
5
|
+
component: "sb-arch-hero-b",
|
|
6
|
+
parameters: {
|
|
7
|
+
chromatic: {
|
|
8
|
+
viewports: [400, 1199]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
const createStyles = () => html `
|
|
15
|
+
<style>
|
|
16
|
+
sb-arch-hero-b {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
</style>`;
|
|
20
|
+
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
export const Base = () => html` ${createStyles()}
|
|
23
|
+
<sb-arch-hero-b
|
|
24
|
+
cta-href="/"
|
|
25
|
+
cta-label="CTA"
|
|
26
|
+
img-src="/images/hero-b.png"
|
|
27
|
+
subtitle="Connect to your customers in a whole new way with the world's #1 CRM."
|
|
28
|
+
title="Hello Architects"
|
|
29
|
+
></sb-arch-hero-b>
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
// prettier-ignore
|
|
33
|
+
export const Light = () => html` ${createStyles()}
|
|
34
|
+
<sb-arch-hero-b
|
|
35
|
+
background="light"
|
|
36
|
+
cta-href="/"
|
|
37
|
+
cta-label="CTA"
|
|
38
|
+
img-src="/images/hero-b.png"
|
|
39
|
+
subtitle="Connect to your customers in a whole new way with the world's #1 CRM."
|
|
40
|
+
title="Hello Architects"
|
|
41
|
+
></sb-arch-hero-b>
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
export const Dark = () => html` ${createStyles()}
|
|
46
|
+
<sb-arch-hero-b
|
|
47
|
+
background="dark"
|
|
48
|
+
background-src="/images/architect-bg.svg"
|
|
49
|
+
cta-href="/"
|
|
50
|
+
cta-label="CTA"
|
|
51
|
+
img-src="/images/hero-b.png"
|
|
52
|
+
subtitle="Connect to your customers in a whole new way with the world's #1 CRM."
|
|
53
|
+
title="Hello Architects"
|
|
54
|
+
></sb-arch-hero-b>
|
|
55
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { api, LightningElement } from 'lwc';
|
|
2
|
+
|
|
3
|
+
export default class extends LightningElement {
|
|
4
|
+
@api background: 'white' | 'dark' | 'light' = 'white';
|
|
5
|
+
@api backgroundSrc: string | undefined;
|
|
6
|
+
@api ctaHref: string | undefined;
|
|
7
|
+
@api ctaLabel: string | undefined;
|
|
8
|
+
@api ctaTarget: string | undefined;
|
|
9
|
+
@api imgSrc: string | undefined;
|
|
10
|
+
@api subtitle: string | undefined;
|
|
11
|
+
@api title: string = '';
|
|
12
|
+
|
|
13
|
+
private get buttonVariant() {
|
|
14
|
+
return this.background === 'dark' ? 'neutral' : 'brand';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private get heroClassName() {
|
|
18
|
+
return `hero hero--${this.background}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private get backgroundStyle() {
|
|
22
|
+
return this.backgroundSrc
|
|
23
|
+
? `background-image: url(${this.backgroundSrc})`
|
|
24
|
+
: '';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Provides a localization service
|
|
3
|
+
*/
|
|
4
|
+
import i18n from 'i18n-js';
|
|
5
|
+
|
|
6
|
+
export type Locale = 'de' | 'en' | 'es-MX' | 'fr' | 'ja' | 'pt-BR';
|
|
7
|
+
|
|
8
|
+
type Labels = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type Locales = {
|
|
13
|
+
[locale in Locale]?: {
|
|
14
|
+
[key: string]: Labels | string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type Scope = {
|
|
19
|
+
[scopeName: string]: Locales;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
i18n.defaultLocale = 'en';
|
|
23
|
+
i18n.fallbacks = true;
|
|
24
|
+
|
|
25
|
+
export function toLocaleKey(value: string) {
|
|
26
|
+
return value.replace(
|
|
27
|
+
/([a-z]{2,3})(?:[_-])?([A-Z]{2})/g,
|
|
28
|
+
(_, lang, country) => `${lang}-${country.toUpperCase()}`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let guid = 0;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @class I18n
|
|
36
|
+
* @example
|
|
37
|
+
* import { I18n } from "shared/i18n";
|
|
38
|
+
* import labels from "./locales";
|
|
39
|
+
* const i18n = new I18n({ scopeName: labels });
|
|
40
|
+
* i18n.t("en", "scopeName", "foo.bar");
|
|
41
|
+
*/
|
|
42
|
+
export class I18n {
|
|
43
|
+
private id = guid++;
|
|
44
|
+
|
|
45
|
+
constructor(scope?: Scope) {
|
|
46
|
+
if (scope) {this.addScope(scope);}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
t(
|
|
50
|
+
locale: string,
|
|
51
|
+
scope: string,
|
|
52
|
+
key: string,
|
|
53
|
+
options?: i18n.TranslateOptions
|
|
54
|
+
) {
|
|
55
|
+
// i18n-js is a singleton, so setting locale on each call is required to
|
|
56
|
+
// avoid overriding the locale of other components' call to this function
|
|
57
|
+
i18n.locale = locale;
|
|
58
|
+
return i18n.t(`${scope}_${this.id}.${key}`, options);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
addScope(scope: Scope) {
|
|
62
|
+
for (const [scopeName, locales] of Object.entries(scope)) {
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(scope, scopeName)) {
|
|
64
|
+
for (const [locale, labels] of Object.entries(locales)) {
|
|
65
|
+
if (Object.prototype.hasOwnProperty.call(locales, locale)) {
|
|
66
|
+
// Modules can only export indentifiers, so we transform the key
|
|
67
|
+
// "esMX" => "es-MX"
|
|
68
|
+
const localeKey = toLocaleKey(locale);
|
|
69
|
+
i18n.translations[localeKey] = {
|
|
70
|
+
...i18n.translations[localeKey],
|
|
71
|
+
[`${scopeName}_${this.id}`]: labels
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import "arch/reset";
|
|
2
|
+
|
|
3
|
+
svg {
|
|
4
|
+
display: block;
|
|
5
|
+
fill: currentcolor;
|
|
6
|
+
height: var(--icon-size);
|
|
7
|
+
width: var(--icon-size);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.size-x-small {
|
|
11
|
+
--icon-size: var(--arch-spacing-3);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.size-small {
|
|
15
|
+
--icon-size: var(--arch-spacing-4);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.size-medium {
|
|
19
|
+
--icon-size: var(--arch-spacing-5);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.size-large {
|
|
23
|
+
--icon-size: var(--arch-spacing-6);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.size-xlarge {
|
|
27
|
+
--icon-size: var(--arch-spacing-10);
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
aria-hidden="true"
|
|
4
|
+
class={className}
|
|
5
|
+
if:false={context.crossOriginAssets}
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<use xlink:href={href}></use>
|
|
9
|
+
</svg>
|
|
10
|
+
<svg
|
|
11
|
+
aria-hidden="true"
|
|
12
|
+
class={className}
|
|
13
|
+
if:true={context.crossOriginAssets}
|
|
14
|
+
lwc:dom="manual"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
></svg>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "arch/arch-icon",
|
|
5
|
+
component: "sb-arch-icon"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// prettier-ignore
|
|
9
|
+
const createStyles = () => html `
|
|
10
|
+
<style>
|
|
11
|
+
sb-arch-icon {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
</style>`;
|
|
15
|
+
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
export const Base = () => html` ${createStyles()}
|
|
18
|
+
<sb-arch-icon size="large" symbol="edit"></sb-arch-icon>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
export const Action = () => html` ${createStyles()}
|
|
23
|
+
<div style="color: red">
|
|
24
|
+
<sb-arch-icon size="large" sprite="action" symbol="check"></sb-arch-icon>
|
|
25
|
+
</div>
|
|
26
|
+
`;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { api, LightningElement, wire } from "lwc";
|
|
2
|
+
import { ContextAdapter, ContextAdapterValue } from "arch/contextAdapter";
|
|
3
|
+
|
|
4
|
+
/* ROLLUP_PLATFORM
|
|
5
|
+
import * as iconUtils from 'lightning/iconUtils';
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
type Size = "x-small" | "small" | "medium" | "large" | "xlarge" | "override";
|
|
9
|
+
|
|
10
|
+
type Sprite =
|
|
11
|
+
| "action"
|
|
12
|
+
| "custom"
|
|
13
|
+
| "doctype"
|
|
14
|
+
| "social"
|
|
15
|
+
| "social-round"
|
|
16
|
+
| "utility";
|
|
17
|
+
|
|
18
|
+
const fetches = new Map<string, Promise<any>>();
|
|
19
|
+
|
|
20
|
+
export default class extends LightningElement {
|
|
21
|
+
@api sprite: Sprite = "utility";
|
|
22
|
+
@api size: Size = "medium";
|
|
23
|
+
@api symbol: string = "";
|
|
24
|
+
|
|
25
|
+
private node: SVGSymbolElement | undefined;
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @lwc/lwc/no-unknown-wire-adapters
|
|
28
|
+
@wire(ContextAdapter)
|
|
29
|
+
private context: ContextAdapterValue = null!;
|
|
30
|
+
|
|
31
|
+
private get className() {
|
|
32
|
+
return `size--${this.size}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private get href() {
|
|
36
|
+
/* ROLLUP_PLATFORM
|
|
37
|
+
return iconUtils.getIconPath(`${this.sprite}:${this.symbol}`);
|
|
38
|
+
*/
|
|
39
|
+
return `${this.context.assetsUrl}/icons/${this.sprite}-sprite/svg/symbols.svg#${this.symbol}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private get symbolId() {
|
|
43
|
+
return `tds__${this.sprite}__${this.symbol}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
renderedCallback() {
|
|
47
|
+
if (this.context.crossOriginAssets) {
|
|
48
|
+
this.appendNodes();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private async appendNodes() {
|
|
53
|
+
if (process.env.NODE_ENV === "test") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const { symbolId } = this;
|
|
57
|
+
if (this.node && this.node.id === symbolId) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
await this.fetchSprite(this.sprite);
|
|
61
|
+
const svg = this.template.querySelector("svg")!;
|
|
62
|
+
const node = document
|
|
63
|
+
.getElementById(symbolId)!
|
|
64
|
+
.cloneNode(true) as SVGSymbolElement;
|
|
65
|
+
while (svg.firstChild) {
|
|
66
|
+
svg.removeChild(svg.firstChild);
|
|
67
|
+
}
|
|
68
|
+
for (const n of Array.from(node.childNodes)) {
|
|
69
|
+
svg.appendChild(n);
|
|
70
|
+
}
|
|
71
|
+
svg.setAttribute("viewBox", node.getAttribute("viewBox")!);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private async fetchSprite(sprite: Sprite) {
|
|
75
|
+
if (fetches.has(sprite)) {
|
|
76
|
+
return fetches.get(sprite);
|
|
77
|
+
}
|
|
78
|
+
const promise = fetch(
|
|
79
|
+
`${this.context.assetsUrl}/icons/${this.sprite}-sprite/svg/symbols.svg`
|
|
80
|
+
)
|
|
81
|
+
.then((res) => res.text())
|
|
82
|
+
.then((svg) => svg.replace(/id="/g, `id="tds__${sprite}__`))
|
|
83
|
+
.then((svg) => {
|
|
84
|
+
const node = document.createElement("div");
|
|
85
|
+
node.innerHTML = svg;
|
|
86
|
+
node.style.display = "none";
|
|
87
|
+
document.body.appendChild(node);
|
|
88
|
+
});
|
|
89
|
+
fetches.set(sprite, promise);
|
|
90
|
+
return promise;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Instrumentation styles */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template></template>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { LightningElement, api } from 'lwc';
|
|
2
|
+
|
|
3
|
+
const TRACKING_EVENT_NAME = 'architectssite_track';
|
|
4
|
+
const LISTENER_QUEUE = '__TDS_INSTRUMENTATION_QUEUE__';
|
|
5
|
+
const LISTENER_INDICATOR = '__TDS_INSTRUMENTATION_IS_INITIALIZED__';
|
|
6
|
+
|
|
7
|
+
export function track(
|
|
8
|
+
element: EventTarget,
|
|
9
|
+
event: string,
|
|
10
|
+
payload: Record<string, unknown>
|
|
11
|
+
): void {
|
|
12
|
+
const detail = { event, payload };
|
|
13
|
+
// if window.LISTENER_INDICATOR is undefined, `arch-instrumentation` has not
|
|
14
|
+
// been mounted, and the listener hasn't been attached.
|
|
15
|
+
if ((window as any)[LISTENER_INDICATOR] === undefined) {
|
|
16
|
+
(window as any)[LISTENER_QUEUE] = (window as any)[LISTENER_QUEUE] || [];
|
|
17
|
+
(window as any)[LISTENER_QUEUE].push(detail);
|
|
18
|
+
} else {
|
|
19
|
+
const e = new CustomEvent(TRACKING_EVENT_NAME, {
|
|
20
|
+
bubbles: true,
|
|
21
|
+
composed: true,
|
|
22
|
+
detail
|
|
23
|
+
});
|
|
24
|
+
element.dispatchEvent(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const googleTagManager = {
|
|
29
|
+
track: function (e: Event) {
|
|
30
|
+
if ((window as any).dataLayer === undefined) {
|
|
31
|
+
(window as any).dataLayer = [];
|
|
32
|
+
}
|
|
33
|
+
const { event, payload } = (e as CustomEvent).detail;
|
|
34
|
+
(window as any).dataLayer.push({ ...payload, event });
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
interface TrackEventListener {
|
|
39
|
+
add: () => void;
|
|
40
|
+
remove: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function trackEventListener(
|
|
44
|
+
trackerFns: { track: (e: Event) => void }[] = []
|
|
45
|
+
): TrackEventListener {
|
|
46
|
+
if (trackerFns.length === 0) {
|
|
47
|
+
throw new Error('No tracker functions passed');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const trackWebEvent = (e: Event) => {
|
|
51
|
+
trackerFns.forEach((tracker) => {
|
|
52
|
+
tracker.track(e);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const attachEventListener = () => {
|
|
57
|
+
document.addEventListener(TRACKING_EVENT_NAME, trackWebEvent);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const removeEventListener = () => {
|
|
61
|
+
document.removeEventListener(TRACKING_EVENT_NAME, trackWebEvent);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
add: attachEventListener,
|
|
66
|
+
remove: removeEventListener
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default class Instrumentation extends LightningElement {
|
|
71
|
+
@api useGoogleTagManager = false;
|
|
72
|
+
|
|
73
|
+
private tracker: TrackEventListener | null = null;
|
|
74
|
+
|
|
75
|
+
private setupTracker() {
|
|
76
|
+
const trackerFunctions = this.useGoogleTagManager
|
|
77
|
+
? [googleTagManager]
|
|
78
|
+
: [];
|
|
79
|
+
this.tracker = trackEventListener(trackerFunctions);
|
|
80
|
+
this.tracker.add();
|
|
81
|
+
(window as any)[LISTENER_INDICATOR] = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private dispatchQueuedEvents() {
|
|
85
|
+
while ((window as any)[LISTENER_QUEUE].length > 0) {
|
|
86
|
+
const event = (window as any)[LISTENER_QUEUE].pop() as {
|
|
87
|
+
event: string;
|
|
88
|
+
payload: Record<string, unknown>;
|
|
89
|
+
};
|
|
90
|
+
track(this, event.event, event.payload);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
renderedCallback() {
|
|
95
|
+
if (this.tracker === null) {
|
|
96
|
+
this.setupTracker();
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
(window as any)[LISTENER_QUEUE] !== undefined &&
|
|
100
|
+
(window as any)[LISTENER_QUEUE].length > 0
|
|
101
|
+
) {
|
|
102
|
+
this.dispatchQueuedEvents();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
disconnectedCallback() {
|
|
108
|
+
if (this.tracker !== null) {
|
|
109
|
+
this.tracker.remove();
|
|
110
|
+
this.tracker = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|