@scania/tegel
Version:
Tegel Design System
79 lines (75 loc) • 3.6 kB
JavaScript
import { p as proxyCustomElement, H, h, c as Host } from './p-28ef5186.js';
import { i as inheritAttributes } from './p-3fe9cbbf.js';
import { d as defineCustomElement$1 } from './p-d3866be7.js';
const popoverCanvasCss = ".tds-popover-canvas.sc-tds-popover-canvas{box-sizing:border-box;display:inline-block;color:var(--tds-popover-canvas-color);background-color:var(--tds-popover-canvas-background);box-shadow:0 3px 3px rgba(0, 0, 0, 0.15), 0 -1px 1px rgba(0, 0, 0, 0.1);border-radius:4px;z-index:900}.tds-popover-canvas.sc-tds-popover-canvas *.sc-tds-popover-canvas{box-sizing:border-box}";
const TdsPopoverCanvasStyle0 = popoverCanvasCss;
const TdsPopoverCanvas = /*@__PURE__*/ proxyCustomElement(class TdsPopoverCanvas extends H {
constructor() {
super();
this.__registerHost();
this.inheritedAttributes = [];
this.selector = undefined;
this.referenceEl = undefined;
this.defaultShow = false;
this.show = null;
this.placement = 'auto';
this.offsetSkidding = 0;
this.animation = 'none';
this.offsetDistance = 8;
this.modifiers = [];
this.tdsAlertDialog = 'dialog';
this.childRef = undefined;
}
/** Property for closing popover programmatically */
async close() {
var _a;
(_a = this.childRef) === null || _a === void 0 ? void 0 : _a.close();
}
componentWillLoad() {
this.inheritedAttributes = inheritAttributes(this.host, ['style', 'class']);
}
render() {
var _a;
return (h(Host, { key: '58db11b606cb1211fc569e0868a602ed935b46fa' }, h("tds-popover-core", Object.assign({ key: 'be884f4ea53cbb76e2c07cd87fba10c66cb18618', role: this.tdsAlertDialog }, this.inheritedAttributes, { class: {
'tds-popover-canvas': true,
[(_a = this.inheritedAttributes.class) !== null && _a !== void 0 ? _a : '']: true,
}, selector: this.selector, referenceEl: this.referenceEl, show: this.show, placement: this.placement, offsetSkidding: this.offsetSkidding, offsetDistance: this.offsetDistance, modifiers: this.modifiers, trigger: 'click', ref: (el) => {
this.childRef = el;
}, defaultShow: this.defaultShow, animation: this.animation }), h("div", { key: 'b7436bdce7bb19745ac25dfc5a9db16f308db41c' }, h("slot", { key: '6436d57046cde0d03359899690be4af1b17fe506' })))));
}
get host() { return this; }
static get style() { return TdsPopoverCanvasStyle0; }
}, [6, "tds-popover-canvas", {
"selector": [1],
"referenceEl": [16],
"defaultShow": [4, "default-show"],
"show": [4],
"placement": [1],
"offsetSkidding": [2, "offset-skidding"],
"animation": [1],
"offsetDistance": [2, "offset-distance"],
"modifiers": [16],
"tdsAlertDialog": [1, "tds-alert-dialog"],
"childRef": [32],
"close": [64]
}]);
function defineCustomElement() {
if (typeof customElements === "undefined") {
return;
}
const components = ["tds-popover-canvas", "tds-popover-core"];
components.forEach(tagName => { switch (tagName) {
case "tds-popover-canvas":
if (!customElements.get(tagName)) {
customElements.define(tagName, TdsPopoverCanvas);
}
break;
case "tds-popover-core":
if (!customElements.get(tagName)) {
defineCustomElement$1();
}
break;
} });
}
defineCustomElement();
export { TdsPopoverCanvas as T, defineCustomElement as d };