@govbr-ds/webcomponents 2.0.0-next.16 → 2.0.0-next.17
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-input.cjs.entry.js +31 -10
- package/dist/cjs/br-input.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/input/input.css +3 -0
- package/dist/collection/components/input/input.js +31 -10
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/components/br-input.js +32 -11
- package/dist/components/br-input.js.map +1 -1
- package/dist/esm/br-input.entry.js +31 -10
- package/dist/esm/br-input.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/input/input.d.ts +6 -2
- package/dist/webcomponents/{p-ee647c4a.entry.js → p-9a6aecb4.entry.js} +2 -2
- package/dist/webcomponents/p-9a6aecb4.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/dist/webcomponents/webcomponents.esm.js.map +1 -1
- package/hydrate/index.js +32 -11
- package/hydrate/index.mjs +32 -11
- package/package.json +1 -1
- package/dist/webcomponents/p-ee647c4a.entry.js.map +0 -1
|
@@ -6,7 +6,7 @@ const index = require('./index-a1cc4aa4.js');
|
|
|
6
6
|
const inheritedAttributes = require('./inherited-attributes-61a2aff9.js');
|
|
7
7
|
const v4 = require('./v4-c23234d2.js');
|
|
8
8
|
|
|
9
|
-
const inputCss = "*,*::before,*::after{box-sizing:border-box}html{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}body{margin:0}a{background-color:transparent}strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;-moz-appearance:button;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}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]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}[hidden]{display:none}.d-flex{display:flex !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter) * 0.5);padding-right:calc(var(--grid-gutter) * 0.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.container{--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{--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{--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{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}}@media (min-width: 1600px){.container{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mr-2{margin-right:var(--spacing-scale-base) !important}.mb-3{margin-bottom:var(--spacing-scale-2x) !important}.pt-half{padding-top:var(--spacing-scale-half) !important}.py-3{padding-bottom:var(--spacing-scale-2x) !important;padding-top:var(--spacing-scale-2x) !important}.py-4{padding-bottom:var(--spacing-scale-3x) !important;padding-top:var(--spacing-scale-3x) !important}body{--bg-color:var(--background);--bg-color-rgb:var(--background-rgb);--bg-color-hsl:var(--background-hsl);--font-size:var(--font-size-scale-base);--font-weight:var(--font-weight-regular);--link-color:var(--interactive);--link-color-rgb:var(--interactive-rgb);--link-color-hsl:var(--interactive-hsl);--line-height:var(--font-line-height-medium);--text-color:var(--color);--text-color-rgb:var(--color-rgb);--text-color-hsl:var(--color-hsl);background:var(--bg-color);color:var(--text-color);font-family:var(--font-family-base);font-size:var(--font-size);font-weight:var(--font-weight);line-height:var(--line-height)}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);color:var(--interactive);text-decoration:none}a:focus{outline:none}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)))}button{cursor:pointer}img{max-width:100%;vertical-align:middle}ul{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}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)}::-moz-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}::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)}.text-pure-0{color:var(--pure-0) !important}.bg-support-01{--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);background:var(--color-support-01) !important}.text-nowrap{white-space:nowrap !important}.text-base{font-size:var(--font-size-scale-base) !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}[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-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)}.br-input{--input-button-margin:var(--spacing-scale-half);--input-padding:0 var(--spacing-scale-2x);--input-padding-button:var(--spacing-scale-5x);--input-padding-icon:var(--spacing-scale-5x);--input-size:var(--input-medium);--input-small:32px;--input-medium:40px;--input-large:48px;--input-highlight:56px;--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);color:var(--color);position:relative}.br-input input{background-color:var(--background-light);border-color:var(--border-color-alternative);border-radius:var(--surface-rounder-sm);border-style:var(--border-style);border-width:var(--border-width);color:var(--color-light);display:block;font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);height:var(--input-size);margin-top:var(--spacing-scale-half);padding-bottom:0;padding-left:var(--spacing-scale-2x);padding-right:var(--spacing-scale-2x);padding-top:0;width:100%}.br-input input::-ms-reveal,.br-input input::-ms-clear,.br-input input::-webkit-calendar-picker-indicator{display:none}.br-input input[type=search]::-webkit-search-decoration,.br-input input[type=search]::-webkit-search-cancel-button,.br-input input[type=search]::-webkit-search-results-button,.br-input input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none}.br-input.input-inline{display:flex}.br-input.input-inline .input-label{margin-right:var(--spacing-scale-baseh);margin-top:calc(var(--input-size) * 0.5 - var(--spacing-scale-half))}.br-input .input-group{position:relative}.br-input .input-icon{align-items:center;color:var(--border-color-alternative);display:flex;height:var(--input-size);margin-left:var(--spacing-scale-baseh);position:absolute}.br-input .input-icon+input{padding-left:var(--input-padding-icon)}.br-input .br-button{--button-size:var(--button-small);--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);border-radius:50%;float:right;margin-right:var(--input-button-margin);margin-top:calc((var(--input-size) + var(--spacing-scale-half)) * -1);padding:0;position:relative;transform:translateY(calc((var(--input-size) - var(--button-size)) * 0.5));width:var(--button-size)}.br-input.input-button input{padding-right:var(--input-padding-button)}.br-input.has-icon input{padding-right:var(--input-padding-icon)}.br-input.has-icon .br-button.circle{float:right;margin-right:var(--spacing-scale-half);margin-top:calc((var(--button-size) + var(--spacing-scale-half) + var(--spacing-scale-half)) * -1);transform:translateY(0)}.br-input.has-icon.small .br-button.circle{margin-top:calc((var(--button-size) + var(--spacing-scale-base)) * -1)}.br-input.has-icon.large .br-button.circle{margin-top:calc(var(--button-size) * -1)}.br-input.input-highlight{--input-button-margin:var(--spacing-scale-2x);--input-padding:0 var(--spacing-scale-3x);--input-padding-button:var(--spacing-scale-7x);--input-padding-icon:var(--spacing-scale-7x);--input-size:var(--input-highlight)}.br-input.input-highlight input{background-color:var(--gray-2);border-color:transparent;padding-left:var(--spacing-scale-3x);padding-right:var(--spacing-scale-3x)}.br-input.input-highlight .input-icon{margin-left:var(--spacing-scale-3x)}.br-input.input-highlight .input-icon+input{padding-left:var(--spacing-scale-7x)}.br-input .br-list{box-shadow:var(--surface-shadow-md);max-height:530px;overflow:auto;position:absolute;width:100%;z-index:var(--z-index-layer-2)}.br-input .br-list::-webkit-scrollbar{height:var(--spacing-scale-base);width:var(--spacing-scale-base)}.br-input .br-list::-webkit-scrollbar-track{background:var(--gray-10)}.br-input .br-list::-webkit-scrollbar-thumb{background:var(--gray-30)}.br-input .br-list:hover::-webkit-scrollbar-thumb{background:var(--gray-40)}.br-input .br-list .br-item{--item-padding-y:var(--spacing-scale-2x)}.br-input .br-list .br-item:not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-input .br-list .br-item:not(:first-child){border-top:var(--surface-width-sm) solid var(--border-color)}.br-input.success input{border-color:var(--success);border-width:2px}.br-input.danger input{border-color:var(--danger);border-width:2px}.br-input.warning input{border-color:var(--warning);border-width:2px}.br-input.info input{border-color:var(--info);border-width:2px}.br-input input:not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-input input:focus,.br-input input:focus-visible{border-color:var(--focus) !important;box-shadow:0 0 0 var(--surface-width-md) var(--focus);outline:none}.br-input .feedback{margin-bottom:var(--spacing-scale-half)}.br-input.small{--input-size:var(--input-small)}.br-input.medium{--input-size:var(--input-medium)}.br-input.large{--input-size:var(--input-large)}.br-input.dark-mode,.br-input.dark-mode label{--color:var(--color-dark);--focus-color:var(--focus-color-dark)}:host{display:block}:host .br-input .input-icon{margin-top:0.1em;margin-left:var(--spacing-scale-base)}:host .br-input .input-icon+input{padding-left:calc(var(--input-padding-icon) + 3px)}.br-input br-button{float:right;margin-right:var(--input-button-margin);margin-top:calc((var(--input-size) + var(--spacing-scale-half)) * -1);padding:0;position:relative}.button-transform{transform:translateY(calc((var(--input-size) - 32px) * 0.5))}";
|
|
9
|
+
const inputCss = "*,*::before,*::after{box-sizing:border-box}html{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}body{margin:0}a{background-color:transparent}strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;-moz-appearance:button;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}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]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}[hidden]{display:none}.d-flex{display:flex !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter) * 0.5);padding-right:calc(var(--grid-gutter) * 0.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.container{--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{--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{--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{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}}@media (min-width: 1600px){.container{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mr-2{margin-right:var(--spacing-scale-base) !important}.mb-3{margin-bottom:var(--spacing-scale-2x) !important}.pt-half{padding-top:var(--spacing-scale-half) !important}.py-3{padding-bottom:var(--spacing-scale-2x) !important;padding-top:var(--spacing-scale-2x) !important}.py-4{padding-bottom:var(--spacing-scale-3x) !important;padding-top:var(--spacing-scale-3x) !important}body{--bg-color:var(--background);--bg-color-rgb:var(--background-rgb);--bg-color-hsl:var(--background-hsl);--font-size:var(--font-size-scale-base);--font-weight:var(--font-weight-regular);--link-color:var(--interactive);--link-color-rgb:var(--interactive-rgb);--link-color-hsl:var(--interactive-hsl);--line-height:var(--font-line-height-medium);--text-color:var(--color);--text-color-rgb:var(--color-rgb);--text-color-hsl:var(--color-hsl);background:var(--bg-color);color:var(--text-color);font-family:var(--font-family-base);font-size:var(--font-size);font-weight:var(--font-weight);line-height:var(--line-height)}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);color:var(--interactive);text-decoration:none}a:focus{outline:none}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)))}button{cursor:pointer}img{max-width:100%;vertical-align:middle}ul{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}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)}::-moz-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}::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)}.text-pure-0{color:var(--pure-0) !important}.bg-support-01{--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);background:var(--color-support-01) !important}.text-nowrap{white-space:nowrap !important}.text-base{font-size:var(--font-size-scale-base) !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}[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-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)}.br-input{--input-button-margin:var(--spacing-scale-half);--input-padding:0 var(--spacing-scale-2x);--input-padding-button:var(--spacing-scale-5x);--input-padding-icon:var(--spacing-scale-5x);--input-size:var(--input-medium);--input-small:32px;--input-medium:40px;--input-large:48px;--input-highlight:56px;--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);color:var(--color);position:relative}.br-input input{background-color:var(--background-light);border-color:var(--border-color-alternative);border-radius:var(--surface-rounder-sm);border-style:var(--border-style);border-width:var(--border-width);color:var(--color-light);display:block;font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);height:var(--input-size);margin-top:var(--spacing-scale-half);padding-bottom:0;padding-left:var(--spacing-scale-2x);padding-right:var(--spacing-scale-2x);padding-top:0;width:100%}.br-input input::-ms-reveal,.br-input input::-ms-clear,.br-input input::-webkit-calendar-picker-indicator{display:none}.br-input input[type=search]::-webkit-search-decoration,.br-input input[type=search]::-webkit-search-cancel-button,.br-input input[type=search]::-webkit-search-results-button,.br-input input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none}.br-input.input-inline{display:flex}.br-input.input-inline .input-label{margin-right:var(--spacing-scale-baseh);margin-top:calc(var(--input-size) * 0.5 - var(--spacing-scale-half))}.br-input.input-inline .input-content{flex:1}.br-input .input-group{position:relative}.br-input .input-icon{align-items:center;color:var(--border-color-alternative);display:flex;height:var(--input-size);margin-left:var(--spacing-scale-baseh);position:absolute}.br-input .input-icon+input{padding-left:var(--input-padding-icon)}.br-input .br-button{--button-size:var(--button-small);--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);border-radius:50%;float:right;margin-right:var(--input-button-margin);margin-top:calc((var(--input-size) + var(--spacing-scale-half)) * -1);padding:0;position:relative;transform:translateY(calc((var(--input-size) - var(--button-size)) * 0.5));width:var(--button-size)}.br-input.input-button input{padding-right:var(--input-padding-button)}.br-input.has-icon input{padding-right:var(--input-padding-icon)}.br-input.has-icon .br-button.circle{float:right;margin-right:var(--spacing-scale-half);margin-top:calc((var(--button-size) + var(--spacing-scale-half) + var(--spacing-scale-half)) * -1);transform:translateY(0)}.br-input.has-icon.small .br-button.circle{margin-top:calc((var(--button-size) + var(--spacing-scale-base)) * -1)}.br-input.has-icon.large .br-button.circle{margin-top:calc(var(--button-size) * -1)}.br-input.input-highlight{--input-button-margin:var(--spacing-scale-2x);--input-padding:0 var(--spacing-scale-3x);--input-padding-button:var(--spacing-scale-7x);--input-padding-icon:var(--spacing-scale-7x);--input-size:var(--input-highlight)}.br-input.input-highlight input{background-color:var(--gray-2);border-color:transparent;padding-left:var(--spacing-scale-3x);padding-right:var(--spacing-scale-3x)}.br-input.input-highlight .input-icon{margin-left:var(--spacing-scale-3x)}.br-input.input-highlight .input-icon+input{padding-left:var(--spacing-scale-7x)}.br-input .br-list{box-shadow:var(--surface-shadow-md);max-height:530px;overflow:auto;position:absolute;width:100%;z-index:var(--z-index-layer-2)}.br-input .br-list::-webkit-scrollbar{height:var(--spacing-scale-base);width:var(--spacing-scale-base)}.br-input .br-list::-webkit-scrollbar-track{background:var(--gray-10)}.br-input .br-list::-webkit-scrollbar-thumb{background:var(--gray-30)}.br-input .br-list:hover::-webkit-scrollbar-thumb{background:var(--gray-40)}.br-input .br-list .br-item{--item-padding-y:var(--spacing-scale-2x)}.br-input .br-list .br-item:not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-input .br-list .br-item:not(:first-child){border-top:var(--surface-width-sm) solid var(--border-color)}.br-input.success input{border-color:var(--success);border-width:2px}.br-input.danger input{border-color:var(--danger);border-width:2px}.br-input.warning input{border-color:var(--warning);border-width:2px}.br-input.info input{border-color:var(--info);border-width:2px}.br-input input:not(:disabled):hover{background-image:linear-gradient(rgba(var(--color-rgb), var(--hover)), rgba(var(--color-rgb), var(--hover)))}.br-input input:focus,.br-input input:focus-visible{border-color:var(--focus) !important;box-shadow:0 0 0 var(--surface-width-md) var(--focus);outline:none}.br-input .feedback{margin-bottom:var(--spacing-scale-half)}.br-input.small{--input-size:var(--input-small)}.br-input.medium{--input-size:var(--input-medium)}.br-input.large{--input-size:var(--input-large)}.br-input.dark-mode,.br-input.dark-mode label{--color:var(--color-dark);--focus-color:var(--focus-color-dark)}:host{display:block}:host .br-input .input-icon{margin-top:0.1em;margin-left:var(--spacing-scale-base)}:host .br-input .input-icon+input{padding-left:calc(var(--input-padding-icon) + 3px)}.br-input br-button{float:right;margin-right:var(--input-button-margin);margin-top:calc((var(--input-size) + var(--spacing-scale-half)) * -1);padding:0;position:relative}.button-transform{transform:translateY(calc((var(--input-size) - 32px) * 0.5))}";
|
|
10
10
|
const BrInputStyle0 = inputCss;
|
|
11
11
|
|
|
12
12
|
const Input = class {
|
|
@@ -49,11 +49,6 @@ const Input = class {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
this.togglePasswordVisibility = () => {
|
|
53
|
-
const input = this.el.shadowRoot.querySelector('input');
|
|
54
|
-
input.type = input.type === 'password' ? 'text' : 'password';
|
|
55
|
-
this.showIconTextPassword = input.type === 'password';
|
|
56
|
-
};
|
|
57
52
|
this.renderInput = () => {
|
|
58
53
|
return (index.h("input", Object.assign({ class: this.isHighlight ? 'input-highlight' : null, id: this.defaultID, autocomplete: this.autocomplete, disabled: this.disabled, onInput: this.handleInput, placeholder: this.placeholder, readonly: this.readonly, required: this.required, title: this.el.title, type: this.type, value: this.value }, this.inheritedAttributes)));
|
|
59
54
|
};
|
|
@@ -62,8 +57,34 @@ const Input = class {
|
|
|
62
57
|
return ((_a = this.helpText) === null || _a === void 0 ? void 0 : _a.length) > 0 ? index.h("p", null, this.helpText) : index.h("slot", { name: "help-text" });
|
|
63
58
|
};
|
|
64
59
|
this.renderIconPassword = () => {
|
|
65
|
-
const
|
|
66
|
-
return index.h("br-icon", { "icon-name":
|
|
60
|
+
const iconName = this.isPasswordVisible ? 'fa-solid:eye-slash' : 'fa-solid:eye';
|
|
61
|
+
return index.h("br-icon", { "icon-name": iconName });
|
|
62
|
+
};
|
|
63
|
+
this.togglePasswordVisibility = () => {
|
|
64
|
+
const input = this.el.shadowRoot.querySelector('input');
|
|
65
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
66
|
+
input.type = this.isPasswordVisible ? 'text' : 'password';
|
|
67
|
+
};
|
|
68
|
+
this.renderInlineInputContent = () => {
|
|
69
|
+
if (this.hasIconSlot) {
|
|
70
|
+
return (index.h("div", { class: "input-content" }, this.renderInputWithIcon()));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return (index.h("div", { class: "input-content" }, this.renderInputWithoutIcon()));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
this.renderInputContent = () => {
|
|
77
|
+
return this.hasIconSlot ? this.renderInputWithIcon() : this.renderInputWithoutIcon();
|
|
78
|
+
};
|
|
79
|
+
this.renderInputWithIcon = () => {
|
|
80
|
+
return (index.h("div", { class: "input-group" }, this.renderIconSlot(), this.renderInput(), this.renderButton(), this.renderHelpText()));
|
|
81
|
+
};
|
|
82
|
+
this.renderInputWithoutIcon = () => {
|
|
83
|
+
return [
|
|
84
|
+
this.renderInput(),
|
|
85
|
+
this.renderButton(),
|
|
86
|
+
this.renderHelpText()
|
|
87
|
+
];
|
|
67
88
|
};
|
|
68
89
|
this.defaultID = `br-input-${v4.v4()}`;
|
|
69
90
|
this.type = 'text';
|
|
@@ -83,7 +104,7 @@ const Input = class {
|
|
|
83
104
|
this.required = false;
|
|
84
105
|
this.value = undefined;
|
|
85
106
|
this.helpText = undefined;
|
|
86
|
-
this.
|
|
107
|
+
this.isPasswordVisible = false;
|
|
87
108
|
this.hasIconSlot = false;
|
|
88
109
|
this.hasActionSlot = false;
|
|
89
110
|
}
|
|
@@ -162,7 +183,7 @@ const Input = class {
|
|
|
162
183
|
return null;
|
|
163
184
|
}
|
|
164
185
|
render() {
|
|
165
|
-
return (index.h(index.Host, { key: '
|
|
186
|
+
return (index.h(index.Host, { key: 'd589b969868e4d97d2aa6ac92a364a18eb8fc772' }, index.h("div", { key: '1f3dc623db346676c696c3b5347a4e39111fe581', class: this.getInputCssClassMap() }, this.renderLabel(), this.isInline ? (this.renderInlineInputContent()) : (this.renderInputContent()))));
|
|
166
187
|
}
|
|
167
188
|
static get formAssociated() { return true; }
|
|
168
189
|
get el() { return index.getElement(this); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"br-input.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,+8aAA+8a,CAAC;AACj+a,sBAAe,QAAQ;;MCkBV,KAAK;;;;;;;;;;;;;;;;;;;;;;;;QAsRR,wBAAmB,GAAe,EAAE,CAAA;QAM3B,gBAAW,GAAG,CAAC,KAAY;YAC1C,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAA;YACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,C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AAc,CAAC,MAAM,CAAC,EAAE;YAC/B,QACEF,iBAAK,KAAK,EAAC,YAAY,IACrBA,kBAAM,IAAI,EAAC,MAAM,GAAQ,CACrB,EACP;SACF;KACF;IAEO,YAAY;QAClB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;YAC5B,QACEA,uBACE,KAAK,EAAC,kBAAkB,EACxB,KAAK,EAAC,QAAQ,EACd,OAAO,EAAC,OAAO,gBACJ,4CAAwB,EACnC,OAAO,EAAE,IAAI,CAAC,wBAAwB,IAErC,IAAI,CAAC,kBAAkB,EAAE,CAChB,EACb;SACF;aAAM,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;YACxC,QACEA,uBACE,KAAK,EAAC,kBAAkB,EACxB,KAAK,EAAC,QAAQ,EACd,OAAO,EAAC,OAAO,gBACJ,4CAAwB,IAGnCA,kBAAM,IAAI,EAAC,QAAQ,GAAQ,CACjB,EACb;SACF;QACD,OAAO,IAAI,CAAA;KACZ;IAED,MAAM;QACJ,QACEA,QAACG,UAAI,uDACHH,kEAAK,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,IACnC,IAAI,CAAC,WAAW,EAAE,EAElB,IAAI,CAAC,WAAW,IACfA,iBAAK,KAAK,EAAC,aAAa,IACrB,IAAI,CAAC,cAAc,EAAE,EACrB,IAAI,CAAC,WAAW,EAAE,CACf,KAEN,IAAI,CAAC,WAAW,EAAE,CACnB,EAEA,IAAI,CAAC,YAAY,EAAE,EACnB,IAAI,CAAC,cAAc,EAAE,CAClB,CACD,EACR;KACF;;;;;;;;","names":["h","uuidv4","inheritAriaAttributes","Host"],"sources":["src/components/input/input.scss?tag=br-input&encapsulation=shadow","src/components/input/input.tsx"],"sourcesContent":["@import \"../../../../../node_modules/@govbr-ds/core/src/components/input/input.scss\";\n\n:host {\n display: block;\n\n .br-input .input-icon {\n margin-top: 0.1em;\n margin-left: var(--spacing-scale-base);\n }\n\n .br-input .input-icon + input {\n padding-left: calc(var(--input-padding-icon) + 3px);\n }\n}\n\n\n.br-input br-button {\n float: right;\n margin-right: var(--input-button-margin);\n margin-top: calc((var(--input-size) + var(--spacing-scale-half)) * -1);\n padding: 0;\n position: relative;\n}\n\n .button-transform{\n transform: translateY(calc((var(--input-size) - 32px) * 0.5));\n }\n","import { AttachInternals, Component, Element, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Attributes, inheritAriaAttributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Identificador único do campo de entrada.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) defaultID: string = `br-input-${uuidv4()}`\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) isHighlight: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação bem-sucedido.\n */\n @Prop({ reflect: true }) success: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação com erro.\n */\n @Prop({ reflect: true }) danger: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado informativo.\n */\n @Prop({ reflect: true }) info: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de alerta.\n */\n @Prop({ reflect: true }) warning: boolean = false\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) label: string\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) required: boolean = false\n\n /**\n * Valor inicial exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) helpText: string\n\n @State() showIconTextPassword: boolean = false\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.brWillLoad.emit()\n this.inheritedAttributes = inheritAriaAttributes(this.el)\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.success,\n danger: this.danger,\n info: this.info,\n warning: this.warning,\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange!: EventEmitter<string>\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label class=\"text-nowrap\" htmlFor={this.defaultID}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return <label htmlFor={this.defaultID}>{this.label}</label>\n }\n }\n }\n\n private readonly togglePasswordVisibility = () => {\n const input = this.el.shadowRoot.querySelector('input')\n input.type = input.type === 'password' ? 'text' : 'password'\n this.showIconTextPassword = input.type === 'password'\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.defaultID}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const showPassword = !this.showIconTextPassword\n return <br-icon icon-name={showPassword ? 'fa-solid:eye' : 'fa-solid:eye-slash'}></br-icon>\n }\n\n private renderIconSlot() {\n if (this.hasSlotContent('icon')) {\n return (\n <div class=\"input-icon\">\n <slot name=\"icon\"></slot>\n </div>\n )\n }\n }\n\n private renderButton() {\n if (this.type === 'password') {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n // onClick={this.onIconAction}\n >\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.hasIconSlot ? (\n <div class=\"input-group\">\n {this.renderIconSlot()}\n {this.renderInput()}\n </div>\n ) : (\n this.renderInput()\n )}\n\n {this.renderButton()}\n {this.renderHelpText()}\n </div>\n </Host>\n )\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"br-input.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,4/aAA4/a,CAAC;AAC9gb,sBAAe,QAAQ;;MCkBV,KAAK;;;;;;;;;;;;;;;;;;;;;;;;QAsRR,wBAAmB,GAAe,EAAE,CAAA;QAM3B,gBAAW,GAAG,CAAC,KAAY;YAC1C,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAA;YACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,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OAAO,gBACJ,4CAAwB,IAGnCA,kBAAM,IAAI,EAAC,QAAQ,GAAQ,CACjB,EACb;SACF;QACD,OAAO,IAAI,CAAA;KACZ;IAyCD,MAAM;QACJ,QACEA,QAACG,UAAI,uDACHH,kEAAK,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,IACnC,IAAI,CAAC,WAAW,EAAE,EAElB,IAAI,CAAC,QAAQ,IACZ,IAAI,CAAC,wBAAwB,EAAE,KAE/B,IAAI,CAAC,kBAAkB,EAAE,CAC5B,CACK,CACD,EACR;KACF;;;;;;;;","names":["h","uuidv4","inheritAriaAttributes","Host"],"sources":["src/components/input/input.scss?tag=br-input&encapsulation=shadow","src/components/input/input.tsx"],"sourcesContent":["@import \"../../../../../node_modules/@govbr-ds/core/src/components/input/input.scss\";\n\n:host {\n display: block;\n\n .br-input .input-icon {\n margin-top: 0.1em;\n margin-left: var(--spacing-scale-base);\n }\n\n .br-input .input-icon + input {\n padding-left: calc(var(--input-padding-icon) + 3px);\n }\n}\n\n\n.br-input br-button {\n float: right;\n margin-right: var(--input-button-margin);\n margin-top: calc((var(--input-size) + var(--spacing-scale-half)) * -1);\n padding: 0;\n position: relative;\n}\n\n .button-transform{\n transform: translateY(calc((var(--input-size) - 32px) * 0.5));\n }\n","import { AttachInternals, Component, Element, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Attributes, inheritAriaAttributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Identificador único do campo de entrada.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) defaultID: string = `br-input-${uuidv4()}`\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) isHighlight: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação bem-sucedido.\n */\n @Prop({ reflect: true }) success: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação com erro.\n */\n @Prop({ reflect: true }) danger: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado informativo.\n */\n @Prop({ reflect: true }) info: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de alerta.\n */\n @Prop({ reflect: true }) warning: boolean = false\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) label: string\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) required: boolean = false\n\n /**\n * Valor inicial exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) helpText: string\n\n @State() isPasswordVisible: boolean = false\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.brWillLoad.emit()\n this.inheritedAttributes = inheritAriaAttributes(this.el)\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.success,\n danger: this.danger,\n info: this.info,\n warning: this.warning,\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange!: EventEmitter<string>\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label class=\"text-nowrap\" htmlFor={this.defaultID}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return <label htmlFor={this.defaultID}>{this.label}</label>\n }\n }\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.defaultID}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const 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=\"botão de ação do ícone\"\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n // onClick={this.onIconAction}\n >\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n private readonly renderInlineInputContent = () => {\n if (this.hasIconSlot) {\n return (\n <div class=\"input-content\">\n {this.renderInputWithIcon()}\n </div>\n );\n } else {\n return (\n <div class=\"input-content\">\n {this.renderInputWithoutIcon()}\n </div>\n );\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 [\n this.renderInput(),\n this.renderButton(),\n this.renderHelpText()\n ]\n };\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.isInline ? (\n this.renderInlineInputContent()\n ) : (\n this.renderInputContent()\n )}\n </div>\n </Host>\n )\n }\n}\n"],"version":3}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["br-input.cjs",[[65,"br-input",{"defaultID":[513,"default-i-d"],"type":[513],"autocomplete":[513],"density":[513],"disabled":[516],"isInline":[516,"is-inline"],"isHighlight":[516,"is-highlight"],"success":[516],"danger":[516],"info":[516],"warning":[516],"label":[513],"name":[513],"placeholder":[513],"readonly":[516],"required":[516],"value":[1537],"helpText":[513,"help-text"],"
|
|
11
|
+
return index.bootstrapLazy([["br-input.cjs",[[65,"br-input",{"defaultID":[513,"default-i-d"],"type":[513],"autocomplete":[513],"density":[513],"disabled":[516],"isInline":[516,"is-inline"],"isHighlight":[516,"is-highlight"],"success":[516],"danger":[516],"info":[516],"warning":[516],"label":[513],"name":[513],"placeholder":[513],"readonly":[516],"required":[516],"value":[1537],"helpText":[513,"help-text"],"isPasswordVisible":[32],"hasIconSlot":[32],"hasActionSlot":[32]}]]],["br-message.cjs",[[65,"br-message",{"messageTitle":[513,"message-title"],"message":[513],"isInline":[516,"is-inline"],"isClosable":[516,"is-closable"],"showIcon":[516,"show-icon"],"isFeedback":[516,"is-feedback"],"state":[513]}]]],["br-avatar.cjs",[[1,"br-avatar",{"density":[1],"image":[1],"imageAlt":[1,"image-alt"],"isIconic":[4,"is-iconic"],"text":[1],"iconWidth":[32],"iconHeight":[32]}]]],["br-checkbox.cjs",[[65,"br-checkbox",{"indeterminate":[516],"checked":[1540],"customId":[513,"id"],"disabled":[516],"hasHiddenLabel":[516,"has-hidden-label"],"label":[513],"name":[513],"state":[513],"value":[520],"_slotDefault":[32],"toggleChecked":[64]}]]],["br-dropdown.cjs",[[65,"br-dropdown",{"isOpen":[1540,"is-open"],"open":[64],"hide":[64]},null,{"isOpen":["isOpenChanged"]}]]],["br-item.cjs",[[65,"br-item",{"disabled":[516],"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]},[[4,"brDidCheckedChange","handleChange"]]]]],["br-list.cjs",[[65,"br-list",{"listTitle":[513,"list-title"],"isHorizontal":[516,"is-horizontal"],"hideHeaderDivider":[516,"hide-header-divider"]}]]],["br-loading.cjs",[[65,"br-loading",{"isProgress":[516,"is-progress"],"progressPercent":[514,"progress-percent"],"isMedium":[516,"is-medium"],"label":[513]}]]],["br-radio.cjs",[[65,"br-radio",{"checked":[1540],"disabled":[516],"state":[513],"hasHiddenLabel":[516,"has-hidden-label"],"name":[513],"label":[513],"value":[520],"customId":[513,"id"],"computedId":[32]},[[8,"brDidChange","onBrDidChange"]],{"customId":["onCustomIdChange"]}]]],["br-switch.cjs",[[65,"br-switch",{"disabled":[516],"checked":[516],"customId":[513,"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],"_checkedValue":[32],"toggleChecked":[64]}]]],["br-textarea.cjs",[[65,"br-textarea",{"value":[1537],"label":[513],"placeholder":[513],"disabled":[516],"maxlength":[514],"states":[513],"density":[513],"isDarkMode":[516,"is-dark-mode"],"isLabelLeft":[516,"is-label-left"],"defaultId":[513,"default-id"],"currentLength":[32],"setValue":[64]},null,{"value":["valueChanged"]}]]],["br-button_2.cjs",[[65,"br-button",{"colorMode":[513,"color-mode"],"density":[513],"disabled":[516],"emphasis":[513],"isActive":[516,"is-active"],"isLoading":[516,"is-loading"],"shape":[513],"type":[513],"value":[513]}],[1,"br-icon",{"IconName":[513,"icon-name"],"height":[513],"width":[513],"CssClasses":[513,"css-classes"],"isInline":[516,"is-inline"],"rotate":[513],"flip":[513]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["br-input.cjs",[[65,"br-input",{"defaultID":[513,"default-i-d"],"type":[513],"autocomplete":[513],"density":[513],"disabled":[516],"isInline":[516,"is-inline"],"isHighlight":[516,"is-highlight"],"success":[516],"danger":[516],"info":[516],"warning":[516],"label":[513],"name":[513],"placeholder":[513],"readonly":[516],"required":[516],"value":[1537],"helpText":[513,"help-text"],"
|
|
22
|
+
return index.bootstrapLazy([["br-input.cjs",[[65,"br-input",{"defaultID":[513,"default-i-d"],"type":[513],"autocomplete":[513],"density":[513],"disabled":[516],"isInline":[516,"is-inline"],"isHighlight":[516,"is-highlight"],"success":[516],"danger":[516],"info":[516],"warning":[516],"label":[513],"name":[513],"placeholder":[513],"readonly":[516],"required":[516],"value":[1537],"helpText":[513,"help-text"],"isPasswordVisible":[32],"hasIconSlot":[32],"hasActionSlot":[32]}]]],["br-message.cjs",[[65,"br-message",{"messageTitle":[513,"message-title"],"message":[513],"isInline":[516,"is-inline"],"isClosable":[516,"is-closable"],"showIcon":[516,"show-icon"],"isFeedback":[516,"is-feedback"],"state":[513]}]]],["br-avatar.cjs",[[1,"br-avatar",{"density":[1],"image":[1],"imageAlt":[1,"image-alt"],"isIconic":[4,"is-iconic"],"text":[1],"iconWidth":[32],"iconHeight":[32]}]]],["br-checkbox.cjs",[[65,"br-checkbox",{"indeterminate":[516],"checked":[1540],"customId":[513,"id"],"disabled":[516],"hasHiddenLabel":[516,"has-hidden-label"],"label":[513],"name":[513],"state":[513],"value":[520],"_slotDefault":[32],"toggleChecked":[64]}]]],["br-dropdown.cjs",[[65,"br-dropdown",{"isOpen":[1540,"is-open"],"open":[64],"hide":[64]},null,{"isOpen":["isOpenChanged"]}]]],["br-item.cjs",[[65,"br-item",{"disabled":[516],"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]},[[4,"brDidCheckedChange","handleChange"]]]]],["br-list.cjs",[[65,"br-list",{"listTitle":[513,"list-title"],"isHorizontal":[516,"is-horizontal"],"hideHeaderDivider":[516,"hide-header-divider"]}]]],["br-loading.cjs",[[65,"br-loading",{"isProgress":[516,"is-progress"],"progressPercent":[514,"progress-percent"],"isMedium":[516,"is-medium"],"label":[513]}]]],["br-radio.cjs",[[65,"br-radio",{"checked":[1540],"disabled":[516],"state":[513],"hasHiddenLabel":[516,"has-hidden-label"],"name":[513],"label":[513],"value":[520],"customId":[513,"id"],"computedId":[32]},[[8,"brDidChange","onBrDidChange"]],{"customId":["onCustomIdChange"]}]]],["br-switch.cjs",[[65,"br-switch",{"disabled":[516],"checked":[516],"customId":[513,"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],"_checkedValue":[32],"toggleChecked":[64]}]]],["br-textarea.cjs",[[65,"br-textarea",{"value":[1537],"label":[513],"placeholder":[513],"disabled":[516],"maxlength":[514],"states":[513],"density":[513],"isDarkMode":[516,"is-dark-mode"],"isLabelLeft":[516,"is-label-left"],"defaultId":[513,"default-id"],"currentLength":[32],"setValue":[64]},null,{"value":["valueChanged"]}]]],["br-button_2.cjs",[[65,"br-button",{"colorMode":[513,"color-mode"],"density":[513],"disabled":[516],"emphasis":[513],"isActive":[516,"is-active"],"isLoading":[516,"is-loading"],"shape":[513],"type":[513],"value":[513]}],[1,"br-icon",{"IconName":[513,"icon-name"],"height":[513],"width":[513],"CssClasses":[513,"css-classes"],"isInline":[516,"is-inline"],"rotate":[513],"flip":[513]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -488,6 +488,9 @@ textarea,
|
|
|
488
488
|
margin-right: var(--spacing-scale-baseh);
|
|
489
489
|
margin-top: calc(var(--input-size) * 0.5 - var(--spacing-scale-half));
|
|
490
490
|
}
|
|
491
|
+
.br-input.input-inline .input-content {
|
|
492
|
+
flex: 1;
|
|
493
|
+
}
|
|
491
494
|
.br-input .input-group {
|
|
492
495
|
position: relative;
|
|
493
496
|
}
|
|
@@ -27,11 +27,6 @@ export class Input {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
this.togglePasswordVisibility = () => {
|
|
31
|
-
const input = this.el.shadowRoot.querySelector('input');
|
|
32
|
-
input.type = input.type === 'password' ? 'text' : 'password';
|
|
33
|
-
this.showIconTextPassword = input.type === 'password';
|
|
34
|
-
};
|
|
35
30
|
this.renderInput = () => {
|
|
36
31
|
return (h("input", Object.assign({ class: this.isHighlight ? 'input-highlight' : null, id: this.defaultID, autocomplete: this.autocomplete, disabled: this.disabled, onInput: this.handleInput, placeholder: this.placeholder, readonly: this.readonly, required: this.required, title: this.el.title, type: this.type, value: this.value }, this.inheritedAttributes)));
|
|
37
32
|
};
|
|
@@ -40,8 +35,34 @@ export class Input {
|
|
|
40
35
|
return ((_a = this.helpText) === null || _a === void 0 ? void 0 : _a.length) > 0 ? h("p", null, this.helpText) : h("slot", { name: "help-text" });
|
|
41
36
|
};
|
|
42
37
|
this.renderIconPassword = () => {
|
|
43
|
-
const
|
|
44
|
-
return h("br-icon", { "icon-name":
|
|
38
|
+
const iconName = this.isPasswordVisible ? 'fa-solid:eye-slash' : 'fa-solid:eye';
|
|
39
|
+
return h("br-icon", { "icon-name": iconName });
|
|
40
|
+
};
|
|
41
|
+
this.togglePasswordVisibility = () => {
|
|
42
|
+
const input = this.el.shadowRoot.querySelector('input');
|
|
43
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
44
|
+
input.type = this.isPasswordVisible ? 'text' : 'password';
|
|
45
|
+
};
|
|
46
|
+
this.renderInlineInputContent = () => {
|
|
47
|
+
if (this.hasIconSlot) {
|
|
48
|
+
return (h("div", { class: "input-content" }, this.renderInputWithIcon()));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return (h("div", { class: "input-content" }, this.renderInputWithoutIcon()));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
this.renderInputContent = () => {
|
|
55
|
+
return this.hasIconSlot ? this.renderInputWithIcon() : this.renderInputWithoutIcon();
|
|
56
|
+
};
|
|
57
|
+
this.renderInputWithIcon = () => {
|
|
58
|
+
return (h("div", { class: "input-group" }, this.renderIconSlot(), this.renderInput(), this.renderButton(), this.renderHelpText()));
|
|
59
|
+
};
|
|
60
|
+
this.renderInputWithoutIcon = () => {
|
|
61
|
+
return [
|
|
62
|
+
this.renderInput(),
|
|
63
|
+
this.renderButton(),
|
|
64
|
+
this.renderHelpText()
|
|
65
|
+
];
|
|
45
66
|
};
|
|
46
67
|
this.defaultID = `br-input-${uuidv4()}`;
|
|
47
68
|
this.type = 'text';
|
|
@@ -61,7 +82,7 @@ export class Input {
|
|
|
61
82
|
this.required = false;
|
|
62
83
|
this.value = undefined;
|
|
63
84
|
this.helpText = undefined;
|
|
64
|
-
this.
|
|
85
|
+
this.isPasswordVisible = false;
|
|
65
86
|
this.hasIconSlot = false;
|
|
66
87
|
this.hasActionSlot = false;
|
|
67
88
|
}
|
|
@@ -140,7 +161,7 @@ export class Input {
|
|
|
140
161
|
return null;
|
|
141
162
|
}
|
|
142
163
|
render() {
|
|
143
|
-
return (h(Host, { key: '
|
|
164
|
+
return (h(Host, { key: 'd589b969868e4d97d2aa6ac92a364a18eb8fc772' }, h("div", { key: '1f3dc623db346676c696c3b5347a4e39111fe581', class: this.getInputCssClassMap() }, this.renderLabel(), this.isInline ? (this.renderInlineInputContent()) : (this.renderInputContent()))));
|
|
144
165
|
}
|
|
145
166
|
static get is() { return "br-input"; }
|
|
146
167
|
static get encapsulation() { return "shadow"; }
|
|
@@ -479,7 +500,7 @@ export class Input {
|
|
|
479
500
|
}
|
|
480
501
|
static get states() {
|
|
481
502
|
return {
|
|
482
|
-
"
|
|
503
|
+
"isPasswordVisible": {},
|
|
483
504
|
"hasIconSlot": {},
|
|
484
505
|
"hasActionSlot": {}
|
|
485
506
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAC9G,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAc,qBAAqB,EAAE,MAA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Q,CACjB,CACb,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DAAK,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE;gBACnC,IAAI,CAAC,WAAW,EAAE;gBAElB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAClB,WAAK,KAAK,EAAC,aAAa;oBACrB,IAAI,CAAC,cAAc,EAAE;oBACrB,IAAI,CAAC,WAAW,EAAE,CACf,CACP,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,WAAW,EAAE,CACnB;gBAEA,IAAI,CAAC,YAAY,EAAE;gBACnB,IAAI,CAAC,cAAc,EAAE,CAClB,CACD,CACR,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Attributes, inheritAriaAttributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Identificador único do campo de entrada.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) defaultID: string = `br-input-${uuidv4()}`\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) isHighlight: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação bem-sucedido.\n */\n @Prop({ reflect: true }) success: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação com erro.\n */\n @Prop({ reflect: true }) danger: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado informativo.\n */\n @Prop({ reflect: true }) info: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de alerta.\n */\n @Prop({ reflect: true }) warning: boolean = false\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) label: string\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) required: boolean = false\n\n /**\n * Valor inicial exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) helpText: string\n\n @State() showIconTextPassword: boolean = false\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.brWillLoad.emit()\n this.inheritedAttributes = inheritAriaAttributes(this.el)\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.success,\n danger: this.danger,\n info: this.info,\n warning: this.warning,\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange!: EventEmitter<string>\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label class=\"text-nowrap\" htmlFor={this.defaultID}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return <label htmlFor={this.defaultID}>{this.label}</label>\n }\n }\n }\n\n private readonly togglePasswordVisibility = () => {\n const input = this.el.shadowRoot.querySelector('input')\n input.type = input.type === 'password' ? 'text' : 'password'\n this.showIconTextPassword = input.type === 'password'\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.defaultID}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const showPassword = !this.showIconTextPassword\n return <br-icon icon-name={showPassword ? 'fa-solid:eye' : 'fa-solid:eye-slash'}></br-icon>\n }\n\n private renderIconSlot() {\n if (this.hasSlotContent('icon')) {\n return (\n <div class=\"input-icon\">\n <slot name=\"icon\"></slot>\n </div>\n )\n }\n }\n\n private renderButton() {\n if (this.type === 'password') {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n // onClick={this.onIconAction}\n >\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.hasIconSlot ? (\n <div class=\"input-group\">\n {this.renderIconSlot()}\n {this.renderInput()}\n </div>\n ) : (\n this.renderInput()\n )}\n\n {this.renderButton()}\n {this.renderHelpText()}\n </div>\n </Host>\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAC9G,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAc,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAGpF;;;;;;;GAOG;AAOH,MAAM,OAAO,KAAK;;QAsRR,wBAAmB,GAAe,EAAE,CAAA;QAM3B,gBAAW,GAAG,CAAC,KAAY,EAAE,EAAE;YAC9C,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,MAA2B,CAAC,KAAK,CAAA;YACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnC,CAAC,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core'\nimport { v4 as uuidv4 } from 'uuid'\nimport { Attributes, inheritAriaAttributes } from '../../utils/inherited-attributes'\nimport { CssClassMap } from '../../utils/interfaces'\n\n/**\n *\n * Para uma descrição detalhada, consulte a [documentação do GovBR-DS](https://www.gov.br/ds/components/input?tab=designer).\n *\n * @slot action - Botão à direita do input.\n * @slot icon - Ícone à esquerda do input.\n * @slot help-text - Personalização do texto de ajuda.\n */\n@Component({\n tag: 'br-input',\n styleUrl: 'input.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class Input {\n /**\n * Referência ao elemento host do componente.\n * Utilize esta propriedade para acessar e manipular o elemento do DOM associado ao componente.\n */\n @Element() el: HTMLBrInputElement\n\n @AttachInternals() elementInternals: ElementInternals\n\n /**\n * Identificador único do campo de entrada.\n * Caso não seja fornecido, um ID gerado automaticamente será usado.\n */\n @Prop({ reflect: true }) defaultID: string = `br-input-${uuidv4()}`\n\n /**\n * Especifica o tipo de entrada do campo. Pode ser um dos seguintes:\n * - 'color': Seletor de cor\n * - 'email': Campo para e-mail\n * - 'hidden': Campo oculto\n * - 'password': Campo para senha\n * - 'range': Controle deslizante\n * - 'search': Campo de pesquisa\n * - 'number': Campo para números\n * - 'tel': Campo para números de telefone\n * - 'text': Campo de texto padrão\n * - 'url': Campo para URLs\n */\n @Prop({ reflect: true }) type:\n | 'color'\n | 'email'\n | 'hidden'\n | 'password'\n | 'range'\n | 'search'\n | 'number'\n | 'tel'\n | 'text'\n | 'url' = 'text'\n\n /**\n * Controla o comportamento de preenchimento automático do navegador para o input.\n */\n @Prop({ reflect: true }) autocomplete: 'on' | 'off'\n\n /**\n * Ajusta a densidade, alterando o espaçamento interno para um visual mais compacto ou mais expandido.\n */\n @Prop({ reflect: true }) density: 'large' | 'medium' | 'small' = 'medium'\n\n /**\n * Desativa o input, tornando-o não interativo.\n */\n @Prop({ reflect: true }) disabled: boolean = false\n\n /**\n * Se verdadeiro, o rótulo e o input estarão na mesma linha (layout inline).\n */\n @Prop({ reflect: true }) isInline: boolean = false\n\n /**\n * Se verdadeiro, o input terá destaque visual.\n */\n @Prop({ reflect: true }) isHighlight: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação bem-sucedido.\n */\n @Prop({ reflect: true }) success: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de validação com erro.\n */\n @Prop({ reflect: true }) danger: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado informativo.\n */\n @Prop({ reflect: true }) info: boolean = false\n\n /**\n * Se verdadeiro, o input indica um estado de alerta.\n */\n @Prop({ reflect: true }) warning: boolean = false\n\n /**\n * Texto exibido como rótulo do input.\n */\n @Prop({ reflect: true }) label: string\n\n /**\n * Nome do input, utilizado para identificação em formulários.\n */\n @Prop({ reflect: true }) name: string\n\n /**\n * Texto exibido dentro do input quando está vazio, fornecendo uma dica ou sugestão ao usuário.\n */\n @Prop({ reflect: true }) placeholder: string\n\n /**\n * Se verdadeiro, o valor do input é exibido, mas não pode ser editado pelo usuário.\n */\n @Prop({ reflect: true }) readonly: boolean = false\n\n /**\n * Se verdadeiro, o input é obrigatório e deve ser preenchido antes que o formulário possa ser enviado.\n */\n @Prop({ reflect: true }) required: boolean = false\n\n /**\n * Valor inicial exibido no input.\n * Pode ser alterado pelo usuário se a propriedade `readonly` não estiver ativa.\n */\n @Prop({ reflect: true, mutable: true }) value: string\n\n /**\n * Texto adicional que fornece ajuda ou informações sobre o input.\n */\n @Prop({ reflect: true }) helpText: string\n\n @State() isPasswordVisible: boolean = false\n\n @State() hasIconSlot: boolean = false\n\n @State() hasActionSlot: boolean = false\n\n /**\n * Emite um evento quando o componente é conectado ao DOM.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#connectedcallback) para mais detalhes.\n */\n @Event() brDidConnect: EventEmitter<void>\n connectedCallback() {\n this.brDidConnect.emit()\n }\n\n /**\n * Emite um evento antes que o componente seja carregado pela primeira vez.\n * Utilize este evento para realizar tarefas de inicialização antes do componente ser exibido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillload) para mais detalhes.\n */\n @Event() brWillLoad: EventEmitter<void>\n componentWillLoad() {\n this.hasIconSlot = this.hasSlotContent('icon')\n this.hasActionSlot = this.hasSlotContent('action')\n this.brWillLoad.emit()\n this.inheritedAttributes = inheritAriaAttributes(this.el)\n }\n\n /**\n * Emite um evento após o componente ter sido carregado pela primeira vez.\n * Utilize este evento para realizar ações que devem ocorrer depois que o componente foi totalmente carregado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidload) para mais detalhes.\n */\n @Event() brDidLoad: EventEmitter<void>\n componentDidLoad() {\n this.brDidLoad.emit()\n }\n\n /**\n * Emite um evento antes do componente ser renderizado.\n * Utilize este evento para preparar o componente antes de sua renderização.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillrender) para mais detalhes.\n */\n @Event() brWillRender: EventEmitter<void>\n componentWillRender() {\n this.brWillRender.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido renderizado.\n * Utilize este evento para executar ações que devem ocorrer após a renderização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidrender) para mais detalhes.\n */\n @Event() brDidRender: EventEmitter<void>\n componentDidRender() {\n this.brDidRender.emit()\n }\n\n /**\n * Emite um evento para indicar se o componente deve ser atualizado ou não.\n * Este evento é chamado antes de qualquer atualização do componente para decidir se a atualização deve prosseguir.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentshouldupdate) para mais detalhes.\n */\n @Event() brShouldUpdate: EventEmitter<void>\n componentShouldUpdate() {\n this.brShouldUpdate.emit()\n }\n\n /**\n * Emite um evento antes de o componente ser atualizado.\n * Utilize este evento para realizar ações preparatórias antes da atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentwillupdate) para mais detalhes.\n */\n @Event() brWillUpdate: EventEmitter<void>\n componentWillUpdate() {\n this.brWillUpdate.emit()\n }\n\n /**\n * Emite um evento após o componente ter sido atualizado.\n * Utilize este evento para realizar ações após a atualização do componente.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#componentdidupdate) para mais detalhes.\n */\n @Event() brDidUpdate: EventEmitter<void>\n componentDidUpdate() {\n this.brDidUpdate.emit()\n }\n\n /**\n * Emite um evento quando o componente é desconectado do DOM.\n * Utilize este evento para realizar a limpeza ou outras ações necessárias quando o componente é removido.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/component-lifecycle#disconnectedcallback) para mais detalhes.\n */\n @Event() brDidDisconnect: EventEmitter<void>\n disconnectedCallback() {\n this.brDidDisconnect.emit()\n }\n\n /**\n * Emite um evento quando o componente é associado ou removido de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formassociatedcallback) para mais detalhes.\n *\n * @param form - Dados do formulário associado.\n */\n @Event() brFormAssociatedCallback: EventEmitter<FormData>\n formAssociatedCallback(form: FormData) {\n this.brFormAssociatedCallback.emit(form)\n }\n\n /**\n * Emite um evento quando o estado `disabled` do componente muda dentro de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formdisabledcallback) para mais informações.\n *\n * @param disabled - Novo estado `disabled` do componente dentro do formulário.\n */\n @Event() brFormDisabledCallback: EventEmitter<boolean>\n formDisabledCallback(disabled: boolean) {\n this.brFormDisabledCallback.emit(disabled)\n }\n\n /**\n * Emite um evento quando um `<form>` é resetado.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formresetcallback) para mais detalhes.\n */\n @Event() brFormResetCallback: EventEmitter<void>\n formResetCallback() {\n this.brFormResetCallback.emit()\n }\n\n /**\n * Emite um evento quando o navegador preenche automaticamente os campos de um `<form>`.\n * Consulte a documentação do [Stencil](https://stenciljs.com/docs/form-associated#formstaterestorecallback) para mais informações.\n *\n * @param state - Estado restaurado do formulário.\n * @param _mode - Modo de preenchimento automático do navegador.\n */\n @Event() brFormStateRestoreCallback: EventEmitter<[state: string, _mode: string]>\n formStateRestoreCallback(state: string, _mode: string) {\n this.brFormStateRestoreCallback.emit([state, _mode])\n }\n\n private getInputCssClassMap(): CssClassMap {\n return {\n 'br-input': true,\n 'input-button': this.hasActionSlot,\n small: this.density === 'small',\n large: this.density === 'large',\n medium: this.density === 'medium',\n 'input-inline': this.isInline,\n 'input-highlight': this.isHighlight,\n success: this.success,\n danger: this.danger,\n info: this.info,\n warning: this.warning,\n }\n }\n\n private inheritedAttributes: Attributes = {}\n\n /**\n * Valor atualizado do input\n */\n @Event() valueChange!: EventEmitter<string>\n private readonly handleInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value\n this.valueChange.emit(this.value)\n }\n\n private readonly renderLabel = () => {\n if (this.label?.length > 0) {\n if (this.isInline) {\n return (\n <div class=\"input-label\">\n <label class=\"text-nowrap\" htmlFor={this.defaultID}>\n {this.label}\n </label>\n </div>\n )\n } else {\n return <label htmlFor={this.defaultID}>{this.label}</label>\n }\n }\n }\n\n private hasSlotContent(slotName: string): boolean {\n return this.el.querySelector(`[slot=\"${slotName}\"]`) !== null\n }\n\n private readonly renderInput = () => {\n return (\n <input\n class={this.isHighlight ? 'input-highlight' : null}\n id={this.defaultID}\n autocomplete={this.autocomplete}\n disabled={this.disabled}\n onInput={this.handleInput}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n title={this.el.title}\n type={this.type}\n value={this.value}\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly renderHelpText = () => {\n return this.helpText?.length > 0 ? <p>{this.helpText}</p> : <slot name=\"help-text\"></slot>\n }\n\n private readonly renderIconPassword = () => {\n const 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=\"botão de ação do ícone\"\n onClick={this.togglePasswordVisibility}\n >\n {this.renderIconPassword()}\n </br-button>\n )\n } else if (this.hasSlotContent('action')) {\n return (\n <br-button\n class=\"button-transform\"\n shape=\"circle\"\n density=\"small\"\n aria-label=\"botão de ação do ícone\"\n // onClick={this.onIconAction}\n >\n <slot name=\"action\"></slot>\n </br-button>\n )\n }\n return null\n }\n\n private readonly renderInlineInputContent = () => {\n if (this.hasIconSlot) {\n return (\n <div class=\"input-content\">\n {this.renderInputWithIcon()}\n </div>\n );\n } else {\n return (\n <div class=\"input-content\">\n {this.renderInputWithoutIcon()}\n </div>\n );\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 [\n this.renderInput(),\n this.renderButton(),\n this.renderHelpText()\n ]\n };\n\n render() {\n return (\n <Host>\n <div class={this.getInputCssClassMap()}>\n {this.renderLabel()}\n\n {this.isInline ? (\n this.renderInlineInputContent()\n ) : (\n this.renderInputContent()\n )}\n </div>\n </Host>\n )\n }\n}\n"]}
|