@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
104 lines (103 loc) • 2.92 kB
JavaScript
import { Component, Host, Prop, h } from "@stencil/core";
import { CSS, TEXT } from "./resources";
/**
* @slot - Default slot for content.
*/
export class CalciteScrim {
constructor() {
// --------------------------------------------------------------------------
//
// Properties
//
// --------------------------------------------------------------------------
/** string to override English loading text */
this.intlLoading = TEXT.loading;
/**
* Determines if the component will have the loader overlay.
* Otherwise, will render opaque disabled state.
*/
this.loading = false;
}
// --------------------------------------------------------------------------
//
// Render Method
//
// --------------------------------------------------------------------------
render() {
const loaderNode = this.loading ? h("calcite-loader", { active: true, label: this.intlLoading }) : null;
const scrimNode = h("div", { class: CSS.scrim }, loaderNode);
const contentNode = (h("div", { class: CSS.content },
h("slot", null)));
return (h(Host, null,
scrimNode,
contentNode));
}
static get is() { return "calcite-scrim"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"$": ["calcite-scrim.scss"]
}; }
static get styleUrls() { return {
"$": ["calcite-scrim.css"]
}; }
static get properties() { return {
"intlLoading": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "string to override English loading text"
},
"attribute": "intl-loading",
"reflect": false,
"defaultValue": "TEXT.loading"
},
"loading": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Determines if the component will have the loader overlay.\nOtherwise, will render opaque disabled state."
},
"attribute": "loading",
"reflect": true,
"defaultValue": "false"
},
"theme": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Theme",
"resolved": "\"dark\" | \"light\"",
"references": {
"Theme": {
"location": "import",
"path": "../interfaces"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "specify the theme of scrim, defaults to light"
},
"attribute": "theme",
"reflect": true
}
}; }
}