@spectrum-web-components/coachmark 0.40.4 → 0.41.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/README.md +193 -9
- package/custom-elements.json +461 -6
- package/package.json +26 -4
- package/sp-coach-indicator.d.ts +6 -0
- package/sp-coach-indicator.dev.js +5 -0
- package/sp-coach-indicator.dev.js.map +7 -0
- package/sp-coach-indicator.js +2 -0
- package/sp-coach-indicator.js.map +7 -0
- package/src/CoachIndicator.d.ts +12 -0
- package/src/CoachIndicator.dev.js +58 -0
- package/src/CoachIndicator.dev.js.map +7 -0
- package/src/CoachIndicator.js +6 -0
- package/src/CoachIndicator.js.map +7 -0
- package/src/Coachmark.d.ts +49 -4
- package/src/Coachmark.dev.js +261 -13
- package/src/Coachmark.dev.js.map +2 -2
- package/src/Coachmark.js +112 -5
- package/src/Coachmark.js.map +3 -3
- package/src/CoachmarkItem.d.ts +18 -0
- package/src/CoachmarkItem.dev.js +7 -0
- package/src/CoachmarkItem.dev.js.map +7 -0
- package/src/CoachmarkItem.js +2 -0
- package/src/CoachmarkItem.js.map +7 -0
- package/src/coach-indicator.css.d.ts +2 -0
- package/src/coach-indicator.css.dev.js +91 -0
- package/src/coach-indicator.css.dev.js.map +7 -0
- package/src/coach-indicator.css.js +88 -0
- package/src/coach-indicator.css.js.map +7 -0
- package/src/coachmark.css.dev.js +105 -75
- package/src/coachmark.css.dev.js.map +2 -2
- package/src/coachmark.css.js +105 -75
- package/src/coachmark.css.js.map +2 -2
- package/src/index.d.ts +2 -0
- package/src/index.dev.js +2 -0
- package/src/index.dev.js.map +2 -2
- package/src/index.js +1 -1
- package/src/index.js.map +2 -2
- package/src/spectrum-coach-indicator.css.d.ts +2 -0
- package/src/spectrum-coach-indicator.css.dev.js +77 -0
- package/src/spectrum-coach-indicator.css.dev.js.map +7 -0
- package/src/spectrum-coach-indicator.css.js +74 -0
- package/src/spectrum-coach-indicator.css.js.map +7 -0
- package/src/spectrum-coachmark.css.dev.js +103 -75
- package/src/spectrum-coachmark.css.dev.js.map +2 -2
- package/src/spectrum-coachmark.css.js +105 -77
- package/src/spectrum-coachmark.css.js.map +2 -2
- package/src/spectrum-config.js +33 -39
- package/stories/coach-indicator-static.stories.js +22 -0
- package/stories/coach-indicator-static.stories.js.map +7 -0
- package/stories/coach-indicator.stories.js +18 -0
- package/stories/coach-indicator.stories.js.map +7 -0
- package/stories/coachmark.stories.js +254 -8
- package/stories/coachmark.stories.js.map +2 -2
- package/stories/images.js +5 -0
- package/stories/images.js.map +7 -0
- package/test/benchmark/basic-test.js +17 -1
- package/test/benchmark/basic-test.js.map +2 -2
- package/test/coach-indicator-static.test-vrt.js +5 -0
- package/test/coach-indicator-static.test-vrt.js.map +7 -0
- package/test/coach-indicator.test-vrt.js +5 -0
- package/test/coach-indicator.test-vrt.js.map +7 -0
- package/test/coach-indicator.test.js +32 -0
- package/test/coach-indicator.test.js.map +7 -0
- package/test/coachmark.test.js +183 -6
- package/test/coachmark.test.js.map +2 -2
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result)
|
|
10
|
+
__defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
import {
|
|
14
|
+
html,
|
|
15
|
+
SpectrumElement
|
|
16
|
+
} from "@spectrum-web-components/base";
|
|
17
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
18
|
+
import styles from "./coach-indicator.css.js";
|
|
19
|
+
export class CoachIndicator extends SpectrumElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.quiet = false;
|
|
23
|
+
}
|
|
24
|
+
static get styles() {
|
|
25
|
+
return [styles];
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html`
|
|
29
|
+
<div class="ring"></div>
|
|
30
|
+
<div class="ring"></div>
|
|
31
|
+
<div class="ring"></div>
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
updated(changes) {
|
|
35
|
+
super.updated(changes);
|
|
36
|
+
if (changes.has("variant") && (this.variant || typeof changes.get("variant"))) {
|
|
37
|
+
this.static = this.variant;
|
|
38
|
+
if (true) {
|
|
39
|
+
window.__swc.warn(
|
|
40
|
+
this,
|
|
41
|
+
`The "variant" attribute/property of <${this.localName}> have been deprecated. Use "static" with any of the same values instead. "variant" will be removed in a future release.`,
|
|
42
|
+
"https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed",
|
|
43
|
+
{ level: "deprecation" }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
__decorateClass([
|
|
50
|
+
property({ type: Boolean, reflect: true })
|
|
51
|
+
], CoachIndicator.prototype, "quiet", 2);
|
|
52
|
+
__decorateClass([
|
|
53
|
+
property({ reflect: true })
|
|
54
|
+
], CoachIndicator.prototype, "static", 2);
|
|
55
|
+
__decorateClass([
|
|
56
|
+
property({ reflect: true })
|
|
57
|
+
], CoachIndicator.prototype, "variant", 2);
|
|
58
|
+
//# sourceMappingURL=CoachIndicator.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["CoachIndicator.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport styles from './coach-indicator.css.js';\n\n/**\n * @element sp-coach-indicator\n */\nexport class CoachIndicator extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ reflect: true })\n public static?: 'white' | 'black';\n\n @property({ reflect: true })\n public variant?: 'white' | 'black';\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"ring\"></div>\n <div class=\"ring\"></div>\n <div class=\"ring\"></div>\n `;\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (\n changes.has('variant') &&\n (this.variant || typeof changes.get('variant'))\n ) {\n this.static = this.variant;\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"variant\" attribute/property of <${this.localName}> have been deprecated. Use \"static\" with any of the same values instead. \"variant\" will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',\n { level: 'deprecation' }\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,OAAO,YAAY;AAKZ,aAAM,uBAAuB,gBAAgB;AAAA,EAA7C;AAAA;AAMH,SAAO,QAAQ;AAAA;AAAA,EALf,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAWmB,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX;AAAA,EAEmB,QAAQ,SAA+B;AACtD,UAAM,QAAQ,OAAO;AACrB,QACI,QAAQ,IAAI,SAAS,MACpB,KAAK,WAAW,OAAO,QAAQ,IAAI,SAAS,IAC/C;AACE,WAAK,SAAS,KAAK;AACnB,UAAI,MAAoB;AACpB,eAAO,MAAM;AAAA,UACT;AAAA,UACA,wCAAwC,KAAK,SAAS;AAAA,UACtD;AAAA,UACA,EAAE,OAAO,cAAc;AAAA,QAC3B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AAjCW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,eAMF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GARlB,eASF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAXlB,eAYF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=(s,r,e,i)=>{for(var t=i>1?void 0:i?u(r,e):r,l=s.length-1,o;l>=0;l--)(o=s[l])&&(t=(i?o(r,e,t):o(t))||t);return i&&t&&d(r,e,t),t};import{html as n,SpectrumElement as c}from"@spectrum-web-components/base";import{property as p}from"@spectrum-web-components/base/src/decorators.js";import v from"./coach-indicator.css.js";export class CoachIndicator extends c{constructor(){super(...arguments);this.quiet=!1}static get styles(){return[v]}render(){return n`
|
|
2
|
+
<div class="ring"></div>
|
|
3
|
+
<div class="ring"></div>
|
|
4
|
+
<div class="ring"></div>
|
|
5
|
+
`}updated(e){super.updated(e),e.has("variant")&&(this.variant||typeof e.get("variant"))&&(this.static=this.variant)}}a([p({type:Boolean,reflect:!0})],CoachIndicator.prototype,"quiet",2),a([p({reflect:!0})],CoachIndicator.prototype,"static",2),a([p({reflect:!0})],CoachIndicator.prototype,"variant",2);
|
|
6
|
+
//# sourceMappingURL=CoachIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["CoachIndicator.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport styles from './coach-indicator.css.js';\n\n/**\n * @element sp-coach-indicator\n */\nexport class CoachIndicator extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ reflect: true })\n public static?: 'white' | 'black';\n\n @property({ reflect: true })\n public variant?: 'white' | 'black';\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"ring\"></div>\n <div class=\"ring\"></div>\n <div class=\"ring\"></div>\n `;\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (\n changes.has('variant') &&\n (this.variant || typeof changes.get('variant'))\n ) {\n this.static = this.variant;\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"variant\" attribute/property of <${this.localName}> have been deprecated. Use \"static\" with any of the same values instead. \"variant\" will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',\n { level: 'deprecation' }\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAOC,MAAY,2BAKZ,aAAM,uBAAuBF,CAAgB,CAA7C,kCAMH,KAAO,MAAQ,GALf,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAM,CAClB,CAWmB,QAAyB,CACxC,OAAOH;AAAA;AAAA;AAAA;AAAA,SAKX,CAEmB,QAAQI,EAA+B,CACtD,MAAM,QAAQA,CAAO,EAEjBA,EAAQ,IAAI,SAAS,IACpB,KAAK,SAAW,OAAOA,EAAQ,IAAI,SAAS,KAE7C,KAAK,OAAS,KAAK,QAU3B,CACJ,CAjCWC,EAAA,CADNH,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GALjC,eAMF,qBAGAG,EAAA,CADNH,EAAS,CAAE,QAAS,EAAK,CAAC,GARlB,eASF,sBAGAG,EAAA,CADNH,EAAS,CAAE,QAAS,EAAK,CAAC,GAXlB,eAYF",
|
|
6
|
+
"names": ["html", "SpectrumElement", "property", "styles", "changes", "__decorateClass"]
|
|
7
|
+
}
|
package/src/Coachmark.d.ts
CHANGED
|
@@ -1,10 +1,55 @@
|
|
|
1
|
-
import { CSSResultArray,
|
|
1
|
+
import { CSSResultArray, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';
|
|
3
|
+
import { Popover } from '@spectrum-web-components/popover';
|
|
4
|
+
import type { Placement } from '@spectrum-web-components/overlay';
|
|
5
|
+
import type { CoachmarkItem } from './CoachmarkItem.js';
|
|
6
|
+
import '@spectrum-web-components/asset/sp-asset.js';
|
|
7
|
+
import '@spectrum-web-components/button/sp-button.js';
|
|
8
|
+
import '@spectrum-web-components/button-group/sp-button-group.js';
|
|
9
|
+
import '@spectrum-web-components/quick-actions/sp-quick-actions.js';
|
|
10
|
+
declare const Coachmark_base: typeof Popover & {
|
|
11
|
+
new (...args: any[]): import("@spectrum-web-components/shared/src/like-anchor.js").LikeAnchorInterface;
|
|
12
|
+
prototype: import("@spectrum-web-components/shared/src/like-anchor.js").LikeAnchorInterface;
|
|
13
|
+
};
|
|
2
14
|
/**
|
|
3
15
|
* @element sp-coachmark
|
|
16
|
+
* @fires primary - Announces that the "primary" button has been clicked.
|
|
17
|
+
* @fires secondary - Announces that the "secondary" button has been clicked.
|
|
18
|
+
* @slot cover-photo - This is the cover photo for Default and Quiet Coachmark
|
|
19
|
+
* @slot heading - HTML content to be listed as the heading
|
|
20
|
+
* @slot description - A description of the card
|
|
21
|
+
* @slot actions - an `sp-action-menu` element outlining actions to take on the represened object
|
|
4
22
|
*/
|
|
5
|
-
export declare class Coachmark extends
|
|
23
|
+
export declare class Coachmark extends Coachmark_base {
|
|
6
24
|
static get styles(): CSSResultArray;
|
|
7
|
-
|
|
8
|
-
|
|
25
|
+
item?: CoachmarkItem;
|
|
26
|
+
placement: Placement;
|
|
27
|
+
private content?;
|
|
28
|
+
private shortcutKey?;
|
|
29
|
+
modifierKeys?: string[];
|
|
30
|
+
private source?;
|
|
31
|
+
private mediaType?;
|
|
32
|
+
hasAsset: boolean;
|
|
33
|
+
asset?: 'file' | 'folder';
|
|
34
|
+
currentStep?: number;
|
|
35
|
+
totalSteps?: number;
|
|
36
|
+
primaryCTA?: string;
|
|
37
|
+
secondaryCTA?: string;
|
|
38
|
+
private renderMedia;
|
|
39
|
+
private renderModifier;
|
|
40
|
+
private renderJoiner;
|
|
41
|
+
private renderHeader;
|
|
42
|
+
private renderContent;
|
|
43
|
+
private stopPropagationOnHref;
|
|
44
|
+
private handlePrimaryCTA;
|
|
45
|
+
private handleSecondaryCTA;
|
|
46
|
+
private renderSecondaryButton;
|
|
47
|
+
private renderPrimaryButton;
|
|
48
|
+
private renderSecondaryButtonMobile;
|
|
49
|
+
private renderPrimaryButtonMobile;
|
|
50
|
+
protected renderButtons(): TemplateResult;
|
|
51
|
+
protected renderSteps: () => TemplateResult;
|
|
52
|
+
protected renderActionMenu: () => TemplateResult;
|
|
9
53
|
protected render(): TemplateResult;
|
|
10
54
|
}
|
|
55
|
+
export {};
|
package/src/Coachmark.dev.js
CHANGED
|
@@ -12,31 +12,279 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
12
12
|
};
|
|
13
13
|
import {
|
|
14
14
|
html,
|
|
15
|
-
|
|
15
|
+
nothing
|
|
16
16
|
} from "@spectrum-web-components/base";
|
|
17
17
|
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
18
|
-
import
|
|
19
|
-
|
|
18
|
+
import { when } from "@spectrum-web-components/base/src/directives.js";
|
|
19
|
+
import { LikeAnchor } from "@spectrum-web-components/shared/src/like-anchor.js";
|
|
20
|
+
import coachmarkStyles from "./coachmark.css.js";
|
|
21
|
+
import chevronStyles from "@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js";
|
|
22
|
+
import "@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js";
|
|
23
|
+
import { Popover } from "@spectrum-web-components/popover";
|
|
24
|
+
import { join } from "lit/directives/join.js";
|
|
25
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
26
|
+
import { MediaType } from "./CoachmarkItem.dev.js";
|
|
27
|
+
import "@spectrum-web-components/asset/sp-asset.js";
|
|
28
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
29
|
+
import "@spectrum-web-components/button-group/sp-button-group.js";
|
|
30
|
+
import "@spectrum-web-components/quick-actions/sp-quick-actions.js";
|
|
31
|
+
export class Coachmark extends LikeAnchor(Popover) {
|
|
20
32
|
constructor() {
|
|
21
33
|
super(...arguments);
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
34
|
+
this.placement = "right";
|
|
35
|
+
this.modifierKeys = [];
|
|
36
|
+
this.hasAsset = false;
|
|
37
|
+
this.renderSecondaryButton = () => {
|
|
38
|
+
return html`
|
|
39
|
+
<sp-button
|
|
40
|
+
treatment="outline"
|
|
41
|
+
variant="secondary"
|
|
42
|
+
@click=${this.handleSecondaryCTA}
|
|
43
|
+
>
|
|
44
|
+
${this.secondaryCTA}
|
|
45
|
+
</sp-button>
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
this.renderPrimaryButton = () => {
|
|
49
|
+
return html`
|
|
50
|
+
<sp-button
|
|
51
|
+
size="s"
|
|
52
|
+
treatment="outline"
|
|
53
|
+
variant="primary"
|
|
54
|
+
@click=${this.handlePrimaryCTA}
|
|
55
|
+
>
|
|
56
|
+
${this.primaryCTA}
|
|
57
|
+
</sp-button>
|
|
58
|
+
`;
|
|
59
|
+
};
|
|
60
|
+
this.renderSecondaryButtonMobile = () => {
|
|
61
|
+
return html`
|
|
62
|
+
<sp-button
|
|
63
|
+
variant="secondary"
|
|
64
|
+
treatment="outline"
|
|
65
|
+
icon-only
|
|
66
|
+
aria-label="previous"
|
|
67
|
+
@click=${this.handleSecondaryCTA}
|
|
68
|
+
>
|
|
69
|
+
<sp-icon-chevron200
|
|
70
|
+
size="s"
|
|
71
|
+
class="spectrum-UIIcon-ChevronLeft75"
|
|
72
|
+
slot="icon"
|
|
73
|
+
></sp-icon-chevron200>
|
|
74
|
+
</sp-button>
|
|
75
|
+
`;
|
|
76
|
+
};
|
|
77
|
+
this.renderPrimaryButtonMobile = () => {
|
|
78
|
+
return html`
|
|
79
|
+
<sp-button
|
|
80
|
+
size="s"
|
|
81
|
+
treatment="outline"
|
|
82
|
+
variant="primary"
|
|
83
|
+
@click=${this.handlePrimaryCTA}
|
|
84
|
+
>
|
|
85
|
+
${this.primaryCTA}
|
|
86
|
+
</sp-button>
|
|
87
|
+
`;
|
|
88
|
+
};
|
|
89
|
+
// render steps
|
|
90
|
+
this.renderSteps = () => {
|
|
91
|
+
return html`
|
|
92
|
+
<div class="step" role="status">
|
|
93
|
+
<span aria-live="polite">
|
|
94
|
+
${this.currentStep} of ${this.totalSteps}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
`;
|
|
98
|
+
};
|
|
99
|
+
// render action menu
|
|
100
|
+
this.renderActionMenu = () => {
|
|
101
|
+
return html`
|
|
102
|
+
<div class="action-menu" @pointerdown=${this.stopPropagationOnHref}>
|
|
103
|
+
<slot name="actions"></slot>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
};
|
|
24
107
|
}
|
|
25
108
|
static get styles() {
|
|
26
|
-
return [styles];
|
|
109
|
+
return [...super.styles, coachmarkStyles, chevronStyles];
|
|
110
|
+
}
|
|
111
|
+
// render video and images
|
|
112
|
+
renderMedia() {
|
|
113
|
+
var _a;
|
|
114
|
+
const isImage = this.mediaType === MediaType.IMAGE;
|
|
115
|
+
if (!isImage) {
|
|
116
|
+
return html`
|
|
117
|
+
<slot name="asset"></slot>
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
return html`
|
|
121
|
+
<sp-asset id="cover-photo">
|
|
122
|
+
<div class="image-wrapper">
|
|
123
|
+
<img
|
|
124
|
+
class="image"
|
|
125
|
+
loading="lazy"
|
|
126
|
+
slot="cover-photo"
|
|
127
|
+
src="${ifDefined(this.source)}"
|
|
128
|
+
alt="${ifDefined((_a = this == null ? void 0 : this.content) == null ? void 0 : _a.imageAlt)}"
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</sp-asset>
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
// method to render modifier
|
|
135
|
+
renderModifier(modifierKey, type = "modifier") {
|
|
136
|
+
return html`
|
|
137
|
+
<span type="${type}" class="keyboard-shortcut">${modifierKey}</span>
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
renderJoiner() {
|
|
141
|
+
return html`
|
|
142
|
+
<span class="plus">+</span>
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
// render heading title and modifier
|
|
146
|
+
renderHeader() {
|
|
147
|
+
var _a, _b, _c, _d;
|
|
148
|
+
const hasModifier = this.modifierKeys && ((_a = this.modifierKeys) == null ? void 0 : _a.length) > 0;
|
|
149
|
+
const hasShortcut = Boolean(this.shortcutKey);
|
|
150
|
+
const hasTitle = Boolean((_b = this.content) == null ? void 0 : _b.title);
|
|
151
|
+
if (!hasTitle && !hasModifier && !hasShortcut) {
|
|
152
|
+
return html`
|
|
153
|
+
<div class="title"><slot name="title"></slot></div>
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
return html`
|
|
157
|
+
${hasTitle ? html`
|
|
158
|
+
<div class="title">${(_c = this.content) == null ? void 0 : _c.title}</div>
|
|
159
|
+
` : nothing}
|
|
160
|
+
${hasModifier || hasShortcut ? html`
|
|
161
|
+
<kbd class="keys spectrum-Body spectrum-Body--sizeS">
|
|
162
|
+
${hasModifier ? join(
|
|
163
|
+
(_d = this.modifierKeys) == null ? void 0 : _d.map(
|
|
164
|
+
(k) => this.renderModifier(k)
|
|
165
|
+
),
|
|
166
|
+
this.renderJoiner()
|
|
167
|
+
) : nothing}
|
|
168
|
+
${hasShortcut && hasModifier ? this.renderJoiner() : nothing}
|
|
169
|
+
${hasShortcut ? this.renderModifier(
|
|
170
|
+
this.shortcutKey,
|
|
171
|
+
"shortcut"
|
|
172
|
+
) : nothing}
|
|
173
|
+
</kbd>
|
|
174
|
+
` : nothing}
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
// render description
|
|
178
|
+
renderContent() {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
const hasDescription = Boolean((_a = this.content) == null ? void 0 : _a.description);
|
|
181
|
+
if (!hasDescription)
|
|
182
|
+
return html`
|
|
183
|
+
<slot name="content"></slot>
|
|
184
|
+
`;
|
|
185
|
+
return html`
|
|
186
|
+
<div>${(_b = this.content) == null ? void 0 : _b.description}</div>
|
|
187
|
+
`;
|
|
188
|
+
}
|
|
189
|
+
stopPropagationOnHref(event) {
|
|
190
|
+
if (this.href) {
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// event on primary button
|
|
195
|
+
handlePrimaryCTA() {
|
|
196
|
+
this.dispatchEvent(
|
|
197
|
+
new Event("primary", {
|
|
198
|
+
bubbles: true,
|
|
199
|
+
composed: true
|
|
200
|
+
})
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
// event on secondary button
|
|
204
|
+
handleSecondaryCTA() {
|
|
205
|
+
this.dispatchEvent(
|
|
206
|
+
new Event("secondary", {
|
|
207
|
+
bubbles: true,
|
|
208
|
+
composed: true
|
|
209
|
+
})
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
renderButtons() {
|
|
213
|
+
return html`
|
|
214
|
+
<sp-button-group class="spectrum-ButtonGroup buttongroup">
|
|
215
|
+
${when(this.secondaryCTA, this.renderSecondaryButton)}
|
|
216
|
+
${when(this.primaryCTA, this.renderPrimaryButton)}
|
|
217
|
+
</sp-button-group>
|
|
218
|
+
<sp-button-group
|
|
219
|
+
class="spectrum-ButtonGroup buttongroup-mobile"
|
|
220
|
+
size="s"
|
|
221
|
+
>
|
|
222
|
+
${when(this.secondaryCTA, this.renderSecondaryButtonMobile)}
|
|
223
|
+
${when(this.primaryCTA, this.renderPrimaryButtonMobile)}
|
|
224
|
+
</sp-button-group>
|
|
225
|
+
`;
|
|
27
226
|
}
|
|
28
227
|
render() {
|
|
29
228
|
return html`
|
|
30
|
-
|
|
31
|
-
<div class="
|
|
32
|
-
|
|
229
|
+
${this.renderMedia()}
|
|
230
|
+
<div class="header">
|
|
231
|
+
<div class="flex-container">${this.renderHeader()}</div>
|
|
232
|
+
<div class="static-item">
|
|
233
|
+
${when(
|
|
234
|
+
this.secondaryCTA && this.primaryCTA,
|
|
235
|
+
this.renderActionMenu
|
|
236
|
+
)}
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div class="content">${this.renderContent()}</div>
|
|
241
|
+
<div class="footer">
|
|
242
|
+
${when(
|
|
243
|
+
this.totalSteps && this.totalSteps > 1,
|
|
244
|
+
this.renderSteps
|
|
245
|
+
)}
|
|
246
|
+
${this.renderButtons()}
|
|
247
|
+
</div>
|
|
33
248
|
`;
|
|
34
249
|
}
|
|
35
250
|
}
|
|
36
251
|
__decorateClass([
|
|
37
|
-
property({ type:
|
|
38
|
-
], Coachmark.prototype, "
|
|
252
|
+
property({ type: Object })
|
|
253
|
+
], Coachmark.prototype, "item", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
property({ type: String })
|
|
256
|
+
], Coachmark.prototype, "placement", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
property({ type: Object, attribute: false })
|
|
259
|
+
], Coachmark.prototype, "content", 2);
|
|
260
|
+
__decorateClass([
|
|
261
|
+
property({ attribute: "shortcut-key" })
|
|
262
|
+
], Coachmark.prototype, "shortcutKey", 2);
|
|
263
|
+
__decorateClass([
|
|
264
|
+
property({ type: Array })
|
|
265
|
+
], Coachmark.prototype, "modifierKeys", 2);
|
|
266
|
+
__decorateClass([
|
|
267
|
+
property({ attribute: "src" })
|
|
268
|
+
], Coachmark.prototype, "source", 2);
|
|
269
|
+
__decorateClass([
|
|
270
|
+
property({ attribute: "media-type" })
|
|
271
|
+
], Coachmark.prototype, "mediaType", 2);
|
|
272
|
+
__decorateClass([
|
|
273
|
+
property({ type: Boolean, attribute: "has-asset", reflect: true })
|
|
274
|
+
], Coachmark.prototype, "hasAsset", 2);
|
|
275
|
+
__decorateClass([
|
|
276
|
+
property()
|
|
277
|
+
], Coachmark.prototype, "asset", 2);
|
|
278
|
+
__decorateClass([
|
|
279
|
+
property({ type: Number, attribute: "current-step" })
|
|
280
|
+
], Coachmark.prototype, "currentStep", 2);
|
|
281
|
+
__decorateClass([
|
|
282
|
+
property({ type: Number, attribute: "total-steps" })
|
|
283
|
+
], Coachmark.prototype, "totalSteps", 2);
|
|
284
|
+
__decorateClass([
|
|
285
|
+
property({ type: String, attribute: "primary-cta" })
|
|
286
|
+
], Coachmark.prototype, "primaryCTA", 2);
|
|
39
287
|
__decorateClass([
|
|
40
|
-
property({
|
|
41
|
-
], Coachmark.prototype, "
|
|
288
|
+
property({ type: String, attribute: "secondary-cta" })
|
|
289
|
+
], Coachmark.prototype, "secondaryCTA", 2);
|
|
42
290
|
//# sourceMappingURL=Coachmark.dev.js.map
|
package/src/Coachmark.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Coachmark.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './coachmark.css.js';\n\n/**\n * @element sp-coachmark\n */\nexport class Coachmark extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ reflect: true })\n public variant: 'dark' | 'light' | '' = '';\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"ring\"></div>\n <div class=\"ring\"></div>\n <div class=\"ring\"></div>\n `;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { when } from '@spectrum-web-components/base/src/directives.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport coachmarkStyles from './coachmark.css.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { join } from 'lit/directives/join.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay';\nimport { MediaType } from './CoachmarkItem.dev.js'\nimport type { CoachmarkItem } from './CoachmarkItem.dev.js'\nimport '@spectrum-web-components/asset/sp-asset.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\nimport '@spectrum-web-components/quick-actions/sp-quick-actions.js';\n\n/**\n * @element sp-coachmark\n * @fires primary - Announces that the \"primary\" button has been clicked.\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @slot cover-photo - This is the cover photo for Default and Quiet Coachmark\n * @slot heading - HTML content to be listed as the heading\n * @slot description - A description of the card\n * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object\n */\nexport class Coachmark extends LikeAnchor(Popover) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, coachmarkStyles, chevronStyles];\n }\n @property({ type: Object })\n public item?: CoachmarkItem;\n\n @property({ type: String })\n public override placement: Placement = 'right';\n\n @property({ type: Object, attribute: false })\n private content?: {\n title?: string;\n description?: string;\n imageAlt?: string;\n };\n\n @property({ attribute: 'shortcut-key' })\n private shortcutKey?: string;\n\n @property({ type: Array })\n public modifierKeys?: string[] = [];\n\n @property({ attribute: 'src' })\n private source?: string;\n\n @property({ attribute: 'media-type' })\n private mediaType?: MediaType;\n\n @property({ type: Boolean, attribute: 'has-asset', reflect: true })\n public hasAsset = false;\n\n @property()\n public asset?: 'file' | 'folder';\n\n @property({ type: Number, attribute: 'current-step' })\n public currentStep?: number;\n\n @property({ type: Number, attribute: 'total-steps' })\n public totalSteps?: number;\n\n @property({ type: String, attribute: 'primary-cta' })\n primaryCTA?: string;\n\n @property({ type: String, attribute: 'secondary-cta' })\n secondaryCTA?: string;\n\n // render video and images\n private renderMedia(): TemplateResult {\n const isImage = this.mediaType === MediaType.IMAGE;\n if (!isImage) {\n return html`\n <slot name=\"asset\"></slot>\n `;\n }\n return html`\n <sp-asset id=\"cover-photo\">\n <div class=\"image-wrapper\">\n <img\n class=\"image\"\n loading=\"lazy\"\n slot=\"cover-photo\"\n src=\"${ifDefined(this.source)}\"\n alt=\"${ifDefined(this?.content?.imageAlt)}\"\n />\n </div>\n </sp-asset>\n `;\n }\n // method to render modifier\n private renderModifier(\n modifierKey: string,\n type: 'modifier' | 'shortcut' = 'modifier'\n ): TemplateResult {\n return html`\n <span type=\"${type}\" class=\"keyboard-shortcut\">${modifierKey}</span>\n `;\n }\n\n private renderJoiner(): TemplateResult {\n return html`\n <span class=\"plus\">+</span>\n `;\n }\n // render heading title and modifier\n private renderHeader(): TemplateResult {\n const hasModifier = this.modifierKeys && this.modifierKeys?.length > 0;\n const hasShortcut = Boolean(this.shortcutKey);\n const hasTitle = Boolean(this.content?.title);\n if (!hasTitle && !hasModifier && !hasShortcut) {\n return html`\n <div class=\"title\"><slot name=\"title\"></slot></div>\n `;\n }\n return html`\n ${hasTitle\n ? html`\n <div class=\"title\">${this.content?.title}</div>\n `\n : nothing}\n ${hasModifier || hasShortcut\n ? html`\n <kbd class=\"keys spectrum-Body spectrum-Body--sizeS\">\n ${hasModifier\n ? join(\n this.modifierKeys?.map((k) =>\n this.renderModifier(k)\n ),\n this.renderJoiner()\n )\n : nothing}\n ${hasShortcut && hasModifier\n ? this.renderJoiner()\n : nothing}\n ${hasShortcut\n ? this.renderModifier(\n this.shortcutKey!,\n 'shortcut'\n )\n : nothing}\n </kbd>\n `\n : nothing}\n `;\n }\n // render description\n private renderContent(): TemplateResult {\n const hasDescription = Boolean(this.content?.description);\n if (!hasDescription)\n return html`\n <slot name=\"content\"></slot>\n `;\n return html`\n <div>${this.content?.description}</div>\n `;\n }\n\n private stopPropagationOnHref(event: Event): void {\n if (this.href) {\n event.stopPropagation();\n }\n }\n\n // event on primary button\n private handlePrimaryCTA(): void {\n this.dispatchEvent(\n new Event('primary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n // event on secondary button\n private handleSecondaryCTA(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private renderSecondaryButton = (): TemplateResult => {\n return html`\n <sp-button\n treatment=\"outline\"\n variant=\"secondary\"\n @click=${this.handleSecondaryCTA}\n >\n ${this.secondaryCTA}\n </sp-button>\n `;\n };\n\n private renderPrimaryButton = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n private renderSecondaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n icon-only\n aria-label=\"previous\"\n @click=${this.handleSecondaryCTA}\n >\n <sp-icon-chevron200\n size=\"s\"\n class=\"spectrum-UIIcon-ChevronLeft75\"\n slot=\"icon\"\n ></sp-icon-chevron200>\n </sp-button>\n `;\n };\n\n private renderPrimaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n protected renderButtons(): TemplateResult {\n return html`\n <sp-button-group class=\"spectrum-ButtonGroup buttongroup\">\n ${when(this.secondaryCTA, this.renderSecondaryButton)}\n ${when(this.primaryCTA, this.renderPrimaryButton)}\n </sp-button-group>\n <sp-button-group\n class=\"spectrum-ButtonGroup buttongroup-mobile\"\n size=\"s\"\n >\n ${when(this.secondaryCTA, this.renderSecondaryButtonMobile)}\n ${when(this.primaryCTA, this.renderPrimaryButtonMobile)}\n </sp-button-group>\n `;\n }\n\n // render steps\n protected renderSteps = (): TemplateResult => {\n return html`\n <div class=\"step\" role=\"status\">\n <span aria-live=\"polite\">\n ${this.currentStep} of ${this.totalSteps}\n </span>\n </div>\n `;\n };\n // render action menu\n protected renderActionMenu = (): TemplateResult => {\n return html`\n <div class=\"action-menu\" @pointerdown=${this.stopPropagationOnHref}>\n <slot name=\"actions\"></slot>\n </div>\n `;\n };\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderMedia()}\n <div class=\"header\">\n <div class=\"flex-container\">${this.renderHeader()}</div>\n <div class=\"static-item\">\n ${when(\n this.secondaryCTA && this.primaryCTA,\n this.renderActionMenu\n )}\n </div>\n </div>\n\n <div class=\"content\">${this.renderContent()}</div>\n <div class=\"footer\">\n ${when(\n this.totalSteps && this.totalSteps > 1,\n this.renderSteps\n )}\n ${this.renderButtons()}\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,OAAO,qBAAqB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO;AACP,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAE1B,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAWA,aAAM,kBAAkB,WAAW,OAAO,EAAE;AAAA,EAA5C;AAAA;AAQH,SAAgB,YAAuB;AAavC,SAAO,eAA0B,CAAC;AASlC,SAAO,WAAW;AAoIlB,SAAQ,wBAAwB,MAAsB;AAClD,aAAO;AAAA;AAAA;AAAA;AAAA,yBAIU,KAAK,kBAAkB;AAAA;AAAA,kBAE9B,KAAK,YAAY;AAAA;AAAA;AAAA,IAG/B;AAEA,SAAQ,sBAAsB,MAAsB;AAChD,aAAO;AAAA;AA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ADN,SAAS,EAAE,MAAM,SAAS,WAAW,aAAa,SAAS,KAAK,CAAC;AAAA,GA7BzD,UA8BF;AAGA;AAAA,EADN,SAAS;AAAA,GAhCD,UAiCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,eAAe,CAAC;AAAA,GAnC5C,UAoCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GAtC3C,UAuCF;AAGP;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GAzC3C,UA0CT;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,gBAAgB,CAAC;AAAA,GA5C7C,UA6CT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Coachmark.js
CHANGED
|
@@ -1,6 +1,113 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";var v=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var i=(d,l,r,e)=>{for(var s=e>1?void 0:e?b(l,r):l,o=d.length-1,a;o>=0;o--)(a=d[o])&&(s=(e?a(l,r,s):a(s))||s);return e&&s&&v(l,r,s),s};import{html as t,nothing as u}from"@spectrum-web-components/base";import{property as n}from"@spectrum-web-components/base/src/decorators.js";import{when as p}from"@spectrum-web-components/base/src/directives.js";import{LikeAnchor as f}from"@spectrum-web-components/shared/src/like-anchor.js";import T from"./coachmark.css.js";import g from"@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js";import{Popover as $}from"@spectrum-web-components/popover";import{join as A}from"lit/directives/join.js";import{ifDefined as h}from"@spectrum-web-components/base/src/directives.js";import{MediaType as S}from"./CoachmarkItem.js";import"@spectrum-web-components/asset/sp-asset.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/button-group/sp-button-group.js";import"@spectrum-web-components/quick-actions/sp-quick-actions.js";export class Coachmark extends f($){constructor(){super(...arguments);this.placement="right";this.modifierKeys=[];this.hasAsset=!1;this.renderSecondaryButton=()=>t`
|
|
2
|
+
<sp-button
|
|
3
|
+
treatment="outline"
|
|
4
|
+
variant="secondary"
|
|
5
|
+
@click=${this.handleSecondaryCTA}
|
|
6
|
+
>
|
|
7
|
+
${this.secondaryCTA}
|
|
8
|
+
</sp-button>
|
|
9
|
+
`;this.renderPrimaryButton=()=>t`
|
|
10
|
+
<sp-button
|
|
11
|
+
size="s"
|
|
12
|
+
treatment="outline"
|
|
13
|
+
variant="primary"
|
|
14
|
+
@click=${this.handlePrimaryCTA}
|
|
15
|
+
>
|
|
16
|
+
${this.primaryCTA}
|
|
17
|
+
</sp-button>
|
|
18
|
+
`;this.renderSecondaryButtonMobile=()=>t`
|
|
19
|
+
<sp-button
|
|
20
|
+
variant="secondary"
|
|
21
|
+
treatment="outline"
|
|
22
|
+
icon-only
|
|
23
|
+
aria-label="previous"
|
|
24
|
+
@click=${this.handleSecondaryCTA}
|
|
25
|
+
>
|
|
26
|
+
<sp-icon-chevron200
|
|
27
|
+
size="s"
|
|
28
|
+
class="spectrum-UIIcon-ChevronLeft75"
|
|
29
|
+
slot="icon"
|
|
30
|
+
></sp-icon-chevron200>
|
|
31
|
+
</sp-button>
|
|
32
|
+
`;this.renderPrimaryButtonMobile=()=>t`
|
|
33
|
+
<sp-button
|
|
34
|
+
size="s"
|
|
35
|
+
treatment="outline"
|
|
36
|
+
variant="primary"
|
|
37
|
+
@click=${this.handlePrimaryCTA}
|
|
38
|
+
>
|
|
39
|
+
${this.primaryCTA}
|
|
40
|
+
</sp-button>
|
|
41
|
+
`;this.renderSteps=()=>t`
|
|
42
|
+
<div class="step" role="status">
|
|
43
|
+
<span aria-live="polite">
|
|
44
|
+
${this.currentStep} of ${this.totalSteps}
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
`;this.renderActionMenu=()=>t`
|
|
48
|
+
<div class="action-menu" @pointerdown=${this.stopPropagationOnHref}>
|
|
49
|
+
<slot name="actions"></slot>
|
|
50
|
+
</div>
|
|
51
|
+
`}static get styles(){return[...super.styles,T,g]}renderMedia(){var e;return this.mediaType===S.IMAGE?t`
|
|
52
|
+
<sp-asset id="cover-photo">
|
|
53
|
+
<div class="image-wrapper">
|
|
54
|
+
<img
|
|
55
|
+
class="image"
|
|
56
|
+
loading="lazy"
|
|
57
|
+
slot="cover-photo"
|
|
58
|
+
src="${h(this.source)}"
|
|
59
|
+
alt="${h((e=this==null?void 0:this.content)==null?void 0:e.imageAlt)}"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</sp-asset>
|
|
63
|
+
`:t`
|
|
64
|
+
<slot name="asset"></slot>
|
|
65
|
+
`}renderModifier(r,e="modifier"){return t`
|
|
66
|
+
<span type="${e}" class="keyboard-shortcut">${r}</span>
|
|
67
|
+
`}renderJoiner(){return t`
|
|
68
|
+
<span class="plus">+</span>
|
|
69
|
+
`}renderHeader(){var o,a,c,m;const r=this.modifierKeys&&((o=this.modifierKeys)==null?void 0:o.length)>0,e=!!this.shortcutKey,s=!!((a=this.content)!=null&&a.title);return!s&&!r&&!e?t`
|
|
70
|
+
<div class="title"><slot name="title"></slot></div>
|
|
71
|
+
`:t`
|
|
72
|
+
${s?t`
|
|
73
|
+
<div class="title">${(c=this.content)==null?void 0:c.title}</div>
|
|
74
|
+
`:u}
|
|
75
|
+
${r||e?t`
|
|
76
|
+
<kbd class="keys spectrum-Body spectrum-Body--sizeS">
|
|
77
|
+
${r?A((m=this.modifierKeys)==null?void 0:m.map(y=>this.renderModifier(y)),this.renderJoiner()):u}
|
|
78
|
+
${e&&r?this.renderJoiner():u}
|
|
79
|
+
${e?this.renderModifier(this.shortcutKey,"shortcut"):u}
|
|
80
|
+
</kbd>
|
|
81
|
+
`:u}
|
|
82
|
+
`}renderContent(){var e,s;return!((e=this.content)!=null&&e.description)?t`
|
|
83
|
+
<slot name="content"></slot>
|
|
84
|
+
`:t`
|
|
85
|
+
<div>${(s=this.content)==null?void 0:s.description}</div>
|
|
86
|
+
`}stopPropagationOnHref(r){this.href&&r.stopPropagation()}handlePrimaryCTA(){this.dispatchEvent(new Event("primary",{bubbles:!0,composed:!0}))}handleSecondaryCTA(){this.dispatchEvent(new Event("secondary",{bubbles:!0,composed:!0}))}renderButtons(){return t`
|
|
87
|
+
<sp-button-group class="spectrum-ButtonGroup buttongroup">
|
|
88
|
+
${p(this.secondaryCTA,this.renderSecondaryButton)}
|
|
89
|
+
${p(this.primaryCTA,this.renderPrimaryButton)}
|
|
90
|
+
</sp-button-group>
|
|
91
|
+
<sp-button-group
|
|
92
|
+
class="spectrum-ButtonGroup buttongroup-mobile"
|
|
93
|
+
size="s"
|
|
94
|
+
>
|
|
95
|
+
${p(this.secondaryCTA,this.renderSecondaryButtonMobile)}
|
|
96
|
+
${p(this.primaryCTA,this.renderPrimaryButtonMobile)}
|
|
97
|
+
</sp-button-group>
|
|
98
|
+
`}render(){return t`
|
|
99
|
+
${this.renderMedia()}
|
|
100
|
+
<div class="header">
|
|
101
|
+
<div class="flex-container">${this.renderHeader()}</div>
|
|
102
|
+
<div class="static-item">
|
|
103
|
+
${p(this.secondaryCTA&&this.primaryCTA,this.renderActionMenu)}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div class="content">${this.renderContent()}</div>
|
|
108
|
+
<div class="footer">
|
|
109
|
+
${p(this.totalSteps&&this.totalSteps>1,this.renderSteps)}
|
|
110
|
+
${this.renderButtons()}
|
|
111
|
+
</div>
|
|
112
|
+
`}}i([n({type:Object})],Coachmark.prototype,"item",2),i([n({type:String})],Coachmark.prototype,"placement",2),i([n({type:Object,attribute:!1})],Coachmark.prototype,"content",2),i([n({attribute:"shortcut-key"})],Coachmark.prototype,"shortcutKey",2),i([n({type:Array})],Coachmark.prototype,"modifierKeys",2),i([n({attribute:"src"})],Coachmark.prototype,"source",2),i([n({attribute:"media-type"})],Coachmark.prototype,"mediaType",2),i([n({type:Boolean,attribute:"has-asset",reflect:!0})],Coachmark.prototype,"hasAsset",2),i([n()],Coachmark.prototype,"asset",2),i([n({type:Number,attribute:"current-step"})],Coachmark.prototype,"currentStep",2),i([n({type:Number,attribute:"total-steps"})],Coachmark.prototype,"totalSteps",2),i([n({type:String,attribute:"primary-cta"})],Coachmark.prototype,"primaryCTA",2),i([n({type:String,attribute:"secondary-cta"})],Coachmark.prototype,"secondaryCTA",2);
|
|
6
113
|
//# sourceMappingURL=Coachmark.js.map
|