option-group.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.82
  5. */
  6. import { Component, h, Prop, Watch, Event, Fragment } from "@stencil/core";
  7. /**
  8. * @slot - A slot for adding `calcite-option`s.
  9. */
  10. export class OptionGroup {
  11. constructor() {
  12. //--------------------------------------------------------------------------
  13. //
  14. // Properties
  15. //
  16. //--------------------------------------------------------------------------
  17. /**
  18. * When true, it prevents selection from any of its associated options.
  19. */
  20. this.disabled = false;
  21. }
  22. handlePropChange() {
  23. this.calciteOptionGroupChange.emit();
  24. }
  25. //--------------------------------------------------------------------------
  26. //
  27. // Render Methods
  28. //
  29. //--------------------------------------------------------------------------
  30. render() {
  31. return (h(Fragment, null,
  32. h("div", null, this.label),
  33. h("slot", null)));
  34. }
  35. static get is() { return "calcite-option-group"; }
  36. static get encapsulation() { return "shadow"; }
  37. static get originalStyleUrls() { return {
  38. "$": ["option-group.scss"]
  39. }; }
  40. static get styleUrls() { return {
  41. "$": ["option-group.css"]
  42. }; }
  43. static get properties() { return {
  44. "disabled": {
  45. "type": "boolean",
  46. "mutable": false,
  47. "complexType": {
  48. "original": "boolean",
  49. "resolved": "boolean",
  50. "references": {}
  51. },
  52. "required": false,
  53. "optional": false,
  54. "docs": {
  55. "tags": [],
  56. "text": "When true, it prevents selection from any of its associated options."
  57. },
  58. "attribute": "disabled",
  59. "reflect": true,
  60. "defaultValue": "false"
  61. },
  62. "label": {
  63. "type": "string",
  64. "mutable": false,
  65. "complexType": {
  66. "original": "string",
  67. "resolved": "string",
  68. "references": {}
  69. },
  70. "required": true,
  71. "optional": false,
  72. "docs": {
  73. "tags": [],
  74. "text": "The group label. This property is required."
  75. },
  76. "attribute": "label",
  77. "reflect": false
  78. }
  79. }; }
  80. static get events() { return [{
  81. "method": "calciteOptionGroupChange",
  82. "name": "calciteOptionGroupChange",
  83. "bubbles": true,
  84. "cancelable": true,
  85. "composed": true,
  86. "docs": {
  87. "tags": [{
  88. "name": "internal",
  89. "text": undefined
  90. }],
  91. "text": ""
  92. },
  93. "complexType": {
  94. "original": "any",
  95. "resolved": "any",
  96. "references": {}
  97. }
  98. }]; }
  99. static get watchers() { return [{
  100. "propName": "disabled",
  101. "methodName": "handlePropChange"
  102. }, {
  103. "propName": "label",
  104. "methodName": "handlePropChange"
  105. }]; }
  106. }