@tectra-ng/ui 0.1.8 → 0.2.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 +2 -2
- package/avatar/README.md +19 -6
- package/color-picker/README.md +6 -5
- package/fesm2022/tectra-ng-ui-avatar.mjs +243 -63
- package/fesm2022/tectra-ng-ui-avatar.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-color-picker.mjs +100 -18
- package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-list-input.mjs +693 -0
- package/fesm2022/tectra-ng-ui-list-input.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs +1 -0
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-month-calendar.mjs +1 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tooltip.mjs +10 -5
- package/fesm2022/tectra-ng-ui-tooltip.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-truncate-text.mjs +390 -0
- package/fesm2022/tectra-ng-ui-truncate-text.mjs.map +1 -0
- package/list-input/README.md +52 -0
- package/package.json +12 -4
- package/truncate-text/README.md +38 -0
- package/types/tectra-ng-ui-avatar.d.ts +85 -3
- package/types/tectra-ng-ui-avatar.d.ts.map +1 -1
- package/types/tectra-ng-ui-color-picker.d.ts +22 -1
- package/types/tectra-ng-ui-color-picker.d.ts.map +1 -1
- package/types/tectra-ng-ui-list-input.d.ts +231 -0
- package/types/tectra-ng-ui-list-input.d.ts.map +1 -0
- package/types/tectra-ng-ui-tooltip.d.ts +20 -17
- package/types/tectra-ng-ui-tooltip.d.ts.map +1 -1
- package/types/tectra-ng-ui-truncate-text.d.ts +123 -0
- package/types/tectra-ng-ui-truncate-text.d.ts.map +1 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, booleanAttribute, computed, inject, input, numberAttribute, output, signal } from "@angular/core";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { injectTranslations } from "@tectra-ng/core/i18n";
|
|
6
|
+
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
7
|
+
import { TxIcon } from "@tectra-ng/icons";
|
|
8
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
9
|
+
import { TxHighlightText } from "@tectra-ng/ui/highlight-text";
|
|
10
|
+
import { TxTooltip } from "@tectra-ng/ui/tooltip";
|
|
11
|
+
const COPIED_FOR = 1600;
|
|
12
|
+
var TxTruncateText = class TxTruncateText {
|
|
13
|
+
document = inject(DOCUMENT);
|
|
14
|
+
timer = null;
|
|
15
|
+
text = input("", ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
16
|
+
limit = input(15, {
|
|
17
|
+
...ngDevMode ? { debugName: "limit" } : /* istanbul ignore next */ {},
|
|
18
|
+
transform: numberAttribute
|
|
19
|
+
});
|
|
20
|
+
ellipsis = input("...", ...ngDevMode ? [{ debugName: "ellipsis" }] : /* istanbul ignore next */ []);
|
|
21
|
+
href = input(void 0, ...ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []);
|
|
22
|
+
openLink = input(false, {
|
|
23
|
+
...ngDevMode ? { debugName: "openLink" } : /* istanbul ignore next */ {},
|
|
24
|
+
transform: booleanAttribute
|
|
25
|
+
});
|
|
26
|
+
target = input("_blank", ...ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []);
|
|
27
|
+
highlight = input("", ...ngDevMode ? [{ debugName: "highlight" }] : /* istanbul ignore next */ []);
|
|
28
|
+
copyable = input(false, {
|
|
29
|
+
...ngDevMode ? { debugName: "copyable" } : /* istanbul ignore next */ {},
|
|
30
|
+
transform: booleanAttribute
|
|
31
|
+
});
|
|
32
|
+
tooltipPlacement = input("top", ...ngDevMode ? [{ debugName: "tooltipPlacement" }] : /* istanbul ignore next */ []);
|
|
33
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
34
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
35
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
36
|
+
unstyled = input(void 0, {
|
|
37
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
38
|
+
transform: optionalBoolean
|
|
39
|
+
});
|
|
40
|
+
copied = output();
|
|
41
|
+
translations = injectTranslations();
|
|
42
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
43
|
+
passThrough = injectPassThrough("truncateText", this, this.pt, this.ptOptions);
|
|
44
|
+
isCopied = signal(false, ...ngDevMode ? [{ debugName: "isCopied" }] : /* istanbul ignore next */ []);
|
|
45
|
+
fullText = computed(() => String(this.text() ?? ""), ...ngDevMode ? [{ debugName: "fullText" }] : /* istanbul ignore next */ []);
|
|
46
|
+
isTruncated = computed(() => this.limit() >= 0 && Array.from(this.fullText()).length > this.limit(), ...ngDevMode ? [{ debugName: "isTruncated" }] : /* istanbul ignore next */ []);
|
|
47
|
+
displayText = computed(() => this.isTruncated() ? Array.from(this.fullText()).slice(0, this.limit()).join("") + this.ellipsis() : this.fullText(), ...ngDevMode ? [{ debugName: "displayText" }] : /* istanbul ignore next */ []);
|
|
48
|
+
tooltip = computed(() => this.isTruncated() ? this.fullText() : null, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
|
|
49
|
+
linkHref = computed(() => this.href() || (this.openLink() ? this.fullText() : null) || null, ...ngDevMode ? [{ debugName: "linkHref" }] : /* istanbul ignore next */ []);
|
|
50
|
+
relation = computed(() => this.target() === "_blank" ? "noopener noreferrer" : null, ...ngDevMode ? [{ debugName: "relation" }] : /* istanbul ignore next */ []);
|
|
51
|
+
copyLabel = computed(() => this.isCopied() ? this.translations().copied : this.translations().copy, ...ngDevMode ? [{ debugName: "copyLabel" }] : /* istanbul ignore next */ []);
|
|
52
|
+
hostStyle = computed(() => ({
|
|
53
|
+
...toStyleObject(this.dt(), "--tx-truncate-text"),
|
|
54
|
+
...this.passThrough().root?.style
|
|
55
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
56
|
+
constructor() {
|
|
57
|
+
inject(DestroyRef).onDestroy(() => this.timer && clearTimeout(this.timer));
|
|
58
|
+
}
|
|
59
|
+
copy() {
|
|
60
|
+
const text = this.fullText();
|
|
61
|
+
this.document.defaultView?.navigator.clipboard?.writeText(text);
|
|
62
|
+
this.copied.emit(text);
|
|
63
|
+
this.isCopied.set(true);
|
|
64
|
+
if (this.timer) clearTimeout(this.timer);
|
|
65
|
+
this.timer = setTimeout(() => this.isCopied.set(false), COPIED_FOR);
|
|
66
|
+
}
|
|
67
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
68
|
+
minVersion: "12.0.0",
|
|
69
|
+
version: "22.2.3",
|
|
70
|
+
ngImport: i0,
|
|
71
|
+
type: TxTruncateText,
|
|
72
|
+
deps: [],
|
|
73
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
74
|
+
});
|
|
75
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
76
|
+
minVersion: "17.0.0",
|
|
77
|
+
version: "22.2.3",
|
|
78
|
+
type: TxTruncateText,
|
|
79
|
+
isStandalone: true,
|
|
80
|
+
selector: "tx-truncate-text",
|
|
81
|
+
inputs: {
|
|
82
|
+
text: {
|
|
83
|
+
classPropertyName: "text",
|
|
84
|
+
publicName: "text",
|
|
85
|
+
isSignal: true,
|
|
86
|
+
isRequired: false,
|
|
87
|
+
transformFunction: null
|
|
88
|
+
},
|
|
89
|
+
limit: {
|
|
90
|
+
classPropertyName: "limit",
|
|
91
|
+
publicName: "limit",
|
|
92
|
+
isSignal: true,
|
|
93
|
+
isRequired: false,
|
|
94
|
+
transformFunction: null
|
|
95
|
+
},
|
|
96
|
+
ellipsis: {
|
|
97
|
+
classPropertyName: "ellipsis",
|
|
98
|
+
publicName: "ellipsis",
|
|
99
|
+
isSignal: true,
|
|
100
|
+
isRequired: false,
|
|
101
|
+
transformFunction: null
|
|
102
|
+
},
|
|
103
|
+
href: {
|
|
104
|
+
classPropertyName: "href",
|
|
105
|
+
publicName: "href",
|
|
106
|
+
isSignal: true,
|
|
107
|
+
isRequired: false,
|
|
108
|
+
transformFunction: null
|
|
109
|
+
},
|
|
110
|
+
openLink: {
|
|
111
|
+
classPropertyName: "openLink",
|
|
112
|
+
publicName: "openLink",
|
|
113
|
+
isSignal: true,
|
|
114
|
+
isRequired: false,
|
|
115
|
+
transformFunction: null
|
|
116
|
+
},
|
|
117
|
+
target: {
|
|
118
|
+
classPropertyName: "target",
|
|
119
|
+
publicName: "target",
|
|
120
|
+
isSignal: true,
|
|
121
|
+
isRequired: false,
|
|
122
|
+
transformFunction: null
|
|
123
|
+
},
|
|
124
|
+
highlight: {
|
|
125
|
+
classPropertyName: "highlight",
|
|
126
|
+
publicName: "highlight",
|
|
127
|
+
isSignal: true,
|
|
128
|
+
isRequired: false,
|
|
129
|
+
transformFunction: null
|
|
130
|
+
},
|
|
131
|
+
copyable: {
|
|
132
|
+
classPropertyName: "copyable",
|
|
133
|
+
publicName: "copyable",
|
|
134
|
+
isSignal: true,
|
|
135
|
+
isRequired: false,
|
|
136
|
+
transformFunction: null
|
|
137
|
+
},
|
|
138
|
+
tooltipPlacement: {
|
|
139
|
+
classPropertyName: "tooltipPlacement",
|
|
140
|
+
publicName: "tooltipPlacement",
|
|
141
|
+
isSignal: true,
|
|
142
|
+
isRequired: false,
|
|
143
|
+
transformFunction: null
|
|
144
|
+
},
|
|
145
|
+
dt: {
|
|
146
|
+
classPropertyName: "dt",
|
|
147
|
+
publicName: "dt",
|
|
148
|
+
isSignal: true,
|
|
149
|
+
isRequired: false,
|
|
150
|
+
transformFunction: null
|
|
151
|
+
},
|
|
152
|
+
pt: {
|
|
153
|
+
classPropertyName: "pt",
|
|
154
|
+
publicName: "pt",
|
|
155
|
+
isSignal: true,
|
|
156
|
+
isRequired: false,
|
|
157
|
+
transformFunction: null
|
|
158
|
+
},
|
|
159
|
+
ptOptions: {
|
|
160
|
+
classPropertyName: "ptOptions",
|
|
161
|
+
publicName: "ptOptions",
|
|
162
|
+
isSignal: true,
|
|
163
|
+
isRequired: false,
|
|
164
|
+
transformFunction: null
|
|
165
|
+
},
|
|
166
|
+
unstyled: {
|
|
167
|
+
classPropertyName: "unstyled",
|
|
168
|
+
publicName: "unstyled",
|
|
169
|
+
isSignal: true,
|
|
170
|
+
isRequired: false,
|
|
171
|
+
transformFunction: null
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
outputs: { copied: "copied" },
|
|
175
|
+
host: {
|
|
176
|
+
properties: {
|
|
177
|
+
"class": "passThrough().root?.class",
|
|
178
|
+
"style": "hostStyle()",
|
|
179
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
180
|
+
"class.tx-truncate-text--truncated": "isTruncated()"
|
|
181
|
+
},
|
|
182
|
+
classAttribute: "tx-truncate-text"
|
|
183
|
+
},
|
|
184
|
+
ngImport: i0,
|
|
185
|
+
template: "@if (copyable() && fullText()) {\n <button\n type=\"button\"\n class=\"tx-truncate-text__copy\"\n [class.tx-truncate-text__copy--done]=\"isCopied()\"\n [class]=\"passThrough().copy?.class\"\n [style]=\"passThrough().copy?.style\"\n [attr.aria-label]=\"copyLabel()\"\n [txTooltip]=\"copyLabel()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n (click)=\"copy()\"\n >\n <tx-icon [name]=\"isCopied() ? 'check' : 'clone'\" />\n </button>\n}\n<ng-template #content>\n @if (isTruncated()) {\n <span aria-hidden=\"true\"><tx-highlight-text [text]=\"displayText()\" [highlight]=\"highlight()\" [unstyled]=\"isUnstyled()\" /></span>\n <span class=\"tx-truncate-text__full\">{{ fullText() }}</span>\n } @else {\n <tx-highlight-text [text]=\"displayText()\" [highlight]=\"highlight()\" [unstyled]=\"isUnstyled()\" />\n }\n</ng-template>\n@if (linkHref(); as link) {\n <a\n class=\"tx-truncate-text__text tx-truncate-text__link\"\n [href]=\"link\"\n [attr.target]=\"target()\"\n [attr.rel]=\"relation()\"\n [class]=\"passThrough().link?.class\"\n [style]=\"passThrough().link?.style\"\n [txTooltip]=\"tooltip()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n [tooltipInteractive]=\"true\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n </a>\n} @else {\n <span\n class=\"tx-truncate-text__text\"\n [attr.tabindex]=\"isTruncated() ? 0 : null\"\n [class]=\"passThrough().text?.class\"\n [style]=\"passThrough().text?.style\"\n [txTooltip]=\"tooltip()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n [tooltipInteractive]=\"true\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n </span>\n}\n",
|
|
186
|
+
styles: [":host{display:inline-flex;align-items:center;max-width:100%;min-width:0;vertical-align:middle}.tx-truncate-text__text{display:inline-flex;min-width:0;white-space:nowrap}.tx-truncate-text__full{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.tx-truncate-text__copy{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:none;font:inherit;cursor:pointer}:host([data-styled]){gap:var(--tx-truncate-text-gap)}:host([data-styled]) .tx-truncate-text__text{border-radius:2px}:host([data-styled]) .tx-truncate-text__text:focus-visible{outline:2px solid var(--tx-truncate-text-focus-ring-color);outline-offset:2px}:host([data-styled].tx-truncate-text--truncated) .tx-truncate-text__text{cursor:pointer}:host([data-styled]) .tx-truncate-text__link{color:var(--tx-truncate-text-link-color);text-decoration:none;transition:color var(--tx-truncate-text-transition-duration) ease}:host([data-styled]) .tx-truncate-text__link:hover{color:var(--tx-truncate-text-link-hover-color)}:host([data-styled]) .tx-truncate-text__copy{border-radius:2px;color:var(--tx-truncate-text-copy-color);font-size:var(--tx-truncate-text-copy-icon-size);transition:color var(--tx-truncate-text-transition-duration) ease}:host([data-styled]) .tx-truncate-text__copy:hover{color:var(--tx-truncate-text-copy-hover-color)}:host([data-styled]) .tx-truncate-text__copy:focus-visible{outline:2px solid var(--tx-truncate-text-focus-ring-color);outline-offset:2px}:host([data-styled]) .tx-truncate-text__copy--done{color:var(--tx-truncate-text-copied-color)}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-truncate-text__link,:host([data-styled]) .tx-truncate-text__copy{transition:none}}\n"],
|
|
187
|
+
dependencies: [
|
|
188
|
+
{
|
|
189
|
+
kind: "directive",
|
|
190
|
+
type: NgTemplateOutlet,
|
|
191
|
+
selector: "[ngTemplateOutlet]",
|
|
192
|
+
inputs: [
|
|
193
|
+
"ngTemplateOutletContext",
|
|
194
|
+
"ngTemplateOutlet",
|
|
195
|
+
"ngTemplateOutletInjector"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
kind: "component",
|
|
200
|
+
type: TxHighlightText,
|
|
201
|
+
selector: "tx-highlight-text",
|
|
202
|
+
inputs: [
|
|
203
|
+
"text",
|
|
204
|
+
"highlight",
|
|
205
|
+
"caseSensitive",
|
|
206
|
+
"dt",
|
|
207
|
+
"pt",
|
|
208
|
+
"ptOptions",
|
|
209
|
+
"unstyled"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
kind: "component",
|
|
214
|
+
type: TxIcon,
|
|
215
|
+
selector: "tx-icon",
|
|
216
|
+
inputs: ["name"]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
kind: "directive",
|
|
220
|
+
type: TxTooltip,
|
|
221
|
+
selector: "[txTooltip]",
|
|
222
|
+
inputs: [
|
|
223
|
+
"txTooltip",
|
|
224
|
+
"tooltipPlacement",
|
|
225
|
+
"tooltipEvent",
|
|
226
|
+
"tooltipShowDelay",
|
|
227
|
+
"tooltipHideDelay",
|
|
228
|
+
"tooltipLife",
|
|
229
|
+
"tooltipOffset",
|
|
230
|
+
"tooltipArrow",
|
|
231
|
+
"tooltipInteractive",
|
|
232
|
+
"tooltipDisabled",
|
|
233
|
+
"tooltipOverflowOnly",
|
|
234
|
+
"tooltipMultiline",
|
|
235
|
+
"tooltipContext",
|
|
236
|
+
"tooltipClass",
|
|
237
|
+
"tooltipDt",
|
|
238
|
+
"tooltipPt",
|
|
239
|
+
"tooltipPtOptions",
|
|
240
|
+
"tooltipUnstyled"
|
|
241
|
+
],
|
|
242
|
+
outputs: ["tooltipShown", "tooltipHidden"],
|
|
243
|
+
exportAs: ["txTooltip"]
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
250
|
+
minVersion: "12.0.0",
|
|
251
|
+
version: "22.2.3",
|
|
252
|
+
ngImport: i0,
|
|
253
|
+
type: TxTruncateText,
|
|
254
|
+
decorators: [{
|
|
255
|
+
type: Component,
|
|
256
|
+
args: [{
|
|
257
|
+
selector: "tx-truncate-text",
|
|
258
|
+
imports: [
|
|
259
|
+
NgTemplateOutlet,
|
|
260
|
+
TxHighlightText,
|
|
261
|
+
TxIcon,
|
|
262
|
+
TxTooltip
|
|
263
|
+
],
|
|
264
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
265
|
+
host: {
|
|
266
|
+
class: "tx-truncate-text",
|
|
267
|
+
"[class]": "passThrough().root?.class",
|
|
268
|
+
"[style]": "hostStyle()",
|
|
269
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
270
|
+
"[class.tx-truncate-text--truncated]": "isTruncated()"
|
|
271
|
+
},
|
|
272
|
+
template: "@if (copyable() && fullText()) {\n <button\n type=\"button\"\n class=\"tx-truncate-text__copy\"\n [class.tx-truncate-text__copy--done]=\"isCopied()\"\n [class]=\"passThrough().copy?.class\"\n [style]=\"passThrough().copy?.style\"\n [attr.aria-label]=\"copyLabel()\"\n [txTooltip]=\"copyLabel()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n (click)=\"copy()\"\n >\n <tx-icon [name]=\"isCopied() ? 'check' : 'clone'\" />\n </button>\n}\n<ng-template #content>\n @if (isTruncated()) {\n <span aria-hidden=\"true\"><tx-highlight-text [text]=\"displayText()\" [highlight]=\"highlight()\" [unstyled]=\"isUnstyled()\" /></span>\n <span class=\"tx-truncate-text__full\">{{ fullText() }}</span>\n } @else {\n <tx-highlight-text [text]=\"displayText()\" [highlight]=\"highlight()\" [unstyled]=\"isUnstyled()\" />\n }\n</ng-template>\n@if (linkHref(); as link) {\n <a\n class=\"tx-truncate-text__text tx-truncate-text__link\"\n [href]=\"link\"\n [attr.target]=\"target()\"\n [attr.rel]=\"relation()\"\n [class]=\"passThrough().link?.class\"\n [style]=\"passThrough().link?.style\"\n [txTooltip]=\"tooltip()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n [tooltipInteractive]=\"true\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n </a>\n} @else {\n <span\n class=\"tx-truncate-text__text\"\n [attr.tabindex]=\"isTruncated() ? 0 : null\"\n [class]=\"passThrough().text?.class\"\n [style]=\"passThrough().text?.style\"\n [txTooltip]=\"tooltip()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n [tooltipInteractive]=\"true\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n </span>\n}\n",
|
|
273
|
+
styles: [":host{display:inline-flex;align-items:center;max-width:100%;min-width:0;vertical-align:middle}.tx-truncate-text__text{display:inline-flex;min-width:0;white-space:nowrap}.tx-truncate-text__full{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.tx-truncate-text__copy{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:none;font:inherit;cursor:pointer}:host([data-styled]){gap:var(--tx-truncate-text-gap)}:host([data-styled]) .tx-truncate-text__text{border-radius:2px}:host([data-styled]) .tx-truncate-text__text:focus-visible{outline:2px solid var(--tx-truncate-text-focus-ring-color);outline-offset:2px}:host([data-styled].tx-truncate-text--truncated) .tx-truncate-text__text{cursor:pointer}:host([data-styled]) .tx-truncate-text__link{color:var(--tx-truncate-text-link-color);text-decoration:none;transition:color var(--tx-truncate-text-transition-duration) ease}:host([data-styled]) .tx-truncate-text__link:hover{color:var(--tx-truncate-text-link-hover-color)}:host([data-styled]) .tx-truncate-text__copy{border-radius:2px;color:var(--tx-truncate-text-copy-color);font-size:var(--tx-truncate-text-copy-icon-size);transition:color var(--tx-truncate-text-transition-duration) ease}:host([data-styled]) .tx-truncate-text__copy:hover{color:var(--tx-truncate-text-copy-hover-color)}:host([data-styled]) .tx-truncate-text__copy:focus-visible{outline:2px solid var(--tx-truncate-text-focus-ring-color);outline-offset:2px}:host([data-styled]) .tx-truncate-text__copy--done{color:var(--tx-truncate-text-copied-color)}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-truncate-text__link,:host([data-styled]) .tx-truncate-text__copy{transition:none}}\n"]
|
|
274
|
+
}]
|
|
275
|
+
}],
|
|
276
|
+
ctorParameters: () => [],
|
|
277
|
+
propDecorators: {
|
|
278
|
+
text: [{
|
|
279
|
+
type: i0.Input,
|
|
280
|
+
args: [{
|
|
281
|
+
isSignal: true,
|
|
282
|
+
alias: "text",
|
|
283
|
+
required: false
|
|
284
|
+
}]
|
|
285
|
+
}],
|
|
286
|
+
limit: [{
|
|
287
|
+
type: i0.Input,
|
|
288
|
+
args: [{
|
|
289
|
+
isSignal: true,
|
|
290
|
+
alias: "limit",
|
|
291
|
+
required: false
|
|
292
|
+
}]
|
|
293
|
+
}],
|
|
294
|
+
ellipsis: [{
|
|
295
|
+
type: i0.Input,
|
|
296
|
+
args: [{
|
|
297
|
+
isSignal: true,
|
|
298
|
+
alias: "ellipsis",
|
|
299
|
+
required: false
|
|
300
|
+
}]
|
|
301
|
+
}],
|
|
302
|
+
href: [{
|
|
303
|
+
type: i0.Input,
|
|
304
|
+
args: [{
|
|
305
|
+
isSignal: true,
|
|
306
|
+
alias: "href",
|
|
307
|
+
required: false
|
|
308
|
+
}]
|
|
309
|
+
}],
|
|
310
|
+
openLink: [{
|
|
311
|
+
type: i0.Input,
|
|
312
|
+
args: [{
|
|
313
|
+
isSignal: true,
|
|
314
|
+
alias: "openLink",
|
|
315
|
+
required: false
|
|
316
|
+
}]
|
|
317
|
+
}],
|
|
318
|
+
target: [{
|
|
319
|
+
type: i0.Input,
|
|
320
|
+
args: [{
|
|
321
|
+
isSignal: true,
|
|
322
|
+
alias: "target",
|
|
323
|
+
required: false
|
|
324
|
+
}]
|
|
325
|
+
}],
|
|
326
|
+
highlight: [{
|
|
327
|
+
type: i0.Input,
|
|
328
|
+
args: [{
|
|
329
|
+
isSignal: true,
|
|
330
|
+
alias: "highlight",
|
|
331
|
+
required: false
|
|
332
|
+
}]
|
|
333
|
+
}],
|
|
334
|
+
copyable: [{
|
|
335
|
+
type: i0.Input,
|
|
336
|
+
args: [{
|
|
337
|
+
isSignal: true,
|
|
338
|
+
alias: "copyable",
|
|
339
|
+
required: false
|
|
340
|
+
}]
|
|
341
|
+
}],
|
|
342
|
+
tooltipPlacement: [{
|
|
343
|
+
type: i0.Input,
|
|
344
|
+
args: [{
|
|
345
|
+
isSignal: true,
|
|
346
|
+
alias: "tooltipPlacement",
|
|
347
|
+
required: false
|
|
348
|
+
}]
|
|
349
|
+
}],
|
|
350
|
+
dt: [{
|
|
351
|
+
type: i0.Input,
|
|
352
|
+
args: [{
|
|
353
|
+
isSignal: true,
|
|
354
|
+
alias: "dt",
|
|
355
|
+
required: false
|
|
356
|
+
}]
|
|
357
|
+
}],
|
|
358
|
+
pt: [{
|
|
359
|
+
type: i0.Input,
|
|
360
|
+
args: [{
|
|
361
|
+
isSignal: true,
|
|
362
|
+
alias: "pt",
|
|
363
|
+
required: false
|
|
364
|
+
}]
|
|
365
|
+
}],
|
|
366
|
+
ptOptions: [{
|
|
367
|
+
type: i0.Input,
|
|
368
|
+
args: [{
|
|
369
|
+
isSignal: true,
|
|
370
|
+
alias: "ptOptions",
|
|
371
|
+
required: false
|
|
372
|
+
}]
|
|
373
|
+
}],
|
|
374
|
+
unstyled: [{
|
|
375
|
+
type: i0.Input,
|
|
376
|
+
args: [{
|
|
377
|
+
isSignal: true,
|
|
378
|
+
alias: "unstyled",
|
|
379
|
+
required: false
|
|
380
|
+
}]
|
|
381
|
+
}],
|
|
382
|
+
copied: [{
|
|
383
|
+
type: i0.Output,
|
|
384
|
+
args: ["copied"]
|
|
385
|
+
}]
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
export { TxTruncateText };
|
|
389
|
+
|
|
390
|
+
//# sourceMappingURL=tectra-ng-ui-truncate-text.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tectra-ng-ui-truncate-text.mjs","names":[],"sources":["../../../../packages/ui/truncate-text/src/truncate-text.component.ts","../../../../packages/ui/truncate-text/src/truncate-text.component.html"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, booleanAttribute, computed, inject, input, numberAttribute, output, signal } from '@angular/core';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { injectTranslations } from '@tectra-ng/core/i18n';\nimport { TxPlacement } from '@tectra-ng/core/overlay';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TxIcon } from '@tectra-ng/icons';\nimport { TectraDeepPartial, TectraTruncateTextTokens, toStyleObject } from '@tectra-ng/themes';\nimport { TxHighlightTerms, TxHighlightText } from '@tectra-ng/ui/highlight-text';\nimport { TxTooltip } from '@tectra-ng/ui/tooltip';\nimport { TxTruncateTextPart } from './truncate-text.types';\n\nconst COPIED_FOR = 1600;\n\n@Component({\n selector: 'tx-truncate-text',\n imports: [NgTemplateOutlet, TxHighlightText, TxIcon, TxTooltip],\n templateUrl: './truncate-text.component.html',\n styleUrl: './truncate-text.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-truncate-text',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[class.tx-truncate-text--truncated]': 'isTruncated()',\n },\n})\nexport class TxTruncateText {\n private document = inject(DOCUMENT);\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n readonly text = input<string | number | null | undefined>('');\n readonly limit = input<number, unknown>(15, { transform: numberAttribute });\n readonly ellipsis = input<string>('...');\n readonly href = input<string | null | undefined>(undefined);\n readonly openLink = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly target = input<string>('_blank');\n readonly highlight = input<TxHighlightTerms>('');\n readonly copyable = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly tooltipPlacement = input<TxPlacement>('top');\n readonly dt = input<TectraDeepPartial<TectraTruncateTextTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxTruncateTextPart, TxTruncateText> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly copied = output<string>();\n\n readonly translations = injectTranslations();\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('truncateText', this, this.pt, this.ptOptions);\n readonly isCopied = signal(false);\n\n readonly fullText = computed(() => String(this.text() ?? ''));\n readonly isTruncated = computed(() => this.limit() >= 0 && Array.from(this.fullText()).length > this.limit());\n readonly displayText = computed(() => (this.isTruncated() ? Array.from(this.fullText()).slice(0, this.limit()).join('') + this.ellipsis() : this.fullText()));\n readonly tooltip = computed(() => (this.isTruncated() ? this.fullText() : null));\n readonly linkHref = computed(() => this.href() || (this.openLink() ? this.fullText() : null) || null);\n readonly relation = computed(() => (this.target() === '_blank' ? 'noopener noreferrer' : null));\n readonly copyLabel = computed(() => (this.isCopied() ? this.translations().copied : this.translations().copy));\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-truncate-text'), ...this.passThrough().root?.style }));\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.timer && clearTimeout(this.timer));\n }\n\n copy(): void {\n const text = this.fullText();\n this.document.defaultView?.navigator.clipboard?.writeText(text);\n this.copied.emit(text);\n this.isCopied.set(true);\n if (this.timer) {\n clearTimeout(this.timer);\n }\n this.timer = setTimeout(() => this.isCopied.set(false), COPIED_FOR);\n }\n}\n","@if (copyable() && fullText()) {\n <button\n type=\"button\"\n class=\"tx-truncate-text__copy\"\n [class.tx-truncate-text__copy--done]=\"isCopied()\"\n [class]=\"passThrough().copy?.class\"\n [style]=\"passThrough().copy?.style\"\n [attr.aria-label]=\"copyLabel()\"\n [txTooltip]=\"copyLabel()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n (click)=\"copy()\"\n >\n <tx-icon [name]=\"isCopied() ? 'check' : 'clone'\" />\n </button>\n}\n<ng-template #content>\n @if (isTruncated()) {\n <span aria-hidden=\"true\"><tx-highlight-text [text]=\"displayText()\" [highlight]=\"highlight()\" [unstyled]=\"isUnstyled()\" /></span>\n <span class=\"tx-truncate-text__full\">{{ fullText() }}</span>\n } @else {\n <tx-highlight-text [text]=\"displayText()\" [highlight]=\"highlight()\" [unstyled]=\"isUnstyled()\" />\n }\n</ng-template>\n@if (linkHref(); as link) {\n <a\n class=\"tx-truncate-text__text tx-truncate-text__link\"\n [href]=\"link\"\n [attr.target]=\"target()\"\n [attr.rel]=\"relation()\"\n [class]=\"passThrough().link?.class\"\n [style]=\"passThrough().link?.style\"\n [txTooltip]=\"tooltip()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n [tooltipInteractive]=\"true\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n </a>\n} @else {\n <span\n class=\"tx-truncate-text__text\"\n [attr.tabindex]=\"isTruncated() ? 0 : null\"\n [class]=\"passThrough().text?.class\"\n [style]=\"passThrough().text?.style\"\n [txTooltip]=\"tooltip()\"\n [tooltipPlacement]=\"tooltipPlacement()\"\n [tooltipInteractive]=\"true\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n </span>\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,aAAa;AAgBnB,IAAa,iBAAb,MAAa,eAAc;CACjB,WAAW,OAAO,QAAQ;CAC1B,QAA8C;CAE7C,OAAO,MAA0C,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACpD,QAAQ,MAAuB,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW;CAAe,CAAA;CAC/D,WAAW,MAAc,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,OAAO,MAAiC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAClD,WAAW,MAAwB,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACvE,SAAS,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,YAAY,MAAwB,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,WAAW,MAAwB,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACvE,mBAAmB,MAAmB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,KAAK,MAA+D,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CA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GAAA;IAAA,MAAA;IAAA,MAAE;IAAe,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAM,UAAA;IAAA,QAAA,CAAA,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAS,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,gBAAA,eAAA;IAAA,UAAA,CAAA,WAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAYnD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAd1B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAkB,SACnB;IAAC;IAAkB;IAAiB;IAAQ;GAAS;GAAC,iBAG9C,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,WAAW;IACX,WAAW;IACX,sBAAsB;IACtB,uCAAuC;GACxC;GAAA,UAAA;GAAA,QAAA,CAAA,guDAAA;EAAA,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ListInput
|
|
2
|
+
|
|
3
|
+
A textarea for pasting many values at once — domains, links, emails, ids. It parses the text as you type, counts the items, duplicates and lines it does not recognize, and offers "Clean up" (one item per line, without duplicates and invalid lines) and "Clear". The value is the parsed array, so send that to the server, not the raw text.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<tx-list-input type="domain" [formControl]="domains" />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Inputs
|
|
10
|
+
| Name | Description |
|
|
11
|
+
|---|---|
|
|
12
|
+
| text | Raw text of the field. Two-way: `[(text)]`. Setting it does not emit `itemsChange` |
|
|
13
|
+
| type | Built-in parser: `domain` (host of a domain or URL, lower case), `email`, `url` (adds a missing `https://`), `text` (any non-empty token) |
|
|
14
|
+
| parser | Own parser, a `TxListInputParser`: gets one token and returns the normalized item, or `null` when it is not recognized. Replaces `type` |
|
|
15
|
+
| splitByLines | Splits only by new lines, commas and semicolons, so a line with spaces stays one item. By default spaces split too |
|
|
16
|
+
| separator | Own separator as a `RegExp`; replaces `splitByLines` |
|
|
17
|
+
| placeholder | Placeholder; a translated one for the `type` by default |
|
|
18
|
+
| hint | Footer text while the field is empty; a translated one for the `type` by default |
|
|
19
|
+
| countLabel | Text of the items counter, with `{count}` and plural forms: `{count, plural, one {# id} other {# ids}}` |
|
|
20
|
+
| rows | Visible rows of the textarea |
|
|
21
|
+
| invalidLimit | How many unrecognized tokens are listed under the field before "+N more" |
|
|
22
|
+
| disabled | Disables the field and its actions (also from the form control) |
|
|
23
|
+
| readonly | The text cannot be changed; the actions are hidden |
|
|
24
|
+
| invalid | Error look; from the form control when not set |
|
|
25
|
+
| inputId | Id of the textarea, for a `<label for>` |
|
|
26
|
+
| ariaLabel | Accessible name of the textarea when there is no label |
|
|
27
|
+
| ariaLabelledBy | Id of the element that names the textarea |
|
|
28
|
+
| dt | Design tokens of this instance (`listInput`) |
|
|
29
|
+
| pt | Classes and styles of the parts: `root`, `field`, `footer`, `stats`, `actions`, `invalid` |
|
|
30
|
+
| ptOptions | How `pt` merges with the global pass-through |
|
|
31
|
+
| unstyled | Removes the tectra styles |
|
|
32
|
+
|
|
33
|
+
## Outputs
|
|
34
|
+
| Name | Description |
|
|
35
|
+
|---|---|
|
|
36
|
+
| itemsChange | The unique recognized items after every edit, "Clean up" and "Clear" |
|
|
37
|
+
| parsedChange | `{ items, invalid, duplicates }` after every edit, "Clean up" and "Clear" |
|
|
38
|
+
|
|
39
|
+
## Methods
|
|
40
|
+
| Name | Description |
|
|
41
|
+
|---|---|
|
|
42
|
+
| cleanUp | Rewrites the text to one recognized item per line, without duplicates |
|
|
43
|
+
| clear | Empties the text |
|
|
44
|
+
|
|
45
|
+
## Parsers
|
|
46
|
+
`txParseList(text, parser, separator)` parses a text without the component and returns `{ items, invalid, duplicates }`. The built-in parsers are exported too: `txParseDomain`, `txParseEmail`, `txParseUrl`, `txParseText` (all in `TX_LIST_INPUT_PARSERS`), with the separators `TX_LIST_INPUT_WORDS` and `TX_LIST_INPUT_LINES`.
|
|
47
|
+
|
|
48
|
+
## Keyboard
|
|
49
|
+
| Key | Action |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Tab | Moves from the field to "Clean up" and "Clear" |
|
|
52
|
+
| Enter / Space | On a button: runs its action and returns focus to the field |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tectra-ng/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Angular UI components on signals: table, datepicker, select, multiselect, dialog, drawer, toast, tooltip, tree and 80+ more. Standalone, OnPush, zoneless, accessible and themable, one entry point per component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://tectra-ng.com",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@angular/forms": "^22.0.0",
|
|
61
61
|
"@angular/router": "^22.0.0",
|
|
62
62
|
"rxjs": "^7.8.0",
|
|
63
|
-
"@tectra-ng/core": "^0.
|
|
64
|
-
"@tectra-ng/icons": "^0.
|
|
65
|
-
"@tectra-ng/themes": "^0.
|
|
63
|
+
"@tectra-ng/core": "^0.2.0",
|
|
64
|
+
"@tectra-ng/icons": "^0.2.0",
|
|
65
|
+
"@tectra-ng/themes": "^0.2.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"@angular/router": {
|
|
@@ -258,6 +258,10 @@
|
|
|
258
258
|
"types": "./types/tectra-ng-ui-link.d.ts",
|
|
259
259
|
"default": "./fesm2022/tectra-ng-ui-link.mjs"
|
|
260
260
|
},
|
|
261
|
+
"./list-input": {
|
|
262
|
+
"types": "./types/tectra-ng-ui-list-input.d.ts",
|
|
263
|
+
"default": "./fesm2022/tectra-ng-ui-list-input.mjs"
|
|
264
|
+
},
|
|
261
265
|
"./listbox": {
|
|
262
266
|
"types": "./types/tectra-ng-ui-listbox.d.ts",
|
|
263
267
|
"default": "./fesm2022/tectra-ng-ui-listbox.mjs"
|
|
@@ -430,6 +434,10 @@
|
|
|
430
434
|
"types": "./types/tectra-ng-ui-tree-table.d.ts",
|
|
431
435
|
"default": "./fesm2022/tectra-ng-ui-tree-table.mjs"
|
|
432
436
|
},
|
|
437
|
+
"./truncate-text": {
|
|
438
|
+
"types": "./types/tectra-ng-ui-truncate-text.d.ts",
|
|
439
|
+
"default": "./fesm2022/tectra-ng-ui-truncate-text.mjs"
|
|
440
|
+
},
|
|
433
441
|
"./virtual-scroller": {
|
|
434
442
|
"types": "./types/tectra-ng-ui-virtual-scroller.d.ts",
|
|
435
443
|
"default": "./fesm2022/tectra-ng-ui-virtual-scroller.mjs"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# TruncateText
|
|
2
|
+
|
|
3
|
+
One line of text cut to a number of characters, with the full value in a tooltip — for long URLs, ids and names in table cells. It can mark search matches, become a link and add a copy button. Screen readers always get the full text.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<tx-truncate-text [text]="link.url" [limit]="30" />
|
|
7
|
+
<tx-truncate-text [text]="domain.name" [href]="'https://' + domain.name" [highlight]="search()" copyable />
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Inputs
|
|
11
|
+
| Name | Description |
|
|
12
|
+
|---|---|
|
|
13
|
+
| text | The text; a number is shown as text |
|
|
14
|
+
| limit | How many characters are shown before the text is cut |
|
|
15
|
+
| ellipsis | What follows the cut text (`...` by default) |
|
|
16
|
+
| href | Makes the text a link to this address |
|
|
17
|
+
| openLink | Makes the text a link to itself — for a `text` that is a URL; `href` wins when both are set |
|
|
18
|
+
| target | Where the link opens (`_blank` by default, with `rel="noopener noreferrer"`) |
|
|
19
|
+
| highlight | Search terms to mark in the shown text |
|
|
20
|
+
| copyable | Adds a button before the text that copies the full text |
|
|
21
|
+
| tooltipPlacement | Side of the tooltips (`top` by default) |
|
|
22
|
+
| dt | Design tokens of this instance (`truncateText`) |
|
|
23
|
+
| pt | Classes and styles of the parts: `root`, `text`, `link`, `copy` |
|
|
24
|
+
| ptOptions | How `pt` merges with the global pass-through |
|
|
25
|
+
| unstyled | Removes the tectra styles |
|
|
26
|
+
|
|
27
|
+
## Outputs
|
|
28
|
+
| Name | Description |
|
|
29
|
+
|---|---|
|
|
30
|
+
| copied | The text was copied; gives the copied text |
|
|
31
|
+
|
|
32
|
+
## Keyboard
|
|
33
|
+
| Key | Action |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Tab | Reaches the copy button, then the link or the cut text, which shows the full text in its tooltip |
|
|
36
|
+
| Enter | Follows the link |
|
|
37
|
+
| Enter / Space | Copies from the copy button |
|
|
38
|
+
| Escape | Hides the tooltip |
|