398 lines
33 KiB
JavaScript
398 lines
33 KiB
JavaScript
|
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[6],{
|
||
|
|
||
|
/***/ "./node_modules/@ionic/core/dist/esm/ion-button_2.entry.js":
|
||
|
/*!*****************************************************************!*\
|
||
|
!*** ./node_modules/@ionic/core/dist/esm/ion-button_2.entry.js ***!
|
||
|
\*****************************************************************/
|
||
|
/*! exports provided: ion_button, ion_icon */
|
||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
|
||
|
"use strict";
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ion_button", function() { return Button; });
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ion_icon", function() { return Icon; });
|
||
|
/* harmony import */ var _index_92848855_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-92848855.js */ "./node_modules/@ionic/core/dist/esm/index-92848855.js");
|
||
|
/* harmony import */ var _ionic_global_23e7365a_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ionic-global-23e7365a.js */ "./node_modules/@ionic/core/dist/esm/ionic-global-23e7365a.js");
|
||
|
/* harmony import */ var _helpers_5c745fbd_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers-5c745fbd.js */ "./node_modules/@ionic/core/dist/esm/helpers-5c745fbd.js");
|
||
|
/* harmony import */ var _theme_5641d27f_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-5641d27f.js */ "./node_modules/@ionic/core/dist/esm/theme-5641d27f.js");
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
let CACHED_MAP;
|
||
|
const getIconMap = () => {
|
||
|
if (typeof window === 'undefined') {
|
||
|
return new Map();
|
||
|
}
|
||
|
else {
|
||
|
if (!CACHED_MAP) {
|
||
|
const win = window;
|
||
|
win.Ionicons = win.Ionicons || {};
|
||
|
CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
|
||
|
}
|
||
|
return CACHED_MAP;
|
||
|
}
|
||
|
};
|
||
|
const getUrl = (i) => {
|
||
|
let url = getSrc(i.src);
|
||
|
if (url) {
|
||
|
return url;
|
||
|
}
|
||
|
url = getName(i.name, i.icon, i.mode, i.ios, i.md);
|
||
|
if (url) {
|
||
|
return getNamedUrl(url);
|
||
|
}
|
||
|
if (i.icon) {
|
||
|
url = getSrc(i.icon);
|
||
|
if (url) {
|
||
|
return url;
|
||
|
}
|
||
|
url = getSrc(i.icon[i.mode]);
|
||
|
if (url) {
|
||
|
return url;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
};
|
||
|
const getNamedUrl = (iconName) => {
|
||
|
const url = getIconMap().get(iconName);
|
||
|
if (url) {
|
||
|
return url;
|
||
|
}
|
||
|
return Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["k"])(`svg/${iconName}.svg`);
|
||
|
};
|
||
|
const getName = (iconName, icon, mode, ios, md) => {
|
||
|
// default to "md" if somehow the mode wasn't set
|
||
|
mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
|
||
|
// if an icon was passed in using the ios or md attributes
|
||
|
// set the iconName to whatever was passed in
|
||
|
if (ios && mode === 'ios') {
|
||
|
iconName = toLower(ios);
|
||
|
}
|
||
|
else if (md && mode === 'md') {
|
||
|
iconName = toLower(md);
|
||
|
}
|
||
|
else {
|
||
|
if (!iconName && icon && !isSrc(icon)) {
|
||
|
iconName = icon;
|
||
|
}
|
||
|
if (isStr(iconName)) {
|
||
|
iconName = toLower(iconName);
|
||
|
}
|
||
|
}
|
||
|
if (!isStr(iconName) || iconName.trim() === '') {
|
||
|
return null;
|
||
|
}
|
||
|
// only allow alpha characters and dash
|
||
|
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
||
|
if (invalidChars !== '') {
|
||
|
return null;
|
||
|
}
|
||
|
return iconName;
|
||
|
};
|
||
|
const getSrc = (src) => {
|
||
|
if (isStr(src)) {
|
||
|
src = src.trim();
|
||
|
if (isSrc(src)) {
|
||
|
return src;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
};
|
||
|
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
||
|
const isStr = (val) => typeof val === 'string';
|
||
|
const toLower = (val) => val.toLowerCase();
|
||
|
|
||
|
const buttonIosCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;-webkit-font-kerning:none;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect
|
||
|
|
||
|
const buttonMdCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;-webkit-font-kerning:none;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{
|
||
|
|
||
|
const Button = class {
|
||
|
constructor(hostRef) {
|
||
|
Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
||
|
this.ionFocus = Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["e"])(this, "ionFocus", 7);
|
||
|
this.ionBlur = Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["e"])(this, "ionBlur", 7);
|
||
|
this.inItem = false;
|
||
|
this.inListHeader = false;
|
||
|
this.inToolbar = false;
|
||
|
/**
|
||
|
* The type of button.
|
||
|
*/
|
||
|
this.buttonType = 'button';
|
||
|
/**
|
||
|
* If `true`, the user cannot interact with the button.
|
||
|
*/
|
||
|
this.disabled = false;
|
||
|
/**
|
||
|
* When using a router, it specifies the transition direction when navigating to
|
||
|
* another page using `href`.
|
||
|
*/
|
||
|
this.routerDirection = 'forward';
|
||
|
/**
|
||
|
* If `true`, activates a button with a heavier font weight.
|
||
|
*/
|
||
|
this.strong = false;
|
||
|
/**
|
||
|
* The type of the button.
|
||
|
*/
|
||
|
this.type = 'button';
|
||
|
this.handleClick = (ev) => {
|
||
|
if (this.type === 'button') {
|
||
|
Object(_theme_5641d27f_js__WEBPACK_IMPORTED_MODULE_3__["o"])(this.href, ev, this.routerDirection, this.routerAnimation);
|
||
|
}
|
||
|
else if (Object(_helpers_5c745fbd_js__WEBPACK_IMPORTED_MODULE_2__["h"])(this.el)) {
|
||
|
// this button wants to specifically submit a form
|
||
|
// climb up the dom to see if we're in a <form>
|
||
|
// and if so, then use JS to submit it
|
||
|
const form = this.el.closest('form');
|
||
|
if (form) {
|
||
|
ev.preventDefault();
|
||
|
const fakeButton = document.createElement('button');
|
||
|
fakeButton.type = this.type;
|
||
|
fakeButton.style.display = 'none';
|
||
|
form.appendChild(fakeButton);
|
||
|
fakeButton.click();
|
||
|
fakeButton.remove();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
this.onFocus = () => {
|
||
|
this.ionFocus.emit();
|
||
|
};
|
||
|
this.onBlur = () => {
|
||
|
this.ionBlur.emit();
|
||
|
};
|
||
|
}
|
||
|
componentWillLoad() {
|
||
|
this.inToolbar = !!this.el.closest('ion-buttons');
|
||
|
this.inListHeader = !!this.el.closest('ion-list-header');
|
||
|
this.inItem = !!this.el.closest('ion-item') || !!this.el.closest('ion-item-divider');
|
||
|
}
|
||
|
get hasIconOnly() {
|
||
|
return !!this.el.querySelector('ion-icon[slot="icon-only"]');
|
||
|
}
|
||
|
get rippleType() {
|
||
|
const hasClearFill = this.fill === undefined || this.fill === 'clear';
|
||
|
// If the button is in a toolbar, has a clear fill (which is the default)
|
||
|
// and only has an icon we use the unbounded "circular" ripple effect
|
||
|
if (hasClearFill && this.hasIconOnly && this.inToolbar) {
|
||
|
return 'unbounded';
|
||
|
}
|
||
|
return 'bounded';
|
||
|
}
|
||
|
render() {
|
||
|
const mode = Object(_ionic_global_23e7365a_js__WEBPACK_IMPORTED_MODULE_1__["b"])(this);
|
||
|
const { buttonType, type, disabled, rel, target, size, href, color, expand, hasIconOnly, shape, strong } = this;
|
||
|
const finalSize = size === undefined && this.inItem ? 'small' : size;
|
||
|
const TagType = href === undefined ? 'button' : 'a';
|
||
|
const attrs = (TagType === 'button')
|
||
|
? { type }
|
||
|
: {
|
||
|
download: this.download,
|
||
|
href,
|
||
|
rel,
|
||
|
target
|
||
|
};
|
||
|
let fill = this.fill;
|
||
|
if (fill === undefined) {
|
||
|
fill = this.inToolbar || this.inListHeader ? 'clear' : 'solid';
|
||
|
}
|
||
|
return (Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["H"], { onClick: this.handleClick, "aria-disabled": disabled ? 'true' : null, class: Object(_theme_5641d27f_js__WEBPACK_IMPORTED_MODULE_3__["c"])(color, {
|
||
|
[mode]: true,
|
||
|
[buttonType]: true,
|
||
|
[`${buttonType}-${expand}`]: expand !== undefined,
|
||
|
[`${buttonType}-${finalSize}`]: finalSize !== undefined,
|
||
|
[`${buttonType}-${shape}`]: shape !== undefined,
|
||
|
[`${buttonType}-${fill}`]: true,
|
||
|
[`${buttonType}-strong`]: strong,
|
||
|
'in-toolbar': Object(_theme_5641d27f_js__WEBPACK_IMPORTED_MODULE_3__["h"])('ion-toolbar', this.el),
|
||
|
'in-toolbar-color': Object(_theme_5641d27f_js__WEBPACK_IMPORTED_MODULE_3__["h"])('ion-toolbar[color]', this.el),
|
||
|
'button-has-icon-only': hasIconOnly,
|
||
|
'button-disabled': disabled,
|
||
|
'ion-activatable': true,
|
||
|
'ion-focusable': true,
|
||
|
}) }, Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])(TagType, Object.assign({}, attrs, { class: "button-native", part: "native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur }), Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", { class: "button-inner" }, Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", { name: "icon-only" }), Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", { name: "start" }), Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", null), Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", { name: "end" })), mode === 'md' && Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("ion-ripple-effect", { type: this.rippleType }))));
|
||
|
}
|
||
|
get el() { return Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["i"])(this); }
|
||
|
};
|
||
|
Button.style = {
|
||
|
ios: buttonIosCss,
|
||
|
md: buttonMdCss
|
||
|
};
|
||
|
|
||
|
const validateContent = (svgContent) => {
|
||
|
if (svgContent && typeof document !== 'undefined') {
|
||
|
const div = document.createElement('div');
|
||
|
div.innerHTML = svgContent;
|
||
|
// setup this way to ensure it works on our buddy IE
|
||
|
for (let i = div.childNodes.length - 1; i >= 0; i--) {
|
||
|
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
|
||
|
div.removeChild(div.childNodes[i]);
|
||
|
}
|
||
|
}
|
||
|
// must only have 1 root element
|
||
|
const svgElm = div.firstElementChild;
|
||
|
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
|
||
|
const svgClass = svgElm.getAttribute('class') || '';
|
||
|
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
|
||
|
// root element must be an svg
|
||
|
// lets double check we've got valid elements
|
||
|
// do not allow scripts
|
||
|
if (isValid(svgElm)) {
|
||
|
return div.innerHTML;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return '';
|
||
|
};
|
||
|
const isValid = (elm) => {
|
||
|
if (elm.nodeType === 1) {
|
||
|
if (elm.nodeName.toLowerCase() === 'script') {
|
||
|
return false;
|
||
|
}
|
||
|
for (let i = 0; i < elm.attributes.length; i++) {
|
||
|
const val = elm.attributes[i].value;
|
||
|
if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
for (let i = 0; i < elm.childNodes.length; i++) {
|
||
|
if (!isValid(elm.childNodes[i])) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
};
|
||
|
|
||
|
const ioniconContent = new Map();
|
||
|
const requests = new Map();
|
||
|
const getSvgContent = (url) => {
|
||
|
// see if we already have a request for this url
|
||
|
let req = requests.get(url);
|
||
|
if (!req) {
|
||
|
if (typeof fetch !== 'undefined') {
|
||
|
// we don't already have a request
|
||
|
req = fetch(url).then(rsp => {
|
||
|
if (rsp.ok) {
|
||
|
return rsp.text().then(svgContent => {
|
||
|
ioniconContent.set(url, validateContent(svgContent));
|
||
|
});
|
||
|
}
|
||
|
ioniconContent.set(url, '');
|
||
|
});
|
||
|
// cache for the same requests
|
||
|
requests.set(url, req);
|
||
|
}
|
||
|
else {
|
||
|
// set to empty for ssr scenarios and resolve promise
|
||
|
ioniconContent.set(url, '');
|
||
|
return Promise.resolve();
|
||
|
}
|
||
|
}
|
||
|
return req;
|
||
|
};
|
||
|
|
||
|
const iconCss = ":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";
|
||
|
|
||
|
const Icon = class {
|
||
|
constructor(hostRef) {
|
||
|
Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
||
|
this.isVisible = false;
|
||
|
/**
|
||
|
* The mode determines which platform styles to use.
|
||
|
*/
|
||
|
this.mode = getIonMode();
|
||
|
/**
|
||
|
* If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
|
||
|
* Default, `false`.
|
||
|
*/
|
||
|
this.lazy = false;
|
||
|
}
|
||
|
connectedCallback() {
|
||
|
// purposely do not return the promise here because loading
|
||
|
// the svg file should not hold up loading the app
|
||
|
// only load the svg if it's visible
|
||
|
this.waitUntilVisible(this.el, '50px', () => {
|
||
|
this.isVisible = true;
|
||
|
this.loadIcon();
|
||
|
});
|
||
|
}
|
||
|
disconnectedCallback() {
|
||
|
if (this.io) {
|
||
|
this.io.disconnect();
|
||
|
this.io = undefined;
|
||
|
}
|
||
|
}
|
||
|
waitUntilVisible(el, rootMargin, cb) {
|
||
|
if ( this.lazy && typeof window !== 'undefined' && window.IntersectionObserver) {
|
||
|
const io = this.io = new window.IntersectionObserver((data) => {
|
||
|
if (data[0].isIntersecting) {
|
||
|
io.disconnect();
|
||
|
this.io = undefined;
|
||
|
cb();
|
||
|
}
|
||
|
}, { rootMargin });
|
||
|
io.observe(el);
|
||
|
}
|
||
|
else {
|
||
|
// browser doesn't support IntersectionObserver
|
||
|
// so just fallback to always show it
|
||
|
cb();
|
||
|
}
|
||
|
}
|
||
|
loadIcon() {
|
||
|
if ( this.isVisible) {
|
||
|
const url = getUrl(this);
|
||
|
if (url) {
|
||
|
if (ioniconContent.has(url)) {
|
||
|
// sync if it's already loaded
|
||
|
this.svgContent = ioniconContent.get(url);
|
||
|
}
|
||
|
else {
|
||
|
// async if it hasn't been loaded
|
||
|
getSvgContent(url).then(() => this.svgContent = ioniconContent.get(url));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (!this.ariaLabel) {
|
||
|
const label = getName(this.name, this.icon, this.mode, this.ios, this.md);
|
||
|
// user did not provide a label
|
||
|
// come up with the label based on the icon name
|
||
|
if (label) {
|
||
|
this.ariaLabel = label.replace(/\-/g, ' ');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
render() {
|
||
|
const mode = this.mode || 'md';
|
||
|
const flipRtl = this.flipRtl || (this.ariaLabel && (this.ariaLabel.indexOf('arrow') > -1 || this.ariaLabel.indexOf('chevron') > -1) && this.flipRtl !== false);
|
||
|
return (Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["H"], { role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': !!flipRtl && this.el.ownerDocument.dir === 'rtl' }) }, (( this.svgContent)
|
||
|
? Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", { class: "icon-inner", innerHTML: this.svgContent })
|
||
|
: Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", { class: "icon-inner" }))));
|
||
|
}
|
||
|
static get assetsDirs() { return ["svg"]; }
|
||
|
get el() { return Object(_index_92848855_js__WEBPACK_IMPORTED_MODULE_0__["i"])(this); }
|
||
|
static get watchers() { return {
|
||
|
"name": ["loadIcon"],
|
||
|
"src": ["loadIcon"],
|
||
|
"icon": ["loadIcon"]
|
||
|
}; }
|
||
|
};
|
||
|
const getIonMode = () => ( typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
|
||
|
const createColorClasses = (color) => {
|
||
|
return (color) ? {
|
||
|
'ion-color': true,
|
||
|
[`ion-color-${color}`]: true
|
||
|
} : null;
|
||
|
};
|
||
|
Icon.style = iconCss;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
}]);
|
||
|
//# sourceMappingURL=6-es2015.js.map
|