a zip code crypto-currency system good for red ONLY

icon.js 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. (function (factory) {
  12. if (typeof module === "object" && typeof module.exports === "object") {
  13. var v = factory(require, exports);
  14. if (v !== undefined) module.exports = v;
  15. }
  16. else if (typeof define === "function" && define.amd) {
  17. define(["require", "exports", "@angular/core", "../../util/util", "../../config/config", "../ion"], factory);
  18. }
  19. })(function (require, exports) {
  20. "use strict";
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. var core_1 = require("@angular/core");
  23. var util_1 = require("../../util/util");
  24. var config_1 = require("../../config/config");
  25. var ion_1 = require("../ion");
  26. /**
  27. * @name Icon
  28. * @description
  29. * Icons can be used on their own, or inside of a number of Ionic components.
  30. * For a full list of available icons, check out the
  31. * [Ionicons docs](../../../../ionicons).
  32. *
  33. * One feature of Ionicons in Ionic is when icon names are set, the actual icon
  34. * which is rendered can change slightly depending on the mode the app is
  35. * running from. For example, by setting the icon name of `alarm`, on iOS the
  36. * icon will automatically apply `ios-alarm`, and on Material Design it will
  37. * automatically apply `md-alarm`. This allows the developer to write the
  38. * markup once while Ionic applies the appropriate icon based on the mode.
  39. *
  40. * @usage
  41. * ```html
  42. * <!-- automatically uses the correct "star" icon depending on the mode -->
  43. * <ion-icon name="star"></ion-icon>
  44. *
  45. * <!-- explicity set the icon for each mode -->
  46. * <ion-icon ios="ios-home" md="md-home"></ion-icon>
  47. *
  48. * <!-- always use the same icon, no matter what the mode -->
  49. * <ion-icon name="ios-clock"></ion-icon>
  50. * <ion-icon name="logo-twitter"></ion-icon>
  51. * ```
  52. *
  53. * @demo /docs/demos/src/icon/
  54. * @see {@link /docs/components#icons Icon Component Docs}
  55. *
  56. */
  57. var Icon = (function (_super) {
  58. __extends(Icon, _super);
  59. function Icon(config, elementRef, renderer) {
  60. var _this = _super.call(this, config, elementRef, renderer, 'icon') || this;
  61. /** @hidden */
  62. _this._isActive = true;
  63. /** @hidden */
  64. _this._name = '';
  65. /** @hidden */
  66. _this._ios = '';
  67. /** @hidden */
  68. _this._md = '';
  69. /** @hidden */
  70. _this._css = '';
  71. /**
  72. * @hidden
  73. */
  74. _this._hidden = false;
  75. _this._iconMode = config.get('iconMode');
  76. return _this;
  77. }
  78. /**
  79. * @hidden
  80. */
  81. Icon.prototype.ngOnDestroy = function () {
  82. if (this._css) {
  83. this.setElementClass(this._css, false);
  84. }
  85. };
  86. Object.defineProperty(Icon.prototype, "name", {
  87. /**
  88. * @input {string} Specifies which icon to use. The appropriate icon will be used based on the mode.
  89. * For more information, see [Ionicons](/docs/ionicons/).
  90. */
  91. get: function () {
  92. return this._name;
  93. },
  94. set: function (val) {
  95. if (!(/^md-|^ios-|^logo-/.test(val))) {
  96. // this does not have one of the defaults
  97. // so lets auto add in the mode prefix for them
  98. this._name = this._iconMode + '-' + val;
  99. }
  100. else {
  101. this._name = val;
  102. }
  103. this.update();
  104. },
  105. enumerable: true,
  106. configurable: true
  107. });
  108. Object.defineProperty(Icon.prototype, "ios", {
  109. /**
  110. * @input {string} Specifies which icon to use on `ios` mode.
  111. */
  112. get: function () {
  113. return this._ios;
  114. },
  115. set: function (val) {
  116. this._ios = val;
  117. this.update();
  118. },
  119. enumerable: true,
  120. configurable: true
  121. });
  122. Object.defineProperty(Icon.prototype, "md", {
  123. /**
  124. * @input {string} Specifies which icon to use on `md` mode.
  125. */
  126. get: function () {
  127. return this._md;
  128. },
  129. set: function (val) {
  130. this._md = val;
  131. this.update();
  132. },
  133. enumerable: true,
  134. configurable: true
  135. });
  136. Object.defineProperty(Icon.prototype, "isActive", {
  137. /**
  138. * @input {boolean} If true, the icon is styled with an "active" appearance.
  139. * An active icon is filled in, and an inactive icon is the outline of the icon.
  140. * The `isActive` property is largely used by the tabbar. Only affects `ios` icons.
  141. */
  142. get: function () {
  143. return this._isActive;
  144. },
  145. set: function (val) {
  146. this._isActive = util_1.isTrueProperty(val);
  147. this.update();
  148. },
  149. enumerable: true,
  150. configurable: true
  151. });
  152. /**
  153. * @hidden
  154. */
  155. Icon.prototype.update = function () {
  156. var iconName;
  157. if (this._ios && this._iconMode === 'ios') {
  158. iconName = this._ios;
  159. }
  160. else if (this._md && this._iconMode === 'md') {
  161. iconName = this._md;
  162. }
  163. else {
  164. iconName = this._name;
  165. }
  166. var hidden = this._hidden = (iconName === null);
  167. if (hidden) {
  168. return;
  169. }
  170. var iconMode = iconName.split('-', 2)[0];
  171. if (iconMode === 'ios' &&
  172. !this._isActive &&
  173. iconName.indexOf('logo-') < 0 &&
  174. iconName.indexOf('-outline') < 0) {
  175. iconName += '-outline';
  176. }
  177. var css = 'ion-' + iconName;
  178. if (this._css === css) {
  179. return;
  180. }
  181. if (this._css) {
  182. this.setElementClass(this._css, false);
  183. }
  184. this._css = css;
  185. this.setElementClass(css, true);
  186. var label = iconName
  187. .replace('ios-', '')
  188. .replace('md-', '')
  189. .replace('-', ' ');
  190. this.setElementAttribute('aria-label', label);
  191. };
  192. Icon.decorators = [
  193. { type: core_1.Directive, args: [{
  194. selector: 'ion-icon',
  195. host: {
  196. 'role': 'img'
  197. }
  198. },] },
  199. ];
  200. /** @nocollapse */
  201. Icon.ctorParameters = function () { return [
  202. { type: config_1.Config, },
  203. { type: core_1.ElementRef, },
  204. { type: core_1.Renderer, },
  205. ]; };
  206. Icon.propDecorators = {
  207. 'name': [{ type: core_1.Input },],
  208. 'ios': [{ type: core_1.Input },],
  209. 'md': [{ type: core_1.Input },],
  210. 'isActive': [{ type: core_1.Input },],
  211. '_hidden': [{ type: core_1.HostBinding, args: ['class.hide',] },],
  212. };
  213. return Icon;
  214. }(ion_1.Ion));
  215. exports.Icon = Icon;
  216. });
  217. //# sourceMappingURL=icon.js.map