@govbr-ds/webcomponents 2.0.0-next.56 → 2.0.0-next.57
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-checkbox.br-input.br-radio.entry.cjs.js.map +1 -1
- package/dist/cjs/br-checkbox_3.cjs.entry.js +63 -2
- package/dist/cjs/br-dropdown.br-select.entry.cjs.js.map +1 -1
- package/dist/cjs/br-dropdown_2.cjs.entry.js +95 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/input/input.js +87 -2
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/select/select.js +160 -8
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/pages/components/select/index.js +41 -0
- package/dist/components/br-input.js +4 -4
- package/dist/components/br-pagination.js +2 -2
- package/dist/components/br-select.js +4 -4
- package/dist/components/{p-Cw0pxndP.js → p-B8JLH_ik.js} +171 -74
- package/dist/components/p-B8JLH_ik.js.map +1 -0
- package/dist/components/{p-CbnpaWFn.js → p-CkOo_SmU.js} +75 -9
- package/dist/components/p-CkOo_SmU.js.map +1 -0
- package/dist/custom-elements.json +171 -4
- package/dist/esm/br-checkbox.br-input.br-radio.entry.js.map +1 -1
- package/dist/esm/br-checkbox_3.entry.js +63 -2
- package/dist/esm/br-dropdown.br-select.entry.js.map +1 -1
- package/dist/esm/br-dropdown_2.entry.js +95 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/hydrate/index.js +167 -11
- package/dist/hydrate/index.mjs +167 -11
- package/dist/types/components/input/input.d.ts +9 -0
- package/dist/types/components/select/select.d.ts +25 -0
- package/dist/types/components.d.ts +30 -8
- package/dist/webcomponents/br-checkbox.br-input.br-radio.entry.esm.js.map +1 -1
- package/dist/webcomponents/br-dropdown.br-select.entry.esm.js.map +1 -1
- package/dist/webcomponents/{p-abfb0743.entry.js → p-6511c9cd.entry.js} +126 -64
- package/dist/webcomponents/p-6511c9cd.entry.js.map +1 -0
- package/dist/webcomponents/{p-67d88dcb.entry.js → p-a7fa8119.entry.js} +110 -18
- package/dist/webcomponents/p-a7fa8119.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +15 -15
- package/dist/webcomponents.html-custom-data.json +7 -2
- package/package.json +1 -1
- package/dist/components/p-CbnpaWFn.js.map +0 -1
- package/dist/components/p-Cw0pxndP.js.map +0 -1
- package/dist/webcomponents/p-67d88dcb.entry.js.map +0 -1
- package/dist/webcomponents/p-abfb0743.entry.js.map +0 -1
|
@@ -44,7 +44,7 @@ var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
44
44
|
|
|
45
45
|
patchBrowser().then(async (options) => {
|
|
46
46
|
await appGlobals.globalScripts();
|
|
47
|
-
return index.bootstrapLazy(JSON.parse("[[\"br-pagination.cjs\",[[321,\"br-pagination\",{\"colorMode\":[513,\"color-mode\"],\"customId\":[513,\"custom-id\"],\"total\":[514],\"current\":[1538],\"ariaLabel\":[513,\"aria-label\"],\"previousLabel\":[513,\"previous-label\"],\"nextLabel\":[513,\"next-label\"],\"ellipsisLabel\":[513,\"ellipsis-label\"],\"density\":[513],\"variant\":[513],\"totalItems\":[514,\"total-items\"],\"perPage\":[1538,\"per-page\"],\"perPageOptions\":[16],\"perPageLabel\":[513,\"per-page-label\"],\"goToPageLabel\":[513,\"go-to-page-label\"],\"itemsText\":[513,\"items-text\"],\"isSmall\":[32]},null,{\"total\":[\"handleTotalChange\"],\"current\":[\"handleCurrentChange\"]}]]],[\"br-breadcrumb.cjs\",[[257,\"br-breadcrumb\",{\"customId\":[513,\"custom-id\"],\"homeUrl\":[1,\"home-url\"],\"crumbs\":[1],\"showTooltip\":[32],\"tooltipPosition\":[32],\"tooltipText\":[32],\"isSmallScreen\":[32],\"isTruncate\":[32],\"larguraInterna\":[32],\"larguraPai\":[32],\"isFolderOpen\":[32]}]]],[\"br-footer-category.cjs\",[[257,\"br-footer-category\",{\"customId\":[513,\"custom-id\"],\"label\":[513],\"isDesktop\":[32],\"accordionGroup\":[32]}]]],[\"br-footer-social.cjs\",[[257,\"br-footer-social\",{\"customId\":[513,\"custom-id\"],\"icon\":[513],\"description\":[513],\"href\":[513]}]]],[\"br-message.cjs\",[[321,\"br-message\",{\"messageTitle\":[513,\"message-title\"],\"customId\":[513,\"custom-id\"],\"message\":[513],\"isInline\":[516,\"is-inline\"],\"isClosable\":[516,\"is-closable\"],\"autoRemove\":[516,\"auto-remove\"],\"showIcon\":[516,\"show-icon\"],\"isFeedback\":[516,\"is-feedback\"],\"state\":[513]}]]],[\"br-modal.cjs\",[[321,\"br-modal\",{\"customId\":[513,\"custom-id\"],\"titleText\":[1,\"title-text\"],\"show\":[1540],\"autoClose\":[516,\"auto-close\"],\"initialFocusSelector\":[1,\"initial-focus-selector\"],\"size\":[513],\"scrim\":[516],\"scrollable\":[516],\"alignFooter\":[513,\"align-footer\"],\"open\":[64],\"close\":[64]}]]],[\"br-step-item.cjs\",[[321,\"br-step-item\",{\"label\":[513],\"highlight\":[513],\"active\":[516],\"disabled\":[516],\"brIconName\":[513,\"br-icon-name\"],\"brIconAria\":[513,\"br-icon-aria\"],\"showTimeLine\":[32],\"stepItemPositionStatus\":[32],\"stepLayout\":[32],\"labelPosition\":[32],\"contentType\":[32],\"mode\":[32],\"content\":[32],\"ariaLabelContent\":[32],\"setStepItemPositionStatus\":[64],\"handleShowTimeLine\":[64],\"setLabelPosition\":[64],\"setContentType\":[64],\"setMode\":[64],\"setContent\":[64]},null,{\"active\":[\"watchItemIsActive\"]}]]],[\"br-tag.cjs\",[[321,\"br-tag\",{\"label\":[513],\"iconName\":[513,\"icon-name\"],\"name\":[513],\"multiple\":[516],\"selected\":[1540],\"customId\":[513,\"custom-id\"],\"bgColor\":[513,\"bg-color\"],\"density\":[513],\"shape\":[513],\"status\":[516],\"interaction\":[1540],\"interactionSelect\":[516,\"interaction-select\"],\"disabled\":[516],\"ariaLabel\":[513,\"aria-label\"],\"ariaDescribedby\":[513,\"aria-describedby\"],\"selectedClassValue\":[32]},[[4,\"radioSelected\",\"handleCheckedChange\"]],{\"interaction\":[\"handleInteractionChange\"],\"interactionSelect\":[\"handleInteractionSelectChange\"],\"selected\":[\"handleSelectedChange\"]}]]],[\"br-tooltip.cjs\",[[321,\"br-tooltip\",{\"customId\":[513,\"custom-id\"],\"position\":[513],\"type\":[513],\"density\":[513],\"state\":[513],\"isAutoVisible\":[516,\"is-auto-visible\"],\"showDelay\":[514,\"show-delay\"],\"hideDelay\":[514,\"hide-delay\"],\"isVisible\":[32]},[[0,\"focusin\",\"handleFocusIn\"],[0,\"focusout\",\"handleFocusOut\"],[4,\"keydown\",\"handleKeyDown\"]],{\"isVisible\":[\"handleVisibilityChange\"]}]]],[\"br-upload.cjs\",[[321,\"br-upload\",{\"customId\":[513,\"custom-id\"],\"accept\":[1],\"label\":[1],\"disabled\":[516],\"state\":[513],\"multiple\":[4],\"filesSelected\":[32],\"file\":[32]}]]],[\"br-avatar.cjs\",[[257,\"br-avatar\",{\"density\":[1025],\"customId\":[513,\"custom-id\"],\"src\":[1],\"alt\":[1],\"isIconic\":[4,\"is-iconic\"],\"text\":[1],\"disabled\":[4],\"bgColor\":[513,\"bg-color\"],\"hasError\":[32]},null,{\"density\":[\"handleDensityChange\"]}]]],[\"br-checkgroup.cjs\",[[321,\"br-checkgroup\",{\"label\":[1],\"labelSelecionado\":[513,\"label-selecionado\"],\"labelDesselecionado\":[513,\"label-desselecionado\"],\"indeterminate\":[516],\"customId\":[513,\"custom-id\"],\"checked\":[32],\"isIndeterminate\":[32],\"numberOfChildren\":[32]},[[4,\"checkedChange\",\"handleChange\"]]]]],[\"br-footer.cjs\",[[257,\"br-footer\",{\"customId\":[513,\"custom-id\"],\"theme\":[513],\"socialNetworkTitle\":[513,\"social-network-title\"]}]]],[\"br-footer-item.cjs\",[[257,\"br-footer-item\",{\"customId\":[513,\"custom-id\"],\"href\":[513]}]]],[\"br-sign-in.cjs\",[[321,\"br-sign-in\",{\"customId\":[513,\"custom-id\"],\"colorMode\":[513,\"color-mode\"],\"density\":[513],\"disabled\":[516],\"emphasis\":[513],\"shape\":[513],\"href\":[513],\"target\":[513],\"ariaLabel\":[513,\"aria-label\"]}]]],[\"br-tab.cjs\",[[257,\"br-tab\",{\"customId\":[513,\"custom-id\"],\"density\":[513],\"colorMode\":[513,\"color-mode\"],\"label\":[513],\"alignItemsTab\":[513,\"align-items-tab\"],\"tabItems\":[32],\"activeTabId\":[32]},[[0,\"brTabItemPropsChange\",\"handleTabItemPropsChange\"]],{\"activeTabId\":[\"activeTabChanged\"],\"colorMode\":[\"colorModeChanged\"]}]]],[\"br-card.cjs\",[[321,\"br-card\",{\"customId\":[513,\"custom-id\"],\"disabled\":[516],\"hover\":[516]}]]],[\"br-footer-legal.cjs\",[[257,\"br-footer-legal\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-footer-logo.cjs\",[[257,\"br-footer-logo\",{\"customId\":[513,\"custom-id\"],\"src\":[513],\"description\":[513],\"position\":[513],\"isPartner\":[516,\"is-partner\"],\"href\":[513],\"target\":[513]}]]],[\"br-loading.cjs\",[[321,\"br-loading\",{\"isProgress\":[516,\"is-progress\"],\"customId\":[513,\"custom-id\"],\"progressPercent\":[514,\"progress-percent\"],\"isMedium\":[516,\"is-medium\"],\"label\":[513]}]]],[\"br-magic-button.cjs\",[[321,\"br-magic-button\",{\"customId\":[513,\"custom-id\"],\"label\":[513],\"icon\":[513],\"density\":[513],\"circle\":[516],\"ariaLabel\":[1,\"aria-label\"]}]]],[\"br-scrim.cjs\",[[321,\"br-scrim\",{\"customId\":[513,\"custom-id\"],\"isOpen\":[516,\"is-open\"],\"positionContent\":[1,\"position-content\"],\"disableCloseOnClick\":[4,\"disable-close-on-click\"],\"zIndex\":[2,\"z-index\"],\"bgColor\":[1,\"bg-color\"],\"customOpacity\":[2,\"custom-opacity\"],\"displayMode\":[1,\"display-mode\"],\"scrollStrategy\":[1,\"scroll-strategy\"],\"scrollThreshold\":[1026,\"scroll-threshold\"],\"activator\":[1],\"ariaLabel\":[1,\"aria-label\"],\"isActive\":[32],\"hasActivatorSlot\":[32],\"setScrollThreshold\":[64],\"open\":[64],\"close\":[64],\"toggle\":[64]},null,{\"isOpen\":[\"handleOpenChange\"],\"zIndex\":[\"updateStyles\"],\"bgColor\":[\"updateStyles\"],\"customOpacity\":[\"updateStyles\"],\"activator\":[\"handleActivatorChange\"]}]]],[\"br-step.cjs\",[[321,\"br-step\",{\"layout\":[513],\"initialStep\":[513,\"initial-step\"],\"labelPosition\":[513,\"label-position\"],\"contentType\":[513,\"content-type\"],\"mode\":[513],\"progressionType\":[513,\"progression-type\"],\"activeStep\":[32],\"stepItems\":[32],\"ProceedToNextStep\":[64],\"BackToPreviousStep\":[64],\"StepValidation\":[64],\"GetActiveStep\":[64]},[[2,\"click\",\"handleClick\"]]]]],[\"br-switch.cjs\",[[321,\"br-switch\",{\"disabled\":[516],\"checked\":[1540],\"customId\":[513,\"custom-id\"],\"label\":[1],\"labelPosition\":[513,\"label-position\"],\"labelOn\":[513,\"label-on\"],\"labelOff\":[513,\"label-off\"],\"hasIcon\":[516,\"has-icon\"],\"name\":[513],\"value\":[513],\"density\":[513],\"_slotDefault\":[32],\"toggleChecked\":[64]}]]],[\"br-tab-item.cjs\",[[257,\"br-tab-item\",{\"tabItemId\":[1537,\"tab-item-id\"],\"tabItemTitle\":[513,\"tab-item-title\"],\"icon\":[513],\"onlyIcon\":[516,\"only-icon\"],\"isActive\":[1540,\"is-active\"],\"counter\":[513],\"colorMode\":[513,\"color-mode\"]},null,{\"tabItemTitle\":[\"tabItemTitleChanged\"],\"icon\":[\"iconChanged\"],\"counter\":[\"counterChanged\"],\"onlyIcon\":[\"onlyIconChanged\"]}]]],[\"br-table.cjs\",[[257,\"br-table\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-table-cell.cjs\",[[257,\"br-table-cell\",{\"customId\":[513,\"custom-id\"],\"hasVerticalBorder\":[516,\"has-vertical-border\"],\"horizontalAlign\":[513,\"horizontal-align\"]},[[4,\"brHorizontalAlignDidChange\",\"handleHorizontalAlignDidChange\"]],{\"horizontalAlign\":[\"handleHorizontalAlignChange\"]}]]],[\"br-table-header-cell.cjs\",[[257,\"br-table-header-cell\",{\"customId\":[513,\"custom-id\"],\"hasVerticalBorder\":[516,\"has-vertical-border\"],\"horizontalAlign\":[513,\"horizontal-align\"]},null,{\"horizontalAlign\":[\"handleHorizontalAlignChange\"]}]]],[\"br-table-header-row.cjs\",[[257,\"br-table-header-row\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-table-row.cjs\",[[257,\"br-table-row\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-textarea.cjs\",[[321,\"br-textarea\",{\"value\":[1537],\"label\":[513],\"placeholder\":[513],\"ariaLabel\":[513,\"aria-label\"],\"customId\":[513,\"custom-id\"],\"disabled\":[516],\"maxlength\":[514],\"showCounter\":[516,\"show-counter\"],\"state\":[513],\"density\":[513],\"isInline\":[516,\"is-inline\"],\"currentLength\":[32],\"setValue\":[64]},null,{\"value\":[\"valueChanged\"]}]]],[\"br-button_2.cjs\",[[321,\"br-button\",{\"colorMode\":[513,\"color-mode\"],\"customId\":[513,\"custom-id\"],\"density\":[513],\"disabled\":[516],\"emphasis\":[513],\"isActive\":[516,\"is-active\"],\"isLoading\":[516,\"is-loading\"],\"shape\":[513],\"type\":[513],\"value\":[513],\"ariaLabel\":[513,\"aria-label\"],\"ariaPressed\":[513,\"aria-pressed\"]}],[257,\"br-icon\",{\"iconName\":[513,\"icon-name\"],\"height\":[513],\"customId\":[513,\"custom-id\"],\"width\":[513],\"cssClasses\":[513,\"css-classes\"],\"isInline\":[516,\"is-inline\"],\"rotate\":[513],\"flip\":[513],\"isFocusable\":[516,\"is-focusable\"],\"lazy\":[516]}]]],[\"br-checkbox_3.cjs\",[[321,\"br-input\",{\"type\":[513],\"autocomplete\":[513],\"density\":[513],\"disabled\":[516],\"isInline\":[516,\"is-inline\"],\"isHighlight\":[516,\"is-highlight\"],\"state\":[513],\"label\":[513],\"customId\":[513,\"custom-id\"],\"name\":[513],\"placeholder\":[513],\"readonly\":[516],\"required\":[516],\"value\":[1537],\"controlWidth\":[513,\"control-width\"],\"borderless\":[516],\"helpText\":[513,\"help-text\"],\"autocorrect\":[513],\"min\":[514],\"max\":[514],\"minlength\":[514],\"maxlength\":[514],\"multiple\":[516],\"pattern\":[513],\"step\":[514],\"actionLabel\":[513,\"action-label\"],\"isPasswordVisible\":[32],\"internalState\":[32],\"hasIconSlot\":[32],\"hasActionSlot\":[32],\"hasFeedbackSlot\":[32]}],[321,\"br-radio\",{\"checked\":[1540],\"disabled\":[516],\"state\":[513],\"hasHiddenLabel\":[516,\"has-hidden-label\"],\"customId\":[513,\"custom-id\"],\"name\":[513],\"label\":[513],\"value\":[513],\"toggleChecked\":[64]},[[8,\"checkedChange\",\"handleCheckedChange\"],[0,\"keydown\",\"handleKeyDown\"]]],[321,\"br-checkbox\",{\"indeterminate\":[1540],\"checked\":[1540],\"customId\":[513,\"custom-id\"],\"disabled\":[516],\"hasHiddenLabel\":[516,\"has-hidden-label\"],\"label\":[513],\"name\":[513],\"state\":[513],\"value\":[513],\"isFather\":[4,\"is-father\"],\"slotDefault\":[32],\"numberOfChildren\":[32],\"setIndeterminate\":[64],\"toggleChecked\":[64],\"setNumberOfChildren\":[64]},null,{\"indeterminate\":[\"updateIndeterminate\"]}]]],[\"br-dropdown_2.cjs\",[[321,\"br-select\",{\"label\":[513],\"placeholder\":[513],\"isMultiple\":[516,\"is-multiple\"],\"options\":[513],\"selectAllLabel\":[513,\"select-all-label\"],\"unselectAllLabel\":[513,\"unselect-all-label\"],\"showSearchIcon\":[516,\"show-search-icon\"],\"isOpen\":[516,\"is-open\"],\"isInline\":[516,\"is-inline\"],\"inputWidth\":[513,\"input-width\"],\"borderless\":[516],\"customId\":[513,\"custom-id\"],\"value\":[1],\"parsedOptions\":[32],\"inputValue\":[32],\"selectedValue\":[32],\"isAllSelected\":[32],\"isExpanded\":[32],\"focusedIndex\":[32],\"toggleOpen\":[64]},null,{\"options\":[\"synchronizeSelect\"],\"value\":[\"syncValueFromOutside\"]}],[321,\"br-dropdown\",{\"isOpen\":[1540,\"is-open\"],\"customId\":[513,\"custom-id\"],\"placement\":[513],\"preventAutoDismiss\":[516,\"prevent-auto-dismiss\"],\"targetZIndex\":[1,\"target-z-index\"],\"open\":[64],\"hide\":[64],\"setFocus\":[64]},null,{\"isOpen\":[\"isOpenChanged\"],\"targetZIndex\":[\"targetZIndexChanged\"]}]]],[\"br-divider.cjs\",[[257,\"br-divider\",{\"customId\":[513,\"custom-id\"],\"orientation\":[513],\"thickness\":[513],\"borderStyle\":[513,\"border-style\"],\"isDarkMode\":[516,\"is-dark-mode\"],\"color\":[513],\"align\":[1],\"bleed\":[4],\"marginTop\":[2,\"margin-top\"],\"marginBottom\":[2,\"margin-bottom\"],\"marginLeft\":[2,\"margin-left\"],\"marginRight\":[2,\"margin-right\"]},null,{\"color\":[\"updateColor\"],\"marginTop\":[\"updateMargins\"],\"marginBottom\":[\"updateMargins\"],\"marginLeft\":[\"updateMargins\"],\"marginRight\":[\"updateMargins\"]}]]],[\"br-collapse.cjs\",[[321,\"br-collapse\",{\"customId\":[513,\"custom-id\"],\"open\":[1540],\"accordionGroup\":[1,\"accordion-group\"],\"iconToShow\":[1,\"icon-to-show\"],\"iconToHide\":[1,\"icon-to-hide\"],\"iconPosition\":[1,\"icon-position\"],\"openCollapse\":[64],\"closeCollapse\":[64]},[[4,\"brDidOpen\",\"handleOpen\"]]]]],[\"br-item_2.cjs\",[[321,\"br-list\",{\"header\":[513],\"isHorizontal\":[516,\"is-horizontal\"],\"customId\":[513,\"custom-id\"],\"hideHeaderDivider\":[516,\"hide-header-divider\"],\"collapse\":[516],\"accordion\":[513]}],[321,\"br-item\",{\"disabled\":[516],\"customId\":[513,\"custom-id\"],\"isActive\":[516,\"is-active\"],\"isSelected\":[516,\"is-selected\"],\"isInteractive\":[516,\"is-interactive\"],\"href\":[513],\"target\":[513],\"isButton\":[516,\"is-button\"],\"type\":[1537],\"value\":[513],\"density\":[513],\"hasSlotDefault\":[32],\"hasSlotStart\":[32],\"hasSlotEnd\":[32],\"selectedValue\":[32],\"setFocus\":[64]},[[4,\"checkedChange\",\"handleRadioChange\"],[4,\"checkedChange\",\"handleCheckboxChange\"]]]]]]"), options);
|
|
47
|
+
return index.bootstrapLazy(JSON.parse("[[\"br-pagination.cjs\",[[321,\"br-pagination\",{\"colorMode\":[513,\"color-mode\"],\"customId\":[513,\"custom-id\"],\"total\":[514],\"current\":[1538],\"ariaLabel\":[513,\"aria-label\"],\"previousLabel\":[513,\"previous-label\"],\"nextLabel\":[513,\"next-label\"],\"ellipsisLabel\":[513,\"ellipsis-label\"],\"density\":[513],\"variant\":[513],\"totalItems\":[514,\"total-items\"],\"perPage\":[1538,\"per-page\"],\"perPageOptions\":[16],\"perPageLabel\":[513,\"per-page-label\"],\"goToPageLabel\":[513,\"go-to-page-label\"],\"itemsText\":[513,\"items-text\"],\"isSmall\":[32]},null,{\"total\":[\"handleTotalChange\"],\"current\":[\"handleCurrentChange\"]}]]],[\"br-breadcrumb.cjs\",[[257,\"br-breadcrumb\",{\"customId\":[513,\"custom-id\"],\"homeUrl\":[1,\"home-url\"],\"crumbs\":[1],\"showTooltip\":[32],\"tooltipPosition\":[32],\"tooltipText\":[32],\"isSmallScreen\":[32],\"isTruncate\":[32],\"larguraInterna\":[32],\"larguraPai\":[32],\"isFolderOpen\":[32]}]]],[\"br-footer-category.cjs\",[[257,\"br-footer-category\",{\"customId\":[513,\"custom-id\"],\"label\":[513],\"isDesktop\":[32],\"accordionGroup\":[32]}]]],[\"br-footer-social.cjs\",[[257,\"br-footer-social\",{\"customId\":[513,\"custom-id\"],\"icon\":[513],\"description\":[513],\"href\":[513]}]]],[\"br-message.cjs\",[[321,\"br-message\",{\"messageTitle\":[513,\"message-title\"],\"customId\":[513,\"custom-id\"],\"message\":[513],\"isInline\":[516,\"is-inline\"],\"isClosable\":[516,\"is-closable\"],\"autoRemove\":[516,\"auto-remove\"],\"showIcon\":[516,\"show-icon\"],\"isFeedback\":[516,\"is-feedback\"],\"state\":[513]}]]],[\"br-modal.cjs\",[[321,\"br-modal\",{\"customId\":[513,\"custom-id\"],\"titleText\":[1,\"title-text\"],\"show\":[1540],\"autoClose\":[516,\"auto-close\"],\"initialFocusSelector\":[1,\"initial-focus-selector\"],\"size\":[513],\"scrim\":[516],\"scrollable\":[516],\"alignFooter\":[513,\"align-footer\"],\"open\":[64],\"close\":[64]}]]],[\"br-step-item.cjs\",[[321,\"br-step-item\",{\"label\":[513],\"highlight\":[513],\"active\":[516],\"disabled\":[516],\"brIconName\":[513,\"br-icon-name\"],\"brIconAria\":[513,\"br-icon-aria\"],\"showTimeLine\":[32],\"stepItemPositionStatus\":[32],\"stepLayout\":[32],\"labelPosition\":[32],\"contentType\":[32],\"mode\":[32],\"content\":[32],\"ariaLabelContent\":[32],\"setStepItemPositionStatus\":[64],\"handleShowTimeLine\":[64],\"setLabelPosition\":[64],\"setContentType\":[64],\"setMode\":[64],\"setContent\":[64]},null,{\"active\":[\"watchItemIsActive\"]}]]],[\"br-tag.cjs\",[[321,\"br-tag\",{\"label\":[513],\"iconName\":[513,\"icon-name\"],\"name\":[513],\"multiple\":[516],\"selected\":[1540],\"customId\":[513,\"custom-id\"],\"bgColor\":[513,\"bg-color\"],\"density\":[513],\"shape\":[513],\"status\":[516],\"interaction\":[1540],\"interactionSelect\":[516,\"interaction-select\"],\"disabled\":[516],\"ariaLabel\":[513,\"aria-label\"],\"ariaDescribedby\":[513,\"aria-describedby\"],\"selectedClassValue\":[32]},[[4,\"radioSelected\",\"handleCheckedChange\"]],{\"interaction\":[\"handleInteractionChange\"],\"interactionSelect\":[\"handleInteractionSelectChange\"],\"selected\":[\"handleSelectedChange\"]}]]],[\"br-tooltip.cjs\",[[321,\"br-tooltip\",{\"customId\":[513,\"custom-id\"],\"position\":[513],\"type\":[513],\"density\":[513],\"state\":[513],\"isAutoVisible\":[516,\"is-auto-visible\"],\"showDelay\":[514,\"show-delay\"],\"hideDelay\":[514,\"hide-delay\"],\"isVisible\":[32]},[[0,\"focusin\",\"handleFocusIn\"],[0,\"focusout\",\"handleFocusOut\"],[4,\"keydown\",\"handleKeyDown\"]],{\"isVisible\":[\"handleVisibilityChange\"]}]]],[\"br-upload.cjs\",[[321,\"br-upload\",{\"customId\":[513,\"custom-id\"],\"accept\":[1],\"label\":[1],\"disabled\":[516],\"state\":[513],\"multiple\":[4],\"filesSelected\":[32],\"file\":[32]}]]],[\"br-avatar.cjs\",[[257,\"br-avatar\",{\"density\":[1025],\"customId\":[513,\"custom-id\"],\"src\":[1],\"alt\":[1],\"isIconic\":[4,\"is-iconic\"],\"text\":[1],\"disabled\":[4],\"bgColor\":[513,\"bg-color\"],\"hasError\":[32]},null,{\"density\":[\"handleDensityChange\"]}]]],[\"br-checkgroup.cjs\",[[321,\"br-checkgroup\",{\"label\":[1],\"labelSelecionado\":[513,\"label-selecionado\"],\"labelDesselecionado\":[513,\"label-desselecionado\"],\"indeterminate\":[516],\"customId\":[513,\"custom-id\"],\"checked\":[32],\"isIndeterminate\":[32],\"numberOfChildren\":[32]},[[4,\"checkedChange\",\"handleChange\"]]]]],[\"br-footer.cjs\",[[257,\"br-footer\",{\"customId\":[513,\"custom-id\"],\"theme\":[513],\"socialNetworkTitle\":[513,\"social-network-title\"]}]]],[\"br-footer-item.cjs\",[[257,\"br-footer-item\",{\"customId\":[513,\"custom-id\"],\"href\":[513]}]]],[\"br-sign-in.cjs\",[[321,\"br-sign-in\",{\"customId\":[513,\"custom-id\"],\"colorMode\":[513,\"color-mode\"],\"density\":[513],\"disabled\":[516],\"emphasis\":[513],\"shape\":[513],\"href\":[513],\"target\":[513],\"ariaLabel\":[513,\"aria-label\"]}]]],[\"br-tab.cjs\",[[257,\"br-tab\",{\"customId\":[513,\"custom-id\"],\"density\":[513],\"colorMode\":[513,\"color-mode\"],\"label\":[513],\"alignItemsTab\":[513,\"align-items-tab\"],\"tabItems\":[32],\"activeTabId\":[32]},[[0,\"brTabItemPropsChange\",\"handleTabItemPropsChange\"]],{\"activeTabId\":[\"activeTabChanged\"],\"colorMode\":[\"colorModeChanged\"]}]]],[\"br-card.cjs\",[[321,\"br-card\",{\"customId\":[513,\"custom-id\"],\"disabled\":[516],\"hover\":[516]}]]],[\"br-footer-legal.cjs\",[[257,\"br-footer-legal\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-footer-logo.cjs\",[[257,\"br-footer-logo\",{\"customId\":[513,\"custom-id\"],\"src\":[513],\"description\":[513],\"position\":[513],\"isPartner\":[516,\"is-partner\"],\"href\":[513],\"target\":[513]}]]],[\"br-loading.cjs\",[[321,\"br-loading\",{\"isProgress\":[516,\"is-progress\"],\"customId\":[513,\"custom-id\"],\"progressPercent\":[514,\"progress-percent\"],\"isMedium\":[516,\"is-medium\"],\"label\":[513]}]]],[\"br-magic-button.cjs\",[[321,\"br-magic-button\",{\"customId\":[513,\"custom-id\"],\"label\":[513],\"icon\":[513],\"density\":[513],\"circle\":[516],\"ariaLabel\":[1,\"aria-label\"]}]]],[\"br-scrim.cjs\",[[321,\"br-scrim\",{\"customId\":[513,\"custom-id\"],\"isOpen\":[516,\"is-open\"],\"positionContent\":[1,\"position-content\"],\"disableCloseOnClick\":[4,\"disable-close-on-click\"],\"zIndex\":[2,\"z-index\"],\"bgColor\":[1,\"bg-color\"],\"customOpacity\":[2,\"custom-opacity\"],\"displayMode\":[1,\"display-mode\"],\"scrollStrategy\":[1,\"scroll-strategy\"],\"scrollThreshold\":[1026,\"scroll-threshold\"],\"activator\":[1],\"ariaLabel\":[1,\"aria-label\"],\"isActive\":[32],\"hasActivatorSlot\":[32],\"setScrollThreshold\":[64],\"open\":[64],\"close\":[64],\"toggle\":[64]},null,{\"isOpen\":[\"handleOpenChange\"],\"zIndex\":[\"updateStyles\"],\"bgColor\":[\"updateStyles\"],\"customOpacity\":[\"updateStyles\"],\"activator\":[\"handleActivatorChange\"]}]]],[\"br-step.cjs\",[[321,\"br-step\",{\"layout\":[513],\"initialStep\":[513,\"initial-step\"],\"labelPosition\":[513,\"label-position\"],\"contentType\":[513,\"content-type\"],\"mode\":[513],\"progressionType\":[513,\"progression-type\"],\"activeStep\":[32],\"stepItems\":[32],\"ProceedToNextStep\":[64],\"BackToPreviousStep\":[64],\"StepValidation\":[64],\"GetActiveStep\":[64]},[[2,\"click\",\"handleClick\"]]]]],[\"br-switch.cjs\",[[321,\"br-switch\",{\"disabled\":[516],\"checked\":[1540],\"customId\":[513,\"custom-id\"],\"label\":[1],\"labelPosition\":[513,\"label-position\"],\"labelOn\":[513,\"label-on\"],\"labelOff\":[513,\"label-off\"],\"hasIcon\":[516,\"has-icon\"],\"name\":[513],\"value\":[513],\"density\":[513],\"_slotDefault\":[32],\"toggleChecked\":[64]}]]],[\"br-tab-item.cjs\",[[257,\"br-tab-item\",{\"tabItemId\":[1537,\"tab-item-id\"],\"tabItemTitle\":[513,\"tab-item-title\"],\"icon\":[513],\"onlyIcon\":[516,\"only-icon\"],\"isActive\":[1540,\"is-active\"],\"counter\":[513],\"colorMode\":[513,\"color-mode\"]},null,{\"tabItemTitle\":[\"tabItemTitleChanged\"],\"icon\":[\"iconChanged\"],\"counter\":[\"counterChanged\"],\"onlyIcon\":[\"onlyIconChanged\"]}]]],[\"br-table.cjs\",[[257,\"br-table\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-table-cell.cjs\",[[257,\"br-table-cell\",{\"customId\":[513,\"custom-id\"],\"hasVerticalBorder\":[516,\"has-vertical-border\"],\"horizontalAlign\":[513,\"horizontal-align\"]},[[4,\"brHorizontalAlignDidChange\",\"handleHorizontalAlignDidChange\"]],{\"horizontalAlign\":[\"handleHorizontalAlignChange\"]}]]],[\"br-table-header-cell.cjs\",[[257,\"br-table-header-cell\",{\"customId\":[513,\"custom-id\"],\"hasVerticalBorder\":[516,\"has-vertical-border\"],\"horizontalAlign\":[513,\"horizontal-align\"]},null,{\"horizontalAlign\":[\"handleHorizontalAlignChange\"]}]]],[\"br-table-header-row.cjs\",[[257,\"br-table-header-row\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-table-row.cjs\",[[257,\"br-table-row\",{\"customId\":[513,\"custom-id\"]}]]],[\"br-textarea.cjs\",[[321,\"br-textarea\",{\"value\":[1537],\"label\":[513],\"placeholder\":[513],\"ariaLabel\":[513,\"aria-label\"],\"customId\":[513,\"custom-id\"],\"disabled\":[516],\"maxlength\":[514],\"showCounter\":[516,\"show-counter\"],\"state\":[513],\"density\":[513],\"isInline\":[516,\"is-inline\"],\"currentLength\":[32],\"setValue\":[64]},null,{\"value\":[\"valueChanged\"]}]]],[\"br-button_2.cjs\",[[321,\"br-button\",{\"colorMode\":[513,\"color-mode\"],\"customId\":[513,\"custom-id\"],\"density\":[513],\"disabled\":[516],\"emphasis\":[513],\"isActive\":[516,\"is-active\"],\"isLoading\":[516,\"is-loading\"],\"shape\":[513],\"type\":[513],\"value\":[513],\"ariaLabel\":[513,\"aria-label\"],\"ariaPressed\":[513,\"aria-pressed\"]}],[257,\"br-icon\",{\"iconName\":[513,\"icon-name\"],\"height\":[513],\"customId\":[513,\"custom-id\"],\"width\":[513],\"cssClasses\":[513,\"css-classes\"],\"isInline\":[516,\"is-inline\"],\"rotate\":[513],\"flip\":[513],\"isFocusable\":[516,\"is-focusable\"],\"lazy\":[516]}]]],[\"br-checkbox_3.cjs\",[[321,\"br-input\",{\"type\":[513],\"autocomplete\":[513],\"density\":[513],\"disabled\":[516],\"isInline\":[516,\"is-inline\"],\"isHighlight\":[516,\"is-highlight\"],\"state\":[513],\"label\":[513],\"customId\":[513,\"custom-id\"],\"name\":[513],\"placeholder\":[513],\"readonly\":[516],\"required\":[516],\"value\":[1537],\"controlWidth\":[513,\"control-width\"],\"borderless\":[516],\"helpText\":[513,\"help-text\"],\"autocorrect\":[513],\"min\":[514],\"max\":[514],\"minlength\":[514],\"maxlength\":[514],\"multiple\":[516],\"pattern\":[513],\"mask\":[513],\"step\":[514],\"actionLabel\":[513,\"action-label\"],\"isPasswordVisible\":[32],\"internalState\":[32],\"hasIconSlot\":[32],\"hasActionSlot\":[32],\"hasFeedbackSlot\":[32]},null,{\"value\":[\"handleValueChange\"],\"mask\":[\"handleMaskChange\"]}],[321,\"br-radio\",{\"checked\":[1540],\"disabled\":[516],\"state\":[513],\"hasHiddenLabel\":[516,\"has-hidden-label\"],\"customId\":[513,\"custom-id\"],\"name\":[513],\"label\":[513],\"value\":[513],\"toggleChecked\":[64]},[[8,\"checkedChange\",\"handleCheckedChange\"],[0,\"keydown\",\"handleKeyDown\"]]],[321,\"br-checkbox\",{\"indeterminate\":[1540],\"checked\":[1540],\"customId\":[513,\"custom-id\"],\"disabled\":[516],\"hasHiddenLabel\":[516,\"has-hidden-label\"],\"label\":[513],\"name\":[513],\"state\":[513],\"value\":[513],\"isFather\":[4,\"is-father\"],\"slotDefault\":[32],\"numberOfChildren\":[32],\"setIndeterminate\":[64],\"toggleChecked\":[64],\"setNumberOfChildren\":[64]},null,{\"indeterminate\":[\"updateIndeterminate\"]}]]],[\"br-dropdown_2.cjs\",[[321,\"br-select\",{\"label\":[513],\"placeholder\":[513],\"isMultiple\":[516,\"is-multiple\"],\"options\":[513],\"selectAllLabel\":[513,\"select-all-label\"],\"unselectAllLabel\":[513,\"unselect-all-label\"],\"showSearchIcon\":[516,\"show-search-icon\"],\"isOpen\":[516,\"is-open\"],\"isInline\":[516,\"is-inline\"],\"inputWidth\":[513,\"input-width\"],\"borderless\":[516],\"customId\":[513,\"custom-id\"],\"value\":[1025],\"parsedOptions\":[32],\"filteredOptions\":[32],\"inputValue\":[32],\"searchTerm\":[32],\"selectedValue\":[32],\"isAllSelected\":[32],\"isExpanded\":[32],\"focusedIndex\":[32],\"toggleOpen\":[64],\"clear\":[64],\"getValue\":[64],\"setValue\":[64]},null,{\"options\":[\"synchronizeSelect\"],\"value\":[\"syncValueFromOutside\"]}],[321,\"br-dropdown\",{\"isOpen\":[1540,\"is-open\"],\"customId\":[513,\"custom-id\"],\"placement\":[513],\"preventAutoDismiss\":[516,\"prevent-auto-dismiss\"],\"targetZIndex\":[1,\"target-z-index\"],\"open\":[64],\"hide\":[64],\"setFocus\":[64]},null,{\"isOpen\":[\"isOpenChanged\"],\"targetZIndex\":[\"targetZIndexChanged\"]}]]],[\"br-divider.cjs\",[[257,\"br-divider\",{\"customId\":[513,\"custom-id\"],\"orientation\":[513],\"thickness\":[513],\"borderStyle\":[513,\"border-style\"],\"isDarkMode\":[516,\"is-dark-mode\"],\"color\":[513],\"align\":[1],\"bleed\":[4],\"marginTop\":[2,\"margin-top\"],\"marginBottom\":[2,\"margin-bottom\"],\"marginLeft\":[2,\"margin-left\"],\"marginRight\":[2,\"margin-right\"]},null,{\"color\":[\"updateColor\"],\"marginTop\":[\"updateMargins\"],\"marginBottom\":[\"updateMargins\"],\"marginLeft\":[\"updateMargins\"],\"marginRight\":[\"updateMargins\"]}]]],[\"br-collapse.cjs\",[[321,\"br-collapse\",{\"customId\":[513,\"custom-id\"],\"open\":[1540],\"accordionGroup\":[1,\"accordion-group\"],\"iconToShow\":[1,\"icon-to-show\"],\"iconToHide\":[1,\"icon-to-hide\"],\"iconPosition\":[1,\"icon-position\"],\"openCollapse\":[64],\"closeCollapse\":[64]},[[4,\"brDidOpen\",\"handleOpen\"]]]]],[\"br-item_2.cjs\",[[321,\"br-list\",{\"header\":[513],\"isHorizontal\":[516,\"is-horizontal\"],\"customId\":[513,\"custom-id\"],\"hideHeaderDivider\":[516,\"hide-header-divider\"],\"collapse\":[516],\"accordion\":[513]}],[321,\"br-item\",{\"disabled\":[516],\"customId\":[513,\"custom-id\"],\"isActive\":[516,\"is-active\"],\"isSelected\":[516,\"is-selected\"],\"isInteractive\":[516,\"is-interactive\"],\"href\":[513],\"target\":[513],\"isButton\":[516,\"is-button\"],\"type\":[1537],\"value\":[513],\"density\":[513],\"hasSlotDefault\":[32],\"hasSlotStart\":[32],\"hasSlotEnd\":[32],\"selectedValue\":[32],\"setFocus\":[64]},[[4,\"checkedChange\",\"handleRadioChange\"],[4,\"checkedChange\",\"handleCheckboxChange\"]]]]]]"), options);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
exports.setNonce = index.setNonce;
|
|
@@ -81,7 +81,17 @@ export class Input {
|
|
|
81
81
|
this.hasActionSlot = false;
|
|
82
82
|
this.hasFeedbackSlot = false;
|
|
83
83
|
this.handleInput = (event) => {
|
|
84
|
-
|
|
84
|
+
var _a;
|
|
85
|
+
const inputElement = event.target;
|
|
86
|
+
let nextValue = (_a = inputElement.value) !== null && _a !== void 0 ? _a : '';
|
|
87
|
+
if (this.hasMaskConfigured()) {
|
|
88
|
+
const maskedValue = this.applyMask(nextValue);
|
|
89
|
+
if (maskedValue !== nextValue) {
|
|
90
|
+
inputElement.value = maskedValue;
|
|
91
|
+
}
|
|
92
|
+
nextValue = maskedValue;
|
|
93
|
+
}
|
|
94
|
+
this.value = nextValue;
|
|
85
95
|
this.valueChange.emit(this.value);
|
|
86
96
|
};
|
|
87
97
|
this.renderLabel = () => {
|
|
@@ -134,6 +144,7 @@ export class Input {
|
|
|
134
144
|
this.hasActionSlot = this.hasSlotContent('action');
|
|
135
145
|
this.hasFeedbackSlot = this.hasSlotContent('feedback');
|
|
136
146
|
this.internalState = this.state;
|
|
147
|
+
this.applyMaskToValue();
|
|
137
148
|
if (this.hasFeedbackSlot) {
|
|
138
149
|
this.initializeStateWithFeedback();
|
|
139
150
|
}
|
|
@@ -186,6 +197,18 @@ export class Input {
|
|
|
186
197
|
warning: this.internalState === 'warning',
|
|
187
198
|
};
|
|
188
199
|
}
|
|
200
|
+
handleValueChange(newValue) {
|
|
201
|
+
if (!this.hasMaskConfigured()) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const maskedValue = this.applyMask(newValue !== null && newValue !== void 0 ? newValue : '');
|
|
205
|
+
if (maskedValue !== newValue) {
|
|
206
|
+
this.value = maskedValue;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
handleMaskChange() {
|
|
210
|
+
this.applyMaskToValue();
|
|
211
|
+
}
|
|
189
212
|
hasSlotContent(slotName) {
|
|
190
213
|
return this.el.querySelector(`[slot="${slotName}"]`) !== null;
|
|
191
214
|
}
|
|
@@ -208,8 +231,42 @@ export class Input {
|
|
|
208
231
|
return h("slot", { name: "feedback" });
|
|
209
232
|
}
|
|
210
233
|
}
|
|
234
|
+
applyMaskToValue() {
|
|
235
|
+
if (!this.hasMaskConfigured() || this.value === undefined || this.value === null) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const maskedValue = this.applyMask(this.value);
|
|
239
|
+
if (this.value !== maskedValue) {
|
|
240
|
+
this.value = maskedValue;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
applyMask(value) {
|
|
244
|
+
if (!this.hasMaskConfigured()) {
|
|
245
|
+
return value !== null && value !== void 0 ? value : '';
|
|
246
|
+
}
|
|
247
|
+
const digits = (value !== null && value !== void 0 ? value : '').replace(/\D/g, '');
|
|
248
|
+
if (digits.length === 0) {
|
|
249
|
+
return '';
|
|
250
|
+
}
|
|
251
|
+
let maskedValue = '';
|
|
252
|
+
let digitIndex = 0;
|
|
253
|
+
for (let i = 0; i < this.mask.length && digitIndex < digits.length; i++) {
|
|
254
|
+
const maskChar = this.mask[i];
|
|
255
|
+
if (maskChar === '#') {
|
|
256
|
+
maskedValue += digits[digitIndex];
|
|
257
|
+
digitIndex++;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
maskedValue += maskChar;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return maskedValue;
|
|
264
|
+
}
|
|
265
|
+
hasMaskConfigured() {
|
|
266
|
+
return typeof this.mask === 'string' && this.mask.length > 0;
|
|
267
|
+
}
|
|
211
268
|
render() {
|
|
212
|
-
return (h(Host, { key: '
|
|
269
|
+
return (h(Host, { key: '251164fce4650bd0fa1a1b9189537b11c2ebe6b6' }, h("div", { key: '7b2f561f2cc1d767ba75b483e3d2b93bccd30901', class: this.getInputCssClassMap() }, this.renderLabel(), this.isInline ? this.renderInlineInputContent() : this.renderInputContent(), this.renderFeedback())));
|
|
213
270
|
}
|
|
214
271
|
static get is() { return "br-input"; }
|
|
215
272
|
static get encapsulation() { return "shadow"; }
|
|
@@ -693,6 +750,25 @@ export class Input {
|
|
|
693
750
|
"reflect": true,
|
|
694
751
|
"attribute": "pattern"
|
|
695
752
|
},
|
|
753
|
+
"mask": {
|
|
754
|
+
"type": "string",
|
|
755
|
+
"mutable": false,
|
|
756
|
+
"complexType": {
|
|
757
|
+
"original": "string",
|
|
758
|
+
"resolved": "string",
|
|
759
|
+
"references": {}
|
|
760
|
+
},
|
|
761
|
+
"required": false,
|
|
762
|
+
"optional": true,
|
|
763
|
+
"docs": {
|
|
764
|
+
"tags": [],
|
|
765
|
+
"text": "M\u00E1scara aplicada ao valor digitado (use `#` para marcar posi\u00E7\u00F5es num\u00E9ricas)."
|
|
766
|
+
},
|
|
767
|
+
"getter": false,
|
|
768
|
+
"setter": false,
|
|
769
|
+
"reflect": true,
|
|
770
|
+
"attribute": "mask"
|
|
771
|
+
},
|
|
696
772
|
"step": {
|
|
697
773
|
"type": "number",
|
|
698
774
|
"mutable": false,
|
|
@@ -761,6 +837,15 @@ export class Input {
|
|
|
761
837
|
}];
|
|
762
838
|
}
|
|
763
839
|
static get elementRef() { return "el"; }
|
|
840
|
+
static get watchers() {
|
|
841
|
+
return [{
|
|
842
|
+
"propName": "value",
|
|
843
|
+
"methodName": "handleValueChange"
|
|
844
|
+
}, {
|
|
845
|
+
"propName": "mask",
|
|
846
|
+
"methodName": "handleMaskChange"
|
|
847
|
+
}];
|
|
848
|
+
}
|
|
764
849
|
static get attachInternalsMemberName() { return "elementInternals"; }
|
|
765
850
|
}
|
|
766
851
|
let inputId = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":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h, Host, Prop, State } from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n * @slot feedback - Mensagem de feedback como resposta específica a uma interação do usuário com o input. Pode ser feedback de erro, aviso, sucesso ou informação.\n *\n * @example\n * ```html\n * <br-input label=\"Nome\" placeholder=\"Digite seu nome\"></br-input>\n * ```\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) readonly type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'file'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) readonly autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) readonly density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) readonly isHighlight: boolean = false\n\n /**\n * Define o estado do input\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'\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) readonly label: 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-input-${inputId++}`\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) readonly name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) readonly placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) readonly required: boolean = false\n\n /**\n * Valor exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Largura do campo de entrada (por exemplo, '88px').\n * Quando definido, sobrescreve a largura padrão de 100%.\n */\n @Prop({ reflect: true }) readonly controlWidth?: string\n\n /**\n * Remove a borda do input quando não está em foco.\n * Útil para composições contextuais (ex.: paginação).\n */\n @Prop({ reflect: true }) readonly borderless: boolean = false\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) readonly helpText: string\n\n /**\n * Controla a correção automática do texto.\n */\n @Prop({ reflect: true }) readonly autocorrect: 'off' | 'on' = 'off'\n\n /**\n * Define o valor mínimo para campos de entrada numéricos.\n */\n @Prop({ reflect: true }) readonly min: number\n\n /**\n * Define o valor máximo para campos de entrada numéricos.\n */\n @Prop({ reflect: true }) readonly max: number\n\n /**\n * Define o comprimento mínimo do valor do campo de entrada.\n */\n @Prop({ reflect: true }) readonly minlength: number\n\n /**\n * Define o comprimento máximo do valor do campo de entrada.\n */\n @Prop({ reflect: true }) readonly maxlength: number\n\n /**\n * Se verdadeiro, permite a seleção de múltiplos arquivos.\n */\n @Prop({ reflect: true }) readonly multiple: boolean = false\n\n /**\n * Define o padrão de entrada para validação.\n */\n @Prop({ reflect: true }) readonly pattern: string\n\n /**\n * Define o valor do passo para campos de entrada numéricos.\n */\n @Prop({ reflect: true }) readonly step: number\n\n /**\n * Texto exibido no botão de ação à direita do input.\n */\n @Prop({ reflect: true }) readonly actionLabel: string\n\n @State() isPasswordVisible: boolean = false\n\n @State() internalState: 'info' | 'warning' | 'danger' | 'success' = 'info'\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n @State() hasFeedbackSlot: boolean = false\n\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.hasFeedbackSlot = this.hasSlotContent('feedback')\n this.internalState = this.state\n\n if (this.hasFeedbackSlot) {\n this.initializeStateWithFeedback()\n }\n }\n\n componentDidLoad() {\n if (this.hasFeedbackSlot) {\n this.setupSlotFeedbackListener()\n }\n }\n\n private initializeStateWithFeedback() {\n const initialMessageElement = this.el.querySelector('br-message')\n\n if (initialMessageElement !== null || initialMessageElement !== undefined) {\n const messageState = initialMessageElement.getAttribute('state')\n this.internalState = (messageState as 'info' | 'warning' | 'danger' | 'success') || this.state\n } else {\n this.internalState = this.state\n }\n }\n\n private setupSlotFeedbackListener() {\n const slot = this.el.shadowRoot?.querySelector('slot[name=\"feedback\"]')\n if (slot !== null && slot !== undefined) {\n slot.addEventListener('slotchange', () => {\n this.syncStateWithSlotFeedback()\n })\n }\n }\n\n private syncStateWithSlotFeedback() {\n const messageElement = this.el.querySelector('br-message')\n\n if (messageElement !== null && messageElement !== undefined) {\n this.internalState = messageElement.getAttribute('state') as 'info' | 'warning' | 'danger' | 'success'\n } else {\n this.internalState = this.state\n }\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.internalState === 'success',\n danger: this.internalState === 'danger',\n info: this.internalState === 'info',\n warning: this.internalState === 'warning',\n }\n }\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange: EventEmitter<string>\n\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label part=\"label\" class=\"text-nowrap\" htmlFor={this.customId}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return (\n <label part=\"label\" htmlFor={this.customId}>\n {this.label}\n </label>\n )\n }\n }\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.customId}\n style={this.controlWidth !== undefined && this.controlWidth !== null ? { width: this.controlWidth } : undefined}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n autoCorrect={this.autocorrect}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n step={this.step}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const iconName = this.isPasswordVisible ? 'fa-solid:eye-slash' : 'fa-solid:eye'\n return <br-icon icon-name={iconName}></br-icon>\n }\n\n private readonly togglePasswordVisibility = () => {\n const input = this.el.shadowRoot.querySelector('input')\n this.isPasswordVisible = !this.isPasswordVisible\n input.type = this.isPasswordVisible ? 'text' : 'password'\n }\n\n private renderIconSlot() {\n if (this.hasSlotContent('icon')) {\n return (\n <div class=\"input-icon\">\n <slot name=\"icon\"></slot>\n </div>\n )\n }\n }\n\n private renderButton() {\n if (this.type === 'password') {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label={this.isPasswordVisible ? 'Esconder senha' : 'Mostrar senha'}\n aria-pressed={this.isPasswordVisible ? 'true' : 'false'}\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button class=\"button-transform\" shape=\"circle\" density=\"small\" aria-label={this.actionLabel}>\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n private readonly renderInlineInputContent = () => {\n if (this.hasIconSlot) {\n return <div class=\"input-content\">{this.renderInputWithIcon()}</div>\n } else {\n return <div class=\"input-content\">{this.renderInputWithoutIcon()}</div>\n }\n }\n\n private readonly renderInputContent = () => {\n return this.hasIconSlot ? this.renderInputWithIcon() : this.renderInputWithoutIcon()\n }\n\n private readonly renderInputWithIcon = () => {\n return (\n <div class=\"input-group\">\n {this.renderIconSlot()}\n {this.renderInput()}\n {this.renderButton()}\n {this.renderHelpText()}\n </div>\n )\n }\n\n private readonly renderInputWithoutIcon = () => {\n return [this.renderInput(), this.renderButton(), this.renderHelpText()]\n }\n\n private renderFeedback() {\n if (this.hasFeedbackSlot) {\n return <slot name=\"feedback\"></slot>\n }\n }\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.isInline ? this.renderInlineInputContent() : this.renderInputContent()}\n\n {this.renderFeedback()}\n </div>\n </Host>\n )\n }\n}\n\nlet inputId = 0\n"]}
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../../packages/webcomponents/src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAIrH;;;;;;;;;;;;;GAaG;AAOH,MAAM,OAAO,KAAK;IANlB;QAeE;;;;;;;;;;;;WAYG;QAC+B,SAAI,GAW1B,MAAM,CAAA;QAOlB;;WAEG;QAC+B,YAAO,GAAiC,QAAQ,CAAA;QAElF;;WAEG;QAC+B,aAAQ,GAAY,KAAK,CAAA;QAE3D;;WAEG;QAC+B,aAAQ,GAAY,KAAK,CAAA;QAE3D;;WAEG;QAC+B,gBAAW,GAAY,KAAK,CAAA;QAkB9D;;;WAGG;QAC+B,aAAQ,GAAW,YAAY,OAAO,EAAE,EAAE,CAAA;QAY5E;;WAEG;QAC+B,aAAQ,GAAY,KAAK,CAAA;QAE3D;;WAEG;QAC+B,aAAQ,GAAY,KAAK,CAAA;QAc3D;;;WAGG;QAC+B,eAAU,GAAY,KAAK,CAAA;QAO7D;;WAEG;QAC+B,gBAAW,GAAiB,KAAK,CAAA;QAsBnE;;WAEG;QAC+B,aAAQ,GAAY,KAAK,CAAA;QAsBlD,sBAAiB,GAAY,KAAK,CAAA;QAElC,kBAAa,GAA8C,MAAM,CAAA;QAEjE,gBAAW,GAAY,KAAK,CAAA;QAE5B,kBAAa,GAAY,KAAK,CAAA;QAE9B,oBAAe,GAAY,KAAK,CAAA;QAwFxB,gBAAW,GAAG,CAAC,KAAY,EAAE,EAAE;;YAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,MAA0B,CAAA;YACrD,IAAI,SAAS,GAAG,MAAA,YAA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,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DAAK,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE;gBACnC,IAAI,CAAC,WAAW,EAAE;gBAElB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE;gBAE3E,IAAI,CAAC,cAAc,EAAE,CAClB,CACD,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,OAAO,GAAG,CAAC,CAAA","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core'\n\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n * @slot feedback - Mensagem de feedback como resposta específica a uma interação do usuário com o input. Pode ser feedback de erro, aviso, sucesso ou informação.\n *\n * @example\n * ```html\n * <br-input label=\"Nome\" placeholder=\"Digite seu nome\"></br-input>\n * ```\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) readonly type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'file'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) readonly autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) readonly density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) readonly disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) readonly isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) readonly isHighlight: boolean = false\n\n /**\n * Define o estado do input\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'\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) readonly label: 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-input-${inputId++}`\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) readonly name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) readonly placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) readonly required: boolean = false\n\n /**\n * Valor exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Largura do campo de entrada (por exemplo, '88px').\n * Quando definido, sobrescreve a largura padrão de 100%.\n */\n @Prop({ reflect: true }) readonly controlWidth?: string\n\n /**\n * Remove a borda do input quando não está em foco.\n * Útil para composições contextuais (ex.: paginação).\n */\n @Prop({ reflect: true }) readonly borderless: boolean = false\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) readonly helpText: string\n\n /**\n * Controla a correção automática do texto.\n */\n @Prop({ reflect: true }) readonly autocorrect: 'off' | 'on' = 'off'\n\n /**\n * Define o valor mínimo para campos de entrada numéricos.\n */\n @Prop({ reflect: true }) readonly min: number\n\n /**\n * Define o valor máximo para campos de entrada numéricos.\n */\n @Prop({ reflect: true }) readonly max: number\n\n /**\n * Define o comprimento mínimo do valor do campo de entrada.\n */\n @Prop({ reflect: true }) readonly minlength: number\n\n /**\n * Define o comprimento máximo do valor do campo de entrada.\n */\n @Prop({ reflect: true }) readonly maxlength: number\n\n /**\n * Se verdadeiro, permite a seleção de múltiplos arquivos.\n */\n @Prop({ reflect: true }) readonly multiple: boolean = false\n\n /**\n * Define o padrão de entrada para validação.\n */\n @Prop({ reflect: true }) readonly pattern: string\n\n /**\n * Máscara aplicada ao valor digitado (use `#` para marcar posições numéricas).\n */\n @Prop({ reflect: true }) readonly mask?: string\n\n /**\n * Define o valor do passo para campos de entrada numéricos.\n */\n @Prop({ reflect: true }) readonly step: number\n\n /**\n * Texto exibido no botão de ação à direita do input.\n */\n @Prop({ reflect: true }) readonly actionLabel: string\n\n @State() isPasswordVisible: boolean = false\n\n @State() internalState: 'info' | 'warning' | 'danger' | 'success' = 'info'\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n @State() hasFeedbackSlot: boolean = false\n\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.hasFeedbackSlot = this.hasSlotContent('feedback')\n this.internalState = this.state\n this.applyMaskToValue()\n\n if (this.hasFeedbackSlot) {\n this.initializeStateWithFeedback()\n }\n }\n\n componentDidLoad() {\n if (this.hasFeedbackSlot) {\n this.setupSlotFeedbackListener()\n }\n }\n\n private initializeStateWithFeedback() {\n const initialMessageElement = this.el.querySelector('br-message')\n\n if (initialMessageElement !== null || initialMessageElement !== undefined) {\n const messageState = initialMessageElement.getAttribute('state')\n this.internalState = (messageState as 'info' | 'warning' | 'danger' | 'success') || this.state\n } else {\n this.internalState = this.state\n }\n }\n\n private setupSlotFeedbackListener() {\n const slot = this.el.shadowRoot?.querySelector('slot[name=\"feedback\"]')\n if (slot !== null && slot !== undefined) {\n slot.addEventListener('slotchange', () => {\n this.syncStateWithSlotFeedback()\n })\n }\n }\n\n private syncStateWithSlotFeedback() {\n const messageElement = this.el.querySelector('br-message')\n\n if (messageElement !== null && messageElement !== undefined) {\n this.internalState = messageElement.getAttribute('state') as 'info' | 'warning' | 'danger' | 'success'\n } else {\n this.internalState = this.state\n }\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.internalState === 'success',\n danger: this.internalState === 'danger',\n info: this.internalState === 'info',\n warning: this.internalState === 'warning',\n }\n }\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange: EventEmitter<string>\n\n @Watch('value')\n protected handleValueChange(newValue: string) {\n if (!this.hasMaskConfigured()) {\n return\n }\n\n const maskedValue = this.applyMask(newValue ?? '')\n if (maskedValue !== newValue) {\n this.value = maskedValue\n }\n }\n\n @Watch('mask')\n protected handleMaskChange() {\n this.applyMaskToValue()\n }\n\n private readonly handleInput = (event: Event) => {\n const inputElement = event.target as HTMLInputElement\n let nextValue = inputElement.value ?? ''\n\n if (this.hasMaskConfigured()) {\n const maskedValue = this.applyMask(nextValue)\n if (maskedValue !== nextValue) {\n inputElement.value = maskedValue\n }\n nextValue = maskedValue\n }\n\n this.value = nextValue\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label part=\"label\" class=\"text-nowrap\" htmlFor={this.customId}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return (\n <label part=\"label\" htmlFor={this.customId}>\n {this.label}\n </label>\n )\n }\n }\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.customId}\n style={this.controlWidth !== undefined && this.controlWidth !== null ? { width: this.controlWidth } : undefined}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n autoCorrect={this.autocorrect}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n step={this.step}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const iconName = this.isPasswordVisible ? 'fa-solid:eye-slash' : 'fa-solid:eye'\n return <br-icon icon-name={iconName}></br-icon>\n }\n\n private readonly togglePasswordVisibility = () => {\n const input = this.el.shadowRoot.querySelector('input')\n this.isPasswordVisible = !this.isPasswordVisible\n input.type = this.isPasswordVisible ? 'text' : 'password'\n }\n\n private renderIconSlot() {\n if (this.hasSlotContent('icon')) {\n return (\n <div class=\"input-icon\">\n <slot name=\"icon\"></slot>\n </div>\n )\n }\n }\n\n private renderButton() {\n if (this.type === 'password') {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label={this.isPasswordVisible ? 'Esconder senha' : 'Mostrar senha'}\n aria-pressed={this.isPasswordVisible ? 'true' : 'false'}\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button class=\"button-transform\" shape=\"circle\" density=\"small\" aria-label={this.actionLabel}>\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n private readonly renderInlineInputContent = () => {\n if (this.hasIconSlot) {\n return <div class=\"input-content\">{this.renderInputWithIcon()}</div>\n } else {\n return <div class=\"input-content\">{this.renderInputWithoutIcon()}</div>\n }\n }\n\n private readonly renderInputContent = () => {\n return this.hasIconSlot ? this.renderInputWithIcon() : this.renderInputWithoutIcon()\n }\n\n private readonly renderInputWithIcon = () => {\n return (\n <div class=\"input-group\">\n {this.renderIconSlot()}\n {this.renderInput()}\n {this.renderButton()}\n {this.renderHelpText()}\n </div>\n )\n }\n\n private readonly renderInputWithoutIcon = () => {\n return [this.renderInput(), this.renderButton(), this.renderHelpText()]\n }\n\n private renderFeedback() {\n if (this.hasFeedbackSlot) {\n return <slot name=\"feedback\"></slot>\n }\n }\n\n private applyMaskToValue() {\n if (!this.hasMaskConfigured() || this.value === undefined || this.value === null) {\n return\n }\n\n const maskedValue = this.applyMask(this.value)\n if (this.value !== maskedValue) {\n this.value = maskedValue\n }\n }\n\n private applyMask(value: string): string {\n if (!this.hasMaskConfigured()) {\n return value ?? ''\n }\n\n const digits = (value ?? '').replace(/\\D/g, '')\n if (digits.length === 0) {\n return ''\n }\n\n let maskedValue = ''\n let digitIndex = 0\n\n for (let i = 0; i < this.mask.length && digitIndex < digits.length; i++) {\n const maskChar = this.mask[i]\n\n if (maskChar === '#') {\n maskedValue += digits[digitIndex]\n digitIndex++\n } else {\n maskedValue += maskChar\n }\n }\n\n return maskedValue\n }\n\n private hasMaskConfigured(): boolean {\n return typeof this.mask === 'string' && this.mask.length > 0\n }\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.isInline ? this.renderInlineInputContent() : this.renderInputContent()}\n\n {this.renderFeedback()}\n </div>\n </Host>\n )\n }\n}\n\nlet inputId = 0\n"]}
|
|
@@ -72,8 +72,12 @@ export class Select {
|
|
|
72
72
|
// Representa as opções do select disponíveis para renderização.
|
|
73
73
|
// Cada opção contém `label`, `value` e o estado de seleção (`selected`).
|
|
74
74
|
this.parsedOptions = [];
|
|
75
|
+
// Opções filtradas de acordo com o termo de busca digitado.
|
|
76
|
+
this.filteredOptions = [];
|
|
75
77
|
// Valor exibido no input, refletindo as opções selecionadas.
|
|
76
78
|
this.inputValue = '';
|
|
79
|
+
// Termo digitado no input (modo busca).
|
|
80
|
+
this.searchTerm = '';
|
|
77
81
|
// Indica se todas as opções estão selecionadas. Comportamento do checkbox "Selecionar Todos".
|
|
78
82
|
this.isAllSelected = false;
|
|
79
83
|
// Controla se a lista de opções do select está expandida (aberta) ou colapsada (fechada).
|
|
@@ -122,6 +126,8 @@ export class Select {
|
|
|
122
126
|
}
|
|
123
127
|
// Sanitiza as opções (remove opções inválidas, etc.)
|
|
124
128
|
this.parsedOptions = parsedOptions;
|
|
129
|
+
// Atualiza lista filtrada considerando o termo atual
|
|
130
|
+
this.filteredOptions = this.getFilteredOptions(this.searchTerm);
|
|
125
131
|
// Atualiza o estado do componente
|
|
126
132
|
this.updateSelectedOptions();
|
|
127
133
|
this.updateSelectedAllState();
|
|
@@ -138,6 +144,7 @@ export class Select {
|
|
|
138
144
|
this.selectedValue = newVal;
|
|
139
145
|
this.updateSelectedOptions(); // mantém inputValue coeso
|
|
140
146
|
this.updateSelectedAllState();
|
|
147
|
+
this.filteredOptions = this.getFilteredOptions(this.searchTerm);
|
|
141
148
|
}
|
|
142
149
|
componentWillLoad() {
|
|
143
150
|
this.isExpanded = this.isOpen;
|
|
@@ -243,17 +250,23 @@ export class Select {
|
|
|
243
250
|
}
|
|
244
251
|
handleSelection(index) {
|
|
245
252
|
var _a, _b;
|
|
246
|
-
if (index < 0 || index >= this.
|
|
253
|
+
if (index < 0 || index >= this.filteredOptions.length) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
// Localiza opção original a partir da lista filtrada
|
|
257
|
+
const selectedOption = this.filteredOptions[index];
|
|
258
|
+
const originalIndex = this.parsedOptions.findIndex((o) => o.value === selectedOption.value);
|
|
259
|
+
if (originalIndex === -1) {
|
|
247
260
|
return;
|
|
248
261
|
}
|
|
249
262
|
if (this.isMultiple) {
|
|
250
263
|
const updatedOptions = [...this.parsedOptions];
|
|
251
|
-
updatedOptions[
|
|
264
|
+
updatedOptions[originalIndex].selected = !updatedOptions[originalIndex].selected;
|
|
252
265
|
this.parsedOptions = updatedOptions;
|
|
253
266
|
}
|
|
254
267
|
else {
|
|
255
268
|
const updatedOptions = this.parsedOptions.map((option) => (Object.assign(Object.assign({}, option), { selected: false })));
|
|
256
|
-
updatedOptions[
|
|
269
|
+
updatedOptions[originalIndex].selected = true;
|
|
257
270
|
this.parsedOptions = updatedOptions;
|
|
258
271
|
this.isExpanded = false;
|
|
259
272
|
}
|
|
@@ -266,6 +279,7 @@ export class Select {
|
|
|
266
279
|
this.valueChange.emit(this.selectedValue);
|
|
267
280
|
this.updateSelectedOptions();
|
|
268
281
|
this.updateSelectedAllState();
|
|
282
|
+
this.filteredOptions = this.getFilteredOptions(this.searchTerm);
|
|
269
283
|
try {
|
|
270
284
|
this.elementInternals.setFormValue(JSON.stringify((_b = this.selectedValue) !== null && _b !== void 0 ? _b : []));
|
|
271
285
|
}
|
|
@@ -276,6 +290,23 @@ export class Select {
|
|
|
276
290
|
updateSelectedOptions() {
|
|
277
291
|
this.inputValue = this.getStringValue(this.parsedOptions.filter((option) => option.selected));
|
|
278
292
|
}
|
|
293
|
+
normalizeText(text) {
|
|
294
|
+
return (text || '')
|
|
295
|
+
.normalize('NFD')
|
|
296
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
297
|
+
.toLowerCase();
|
|
298
|
+
}
|
|
299
|
+
getFilteredOptions(term) {
|
|
300
|
+
if (!term) {
|
|
301
|
+
return this.parsedOptions;
|
|
302
|
+
}
|
|
303
|
+
const normalizedTerm = this.normalizeText(term);
|
|
304
|
+
return this.parsedOptions.filter((option) => {
|
|
305
|
+
const normalizedLabel = this.normalizeText(option.label || option.value);
|
|
306
|
+
const normalizedValue = this.normalizeText(option.value);
|
|
307
|
+
return normalizedLabel.includes(normalizedTerm) || normalizedValue.includes(normalizedTerm);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
279
310
|
getStringValue(options) {
|
|
280
311
|
if (options.length > 0) {
|
|
281
312
|
const firstSelected = options[0].label || options[0].value;
|
|
@@ -329,13 +360,16 @@ export class Select {
|
|
|
329
360
|
}
|
|
330
361
|
}
|
|
331
362
|
renderInput() {
|
|
332
|
-
return (h("br-input", { exportparts: "label", value: this.inputValue, label: this.label, isInline: this.isInline, controlWidth: this.inputWidth, borderless: this.borderless, placeholder: this.placeholder, actionLabel: this.isExpanded ? 'Recolher lista de opções' : 'Exibir lista de opções', readonly:
|
|
363
|
+
return (h("br-input", { exportparts: "label", value: this.searchTerm || this.inputValue, label: this.label, isInline: this.isInline, controlWidth: this.inputWidth, borderless: this.borderless, placeholder: this.placeholder, actionLabel: this.isExpanded ? 'Recolher lista de opções' : 'Exibir lista de opções', readonly: false, onClick: () => this.toggleOpen(), onInput: (event) => this.handleSearchInput(event), onFocus: () => this.handleSearchFocus(), onBlur: () => this.handleSearchBlur(), onKeyDown: (event) => this.handleKeydownOnInput(event) }, this.showSearchIcon && h("br-icon", { slot: "icon", "icon-name": "fa-solid:search", "aria-hidden": "true" }), h("br-icon", { slot: "action", "icon-name": this.isExpanded ? 'fa-solid:angle-up' : 'fa-solid:angle-down', height: "16", "aria-hidden": "true" })));
|
|
333
364
|
}
|
|
334
365
|
renderSelectAllCheckbox() {
|
|
335
366
|
return (h("div", { class: `br-item highlighted ${this.isAllSelected ? 'selected' : ''}`, "data-all": "data-all", tabindex: "-1", role: "option", "aria-selected": this.isAllSelected, onKeyDown: (event) => this.handleSelectAllKeyDown(event), onClick: () => this.toggleSelectAll() }, h("br-checkbox", { name: `checkbox-${this.customId}`, label: this.isAllSelected ? this.unselectAllLabel : this.selectAllLabel, checked: this.isAllSelected, onCheckedChange: () => this.toggleSelectAll() })));
|
|
336
367
|
}
|
|
337
368
|
renderOptions() {
|
|
338
|
-
|
|
369
|
+
if (this.filteredOptions.length === 0) {
|
|
370
|
+
return (h("div", { class: "br-item empty", role: "option", "aria-selected": "false", tabindex: -1 }, "Nenhum resultado encontrado"));
|
|
371
|
+
}
|
|
372
|
+
return this.filteredOptions.map((option, index) => (h("div", { class: `br-item ${option.selected ? 'selected' : ''}`, key: `${option.label}-${this.customId}`, role: "option", tabindex: this.focusedIndex === index ? 0 : -1, "aria-selected": option.selected, onClick: () => this.handleSelection(index), onKeyDown: (event) => this.handleKeydownOnItem(event, index) }, this.isMultiple ? (h("br-checkbox", { name: `checkbox-${index}-${this.customId}`, label: option.label || option.value, checked: option.selected === true, onCheckedChange: () => this.handleSelection(index) })) : (h("br-radio", { exportparts: "radio-input, radio-label", name: `radio-${index}-${this.customId}`, label: option.label || option.value, checked: option.selected === true, onCheckedChange: () => this.handleSelection(index) })))));
|
|
339
373
|
}
|
|
340
374
|
/**
|
|
341
375
|
* Determina um id para o radio.
|
|
@@ -352,13 +386,68 @@ export class Select {
|
|
|
352
386
|
this.isExpanded = !this.isExpanded;
|
|
353
387
|
});
|
|
354
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Limpa todas as opções selecionadas.
|
|
391
|
+
*/
|
|
392
|
+
clear() {
|
|
393
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
const updatedOptions = this.parsedOptions.map((option) => (Object.assign(Object.assign({}, option), { selected: false })));
|
|
395
|
+
this.parsedOptions = updatedOptions;
|
|
396
|
+
const newValue = this.isMultiple ? [] : undefined;
|
|
397
|
+
this.selectedValue = newValue;
|
|
398
|
+
this.value = newValue;
|
|
399
|
+
this.updateSelectedOptions();
|
|
400
|
+
this.updateSelectedAllState();
|
|
401
|
+
this.valueChange.emit(newValue);
|
|
402
|
+
try {
|
|
403
|
+
this.elementInternals.setFormValue(JSON.stringify(newValue !== null && newValue !== void 0 ? newValue : (this.isMultiple ? [] : null)));
|
|
404
|
+
}
|
|
405
|
+
catch (_a) {
|
|
406
|
+
// Ignora erro em testes onde setFormValue não é implementado
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Retorna o valor selecionado.
|
|
412
|
+
* @returns {Promise<string | string[]>} O valor atual.
|
|
413
|
+
*/
|
|
414
|
+
getValue() {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
return this.value;
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Define o valor do componente.
|
|
421
|
+
* @param {string | string[]} newValue O novo valor a ser definido.
|
|
422
|
+
*/
|
|
423
|
+
setValue(newValue) {
|
|
424
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
425
|
+
this.value = newValue;
|
|
426
|
+
// O @Watch('value') cuidará da sincronização
|
|
427
|
+
});
|
|
428
|
+
}
|
|
355
429
|
getCssClassMap() {
|
|
356
430
|
return {
|
|
357
431
|
'br-select': true,
|
|
358
432
|
};
|
|
359
433
|
}
|
|
434
|
+
handleSearchInput(event) {
|
|
435
|
+
var _a;
|
|
436
|
+
const value = (_a = event.target.value) !== null && _a !== void 0 ? _a : '';
|
|
437
|
+
this.searchTerm = value;
|
|
438
|
+
this.filteredOptions = this.getFilteredOptions(value);
|
|
439
|
+
this.isExpanded = true;
|
|
440
|
+
}
|
|
441
|
+
handleSearchFocus() {
|
|
442
|
+
this.filteredOptions = this.getFilteredOptions(this.searchTerm);
|
|
443
|
+
}
|
|
444
|
+
handleSearchBlur() {
|
|
445
|
+
// Ao sair do campo, volta a exibir o resumo das seleções
|
|
446
|
+
this.searchTerm = '';
|
|
447
|
+
this.filteredOptions = this.getFilteredOptions('');
|
|
448
|
+
}
|
|
360
449
|
render() {
|
|
361
|
-
return (h("div", { key: '
|
|
450
|
+
return (h("div", { key: '0cc55b88b7a17c5e930f76db97f9edb7e4a2948d', class: this.getCssClassMap(), id: this.getComputedId() }, this.renderInput(), this.isExpanded && (h("br-list", { key: '55af5ca9de920524dcf05091e2c9369fd199c67f', tabindex: -1, onKeyDown: (event) => this.handleKeydownOnList(event) }, this.isMultiple && this.renderSelectAllCheckbox(), this.renderOptions()))));
|
|
362
451
|
}
|
|
363
452
|
static get is() { return "br-select"; }
|
|
364
453
|
static get encapsulation() { return "shadow"; }
|
|
@@ -438,7 +527,7 @@ export class Select {
|
|
|
438
527
|
"type": "string",
|
|
439
528
|
"mutable": false,
|
|
440
529
|
"complexType": {
|
|
441
|
-
"original": "| string\n | {\n
|
|
530
|
+
"original": "| string\n | {\n label: string\n value: string\n selected?: boolean\n }[]",
|
|
442
531
|
"resolved": "string | { label: string; value: string; selected?: boolean; }[]",
|
|
443
532
|
"references": {}
|
|
444
533
|
},
|
|
@@ -615,7 +704,7 @@ export class Select {
|
|
|
615
704
|
},
|
|
616
705
|
"value": {
|
|
617
706
|
"type": "string",
|
|
618
|
-
"mutable":
|
|
707
|
+
"mutable": true,
|
|
619
708
|
"complexType": {
|
|
620
709
|
"original": "string | string[]",
|
|
621
710
|
"resolved": "string | string[]",
|
|
@@ -637,7 +726,9 @@ export class Select {
|
|
|
637
726
|
static get states() {
|
|
638
727
|
return {
|
|
639
728
|
"parsedOptions": {},
|
|
729
|
+
"filteredOptions": {},
|
|
640
730
|
"inputValue": {},
|
|
731
|
+
"searchTerm": {},
|
|
641
732
|
"selectedValue": {},
|
|
642
733
|
"isAllSelected": {},
|
|
643
734
|
"isExpanded": {},
|
|
@@ -680,6 +771,67 @@ export class Select {
|
|
|
680
771
|
"text": "Inverte o valor da prop `isOpen`",
|
|
681
772
|
"tags": []
|
|
682
773
|
}
|
|
774
|
+
},
|
|
775
|
+
"clear": {
|
|
776
|
+
"complexType": {
|
|
777
|
+
"signature": "() => Promise<void>",
|
|
778
|
+
"parameters": [],
|
|
779
|
+
"references": {
|
|
780
|
+
"Promise": {
|
|
781
|
+
"location": "global",
|
|
782
|
+
"id": "global::Promise"
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
"return": "Promise<void>"
|
|
786
|
+
},
|
|
787
|
+
"docs": {
|
|
788
|
+
"text": "Limpa todas as op\u00E7\u00F5es selecionadas.",
|
|
789
|
+
"tags": []
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
"getValue": {
|
|
793
|
+
"complexType": {
|
|
794
|
+
"signature": "() => Promise<string | string[]>",
|
|
795
|
+
"parameters": [],
|
|
796
|
+
"references": {
|
|
797
|
+
"Promise": {
|
|
798
|
+
"location": "global",
|
|
799
|
+
"id": "global::Promise"
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
"return": "Promise<string | string[]>"
|
|
803
|
+
},
|
|
804
|
+
"docs": {
|
|
805
|
+
"text": "Retorna o valor selecionado.",
|
|
806
|
+
"tags": [{
|
|
807
|
+
"name": "returns",
|
|
808
|
+
"text": "O valor atual."
|
|
809
|
+
}]
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
"setValue": {
|
|
813
|
+
"complexType": {
|
|
814
|
+
"signature": "(newValue: string | string[]) => Promise<void>",
|
|
815
|
+
"parameters": [{
|
|
816
|
+
"name": "newValue",
|
|
817
|
+
"type": "string | string[]",
|
|
818
|
+
"docs": "O novo valor a ser definido."
|
|
819
|
+
}],
|
|
820
|
+
"references": {
|
|
821
|
+
"Promise": {
|
|
822
|
+
"location": "global",
|
|
823
|
+
"id": "global::Promise"
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
"return": "Promise<void>"
|
|
827
|
+
},
|
|
828
|
+
"docs": {
|
|
829
|
+
"text": "Define o valor do componente.",
|
|
830
|
+
"tags": [{
|
|
831
|
+
"name": "param",
|
|
832
|
+
"text": "newValue O novo valor a ser definido."
|
|
833
|
+
}]
|
|
834
|
+
}
|
|
683
835
|
}
|
|
684
836
|
};
|
|
685
837
|
}
|