@ncino/web-components 2.0.0 → 2.1.0-preview.1
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/button/gator/button.gator.js +1 -1
- package/dist/components/date-picker/base/datepicker.js +1 -1
- package/dist/components/date-picker/base/gator/datepicker.gator.js +84 -63
- package/dist/components/date-picker/year-month-selector/year-month-selector.gator.js +2 -2
- package/dist/components/input/base/input-base.gator.js +4 -3
- package/dist/components/input/gator/input-masked/input-masked.gator.js +1 -1
- package/dist/components/input/gator/input-text/input-text.gator.js +13 -11
- package/dist/types/components/date-picker/base/datepicker.d.ts +1 -0
- package/dist/types/components/date-picker/base/gator/datepicker.gator.d.ts +18 -3
- package/dist/types/components/input/gator/input-masked/input-masked.gator.d.ts +0 -1
- package/dist/types/components/input/gator/input-text/input-text.gator.d.ts +1 -0
- package/package.json +1 -1
- package/web-types.json +21 -2
|
@@ -22,4 +22,4 @@ import{N as b}from"../button.js";import{a as s,x as d,E as c}from"../../../asset
|
|
|
22
22
|
<div class="gator-button-loader">
|
|
23
23
|
<ngc-loading-spinner .size="${o}"></ngc-loading-spinner>
|
|
24
24
|
</div>
|
|
25
|
-
`}handleClick(o){o.preventDefault(),o.stopPropagation(),!(this.disabled||this.loading||this.skeleton)&&this.dispatchEvent(new CustomEvent("click",{bubbles:!0,composed:!0}))}};n.styles=[s(p),s(g),s(v)];n.shadowRootOptions={...b.shadowRootOptions,delegatesFocus:!0};n=f([u("ngc-button")],n);
|
|
25
|
+
`}handleClick(o){o.preventDefault(),o.stopPropagation(),!(this.disabled||this.loading||this.skeleton)&&this.dispatchEvent(new CustomEvent("click",{bubbles:!0,composed:!0}))}};n.styles=[s(p),s(g),s(v)];n.shadowRootOptions={...b.shadowRootOptions,delegatesFocus:!0};n=f([u("ngc-button")],n);export{p as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as r}from"../../../assets/index-chunk.js";import{r as l}from"../../../assets/index-chunk4.js";import{T as
|
|
1
|
+
import{n as r}from"../../../assets/index-chunk.js";import{r as l}from"../../../assets/index-chunk4.js";import{T as u}from"../../../utils/components/testable-lit-element/testable-lit-element.js";import"../../../assets/index-chunk2.js";var _=Object.defineProperty,a=(c,t,n,i)=>{for(var e=void 0,h=c.length-1,D;h>=0;h--)(D=c[h])&&(e=D(t,n,e)||e);return e&&_(t,n,e),e};class s extends u{constructor(){super(),this._todaysDate=new Date,this._defaultMin=new Date(this._todaysDate.getFullYear()-150,0,1),this._defaultMax=new Date(this._todaysDate.getFullYear()+101,11,31),this.range=!1,this.startDate=null,this.endDate=null,this.selectedDate=null,this.min=this._defaultMin,this.max=this._defaultMax,this.sundayStart=!1,this.previousMonthAriaLabel="Previous Month",this.nextMonthAriaLabel="Next Month",this.clearButtonLabel="Clear",this.todayButtonLabel="Today",this._selectedDate=null,this._startDate=null,this._endDate=null,this._localizedDaysOfWeek=this.getLocalizedDaysOfWeek(),this._localizedMonths=this.getLocalizedMonths(),this._years=void 0,this._todaysDate.setHours(0,0,0,0),this._contextDate=new Date(this._todaysDate),this._contextMonth=this._contextDate.getMonth(),this._contextYear=this._contextDate.getFullYear(),this._contextDays=this.getDatesForMonth(),this._years=this.getYears()}updated(t){t.has("_contextDate")&&(this._contextDate.getMonth()!==this._contextMonth&&(this._contextMonth=this._contextDate.getMonth(),this._contextDays=this.getDatesForMonth()),this._contextDate.getFullYear()!==this._contextYear&&(this._contextYear=this._contextDate.getFullYear(),this._contextDays=this.getDatesForMonth())),t.has("selectedDate")&&this.setSelectedDate(this.selectedDate),t.has("startDate")&&this.setRangeStart(this.startDate),t.has("endDate")&&this.setRangeEnd(this.endDate),(t.has("min")||t.has("max"))&&(this.min===void 0&&(this.min=this._defaultMin),this.max===void 0&&(this.max=this._defaultMax),this._years=this.getYears(),this.requestUpdate()),t.has("sundayStart")&&(this._localizedDaysOfWeek=this.getLocalizedDaysOfWeek(),this._contextDays=this.getDatesForMonth(),this.requestUpdate())}connectedCallback(){super.connectedCallback(),this.selectedDate&&(this._selectedDate=new Date(this.selectedDate),this._contextDate=this._selectedDate),this.startDate&&this.endDate&&(this._startDate=new Date(this.startDate),this._endDate=new Date(this.endDate),this._contextDate=this._startDate),this._years=this.getYears()}get currentMonthName(){return new Intl.DateTimeFormat(navigator.language,{month:"long"}).format(this._contextDate)}getLocalizedDaysOfWeek(){const t=[],n=new Intl.DateTimeFormat(navigator.language,{weekday:"narrow"}),i=this.sundayStart?5:6,e=new Date(2025,0,i);for(let h=0;h<7;h++){const D=new Date(e);D.setDate(e.getDate()+h),t.push(n.format(D))}return t}getLocalizedMonths(){const t=[],n=new Intl.DateTimeFormat(navigator.language,{month:"short"});for(let i=0;i<12;i++){const e=new Date(this._todaysDate.getFullYear(),i,1);t.push({dataValue:i,selectorText:n.format(e).toLocaleUpperCase()})}return t}getYears(){const t=[],n=new Date(this.min).getFullYear(),i=new Date(this.max).getFullYear();for(let e=n;e<=i;e++)t.push({dataValue:e,selectorText:e.toString()});return t}getDatesForMonth(){const t=[],n=new Date(this._contextYear,this._contextMonth,1),i=new Date(this._contextYear,this._contextMonth+1,0);let e=n.getDay();this.sundayStart||(e=e===0?6:e-1);for(let o=e;o>0;o--)t.push({date:new Date(this._contextYear,this._contextMonth,1-o),isCurrentMonth:!1});for(let o=1;o<=i.getDate();o++)t.push({date:new Date(this._contextYear,this._contextMonth,o),isCurrentMonth:!0});const d=6*7-t.length;for(let o=1;o<=d;o++)t.push({date:new Date(this._contextYear,this._contextMonth+1,o),isCurrentMonth:!1});return t}isSameDate(t,n){return!t||!n?!1:t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}isDateInRange(t){return!this._startDate||!this._endDate?!1:t>=this._startDate&&t<=this._endDate}isTodayDisabled(){return this._todaysDate<this.min||this._todaysDate>this.max}isDateOutsideMinMax(t){return t<this.min||t>this.max}setSelectedDate(t){t?(this._selectedDate=new Date(t),this._contextDate=this._selectedDate):this._selectedDate=null}setRangeStart(t){t?(this._startDate=new Date(t),this._contextDate=this._startDate):this._startDate=null}setRangeEnd(t){t?(this._endDate=new Date(t),this._contextDate=this._endDate):this._endDate=null}clearSelection(){this.range?(this._startDate=null,this._endDate=null):this._selectedDate=null}}a([l()],s.prototype,"_todaysDate");a([r({type:Boolean})],s.prototype,"range");a([r({type:Date,attribute:"start-date"})],s.prototype,"startDate");a([r({type:Date,attribute:"start-date"})],s.prototype,"endDate");a([r({type:Date,attribute:"selected-date"})],s.prototype,"selectedDate");a([r({type:Date})],s.prototype,"min");a([r({type:Date})],s.prototype,"max");a([r({type:Boolean,attribute:"sunday-start"})],s.prototype,"sundayStart");a([r({type:String,attribute:"previous-month-aria-label"})],s.prototype,"previousMonthAriaLabel");a([r({type:String,attribute:"next-month-aria-label"})],s.prototype,"nextMonthAriaLabel");a([r({type:String,attribute:"clear-button-label"})],s.prototype,"clearButtonLabel");a([r({type:String,attribute:"today-button-label"})],s.prototype,"todayButtonLabel");a([l()],s.prototype,"_selectedDate");a([l()],s.prototype,"_startDate");a([l()],s.prototype,"_endDate");a([l()],s.prototype,"_contextDate");a([l()],s.prototype,"_contextMonth");a([l()],s.prototype,"_contextYear");a([l()],s.prototype,"_contextDays");export{s as N};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import{r as u,a as d,x as s}from"../../../../assets/index-chunk2.js";import{p as b}from"../../../../assets/index-chunk5.js";import{s as y}from"../../../../assets/index-chunk6.js";import{b as f}from"../../../button/gator/button.gator.js";import{t as x}from"../../../../assets/index-chunk3.js";import{n as g}from"../../../../assets/index-chunk.js";import{r as w}from"../../../../assets/index-chunk4.js";import"../../../icon-button/gator/icon-button.gator.js";import"../../../selector/gator/selector.gator.js";import{S as p}from"../../year-month-selector/year-month-selector.gator.js";import{N as D}from"../datepicker.js";import{K as n}from"../../../../consts/key-constants.js";import"../../../button/button.js";import"../../../../utils/components/testable-lit-element/testable-lit-element.js";import"../../../../utils/mixins/attribute-deletion.js";import"../../../loading-spinner/gator/loading-spinner.gator.js";import"../../../loading-spinner/loading-spinner.js";import"../../../../assets/index-chunk7.js";import"../../../button/slds/button.slds.js";import"../../../../assets/index-chunk10.js";import"../../../icon/slds/icon.slds.js";import"../../../icon/icon.js";import"../../../icon/gator/icon.gator.js";import"../../../icon/gator/templates/arrow-left.js";import"../../../icon/icon-registry.js";import"../../../icon/gator/templates/arrow-right.js";import"../../../icon/gator/templates/check-circle.js";import"../../../icon/gator/templates/check.js";import"../../../icon/gator/templates/checkbox.js";import"../../../icon/gator/templates/checkbox-selected.js";import"../../../icon/gator/templates/chevron-down.js";import"../../../icon/gator/templates/chevron-left.js";import"../../../icon/gator/templates/chevron-right.js";import"../../../icon/gator/templates/chevron-up.js";import"../../../icon/gator/templates/dashboard.js";import"../../../icon/gator/templates/exit.js";import"../../../icon/gator/templates/exit-circle.js";import"../../../icon/gator/templates/eye-crossed.js";import"../../../icon/gator/templates/info.js";import"../../../icon/gator/templates/link.js";import"../../../icon/gator/templates/overflow-menu.js";import"../../../icon/gator/templates/percent.js";import"../../../icon/gator/templates/picture.js";import"../../../icon/gator/templates/shield-lock.js";import"../../../icon/gator/templates/radio.js";import"../../../icon/gator/templates/radio-selected.js";import"../../../icon/gator/templates/restricted.js";import"../../../icon/gator/templates/settings.js";import"../../../icon/gator/templates/warning.js";import"../../../skeleton-loader/gator/skeleton-loader.gator.js";import"../../../../assets/index-chunk8.js";import"../../../../assets/index-chunk9.js";import"../../../icon-button/icon-button.js";const k='.gator-datepicker{display:flex;width:20.75rem;padding:var(--spacing-gap-24, 1.5rem) 0rem var(--spacing-gap-16, 1rem) 0rem;flex-direction:column;align-items:flex-start;gap:var(--spacing-6, 1.5rem);border-radius:var(--radius-card-medium, .5rem);background:var(--color-surface-primary-white, #FFF);box-shadow:var(--shadow-x-offset-0, 0px) var(--shadow-shadow-3-dropdown-property-1-y-offset, 7px) var(--shadow-shadow-3-dropdown-property-1-blur, 12px) var(--shadow-shadow-3-dropdown-property-1-spread, 0px) var(--shadow-color-10, rgba(31, 31, 31, .1)),var(--shadow-x-offset-0, 0px) var(--shadow-shadow-3-dropdown-property-2-y-offset, 8px) var(--shadow-shadow-3-dropdown-property-2-blur, 16px) var(--shadow-shadow-3-dropdown-property-2-spread, 0px) var(--shadow-color-8, rgba(31, 31, 31, .08)),var(--shadow-x-offset-0, 0px) var(--shadow-shadow-3-dropdown-property-3-y-offset, 9px) var(--shadow-shadow-3-dropdown-property-3-blur, 18px) var(--shadow-shadow-3-dropdown-property-3-spread, 0px) var(--shadow-color-8, rgba(31, 31, 31, .08))}.gator-datepicker-header{display:flex;padding:0rem var(--spacing-gap-16, 1rem);align-items:center;gap:var(--spacing-gap-32, 2rem);align-self:stretch}.gator-datepicker-header .gator-datepicker-header-title{display:flex;justify-content:space-between;align-items:center;flex:1 0 0;align-self:stretch}.gator-datepicker-header .button-group{display:flex;align-items:center;gap:var(--spacing-gap-16, 1rem)}.gator-datepicker-table{display:flex;padding:0rem var(--spacing-gap-16, 1rem);flex-direction:column;align-items:flex-start;gap:var(--spacing-4, 1rem);align-self:stretch}.gator-datepicker-table-header{display:flex;height:2rem;flex-direction:column;justify-content:center;align-items:flex-start;align-self:stretch}.gator-datepicker-table-header tr{display:flex;flex:1;align-items:flex-start;align-self:stretch}.gator-datepicker-table-header div[role=columnheader]{flex:1 1 0;align-self:stretch;color:var(--text-color-primary-base, #1F1F1F);text-align:center;font-feature-settings:"liga" off,"clig" off;font-family:var(--text-family-body, "Open Sans");font-size:var(--text-size-subtitle-2, .9375rem);font-style:normal;font-weight:700;line-height:var(--text-line-height-subtitle-2, 1.375rem);letter-spacing:var(--text-letter-spacing-default, 0rem)}.gator-datepicker-table-body{display:flex;flex-direction:column;align-items:flex-start;width:100%}.gator-datepicker-table-body.gator-datepicker-table-body-dates{gap:var(--spacing-4, 1rem)}.gator-datepicker-table-body.gator-datepicker-table-body-year-month{gap:var(--spacing-gap-12, .75rem);max-height:260px;overflow-y:scroll}.gator-datepicker-table-body tr{display:flex;flex-direction:row;align-items:flex-start;align-self:stretch;justify-content:space-between}.gator-datepicker-table-body tr td{display:flex;flex:1;justify-content:center;align-items:center;padding:0}.gator-datepicker-year-month-selectors{display:flex;flex-direction:column;justify-content:space-between;align-items:center;align-self:stretch;gap:var(--spacing-6, 1.5rem)}.gator-datepicker-footer{display:flex;padding:0rem var(--spacing-gap-16, 1rem);justify-content:space-between;align-items:center;align-self:stretch}';var _=Object.defineProperty,S=Object.getOwnPropertyDescriptor,c=(e,t,r,a)=>{for(var o=a>1?void 0:a?S(t,r):t,i=e.length-1,h;i>=0;i--)(h=e[i])&&(o=(a?h(t,r,o):h(o))||o);return a&&o&&_(t,r,o),o};let l=class extends D{constructor(){super(...arguments),this.monthComboboxAriaLabel="Current Month",this.yearComboboxAriaLabel="Current Year",this.monthDialogAriaLabel="Month Selection",this.yearDialogAriaLabel="Year Selection",this._currentView="calendar"}render(){return s`
|
|
2
2
|
<div class="gator-datepicker"
|
|
3
3
|
role="dialog"
|
|
4
4
|
aria-modal="true"
|
|
5
5
|
aria-label=${`${this.currentMonthName} ${this._contextYear}`}
|
|
6
6
|
lang=${navigator.language}>
|
|
7
7
|
${this.headerMarkup}
|
|
8
|
-
${this.
|
|
9
|
-
${this.footerMarkup}
|
|
8
|
+
${this.currentViewMarkup}
|
|
10
9
|
</div>
|
|
11
|
-
`}get headerMarkup(){return
|
|
10
|
+
`}get headerMarkup(){return s`
|
|
12
11
|
<div class="gator-datepicker-header">
|
|
13
12
|
<div class="gator-datepicker-header-title">
|
|
14
13
|
<ngc-icon-button
|
|
@@ -18,18 +17,32 @@ import{r as g,a as h,x as o}from"../../../../assets/index-chunk2.js";import{p as
|
|
|
18
17
|
@click=${this.handlePreviousMonthClicked}>
|
|
19
18
|
</ngc-icon-button>
|
|
20
19
|
<div class="button-group" aria-live="polite">
|
|
21
|
-
<
|
|
22
|
-
|
|
20
|
+
<button
|
|
21
|
+
role="combobox"
|
|
22
|
+
id="month-combobox"
|
|
23
|
+
aria-label=${this.monthComboboxAriaLabel}
|
|
24
|
+
aria-haspopup="dialog"
|
|
25
|
+
aria-expanded=${this._currentView==="months"}
|
|
26
|
+
aria-autocomplete="none"
|
|
27
|
+
aria-controls="month-selectors"
|
|
28
|
+
class='gator-button gator-button_base gator-button_medium'
|
|
23
29
|
@click=${this.handleMonthClick}
|
|
24
|
-
@keydown=${this.
|
|
25
|
-
|
|
26
|
-
</
|
|
27
|
-
<
|
|
28
|
-
|
|
30
|
+
@keydown=${this.handleYearMonthComboboxKeydown}>
|
|
31
|
+
<span class="gator-button-text">${this.currentMonthName}</span>
|
|
32
|
+
</button>
|
|
33
|
+
<button
|
|
34
|
+
role="combobox"
|
|
35
|
+
id="year-combobox"
|
|
36
|
+
aria-label=${this.yearComboboxAriaLabel}
|
|
37
|
+
aria-haspopup="dialog"
|
|
38
|
+
aria-expanded=${this._currentView==="years"}
|
|
39
|
+
aria-autocomplete="none"
|
|
40
|
+
aria-controls="year-selectors"
|
|
41
|
+
class='gator-button gator-button_base gator-button_medium'
|
|
29
42
|
@click=${this.handleYearClick}
|
|
30
|
-
@keydown=${this.
|
|
31
|
-
|
|
32
|
-
</
|
|
43
|
+
@keydown=${this.handleYearMonthComboboxKeydown}>
|
|
44
|
+
<span class="gator-button-text">${this._contextYear}</span>
|
|
45
|
+
</button>
|
|
33
46
|
</div>
|
|
34
47
|
<ngc-icon-button
|
|
35
48
|
size="small"
|
|
@@ -39,67 +52,75 @@ import{r as g,a as h,x as o}from"../../../../assets/index-chunk2.js";import{p as
|
|
|
39
52
|
</ngc-icon-button>
|
|
40
53
|
</div>
|
|
41
54
|
</div>
|
|
42
|
-
`}handlePreviousMonthClicked(){this._contextDate=new Date(this._contextYear,this._contextMonth-1,1),this._currentView="calendar"}handleMonthClick(){this._currentView==="months"?this._currentView="calendar":this._currentView="months"}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
${this._localizedDaysOfWeek.map(e=>o`
|
|
55
|
+
`}handlePreviousMonthClicked(){this._contextDate=new Date(this._contextYear,this._contextMonth-1,1),this._currentView="calendar"}handleMonthClick(){this._currentView==="months"?this._currentView="calendar":this._currentView="months"}handleYearClick(){this._currentView==="years"?this._currentView="calendar":(this._currentView="years",this.scrollToSelectedYear())}handleNextMonthClicked(){this._contextDate=new Date(this._contextYear,this._contextMonth+1,1),this._currentView="calendar"}handleYearMonthComboboxKeydown(e){if(e.key===n.TAB&&!e.shiftKey&&this._currentView!=="calendar"){e.preventDefault();const r=this.renderRoot.querySelector('ngc-year-month-selector[tabindex="0"]');r==null||r.focus()}}get currentViewMarkup(){switch(this._currentView){case"calendar":return this.calendarMarkup;case"months":return this.getYearOrMonthSelectorGrid(p.MONTH);case"years":return this.getYearOrMonthSelectorGrid(p.YEAR);default:return null}}get calendarMarkup(){return s`
|
|
56
|
+
<table class="gator-datepicker-table" role="grid">
|
|
57
|
+
<thead role="rowgroup" class="gator-datepicker-table-header">
|
|
58
|
+
<tr role="row">
|
|
59
|
+
${this.daysOfWeekMarkup}
|
|
60
|
+
</tr>
|
|
61
|
+
</thead>
|
|
62
|
+
<tbody role="rowgroup"
|
|
63
|
+
class="gator-datepicker-table-body gator-datepicker-table-body-dates">
|
|
64
|
+
${this.getDatesMarkup}
|
|
65
|
+
</tbody>
|
|
66
|
+
</table>
|
|
67
|
+
${this.footerMarkup}
|
|
68
|
+
`}get daysOfWeekMarkup(){return s`
|
|
69
|
+
${this._localizedDaysOfWeek.map(e=>s`
|
|
58
70
|
<div role="columnheader">
|
|
59
71
|
${e}
|
|
60
72
|
</div>`)}
|
|
61
|
-
`}get getDatesMarkup(){const e=this._contextDays,t=[];for(let
|
|
62
|
-
${t.map(
|
|
73
|
+
`}get getDatesMarkup(){const e=this._contextDays,t=[];for(let r=0;r<e.length;r+=7)t.push(e.slice(r,r+7));return s`
|
|
74
|
+
${t.map(r=>s`
|
|
63
75
|
<tr role="row">
|
|
64
|
-
${
|
|
76
|
+
${r.map(({date:a})=>s`
|
|
65
77
|
<ngc-selector
|
|
66
|
-
?current=${this.isSameDate(
|
|
67
|
-
?selected=${this.setSelectorSelected(
|
|
68
|
-
?disabled=${this.isDateOutsideMinMax(
|
|
69
|
-
type=${this.setSelectorType(
|
|
70
|
-
tabindex='${this.isSameDate(
|
|
78
|
+
?current=${this.isSameDate(a,this._todaysDate)}
|
|
79
|
+
?selected=${this.setSelectorSelected(a)}
|
|
80
|
+
?disabled=${this.isDateOutsideMinMax(a)}
|
|
81
|
+
type=${this.setSelectorType(a)}
|
|
82
|
+
tabindex='${this.isSameDate(a,this._contextDate)?0:-1}'
|
|
71
83
|
@keydown=${this.handleDateKeydown}
|
|
72
|
-
@selectorclick=${
|
|
73
|
-
data-value=${
|
|
84
|
+
@selectorclick=${o=>this.handleDateClick(o,a)}
|
|
85
|
+
data-value=${a.getDate()}
|
|
74
86
|
>
|
|
75
|
-
${
|
|
87
|
+
${a.getDate()}
|
|
76
88
|
</ngc-selector>
|
|
77
89
|
`)}
|
|
78
90
|
</tr>
|
|
79
91
|
`)}
|
|
80
92
|
</div>
|
|
81
|
-
`}handleDateKeydown(e){switch(e.key){case"ArrowUp":e.preventDefault(),this.setNewContextDateAndShiftFocus(-7);break;case"ArrowDown":e.preventDefault(),this.setNewContextDateAndShiftFocus(7);break;case"ArrowLeft":e.preventDefault(),this.setNewContextDateAndShiftFocus(-1);break;case"ArrowRight":e.preventDefault(),this.setNewContextDateAndShiftFocus(1);break}}handleDateClick(e,t){this.range?this.handleRangeSelection(t):e.target.selected?this.clearSelection():this.setSelectedDate(t)}handleRangeSelection(e){this._startDate?this._startDate&&!this._endDate?e<this._startDate?this.setRangeStart(e):this.setRangeEnd(e):this._startDate&&this._endDate&&(e<this._startDate?this.setRangeStart(e):e>this._endDate?this.setRangeEnd(e):(this.clearSelection(),this.setRangeStart(e))):this.setRangeStart(e)}setSelectorType(e){if(this.range){if(this._startDate&&this._endDate&&this.isSameDate(this._startDate,this._endDate))return"base";if(this.isSameDate(e,this._startDate))return"range-start";if(this.isSameDate(e,this._endDate))return"range-end";if(this.isDateInRange(e))return"range-in-between"}return e.getMonth()===this._contextDate.getMonth()?"base":"inactive"}setSelectorSelected(e){return this.range?this.isDateInRange(e):this.isSameDate(e,this._selectedDate)}setNewContextDateAndShiftFocus(e){var t;this._contextDate=new Date(this._contextDate.getFullYear(),this._contextDate.getMonth(),this._contextDate.getDate()+e),(t=this.getSelectorByDate(this._contextDate))==null||t.focus()}getSelectorByDate(e){return this.renderRoot.querySelector(`ngc-selector[data-value="${e.getDate()}"]:not([type="inactive"])`)}getYearOrMonthSelectorGrid(e){const
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
`}handleDateKeydown(e){switch(e.key){case"ArrowUp":e.preventDefault(),this.setNewContextDateAndShiftFocus(-7);break;case"ArrowDown":e.preventDefault(),this.setNewContextDateAndShiftFocus(7);break;case"ArrowLeft":e.preventDefault(),this.setNewContextDateAndShiftFocus(-1);break;case"ArrowRight":e.preventDefault(),this.setNewContextDateAndShiftFocus(1);break}}handleDateClick(e,t){this.range?this.handleRangeSelection(t):e.target.selected?this.clearSelection():this.setSelectedDate(t)}handleRangeSelection(e){this._startDate?this._startDate&&!this._endDate?e<this._startDate?this.setRangeStart(e):this.setRangeEnd(e):this._startDate&&this._endDate&&(e<this._startDate?this.setRangeStart(e):e>this._endDate?this.setRangeEnd(e):(this.clearSelection(),this.setRangeStart(e))):this.setRangeStart(e)}setSelectorType(e){if(this.range){if(this._startDate&&this._endDate&&this.isSameDate(this._startDate,this._endDate))return"base";if(this.isSameDate(e,this._startDate))return"range-start";if(this.isSameDate(e,this._endDate))return"range-end";if(this.isDateInRange(e))return"range-in-between"}return e.getMonth()===this._contextDate.getMonth()?"base":"inactive"}setSelectorSelected(e){return this.range?this.isDateInRange(e):this.isSameDate(e,this._selectedDate)}setNewContextDateAndShiftFocus(e){var t;this._contextDate=new Date(this._contextDate.getFullYear(),this._contextDate.getMonth(),this._contextDate.getDate()+e),(t=this.getSelectorByDate(this._contextDate))==null||t.focus()}getSelectorByDate(e){return this.renderRoot.querySelector(`ngc-selector[data-value="${e.getDate()}"]:not([type="inactive"])`)}getYearOrMonthSelectorGrid(e){const r=e===p.YEAR?this._years:this._localizedMonths,a=[];for(let o=0;o<r.length;o+=3)a.push(r.slice(o,o+3));return s`
|
|
94
|
+
<div role="dialog"
|
|
95
|
+
class="gator-datepicker-year-month-selectors"
|
|
96
|
+
id="${e}-selectors"
|
|
97
|
+
aria-label="${e===p.YEAR?this.yearDialogAriaLabel:this.monthDialogAriaLabel}"
|
|
98
|
+
@keydown=${this.handleSelectionDialogKeydown}>
|
|
99
|
+
<table class="gator-datepicker-table" role="grid">
|
|
100
|
+
<tbody class="gator-datepicker-table-body gator-datepicker-table-body-year-month">
|
|
101
|
+
${a.map(o=>s`
|
|
102
|
+
<tr>
|
|
103
|
+
${o.map(({dataValue:i,selectorText:h})=>s`
|
|
104
|
+
<ngc-year-month-selector
|
|
105
|
+
data-value=${i}
|
|
106
|
+
tabindex=${this.yearMonthSelectorTabindex(e,i)}
|
|
107
|
+
?current=${this.isYearMonthSelectorCurrent(e,i)}
|
|
108
|
+
?selected=${this.isYearMonthSelectorSelected(e,i)}
|
|
109
|
+
@selectorclick=${()=>this.handleYearMonthSelectorClick(i,e)}
|
|
110
|
+
@keydown=${m=>this.handleYearMonthSelectorKeyDown(m,i)}
|
|
111
|
+
>
|
|
112
|
+
${h}
|
|
113
|
+
</ngc-year-month-selector>
|
|
114
|
+
`)}
|
|
115
|
+
</tr>
|
|
96
116
|
`)}
|
|
97
|
-
</
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
117
|
+
</tbody>
|
|
118
|
+
</table>
|
|
119
|
+
${this.footerMarkup}
|
|
120
|
+
</div>
|
|
121
|
+
`}handleSelectionDialogKeydown(e){var t,r;switch(e.key){case n.TAB:const a=this.renderRoot.querySelector('ngc-year-month-selector[tabindex="0"]'),o=this.isTodayDisabled()?this.renderRoot.querySelector("#clear-button"):this.renderRoot.querySelector("#today-button");e.shiftKey?((t=this.shadowRoot)==null?void 0:t.activeElement)===a&&(o.focus(),e.preventDefault()):((r=this.shadowRoot)==null?void 0:r.activeElement)===o&&(a.focus(),e.preventDefault());break;case n.ESCAPE:case n.ENTER:case n.SPACE:const i=this._currentView==="years"?this.renderRoot.querySelector("#year-combobox"):this.renderRoot.querySelector("#month-combobox");this._currentView="calendar",setTimeout(()=>{i.focus()},0);break}}isYearMonthSelectorCurrent(e,t){return e==="year"?this._todaysDate.getFullYear()===t:this._todaysDate.getMonth()===t}isYearMonthSelectorSelected(e,t){return e==="year"?this._contextYear===t:this._contextMonth===t}yearMonthSelectorTabindex(e,t){if(e==="year"){const r=this._years.some(i=>i.dataValue===this._contextYear),a=this._years[0].dataValue===t,o=this._contextYear===t;return r?o?0:-1:a?0:-1}return this._contextMonth===t?0:-1}handleYearMonthSelectorClick(e,t){t==="month"?this._contextDate=new Date(this._contextDate.getFullYear(),e,1):this._contextDate=new Date(e,this._contextDate.getMonth(),1),this._currentView="calendar"}handleYearMonthSelectorKeyDown(e,t){switch(e.key){case n.UP:e.preventDefault(),this.shiftFocusToYearMonthSelector(t-3);break;case n.DOWN:e.preventDefault(),this.shiftFocusToYearMonthSelector(t+3);break;case n.LEFT:e.preventDefault(),this.shiftFocusToYearMonthSelector(t-1);break;case n.RIGHT:e.preventDefault(),this.shiftFocusToYearMonthSelector(t+1);break}}shiftFocusToYearMonthSelector(e){const t=this.renderRoot.querySelector(`ngc-year-month-selector[data-value="${e}"]`);t==null||t.focus()}async scrollToSelectedYear(){await this.updateComplete;const e=this.renderRoot.querySelector("ngc-year-month-selector[selected]");e==null||e.scrollIntoView({behavior:"auto",block:"center"})}get footerMarkup(){return s`
|
|
101
122
|
<div class="gator-datepicker-footer">
|
|
102
|
-
<ngc-button variant='base' @click=${this.handleClearClick}>${this.clearButtonLabel}</ngc-button>
|
|
103
|
-
<ngc-button variant='base' @click=${this.handleTodayClick}>${this.todayButtonLabel}</ngc-button>
|
|
123
|
+
<ngc-button id="clear-button" variant='base' @click=${this.handleClearClick}>${this.clearButtonLabel}</ngc-button>
|
|
124
|
+
<ngc-button id="today-button" variant='base' @click=${this.handleTodayClick} ?disabled=${this.isTodayDisabled()}>${this.todayButtonLabel}</ngc-button>
|
|
104
125
|
</div>
|
|
105
|
-
`}handleClearClick(){this.clearSelection(),this._currentView="calendar"}handleTodayClick(){this.range?(this.setRangeStart(this._todaysDate),this.setRangeEnd(this._todaysDate)):this.setSelectedDate(this._todaysDate),this._currentView="calendar"}};l.shadowRootOptions={...
|
|
126
|
+
`}handleClearClick(){this.clearSelection(),this._currentView="calendar"}handleTodayClick(){this.range?(this.setRangeStart(this._todaysDate),this.setRangeEnd(this._todaysDate)):this.setSelectedDate(this._todaysDate),this._currentView="calendar"}};l.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0};l.styles=[d(k),d(b),d(y),d(f)];c([g({type:String,attribute:"month-combobox-aria-label"})],l.prototype,"monthComboboxAriaLabel",2);c([g({type:String,attribute:"year-combobox-aria-label"})],l.prototype,"yearComboboxAriaLabel",2);c([g({type:String,attribute:"month-dialog-aria-label"})],l.prototype,"monthDialogAriaLabel",2);c([g({type:String,attribute:"year-dialog-aria-label"})],l.prototype,"yearDialogAriaLabel",2);c([w()],l.prototype,"_currentView",2);l=c([x("ngc-datepicker")],l);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import{r as b,a as d,x as u}from"../../../assets/index-chunk2.js";import{p as m}from"../../../assets/index-chunk5.js";import{s as p}from"../../../assets/index-chunk6.js";import{t as g}from"../../../assets/index-chunk3.js";import{n}from"../../../assets/index-chunk.js";import{T as y}from"../../../utils/components/testable-lit-element/testable-lit-element.js";import{K as h}from"../../../consts/key-constants.js";const v='.gator-year-month-selector{color:var(--text-color-primary-base, #1F1F1F);text-align:center;font-family:var(--text-family-body, "Open Sans");font-size:var(--text-size-body-2, .9375rem);line-height:var(--text-line-height-body-2, 1.375rem);letter-spacing:var(--text-letter-spacing-default, 0rem);display:flex;padding:var(--spacing-gap-12, .75rem) var(--spacing-gap-16, 1rem);justify-content:center;align-items:center;gap:.5rem;box-sizing:border-box;width:100%;height:100%;border-radius:var(--radius-input, .125rem)}.gator-year-month-selector:hover{cursor:pointer;background:var(--color-surface-brand-hover, #E4ECF2)}.gator-year-month-selector:active{background:var(--color-surface-brand, #E4ECF2)}.gator-year-month-selector:focus-visible{outline:none;border:2px solid var(--color-stroke-brand, #11395B)}.gator-year-month-selector-text{width:2.5rem}.gator-year-month-selector_disabled{color:var(--text-color-loading, #BFBFBF);pointer-events:none}.gator-year-month-selector_selected{font-weight:700}.gator-year-month-selector_selected:not(.gator-year-month-selector_disabled,:focus-visible,:hover){background:var(--color-surface-brand-secondary, #C3CDD6)}.gator-year-month-selector_selected.gator-year-month-selector_disabled{background:var(--color-surface-brand, #E4ECF2)}.gator-year-month-selector_current{border:1px solid var(--color-stroke-brand, #11395B)}';var f=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,r,l,s)=>{for(var o=s>1?void 0:s?x(r,l):r,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=(s?c(r,l,o):c(o))||o);return s&&o&&f(r,l,o),o},C=(e=>(e.MONTH="month",e.YEAR="year",e))(C||{});let t=class extends y{constructor(){super(),this.selected=!1,this.disabled=!1,this.current=!1,this.tabindex=0,this.addEventListener("click",this.handleClick)}render(){return u`
|
|
2
2
|
<div class="gator-year-month-selector ${this.selectedClass} ${this.disabledClass} ${this.currentClass}"
|
|
3
3
|
tabindex=${this.disabled?"-1":this.tabindex}
|
|
4
4
|
role="gridcell"
|
|
@@ -10,4 +10,4 @@ import{r as p,a as d,x as b}from"../../../assets/index-chunk2.js";import{p as u}
|
|
|
10
10
|
<slot></slot>
|
|
11
11
|
</span>
|
|
12
12
|
</div>
|
|
13
|
-
`}get selectedClass(){return this.selected?"gator-year-month-selector_selected":""}get disabledClass(){return this.disabled?"gator-year-month-selector_disabled":""}get currentClass(){return this.current?"gator-year-month-selector_current":""}handleKeydown(e){if(e.key===h.ENTER||e.key===h.SPACE){e.preventDefault(),this.handleClick(e);return}}handleClick(e){var r;e.preventDefault()
|
|
13
|
+
`}get selectedClass(){return this.selected?"gator-year-month-selector_selected":""}get disabledClass(){return this.disabled?"gator-year-month-selector_disabled":""}get currentClass(){return this.current?"gator-year-month-selector_current":""}handleKeydown(e){if(e.key===h.ENTER||e.key===h.SPACE){e.preventDefault(),this.handleClick(e);return}}handleClick(e){var r;e.preventDefault(),!this.disabled&&this.dispatchEvent(new CustomEvent("selectorclick",{bubbles:!0,detail:{value:(r=this.textContent)==null?void 0:r.trim(),selected:this.selected}}))}};t.shadowRootOptions={...b.shadowRootOptions,delegatesFocus:!0};t.styles=[d(v),d(m),d(p)];a([n({type:Boolean,attribute:"selected"})],t.prototype,"selected",2);a([n({type:Boolean,attribute:"disabled"})],t.prototype,"disabled",2);a([n({type:Boolean,attribute:"current"})],t.prototype,"current",2);a([n({type:Number,attribute:"tabindex"})],t.prototype,"tabindex",2);t=a([g("ngc-year-month-selector")],t);export{C as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as o,x as t}from"../../../assets/index-chunk2.js";import"../gator/input-label/input-label.gator.js";import"../gator/help-text/help-text.gator.js";import"../../icon/gator/icon.gator.js";import"../../icon/gator/templates/arrow-left.js";import"../../icon/gator/templates/arrow-right.js";import"../../icon/gator/templates/check-circle.js";import"../../icon/gator/templates/check.js";import"../../icon/gator/templates/checkbox.js";import"../../icon/gator/templates/checkbox-selected.js";import"../../icon/gator/templates/chevron-down.js";import"../../icon/gator/templates/chevron-left.js";import"../../icon/gator/templates/chevron-right.js";import"../../icon/gator/templates/chevron-up.js";import"../../icon/gator/templates/dashboard.js";import"../../icon/gator/templates/exit.js";import"../../icon/gator/templates/exit-circle.js";import"../../icon/gator/templates/eye-crossed.js";import"../../icon/gator/templates/info.js";import"../../icon/gator/templates/link.js";import"../../icon/gator/templates/overflow-menu.js";import"../../icon/gator/templates/percent.js";import"../../icon/gator/templates/picture.js";import"../../icon/gator/templates/shield-lock.js";import"../../icon/gator/templates/radio.js";import"../../icon/gator/templates/radio-selected.js";import"../../icon/gator/templates/restricted.js";import"../../icon/gator/templates/settings.js";import"../../icon/gator/templates/warning.js";import{s as
|
|
1
|
+
import{a as o,x as t}from"../../../assets/index-chunk2.js";import"../gator/input-label/input-label.gator.js";import"../gator/help-text/help-text.gator.js";import"../../icon/gator/icon.gator.js";import"../../icon/gator/templates/arrow-left.js";import"../../icon/gator/templates/arrow-right.js";import"../../icon/gator/templates/check-circle.js";import"../../icon/gator/templates/check.js";import"../../icon/gator/templates/checkbox.js";import"../../icon/gator/templates/checkbox-selected.js";import"../../icon/gator/templates/chevron-down.js";import"../../icon/gator/templates/chevron-left.js";import"../../icon/gator/templates/chevron-right.js";import"../../icon/gator/templates/chevron-up.js";import"../../icon/gator/templates/dashboard.js";import"../../icon/gator/templates/exit.js";import"../../icon/gator/templates/exit-circle.js";import"../../icon/gator/templates/eye-crossed.js";import"../../icon/gator/templates/info.js";import"../../icon/gator/templates/link.js";import"../../icon/gator/templates/overflow-menu.js";import"../../icon/gator/templates/percent.js";import"../../icon/gator/templates/picture.js";import"../../icon/gator/templates/shield-lock.js";import"../../icon/gator/templates/radio.js";import"../../icon/gator/templates/radio-selected.js";import"../../icon/gator/templates/restricted.js";import"../../icon/gator/templates/settings.js";import"../../icon/gator/templates/warning.js";import{s as n}from"../../../assets/index-chunk6.js";import{p as a}from"../../../assets/index-chunk5.js";import{I as p}from"./input-base.js";import{e as s}from"../../../assets/index-chunk8.js";import"../../../assets/index-chunk3.js";import"../../../assets/index-chunk.js";import"../../../utils/mixins/attribute-deletion.js";import"../../icon/icon-registry.js";import"../../../utils/components/testable-lit-element/testable-lit-element.js";import"../../../assets/index-chunk9.js";const l='input,textarea{border:none}input:focus,textarea:focus{outline:none}.gator-form-element-control:focus-within{outline:2px solid var(--ngc-input-border-color-focused, #1F1F1F)!important;border:1px solid transparent!important}.gator-form-element{display:block;margin-bottom:1rem}.gator-form-element-control{padding:var(--ngc-input-padding);display:flex;flex-direction:column}.gator-input,.gator-faux-input{display:flex;width:100%;height:100%;font-size:var(--ngc-input-font-size, 1.0625rem);font-family:var(--text-family-sans-serif, "Open Sans", sans-serif)}.gator-form-element-control{margin:.5rem 0;border:1px solid var(--ngc-input-border-color, #BFBFBF);border-radius:var(--ngc-input-border-radius, 2px);flex:1}.gator-form-element-control:hover:not(.gator-disabled){border:1px solid var(--ngc-input-border-color-hovered, #1F1F1F);outline:none}.gator-has-error{border-color:var(--ngc-input-error-border)!important}.gator-disabled{background:var(--color-surface-secondary, #F7F7F7);border:none;cursor:not-allowed}.gator-disabled input,.gator-disabled textarea{background-color:transparent;cursor:not-allowed}.gator-form-element-control-icon-right{display:flex;align-items:center}.gator-input-container{max-width:var(--ngc-input-max-width, 200px);display:flex;align-items:center;position:relative}.gator-input-start,.gator-input-end{display:flex;align-items:center}.gator-input-start{margin-right:.5rem}.gator-cursor-pointer{cursor:pointer}',c=":root,:host{--ngc-input-error-border: var(--color-error, #D0021B);--ngc-input-border-color: var(--color-grey-40, #BFBFBF);--ngc-input-border-color-focused: var(--color-stroke-brand, #1F1F1F);--ngc-input-border-color-hovered: var(--color-stroke-interactive, #0052CC);--ngc-input-min-width: 200px;--ngc-input-padding: var(--spacing-3, .75rem) var(--spacing-4, 1rem);--ngc-input-border-radius: var(--radius-sm, .125rem);--ngc-input-max-width: 100%;--ngc-input-font-size: 17px}",e=class e extends p{constructor(){super(...arguments),this.controlRef=s()}get shouldHaveStartMarkup(){return this.startIcon}get shouldHaveEndMarkup(){return this.endIcon||this.type==="password"}get startIconMarkup(){return this.startIcon?t`<ngc-icon .name="${this.startIcon}"></ngc-icon>`:null}get endIconMarkup(){return this.endIcon?t`
|
|
2
2
|
<ngc-icon .name="${this.endIcon}"></ngc-icon>`:null}get labelMarkup(){return t`
|
|
3
3
|
<ngc-input-label
|
|
4
4
|
.for="${this.id}"
|
|
@@ -12,6 +12,7 @@ import{a as o,x as t}from"../../../assets/index-chunk2.js";import"../gator/input
|
|
|
12
12
|
${this.helpTextMarkup}
|
|
13
13
|
${this.errorTextMarkup}
|
|
14
14
|
`}get errorTextMarkup(){return this.errorText?t`
|
|
15
|
-
<ngc-help-text icon="warning" error
|
|
15
|
+
<ngc-help-text icon="warning" error
|
|
16
|
+
data-testid=${this.errorMessageDataTestid}>
|
|
16
17
|
${this.errorText}
|
|
17
|
-
</ngc-help-text>`:null}handleClick(r){}handleInputFocusIn(){var r;(r=this.controlRef.value)==null||r.classList.add("gator-input-has-focus")}handleInputFocusOut(){var r;(r=this.controlRef.value)==null||r.classList.remove("gator-input-has-focus")}};e.styles=[o(l),o(
|
|
18
|
+
</ngc-help-text>`:null}handleClick(r){}handleInputFocusIn(){var r;(r=this.controlRef.value)==null||r.classList.add("gator-input-has-focus")}handleInputFocusOut(){var r;(r=this.controlRef.value)==null||r.classList.remove("gator-input-has-focus")}};e.styles=[o(l),o(n),o(a),o(c)];let i=e;export{i as N,c as g,l as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as h}from"../../../../assets/index-chunk3.js";import{n as
|
|
1
|
+
import{t as h}from"../../../../assets/index-chunk3.js";import{n as u}from"../../../../assets/index-chunk.js";import{r as l}from"../../../../assets/index-chunk4.js";import{N as m}from"../input-text/input-text.gator.js";import"../../../../assets/index-chunk2.js";import"../input-label/input-label.gator.js";import"../../../../assets/index-chunk5.js";import"../../../../assets/index-chunk6.js";import"../../../../utils/mixins/attribute-deletion.js";import"../help-text/help-text.gator.js";import"../../../icon/gator/icon.gator.js";import"../../../icon/gator/templates/arrow-left.js";import"../../../icon/icon-registry.js";import"../../../icon/gator/templates/arrow-right.js";import"../../../icon/gator/templates/check-circle.js";import"../../../icon/gator/templates/check.js";import"../../../icon/gator/templates/checkbox.js";import"../../../icon/gator/templates/checkbox-selected.js";import"../../../icon/gator/templates/chevron-down.js";import"../../../icon/gator/templates/chevron-left.js";import"../../../icon/gator/templates/chevron-right.js";import"../../../icon/gator/templates/chevron-up.js";import"../../../icon/gator/templates/dashboard.js";import"../../../icon/gator/templates/exit.js";import"../../../icon/gator/templates/exit-circle.js";import"../../../icon/gator/templates/eye-crossed.js";import"../../../icon/gator/templates/info.js";import"../../../icon/gator/templates/link.js";import"../../../icon/gator/templates/overflow-menu.js";import"../../../icon/gator/templates/percent.js";import"../../../icon/gator/templates/picture.js";import"../../../icon/gator/templates/shield-lock.js";import"../../../icon/gator/templates/radio.js";import"../../../icon/gator/templates/radio-selected.js";import"../../../icon/gator/templates/restricted.js";import"../../../icon/gator/templates/settings.js";import"../../../icon/gator/templates/warning.js";import"../../../../assets/index-chunk8.js";import"../../../../assets/index-chunk9.js";import"../../base/input-base.gator.js";import"../../base/input-base.js";import"../../../../utils/components/testable-lit-element/testable-lit-element.js";import"../../../../assets/index-chunk7.js";var c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,_=Reflect.get,n=(t,e,s,i)=>{for(var r=i>1?void 0:i?d(e,s):e,o=t.length-1,p;o>=0;o--)(p=t[o])&&(r=(i?p(e,s,r):p(r))||r);return i&&r&&c(e,s,r),r},v=(t,e,s)=>_(f(t),s,e);let a=class extends m{constructor(){super(...arguments),this.maskPreset=null,this.maskPattern="",this.acceptedCharType="alphanumeric",this.value="",this._value="",this._inputFocused=!1,this._cursorPosition=null}updated(t){super.updated(t),t.has("value")&&(this._value=this.formatValue(this.value)),t.get("_cursorPosition")&&this.inputRef.value&&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._maxLength=this._maskPattern.length,this._value=this.formatValue(this.value))}handleInputEvent(t){t.preventDefault(),t.stopPropagation();const e=t.target,s=e.selectionStart??0,i=this.formatValue(e.value),r=this._value.length<e.value.length,o=!!this.errorText,p=new CustomEvent("input",{bubbles:!0,composed:!0,detail:{formatted:i,raw:o?i:i.replaceAll("-","")}});r&&i[s-1]==="-"?this._cursorPosition=s+1:this._cursorPosition=s,this._value=i,this.dispatchEvent(p)}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####";default:return this.maskPattern}}validateChars(t){switch(this.acceptedCharType){case"numeric":return/^[0-9]*$/.test(t.replaceAll("-",""));case"alpha":return/^[a-zA-Z]*$/.test(t.replaceAll("-",""));case"alphanumeric":default:return/^[a-zA-Z0-9]*$/.test(t.replaceAll("-",""))}}formatValue(t){if(!this.validateChars(t)){let r="";switch(this.acceptedCharType){case"alpha":{r="letters";break}case"numeric":{r="numbers";break}default:r="letters, numbers,"}return this.errorText=`Invalid ${this.label??"input"}. Use only ${r} and dashes in this field.`,t}this.errorText="";const e=t.replaceAll(/[^a-zA-Z0-9]/g,"").substring(0,this._maskPattern.length);let s="",i=0;for(let r=0;r<this._maskPattern.length&&i!==e.length;++r){const o=e[i],p=this._maskPattern[r];switch(p){case"X":{this._inputFocused?s+=o:s+="X",i++;break}case"#":{s+=o,i++;break}default:s+=p}}return s}};a.styles=[...v(a,a,"styles")];n([u({attribute:"mask-preset"})],a.prototype,"maskPreset",2);n([u({attribute:"mask-pattern"})],a.prototype,"maskPattern",2);n([u({attribute:"accepted-char-type"})],a.prototype,"acceptedCharType",2);n([l()],a.prototype,"_inputFocused",2);n([l()],a.prototype,"_cursorPosition",2);a=n([h("ngc-input-masked")],a);
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import{T as l,E as
|
|
1
|
+
import{T as l,E as $,x as p}from"../../../../assets/index-chunk2.js";import"../input-label/input-label.gator.js";import"../help-text/help-text.gator.js";import"../../../icon/gator/icon.gator.js";import"../../../icon/gator/templates/arrow-left.js";import"../../../icon/gator/templates/arrow-right.js";import"../../../icon/gator/templates/check-circle.js";import"../../../icon/gator/templates/check.js";import"../../../icon/gator/templates/checkbox.js";import"../../../icon/gator/templates/checkbox-selected.js";import"../../../icon/gator/templates/chevron-down.js";import"../../../icon/gator/templates/chevron-left.js";import"../../../icon/gator/templates/chevron-right.js";import"../../../icon/gator/templates/chevron-up.js";import"../../../icon/gator/templates/dashboard.js";import"../../../icon/gator/templates/exit.js";import"../../../icon/gator/templates/exit-circle.js";import"../../../icon/gator/templates/eye-crossed.js";import"../../../icon/gator/templates/info.js";import"../../../icon/gator/templates/link.js";import"../../../icon/gator/templates/overflow-menu.js";import"../../../icon/gator/templates/percent.js";import"../../../icon/gator/templates/picture.js";import"../../../icon/gator/templates/shield-lock.js";import"../../../icon/gator/templates/radio.js";import"../../../icon/gator/templates/radio-selected.js";import"../../../icon/gator/templates/restricted.js";import"../../../icon/gator/templates/settings.js";import"../../../icon/gator/templates/warning.js";import{t as b}from"../../../../assets/index-chunk3.js";import{n as u}from"../../../../assets/index-chunk.js";import{r as d}from"../../../../assets/index-chunk4.js";import{f as E,m as T,e as v,n as g}from"../../../../assets/index-chunk8.js";import{N as y}from"../../base/input-base.gator.js";import{o as c}from"../../../../assets/index-chunk7.js";import{e as x,i as I,t as n}from"../../../../assets/index-chunk9.js";import"../../../../assets/index-chunk5.js";import"../../../../assets/index-chunk6.js";import"../../../../utils/mixins/attribute-deletion.js";import"../../../icon/icon-registry.js";import"../../base/input-base.js";import"../../../../utils/components/testable-lit-element/testable-lit-element.js";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const f=x(class extends I{constructor(t){if(super(t),t.type!==n.PROPERTY&&t.type!==n.ATTRIBUTE&&t.type!==n.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!E(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===l||e===$)return e;const i=t.element,o=t.name;if(t.type===n.PROPERTY){if(e===i[o])return l}else if(t.type===n.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return l}else if(t.type===n.ATTRIBUTE&&i.getAttribute(o)===e+"")return l;return T(t),e}});var _=Object.defineProperty,R=Object.getOwnPropertyDescriptor,s=(t,e,i,o)=>{for(var a=o>1?void 0:o?R(e,i):e,h=t.length-1,m;h>=0;h--)(m=t[h])&&(a=(o?m(e,i,a):m(a))||a);return o&&a&&_(e,i,a),a};let r=class extends y{constructor(){super(...arguments),this.inputRef=v(),this.controlRef=v(),this.for=""}render(){return p`
|
|
6
6
|
<div class="gator-form-element">
|
|
7
7
|
${this.label?this.labelMarkup:null}
|
|
8
|
-
<div ${
|
|
8
|
+
<div ${g(this.controlRef)} class="gator-form-element-control ${this.errorClass} ${this.disabledClass}">
|
|
9
9
|
<div class="gator-input-container">
|
|
10
10
|
${this.shouldHaveStartMarkup?p`
|
|
11
11
|
<div class="gator-input-start">
|
|
12
12
|
${this.startIconMarkup}
|
|
13
13
|
</div>`:null}
|
|
14
14
|
<input
|
|
15
|
-
${
|
|
15
|
+
${g(this.inputRef)}
|
|
16
16
|
type="${this.type}"
|
|
17
17
|
.id="${this.id}"
|
|
18
|
-
|
|
18
|
+
data-testid=${c(this.dataTestid)}-input
|
|
19
|
+
.placeholder="${f(this._placeholder)}"
|
|
19
20
|
.required="${this.required}"
|
|
20
21
|
.disabled="${this.disabled}"
|
|
21
22
|
class="gator-input"
|
|
22
23
|
aria-invalid="${this.isAriaInvalid}"
|
|
23
24
|
aria-required="${this.required}"
|
|
24
|
-
aria-description="${
|
|
25
|
-
.value="${
|
|
26
|
-
maxlength="${
|
|
25
|
+
aria-description="${c(this.ariaDescription)}"
|
|
26
|
+
.value="${f(this._value)}"
|
|
27
|
+
maxlength="${c(this._maxLength)}"
|
|
27
28
|
.min="${this.min}"
|
|
28
29
|
.max="${this.max}"
|
|
29
30
|
.step="${this.step}"
|
|
@@ -44,7 +45,8 @@ import{T as l,E as y,x as p}from"../../../../assets/index-chunk2.js";import"../i
|
|
|
44
45
|
|
|
45
46
|
${this.bottomText}
|
|
46
47
|
</div>
|
|
47
|
-
`}get displayedErrorText(){return this.errorText||this._nativeInputError}get isAriaInvalid(){return this.displayedErrorText?"true":"false"}get errorClass(){return this.displayedErrorText?"gator-has-error":""}get disabledClass(){return this.disabled?"gator-disabled":""}get passwordVisibilityMarkup(){return this.endIconMarkup||this.type!=="password"?null:p`<ngc-icon name="eye-crossed" @click="${this.togglePasswordVisibility}"></ngc-icon>`}connectedCallback(){super.connectedCallback(),this._value=this.value,this._maxLength=this.maxLength}handleNativeInputValidation(t){this.inputRef.value&&(this._nativeInputError=this.inputRef.value.validationMessage),t.preventDefault()}handleInputEvent(t){t.preventDefault(),t.stopPropagation();const e=t.target,i=new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e.value}});this._value=e.value,this.dispatchEvent(i)}handleChange(t){t.preventDefault(),t.stopPropagation();const e=t.target,i=new CustomEvent("change",{composed:!0,bubbles:!0,detail:{value:e.value}});this._value=e.value,this.dispatchEvent(i)}togglePasswordVisibility(){const t=this.inputRef.value;t&&(t.type=t.type==="password"?"text":"password")}handleInputFocusOut(){var t;super.handleInputFocusOut(),(t=this.inputRef.value)!=null&&t.checkValidity()&&(this._nativeInputError="")}get errorTextMarkup(){return this.displayedErrorText?p`
|
|
48
|
-
<ngc-help-text icon="warning" error
|
|
48
|
+
`}get displayedErrorText(){return this.errorText||this._nativeInputError}get isAriaInvalid(){return this.displayedErrorText?"true":"false"}get errorClass(){return this.displayedErrorText?"gator-has-error":""}get disabledClass(){return this.disabled?"gator-disabled":""}get passwordVisibilityMarkup(){return this.endIconMarkup||this.type!=="password"?null:p`<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}handleNativeInputValidation(t){this.inputRef.value&&(this._nativeInputError=this.inputRef.value.validationMessage),t.preventDefault()}handleInputEvent(t){t.preventDefault(),t.stopPropagation();const e=t.target,i=new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e.value}});this._value=e.value,this.dispatchEvent(i)}handleChange(t){t.preventDefault(),t.stopPropagation();const e=t.target,i=new CustomEvent("change",{composed:!0,bubbles:!0,detail:{value:e.value}});this._value=e.value,this.dispatchEvent(i)}togglePasswordVisibility(){const t=this.inputRef.value;t&&(t.type=t.type==="password"?"text":"password")}handleInputFocusOut(){var t;super.handleInputFocusOut(),(t=this.inputRef.value)!=null&&t.checkValidity()&&(this._nativeInputError="")}get errorTextMarkup(){return this.displayedErrorText?p`
|
|
49
|
+
<ngc-help-text icon="warning" error
|
|
50
|
+
data-testid=${this.errorMessageDataTestid}>
|
|
49
51
|
${this.displayedErrorText}
|
|
50
|
-
</ngc-help-text>`:null}};r.shadowRootOptions={...
|
|
52
|
+
</ngc-help-text>`:null}};r.shadowRootOptions={...y.shadowRootOptions,delegatesFocus:!0};s([u()],r.prototype,"for",2);s([u({type:Number})],r.prototype,"min",2);s([u({type:Number})],r.prototype,"max",2);s([u({type:Number})],r.prototype,"step",2);s([d()],r.prototype,"_nativeInputError",2);s([d()],r.prototype,"_value",2);s([d()],r.prototype,"_maxLength",2);s([d()],r.prototype,"_placeholder",2);r=s([b("ngc-input-text")],r);export{r as N};
|
|
@@ -83,6 +83,7 @@ export declare class NjcDatepicker extends TestableLitElement {
|
|
|
83
83
|
}[];
|
|
84
84
|
isSameDate(date1: Date | null, date2: Date | null): boolean;
|
|
85
85
|
isDateInRange(date: Date): boolean;
|
|
86
|
+
isTodayDisabled(): boolean;
|
|
86
87
|
isDateOutsideMinMax(date: Date): boolean;
|
|
87
88
|
setSelectedDate(date: Date | null): void;
|
|
88
89
|
setRangeStart(startDate: Date | null): void;
|
|
@@ -12,17 +12,31 @@ export declare class NgcDatepicker extends NjcDatepicker {
|
|
|
12
12
|
serializable?: boolean;
|
|
13
13
|
slotAssignment?: SlotAssignmentMode;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* @property {string} monthComboboxAriaLabel - Aria label for month combobox
|
|
17
|
+
*/
|
|
18
|
+
monthComboboxAriaLabel: string;
|
|
19
|
+
/**
|
|
20
|
+
* @property {string} yearComboboxAriaLabel - Aria label for year combobox
|
|
21
|
+
*/
|
|
22
|
+
yearComboboxAriaLabel: string;
|
|
23
|
+
/**
|
|
24
|
+
* @property {string} monthDialogAriaLabel - Aria label for month selection dialog
|
|
25
|
+
*/
|
|
26
|
+
monthDialogAriaLabel: string;
|
|
27
|
+
/**
|
|
28
|
+
* @property {string} yearDialogAriaLabel - Aria label for year selection dialog
|
|
29
|
+
*/
|
|
30
|
+
yearDialogAriaLabel: string;
|
|
15
31
|
protected _currentView: DATE_PICKER_VIEW;
|
|
16
32
|
static styles: import('lit').CSSResult[];
|
|
17
33
|
render(): import('lit').TemplateResult<1>;
|
|
18
34
|
get headerMarkup(): import('lit').TemplateResult<1>;
|
|
19
35
|
handlePreviousMonthClicked(): void;
|
|
20
36
|
handleMonthClick(): void;
|
|
21
|
-
handleMonthKeydown(e: KeyboardEvent): void;
|
|
22
37
|
handleYearClick(): void;
|
|
23
|
-
handleYearKeydown(e: KeyboardEvent): void;
|
|
24
38
|
handleNextMonthClicked(): void;
|
|
25
|
-
|
|
39
|
+
handleYearMonthComboboxKeydown(event: KeyboardEvent): void;
|
|
26
40
|
get currentViewMarkup(): import('lit').TemplateResult<1> | null;
|
|
27
41
|
get calendarMarkup(): import('lit').TemplateResult<1>;
|
|
28
42
|
get daysOfWeekMarkup(): import('lit').TemplateResult<1>;
|
|
@@ -35,6 +49,7 @@ export declare class NgcDatepicker extends NjcDatepicker {
|
|
|
35
49
|
setNewContextDateAndShiftFocus(number: number): void;
|
|
36
50
|
getSelectorByDate(date: Date): HTMLElement;
|
|
37
51
|
getYearOrMonthSelectorGrid(type: SELECTOR_TYPE): import('lit').TemplateResult<1>;
|
|
52
|
+
handleSelectionDialogKeydown(event: KeyboardEvent): void;
|
|
38
53
|
isYearMonthSelectorCurrent(type: SELECTOR_TYPE, valueToCheck: number): boolean;
|
|
39
54
|
isYearMonthSelectorSelected(type: SELECTOR_TYPE, valueToCheck: number): boolean;
|
|
40
55
|
yearMonthSelectorTabindex(type: SELECTOR_TYPE, valueToCheck: number): 0 | -1;
|
|
@@ -22,7 +22,6 @@ export declare class NgcInputMasked extends NgcInputText {
|
|
|
22
22
|
_value: string;
|
|
23
23
|
private _inputFocused;
|
|
24
24
|
private _cursorPosition;
|
|
25
|
-
connectedCallback(): void;
|
|
26
25
|
updated(changedProperties: Map<string, string>): void;
|
|
27
26
|
handleInputEvent(e: Event): void;
|
|
28
27
|
handleClick(e: Event): void;
|
|
@@ -28,6 +28,7 @@ export declare class NgcInputText extends NgcInputBase {
|
|
|
28
28
|
_nativeInputError: string | undefined;
|
|
29
29
|
protected _value: string | number | undefined | null;
|
|
30
30
|
protected _maxLength: number | undefined;
|
|
31
|
+
protected _placeholder: string | undefined;
|
|
31
32
|
render(): import('lit').TemplateResult<1>;
|
|
32
33
|
get displayedErrorText(): string | undefined;
|
|
33
34
|
get isAriaInvalid(): "true" | "false";
|
package/package.json
CHANGED
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@ncino/web-components",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1-preview.1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -3341,6 +3341,22 @@
|
|
|
3341
3341
|
"description": "\n---\n",
|
|
3342
3342
|
"doc-url": "",
|
|
3343
3343
|
"attributes": [
|
|
3344
|
+
{
|
|
3345
|
+
"name": "month-combobox-aria-label",
|
|
3346
|
+
"value": { "type": "string", "default": "'Current Month'" }
|
|
3347
|
+
},
|
|
3348
|
+
{
|
|
3349
|
+
"name": "year-combobox-aria-label",
|
|
3350
|
+
"value": { "type": "string", "default": "'Current Year'" }
|
|
3351
|
+
},
|
|
3352
|
+
{
|
|
3353
|
+
"name": "month-dialog-aria-label",
|
|
3354
|
+
"value": { "type": "string", "default": "'Month Selection'" }
|
|
3355
|
+
},
|
|
3356
|
+
{
|
|
3357
|
+
"name": "year-dialog-aria-label",
|
|
3358
|
+
"value": { "type": "string", "default": "'Year Selection'" }
|
|
3359
|
+
},
|
|
3344
3360
|
{
|
|
3345
3361
|
"name": "range",
|
|
3346
3362
|
"value": { "type": "boolean", "default": "false" }
|
|
@@ -3383,8 +3399,11 @@
|
|
|
3383
3399
|
"events": [],
|
|
3384
3400
|
"js": {
|
|
3385
3401
|
"properties": [
|
|
3402
|
+
{ "name": "monthComboboxAriaLabel", "type": "string" },
|
|
3403
|
+
{ "name": "yearComboboxAriaLabel", "type": "string" },
|
|
3404
|
+
{ "name": "monthDialogAriaLabel", "type": "string" },
|
|
3405
|
+
{ "name": "yearDialogAriaLabel", "type": "string" },
|
|
3386
3406
|
{ "name": "headerMarkup" },
|
|
3387
|
-
{ "name": "bodyMarkup" },
|
|
3388
3407
|
{ "name": "currentViewMarkup" },
|
|
3389
3408
|
{ "name": "calendarMarkup" },
|
|
3390
3409
|
{ "name": "daysOfWeekMarkup" },
|