@spectrum-web-components/contextual-help 0.43.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 ADDED
@@ -0,0 +1,86 @@
1
+ ## Description
2
+
3
+ A `sp-contextual-help` shows a user extra information about the state of either an adjacent component or an entire view. It explains a high-level topic about an experience and can point users to more information elsewhere.
4
+
5
+ ### Usage
6
+
7
+ [![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/contextual-help?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/contextual-help)
8
+ [![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/contextual-help?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/contextual-help)
9
+
10
+ ```
11
+ yarn add @spectrum-web-components/contextual-help
12
+ ```
13
+
14
+ Import the side effectful registration of `<sp-contextual-help>` via:
15
+
16
+ ```
17
+ import '@spectrum-web-components/contextual-help/sp-contextual-help.js';
18
+ ```
19
+
20
+ When looking to leverage the `ContextualHelp` base class as a type and/or for extension purposes, do so via:
21
+
22
+ ```
23
+ import { ContextualHelp } from '@spectrum-web-components/contextual-help';
24
+ ```
25
+
26
+ ## Example
27
+
28
+ ```html
29
+ <sp-contextual-help>
30
+ <h2 slot="heading">Permission required</h2>
31
+ Your admin must grant you permission before you can create a segment.
32
+ <sp-link
33
+ slot="link"
34
+ href="https://opensource.adobe.com/spectrum-web-components/"
35
+ >
36
+ Request permission
37
+ </sp-link>
38
+ </sp-contextual-help>
39
+ ```
40
+
41
+ ## Help
42
+
43
+ Use `variant="help"` for helpful content: more detailed, in-depth guidance about a task, UI element, tool, or keyboard shortcuts. This may include an image, video, or link and should be helpful in tone.
44
+
45
+ ```html
46
+ <sp-contextual-help variant="help">
47
+ <h2 slot="heading">What is a segment?</h2>
48
+ Segments identify who your visitors are, what devices and services they use,
49
+ where they navigate from, and much more.
50
+ <sp-link
51
+ slot="link"
52
+ href="https://opensource.adobe.com/spectrum-web-components/"
53
+ >
54
+ Learn more about segments
55
+ </sp-link>
56
+ </sp-contextual-help>
57
+ ```
58
+
59
+ ## Placement
60
+
61
+ By default a `sp-contextual-help` will render its popover at the `bottom-start` position. This can be customized using the `placement` attribute and supports [all the placement options](http://localhost:8000/components/overlay-trigger/#placement) an `overlay-trigger` component supports.
62
+
63
+ ```html
64
+ <sp-contextual-help placement="top-start">
65
+ <h2 slot="heading">Permission required</h2>
66
+ Your admin must grant you permission before you can create a segment.
67
+ <sp-link
68
+ slot="link"
69
+ href="https://opensource.adobe.com/spectrum-web-components/"
70
+ >
71
+ Request permission
72
+ </sp-link>
73
+ </sp-contextual-help>
74
+ ```
75
+
76
+ ## Events
77
+
78
+ `sp-contextual-help` does not fire any events of its own. You can listen, however, for the `sp-open` and `sp-closed` events which are fired when the popover opens or closes.
79
+
80
+ ## Accessibility
81
+
82
+ Given that the trigger is an icon-only `sp-action-button`, it is important to provide an accessible name for it, so that it can be properly announced by screen readers.
83
+ By default, the `sp-contextual-help` uses an `aria-label` property with either "Informations" or "Help" as values, depending on the component's `variant`.
84
+ You can customize this using the `label` attribute.
85
+
86
+ When providing headings using the `heading` slot, make sure to provide actual heading elements such as `h1`, `h2`, `h3` ... or use the `role="heading"` attribute.
@@ -0,0 +1,236 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "sp-contextual-help.js",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "custom-element-definition",
12
+ "name": "sp-contextual-help",
13
+ "declaration": {
14
+ "name": "ContextualHelp",
15
+ "module": "/src/ContextualHelp.js"
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "kind": "javascript-module",
22
+ "path": "src/ContextualHelp.js",
23
+ "declarations": [
24
+ {
25
+ "kind": "class",
26
+ "description": "Spectrum Contextual help provides additional information about\nthe state of either an adjacent component or an entire view.",
27
+ "name": "ContextualHelp",
28
+ "slots": [
29
+ {
30
+ "description": "content to display as the heading of the popover",
31
+ "name": "heading"
32
+ },
33
+ {
34
+ "description": "content to display in the popover",
35
+ "name": "Text"
36
+ },
37
+ {
38
+ "description": "link to additional informations",
39
+ "name": "link"
40
+ }
41
+ ],
42
+ "members": [
43
+ {
44
+ "kind": "field",
45
+ "name": "isMobile",
46
+ "privacy": "protected",
47
+ "default": "new MatchMediaController(this, IS_MOBILE)"
48
+ },
49
+ {
50
+ "kind": "field",
51
+ "name": "label",
52
+ "type": {
53
+ "text": "string | undefined"
54
+ },
55
+ "privacy": "public",
56
+ "description": "Provides an accessible name for the action button trigger.",
57
+ "parameters": [
58
+ {
59
+ "name": "label",
60
+ "type": {
61
+ "text": "String"
62
+ }
63
+ }
64
+ ],
65
+ "attribute": "label"
66
+ },
67
+ {
68
+ "kind": "field",
69
+ "name": "variant",
70
+ "type": {
71
+ "text": "'info' | 'help'"
72
+ },
73
+ "privacy": "public",
74
+ "default": "'info'",
75
+ "description": "The `variant` property applies specific styling on the action button trigger.",
76
+ "parameters": [
77
+ {
78
+ "name": "variant",
79
+ "type": {
80
+ "text": "String"
81
+ }
82
+ }
83
+ ],
84
+ "attribute": "variant"
85
+ },
86
+ {
87
+ "kind": "field",
88
+ "name": "placement",
89
+ "type": {
90
+ "text": "\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\""
91
+ },
92
+ "privacy": "public",
93
+ "default": "'bottom-start'",
94
+ "attribute": "placement",
95
+ "reflects": true
96
+ },
97
+ {
98
+ "kind": "field",
99
+ "name": "offset",
100
+ "type": {
101
+ "text": "number | [number, number]"
102
+ },
103
+ "privacy": "public",
104
+ "default": "0",
105
+ "description": "The `offset` property accepts either a single number, to\ndefine the offset of the Popover along the main axis from\nthe action button, or 2-tuple, to define the offset along the\nmain axis and the cross axis.",
106
+ "attribute": "offset"
107
+ },
108
+ {
109
+ "kind": "field",
110
+ "name": "open",
111
+ "type": {
112
+ "text": "boolean"
113
+ },
114
+ "default": "false",
115
+ "attribute": "open"
116
+ },
117
+ {
118
+ "kind": "field",
119
+ "name": "buttonAriaLabel",
120
+ "type": {
121
+ "text": "string"
122
+ },
123
+ "privacy": "private",
124
+ "readonly": true
125
+ },
126
+ {
127
+ "kind": "method",
128
+ "name": "renderOverlayContent",
129
+ "privacy": "private",
130
+ "return": {
131
+ "type": {
132
+ "text": "TemplateResult"
133
+ }
134
+ }
135
+ },
136
+ {
137
+ "kind": "method",
138
+ "name": "handleSlottableRequest",
139
+ "privacy": "private",
140
+ "return": {
141
+ "type": {
142
+ "text": "void"
143
+ }
144
+ },
145
+ "parameters": [
146
+ {
147
+ "name": "event",
148
+ "type": {
149
+ "text": "SlottableRequestEvent"
150
+ }
151
+ }
152
+ ]
153
+ }
154
+ ],
155
+ "attributes": [
156
+ {
157
+ "name": "placement",
158
+ "type": {
159
+ "text": "\"top\" | \"top-start\" | \"top-end\" | \"right\" | \"right-start\" | \"right-end\" | \"bottom\" | \"bottom-start\" | \"bottom-end\" | \"left\" | \"left-start\" | \"left-end\""
160
+ },
161
+ "default": "'bottom-start'",
162
+ "fieldName": "placement",
163
+ "attribute": "placement"
164
+ },
165
+ {
166
+ "name": "label",
167
+ "type": {
168
+ "text": "string | undefined"
169
+ },
170
+ "description": "Provides an accessible name for the action button trigger.",
171
+ "parameters": [
172
+ {
173
+ "name": "label",
174
+ "type": {
175
+ "text": "String"
176
+ }
177
+ }
178
+ ],
179
+ "fieldName": "label"
180
+ },
181
+ {
182
+ "name": "variant",
183
+ "type": {
184
+ "text": "'info' | 'help'"
185
+ },
186
+ "default": "'info'",
187
+ "description": "The `variant` property applies specific styling on the action button trigger.",
188
+ "parameters": [
189
+ {
190
+ "name": "variant",
191
+ "type": {
192
+ "text": "String"
193
+ }
194
+ }
195
+ ],
196
+ "fieldName": "variant"
197
+ },
198
+ {
199
+ "name": "offset",
200
+ "type": {
201
+ "text": "number | [number, number]"
202
+ },
203
+ "default": "0",
204
+ "description": "The `offset` property accepts either a single number, to\ndefine the offset of the Popover along the main axis from\nthe action button, or 2-tuple, to define the offset along the\nmain axis and the cross axis.",
205
+ "fieldName": "offset"
206
+ },
207
+ {
208
+ "name": "open",
209
+ "type": {
210
+ "text": "boolean"
211
+ },
212
+ "default": "false",
213
+ "fieldName": "open"
214
+ }
215
+ ],
216
+ "superclass": {
217
+ "name": "SpectrumElement",
218
+ "package": "@spectrum-web-components/base"
219
+ },
220
+ "tagName": "sp-contextual-help",
221
+ "customElement": true
222
+ }
223
+ ],
224
+ "exports": [
225
+ {
226
+ "kind": "js",
227
+ "name": "ContextualHelp",
228
+ "declaration": {
229
+ "name": "ContextualHelp",
230
+ "module": "src/ContextualHelp.js"
231
+ }
232
+ }
233
+ ]
234
+ }
235
+ ]
236
+ }
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@spectrum-web-components/contextual-help",
3
+ "version": "0.43.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "Web component implementation of a Spectrum design ContextualHelp",
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/adobe/spectrum-web-components.git",
12
+ "directory": "packages/contextual-help"
13
+ },
14
+ "author": "",
15
+ "homepage": "https://adobe.github.io/spectrum-web-components/components/contextual-help",
16
+ "bugs": {
17
+ "url": "https://github.com/adobe/spectrum-web-components/issues"
18
+ },
19
+ "main": "src/index.js",
20
+ "module": "src/index.js",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "development": "./src/index.dev.js",
25
+ "default": "./src/index.js"
26
+ },
27
+ "./package.json": "./package.json",
28
+ "./src/ContextualHelp.js": {
29
+ "development": "./src/ContextualHelp.dev.js",
30
+ "default": "./src/ContextualHelp.js"
31
+ },
32
+ "./src/contextual-help.css.js": "./src/contextual-help.css.js",
33
+ "./src/index.js": {
34
+ "development": "./src/index.dev.js",
35
+ "default": "./src/index.js"
36
+ },
37
+ "./sp-contextual-help.js": {
38
+ "development": "./sp-contextual-help.dev.js",
39
+ "default": "./sp-contextual-help.js"
40
+ }
41
+ },
42
+ "scripts": {
43
+ "test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
44
+ },
45
+ "files": [
46
+ "**/*.d.ts",
47
+ "**/*.js",
48
+ "**/*.js.map",
49
+ "custom-elements.json",
50
+ "!stories/",
51
+ "!test/"
52
+ ],
53
+ "keywords": [
54
+ "spectrum css",
55
+ "web components",
56
+ "lit-element",
57
+ "lit-html"
58
+ ],
59
+ "dependencies": {
60
+ "@spectrum-web-components/action-button": "^0.43.0",
61
+ "@spectrum-web-components/base": "^0.43.0",
62
+ "@spectrum-web-components/dialog": "^0.43.0",
63
+ "@spectrum-web-components/icons-workflow": "^0.43.0",
64
+ "@spectrum-web-components/overlay": "^0.43.0",
65
+ "@spectrum-web-components/popover": "^0.43.0"
66
+ },
67
+ "devDependencies": {
68
+ "@spectrum-css/contextualhelp": "^2.1.5"
69
+ },
70
+ "types": "./src/index.d.ts",
71
+ "customElements": "custom-elements.json",
72
+ "sideEffects": [
73
+ "./sp-*.js",
74
+ "./**/*.dev.js",
75
+ "./**/*.dev.js"
76
+ ],
77
+ "gitHead": "dd5179a5eae5fe69ac77c5e10faed912d0e780e3"
78
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ import { ContextualHelp } from "./src/ContextualHelp.dev.js";
3
+ customElements.define("sp-contextual-help", ContextualHelp);
4
+ //# sourceMappingURL=sp-contextual-help.dev.js.map
@@ -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,2 @@
1
+ "use strict";import{ContextualHelp as e}from"./src/ContextualHelp.js";customElements.define("sp-contextual-help",e);
2
+ //# sourceMappingURL=sp-contextual-help.js.map
@@ -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,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 protected 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 private 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 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,SAAU,WAAW,IAAI,qBAAqB,MAAM,SAAS;AAkB7D,SAAO,UAA2B;AAOlC,SAAO,YAAwB;AAS/B,SAAO,SAAoC;AAG3C,gBAAO;AAAA;AAAA,EAnCP,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAmCA,IAAY,kBAA0B;AAClC,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;AAErD,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASX,OAAO;AACH,aAAO,gDAAgD;AAEvD,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASX;AAAA,EACJ;AAAA,EAEQ,uBAAuB,OAAoC;AAC/D,UAAM,gBAAgB;AAEtB,QAAI,MAAM,SAAS,wBAAwB;AACvC,WAAK,OAAO;AACZ,aAAO,QAAW,MAAM,MAAqB;AAC7C;AAAA,IACJ;AAEA,SAAK,OAAO;AACZ,UAAM,WAAW,KAAK,qBAAqB;AAC3C,WAAO,UAAU,MAAM,MAAqB;AAAA,EAChD;AAAA,EAEmB,SAAyB;AACxC,UAAM,kBAAkB,KAAK,SAAS,UAChC,SACA,KAAK;AAEX,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA,6BAKc,KAAK,eAAe;AAAA,0BACvB,KAAK,IAAI;AAAA;AAAA,kBAEjB,KAAK,YAAY,SACb;AAAA;AAAA;AAAA;AAAA,0BAKA;AAAA;AAAA;AAAA;AAAA,uBAIC;AAAA;AAAA;AAAA;AAAA,4BAIK,UAAU,eAAe,CAAC;AAAA,uBAC/B,KAAK,SAAS,UAAU,UAAU,MAAM;AAAA;AAAA,0BAErC,KAAK,MAAM;AAAA,qCACA,KAAK,sBAAsB;AAAA,wBACxC,KAAK,IAAI;AAAA;AAAA;AAAA,EAG7B;AACJ;AAtHW;AAAA,EADN,SAAS;AAAA,GAXD,eAYF;AAOA;AAAA,EADN,SAAS;AAAA,GAlBD,eAmBF;AAOA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAzBlB,eA0BF;AASA;AAAA,EADN,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAlCjB,eAmCF;AAGP;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GArClB,eAsCT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=(a,s,e,o)=>{for(var t=o>1?void 0:o?c(s,e):s,n=a.length-1,p;n>=0;n--)(p=a[n])&&(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 d}from"@spectrum-web-components/overlay/src/slottable-request-event.js";import{IS_MOBILE as f,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,f);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===d){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 protected 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 private 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 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": "qNAWA,OAEI,QAAAA,EACA,UAAAC,EACA,mBAAAC,MAEG,gCACP,MAAO,6DACP,MAAO,iDACP,MAAO,wEACP,MAAO,wEACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,aAAAC,MAAiB,kDAE1B,OACI,0BAAAC,MAEG,kEACP,OACI,aAAAC,EACA,wBAAAC,MACG,kEACP,OAAOC,MAAY,2BAWZ,aAAM,uBAAuBN,CAAgB,CAA7C,kCACH,KAAU,SAAW,IAAIK,EAAqB,KAAMD,CAAS,EAkB7D,KAAO,QAA2B,OAOlC,KAAO,UAAwB,eAS/B,KAAO,OAAoC,EAG3C,UAAO,GAnCP,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAM,CAClB,CAmCA,IAAY,iBAA0B,CAClC,OAAI,KAAK,MACE,KAAK,MAER,KAAK,UAAY,OACV,OAEJ,cAEf,CAEQ,sBAAuC,CAC3C,OAAI,KAAK,SAAS,SACd,OAAO,mDAAmD,EAC1D,OAAO,8CAA8C,EAE9CR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAUP,OAAO,gDAAgD,EAEhDA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAUf,CAEQ,uBAAuBS,EAAoC,CAG/D,GAFAA,EAAM,gBAAgB,EAElBA,EAAM,OAASJ,EAAwB,CACvC,KAAK,KAAO,GACZJ,EAAO,OAAWQ,EAAM,MAAqB,EAC7C,MACJ,CAEA,KAAK,KAAO,GACZ,MAAMC,EAAW,KAAK,qBAAqB,EAC3CT,EAAOS,EAAUD,EAAM,MAAqB,CAChD,CAEmB,QAAyB,CACxC,MAAME,EAAkB,KAAK,SAAS,QAChC,OACA,KAAK,UAEX,OAAOX;AAAA;AAAA;AAAA;AAAA;AAAA,6BAKc,KAAK,eAAe;AAAA,0BACvB,KAAK,IAAI;AAAA;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,CAtHWC,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(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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{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 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-contextual-help-padding:var(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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{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 t}from"@spectrum-web-components/base";const e=t`
2
+ :host{--spectrum-contextual-help-padding:var(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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{display:inline-block}::slotted([slot=link]){display:block}
3
+ `;export default e;
4
+ //# sourceMappingURL=contextual-help.css.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["contextual-help.css.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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-contextual-help-padding:var(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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{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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ export * from "./ContextualHelp.dev.js";
3
+ //# sourceMappingURL=index.dev.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*/\nexport * from './ContextualHelp.dev.js'\n"],
5
+ "mappings": ";AAWA,cAAc;",
6
+ "names": []
7
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";export*from"./ContextualHelp.js";
2
+ //# 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*/\nexport * from './ContextualHelp.js';\n"],
5
+ "mappings": "aAWA,WAAc",
6
+ "names": []
7
+ }
@@ -0,0 +1,54 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ // @ts-check
13
+
14
+ import {
15
+ builder,
16
+ converterFor,
17
+ } from '../../../tasks/process-spectrum-utils.js';
18
+
19
+ const converter = converterFor('spectrum-ContextualHelp');
20
+
21
+ /**
22
+ * @type { import('../../../tasks/spectrum-css-converter').SpectrumCSSConverter }
23
+ */
24
+ const config = {
25
+ conversions: [
26
+ {
27
+ inPackage: '@spectrum-css/contextualhelp',
28
+ outPackage: 'contextual-help',
29
+ fileName: 'contextual-help',
30
+ hoistCustomPropertiesFrom: 'spectrum-ContextualHelp',
31
+ excludeByComponents: [
32
+ // No need to style the trigger, it is already styled by sp-button
33
+ builder.class('spectrum-ContextualHelp-button'),
34
+ builder.class('spectrum--large'),
35
+ ],
36
+ components: [
37
+ // The min-width should be applied to the popover, not the :host
38
+ converter.classToClass('spectrum-ContextualHelp', 'popover'),
39
+ converter.classToClass('spectrum-ContextualHelp-popover'),
40
+ converter.classToSlotted(
41
+ 'spectrum-ContextualHelp-heading',
42
+ 'heading'
43
+ ),
44
+ converter.classToClass('spectrum-ContextualHelp-body'),
45
+ converter.classToSlotted(
46
+ 'spectrum-ContextualHelp-link',
47
+ 'link'
48
+ ),
49
+ ],
50
+ },
51
+ ],
52
+ };
53
+
54
+ export default config;
@@ -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(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-contextual-help-padding:var(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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 e}from"@spectrum-web-components/base";const t=e`
2
+ :host{--spectrum-contextual-help-padding:var(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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 t;
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 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-contextual-help-padding:var(--spectrum-spacing-400);--spectrum-contextual-help-content-spacing:var(--spectrum-spacing-100);--spectrum-contextual-help-link-spacing:var(--spectrum-spacing-300);--spectrum-contextual-help-heading-size:var(--spectrum-contextual-help-title-size);--spectrum-contextual-help-heading-color:var(--spectrum-heading-color);--spectrum-contextual-help-body-color:var(--spectrum-body-color)}.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 ::slotted([slot=heading]),.popover .body{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
+ }