@govbr-ds/webcomponents 2.0.0-next.13 → 2.0.0-next.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/cjs/br-avatar.cjs.entry.js +6 -6
  2. package/dist/cjs/br-avatar.cjs.entry.js.map +1 -1
  3. package/dist/cjs/br-button_2.cjs.entry.js +20 -21
  4. package/dist/cjs/br-button_2.cjs.entry.js.map +1 -1
  5. package/dist/cjs/br-checkbox.cjs.entry.js +9 -8
  6. package/dist/cjs/br-checkbox.cjs.entry.js.map +1 -1
  7. package/dist/cjs/br-dropdown.cjs.entry.js +142 -0
  8. package/dist/cjs/br-dropdown.cjs.entry.js.map +1 -0
  9. package/dist/cjs/br-input.cjs.entry.js +13 -12
  10. package/dist/cjs/br-input.cjs.entry.js.map +1 -1
  11. package/dist/cjs/br-item.cjs.entry.js +24 -24
  12. package/dist/cjs/br-item.cjs.entry.js.map +1 -1
  13. package/dist/cjs/br-list.cjs.entry.js +8 -7
  14. package/dist/cjs/br-list.cjs.entry.js.map +1 -1
  15. package/dist/cjs/br-loading.cjs.entry.js +3 -3
  16. package/dist/cjs/br-loading.cjs.entry.js.map +1 -1
  17. package/dist/cjs/br-message.cjs.entry.js +8 -7
  18. package/dist/cjs/br-message.cjs.entry.js.map +1 -1
  19. package/dist/cjs/br-radio.cjs.entry.js +27 -29
  20. package/dist/cjs/br-radio.cjs.entry.js.map +1 -1
  21. package/dist/cjs/br-switch.cjs.entry.js +9 -8
  22. package/dist/cjs/br-switch.cjs.entry.js.map +1 -1
  23. package/dist/cjs/{index-ecdd4399.js → index-fb4e9eaf.js} +33 -3
  24. package/dist/cjs/index-fb4e9eaf.js.map +1 -0
  25. package/dist/cjs/loader.cjs.js +2 -2
  26. package/dist/cjs/webcomponents.cjs.js +2 -2
  27. package/dist/cjs/webcomponents.cjs.js.map +1 -1
  28. package/dist/collection/collection-manifest.json +1 -0
  29. package/dist/collection/components/avatar/avatar.css +58 -0
  30. package/dist/collection/components/avatar/avatar.js +4 -4
  31. package/dist/collection/components/avatar/avatar.js.map +1 -1
  32. package/dist/collection/components/button/button.css +56 -0
  33. package/dist/collection/components/button/button.js +15 -34
  34. package/dist/collection/components/button/button.js.map +1 -1
  35. package/dist/collection/components/checkbox/checkbox.css +49 -0
  36. package/dist/collection/components/checkbox/checkbox.js +9 -8
  37. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  38. package/dist/collection/components/dropdown/dropdown.css +418 -0
  39. package/dist/collection/components/dropdown/dropdown.js +426 -0
  40. package/dist/collection/components/dropdown/dropdown.js.map +1 -0
  41. package/dist/collection/components/icon/icon.css +49 -0
  42. package/dist/collection/components/icon/icon.js +4 -4
  43. package/dist/collection/components/icon/icon.js.map +1 -1
  44. package/dist/collection/components/input/input.css +49 -0
  45. package/dist/collection/components/input/input.js +11 -28
  46. package/dist/collection/components/input/input.js.map +1 -1
  47. package/dist/collection/components/item/item.css +49 -0
  48. package/dist/collection/components/item/item.js +25 -25
  49. package/dist/collection/components/item/item.js.map +1 -1
  50. package/dist/collection/components/list/list.css +49 -0
  51. package/dist/collection/components/list/list.js +13 -12
  52. package/dist/collection/components/list/list.js.map +1 -1
  53. package/dist/collection/components/loading/loading.css +56 -0
  54. package/dist/collection/components/loading/loading.js +1 -1
  55. package/dist/collection/components/loading/loading.js.map +1 -1
  56. package/dist/collection/components/message/message.css +49 -0
  57. package/dist/collection/components/message/message.js +6 -5
  58. package/dist/collection/components/message/message.js.map +1 -1
  59. package/dist/collection/components/radio/radio.css +49 -0
  60. package/dist/collection/components/radio/radio.js +26 -74
  61. package/dist/collection/components/radio/radio.js.map +1 -1
  62. package/dist/collection/components/switch/switch.css +49 -0
  63. package/dist/collection/components/switch/switch.js +9 -8
  64. package/dist/collection/components/switch/switch.js.map +1 -1
  65. package/dist/collection/pages/dropdown/dropdown.js +18 -0
  66. package/dist/collection/scripts/menu.js +29 -31
  67. package/dist/components/br-avatar.js +7 -7
  68. package/dist/components/br-avatar.js.map +1 -1
  69. package/dist/components/br-button.js +1 -1
  70. package/dist/components/br-checkbox.js +11 -10
  71. package/dist/components/br-checkbox.js.map +1 -1
  72. package/dist/components/br-dropdown.d.ts +11 -0
  73. package/dist/components/br-dropdown.js +156 -0
  74. package/dist/components/br-dropdown.js.map +1 -0
  75. package/dist/components/br-icon.js +1 -1
  76. package/dist/components/br-input.js +15 -15
  77. package/dist/components/br-input.js.map +1 -1
  78. package/dist/components/br-item.js +27 -27
  79. package/dist/components/br-item.js.map +1 -1
  80. package/dist/components/br-list.js +10 -9
  81. package/dist/components/br-list.js.map +1 -1
  82. package/dist/components/br-loading.js +3 -3
  83. package/dist/components/br-loading.js.map +1 -1
  84. package/dist/components/br-message.js +10 -9
  85. package/dist/components/br-message.js.map +1 -1
  86. package/dist/components/br-radio.js +29 -33
  87. package/dist/components/br-radio.js.map +1 -1
  88. package/dist/components/br-switch.js +11 -10
  89. package/dist/components/br-switch.js.map +1 -1
  90. package/dist/components/index.d.ts +2 -0
  91. package/dist/components/index.js +2 -1
  92. package/dist/components/index.js.map +1 -1
  93. package/dist/components/p-5769e796.js +138 -0
  94. package/dist/components/p-5769e796.js.map +1 -0
  95. package/dist/components/{p-4c4ab942.js → p-698e7a18.js} +27 -3
  96. package/dist/components/p-698e7a18.js.map +1 -0
  97. package/dist/components/{p-ceec3589.js → p-87afe26f.js} +6 -6
  98. package/dist/components/{p-ceec3589.js.map → p-87afe26f.js.map} +1 -1
  99. package/dist/esm/br-avatar.entry.js +6 -6
  100. package/dist/esm/br-avatar.entry.js.map +1 -1
  101. package/dist/esm/br-button_2.entry.js +20 -21
  102. package/dist/esm/br-button_2.entry.js.map +1 -1
  103. package/dist/esm/br-checkbox.entry.js +9 -8
  104. package/dist/esm/br-checkbox.entry.js.map +1 -1
  105. package/dist/esm/br-dropdown.entry.js +138 -0
  106. package/dist/esm/br-dropdown.entry.js.map +1 -0
  107. package/dist/esm/br-input.entry.js +13 -12
  108. package/dist/esm/br-input.entry.js.map +1 -1
  109. package/dist/esm/br-item.entry.js +24 -24
  110. package/dist/esm/br-item.entry.js.map +1 -1
  111. package/dist/esm/br-list.entry.js +8 -7
  112. package/dist/esm/br-list.entry.js.map +1 -1
  113. package/dist/esm/br-loading.entry.js +3 -3
  114. package/dist/esm/br-loading.entry.js.map +1 -1
  115. package/dist/esm/br-message.entry.js +8 -7
  116. package/dist/esm/br-message.entry.js.map +1 -1
  117. package/dist/esm/br-radio.entry.js +27 -29
  118. package/dist/esm/br-radio.entry.js.map +1 -1
  119. package/dist/esm/br-switch.entry.js +9 -8
  120. package/dist/esm/br-switch.entry.js.map +1 -1
  121. package/dist/esm/{index-5866d5ff.js → index-c7037515.js} +33 -3
  122. package/dist/esm/index-c7037515.js.map +1 -0
  123. package/dist/esm/loader.js +3 -3
  124. package/dist/esm/webcomponents.js +3 -3
  125. package/dist/esm/webcomponents.js.map +1 -1
  126. package/dist/types/components/avatar/avatar.d.ts +3 -3
  127. package/dist/types/components/button/button.d.ts +2 -6
  128. package/dist/types/components/checkbox/checkbox.d.ts +2 -2
  129. package/dist/types/components/dropdown/dropdown.d.ts +154 -0
  130. package/dist/types/components/icon/icon.d.ts +2 -2
  131. package/dist/types/components/input/input.d.ts +9 -13
  132. package/dist/types/components/item/item.d.ts +4 -4
  133. package/dist/types/components/list/list.d.ts +17 -17
  134. package/dist/types/components/loading/loading.d.ts +1 -1
  135. package/dist/types/components/message/message.d.ts +2 -2
  136. package/dist/types/components/radio/radio.d.ts +5 -4
  137. package/dist/types/components/switch/switch.d.ts +3 -3
  138. package/dist/types/components.d.ts +139 -26
  139. package/dist/webcomponents/p-0f6e2ddc.entry.js +2 -0
  140. package/dist/webcomponents/p-0f6e2ddc.entry.js.map +1 -0
  141. package/dist/webcomponents/p-14f1c8e6.entry.js +2 -0
  142. package/dist/webcomponents/p-14f1c8e6.entry.js.map +1 -0
  143. package/dist/webcomponents/p-198082b6.entry.js +2 -0
  144. package/dist/webcomponents/p-198082b6.entry.js.map +1 -0
  145. package/dist/webcomponents/{p-6315c80a.js → p-6849daee.js} +3 -3
  146. package/dist/webcomponents/p-6849daee.js.map +1 -0
  147. package/dist/webcomponents/p-867bba23.entry.js +2 -0
  148. package/dist/webcomponents/p-867bba23.entry.js.map +1 -0
  149. package/dist/webcomponents/p-8efc22a3.entry.js +2 -0
  150. package/dist/webcomponents/p-8efc22a3.entry.js.map +1 -0
  151. package/dist/webcomponents/p-9dbe247e.entry.js +2 -0
  152. package/dist/webcomponents/p-9dbe247e.entry.js.map +1 -0
  153. package/dist/webcomponents/p-a5a079d8.entry.js +2 -0
  154. package/dist/webcomponents/p-a5a079d8.entry.js.map +1 -0
  155. package/dist/webcomponents/p-ac16ee58.entry.js +2 -0
  156. package/dist/webcomponents/p-ac16ee58.entry.js.map +1 -0
  157. package/dist/webcomponents/p-c36696c6.entry.js +2 -0
  158. package/dist/webcomponents/p-c36696c6.entry.js.map +1 -0
  159. package/dist/webcomponents/p-dde91d20.entry.js +13 -0
  160. package/dist/webcomponents/p-dde91d20.entry.js.map +1 -0
  161. package/dist/webcomponents/p-f01f1e6b.entry.js +2 -0
  162. package/dist/webcomponents/p-f01f1e6b.entry.js.map +1 -0
  163. package/dist/webcomponents/webcomponents.esm.js +1 -1
  164. package/dist/webcomponents/webcomponents.esm.js.map +1 -1
  165. package/hydrate/index.js +312 -141
  166. package/hydrate/index.mjs +312 -141
  167. package/package.json +10 -6
  168. package/vscode-data.json +17 -12
  169. package/dist/cjs/index-ecdd4399.js.map +0 -1
  170. package/dist/components/p-4c4ab942.js.map +0 -1
  171. package/dist/components/p-6c7f2b2a.js +0 -140
  172. package/dist/components/p-6c7f2b2a.js.map +0 -1
  173. package/dist/esm/index-5866d5ff.js.map +0 -1
  174. package/dist/webcomponents/p-0178bba0.entry.js +0 -2
  175. package/dist/webcomponents/p-0178bba0.entry.js.map +0 -1
  176. package/dist/webcomponents/p-47812ff4.entry.js +0 -2
  177. package/dist/webcomponents/p-47812ff4.entry.js.map +0 -1
  178. package/dist/webcomponents/p-5cb55733.entry.js +0 -2
  179. package/dist/webcomponents/p-5cb55733.entry.js.map +0 -1
  180. package/dist/webcomponents/p-6315c80a.js.map +0 -1
  181. package/dist/webcomponents/p-6f787c6e.entry.js +0 -2
  182. package/dist/webcomponents/p-6f787c6e.entry.js.map +0 -1
  183. package/dist/webcomponents/p-9054589f.entry.js +0 -2
  184. package/dist/webcomponents/p-9054589f.entry.js.map +0 -1
  185. package/dist/webcomponents/p-961ad7ab.entry.js +0 -13
  186. package/dist/webcomponents/p-961ad7ab.entry.js.map +0 -1
  187. package/dist/webcomponents/p-9810bb43.entry.js +0 -2
  188. package/dist/webcomponents/p-9810bb43.entry.js.map +0 -1
  189. package/dist/webcomponents/p-a1969013.entry.js +0 -2
  190. package/dist/webcomponents/p-a1969013.entry.js.map +0 -1
  191. package/dist/webcomponents/p-ca5f6891.entry.js +0 -2
  192. package/dist/webcomponents/p-ca5f6891.entry.js.map +0 -1
  193. package/dist/webcomponents/p-e981b8b4.entry.js +0 -2
  194. package/dist/webcomponents/p-e981b8b4.entry.js.map +0 -1
@@ -12,8 +12,13 @@ import { inheritAriaAttributes } from "../../utils/inherited-attributes";
12
12
  export class Input {
13
13
  constructor() {
14
14
  this.inheritedAttributes = {};
15
+ this.handleInput = (event) => {
16
+ this.value = event.target.value;
17
+ this.valueChange.emit(this.value);
18
+ };
15
19
  this.renderLabel = () => {
16
- if (this.label) {
20
+ var _a;
21
+ if (((_a = this.label) === null || _a === void 0 ? void 0 : _a.length) > 0) {
17
22
  if (this.isInline) {
18
23
  return (h("div", { class: "input-label" }, h("label", { class: "text-nowrap", htmlFor: this.defaultID }, this.label)));
19
24
  }
@@ -28,10 +33,11 @@ export class Input {
28
33
  this.showIconTextPassword = input.type === 'password';
29
34
  };
30
35
  this.renderInput = () => {
31
- return (h("input", Object.assign({ class: this.isHighlight ? 'input-highlight' : null, id: this.defaultID, autocomplete: this.autocomplete, autofocus: this.autofocus, disabled: this.disabled, onInput: this.handleInput.bind(this), placeholder: this.placeholder, readonly: this.readonly, required: this.required, title: this.el.title, type: this.type, value: this.value }, this.inheritedAttributes)));
36
+ return (h("input", Object.assign({ class: this.isHighlight ? 'input-highlight' : null, id: this.defaultID, autocomplete: this.autocomplete, disabled: this.disabled, onInput: this.handleInput, placeholder: this.placeholder, readonly: this.readonly, required: this.required, title: this.el.title, type: this.type, value: this.value }, this.inheritedAttributes)));
32
37
  };
33
38
  this.renderHelpText = () => {
34
- return this.helpText ? h("p", null, this.helpText) : h("slot", { name: "help-text" });
39
+ var _a;
40
+ return ((_a = this.helpText) === null || _a === void 0 ? void 0 : _a.length) > 0 ? h("p", null, this.helpText) : h("slot", { name: "help-text" });
35
41
  };
36
42
  this.renderIconPassword = () => {
37
43
  const showPassword = !this.showIconTextPassword;
@@ -40,7 +46,6 @@ export class Input {
40
46
  this.defaultID = `br-input-${uuidv4()}`;
41
47
  this.type = 'text';
42
48
  this.autocomplete = undefined;
43
- this.autofocus = false;
44
49
  this.density = 'medium';
45
50
  this.disabled = false;
46
51
  this.isInline = false;
@@ -117,12 +122,8 @@ export class Input {
117
122
  warning: this.warning,
118
123
  };
119
124
  }
120
- handleInput(event) {
121
- this.value = event.target.value;
122
- this.valueChange.emit(this.value);
123
- }
124
125
  hasSlotContent(slotName) {
125
- return !!this.el.querySelector(`[slot="${slotName}"]`);
126
+ return this.el.querySelector(`[slot="${slotName}"]`) !== null;
126
127
  }
127
128
  renderIconSlot() {
128
129
  if (this.hasSlotContent('icon')) {
@@ -139,7 +140,7 @@ export class Input {
139
140
  return null;
140
141
  }
141
142
  render() {
142
- return (h(Host, { key: 'd6d001f1ad2ce509ad81a4ecf9be52353b85e661' }, h("div", { key: '9d672553f29ec3147eacfc26b8cb9f35a67d7223', class: this.getInputCssClassMap() }, this.renderLabel(), this.hasIconSlot ? (h("div", { class: "input-group" }, this.renderIconSlot(), this.renderInput())) : (this.renderInput()), this.renderButton(), this.renderHelpText())));
143
+ return (h(Host, { key: '04d44896164c990470d07dde9bd531afa826dfe2' }, h("div", { key: '9605db5f9260861938915b37dda216b5babf2ea1', class: this.getInputCssClassMap() }, this.renderLabel(), this.hasIconSlot ? (h("div", { class: "input-group" }, this.renderIconSlot(), this.renderInput())) : (this.renderInput()), this.renderButton(), this.renderHelpText())));
143
144
  }
144
145
  static get is() { return "br-input"; }
145
146
  static get encapsulation() { return "shadow"; }
@@ -209,24 +210,6 @@ export class Input {
209
210
  "attribute": "autocomplete",
210
211
  "reflect": true
211
212
  },
212
- "autofocus": {
213
- "type": "boolean",
214
- "mutable": false,
215
- "complexType": {
216
- "original": "boolean",
217
- "resolved": "boolean",
218
- "references": {}
219
- },
220
- "required": false,
221
- "optional": false,
222
- "docs": {
223
- "tags": [],
224
- "text": "Se definido como verdadeiro, o input receber\u00E1 foco automaticamente ao ser renderizado."
225
- },
226
- "attribute": "autofocus",
227
- "reflect": true,
228
- "defaultValue": "false"
229
- },
230
213
  "density": {
231
214
  "type": "string",
232
215
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAC9G,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAc,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAGpF;;;;;;;GAOG;AAOH,MAAM,OAAO,KAAK;;QA2RR,wBAAmB,GAAe,EAAE,CAAA;QAW5C,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,OAAO,CACL,WAAK,KAAK,EAAC,aAAa;wBACtB,aAAO,KAAK,EAAC,aAAa,EAA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,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,WAAW,EAAE,CACnB;gBAEA,IAAI,CAAC,YAAY,EAAE;gBACnB,IAAI,CAAC,cAAc,EAAE,CAClB,CACD,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Attributes, inheritAriaAttributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Identificador único do campo de entrada.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) defaultID: string = `br-input-${uuidv4()}`\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) autocomplete: 'on' | 'off'\n\n /**\n * Se definido como verdadeiro, o input receberá foco automaticamente ao ser renderizado.\n */\n @Prop({ reflect: true }) autofocus: boolean = false\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) isHighlight: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação bem-sucedido.\n */\n @Prop({ reflect: true }) success: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação com erro.\n */\n @Prop({ reflect: true }) danger: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado informativo.\n */\n @Prop({ reflect: true }) info: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de alerta.\n */\n @Prop({ reflect: true }) warning: boolean = false\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) label: string\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) required: boolean = false\n\n /**\n * Valor inicial exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) helpText: string\n\n @State() showIconTextPassword: boolean = false\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.brWillLoad.emit()\n this.inheritedAttributes = inheritAriaAttributes(this.el)\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.success,\n danger: this.danger,\n info: this.info,\n warning: this.warning,\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange!: EventEmitter<string>\n private handleInput(event: Event) {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n renderLabel = () => {\n if (this.label) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label class=\"text-nowrap\" htmlFor={this.defaultID}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return <label htmlFor={this.defaultID}>{this.label}</label>\n }\n }\n }\n\n togglePasswordVisibility = () => {\n const input = this.el.shadowRoot.querySelector('input')\n input.type = input.type === 'password' ? 'text' : 'password'\n this.showIconTextPassword = input.type === 'password'\n }\n\n private hasSlotContent(slotName: string): boolean {\n return !!this.el.querySelector(`[slot=\"${slotName}\"]`)\n }\n\n renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.defaultID}\n autocomplete={this.autocomplete}\n autofocus={this.autofocus}\n disabled={this.disabled}\n onInput={this.handleInput.bind(this)}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n {...this.inheritedAttributes}\n />\n )\n }\n\n renderHelpText = () => {\n return this.helpText ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n renderIconPassword = () => {\n const showPassword = !this.showIconTextPassword\n return <br-icon icon-name={showPassword ? 'fa-solid:eye' : 'fa-solid:eye-slash'}></br-icon>\n }\n\n renderIconSlot() {\n if (this.hasSlotContent('icon')) {\n return (\n <div class=\"input-icon\">\n <slot name=\"icon\"></slot>\n </div>\n )\n }\n }\n\n renderButton() {\n if (this.type === 'password') {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n // onClick={this.onIconAction}\n >\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.hasIconSlot ? (\n <div class=\"input-group\">\n {this.renderIconSlot()}\n {this.renderInput()}\n </div>\n ) : (\n this.renderInput()\n )}\n\n {this.renderButton()}\n {this.renderHelpText()}\n </div>\n </Host>\n )\n }\n}\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAC9G,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAc,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAGpF;;;;;;;GAOG;AAOH,MAAM,OAAO,KAAK;;QAsRR,wBAAmB,GAAe,EAAE,CAAA;QAM3B,gBAAW,GAAG,CAAC,KAAY,EAAE,EAAE;YAC9C,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAA;YACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnC,CAAC,CAAA;QAEgB,gBAAW,GAAG,GAAG,EAAE;;YAClC,IAAI,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,MAAM,IAAG,CAAC,EAAE,CAAC;gBAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,OAAO,CACL,WAAK,KAAK,EAAC,aAAa;wBACtB,aAAO,KAAK,EAAC,aAAa,EAAC,OAAO,EAAE,IAAI,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Attributes, inheritAriaAttributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Identificador único do campo de entrada.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) defaultID: string = `br-input-${uuidv4()}`\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) isHighlight: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação bem-sucedido.\n */\n @Prop({ reflect: true }) success: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação com erro.\n */\n @Prop({ reflect: true }) danger: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado informativo.\n */\n @Prop({ reflect: true }) info: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de alerta.\n */\n @Prop({ reflect: true }) warning: boolean = false\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) label: string\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) required: boolean = false\n\n /**\n * Valor inicial exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) helpText: string\n\n @State() showIconTextPassword: boolean = false\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.brWillLoad.emit()\n this.inheritedAttributes = inheritAriaAttributes(this.el)\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.success,\n danger: this.danger,\n info: this.info,\n warning: this.warning,\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange!: EventEmitter<string>\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label class=\"text-nowrap\" htmlFor={this.defaultID}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return <label htmlFor={this.defaultID}>{this.label}</label>\n }\n }\n }\n\n private readonly togglePasswordVisibility = () => {\n const input = this.el.shadowRoot.querySelector('input')\n input.type = input.type === 'password' ? 'text' : 'password'\n this.showIconTextPassword = input.type === 'password'\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.defaultID}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const showPassword = !this.showIconTextPassword\n return <br-icon icon-name={showPassword ? 'fa-solid:eye' : 'fa-solid:eye-slash'}></br-icon>\n }\n\n private renderIconSlot() {\n if (this.hasSlotContent('icon')) {\n return (\n <div class=\"input-icon\">\n <slot name=\"icon\"></slot>\n </div>\n )\n }\n }\n\n private renderButton() {\n if (this.type === 'password') {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n // onClick={this.onIconAction}\n >\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.hasIconSlot ? (\n <div class=\"input-group\">\n {this.renderIconSlot()}\n {this.renderInput()}\n </div>\n ) : (\n this.renderInput()\n )}\n\n {this.renderButton()}\n {this.renderHelpText()}\n </div>\n </Host>\n )\n }\n}\n"]}
@@ -256,6 +256,11 @@ img {
256
256
  max-width: 100%;
257
257
  vertical-align: middle;
258
258
  }
259
+ ul {
260
+ margin-bottom: var(--spacing-scale-2x);
261
+ margin-top: 0;
262
+ padding: 0 0 0 var(--spacing-scale-5x);
263
+ }
259
264
 
260
265
  label,
261
266
  .label {
@@ -349,6 +354,50 @@ code,
349
354
  pointer-events: none;
350
355
  }
351
356
 
357
+ [data-toggle=dropdown] + * {
358
+ position: absolute;
359
+ }
360
+
361
+ .dropdown {
362
+ position: relative;
363
+ }
364
+ .dropdown [data-toggle=dropdown] + * {
365
+ box-shadow: var(--surface-shadow-sm);
366
+ left: 0;
367
+ position: absolute;
368
+ top: 100%;
369
+ }
370
+ .dropdown .br-item {
371
+ --color: var(--color-light);
372
+ --color-rgb: var(--color-light-rgb);
373
+ --text-color: var(--color-light);
374
+ --interactive: var(--interactive-light);
375
+ --interactive-rgb: var(--color-rgb);
376
+ --visited: var(--visited-light);
377
+ --hover: var(--hover-light);
378
+ --pressed: var(--pressed-light);
379
+ --focus-color: var(--focus-color-light);
380
+ --focus: var(--focus-color-light);
381
+ --item-padding-y: var(--spacing-scale-2x);
382
+ background-color: var(--background-light);
383
+ color: var(--color);
384
+ }
385
+ .dropdown .br-item:not(:last-child) {
386
+ border-bottom: 1px solid var(--border-color);
387
+ }
388
+ .dropdown .br-item.selected {
389
+ --color: var(--color-dark);
390
+ --color-rgb: var(--color-dark-rgb);
391
+ --text-color: var(--color-dark);
392
+ --interactive: var(--interactive-dark);
393
+ --interactive-rgb: var(--interactive-dark-rgb);
394
+ --visited: var(--visited-dark);
395
+ --hover: var(--hover-dark);
396
+ --pressed: var(--pressed-dark);
397
+ --focus-color: var(--focus-color-dark);
398
+ --focus: var(--focus-color-dark);
399
+ }
400
+
352
401
  .br-item {
353
402
  background: var(--background);
354
403
  --item-padding-x: var(--spacing-scale-2x);
@@ -11,6 +11,22 @@ import { Host, h } from "@stencil/core";
11
11
  export class Item {
12
12
  constructor() {
13
13
  this.inheritedAttributes = {};
14
+ this.handleClick = (event) => {
15
+ const clickedElement = event.target;
16
+ if (this.disabled) {
17
+ event.preventDefault();
18
+ event.stopPropagation();
19
+ }
20
+ if (this.isButton) {
21
+ this.brDidClick.emit();
22
+ }
23
+ else if (this.isInteractive && !this.isClickInsideInteractiveElement(clickedElement)) {
24
+ this.selectedValue = !this.selectedValue;
25
+ this.brDidSelect.emit({ selected: this.selectedValue });
26
+ this.updateCheckboxes();
27
+ }
28
+ event.stopPropagation();
29
+ };
14
30
  this.disabled = false;
15
31
  this.isActive = false;
16
32
  this.isSelected = false;
@@ -84,7 +100,7 @@ export class Item {
84
100
  this.hasSlotDefault = this.el.innerHTML !== '';
85
101
  }
86
102
  hasSlotContent(slotName) {
87
- return !!this.el.querySelector(`[slot="${slotName}"]`);
103
+ return this.el.querySelector(`[slot="${slotName}"]`) !== null;
88
104
  }
89
105
  getCssClassMap() {
90
106
  return {
@@ -92,15 +108,16 @@ export class Item {
92
108
  disabled: this.disabled,
93
109
  active: this.isActive,
94
110
  selected: this.selectedValue,
95
- 'py-3': this.density === "middle",
96
- 'py-4': this.density === "small"
111
+ 'py-3': this.density === 'middle',
112
+ 'py-4': this.density === 'small',
97
113
  };
98
114
  }
99
115
  getTagType() {
116
+ var _a;
100
117
  if (this.isButton) {
101
118
  return 'button';
102
119
  }
103
- if (this.href) {
120
+ if (((_a = this.href) === null || _a === void 0 ? void 0 : _a.length) > 0) {
104
121
  return 'a';
105
122
  }
106
123
  return 'div';
@@ -135,28 +152,11 @@ export class Item {
135
152
  checkbox.checked = this.selectedValue;
136
153
  });
137
154
  }
138
- handleClick(event) {
139
- const clickedElement = event.target;
140
- if (this.disabled) {
141
- event.preventDefault();
142
- event.stopPropagation();
143
- }
144
- if (this.isButton) {
145
- this.brDidClick.emit();
146
- }
147
- else if (this.isInteractive && !this.isClickInsideInteractiveElement(clickedElement)) {
148
- this.selectedValue = !this.selectedValue;
149
- this.brDidSelect.emit({ selected: this.selectedValue });
150
- this.updateCheckboxes();
151
- }
152
- event.stopPropagation();
153
- }
154
155
  render() {
155
156
  const TagType = this.getTagType();
156
157
  const attributes = this.getAttributes();
157
158
  const classList = this.getCssClassMap();
158
- return (h(Host, { key: '96009f72cb35266dfc6d605ec967e9240aca7aa5' }, h(TagType, Object.assign({ key: '24568364a790b854047a8ec99fad4d5ae7506077', class: classList }, attributes, { onClick: (event) => this.handleClick(event) }), this.hasSlotStart || this.hasSlotEnd
159
- ? (h("div", { class: "row align-items-center" }, this.hasSlotStart && (h("div", { class: "col-auto" }, h("slot", { name: "start" }))), h("div", { class: "col" }, h("slot", null)), this.hasSlotEnd && (h("div", { class: "col-auto" }, h("slot", { name: "end" }))))) : (h("slot", null)))));
159
+ return (h(Host, { key: '53659ae6636c2f6eae32214c2bbfc3ef57b700bd' }, h(TagType, Object.assign({ key: '35272110ced36e52e965db6f16d30ed97680cca8', class: classList }, attributes, { onClick: this.handleClick }), this.hasSlotStart || this.hasSlotEnd ? (h("div", { class: "row align-items-center" }, this.hasSlotStart && (h("div", { class: "col-auto" }, h("slot", { name: "start" }))), h("div", { class: "col" }, h("slot", null)), this.hasSlotEnd && (h("div", { class: "col-auto" }, h("slot", { name: "end" }))))) : (h("slot", null)))));
160
160
  }
161
161
  static get is() { return "br-item"; }
162
162
  static get encapsulation() { return "shadow"; }
@@ -193,7 +193,7 @@ export class Item {
193
193
  },
194
194
  "isActive": {
195
195
  "type": "boolean",
196
- "mutable": true,
196
+ "mutable": false,
197
197
  "complexType": {
198
198
  "original": "boolean",
199
199
  "resolved": "boolean",
@@ -211,7 +211,7 @@ export class Item {
211
211
  },
212
212
  "isSelected": {
213
213
  "type": "boolean",
214
- "mutable": true,
214
+ "mutable": false,
215
215
  "complexType": {
216
216
  "original": "boolean",
217
217
  "resolved": "boolean",
@@ -229,7 +229,7 @@ export class Item {
229
229
  },
230
230
  "isInteractive": {
231
231
  "type": "boolean",
232
- "mutable": true,
232
+ "mutable": false,
233
233
  "complexType": {
234
234
  "original": "boolean",
235
235
  "resolved": "boolean",
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../src/components/item/item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAItH;;;;;;;;GAQG;AAOH,MAAM,OAAO,IAAI;;QAyQP,wBAAmB,GAAe,EAAE,CAAA;wBA7PC,KAAK;wBAMU,KAAK;0BAMH,KAAK;6BAKF,KAAK;;;wBAmBzB,KAAK;;;;8BAsBf,KAAK;4BAEP,KAAK;0BAEN,KAAK;6BAGH,KAAK;;IAGvC,YAAY,CAAC,KAAY;QACvB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAA;QAE1C,IAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,wBAAwB,EAAE,CAAA;QACjC,CAAC;IACH,CAAC;IAwBD,iBAAiB;QACf,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAC1B,CAAC;IAQD,iBAAiB;QACf,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,UAAU,CAAA;QACpC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAA;QACnC,CAAC;QACD,IAAI,CAAC,wBAAwB,EAAE,CAAA;QAC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AQ,CACtB,CACP;oBAED,WAAK,KAAK,EAAC,KAAK;wBACd,eAAa,CACT;oBAEL,IAAI,CAAC,UAAU,IAAI,CAClB,WAAK,KAAK,EAAC,UAAU;wBACnB,YAAM,IAAI,EAAC,KAAK,GAAQ,CACpB,CACP,CACG,CACP,CAAC,CAAC,CAAC,CACF,eAAa,CACd,CACO,CACL,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core'\nimport { Attributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/item?tab=designer).\n *\n * @slot default - Área de conteúdo, podendo conter qualquer componente, exceto botões primários e componentes relacionados à navegação (como carrosséis, paginações, abas, menus, etc.).\n *\n * @slot start - Área de recursos visuais, podendo conter elementos como ícones, avatares e mídias.\n *\n * @slot end - Área de recursos complementares, podendo conter componentes interativos, metadados e informações adicionais.\n */\n@Component({\n tag: 'br-item',\n styleUrl: 'item.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Item {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Desativa o item, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Indica se o item está no estado ativo.\n * Se definido como verdadeiro, o item será exibido como ativo.\n */\n @Prop({ reflect: true, mutable: true }) isActive: boolean = false\n\n /**\n * Indica se o item está no estado selecionado.\n * Se definido como verdadeiro, o item será exibido como selecionado.\n */\n @Prop({ reflect: true, mutable: true }) isSelected: boolean = false\n\n /**\n * Marca o item como interativo, permitindo que toda a superfície do item seja clicável.\n */\n @Prop({ reflect: true, mutable: true }) isInteractive: boolean = false\n\n /**\n * URL ou caminho para o qual o usuário será direcionado ao clicar no item. Quando definido, o item será renderizado como um link.\n */\n @Prop({ reflect: true }) href?: string\n\n /**\n * Define o alvo do link quando `href` está presente. Pode ser:\n * - `_blank` para abrir em uma nova aba,\n * - `_self` para abrir na mesma aba,\n * - `_parent` para abrir na aba pai,\n * - `_top` para abrir na aba superior.\n */\n @Prop({ reflect: true }) target?: '_blank' | '_self' | '_parent' | '_top'\n\n /**\n * Quando definido como `true`, o item será tratado como um botão.\n */\n @Prop({ reflect: true }) isButton: boolean = false\n\n /**\n * Tipo do botão, aplicável apenas se `isButton` for `true`. Pode ser:\n * - `'submit'` para enviar um formulário,\n * - `'reset'` para redefinir um formulário,\n * - `'button'` para um botão padrão.\n */\n @Prop({ reflect: true, mutable: true }) type: 'submit' | 'reset' | 'button'\n\n /**\n * Define um valor associado ao br-item quando renderizado como um botão, utilizado em contextos de formulário.\n */\n @Prop({ reflect: true }) value?: string\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'middle' | 'small'\n\n\n // Propriedade interna para verificar a presença de conteúdo no slot default\n @State() hasSlotDefault: boolean = false\n\n @State() hasSlotStart: boolean = false\n\n @State() hasSlotEnd: boolean = false\n\n // Propriedade interna para armazenar o valor selecionado\n @State() selectedValue: boolean = false\n\n @Listen('brDidCheckedChange', { target: 'document' })\n handleChange(event: Event) {\n const target = event.target as HTMLElement\n\n if (this.el.contains(target)) {\n this.updateItemSelectionState()\n }\n }\n\n /**\n * Evento customizado emitido quando o item é clicado, aplicável apenas se o item for um botão (`<button>`).\n * Pode ser utilizado para ações personalizadas, exceto quando o item está desativado.\n */\n @Event({\n eventName: 'brDidClick',\n composed: true,\n cancelable: true,\n bubbles: true,\n })\n brDidClick: EventEmitter\n\n /**\n * Evento customizado aplicável para todos os tipos de elementos (`div`, `button`, `a`), emitido quando o item é selecionado e desde que a propriedade `isInteractive` esteja presente.\n */\n @Event({ bubbles: true, composed: true }) brDidSelect: EventEmitter<{ selected: boolean }>\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasSlotContentDefault()\n this.hasSlotStart = this.hasSlotContent('start');\n this.hasSlotEnd = this.hasSlotContent('end');\n this.selectedValue = this.isSelected\n if (this.isButton) {\n this.type = this.type || 'button'\n }\n this.updateItemSelectionState()\n this.brWillLoad.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.updateCheckboxes()\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private hasSlotContentDefault(): any {\n this.hasSlotDefault = this.el.innerHTML !== ''\n }\n\n private hasSlotContent(slotName: string): boolean {\n return !!this.el.querySelector(`[slot=\"${slotName}\"]`)\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-item': true,\n disabled: this.disabled,\n active: this.isActive,\n selected: this.selectedValue,\n 'py-3': this.density === \"middle\",\n 'py-4': this.density === \"small\"\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n private getTagType(): string {\n if (this.isButton) {\n return 'button'\n }\n if (this.href) {\n return 'a'\n }\n return 'div'\n }\n\n private getAttributes() {\n const TagType = this.getTagType()\n const baseAttributes =\n TagType === 'button' ? { type: this.type, value: this.value } : { href: this.href, target: this.target }\n\n return {\n ...baseAttributes,\n 'aria-disabled': this.disabled ? 'true' : null,\n 'aria-current': this.isActive ? 'true' : null,\n 'data-toggle': this.isInteractive ? 'selection' : null,\n ...this.inheritedAttributes,\n }\n }\n\n updateItemSelectionState() {\n const checkboxes = Array.from(this.el.querySelectorAll('br-checkbox'))\n const radios = Array.from(this.el.querySelectorAll('br-radio'))\n\n let isAnyCheckboxChecked = false\n let isAnyRadioSelected = false\n\n if (checkboxes.length > 0) {\n isAnyCheckboxChecked = checkboxes.some((cb) => cb.checked)\n }\n if (radios.length > 0) {\n isAnyRadioSelected = radios.some((radio) => radio.checked)\n }\n\n this.selectedValue = isAnyCheckboxChecked || isAnyRadioSelected\n }\n\n // Função para verificar se o clique foi dentro do slot do item.\n private isClickInsideInteractiveElement(target: HTMLElement): boolean {\n const interactiveSelectors = 'br-checkbox, br-radio, br-input, br-button, br-select, br-textarea'\n const interactiveElements = this.el.querySelectorAll(interactiveSelectors)\n return Array.from(interactiveElements).some((el) => el.contains(target) || target === el)\n }\n\n private updateCheckboxes() {\n const checkboxes = Array.from(this.el.querySelectorAll('br-checkbox'))\n\n checkboxes.forEach((checkbox) => {\n checkbox.checked = this.selectedValue\n })\n }\n\n private handleClick(event: MouseEvent) {\n const clickedElement = event.target as HTMLElement\n\n if (this.disabled) {\n event.preventDefault()\n event.stopPropagation()\n }\n\n if (this.isButton) {\n this.brDidClick.emit()\n } else if (this.isInteractive && !this.isClickInsideInteractiveElement(clickedElement)) {\n this.selectedValue = !this.selectedValue\n this.brDidSelect.emit({ selected: this.selectedValue })\n this.updateCheckboxes()\n }\n event.stopPropagation()\n }\n\n render() {\n const TagType = this.getTagType()\n const attributes = this.getAttributes()\n const classList = this.getCssClassMap()\n return (\n <Host>\n <TagType class={classList} {...attributes} onClick={(event) => this.handleClick(event)}>\n {this.hasSlotStart || this.hasSlotEnd\n ? (\n <div class=\"row align-items-center\">\n {this.hasSlotStart && (\n <div class=\"col-auto\">\n <slot name=\"start\"></slot>\n </div>\n )}\n\n <div class=\"col\">\n <slot></slot>\n </div>\n\n {this.hasSlotEnd && (\n <div class=\"col-auto\">\n <slot name=\"end\"></slot>\n </div>\n )}\n </div>\n ) : (\n <slot></slot>\n )}\n </TagType>\n </Host>\n )\n }\n}\n"]}
1
+ {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../src/components/item/item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAItH;;;;;;;;GAQG;AAOH,MAAM,OAAO,IAAI;;QAkQE,wBAAmB,GAAe,EAAE,CAAA;QA0DpC,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;YACnD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAqB,CAAA;YAElD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,KAAK,CAAC,cAAc,EAAE,CAAA;gBACtB,KAAK,CAAC,eAAe,EAAE,CAAA;YACzB,CAAC;YAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;YACxB,CAAC;iBAAM,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,cAAc,CAAC,EAAE,CAAC;gBACvF,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,aAAa,CAAA;gBACxC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,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,IAAI;YACH,EAAC,OAAO,mEAAC,KAAK,EAAE,SAAS,IAAM,UAAU,IAAE,OAAO,EAAE,IAAI,CAAC,WAAW,KACjE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CACtC,WAAK,KAAK,EAAC,wBAAwB;gBAChC,IAAI,CAAC,YAAY,IAAI,CACpB,WAAK,KAAK,EAAC,UAAU;oBACnB,YAAM,IAAI,EAAC,OAAO,GAAQ,CACtB,CACP;gBAED,WAAK,KAAK,EAAC,KAAK;oBACd,eAAa,CACT;gBAEL,IAAI,CAAC,UAAU,IAAI,CAClB,WAAK,KAAK,EAAC,UAAU;oBACnB,YAAM,IAAI,EAAC,KAAK,GAAQ,CACpB,CACP,CACG,CACP,CAAC,CAAC,CAAC,CACF,eAAa,CACd,CACO,CACL,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core'\nimport { Attributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/item?tab=designer).\n *\n * @slot default - Área de conteúdo, podendo conter qualquer componente, exceto botões primários e componentes relacionados à navegação (como carrosséis, paginações, abas, menus, etc.).\n *\n * @slot start - Área de recursos visuais, podendo conter elementos como ícones, avatares e mídias.\n *\n * @slot end - Área de recursos complementares, podendo conter componentes interativos, metadados e informações adicionais.\n */\n@Component({\n tag: 'br-item',\n styleUrl: 'item.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Item {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrItemElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Desativa o item, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Indica se o item está no estado ativo.\n * Se definido como verdadeiro, o item será exibido como ativo.\n */\n @Prop({ reflect: true }) isActive: boolean = false\n\n /**\n * Indica se o item está no estado selecionado.\n * Se definido como verdadeiro, o item será exibido como selecionado.\n */\n @Prop({ reflect: true }) isSelected: boolean = false\n\n /**\n * Marca o item como interativo, permitindo que toda a superfície do item seja clicável.\n */\n @Prop({ reflect: true }) isInteractive: boolean = false\n\n /**\n * URL ou caminho para o qual o usuário será direcionado ao clicar no item. Quando definido, o item será renderizado como um link.\n */\n @Prop({ reflect: true }) href?: string\n\n /**\n * Define o alvo do link quando `href` está presente. Pode ser:\n * - `_blank` para abrir em uma nova aba,\n * - `_self` para abrir na mesma aba,\n * - `_parent` para abrir na aba pai,\n * - `_top` para abrir na aba superior.\n */\n @Prop({ reflect: true }) target?: '_blank' | '_self' | '_parent' | '_top'\n\n /**\n * Quando definido como `true`, o item será tratado como um botão.\n */\n @Prop({ reflect: true }) isButton: boolean = false\n\n /**\n * Tipo do botão, aplicável apenas se `isButton` for `true`. Pode ser:\n * - `'submit'` para enviar um formulário,\n * - `'reset'` para redefinir um formulário,\n * - `'button'` para um botão padrão.\n */\n @Prop({ reflect: true, mutable: true }) type: 'submit' | 'reset' | 'button'\n\n /**\n * Define um valor associado ao br-item quando renderizado como um botão, utilizado em contextos de formulário.\n */\n @Prop({ reflect: true }) value?: string\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'middle' | 'small'\n\n // Propriedade interna para verificar a presença de conteúdo no slot default\n @State() hasSlotDefault: boolean = false\n\n @State() hasSlotStart: boolean = false\n\n @State() hasSlotEnd: boolean = false\n\n // Propriedade interna para armazenar o valor selecionado\n @State() selectedValue: boolean = false\n\n @Listen('brDidCheckedChange', { target: 'document' })\n handleChange(event: Event) {\n const target = event.target as HTMLElement\n\n if (this.el.contains(target)) {\n this.updateItemSelectionState()\n }\n }\n\n /**\n * Evento customizado emitido quando o item é clicado, aplicável apenas se o item for um botão (`<button>`).\n * Pode ser utilizado para ações personalizadas, exceto quando o item está desativado.\n */\n @Event({ composed: true, cancelable: true, bubbles: true }) brDidClick: EventEmitter\n\n /**\n * Evento customizado aplicável para todos os tipos de elementos (`div`, `button`, `a`), emitido quando o item é selecionado e desde que a propriedade `isInteractive` esteja presente.\n */\n @Event({ bubbles: true, composed: true }) brDidSelect: EventEmitter<{ selected: boolean }>\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasSlotContentDefault()\n this.hasSlotStart = this.hasSlotContent('start')\n this.hasSlotEnd = this.hasSlotContent('end')\n this.selectedValue = this.isSelected\n if (this.isButton) {\n this.type = this.type || 'button'\n }\n this.updateItemSelectionState()\n this.brWillLoad.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.updateCheckboxes()\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private hasSlotContentDefault(): any {\n this.hasSlotDefault = this.el.innerHTML !== ''\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-item': true,\n disabled: this.disabled,\n active: this.isActive,\n selected: this.selectedValue,\n 'py-3': this.density === 'middle',\n 'py-4': this.density === 'small',\n }\n }\n\n private readonly inheritedAttributes: Attributes = {}\n\n private getTagType(): string {\n if (this.isButton) {\n return 'button'\n }\n if (this.href?.length > 0) {\n return 'a'\n }\n return 'div'\n }\n\n private getAttributes() {\n const TagType = this.getTagType()\n const baseAttributes =\n TagType === 'button' ? { type: this.type, value: this.value } : { href: this.href, target: this.target }\n\n return {\n ...baseAttributes,\n 'aria-disabled': this.disabled ? 'true' : null,\n 'aria-current': this.isActive ? 'true' : null,\n 'data-toggle': this.isInteractive ? 'selection' : null,\n ...this.inheritedAttributes,\n }\n }\n\n private updateItemSelectionState() {\n const checkboxes = Array.from(this.el.querySelectorAll('br-checkbox'))\n const radios = Array.from(this.el.querySelectorAll('br-radio'))\n\n let isAnyCheckboxChecked = false\n let isAnyRadioSelected = false\n\n if (checkboxes.length > 0) {\n isAnyCheckboxChecked = checkboxes.some((cb) => cb.checked)\n }\n if (radios.length > 0) {\n isAnyRadioSelected = radios.some((radio) => radio.checked)\n }\n\n this.selectedValue = isAnyCheckboxChecked || isAnyRadioSelected\n }\n\n // Função para verificar se o clique foi dentro do slot do item.\n private isClickInsideInteractiveElement(target: HTMLElement): boolean {\n const interactiveSelectors = 'br-checkbox, br-radio, br-input, br-button, br-select, br-textarea'\n const interactiveElements = this.el.querySelectorAll(interactiveSelectors)\n return Array.from(interactiveElements).some((el) => el.contains(target) || target === el)\n }\n\n private updateCheckboxes() {\n const checkboxes = Array.from(this.el.querySelectorAll('br-checkbox'))\n\n checkboxes.forEach((checkbox) => {\n checkbox.checked = this.selectedValue\n })\n }\n\n private readonly handleClick = (event: MouseEvent) => {\n const clickedElement = event.target as HTMLElement\n\n if (this.disabled) {\n event.preventDefault()\n event.stopPropagation()\n }\n\n if (this.isButton) {\n this.brDidClick.emit()\n } else if (this.isInteractive && !this.isClickInsideInteractiveElement(clickedElement)) {\n this.selectedValue = !this.selectedValue\n this.brDidSelect.emit({ selected: this.selectedValue })\n this.updateCheckboxes()\n }\n event.stopPropagation()\n }\n\n render() {\n const TagType = this.getTagType()\n const attributes = this.getAttributes()\n const classList = this.getCssClassMap()\n return (\n <Host>\n <TagType class={classList} {...attributes} onClick={this.handleClick}>\n {this.hasSlotStart || this.hasSlotEnd ? (\n <div class=\"row align-items-center\">\n {this.hasSlotStart && (\n <div class=\"col-auto\">\n <slot name=\"start\"></slot>\n </div>\n )}\n\n <div class=\"col\">\n <slot></slot>\n </div>\n\n {this.hasSlotEnd && (\n <div class=\"col-auto\">\n <slot name=\"end\"></slot>\n </div>\n )}\n </div>\n ) : (\n <slot></slot>\n )}\n </TagType>\n </Host>\n )\n }\n}\n"]}
@@ -256,6 +256,11 @@ img {
256
256
  max-width: 100%;
257
257
  vertical-align: middle;
258
258
  }
259
+ ul {
260
+ margin-bottom: var(--spacing-scale-2x);
261
+ margin-top: 0;
262
+ padding: 0 0 0 var(--spacing-scale-5x);
263
+ }
259
264
 
260
265
  label,
261
266
  .label {
@@ -349,6 +354,50 @@ code,
349
354
  pointer-events: none;
350
355
  }
351
356
 
357
+ [data-toggle=dropdown] + * {
358
+ position: absolute;
359
+ }
360
+
361
+ .dropdown {
362
+ position: relative;
363
+ }
364
+ .dropdown [data-toggle=dropdown] + * {
365
+ box-shadow: var(--surface-shadow-sm);
366
+ left: 0;
367
+ position: absolute;
368
+ top: 100%;
369
+ }
370
+ .dropdown .br-item {
371
+ --color: var(--color-light);
372
+ --color-rgb: var(--color-light-rgb);
373
+ --text-color: var(--color-light);
374
+ --interactive: var(--interactive-light);
375
+ --interactive-rgb: var(--color-rgb);
376
+ --visited: var(--visited-light);
377
+ --hover: var(--hover-light);
378
+ --pressed: var(--pressed-light);
379
+ --focus-color: var(--focus-color-light);
380
+ --focus: var(--focus-color-light);
381
+ --item-padding-y: var(--spacing-scale-2x);
382
+ background-color: var(--background-light);
383
+ color: var(--color);
384
+ }
385
+ .dropdown .br-item:not(:last-child) {
386
+ border-bottom: 1px solid var(--border-color);
387
+ }
388
+ .dropdown .br-item.selected {
389
+ --color: var(--color-dark);
390
+ --color-rgb: var(--color-dark-rgb);
391
+ --text-color: var(--color-dark);
392
+ --interactive: var(--interactive-dark);
393
+ --interactive-rgb: var(--interactive-dark-rgb);
394
+ --visited: var(--visited-dark);
395
+ --hover: var(--hover-dark);
396
+ --pressed: var(--pressed-dark);
397
+ --focus-color: var(--focus-color-dark);
398
+ --focus: var(--focus-color-dark);
399
+ }
400
+
352
401
  .br-list {
353
402
  background-color: var(--background);
354
403
  }
@@ -1,17 +1,18 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { inheritAriaAttributes } from "../../utils/inherited-attributes";
3
3
  /**
4
- * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/list?tab=designer).
5
- *
6
- * @slot default - Slot padrão para inclusão dos itens da lista.
7
- * @slot header - Slot nomeado para inclusão de ações relacionadas ao cabeçalho do list (uso de botões por exemplo).
8
- */
4
+ * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/list?tab=designer).
5
+ *
6
+ * @slot default - Slot padrão para inclusão dos itens da lista.
7
+ * @slot header - Slot nomeado para inclusão de ações relacionadas ao cabeçalho do list (uso de botões por exemplo).
8
+ */
9
9
  export class List {
10
10
  constructor() {
11
11
  this.inheritedAttributes = {};
12
12
  this.renderHeader = () => {
13
- if (this.listTitle || this.hasSlotContent('header')) {
14
- return (h("div", { class: "header" }, this.listTitle && (h("div", { class: "title" }, this.listTitle)), this.hasSlotContent('header') && (h("div", { class: "d-flex" }, h("slot", { name: "header" })))));
13
+ var _a;
14
+ if (((_a = this.listTitle) === null || _a === void 0 ? void 0 : _a.length) > 0 || this.hasSlotContent('header')) {
15
+ return (h("div", { class: "header" }, this.listTitle && h("div", { class: "title" }, this.listTitle), this.hasSlotContent('header') && (h("div", { class: "d-flex" }, h("slot", { name: "header" })))));
15
16
  }
16
17
  return null;
17
18
  };
@@ -77,11 +78,11 @@ export class List {
77
78
  getCssClassMap() {
78
79
  return {
79
80
  'br-list': true,
80
- 'horizontal': this.isHorizontal
81
+ horizontal: this.isHorizontal,
81
82
  };
82
83
  }
83
84
  hasSlotContent(slotName) {
84
- return !!this.el.querySelector(`[slot="${slotName}"]`);
85
+ return this.el.querySelector(`[slot="${slotName}"]`) !== null;
85
86
  }
86
87
  renderDivider() {
87
88
  if ((this.listTitle || this.hasSlotContent('header')) && !this.hideHeaderDivider) {
@@ -90,7 +91,7 @@ export class List {
90
91
  return null;
91
92
  }
92
93
  render() {
93
- return (h(Host, { key: '8a455944df84292a69b3ad4c6a2500b64e78de98' }, h("div", Object.assign({ key: '4098c4f688290e035aa3775df06a6885d058b55c', class: this.getCssClassMap() }, this.inheritedAttributes, { role: "list" }), this.renderHeader(), this.renderDivider(), h("slot", { key: '1358811266e52513572441a0f0039bd16ac35afd' }))));
94
+ return (h(Host, { key: 'bf56fd2ff3f57265a05521c8447630106f261fd9' }, h("div", Object.assign({ key: '710c166b13c9e02eb167bcfb4bfddc044469b85b', class: this.getCssClassMap() }, this.inheritedAttributes, { role: "list" }), this.renderHeader(), this.renderDivider(), h("slot", { key: 'b41329f3ecd8cd06df7c186d52ea08e42679e31f' }))));
94
95
  }
95
96
  static get is() { return "br-list"; }
96
97
  static get encapsulation() { return "shadow"; }
@@ -126,7 +127,7 @@ export class List {
126
127
  },
127
128
  "isHorizontal": {
128
129
  "type": "boolean",
129
- "mutable": true,
130
+ "mutable": false,
130
131
  "complexType": {
131
132
  "original": "boolean",
132
133
  "resolved": "boolean",
@@ -144,7 +145,7 @@ export class List {
144
145
  },
145
146
  "hideHeaderDivider": {
146
147
  "type": "boolean",
147
- "mutable": true,
148
+ "mutable": false,
148
149
  "complexType": {
149
150
  "original": "boolean",
150
151
  "resolved": "boolean",