@ncino/web-components 6.1.0-preview.1 → 6.1.0-preview.11
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/components/avatar/gator/avatar.gator.js +5 -5
- package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.js +3 -3
- package/dist/components/input/base/input-base.js +1 -1
- package/dist/components/input/gator/input-date/input-date.gator.js +8 -8
- package/dist/components/input/gator/input-masked/input-masked.gator.js +1 -1
- package/dist/components/input/gator/input-text/input-text.gator.js +8 -7
- package/dist/components/input/gator/input-textarea/input-textarea.gator.js +13 -5
- package/dist/components/panel/gator/panel.storybook-test.js +1 -1
- package/dist/components/skip-link/gator/base/skip-link.gator.js +22 -0
- package/dist/components/skip-link/gator/list-item/skip-link-list-item.gator.js +7 -0
- package/dist/components/skip-link/index.js +1 -0
- package/dist/components/table/gator/table-bulk-controls/table-bulk-controls.gator.js +2 -2
- package/dist/components/table/gator/table.gator.js +29 -38
- package/dist/components/text-link/gator/text-link.gator.js +20 -10
- package/dist/index.gator.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.utils.js +1 -0
- package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/color-convert@3.1.0/node_modules/color-convert/conversions.js +1 -0
- package/dist/node_modules/.pnpm/color-convert@3.1.0/node_modules/color-convert/index.js +1 -0
- package/dist/node_modules/.pnpm/color-convert@3.1.0/node_modules/color-convert/route.js +1 -0
- package/dist/node_modules/.pnpm/color-name@2.0.0/node_modules/color-name/index.js +1 -0
- package/dist/node_modules/.pnpm/color-string@2.0.1/node_modules/color-string/index.js +1 -0
- package/dist/node_modules/.pnpm/color@5.0.0/node_modules/color/index.js +1 -0
- package/dist/node_modules/.pnpm/{magic-string@0.30.17 → magic-string@0.30.18}/node_modules/magic-string/dist/magic-string.es.js +2 -2
- package/dist/packages/web-components/src/components/avatar/gator/avatar.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/checkbox/checkbox.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/checkbox-group/checkbox-group.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/input/gator/input-textarea/input-textarea.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/page-header/gator/page-header.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/skip-link/gator/base/skip-link.gator.scss.js +1 -0
- package/dist/packages/web-components/src/components/skip-link/gator/list-item/skip-link-list-item.gator.scss.js +1 -0
- package/dist/packages/web-components/src/styles/_gator-utils.scss.js +1 -1
- package/dist/types/components/avatar/gator/avatar.gator.d.ts +3 -1
- package/dist/types/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.d.ts +6 -0
- package/dist/types/components/input/base/input-base.d.ts +5 -0
- package/dist/types/components/input/gator/input-date/input-date.gator.d.ts +11 -1
- package/dist/types/components/input/gator/input-masked/input-masked.gator.d.ts +7 -1
- package/dist/types/components/input/gator/input-text/input-text.gator.d.ts +1 -0
- package/dist/types/components/input/gator/input-textarea/input-textarea.gator.d.ts +21 -0
- package/dist/types/components/skip-link/gator/base/skip-link.gator.d.ts +36 -0
- package/dist/types/components/skip-link/gator/base/skip-link.gator.test.d.ts +0 -0
- package/dist/types/components/skip-link/gator/list-item/skip-link-list-item.gator.d.ts +13 -0
- package/dist/types/components/skip-link/gator/list-item/skip-link-list-item.gator.test.d.ts +0 -0
- package/dist/types/components/skip-link/index.d.ts +2 -0
- package/dist/types/components/table/gator/table-bulk-controls/table-bulk-controls.gator.d.ts +6 -1
- package/dist/types/components/table/gator/table.gator.d.ts +3 -6
- package/dist/types/components/text-link/gator/text-link.gator.d.ts +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.gator.d.ts +1 -0
- package/dist/types/index.utils.d.ts +1 -0
- package/dist/types/utils/brand-color-utils.d.ts +2 -0
- package/dist/types/utils/storybook-args.d.ts +10 -0
- package/dist/utils/brand-color-utils.js +1 -0
- package/dist/utils/storybook-args.js +1 -1
- package/dist/utils/vitest-a11y-utils.js +1 -1
- package/package.json +14 -6
- package/web-types.json +260 -11
- package/dist/node_modules/.pnpm/chai@5.2.1/node_modules/chai/chai.js +0 -218
- /package/dist/node_modules/.pnpm/{@jridgewell_sourcemap-codec@1.5.4 → @jridgewell_sourcemap-codec@1.5.5}/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +0 -0
- /package/dist/node_modules/.pnpm/{@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.2.1_typescript@5.8.3__playwright@1.54.1__6e6aa2c9b4102560da2d8ed1e4176ee9 → @vitest_browser@3.2.4_msw@2.7.3_@types_node@24.3.0_typescript@5.8.3__playwright@1.55.0__558558d730596f7c5e09b21ff26a3e74}/node_modules/@vitest/browser/context.js +0 -0
- /package/dist/node_modules/.pnpm/{storybook@9.1.1_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.2.1_typescript@5.8_ee1bb5025e4d34f67b4152c2110a5ec2 → storybook@9.1.2_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.3.0_typescript@5.8_573854de366b5ba3e2ab3da4bce0caa8}/node_modules/storybook/dist/client-logger/index.js +0 -0
- /package/dist/node_modules/.pnpm/{storybook@9.1.1_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.2.1_typescript@5.8_ee1bb5025e4d34f67b4152c2110a5ec2 → storybook@9.1.2_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.3.0_typescript@5.8_573854de366b5ba3e2ab3da4bce0caa8}/node_modules/storybook/dist/core-events/index.js +0 -0
- /package/dist/node_modules/.pnpm/{storybook@9.1.1_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.2.1_typescript@5.8_ee1bb5025e4d34f67b4152c2110a5ec2 → storybook@9.1.2_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.3.0_typescript@5.8_573854de366b5ba3e2ab3da4bce0caa8}/node_modules/storybook/dist/instrumenter/index.js +0 -0
- /package/dist/node_modules/.pnpm/{storybook@9.1.1_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.2.1_typescript@5.8_ee1bb5025e4d34f67b4152c2110a5ec2 → storybook@9.1.2_@testing-library_dom@10.4.0_msw@2.7.3_@types_node@24.3.0_typescript@5.8_573854de366b5ba3e2ab3da4bce0caa8}/node_modules/storybook/dist/test/index.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.2.1_@vitest_browser@3.2.4_@vitest_ui@3._7f1cfb627fdb82ddd833112aba9e7b0b → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.3.0_@vitest_browser@3.2.4_@vitest_ui@3._f0774390203a57f267156838cb4cb2c5}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.2.1_@vitest_browser@3.2.4_@vitest_ui@3._7f1cfb627fdb82ddd833112aba9e7b0b → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.3.0_@vitest_browser@3.2.4_@vitest_ui@3._f0774390203a57f267156838cb4cb2c5}/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.2.1_@vitest_browser@3.2.4_@vitest_ui@3._7f1cfb627fdb82ddd833112aba9e7b0b → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.3.0_@vitest_browser@3.2.4_@vitest_ui@3._f0774390203a57f267156838cb4cb2c5}/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.2.1_@vitest_browser@3.2.4_@vitest_ui@3._7f1cfb627fdb82ddd833112aba9e7b0b → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.3.0_@vitest_browser@3.2.4_@vitest_ui@3._f0774390203a57f267156838cb4cb2c5}/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as c}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as
|
|
2
|
-
<div ${
|
|
1
|
+
import"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as c}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as p}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{state as h}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/state.js";import u from"../../../packages/web-components/src/components/avatar/gator/avatar.gator.scss.js";import f from"../../../packages/web-components/src/components/avatar/avatar.tokens.scss.js";import v from"../../../packages/web-components/src/tokens/primitive.tokens.scss.js";import g from"../../../packages/web-components/src/tokens/semantic.tokens.scss.js";import{NjcAvatar as d}from"../avatar.js";import{createRef as _,ref as x}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js";import{ifDefined as z}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/if-defined.js";import{unsafeCSS as o}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var y=Object.defineProperty,$=Object.getOwnPropertyDescriptor,m=(t,e,a,s)=>{for(var r=s>1?void 0:s?$(e,a):e,l=t.length-1,n;l>=0;l--)(n=t[l])&&(r=(s?n(e,a,r):n(r))||r);return s&&r&&y(e,a,r),r};let i=class extends d{constructor(){super(...arguments),this._avatarRef=_(),this._size=40,this._srcValid=!1}render(){return this.skeleton?c`<ngc-skeleton-loader width="${this.pixelSize}" height="${this.pixelSize}" radius="50"></ngc-skeleton-loader>`:c`
|
|
2
|
+
<div ${x(this._avatarRef)}
|
|
3
3
|
class="gator-avatar ${this.interactive?"gator-avatar-interactive":""}"
|
|
4
|
-
tabindex="${
|
|
4
|
+
tabindex="${z(this.interactive?"0":void 0)}"
|
|
5
5
|
role="${this.interactive?"button":"img"}"
|
|
6
6
|
aria-label="${this.srcAriaLabel||this.avatarAriaLabel}"
|
|
7
7
|
>
|
|
8
8
|
<span class="gator-avatar-content">
|
|
9
9
|
<slot></slot>
|
|
10
|
-
${this.srcIsPopulated?c`
|
|
10
|
+
${this.srcIsPopulated&&this._srcValid?c`
|
|
11
11
|
<span class="gator-avatar-image"></span>
|
|
12
12
|
`:null}
|
|
13
13
|
</span>
|
|
14
14
|
</div>
|
|
15
|
-
`}get srcIsPopulated(){return this.src&&this.src.trim()!==""}updated(){if(this._avatarRef.value&&(this.size&&(this._size=this.pixelSize,this._avatarRef.value.style.width=`${this._size}px`,this._avatarRef.value.style.height=`${this._size}px`,this._avatarRef.value.querySelector(".gator-avatar-content")?.setAttribute("style",`font-size: ${this._size/2.5}px`),this.applySizeToSlottedIcon()),this.src)){let
|
|
15
|
+
`}get srcIsPopulated(){return this.src&&this.src.trim()!==""}async updated(t){if(t&&t.has("src")&&(this._srcValid=await this.isImageLoadable(this.src)),!!this._avatarRef.value&&(this.size&&(this._size=this.pixelSize,this._avatarRef.value.style.width=`${this._size}px`,this._avatarRef.value.style.height=`${this._size}px`,this._avatarRef.value.querySelector(".gator-avatar-content")?.setAttribute("style",`font-size: ${this._size/2.5}px`),this.applySizeToSlottedIcon()),this.src&&this._srcValid)){let e=this._avatarRef.value.querySelector(".gator-avatar-image");e&&(e.style.backgroundImage=`url(${this.src})`,e.style.width=`${this._size}px`,e.style.height=`${this._size}px`)}}isImageLoadable(t){return!t||t.trim()===""?Promise.resolve(!1):new Promise(e=>{const a=new Image,s=()=>{a.onload=null,a.onerror=null};a.onload=()=>{s(),e(!0)},a.onerror=()=>{s(),e(!1)},a.src=t})}applySizeToSlottedIcon(){const t=this._avatarRef.value?.querySelector("slot");t&&t.assignedElements().forEach(a=>{a.tagName.toLowerCase()==="ngc-icon"&&(a.size=this.size==="xxx-small"?"xx-small":this.size)})}get pixelSize(){const t=parseInt(this.size);if(!Number.isNaN(t))return t;switch(this.size){case"xxx-small":return 16;case"xx-small":return 24;case"x-small":return 32;case"small":return 40;case"medium":return 48;case"large":return 64;case"x-large":return 80;default:return 40}}};i.styles=[o(u),o(v),o(g),o(f)];m([h()],i.prototype,"_size",2);m([h()],i.prototype,"_srcValid",2);i=m([p("ngc-avatar")],i);export{i as NgcAvatar};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as b}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as
|
|
1
|
+
import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as b}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as n}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as m}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import l from"../../../../packages/web-components/src/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.scss.js";import h from"../../../../packages/web-components/src/tokens/primitive.tokens.scss.js";import d from"../../../../packages/web-components/src/tokens/semantic.tokens.scss.js";import g from"../../../../packages/web-components/src/components/breadcrumbs/gator/breadcrumbs.gator.tokens.scss.js";import{createRef as y,ref as v}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js";import{TestableLitElement as f}from"../../../../utils/components/testable-lit-element/testable-lit-element.js";import{unsafeCSS as a}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var O=Object.defineProperty,R=Object.getOwnPropertyDescriptor,e=(c,s,p,o)=>{for(var t=o>1?void 0:o?R(s,p):s,i=c.length-1,u;i>=0;i--)(u=c[i])&&(t=(o?u(s,p,t):u(t))||t);return o&&t&&O(s,p,t),t};let r=class extends f{constructor(){super(...arguments),this.current=!1,this.first=!1,this.label="",this.href="",this.crumbRef=y()}updated(){this.current&&this.crumbRef.value?.setAttribute("aria-current","page")}render(){return b`
|
|
2
2
|
${this.breadcrumbSeparator}
|
|
3
|
-
<a ${
|
|
3
|
+
<a ${v(this.crumbRef)} class="${this.breadcrumbClass}" .href="${this.href}">
|
|
4
4
|
${this.label}
|
|
5
5
|
</a>
|
|
6
|
-
`}get breadcrumbClass(){return this.current?"gator-breadcrumb gator-breadcrumb-current":"gator-breadcrumb"}get breadcrumbSeparator(){return this.first?null:b`<span class="gator-breadcrumb-separator">/</span>`}};
|
|
6
|
+
`}get breadcrumbClass(){return this.current?"gator-breadcrumb gator-breadcrumb-current":"gator-breadcrumb"}get breadcrumbSeparator(){return this.first?null:b`<span class="gator-breadcrumb-separator">/</span>`}};r.shadowRootOptions={...f.shadowRootOptions,delegatesFocus:!0};r.styles=[a(l),a(h),a(d),a(g)];e([m({type:Boolean})],r.prototype,"current",2);e([m({type:Boolean})],r.prototype,"first",2);e([m()],r.prototype,"label",2);e([m()],r.prototype,"href",2);r=e([n("ngc-breadcrumb")],r);export{r as NgcBreadcrumb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{property as e}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{TestableLitElement as
|
|
1
|
+
import{property as e}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{TestableLitElement as h}from"../../../utils/components/testable-lit-element/testable-lit-element.js";var y=Object.defineProperty,o=(p,i,s,d)=>{for(var r=void 0,a=p.length-1,n;a>=0;a--)(n=p[a])&&(r=n(i,s,r)||r);return r&&y(i,s,r),r};const l=class l extends h{constructor(){super(),this.form=null,this.id="",this.required=!1,this.disabled=!1,this.readonly=!1,this.label="",this.ariaDescription=null,this.ariaLabelledByElements=void 0,this.placeholder="",this.errorText="",this.helpText="",this.type="text",this.startIcon="",this.endIcon="",this.minLength=void 0,this.maxLength=void 0,this.iconAsLabel=!1,this.skeleton=!1,this.internals=this.attachInternals()}formAssociatedCallback(i){this.form=i}};l.formAssociated=!0;let t=l;o([e()],t.prototype,"id");o([e({type:Boolean})],t.prototype,"required");o([e({type:Boolean})],t.prototype,"disabled");o([e({type:Boolean})],t.prototype,"readonly");o([e()],t.prototype,"label");o([e({attribute:"aria-description"})],t.prototype,"ariaDescription");o([e({type:Array,attribute:"aria-labelled-by-elements"})],t.prototype,"ariaLabelledByElements");o([e()],t.prototype,"placeholder");o([e()],t.prototype,"value");o([e({attribute:"error-text"})],t.prototype,"errorText");o([e({attribute:"help-text"})],t.prototype,"helpText");o([e()],t.prototype,"type");o([e({attribute:"start-icon"})],t.prototype,"startIcon");o([e({attribute:"end-icon"})],t.prototype,"endIcon");o([e({attribute:"min-length"})],t.prototype,"minLength");o([e({attribute:"max-length"})],t.prototype,"maxLength");o([e({type:Boolean,attribute:"icon-as-label"})],t.prototype,"iconAsLabel");o([e({type:Boolean})],t.prototype,"skeleton");export{t as InputBase};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../../icon-button/gator/icon-button.gator.js";import"../../../date-picker/base/gator/datepicker.gator.js";import{customElement as g}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as
|
|
1
|
+
import"../../../icon-button/gator/icon-button.gator.js";import"../../../date-picker/base/gator/datepicker.gator.js";import{customElement as g}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as h}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{state as d}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/state.js";import{NgcInputText as v}from"../input-text/input-text.gator.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as m}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{createRef as c,ref as D}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js";import{autoUpdate as _,computePosition as I}from"../../../../node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.js";import k from"../../../../packages/web-components/src/components/input/gator/input-date/input-date.gator.scss.js";import{NgcErrorEvent as y,NgcErrorReason as b}from"../../../../utils/error-utils.js";import{msg as E}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/install.js";import{localized as R}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-decorator.js";import"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js";import{ifDefined as f}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/if-defined.js";import{unsafeCSS as x}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var S=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=Object.getPrototypeOf,T=Reflect.get,r=(t,e,a,i)=>{for(var n=i>1?void 0:i?$(e,a):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(n=(i?l(e,a,n):l(n))||n);return i&&n&&S(e,a,n),n},L=(t,e,a)=>T(V(t),a,e),N=(t=>(t.INVALID_FORMAT="invalid-format",t.LESS_THAN_MIN_DATE="less-than-min-date",t.GREATER_THAN_MAX_DATE="greater-than-max-date",t.OUTSIDE_RANGE="outside-range",t.INVALID_START_DATE="invalid-start-date",t.INVALID_END_DATE="invalid-end-date",t))(N||{});let s=class extends v{constructor(){super(...arguments),this.locale=navigator.language,this.sundayStart=!1,this.range=!1,this.startDateLabel="Start Date",this.endDateLabel="End Date",this.maskInput=!1,this._value="",this.datepickerRef=c(),this.datepickerTriggerRef=c(),this.startInputRef=c(),this.endInputRef=c(),this.groupRef=c(),this.dateValue=null,this._dateSeparator="/",this._messageInvalidFormat="Invalid date. Please provide a valid date with format {0}.",this._messageLessThanMinDate="Date must be after {0}.",this._messageGreaterThanMaxDate="Date must be before {0}.",this._messageOutsideRange="Date must be between {0} and {1}.",this._messageInvalidStartDate="{0} must come before {1}: {2}.",this._messageInvalidEndDate="{0} must come after {1}: {2}.",this._datePickerVisible=!1,this._startDate=null,this._endDate=null,this._maskPattern="",this._dateString=""}connectedCallback(){super.connectedCallback(),this.endIcon="calendar"}updated(t){if(super.updated(t),t.has("locale")&&((this.locale===void 0||this.locale==="")&&(this.locale=navigator.language),this.setLocaleDateFormat(),this._value=this.value?this.value.toLocaleDateString(this.locale):""),t.has("value"))if(this.value&&this.value instanceof Date&&!isNaN(this.value.getTime())){this.dateValue=this.value;const e=this.value.toLocaleDateString(this.locale);this._dateString=e,this.maskInput&&this.maskDate(e),this.maskInput?this._value=this._maskPattern:this._value=e}else this._dateString="",this._maskPattern="",this.dateValue=null,this._value="";if(t.has("dateValue"))if(this.dateValue&&this.dateValue instanceof Date&&!isNaN(this.dateValue.getTime())){const e=this.dateValue.toLocaleDateString(this.locale);this._dateString=e,this.maskInput&&this.maskDate(e)}else this.dateValue===null&&(this._dateString="",this._maskPattern="");if(t.has("startDate")&&(this.startDate&&this.startDate instanceof Date&&!isNaN(this.startDate.getTime())?(this._startDate=this.startDate,this._startDateInputValue=this.startDate.toLocaleDateString(this.locale)):(this._startDate=null,this._startDateInputValue="")),t.has("endDate")&&(this.endDate&&this.endDate instanceof Date&&!isNaN(this.endDate.getTime())?(this._endDate=this.endDate,this._endDateInputValue=this.endDate.toLocaleDateString(this.locale)):(this._endDate=null,this._endDateInputValue="")),t.has("maskInput")&&this.value&&this.value instanceof Date&&!isNaN(this.value.getTime())){const e=this.value.toLocaleDateString(this.locale);this._dateString=e,this.maskInput?(this.maskDate(e),this._value=this._maskPattern):this._value=e}}render(){return m`
|
|
2
2
|
${this.range?this.rangeMarkup:super.render()}
|
|
3
3
|
${this.datepickerMarkup}
|
|
4
4
|
`}get endIconMarkup(){return this.calendarIconMarkup}get calendarIconMarkup(){return m`
|
|
@@ -8,7 +8,7 @@ import"../../../icon-button/gator/icon-button.gator.js";import"../../../date-pic
|
|
|
8
8
|
?disabled=${this.disabled||this.readonly}
|
|
9
9
|
size="medium"
|
|
10
10
|
icon-name="calendar"
|
|
11
|
-
.ariaLabel="${
|
|
11
|
+
.ariaLabel="${E("Open date picker")}"
|
|
12
12
|
@click=${this.toggleVisibility}
|
|
13
13
|
></ngc-icon-button>
|
|
14
14
|
`}get datepickerMarkup(){return m`
|
|
@@ -29,7 +29,7 @@ import"../../../icon-button/gator/icon-button.gator.js";import"../../../date-pic
|
|
|
29
29
|
@done=${this.closeDatepicker}
|
|
30
30
|
@keydown=${t=>{t.key==="Escape"&&this.closeDatepicker()}}
|
|
31
31
|
></ngc-datepicker>
|
|
32
|
-
`}handleDatepickerFocusOut(t){t.relatedTarget!==this.datepickerTriggerRef.value&&(this._datePickerVisible=!1)}closeDatepicker(){this.datepickerRef.value?.handleClose(),this._datePickerVisible=!1,this.range?this.startInputRef.value?.focus():this.inputRef.value?.focus()}get datepickerSelectedDate(){return this.dateValue instanceof Date&&!isNaN(this.dateValue.getTime())?this.dateValue:null}handleChange(t){t.preventDefault(),t.stopPropagation();const
|
|
32
|
+
`}handleDatepickerFocusOut(t){t.relatedTarget!==this.datepickerTriggerRef.value&&(this._datePickerVisible=!1)}closeDatepicker(){this.datepickerRef.value?.handleClose(),this._datePickerVisible=!1,this.range?this.startInputRef.value?.focus():this.inputRef.value?.focus()}get datepickerSelectedDate(){return this.dateValue instanceof Date&&!isNaN(this.dateValue.getTime())?this.dateValue:null}handleChange(t){t.preventDefault(),t.stopPropagation();const e=t.target;this._value=e.value,this.validateDate((a,i)=>this.setDateValue(a,i),e.value),this.dispatchEvent(new CustomEvent("change",this.dateEventData))}handleInputEvent(t){t.preventDefault(),t.stopPropagation();const e=t.target;this._value=e.value,this.validateDate((a,i)=>this.setDateValue(a,i),e.value),this.dispatchEvent(new CustomEvent("input",this.dateEventData))}handleInputFocusIn(){super.handleInputFocusIn(),this.maskInput&&!this._internalValidationError&&this._maskPattern&&(this._value=this._dateString)}handleInputFocusOut(){super.handleInputFocusOut(),this.maskInput&&!this._internalValidationError&&this._maskPattern&&(this._value=this._maskPattern)}setDateValue(t,e){e?this._internalValidationError=e:this._internalValidationError="",this.dateValue=t}handleDatepickerChange(t){t.detail.date?this._value=new Intl.DateTimeFormat(this.locale).format(t.detail.date):this._value="",this.dateValue=t.detail.date,this._internalValidationError="",this.dispatchEvent(new CustomEvent("change",this.dateEventData))}get dateEventData(){return{bubbles:!0,composed:!0,detail:{value:this._value,valueAsDate:this.dateValue}}}get rangeMarkup(){return requestAnimationFrame(()=>{const t=this.shadowRoot?.querySelector("ngc-input-label"),e=this.shadowRoot?.querySelectorAll("ngc-help-text");t&&this.groupRef.value&&(this.groupRef.value.ariaLabelledByElements=[t]),e&&this.groupRef.value&&(this.groupRef.value.ariaDescribedByElements=Array.from(e))}),m`
|
|
33
33
|
<div ${D(this.groupRef)} role="group">
|
|
34
34
|
${this.labelMarkup}
|
|
35
35
|
<div class="gator-input-date-range">
|
|
@@ -42,8 +42,8 @@ import"../../../icon-button/gator/icon-button.gator.js";import"../../../date-pic
|
|
|
42
42
|
?disabled=${this.disabled}
|
|
43
43
|
?required=${this.required}
|
|
44
44
|
?readonly=${this.readonly}
|
|
45
|
-
@input=${t=>this.handleRangeInputEvent(t,(a
|
|
46
|
-
@change=${t=>this.handleRangeChangeEvent(t,(a
|
|
45
|
+
@input=${t=>this.handleRangeInputEvent(t,(e,a)=>this.setStartDate(e,t.detail.value,a))}
|
|
46
|
+
@change=${t=>this.handleRangeChangeEvent(t,(e,a)=>this.setStartDate(e,t.detail.value,a))}
|
|
47
47
|
>
|
|
48
48
|
${this.calendarIconMarkup}
|
|
49
49
|
</ngc-input-text>
|
|
@@ -56,12 +56,12 @@ import"../../../icon-button/gator/icon-button.gator.js";import"../../../date-pic
|
|
|
56
56
|
?disabled=${this.disabled}
|
|
57
57
|
?required=${this.required}
|
|
58
58
|
?readonly=${this.readonly}
|
|
59
|
-
@input=${t=>this.handleRangeInputEvent(t,(a
|
|
60
|
-
@change=${t=>this.handleRangeChangeEvent(t,(a
|
|
59
|
+
@input=${t=>this.handleRangeInputEvent(t,(e,a)=>this.setEndDate(e,t.detail.value,a))}
|
|
60
|
+
@change=${t=>this.handleRangeChangeEvent(t,(e,a)=>this.setEndDate(e,t.detail.value,a))}
|
|
61
61
|
>
|
|
62
62
|
${this.calendarIconMarkup}
|
|
63
63
|
</ngc-input-text>
|
|
64
64
|
</div>
|
|
65
65
|
${this.bottomText}
|
|
66
66
|
</div>
|
|
67
|
-
`}setStartDate(t,a
|
|
67
|
+
`}setStartDate(t,e,a){this.errorText||(a?this.startInputRef.value.errorText=a:this.startInputRef.value.errorText=""),this._startDate=t,this._startDateInputValue=e}setEndDate(t,e,a){this.errorText||(a?this.endInputRef.value.errorText=a:this.endInputRef.value.errorText=""),this._endDate=t,this._endDateInputValue=e}get datepickerStartDate(){if(this._startDate instanceof Date&&!isNaN(this._startDate.getTime()))return this._startDate}get datepickerEndDate(){if(this._endDate instanceof Date&&!isNaN(this._endDate.getTime()))return this._endDate}handleRangeInputEvent(t,e){t.preventDefault(),t.stopPropagation();const a=t.detail.value;this.validateDate(e,a),this.dispatchEvent(new CustomEvent("input",this.rangeEventData))}handleRangeChangeEvent(t,e){t.preventDefault(),t.stopPropagation();const a=t.detail.value;this.validateDate(e,a),this.dispatchEvent(new CustomEvent("change",this.rangeEventData))}get rangeEventData(){return{bubbles:!0,composed:!0,detail:{startDate:this._startDate,endDate:this._endDate,value:this.dateRangeTextValue}}}get dateRangeTextValue(){const t=this._startDate instanceof Date?this._startDate.toLocaleDateString(this.locale):"",e=this._endDate instanceof Date?this._endDate.toLocaleDateString(this.locale):"";return`${t} - ${e}`}handleDatepickerRangeChange(t){!t.detail.startDate&&!t.detail.endDate&&this.closeDatepicker(),t.detail.startDate!==this._startDate&&(this._startDate=t.detail.startDate,this._startDateInputValue=t.detail.startDate?new Intl.DateTimeFormat(this.locale).format(t.detail.startDate):""),t.detail.endDate!==this.endDate&&(this._endDate=t.detail.endDate,this._endDateInputValue=t.detail.endDate?new Intl.DateTimeFormat(this.locale).format(t.detail.endDate):""),this.errorText||(this.endInputRef.value.errorText="",this.startInputRef.value.errorText=""),this.dispatchEvent(new CustomEvent("change",this.rangeEventData))}validateDate(t,e){let a=this.getDateValueFromLocalizedDateString(e),i=null;typeof a=="number"&&isNaN(a)&&(i=this.handleError("invalid-format")),a&&typeof a=="object"&&(this.minDate&&a<this.minDate&&(i=this.handleError("less-than-min-date")),this.maxDate&&a>this.maxDate&&(i=this.handleError("greater-than-max-date")),this.minDate&&this.maxDate&&(a<this.minDate||a>this.maxDate)&&(i=this.handleError("outside-range")),this.range&&(this._startDate&&a<this._startDate&&(i=this.handleError("invalid-end-date")),this._endDate&&a>this._endDate&&(i=this.handleError("invalid-start-date")))),t(a,i)}setLocaleDateFormat(){const t=new Intl.DateTimeFormat(this.locale).formatToParts(new Date("12/31/1999")),e=t.find(l=>l.type==="literal")?.value,a={day:"dd",month:"mm",year:"yyyy"},i={day:"([1-9]|0[1-9]|[12][0-9]|3[01])",month:"([1-9]|0[1-9]|1[0-2])",year:"\\d{4}"},n=new Map,o=new Map;t.forEach((l,u)=>{a[l.type]&&(n.set(u,a[l.type]),o.set(u,i[l.type]))}),this._dateSeparator=e||"/",this._localizedDateRegex=new RegExp(`^${Array.from(o.values()).join(this._dateSeparator)}$`),this.localizedExpectedDateFormat=Array.from(n.values()).join(this._dateSeparator),this._placeholder=this.localizedExpectedDateFormat}getDateValueFromLocalizedDateString(t){if(!t||t==="")return null;if(!this._localizedDateRegex?.test(t))return NaN;const a=t.split(this._dateSeparator),i=this.localizedExpectedDateFormat?.split(this._dateSeparator)||[],n=i.findIndex(p=>p.toLowerCase().includes("y")),o=i.findIndex(p=>p.toLowerCase().includes("m")),l=i.findIndex(p=>p.toLowerCase().includes("d")),u=new Date(parseInt(a[n]),parseInt(a[o])-1,parseInt(a[l]));return isNaN(u.getTime())?NaN:u}maskDate(t){const e=t.split(this._dateSeparator).map(i=>i.replace(/[^\d]/g,""));if(e.length!==3){this._maskPattern="";return}const a=e.findIndex(i=>i.length===4);a===-1?this._maskPattern=e.map((i,n)=>n<2?"X".repeat(i.length):i).join(this._dateSeparator):this._maskPattern=e.map((i,n)=>n===a?i:"X".repeat(i.length)).join(this._dateSeparator)}toggleVisibility(){this._datePickerVisible=!this._datePickerVisible,this._datePickerVisible&&(this.assignPosition(),this.datepickerRef.value?.shiftFocusToCalendarGrid())}assignPosition(){const t=this.range?this.endInputRef.value?.controlRef.value:this.controlRef.value;!this.datepickerRef||!this.datepickerRef.value||!t||(this._cleanup=_(t,this.datepickerRef.value,async()=>{if(!this.datepickerRef||!this.datepickerRef.value||!t)return;const{x:e,y:a,placement:i}=await I(t,this.datepickerRef.value,{placement:"bottom-end"});let n=i.includes("bottom")?4:-4;Object.assign(this.datepickerRef.value.style,{left:`${e}px`,top:`${a+n}px`})}))}handleError(t){switch(this.dispatchEvent(new y({errorReason:b.VALIDATION,component:{errorReason:t}})),t){case"invalid-format":return this._messageInvalidFormat.replace("{0}",this.localizedExpectedDateFormat);case"less-than-min-date":return this._messageLessThanMinDate.replace("{0}",this.minDate?.toLocaleDateString(this.locale)||"");case"greater-than-max-date":return this._messageGreaterThanMaxDate.replace("{0}",this.maxDate?.toLocaleDateString(this.locale)||"");case"outside-range":return this._messageOutsideRange.replace("{0}",this.minDate?.toLocaleDateString(this.locale)||"").replace("{1}",this.maxDate?.toLocaleDateString(this.locale)||"");case"invalid-start-date":return this._messageInvalidStartDate.replace("{0}",this.startDateLabel||"").replace("{1}",this.endDateLabel||"").replace("{2}",this._endDateInputValue||"");case"invalid-end-date":return this._messageInvalidEndDate.replace("{0}",this.endDateLabel||"").replace("{1}",this.startDateLabel||"").replace("{2}",this._startDateInputValue||"");default:return null}}};s.styles=[...L(s,s,"styles"),x(k)];r([h({type:Date})],s.prototype,"value",2);r([h({type:String,attribute:"locale"})],s.prototype,"locale",2);r([h({type:Date,attribute:"min-date"})],s.prototype,"minDate",2);r([h({type:Date,attribute:"max-date"})],s.prototype,"maxDate",2);r([h({type:Boolean,attribute:"sunday-start"})],s.prototype,"sundayStart",2);r([h({type:Boolean,attribute:"range"})],s.prototype,"range",2);r([h({type:Date,attribute:"start-date"})],s.prototype,"startDate",2);r([h({type:Date,attribute:"end-date"})],s.prototype,"endDate",2);r([h({type:String,attribute:"start-date-label"})],s.prototype,"startDateLabel",2);r([h({type:String,attribute:"end-date-label"})],s.prototype,"endDateLabel",2);r([h({type:Boolean,attribute:"mask-input"})],s.prototype,"maskInput",2);r([d()],s.prototype,"dateValue",2);r([d()],s.prototype,"_datePickerVisible",2);r([d()],s.prototype,"_startDate",2);r([d()],s.prototype,"_endDate",2);r([d()],s.prototype,"_startDateInputValue",2);r([d()],s.prototype,"_endDateInputValue",2);r([d()],s.prototype,"_maskPattern",2);r([d()],s.prototype,"_dateString",2);s=r([g("ngc-input-date"),R()],s);export{N as DateValidationError,s as NgcInputDate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{customElement as c}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as
|
|
1
|
+
import{customElement as c}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as u}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{state as p}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/state.js";import{NgcInputText as v}from"../input-text/input-text.gator.js";import{KEY_CONSTANTS as h}from"../../../../consts/key-constants.js";var m=Object.defineProperty,_=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,f=Reflect.get,l=(t,e,s,a)=>{for(var r=a>1?void 0:a?_(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(a?o(e,s,r):o(r))||r);return a&&r&&m(e,s,r),r},g=(t,e,s)=>f(d(t),s,e);let i=class extends v{constructor(){super(...arguments),this.maskPreset=null,this.maskPattern="",this.acceptedCharType="numeric",this.variableMaxLength=10,this.value="",this._value="",this._inputFocused=!1,this._cursorPosition=null}updated(t){super.updated(t),t.has("value")&&(this._value=this.formatValue(this.value),this.inputRef.value?.setSelectionRange(this._cursorPosition,this._cursorPosition)),t.has("errorText")&&!this.errorText&&this.validateChars(this.value),t.get("_cursorPosition")&&this.inputRef.value?.setSelectionRange(this._cursorPosition,this._cursorPosition),t.has("maskPreset")&&(this._placeholder=this.placeholder?this.placeholder:this._maskPattern.split("").map((e,s)=>e==="#"?((s+1)%10).toString():e).join(""),this.maskPreset==="variable"?this._maxLength=this.variableMaxLength:this._maxLength=this._maskPattern.length,this._value=this.formatValue(this.value))}handleInputEvent(t){t.preventDefault(),t.stopPropagation();const e=t.target,s=e.selectionStart??0,a=this.formatValue(e.value),r=this._value.length<e.value.length,n=!!this.displayedErrorText,o=new CustomEvent("input",{bubbles:!0,composed:!0,detail:{formatted:a,raw:n?a:a.replaceAll("-","")}});r&&e.value[s]!=="-"&&a[s-1]==="-"?this._cursorPosition=s+1:this._cursorPosition=s,this._value=a,this.dispatchEvent(o)}handleKeyup(t){if(t.key===h.LEFT||t.key===h.RIGHT){const e=t.target;this._cursorPosition=e.selectionStart??0}}handleClick(t){const e=t.target;this._cursorPosition=e.selectionStart??0}handleInputFocusIn(){super.handleInputFocusIn(),this._inputFocused=!0,this._value=this.formatValue(this.value)}handleInputFocusOut(){super.handleInputFocusOut(),this._inputFocused=!1,this._value=this.formatValue(this._value)}get _maskPattern(){switch(this.maskPreset){case"ssn":return"XXX-XX-####";case"ein":return"XX-XXX####";case"variable":return this.variableMaskPattern();default:return this.maskPattern}}variableMaskPattern(){const t=this._value.length+1;return t<=5?"#".repeat(t):"X".repeat(t-5)+"#".repeat(5)}validateChars(t){const e={numeric:{regex:/^[0-9]*$/,errText:"numbers"},alpha:{regex:/^[a-zA-Z]*$/,errText:"letters"},alphanumeric:{regex:/^[a-zA-Z0-9]*$/,errText:"letters, numbers,"}};return e[this.acceptedCharType].regex.test(t.replaceAll("-",""))?(this._internalValidationError="",!0):(this._internalValidationError=`Invalid input. Use only ${e[this.acceptedCharType].errText} and dashes in this field.`,!1)}formatValue(t){if(!this.validateChars(t))return t;const e=t.replaceAll(/[^a-zA-Z0-9]/g,"").substring(0,this._maskPattern.length);let s="",a=0;for(let r=0;r<this._maskPattern.length&&a!==e.length;++r){const n=e[a],o=this._maskPattern[r];switch(o){case"X":{this._inputFocused?s+=n:s+="X",a++;break}case"#":{s+=n,a++;break}default:s+=o}}return s}};i.styles=[...g(i,i,"styles")];l([u({attribute:"mask-preset"})],i.prototype,"maskPreset",2);l([u({attribute:"mask-pattern"})],i.prototype,"maskPattern",2);l([u({attribute:"accepted-char-type"})],i.prototype,"acceptedCharType",2);l([u({attribute:"variable-max-length"})],i.prototype,"variableMaxLength",2);l([p()],i.prototype,"_inputFocused",2);l([p()],i.prototype,"_cursorPosition",2);i=l([c("ngc-input-masked")],i);export{i as NgcInputMasked};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as o}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import"../input-label/input-label.gator.js";import"../help-text/help-text.gator.js";import{customElement as f}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as
|
|
1
|
+
import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as o}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import"../input-label/input-label.gator.js";import"../help-text/help-text.gator.js";import{customElement as f}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as u}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{state as a}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/state.js";import{createRef as v,ref as c}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js";import{NgcInputBase as m}from"../../base/input-base.gator.js";import{ifDefined as h}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/if-defined.js";import{live as y}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/live.js";import{classMap as _}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/class-map.js";import{msg as g}from"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/install.js";import"../../../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js";var $=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(t,e,r,l)=>{for(var n=l>1?void 0:l?b(e,r):e,d=t.length-1,p;d>=0;d--)(p=t[d])&&(n=(l?p(e,r,n):p(n))||n);return l&&n&&$(e,r,n),n};let i=class extends m{constructor(){super(...arguments),this.inputRef=v(),this.controlRef=v(),this.for="",this._inputMode="text",this._showErrors=!1,this._onInvalid=t=>{this._showErrors=!0,this.requestUpdate()}}render(){return o`
|
|
2
2
|
<div class="gator-form-element">
|
|
3
3
|
<slot name="label">
|
|
4
4
|
${this.label&&!this.iconAsLabel?this.labelMarkup:null}
|
|
@@ -13,7 +13,7 @@ import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@
|
|
|
13
13
|
${c(this.inputRef)}
|
|
14
14
|
type="${this.type}"
|
|
15
15
|
id="${this.id}-input"
|
|
16
|
-
data-testid=${
|
|
16
|
+
data-testid=${h(this.dataTestid)}-input
|
|
17
17
|
.placeholder="${y(this._placeholder)}"
|
|
18
18
|
.required="${this.required}"
|
|
19
19
|
.disabled="${this.disabled}"
|
|
@@ -24,12 +24,13 @@ import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@
|
|
|
24
24
|
aria-labelledby="${this.ariaLabelledbyValue}"
|
|
25
25
|
aria-describedby="${this.ariaDescribedby}"
|
|
26
26
|
.value="${y(this._value)}"
|
|
27
|
-
|
|
27
|
+
minlength="${h(this.minLength)}"
|
|
28
|
+
maxlength="${h(this._maxLength)}"
|
|
28
29
|
.min="${this.min}"
|
|
29
30
|
.max="${this.max}"
|
|
30
|
-
.step="${
|
|
31
|
+
.step="${h(this.step)}"
|
|
31
32
|
inputmode="${this._inputMode}"
|
|
32
|
-
.pattern="${
|
|
33
|
+
.pattern="${h(this.pattern)}"
|
|
33
34
|
@input="${this.handleInputEvent}"
|
|
34
35
|
@change="${this.handleChange}"
|
|
35
36
|
@click="${this.handleClick}"
|
|
@@ -52,7 +53,7 @@ import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@
|
|
|
52
53
|
|
|
53
54
|
${this.bottomText}
|
|
54
55
|
</div>
|
|
55
|
-
`}updateRequiredValidity(){const t=this.inputRef.value;this.required&&(!t?.value||t.value==="")?(this._nativeInputError=t?.validationMessage
|
|
56
|
+
`}updateRequiredValidity(){const t=this.inputRef.value;this.required&&(!t?.value||t.value==="")?(this._nativeInputError=t?.validationMessage||g("This field is required"),this.internals.setValidity({valueMissing:!0},this._nativeInputError,t??void 0)):(this._nativeInputError="",this.internals.setValidity({}))}updated(t){t.has("disabled")&&(this.disabled?this.internals.states.add("disabled"):this.internals.states.delete("disabled")),t.has("readonly")&&(this.readonly?this.internals.states.add("readonly"):this.internals.states.delete("readonly")),t.has("value")&&(this._value=this.value),t.has("placeholder")&&(this._placeholder=this.placeholder),t.has("ariaLabelledByElements")&&this.ariaLabelledByElements&&(this.inputRef.value.ariaLabelledByElements=this.ariaLabelledByElements),(t.has("required")||t.has("value"))&&this.updateRequiredValidity()}get displayedErrorText(){if(!(!this._showErrors&&!this.errorText))return this.errorText||this._internalValidationError||this._nativeInputError}get isAriaInvalid(){return this.displayedErrorText?"true":"false"}get passwordVisibilityMarkup(){return this.endIconMarkup||this.type!=="password"?null:o`
|
|
56
57
|
<ngc-icon name="eye-crossed" @click="${this.togglePasswordVisibility}"></ngc-icon>`}connectedCallback(){super.connectedCallback(),this._value=this.value,this._maxLength=this.maxLength,this._placeholder=this.placeholder,this.updateRequiredValidity(),this.addEventListener("invalid",this._onInvalid,!0)}handleNativeInputValidation(t){t.preventDefault(),t.stopPropagation();const e=this.inputRef.value;if(!e)return;this._showErrors=!0;const r=e.validity,l=e.validationMessage;r.valid?this._nativeInputError="":this._nativeInputError=l}handleWheel(){if(this.type=="number"){this.inputRef.value?.blur();return}}handleInputEvent(t){t.preventDefault(),t.stopPropagation();const e=t.target;this.internals.setFormValue(e.value),this._value=e.value,this._showErrors=!0,this.syncValidity(),this.updateRequiredValidity();const r=new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e.value}});this.dispatchEvent(r)}handleChange(t){t.preventDefault(),t.stopPropagation();const e=t.target;this._showErrors=!0;const r=new CustomEvent("change",{composed:!0,bubbles:!0,detail:{value:e.value}});this._value=e.value,this.dispatchEvent(r)}togglePasswordVisibility(){const t=this.inputRef.value;t&&(t.type=t.type==="password"?"text":"password")}syncValidity(){const t=this.inputRef.value;if(!t)return;if(t.checkValidity())this._nativeInputError="",this.internals.setValidity({});else{const r=t.validationMessage;this._nativeInputError=r,this.internals.setValidity({customError:!0},r,t)}}handleInputFocusOut(){super.handleInputFocusOut(),this.inputRef.value?.checkValidity()&&!this.readonly&&(this._nativeInputError=""),this._showErrors=!0,this.syncValidity()}get errorTextMarkup(){return this.displayedErrorText?o`
|
|
57
58
|
<ngc-help-text
|
|
58
59
|
icon
|
|
@@ -62,4 +63,4 @@ import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@
|
|
|
62
63
|
>
|
|
63
64
|
${this.displayedErrorText}
|
|
64
65
|
</ngc-help-text>
|
|
65
|
-
`:null}};i.shadowRootOptions={...m.shadowRootOptions,delegatesFocus:!0};s([
|
|
66
|
+
`:null}};i.shadowRootOptions={...m.shadowRootOptions,delegatesFocus:!0};s([u()],i.prototype,"for",2);s([u({type:Number})],i.prototype,"min",2);s([u({type:Number})],i.prototype,"max",2);s([u({type:Number})],i.prototype,"step",2);s([u({type:String})],i.prototype,"pattern",2);s([a()],i.prototype,"_value",2);s([a()],i.prototype,"_inputMode",2);s([a()],i.prototype,"_placeholder",2);s([a()],i.prototype,"_minLength",2);s([a()],i.prototype,"_maxLength",2);s([a()],i.prototype,"_errorText",2);s([a()],i.prototype,"_internalValidationError",2);s([a()],i.prototype,"_nativeInputError",2);s([a()],i.prototype,"_showErrors",2);i=s([f("ngc-input-text")],i);export{i as NgcInputText};
|