@govbr-ds/webcomponents 2.0.0-next.45 → 2.0.0-next.47
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.
- package/dist/cjs/br-avatar.cjs.entry.js +1 -1
- package/dist/cjs/br-avatar.cjs.entry.js.map +1 -1
- package/dist/cjs/br-avatar.entry.cjs.js.map +1 -1
- package/dist/cjs/br-button.br-icon.entry.cjs.js.map +1 -1
- package/dist/cjs/br-button_2.cjs.entry.js +15 -2
- package/dist/cjs/br-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/br-message.cjs.entry.js +2 -2
- package/dist/cjs/br-message.cjs.entry.js.map +1 -1
- package/dist/cjs/br-message.entry.cjs.js.map +1 -1
- package/dist/cjs/br-switch.cjs.entry.js +28 -2
- package/dist/cjs/br-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/br-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/br-tag.cjs.entry.js +151 -13
- package/dist/cjs/br-tag.cjs.entry.js.map +1 -1
- package/dist/cjs/br-tag.entry.cjs.js.map +1 -1
- package/dist/cjs/br-textarea.cjs.entry.js +32 -5
- package/dist/cjs/br-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/br-textarea.entry.cjs.js.map +1 -1
- package/dist/cjs/br-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/br-upload.cjs.entry.js +15 -23
- package/dist/cjs/br-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/br-upload.entry.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/avatar/avatar.js +1 -1
- package/dist/collection/components/avatar/avatar.js.map +1 -1
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/icon/icon.js +42 -1
- package/dist/collection/components/icon/icon.js.map +1 -1
- package/dist/collection/components/message/message.css +1 -1
- package/dist/collection/components/message/message.js +1 -1
- package/dist/collection/components/message/message.js.map +1 -1
- package/dist/collection/components/switch/switch.css +1 -1
- package/dist/collection/components/switch/switch.js +27 -1
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tag/tag.css +1 -1
- package/dist/collection/components/tag/tag.js +192 -14
- package/dist/collection/components/tag/tag.js.map +1 -1
- package/dist/collection/components/textarea/textarea.js +51 -5
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.js +1 -1
- package/dist/collection/components/upload/upload.js +46 -30
- package/dist/collection/components/upload/upload.js.map +1 -1
- package/dist/components/br-avatar.js +4 -3
- package/dist/components/br-avatar.js.map +1 -1
- package/dist/components/br-breadcrumb.js +4 -4
- package/dist/components/br-button.js +4 -4
- package/dist/components/br-collapse.js +4 -4
- package/dist/components/br-footer-category.js +3 -3
- package/dist/components/br-footer-social.js +2 -2
- package/dist/components/br-icon.js +1 -1
- package/dist/components/br-input.js +1 -1
- package/dist/components/br-list.js +1 -1
- package/dist/components/br-message.js +11 -9
- package/dist/components/br-message.js.map +1 -1
- package/dist/components/br-select.js +5 -5
- package/dist/components/br-step-item.js +2 -2
- package/dist/components/br-switch.js +35 -11
- package/dist/components/br-switch.js.map +1 -1
- package/dist/components/br-tab-item.js +1 -1
- package/dist/components/br-tag.js +167 -52
- package/dist/components/br-tag.js.map +1 -1
- package/dist/components/br-textarea.js +42 -15
- package/dist/components/br-textarea.js.map +1 -1
- package/dist/components/br-tooltip.js +31 -31
- package/dist/components/br-upload.js +57 -59
- package/dist/components/br-upload.js.map +1 -1
- package/dist/components/{p-Hceu1c6D.js → p-BUfNFi9N.js} +3 -3
- package/dist/components/{p-mX_ZX0bR.js → p-Bjt1OWm8.js} +4 -4
- package/dist/components/{p-ssSt5UuQ.js → p-Brhs7qAd.js} +6 -7
- package/dist/components/p-Brhs7qAd.js.map +1 -0
- package/dist/components/{p-xvM_htUS.js → p-CYtPDYp6.js} +22 -6
- package/dist/components/p-CYtPDYp6.js.map +1 -0
- package/dist/components/{p-3-jhm6pC.js → p-D0wwETCp.js} +4 -4
- package/dist/custom-elements.json +297 -9
- package/dist/esm/br-avatar.entry.js +1 -1
- package/dist/esm/br-avatar.entry.js.map +1 -1
- package/dist/esm/br-button.br-icon.entry.js.map +1 -1
- package/dist/esm/br-button_2.entry.js +15 -2
- package/dist/esm/br-button_2.entry.js.map +1 -1
- package/dist/esm/br-message.entry.js +2 -2
- package/dist/esm/br-message.entry.js.map +1 -1
- package/dist/esm/br-switch.entry.js +28 -2
- package/dist/esm/br-switch.entry.js.map +1 -1
- package/dist/esm/br-tag.entry.js +151 -13
- package/dist/esm/br-tag.entry.js.map +1 -1
- package/dist/esm/br-textarea.entry.js +32 -5
- package/dist/esm/br-textarea.entry.js.map +1 -1
- package/dist/esm/br-tooltip.entry.js +1 -1
- package/dist/esm/br-upload.entry.js +15 -23
- package/dist/esm/br-upload.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/hydrate/index.js +258 -55
- package/dist/hydrate/index.mjs +258 -55
- package/dist/types/components/icon/icon.d.ts +35 -0
- package/dist/types/components/switch/switch.d.ts +8 -3
- package/dist/types/components/tag/tag.d.ts +45 -3
- package/dist/types/components/textarea/textarea.d.ts +18 -0
- package/dist/types/components/upload/upload.d.ts +14 -4
- package/dist/types/components.d.ts +54 -6
- package/dist/webcomponents/br-avatar.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-button.br-icon.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-message.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-switch.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-tag.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-textarea.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-upload.entry.esm.js.map +1 -1
- package/dist/webcomponents/{p-9f9f80c1.entry.js → p-0b45efc3.entry.js} +6 -4
- package/dist/webcomponents/p-0b45efc3.entry.js.map +1 -0
- package/dist/webcomponents/{p-b019dfca.entry.js → p-3f18e20a.entry.js} +23 -9
- package/dist/webcomponents/p-3f18e20a.entry.js.map +1 -0
- package/dist/webcomponents/{p-8b15dfc8.entry.js → p-6dba4bb1.entry.js} +10 -10
- package/dist/webcomponents/{p-df6e707a.entry.js → p-7251c80f.entry.js} +4 -3
- package/dist/webcomponents/p-7251c80f.entry.js.map +1 -0
- package/dist/webcomponents/{p-24f6adad.entry.js → p-73794ac8.entry.js} +42 -16
- package/dist/webcomponents/p-73794ac8.entry.js.map +1 -0
- package/dist/webcomponents/{p-abf81334.entry.js → p-82dec3b6.entry.js} +36 -12
- package/dist/webcomponents/p-82dec3b6.entry.js.map +1 -0
- package/dist/webcomponents/{p-a802ca08.entry.js → p-861b8ebf.entry.js} +55 -58
- package/dist/webcomponents/p-861b8ebf.entry.js.map +1 -0
- package/dist/webcomponents/{p-761f7798.entry.js → p-d3463d4a.entry.js} +161 -48
- package/dist/webcomponents/p-d3463d4a.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/dist/webcomponents.html-custom-data.json +17 -4
- package/package.json +1 -1
- package/dist/components/p-ssSt5UuQ.js.map +0 -1
- package/dist/components/p-xvM_htUS.js.map +0 -1
- package/dist/webcomponents/p-24f6adad.entry.js.map +0 -1
- package/dist/webcomponents/p-761f7798.entry.js.map +0 -1
- package/dist/webcomponents/p-9f9f80c1.entry.js.map +0 -1
- package/dist/webcomponents/p-a802ca08.entry.js.map +0 -1
- package/dist/webcomponents/p-abf81334.entry.js.map +0 -1
- package/dist/webcomponents/p-b019dfca.entry.js.map +0 -1
- package/dist/webcomponents/p-df6e707a.entry.js.map +0 -1
- /package/dist/components/{p-Hceu1c6D.js.map → p-BUfNFi9N.js.map} +0 -0
- /package/dist/components/{p-mX_ZX0bR.js.map → p-Bjt1OWm8.js.map} +0 -0
- /package/dist/components/{p-3-jhm6pC.js.map → p-D0wwETCp.js.map} +0 -0
- /package/dist/webcomponents/{p-8b15dfc8.entry.js.map → p-6dba4bb1.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"br-message.entry.esm.js","sources":["../../packages/webcomponents/src/components/message/message.scss?tag=br-message&encapsulation=shadow","../../packages/webcomponents/src/components/message/message.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/message/message\";\n\n:host {\n display: block;\n\n .icon-space {\n margin-right: var(--spacing-scale-half);\n }\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Host, Prop } from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/message?tab=designer).\n *\n * @slot default - Utilizado para inserir qualquer conteúdo que será exibido no corpo da mensagem.\n */\n@Component({\n tag: 'br-message',\n styleUrl: 'message.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Message {\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: HTMLBrMessageElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Define o título da mensagem, que é exibido no início, acima da mensagem principal.\n * Este título serve para destacar a mensagem textual. Não é aplicável para mensagens do tipo feedback.\n */\n @Prop({ reflect: true }) readonly messageTitle: string\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-message-${messageId++}`\n\n /**\n * Define o texto da mensagem que será exibido.\n * Este é o conteúdo principal da mensagem. A propriedade `message` é obrigatória e deve ser fornecida para que a mensagem apareça.\n */\n @Prop({ reflect: true }) readonly message!: string\n\n /**\n * Se definido como verdadeiro, o título da mensagem será exibido na mesma linha que a mensagem principal.\n * Isso pode ser útil para criar um layout onde o título e a mensagem estão alinhados horizontalmente.\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Se definido como verdadeiro, um botão de fechar será exibido para permitir que o usuário feche a mensagem.\n * O fechamento emitirá o evento `brDidClose`, mas não removerá automaticamente o componente do DOM, a menos que a propriedade `autoRemove` também esteja definida como `true`.\n * Este recurso não está disponível para mensagens do tipo feedback.\n */\n @Prop({ reflect: true }) readonly isClosable: boolean = false\n\n /**\n * Controla o comportamento do fechamento do componente quando `isClosable` é verdadeiro.\n * - Se definido como `true`, o componente será automaticamente removido do DOM ao clicar no botão de fechar.\n * - Se definido como `false`, o componente permanecerá no DOM e apenas emitirá o evento `brDidClose`.\n *\n * Esta propriedade não tem efeito se `isClosable` for `false`.\n * O valor padrão é `false`.\n */\n @Prop({ reflect: true }) autoRemove: boolean = false\n\n /**\n * Se definido como verdadeiro, um ícone associado à mensagem será exibido.\n * Use esta propriedade para mostrar ou ocultar o ícone da mensagem conforme necessário.\n */\n @Prop({ reflect: true }) readonly showIcon: boolean = false\n\n /**\n * Define se a mensagem é do tipo feedback, geralmente usada para fornecer contexto adicional sobre ações do usuário.\n * Exemplos incluem mensagens de validação em campos de formulário. Não disponível para mensagens que não sejam de feedback.\n */\n @Prop({ reflect: true }) readonly isFeedback: boolean = false\n\n /**\n * Define o estado do message.\n * Os possíveis valores são:\n * - 'info': Mensagem informativa.\n * - 'warning': Mensagem de aviso.\n * - 'danger': Mensagem de erro ou alerta.\n * - 'success': Mensagem de sucesso.\n * O valor padrão é 'info'.\n */\n @Prop({ reflect: true }) readonly state: 'info' | 'warning' | 'danger' | 'success' = 'info'\n\n /** Evento emitido quando o usuário fecha a mensagem, se closable for true. */\n @Event() brDidClose: EventEmitter\n\n private readonly dismissHandler = () => {\n this.brDidClose.emit()\n if (this.autoRemove) {\n this.el.remove()\n }\n }\n\n private checkIconState() {\n const iconMap = {\n success: 'fa-solid:check-circle',\n warning: 'fa-solid:exclamation-triangle',\n danger: 'fa-solid:times-circle',\n info: 'fa-solid:info-circle',\n }\n return iconMap[this.state] || 'check-circle' // Valor padrão se não encontrado\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-message': true,\n [this.state]: true,\n }\n }\n\n render() {\n return (\n <Host>\n {this.isFeedback ? (\n <span class={`feedback ${this.state}`} role=\"alert\" id={this.customId}>\n {this.showIcon ? <br-icon class=\"icon-space\" icon-name={this.checkIconState()}></br-icon> : null}\n {this.message && this.message.length > 0 ? this.message : <slot></slot>}\n </span>\n ) : (\n <div class={this.getCssClassMap()} role=\"alert\" id={this.customId}>\n {this.showIcon && (\n <div class=\"icon\">\n <br-icon icon-name={this.checkIconState()} height=\"20\" aria-hidden=\"true\"></br-icon>\n </div>\n )}\n <div class=\"content\" role=\"alert\">\n {this.message && this.message.length > 0 ? (\n <div>\n {this.messageTitle && <span class=\"message-title\">{this.messageTitle}</span>}\n {this.messageTitle && !this.isInline && <br />}\n {this.message && <span class=\"message-body\">{this.message}</span>}\n </div>\n ) : (\n <div>\n {this.messageTitle && this.isInline && <strong>{this.messageTitle}</strong>}\n {this.messageTitle && !this.isInline && <br />}\n <slot></slot>\n </div>\n )}\n </div>\n {this.isClosable && !this.isFeedback && (\n <div class=\"close\">\n <br-button shape=\"circle\" type=\"button\" aria-label=\"Fechar a mensagem\" onClick={this.dismissHandler}>\n <br-icon icon-name=\"fa-solid:times\" aria-hidden=\"true\"></br-icon>\n </br-button>\n </div>\n )}\n </div>\n )}\n </Host>\n )\n }\n}\n\nlet messageId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,UAAU,GAAG,4/8DAA4/8D;;MCclg9D,OAAO,GAAA,MAAA;AANpB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;;AAqBE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,cAAc,SAAS,EAAE,EAAE;AAQhF;;;AAGG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;;;AAIG;AAC+B,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;AAE7D;;;;;;;AAOG;AACsB,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;AAEpD;;;AAGG;AAC+B,Q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T,CACP,CACG,EACL,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,KAClC,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,OAAO,EAAA,EAChB,CAAA,CAAA,WAAA,EAAA,EAAW,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAY,YAAA,EAAA,mBAAmB,EAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAA,EACjG,CAAmB,CAAA,SAAA,EAAA,EAAA,WAAA,EAAA,gBAAgB,EAAa,aAAA,EAAA,MAAM,EAAW,CAAA,CACvD,CACR,CACP,CACG,CACP,CACI;;;;;AAKb,IAAI,SAAS,GAAG,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"br-message.entry.esm.js","sources":["../../packages/webcomponents/src/components/message/message.scss?tag=br-message&encapsulation=shadow","../../packages/webcomponents/src/components/message/message.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/message/message\";\n\n:host {\n display: block;\n\n .icon-space {\n margin-right: var(--spacing-scale-half);\n }\n\n .br-message.success .close br-button,\n .br-message.danger .close br-button,\n .br-message.info .close br-button {\n --interactive: var(--message-color-icon);\n }\n\n .br-message.success .close br-button {\n --interactive-rgb: var(--success-rgb);\n }\n\n .br-message.danger .close br-button {\n --interactive-rgb: var(--danger-rgb);\n }\n\n .br-message.info .close br-button {\n --interactive-rgb: var(--info-rgb);\n }\n\n .br-message.warning .close br-button {\n --interactive: var(--color);\n --interactive-rgb: var(--color-rgb);\n }\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Host, Prop } from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/message?tab=designer).\n *\n * @slot default - Utilizado para inserir qualquer conteúdo que será exibido no corpo da mensagem.\n */\n@Component({\n tag: 'br-message',\n styleUrl: 'message.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Message {\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: HTMLBrMessageElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Define o título da mensagem, que é exibido no início, acima da mensagem principal.\n * Este título serve para destacar a mensagem textual. Não é aplicável para mensagens do tipo feedback.\n */\n @Prop({ reflect: true }) readonly messageTitle: string\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-message-${messageId++}`\n\n /**\n * Define o texto da mensagem que será exibido.\n * Este é o conteúdo principal da mensagem. A propriedade `message` é obrigatória e deve ser fornecida para que a mensagem apareça.\n */\n @Prop({ reflect: true }) readonly message!: string\n\n /**\n * Se definido como verdadeiro, o título da mensagem será exibido na mesma linha que a mensagem principal.\n * Isso pode ser útil para criar um layout onde o título e a mensagem estão alinhados horizontalmente.\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Se definido como verdadeiro, um botão de fechar será exibido para permitir que o usuário feche a mensagem.\n * O fechamento emitirá o evento `brDidClose`, mas não removerá automaticamente o componente do DOM, a menos que a propriedade `autoRemove` também esteja definida como `true`.\n * Este recurso não está disponível para mensagens do tipo feedback.\n */\n @Prop({ reflect: true }) readonly isClosable: boolean = false\n\n /**\n * Controla o comportamento do fechamento do componente quando `isClosable` é verdadeiro.\n * - Se definido como `true`, o componente será automaticamente removido do DOM ao clicar no botão de fechar.\n * - Se definido como `false`, o componente permanecerá no DOM e apenas emitirá o evento `brDidClose`.\n *\n * Esta propriedade não tem efeito se `isClosable` for `false`.\n * O valor padrão é `false`.\n */\n @Prop({ reflect: true }) autoRemove: boolean = false\n\n /**\n * Se definido como verdadeiro, um ícone associado à mensagem será exibido.\n * Use esta propriedade para mostrar ou ocultar o ícone da mensagem conforme necessário.\n */\n @Prop({ reflect: true }) readonly showIcon: boolean = false\n\n /**\n * Define se a mensagem é do tipo feedback, geralmente usada para fornecer contexto adicional sobre ações do usuário.\n * Exemplos incluem mensagens de validação em campos de formulário. Não disponível para mensagens que não sejam de feedback.\n */\n @Prop({ reflect: true }) readonly isFeedback: boolean = false\n\n /**\n * Define o estado do message.\n * Os possíveis valores são:\n * - 'info': Mensagem informativa.\n * - 'warning': Mensagem de aviso.\n * - 'danger': Mensagem de erro ou alerta.\n * - 'success': Mensagem de sucesso.\n * O valor padrão é 'info'.\n */\n @Prop({ reflect: true }) readonly state: 'info' | 'warning' | 'danger' | 'success' = 'info'\n\n /** Evento emitido quando o usuário fecha a mensagem, se closable for true. */\n @Event() brDidClose: EventEmitter\n\n private readonly dismissHandler = () => {\n this.brDidClose.emit()\n if (this.autoRemove) {\n this.el.remove()\n }\n }\n\n private checkIconState() {\n const iconMap = {\n success: 'fa-solid:check-circle',\n warning: 'fa-solid:exclamation-triangle',\n danger: 'fa-solid:times-circle',\n info: 'fa-solid:info-circle',\n }\n return iconMap[this.state] || 'check-circle' // Valor padrão se não encontrado\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-message': true,\n [this.state]: true,\n }\n }\n\n render() {\n return (\n <Host>\n {this.isFeedback ? (\n <span class={`feedback ${this.state}`} role=\"alert\" id={this.customId}>\n {this.showIcon ? <br-icon class=\"icon-space\" icon-name={this.checkIconState()}></br-icon> : null}\n {this.message && this.message.length > 0 ? this.message : <slot></slot>}\n </span>\n ) : (\n <div class={this.getCssClassMap()} role=\"alert\" id={this.customId}>\n <div class=\"icon\">\n {this.showIcon ? (\n <br-icon icon-name={this.checkIconState()} height=\"20\" aria-hidden=\"true\"></br-icon>\n ) : (\n <slot name=\"icon\"></slot>\n )}\n </div>\n <div class=\"content\" role=\"alert\">\n {this.message && this.message.length > 0 ? (\n <div>\n {this.messageTitle && <span class=\"message-title\">{this.messageTitle}</span>}\n {this.messageTitle && !this.isInline && <br />}\n {this.message && <span class=\"message-body\">{this.message}</span>}\n </div>\n ) : (\n <div>\n {this.messageTitle && this.isInline && <strong>{this.messageTitle}</strong>}\n {this.messageTitle && !this.isInline && <br />}\n <slot></slot>\n </div>\n )}\n </div>\n {this.isClosable && !this.isFeedback && (\n <div class=\"close\">\n <br-button shape=\"circle\" type=\"button\" aria-label=\"Fechar a mensagem\" onClick={this.dismissHandler}>\n <br-icon icon-name=\"fa-solid:times\" aria-hidden=\"true\"></br-icon>\n </br-button>\n </div>\n )}\n </div>\n )}\n </Host>\n )\n }\n}\n\nlet messageId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,UAAU,GAAG,k/9DAAk/9D;;MCcx/9D,OAAO,GAAA,MAAA;AANpB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;;AAqBE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,cAAc,SAAS,EAAE,EAAE;AAQhF;;;AAGG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;;;AAIG;AAC+B,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;AAE7D;;;;;;;AAOG;AACsB,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;AAEpD;;;AAGG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;;AAGG;AAC+B,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;AAE7D;;;;;;;;AAQG;AAC+B,QAAA,IAAK,CAAA,KAAA,GAA8C,MAAM;AAK1E,QAAA,IAAc,CAAA,cAAA,GAAG,MAAK;AACrC,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACtB,YAAA,IAAI,IAAI,CAAC,UAAU,EAAE;AACnB,gBAAA,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;;AAEpB,SAAC;AA+DF;IA7DS,cAAc,GAAA;AACpB,QAAA,MAAM,OAAO,GAAG;AACd,YAAA,OAAO,EAAE,uBAAuB;AAChC,YAAA,OAAO,EAAE,+BAA+B;AACxC,YAAA,MAAM,EAAE,uBAAuB;AAC/B,YAAA,IAAI,EA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":["../../packages/webcomponents/src/components/switch/switch.scss?tag=br-switch&encapsulation=shadow","../../packages/webcomponents/src/components/switch/switch.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/switch/switch\";\n\n:host {\n display: inline-block;\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core'\n\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/switch?tab=designer).\n *\n * @slot default - Descreve o que o switch faz quando a alternância estiver ativada. A label passada por slot tem precedência sobre a propriedade 'label'.\n */\n@Component({\n tag: 'br-switch',\n styleUrl: 'switch.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Switch {\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: HTMLBrSwitchElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Desativa o switch, tornando-o não interativo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Define o estado de seleção do checkbox.\n * Se definido como verdadeiro, o checkbox estará marcado. Caso contrário, estará desmarcado.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-switch-${switchId++}`\n\n /**\n * Texto descritivo.\n * Caso um slot seja utilizado para fornecer um texto alternativo, o valor desta propriedade será ignorado.\n */\n @Prop() readonly label: string\n\n /**\n * Posição do rótulo em relação ao switch.\n */\n @Prop({ reflect: true }) readonly labelPosition: 'right' | 'left' | 'top' = 'left'\n\n /**\n * Texto exibido quando o switch está ativado.\n */\n @Prop({ reflect: true }) readonly labelOn: string\n\n /**\n * Texto exibido quando o switch está desativado.\n */\n @Prop({ reflect: true }) readonly labelOff: string\n\n /**\n * Adiciona um ícone ao switch para indicar a mudança de estado.\n */\n @Prop({ reflect: true }) readonly hasIcon: boolean = false\n\n /**\n * Define o nome do switch, que é utilizado para agrupar switches em formulários e identificar o campo.\n * O valor é obrigatório e deve ser fornecido para garantir o correto funcionamento em formulários.\n */\n @Prop({ reflect: true }) readonly name: string\n\n /**\n * Define o valor associado ao switch quando ele faz parte de um formulário nativo (`<form>`).\n * Esse valor é enviado com o formulário quando o switch está selecionado.\n * **Nota:** Esta propriedade não deve ser utilizada para determinar se o switch está selecionado; para verificar o estado de seleção, use a propriedade `checked`.\n */\n @Prop({ reflect: true }) readonly value: string\n\n /** O ajuste da densidade consiste em aumentar ou reduzir a área de interação do switch. Quanto menor for a densidade, maior a área de interação. */\n @Prop({ reflect: true }) readonly density: 'large' | 'medium' | 'small' = 'medium'\n\n // Propriedade interna para verificar a presença de conteúdo no slot default\n @State() _slotDefault: boolean = false\n\n componentWillLoad() {\n this._hasSlotContentDefault()\n }\n\n /**\n * Disparado depois que o valor do `checked` foi alterado\n */\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"br-switch.entry.esm.js","sources":["../../packages/webcomponents/src/components/switch/switch.scss?tag=br-switch&encapsulation=shadow","../../packages/webcomponents/src/components/switch/switch.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/switch/switch\";\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]) .br-switch,\n:host([disabled]) .br-switch label,\n:host([disabled]) .br-switch input {\n cursor: not-allowed;\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core'\n\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/switch?tab=designer).\n *\n * @slot default - Descreve o que o switch faz quando a alternância estiver ativada. A label passada por slot tem precedência sobre a propriedade 'label'.\n */\n@Component({\n tag: 'br-switch',\n styleUrl: 'switch.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Switch {\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: HTMLBrSwitchElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Desativa o switch, tornando-o não interativo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Define o estado de seleção do checkbox.\n * Se definido como verdadeiro, o checkbox estará marcado. Caso contrário, estará desmarcado.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-switch-${switchId++}`\n\n /**\n * Texto descritivo.\n * Caso um slot seja utilizado para fornecer um texto alternativo, o valor desta propriedade será ignorado.\n */\n @Prop() readonly label: string\n\n /**\n * Posição do rótulo em relação ao switch.\n */\n @Prop({ reflect: true }) readonly labelPosition: 'right' | 'left' | 'top' = 'left'\n\n /**\n * Texto exibido quando o switch está ativado.\n */\n @Prop({ reflect: true }) readonly labelOn: string\n\n /**\n * Texto exibido quando o switch está desativado.\n */\n @Prop({ reflect: true }) readonly labelOff: string\n\n /**\n * Adiciona um ícone ao switch para indicar a mudança de estado.\n */\n @Prop({ reflect: true }) readonly hasIcon: boolean = false\n\n /**\n * Define o nome do switch, que é utilizado para agrupar switches em formulários e identificar o campo.\n * O valor é obrigatório e deve ser fornecido para garantir o correto funcionamento em formulários.\n */\n @Prop({ reflect: true }) readonly name: string\n\n /**\n * Define o valor associado ao switch quando ele faz parte de um formulário nativo (`<form>`).\n * Esse valor é enviado com o formulário quando o switch está selecionado.\n * **Nota:** Esta propriedade não deve ser utilizada para determinar se o switch está selecionado; para verificar o estado de seleção, use a propriedade `checked`.\n */\n @Prop({ reflect: true }) readonly value: string\n\n /** O ajuste da densidade consiste em aumentar ou reduzir a área de interação do switch. Quanto menor for a densidade, maior a área de interação. */\n @Prop({ reflect: true }) readonly density: 'large' | 'medium' | 'small' = 'medium'\n\n // Propriedade interna para verificar a presença de conteúdo no slot default\n @State() _slotDefault: boolean = false\n\n componentWillLoad() {\n this._hasSlotContentDefault()\n }\n\n /**\n * Disparado depois que o valor do `checked` foi alterado\n */\n @Event() checkedChange: EventEmitter<boolean>\n private _hasSlotContentDefault(): void {\n this._slotDefault = this.el.innerHTML !== ''\n }\n\n /**\n * Determina o texto a ser usado para acessibilidade quando não há label visível\n */\n private getAccessibilityLabel(): string {\n const hostAriaLabel = this.el.getAttribute('aria-label')\n\n if (hostAriaLabel && hostAriaLabel.trim() !== '') {\n return hostAriaLabel\n }\n\n if (this.label && this.label.trim() !== '') {\n return this.label\n }\n\n if (\n typeof this.labelOn === 'string' &&\n this.labelOn.trim() !== '' &&\n typeof this.labelOff === 'string' &&\n this.labelOff.trim() !== ''\n ) {\n return `Alternar entre ${this.labelOff} e ${this.labelOn}`\n }\n\n return 'Alternar seleção'\n }\n\n private readonly handleCheckedChange = (event: Event) => {\n this.checked = (event.target as HTMLInputElement).checked\n this.checkedChange.emit(this.checked)\n }\n\n private readonly handleClick = (event: Event) => {\n event.stopPropagation()\n }\n\n /**\n * Inverte o valor da prop `checked`\n */\n @Method()\n async toggleChecked() {\n this.checked = !this.checked\n this.checkedChange.emit(this.checked)\n }\n\n /**\n * Verifica se o componente tem texto visível (via slot ou label)\n */\n private hasVisibleText(): boolean {\n return this._slotDefault || (this.label !== undefined && this.label !== null && this.label.trim() !== '')\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-switch': true,\n icon: this.hasIcon,\n top: this.labelPosition === 'top',\n right: this.labelPosition === 'right',\n large: this.density === 'large',\n small: this.density === 'small',\n }\n }\n\n render() {\n const hasVisibleText = this.hasVisibleText()\n\n return (\n <Host>\n <div class={this.getCssClassMap()}>\n <input\n id={this.customId}\n type=\"checkbox\"\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n role=\"switch\"\n aria-checked={this.checked ? 'true' : 'false'}\n onChange={this.handleCheckedChange}\n onClick={this.handleClick}\n {...(!hasVisibleText ? { 'aria-label': this.getAccessibilityLabel() } : {})}\n />\n <label htmlFor={this.customId}>{this._slotDefault ? <slot></slot> : this.label || ''}</label>\n {this.labelOn && this.labelOff && (\n <div class=\"switch-data\" data-enabled={this.labelOn} data-disabled={this.labelOff} aria-hidden=\"true\"></div>\n )}\n </div>\n </Host>\n )\n }\n}\n\nlet switchId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,i8+DAAi8+D;;MCet8+D,MAAM,GAAA,MAAA;AANnB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;;AAeE;;AAEG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;;AAGG;AACqC,QAAA,IAAO,CAAA,OAAA,GAAY,KAAK;AAEhE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,aAAa,QAAQ,EAAE,EAAE;AAQ9E;;AAEG;AAC+B,QAAA,IAAa,CAAA,aAAA,GAA6B,MAAM;AAYlF;;AAEG;AAC+B,QAAA,IAAO,CAAA,OAAA,GAAY,KAAK;;AAgBxB,QAAA,IAAO,CAAA,OAAA,GAAiC,QAAQ;;AAGzE,QAAA,IAAY,CAAA,YAAA,GAAY,KAAK;AAwCrB,QAAA,IAAA,CAAA,mBAAmB,GAAG,CAAC,KAAY,KAAI;YACtD,IAAI,CAAC,OAAO,GAAI,KAAK,CAAC,MAA2B,CAAC,OAAO;YACzD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;AACvC,SAAC;AAEgB,QAAA,IAAA,CAAA,WAAW,GAAG,CAAC,KAAY,KAAI;YAC9C,KAAK,CAAC,eAAe,EAAE;AACzB,SAAC;AAuDF;IApGC,iBAAiB,GAAA;QACf,IAAI,CAAC,sBAAsB,EAAE;;IAOvB,sBAAsB,GAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,SAAS,KAAK,EAAE;;AAG9C;;AAEG;IACK,qBAAqB,GAAA;QAC3B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AQ,EAAA,aAAA,EAAc,MAAM,EAAA,CAAO,CAC7G,CACG,CACD;;;;;AAKb,IAAI,QAAQ,GAAG,CAAC;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"br-tag.entry.esm.js","sources":["../../packages/webcomponents/src/components/tag/tag.scss?tag=br-tag&encapsulation=shadow","../../packages/webcomponents/src/components/tag/tag.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/checkbox/checkbox\";\n@import \"~@govbr-ds/core/src/components/input/input\";\n@import \"~@govbr-ds/core/src/components/tag/tag\";\n\n:host {\n display: inline-block;\n\n .tag-position {\n display: flex;\n justify-content: space-around;\n align-items: center;\n }\n\n .tag-spacing-status {\n margin-left: var(--spacing-scale-half) !important;\n }\n}\n\n.br-tag {\n &:not(.icon) {\n br-icon {\n margin-right: var(--spacing-scale-base);\n }\n }\n}\n","import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\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/tag?tab=designer).\n *\n * @slot default - Espaço de conteúdo do tag. Geralmente usado para incluir o rótulo ou um ícone.\n */\n\n// Constantes para valores fixos\nconst DENSITY_SMALL = 'small'\nconst DENSITY_MEDIUM = 'medium'\nconst DENSITY_LARGE = 'large'\n\nconst SHAPE_CIRCLE = 'circle'\nconst SHAPE_ROUNDED = 'rounded'\nconst SHAPE_DEFAULT = 'default'\n\n@Component({\n tag: 'br-tag',\n styleUrl: 'tag.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Tag {\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: HTMLBrTagElement\n\n /** API de controle de formulário nativa */\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * A propriedade 'label' é uma string que representa o texto a ser exibido no componente.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly label: string = ''\n\n /**\n * A propriedade 'iconName' define o nome do ícone que será exibido ao lado do texto.\n * O valor padrão é 'fa-solid:car', que corresponde a um ícone de carro da biblioteca Font Awesome.\n */\n @Prop({ reflect: true }) readonly iconName: string = ''\n\n /**\n * A propriedade 'name' é uma string que representa o nome do grupo da tag para seleção.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly name: string = ''\n\n /**\n * A tag permite seleção múltipla.\n * */\n @Prop({ reflect: true }) readonly multiple: boolean = false\n\n /**\n * A tag está selecionada.\n * */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-tag-${tagId++}`\n\n /**\n * A propriedade 'color' permite definir a cor do componente.\n * Aceita valores como 'red', 'blue', entre outros, e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly color: string = ''\n\n /**\n * A propriedade 'density' permite definir a densidade do componente.\n * Aceita valores como 'small', 'medium' e 'large', e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = DENSITY_SMALL\n\n /**\n * A propriedade 'shape' define o formato do componente.\n * Valores possíveis:\n * - 'circle': Componente com formato circular.\n * - 'rounded': Componente com bordas arredondadas.\n * - 'default': Componente com formato padrão.\n */\n @Prop({ reflect: true }) readonly shape: 'circle' | 'rounded' | 'default' = SHAPE_DEFAULT\n\n /**\n * Status deve ser exibido.\n */\n @Prop({ reflect: true }) readonly status: boolean = false\n\n /**\n * Interação deve ser habilitada.\n */\n @Prop({ reflect: true, mutable: true }) interaction: boolean = false\n\n /**\n * Interação de seleção deve ser habilitada.\n * */\n @Prop({ reflect: true }) interactionSelect: boolean = false\n\n /**\n * Tag deve estar desabilitado.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Tag está selecionada.\n */\n @State() selectedClassValue: boolean = false\n\n /**\n * Evento emitido quando a tag é selecionada.\n */\n @Event() radioSelected: EventEmitter<string>\n\n @Watch('interaction')\n handleInteractionChange(newValue: boolean) {\n if (newValue && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n @Watch('interactionSelect')\n handleInteractionSelectChange(newValue: boolean) {\n if (newValue && this.interaction) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n componentWillLoad() {\n if (this.interaction && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n connectedCallback() {\n this.selectedClassValue = this.selected\n }\n\n @Watch('selected')\n handleSelectedChange(newValue: boolean) {\n this.selectedClassValue = newValue\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-tag': true,\n interaction: this.interaction,\n 'interaction-select': this.interactionSelect,\n selected: this.selectedClassValue,\n [this.color]: !!this.color,\n [DENSITY_SMALL]: this.density === DENSITY_SMALL,\n [DENSITY_MEDIUM]: this.density === DENSITY_MEDIUM,\n [DENSITY_LARGE]: this.density === DENSITY_LARGE,\n count: this.shape === SHAPE_ROUNDED,\n icon: this.shape === SHAPE_CIRCLE,\n status: this.status,\n }\n }\n\n private renderIcon() {\n return this.iconName && this.iconName.trim() !== '' ? (\n <br-icon icon-name={this.iconName} aria-hidden=\"true\" />\n ) : null\n }\n\n private renderLabel() {\n return this.shape !== SHAPE_CIRCLE && !this.status ? <span>{this.label}</span> : null\n }\n\n private renderCloseButton() {\n if (!this.interaction) return null\n return (\n <br-button\n type=\"button\"\n shape=\"circle\"\n emphasis=\"primary\"\n aria-label=\"Fechar\"\n onClick={this.handleClose}\n disabled={this.disabled}\n >\n <br-icon icon-name=\"fa-solid:times\"></br-icon>\n </br-button>\n )\n }\n\n private renderStatusLabel() {\n return this.status ? <span class=\"tag-spacing-status\">{this.label}</span> : null\n }\n\n private handleClose = () => {\n this.el.remove()\n }\n\n private handleChangeValueChecked = () => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n }\n this.selected = !this.selected\n }\n\n private handleChangeRadioValue = (event: MouseEvent) => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n this.selected = (event.target as HTMLInputElement).checked\n }\n }\n\n @Listen('radioSelected', { target: 'document' })\n handleCheckedChange(event: CustomEvent) {\n if (event.detail === this.name && this.el !== event.target) {\n this.selected = false\n }\n }\n\n render() {\n const mainTagContent = (\n <span class={this.getCssClassMap()} id={this.customId}>\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderCloseButton()}\n <slot></slot>\n </span>\n )\n\n return (\n <Host>\n {!this.status ? (\n mainTagContent\n ) : (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {mainTagContent}\n {this.renderStatusLabel()}\n </div>\n )}\n\n {this.interactionSelect && (\n <span class={this.getCssClassMap()} id={this.customId}>\n {this.multiple ? (\n <input\n id={this.label}\n type=\"checkbox\"\n name={this.name}\n value={this.label}\n checked={this.selected}\n onClick={this.handleChangeValueChecked}\n disabled={this.disabled}\n />\n ) : (\n <input\n id={this.label}\n type=\"radio\"\n name={this.name}\n value={this.label}\n checked={this.selected}\n onClick={this.handleChangeRadioValue}\n disabled={this.disabled}\n />\n )}\n <label htmlFor={this.label}>\n {this.renderIcon()}\n <span>{this.label}</span>\n </label>\n </span>\n )}\n </Host>\n )\n }\n}\n\nlet tagId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,MAAM,GAAG,o11EAAo11E;;ACgBn21E;;;;AAIG;AAEH;AACA,MAAM,aAAa,GAAG,OAAO;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,EAAE,IAAI,CAAC,KAAK,EACd,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,OAAO,EAAE,IAAI,CAAC,wBAAwB,EACtC,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACvB,KAEF,aACE,EAAE,EAAE,IAAI,CAAC,KAAK,EACd,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,OAAO,EAAE,IAAI,CAAC,sBAAsB,EACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAA,CACvB,CACH,EACD,CAAA,CAAA,OAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAO,OAAO,EAAE,IAAI,CAAC,KAAK,EAAA,EACvB,IAAI,CAAC,UAAU,EAAE,EAClB,CAAO,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAA,IAAI,CAAC,KAAK,CAAQ,CACnB,CACH,CACR,CACI;;;;;;;;;;AAKb,IAAI,KAAK,GAAG,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"br-tag.entry.esm.js","sources":["../../packages/webcomponents/src/components/tag/tag.scss?tag=br-tag&encapsulation=shadow","../../packages/webcomponents/src/components/tag/tag.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/checkbox/checkbox\";\n@import \"~@govbr-ds/core/src/components/input/input\";\n@import \"~@govbr-ds/core/src/components/tag/tag\";\n\n:host {\n display: inline-block;\n margin-right: var(--spacing-scale-half);\n\n .tag-spacing-status {\n margin-left: var(--spacing-scale-half) !important;\n }\n}\n\n.br-tag {\n &.interaction {\n br-button {\n margin-left: var(--spacing-scale-baseh);\n }\n }\n\n &:not(.icon) {\n br-icon {\n margin-right: var(--spacing-scale-base);\n }\n }\n}\n","import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\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/tag?tab=designer).\n *\n * @slot default - Espaço de conteúdo do tag. Geralmente usado para incluir o rótulo ou um ícone.\n */\n\n// Constantes para valores fixos\nconst DENSITY_SMALL = 'small'\nconst DENSITY_MEDIUM = 'medium'\nconst DENSITY_LARGE = 'large'\n\nconst SHAPE_CIRCLE = 'circle'\nconst SHAPE_ROUNDED = 'rounded'\nconst SHAPE_DEFAULT = 'default'\n\n@Component({\n tag: 'br-tag',\n styleUrl: 'tag.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Tag {\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: HTMLBrTagElement\n\n /** API de controle de formulário nativa */\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * A propriedade 'label' é uma string que representa o texto a ser exibido no componente.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly label: string = ''\n\n /**\n * A propriedade 'iconName' define o nome do ícone que será exibido ao lado do texto.\n * O valor padrão é 'fa-solid:car', que corresponde a um ícone de carro da biblioteca Font Awesome.\n */\n @Prop({ reflect: true }) readonly iconName: string = ''\n\n /**\n * A propriedade 'name' é uma string que representa o nome do grupo da tag para seleção.\n * Ela é refletida no DOM, permitindo que alterações no valor sejam refletidas no elemento HTML correspondente.\n */\n @Prop({ reflect: true }) readonly name: string = ''\n\n /**\n * A tag permite seleção múltipla.\n * */\n @Prop({ reflect: true }) readonly multiple: boolean = false\n\n /**\n * A tag está selecionada.\n * */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-tag-${tagId++}`\n\n /**\n * A propriedade 'color' permite definir a cor do componente.\n * Aceita valores como 'red', 'blue', entre outros, e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly color: string = ''\n\n /**\n * A propriedade 'density' permite definir a densidade do componente.\n * Aceita valores como 'small', 'medium' e 'large', e é refletida no DOM.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = DENSITY_MEDIUM\n\n /**\n * A propriedade 'shape' define o formato do componente.\n * Valores possíveis:\n * - 'circle': Componente com formato circular.\n * - 'rounded': Componente com bordas arredondadas.\n * - 'default': Componente com formato padrão.\n */\n @Prop({ reflect: true }) readonly shape: 'circle' | 'rounded' | 'default' = SHAPE_DEFAULT\n\n /**\n * Transforma a tag em um indicador de status, com aparência circular.\n * É flexível podendo ser utilizado com label ou apenas a superfície circular (informação é transmitida por meio de cores).\n */\n @Prop({ reflect: true }) readonly status: boolean = false\n\n /**\n * Interação deve ser habilitada.\n */\n @Prop({ reflect: true, mutable: true }) interaction: boolean = false\n\n /**\n * Interação de seleção deve ser habilitada.\n * */\n @Prop({ reflect: true }) interactionSelect: boolean = false\n\n /**\n * Tag deve estar desabilitado.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Rótulo personalizado para leitores de tela.\n * Quando fornecido, substitui completamente o texto visível para usuários de leitores de tela.\n * Útil quando o texto visível não é suficientemente descritivo (ex: ícones, abreviações).\n */\n @Prop({ reflect: true }) readonly ariaLabel: string = null\n\n /**\n * ID do elemento que fornece descrição adicional da tag.\n * Referencia um elemento na página que contém informações complementares sobre a tag.\n * A descrição é lida após o conteúdo principal, fornecendo contexto extra aos usuários de leitores de tela.\n * Exemplo: aria-describedby=\"help-status\" onde existe <div id=\"help-status\">Aguardando aprovação</div>\n */\n @Prop({ reflect: true }) readonly ariaDescribedby: string = null\n\n /**\n * Tag está selecionada.\n */\n @State() selectedClassValue: boolean = false\n\n /**\n * Evento emitido quando a tag é selecionada.\n */\n @Event() radioSelected: EventEmitter<string>\n\n @Watch('interaction')\n handleInteractionChange(newValue: boolean) {\n if (newValue && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n @Watch('interactionSelect')\n handleInteractionSelectChange(newValue: boolean) {\n if (newValue && this.interaction) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n\n @Watch('selected')\n handleSelectedChange(newValue: boolean) {\n this.selectedClassValue = newValue\n }\n\n @Listen('radioSelected', { target: 'document' })\n handleCheckedChange(event: CustomEvent) {\n if (event.detail === this.name && this.el !== event.target) {\n this.selected = false\n }\n }\n\n componentWillLoad() {\n if (this.interaction && this.interactionSelect) {\n console.warn(\n \"Aviso: 'interaction' e 'interactionSelect' não podem ser usados ao mesmo tempo. Alterando o 'interaction' para 'false'.\"\n )\n this.interaction = false\n }\n }\n connectedCallback() {\n this.selectedClassValue = this.selected\n this.el.addEventListener('keydown', this.handleKeyDown)\n }\n\n disconnectedCallback() {\n this.el.removeEventListener('keydown', this.handleKeyDown)\n }\n /**\n * Permite navegação por teclado (setas) entre tags do tipo radio (seleção unica).\n * Funciona apenas quando 'interactionSelect' é true e 'multiple' é false.\n * Ignora tags desabilitadas.\n * @param event - Evento de teclado\n */\n private handleKeyDown = (event: KeyboardEvent) => {\n if (!this.interactionSelect || this.multiple || this.disabled) return\n\n if (event.key === 'ArrowRight') {\n event.preventDefault()\n this.selectNextRadio()\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n this.selectPreviousRadio()\n }\n }\n\n private selectNextRadio() {\n this.selectRadioByStep(1)\n }\n\n private selectPreviousRadio() {\n this.selectRadioByStep(-1)\n }\n\n private selectRadioByStep(step: number) {\n const radios = Array.from(\n document.querySelectorAll(`br-tag[interaction-select][name=\"${this.name}\"]:not([disabled])`)\n ) as HTMLElement[]\n const currentIndex = radios.indexOf(this.el)\n if (currentIndex === -1) return\n const newIndex = (currentIndex + step + radios.length) % radios.length\n this.selectRadioByIndex(radios, newIndex)\n }\n\n private selectRadioByIndex(radios: HTMLElement[], index: number) {\n const nextRadio = radios[index] as HTMLBrTagElement\n const input = nextRadio.shadowRoot?.querySelector('input[type=\"radio\"]') as HTMLInputElement | null\n if (input !== null) {\n input.focus()\n input.click()\n }\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-tag': true,\n interaction: this.interaction,\n 'interaction-select': this.interactionSelect,\n selected: this.selectedClassValue,\n disabled: this.disabled,\n [this.color]: this.color !== '',\n [DENSITY_SMALL]: this.density === DENSITY_SMALL,\n [DENSITY_MEDIUM]: this.density === DENSITY_MEDIUM,\n [DENSITY_LARGE]: this.density === DENSITY_LARGE,\n count: this.shape === SHAPE_ROUNDED,\n icon: this.shape === SHAPE_CIRCLE,\n status: this.status,\n }\n }\n\n private getTagAttributes() {\n if (this.interaction) {\n return {\n id: this.customId,\n }\n }\n\n return {\n id: this.customId,\n role: this.getRole(),\n 'aria-label': this.getAriaLabel(),\n 'aria-describedby': this.getAriaDescribedBy(),\n 'aria-checked': this.getAriaChecked(),\n 'aria-disabled': this.getAriaDisabled(),\n }\n }\n\n private getAriaDescribedBy(): string | null {\n const hostTitle = this.el.getAttribute('title')\n if (this.hasContent(hostTitle)) {\n return null\n }\n\n const hasInternalLabel = !this.status && this.label !== ''\n\n if (this.ariaDescribedby && this.ariaDescribedby.trim() !== '') {\n return this.ariaDescribedby\n }\n\n if (hasInternalLabel && !this.hasContent(this.ariaLabel)) {\n return `${this.customId}-label`\n }\n\n return null\n }\n\n /**\n * Verifica se uma string possui conteúdo válido (não vazia após remover espaços em branco).\n * @param value - String a ser verificada\n * @returns {boolean} true se a string possui conteúdo\n */\n private hasContent(value: string): boolean {\n return value?.trim().length > 0\n }\n\n private getAriaLabel(): string | null {\n return this.ariaLabel && this.ariaLabel.trim() !== '' ? this.ariaLabel : null\n }\n\n private getRole(): string | null {\n const hostTitle = this.el.getAttribute('title')\n if (this.hasContent(hostTitle)) {\n return null\n }\n\n if (this.interactionSelect) return this.multiple ? 'checkbox' : 'radio'\n return 'status'\n }\n\n private getAriaChecked(): string | null {\n return this.interactionSelect ? (this.selected ? 'true' : 'false') : null\n }\n\n private getAriaDisabled(): string | null {\n return this.disabled ? 'true' : null\n }\n\n private renderIcon() {\n return this.iconName && this.iconName.trim() !== '' ? (\n <br-icon icon-name={this.iconName} aria-hidden=\"true\" />\n ) : null\n }\n\n private renderLabel() {\n return this.shape !== SHAPE_CIRCLE && !this.status ? <span id={`${this.customId}-label`}>{this.label}</span> : null\n }\n\n private renderCloseButton() {\n if (!this.interaction) return null\n return (\n <br-button\n shape=\"circle\"\n emphasis=\"primary\"\n density=\"small\"\n aria-label={`Fechar ${this.label || 'tag'}`}\n onClick={this.handleClose}\n disabled={this.disabled}\n >\n <br-icon icon-name=\"fa-solid:times\" aria-hidden=\"true\"></br-icon>\n </br-button>\n )\n }\n\n private renderStatusLabel() {\n return this.status ? <span class=\"tag-spacing-status\">{this.label}</span> : null\n }\n\n private handleClose = () => {\n this.el.remove()\n }\n\n private handleChangeValueChecked = () => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n }\n this.selected = !this.selected\n }\n\n private handleChangeRadioValue = (event: MouseEvent) => {\n if (!this.multiple) {\n this.radioSelected.emit(this.name)\n this.selected = (event.target as HTMLInputElement).checked\n }\n }\n\n private renderMainTagContent() {\n return (\n <span class={this.getCssClassMap()} {...this.getTagAttributes()}>\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderCloseButton()}\n <slot></slot>\n </span>\n )\n }\n\n private renderStatusLayout(content: JSX.Element) {\n return (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {content}\n {this.renderStatusLabel()}\n </span>\n )\n }\n\n private handleInputChange = (event: MouseEvent) => {\n if (this.multiple) {\n this.handleChangeValueChecked()\n } else {\n this.handleChangeRadioValue(event)\n }\n }\n\n private renderInteractionSelectTag() {\n if (!this.interactionSelect) {\n return null\n }\n\n return (\n <span class={this.getCssClassMap()} id={this.customId}>\n <input\n id={`input-${this.customId}`}\n type={this.multiple ? 'checkbox' : 'radio'}\n name={this.name}\n value={this.label}\n checked={this.selected}\n onClick={this.handleInputChange}\n disabled={this.disabled}\n />\n <label htmlFor={`input-${this.customId}`}>\n {this.renderIcon()}\n {this.renderLabel()}\n </label>\n </span>\n )\n }\n\n render() {\n const mainContent = this.renderMainTagContent()\n\n return (\n <Host>\n {this.interactionSelect\n ? this.renderInteractionSelectTag()\n : this.status\n ? this.renderStatusLayout(mainContent)\n : mainContent}\n </Host>\n )\n }\n}\n\nlet tagId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,MAAM,GAAG,+v1EAA+v1E;;ACgB9w1E;;;;AAIG;AAEH;AACA,MAAM,aAAa,GAAG,OAAO;AAC7B,MAAM,cAAc,GAAG,QAAQ;AAC/B,MAAM,aAAa,GAAG,OAAO;AAE7B,MAAM,YAAY,GAAG,QAAQ;AAC7B,MAAM,aAAa,GAAG,SAAS;AAC/B,MAAM,aAAa,GAAG,SAAS;MAQlB,GAAG,GAAA,MAAA;AANhB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;;AAgBE;;;AAGG;AAC+B,QAAA,IAAK,CAAA,KAAA,GAAW,EAAE;AAEpD;;;AAGG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAW,EAAE;AAEvD;;;AAGG;AAC+B,QAAA,IAAI,CAAA,IAAA,GAAW,EAAE;AAEnD;;AAEK;AAC6B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;AAEK;AACmC,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAEjE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,UAAU,KAAK,EAAE,EAAE;AAExE;;;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,IAAI,CAAC,0BAA0B;cAC/B,IAAI,CAAC;AACL,kBAAE,IAAI,CAAC,kBAAkB,CAAC,WAAW;AACrC,kBAAE,WAAW,CACZ;;;;;;;;;;AAKb,IAAI,KAAK,GAAG,CAAC;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"br-textarea.entry.esm.js","sources":["../../packages/webcomponents/src/components/textarea/textarea.scss?tag=br-textarea&encapsulation=shadow","../../packages/webcomponents/src/components/textarea/textarea.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/textarea/textarea\";\n\n:host {\n display: inline-block;\n box-sizing: border-box;\n font-family: Rawline, Raleway, sans-serif;\n}\n","import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\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/textarea?tab=designer).\n *\n * @slot default - Espaço de conteúdo do textarea. Geralmente usado para incluir texto adicional ou instruções para o usuário.\n */\n@Component({\n tag: 'br-textarea',\n styleUrl: 'textarea.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Textarea {\n @Element() el: HTMLBrTextareaElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Valor exibido no textarea.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ mutable: true, reflect: true }) value: string\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) readonly label: 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 }) readonly placeholder: string\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-textarea-${textareaId++}`\n\n /**\n * Indica se o textarea está desabilitado. Quando verdadeiro, o usuário não pode interagir com o campo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Número máximo de caracteres permitidos no textarea. Se definido como 0, não há limite.\n */\n @Prop({ reflect: true }) readonly maxlength: number = 0\n\n /**\n * Mostra o contador com a quantidade máxima de caracteres.\n */\n @Prop({ reflect: true }) readonly showCounter: boolean = false\n\n /**\n * Define o estado visual do componente, podendo ser 'danger', 'success' ou 'warning'.\n */\n @Prop({ reflect: true }) readonly state: 'danger' | 'success' | 'warning'\n /**\n * Ajusta a densidade do componente, podendo ser 'small', 'medium' ou 'large'.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = 'medium'\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Comprimento atual do texto no textarea. É atualizado sempre que o valor do textarea muda.\n */\n @State() currentLength: number\n\n componentWillLoad() {\n this.currentLength = this.value?.length\n }\n\n /**\n * Valor atualizado do textarea\n */\n @Event() valueChange: EventEmitter<string>\n\n @Watch('value')\n valueChanged() {\n this.currentLength = this.value?.length\n }\n\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.currentLength = this.value?.length\n this.valueChange.emit(this.value)\n }\n\n /**\n * Define um novo valor para o textarea.\n * @param newValue - O novo valor a ser definido.\n */\n @Method()\n async setValue(newValue: string) {\n this.value = newValue\n this.currentLength = this.value?.length\n this.valueChange.emit(this.value)\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-textarea': true,\n small: this.density === 'small',\n medium: this.density === 'medium',\n large: this.density === 'large',\n success: this.state === 'success',\n danger: this.state === 'danger',\n warning: this.state === 'warning',\n }\n }\n\n render() {\n const caracteresRestantes: number = this.maxlength - this.currentLength\n const mostrarLimite = this.currentLength > 0\n\n return (\n <Host>\n <div class={this.getCssClassMap()}>\n <div class={this.isInline ? 'row' : ''}>\n {this.isInline ? (\n <div class=\"col-auto pt-half\">\n <label htmlFor={this.customId}>{this.label}</label>\n </div>\n ) : (\n <label htmlFor={this.customId}>{this.label}</label>\n )}\n <div class={this.isInline ? 'col' : ''}>\n <textarea\n id={this.customId}\n value={this.value}\n placeholder={this.placeholder}\n disabled={this.disabled}\n onInput={this.handleInput}\n {...(this.maxlength > 0 ? { maxLength: this.maxlength } : {})}\n ></textarea>\n <div class=\"text-base mt-1\">\n {this.showCounter && (\n <div>\n {mostrarLimite ? (\n <span class=\"restantes\" aria-live=\"polite\" role=\"status\" id=\"limitMax\">\n Restam <strong>{caracteresRestantes}</strong> caracteres\n </span>\n ) : (\n <span class=\"limit\" aria-live=\"polite\">\n Limite máximo de <strong>{this.maxlength}</strong> caracteres\n </span>\n )}\n </div>\n )}\n </div>\n <slot></slot>\n </div>\n </div>\n </div>\n </Host>\n )\n }\n}\n\nlet textareaId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,WAAW,GAAG,y43DAAy43D;;MC2Bh53D,QAAQ,GAAA,MAAA;AANrB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;;AA2BE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,eAAe,UAAU,EAAE,EAAE;AAElF;;AAEG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;AAEG;AAC+B,QAAA,IAAS,CAAA,SAAA,GAAW,CAAC;AAEvD;;AAEG;AAC+B,QAAA,IAAW,CAAA,WAAA,GAAY,KAAK;AAM9D;;AAEG;AAC+B,QAAA,IAAO,CAAA,OAAA,GAAiC,QAAQ;AAElF;;AAEG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAqB1C,QAAA,IAAA,CAAA,WAAW,GAAG,CAAC,KAAY,KAAI;YAC9C,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK;YACrD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM;YACvC,IAAI,CAAC,WAAW,CAAC,I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AAK,EAAC,OAAO,EAAA,WAAA,EAAW,QAAQ,EAAA,4BACnB,CAAS,CAAA,QAAA,EAAA,IAAA,EAAA,IAAI,CAAC,SAAS,CAAU,gBAC7C,CACR,CACG,CACP,CACG,EACN,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACT,CACF,CACF,CACD;;;;;;;;AAKb,IAAI,UAAU,GAAG,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"br-textarea.entry.esm.js","sources":["../../packages/webcomponents/src/components/textarea/textarea.scss?tag=br-textarea&encapsulation=shadow","../../packages/webcomponents/src/components/textarea/textarea.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/textarea/textarea\";\n\n:host {\n display: inline-block;\n box-sizing: border-box;\n font-family: Rawline, Raleway, sans-serif;\n}\n","import {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\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/textarea?tab=designer).\n *\n * @slot default - Espaço de conteúdo do textarea. Geralmente usado para incluir texto adicional ou instruções para o usuário.\n */\n@Component({\n tag: 'br-textarea',\n styleUrl: 'textarea.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Textarea {\n @Element() el: HTMLBrTextareaElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Valor exibido no textarea.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ mutable: true, reflect: true }) value: string\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) readonly label: 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 }) readonly placeholder: string\n\n /**\n * Texto alternativo para acessibilidade quando não há label visível.\n * Fornece um rótulo para tecnologias assistivas sem exibir visualmente.\n */\n @Prop({ reflect: true }) readonly ariaLabel: string\n\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-textarea-${textareaId++}`\n\n /**\n * Indica se o textarea está desabilitado. Quando verdadeiro, o usuário não pode interagir com o campo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Número máximo de caracteres permitidos no textarea. Se definido como 0, não há limite.\n */\n @Prop({ reflect: true }) readonly maxlength: number = 0\n\n /**\n * Mostra o contador com a quantidade máxima de caracteres.\n */\n @Prop({ reflect: true }) readonly showCounter: boolean = false\n\n /**\n * Define o estado visual do componente, podendo ser 'danger', 'success' ou 'warning'.\n */\n @Prop({ reflect: true }) readonly state: 'danger' | 'success' | 'warning'\n /**\n * Ajusta a densidade do componente, podendo ser 'small', 'medium' ou 'large'.\n */\n @Prop({ reflect: true }) readonly density: 'small' | 'medium' | 'large' = 'medium'\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Comprimento atual do texto no textarea. É atualizado sempre que o valor do textarea muda.\n */\n @State() currentLength: number\n\n componentWillLoad() {\n this.currentLength = this.value?.length || 0\n }\n\n /**\n * Valor atualizado do textarea\n */\n @Event() valueChange: EventEmitter<string>\n\n @Watch('value')\n valueChanged() {\n this.currentLength = this.value?.length || 0\n }\n\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.currentLength = this.value?.length || 0\n this.valueChange.emit(this.value)\n }\n\n /**\n * Define um novo valor para o textarea.\n * @param newValue - O novo valor a ser definido.\n */\n @Method()\n async setValue(newValue: string) {\n this.value = newValue\n this.currentLength = this.value?.length || 0\n this.valueChange.emit(this.value)\n }\n\n /**\n * Retorna os ids para o atributo aria-describedby do textarea\n */\n private getDescribedBy(): string {\n return [this.showCounter ? `${this.customId}-limitMax` : null, `${this.customId}-slotInfo`]\n .filter(Boolean)\n .join(' ')\n }\n\n /**\n * Determina o texto a ser usado para acessibilidade quando não há label\n * Ordem de prioridade:\n * - aria-label do elemento host\n * - propriedade ariaLabel do componente\n * - placeholder\n * - texto padrão (\"Campo de texto\")\n */\n private getAccessibilityLabel(): string {\n const hostAriaLabel = this.el.getAttribute('aria-label')\n\n return hostAriaLabel && hostAriaLabel.trim() !== ''\n ? hostAriaLabel\n : this.ariaLabel && this.ariaLabel.trim() !== ''\n ? this.ariaLabel\n : this.placeholder && this.placeholder.trim() !== ''\n ? this.placeholder\n : 'Campo de texto'\n }\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-textarea': true,\n small: this.density === 'small',\n medium: this.density === 'medium',\n large: this.density === 'large',\n success: this.state === 'success',\n danger: this.state === 'danger',\n warning: this.state === 'warning',\n }\n }\n\n render() {\n const caracteresRestantes: number = this.maxlength - this.currentLength\n const mostrarLimite = this.currentLength > 0\n const hasLabel = !!this.label\n\n return (\n <Host>\n <div class={this.getCssClassMap()}>\n <div class={this.isInline ? 'row' : ''}>\n {this.isInline ? (\n <div class=\"col-auto pt-half\">\n <label htmlFor={this.customId}>{this.label}</label>\n </div>\n ) : (\n <label htmlFor={this.customId}>{this.label}</label>\n )}\n\n <div class={this.isInline ? 'col' : ''}>\n <textarea\n id={this.customId}\n value={this.value}\n placeholder={this.placeholder}\n disabled={this.disabled}\n onInput={this.handleInput}\n {...(this.maxlength > 0 ? { maxLength: this.maxlength } : {})}\n aria-describedby={this.getDescribedBy()}\n {...(!hasLabel ? { 'aria-label': this.getAccessibilityLabel() } : {})}\n ></textarea>\n <div class=\"text-base mt-1\">\n {this.showCounter && (\n <div>\n {mostrarLimite ? (\n <span class=\"restantes\" aria-live=\"polite\" role=\"status\" id={`${this.customId}-limitMax`}>\n Restam <strong>{caracteresRestantes}</strong> caracteres\n </span>\n ) : (\n <span class=\"limit\" aria-live=\"polite\" id={`${this.customId}-limitMax`}>\n Limite máximo de <strong>{this.maxlength}</strong> caracteres\n </span>\n )}\n </div>\n )}\n </div>\n <div id={`${this.customId}-slotInfo`} aria-live=\"polite\">\n <slot></slot>\n </div>\n </div>\n </div>\n </div>\n </Host>\n )\n }\n}\n\nlet textareaId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,WAAW,GAAG,y43DAAy43D;;MC2Bh53D,QAAQ,GAAA,MAAA;AANrB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;;AAiCE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,eAAe,UAAU,EAAE,EAAE;AAElF;;AAEG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAE3D;;AAEG;AAC+B,QAAA,IAAS,CAAA,SAAA,GAAW,CAAC;AAEvD;;AAEG;AAC+B,QAAA,IAAW,CAAA,WAAA,GAAY,KAAK;AAM9D;;AAEG;AAC+B,QAAA,IAAO,CAAA,OAAA,GAAiC,QAAQ;AAElF;;AAEG;AAC+B,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAqB1C,QAAA,IAAA,CAAA,WAAW,GAAG,CAAC,KAAY,KAAI;YAC9C,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK;YACrD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;YAC5C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACnC,SAAC;AA0GF;IA5HC,iBAAiB,GAAA;QACf,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;;IAS9C,YAAY,GAAA;QACV,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;;AAS9C;;;AAGG;IAEH,MAAM,QAAQ,CAAC,QAAgB,EAAA;AAC7B,QAAA,IAAI,CAAC,KAAK,GAAG,QAAQ;QACrB,IAAI,CAAC,aAAa,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IAAC,CAAC,QAAQ,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,qBAAqB,EAAE,EAAE,GAAG,EAAE,CAAC,EAC3D,CAAA,EACZ,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,gBAAgB,EAAA,EACxB,IAAI,CAAC,WAAW,KACf,CACG,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAA,aAAa,IACZ,CAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAC,WAAW,EAAA,WAAA,EAAW,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAW,SAAA,CAAA,EAAA,aAC/E,CAAA,CAAA,QAAA,EAAA,IAAA,EAAS,mBAAmB,CAAU,EACxC,aAAA,CAAA,KAEP,CAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAC,OAAO,EAAW,WAAA,EAAA,QAAQ,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAW,SAAA,CAAA,EAAA,4BACnD,CAAS,CAAA,QAAA,EAAA,IAAA,EAAA,IAAI,CAAC,SAAS,CAAU,gBAC7C,CACR,CACG,CACP,CACG,EACN,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAE,EAAE,CAAA,EAAG,IAAI,CAAC,QAAQ,WAAW,eAAY,QAAQ,EAAA,EACtD,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACT,CACF,CACF,CACF,CACD;;;;;;;;AAKb,IAAI,UAAU,GAAG,CAAC;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"br-upload.entry.esm.js","sources":["../../packages/webcomponents/src/components/upload/upload.scss?tag=br-upload&encapsulation=shadow","../../packages/webcomponents/src/components/upload/upload.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/upload/upload\";\n\n:host {\n display: block;\n}\n\n.br-upload {\n br-icon {\n margin-right: var(--spacing-scale-base);\n }\n}\n","import { AttachInternals, Component, Element, h, Host, Prop, State } from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\nenum UploadState {\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n SUCCESS = 'success',\n}\n\n/**\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/upload?tab=designer).\n *\n * @slot default - Descrição do slot\n */\n@Component({\n tag: 'br-upload',\n styleUrl: 'upload.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Upload {\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!: HTMLBrUploadElement\n\n /**\n * Tipos de arquivo permitidos (ex: 'image/*').\n * Esta propriedade define quais tipos de arquivos podem ser selecionados para upload.\n */\n @Prop() accept: string = ''\n\n /**\n * Texto descritivo do campo de upload.\n * Este é o texto que é mostrado no label do textarea.\n */\n @Prop() label: string = 'Envio de arquivo'\n\n /**\n * Evento emitido quando um arquivo é selecionado.\n * Este estado armazena os arquivos que foram selecionados pelo usuário.\n */\n @State() filesSelected: FileList | null = null\n\n /**\n * Referência ao elemento de arquivo selecionado.\n * Este estado armazena o arquivo que foi selecionado para upload.\n */\n @State() file: File | null = null\n\n /**\n * Indica se o componente está desativado.\n * Quando definido como `true`, o campo de upload se torna não interativo,\n * impedindo que o usuário selecione ou envie arquivos.\n * Isso é útil para controlar a interação do usuário em situações específicas,\n * como durante o carregamento de dados ou quando o formulário está em um estado inválido.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Define o estado visual da mensagem.\n * Os possíveis valores são:\n * - 'info': Mensagem informativa.\n * - 'warning': Mensagem de aviso.\n * - 'danger': Mensagem de erro ou alerta.\n * - 'success': Mensagem de sucesso.\n * O valor padrão é 'info'.\n */\n @Prop({ reflect: true }) state: string = UploadState.INFO\n\n /**\n * Indica se o componente permite a seleção de múltiplos arquivos.\n * Quando definido como `true`, o usuário pode selecionar mais de um arquivo para upload.\n */\n @Prop() multiple: boolean = false\n\n @AttachInternals() elementInternals: ElementInternals\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-upload': true,\n [this.state]: true,\n }\n }\n\n private handleRemoveFileSelection(file: File) {\n const newArrayFilter = Array.from(this.filesSelected).filter((f) => f !== file)\n this.filesSelected = newArrayFilter as unknown as FileList\n const fileInput = this.el.shadowRoot.getElementById('single-file') as HTMLInputElement\n fileInput.value = ''\n }\n\n private renderFilesUploaded() {\n const fileSizes = this._calculateFileSize(this.filesSelected)\n\n return fileSizes.map(({ file, size }) => {\n return (\n <div class=\"br-item d-flex\" key={file.name}>\n <div class=\"content text-primary-default mr-auto\">{file.name}</div>\n <div class=\"support mr-n2\">\n <span class=\"\">{size}</span>\n <br-button\n shape=\"circle\"\n type=\"button\"\n aria-label=\"Remover arquivo\"\n onClick={() => this.handleRemoveFileSelection(file)}\n >\n <br-icon icon-name=\"fa-solid:trash\" aria-hidden=\"true\"></br-icon>\n </br-button>\n </div>\n </div>\n )\n })\n }\n\n private onInputChange(files: FileList) {\n if (files.length === 1) {\n this.filesSelected = files\n } else if (files.length > 0) {\n this.filesSelected = files\n } else {\n console.error(files.length === 0 ? 'NENHUM ARQUIVO ENVIADO' : 'VOCÊ SÓ PODE ENVIAR UM ARQUIVO POR VEZ')\n\n return false\n }\n }\n\n private _calculateFileSize(files: FileList) {\n return Array.from(files).map((file) => {\n let sOutput = ''\n const aMultiples = ['KB', 'MB', 'GB', 'TB']\n let nMultiple = 0\n let nApprox = file.size / 1024\n\n if (nApprox < 1) {\n sOutput = `${file.size} bytes`\n } else {\n while (nApprox > 1 && nMultiple < aMultiples.length) {\n sOutput = `${nApprox.toFixed(2)} ${aMultiples[nMultiple]}`\n nApprox /= 1024\n nMultiple++\n }\n }\n\n return { file: file, size: sOutput || 0 }\n })\n }\n\n private handleDrop(event: DragEvent) {\n event.preventDefault()\n const files = event.dataTransfer?.files\n if (files && files.length > 0) {\n this.onInputChange(files)\n }\n }\n\n private handleDragOver(event: DragEvent) {\n event.preventDefault()\n }\n\n private handleFileSelection() {\n const fileInput = this.el.shadowRoot.getElementById('single-file') as HTMLInputElement\n fileInput.click()\n }\n\n private readonly handleInputChange = (event: Event) => {\n const target = event.target as HTMLInputElement\n this.onInputChange(target.files)\n }\n\n render() {\n return (\n <Host>\n <div class={this.getCssClassMap()}>\n <label class=\"upload-label\" form=\"single-file\">\n <span>{this.label}</span>\n </label>\n <button\n class=\"upload-button\"\n type=\"button\"\n tabIndex={this.disabled ? -1 : 0}\n disabled={this.disabled}\n aria-label=\"Selecionar arquivo para upload\"\n onClick={() => this.handleFileSelection()}\n onDrop={(event) => this.handleDrop(event)}\n onDragOver={(event) => this.handleDragOver(event)}\n >\n <br-icon icon-name=\"fa-solid:upload\" height=\"16\" aria-hidden=\"true\"></br-icon>\n <span>Selecione o arquivo</span>\n </button>\n\n <input\n class=\"upload-input\"\n id=\"single-file\"\n type=\"file\"\n aria-label=\"enviar arquivo\"\n onChange={this.handleInputChange}\n multiple={this.multiple}\n disabled={this.disabled}\n accept={this.accept}\n />\n <div id=\"list-files\" class=\"upload-list\">\n {this.filesSelected ? this.renderFilesUploaded() : null}\n </div>\n </div>\n </Host>\n )\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,8g7DAA8g7D;;ACIhi7D,IAAK,WAKJ;AALD,CAAA,UAAK,WAAW,EAAA;AACd,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EALI,WAAW,KAAX,WAAW,GAKf,EAAA,CAAA,CAAA;MAaY,MAAM,GAAA,MAAA;AANnB,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GAAA,EAAA,0CAAA,EAAA,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,aAAa,EACrC,EAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,GAAG,IAAI,CACnD,CACF,CACD;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"br-upload.entry.esm.js","sources":["../../packages/webcomponents/src/components/upload/upload.scss?tag=br-upload&encapsulation=shadow","../../packages/webcomponents/src/components/upload/upload.tsx"],"sourcesContent":["@import \"~@govbr-ds/core/src/components/upload/upload\";\n\n:host {\n display: block;\n}\n\n.br-upload {\n br-icon {\n margin-right: var(--spacing-scale-base);\n }\n}\n","import { AttachInternals, Component, Element, h, Host, Prop, State } from '@stencil/core'\n\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/upload?tab=designer).\n *\n * @slot default - Texto personalizado para o botão de upload. Se não fornecido, será exibido \"Selecione o arquivo\" como texto padrão.\n * Use este slot para personalizar o texto do botão de acordo com o contexto do upload, por exemplo: \"Anexar documentos\",\n * \"Enviar imagens\", etc.\n */\n@Component({\n tag: 'br-upload',\n styleUrl: 'upload.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Upload {\n /**\n * Identificador único.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) readonly customId: string = `br-upload-${uploadId++}`\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!: HTMLBrUploadElement\n\n /**\n * Tipos de arquivo permitidos (ex: 'image/*').\n * Esta propriedade define quais tipos de arquivos podem ser selecionados para upload.\n */\n @Prop() accept: string = ''\n\n /**\n * Rótulo principal do campo de upload.\n * Este texto ajuda usuários de leitores de tela a identificarem o propósito do upload.\n * Exemplos: \"Anexar comprovante\", \"Enviar foto do documento\".\n *\n * @default \"Envio de arquivo\"\n */\n @Prop() label: string = 'Envio de arquivo'\n\n /**\n * Evento emitido quando um arquivo é selecionado.\n * Este estado armazena os arquivos que foram selecionados pelo usuário.\n */\n @State() filesSelected: FileList | null = null\n\n /**\n * Referência ao elemento de arquivo selecionado.\n * Este estado armazena o arquivo que foi selecionado para upload.\n */\n @State() file: File | null = null\n\n /**\n * Indica se o componente está desativado.\n * Quando definido como `true`, o campo de upload se torna não interativo,\n * impedindo que o usuário selecione ou envie arquivos.\n * Isso é útil para controlar a interação do usuário em situações específicas,\n * como durante o carregamento de dados ou quando o formulário está em um estado inválido.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Define o estado visual da mensagem.\n * Os possíveis valores são:\n * - 'info': Mensagem informativa.\n * - 'warning': Mensagem de aviso.\n * - 'danger': Mensagem de erro ou alerta.\n * - 'success': Mensagem de sucesso.\n * O valor padrão é 'info'.\n */\n @Prop({ reflect: true }) state: 'info' | 'warning' | 'danger' | 'success'\n\n /**\n * Indica se o componente permite a seleção de múltiplos arquivos.\n * Quando definido como `true`, o usuário pode selecionar mais de um arquivo para upload.\n */\n @Prop() multiple: boolean = false\n\n @AttachInternals() elementInternals: ElementInternals\n\n private getCssClassMap(): CssClassMap {\n return {\n 'br-upload': true,\n [this.state]: true,\n }\n }\n\n private handleRemoveFileSelection(file: File) {\n const newArrayFilter = Array.from(this.filesSelected).filter((f) => f !== file)\n this.filesSelected = newArrayFilter as unknown as FileList\n const fileInput = this.el.shadowRoot.getElementById(`single-file-${this.customId}`) as HTMLInputElement\n fileInput.value = ''\n }\n\n private renderFilesUploaded() {\n const fileSizes = this._calculateFileSize(this.filesSelected)\n return fileSizes.map(({ file, size }) => {\n return (\n <div class=\"br-item d-flex\" key={file.name} role=\"listitem\">\n <div class=\"content text-primary-default mr-auto\">{file.name}</div>\n <div class=\"support mr-n2\">\n <span class=\"\">{size}</span>\n <br-button\n shape=\"circle\"\n type=\"button\"\n aria-label={`Remover arquivo ${file.name}`}\n onClick={() => this.handleRemoveFileSelection(file)}\n >\n <br-icon icon-name=\"fa-solid:trash\" aria-hidden=\"true\"></br-icon>\n </br-button>\n </div>\n </div>\n )\n })\n }\n\n private onInputChange(files: FileList) {\n if (files.length === 1) {\n this.filesSelected = files\n } else if (files.length > 0) {\n this.filesSelected = files\n } else {\n console.error(files.length === 0 ? 'NENHUM ARQUIVO ENVIADO' : 'VOCÊ SÓ PODE ENVIAR UM ARQUIVO POR VEZ')\n\n return false\n }\n }\n\n private _calculateFileSize(files: FileList) {\n return Array.from(files).map((file) => {\n let sOutput = ''\n const aMultiples = ['KB', 'MB', 'GB', 'TB']\n let nMultiple = 0\n let nApprox = file.size / 1024\n\n if (nApprox < 1) {\n sOutput = `${file.size} bytes`\n } else {\n while (nApprox > 1 && nMultiple < aMultiples.length) {\n sOutput = `${nApprox.toFixed(2)} ${aMultiples[nMultiple]}`\n nApprox /= 1024\n nMultiple++\n }\n }\n\n return { file: file, size: sOutput || 0 }\n })\n }\n\n private handleDrop(event: DragEvent) {\n event.preventDefault()\n const files = event.dataTransfer?.files\n if (files && files.length > 0) {\n this.onInputChange(files)\n }\n }\n\n private handleDragOver(event: DragEvent) {\n event.preventDefault()\n }\n\n private handleFileSelection() {\n const fileInput = this.el.shadowRoot.getElementById(`single-file-${this.customId}`) as HTMLInputElement\n fileInput.click()\n }\n\n private readonly handleInputChange = (event: Event) => {\n const target = event.target as HTMLInputElement\n this.onInputChange(target.files)\n }\n\n render() {\n return (\n <Host>\n <div class={this.getCssClassMap()} id={this.customId}>\n <label id={`label-${this.customId}`} class=\"upload-label\" htmlFor={`single-file-${this.customId}`}>\n <span>{this.label}</span>\n </label>\n <input\n class=\"upload-input\"\n id={`single-file-${this.customId}`}\n type=\"file\"\n onChange={this.handleInputChange}\n multiple={this.multiple}\n disabled={this.disabled}\n accept={this.accept}\n aria-labelledby={`label-${this.customId}`}\n />\n <button\n class=\"upload-button\"\n type=\"button\"\n disabled={this.disabled}\n onClick={() => this.handleFileSelection()}\n onDrop={(event) => this.handleDrop(event)}\n onDragOver={(event) => this.handleDragOver(event)}\n aria-describedby={`label-${this.customId}`}\n >\n <br-icon icon-name=\"fa-solid:upload\" height=\"16\" aria-hidden=\"true\"></br-icon>\n <slot>\n <span>Selecione o arquivo</span>\n </slot>\n </button>\n {this.filesSelected && (\n <div id={`${this.customId}-list-files`} class=\"upload-list\" role=\"list\">\n {this.renderFilesUploaded()}\n </div>\n )}\n </div>\n </Host>\n )\n }\n}\nlet uploadId = 0\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,8g7DAA8g7D;;MCiBnh7D,MAAM,GAAA,MAAA;AANnB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;;;;;AAOE;;;AAGG;AAC+B,QAAA,IAAA,CAAA,QAAQ,GAAW,aAAa,QAAQ,EAAE,EAAE;AAO9E;;;AAGG;AACK,QAAA,IAAM,CAAA,MAAA,GAAW,EAAE;AAE3B;;;;;;AAMG;AACK,QAAA,IAAK,CAAA,KAAA,GAAW,kBAAkB;AAE1C;;;AAGG;AACM,QAAA,IAAa,CAAA,aAAA,GAAoB,IAAI;AAE9C;;;AAGG;AACM,QAAA,IAAI,CAAA,IAAA,GAAgB,IAAI;AAEjC;;;;;;AAMG;AACsB,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AAalD;;;AAGG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK;AA0FhB,QAAA,IAAA,CAAA,iBAAiB,GAAG,CAAC,KAAY,KAAI;AACpD,YAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAA0B;AAC/C,YAAA,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;AAClC,SAAC;AA0CF;IAnIS,cAAc,GAAA;QACpB,OAAO;AACL,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI;SACnB;;AAGK,IAAA,yBAAyB,CAAC,IAAU,EAAA;QAC1C,MAAM,cAAc,GAAG,KAAK,CAAC,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