@spectrum-web-components/contextual-help 1.1.0 → 1.1.1
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/package.json +8 -8
- package/sp-contextual-help.d.ts +6 -0
- package/sp-contextual-help.dev.js +4 -0
- package/sp-contextual-help.dev.js.map +7 -0
- package/sp-contextual-help.js +2 -0
- package/sp-contextual-help.js.map +7 -0
- package/src/ContextualHelp.d.ts +47 -0
- package/src/ContextualHelp.dev.js +137 -0
- package/src/ContextualHelp.dev.js.map +7 -0
- package/src/ContextualHelp.js +45 -0
- package/src/ContextualHelp.js.map +7 -0
- package/src/contextual-help-overrides.css.d.ts +2 -0
- package/src/contextual-help-overrides.css.dev.js +7 -0
- package/src/contextual-help-overrides.css.dev.js.map +7 -0
- package/src/contextual-help-overrides.css.js +4 -0
- package/src/contextual-help-overrides.css.js.map +7 -0
- package/src/contextual-help.css.d.ts +2 -0
- package/src/contextual-help.css.dev.js +7 -0
- package/src/contextual-help.css.dev.js.map +7 -0
- package/src/contextual-help.css.js +4 -0
- package/src/contextual-help.css.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-contextual-help.css.d.ts +2 -0
- package/src/spectrum-contextual-help.css.dev.js +7 -0
- package/src/spectrum-contextual-help.css.dev.js.map +7 -0
- package/src/spectrum-contextual-help.css.js +4 -0
- package/src/spectrum-contextual-help.css.js.map +7 -0
- package/stories/args.js +88 -0
- package/stories/args.js.map +7 -0
- package/stories/contextual-help.stories.js +37 -0
- package/stories/contextual-help.stories.js.map +7 -0
- package/stories/index.js +25 -0
- package/stories/index.js.map +7 -0
- package/stories/template.js +4 -0
- package/stories/template.js.map +7 -0
- package/test/benchmark/basic-test.js +8 -0
- package/test/benchmark/basic-test.js.map +7 -0
- package/test/contextual-help-memory.test.js +5 -0
- package/test/contextual-help-memory.test.js.map +7 -0
- package/test/contextual-help.test-vrt.js +5 -0
- package/test/contextual-help.test-vrt.js.map +7 -0
- package/test/contextual-help.test.js +100 -0
- package/test/contextual-help.test.js.map +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/contextual-help",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"lit-html"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@spectrum-web-components/action-button": "^1.1.
|
|
62
|
-
"@spectrum-web-components/base": "^1.1.
|
|
63
|
-
"@spectrum-web-components/dialog": "^1.1.
|
|
64
|
-
"@spectrum-web-components/icons-workflow": "^1.1.
|
|
65
|
-
"@spectrum-web-components/overlay": "^1.1.
|
|
66
|
-
"@spectrum-web-components/popover": "^1.1.
|
|
61
|
+
"@spectrum-web-components/action-button": "^1.1.1",
|
|
62
|
+
"@spectrum-web-components/base": "^1.1.1",
|
|
63
|
+
"@spectrum-web-components/dialog": "^1.1.1",
|
|
64
|
+
"@spectrum-web-components/icons-workflow": "^1.1.1",
|
|
65
|
+
"@spectrum-web-components/overlay": "^1.1.1",
|
|
66
|
+
"@spectrum-web-components/popover": "^1.1.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@spectrum-css/contextualhelp": "4.0.0-s2-foundations.16"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"./**/*.dev.js",
|
|
76
76
|
"./**/*.dev.js"
|
|
77
77
|
],
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "44870aa95001c1b995456d994ae31bbe7277fac9"
|
|
79
79
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-contextual-help.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { ContextualHelp } from './src/ContextualHelp.dev.js'\n\ncustomElements.define('sp-contextual-help', ContextualHelp);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-contextual-help': ContextualHelp;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,sBAAsB;AAE/B,eAAe,OAAO,sBAAsB,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-contextual-help.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { ContextualHelp } from './src/ContextualHelp.js';\n\ncustomElements.define('sp-contextual-help', ContextualHelp);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-contextual-help': ContextualHelp;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,kBAAAA,MAAsB,0BAE/B,eAAe,OAAO,qBAAsBA,CAAc",
|
|
6
|
+
"names": ["ContextualHelp"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
3
|
+
import '@spectrum-web-components/overlay/sp-overlay.js';
|
|
4
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help-outline.js';
|
|
5
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-info-outline.js';
|
|
6
|
+
import type { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';
|
|
7
|
+
import { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';
|
|
8
|
+
/**
|
|
9
|
+
* Spectrum Contextual help provides additional information about
|
|
10
|
+
* the state of either an adjacent component or an entire view.
|
|
11
|
+
* @element sp-contextual-help
|
|
12
|
+
*
|
|
13
|
+
* @slot heading - content to display as the heading of the popover
|
|
14
|
+
* @slot Text content to display in the popover
|
|
15
|
+
* @slot link - link to additional informations
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContextualHelp extends SpectrumElement {
|
|
18
|
+
isMobile: MatchMediaController;
|
|
19
|
+
static get styles(): CSSResultArray;
|
|
20
|
+
/**
|
|
21
|
+
* Provides an accessible name for the action button trigger.
|
|
22
|
+
* @param {String} label
|
|
23
|
+
*/
|
|
24
|
+
label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The `variant` property applies specific styling on the action button trigger.
|
|
27
|
+
* @param {String} variant
|
|
28
|
+
*/
|
|
29
|
+
variant: 'info' | 'help';
|
|
30
|
+
/**
|
|
31
|
+
* @type {"top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end"}
|
|
32
|
+
* @attr
|
|
33
|
+
*/
|
|
34
|
+
placement?: Placement;
|
|
35
|
+
/**
|
|
36
|
+
* The `offset` property accepts either a single number, to
|
|
37
|
+
* define the offset of the Popover along the main axis from
|
|
38
|
+
* the action button, or 2-tuple, to define the offset along the
|
|
39
|
+
* main axis and the cross axis.
|
|
40
|
+
*/
|
|
41
|
+
offset: number | [number, number];
|
|
42
|
+
open: boolean;
|
|
43
|
+
get buttonAriaLabel(): string;
|
|
44
|
+
private renderOverlayContent;
|
|
45
|
+
private handleSlottableRequest;
|
|
46
|
+
protected render(): TemplateResult;
|
|
47
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
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) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
render,
|
|
15
|
+
SpectrumElement
|
|
16
|
+
} from "@spectrum-web-components/base";
|
|
17
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
18
|
+
import "@spectrum-web-components/overlay/sp-overlay.js";
|
|
19
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-help-outline.js";
|
|
20
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-info-outline.js";
|
|
21
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
22
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
23
|
+
import {
|
|
24
|
+
removeSlottableRequest
|
|
25
|
+
} from "@spectrum-web-components/overlay/src/slottable-request-event.js";
|
|
26
|
+
import {
|
|
27
|
+
IS_MOBILE,
|
|
28
|
+
MatchMediaController
|
|
29
|
+
} from "@spectrum-web-components/reactive-controllers/src/MatchMedia.js";
|
|
30
|
+
import styles from "./contextual-help.css.js";
|
|
31
|
+
export class ContextualHelp extends SpectrumElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.isMobile = new MatchMediaController(this, IS_MOBILE);
|
|
35
|
+
this.variant = "info";
|
|
36
|
+
this.placement = "bottom-start";
|
|
37
|
+
this.offset = 0;
|
|
38
|
+
this.open = false;
|
|
39
|
+
}
|
|
40
|
+
static get styles() {
|
|
41
|
+
return [styles];
|
|
42
|
+
}
|
|
43
|
+
get buttonAriaLabel() {
|
|
44
|
+
if (this.label) {
|
|
45
|
+
return this.label;
|
|
46
|
+
} else {
|
|
47
|
+
if (this.variant === "help") {
|
|
48
|
+
return "Help";
|
|
49
|
+
}
|
|
50
|
+
return "Informations";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
renderOverlayContent() {
|
|
54
|
+
if (this.isMobile.matches) {
|
|
55
|
+
import("@spectrum-web-components/dialog/sp-dialog-base.js");
|
|
56
|
+
import("@spectrum-web-components/dialog/sp-dialog.js");
|
|
57
|
+
return html`
|
|
58
|
+
<sp-dialog-base underlay>
|
|
59
|
+
<sp-dialog dismissable size="s">
|
|
60
|
+
<slot name="heading" slot="heading"></slot>
|
|
61
|
+
<slot></slot>
|
|
62
|
+
<slot name="link"></slot>
|
|
63
|
+
</sp-dialog>
|
|
64
|
+
</sp-dialog-base>
|
|
65
|
+
`;
|
|
66
|
+
} else {
|
|
67
|
+
import("@spectrum-web-components/popover/sp-popover.js");
|
|
68
|
+
return html`
|
|
69
|
+
<sp-popover class="popover">
|
|
70
|
+
<section>
|
|
71
|
+
<slot name="heading"></slot>
|
|
72
|
+
<slot></slot>
|
|
73
|
+
<slot name="link"></slot>
|
|
74
|
+
</section>
|
|
75
|
+
</sp-popover>
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
handleSlottableRequest(event) {
|
|
80
|
+
event.stopPropagation();
|
|
81
|
+
if (event.data === removeSlottableRequest) {
|
|
82
|
+
this.open = false;
|
|
83
|
+
render(void 0, event.target);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.open = true;
|
|
87
|
+
const template = this.renderOverlayContent();
|
|
88
|
+
render(template, event.target);
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
const actualPlacement = this.isMobile.matches ? void 0 : this.placement;
|
|
92
|
+
return html`
|
|
93
|
+
<sp-action-button
|
|
94
|
+
quiet
|
|
95
|
+
size="s"
|
|
96
|
+
id="trigger"
|
|
97
|
+
aria-label=${this.buttonAriaLabel}
|
|
98
|
+
.active=${this.open}
|
|
99
|
+
>
|
|
100
|
+
${this.variant === "help" ? html`
|
|
101
|
+
<sp-icon-help-outline
|
|
102
|
+
slot="icon"
|
|
103
|
+
></sp-icon-help-outline>
|
|
104
|
+
` : html`
|
|
105
|
+
<sp-icon-info-outline
|
|
106
|
+
slot="icon"
|
|
107
|
+
></sp-icon-info-outline>
|
|
108
|
+
`}
|
|
109
|
+
</sp-action-button>
|
|
110
|
+
<sp-overlay
|
|
111
|
+
trigger="trigger@click"
|
|
112
|
+
placement=${ifDefined(actualPlacement)}
|
|
113
|
+
type=${this.isMobile.matches ? "modal" : "auto"}
|
|
114
|
+
receives-focus="true"
|
|
115
|
+
.offset=${this.offset}
|
|
116
|
+
@slottable-request=${this.handleSlottableRequest}
|
|
117
|
+
?open=${this.open}
|
|
118
|
+
></sp-overlay>
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property()
|
|
124
|
+
], ContextualHelp.prototype, "label", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
property()
|
|
127
|
+
], ContextualHelp.prototype, "variant", 2);
|
|
128
|
+
__decorateClass([
|
|
129
|
+
property({ reflect: true })
|
|
130
|
+
], ContextualHelp.prototype, "placement", 2);
|
|
131
|
+
__decorateClass([
|
|
132
|
+
property({ type: Number })
|
|
133
|
+
], ContextualHelp.prototype, "offset", 2);
|
|
134
|
+
__decorateClass([
|
|
135
|
+
property({ type: Boolean })
|
|
136
|
+
], ContextualHelp.prototype, "open", 2);
|
|
137
|
+
//# sourceMappingURL=ContextualHelp.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["ContextualHelp.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 render,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help-outline.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info-outline.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from '@spectrum-web-components/overlay/src/slottable-request-event.js';\nimport {\n IS_MOBILE,\n MatchMediaController,\n} from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\nimport styles from './contextual-help.css.js';\n\n/**\n * Spectrum Contextual help provides additional information about\n * the state of either an adjacent component or an entire view.\n * @element sp-contextual-help\n *\n * @slot heading - content to display as the heading of the popover\n * @slot Text content to display in the popover\n * @slot link - link to additional informations\n */\nexport class ContextualHelp extends SpectrumElement {\n public isMobile = new MatchMediaController(this, IS_MOBILE);\n\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n /**\n * Provides an accessible name for the action button trigger.\n * @param {String} label\n */\n @property()\n public label?: string;\n\n /**\n * The `variant` property applies specific styling on the action button trigger.\n * @param {String} variant\n */\n @property()\n public variant: 'info' | 'help' = 'info';\n\n /**\n * @type {\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\"}\n * @attr\n */\n @property({ reflect: true })\n public placement?: Placement = 'bottom-start';\n\n /**\n * The `offset` property accepts either a single number, to\n * define the offset of the Popover along the main axis from\n * the action button, or 2-tuple, to define the offset along the\n * main axis and the cross axis.\n */\n @property({ type: Number })\n public offset: number | [number, number] = 0;\n\n @property({ type: Boolean })\n open = false;\n\n public get buttonAriaLabel(): string {\n if (this.label) {\n return this.label;\n } else {\n if (this.variant === 'help') {\n return 'Help';\n }\n return 'Informations';\n }\n }\n\n private renderOverlayContent(): TemplateResult {\n if (this.isMobile.matches) {\n import('@spectrum-web-components/dialog/sp-dialog-base.js');\n import('@spectrum-web-components/dialog/sp-dialog.js');\n\n return html`\n <sp-dialog-base underlay>\n <sp-dialog dismissable size=\"s\">\n <slot name=\"heading\" slot=\"heading\"></slot>\n <slot></slot>\n <slot name=\"link\"></slot>\n </sp-dialog>\n </sp-dialog-base>\n `;\n } else {\n import('@spectrum-web-components/popover/sp-popover.js');\n\n return html`\n <sp-popover class=\"popover\">\n <section>\n <slot name=\"heading\"></slot>\n <slot></slot>\n <slot name=\"link\"></slot>\n </section>\n </sp-popover>\n `;\n }\n }\n\n private handleSlottableRequest(event: SlottableRequestEvent): void {\n event.stopPropagation();\n\n if (event.data === removeSlottableRequest) {\n this.open = false;\n render(undefined, event.target as HTMLElement);\n return;\n }\n\n this.open = true;\n const template = this.renderOverlayContent();\n render(template, event.target as HTMLElement);\n }\n\n protected override render(): TemplateResult {\n /* c8 ignore next 3 */\n const actualPlacement = this.isMobile.matches\n ? undefined\n : this.placement;\n\n return html`\n <sp-action-button\n quiet\n size=\"s\"\n id=\"trigger\"\n aria-label=${this.buttonAriaLabel}\n .active=${this.open}\n >\n ${this.variant === 'help'\n ? html`\n <sp-icon-help-outline\n slot=\"icon\"\n ></sp-icon-help-outline>\n `\n : html`\n <sp-icon-info-outline\n slot=\"icon\"\n ></sp-icon-info-outline>\n `}\n </sp-action-button>\n <sp-overlay\n trigger=\"trigger@click\"\n placement=${ifDefined(actualPlacement)}\n type=${this.isMobile.matches ? 'modal' : 'auto'}\n receives-focus=\"true\"\n .offset=${this.offset}\n @slottable-request=${this.handleSlottableRequest}\n ?open=${this.open}\n ></sp-overlay>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B;AAAA,EACI;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,OAAO,YAAY;AAWZ,aAAM,uBAAuB,gBAAgB;AAAA,EAA7C;AAAA;AACH,SAAO,WAAW,IAAI,qBAAqB,MAAM,SAAS;AAkB1D,SAAO,UAA2B;AAOlC,SAAO,YAAwB;AAS/B,SAAO,SAAoC;AAG3C,gBAAO;AAAA;AAAA,EAnCP,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAmCA,IAAW,kBAA0B;AACjC,QAAI,KAAK,OAAO;AACZ,aAAO,KAAK;AAAA,IAChB,OAAO;AACH,UAAI,KAAK,YAAY,QAAQ;AACzB,eAAO;AAAA,MACX;AACA,aAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAEQ,uBAAuC;AAC3C,QAAI,KAAK,SAAS,SAAS;AACvB,aAAO,mDAAmD;AAC1D,aAAO,8CAA8C;A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,45 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=(n,s,e,o)=>{for(var t=o>1?void 0:o?c(s,e):s,a=n.length-1,p;a>=0;a--)(p=n[a])&&(t=(o?p(s,e,t):p(t))||t);return o&&t&&u(s,e,t),t};import{html as r,render as m,SpectrumElement as b}from"@spectrum-web-components/base";import"@spectrum-web-components/action-button/sp-action-button.js";import"@spectrum-web-components/overlay/sp-overlay.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-help-outline.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-info-outline.js";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as h}from"@spectrum-web-components/base/src/directives.js";import{removeSlottableRequest as f}from"@spectrum-web-components/overlay/src/slottable-request-event.js";import{IS_MOBILE as d,MatchMediaController as g}from"@spectrum-web-components/reactive-controllers/src/MatchMedia.js";import v from"./contextual-help.css.js";export class ContextualHelp extends b{constructor(){super(...arguments);this.isMobile=new g(this,d);this.variant="info";this.placement="bottom-start";this.offset=0;this.open=!1}static get styles(){return[v]}get buttonAriaLabel(){return this.label?this.label:this.variant==="help"?"Help":"Informations"}renderOverlayContent(){return this.isMobile.matches?(import("@spectrum-web-components/dialog/sp-dialog-base.js"),import("@spectrum-web-components/dialog/sp-dialog.js"),r`
|
|
2
|
+
<sp-dialog-base underlay>
|
|
3
|
+
<sp-dialog dismissable size="s">
|
|
4
|
+
<slot name="heading" slot="heading"></slot>
|
|
5
|
+
<slot></slot>
|
|
6
|
+
<slot name="link"></slot>
|
|
7
|
+
</sp-dialog>
|
|
8
|
+
</sp-dialog-base>
|
|
9
|
+
`):(import("@spectrum-web-components/popover/sp-popover.js"),r`
|
|
10
|
+
<sp-popover class="popover">
|
|
11
|
+
<section>
|
|
12
|
+
<slot name="heading"></slot>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
<slot name="link"></slot>
|
|
15
|
+
</section>
|
|
16
|
+
</sp-popover>
|
|
17
|
+
`)}handleSlottableRequest(e){if(e.stopPropagation(),e.data===f){this.open=!1,m(void 0,e.target);return}this.open=!0;const o=this.renderOverlayContent();m(o,e.target)}render(){const e=this.isMobile.matches?void 0:this.placement;return r`
|
|
18
|
+
<sp-action-button
|
|
19
|
+
quiet
|
|
20
|
+
size="s"
|
|
21
|
+
id="trigger"
|
|
22
|
+
aria-label=${this.buttonAriaLabel}
|
|
23
|
+
.active=${this.open}
|
|
24
|
+
>
|
|
25
|
+
${this.variant==="help"?r`
|
|
26
|
+
<sp-icon-help-outline
|
|
27
|
+
slot="icon"
|
|
28
|
+
></sp-icon-help-outline>
|
|
29
|
+
`:r`
|
|
30
|
+
<sp-icon-info-outline
|
|
31
|
+
slot="icon"
|
|
32
|
+
></sp-icon-info-outline>
|
|
33
|
+
`}
|
|
34
|
+
</sp-action-button>
|
|
35
|
+
<sp-overlay
|
|
36
|
+
trigger="trigger@click"
|
|
37
|
+
placement=${h(e)}
|
|
38
|
+
type=${this.isMobile.matches?"modal":"auto"}
|
|
39
|
+
receives-focus="true"
|
|
40
|
+
.offset=${this.offset}
|
|
41
|
+
@slottable-request=${this.handleSlottableRequest}
|
|
42
|
+
?open=${this.open}
|
|
43
|
+
></sp-overlay>
|
|
44
|
+
`}}i([l()],ContextualHelp.prototype,"label",2),i([l()],ContextualHelp.prototype,"variant",2),i([l({reflect:!0})],ContextualHelp.prototype,"placement",2),i([l({type:Number})],ContextualHelp.prototype,"offset",2),i([l({type:Boolean})],ContextualHelp.prototype,"open",2);
|
|
45
|
+
//# sourceMappingURL=ContextualHelp.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["ContextualHelp.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 render,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help-outline.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info-outline.js';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport {\n removeSlottableRequest,\n SlottableRequestEvent,\n} from '@spectrum-web-components/overlay/src/slottable-request-event.js';\nimport {\n IS_MOBILE,\n MatchMediaController,\n} from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\nimport styles from './contextual-help.css.js';\n\n/**\n * Spectrum Contextual help provides additional information about\n * the state of either an adjacent component or an entire view.\n * @element sp-contextual-help\n *\n * @slot heading - content to display as the heading of the popover\n * @slot Text content to display in the popover\n * @slot link - link to additional informations\n */\nexport class ContextualHelp extends SpectrumElement {\n public isMobile = new MatchMediaController(this, IS_MOBILE);\n\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n /**\n * Provides an accessible name for the action button trigger.\n * @param {String} label\n */\n @property()\n public label?: string;\n\n /**\n * The `variant` property applies specific styling on the action button trigger.\n * @param {String} variant\n */\n @property()\n public variant: 'info' | 'help' = 'info';\n\n /**\n * @type {\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\"}\n * @attr\n */\n @property({ reflect: true })\n public placement?: Placement = 'bottom-start';\n\n /**\n * The `offset` property accepts either a single number, to\n * define the offset of the Popover along the main axis from\n * the action button, or 2-tuple, to define the offset along the\n * main axis and the cross axis.\n */\n @property({ type: Number })\n public offset: number | [number, number] = 0;\n\n @property({ type: Boolean })\n open = false;\n\n public get buttonAriaLabel(): string {\n if (this.label) {\n return this.label;\n } else {\n if (this.variant === 'help') {\n return 'Help';\n }\n return 'Informations';\n }\n }\n\n private renderOverlayContent(): TemplateResult {\n if (this.isMobile.matches) {\n import('@spectrum-web-components/dialog/sp-dialog-base.js');\n import('@spectrum-web-components/dialog/sp-dialog.js');\n\n return html`\n <sp-dialog-base underlay>\n <sp-dialog dismissable size=\"s\">\n <slot name=\"heading\" slot=\"heading\"></slot>\n <slot></slot>\n <slot name=\"link\"></slot>\n </sp-dialog>\n </sp-dialog-base>\n `;\n } else {\n import('@spectrum-web-components/popover/sp-popover.js');\n\n return html`\n <sp-popover class=\"popover\">\n <section>\n <slot name=\"heading\"></slot>\n <slot></slot>\n <slot name=\"link\"></slot>\n </section>\n </sp-popover>\n `;\n }\n }\n\n private handleSlottableRequest(event: SlottableRequestEvent): void {\n event.stopPropagation();\n\n if (event.data === removeSlottableRequest) {\n this.open = false;\n render(undefined, event.target as HTMLElement);\n return;\n }\n\n this.open = true;\n const template = this.renderOverlayContent();\n render(template, event.target as HTMLElement);\n }\n\n protected override render(): TemplateResult {\n /* c8 ignore next 3 */\n const actualPlacement = this.isMobile.matches\n ? undefined\n : this.placement;\n\n return html`\n <sp-action-button\n quiet\n size=\"s\"\n id=\"trigger\"\n aria-label=${this.buttonAriaLabel}\n .active=${this.open}\n >\n ${this.variant === 'help'\n ? html`\n <sp-icon-help-outline\n slot=\"icon\"\n ></sp-icon-help-outline>\n `\n : html`\n <sp-icon-info-outline\n slot=\"icon\"\n ></sp-icon-info-outline>\n `}\n </sp-action-button>\n <sp-overlay\n trigger=\"trigger@click\"\n placement=${ifDefined(actualPlacement)}\n type=${this.isMobile.matches ? 'modal' : 'auto'}\n receives-focus=\"true\"\n .offset=${this.offset}\n @slottable-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AA;AAAA,kBAEjB,KAAK,UAAY,OACbA;AAAA;AAAA;AAAA;AAAA,wBAKAA;AAAA;AAAA;AAAA;AAAA,uBAIC;AAAA;AAAA;AAAA;AAAA,4BAIKI,EAAUO,CAAe,CAAC;AAAA,uBAC/B,KAAK,SAAS,QAAU,QAAU,MAAM;AAAA;AAAA,0BAErC,KAAK,MAAM;AAAA,qCACA,KAAK,sBAAsB;AAAA,wBACxC,KAAK,IAAI;AAAA;AAAA,SAG7B,CACJ,CAvHWC,EAAA,CADNT,EAAS,GAXD,eAYF,qBAOAS,EAAA,CADNT,EAAS,GAlBD,eAmBF,uBAOAS,EAAA,CADNT,EAAS,CAAE,QAAS,EAAK,CAAC,GAzBlB,eA0BF,yBASAS,EAAA,CADNT,EAAS,CAAE,KAAM,MAAO,CAAC,GAlCjB,eAmCF,sBAGPS,EAAA,CADCT,EAAS,CAAE,KAAM,OAAQ,CAAC,GArClB,eAsCT",
|
|
6
|
+
"names": ["html", "render", "SpectrumElement", "property", "ifDefined", "removeSlottableRequest", "IS_MOBILE", "MatchMediaController", "styles", "event", "template", "actualPlacement", "__decorateClass"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=contextual-help-overrides.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as e}from"@spectrum-web-components/base";const t=e`
|
|
2
|
+
:host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}
|
|
3
|
+
`;export default t;
|
|
4
|
+
//# sourceMappingURL=contextual-help-overrides.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
.popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}:host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}:host{display:inline-block}::slotted([slot=link]){display:block}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=contextual-help.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n .popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}:host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}:host{display:inline-block}::slotted([slot=link]){display:block}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as e}from"@spectrum-web-components/base";const t=e`
|
|
2
|
+
.popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}:host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}:host{display:inline-block}::slotted([slot=link]){display:block}
|
|
3
|
+
`;export default t;
|
|
4
|
+
//# sourceMappingURL=contextual-help.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n .popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}:host{--spectrum-contextual-help-padding:var(--system-contextual-help-padding);--spectrum-contextual-help-content-spacing:var(--system-contextual-help-content-spacing);--spectrum-contextual-help-link-spacing:var(--system-contextual-help-link-spacing);--spectrum-contextual-help-heading-size:var(--system-contextual-help-heading-size);--spectrum-contextual-help-heading-color:var(--system-contextual-help-heading-color);--spectrum-contextual-help-body-color:var(--system-contextual-help-body-color)}:host{display:inline-block}::slotted([slot=link]){display:block}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ContextualHelp.js';
|
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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*/\nexport * from './ContextualHelp.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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*/\nexport * from './ContextualHelp.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
.popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=spectrum-contextual-help.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-contextual-help.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n .popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";import{css as t}from"@spectrum-web-components/base";const e=t`
|
|
2
|
+
.popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}
|
|
3
|
+
`;export default e;
|
|
4
|
+
//# sourceMappingURL=spectrum-contextual-help.css.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["spectrum-contextual-help.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n .popover{min-inline-size:var(--mod-spectrum-contextual-help-minimum-width,var(--spectrum-contextual-help-minimum-width));padding-block:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));padding-inline:var(--mod-spectrum-contextual-help-padding,var(--spectrum-contextual-help-padding));font-size:var(--mod-spectrum-contextual-help-body-size,var(--spectrum-contextual-help-body-size));color:var(--highcontrast-contextual-help-body-color,var(--mod-contextual-help-body-color,var(--spectrum-contextual-help-body-color)));position:relative}.popover .body,.popover ::slotted([slot=heading]){margin:0}.popover ::slotted([slot=heading]){font-size:var(--mod-spectrum-contextual-help-heading-size,var(--spectrum-contextual-help-heading-size));color:var(--highcontrast-contextual-help-heading-color,var(--mod-contextual-help-heading-color,var(--spectrum-contextual-help-heading-color)));margin-block-end:var(--mod-spectrum-contextual-help-content-spacing,var(--spectrum-contextual-help-content-spacing))}::slotted([slot=link]){margin-block-start:var(--mod-spectrum-contextual-help-link-spacing,var(--spectrum-contextual-help-link-spacing))}@media (forced-colors:active){:host{--highcontrast-contextual-help-heading-color:CanvasText;--highcontrast-contextual-help-body-color:CanvasText}}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|
package/stories/args.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export const argTypes = {
|
|
3
|
+
open: {
|
|
4
|
+
name: "open",
|
|
5
|
+
type: { name: "boolean", required: false },
|
|
6
|
+
table: {
|
|
7
|
+
type: { summary: "boolean" },
|
|
8
|
+
defaultValue: { summary: false }
|
|
9
|
+
},
|
|
10
|
+
control: {
|
|
11
|
+
type: "boolean"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
variant: {
|
|
15
|
+
name: "variant",
|
|
16
|
+
type: { name: "string", required: false },
|
|
17
|
+
table: {
|
|
18
|
+
defaultValue: { summary: "info" }
|
|
19
|
+
},
|
|
20
|
+
control: {
|
|
21
|
+
labels: {
|
|
22
|
+
info: "Info",
|
|
23
|
+
help: "Help"
|
|
24
|
+
},
|
|
25
|
+
type: "select"
|
|
26
|
+
},
|
|
27
|
+
options: ["info", "help"]
|
|
28
|
+
},
|
|
29
|
+
label: {
|
|
30
|
+
name: "label",
|
|
31
|
+
type: { name: "string", required: false },
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: "label" },
|
|
34
|
+
defaultValue: { summary: "Informations" }
|
|
35
|
+
},
|
|
36
|
+
control: "text"
|
|
37
|
+
},
|
|
38
|
+
offset: {
|
|
39
|
+
name: "offset",
|
|
40
|
+
type: { name: "number", required: false },
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: "offset" },
|
|
43
|
+
defaultValue: { summary: 0 }
|
|
44
|
+
},
|
|
45
|
+
control: "number"
|
|
46
|
+
},
|
|
47
|
+
placement: {
|
|
48
|
+
name: "placement",
|
|
49
|
+
type: { name: "string", required: false },
|
|
50
|
+
description: "The placement of the popover content in relation to the button",
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: "string" },
|
|
53
|
+
defaultValue: { summary: "bottom-start" }
|
|
54
|
+
},
|
|
55
|
+
control: {
|
|
56
|
+
type: "select",
|
|
57
|
+
labels: {
|
|
58
|
+
top: "top",
|
|
59
|
+
"top-start": "top-start",
|
|
60
|
+
"top-end": "top-end",
|
|
61
|
+
right: "right",
|
|
62
|
+
"right-start": "right-start",
|
|
63
|
+
"right-end": "right-end",
|
|
64
|
+
bottom: "bottom",
|
|
65
|
+
"bottom-start": "bottom-start",
|
|
66
|
+
"bottom-end": "bottom-end",
|
|
67
|
+
left: "left",
|
|
68
|
+
"left-start": "left-start",
|
|
69
|
+
"left-end": "left-end"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
options: [
|
|
73
|
+
"top",
|
|
74
|
+
"top-start",
|
|
75
|
+
"top-end",
|
|
76
|
+
"right",
|
|
77
|
+
"right-start",
|
|
78
|
+
"right-end",
|
|
79
|
+
"bottom",
|
|
80
|
+
"bottom-start",
|
|
81
|
+
"bottom-end",
|
|
82
|
+
"left",
|
|
83
|
+
"left-start",
|
|
84
|
+
"left-end"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=args.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["args.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 type { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';\n\nexport interface StoryArgs {\n label?: string;\n variant?: 'info' | 'help';\n placement?: Placement;\n open?: boolean;\n [key: string]: unknown;\n}\n\nexport const argTypes = {\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n table: {\n defaultValue: { summary: 'info' },\n },\n control: {\n labels: {\n info: 'Info',\n help: 'Help',\n },\n type: 'select',\n },\n options: ['info', 'help'],\n },\n label: {\n name: 'label',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'label' },\n defaultValue: { summary: 'Informations' },\n },\n control: 'text',\n },\n offset: {\n name: 'offset',\n type: { name: 'number', required: false },\n table: {\n type: { summary: 'offset' },\n defaultValue: { summary: 0 },\n },\n control: 'number',\n },\n placement: {\n name: 'placement',\n type: { name: 'string', required: false },\n description:\n 'The placement of the popover content in relation to the button',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'bottom-start' },\n },\n control: {\n type: 'select',\n labels: {\n top: 'top',\n 'top-start': 'top-start',\n 'top-end': 'top-end',\n right: 'right',\n 'right-start': 'right-start',\n 'right-end': 'right-end',\n bottom: 'bottom',\n 'bottom-start': 'bottom-start',\n 'bottom-end': 'bottom-end',\n left: 'left',\n 'left-start': 'left-start',\n 'left-end': 'left-end',\n },\n },\n options: [\n 'top',\n 'top-start',\n 'top-end',\n 'right',\n 'right-start',\n 'right-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'left',\n 'left-start',\n 'left-end',\n ],\n },\n};\n"],
|
|
5
|
+
"mappings": ";AAqBO,aAAM,WAAW;AAAA,EACpB,MAAM;AAAA,IACF,MAAM;AAAA,IACN,MAAM,EAAE,MAA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AA,QACP,eAAe;AAAA,QACf,aAAa;AAAA,QACb,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB,cAAc;AAAA,QACd,MAAM;AAAA,QACN,cAAc;AAAA,QACd,YAAY;AAAA,MAChB;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { argTypes } from "./args.js";
|
|
4
|
+
import { Template } from "./template.js";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Contextual Help",
|
|
7
|
+
component: "sp-contextual-help",
|
|
8
|
+
args: {
|
|
9
|
+
label: "",
|
|
10
|
+
variant: "info",
|
|
11
|
+
placement: void 0
|
|
12
|
+
},
|
|
13
|
+
argTypes
|
|
14
|
+
};
|
|
15
|
+
export const Default = (args) => Template(args);
|
|
16
|
+
Default.args = {
|
|
17
|
+
open: true
|
|
18
|
+
};
|
|
19
|
+
export const Help = (args) => Template(args);
|
|
20
|
+
Help.args = {
|
|
21
|
+
variant: "help",
|
|
22
|
+
open: true
|
|
23
|
+
};
|
|
24
|
+
export const CustomPlacement = (args) => {
|
|
25
|
+
return html`
|
|
26
|
+
<div
|
|
27
|
+
style="width: 100%; height: 500px; display: flex; align-items: center; justify-content: center"
|
|
28
|
+
>
|
|
29
|
+
${Template(args)}
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
};
|
|
33
|
+
CustomPlacement.args = {
|
|
34
|
+
placement: "top",
|
|
35
|
+
open: true
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=contextual-help.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help.stories.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { argTypes, StoryArgs } from './args.js';\nimport { Template } from './template.js';\n\nexport default {\n title: 'Contextual Help',\n component: 'sp-contextual-help',\n args: {\n label: '',\n variant: 'info',\n placement: undefined,\n },\n argTypes,\n};\n\nexport const Default = (args?: StoryArgs): TemplateResult => Template(args);\nDefault.args = {\n open: true,\n};\n\nexport const Help = (args?: StoryArgs): TemplateResult => Template(args);\nHelp.args = {\n variant: 'help',\n open: true,\n};\n\nexport const CustomPlacement = (args?: StoryArgs): TemplateResult => {\n return html`\n <div\n style=\"width: 100%; height: 500px; display: flex; align-items: center; justify-content: center\"\n >\n ${Template(args)}\n </div>\n `;\n};\n\nCustomPlacement.args = {\n placement: 'top',\n open: true,\n};\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,gBAA2B;AACpC,SAAS,gBAAgB;AAEzB,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,IACF,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACf;AAAA,EACA;AACJ;AAEO,aAAM,UAAU,CAAC,SAAqC,SAAS,IAAI;AAC1E,QAAQ,OAAO;AAAA,EACX,MAAM;AACV;AAEO,aAAM,OAAO,CAAC,SAAqC,SAAS,IAAI;AACvE,KAAK,OAAO;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AACV;AAEO,aAAM,kBAAkB,CAAC,SAAqC;AACjE,SAAO;AAAA;AAAA;AAAA;AAAA,cAIG,SAAS,IAAI,CAAC;AAAA;AAAA;AAG5B;AAEA,gBAAgB,OAAO;AAAA,EACnB,WAAW;AAAA,EACX,MAAM;AACV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/stories/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
4
|
+
import { spreadProps } from "../../../test/lit-helpers.js";
|
|
5
|
+
import "@spectrum-web-components/link/sp-link.js";
|
|
6
|
+
import "../sp-contextual-help.js";
|
|
7
|
+
export const ContextualHelpMarkup = (args = {}) => {
|
|
8
|
+
return html`
|
|
9
|
+
<sp-contextual-help
|
|
10
|
+
${spreadProps(args)}
|
|
11
|
+
placement=${ifDefined(args.placement)}
|
|
12
|
+
>
|
|
13
|
+
<h2 slot="heading">Permission required</h2>
|
|
14
|
+
Your admin must grant you permission before you can create a
|
|
15
|
+
segment.
|
|
16
|
+
<sp-link
|
|
17
|
+
slot="link"
|
|
18
|
+
href="https://opensource.adobe.com/spectrum-web-components/"
|
|
19
|
+
>
|
|
20
|
+
Request permission
|
|
21
|
+
</sp-link>
|
|
22
|
+
</sp-contextual-help>
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport { spreadProps } from '../../../test/lit-helpers.js';\nimport { StoryArgs } from './args.js';\nimport '@spectrum-web-components/link/sp-link.js';\nimport '../sp-contextual-help.js';\n\nexport const ContextualHelpMarkup = (args: StoryArgs = {}): TemplateResult => {\n return html`\n <sp-contextual-help\n ${spreadProps(args)}\n placement=${ifDefined(args.placement)}\n >\n <h2 slot=\"heading\">Permission required</h2>\n Your admin must grant you permission before you can create a\n segment.\n <sp-link\n slot=\"link\"\n href=\"https://opensource.adobe.com/spectrum-web-components/\"\n >\n Request permission\n </sp-link>\n </sp-contextual-help>\n `;\n};\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,OAAO;AACP,OAAO;AAEA,aAAM,uBAAuB,CAAC,OAAkB,CAAC,MAAsB;AAC1E,SAAO;AAAA;AAAA,cAEG,YAAY,IAAI,CAAC;AAAA,wBACP,UAAU,KAAK,SAAS,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAajD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["template.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { ContextualHelpMarkup } from './';\n\nexport const Template = ContextualHelpMarkup;\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,4BAA4B;AAE9B,aAAM,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/contextual-help/sp-contextual-help.js";
|
|
3
|
+
import { html } from "@spectrum-web-components/base";
|
|
4
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
5
|
+
measureFixtureCreation(html`
|
|
6
|
+
<sp-contextual-help></sp-contextual-help>
|
|
7
|
+
`);
|
|
8
|
+
//# sourceMappingURL=basic-test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["basic-test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 '@spectrum-web-components/contextual-help/sp-contextual-help.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-contextual-help></sp-contextual-help>\n`);\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA,CAEtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help-memory.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { Default } from '../stories/contextual-help.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ntestForMemoryLeaks(Default());\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAEnC,mBAAmB,QAAQ,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help.test-vrt.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 * as stories from '../stories/contextual-help.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('ContextualHelpStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,yBAAyB,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { elementUpdated, expect, fixture, oneEvent } from "@open-wc/testing";
|
|
3
|
+
import { nextFrame } from "@spectrum-web-components/overlay/src/AbstractOverlay.js";
|
|
4
|
+
import { sendKeys } from "@web/test-runner-commands";
|
|
5
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
6
|
+
import { ContextualHelpMarkup } from "../stories";
|
|
7
|
+
import { render } from "lit";
|
|
8
|
+
describe("ContextualHelp", () => {
|
|
9
|
+
testForLitDevWarnings(
|
|
10
|
+
async () => await fixture(ContextualHelpMarkup())
|
|
11
|
+
);
|
|
12
|
+
it("loads default contextual-help accessibly", async () => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
15
|
+
await elementUpdated(el);
|
|
16
|
+
await expect(el).to.be.accessible();
|
|
17
|
+
const button = (_b = (_a = document.querySelector("sp-contextual-help")) == null ? void 0 : _a.shadowRoot) == null ? void 0 : _b.querySelector("sp-action-button");
|
|
18
|
+
expect(button).to.have.attribute("aria-label", "Informations");
|
|
19
|
+
el.variant = "help";
|
|
20
|
+
await elementUpdated(el);
|
|
21
|
+
expect(button).to.have.attribute("aria-label", "Help");
|
|
22
|
+
});
|
|
23
|
+
it("is a popover on web", async () => {
|
|
24
|
+
var _a, _b, _c, _d, _e;
|
|
25
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
26
|
+
await elementUpdated(el);
|
|
27
|
+
const trigger = (_a = el.shadowRoot) == null ? void 0 : _a.querySelector("#trigger");
|
|
28
|
+
let popover = (_b = el.shadowRoot) == null ? void 0 : _b.querySelector("sp-popover");
|
|
29
|
+
expect(popover).not.to.exist;
|
|
30
|
+
const opened = oneEvent(el, "sp-opened");
|
|
31
|
+
trigger.click();
|
|
32
|
+
await opened;
|
|
33
|
+
popover = (_c = el.shadowRoot) == null ? void 0 : _c.querySelector("sp-popover");
|
|
34
|
+
expect(popover).to.exist;
|
|
35
|
+
const headingSlot = popover == null ? void 0 : popover.querySelector(
|
|
36
|
+
'slot[name="heading"]'
|
|
37
|
+
);
|
|
38
|
+
const heading = headingSlot.assignedElements()[0].textContent;
|
|
39
|
+
expect(heading).to.equal("Permission required");
|
|
40
|
+
const closed = oneEvent(el, "sp-closed");
|
|
41
|
+
await sendKeys({
|
|
42
|
+
press: "Escape"
|
|
43
|
+
});
|
|
44
|
+
await closed;
|
|
45
|
+
await nextFrame();
|
|
46
|
+
await nextFrame();
|
|
47
|
+
popover = (_d = el.shadowRoot) == null ? void 0 : _d.querySelector("sp-popover");
|
|
48
|
+
expect((_e = el.shadowRoot) == null ? void 0 : _e.querySelector("sp-popover")).not.to.exist;
|
|
49
|
+
});
|
|
50
|
+
it("returns the label if set", async () => {
|
|
51
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
52
|
+
el.label = "Custom Label";
|
|
53
|
+
expect(el.buttonAriaLabel).to.equal("Custom Label");
|
|
54
|
+
});
|
|
55
|
+
it('returns "Help" if variant is "help" and label is not set', async () => {
|
|
56
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
57
|
+
el.variant = "help";
|
|
58
|
+
expect(el.buttonAriaLabel).to.equal("Help");
|
|
59
|
+
});
|
|
60
|
+
it('returns "Informations" if variant is not "help" and label is not set', async () => {
|
|
61
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
62
|
+
expect(el.buttonAriaLabel).to.equal("Informations");
|
|
63
|
+
});
|
|
64
|
+
it("renders correctly when actualPlacement is undefined", async () => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
67
|
+
el.isMobile.matches = true;
|
|
68
|
+
await elementUpdated(el);
|
|
69
|
+
const trigger = (_a = el.shadowRoot) == null ? void 0 : _a.querySelector("#trigger");
|
|
70
|
+
expect(trigger).to.exist;
|
|
71
|
+
expect(trigger).to.have.attribute("aria-label", "Informations");
|
|
72
|
+
const overlay = (_b = el.shadowRoot) == null ? void 0 : _b.querySelector(
|
|
73
|
+
"sp-overlay"
|
|
74
|
+
);
|
|
75
|
+
expect(overlay).to.exist;
|
|
76
|
+
expect(overlay).to.have.attribute("trigger", "trigger@click");
|
|
77
|
+
expect(overlay).to.have.attribute("receives-focus", "true");
|
|
78
|
+
expect(overlay).to.have.property("offset", el.offset);
|
|
79
|
+
expect(overlay).to.have.property("open", el.open);
|
|
80
|
+
});
|
|
81
|
+
it("renders dialog content when isMobile.matches is true", async () => {
|
|
82
|
+
const el = await fixture(ContextualHelpMarkup());
|
|
83
|
+
el.isMobile.matches = true;
|
|
84
|
+
await elementUpdated(el);
|
|
85
|
+
const template = el["renderOverlayContent"]();
|
|
86
|
+
const container = document.createElement("div");
|
|
87
|
+
render(template, container);
|
|
88
|
+
const dialogBase = container.querySelector("sp-dialog-base");
|
|
89
|
+
const dialog = container.querySelector("sp-dialog");
|
|
90
|
+
const headingSlot = container.querySelector('slot[name="heading"]');
|
|
91
|
+
const linkSlot = container.querySelector('slot[name="link"]');
|
|
92
|
+
expect(dialogBase).to.exist;
|
|
93
|
+
expect(dialog).to.exist;
|
|
94
|
+
expect(dialog).to.have.attribute("dismissable");
|
|
95
|
+
expect(dialog).to.have.attribute("size", "s");
|
|
96
|
+
expect(headingSlot).to.exist;
|
|
97
|
+
expect(linkSlot).to.exist;
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=contextual-help.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["contextual-help.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 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 { elementUpdated, expect, fixture, oneEvent } from '@open-wc/testing';\nimport { nextFrame } from '@spectrum-web-components/overlay/src/AbstractOverlay.js';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { ContextualHelp } from '../src/ContextualHelp.js';\nimport { ContextualHelpMarkup } from '../stories';\nimport { render, TemplateResult } from 'lit';\n\ndescribe('ContextualHelp', () => {\n testForLitDevWarnings(\n async () => await fixture<ContextualHelp>(ContextualHelpMarkup())\n );\n it('loads default contextual-help accessibly', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n\n const button = document\n .querySelector('sp-contextual-help')\n ?.shadowRoot?.querySelector('sp-action-button');\n expect(button).to.have.attribute('aria-label', 'Informations');\n\n el.variant = 'help';\n\n await elementUpdated(el);\n expect(button).to.have.attribute('aria-label', 'Help');\n });\n it('is a popover on web', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n\n await elementUpdated(el);\n const trigger = el.shadowRoot?.querySelector('#trigger') as HTMLElement;\n\n let popover = el.shadowRoot?.querySelector('sp-popover');\n expect(popover).not.to.exist;\n\n const opened = oneEvent(el, 'sp-opened');\n trigger.click();\n await opened;\n\n popover = el.shadowRoot?.querySelector('sp-popover');\n expect(popover).to.exist;\n const headingSlot = popover?.querySelector(\n 'slot[name=\"heading\"]'\n ) as HTMLSlotElement;\n const heading = headingSlot.assignedElements()[0].textContent;\n expect(heading).to.equal('Permission required');\n\n const closed = oneEvent(el, 'sp-closed');\n await sendKeys({\n press: 'Escape',\n });\n await closed;\n await nextFrame();\n await nextFrame();\n\n popover = el.shadowRoot?.querySelector('sp-popover');\n expect(el.shadowRoot?.querySelector('sp-popover')).not.to.exist;\n });\n it('returns the label if set', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n el.label = 'Custom Label';\n expect(el.buttonAriaLabel).to.equal('Custom Label');\n });\n\n it('returns \"Help\" if variant is \"help\" and label is not set', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n el.variant = 'help';\n expect(el.buttonAriaLabel).to.equal('Help');\n });\n\n it('returns \"Informations\" if variant is not \"help\" and label is not set', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n expect(el.buttonAriaLabel).to.equal('Informations');\n });\n it('renders correctly when actualPlacement is undefined', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n\n el.isMobile.matches = true;\n\n await elementUpdated(el);\n\n const trigger = el.shadowRoot?.querySelector('#trigger') as HTMLElement;\n expect(trigger).to.exist;\n expect(trigger).to.have.attribute('aria-label', 'Informations');\n\n const overlay = el.shadowRoot?.querySelector(\n 'sp-overlay'\n ) as HTMLElement;\n expect(overlay).to.exist;\n expect(overlay).to.have.attribute('trigger', 'trigger@click');\n expect(overlay).to.have.attribute('receives-focus', 'true');\n expect(overlay).to.have.property('offset', el.offset);\n expect(overlay).to.have.property('open', el.open);\n });\n it('renders dialog content when isMobile.matches is true', async () => {\n const el = await fixture<ContextualHelp>(ContextualHelpMarkup());\n\n el.isMobile.matches = true;\n\n await elementUpdated(el);\n\n const template: TemplateResult = el['renderOverlayContent']();\n\n const container = document.createElement('div');\n render(template, container);\n\n const dialogBase = container.querySelector('sp-dialog-base');\n const dialog = container.querySelector('sp-dialog');\n const headingSlot = container.querySelector('slot[name=\"heading\"]');\n const linkSlot = container.querySelector('slot[name=\"link\"]');\n\n expect(dialogBase).to.exist;\n expect(dialog).to.exist;\n expect(dialog).to.have.attribute('dismissable');\n expect(dialog).to.have.attribute('size', 's');\n expect(headingSlot).to.exist;\n expect(linkSlot).to.exist;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,gBAAgB,QAAQ,SAAS,gBAAgB;AA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