@spectrum-web-components/truncated 0.0.0-20241209155954
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 +49 -0
- package/package.json +72 -0
- package/sp-truncated.d.ts +6 -0
- package/sp-truncated.dev.js +4 -0
- package/sp-truncated.dev.js.map +7 -0
- package/sp-truncated.js +2 -0
- package/sp-truncated.js.map +7 -0
- package/src/Truncated.d.ts +33 -0
- package/src/Truncated.dev.js +159 -0
- package/src/Truncated.dev.js.map +7 -0
- package/src/Truncated.js +32 -0
- package/src/Truncated.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/truncated.css.d.ts +2 -0
- package/src/truncated.css.dev.js +7 -0
- package/src/truncated.css.dev.js.map +7 -0
- package/src/truncated.css.js +4 -0
- package/src/truncated.css.js.map +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
`<sp-truncated>` renders a line of text, truncating it if it overflows its container. When overflowing, a tooltip is automatically created
|
|
4
|
+
that renders the entire non-truncated content.
|
|
5
|
+
|
|
6
|
+
It is used like a `<span>` to contain potentially-long strings that are important for users to see, even when in small containers, like full
|
|
7
|
+
names and email addresses.
|
|
8
|
+
|
|
9
|
+
### Usage
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/@spectrum-web-components/truncated)
|
|
12
|
+
[](https://bundlephobia.com/result?p=@spectrum-web-components/truncated)
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
yarn add @spectrum-web-components/truncated
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Import the side effectful registration of `<sp-truncated>` via:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
import '@spectrum-web-components/truncated/sp-truncated.js';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
When looking to leverage the `Truncated` base class as a type and/or for extension purposes, do so via:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
import { Truncated } from '@spectrum-web-components/truncated';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<sp-truncated>
|
|
34
|
+
This will truncate into a tooltip if there isn't enough space for it.
|
|
35
|
+
</sp-truncated>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### With specific overflow content
|
|
39
|
+
|
|
40
|
+
By default, tooltip text will be extracted from overflowing content. To provide your own overflow content, slot it into "overflow":
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<sp-truncated placement="right">
|
|
44
|
+
This is the inline content
|
|
45
|
+
<span slot="overflow">
|
|
46
|
+
And this overflow content will go into the tooltip, on the right
|
|
47
|
+
</span>
|
|
48
|
+
</sp-truncated>
|
|
49
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spectrum-web-components/truncated",
|
|
3
|
+
"version": "0.0.0-20241209155954",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "Web component implementation of a Spectrum design Truncated",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/adobe/spectrum-web-components.git",
|
|
12
|
+
"directory": "tools/truncated"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"homepage": "https://adobe.github.io/spectrum-web-components/components/truncated",
|
|
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/Truncated.js": {
|
|
29
|
+
"development": "./src/Truncated.dev.js",
|
|
30
|
+
"default": "./src/Truncated.js"
|
|
31
|
+
},
|
|
32
|
+
"./src/index.js": {
|
|
33
|
+
"development": "./src/index.dev.js",
|
|
34
|
+
"default": "./src/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./src/truncated.css.js": "./src/truncated.css.js",
|
|
37
|
+
"./sp-truncated": "./sp-truncated.js",
|
|
38
|
+
"./sp-truncated.js": {
|
|
39
|
+
"development": "./sp-truncated.dev.js",
|
|
40
|
+
"default": "./sp-truncated.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"**/*.d.ts",
|
|
48
|
+
"**/*.js",
|
|
49
|
+
"**/*.js.map",
|
|
50
|
+
"custom-elements.json",
|
|
51
|
+
"!stories/",
|
|
52
|
+
"!test/"
|
|
53
|
+
],
|
|
54
|
+
"keywords": [
|
|
55
|
+
"spectrum css",
|
|
56
|
+
"web components",
|
|
57
|
+
"lit-element",
|
|
58
|
+
"lit-html"
|
|
59
|
+
],
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@spectrum-web-components/base": "0.0.0-20241209155954",
|
|
62
|
+
"@spectrum-web-components/overlay": "0.0.0-20241209155954",
|
|
63
|
+
"@spectrum-web-components/styles": "0.0.0-20241209155954",
|
|
64
|
+
"@spectrum-web-components/tooltip": "0.0.0-20241209155954"
|
|
65
|
+
},
|
|
66
|
+
"types": "./src/index.d.ts",
|
|
67
|
+
"customElements": "custom-elements.json",
|
|
68
|
+
"sideEffects": [
|
|
69
|
+
"./sp-*.js",
|
|
70
|
+
"./**/*.dev.js"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-truncated.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Truncated } from './src/Truncated.dev.js'\n\ncustomElements.define('sp-truncated', Truncated);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-truncated': Truncated;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,iBAAiB;AAE1B,eAAe,OAAO,gBAAgB,SAAS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-truncated.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-truncated.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Truncated } from './src/Truncated.js';\n\ncustomElements.define('sp-truncated', Truncated);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-truncated': Truncated;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAYA,OAAS,aAAAA,MAAiB,qBAE1B,eAAe,OAAO,eAAgBA,CAAS",
|
|
6
|
+
"names": ["Truncated"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import type { Placement } from '@spectrum-web-components/overlay';
|
|
3
|
+
import '@spectrum-web-components/overlay/sp-overlay.js';
|
|
4
|
+
import '@spectrum-web-components/tooltip/sp-tooltip.js';
|
|
5
|
+
/**
|
|
6
|
+
* @element sp-truncated
|
|
7
|
+
*/
|
|
8
|
+
export declare class Truncated extends SpectrumElement {
|
|
9
|
+
static get styles(): CSSResultArray;
|
|
10
|
+
/**
|
|
11
|
+
* @type {"top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end"}
|
|
12
|
+
*/
|
|
13
|
+
placement: Placement;
|
|
14
|
+
successMessage: string;
|
|
15
|
+
hasCopied: boolean;
|
|
16
|
+
private fullText;
|
|
17
|
+
private overflowing;
|
|
18
|
+
private content;
|
|
19
|
+
private overlayEl?;
|
|
20
|
+
private slottedContent;
|
|
21
|
+
private slottedOverflow;
|
|
22
|
+
get hasCustomOverflow(): boolean;
|
|
23
|
+
private resizeObserver;
|
|
24
|
+
private mutationObserver;
|
|
25
|
+
render(): TemplateResult;
|
|
26
|
+
private renderTooltip;
|
|
27
|
+
protected firstUpdated(_changedProperties: PropertyValues<this>): void;
|
|
28
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
29
|
+
private handleOverflowSlotchange;
|
|
30
|
+
private handleClick;
|
|
31
|
+
private measureOverflow;
|
|
32
|
+
private copyText;
|
|
33
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
SpectrumElement
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import "@spectrum-web-components/overlay/sp-overlay.js";
|
|
17
|
+
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
18
|
+
import {
|
|
19
|
+
property,
|
|
20
|
+
query,
|
|
21
|
+
queryAssignedElements,
|
|
22
|
+
queryAssignedNodes,
|
|
23
|
+
state
|
|
24
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
25
|
+
import styles from "./truncated.css.js";
|
|
26
|
+
export class Truncated extends SpectrumElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.placement = "top-start";
|
|
30
|
+
this.successMessage = "Copied to clipboard";
|
|
31
|
+
this.hasCopied = false;
|
|
32
|
+
this.fullText = "";
|
|
33
|
+
this.overflowing = false;
|
|
34
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
35
|
+
this.measureOverflow();
|
|
36
|
+
});
|
|
37
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
38
|
+
this.copyText();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
static get styles() {
|
|
42
|
+
return [styles];
|
|
43
|
+
}
|
|
44
|
+
get hasCustomOverflow() {
|
|
45
|
+
return this.slottedOverflow.length > 0;
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
return html`
|
|
49
|
+
<span id="content" @click=${this.handleClick}>
|
|
50
|
+
<slot></slot>
|
|
51
|
+
</span>
|
|
52
|
+
${this.renderTooltip()}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
renderTooltip() {
|
|
56
|
+
if (!this.overflowing) {
|
|
57
|
+
return html`
|
|
58
|
+
<slot
|
|
59
|
+
name="overflow"
|
|
60
|
+
style="display: none"
|
|
61
|
+
@slotchange=${this.handleOverflowSlotchange}
|
|
62
|
+
></slot>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
return html`
|
|
66
|
+
<sp-overlay
|
|
67
|
+
id="overlay"
|
|
68
|
+
.triggerElement=${this}
|
|
69
|
+
.triggerInteraction=${"hover"}
|
|
70
|
+
type="hint"
|
|
71
|
+
placement=${this.placement}
|
|
72
|
+
>
|
|
73
|
+
<sp-tooltip name="tooltip">
|
|
74
|
+
${!this.hasCopied ? html`
|
|
75
|
+
<slot
|
|
76
|
+
name="overflow"
|
|
77
|
+
@slotchange=${this.handleOverflowSlotchange}
|
|
78
|
+
>
|
|
79
|
+
${this.fullText}
|
|
80
|
+
</slot>
|
|
81
|
+
` : this.successMessage}
|
|
82
|
+
</sp-tooltip>
|
|
83
|
+
</sp-overlay>
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
firstUpdated(_changedProperties) {
|
|
87
|
+
this.resizeObserver.observe(this);
|
|
88
|
+
this.resizeObserver.observe(this.content);
|
|
89
|
+
this.copyText();
|
|
90
|
+
this.measureOverflow();
|
|
91
|
+
}
|
|
92
|
+
updated(changedProperties) {
|
|
93
|
+
super.updated(changedProperties);
|
|
94
|
+
if (changedProperties.has("hasCopied") && this.hasCopied && this.overlayEl) {
|
|
95
|
+
this.overlayEl.open = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
handleOverflowSlotchange() {
|
|
99
|
+
this.mutationObserver.disconnect();
|
|
100
|
+
if (!this.hasCustomOverflow) {
|
|
101
|
+
this.mutationObserver.observe(this.content, {
|
|
102
|
+
subtree: true,
|
|
103
|
+
childList: true,
|
|
104
|
+
characterData: true
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
handleClick() {
|
|
109
|
+
if (!this.overflowing) return;
|
|
110
|
+
const textToCopy = this.slottedContent.map((node) => {
|
|
111
|
+
var _a;
|
|
112
|
+
return (_a = node.textContent) != null ? _a : "";
|
|
113
|
+
}).join("").trim();
|
|
114
|
+
navigator.clipboard.writeText(textToCopy);
|
|
115
|
+
this.hasCopied = true;
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
this.hasCopied = false;
|
|
118
|
+
}, 6e3);
|
|
119
|
+
}
|
|
120
|
+
measureOverflow() {
|
|
121
|
+
this.overflowing = this.content.offsetWidth > this.clientWidth + 1;
|
|
122
|
+
}
|
|
123
|
+
// Copies just the textContent of slotted nodes into the tooltip to avoid duplicating the user's DOM
|
|
124
|
+
copyText() {
|
|
125
|
+
if (this.hasCustomOverflow) return;
|
|
126
|
+
this.fullText = this.slottedContent.map((node) => {
|
|
127
|
+
var _a;
|
|
128
|
+
return (_a = node.textContent) != null ? _a : "";
|
|
129
|
+
}).join("");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
__decorateClass([
|
|
133
|
+
property()
|
|
134
|
+
], Truncated.prototype, "placement", 2);
|
|
135
|
+
__decorateClass([
|
|
136
|
+
property({ type: String, attribute: "success-message" })
|
|
137
|
+
], Truncated.prototype, "successMessage", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
state()
|
|
140
|
+
], Truncated.prototype, "hasCopied", 2);
|
|
141
|
+
__decorateClass([
|
|
142
|
+
state()
|
|
143
|
+
], Truncated.prototype, "fullText", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
state()
|
|
146
|
+
], Truncated.prototype, "overflowing", 2);
|
|
147
|
+
__decorateClass([
|
|
148
|
+
query("#content")
|
|
149
|
+
], Truncated.prototype, "content", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
query("#overlay")
|
|
152
|
+
], Truncated.prototype, "overlayEl", 2);
|
|
153
|
+
__decorateClass([
|
|
154
|
+
queryAssignedNodes({ flatten: true })
|
|
155
|
+
], Truncated.prototype, "slottedContent", 2);
|
|
156
|
+
__decorateClass([
|
|
157
|
+
queryAssignedElements({ slot: "overflow", flatten: true })
|
|
158
|
+
], Truncated.prototype, "slottedOverflow", 2);
|
|
159
|
+
//# sourceMappingURL=Truncated.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Truncated.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2021 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 PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport type { Overlay, Placement } from '@spectrum-web-components/overlay';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport {\n property,\n query,\n queryAssignedElements,\n queryAssignedNodes,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './truncated.css.js';\n\n/**\n * @element sp-truncated\n */\nexport class Truncated extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\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 */\n @property()\n placement: Placement = 'top-start';\n\n /*\n * @type {String}\n * @attr success-message\n * @description The message to display when the text is copied to the clipboard after clicking on the truncated text\n */\n @property({ type: String, attribute: 'success-message' })\n successMessage = 'Copied to clipboard';\n\n @state()\n hasCopied = false;\n\n @state()\n private fullText = '';\n\n @state()\n private overflowing = false;\n\n @query('#content')\n private content!: HTMLElement;\n\n @query('#overlay')\n private overlayEl?: Overlay;\n\n @queryAssignedNodes({ flatten: true })\n private slottedContent!: Node[];\n\n // elements instead of nodes because, according to spec,\n // flattened assignedNodes will return a slot's *children* if there are no assigned nodes.\n // \u00AF\\_(\u30C4)_/\u00AF\n @queryAssignedElements({ slot: 'overflow', flatten: true })\n private slottedOverflow!: HTMLElement[];\n\n get hasCustomOverflow(): boolean {\n return this.slottedOverflow.length > 0;\n }\n\n private resizeObserver = new ResizeObserver(() => {\n this.measureOverflow();\n });\n\n private mutationObserver = new MutationObserver(() => {\n this.copyText();\n });\n\n override render(): TemplateResult {\n /* eslint-disable lit-a11y/click-events-have-key-events */\n return html`\n <span id=\"content\" @click=${this.handleClick}>\n <slot></slot>\n </span>\n ${this.renderTooltip()}\n `;\n /* eslint-enable lit-a11y/click-events-have-key-events */\n }\n\n private renderTooltip(): TemplateResult | undefined {\n if (!this.overflowing) {\n return html`\n <slot\n name=\"overflow\"\n style=\"display: none\"\n @slotchange=${this.handleOverflowSlotchange}\n ></slot>\n `;\n }\n return html`\n <sp-overlay\n id=\"overlay\"\n .triggerElement=${this as HTMLElement}\n .triggerInteraction=${'hover'}\n type=\"hint\"\n placement=${this.placement}\n >\n <sp-tooltip name=\"tooltip\">\n ${!this.hasCopied\n ? html`\n <slot\n name=\"overflow\"\n @slotchange=${this.handleOverflowSlotchange}\n >\n ${this.fullText}\n </slot>\n `\n : this.successMessage}\n </sp-tooltip>\n </sp-overlay>\n `;\n }\n\n protected override firstUpdated(\n _changedProperties: PropertyValues<this>\n ): void {\n this.resizeObserver.observe(this);\n this.resizeObserver.observe(this.content);\n this.copyText();\n this.measureOverflow();\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties);\n if (\n changedProperties.has('hasCopied') &&\n this.hasCopied &&\n this.overlayEl\n ) {\n // we know overlayEl exists because it couldn't copy the text otherwise\n this.overlayEl.open = true;\n }\n }\n\n private handleOverflowSlotchange(): void {\n this.mutationObserver.disconnect();\n if (!this.hasCustomOverflow) {\n /* c8 ignore next 5 */\n this.mutationObserver.observe(this.content, {\n subtree: true,\n childList: true,\n characterData: true,\n });\n }\n }\n\n private handleClick(): void {\n if (!this.overflowing) return;\n\n const textToCopy = this.slottedContent\n .map((node) => node.textContent ?? '')\n .join('')\n .trim();\n navigator.clipboard.writeText(textToCopy);\n this.hasCopied = true;\n /* c8 ignore next 3 */\n setTimeout(() => {\n this.hasCopied = false;\n }, 6000);\n }\n\n private measureOverflow(): void {\n // Add 1 because Safari sometimes rounds by 1px, breaking the calculation otherwise\n this.overflowing = this.content.offsetWidth > this.clientWidth + 1;\n }\n\n // Copies just the textContent of slotted nodes into the tooltip to avoid duplicating the user's DOM\n private copyText(): void {\n if (this.hasCustomOverflow) return;\n this.fullText = this.slottedContent\n .map((node) => node.textContent ?? '')\n .join('');\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Truncated.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=(l,o,e,r)=>{for(var t=r>1?void 0:r?m(o,e):o,a=l.length-1,n;a>=0;a--)(n=l[a])&&(t=(r?n(o,e,t):n(t))||t);return r&&t&&d(o,e,t),t};import{html as i,SpectrumElement as u}from"@spectrum-web-components/base";import"@spectrum-web-components/overlay/sp-overlay.js";import"@spectrum-web-components/tooltip/sp-tooltip.js";import{property as h,query as v,queryAssignedElements as c,queryAssignedNodes as f,state as p}from"@spectrum-web-components/base/src/decorators.js";import y from"./truncated.css.js";export class Truncated extends u{constructor(){super(...arguments);this.placement="top-start";this.successMessage="Copied to clipboard";this.hasCopied=!1;this.fullText="";this.overflowing=!1;this.resizeObserver=new ResizeObserver(()=>{this.measureOverflow()});this.mutationObserver=new MutationObserver(()=>{this.copyText()})}static get styles(){return[y]}get hasCustomOverflow(){return this.slottedOverflow.length>0}render(){return i`
|
|
2
|
+
<span id="content" @click=${this.handleClick}>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</span>
|
|
5
|
+
${this.renderTooltip()}
|
|
6
|
+
`}renderTooltip(){return this.overflowing?i`
|
|
7
|
+
<sp-overlay
|
|
8
|
+
id="overlay"
|
|
9
|
+
.triggerElement=${this}
|
|
10
|
+
.triggerInteraction=${"hover"}
|
|
11
|
+
type="hint"
|
|
12
|
+
placement=${this.placement}
|
|
13
|
+
>
|
|
14
|
+
<sp-tooltip name="tooltip">
|
|
15
|
+
${this.hasCopied?this.successMessage:i`
|
|
16
|
+
<slot
|
|
17
|
+
name="overflow"
|
|
18
|
+
@slotchange=${this.handleOverflowSlotchange}
|
|
19
|
+
>
|
|
20
|
+
${this.fullText}
|
|
21
|
+
</slot>
|
|
22
|
+
`}
|
|
23
|
+
</sp-tooltip>
|
|
24
|
+
</sp-overlay>
|
|
25
|
+
`:i`
|
|
26
|
+
<slot
|
|
27
|
+
name="overflow"
|
|
28
|
+
style="display: none"
|
|
29
|
+
@slotchange=${this.handleOverflowSlotchange}
|
|
30
|
+
></slot>
|
|
31
|
+
`}firstUpdated(e){this.resizeObserver.observe(this),this.resizeObserver.observe(this.content),this.copyText(),this.measureOverflow()}updated(e){super.updated(e),e.has("hasCopied")&&this.hasCopied&&this.overlayEl&&(this.overlayEl.open=!0)}handleOverflowSlotchange(){this.mutationObserver.disconnect(),this.hasCustomOverflow||this.mutationObserver.observe(this.content,{subtree:!0,childList:!0,characterData:!0})}handleClick(){if(!this.overflowing)return;const e=this.slottedContent.map(r=>{var t;return(t=r.textContent)!=null?t:""}).join("").trim();navigator.clipboard.writeText(e),this.hasCopied=!0,setTimeout(()=>{this.hasCopied=!1},6e3)}measureOverflow(){this.overflowing=this.content.offsetWidth>this.clientWidth+1}copyText(){this.hasCustomOverflow||(this.fullText=this.slottedContent.map(e=>{var r;return(r=e.textContent)!=null?r:""}).join(""))}}s([h()],Truncated.prototype,"placement",2),s([h({type:String,attribute:"success-message"})],Truncated.prototype,"successMessage",2),s([p()],Truncated.prototype,"hasCopied",2),s([p()],Truncated.prototype,"fullText",2),s([p()],Truncated.prototype,"overflowing",2),s([v("#content")],Truncated.prototype,"content",2),s([v("#overlay")],Truncated.prototype,"overlayEl",2),s([f({flatten:!0})],Truncated.prototype,"slottedContent",2),s([c({slot:"overflow",flatten:!0})],Truncated.prototype,"slottedOverflow",2);
|
|
32
|
+
//# sourceMappingURL=Truncated.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Truncated.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2021 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 PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport type { Overlay, Placement } from '@spectrum-web-components/overlay';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport {\n property,\n query,\n queryAssignedElements,\n queryAssignedNodes,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './truncated.css.js';\n\n/**\n * @element sp-truncated\n */\nexport class Truncated extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\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 */\n @property()\n placement: Placement = 'top-start';\n\n /*\n * @type {String}\n * @attr success-message\n * @description The message to display when the text is copied to the clipboard after clicking on the truncated text\n */\n @property({ type: String, attribute: 'success-message' })\n successMessage = 'Copied to clipboard';\n\n @state()\n hasCopied = false;\n\n @state()\n private fullText = '';\n\n @state()\n private overflowing = false;\n\n @query('#content')\n private content!: HTMLElement;\n\n @query('#overlay')\n private overlayEl?: Overlay;\n\n @queryAssignedNodes({ flatten: true })\n private slottedContent!: Node[];\n\n // elements instead of nodes because, according to spec,\n // flattened assignedNodes will return a slot's *children* if there are no assigned nodes.\n // \u00AF\\_(\u30C4)_/\u00AF\n @queryAssignedElements({ slot: 'overflow', flatten: true })\n private slottedOverflow!: HTMLElement[];\n\n get hasCustomOverflow(): boolean {\n return this.slottedOverflow.length > 0;\n }\n\n private resizeObserver = new ResizeObserver(() => {\n this.measureOverflow();\n });\n\n private mutationObserver = new MutationObserver(() => {\n this.copyText();\n });\n\n override render(): TemplateResult {\n /* eslint-disable lit-a11y/click-events-have-key-events */\n return html`\n <span id=\"content\" @click=${this.handleClick}>\n <slot></slot>\n </span>\n ${this.renderTooltip()}\n `;\n /* eslint-enable lit-a11y/click-events-have-key-events */\n }\n\n private renderTooltip(): TemplateResult | undefined {\n if (!this.overflowing) {\n return html`\n <slot\n name=\"overflow\"\n style=\"display: none\"\n @slotchange=${this.handleOverflowSlotchange}\n ></slot>\n `;\n }\n return html`\n <sp-overlay\n id=\"overlay\"\n .triggerElement=${this as HTMLElement}\n .triggerInteraction=${'hover'}\n type=\"hint\"\n placement=${this.placement}\n >\n <sp-tooltip name=\"tooltip\">\n ${!this.hasCopied\n ? html`\n <slot\n name=\"overflow\"\n @slotchange=${this.handleOverflowSlotchange}\n >\n ${this.fullText}\n </slot>\n `\n : this.successMessage}\n </sp-tooltip>\n </sp-overlay>\n `;\n }\n\n protected override firstUpdated(\n _changedProperties: PropertyValues<this>\n ): void {\n this.resizeObserver.observe(this);\n this.resizeObserver.observe(this.content);\n this.copyText();\n this.measureOverflow();\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties);\n if (\n changedProperties.has('hasCopied') &&\n this.hasCopied &&\n this.overlayEl\n ) {\n // we know overlayEl exists because it couldn't copy the text otherwise\n this.overlayEl.open = true;\n }\n }\n\n private handleOverflowSlotchange(): void {\n this.mutationObserver.disconnect();\n if (!this.hasCustomOverflow) {\n /* c8 ignore next 5 */\n this.mutationObserver.observe(this.content, {\n subtree: true,\n childList: true,\n characterData: true,\n });\n }\n }\n\n private handleClick(): void {\n if (!this.overflowing) return;\n\n const textToCopy = this.slottedContent\n .map((node) => node.textContent ?? '')\n .join('')\n .trim();\n navigator.clipboard.writeText(textToCopy);\n this.hasCopied = true;\n /* c8 ignore next 3 */\n setTimeout(() => {\n this.hasCopied = false;\n }, 6000);\n }\n\n private measureOverflow(): void {\n // Add 1 because Safari sometimes rounds by 1px, breaking the calculation otherwise\n this.overflowing = this.content.offsetWidth > this.clientWidth + 1;\n }\n\n // Copies just the textContent of slotted nodes into the tooltip to avoid duplicating the user's DOM\n private copyText(): void {\n if (this.hasCustomOverflow) return;\n this.fullText = this.slottedContent\n .map((node) => node.textContent ?? '')\n .join('');\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCAEP,MAAO,iDACP,MAAO,iDACP,OACI,YAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,sBAAAC,EACA,SAAAC,MACG,kDAEP,OAAOC,MAAY,qBAKZ,aAAM,kBAAkBN,CAAgB,CAAxC,kCASH,eAAuB,YAQvB,oBAAiB,sBAGjB,eAAY,GAGZ,KAAQ,SAAW,GAGnB,KAAQ,YAAc,GAqBtB,KAAQ,eAAiB,IAAI,eAAe,IAAM,CAC9C,KAAK,gBAAgB,CACzB,CAAC,EAED,KAAQ,iBAAmB,IAAI,iBAAiB,IAAM,CAClD,KAAK,SAAS,CAClB,CAAC,EApDD,WAA2B,QAAyB,CAChD,MAAO,CAACM,CAAM,CAClB,CAwCA,IAAI,mBAA6B,CAC7B,OAAO,KAAK,gBAAgB,OAAS,CACzC,CAUS,QAAyB,CAE9B,OAAOP;AAAA,wCACyB,KAAK,WAAW;AAAA;AAAA;AAAA,cAG1C,KAAK,cAAc,CAAC;AAAA,SAG9B,CAEQ,eAA4C,CAChD,OAAK,KAAK,YASHA;AAAA;AAAA;AAAA,kCAGmB,IAAmB;AAAA,sCACf,OAAO;AAAA;AAAA,4BAEjB,KAAK,SAAS;AAAA;AAAA;AAAA,sBAGnB,KAAK,UASF,KAAK,eARLA;AAAA;AAAA;AAAA,gDAGsB,KAAK,wBAAwB;AAAA;AAAA,oCAEzC,KAAK,QAAQ;AAAA;AAAA,2BAGJ;AAAA;AAAA;AAAA,UA1B1BA;AAAA;AAAA;AAAA;AAAA,kCAIe,KAAK,wBAAwB;AAAA;AAAA,aA0B3D,CAEmB,aACfQ,EACI,CACJ,KAAK,eAAe,QAAQ,IAAI,EAChC,KAAK,eAAe,QAAQ,KAAK,OAAO,EACxC,KAAK,SAAS,EACd,KAAK,gBAAgB,CACzB,CAEmB,QAAQC,EAA+C,CACtE,MAAM,QAAQA,CAAiB,EAE3BA,EAAkB,IAAI,WAAW,GACjC,KAAK,WACL,KAAK,YAGL,KAAK,UAAU,KAAO,GAE9B,CAEQ,0BAAiC,CACrC,KAAK,iBAAiB,WAAW,EAC5B,KAAK,mBAEN,KAAK,iBAAiB,QAAQ,KAAK,QAAS,CACxC,QAAS,GACT,UAAW,GACX,cAAe,EACnB,CAAC,CAET,CAEQ,aAAoB,CACxB,GAAI,CAAC,KAAK,YAAa,OAEvB,MAAMC,EAAa,KAAK,eACnB,IAAKC,GAAM,CA5KxB,IAAAC,EA4K2B,OAAAA,EAAAD,EAAK,cAAL,KAAAC,EAAoB,GAAE,EACpC,KAAK,EAAE,EACP,KAAK,EACV,UAAU,UAAU,UAAUF,CAAU,EACxC,KAAK,UAAY,GAEjB,WAAW,IAAM,CACb,KAAK,UAAY,EACrB,EAAG,GAAI,CACX,CAEQ,iBAAwB,CAE5B,KAAK,YAAc,KAAK,QAAQ,YAAc,KAAK,YAAc,CACrE,CAGQ,UAAiB,CACjB,KAAK,oBACT,KAAK,SAAW,KAAK,eAChB,IAAKC,GAAM,CAhMxB,IAAAC,EAgM2B,OAAAA,EAAAD,EAAK,cAAL,KAAAC,EAAoB,GAAE,EACpC,KAAK,EAAE,EAChB,CACJ,CAvJIC,EAAA,CADCX,EAAS,GARD,UAST,yBAQAW,EAAA,CADCX,EAAS,CAAE,KAAM,OAAQ,UAAW,iBAAkB,CAAC,GAhB/C,UAiBT,8BAGAW,EAAA,CADCP,EAAM,GAnBE,UAoBT,yBAGQO,EAAA,CADPP,EAAM,GAtBE,UAuBD,wBAGAO,EAAA,CADPP,EAAM,GAzBE,UA0BD,2BAGAO,EAAA,CADPV,EAAM,UAAU,GA5BR,UA6BD,uBAGAU,EAAA,CADPV,EAAM,UAAU,GA/BR,UAgCD,yBAGAU,EAAA,CADPR,EAAmB,CAAE,QAAS,EAAK,CAAC,GAlC5B,UAmCD,8BAMAQ,EAAA,CADPT,EAAsB,CAAE,KAAM,WAAY,QAAS,EAAK,CAAC,GAxCjD,UAyCD",
|
|
6
|
+
"names": ["html", "SpectrumElement", "property", "query", "queryAssignedElements", "queryAssignedNodes", "state", "styles", "_changedProperties", "changedProperties", "textToCopy", "node", "_a", "__decorateClass"]
|
|
7
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Truncated.js';
|
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Truncated.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Truncated.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{min-width:0;max-width:100%;white-space:nowrap;text-overflow:ellipsis;display:inline-block;overflow:hidden}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=truncated.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["truncated.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{min-width:0;max-width:100%;white-space:nowrap;text-overflow:ellipsis;display:inline-block;overflow:hidden}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["truncated.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{min-width:0;max-width:100%;white-space:nowrap;text-overflow:ellipsis;display:inline-block;overflow:hidden}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
|
+
}
|