@postnord/web-components
Version:
PostNord Web Components
42 lines (36 loc) • 2.7 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-ec4ed1cc.js');
const helpers = require('./helpers-2e2349b4.js');
const pnSegmentCss = "pn-segment{position:relative;color:#005d92;margin-right:0.5em;z-index:2;white-space:nowrap;scroll-snap-align:center;outline:none;-webkit-tap-highlight-color:transparent;transform:translateZ(0)}pn-segment:last-of-type{margin-right:0}pn-segment .pn-segment{cursor:pointer;margin:0;padding:0;opacity:0;position:absolute;top:0;left:0;width:100%;height:100%;-webkit-tap-highlight-color:transparent}pn-segment .pn-segment:disabled{cursor:not-allowed}pn-segment .pn-segment:disabled~.pn-segment-label{color:#5e554a}pn-segment .pn-segment:disabled~.pn-segment-label pn-icon .pn-icon-svg path{fill:#5e554a}pn-segment .pn-segment-label{height:100%;width:100%;padding:0.5em;border-radius:3em;font-weight:500;border:0.0625em solid transparent;display:inline-flex;gap:0.5em;align-items:center;-webkit-tap-highlight-color:transparent}";
const PnSegmentStyle0 = pnSegmentCss;
const PnSegment = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.segmentHover = index.createEvent(this, "segmentHover", 7);
this.label = undefined;
this.name = undefined;
this.value = undefined;
this.selected = false;
this.segmentid = this.id;
this.icon = undefined;
this.disabled = false;
}
id = `pn-segment-${helpers.uuidv4()}`;
get hostElement() { return index.getElement(this); }
/** This event is used by the `pn-segmented-control` component. Do not use manually. */
segmentHover;
handleHover(mouse) {
this.segmentHover.emit(mouse);
}
render() {
return (index.h(index.Host, { key: 'b325719082527754f09c013b3e01e8de7d5595e7', onMouseEnter: (event) => this.handleHover(event) }, index.h("input", { key: 'a077d547cf945c3d54d345bda5ead3fd7282b527', class: "pn-segment", id: this.segmentid, name: this.name, checked: this.selected, type: "radio", value: this.value, disabled: this.disabled }), index.h("label", { key: '334868268acf600c2dd1d15e585d3a98859dba44', htmlFor: this.segmentid, class: "pn-segment-label" }, this.icon && index.h("pn-icon", { key: 'bff15a1148753a1abc5eb9dfcee01026f8eabbb5', icon: this.icon, color: "blue700" }), index.h("span", { key: '3b6a60bee13d4f929ac463196b1b8492a2efccbc', class: "pn-segment-text" }, this.label, index.h("slot", { key: '266ffb928bcd8f1e66c771ccb5856032859c08e7' })))));
}
};
PnSegment.style = PnSegmentStyle0;
exports.pn_segment = PnSegment;
//# sourceMappingURL=pn-segment.cjs.entry.js.map