@spectrum-web-components/popover 0.31.1-overlay.29 → 0.31.1-react.2
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/custom-elements.json +158 -0
- package/package.json +4 -4
- package/src/Popover.d.ts +5 -3
- package/src/Popover.dev.js +27 -7
- package/src/Popover.dev.js.map +2 -2
- package/src/Popover.js +4 -4
- package/src/Popover.js.map +3 -3
- package/src/popover.css.dev.js +1 -3
- package/src/popover.css.dev.js.map +2 -2
- package/src/popover.css.js +1 -3
- package/src/popover.css.js.map +2 -2
- package/test/popover.test.js +15 -2
- package/test/popover.test.js.map +2 -2
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "sp-popover.ts",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": []
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"kind": "javascript-module",
|
|
13
|
+
"path": "src/Popover.ts",
|
|
14
|
+
"declarations": [
|
|
15
|
+
{
|
|
16
|
+
"kind": "class",
|
|
17
|
+
"description": "",
|
|
18
|
+
"name": "Popover",
|
|
19
|
+
"slots": [
|
|
20
|
+
{
|
|
21
|
+
"description": "content to display within the Popover",
|
|
22
|
+
"name": ""
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"members": [
|
|
26
|
+
{
|
|
27
|
+
"kind": "field",
|
|
28
|
+
"name": "dialog",
|
|
29
|
+
"type": {
|
|
30
|
+
"text": "boolean"
|
|
31
|
+
},
|
|
32
|
+
"privacy": "public",
|
|
33
|
+
"default": "false",
|
|
34
|
+
"description": "Whether the popover should manage the application\nof padding to its content or not.",
|
|
35
|
+
"attribute": "dialog",
|
|
36
|
+
"reflects": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"kind": "field",
|
|
40
|
+
"name": "open",
|
|
41
|
+
"type": {
|
|
42
|
+
"text": "boolean"
|
|
43
|
+
},
|
|
44
|
+
"privacy": "public",
|
|
45
|
+
"default": "false",
|
|
46
|
+
"description": "Whether the popover is visible or not.",
|
|
47
|
+
"attribute": "open",
|
|
48
|
+
"reflects": true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "field",
|
|
52
|
+
"name": "placement",
|
|
53
|
+
"type": {
|
|
54
|
+
"text": "\"auto\" | \"auto-start\" | \"auto-end\" | \"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\" | \"none\""
|
|
55
|
+
},
|
|
56
|
+
"privacy": "public",
|
|
57
|
+
"default": "'none'",
|
|
58
|
+
"attribute": "placement",
|
|
59
|
+
"reflects": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"kind": "field",
|
|
63
|
+
"name": "tip",
|
|
64
|
+
"type": {
|
|
65
|
+
"text": "boolean"
|
|
66
|
+
},
|
|
67
|
+
"privacy": "public",
|
|
68
|
+
"default": "false",
|
|
69
|
+
"attribute": "tip",
|
|
70
|
+
"reflects": true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"kind": "method",
|
|
74
|
+
"name": "renderTip",
|
|
75
|
+
"privacy": "protected",
|
|
76
|
+
"return": {
|
|
77
|
+
"type": {
|
|
78
|
+
"text": "TemplateResult"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"kind": "method",
|
|
84
|
+
"name": "onOverlayQuery",
|
|
85
|
+
"privacy": "public",
|
|
86
|
+
"return": {
|
|
87
|
+
"type": {
|
|
88
|
+
"text": "void"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"parameters": [
|
|
92
|
+
{
|
|
93
|
+
"name": "event",
|
|
94
|
+
"type": {
|
|
95
|
+
"text": "CustomEvent<OverlayDisplayQueryDetail>"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"attributes": [
|
|
102
|
+
{
|
|
103
|
+
"name": "placement",
|
|
104
|
+
"type": {
|
|
105
|
+
"text": "\"auto\" | \"auto-start\" | \"auto-end\" | \"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\" | \"none\""
|
|
106
|
+
},
|
|
107
|
+
"default": "'none'",
|
|
108
|
+
"fieldName": "placement",
|
|
109
|
+
"attribute": "placement"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "dialog",
|
|
113
|
+
"type": {
|
|
114
|
+
"text": "boolean"
|
|
115
|
+
},
|
|
116
|
+
"default": "false",
|
|
117
|
+
"description": "Whether the popover should manage the application\nof padding to its content or not.",
|
|
118
|
+
"fieldName": "dialog"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "open",
|
|
122
|
+
"type": {
|
|
123
|
+
"text": "boolean"
|
|
124
|
+
},
|
|
125
|
+
"default": "false",
|
|
126
|
+
"description": "Whether the popover is visible or not.",
|
|
127
|
+
"fieldName": "open"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "tip",
|
|
131
|
+
"type": {
|
|
132
|
+
"text": "boolean"
|
|
133
|
+
},
|
|
134
|
+
"default": "false",
|
|
135
|
+
"fieldName": "tip"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"superclass": {
|
|
139
|
+
"name": "SpectrumElement",
|
|
140
|
+
"package": "@spectrum-web-components/base"
|
|
141
|
+
},
|
|
142
|
+
"tagName": "sp-popover",
|
|
143
|
+
"customElement": true
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"exports": [
|
|
147
|
+
{
|
|
148
|
+
"kind": "js",
|
|
149
|
+
"name": "Popover",
|
|
150
|
+
"declaration": {
|
|
151
|
+
"name": "Popover",
|
|
152
|
+
"module": "src/Popover.ts"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/popover",
|
|
3
|
-
"version": "0.31.1-
|
|
3
|
+
"version": "0.31.1-react.2+971de948d",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"lit-html"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@spectrum-web-components/base": "^0.31.1-
|
|
61
|
-
"@spectrum-web-components/overlay": "^0.31.1-
|
|
60
|
+
"@spectrum-web-components/base": "^0.31.1-react.2+971de948d",
|
|
61
|
+
"@spectrum-web-components/overlay": "^0.31.1-react.2+971de948d"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@spectrum-css/popover": "^5.0.18"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"./sp-*.js",
|
|
70
70
|
"./**/*.dev.js"
|
|
71
71
|
],
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "971de948df12f7082f13ab5dd5e638d456ebbb94"
|
|
73
73
|
}
|
package/src/Popover.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
-
import type { Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';
|
|
2
|
+
import type { OverlayDisplayQueryDetail, Placement } from '@spectrum-web-components/overlay/src/overlay-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @element sp-popover
|
|
5
5
|
*
|
|
@@ -20,9 +20,11 @@ export declare class Popover extends SpectrumElement {
|
|
|
20
20
|
* @type {"auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | "none"}
|
|
21
21
|
* @attr
|
|
22
22
|
*/
|
|
23
|
-
placement
|
|
23
|
+
placement: Placement;
|
|
24
24
|
tip: boolean;
|
|
25
|
-
tipElement: HTMLSpanElement;
|
|
26
25
|
protected renderTip(): TemplateResult;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
onOverlayQuery(event: CustomEvent<OverlayDisplayQueryDetail>): void;
|
|
27
29
|
protected render(): TemplateResult;
|
|
28
30
|
}
|
package/src/Popover.dev.js
CHANGED
|
@@ -15,16 +15,14 @@ import {
|
|
|
15
15
|
nothing,
|
|
16
16
|
SpectrumElement
|
|
17
17
|
} from "@spectrum-web-components/base";
|
|
18
|
-
import {
|
|
19
|
-
property,
|
|
20
|
-
query
|
|
21
|
-
} from "@spectrum-web-components/base/src/decorators.js";
|
|
18
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
22
19
|
import popoverStyles from "./popover.css.js";
|
|
23
20
|
export class Popover extends SpectrumElement {
|
|
24
21
|
constructor() {
|
|
25
22
|
super(...arguments);
|
|
26
23
|
this.dialog = false;
|
|
27
24
|
this.open = false;
|
|
25
|
+
this.placement = "none";
|
|
28
26
|
this.tip = false;
|
|
29
27
|
}
|
|
30
28
|
static get styles() {
|
|
@@ -46,6 +44,31 @@ export class Popover extends SpectrumElement {
|
|
|
46
44
|
</div>
|
|
47
45
|
`;
|
|
48
46
|
}
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
this.addEventListener(
|
|
50
|
+
"sp-overlay-query",
|
|
51
|
+
this.onOverlayQuery
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
disconnectedCallback() {
|
|
55
|
+
super.disconnectedCallback();
|
|
56
|
+
this.removeEventListener(
|
|
57
|
+
"sp-overlay-query",
|
|
58
|
+
this.onOverlayQuery
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
onOverlayQuery(event) {
|
|
62
|
+
if (!event.target)
|
|
63
|
+
return;
|
|
64
|
+
const target = event.target;
|
|
65
|
+
if (target !== this)
|
|
66
|
+
return;
|
|
67
|
+
const tipElement = this.shadowRoot.querySelector("#tip");
|
|
68
|
+
if (tipElement) {
|
|
69
|
+
event.detail.overlayContentTipElement = tipElement;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
49
72
|
render() {
|
|
50
73
|
return html`
|
|
51
74
|
<slot></slot>
|
|
@@ -65,7 +88,4 @@ __decorateClass([
|
|
|
65
88
|
__decorateClass([
|
|
66
89
|
property({ type: Boolean, reflect: true })
|
|
67
90
|
], Popover.prototype, "tip", 2);
|
|
68
|
-
__decorateClass([
|
|
69
|
-
query("#tip")
|
|
70
|
-
], Popover.prototype, "tipElement", 2);
|
|
71
91
|
//# sourceMappingURL=Popover.dev.js.map
|
package/src/Popover.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Popover.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AACP
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport type {\n OverlayDisplayQueryDetail,\n Placement,\n} from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport popoverStyles from './popover.css.js';\n\n/**\n * @element sp-popover\n *\n * @slot - content to display within the Popover\n */\nexport class Popover extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [popoverStyles];\n }\n\n /**\n * Whether the popover should manage the application\n * of padding to its content or not.\n */\n @property({ type: Boolean, reflect: true })\n public dialog = false;\n\n /**\n * Whether the popover is visible or not.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * @type {\"auto\" | \"auto-start\" | \"auto-end\" | \"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\" | \"none\"}\n * @attr\n */\n @property({ reflect: true })\n public placement: Placement = 'none';\n\n @property({ type: Boolean, reflect: true })\n public tip = false;\n\n protected renderTip(): TemplateResult {\n return html`\n <div id=\"tip\">\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n class=\"tip\"\n viewBox=\"0 0 24 12\"\n >\n <path\n class=\"triangle\"\n d=\"M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0\"\n ></path>\n </svg>\n </div>\n `;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\n 'sp-overlay-query',\n this.onOverlayQuery as EventListener\n );\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener(\n 'sp-overlay-query',\n this.onOverlayQuery as EventListener\n );\n }\n\n public onOverlayQuery(event: CustomEvent<OverlayDisplayQueryDetail>): void {\n /* c8 ignore next */\n if (!event.target) return;\n\n const target = event.target as Node;\n /* c8 ignore next */\n if (target !== this) return;\n\n const tipElement = this.shadowRoot.querySelector('#tip') as HTMLElement;\n if (tipElement) {\n event.detail.overlayContentTipElement = tipElement;\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n ${this.tip ? this.renderTip() : nothing}\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAKzB,OAAO,mBAAmB;AAOnB,aAAM,gBAAgB,gBAAgB;AAAA,EAAtC;AAAA;AAUH,SAAO,SAAS;AAMhB,SAAO,OAAO;AAOd,SAAO,YAAuB;AAG9B,SAAO,MAAM;AAAA;AAAA,EAzBb,WAA2B,SAAyB;AAChD,WAAO,CAAC,aAAa;AAAA,EACzB;AAAA,EAyBU,YAA4B;AAClC,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcX;AAAA,EAEgB,oBAA0B;AACtC,UAAM,kBAAkB;AACxB,SAAK;AAAA,MACD;AAAA,MACA,KAAK;AAAA,IACT;AAAA,EACJ;AAAA,EAEgB,uBAA6B;AACzC,UAAM,qBAAqB;AAC3B,SAAK;AAAA,MACD;AAAA,MACA,KAAK;AAAA,IACT;AAAA,EACJ;AAAA,EAEO,eAAe,OAAqD;AAEvE,QAAI,CAAC,MAAM;AAAQ;AAEnB,UAAM,SAAS,MAAM;AAErB,QAAI,WAAW;AAAM;AAErB,UAAM,aAAa,KAAK,WAAW,cAAc,MAAM;AACvD,QAAI,YAAY;AACZ,YAAM,OAAO,2BAA2B;AAAA,IAC5C;AAAA,EACJ;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA,cAED,KAAK,MAAM,KAAK,UAAU,IAAI;AAAA;AAAA,EAExC;AACJ;AAvEW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GATjC,QAUF;AAMA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAfjC,QAgBF;AAOA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAtBlB,QAuBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAzBjC,QA0BF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Popover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=(a,r,t,l)=>{for(var e=l>1?void 0:l?u(r,t):r,o=a.length-1,n;o>=0;o--)(n=a[o])&&(e=(l?n(r,t,e):n(e))||e);return l&&e&&c(r,t,e),e};import{html as p,nothing as y,SpectrumElement as d}from"@spectrum-web-components/base";import{property as s}from"@spectrum-web-components/base/src/decorators.js";import m from"./popover.css.js";export class Popover extends d{constructor(){super(...arguments);this.dialog=!1;this.open=!1;this.placement="none";this.tip=!1}static get styles(){return[m]}renderTip(){return p`
|
|
2
2
|
<div id="tip">
|
|
3
3
|
<svg
|
|
4
4
|
xmlns="http://www.w3.org/svg/2000"
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
></path>
|
|
12
12
|
</svg>
|
|
13
13
|
</div>
|
|
14
|
-
`}render(){return
|
|
14
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("sp-overlay-query",this.onOverlayQuery)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("sp-overlay-query",this.onOverlayQuery)}onOverlayQuery(t){if(!t.target||t.target!==this)return;const e=this.shadowRoot.querySelector("#tip");e&&(t.detail.overlayContentTipElement=e)}render(){return p`
|
|
15
15
|
<slot></slot>
|
|
16
|
-
${this.tip?this.renderTip():
|
|
17
|
-
`}}
|
|
16
|
+
${this.tip?this.renderTip():y}
|
|
17
|
+
`}}i([s({type:Boolean,reflect:!0})],Popover.prototype,"dialog",2),i([s({type:Boolean,reflect:!0})],Popover.prototype,"open",2),i([s({reflect:!0})],Popover.prototype,"placement",2),i([s({type:Boolean,reflect:!0})],Popover.prototype,"tip",2);
|
|
18
18
|
//# sourceMappingURL=Popover.js.map
|
package/src/Popover.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Popover.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EACA,mBAAAC,MAEG,gCACP,
|
|
6
|
-
"names": ["html", "nothing", "SpectrumElement", "property", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport type {\n OverlayDisplayQueryDetail,\n Placement,\n} from '@spectrum-web-components/overlay/src/overlay-types.js';\nimport popoverStyles from './popover.css.js';\n\n/**\n * @element sp-popover\n *\n * @slot - content to display within the Popover\n */\nexport class Popover extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [popoverStyles];\n }\n\n /**\n * Whether the popover should manage the application\n * of padding to its content or not.\n */\n @property({ type: Boolean, reflect: true })\n public dialog = false;\n\n /**\n * Whether the popover is visible or not.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * @type {\"auto\" | \"auto-start\" | \"auto-end\" | \"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\" | \"none\"}\n * @attr\n */\n @property({ reflect: true })\n public placement: Placement = 'none';\n\n @property({ type: Boolean, reflect: true })\n public tip = false;\n\n protected renderTip(): TemplateResult {\n return html`\n <div id=\"tip\">\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n class=\"tip\"\n viewBox=\"0 0 24 12\"\n >\n <path\n class=\"triangle\"\n d=\"M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0\"\n ></path>\n </svg>\n </div>\n `;\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\n 'sp-overlay-query',\n this.onOverlayQuery as EventListener\n );\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener(\n 'sp-overlay-query',\n this.onOverlayQuery as EventListener\n );\n }\n\n public onOverlayQuery(event: CustomEvent<OverlayDisplayQueryDetail>): void {\n /* c8 ignore next */\n if (!event.target) return;\n\n const target = event.target as Node;\n /* c8 ignore next */\n if (target !== this) return;\n\n const tipElement = this.shadowRoot.querySelector('#tip') as HTMLElement;\n if (tipElement) {\n event.detail.overlayContentTipElement = tipElement;\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n ${this.tip ? this.renderTip() : nothing}\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAKzB,OAAOC,MAAmB,mBAOnB,aAAM,gBAAgBF,CAAgB,CAAtC,kCAUH,KAAO,OAAS,GAMhB,KAAO,KAAO,GAOd,KAAO,UAAuB,OAG9B,KAAO,IAAM,GAzBb,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAa,CACzB,CAyBU,WAA4B,CAClC,OAAOJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAcX,CAEgB,mBAA0B,CACtC,MAAM,kBAAkB,EACxB,KAAK,iBACD,mBACA,KAAK,cACT,CACJ,CAEgB,sBAA6B,CACzC,MAAM,qBAAqB,EAC3B,KAAK,oBACD,mBACA,KAAK,cACT,CACJ,CAEO,eAAeK,EAAqD,CAMvE,GAJI,CAACA,EAAM,QAEIA,EAAM,SAEN,KAAM,OAErB,MAAMC,EAAa,KAAK,WAAW,cAAc,MAAM,EACnDA,IACAD,EAAM,OAAO,yBAA2BC,EAEhD,CAEmB,QAAyB,CACxC,OAAON;AAAA;AAAA,cAED,KAAK,IAAM,KAAK,UAAU,EAAIC;AAAA,SAExC,CACJ,CAvEWM,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GATjC,QAUF,sBAMAI,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAfjC,QAgBF,oBAOAI,EAAA,CADNJ,EAAS,CAAE,QAAS,EAAK,CAAC,GAtBlB,QAuBF,yBAGAI,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAzBjC,QA0BF",
|
|
6
|
+
"names": ["html", "nothing", "SpectrumElement", "property", "popoverStyles", "event", "tipElement", "__decorateClass"]
|
|
7
7
|
}
|
package/src/popover.css.dev.js
CHANGED
|
@@ -25,9 +25,7 @@ const styles = css`
|
|
|
25
25
|
--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)
|
|
26
26
|
);stroke:var(
|
|
27
27
|
--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)
|
|
28
|
-
)}:host{--sp-popover-tip-size:24px
|
|
29
|
-
--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)
|
|
30
|
-
));clip-path:none;filter:var(--sp-popover-filter-override,var(--sp-popover-filter));max-height:100%;max-width:100%;min-width:min-content}::slotted(*){--sp-popover-filter-override:none;overscroll-behavior:contain}.tip{height:calc(var(--sp-popover-tip-size)/2);left:0;position:absolute;width:var(--sp-popover-tip-size)}:host([placement*=right]) #tip{transform:none}:host([placement*=bottom]) #tip{transform:none}:host([placement*=top]) .tip{top:100%}:host([placement*=bottom]) .tip{bottom:100%;transform:scaleY(-1)}:host([placement*=left]) .tip{transform:rotate(-90deg) translateY(-200%);transform-origin:100% 0}:host([placement*=right]) .tip{transform:rotate(90deg);transform-origin:0 0}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
|
|
28
|
+
)}:host{--sp-popover-tip-size:24px;max-height:100%;max-width:100%;min-width:min-content}::slotted(*){overscroll-behavior:contain}.tip{height:calc(var(--sp-popover-tip-size)/2);left:0;position:absolute;width:var(--sp-popover-tip-size)}:host([placement*=right]) #tip{transform:none}:host([placement*=bottom]) #tip{transform:none}:host([placement*=top]) .tip{top:100%}:host([placement*=bottom]) .tip{bottom:100%;transform:scaleY(-1)}:host([placement*=left]) .tip{transform:rotate(-90deg) translateY(-200%);transform-origin:100% 0}:host([placement*=right]) .tip{transform:rotate(90deg);transform-origin:0 0}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
|
|
31
29
|
`;
|
|
32
30
|
export default styles;
|
|
33
31
|
//# sourceMappingURL=popover.css.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["popover.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0s linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;transition-delay:0s;visibility:visible}:host([placement*=bottom][open]){transform:translateY(var(--spectrum-overlay-animation-distance))}:host([placement*=top][open]){transform:translateY(calc(var(--spectrum-overlay-animation-distance)*-1))}:host([placement*=right][open]){transform:translateX(var(--spectrum-overlay-animation-distance))}:host([placement*=left][open]){transform:translateX(calc(var(--spectrum-overlay-animation-distance)*-1))}:host{--spectrum-popover-target-offset:13px;--spectrum-popover-dialog-padding:30px 29px;--spectrum-popover-dialog-min-width:270px;--spectrum-popover-min-width:var(--spectrum-global-dimension-size-400);--spectrum-popover-min-height:var(--spectrum-global-dimension-size-400)}:host{border-radius:var(\n--spectrum-popover-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:solid;border-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;display:inline-flex;flex-direction:column;min-height:var(\n--spectrum-popover-min-height,var(--spectrum-global-dimension-size-400)\n);min-width:var(\n--spectrum-popover-min-width,var(--spectrum-global-dimension-size-400)\n);outline:none;position:absolute}#tip{position:absolute;-webkit-transform:translate(0)}#tip .triangle{stroke-linecap:square;stroke-linejoin:miter;stroke-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n)}:host([dialog]){min-width:var(--spectrum-popover-dialog-min-width);padding:var(--spectrum-popover-dialog-padding)}:host([placement*=left][tip]){margin-right:var(--spectrum-popover-target-offset)}:host([placement*=left]) #tip{left:100%}:host([placement*=right][tip]){margin-left:var(--spectrum-popover-target-offset)}:host([placement*=right]) #tip{right:100%;transform:scaleX(-1)}:host([placement*=left]) #tip,:host([placement*=right]) #tip{margin-top:calc(var(--spectrum-global-dimension-size-150)*-1);top:50%}:host([placement*=bottom][tip]){margin-top:var(--spectrum-popover-target-offset)}:host([placement*=bottom]) #tip{bottom:100%;transform:scaleY(-1)}:host([placement*=top][tip]){margin-bottom:var(--spectrum-popover-target-offset)}:host([placement*=top]) #tip{top:100%}:host([placement*=bottom]) #tip,:host([placement*=top]) #tip{left:50%;margin-left:calc(var(--spectrum-global-dimension-size-150)*-1)}:host{background-color:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);border-color:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n);clip-path:inset(-30px);filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));-webkit-filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));will-change:filter}#tip .triangle{fill:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);stroke:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n)}:host{--sp-popover-tip-size:24px
|
|
5
|
-
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0s linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;transition-delay:0s;visibility:visible}:host([placement*=bottom][open]){transform:translateY(var(--spectrum-overlay-animation-distance))}:host([placement*=top][open]){transform:translateY(calc(var(--spectrum-overlay-animation-distance)*-1))}:host([placement*=right][open]){transform:translateX(var(--spectrum-overlay-animation-distance))}:host([placement*=left][open]){transform:translateX(calc(var(--spectrum-overlay-animation-distance)*-1))}:host{--spectrum-popover-target-offset:13px;--spectrum-popover-dialog-padding:30px 29px;--spectrum-popover-dialog-min-width:270px;--spectrum-popover-min-width:var(--spectrum-global-dimension-size-400);--spectrum-popover-min-height:var(--spectrum-global-dimension-size-400)}:host{border-radius:var(\n--spectrum-popover-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:solid;border-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;display:inline-flex;flex-direction:column;min-height:var(\n--spectrum-popover-min-height,var(--spectrum-global-dimension-size-400)\n);min-width:var(\n--spectrum-popover-min-width,var(--spectrum-global-dimension-size-400)\n);outline:none;position:absolute}#tip{position:absolute;-webkit-transform:translate(0)}#tip .triangle{stroke-linecap:square;stroke-linejoin:miter;stroke-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n)}:host([dialog]){min-width:var(--spectrum-popover-dialog-min-width);padding:var(--spectrum-popover-dialog-padding)}:host([placement*=left][tip]){margin-right:var(--spectrum-popover-target-offset)}:host([placement*=left]) #tip{left:100%}:host([placement*=right][tip]){margin-left:var(--spectrum-popover-target-offset)}:host([placement*=right]) #tip{right:100%;transform:scaleX(-1)}:host([placement*=left]) #tip,:host([placement*=right]) #tip{margin-top:calc(var(--spectrum-global-dimension-size-150)*-1);top:50%}:host([placement*=bottom][tip]){margin-top:var(--spectrum-popover-target-offset)}:host([placement*=bottom]) #tip{bottom:100%;transform:scaleY(-1)}:host([placement*=top][tip]){margin-bottom:var(--spectrum-popover-target-offset)}:host([placement*=top]) #tip{top:100%}:host([placement*=bottom]) #tip,:host([placement*=top]) #tip{left:50%;margin-left:calc(var(--spectrum-global-dimension-size-150)*-1)}:host{background-color:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);border-color:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n);clip-path:inset(-30px);filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));-webkit-filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));will-change:filter}#tip .triangle{fill:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);stroke:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n)}:host{--sp-popover-tip-size:24px;max-height:100%;max-width:100%;min-width:min-content}::slotted(*){overscroll-behavior:contain}.tip{height:calc(var(--sp-popover-tip-size)/2);left:0;position:absolute;width:var(--sp-popover-tip-size)}:host([placement*=right]) #tip{transform:none}:host([placement*=bottom]) #tip{transform:none}:host([placement*=top]) .tip{top:100%}:host([placement*=bottom]) .tip{bottom:100%;transform:scaleY(-1)}:host([placement*=left]) .tip{transform:rotate(-90deg) translateY(-200%);transform-origin:100% 0}:host([placement*=right]) .tip{transform:rotate(90deg);transform-origin:0 0}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2Bf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/popover.css.js
CHANGED
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)
|
|
24
24
|
);stroke:var(
|
|
25
25
|
--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)
|
|
26
|
-
)}:host{--sp-popover-tip-size:24px
|
|
27
|
-
--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)
|
|
28
|
-
));clip-path:none;filter:var(--sp-popover-filter-override,var(--sp-popover-filter));max-height:100%;max-width:100%;min-width:min-content}::slotted(*){--sp-popover-filter-override:none;overscroll-behavior:contain}.tip{height:calc(var(--sp-popover-tip-size)/2);left:0;position:absolute;width:var(--sp-popover-tip-size)}:host([placement*=right]) #tip{transform:none}:host([placement*=bottom]) #tip{transform:none}:host([placement*=top]) .tip{top:100%}:host([placement*=bottom]) .tip{bottom:100%;transform:scaleY(-1)}:host([placement*=left]) .tip{transform:rotate(-90deg) translateY(-200%);transform-origin:100% 0}:host([placement*=right]) .tip{transform:rotate(90deg);transform-origin:0 0}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
|
|
26
|
+
)}:host{--sp-popover-tip-size:24px;max-height:100%;max-width:100%;min-width:min-content}::slotted(*){overscroll-behavior:contain}.tip{height:calc(var(--sp-popover-tip-size)/2);left:0;position:absolute;width:var(--sp-popover-tip-size)}:host([placement*=right]) #tip{transform:none}:host([placement*=bottom]) #tip{transform:none}:host([placement*=top]) .tip{top:100%}:host([placement*=bottom]) .tip{bottom:100%;transform:scaleY(-1)}:host([placement*=left]) .tip{transform:rotate(-90deg) translateY(-200%);transform-origin:100% 0}:host([placement*=right]) .tip{transform:rotate(90deg);transform-origin:0 0}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
|
|
29
27
|
`;export default o;
|
|
30
28
|
//# sourceMappingURL=popover.css.js.map
|
package/src/popover.css.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["popover.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0s linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;transition-delay:0s;visibility:visible}:host([placement*=bottom][open]){transform:translateY(var(--spectrum-overlay-animation-distance))}:host([placement*=top][open]){transform:translateY(calc(var(--spectrum-overlay-animation-distance)*-1))}:host([placement*=right][open]){transform:translateX(var(--spectrum-overlay-animation-distance))}:host([placement*=left][open]){transform:translateX(calc(var(--spectrum-overlay-animation-distance)*-1))}:host{--spectrum-popover-target-offset:13px;--spectrum-popover-dialog-padding:30px 29px;--spectrum-popover-dialog-min-width:270px;--spectrum-popover-min-width:var(--spectrum-global-dimension-size-400);--spectrum-popover-min-height:var(--spectrum-global-dimension-size-400)}:host{border-radius:var(\n--spectrum-popover-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:solid;border-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;display:inline-flex;flex-direction:column;min-height:var(\n--spectrum-popover-min-height,var(--spectrum-global-dimension-size-400)\n);min-width:var(\n--spectrum-popover-min-width,var(--spectrum-global-dimension-size-400)\n);outline:none;position:absolute}#tip{position:absolute;-webkit-transform:translate(0)}#tip .triangle{stroke-linecap:square;stroke-linejoin:miter;stroke-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n)}:host([dialog]){min-width:var(--spectrum-popover-dialog-min-width);padding:var(--spectrum-popover-dialog-padding)}:host([placement*=left][tip]){margin-right:var(--spectrum-popover-target-offset)}:host([placement*=left]) #tip{left:100%}:host([placement*=right][tip]){margin-left:var(--spectrum-popover-target-offset)}:host([placement*=right]) #tip{right:100%;transform:scaleX(-1)}:host([placement*=left]) #tip,:host([placement*=right]) #tip{margin-top:calc(var(--spectrum-global-dimension-size-150)*-1);top:50%}:host([placement*=bottom][tip]){margin-top:var(--spectrum-popover-target-offset)}:host([placement*=bottom]) #tip{bottom:100%;transform:scaleY(-1)}:host([placement*=top][tip]){margin-bottom:var(--spectrum-popover-target-offset)}:host([placement*=top]) #tip{top:100%}:host([placement*=bottom]) #tip,:host([placement*=top]) #tip{left:50%;margin-left:calc(var(--spectrum-global-dimension-size-150)*-1)}:host{background-color:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);border-color:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n);clip-path:inset(-30px);filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));-webkit-filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));will-change:filter}#tip .triangle{fill:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);stroke:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n)}:host{--sp-popover-tip-size:24px
|
|
5
|
-
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);opacity:0;pointer-events:none;transition:transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out,visibility 0s linear var(--spectrum-global-animation-duration-100,.13s);visibility:hidden}:host([open]){opacity:1;pointer-events:auto;transition-delay:0s;visibility:visible}:host([placement*=bottom][open]){transform:translateY(var(--spectrum-overlay-animation-distance))}:host([placement*=top][open]){transform:translateY(calc(var(--spectrum-overlay-animation-distance)*-1))}:host([placement*=right][open]){transform:translateX(var(--spectrum-overlay-animation-distance))}:host([placement*=left][open]){transform:translateX(calc(var(--spectrum-overlay-animation-distance)*-1))}:host{--spectrum-popover-target-offset:13px;--spectrum-popover-dialog-padding:30px 29px;--spectrum-popover-dialog-min-width:270px;--spectrum-popover-min-width:var(--spectrum-global-dimension-size-400);--spectrum-popover-min-height:var(--spectrum-global-dimension-size-400)}:host{border-radius:var(\n--spectrum-popover-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:solid;border-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n);box-sizing:border-box;display:inline-flex;flex-direction:column;min-height:var(\n--spectrum-popover-min-height,var(--spectrum-global-dimension-size-400)\n);min-width:var(\n--spectrum-popover-min-width,var(--spectrum-global-dimension-size-400)\n);outline:none;position:absolute}#tip{position:absolute;-webkit-transform:translate(0)}#tip .triangle{stroke-linecap:square;stroke-linejoin:miter;stroke-width:var(\n--spectrum-popover-border-size,var(--spectrum-alias-border-size-thin)\n)}:host([dialog]){min-width:var(--spectrum-popover-dialog-min-width);padding:var(--spectrum-popover-dialog-padding)}:host([placement*=left][tip]){margin-right:var(--spectrum-popover-target-offset)}:host([placement*=left]) #tip{left:100%}:host([placement*=right][tip]){margin-left:var(--spectrum-popover-target-offset)}:host([placement*=right]) #tip{right:100%;transform:scaleX(-1)}:host([placement*=left]) #tip,:host([placement*=right]) #tip{margin-top:calc(var(--spectrum-global-dimension-size-150)*-1);top:50%}:host([placement*=bottom][tip]){margin-top:var(--spectrum-popover-target-offset)}:host([placement*=bottom]) #tip{bottom:100%;transform:scaleY(-1)}:host([placement*=top][tip]){margin-bottom:var(--spectrum-popover-target-offset)}:host([placement*=top]) #tip{top:100%}:host([placement*=bottom]) #tip,:host([placement*=top]) #tip{left:50%;margin-left:calc(var(--spectrum-global-dimension-size-150)*-1)}:host{background-color:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);border-color:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n);clip-path:inset(-30px);filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));-webkit-filter:drop-shadow(0 1px 4px var(\n--spectrum-popover-shadow-color,var(--spectrum-alias-dropshadow-color)\n));will-change:filter}#tip .triangle{fill:var(\n--spectrum-popover-background-color,var(--spectrum-global-color-gray-50)\n);stroke:var(\n--spectrum-popover-border-color,var(--spectrum-alias-border-color-dark)\n)}:host{--sp-popover-tip-size:24px;max-height:100%;max-width:100%;min-width:min-content}::slotted(*){overscroll-behavior:contain}.tip{height:calc(var(--sp-popover-tip-size)/2);left:0;position:absolute;width:var(--sp-popover-tip-size)}:host([placement*=right]) #tip{transform:none}:host([placement*=bottom]) #tip{transform:none}:host([placement*=top]) .tip{top:100%}:host([placement*=bottom]) .tip{bottom:100%;transform:scaleY(-1)}:host([placement*=left]) .tip{transform:rotate(-90deg) translateY(-200%);transform-origin:100% 0}:host([placement*=right]) .tip{transform:rotate(90deg);transform-origin:0 0}::slotted(.visually-hidden){clip:rect(0,0,0,0);border:0;clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2Bf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
package/test/popover.test.js
CHANGED
|
@@ -34,7 +34,7 @@ describe("popover", () => {
|
|
|
34
34
|
tip = popover.shadowRoot.querySelector("tip");
|
|
35
35
|
expect(tip).to.not.equal(void 0);
|
|
36
36
|
});
|
|
37
|
-
it("
|
|
37
|
+
it("answers tip query", async () => {
|
|
38
38
|
const el = await fixture(
|
|
39
39
|
html`
|
|
40
40
|
<sp-popover variant="dialog" placement="top" tip open>
|
|
@@ -49,7 +49,20 @@ describe("popover", () => {
|
|
|
49
49
|
`
|
|
50
50
|
);
|
|
51
51
|
await elementUpdated(el);
|
|
52
|
-
|
|
52
|
+
const overlayDetailQuery = {};
|
|
53
|
+
const queryOverlayDetailEvent = new CustomEvent("sp-overlay-query", {
|
|
54
|
+
bubbles: true,
|
|
55
|
+
composed: true,
|
|
56
|
+
detail: overlayDetailQuery,
|
|
57
|
+
cancelable: true
|
|
58
|
+
});
|
|
59
|
+
el.dispatchEvent(queryOverlayDetailEvent);
|
|
60
|
+
expect(overlayDetailQuery.overlayContentTipElement).to.exist;
|
|
61
|
+
if (overlayDetailQuery.overlayContentTipElement) {
|
|
62
|
+
expect(overlayDetailQuery.overlayContentTipElement.id).to.equal(
|
|
63
|
+
"tip"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
53
66
|
});
|
|
54
67
|
});
|
|
55
68
|
//# sourceMappingURL=popover.test.js.map
|
package/test/popover.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["popover.test.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*/\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\ndescribe('popover', () => {\n let popover!: Popover;\n\n beforeEach(async () => {\n popover = await fixture<Popover>(\n html`\n <sp-popover variant=\"dialog\" placement=\"top\" open>\n <div id=\"title\">Popover Title</div>\n <div id=\"content\">\n Cupcake ipsum dolor sit amet jelly beans. Chocolate\n jelly caramels. Icing souffl\u00E9 chupa chups donut\n cheesecake. Jelly-o chocolate cake sweet roll cake\n danish candy biscuit halvah\n </div>\n </sp-popover>\n `\n );\n await elementUpdated(popover);\n });\n\n it('loads', async () => {\n expect(popover).to.not.equal(undefined);\n expect(popover.textContent).to.include('Popover Title');\n\n await expect(popover).to.be.accessible();\n });\n it('tip exists only when tip attribute is true', async () => {\n if (!popover.shadowRoot) throw new Error('No shadowRoot');\n expect(popover.getAttribute('tip')).to.equal(null);\n\n let tip = popover.shadowRoot.querySelector('tip') as HTMLElement;\n expect(tip).to.equal(null);\n\n popover.setAttribute('tip', 'true');\n\n tip = popover.shadowRoot.querySelector('tip') as HTMLElement;\n expect(tip).to.not.equal(undefined);\n });\n\n it('
|
|
5
|
-
"mappings": ";AAWA,OAAO;AAEP,SAAS,gBAAgB,QAAQ,SAAS,YAAY;
|
|
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*/\nimport '@spectrum-web-components/popover/sp-popover.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { OverlayDisplayQueryDetail } from '@spectrum-web-components/overlay';\n\ndescribe('popover', () => {\n let popover!: Popover;\n\n beforeEach(async () => {\n popover = await fixture<Popover>(\n html`\n <sp-popover variant=\"dialog\" placement=\"top\" open>\n <div id=\"title\">Popover Title</div>\n <div id=\"content\">\n Cupcake ipsum dolor sit amet jelly beans. Chocolate\n jelly caramels. Icing souffl\u00E9 chupa chups donut\n cheesecake. Jelly-o chocolate cake sweet roll cake\n danish candy biscuit halvah\n </div>\n </sp-popover>\n `\n );\n await elementUpdated(popover);\n });\n\n it('loads', async () => {\n expect(popover).to.not.equal(undefined);\n expect(popover.textContent).to.include('Popover Title');\n\n await expect(popover).to.be.accessible();\n });\n it('tip exists only when tip attribute is true', async () => {\n if (!popover.shadowRoot) throw new Error('No shadowRoot');\n expect(popover.getAttribute('tip')).to.equal(null);\n\n let tip = popover.shadowRoot.querySelector('tip') as HTMLElement;\n expect(tip).to.equal(null);\n\n popover.setAttribute('tip', 'true');\n\n tip = popover.shadowRoot.querySelector('tip') as HTMLElement;\n expect(tip).to.not.equal(undefined);\n });\n\n it('answers tip query', async () => {\n const el = await fixture<Popover>(\n html`\n <sp-popover variant=\"dialog\" placement=\"top\" tip open>\n <div id=\"title\">Popover Title</div>\n <div id=\"content\">\n Cupcake ipsum dolor sit amet jelly beans. Chocolate\n jelly caramels. Icing souffl\u00E9 chupa chups donut\n cheesecake. Jelly-o chocolate cake sweet roll cake\n danish candy biscuit halvah\n </div>\n </sp-popover>\n `\n );\n\n await elementUpdated(el);\n\n const overlayDetailQuery: OverlayDisplayQueryDetail = {};\n const queryOverlayDetailEvent =\n new CustomEvent<OverlayDisplayQueryDetail>('sp-overlay-query', {\n bubbles: true,\n composed: true,\n detail: overlayDetailQuery,\n cancelable: true,\n });\n el.dispatchEvent(queryOverlayDetailEvent);\n\n expect(overlayDetailQuery.overlayContentTipElement).to.exist;\n if (overlayDetailQuery.overlayContentTipElement) {\n expect(overlayDetailQuery.overlayContentTipElement.id).to.equal(\n 'tip'\n );\n }\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AAEP,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAGtD,SAAS,WAAW,MAAM;AACtB,MAAI;AAEJ,aAAW,YAAY;AACnB,cAAU,MAAM;AAAA,MACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWJ;AACA,UAAM,eAAe,OAAO;AAAA,EAChC,CAAC;AAED,KAAG,SAAS,YAAY;AACpB,WAAO,OAAO,EAAE,GAAG,IAAI,MAAM,MAAS;AACtC,WAAO,QAAQ,WAAW,EAAE,GAAG,QAAQ,eAAe;AAEtD,UAAM,OAAO,OAAO,EAAE,GAAG,GAAG,WAAW;AAAA,EAC3C,CAAC;AACD,KAAG,8CAA8C,YAAY;AACzD,QAAI,CAAC,QAAQ;AAAY,YAAM,IAAI,MAAM,eAAe;AACxD,WAAO,QAAQ,aAAa,KAAK,CAAC,EAAE,GAAG,MAAM,IAAI;AAEjD,QAAI,MAAM,QAAQ,WAAW,cAAc,KAAK;AAChD,WAAO,GAAG,EAAE,GAAG,MAAM,IAAI;AAEzB,YAAQ,aAAa,OAAO,MAAM;AAElC,UAAM,QAAQ,WAAW,cAAc,KAAK;AAC5C,WAAO,GAAG,EAAE,GAAG,IAAI,MAAM,MAAS;AAAA,EACtC,CAAC;AAED,KAAG,qBAAqB,YAAY;AAChC,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,qBAAgD,CAAC;AACvD,UAAM,0BACF,IAAI,YAAuC,oBAAoB;AAAA,MAC3D,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB,CAAC;AACL,OAAG,cAAc,uBAAuB;AAExC,WAAO,mBAAmB,wBAAwB,EAAE,GAAG;AACvD,QAAI,mBAAmB,0BAA0B;AAC7C,aAAO,mBAAmB,yBAAyB,EAAE,EAAE,GAAG;AAAA,QACtD;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|