@govbr-ds/webcomponents 2.1.1 → 2.1.2

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 (191) hide show
  1. package/README.md +0 -11
  2. package/cem/custom-elements.json +209 -8
  3. package/dist/cjs/br-cookiebar-link.cjs.entry.js +2 -1
  4. package/dist/cjs/br-date-picker_3.cjs.entry.js +2 -1
  5. package/dist/cjs/br-datetime-picker.cjs.entry.js +1 -2
  6. package/dist/cjs/br-dropdown_2.cjs.entry.js +252 -108
  7. package/dist/cjs/br-header-logo.cjs.entry.js +2 -1
  8. package/dist/cjs/br-icon.cjs.entry.js +1 -1
  9. package/dist/cjs/br-item.cjs.entry.js +25 -14
  10. package/dist/cjs/br-link.cjs.entry.js +2 -1
  11. package/dist/cjs/br-magic-button.cjs.entry.js +2 -1
  12. package/dist/cjs/br-menu-link.cjs.entry.js +2 -1
  13. package/dist/cjs/br-select-input_3.cjs.entry.js +45 -11
  14. package/dist/cjs/br-sign-in.cjs.entry.js +2 -1
  15. package/dist/cjs/br-slider.cjs.entry.js +1 -2
  16. package/dist/cjs/br-tag.cjs.entry.js +2 -3
  17. package/dist/cjs/br-upload.cjs.entry.js +2 -3
  18. package/dist/cjs/index-CRdcutym.js +4 -4
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/cjs/webcomponents.cjs.js +1 -1
  21. package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.js +2 -1
  22. package/dist/collection/components/datetime-picker/datetime-input/datetime-input.js +2 -1
  23. package/dist/collection/components/datetime-picker/datetime-picker.js +1 -2
  24. package/dist/collection/components/header/header-logo/header-logo.js +2 -1
  25. package/dist/collection/components/icon/icon.js +1 -1
  26. package/dist/collection/components/item/item.js +25 -14
  27. package/dist/collection/components/link/link.js +2 -1
  28. package/dist/collection/components/magic-button/magic-button.js +2 -1
  29. package/dist/collection/components/menu/menu-link/menu-link.js +2 -1
  30. package/dist/collection/components/select/select-input/select-input.js +2 -1
  31. package/dist/collection/components/select/select-list/select-list.js +17 -5
  32. package/dist/collection/components/select/select-option/select-option.js +28 -7
  33. package/dist/collection/components/select/select.js +226 -109
  34. package/dist/collection/components/select/select.utils.js +34 -0
  35. package/dist/collection/components/sign-in/sign-in.js +2 -1
  36. package/dist/collection/components/slider/slider.js +1 -2
  37. package/dist/collection/components/tag/tag.js +2 -3
  38. package/dist/collection/components/upload/upload.js +2 -3
  39. package/dist/collection/pages/scripts/component-controls.js +13 -4
  40. package/dist/collection/pages/scripts/menu.js +11 -2
  41. package/dist/collection/pages/scripts/pageLoader.js +3 -1
  42. package/dist/components/br-avatar.js +1 -1
  43. package/dist/components/br-breadcrumb.js +1 -1
  44. package/dist/components/br-carousel.js +1 -1
  45. package/dist/components/br-checkbox-group.js +1 -1
  46. package/dist/components/br-checkbox.js +1 -1
  47. package/dist/components/br-checkgroup.js +1 -1
  48. package/dist/components/br-collapse.js +1 -1
  49. package/dist/components/br-cookiebar-cookie.js +1 -1
  50. package/dist/components/br-cookiebar-group.js +1 -1
  51. package/dist/components/br-cookiebar-link.js +1 -1
  52. package/dist/components/br-cookiebar-note-group.js +1 -1
  53. package/dist/components/br-cookiebar.js +1 -1
  54. package/dist/components/br-date-picker.js +1 -1
  55. package/dist/components/br-datetime-input.js +1 -1
  56. package/dist/components/br-datetime-picker.js +1 -1
  57. package/dist/components/br-dropdown.js +1 -1
  58. package/dist/components/br-footer-category.js +1 -1
  59. package/dist/components/br-footer-item.js +1 -1
  60. package/dist/components/br-footer-social.js +1 -1
  61. package/dist/components/br-header-function.js +1 -1
  62. package/dist/components/br-header-link.js +1 -1
  63. package/dist/components/br-header-list.js +1 -1
  64. package/dist/components/br-header-logo.js +1 -1
  65. package/dist/components/br-header.js +1 -1
  66. package/dist/components/br-icon.js +1 -1
  67. package/dist/components/br-input.js +1 -1
  68. package/dist/components/br-item.js +1 -1
  69. package/dist/components/br-link.js +1 -1
  70. package/dist/components/br-list.js +1 -1
  71. package/dist/components/br-magic-button.js +1 -1
  72. package/dist/components/br-menu-header.js +1 -1
  73. package/dist/components/br-menu-item.js +1 -1
  74. package/dist/components/br-menu-link.js +1 -1
  75. package/dist/components/br-menu-list.js +1 -1
  76. package/dist/components/br-menu-social.js +1 -1
  77. package/dist/components/br-menu.js +1 -1
  78. package/dist/components/br-message.js +1 -1
  79. package/dist/components/br-modal.js +1 -1
  80. package/dist/components/br-notification-header.js +1 -1
  81. package/dist/components/br-notification-item.js +1 -1
  82. package/dist/components/br-pagination.js +1 -1
  83. package/dist/components/br-radio-group.js +1 -1
  84. package/dist/components/br-radio.js +1 -1
  85. package/dist/components/br-select-input.js +1 -1
  86. package/dist/components/br-select-list.js +1 -1
  87. package/dist/components/br-select-option.js +1 -1
  88. package/dist/components/br-select.js +1 -1
  89. package/dist/components/br-sign-in.js +1 -1
  90. package/dist/components/br-skip-link-item.js +1 -1
  91. package/dist/components/br-skip-link.js +1 -1
  92. package/dist/components/br-skiplink-item.js +1 -1
  93. package/dist/components/br-slider.js +1 -1
  94. package/dist/components/br-step-item.js +1 -1
  95. package/dist/components/br-switch.js +1 -1
  96. package/dist/components/br-tab.js +1 -1
  97. package/dist/components/br-table-cell.js +1 -1
  98. package/dist/components/br-table-header-cell.js +1 -1
  99. package/dist/components/br-tag.js +1 -1
  100. package/dist/components/br-textarea.js +1 -1
  101. package/dist/components/br-time-picker.js +1 -1
  102. package/dist/components/br-tooltip.js +1 -1
  103. package/dist/components/br-upload.js +1 -1
  104. package/dist/components/br-wizard.js +1 -1
  105. package/dist/components/index.js +1 -1
  106. package/dist/components/{p-0IYmyaTi.js → p-34Jfn-U-.js} +1 -1
  107. package/dist/components/{p-41XwlWiS.js → p-B7Amgxkp.js} +1 -1
  108. package/dist/components/p-BKuMQJrQ.js +5 -0
  109. package/dist/components/{p-LmeJrLxH.js → p-BeE7R9nu.js} +1 -1
  110. package/dist/components/{p-C98-mHmV.js → p-Bo0QYHJO.js} +1 -1
  111. package/dist/components/{p-DYnkGWii.js → p-C2i2c_io.js} +1 -1
  112. package/dist/components/p-C7v0lVlX.js +5 -0
  113. package/dist/components/{p-D_CSvOY9.js → p-CMBsvswx.js} +1 -1
  114. package/dist/components/{p-Dkg2scYZ.js → p-CRrimdz6.js} +1 -1
  115. package/dist/components/{p-Bm0ECvfB.js → p-CWORw84-.js} +1 -1
  116. package/dist/components/p-CvUMXJCl.js +5 -0
  117. package/dist/components/{p-nJOJGpyl.js → p-DFUKDNck.js} +1 -1
  118. package/dist/components/p-DHicj0By.js +5 -0
  119. package/dist/components/{p-B-sbd1_h.js → p-DXjQyH6s.js} +1 -1
  120. package/dist/components/p-DmCxdB9P.js +5 -0
  121. package/dist/components/{p-DoXNfcTT.js → p-Dp0xy_3n.js} +1 -1
  122. package/dist/components/{p-DaeGwqw0.js → p-JAkkThgf.js} +1 -1
  123. package/dist/components/{p-aF8bGN3t.js → p-Ud-WB0hx.js} +1 -1
  124. package/dist/components/p-fpMNttbg.js +5 -0
  125. package/dist/components/{p-D9SpD3Ay.js → p-qYONSNcf.js} +1 -1
  126. package/dist/components/{p-CDZFuUlU.js → p-qhhHGJY1.js} +1 -1
  127. package/dist/components/p-ukNmfGNP.js +5 -0
  128. package/dist/components/p-xa8e1kSW.js +5 -0
  129. package/dist/esm/br-cookiebar-link.entry.js +2 -1
  130. package/dist/esm/br-date-picker_3.entry.js +2 -1
  131. package/dist/esm/br-datetime-picker.entry.js +1 -2
  132. package/dist/esm/br-dropdown_2.entry.js +252 -108
  133. package/dist/esm/br-header-logo.entry.js +2 -1
  134. package/dist/esm/br-icon.entry.js +1 -1
  135. package/dist/esm/br-item.entry.js +25 -14
  136. package/dist/esm/br-link.entry.js +2 -1
  137. package/dist/esm/br-magic-button.entry.js +2 -1
  138. package/dist/esm/br-menu-link.entry.js +2 -1
  139. package/dist/esm/br-select-input_3.entry.js +45 -11
  140. package/dist/esm/br-sign-in.entry.js +2 -1
  141. package/dist/esm/br-slider.entry.js +1 -2
  142. package/dist/esm/br-tag.entry.js +2 -3
  143. package/dist/esm/br-upload.entry.js +2 -3
  144. package/dist/esm/index-C2RBydfd.js +4 -4
  145. package/dist/esm/loader.js +1 -1
  146. package/dist/esm/webcomponents.js +1 -1
  147. package/dist/hydrate/index.js +356 -163
  148. package/dist/hydrate/index.mjs +356 -163
  149. package/dist/types/components/item/item.d.ts +1 -0
  150. package/dist/types/components/select/select-list/select-list.d.ts +1 -0
  151. package/dist/types/components/select/select-option/select-option.d.ts +1 -0
  152. package/dist/types/components/select/select.d.ts +14 -0
  153. package/dist/types/components/select/select.types.d.ts +2 -0
  154. package/dist/types/components/select/select.utils.d.ts +13 -0
  155. package/dist/webcomponents/p-0777c7b1.entry.js +5 -0
  156. package/dist/webcomponents/p-18ee6175.entry.js +5 -0
  157. package/dist/webcomponents/p-1c303a4e.entry.js +5 -0
  158. package/dist/webcomponents/{p-60cc820c.entry.js → p-4c13221a.entry.js} +1 -1
  159. package/dist/webcomponents/p-51ce2c31.entry.js +5 -0
  160. package/dist/webcomponents/p-83ff4579.entry.js +5 -0
  161. package/dist/webcomponents/p-8e819355.entry.js +5 -0
  162. package/dist/webcomponents/p-92a9b9c4.entry.js +5 -0
  163. package/dist/webcomponents/p-a4ae72e3.entry.js +5 -0
  164. package/dist/webcomponents/p-a994c190.entry.js +5 -0
  165. package/dist/webcomponents/p-c949d993.entry.js +5 -0
  166. package/dist/webcomponents/p-f26038e2.entry.js +5 -0
  167. package/dist/webcomponents/{p-4fe12a72.entry.js → p-f303f6b3.entry.js} +1 -1
  168. package/dist/webcomponents/p-f85ee01c.entry.js +5 -0
  169. package/dist/webcomponents/{p-5b257a4b.entry.js → p-ffe0241e.entry.js} +1 -1
  170. package/dist/webcomponents/webcomponents.esm.js +1 -1
  171. package/package.json +3 -7
  172. package/dist/components/p-BW0_ORNA.js +0 -5
  173. package/dist/components/p-C3LQSQpc.js +0 -5
  174. package/dist/components/p-CRfi23Rd.js +0 -5
  175. package/dist/components/p-CUI5zWGf.js +0 -5
  176. package/dist/components/p-CxviDiCr.js +0 -5
  177. package/dist/components/p-DvrdmqoQ.js +0 -5
  178. package/dist/components/p-TFWd_UBV.js +0 -5
  179. package/dist/components/p-cfPt-vKA.js +0 -5
  180. package/dist/webcomponents/p-059c3d6c.entry.js +0 -5
  181. package/dist/webcomponents/p-0b8f39bc.entry.js +0 -5
  182. package/dist/webcomponents/p-1b138f1c.entry.js +0 -5
  183. package/dist/webcomponents/p-22443c08.entry.js +0 -5
  184. package/dist/webcomponents/p-6c5f6cb6.entry.js +0 -5
  185. package/dist/webcomponents/p-6f1c4425.entry.js +0 -5
  186. package/dist/webcomponents/p-7cf9f4e5.entry.js +0 -5
  187. package/dist/webcomponents/p-7e1856e4.entry.js +0 -5
  188. package/dist/webcomponents/p-bba9fc09.entry.js +0 -5
  189. package/dist/webcomponents/p-cedb8eea.entry.js +0 -5
  190. package/dist/webcomponents/p-dba376cb.entry.js +0 -5
  191. package/dist/webcomponents/p-e80a1eb0.entry.js +0 -5
@@ -575,6 +575,37 @@ const Dropdown = class {
575
575
  };
576
576
  Dropdown.style = dropdownCss();
577
577
 
578
+ function transitionSelection({ currentValues, multiple, value, selected, selectableValues = [], }) {
579
+ const current = [...new Set(currentValues)];
580
+ if (!multiple) {
581
+ const values = selected && value ? [value] : [];
582
+ return { values, changed: values.length !== current.length || values[0] !== current[0] };
583
+ }
584
+ if (!value && selectableValues.length > 0) {
585
+ const values = selected ? [...new Set(selectableValues)] : [];
586
+ return {
587
+ values,
588
+ changed: values.length !== current.length || values.some((item, index) => item !== current[index]),
589
+ };
590
+ }
591
+ const next = new Set(current);
592
+ if (selected)
593
+ next.add(value);
594
+ else
595
+ next.delete(value);
596
+ const values = [...next];
597
+ return { values, changed: values.length !== current.length || values.some((item, index) => item !== current[index]) };
598
+ }
599
+ function transitionAllSelection(currentValues, selected, selectableValues) {
600
+ return transitionSelection({
601
+ currentValues,
602
+ multiple: true,
603
+ value: '',
604
+ selected,
605
+ selectableValues,
606
+ });
607
+ }
608
+
578
609
  const selectCss = () => `*,*::before,*::after{box-sizing:border-box}:host{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}code{font-family:monospace;font-size:1em}small{font-size:80%}img{border-style:none}button,input,select,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.d-none{display:none !important}@media (min-width: 576px){.d-sm-block{display:block !important}.d-sm-flex{display:flex !important}}[data-toggle=dropdown]+*{position:absolute}.dropdown{position:relative}.dropdown [data-toggle=dropdown]+*{box-shadow:var(--surface-shadow-sm);left:0;position:absolute;top:100%}.dropdown>.br-notification{left:auto;right:0}.dropdown .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--color-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x);background-color:var(--background-light);color:var(--color)}.dropdown .br-item:not(:last-child){border-bottom:1px solid var(--border-color)}.dropdown .br-item.selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.justify-content-start{justify-content:flex-start !important}.justify-content-end{justify-content:flex-end !important}.justify-content-center{justify-content:center !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter)*.5);padding-right:calc(var(--grid-gutter)*.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.col-2{flex-basis:16.6666666667%;max-width:16.6666666667%}.container,.container-fluid,.container-lg{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:flex;flex-wrap:wrap;margin-left:calc(var(--grid-gutter)*-0.5);margin-right:calc(var(--grid-gutter)*-0.5)}@media (min-width: 576px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}}@media (min-width: 992px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width: 1280px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}}@media (min-width: 1600px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.ease{animation-timing-function:cubic-bezier(0.25, 0.1, 0.25, 1)}.ease-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mb-1{margin-bottom:var(--spacing-scale-half) !important}.ml-1{margin-left:var(--spacing-scale-half) !important}.mx-3{margin-left:var(--spacing-scale-2x) !important;margin-right:var(--spacing-scale-2x) !important}.mb-4{margin-bottom:var(--spacing-scale-3x) !important}.ml-auto{margin-left:auto !important}.pt-half{padding-top:var(--spacing-scale-half) !important}@media (min-width: 576px){.ml-sm-0{margin-left:var(--spacing-scale-default) !important}}.highlight{background:var(--status-highlight-background) linear-gradient(var(--status-highlight-overlay), var(--status-highlight-overlay));color:var(--status-highlight-text);padding:0 var(--spacing-scale-half)}[disabled],.disabled{cursor:not-allowed;opacity:var(--disabled)}[disabled] *,.disabled *{pointer-events:none}.text-center{text-align:center !important}.text-right{text-align:right !important}.text-nowrap{white-space:nowrap !important}.text-uppercase{text-transform:uppercase !important}.text-bold{font-weight:700 !important}.text-base{font-size:var(--font-size-scale-base) !important}.text-down-01{font-size:var(--font-size-scale-down-01) !important}@media (min-width: 576px){.text-sm-center{text-align:center !important}.text-sm-left{text-align:left !important}.text-sm-right{text-align:right !important}}p{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-2x);margin-top:0}p a{text-decoration:underline}@media (min-width: 576px){p{font-size:var(--font-size-scale-up-01)}}a{--focus-offset:var(--spacing-scale-half)}a:focus{outline:none}a.focus-visible,a:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}a:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}a:not(:disabled):active{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--pressed)), rgba(var(--interactive-rgb), var(--pressed)))}a{color:var(--interactive);text-decoration:none}.main-content a{text-decoration:underline}button{cursor:pointer}img{max-width:100%;vertical-align:middle}h2,.h2{color:var(--color);font-size:var(--font-size-scale-up-03);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2xh);margin-top:var(--spacing-scale-3xh);padding-bottom:var(--spacing-scale-2xh)}@media (min-width: 576px){.h2,h2{font-size:var(--font-size-scale-up-05);font-weight:var(--font-weight-regular)}}ul,ol{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}table{--table-background:var(--background);--table-color:var(--color);--table-border-color:var(--gray-20);--table-border-style:solid;--table-border-width:1px;--table-hover:var(--color-rgb);--table-padding:var(--spacing-scale-3x);--table-font-weight:var(--font-weight-medium);--table-th-background:var(--background-alternative);--table-th-font-weight:var(--font-weight-semi-bold);--table-row-size:var(--spacing-scale-2x);border-collapse:collapse;width:100%}tr.selected,tr.is-selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}label,.label{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half)}fieldset,.fieldset{border:var(--surface-width-none);margin-bottom:var(--spacing-scale-5x);margin-top:0;padding:0}legend,.legend{color:var(--color);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2x);margin-top:var(--spacing-scale-2x)}::placeholder,.placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}input,textarea,.input{color:var(--color-light);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-half)}.help{font-size:var(--font-size-scale-base)}code,.code{background:var(--gray-5);border-radius:4px;color:var(--gray-80);display:inline-block;font-family:monospace;font-size:var(--font-size-scale-base);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);padding:var(--spacing-scale-half)}*[data-toggle=collapse]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}*[data-toggle=collapse]:focus{outline:none}*[data-toggle=collapse].focus-visible,*[data-toggle=collapse]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}.br-select{--select-divider:1px solid var(--color-secondary-04);--select-shadow:var(--surface-shadow-md)}.br-select .br-input input{padding-right:29px;text-overflow:ellipsis}.br-select .br-input input::after{bottom:0;padding:0 5px;position:absolute;right:0}.br-select{max-width:400px;min-width:100px;position:relative}.br-select .br-list{background:var(--bg-color);box-shadow:var(--select-shadow);display:none;margin-top:-2px;max-height:404px;overflow:auto;position:absolute;resize:none;width:100%;z-index:1}.br-select .br-list::-webkit-scrollbar{height:var(--spacing-scale-base);width:var(--spacing-scale-base)}.br-select .br-list::-webkit-scrollbar-track{background:var(--gray-10)}.br-select .br-list::-webkit-scrollbar-thumb{background:var(--gray-30)}.br-select .br-list:hover::-webkit-scrollbar-thumb{background:var(--gray-40)}.br-select .br-list:focus,.br-select .br-list:active{color:var(--color-secondary-09);outline:none}.br-select .br-list:hover::-webkit-scrollbar-thumb{background:var(--color-secondary-07)}.br-select .br-list[expanded]{display:block}.br-select .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--interactive-light-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x)}.br-select .br-item .content{padding:0}.br-select .br-item .br-checkbox,.br-select .br-item .br-radio{--item-padding-x:var(--spacing-scale-2x);--item-padding-y:var(--spacing-scale-2x)}.br-select .br-item .br-checkbox input:hover:not(:disabled)+label::before,.br-select .br-item .br-radio input:hover:not(:disabled)+label::before{background-image:none}.br-select .br-item .br-checkbox input+label,.br-select .br-item .br-radio input+label{padding-left:calc(var(--checkbox-padding) + var(--checkbox-size) + var(--item-padding-x))}.br-select .br-item .br-radio input+label{color:var(--text-color);display:block;height:auto;min-height:0;padding:var(--item-padding)}.br-select .br-item .br-radio input+label::before,.br-select .br-item .br-radio input+label::after{content:none}.br-select .br-item:not(:last-child){border-bottom:var(--select-divider)}.br-select .br-item:not([disabled]){--focus-offset:calc(var(--spacing-scale-half) * -1)}.br-select .br-item:not([disabled]):focus{outline:none}.br-select .br-item:not([disabled]).focus-visible,.br-select .br-item:not([disabled]):focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}.br-select .br-item:not([disabled]):not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-select .br-item.selected,.br-select .br-item[selected]{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.br-select .br-item.selected:focus,.br-select .br-item[selected]:focus{outline:none}.br-select .br-item.selected.focus-visible,.br-select .br-item.selected:focus-visible,.br-select .br-item[selected].focus-visible,.br-select .br-item[selected]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}.br-select .br-item.selected:not(:disabled):hover,.br-select .br-item[selected]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-select .br-item.disabled{line-height:calc(var(--font-line-height-high)*2);padding-left:calc(var(--item-padding) + var(--spacing-scale-base))}.br-select.inverted .br-input,.br-select.inverted .br-input label,.br-select.dark-mode .br-input,.br-select.dark-mode .br-input label{--color:var(--color-dark);--focus-color:var(--focus-color-dark)}:host{display:inline-block}.br-select{min-width:100px;max-width:400px;position:relative}:host([multiple]) .br-select{min-width:200px}`;
579
610
 
580
611
  let selectId = 0;
@@ -745,6 +776,7 @@ const Select = class {
745
776
  this.validatorMessage = null;
746
777
  this.hasFeedbackSlot = false;
747
778
  this.hasValidationLoadingSlot = false;
779
+ this.selectedValuesState = [];
748
780
  this.customValidationMessage = '';
749
781
  this.validationRunId = 0;
750
782
  this.lastAnnouncedOpen = false;
@@ -752,6 +784,9 @@ const Select = class {
752
784
  this.suppressValueChange = false;
753
785
  this.hasImperativeOptions = false;
754
786
  this.remoteSelectedOptions = new Map();
787
+ this.selectionInitialized = false;
788
+ this.selectedValues = [];
789
+ this.suppressFocusOpen = false;
755
790
  /**
756
791
  * Sincroniza as opções declaradas no slot com a lista interna renderizada.
757
792
  *
@@ -762,10 +797,11 @@ const Select = class {
762
797
  this.syncOptionsFromSlot = (updateDisplayValue = true) => {
763
798
  if (this.hasImperativeOptions)
764
799
  return;
765
- const nodes = this.slotElement?.assignedNodes({ flatten: true }) ?? [];
800
+ const nodes = this.slotElement?.assignedNodes({ flatten: true }) ?? Array.from(this.el.childNodes);
766
801
  const options = nodes.map((n) => this.nodeToOption(n)).filter((o) => Boolean(o));
767
802
  // Envia opções para o br-select-list
768
- this.selectListElement?.setOptions(options);
803
+ if (this.selectListElement)
804
+ this.selectListElement.options = this.getListOptions(options);
769
805
  if (updateDisplayValue)
770
806
  this.syncDisplayValue(options);
771
807
  };
@@ -795,6 +831,10 @@ const Select = class {
795
831
  this.setSelectionMode(this.effectiveMultiple);
796
832
  const initialOptions = this.getHostOptions();
797
833
  const propOptions = this.getOptionsProp();
834
+ const sourceOptions = initialOptions.length === 0 && propOptions.length > 0 ? propOptions : initialOptions;
835
+ this.setSelectedValues(this.valueFromPublicValue(this.value) ??
836
+ sourceOptions.filter((option) => option.selected).map((option) => option.value));
837
+ this.selectionInitialized = true;
798
838
  if (initialOptions.length === 0 && propOptions.length > 0) {
799
839
  this.pendingOptions = propOptions;
800
840
  this.syncDisplayValue(propOptions);
@@ -816,7 +856,7 @@ const Select = class {
816
856
  this.slotElement.addEventListener('slotchange', this.handleSlotChange);
817
857
  }
818
858
  if (this.pendingOptions && this.selectListElement) {
819
- this.selectListElement.setOptions(this.pendingOptions);
859
+ this.selectListElement.options = this.getListOptions(this.pendingOptions);
820
860
  this.pendingOptions = null;
821
861
  }
822
862
  this.isValueChangeReady = true;
@@ -825,6 +865,10 @@ const Select = class {
825
865
  this.attachBlockingSurfaceListener();
826
866
  this.updateValidity();
827
867
  }
868
+ componentDidRender() {
869
+ this.syncNativeSelectSelection();
870
+ this.updateValidity();
871
+ }
828
872
  disconnectedCallback() {
829
873
  if (this.slotElement) {
830
874
  this.slotElement.removeEventListener('slotchange', this.handleSlotChange);
@@ -841,6 +885,47 @@ const Select = class {
841
885
  get effectiveOpen() {
842
886
  return this.open ?? this.isOpen;
843
887
  }
888
+ valueFromPublicValue(value) {
889
+ if (this.effectiveMultiple)
890
+ return Array.isArray(value) ? [...new Set(value.filter(Boolean))] : null;
891
+ return typeof value === 'string' && value ? [value] : null;
892
+ }
893
+ setSelectedValues(values) {
894
+ const next = [...new Set(values.filter(Boolean))];
895
+ if (!this.effectiveMultiple && next.length > 1)
896
+ next.splice(1);
897
+ if (this.selectedValues.length === next.length &&
898
+ this.selectedValues.every((value, index) => value === next[index]))
899
+ return;
900
+ this.selectedValues = next;
901
+ this.selectedValuesState = next;
902
+ }
903
+ get canonicalSelectedValues() {
904
+ return this.selectedValues;
905
+ }
906
+ applyCanonicalSelection(options, values = this.canonicalSelectedValues) {
907
+ if (!this.selectionInitialized)
908
+ return options.map((option) => ({ ...option }));
909
+ const selected = new Set(values);
910
+ return options.map((option) => ({ ...option, selected: selected.has(option.value) }));
911
+ }
912
+ getListOptions(options) {
913
+ const normalized = this.applyCanonicalSelection(options).filter((option) => option.value !== '__select_all__');
914
+ if (!this.effectiveMultiple)
915
+ return normalized;
916
+ const selectable = normalized.filter((option) => !this.isSelectAllLabel(this.getOptionLabel(option)));
917
+ const allSelected = selectable.length > 0 && selectable.every((option) => Boolean(option.selected));
918
+ const anySelected = selectable.some((option) => Boolean(option.selected));
919
+ return [
920
+ {
921
+ value: '__select_all__',
922
+ label: allSelected ? this.unselectAllLabel : this.selectAllLabel,
923
+ selected: allSelected,
924
+ indeterminate: anySelected && !allSelected,
925
+ },
926
+ ...selectable,
927
+ ];
928
+ }
844
929
  isDisabled() {
845
930
  return isFormControlDisabled(this.disabled, this.formDisabled);
846
931
  }
@@ -913,6 +998,8 @@ const Select = class {
913
998
  }
914
999
  handleSelectInputFocus() {
915
1000
  this.activeOptionIndex = -1;
1001
+ if (this.suppressFocusOpen)
1002
+ return;
916
1003
  if (this.filterable && !this.effectiveOpen) {
917
1004
  this.clearSearch();
918
1005
  void this.show();
@@ -949,16 +1036,50 @@ const Select = class {
949
1036
  this.toggleOpenFromPointer();
950
1037
  }
951
1038
  handleSelectOptionStateChange(event) {
952
- this.syncSlottedOptionSelection(event.detail);
953
- this.rememberRemoteSelections(this.getCurrentOptions());
954
- this.syncDisplayValue();
955
- this.syncActiveOptionIndex(event.detail);
956
1039
  event.stopPropagation();
957
- const detail = { selected: event.detail.selected, value: event.detail.value };
1040
+ const detail = event.detail;
1041
+ // Use a lista interna para preservar rótulos e opções remotas enquanto as
1042
+ // props projetadas aguardam a próxima renderização.
1043
+ const listOptions = this.getSelectListController()?.options;
1044
+ const sourceOptions = Array.isArray(listOptions) && listOptions.length > 0
1045
+ ? listOptions.map((option) => ({ ...option }))
1046
+ : this.getCurrentOptions();
1047
+ // No modo simples, o evento é a decisão final da interação. A lista
1048
+ // virtualizada e as opções projetadas podem ainda conter o snapshot da
1049
+ // interação anterior durante cliques consecutivos; derivar a coleção a
1050
+ // partir do valor do evento evita que esse snapshot reapareça no valor
1051
+ // público ou no formulário.
1052
+ const selectableValues = sourceOptions
1053
+ .filter((option) => !this.isSelectAllLabel(this.getOptionLabel(option)))
1054
+ .map((option) => option.value);
1055
+ const transition = this.isSelectAllLabel(detail.label ?? detail.value)
1056
+ ? transitionAllSelection(this.selectedValues, Boolean(detail.selected), selectableValues)
1057
+ : transitionSelection({
1058
+ currentValues: this.selectedValues,
1059
+ multiple: this.effectiveMultiple,
1060
+ value: detail.value,
1061
+ selected: Boolean(detail.selected),
1062
+ });
1063
+ this.setSelectedValues(transition.values);
1064
+ const options = this.applyCanonicalSelection(sourceOptions, transition.values);
1065
+ if (this.selectListElement)
1066
+ this.selectListElement.options = this.getListOptions(options);
1067
+ this.reflectRenderedListSelection(transition.values);
1068
+ this.syncSlottedOptionSelection(transition.values);
1069
+ this.rememberRemoteSelections(options);
1070
+ this.syncDisplayValue(options);
1071
+ this.syncActiveOptionIndex(event.detail);
958
1072
  this.emitStateChange(detail);
959
1073
  this.updateValidity();
960
- if (!this.keepOpenOnSelect && !this.effectiveMultiple)
961
- void this.close();
1074
+ if (!transition.changed)
1075
+ return;
1076
+ if (!this.effectiveMultiple) {
1077
+ this.suppressFocusOpen = true;
1078
+ void this.selectInputElement?.setFocus?.();
1079
+ void this.close().finally(() => {
1080
+ this.suppressFocusOpen = false;
1081
+ });
1082
+ }
962
1083
  dispatchNativeFormEvent(this.el, 'input');
963
1084
  dispatchNativeFormEvent(this.el, 'change');
964
1085
  }
@@ -1175,7 +1296,7 @@ const Select = class {
1175
1296
  this.suppressValueChange = true;
1176
1297
  try {
1177
1298
  if (this.selectListElement) {
1178
- await this.selectListElement.setOptions(nextOptions);
1299
+ this.selectListElement.options = this.getListOptions(nextOptions);
1179
1300
  }
1180
1301
  else {
1181
1302
  this.pendingOptions = nextOptions;
@@ -1194,20 +1315,20 @@ const Select = class {
1194
1315
  */
1195
1316
  async setOption(option) {
1196
1317
  this.hasImperativeOptions = true;
1318
+ const currentOptions = this.getCurrentOptions();
1319
+ const index = currentOptions.findIndex((currentOption) => currentOption.value === option.value);
1320
+ const nextOptions = [...currentOptions];
1321
+ if (index === -1)
1322
+ nextOptions.push(option);
1323
+ else
1324
+ nextOptions[index] = option;
1197
1325
  if (this.selectListElement) {
1198
- await this.selectListElement.setOption(option);
1199
- }
1200
- else if (this.pendingOptions) {
1201
- const index = this.pendingOptions.findIndex((currentOption) => currentOption.value === option.value);
1202
- if (index !== -1)
1203
- this.pendingOptions[index] = option;
1204
- else
1205
- this.pendingOptions.push(option);
1326
+ this.selectListElement.options = this.getListOptions(nextOptions);
1206
1327
  }
1207
1328
  else {
1208
- this.pendingOptions = [option];
1329
+ this.pendingOptions = nextOptions;
1209
1330
  }
1210
- this.syncDisplayValue();
1331
+ this.syncDisplayValue(nextOptions);
1211
1332
  }
1212
1333
  getHostOptions() {
1213
1334
  return Array.from(this.el.childNodes)
@@ -1236,15 +1357,16 @@ const Select = class {
1236
1357
  const rawLabel = el.getAttribute('label') ?? el.label ?? '';
1237
1358
  let value = String(rawValue || '').trim();
1238
1359
  let label = String(rawLabel || '').trim();
1360
+ const inner = this.extractInnerTextFromOption(el);
1361
+ const content = (el.innerHTML || '').trim();
1239
1362
  const selected = el.hasAttribute('selected') || Boolean(el.selected);
1240
1363
  if (!value) {
1241
- const inner = this.extractInnerTextFromOption(el);
1242
1364
  if (inner)
1243
1365
  value = inner.trim();
1244
1366
  }
1245
1367
  if (!label)
1246
- label = value;
1247
- return { value: value || '', label: label || undefined, selected };
1368
+ label = inner?.trim() || value;
1369
+ return { value: value || '', label: label || undefined, selected, content: content || undefined };
1248
1370
  }
1249
1371
  extractInnerTextFromOption(el) {
1250
1372
  const fromSlot = this.getAssignedSlotText(el);
@@ -1297,6 +1419,9 @@ const Select = class {
1297
1419
  this.syncValue(resolvedOptions);
1298
1420
  }
1299
1421
  syncValue(options) {
1422
+ this.setSelectedValues(options
1423
+ .filter((option) => option.selected && !this.isSelectAllLabel(this.getOptionLabel(option)))
1424
+ .map((option) => option.value));
1300
1425
  const nextValue = this.getSerializedValue(options);
1301
1426
  this.syncFormState(options);
1302
1427
  if (this.value === nextValue)
@@ -1336,15 +1461,18 @@ const Select = class {
1336
1461
  }
1337
1462
  applySelectedValue(value) {
1338
1463
  const currentOptions = this.getCurrentOptions();
1464
+ const requestedValues = this.valueFromPublicValue(value) ?? [];
1465
+ this.setSelectedValues(requestedValues);
1339
1466
  const options = currentOptions.map((option) => ({
1340
1467
  ...option,
1341
- selected: this.effectiveMultiple ? Array.isArray(value) && value.includes(option.value) : value === option.value,
1468
+ selected: requestedValues.includes(option.value),
1342
1469
  }));
1343
1470
  this.isApplyingExternalValue = true;
1344
1471
  if (this.selectListElement)
1345
- void this.selectListElement.setOptions(options);
1472
+ this.selectListElement.options = this.getListOptions(options);
1346
1473
  else
1347
1474
  this.pendingOptions = options;
1475
+ this.reflectRenderedListSelection(requestedValues);
1348
1476
  this.value = value;
1349
1477
  this.isApplyingExternalValue = false;
1350
1478
  this.remoteSelectedOptions.clear();
@@ -1367,7 +1495,7 @@ const Select = class {
1367
1495
  }
1368
1496
  applyRemoteSelection(options) {
1369
1497
  this.rememberRemoteSelections(this.getCurrentOptions());
1370
- const selectedValues = new Set(Array.isArray(this.value) ? this.value : [this.value ?? '']);
1498
+ const selectedValues = new Set(this.selectedValues);
1371
1499
  const nextOptions = options.map((option) => ({
1372
1500
  ...option,
1373
1501
  selected: selectedValues.has(option.value) || Boolean(option.selected),
@@ -1402,38 +1530,36 @@ const Select = class {
1402
1530
  const selectedValues = selected.map((option) => option.value);
1403
1531
  const formValue = this.effectiveMultiple ? JSON.stringify(selectedValues) : (selectedValues[0] ?? null);
1404
1532
  safeSetFormValue(this.elementInternals, formValue);
1405
- if (this.nativeSelect) {
1406
- this.nativeSelect.value = selectedValues[0] ?? '';
1407
- const selectedSet = new Set(selectedValues);
1408
- const optionNodes = Array.from(this.nativeSelect.options);
1409
- selectedSet.forEach((value) => {
1410
- if (optionNodes.some((option) => option.value === value))
1411
- return;
1412
- const option = document.createElement('option');
1413
- option.value = value;
1414
- this.nativeSelect?.append(option);
1415
- });
1416
- optionNodes.forEach((option) => {
1417
- if (option.value !== '' && !selectedSet.has(option.value))
1418
- option.remove();
1419
- else
1420
- option.selected = selectedSet.has(option.value);
1421
- });
1422
- this.nativeSelect.value = selectedValues[0] ?? '';
1423
- }
1424
- this.updateValidity();
1533
+ this.syncNativeSelectSelection(selectedValues);
1534
+ this.updateValidity(selectedValues.length);
1425
1535
  }
1426
- updateValidity() {
1427
- if (!this.nativeSelect)
1536
+ syncNativeSelectSelection(values = this.getSelectedValues()) {
1537
+ const nativeSelect = this.getNativeSelect();
1538
+ if (!nativeSelect)
1539
+ return;
1540
+ const selectedValues = new Set(values);
1541
+ Array.from(nativeSelect.options).forEach((option) => {
1542
+ option.selected = option.value === '' ? selectedValues.size === 0 : selectedValues.has(option.value);
1543
+ });
1544
+ }
1545
+ getSelectedValues() {
1546
+ return [...this.selectedValues];
1547
+ }
1548
+ updateValidity(selectedCount = this.getSelectedValues().length) {
1549
+ const nativeSelect = this.getNativeSelect();
1550
+ if (!nativeSelect)
1428
1551
  return;
1429
- const selectedCount = this.getFormOptions(this.getCurrentOptions()).filter((option) => option.selected).length;
1430
1552
  const selectionMessage = this.effectiveMultiple && this.minSelections > 0 && selectedCount < this.minSelections
1431
1553
  ? `Selecione pelo menos ${this.minSelections} opções.`
1432
1554
  : this.effectiveMultiple && this.maxSelections > 0 && selectedCount > this.maxSelections
1433
1555
  ? `Selecione no máximo ${this.maxSelections} opções.`
1434
1556
  : '';
1435
- this.nativeSelect.setCustomValidity(this.customValidationMessage || this.validatorMessage || selectionMessage);
1436
- syncNativeFormValidity(this.elementInternals, this.nativeSelect);
1557
+ nativeSelect.setCustomValidity(this.customValidationMessage || this.validatorMessage || selectionMessage);
1558
+ syncNativeFormValidity(this.elementInternals, nativeSelect);
1559
+ }
1560
+ getNativeSelect() {
1561
+ return (this.el.shadowRoot?.querySelector('select[part="hidden-select"]') ??
1562
+ this.nativeSelect);
1437
1563
  }
1438
1564
  resolveValidator() {
1439
1565
  return resolveFormValidator(this.validator);
@@ -1544,6 +1670,17 @@ const Select = class {
1544
1670
  const index = this.getCurrentActiveIndex();
1545
1671
  const option = options[index];
1546
1672
  const nextSelected = this.effectiveMultiple ? !option?.selected : true;
1673
+ if (this.effectiveMultiple && index === 0 && option && !this.isSelectAllLabel(this.getOptionLabel(option))) {
1674
+ this.handleSelectOptionStateChange(new CustomEvent('brSelectOptionStateChange', {
1675
+ detail: {
1676
+ value: '__select_all__',
1677
+ label: this.selectAllLabel,
1678
+ selected: true,
1679
+ disabled: false,
1680
+ },
1681
+ }));
1682
+ return;
1683
+ }
1547
1684
  const didSelect = await this.getSelectListController()?.setOptionSelected?.(index, nextSelected);
1548
1685
  if (didSelect) {
1549
1686
  this.activeOptionIndex = index;
@@ -1564,55 +1701,19 @@ const Select = class {
1564
1701
  * Essa sincronização mantém as props/atributos das opções declaradas pelo consumidor em
1565
1702
  * conformidade com o estado calculado internamente, inclusive no caso do "selecionar todos".
1566
1703
  */
1567
- syncSlottedOptionSelection(detail) {
1568
- if (!this.slotElement || !detail?.value)
1569
- return;
1570
- const slottedOptions = this.slotElement
1571
- .assignedElements({ flatten: true })
1572
- .filter((el) => el.tagName.toLowerCase() === 'br-select-option');
1704
+ syncSlottedOptionSelection(values = this.selectedValues) {
1705
+ const slottedOptions = Array.from(this.el.children).filter((el) => el.tagName.toLowerCase() === 'br-select-option');
1573
1706
  if (slottedOptions.length === 0)
1574
1707
  return;
1575
- const detailLabel = (detail.label ?? detail.value).trim();
1576
- const isSelectAll = this.isSelectAllLabel(detailLabel);
1577
- if (this.effectiveMultiple && isSelectAll) {
1578
- slottedOptions.forEach((option) => {
1579
- const optionLabel = (option.label ?? option.value).trim();
1580
- const isSelectAllOption = this.isSelectAllLabel(optionLabel);
1581
- if (isSelectAllOption) {
1582
- option.indeterminate = false;
1583
- option.selected = Boolean(detail.selected);
1584
- this.normalizeSelectAllState(option);
1585
- if (option.selected)
1586
- option.setAttribute('selected', '');
1587
- else
1588
- option.removeAttribute('selected');
1589
- return;
1590
- }
1591
- option.selected = Boolean(detail.selected);
1592
- if (option.selected)
1593
- option.setAttribute('selected', '');
1594
- else
1595
- option.removeAttribute('selected');
1596
- });
1597
- return;
1598
- }
1708
+ const selectedValues = new Set(values);
1599
1709
  slottedOptions.forEach((option) => {
1600
- const isTarget = option.value === detail.value;
1601
- const nextSelected = this.effectiveMultiple ? (isTarget ? Boolean(detail.selected) : option.selected) : isTarget;
1602
- if (isTarget) {
1603
- option.indeterminate = false;
1604
- }
1605
- option.selected = nextSelected;
1606
- if (nextSelected) {
1710
+ const resolved = this.optionElementToData(option).value;
1711
+ option.selected = selectedValues.has(resolved);
1712
+ option.indeterminate = false;
1713
+ if (option.selected)
1607
1714
  option.setAttribute('selected', '');
1608
- }
1609
- else {
1610
- option.removeAttribute('selected');
1611
- }
1612
- if (!this.effectiveMultiple && !isTarget) {
1613
- option.selected = false;
1715
+ else
1614
1716
  option.removeAttribute('selected');
1615
- }
1616
1717
  });
1617
1718
  if (!this.effectiveMultiple)
1618
1719
  return;
@@ -1635,6 +1736,17 @@ const Select = class {
1635
1736
  option.removeAttribute('selected');
1636
1737
  });
1637
1738
  }
1739
+ reflectRenderedListSelection(values) {
1740
+ const renderedOptions = this.selectListElement?.shadowRoot?.querySelectorAll('br-select-option');
1741
+ if (!renderedOptions)
1742
+ return;
1743
+ const selectedValues = new Set(values);
1744
+ renderedOptions.forEach((option) => {
1745
+ if (this.isSelectAllLabel(option.label))
1746
+ return;
1747
+ option.selected = selectedValues.has(option.value);
1748
+ });
1749
+ }
1638
1750
  isSelectAllLabel(label) {
1639
1751
  return label === this.selectAllLabel || label === this.unselectAllLabel;
1640
1752
  }
@@ -1715,6 +1827,7 @@ const Select = class {
1715
1827
  * A precedência é: lista interna, opções pendentes, conteúdo do slot e, por último,
1716
1828
  * os filhos atuais do host.
1717
1829
  */
1830
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: prioriza a precedência entre slot, lista e opções remotas.
1718
1831
  getCurrentOptions() {
1719
1832
  // As opções projetadas são a fonte canônica quando não há coleção
1720
1833
  // imperativa: a lista virtualizada pode manter um snapshot enquanto o
@@ -1724,21 +1837,53 @@ const Select = class {
1724
1837
  const slotOptions = nodes
1725
1838
  .map((node) => this.nodeToOption(node))
1726
1839
  .filter((option) => Boolean(option));
1727
- if (slotOptions.length > 0)
1728
- return slotOptions;
1840
+ if (slotOptions.length > 0) {
1841
+ const normalizedSlotOptions = this.applyCanonicalSelection(slotOptions);
1842
+ if (this.effectiveMultiple &&
1843
+ !normalizedSlotOptions.some((option) => this.isSelectAllLabel(this.getOptionLabel(option)))) {
1844
+ normalizedSlotOptions.unshift({
1845
+ value: '__select_all__',
1846
+ label: this.selectAllLabel,
1847
+ selected: false,
1848
+ indeterminate: false,
1849
+ });
1850
+ }
1851
+ return normalizedSlotOptions;
1852
+ }
1729
1853
  }
1730
1854
  const listOptions = this.getSelectListController()?.options;
1731
1855
  if (Array.isArray(listOptions) && listOptions.length > 0) {
1732
1856
  const normalizedListOptions = listOptions.map((option) => ({ ...option }));
1733
1857
  const hasRealOptions = normalizedListOptions.some((option) => !this.isSelectAllLabel(this.getOptionLabel(option)));
1734
1858
  if (hasRealOptions) {
1735
- return normalizedListOptions;
1859
+ if (this.effectiveMultiple &&
1860
+ !normalizedListOptions.some((option) => this.isSelectAllLabel(this.getOptionLabel(option)))) {
1861
+ normalizedListOptions.unshift({
1862
+ value: '__select_all__',
1863
+ label: this.selectAllLabel,
1864
+ selected: false,
1865
+ indeterminate: false,
1866
+ });
1867
+ }
1868
+ return this.applyCanonicalSelection(normalizedListOptions);
1736
1869
  }
1737
1870
  }
1738
1871
  if (this.pendingOptions) {
1739
- return this.pendingOptions.map((option) => ({ ...option }));
1740
- }
1741
- return this.getHostOptions();
1872
+ return this.applyCanonicalSelection(this.pendingOptions);
1873
+ }
1874
+ const hostOptions = this.applyCanonicalSelection(this.getHostOptions());
1875
+ if (this.effectiveMultiple && hostOptions.length > 0) {
1876
+ return [
1877
+ {
1878
+ value: '__select_all__',
1879
+ label: this.selectAllLabel,
1880
+ selected: false,
1881
+ indeterminate: false,
1882
+ },
1883
+ ...hostOptions,
1884
+ ];
1885
+ }
1886
+ return hostOptions;
1742
1887
  }
1743
1888
  normalizeSearchText(value) {
1744
1889
  return value
@@ -1788,7 +1933,7 @@ const Select = class {
1788
1933
  return (h("br-select-input", { part: "input", exportparts: "container:input-container, input:input-field, label:input-label, group:input-group, icon:input-icon, action:input-action, action-button:input-action-button", ref: (el) => (this.selectInputElement = el), "aria-activedescendant": this.getActiveDescendant(), "aria-controls": this.listboxId, "aria-disabled": String(this.isDisabled()), "aria-expanded": String(this.effectiveOpen), "aria-haspopup": "listbox", "aria-label": this.getAccessibleLabel(), "aria-required": String(this.required), borderless: this.borderless, "is-inline": this.effectiveInline, "is-open": this.effectiveOpen, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, disabled: this.isDisabled(), filterable: this.filterable, showSearchIcon: this.showSearchIcon, autocomplete: this.autocomplete, "input-width": this.inputWidth, role: "combobox", value: this.filterable && this.effectiveOpen ? this.searchTerm : this.getRenderedDisplayValue() }));
1789
1934
  }
1790
1935
  renderSelectList() {
1791
- return (h("br-select-list", { part: "list", exportparts: "list, option, checkbox, select-all, empty-option, option-checkbox, option-radio", "active-option-index": this.activeOptionIndex, "aria-label": this.getAccessibleLabel(), "aria-multiselectable": this.effectiveMultiple ? 'true' : 'false', id: this.listboxId, "visible-items": this.visibleItems, "item-height": this.itemHeight, overscan: this.overscan, "search-term": this.filterable && this.searchMode === 'local' ? this.searchTerm : '', role: "listbox", "select-all-label": this.selectAllLabel, "unselect-all-label": this.unselectAllLabel, ref: (el) => {
1936
+ return (h("br-select-list", { part: "list", options: this.getCurrentOptions(), exportparts: "list, option, checkbox, select-all, empty-option, option-checkbox, option-radio", "active-option-index": this.activeOptionIndex, "aria-label": this.getAccessibleLabel(), "aria-multiselectable": this.effectiveMultiple ? 'true' : 'false', id: this.listboxId, "visible-items": this.visibleItems, "item-height": this.itemHeight, overscan: this.overscan, "search-term": this.filterable && this.searchMode === 'local' ? this.searchTerm : '', role: "listbox", "select-all-label": this.selectAllLabel, "unselect-all-label": this.unselectAllLabel, ref: (el) => {
1792
1937
  this.selectListElement = el;
1793
1938
  this.selectListElement.loading = this.loading;
1794
1939
  this.setSelectionMode(this.effectiveMultiple);
@@ -1796,9 +1941,8 @@ const Select = class {
1796
1941
  } }, h("slot", null), h("slot", { name: "loading", slot: "loading" })));
1797
1942
  }
1798
1943
  renderHiddenSelect() {
1799
- const selectedOptions = this.getFormOptions(this.getCurrentOptions())
1800
- .filter((option) => !this.isSelectAllLabel(this.getOptionLabel(option)))
1801
- .filter((option) => option.selected);
1944
+ const options = this.getFormOptions(this.getCurrentOptions()).filter((option) => !this.isSelectAllLabel(this.getOptionLabel(option)));
1945
+ const hasSelection = options.some((option) => option.selected);
1802
1946
  return (h("select", { ref: (el) => (this.nativeSelect = el), part: "hidden-select", name: this.name, autocomplete: this.autocomplete, multiple: this.effectiveMultiple, required: this.required, disabled: this.isDisabled(), tabIndex: -1, "aria-hidden": "true", style: {
1803
1947
  position: 'absolute',
1804
1948
  width: '1px',
@@ -1809,10 +1953,10 @@ const Select = class {
1809
1953
  clip: 'rect(0, 0, 0, 0)',
1810
1954
  whiteSpace: 'nowrap',
1811
1955
  border: '0',
1812
- }, onChange: (event) => event.preventDefault() }, h("option", { value: "", selected: selectedOptions.length === 0 }), selectedOptions.map((option) => (h("option", { key: option.value, value: option.value, selected: option.selected, disabled: option.disabled })))));
1956
+ }, onChange: (event) => event.preventDefault() }, h("option", { value: "", selected: !hasSelection }), options.map((option) => (h("option", { key: option.value, value: option.value, selected: option.selected, disabled: option.disabled })))));
1813
1957
  }
1814
1958
  render() {
1815
- return (h(Host, { key: 'acca9307d38da5b977fa8eac160bdd2b74eb573c', "aria-busy": this.isValidating || this.loading ? 'true' : null }, h("div", { key: 'b6a55059b9948c89c40415297315af9fa40939de', class: this.getCssClassMap(), part: "container" }, this.renderSelectInput(), this.renderSelectList(), h("div", { key: '789c2752631fed675dfe4f24e703a04a6012681f', part: "feedback", hidden: !this.hasFeedbackSlot && !this.validatorMessage }, h("slot", { key: '13f7245f98ee7c5529881b12d400180316e439f0', name: "feedback", onSlotchange: (event) => (this.hasFeedbackSlot = hasAssignedSlotContent(event.currentTarget)) }, this.validatorMessage)), h("div", { key: '3e2076875f4a9d7fd717151b918011b6ea89455e', part: "validation-loading", hidden: !this.hasValidationLoadingSlot || !this.isValidating }, h("slot", { key: 'cb51e859372eb703c4eed65e157bbefe7ab9e844', name: "validation-loading" })), this.renderHiddenSelect())));
1959
+ return (h(Host, { key: '9eab35d12b8b0fff68f16bb1e1ccc1209ea09687', "aria-busy": this.isValidating || this.loading ? 'true' : null }, h("div", { key: '68747830dd29319dc044caa056ffc13fea834bea', class: this.getCssClassMap(), part: "container" }, this.renderSelectInput(), this.renderSelectList(), h("div", { key: '825c7934402930816fba48f02d161d936c8a4e3e', part: "feedback", hidden: !this.hasFeedbackSlot && !this.validatorMessage }, h("slot", { key: '10b2ee676c54b913b39b6523d3ebce462ed031e3', name: "feedback", onSlotchange: (event) => (this.hasFeedbackSlot = hasAssignedSlotContent(event.currentTarget)) }, this.validatorMessage)), h("div", { key: '571a5a5e89ae14a91f8c88c0b1fb5e7341adb094', part: "validation-loading", hidden: !this.hasValidationLoadingSlot || !this.isValidating }, h("slot", { key: 'e9647f09ce303d15a564707e1d3a060280de10a1', name: "validation-loading" })), this.renderHiddenSelect())));
1816
1960
  }
1817
1961
  static get formAssociated() { return true; }
1818
1962
  get el() { return getElement(this); }
@@ -161,8 +161,9 @@ const HeaderLogo = class {
161
161
  * @returns JSX do componente.
162
162
  */
163
163
  render() {
164
- return (h(Host, { key: '474f36880dc136e05ca089304ecf59d60d2737d1' }, h("slot", { key: '66f9073605f683f0b716e51f86690cd5e79e77de' }, h("div", { key: '1b489db57d26ba0409beafb81ed8458916fcdf38', id: this.customId, class: this.getCssClassMap(), part: "container" }, this.href && this.href.trim() !== '' ? (h("a", { href: this.href, target: this.target, rel: this.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: this.handleClick }, this.renderImageElement())) : (this.renderImageElement())))));
164
+ return (h(Host, { key: '31a3b7c3feb28df1bb66fb38832ed93ffec8a47b' }, h("slot", { key: 'c3c1b1c2ad499c63866fe44a72ee8ec1b9cd43d6' }, h("div", { key: '1edc6208374cee19b27d47f1e760cd25601286be', id: this.customId, class: this.getCssClassMap(), part: "container" }, this.href && this.href.trim() !== '' ? (h("a", { href: this.href, target: this.target, rel: this.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: this.handleClick }, this.renderImageElement())) : (this.renderImageElement())))));
165
165
  }
166
+ static get delegatesFocus() { return true; }
166
167
  get el() { return getElement(this); }
167
168
  static get watchers() { return {
168
169
  "isCompact": [{
@@ -433,7 +433,7 @@ const Icon = class {
433
433
  return {
434
434
  role: isInformative || isFocusable ? 'img' : null,
435
435
  'aria-label': this.label || null,
436
- tabindex: isFocusable ? 0 : '-1',
436
+ tabindex: isFocusable ? 0 : null,
437
437
  'aria-hidden': isInformative || isFocusable ? null : 'true',
438
438
  focusable: isFocusable ? true : 'false',
439
439
  };