@ctrliq/quantic-components 1.63.6 → 1.64.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/quantic-components.js +120 -0
- package/dist/quantic-components.js.map +1 -1
- package/dist/quantic-components.min.js +39 -1
- package/dist/quantic-components.min.js.map +1 -1
- package/dist/truncate/index.d.ts +19 -0
- package/dist/truncate/index.js +134 -0
- package/dist/truncate/index.stories.d.ts +24 -0
- package/dist/truncate/index.stories.js +26 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/truncate/index.d.ts +19 -0
- package/dist/types/truncate/index.stories.d.ts +24 -0
- package/package.json +1 -1
|
@@ -69092,6 +69092,125 @@
|
|
|
69092
69092
|
quanticElement('quantic-toast')
|
|
69093
69093
|
], exports.Toast);
|
|
69094
69094
|
|
|
69095
|
+
exports.Tooltip.ensureDefined();
|
|
69096
|
+
exports.Truncate = class Truncate extends QuanticElement {
|
|
69097
|
+
constructor() {
|
|
69098
|
+
super(...arguments);
|
|
69099
|
+
this.value = '';
|
|
69100
|
+
this.maxLines = 1;
|
|
69101
|
+
this.placement = TooltipPlacement.Top;
|
|
69102
|
+
this.isTruncated = false;
|
|
69103
|
+
}
|
|
69104
|
+
firstUpdated() {
|
|
69105
|
+
this.observer = new ResizeObserver(() => this.checkTruncation());
|
|
69106
|
+
this.observer.observe(this);
|
|
69107
|
+
this.checkTruncation();
|
|
69108
|
+
}
|
|
69109
|
+
updated(changed) {
|
|
69110
|
+
if (changed.has('maxLines') || changed.has('value')) {
|
|
69111
|
+
this.checkTruncation();
|
|
69112
|
+
}
|
|
69113
|
+
}
|
|
69114
|
+
disconnectedCallback() {
|
|
69115
|
+
super.disconnectedCallback();
|
|
69116
|
+
this.observer?.disconnect();
|
|
69117
|
+
}
|
|
69118
|
+
checkTruncation() {
|
|
69119
|
+
if (!this.textEl)
|
|
69120
|
+
return;
|
|
69121
|
+
const isTruncated = this.maxLines > 1
|
|
69122
|
+
? this.textEl.scrollHeight > this.textEl.clientHeight
|
|
69123
|
+
: this.textEl.scrollWidth > this.textEl.clientWidth;
|
|
69124
|
+
if (isTruncated !== this.isTruncated) {
|
|
69125
|
+
this.isTruncated = isTruncated;
|
|
69126
|
+
}
|
|
69127
|
+
}
|
|
69128
|
+
render() {
|
|
69129
|
+
const text = x `
|
|
69130
|
+
<div
|
|
69131
|
+
class=${e$3({ text: true, 'text--multiline': this.maxLines > 1 })}
|
|
69132
|
+
style=${o({ '--truncate-max-lines': String(this.maxLines) })}
|
|
69133
|
+
tabindex=${this.isTruncated ? '0' : E}
|
|
69134
|
+
>
|
|
69135
|
+
${this.value}
|
|
69136
|
+
</div>
|
|
69137
|
+
`;
|
|
69138
|
+
return this.isTruncated
|
|
69139
|
+
? x `
|
|
69140
|
+
<quantic-tooltip placement=${this.placement}>
|
|
69141
|
+
${text}
|
|
69142
|
+
<span slot="content">${this.value}</span>
|
|
69143
|
+
</quantic-tooltip>
|
|
69144
|
+
`
|
|
69145
|
+
: text;
|
|
69146
|
+
}
|
|
69147
|
+
};
|
|
69148
|
+
exports.Truncate.meta = {
|
|
69149
|
+
tag: 'quantic-truncate',
|
|
69150
|
+
description: 'Renders text with ellipsis overflow. ' +
|
|
69151
|
+
'A tooltip revealing the full value appears on hover or keyboard focus when the text is actually truncated.',
|
|
69152
|
+
category: 'display',
|
|
69153
|
+
relatedTo: ['quantic-tooltip'],
|
|
69154
|
+
};
|
|
69155
|
+
exports.Truncate.styles = i$6 `
|
|
69156
|
+
:host {
|
|
69157
|
+
display: block;
|
|
69158
|
+
min-width: 0;
|
|
69159
|
+
}
|
|
69160
|
+
|
|
69161
|
+
quantic-tooltip {
|
|
69162
|
+
display: block;
|
|
69163
|
+
min-width: 0;
|
|
69164
|
+
}
|
|
69165
|
+
|
|
69166
|
+
.text {
|
|
69167
|
+
overflow: hidden;
|
|
69168
|
+
text-overflow: ellipsis;
|
|
69169
|
+
white-space: nowrap;
|
|
69170
|
+
min-width: 0;
|
|
69171
|
+
}
|
|
69172
|
+
|
|
69173
|
+
.text--multiline {
|
|
69174
|
+
display: -webkit-box;
|
|
69175
|
+
-webkit-box-orient: vertical;
|
|
69176
|
+
-webkit-line-clamp: var(--truncate-max-lines);
|
|
69177
|
+
line-clamp: var(--truncate-max-lines);
|
|
69178
|
+
white-space: normal;
|
|
69179
|
+
}
|
|
69180
|
+
`;
|
|
69181
|
+
__decorate([
|
|
69182
|
+
prop({
|
|
69183
|
+
type: 'string',
|
|
69184
|
+
default: '',
|
|
69185
|
+
description: 'Text to display and show in the tooltip when truncated.',
|
|
69186
|
+
})
|
|
69187
|
+
], exports.Truncate.prototype, "value", void 0);
|
|
69188
|
+
__decorate([
|
|
69189
|
+
prop({
|
|
69190
|
+
type: 'number',
|
|
69191
|
+
attribute: 'max-lines',
|
|
69192
|
+
default: '1',
|
|
69193
|
+
description: 'Maximum number of visible lines before truncating. Defaults to 1 (single-line).',
|
|
69194
|
+
})
|
|
69195
|
+
], exports.Truncate.prototype, "maxLines", void 0);
|
|
69196
|
+
__decorate([
|
|
69197
|
+
prop({
|
|
69198
|
+
type: 'TooltipPlacement',
|
|
69199
|
+
options: Object.values(TooltipPlacement),
|
|
69200
|
+
default: TooltipPlacement.Top,
|
|
69201
|
+
description: 'Preferred tooltip placement relative to the text.',
|
|
69202
|
+
})
|
|
69203
|
+
], exports.Truncate.prototype, "placement", void 0);
|
|
69204
|
+
__decorate([
|
|
69205
|
+
e$5('.text')
|
|
69206
|
+
], exports.Truncate.prototype, "textEl", void 0);
|
|
69207
|
+
__decorate([
|
|
69208
|
+
r$2()
|
|
69209
|
+
], exports.Truncate.prototype, "isTruncated", void 0);
|
|
69210
|
+
exports.Truncate = __decorate([
|
|
69211
|
+
quanticElement('quantic-truncate')
|
|
69212
|
+
], exports.Truncate);
|
|
69213
|
+
|
|
69095
69214
|
exports.AlertType = AlertType;
|
|
69096
69215
|
exports.BadgeColor = BadgeColor;
|
|
69097
69216
|
exports.BadgeSize = BadgeSize;
|
|
@@ -69148,6 +69267,7 @@
|
|
|
69148
69267
|
exports.TextareaSize = TextareaSize;
|
|
69149
69268
|
exports.ToastType = ToastType;
|
|
69150
69269
|
exports.ToggleSize = ToggleSize;
|
|
69270
|
+
exports.TooltipPlacement = TooltipPlacement;
|
|
69151
69271
|
exports.icons = icons;
|
|
69152
69272
|
exports.quanticElement = quanticElement;
|
|
69153
69273
|
exports.tableVariantContext = tableVariantContext;
|