material-components-web.js 999 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
  7. */
  8. (function webpackUniversalModuleDefinition(root, factory) {
  9. if(typeof exports === 'object' && typeof module === 'object')
  10. module.exports = factory();
  11. else if(typeof define === 'function' && define.amd)
  12. define([], factory);
  13. else if(typeof exports === 'object')
  14. exports["mdc"] = factory();
  15. else
  16. root["mdc"] = factory();
  17. })(this, function() {
  18. return /******/ (function(modules) { // webpackBootstrap
  19. /******/ // The module cache
  20. /******/ var installedModules = {};
  21. /******/
  22. /******/ // The require function
  23. /******/ function __webpack_require__(moduleId) {
  24. /******/
  25. /******/ // Check if module is in cache
  26. /******/ if(installedModules[moduleId]) {
  27. /******/ return installedModules[moduleId].exports;
  28. /******/ }
  29. /******/ // Create a new module (and put it into the cache)
  30. /******/ var module = installedModules[moduleId] = {
  31. /******/ i: moduleId,
  32. /******/ l: false,
  33. /******/ exports: {}
  34. /******/ };
  35. /******/
  36. /******/ // Execute the module function
  37. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  38. /******/
  39. /******/ // Flag the module as loaded
  40. /******/ module.l = true;
  41. /******/
  42. /******/ // Return the exports of the module
  43. /******/ return module.exports;
  44. /******/ }
  45. /******/
  46. /******/
  47. /******/ // expose the modules object (__webpack_modules__)
  48. /******/ __webpack_require__.m = modules;
  49. /******/
  50. /******/ // expose the module cache
  51. /******/ __webpack_require__.c = installedModules;
  52. /******/
  53. /******/ // define getter function for harmony exports
  54. /******/ __webpack_require__.d = function(exports, name, getter) {
  55. /******/ if(!__webpack_require__.o(exports, name)) {
  56. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  57. /******/ }
  58. /******/ };
  59. /******/
  60. /******/ // define __esModule on exports
  61. /******/ __webpack_require__.r = function(exports) {
  62. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  63. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  64. /******/ }
  65. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  66. /******/ };
  67. /******/
  68. /******/ // create a fake namespace object
  69. /******/ // mode & 1: value is a module id, require it
  70. /******/ // mode & 2: merge all properties of value into the ns
  71. /******/ // mode & 4: return value when already ns object
  72. /******/ // mode & 8|1: behave like require
  73. /******/ __webpack_require__.t = function(value, mode) {
  74. /******/ if(mode & 1) value = __webpack_require__(value);
  75. /******/ if(mode & 8) return value;
  76. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  77. /******/ var ns = Object.create(null);
  78. /******/ __webpack_require__.r(ns);
  79. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  80. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  81. /******/ return ns;
  82. /******/ };
  83. /******/
  84. /******/ // getDefaultExport function for compatibility with non-harmony modules
  85. /******/ __webpack_require__.n = function(module) {
  86. /******/ var getter = module && module.__esModule ?
  87. /******/ function getDefault() { return module['default']; } :
  88. /******/ function getModuleExports() { return module; };
  89. /******/ __webpack_require__.d(getter, 'a', getter);
  90. /******/ return getter;
  91. /******/ };
  92. /******/
  93. /******/ // Object.prototype.hasOwnProperty.call
  94. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  95. /******/
  96. /******/ // __webpack_public_path__
  97. /******/ __webpack_require__.p = "";
  98. /******/
  99. /******/
  100. /******/ // Load entry module and return exports
  101. /******/ return __webpack_require__(__webpack_require__.s = "./packages/material-components-web/index.ts");
  102. /******/ })
  103. /************************************************************************/
  104. /******/ ({
  105. /***/ "./packages/material-components-web/index.ts":
  106. /*!***************************************************!*\
  107. !*** ./packages/material-components-web/index.ts ***!
  108. \***************************************************/
  109. /*! no static exports found */
  110. /***/ (function(module, exports, __webpack_require__) {
  111. "use strict";
  112. /**
  113. * @license
  114. * Copyright 2016 Google Inc.
  115. *
  116. * Permission is hereby granted, free of charge, to any person obtaining a copy
  117. * of this software and associated documentation files (the "Software"), to deal
  118. * in the Software without restriction, including without limitation the rights
  119. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  120. * copies of the Software, and to permit persons to whom the Software is
  121. * furnished to do so, subject to the following conditions:
  122. *
  123. * The above copyright notice and this permission notice shall be included in
  124. * all copies or substantial portions of the Software.
  125. *
  126. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  127. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  128. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  129. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  130. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  131. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  132. * THE SOFTWARE.
  133. */
  134. var __importDefault = this && this.__importDefault || function (mod) {
  135. return mod && mod.__esModule ? mod : { "default": mod };
  136. };
  137. var __importStar = this && this.__importStar || function (mod) {
  138. if (mod && mod.__esModule) return mod;
  139. var result = {};
  140. if (mod != null) for (var k in mod) {
  141. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  142. }result["default"] = mod;
  143. return result;
  144. };
  145. Object.defineProperty(exports, "__esModule", { value: true });
  146. var index_1 = __importDefault(__webpack_require__(/*! @material/auto-init/index */ "./packages/mdc-auto-init/index.ts"));
  147. exports.autoInit = index_1.default;
  148. var base = __importStar(__webpack_require__(/*! @material/base/index */ "./packages/mdc-base/index.ts"));
  149. exports.base = base;
  150. var checkbox = __importStar(__webpack_require__(/*! @material/checkbox/index */ "./packages/mdc-checkbox/index.ts"));
  151. exports.checkbox = checkbox;
  152. var chips = __importStar(__webpack_require__(/*! @material/chips/index */ "./packages/mdc-chips/index.ts"));
  153. exports.chips = chips;
  154. var circularProgress = __importStar(__webpack_require__(/*! @material/circular-progress/index */ "./packages/mdc-circular-progress/index.ts"));
  155. exports.circularProgress = circularProgress;
  156. var dataTable = __importStar(__webpack_require__(/*! @material/data-table/index */ "./packages/mdc-data-table/index.ts"));
  157. exports.dataTable = dataTable;
  158. var dialog = __importStar(__webpack_require__(/*! @material/dialog/index */ "./packages/mdc-dialog/index.ts"));
  159. exports.dialog = dialog;
  160. var dom = __importStar(__webpack_require__(/*! @material/dom/index */ "./packages/mdc-dom/index.ts"));
  161. exports.dom = dom;
  162. var drawer = __importStar(__webpack_require__(/*! @material/drawer/index */ "./packages/mdc-drawer/index.ts"));
  163. exports.drawer = drawer;
  164. var floatingLabel = __importStar(__webpack_require__(/*! @material/floating-label/index */ "./packages/mdc-floating-label/index.ts"));
  165. exports.floatingLabel = floatingLabel;
  166. var formField = __importStar(__webpack_require__(/*! @material/form-field/index */ "./packages/mdc-form-field/index.ts"));
  167. exports.formField = formField;
  168. var iconButton = __importStar(__webpack_require__(/*! @material/icon-button/index */ "./packages/mdc-icon-button/index.ts"));
  169. exports.iconButton = iconButton;
  170. var lineRipple = __importStar(__webpack_require__(/*! @material/line-ripple/index */ "./packages/mdc-line-ripple/index.ts"));
  171. exports.lineRipple = lineRipple;
  172. var linearProgress = __importStar(__webpack_require__(/*! @material/linear-progress/index */ "./packages/mdc-linear-progress/index.ts"));
  173. exports.linearProgress = linearProgress;
  174. var list = __importStar(__webpack_require__(/*! @material/list/index */ "./packages/mdc-list/index.ts"));
  175. exports.list = list;
  176. var menuSurface = __importStar(__webpack_require__(/*! @material/menu-surface/index */ "./packages/mdc-menu-surface/index.ts"));
  177. exports.menuSurface = menuSurface;
  178. var menu = __importStar(__webpack_require__(/*! @material/menu/index */ "./packages/mdc-menu/index.ts"));
  179. exports.menu = menu;
  180. var notchedOutline = __importStar(__webpack_require__(/*! @material/notched-outline/index */ "./packages/mdc-notched-outline/index.ts"));
  181. exports.notchedOutline = notchedOutline;
  182. var radio = __importStar(__webpack_require__(/*! @material/radio/index */ "./packages/mdc-radio/index.ts"));
  183. exports.radio = radio;
  184. var ripple = __importStar(__webpack_require__(/*! @material/ripple/index */ "./packages/mdc-ripple/index.ts"));
  185. exports.ripple = ripple;
  186. var select = __importStar(__webpack_require__(/*! @material/select/index */ "./packages/mdc-select/index.ts"));
  187. exports.select = select;
  188. var slider = __importStar(__webpack_require__(/*! @material/slider/index */ "./packages/mdc-slider/index.ts"));
  189. exports.slider = slider;
  190. var snackbar = __importStar(__webpack_require__(/*! @material/snackbar/index */ "./packages/mdc-snackbar/index.ts"));
  191. exports.snackbar = snackbar;
  192. var switchControl = __importStar(__webpack_require__(/*! @material/switch/index */ "./packages/mdc-switch/index.ts"));
  193. exports.switchControl = switchControl;
  194. var tabBar = __importStar(__webpack_require__(/*! @material/tab-bar/index */ "./packages/mdc-tab-bar/index.ts"));
  195. exports.tabBar = tabBar;
  196. var tabIndicator = __importStar(__webpack_require__(/*! @material/tab-indicator/index */ "./packages/mdc-tab-indicator/index.ts"));
  197. exports.tabIndicator = tabIndicator;
  198. var tabScroller = __importStar(__webpack_require__(/*! @material/tab-scroller/index */ "./packages/mdc-tab-scroller/index.ts"));
  199. exports.tabScroller = tabScroller;
  200. var tab = __importStar(__webpack_require__(/*! @material/tab/index */ "./packages/mdc-tab/index.ts"));
  201. exports.tab = tab;
  202. var textField = __importStar(__webpack_require__(/*! @material/textfield/index */ "./packages/mdc-textfield/index.ts"));
  203. exports.textField = textField;
  204. var topAppBar = __importStar(__webpack_require__(/*! @material/top-app-bar/index */ "./packages/mdc-top-app-bar/index.ts"));
  205. exports.topAppBar = topAppBar;
  206. // Register all components
  207. index_1.default.register('MDCCheckbox', checkbox.MDCCheckbox);
  208. index_1.default.register('MDCChip', chips.MDCChip);
  209. index_1.default.register('MDCChipSet', chips.MDCChipSet);
  210. index_1.default.register('MDCCircularProgress', circularProgress.MDCCircularProgress);
  211. index_1.default.register('MDCDataTable', dataTable.MDCDataTable);
  212. index_1.default.register('MDCDialog', dialog.MDCDialog);
  213. index_1.default.register('MDCDrawer', drawer.MDCDrawer);
  214. index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel);
  215. index_1.default.register('MDCFormField', formField.MDCFormField);
  216. index_1.default.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle);
  217. index_1.default.register('MDCLineRipple', lineRipple.MDCLineRipple);
  218. index_1.default.register('MDCLinearProgress', linearProgress.MDCLinearProgress);
  219. index_1.default.register('MDCList', list.MDCList);
  220. index_1.default.register('MDCMenu', menu.MDCMenu);
  221. index_1.default.register('MDCMenuSurface', menuSurface.MDCMenuSurface);
  222. index_1.default.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline);
  223. index_1.default.register('MDCRadio', radio.MDCRadio);
  224. index_1.default.register('MDCRipple', ripple.MDCRipple);
  225. index_1.default.register('MDCSelect', select.MDCSelect);
  226. index_1.default.register('MDCSlider', slider.MDCSlider);
  227. index_1.default.register('MDCSnackbar', snackbar.MDCSnackbar);
  228. index_1.default.register('MDCSwitch', switchControl.MDCSwitch);
  229. index_1.default.register('MDCTabBar', tabBar.MDCTabBar);
  230. index_1.default.register('MDCTextField', textField.MDCTextField);
  231. index_1.default.register('MDCTopAppBar', topAppBar.MDCTopAppBar);
  232. /***/ }),
  233. /***/ "./packages/mdc-animation/util.ts":
  234. /*!****************************************!*\
  235. !*** ./packages/mdc-animation/util.ts ***!
  236. \****************************************/
  237. /*! no static exports found */
  238. /***/ (function(module, exports, __webpack_require__) {
  239. "use strict";
  240. /**
  241. * @license
  242. * Copyright 2016 Google Inc.
  243. *
  244. * Permission is hereby granted, free of charge, to any person obtaining a copy
  245. * of this software and associated documentation files (the "Software"), to deal
  246. * in the Software without restriction, including without limitation the rights
  247. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  248. * copies of the Software, and to permit persons to whom the Software is
  249. * furnished to do so, subject to the following conditions:
  250. *
  251. * The above copyright notice and this permission notice shall be included in
  252. * all copies or substantial portions of the Software.
  253. *
  254. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  255. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  256. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  257. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  258. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  259. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  260. * THE SOFTWARE.
  261. */
  262. Object.defineProperty(exports, "__esModule", { value: true });
  263. var cssPropertyNameMap = {
  264. animation: {
  265. prefixed: '-webkit-animation',
  266. standard: 'animation'
  267. },
  268. transform: {
  269. prefixed: '-webkit-transform',
  270. standard: 'transform'
  271. },
  272. transition: {
  273. prefixed: '-webkit-transition',
  274. standard: 'transition'
  275. }
  276. };
  277. var jsEventTypeMap = {
  278. animationend: {
  279. cssProperty: 'animation',
  280. prefixed: 'webkitAnimationEnd',
  281. standard: 'animationend'
  282. },
  283. animationiteration: {
  284. cssProperty: 'animation',
  285. prefixed: 'webkitAnimationIteration',
  286. standard: 'animationiteration'
  287. },
  288. animationstart: {
  289. cssProperty: 'animation',
  290. prefixed: 'webkitAnimationStart',
  291. standard: 'animationstart'
  292. },
  293. transitionend: {
  294. cssProperty: 'transition',
  295. prefixed: 'webkitTransitionEnd',
  296. standard: 'transitionend'
  297. }
  298. };
  299. function isWindow(windowObj) {
  300. return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
  301. }
  302. function getCorrectPropertyName(windowObj, cssProperty) {
  303. if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
  304. var el = windowObj.document.createElement('div');
  305. var _a = cssPropertyNameMap[cssProperty],
  306. standard = _a.standard,
  307. prefixed = _a.prefixed;
  308. var isStandard = standard in el.style;
  309. return isStandard ? standard : prefixed;
  310. }
  311. return cssProperty;
  312. }
  313. exports.getCorrectPropertyName = getCorrectPropertyName;
  314. function getCorrectEventName(windowObj, eventType) {
  315. if (isWindow(windowObj) && eventType in jsEventTypeMap) {
  316. var el = windowObj.document.createElement('div');
  317. var _a = jsEventTypeMap[eventType],
  318. standard = _a.standard,
  319. prefixed = _a.prefixed,
  320. cssProperty = _a.cssProperty;
  321. var isStandard = cssProperty in el.style;
  322. return isStandard ? standard : prefixed;
  323. }
  324. return eventType;
  325. }
  326. exports.getCorrectEventName = getCorrectEventName;
  327. /***/ }),
  328. /***/ "./packages/mdc-auto-init/constants.ts":
  329. /*!*********************************************!*\
  330. !*** ./packages/mdc-auto-init/constants.ts ***!
  331. \*********************************************/
  332. /*! no static exports found */
  333. /***/ (function(module, exports, __webpack_require__) {
  334. "use strict";
  335. /**
  336. * @license
  337. * Copyright 2019 Google Inc.
  338. *
  339. * Permission is hereby granted, free of charge, to any person obtaining a copy
  340. * of this software and associated documentation files (the "Software"), to deal
  341. * in the Software without restriction, including without limitation the rights
  342. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  343. * copies of the Software, and to permit persons to whom the Software is
  344. * furnished to do so, subject to the following conditions:
  345. *
  346. * The above copyright notice and this permission notice shall be included in
  347. * all copies or substantial portions of the Software.
  348. *
  349. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  350. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  351. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  352. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  353. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  354. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  355. * THE SOFTWARE.
  356. */
  357. Object.defineProperty(exports, "__esModule", { value: true });
  358. exports.strings = {
  359. AUTO_INIT_ATTR: 'data-mdc-auto-init',
  360. AUTO_INIT_STATE_ATTR: 'data-mdc-auto-init-state',
  361. INITIALIZED_STATE: 'initialized'
  362. };
  363. /***/ }),
  364. /***/ "./packages/mdc-auto-init/index.ts":
  365. /*!*****************************************!*\
  366. !*** ./packages/mdc-auto-init/index.ts ***!
  367. \*****************************************/
  368. /*! no static exports found */
  369. /***/ (function(module, exports, __webpack_require__) {
  370. "use strict";
  371. /**
  372. * @license
  373. * Copyright 2016 Google Inc.
  374. *
  375. * Permission is hereby granted, free of charge, to any person obtaining a copy
  376. * of this software and associated documentation files (the "Software"), to deal
  377. * in the Software without restriction, including without limitation the rights
  378. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  379. * copies of the Software, and to permit persons to whom the Software is
  380. * furnished to do so, subject to the following conditions:
  381. *
  382. * The above copyright notice and this permission notice shall be included in
  383. * all copies or substantial portions of the Software.
  384. *
  385. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  386. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  387. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  388. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  389. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  390. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  391. * THE SOFTWARE.
  392. */
  393. var __values = this && this.__values || function (o) {
  394. var s = typeof Symbol === "function" && Symbol.iterator,
  395. m = s && o[s],
  396. i = 0;
  397. if (m) return m.call(o);
  398. if (o && typeof o.length === "number") return {
  399. next: function next() {
  400. if (o && i >= o.length) o = void 0;
  401. return { value: o && o[i++], done: !o };
  402. }
  403. };
  404. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  405. };
  406. Object.defineProperty(exports, "__esModule", { value: true });
  407. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-auto-init/constants.ts");
  408. var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR,
  409. AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR,
  410. INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE;
  411. var registry = {};
  412. var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console
  413. function emit(evtType, evtData, shouldBubble) {
  414. if (shouldBubble === void 0) {
  415. shouldBubble = false;
  416. }
  417. var evt;
  418. if (typeof CustomEvent === 'function') {
  419. evt = new CustomEvent(evtType, {
  420. bubbles: shouldBubble,
  421. detail: evtData
  422. });
  423. } else {
  424. evt = document.createEvent('CustomEvent');
  425. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  426. }
  427. document.dispatchEvent(evt);
  428. }
  429. /* istanbul ignore next: optional argument is not a branch statement */
  430. /**
  431. * Auto-initializes all MDC components on a page.
  432. */
  433. function mdcAutoInit(root) {
  434. var e_1, _a;
  435. if (root === void 0) {
  436. root = document;
  437. }
  438. var components = [];
  439. var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]"));
  440. nodes = nodes.filter(function (node) {
  441. return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE;
  442. });
  443. try {
  444. for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
  445. var node = nodes_1_1.value;
  446. var ctorName = node.getAttribute(AUTO_INIT_ATTR);
  447. if (!ctorName) {
  448. throw new Error('(mdc-auto-init) Constructor name must be given.');
  449. }
  450. var Constructor = registry[ctorName]; // tslint:disable-line:variable-name
  451. if (typeof Constructor !== 'function') {
  452. throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName);
  453. }
  454. // TODO: Should we make an eslint rule for an attachTo() static method?
  455. // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS
  456. var component = Constructor.attachTo(node);
  457. Object.defineProperty(node, ctorName, {
  458. configurable: true,
  459. enumerable: false,
  460. value: component,
  461. writable: false
  462. });
  463. components.push(component);
  464. node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE);
  465. }
  466. } catch (e_1_1) {
  467. e_1 = { error: e_1_1 };
  468. } finally {
  469. try {
  470. if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
  471. } finally {
  472. if (e_1) throw e_1.error;
  473. }
  474. }
  475. emit('MDCAutoInit:End', {});
  476. return components;
  477. }
  478. exports.mdcAutoInit = mdcAutoInit;
  479. // Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class.
  480. // tslint:disable-next-line:variable-name
  481. mdcAutoInit.register = function (componentName, Constructor, warn) {
  482. if (warn === void 0) {
  483. warn = CONSOLE_WARN;
  484. }
  485. if (typeof Constructor !== 'function') {
  486. throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function.");
  487. }
  488. var registryValue = registry[componentName];
  489. if (registryValue) {
  490. warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue);
  491. }
  492. registry[componentName] = Constructor;
  493. };
  494. mdcAutoInit.deregister = function (componentName) {
  495. delete registry[componentName];
  496. };
  497. /** @nocollapse */
  498. mdcAutoInit.deregisterAll = function () {
  499. var keys = Object.keys(registry);
  500. keys.forEach(this.deregister, this);
  501. };
  502. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  503. exports.default = mdcAutoInit;
  504. /***/ }),
  505. /***/ "./packages/mdc-base/component.ts":
  506. /*!****************************************!*\
  507. !*** ./packages/mdc-base/component.ts ***!
  508. \****************************************/
  509. /*! no static exports found */
  510. /***/ (function(module, exports, __webpack_require__) {
  511. "use strict";
  512. /**
  513. * @license
  514. * Copyright 2016 Google Inc.
  515. *
  516. * Permission is hereby granted, free of charge, to any person obtaining a copy
  517. * of this software and associated documentation files (the "Software"), to deal
  518. * in the Software without restriction, including without limitation the rights
  519. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  520. * copies of the Software, and to permit persons to whom the Software is
  521. * furnished to do so, subject to the following conditions:
  522. *
  523. * The above copyright notice and this permission notice shall be included in
  524. * all copies or substantial portions of the Software.
  525. *
  526. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  527. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  528. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  529. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  530. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  531. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  532. * THE SOFTWARE.
  533. */
  534. var __read = this && this.__read || function (o, n) {
  535. var m = typeof Symbol === "function" && o[Symbol.iterator];
  536. if (!m) return o;
  537. var i = m.call(o),
  538. r,
  539. ar = [],
  540. e;
  541. try {
  542. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  543. ar.push(r.value);
  544. }
  545. } catch (error) {
  546. e = { error: error };
  547. } finally {
  548. try {
  549. if (r && !r.done && (m = i["return"])) m.call(i);
  550. } finally {
  551. if (e) throw e.error;
  552. }
  553. }
  554. return ar;
  555. };
  556. var __spread = this && this.__spread || function () {
  557. for (var ar = [], i = 0; i < arguments.length; i++) {
  558. ar = ar.concat(__read(arguments[i]));
  559. }return ar;
  560. };
  561. Object.defineProperty(exports, "__esModule", { value: true });
  562. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
  563. var MDCComponent = /** @class */function () {
  564. function MDCComponent(root, foundation) {
  565. var args = [];
  566. for (var _i = 2; _i < arguments.length; _i++) {
  567. args[_i - 2] = arguments[_i];
  568. }
  569. this.root = root;
  570. this.initialize.apply(this, __spread(args));
  571. // Note that we initialize foundation here and not within the constructor's default param so that
  572. // this.root_ is defined and can be used within the foundation class.
  573. this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
  574. this.foundation.init();
  575. this.initialSyncWithDOM();
  576. }
  577. MDCComponent.attachTo = function (root) {
  578. // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
  579. // returns an instantiated component with its root set to that element. Also note that in the cases of
  580. // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
  581. // from getDefaultFoundation().
  582. return new MDCComponent(root, new foundation_1.MDCFoundation({}));
  583. };
  584. /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
  585. MDCComponent.prototype.initialize = function () {
  586. var _args = [];
  587. for (var _i = 0; _i < arguments.length; _i++) {
  588. _args[_i] = arguments[_i];
  589. }
  590. // Subclasses can override this to do any additional setup work that would be considered part of a
  591. // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
  592. // initialized. Any additional arguments besides root and foundation will be passed in here.
  593. };
  594. MDCComponent.prototype.getDefaultFoundation = function () {
  595. // Subclasses must override this method to return a properly configured foundation class for the
  596. // component.
  597. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
  598. };
  599. MDCComponent.prototype.initialSyncWithDOM = function () {
  600. // Subclasses should override this method if they need to perform work to synchronize with a host DOM
  601. // object. An example of this would be a form control wrapper that needs to synchronize its internal state
  602. // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
  603. // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
  604. };
  605. MDCComponent.prototype.destroy = function () {
  606. // Subclasses may implement this method to release any resources / deregister any listeners they have
  607. // attached. An example of this might be deregistering a resize event from the window object.
  608. this.foundation.destroy();
  609. };
  610. MDCComponent.prototype.listen = function (evtType, handler, options) {
  611. this.root.addEventListener(evtType, handler, options);
  612. };
  613. MDCComponent.prototype.unlisten = function (evtType, handler, options) {
  614. this.root.removeEventListener(evtType, handler, options);
  615. };
  616. /**
  617. * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
  618. */
  619. MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
  620. if (shouldBubble === void 0) {
  621. shouldBubble = false;
  622. }
  623. var evt;
  624. if (typeof CustomEvent === 'function') {
  625. evt = new CustomEvent(evtType, {
  626. bubbles: shouldBubble,
  627. detail: evtData
  628. });
  629. } else {
  630. evt = document.createEvent('CustomEvent');
  631. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  632. }
  633. this.root.dispatchEvent(evt);
  634. };
  635. return MDCComponent;
  636. }();
  637. exports.MDCComponent = MDCComponent;
  638. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  639. exports.default = MDCComponent;
  640. /***/ }),
  641. /***/ "./packages/mdc-base/foundation.ts":
  642. /*!*****************************************!*\
  643. !*** ./packages/mdc-base/foundation.ts ***!
  644. \*****************************************/
  645. /*! no static exports found */
  646. /***/ (function(module, exports, __webpack_require__) {
  647. "use strict";
  648. /**
  649. * @license
  650. * Copyright 2016 Google Inc.
  651. *
  652. * Permission is hereby granted, free of charge, to any person obtaining a copy
  653. * of this software and associated documentation files (the "Software"), to deal
  654. * in the Software without restriction, including without limitation the rights
  655. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  656. * copies of the Software, and to permit persons to whom the Software is
  657. * furnished to do so, subject to the following conditions:
  658. *
  659. * The above copyright notice and this permission notice shall be included in
  660. * all copies or substantial portions of the Software.
  661. *
  662. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  663. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  664. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  665. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  666. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  667. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  668. * THE SOFTWARE.
  669. */
  670. Object.defineProperty(exports, "__esModule", { value: true });
  671. var MDCFoundation = /** @class */function () {
  672. function MDCFoundation(adapter) {
  673. if (adapter === void 0) {
  674. adapter = {};
  675. }
  676. this.adapter = adapter;
  677. }
  678. Object.defineProperty(MDCFoundation, "cssClasses", {
  679. get: function get() {
  680. // Classes extending MDCFoundation should implement this method to return an object which exports every
  681. // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
  682. return {};
  683. },
  684. enumerable: true,
  685. configurable: true
  686. });
  687. Object.defineProperty(MDCFoundation, "strings", {
  688. get: function get() {
  689. // Classes extending MDCFoundation should implement this method to return an object which exports all
  690. // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
  691. return {};
  692. },
  693. enumerable: true,
  694. configurable: true
  695. });
  696. Object.defineProperty(MDCFoundation, "numbers", {
  697. get: function get() {
  698. // Classes extending MDCFoundation should implement this method to return an object which exports all
  699. // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
  700. return {};
  701. },
  702. enumerable: true,
  703. configurable: true
  704. });
  705. Object.defineProperty(MDCFoundation, "defaultAdapter", {
  706. get: function get() {
  707. // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
  708. // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
  709. // validation.
  710. return {};
  711. },
  712. enumerable: true,
  713. configurable: true
  714. });
  715. MDCFoundation.prototype.init = function () {
  716. // Subclasses should override this method to perform initialization routines (registering events, etc.)
  717. };
  718. MDCFoundation.prototype.destroy = function () {
  719. // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
  720. };
  721. return MDCFoundation;
  722. }();
  723. exports.MDCFoundation = MDCFoundation;
  724. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  725. exports.default = MDCFoundation;
  726. /***/ }),
  727. /***/ "./packages/mdc-base/index.ts":
  728. /*!************************************!*\
  729. !*** ./packages/mdc-base/index.ts ***!
  730. \************************************/
  731. /*! no static exports found */
  732. /***/ (function(module, exports, __webpack_require__) {
  733. "use strict";
  734. /**
  735. * @license
  736. * Copyright 2019 Google Inc.
  737. *
  738. * Permission is hereby granted, free of charge, to any person obtaining a copy
  739. * of this software and associated documentation files (the "Software"), to deal
  740. * in the Software without restriction, including without limitation the rights
  741. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  742. * copies of the Software, and to permit persons to whom the Software is
  743. * furnished to do so, subject to the following conditions:
  744. *
  745. * The above copyright notice and this permission notice shall be included in
  746. * all copies or substantial portions of the Software.
  747. *
  748. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  749. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  750. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  751. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  752. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  753. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  754. * THE SOFTWARE.
  755. */
  756. function __export(m) {
  757. for (var p in m) {
  758. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  759. }
  760. }
  761. Object.defineProperty(exports, "__esModule", { value: true });
  762. __export(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts"));
  763. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"));
  764. /***/ }),
  765. /***/ "./packages/mdc-checkbox/component.ts":
  766. /*!********************************************!*\
  767. !*** ./packages/mdc-checkbox/component.ts ***!
  768. \********************************************/
  769. /*! no static exports found */
  770. /***/ (function(module, exports, __webpack_require__) {
  771. "use strict";
  772. /**
  773. * @license
  774. * Copyright 2016 Google Inc.
  775. *
  776. * Permission is hereby granted, free of charge, to any person obtaining a copy
  777. * of this software and associated documentation files (the "Software"), to deal
  778. * in the Software without restriction, including without limitation the rights
  779. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  780. * copies of the Software, and to permit persons to whom the Software is
  781. * furnished to do so, subject to the following conditions:
  782. *
  783. * The above copyright notice and this permission notice shall be included in
  784. * all copies or substantial portions of the Software.
  785. *
  786. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  787. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  788. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  789. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  790. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  791. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  792. * THE SOFTWARE.
  793. */
  794. var __extends = this && this.__extends || function () {
  795. var _extendStatics = function extendStatics(d, b) {
  796. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  797. d.__proto__ = b;
  798. } || function (d, b) {
  799. for (var p in b) {
  800. if (b.hasOwnProperty(p)) d[p] = b[p];
  801. }
  802. };
  803. return _extendStatics(d, b);
  804. };
  805. return function (d, b) {
  806. _extendStatics(d, b);
  807. function __() {
  808. this.constructor = d;
  809. }
  810. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  811. };
  812. }();
  813. var __assign = this && this.__assign || function () {
  814. __assign = Object.assign || function (t) {
  815. for (var s, i = 1, n = arguments.length; i < n; i++) {
  816. s = arguments[i];
  817. for (var p in s) {
  818. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  819. }
  820. }
  821. return t;
  822. };
  823. return __assign.apply(this, arguments);
  824. };
  825. Object.defineProperty(exports, "__esModule", { value: true });
  826. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  827. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  828. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  829. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  830. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  831. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  832. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  833. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts");
  834. var CB_PROTO_PROPS = ['checked', 'indeterminate'];
  835. var MDCCheckbox = /** @class */function (_super) {
  836. __extends(MDCCheckbox, _super);
  837. function MDCCheckbox() {
  838. var _this = _super !== null && _super.apply(this, arguments) || this;
  839. _this.ripple_ = _this.createRipple_();
  840. return _this;
  841. }
  842. MDCCheckbox.attachTo = function (root) {
  843. return new MDCCheckbox(root);
  844. };
  845. Object.defineProperty(MDCCheckbox.prototype, "ripple", {
  846. get: function get() {
  847. return this.ripple_;
  848. },
  849. enumerable: true,
  850. configurable: true
  851. });
  852. Object.defineProperty(MDCCheckbox.prototype, "checked", {
  853. get: function get() {
  854. return this.nativeControl_.checked;
  855. },
  856. set: function set(checked) {
  857. this.nativeControl_.checked = checked;
  858. },
  859. enumerable: true,
  860. configurable: true
  861. });
  862. Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
  863. get: function get() {
  864. return this.nativeControl_.indeterminate;
  865. },
  866. set: function set(indeterminate) {
  867. this.nativeControl_.indeterminate = indeterminate;
  868. },
  869. enumerable: true,
  870. configurable: true
  871. });
  872. Object.defineProperty(MDCCheckbox.prototype, "disabled", {
  873. get: function get() {
  874. return this.nativeControl_.disabled;
  875. },
  876. set: function set(disabled) {
  877. this.foundation.setDisabled(disabled);
  878. },
  879. enumerable: true,
  880. configurable: true
  881. });
  882. Object.defineProperty(MDCCheckbox.prototype, "value", {
  883. get: function get() {
  884. return this.nativeControl_.value;
  885. },
  886. set: function set(value) {
  887. this.nativeControl_.value = value;
  888. },
  889. enumerable: true,
  890. configurable: true
  891. });
  892. MDCCheckbox.prototype.initialize = function () {
  893. var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR;
  894. this.nativeControl_.indeterminate = this.nativeControl_.getAttribute(DATA_INDETERMINATE_ATTR) === 'true';
  895. this.nativeControl_.removeAttribute(DATA_INDETERMINATE_ATTR);
  896. };
  897. MDCCheckbox.prototype.initialSyncWithDOM = function () {
  898. var _this = this;
  899. this.handleChange_ = function () {
  900. return _this.foundation.handleChange();
  901. };
  902. this.handleAnimationEnd_ = function () {
  903. return _this.foundation.handleAnimationEnd();
  904. };
  905. this.nativeControl_.addEventListener('change', this.handleChange_);
  906. this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
  907. this.installPropertyChangeHooks_();
  908. };
  909. MDCCheckbox.prototype.destroy = function () {
  910. this.ripple_.destroy();
  911. this.nativeControl_.removeEventListener('change', this.handleChange_);
  912. this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
  913. this.uninstallPropertyChangeHooks_();
  914. _super.prototype.destroy.call(this);
  915. };
  916. MDCCheckbox.prototype.getDefaultFoundation = function () {
  917. var _this = this;
  918. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  919. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  920. var adapter = {
  921. addClass: function addClass(className) {
  922. return _this.root.classList.add(className);
  923. },
  924. forceLayout: function forceLayout() {
  925. return _this.root.offsetWidth;
  926. },
  927. hasNativeControl: function hasNativeControl() {
  928. return !!_this.nativeControl_;
  929. },
  930. isAttachedToDOM: function isAttachedToDOM() {
  931. return Boolean(_this.root.parentNode);
  932. },
  933. isChecked: function isChecked() {
  934. return _this.checked;
  935. },
  936. isIndeterminate: function isIndeterminate() {
  937. return _this.indeterminate;
  938. },
  939. removeClass: function removeClass(className) {
  940. _this.root.classList.remove(className);
  941. },
  942. removeNativeControlAttr: function removeNativeControlAttr(attr) {
  943. _this.nativeControl_.removeAttribute(attr);
  944. },
  945. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  946. _this.nativeControl_.setAttribute(attr, value);
  947. },
  948. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  949. _this.nativeControl_.disabled = disabled;
  950. }
  951. };
  952. return new foundation_2.MDCCheckboxFoundation(adapter);
  953. };
  954. MDCCheckbox.prototype.createRipple_ = function () {
  955. var _this = this;
  956. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  957. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  958. var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  959. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  960. }, isSurfaceActive: function isSurfaceActive() {
  961. return ponyfill_1.matches(_this.nativeControl_, ':active');
  962. }, isUnbounded: function isUnbounded() {
  963. return true;
  964. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  965. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  966. } });
  967. return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
  968. };
  969. MDCCheckbox.prototype.installPropertyChangeHooks_ = function () {
  970. var _this = this;
  971. var nativeCb = this.nativeControl_;
  972. var cbProto = Object.getPrototypeOf(nativeCb);
  973. CB_PROTO_PROPS.forEach(function (controlState) {
  974. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  975. // We have to check for this descriptor, since some browsers (Safari) don't support its return.
  976. // See: https://bugs.webkit.org/show_bug.cgi?id=49739
  977. if (!validDescriptor(desc)) {
  978. return;
  979. }
  980. // Type cast is needed for compatibility with Closure Compiler.
  981. var nativeGetter = desc.get;
  982. var nativeCbDesc = {
  983. configurable: desc.configurable,
  984. enumerable: desc.enumerable,
  985. get: nativeGetter,
  986. set: function set(state) {
  987. desc.set.call(nativeCb, state);
  988. _this.foundation.handleChange();
  989. }
  990. };
  991. Object.defineProperty(nativeCb, controlState, nativeCbDesc);
  992. });
  993. };
  994. MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () {
  995. var nativeCb = this.nativeControl_;
  996. var cbProto = Object.getPrototypeOf(nativeCb);
  997. CB_PROTO_PROPS.forEach(function (controlState) {
  998. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  999. if (!validDescriptor(desc)) {
  1000. return;
  1001. }
  1002. Object.defineProperty(nativeCb, controlState, desc);
  1003. });
  1004. };
  1005. Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", {
  1006. get: function get() {
  1007. var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR;
  1008. var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
  1009. if (!el) {
  1010. throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  1011. }
  1012. return el;
  1013. },
  1014. enumerable: true,
  1015. configurable: true
  1016. });
  1017. return MDCCheckbox;
  1018. }(component_1.MDCComponent);
  1019. exports.MDCCheckbox = MDCCheckbox;
  1020. function validDescriptor(inputPropDesc) {
  1021. return !!inputPropDesc && typeof inputPropDesc.set === 'function';
  1022. }
  1023. /***/ }),
  1024. /***/ "./packages/mdc-checkbox/constants.ts":
  1025. /*!********************************************!*\
  1026. !*** ./packages/mdc-checkbox/constants.ts ***!
  1027. \********************************************/
  1028. /*! no static exports found */
  1029. /***/ (function(module, exports, __webpack_require__) {
  1030. "use strict";
  1031. /**
  1032. * @license
  1033. * Copyright 2016 Google Inc.
  1034. *
  1035. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1036. * of this software and associated documentation files (the "Software"), to deal
  1037. * in the Software without restriction, including without limitation the rights
  1038. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1039. * copies of the Software, and to permit persons to whom the Software is
  1040. * furnished to do so, subject to the following conditions:
  1041. *
  1042. * The above copyright notice and this permission notice shall be included in
  1043. * all copies or substantial portions of the Software.
  1044. *
  1045. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1046. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1047. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1048. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1049. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1050. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1051. * THE SOFTWARE.
  1052. */
  1053. Object.defineProperty(exports, "__esModule", { value: true });
  1054. exports.cssClasses = {
  1055. ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
  1056. ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
  1057. ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
  1058. ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
  1059. ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
  1060. ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
  1061. BACKGROUND: 'mdc-checkbox__background',
  1062. CHECKED: 'mdc-checkbox--checked',
  1063. CHECKMARK: 'mdc-checkbox__checkmark',
  1064. CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
  1065. DISABLED: 'mdc-checkbox--disabled',
  1066. INDETERMINATE: 'mdc-checkbox--indeterminate',
  1067. MIXEDMARK: 'mdc-checkbox__mixedmark',
  1068. NATIVE_CONTROL: 'mdc-checkbox__native-control',
  1069. ROOT: 'mdc-checkbox',
  1070. SELECTED: 'mdc-checkbox--selected',
  1071. UPGRADED: 'mdc-checkbox--upgraded'
  1072. };
  1073. exports.strings = {
  1074. ARIA_CHECKED_ATTR: 'aria-checked',
  1075. ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
  1076. DATA_INDETERMINATE_ATTR: 'data-indeterminate',
  1077. NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
  1078. TRANSITION_STATE_CHECKED: 'checked',
  1079. TRANSITION_STATE_INDETERMINATE: 'indeterminate',
  1080. TRANSITION_STATE_INIT: 'init',
  1081. TRANSITION_STATE_UNCHECKED: 'unchecked'
  1082. };
  1083. exports.numbers = {
  1084. ANIM_END_LATCH_MS: 250
  1085. };
  1086. /***/ }),
  1087. /***/ "./packages/mdc-checkbox/foundation.ts":
  1088. /*!*********************************************!*\
  1089. !*** ./packages/mdc-checkbox/foundation.ts ***!
  1090. \*********************************************/
  1091. /*! no static exports found */
  1092. /***/ (function(module, exports, __webpack_require__) {
  1093. "use strict";
  1094. /**
  1095. * @license
  1096. * Copyright 2016 Google Inc.
  1097. *
  1098. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1099. * of this software and associated documentation files (the "Software"), to deal
  1100. * in the Software without restriction, including without limitation the rights
  1101. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1102. * copies of the Software, and to permit persons to whom the Software is
  1103. * furnished to do so, subject to the following conditions:
  1104. *
  1105. * The above copyright notice and this permission notice shall be included in
  1106. * all copies or substantial portions of the Software.
  1107. *
  1108. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1109. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1110. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1111. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1112. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1113. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1114. * THE SOFTWARE.
  1115. */
  1116. var __extends = this && this.__extends || function () {
  1117. var _extendStatics = function extendStatics(d, b) {
  1118. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1119. d.__proto__ = b;
  1120. } || function (d, b) {
  1121. for (var p in b) {
  1122. if (b.hasOwnProperty(p)) d[p] = b[p];
  1123. }
  1124. };
  1125. return _extendStatics(d, b);
  1126. };
  1127. return function (d, b) {
  1128. _extendStatics(d, b);
  1129. function __() {
  1130. this.constructor = d;
  1131. }
  1132. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1133. };
  1134. }();
  1135. var __assign = this && this.__assign || function () {
  1136. __assign = Object.assign || function (t) {
  1137. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1138. s = arguments[i];
  1139. for (var p in s) {
  1140. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1141. }
  1142. }
  1143. return t;
  1144. };
  1145. return __assign.apply(this, arguments);
  1146. };
  1147. Object.defineProperty(exports, "__esModule", { value: true });
  1148. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  1149. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  1150. var MDCCheckboxFoundation = /** @class */function (_super) {
  1151. __extends(MDCCheckboxFoundation, _super);
  1152. function MDCCheckboxFoundation(adapter) {
  1153. var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this;
  1154. _this.currentCheckState_ = constants_1.strings.TRANSITION_STATE_INIT;
  1155. _this.currentAnimationClass_ = '';
  1156. _this.animEndLatchTimer_ = 0;
  1157. _this.enableAnimationEndHandler_ = false;
  1158. return _this;
  1159. }
  1160. Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
  1161. get: function get() {
  1162. return constants_1.cssClasses;
  1163. },
  1164. enumerable: true,
  1165. configurable: true
  1166. });
  1167. Object.defineProperty(MDCCheckboxFoundation, "strings", {
  1168. get: function get() {
  1169. return constants_1.strings;
  1170. },
  1171. enumerable: true,
  1172. configurable: true
  1173. });
  1174. Object.defineProperty(MDCCheckboxFoundation, "numbers", {
  1175. get: function get() {
  1176. return constants_1.numbers;
  1177. },
  1178. enumerable: true,
  1179. configurable: true
  1180. });
  1181. Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
  1182. get: function get() {
  1183. return {
  1184. addClass: function addClass() {
  1185. return undefined;
  1186. },
  1187. forceLayout: function forceLayout() {
  1188. return undefined;
  1189. },
  1190. hasNativeControl: function hasNativeControl() {
  1191. return false;
  1192. },
  1193. isAttachedToDOM: function isAttachedToDOM() {
  1194. return false;
  1195. },
  1196. isChecked: function isChecked() {
  1197. return false;
  1198. },
  1199. isIndeterminate: function isIndeterminate() {
  1200. return false;
  1201. },
  1202. removeClass: function removeClass() {
  1203. return undefined;
  1204. },
  1205. removeNativeControlAttr: function removeNativeControlAttr() {
  1206. return undefined;
  1207. },
  1208. setNativeControlAttr: function setNativeControlAttr() {
  1209. return undefined;
  1210. },
  1211. setNativeControlDisabled: function setNativeControlDisabled() {
  1212. return undefined;
  1213. }
  1214. };
  1215. },
  1216. enumerable: true,
  1217. configurable: true
  1218. });
  1219. MDCCheckboxFoundation.prototype.init = function () {
  1220. this.currentCheckState_ = this.determineCheckState_();
  1221. this.updateAriaChecked_();
  1222. this.adapter.addClass(constants_1.cssClasses.UPGRADED);
  1223. };
  1224. MDCCheckboxFoundation.prototype.destroy = function () {
  1225. clearTimeout(this.animEndLatchTimer_);
  1226. };
  1227. MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
  1228. this.adapter.setNativeControlDisabled(disabled);
  1229. if (disabled) {
  1230. this.adapter.addClass(constants_1.cssClasses.DISABLED);
  1231. } else {
  1232. this.adapter.removeClass(constants_1.cssClasses.DISABLED);
  1233. }
  1234. };
  1235. /**
  1236. * Handles the animationend event for the checkbox
  1237. */
  1238. MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
  1239. var _this = this;
  1240. if (!this.enableAnimationEndHandler_) {
  1241. return;
  1242. }
  1243. clearTimeout(this.animEndLatchTimer_);
  1244. this.animEndLatchTimer_ = setTimeout(function () {
  1245. _this.adapter.removeClass(_this.currentAnimationClass_);
  1246. _this.enableAnimationEndHandler_ = false;
  1247. }, constants_1.numbers.ANIM_END_LATCH_MS);
  1248. };
  1249. /**
  1250. * Handles the change event for the checkbox
  1251. */
  1252. MDCCheckboxFoundation.prototype.handleChange = function () {
  1253. this.transitionCheckState_();
  1254. };
  1255. MDCCheckboxFoundation.prototype.transitionCheckState_ = function () {
  1256. if (!this.adapter.hasNativeControl()) {
  1257. return;
  1258. }
  1259. var oldState = this.currentCheckState_;
  1260. var newState = this.determineCheckState_();
  1261. if (oldState === newState) {
  1262. return;
  1263. }
  1264. this.updateAriaChecked_();
  1265. var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1266. var SELECTED = constants_1.cssClasses.SELECTED;
  1267. if (newState === TRANSITION_STATE_UNCHECKED) {
  1268. this.adapter.removeClass(SELECTED);
  1269. } else {
  1270. this.adapter.addClass(SELECTED);
  1271. }
  1272. // Check to ensure that there isn't a previously existing animation class, in case for example
  1273. // the user interacted with the checkbox before the animation was finished.
  1274. if (this.currentAnimationClass_.length > 0) {
  1275. clearTimeout(this.animEndLatchTimer_);
  1276. this.adapter.forceLayout();
  1277. this.adapter.removeClass(this.currentAnimationClass_);
  1278. }
  1279. this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState);
  1280. this.currentCheckState_ = newState;
  1281. // Check for parentNode so that animations are only run when the element is attached
  1282. // to the DOM.
  1283. if (this.adapter.isAttachedToDOM() && this.currentAnimationClass_.length > 0) {
  1284. this.adapter.addClass(this.currentAnimationClass_);
  1285. this.enableAnimationEndHandler_ = true;
  1286. }
  1287. };
  1288. MDCCheckboxFoundation.prototype.determineCheckState_ = function () {
  1289. var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
  1290. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  1291. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1292. if (this.adapter.isIndeterminate()) {
  1293. return TRANSITION_STATE_INDETERMINATE;
  1294. }
  1295. return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
  1296. };
  1297. MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) {
  1298. var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
  1299. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  1300. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1301. var _a = MDCCheckboxFoundation.cssClasses,
  1302. ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
  1303. ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
  1304. ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
  1305. ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
  1306. ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
  1307. ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
  1308. switch (oldState) {
  1309. case TRANSITION_STATE_INIT:
  1310. if (newState === TRANSITION_STATE_UNCHECKED) {
  1311. return '';
  1312. }
  1313. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  1314. case TRANSITION_STATE_UNCHECKED:
  1315. return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
  1316. case TRANSITION_STATE_CHECKED:
  1317. return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
  1318. default:
  1319. // TRANSITION_STATE_INDETERMINATE
  1320. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  1321. }
  1322. };
  1323. MDCCheckboxFoundation.prototype.updateAriaChecked_ = function () {
  1324. // Ensure aria-checked is set to mixed if checkbox is in indeterminate state.
  1325. if (this.adapter.isIndeterminate()) {
  1326. this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
  1327. } else {
  1328. // The on/off state does not need to keep track of aria-checked, since
  1329. // the screenreader uses the checked property on the checkbox element.
  1330. this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
  1331. }
  1332. };
  1333. return MDCCheckboxFoundation;
  1334. }(foundation_1.MDCFoundation);
  1335. exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
  1336. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  1337. exports.default = MDCCheckboxFoundation;
  1338. /***/ }),
  1339. /***/ "./packages/mdc-checkbox/index.ts":
  1340. /*!****************************************!*\
  1341. !*** ./packages/mdc-checkbox/index.ts ***!
  1342. \****************************************/
  1343. /*! no static exports found */
  1344. /***/ (function(module, exports, __webpack_require__) {
  1345. "use strict";
  1346. /**
  1347. * @license
  1348. * Copyright 2019 Google Inc.
  1349. *
  1350. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1351. * of this software and associated documentation files (the "Software"), to deal
  1352. * in the Software without restriction, including without limitation the rights
  1353. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1354. * copies of the Software, and to permit persons to whom the Software is
  1355. * furnished to do so, subject to the following conditions:
  1356. *
  1357. * The above copyright notice and this permission notice shall be included in
  1358. * all copies or substantial portions of the Software.
  1359. *
  1360. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1361. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1362. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1363. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1364. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1365. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1366. * THE SOFTWARE.
  1367. */
  1368. function __export(m) {
  1369. for (var p in m) {
  1370. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  1371. }
  1372. }
  1373. Object.defineProperty(exports, "__esModule", { value: true });
  1374. __export(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts"));
  1375. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"));
  1376. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"));
  1377. /***/ }),
  1378. /***/ "./packages/mdc-chips/chip-set/component.ts":
  1379. /*!**************************************************!*\
  1380. !*** ./packages/mdc-chips/chip-set/component.ts ***!
  1381. \**************************************************/
  1382. /*! no static exports found */
  1383. /***/ (function(module, exports, __webpack_require__) {
  1384. "use strict";
  1385. /**
  1386. * @license
  1387. * Copyright 2016 Google Inc.
  1388. *
  1389. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1390. * of this software and associated documentation files (the "Software"), to deal
  1391. * in the Software without restriction, including without limitation the rights
  1392. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1393. * copies of the Software, and to permit persons to whom the Software is
  1394. * furnished to do so, subject to the following conditions:
  1395. *
  1396. * The above copyright notice and this permission notice shall be included in
  1397. * all copies or substantial portions of the Software.
  1398. *
  1399. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1400. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1401. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1402. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1403. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1404. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1405. * THE SOFTWARE.
  1406. */
  1407. var __extends = this && this.__extends || function () {
  1408. var _extendStatics = function extendStatics(d, b) {
  1409. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1410. d.__proto__ = b;
  1411. } || function (d, b) {
  1412. for (var p in b) {
  1413. if (b.hasOwnProperty(p)) d[p] = b[p];
  1414. }
  1415. };
  1416. return _extendStatics(d, b);
  1417. };
  1418. return function (d, b) {
  1419. _extendStatics(d, b);
  1420. function __() {
  1421. this.constructor = d;
  1422. }
  1423. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1424. };
  1425. }();
  1426. Object.defineProperty(exports, "__esModule", { value: true });
  1427. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  1428. var announce_1 = __webpack_require__(/*! @material/dom/announce */ "./packages/mdc-dom/announce.ts");
  1429. var component_2 = __webpack_require__(/*! ../chip/component */ "./packages/mdc-chips/chip/component.ts");
  1430. var foundation_1 = __webpack_require__(/*! ../chip/foundation */ "./packages/mdc-chips/chip/foundation.ts");
  1431. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts");
  1432. var _a = foundation_1.MDCChipFoundation.strings,
  1433. INTERACTION_EVENT = _a.INTERACTION_EVENT,
  1434. SELECTION_EVENT = _a.SELECTION_EVENT,
  1435. REMOVAL_EVENT = _a.REMOVAL_EVENT,
  1436. NAVIGATION_EVENT = _a.NAVIGATION_EVENT;
  1437. var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR;
  1438. var idCounter = 0;
  1439. var MDCChipSet = /** @class */function (_super) {
  1440. __extends(MDCChipSet, _super);
  1441. function MDCChipSet() {
  1442. return _super !== null && _super.apply(this, arguments) || this;
  1443. }
  1444. MDCChipSet.attachTo = function (root) {
  1445. return new MDCChipSet(root);
  1446. };
  1447. Object.defineProperty(MDCChipSet.prototype, "chips", {
  1448. get: function get() {
  1449. return this.chips_.slice();
  1450. },
  1451. enumerable: true,
  1452. configurable: true
  1453. });
  1454. Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", {
  1455. /**
  1456. * @return An array of the IDs of all selected chips.
  1457. */
  1458. get: function get() {
  1459. return this.foundation.getSelectedChipIds();
  1460. },
  1461. enumerable: true,
  1462. configurable: true
  1463. });
  1464. /**
  1465. * @param chipFactory A function which creates a new MDCChip.
  1466. */
  1467. MDCChipSet.prototype.initialize = function (chipFactory) {
  1468. if (chipFactory === void 0) {
  1469. chipFactory = function chipFactory(el) {
  1470. return new component_2.MDCChip(el);
  1471. };
  1472. }
  1473. this.chipFactory_ = chipFactory;
  1474. this.chips_ = this.instantiateChips_(this.chipFactory_);
  1475. };
  1476. MDCChipSet.prototype.initialSyncWithDOM = function () {
  1477. var _this = this;
  1478. this.chips_.forEach(function (chip) {
  1479. if (chip.id && chip.selected) {
  1480. _this.foundation.select(chip.id);
  1481. }
  1482. });
  1483. this.handleChipInteraction_ = function (evt) {
  1484. return _this.foundation.handleChipInteraction(evt.detail);
  1485. };
  1486. this.handleChipSelection_ = function (evt) {
  1487. return _this.foundation.handleChipSelection(evt.detail);
  1488. };
  1489. this.handleChipRemoval_ = function (evt) {
  1490. return _this.foundation.handleChipRemoval(evt.detail);
  1491. };
  1492. this.handleChipNavigation_ = function (evt) {
  1493. return _this.foundation.handleChipNavigation(evt.detail);
  1494. };
  1495. this.listen(INTERACTION_EVENT, this.handleChipInteraction_);
  1496. this.listen(SELECTION_EVENT, this.handleChipSelection_);
  1497. this.listen(REMOVAL_EVENT, this.handleChipRemoval_);
  1498. this.listen(NAVIGATION_EVENT, this.handleChipNavigation_);
  1499. };
  1500. MDCChipSet.prototype.destroy = function () {
  1501. this.chips_.forEach(function (chip) {
  1502. chip.destroy();
  1503. });
  1504. this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_);
  1505. this.unlisten(SELECTION_EVENT, this.handleChipSelection_);
  1506. this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_);
  1507. this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation_);
  1508. _super.prototype.destroy.call(this);
  1509. };
  1510. /**
  1511. * Adds a new chip object to the chip set from the given chip element.
  1512. */
  1513. MDCChipSet.prototype.addChip = function (chipEl) {
  1514. chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter;
  1515. this.chips_.push(this.chipFactory_(chipEl));
  1516. };
  1517. MDCChipSet.prototype.getDefaultFoundation = function () {
  1518. var _this = this;
  1519. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  1520. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  1521. var adapter = {
  1522. announceMessage: function announceMessage(message) {
  1523. announce_1.announce(message);
  1524. },
  1525. focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex(index) {
  1526. _this.chips_[index].focusPrimaryAction();
  1527. },
  1528. focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex(index) {
  1529. _this.chips_[index].focusTrailingAction();
  1530. },
  1531. getChipListCount: function getChipListCount() {
  1532. return _this.chips_.length;
  1533. },
  1534. getIndexOfChipById: function getIndexOfChipById(chipId) {
  1535. return _this.findChipIndex_(chipId);
  1536. },
  1537. hasClass: function hasClass(className) {
  1538. return _this.root.classList.contains(className);
  1539. },
  1540. isRTL: function isRTL() {
  1541. return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
  1542. },
  1543. removeChipAtIndex: function removeChipAtIndex(index) {
  1544. if (index >= 0 && index < _this.chips_.length) {
  1545. _this.chips_[index].destroy();
  1546. _this.chips_[index].remove();
  1547. _this.chips_.splice(index, 1);
  1548. }
  1549. },
  1550. removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex(index) {
  1551. _this.chips_[index].removeFocus();
  1552. },
  1553. selectChipAtIndex: function selectChipAtIndex(index, selected, shouldNotifyClients) {
  1554. if (index >= 0 && index < _this.chips_.length) {
  1555. _this.chips_[index].setSelectedFromChipSet(selected, shouldNotifyClients);
  1556. }
  1557. }
  1558. };
  1559. return new foundation_2.MDCChipSetFoundation(adapter);
  1560. };
  1561. /**
  1562. * Instantiates chip components on all of the chip set's child chip elements.
  1563. */
  1564. MDCChipSet.prototype.instantiateChips_ = function (chipFactory) {
  1565. var chipElements = [].slice.call(this.root.querySelectorAll(CHIP_SELECTOR));
  1566. return chipElements.map(function (el) {
  1567. el.id = el.id || "mdc-chip-" + ++idCounter;
  1568. return chipFactory(el);
  1569. });
  1570. };
  1571. /**
  1572. * Returns the index of the chip with the given id, or -1 if the chip does not exist.
  1573. */
  1574. MDCChipSet.prototype.findChipIndex_ = function (chipId) {
  1575. for (var i = 0; i < this.chips_.length; i++) {
  1576. if (this.chips_[i].id === chipId) {
  1577. return i;
  1578. }
  1579. }
  1580. return -1;
  1581. };
  1582. return MDCChipSet;
  1583. }(component_1.MDCComponent);
  1584. exports.MDCChipSet = MDCChipSet;
  1585. /***/ }),
  1586. /***/ "./packages/mdc-chips/chip-set/constants.ts":
  1587. /*!**************************************************!*\
  1588. !*** ./packages/mdc-chips/chip-set/constants.ts ***!
  1589. \**************************************************/
  1590. /*! no static exports found */
  1591. /***/ (function(module, exports, __webpack_require__) {
  1592. "use strict";
  1593. /**
  1594. * @license
  1595. * Copyright 2016 Google Inc.
  1596. *
  1597. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1598. * of this software and associated documentation files (the "Software"), to deal
  1599. * in the Software without restriction, including without limitation the rights
  1600. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1601. * copies of the Software, and to permit persons to whom the Software is
  1602. * furnished to do so, subject to the following conditions:
  1603. *
  1604. * The above copyright notice and this permission notice shall be included in
  1605. * all copies or substantial portions of the Software.
  1606. *
  1607. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1608. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1609. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1610. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1611. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1612. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1613. * THE SOFTWARE.
  1614. */
  1615. Object.defineProperty(exports, "__esModule", { value: true });
  1616. exports.strings = {
  1617. CHIP_SELECTOR: '.mdc-chip'
  1618. };
  1619. exports.cssClasses = {
  1620. CHOICE: 'mdc-chip-set--choice',
  1621. FILTER: 'mdc-chip-set--filter'
  1622. };
  1623. /***/ }),
  1624. /***/ "./packages/mdc-chips/chip-set/foundation.ts":
  1625. /*!***************************************************!*\
  1626. !*** ./packages/mdc-chips/chip-set/foundation.ts ***!
  1627. \***************************************************/
  1628. /*! no static exports found */
  1629. /***/ (function(module, exports, __webpack_require__) {
  1630. "use strict";
  1631. /**
  1632. * @license
  1633. * Copyright 2017 Google Inc.
  1634. *
  1635. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1636. * of this software and associated documentation files (the "Software"), to deal
  1637. * in the Software without restriction, including without limitation the rights
  1638. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1639. * copies of the Software, and to permit persons to whom the Software is
  1640. * furnished to do so, subject to the following conditions:
  1641. *
  1642. * The above copyright notice and this permission notice shall be included in
  1643. * all copies or substantial portions of the Software.
  1644. *
  1645. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1646. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1647. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1648. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1649. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1650. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1651. * THE SOFTWARE.
  1652. */
  1653. var __extends = this && this.__extends || function () {
  1654. var _extendStatics = function extendStatics(d, b) {
  1655. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1656. d.__proto__ = b;
  1657. } || function (d, b) {
  1658. for (var p in b) {
  1659. if (b.hasOwnProperty(p)) d[p] = b[p];
  1660. }
  1661. };
  1662. return _extendStatics(d, b);
  1663. };
  1664. return function (d, b) {
  1665. _extendStatics(d, b);
  1666. function __() {
  1667. this.constructor = d;
  1668. }
  1669. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1670. };
  1671. }();
  1672. var __assign = this && this.__assign || function () {
  1673. __assign = Object.assign || function (t) {
  1674. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1675. s = arguments[i];
  1676. for (var p in s) {
  1677. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1678. }
  1679. }
  1680. return t;
  1681. };
  1682. return __assign.apply(this, arguments);
  1683. };
  1684. Object.defineProperty(exports, "__esModule", { value: true });
  1685. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  1686. var constants_1 = __webpack_require__(/*! ../chip/constants */ "./packages/mdc-chips/chip/constants.ts");
  1687. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
  1688. var MDCChipSetFoundation = /** @class */function (_super) {
  1689. __extends(MDCChipSetFoundation, _super);
  1690. function MDCChipSetFoundation(adapter) {
  1691. var _this = _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this;
  1692. /**
  1693. * The ids of the selected chips in the set. Only used for choice chip set or filter chip set.
  1694. */
  1695. _this.selectedChipIds_ = [];
  1696. return _this;
  1697. }
  1698. Object.defineProperty(MDCChipSetFoundation, "strings", {
  1699. get: function get() {
  1700. return constants_2.strings;
  1701. },
  1702. enumerable: true,
  1703. configurable: true
  1704. });
  1705. Object.defineProperty(MDCChipSetFoundation, "cssClasses", {
  1706. get: function get() {
  1707. return constants_2.cssClasses;
  1708. },
  1709. enumerable: true,
  1710. configurable: true
  1711. });
  1712. Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", {
  1713. get: function get() {
  1714. return {
  1715. announceMessage: function announceMessage() {
  1716. return undefined;
  1717. },
  1718. focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex() {
  1719. return undefined;
  1720. },
  1721. focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex() {
  1722. return undefined;
  1723. },
  1724. getChipListCount: function getChipListCount() {
  1725. return -1;
  1726. },
  1727. getIndexOfChipById: function getIndexOfChipById() {
  1728. return -1;
  1729. },
  1730. hasClass: function hasClass() {
  1731. return false;
  1732. },
  1733. isRTL: function isRTL() {
  1734. return false;
  1735. },
  1736. removeChipAtIndex: function removeChipAtIndex() {
  1737. return undefined;
  1738. },
  1739. removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex() {
  1740. return undefined;
  1741. },
  1742. selectChipAtIndex: function selectChipAtIndex() {
  1743. return undefined;
  1744. }
  1745. };
  1746. },
  1747. enumerable: true,
  1748. configurable: true
  1749. });
  1750. /**
  1751. * Returns an array of the IDs of all selected chips.
  1752. */
  1753. MDCChipSetFoundation.prototype.getSelectedChipIds = function () {
  1754. return this.selectedChipIds_.slice();
  1755. };
  1756. /**
  1757. * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant.
  1758. * Does not notify clients of the updated selection state.
  1759. */
  1760. MDCChipSetFoundation.prototype.select = function (chipId) {
  1761. this.select_(chipId, false);
  1762. };
  1763. /**
  1764. * Handles a chip interaction event
  1765. */
  1766. MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) {
  1767. var chipId = _a.chipId;
  1768. var index = this.adapter.getIndexOfChipById(chipId);
  1769. this.removeFocusFromChipsExcept_(index);
  1770. if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) || this.adapter.hasClass(constants_2.cssClasses.FILTER)) {
  1771. this.toggleSelect_(chipId);
  1772. }
  1773. };
  1774. /**
  1775. * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip.
  1776. */
  1777. MDCChipSetFoundation.prototype.handleChipSelection = function (_a) {
  1778. var chipId = _a.chipId,
  1779. selected = _a.selected,
  1780. shouldIgnore = _a.shouldIgnore;
  1781. // Early exit if we should ignore the event
  1782. if (shouldIgnore) {
  1783. return;
  1784. }
  1785. var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0;
  1786. if (selected && !chipIsSelected) {
  1787. this.select(chipId);
  1788. } else if (!selected && chipIsSelected) {
  1789. this.deselect_(chipId);
  1790. }
  1791. };
  1792. /**
  1793. * Handles the event when a chip is removed.
  1794. */
  1795. MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) {
  1796. var chipId = _a.chipId,
  1797. removedAnnouncement = _a.removedAnnouncement;
  1798. if (removedAnnouncement) {
  1799. this.adapter.announceMessage(removedAnnouncement);
  1800. }
  1801. var index = this.adapter.getIndexOfChipById(chipId);
  1802. this.deselectAndNotifyClients_(chipId);
  1803. this.adapter.removeChipAtIndex(index);
  1804. var maxIndex = this.adapter.getChipListCount() - 1;
  1805. var nextIndex = Math.min(index, maxIndex);
  1806. this.removeFocusFromChipsExcept_(nextIndex);
  1807. // After removing a chip, we should focus the trailing action for the next chip.
  1808. this.adapter.focusChipTrailingActionAtIndex(nextIndex);
  1809. };
  1810. /**
  1811. * Handles a chip navigation event.
  1812. */
  1813. MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) {
  1814. var chipId = _a.chipId,
  1815. key = _a.key,
  1816. source = _a.source;
  1817. var maxIndex = this.adapter.getChipListCount() - 1;
  1818. var index = this.adapter.getIndexOfChipById(chipId);
  1819. // Early exit if the index is out of range or the key is unusable
  1820. if (index === -1 || !constants_1.navigationKeys.has(key)) {
  1821. return;
  1822. }
  1823. var isRTL = this.adapter.isRTL();
  1824. var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY;
  1825. var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY;
  1826. var isDownKey = key === constants_1.strings.ARROW_DOWN_KEY || key === constants_1.strings.IE_ARROW_DOWN_KEY;
  1827. var shouldIncrement = !isRTL && isRightKey || isRTL && isLeftKey || isDownKey;
  1828. var isHome = key === constants_1.strings.HOME_KEY;
  1829. var isEnd = key === constants_1.strings.END_KEY;
  1830. if (shouldIncrement) {
  1831. index++;
  1832. } else if (isHome) {
  1833. index = 0;
  1834. } else if (isEnd) {
  1835. index = maxIndex;
  1836. } else {
  1837. index--;
  1838. }
  1839. // Early exit if the index is out of bounds
  1840. if (index < 0 || index > maxIndex) {
  1841. return;
  1842. }
  1843. this.removeFocusFromChipsExcept_(index);
  1844. this.focusChipAction_(index, key, source);
  1845. };
  1846. MDCChipSetFoundation.prototype.focusChipAction_ = function (index, key, source) {
  1847. var shouldJumpChips = constants_1.jumpChipKeys.has(key);
  1848. if (shouldJumpChips && source === constants_1.EventSource.PRIMARY) {
  1849. return this.adapter.focusChipPrimaryActionAtIndex(index);
  1850. }
  1851. if (shouldJumpChips && source === constants_1.EventSource.TRAILING) {
  1852. return this.adapter.focusChipTrailingActionAtIndex(index);
  1853. }
  1854. var dir = this.getDirection_(key);
  1855. if (dir === constants_1.Direction.LEFT) {
  1856. return this.adapter.focusChipTrailingActionAtIndex(index);
  1857. }
  1858. if (dir === constants_1.Direction.RIGHT) {
  1859. return this.adapter.focusChipPrimaryActionAtIndex(index);
  1860. }
  1861. };
  1862. MDCChipSetFoundation.prototype.getDirection_ = function (key) {
  1863. var isRTL = this.adapter.isRTL();
  1864. var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY;
  1865. var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY;
  1866. if (!isRTL && isLeftKey || isRTL && isRightKey) {
  1867. return constants_1.Direction.LEFT;
  1868. }
  1869. return constants_1.Direction.RIGHT;
  1870. };
  1871. /**
  1872. * Deselects the chip with the given id and optionally notifies clients.
  1873. */
  1874. MDCChipSetFoundation.prototype.deselect_ = function (chipId, shouldNotifyClients) {
  1875. if (shouldNotifyClients === void 0) {
  1876. shouldNotifyClients = false;
  1877. }
  1878. var index = this.selectedChipIds_.indexOf(chipId);
  1879. if (index >= 0) {
  1880. this.selectedChipIds_.splice(index, 1);
  1881. var chipIndex = this.adapter.getIndexOfChipById(chipId);
  1882. this.adapter.selectChipAtIndex(chipIndex, /** isSelected */false, shouldNotifyClients);
  1883. }
  1884. };
  1885. /**
  1886. * Deselects the chip with the given id and notifies clients.
  1887. */
  1888. MDCChipSetFoundation.prototype.deselectAndNotifyClients_ = function (chipId) {
  1889. this.deselect_(chipId, true);
  1890. };
  1891. /**
  1892. * Toggles selection of the chip with the given id.
  1893. */
  1894. MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) {
  1895. if (this.selectedChipIds_.indexOf(chipId) >= 0) {
  1896. this.deselectAndNotifyClients_(chipId);
  1897. } else {
  1898. this.selectAndNotifyClients_(chipId);
  1899. }
  1900. };
  1901. MDCChipSetFoundation.prototype.removeFocusFromChipsExcept_ = function (index) {
  1902. var chipCount = this.adapter.getChipListCount();
  1903. for (var i = 0; i < chipCount; i++) {
  1904. if (i !== index) {
  1905. this.adapter.removeFocusFromChipAtIndex(i);
  1906. }
  1907. }
  1908. };
  1909. MDCChipSetFoundation.prototype.selectAndNotifyClients_ = function (chipId) {
  1910. this.select_(chipId, true);
  1911. };
  1912. MDCChipSetFoundation.prototype.select_ = function (chipId, shouldNotifyClients) {
  1913. if (this.selectedChipIds_.indexOf(chipId) >= 0) {
  1914. return;
  1915. }
  1916. if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) && this.selectedChipIds_.length > 0) {
  1917. var previouslySelectedChip = this.selectedChipIds_[0];
  1918. var previouslySelectedIndex = this.adapter.getIndexOfChipById(previouslySelectedChip);
  1919. this.selectedChipIds_ = [];
  1920. this.adapter.selectChipAtIndex(previouslySelectedIndex, /** isSelected */false, shouldNotifyClients);
  1921. }
  1922. this.selectedChipIds_.push(chipId);
  1923. var index = this.adapter.getIndexOfChipById(chipId);
  1924. this.adapter.selectChipAtIndex(index, /** isSelected */true, shouldNotifyClients);
  1925. };
  1926. return MDCChipSetFoundation;
  1927. }(foundation_1.MDCFoundation);
  1928. exports.MDCChipSetFoundation = MDCChipSetFoundation;
  1929. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  1930. exports.default = MDCChipSetFoundation;
  1931. /***/ }),
  1932. /***/ "./packages/mdc-chips/chip-set/index.ts":
  1933. /*!**********************************************!*\
  1934. !*** ./packages/mdc-chips/chip-set/index.ts ***!
  1935. \**********************************************/
  1936. /*! no static exports found */
  1937. /***/ (function(module, exports, __webpack_require__) {
  1938. "use strict";
  1939. /**
  1940. * @license
  1941. * Copyright 2019 Google Inc.
  1942. *
  1943. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1944. * of this software and associated documentation files (the "Software"), to deal
  1945. * in the Software without restriction, including without limitation the rights
  1946. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1947. * copies of the Software, and to permit persons to whom the Software is
  1948. * furnished to do so, subject to the following conditions:
  1949. *
  1950. * The above copyright notice and this permission notice shall be included in
  1951. * all copies or substantial portions of the Software.
  1952. *
  1953. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1954. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1955. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1956. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1957. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1958. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1959. * THE SOFTWARE.
  1960. */
  1961. function __export(m) {
  1962. for (var p in m) {
  1963. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  1964. }
  1965. }
  1966. Object.defineProperty(exports, "__esModule", { value: true });
  1967. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip-set/component.ts"));
  1968. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts"));
  1969. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
  1970. exports.chipSetCssClasses = constants_1.cssClasses;
  1971. exports.chipSetStrings = constants_1.strings;
  1972. /***/ }),
  1973. /***/ "./packages/mdc-chips/chip/component.ts":
  1974. /*!**********************************************!*\
  1975. !*** ./packages/mdc-chips/chip/component.ts ***!
  1976. \**********************************************/
  1977. /*! no static exports found */
  1978. /***/ (function(module, exports, __webpack_require__) {
  1979. "use strict";
  1980. /**
  1981. * @license
  1982. * Copyright 2016 Google Inc.
  1983. *
  1984. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1985. * of this software and associated documentation files (the "Software"), to deal
  1986. * in the Software without restriction, including without limitation the rights
  1987. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1988. * copies of the Software, and to permit persons to whom the Software is
  1989. * furnished to do so, subject to the following conditions:
  1990. *
  1991. * The above copyright notice and this permission notice shall be included in
  1992. * all copies or substantial portions of the Software.
  1993. *
  1994. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1995. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1996. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1997. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1998. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1999. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2000. * THE SOFTWARE.
  2001. */
  2002. var __extends = this && this.__extends || function () {
  2003. var _extendStatics = function extendStatics(d, b) {
  2004. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2005. d.__proto__ = b;
  2006. } || function (d, b) {
  2007. for (var p in b) {
  2008. if (b.hasOwnProperty(p)) d[p] = b[p];
  2009. }
  2010. };
  2011. return _extendStatics(d, b);
  2012. };
  2013. return function (d, b) {
  2014. _extendStatics(d, b);
  2015. function __() {
  2016. this.constructor = d;
  2017. }
  2018. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2019. };
  2020. }();
  2021. var __assign = this && this.__assign || function () {
  2022. __assign = Object.assign || function (t) {
  2023. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2024. s = arguments[i];
  2025. for (var p in s) {
  2026. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  2027. }
  2028. }
  2029. return t;
  2030. };
  2031. return __assign.apply(this, arguments);
  2032. };
  2033. Object.defineProperty(exports, "__esModule", { value: true });
  2034. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  2035. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  2036. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  2037. var component_3 = __webpack_require__(/*! ../trailingaction/component */ "./packages/mdc-chips/trailingaction/component.ts");
  2038. var constants_1 = __webpack_require__(/*! ../trailingaction/constants */ "./packages/mdc-chips/trailingaction/constants.ts");
  2039. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2040. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts");
  2041. var MDCChip = /** @class */function (_super) {
  2042. __extends(MDCChip, _super);
  2043. function MDCChip() {
  2044. return _super !== null && _super.apply(this, arguments) || this;
  2045. }
  2046. Object.defineProperty(MDCChip.prototype, "selected", {
  2047. /**
  2048. * @return Whether the chip is selected.
  2049. */
  2050. get: function get() {
  2051. return this.foundation.isSelected();
  2052. },
  2053. /**
  2054. * Sets selected state on the chip.
  2055. */
  2056. set: function set(selected) {
  2057. this.foundation.setSelected(selected);
  2058. },
  2059. enumerable: true,
  2060. configurable: true
  2061. });
  2062. Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", {
  2063. /**
  2064. * @return Whether a trailing icon click should trigger exit/removal of the chip.
  2065. */
  2066. get: function get() {
  2067. return this.foundation.getShouldRemoveOnTrailingIconClick();
  2068. },
  2069. /**
  2070. * Sets whether a trailing icon click should trigger exit/removal of the chip.
  2071. */
  2072. set: function set(shouldRemove) {
  2073. this.foundation.setShouldRemoveOnTrailingIconClick(shouldRemove);
  2074. },
  2075. enumerable: true,
  2076. configurable: true
  2077. });
  2078. Object.defineProperty(MDCChip.prototype, "setShouldFocusPrimaryActionOnClick", {
  2079. /**
  2080. * Sets whether a clicking on the chip should focus the primary action.
  2081. */
  2082. set: function set(shouldFocus) {
  2083. this.foundation.setShouldFocusPrimaryActionOnClick(shouldFocus);
  2084. },
  2085. enumerable: true,
  2086. configurable: true
  2087. });
  2088. Object.defineProperty(MDCChip.prototype, "ripple", {
  2089. get: function get() {
  2090. return this.ripple_;
  2091. },
  2092. enumerable: true,
  2093. configurable: true
  2094. });
  2095. Object.defineProperty(MDCChip.prototype, "id", {
  2096. get: function get() {
  2097. return this.root.id;
  2098. },
  2099. enumerable: true,
  2100. configurable: true
  2101. });
  2102. MDCChip.attachTo = function (root) {
  2103. return new MDCChip(root);
  2104. };
  2105. MDCChip.prototype.initialize = function (rippleFactory, trailingActionFactory) {
  2106. var _this = this;
  2107. if (rippleFactory === void 0) {
  2108. rippleFactory = function rippleFactory(el, foundation) {
  2109. return new component_2.MDCRipple(el, foundation);
  2110. };
  2111. }
  2112. if (trailingActionFactory === void 0) {
  2113. trailingActionFactory = function trailingActionFactory(el) {
  2114. return new component_3.MDCChipTrailingAction(el);
  2115. };
  2116. }
  2117. this.leadingIcon_ = this.root.querySelector(constants_2.strings.LEADING_ICON_SELECTOR);
  2118. this.checkmark_ = this.root.querySelector(constants_2.strings.CHECKMARK_SELECTOR);
  2119. this.primaryAction_ = this.root.querySelector(constants_2.strings.PRIMARY_ACTION_SELECTOR);
  2120. var trailingActionEl = this.root.querySelector(constants_2.strings.TRAILING_ACTION_SELECTOR);
  2121. if (trailingActionEl) {
  2122. this.trailingAction_ = trailingActionFactory(trailingActionEl);
  2123. }
  2124. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  2125. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  2126. var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() {
  2127. return _this.foundation.getDimensions();
  2128. } });
  2129. this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter));
  2130. };
  2131. MDCChip.prototype.initialSyncWithDOM = function () {
  2132. var _this = this;
  2133. // Custom events
  2134. this.handleTrailingActionInteraction_ = function () {
  2135. _this.foundation.handleTrailingActionInteraction();
  2136. };
  2137. this.handleTrailingActionNavigation_ = function (evt) {
  2138. _this.foundation.handleTrailingActionNavigation(evt);
  2139. };
  2140. // Native events
  2141. this.handleClick_ = function () {
  2142. _this.foundation.handleClick();
  2143. };
  2144. this.handleKeydown_ = function (evt) {
  2145. _this.foundation.handleKeydown(evt);
  2146. };
  2147. this.handleTransitionEnd_ = function (evt) {
  2148. _this.foundation.handleTransitionEnd(evt);
  2149. };
  2150. this.handleFocusIn_ = function (evt) {
  2151. _this.foundation.handleFocusIn(evt);
  2152. };
  2153. this.handleFocusOut_ = function (evt) {
  2154. _this.foundation.handleFocusOut(evt);
  2155. };
  2156. this.listen('transitionend', this.handleTransitionEnd_);
  2157. this.listen('click', this.handleClick_);
  2158. this.listen('keydown', this.handleKeydown_);
  2159. this.listen('focusin', this.handleFocusIn_);
  2160. this.listen('focusout', this.handleFocusOut_);
  2161. if (this.trailingAction_) {
  2162. this.listen(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_);
  2163. this.listen(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_);
  2164. }
  2165. };
  2166. MDCChip.prototype.destroy = function () {
  2167. this.ripple_.destroy();
  2168. this.unlisten('transitionend', this.handleTransitionEnd_);
  2169. this.unlisten('keydown', this.handleKeydown_);
  2170. this.unlisten('click', this.handleClick_);
  2171. this.unlisten('focusin', this.handleFocusIn_);
  2172. this.unlisten('focusout', this.handleFocusOut_);
  2173. if (this.trailingAction_) {
  2174. this.unlisten(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_);
  2175. this.unlisten(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_);
  2176. }
  2177. _super.prototype.destroy.call(this);
  2178. };
  2179. /**
  2180. * Begins the exit animation which leads to removal of the chip.
  2181. */
  2182. MDCChip.prototype.beginExit = function () {
  2183. this.foundation.beginExit();
  2184. };
  2185. MDCChip.prototype.getDefaultFoundation = function () {
  2186. var _this = this;
  2187. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  2188. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  2189. var adapter = {
  2190. addClass: function addClass(className) {
  2191. return _this.root.classList.add(className);
  2192. },
  2193. addClassToLeadingIcon: function addClassToLeadingIcon(className) {
  2194. if (_this.leadingIcon_) {
  2195. _this.leadingIcon_.classList.add(className);
  2196. }
  2197. },
  2198. eventTargetHasClass: function eventTargetHasClass(target, className) {
  2199. return target ? target.classList.contains(className) : false;
  2200. },
  2201. focusPrimaryAction: function focusPrimaryAction() {
  2202. if (_this.primaryAction_) {
  2203. _this.primaryAction_.focus();
  2204. }
  2205. },
  2206. focusTrailingAction: function focusTrailingAction() {
  2207. if (_this.trailingAction_) {
  2208. _this.trailingAction_.focus();
  2209. }
  2210. },
  2211. getAttribute: function getAttribute(attr) {
  2212. return _this.root.getAttribute(attr);
  2213. },
  2214. getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
  2215. return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null;
  2216. },
  2217. getComputedStyleValue: function getComputedStyleValue(propertyName) {
  2218. return window.getComputedStyle(_this.root).getPropertyValue(propertyName);
  2219. },
  2220. getRootBoundingClientRect: function getRootBoundingClientRect() {
  2221. return _this.root.getBoundingClientRect();
  2222. },
  2223. hasClass: function hasClass(className) {
  2224. return _this.root.classList.contains(className);
  2225. },
  2226. hasLeadingIcon: function hasLeadingIcon() {
  2227. return !!_this.leadingIcon_;
  2228. },
  2229. isRTL: function isRTL() {
  2230. return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
  2231. },
  2232. isTrailingActionNavigable: function isTrailingActionNavigable() {
  2233. if (_this.trailingAction_) {
  2234. return _this.trailingAction_.isNavigable();
  2235. }
  2236. return false;
  2237. },
  2238. notifyInteraction: function notifyInteraction() {
  2239. return _this.emit(constants_2.strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
  2240. },
  2241. notifyNavigation: function notifyNavigation(key, source) {
  2242. return _this.emit(constants_2.strings.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true /* shouldBubble */);
  2243. },
  2244. notifyRemoval: function notifyRemoval(removedAnnouncement) {
  2245. _this.emit(constants_2.strings.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true /* shouldBubble */);
  2246. },
  2247. notifySelection: function notifySelection(selected, shouldIgnore) {
  2248. return _this.emit(constants_2.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true /* shouldBubble */);
  2249. },
  2250. notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
  2251. return _this.emit(constants_2.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
  2252. },
  2253. notifyEditStart: function notifyEditStart() {},
  2254. notifyEditFinish: function notifyEditFinish() {},
  2255. removeClass: function removeClass(className) {
  2256. return _this.root.classList.remove(className);
  2257. },
  2258. removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) {
  2259. if (_this.leadingIcon_) {
  2260. _this.leadingIcon_.classList.remove(className);
  2261. }
  2262. },
  2263. removeTrailingActionFocus: function removeTrailingActionFocus() {
  2264. if (_this.trailingAction_) {
  2265. _this.trailingAction_.removeFocus();
  2266. }
  2267. },
  2268. setPrimaryActionAttr: function setPrimaryActionAttr(attr, value) {
  2269. if (_this.primaryAction_) {
  2270. _this.primaryAction_.setAttribute(attr, value);
  2271. }
  2272. },
  2273. setStyleProperty: function setStyleProperty(propertyName, value) {
  2274. return _this.root.style.setProperty(propertyName, value);
  2275. }
  2276. };
  2277. return new foundation_2.MDCChipFoundation(adapter);
  2278. };
  2279. MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
  2280. this.foundation.setSelectedFromChipSet(selected, shouldNotifyClients);
  2281. };
  2282. MDCChip.prototype.focusPrimaryAction = function () {
  2283. this.foundation.focusPrimaryAction();
  2284. };
  2285. MDCChip.prototype.focusTrailingAction = function () {
  2286. this.foundation.focusTrailingAction();
  2287. };
  2288. MDCChip.prototype.removeFocus = function () {
  2289. this.foundation.removeFocus();
  2290. };
  2291. MDCChip.prototype.remove = function () {
  2292. var parent = this.root.parentNode;
  2293. if (parent !== null) {
  2294. parent.removeChild(this.root);
  2295. }
  2296. };
  2297. return MDCChip;
  2298. }(component_1.MDCComponent);
  2299. exports.MDCChip = MDCChip;
  2300. /***/ }),
  2301. /***/ "./packages/mdc-chips/chip/constants.ts":
  2302. /*!**********************************************!*\
  2303. !*** ./packages/mdc-chips/chip/constants.ts ***!
  2304. \**********************************************/
  2305. /*! no static exports found */
  2306. /***/ (function(module, exports, __webpack_require__) {
  2307. "use strict";
  2308. /**
  2309. * @license
  2310. * Copyright 2016 Google Inc.
  2311. *
  2312. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2313. * of this software and associated documentation files (the "Software"), to deal
  2314. * in the Software without restriction, including without limitation the rights
  2315. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2316. * copies of the Software, and to permit persons to whom the Software is
  2317. * furnished to do so, subject to the following conditions:
  2318. *
  2319. * The above copyright notice and this permission notice shall be included in
  2320. * all copies or substantial portions of the Software.
  2321. *
  2322. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2323. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2324. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2325. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2326. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2327. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2328. * THE SOFTWARE.
  2329. */
  2330. Object.defineProperty(exports, "__esModule", { value: true });
  2331. var Direction;
  2332. (function (Direction) {
  2333. Direction["LEFT"] = "left";
  2334. Direction["RIGHT"] = "right";
  2335. })(Direction = exports.Direction || (exports.Direction = {}));
  2336. var EventSource;
  2337. (function (EventSource) {
  2338. EventSource["PRIMARY"] = "primary";
  2339. EventSource["TRAILING"] = "trailing";
  2340. EventSource["NONE"] = "none";
  2341. })(EventSource = exports.EventSource || (exports.EventSource = {}));
  2342. exports.strings = {
  2343. ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement',
  2344. ARIA_CHECKED: 'aria-checked',
  2345. ARROW_DOWN_KEY: 'ArrowDown',
  2346. ARROW_LEFT_KEY: 'ArrowLeft',
  2347. ARROW_RIGHT_KEY: 'ArrowRight',
  2348. ARROW_UP_KEY: 'ArrowUp',
  2349. BACKSPACE_KEY: 'Backspace',
  2350. CHECKMARK_SELECTOR: '.mdc-chip__checkmark',
  2351. DELETE_KEY: 'Delete',
  2352. END_KEY: 'End',
  2353. ENTER_KEY: 'Enter',
  2354. ENTRY_ANIMATION_NAME: 'mdc-chip-entry',
  2355. HOME_KEY: 'Home',
  2356. IE_ARROW_DOWN_KEY: 'Down',
  2357. IE_ARROW_LEFT_KEY: 'Left',
  2358. IE_ARROW_RIGHT_KEY: 'Right',
  2359. IE_ARROW_UP_KEY: 'Up',
  2360. IE_DELETE_KEY: 'Del',
  2361. INTERACTION_EVENT: 'MDCChip:interaction',
  2362. LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading',
  2363. NAVIGATION_EVENT: 'MDCChip:navigation',
  2364. PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action',
  2365. REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement',
  2366. REMOVAL_EVENT: 'MDCChip:removal',
  2367. SELECTION_EVENT: 'MDCChip:selection',
  2368. SPACEBAR_KEY: ' ',
  2369. TAB_INDEX: 'tabindex',
  2370. TRAILING_ACTION_SELECTOR: '.mdc-chip-trailing-action',
  2371. TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction',
  2372. TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing'
  2373. };
  2374. exports.cssClasses = {
  2375. CHECKMARK: 'mdc-chip__checkmark',
  2376. CHIP_EXIT: 'mdc-chip--exit',
  2377. DELETABLE: 'mdc-chip--deletable',
  2378. EDITABLE: 'mdc-chip--editable',
  2379. EDITING: 'mdc-chip--editing',
  2380. HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden',
  2381. LEADING_ICON: 'mdc-chip__icon--leading',
  2382. PRIMARY_ACTION: 'mdc-chip__primary-action',
  2383. PRIMARY_ACTION_FOCUSED: 'mdc-chip--primary-action-focused',
  2384. SELECTED: 'mdc-chip--selected',
  2385. TEXT: 'mdc-chip__text',
  2386. TRAILING_ACTION: 'mdc-chip__trailing-action',
  2387. TRAILING_ICON: 'mdc-chip__icon--trailing'
  2388. };
  2389. exports.navigationKeys = new Set();
  2390. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  2391. exports.navigationKeys.add(exports.strings.ARROW_LEFT_KEY);
  2392. exports.navigationKeys.add(exports.strings.ARROW_RIGHT_KEY);
  2393. exports.navigationKeys.add(exports.strings.ARROW_DOWN_KEY);
  2394. exports.navigationKeys.add(exports.strings.ARROW_UP_KEY);
  2395. exports.navigationKeys.add(exports.strings.END_KEY);
  2396. exports.navigationKeys.add(exports.strings.HOME_KEY);
  2397. exports.navigationKeys.add(exports.strings.IE_ARROW_LEFT_KEY);
  2398. exports.navigationKeys.add(exports.strings.IE_ARROW_RIGHT_KEY);
  2399. exports.navigationKeys.add(exports.strings.IE_ARROW_DOWN_KEY);
  2400. exports.navigationKeys.add(exports.strings.IE_ARROW_UP_KEY);
  2401. exports.jumpChipKeys = new Set();
  2402. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  2403. exports.jumpChipKeys.add(exports.strings.ARROW_UP_KEY);
  2404. exports.jumpChipKeys.add(exports.strings.ARROW_DOWN_KEY);
  2405. exports.jumpChipKeys.add(exports.strings.HOME_KEY);
  2406. exports.jumpChipKeys.add(exports.strings.END_KEY);
  2407. exports.jumpChipKeys.add(exports.strings.IE_ARROW_UP_KEY);
  2408. exports.jumpChipKeys.add(exports.strings.IE_ARROW_DOWN_KEY);
  2409. /***/ }),
  2410. /***/ "./packages/mdc-chips/chip/foundation.ts":
  2411. /*!***********************************************!*\
  2412. !*** ./packages/mdc-chips/chip/foundation.ts ***!
  2413. \***********************************************/
  2414. /*! no static exports found */
  2415. /***/ (function(module, exports, __webpack_require__) {
  2416. "use strict";
  2417. /**
  2418. * @license
  2419. * Copyright 2016 Google Inc.
  2420. *
  2421. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2422. * of this software and associated documentation files (the "Software"), to deal
  2423. * in the Software without restriction, including without limitation the rights
  2424. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2425. * copies of the Software, and to permit persons to whom the Software is
  2426. * furnished to do so, subject to the following conditions:
  2427. *
  2428. * The above copyright notice and this permission notice shall be included in
  2429. * all copies or substantial portions of the Software.
  2430. *
  2431. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2432. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2433. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2434. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2435. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2436. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2437. * THE SOFTWARE.
  2438. */
  2439. var __extends = this && this.__extends || function () {
  2440. var _extendStatics = function extendStatics(d, b) {
  2441. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2442. d.__proto__ = b;
  2443. } || function (d, b) {
  2444. for (var p in b) {
  2445. if (b.hasOwnProperty(p)) d[p] = b[p];
  2446. }
  2447. };
  2448. return _extendStatics(d, b);
  2449. };
  2450. return function (d, b) {
  2451. _extendStatics(d, b);
  2452. function __() {
  2453. this.constructor = d;
  2454. }
  2455. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2456. };
  2457. }();
  2458. var __assign = this && this.__assign || function () {
  2459. __assign = Object.assign || function (t) {
  2460. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2461. s = arguments[i];
  2462. for (var p in s) {
  2463. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  2464. }
  2465. }
  2466. return t;
  2467. };
  2468. return __assign.apply(this, arguments);
  2469. };
  2470. Object.defineProperty(exports, "__esModule", { value: true });
  2471. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  2472. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2473. var emptyClientRect = {
  2474. bottom: 0,
  2475. height: 0,
  2476. left: 0,
  2477. right: 0,
  2478. top: 0,
  2479. width: 0
  2480. };
  2481. var FocusBehavior;
  2482. (function (FocusBehavior) {
  2483. FocusBehavior[FocusBehavior["SHOULD_FOCUS"] = 0] = "SHOULD_FOCUS";
  2484. FocusBehavior[FocusBehavior["SHOULD_NOT_FOCUS"] = 1] = "SHOULD_NOT_FOCUS";
  2485. })(FocusBehavior || (FocusBehavior = {}));
  2486. var MDCChipFoundation = /** @class */function (_super) {
  2487. __extends(MDCChipFoundation, _super);
  2488. function MDCChipFoundation(adapter) {
  2489. var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this;
  2490. /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */
  2491. _this.shouldRemoveOnTrailingIconClick_ = true;
  2492. /**
  2493. * Whether the primary action should receive focus on click. Should only be
  2494. * set to true for clients who programmatically give focus to a different
  2495. * element on the page when a chip is clicked (like a menu).
  2496. */
  2497. _this.shouldFocusPrimaryActionOnClick_ = true;
  2498. return _this;
  2499. }
  2500. Object.defineProperty(MDCChipFoundation, "strings", {
  2501. get: function get() {
  2502. return constants_1.strings;
  2503. },
  2504. enumerable: true,
  2505. configurable: true
  2506. });
  2507. Object.defineProperty(MDCChipFoundation, "cssClasses", {
  2508. get: function get() {
  2509. return constants_1.cssClasses;
  2510. },
  2511. enumerable: true,
  2512. configurable: true
  2513. });
  2514. Object.defineProperty(MDCChipFoundation, "defaultAdapter", {
  2515. get: function get() {
  2516. return {
  2517. addClass: function addClass() {
  2518. return undefined;
  2519. },
  2520. addClassToLeadingIcon: function addClassToLeadingIcon() {
  2521. return undefined;
  2522. },
  2523. eventTargetHasClass: function eventTargetHasClass() {
  2524. return false;
  2525. },
  2526. focusPrimaryAction: function focusPrimaryAction() {
  2527. return undefined;
  2528. },
  2529. focusTrailingAction: function focusTrailingAction() {
  2530. return undefined;
  2531. },
  2532. getAttribute: function getAttribute() {
  2533. return null;
  2534. },
  2535. getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
  2536. return emptyClientRect;
  2537. },
  2538. getComputedStyleValue: function getComputedStyleValue() {
  2539. return '';
  2540. },
  2541. getRootBoundingClientRect: function getRootBoundingClientRect() {
  2542. return emptyClientRect;
  2543. },
  2544. hasClass: function hasClass() {
  2545. return false;
  2546. },
  2547. hasLeadingIcon: function hasLeadingIcon() {
  2548. return false;
  2549. },
  2550. isRTL: function isRTL() {
  2551. return false;
  2552. },
  2553. isTrailingActionNavigable: function isTrailingActionNavigable() {
  2554. return false;
  2555. },
  2556. notifyEditFinish: function notifyEditFinish() {
  2557. return undefined;
  2558. },
  2559. notifyEditStart: function notifyEditStart() {
  2560. return undefined;
  2561. },
  2562. notifyInteraction: function notifyInteraction() {
  2563. return undefined;
  2564. },
  2565. notifyNavigation: function notifyNavigation() {
  2566. return undefined;
  2567. },
  2568. notifyRemoval: function notifyRemoval() {
  2569. return undefined;
  2570. },
  2571. notifySelection: function notifySelection() {
  2572. return undefined;
  2573. },
  2574. notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
  2575. return undefined;
  2576. },
  2577. removeClass: function removeClass() {
  2578. return undefined;
  2579. },
  2580. removeClassFromLeadingIcon: function removeClassFromLeadingIcon() {
  2581. return undefined;
  2582. },
  2583. removeTrailingActionFocus: function removeTrailingActionFocus() {
  2584. return undefined;
  2585. },
  2586. setPrimaryActionAttr: function setPrimaryActionAttr() {
  2587. return undefined;
  2588. },
  2589. setStyleProperty: function setStyleProperty() {
  2590. return undefined;
  2591. }
  2592. };
  2593. },
  2594. enumerable: true,
  2595. configurable: true
  2596. });
  2597. MDCChipFoundation.prototype.isSelected = function () {
  2598. return this.adapter.hasClass(constants_1.cssClasses.SELECTED);
  2599. };
  2600. MDCChipFoundation.prototype.isEditable = function () {
  2601. return this.adapter.hasClass(constants_1.cssClasses.EDITABLE);
  2602. };
  2603. MDCChipFoundation.prototype.isEditing = function () {
  2604. return this.adapter.hasClass(constants_1.cssClasses.EDITING);
  2605. };
  2606. MDCChipFoundation.prototype.setSelected = function (selected) {
  2607. this.setSelected_(selected);
  2608. this.notifySelection_(selected);
  2609. };
  2610. MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
  2611. this.setSelected_(selected);
  2612. if (shouldNotifyClients) {
  2613. this.notifyIgnoredSelection_(selected);
  2614. }
  2615. };
  2616. MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () {
  2617. return this.shouldRemoveOnTrailingIconClick_;
  2618. };
  2619. MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) {
  2620. this.shouldRemoveOnTrailingIconClick_ = shouldRemove;
  2621. };
  2622. MDCChipFoundation.prototype.setShouldFocusPrimaryActionOnClick = function (shouldFocus) {
  2623. this.shouldFocusPrimaryActionOnClick_ = shouldFocus;
  2624. };
  2625. MDCChipFoundation.prototype.getDimensions = function () {
  2626. var _this = this;
  2627. var getRootRect = function getRootRect() {
  2628. return _this.adapter.getRootBoundingClientRect();
  2629. };
  2630. var getCheckmarkRect = function getCheckmarkRect() {
  2631. return _this.adapter.getCheckmarkBoundingClientRect();
  2632. };
  2633. // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current
  2634. // size of the checkmark.
  2635. if (!this.adapter.hasLeadingIcon()) {
  2636. var checkmarkRect = getCheckmarkRect();
  2637. if (checkmarkRect) {
  2638. var rootRect = getRootRect();
  2639. // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes.
  2640. // However, the checkbox is initially hidden by setting the width to 0.
  2641. // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width)
  2642. // when adding it to the root client rect's width.
  2643. return {
  2644. bottom: rootRect.bottom,
  2645. height: rootRect.height,
  2646. left: rootRect.left,
  2647. right: rootRect.right,
  2648. top: rootRect.top,
  2649. width: rootRect.width + checkmarkRect.height
  2650. };
  2651. }
  2652. }
  2653. return getRootRect();
  2654. };
  2655. /**
  2656. * Begins the exit animation which leads to removal of the chip.
  2657. */
  2658. MDCChipFoundation.prototype.beginExit = function () {
  2659. this.adapter.addClass(constants_1.cssClasses.CHIP_EXIT);
  2660. };
  2661. MDCChipFoundation.prototype.handleClick = function () {
  2662. this.adapter.notifyInteraction();
  2663. this.setPrimaryActionFocusable_(this.getFocusBehavior_());
  2664. };
  2665. MDCChipFoundation.prototype.handleDoubleClick = function () {
  2666. if (this.isEditable()) {
  2667. this.startEditing();
  2668. }
  2669. };
  2670. /**
  2671. * Handles a transition end event on the root element.
  2672. */
  2673. MDCChipFoundation.prototype.handleTransitionEnd = function (evt) {
  2674. var _this = this;
  2675. // Handle transition end event on the chip when it is about to be removed.
  2676. var shouldHandle = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT);
  2677. var widthIsAnimating = evt.propertyName === 'width';
  2678. var opacityIsAnimating = evt.propertyName === 'opacity';
  2679. if (shouldHandle && opacityIsAnimating) {
  2680. // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5
  2681. var chipWidth_1 = this.adapter.getComputedStyleValue('width');
  2682. // On the next frame (once we get the computed width), explicitly set the chip's width
  2683. // to its current pixel width, so we aren't transitioning out of 'auto'.
  2684. requestAnimationFrame(function () {
  2685. _this.adapter.setStyleProperty('width', chipWidth_1);
  2686. // To mitigate jitter, start transitioning padding and margin before width.
  2687. _this.adapter.setStyleProperty('padding', '0');
  2688. _this.adapter.setStyleProperty('margin', '0');
  2689. // On the next frame (once width is explicitly set), transition width to 0.
  2690. requestAnimationFrame(function () {
  2691. _this.adapter.setStyleProperty('width', '0');
  2692. });
  2693. });
  2694. return;
  2695. }
  2696. if (shouldHandle && widthIsAnimating) {
  2697. this.removeFocus();
  2698. var removedAnnouncement = this.adapter.getAttribute(constants_1.strings.REMOVED_ANNOUNCEMENT_ATTRIBUTE);
  2699. this.adapter.notifyRemoval(removedAnnouncement);
  2700. }
  2701. // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles.
  2702. if (!opacityIsAnimating) {
  2703. return;
  2704. }
  2705. var shouldHideLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.LEADING_ICON) && this.adapter.hasClass(constants_1.cssClasses.SELECTED);
  2706. var shouldShowLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter.hasClass(constants_1.cssClasses.SELECTED);
  2707. if (shouldHideLeadingIcon) {
  2708. this.adapter.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
  2709. return;
  2710. }
  2711. if (shouldShowLeadingIcon) {
  2712. this.adapter.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
  2713. return;
  2714. }
  2715. };
  2716. MDCChipFoundation.prototype.handleFocusIn = function (evt) {
  2717. // Early exit if the event doesn't come from the primary action
  2718. if (!this.eventFromPrimaryAction_(evt)) {
  2719. return;
  2720. }
  2721. this.adapter.addClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED);
  2722. };
  2723. MDCChipFoundation.prototype.handleFocusOut = function (evt) {
  2724. // Early exit if the event doesn't come from the primary action
  2725. if (!this.eventFromPrimaryAction_(evt)) {
  2726. return;
  2727. }
  2728. if (this.isEditing()) {
  2729. this.finishEditing();
  2730. }
  2731. this.adapter.removeClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED);
  2732. };
  2733. /**
  2734. * Handles an interaction event on the trailing icon element. This is used to
  2735. * prevent the ripple from activating on interaction with the trailing icon.
  2736. */
  2737. MDCChipFoundation.prototype.handleTrailingActionInteraction = function () {
  2738. this.adapter.notifyTrailingIconInteraction();
  2739. this.removeChip_();
  2740. };
  2741. /**
  2742. * Handles a keydown event from the root element.
  2743. */
  2744. MDCChipFoundation.prototype.handleKeydown = function (evt) {
  2745. if (this.isEditing()) {
  2746. if (this.shouldFinishEditing(evt)) {
  2747. evt.preventDefault();
  2748. this.finishEditing();
  2749. }
  2750. // When editing, the foundation should only handle key events that finish
  2751. // the editing process.
  2752. return;
  2753. }
  2754. if (this.isEditable()) {
  2755. if (this.shouldStartEditing(evt)) {
  2756. evt.preventDefault();
  2757. this.startEditing();
  2758. }
  2759. }
  2760. if (this.shouldNotifyInteraction_(evt)) {
  2761. this.adapter.notifyInteraction();
  2762. this.setPrimaryActionFocusable_(this.getFocusBehavior_());
  2763. return;
  2764. }
  2765. if (this.isDeleteAction_(evt)) {
  2766. evt.preventDefault();
  2767. this.removeChip_();
  2768. return;
  2769. }
  2770. // Early exit if the key is not usable
  2771. if (!constants_1.navigationKeys.has(evt.key)) {
  2772. return;
  2773. }
  2774. // Prevent default behavior for movement keys which could include scrolling
  2775. evt.preventDefault();
  2776. this.focusNextAction_(evt.key, constants_1.EventSource.PRIMARY);
  2777. };
  2778. MDCChipFoundation.prototype.handleTrailingActionNavigation = function (evt) {
  2779. return this.focusNextAction_(evt.detail.key, constants_1.EventSource.TRAILING);
  2780. };
  2781. /**
  2782. * Called by the chip set to remove focus from the chip actions.
  2783. */
  2784. MDCChipFoundation.prototype.removeFocus = function () {
  2785. this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2786. this.adapter.removeTrailingActionFocus();
  2787. };
  2788. /**
  2789. * Called by the chip set to focus the primary action.
  2790. *
  2791. */
  2792. MDCChipFoundation.prototype.focusPrimaryAction = function () {
  2793. this.setPrimaryActionFocusable_(FocusBehavior.SHOULD_FOCUS);
  2794. };
  2795. /**
  2796. * Called by the chip set to focus the trailing action (if present), otherwise
  2797. * gives focus to the trailing action.
  2798. */
  2799. MDCChipFoundation.prototype.focusTrailingAction = function () {
  2800. var trailingActionIsNavigable = this.adapter.isTrailingActionNavigable();
  2801. if (trailingActionIsNavigable) {
  2802. this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2803. this.adapter.focusTrailingAction();
  2804. return;
  2805. }
  2806. this.focusPrimaryAction();
  2807. };
  2808. MDCChipFoundation.prototype.setPrimaryActionFocusable_ = function (focusBehavior) {
  2809. this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '0');
  2810. if (focusBehavior === FocusBehavior.SHOULD_FOCUS) {
  2811. this.adapter.focusPrimaryAction();
  2812. }
  2813. this.adapter.removeTrailingActionFocus();
  2814. };
  2815. MDCChipFoundation.prototype.getFocusBehavior_ = function () {
  2816. if (this.shouldFocusPrimaryActionOnClick_) {
  2817. return FocusBehavior.SHOULD_FOCUS;
  2818. }
  2819. return FocusBehavior.SHOULD_NOT_FOCUS;
  2820. };
  2821. MDCChipFoundation.prototype.focusNextAction_ = function (key, source) {
  2822. var isTrailingActionNavigable = this.adapter.isTrailingActionNavigable();
  2823. var dir = this.getDirection_(key);
  2824. // Early exit if the key should jump chips
  2825. if (constants_1.jumpChipKeys.has(key) || !isTrailingActionNavigable) {
  2826. return this.adapter.notifyNavigation(key, source);
  2827. }
  2828. if (source === constants_1.EventSource.PRIMARY && dir === constants_1.Direction.RIGHT) {
  2829. return this.focusTrailingAction();
  2830. }
  2831. if (source === constants_1.EventSource.TRAILING && dir === constants_1.Direction.LEFT) {
  2832. return this.focusPrimaryAction();
  2833. }
  2834. this.adapter.notifyNavigation(key, constants_1.EventSource.NONE);
  2835. };
  2836. MDCChipFoundation.prototype.getDirection_ = function (key) {
  2837. var isRTL = this.adapter.isRTL();
  2838. var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY;
  2839. var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY;
  2840. if (!isRTL && isLeftKey || isRTL && isRightKey) {
  2841. return constants_1.Direction.LEFT;
  2842. }
  2843. return constants_1.Direction.RIGHT;
  2844. };
  2845. MDCChipFoundation.prototype.removeChip_ = function () {
  2846. if (this.shouldRemoveOnTrailingIconClick_) {
  2847. this.beginExit();
  2848. }
  2849. };
  2850. MDCChipFoundation.prototype.shouldStartEditing = function (evt) {
  2851. return this.eventFromPrimaryAction_(evt) && evt.key === constants_1.strings.ENTER_KEY;
  2852. };
  2853. MDCChipFoundation.prototype.shouldFinishEditing = function (evt) {
  2854. return evt.key === constants_1.strings.ENTER_KEY;
  2855. };
  2856. MDCChipFoundation.prototype.shouldNotifyInteraction_ = function (evt) {
  2857. return evt.key === constants_1.strings.ENTER_KEY || evt.key === constants_1.strings.SPACEBAR_KEY;
  2858. };
  2859. MDCChipFoundation.prototype.isDeleteAction_ = function (evt) {
  2860. var isDeletable = this.adapter.hasClass(constants_1.cssClasses.DELETABLE);
  2861. return isDeletable && (evt.key === constants_1.strings.BACKSPACE_KEY || evt.key === constants_1.strings.DELETE_KEY || evt.key === constants_1.strings.IE_DELETE_KEY);
  2862. };
  2863. MDCChipFoundation.prototype.setSelected_ = function (selected) {
  2864. if (selected) {
  2865. this.adapter.addClass(constants_1.cssClasses.SELECTED);
  2866. this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'true');
  2867. } else {
  2868. this.adapter.removeClass(constants_1.cssClasses.SELECTED);
  2869. this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'false');
  2870. }
  2871. };
  2872. MDCChipFoundation.prototype.notifySelection_ = function (selected) {
  2873. this.adapter.notifySelection(selected, false);
  2874. };
  2875. MDCChipFoundation.prototype.notifyIgnoredSelection_ = function (selected) {
  2876. this.adapter.notifySelection(selected, true);
  2877. };
  2878. MDCChipFoundation.prototype.eventFromPrimaryAction_ = function (evt) {
  2879. return this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.PRIMARY_ACTION);
  2880. };
  2881. MDCChipFoundation.prototype.startEditing = function () {
  2882. this.adapter.addClass(constants_1.cssClasses.EDITING);
  2883. this.adapter.notifyEditStart();
  2884. };
  2885. MDCChipFoundation.prototype.finishEditing = function () {
  2886. this.adapter.removeClass(constants_1.cssClasses.EDITING);
  2887. this.adapter.notifyEditFinish();
  2888. };
  2889. return MDCChipFoundation;
  2890. }(foundation_1.MDCFoundation);
  2891. exports.MDCChipFoundation = MDCChipFoundation;
  2892. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  2893. exports.default = MDCChipFoundation;
  2894. /***/ }),
  2895. /***/ "./packages/mdc-chips/chip/index.ts":
  2896. /*!******************************************!*\
  2897. !*** ./packages/mdc-chips/chip/index.ts ***!
  2898. \******************************************/
  2899. /*! no static exports found */
  2900. /***/ (function(module, exports, __webpack_require__) {
  2901. "use strict";
  2902. /**
  2903. * @license
  2904. * Copyright 2019 Google Inc.
  2905. *
  2906. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2907. * of this software and associated documentation files (the "Software"), to deal
  2908. * in the Software without restriction, including without limitation the rights
  2909. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2910. * copies of the Software, and to permit persons to whom the Software is
  2911. * furnished to do so, subject to the following conditions:
  2912. *
  2913. * The above copyright notice and this permission notice shall be included in
  2914. * all copies or substantial portions of the Software.
  2915. *
  2916. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2917. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2918. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2919. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2920. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2921. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2922. * THE SOFTWARE.
  2923. */
  2924. function __export(m) {
  2925. for (var p in m) {
  2926. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  2927. }
  2928. }
  2929. Object.defineProperty(exports, "__esModule", { value: true });
  2930. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip/component.ts"));
  2931. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts"));
  2932. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2933. exports.chipCssClasses = constants_1.cssClasses;
  2934. exports.chipStrings = constants_1.strings;
  2935. /***/ }),
  2936. /***/ "./packages/mdc-chips/index.ts":
  2937. /*!*************************************!*\
  2938. !*** ./packages/mdc-chips/index.ts ***!
  2939. \*************************************/
  2940. /*! no static exports found */
  2941. /***/ (function(module, exports, __webpack_require__) {
  2942. "use strict";
  2943. /**
  2944. * @license
  2945. * Copyright 2019 Google Inc.
  2946. *
  2947. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2948. * of this software and associated documentation files (the "Software"), to deal
  2949. * in the Software without restriction, including without limitation the rights
  2950. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2951. * copies of the Software, and to permit persons to whom the Software is
  2952. * furnished to do so, subject to the following conditions:
  2953. *
  2954. * The above copyright notice and this permission notice shall be included in
  2955. * all copies or substantial portions of the Software.
  2956. *
  2957. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2958. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2959. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2960. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2961. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2962. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2963. * THE SOFTWARE.
  2964. */
  2965. function __export(m) {
  2966. for (var p in m) {
  2967. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  2968. }
  2969. }
  2970. Object.defineProperty(exports, "__esModule", { value: true });
  2971. __export(__webpack_require__(/*! ./trailingaction/index */ "./packages/mdc-chips/trailingaction/index.ts"));
  2972. __export(__webpack_require__(/*! ./chip/index */ "./packages/mdc-chips/chip/index.ts"));
  2973. __export(__webpack_require__(/*! ./chip-set/index */ "./packages/mdc-chips/chip-set/index.ts"));
  2974. /***/ }),
  2975. /***/ "./packages/mdc-chips/trailingaction/component.ts":
  2976. /*!********************************************************!*\
  2977. !*** ./packages/mdc-chips/trailingaction/component.ts ***!
  2978. \********************************************************/
  2979. /*! no static exports found */
  2980. /***/ (function(module, exports, __webpack_require__) {
  2981. "use strict";
  2982. /**
  2983. * @license
  2984. * Copyright 2020 Google Inc.
  2985. *
  2986. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2987. * of this software and associated documentation files (the "Software"), to deal
  2988. * in the Software without restriction, including without limitation the rights
  2989. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2990. * copies of the Software, and to permit persons to whom the Software is
  2991. * furnished to do so, subject to the following conditions:
  2992. *
  2993. * The above copyright notice and this permission notice shall be included in
  2994. * all copies or substantial portions of the Software.
  2995. *
  2996. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2997. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2998. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2999. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3000. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3001. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3002. * THE SOFTWARE.
  3003. */
  3004. var __extends = this && this.__extends || function () {
  3005. var _extendStatics = function extendStatics(d, b) {
  3006. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3007. d.__proto__ = b;
  3008. } || function (d, b) {
  3009. for (var p in b) {
  3010. if (b.hasOwnProperty(p)) d[p] = b[p];
  3011. }
  3012. };
  3013. return _extendStatics(d, b);
  3014. };
  3015. return function (d, b) {
  3016. _extendStatics(d, b);
  3017. function __() {
  3018. this.constructor = d;
  3019. }
  3020. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3021. };
  3022. }();
  3023. Object.defineProperty(exports, "__esModule", { value: true });
  3024. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3025. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  3026. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  3027. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts");
  3028. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/trailingaction/foundation.ts");
  3029. var MDCChipTrailingAction = /** @class */function (_super) {
  3030. __extends(MDCChipTrailingAction, _super);
  3031. function MDCChipTrailingAction() {
  3032. return _super !== null && _super.apply(this, arguments) || this;
  3033. }
  3034. Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", {
  3035. get: function get() {
  3036. return this.ripple_;
  3037. },
  3038. enumerable: true,
  3039. configurable: true
  3040. });
  3041. MDCChipTrailingAction.attachTo = function (root) {
  3042. return new MDCChipTrailingAction(root);
  3043. };
  3044. MDCChipTrailingAction.prototype.initialize = function (rippleFactory) {
  3045. if (rippleFactory === void 0) {
  3046. rippleFactory = function rippleFactory(el, foundation) {
  3047. return new component_2.MDCRipple(el, foundation);
  3048. };
  3049. }
  3050. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3051. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3052. // methods, we need a separate, strongly typed adapter variable.
  3053. var rippleAdapter = component_2.MDCRipple.createAdapter(this);
  3054. this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter));
  3055. };
  3056. MDCChipTrailingAction.prototype.initialSyncWithDOM = function () {
  3057. var _this = this;
  3058. this.handleClick_ = function (evt) {
  3059. _this.foundation.handleClick(evt);
  3060. };
  3061. this.handleKeydown_ = function (evt) {
  3062. _this.foundation.handleKeydown(evt);
  3063. };
  3064. this.listen('click', this.handleClick_);
  3065. this.listen('keydown', this.handleKeydown_);
  3066. };
  3067. MDCChipTrailingAction.prototype.destroy = function () {
  3068. this.ripple_.destroy();
  3069. this.unlisten('click', this.handleClick_);
  3070. this.unlisten('keydown', this.handleKeydown_);
  3071. _super.prototype.destroy.call(this);
  3072. };
  3073. MDCChipTrailingAction.prototype.getDefaultFoundation = function () {
  3074. var _this = this;
  3075. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3076. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3077. // methods, we need a separate, strongly typed adapter variable.
  3078. var adapter = {
  3079. focus: function focus() {
  3080. // TODO(b/157231863): Migate MDCComponent#root to HTMLElement
  3081. _this.root.focus();
  3082. },
  3083. getAttribute: function getAttribute(attr) {
  3084. return _this.root.getAttribute(attr);
  3085. },
  3086. notifyInteraction: function notifyInteraction(trigger) {
  3087. return _this.emit(constants_1.strings.INTERACTION_EVENT, { trigger: trigger }, true /* shouldBubble */);
  3088. },
  3089. notifyNavigation: function notifyNavigation(key) {
  3090. _this.emit(constants_1.strings.NAVIGATION_EVENT, { key: key }, true /* shouldBubble */);
  3091. },
  3092. setAttribute: function setAttribute(attr, value) {
  3093. _this.root.setAttribute(attr, value);
  3094. }
  3095. };
  3096. return new foundation_2.MDCChipTrailingActionFoundation(adapter);
  3097. };
  3098. MDCChipTrailingAction.prototype.isNavigable = function () {
  3099. return this.foundation.isNavigable();
  3100. };
  3101. MDCChipTrailingAction.prototype.focus = function () {
  3102. this.foundation.focus();
  3103. };
  3104. MDCChipTrailingAction.prototype.removeFocus = function () {
  3105. this.foundation.removeFocus();
  3106. };
  3107. return MDCChipTrailingAction;
  3108. }(component_1.MDCComponent);
  3109. exports.MDCChipTrailingAction = MDCChipTrailingAction;
  3110. /***/ }),
  3111. /***/ "./packages/mdc-chips/trailingaction/constants.ts":
  3112. /*!********************************************************!*\
  3113. !*** ./packages/mdc-chips/trailingaction/constants.ts ***!
  3114. \********************************************************/
  3115. /*! no static exports found */
  3116. /***/ (function(module, exports, __webpack_require__) {
  3117. "use strict";
  3118. /**
  3119. * @license
  3120. * Copyright 2020 Google Inc.
  3121. *
  3122. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3123. * of this software and associated documentation files (the "Software"), to deal
  3124. * in the Software without restriction, including without limitation the rights
  3125. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3126. * copies of the Software, and to permit persons to whom the Software is
  3127. * furnished to do so, subject to the following conditions:
  3128. *
  3129. * The above copyright notice and this permission notice shall be included in
  3130. * all copies or substantial portions of the Software.
  3131. *
  3132. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3133. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3134. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3135. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3136. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3137. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3138. * THE SOFTWARE.
  3139. */
  3140. Object.defineProperty(exports, "__esModule", { value: true });
  3141. var InteractionTrigger;
  3142. (function (InteractionTrigger) {
  3143. InteractionTrigger[InteractionTrigger["UNSPECIFIED"] = 0] = "UNSPECIFIED";
  3144. InteractionTrigger[InteractionTrigger["CLICK"] = 1] = "CLICK";
  3145. InteractionTrigger[InteractionTrigger["BACKSPACE_KEY"] = 2] = "BACKSPACE_KEY";
  3146. InteractionTrigger[InteractionTrigger["DELETE_KEY"] = 3] = "DELETE_KEY";
  3147. InteractionTrigger[InteractionTrigger["SPACEBAR_KEY"] = 4] = "SPACEBAR_KEY";
  3148. InteractionTrigger[InteractionTrigger["ENTER_KEY"] = 5] = "ENTER_KEY";
  3149. })(InteractionTrigger = exports.InteractionTrigger || (exports.InteractionTrigger = {}));
  3150. exports.strings = {
  3151. ARIA_HIDDEN: 'aria-hidden',
  3152. INTERACTION_EVENT: 'MDCChipTrailingAction:interaction',
  3153. NAVIGATION_EVENT: 'MDCChipTrailingAction:navigation',
  3154. TAB_INDEX: 'tabindex'
  3155. };
  3156. /***/ }),
  3157. /***/ "./packages/mdc-chips/trailingaction/foundation.ts":
  3158. /*!*********************************************************!*\
  3159. !*** ./packages/mdc-chips/trailingaction/foundation.ts ***!
  3160. \*********************************************************/
  3161. /*! no static exports found */
  3162. /***/ (function(module, exports, __webpack_require__) {
  3163. "use strict";
  3164. /**
  3165. * @license
  3166. * Copyright 2020 Google Inc.
  3167. *
  3168. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3169. * of this software and associated documentation files (the "Software"), to deal
  3170. * in the Software without restriction, including without limitation the rights
  3171. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3172. * copies of the Software, and to permit persons to whom the Software is
  3173. * furnished to do so, subject to the following conditions:
  3174. *
  3175. * The above copyright notice and this permission notice shall be included in
  3176. * all copies or substantial portions of the Software.
  3177. *
  3178. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3179. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3180. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3181. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3182. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3183. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3184. * THE SOFTWARE.
  3185. */
  3186. var __extends = this && this.__extends || function () {
  3187. var _extendStatics = function extendStatics(d, b) {
  3188. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3189. d.__proto__ = b;
  3190. } || function (d, b) {
  3191. for (var p in b) {
  3192. if (b.hasOwnProperty(p)) d[p] = b[p];
  3193. }
  3194. };
  3195. return _extendStatics(d, b);
  3196. };
  3197. return function (d, b) {
  3198. _extendStatics(d, b);
  3199. function __() {
  3200. this.constructor = d;
  3201. }
  3202. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3203. };
  3204. }();
  3205. var __assign = this && this.__assign || function () {
  3206. __assign = Object.assign || function (t) {
  3207. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3208. s = arguments[i];
  3209. for (var p in s) {
  3210. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3211. }
  3212. }
  3213. return t;
  3214. };
  3215. return __assign.apply(this, arguments);
  3216. };
  3217. Object.defineProperty(exports, "__esModule", { value: true });
  3218. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  3219. var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts");
  3220. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts");
  3221. var MDCChipTrailingActionFoundation = /** @class */function (_super) {
  3222. __extends(MDCChipTrailingActionFoundation, _super);
  3223. function MDCChipTrailingActionFoundation(adapter) {
  3224. return _super.call(this, __assign(__assign({}, MDCChipTrailingActionFoundation.defaultAdapter), adapter)) || this;
  3225. }
  3226. Object.defineProperty(MDCChipTrailingActionFoundation, "strings", {
  3227. get: function get() {
  3228. return constants_1.strings;
  3229. },
  3230. enumerable: true,
  3231. configurable: true
  3232. });
  3233. Object.defineProperty(MDCChipTrailingActionFoundation, "defaultAdapter", {
  3234. get: function get() {
  3235. return {
  3236. focus: function focus() {
  3237. return undefined;
  3238. },
  3239. getAttribute: function getAttribute() {
  3240. return null;
  3241. },
  3242. setAttribute: function setAttribute() {
  3243. return undefined;
  3244. },
  3245. notifyInteraction: function notifyInteraction() {
  3246. return undefined;
  3247. },
  3248. notifyNavigation: function notifyNavigation() {
  3249. return undefined;
  3250. }
  3251. };
  3252. },
  3253. enumerable: true,
  3254. configurable: true
  3255. });
  3256. MDCChipTrailingActionFoundation.prototype.handleClick = function (evt) {
  3257. evt.stopPropagation();
  3258. this.adapter.notifyInteraction(constants_1.InteractionTrigger.CLICK);
  3259. };
  3260. MDCChipTrailingActionFoundation.prototype.handleKeydown = function (evt) {
  3261. evt.stopPropagation();
  3262. var key = keyboard_1.normalizeKey(evt);
  3263. if (this.shouldNotifyInteractionFromKey_(key)) {
  3264. var trigger = this.getTriggerFromKey_(key);
  3265. this.adapter.notifyInteraction(trigger);
  3266. return;
  3267. }
  3268. if (keyboard_1.isNavigationEvent(evt)) {
  3269. this.adapter.notifyNavigation(key);
  3270. return;
  3271. }
  3272. };
  3273. MDCChipTrailingActionFoundation.prototype.removeFocus = function () {
  3274. this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '-1');
  3275. };
  3276. MDCChipTrailingActionFoundation.prototype.focus = function () {
  3277. this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '0');
  3278. this.adapter.focus();
  3279. };
  3280. MDCChipTrailingActionFoundation.prototype.isNavigable = function () {
  3281. return this.adapter.getAttribute(constants_1.strings.ARIA_HIDDEN) !== 'true';
  3282. };
  3283. MDCChipTrailingActionFoundation.prototype.shouldNotifyInteractionFromKey_ = function (key) {
  3284. var isFromActionKey = key === keyboard_1.KEY.ENTER || key === keyboard_1.KEY.SPACEBAR;
  3285. var isFromDeleteKey = key === keyboard_1.KEY.BACKSPACE || key === keyboard_1.KEY.DELETE;
  3286. return isFromActionKey || isFromDeleteKey;
  3287. };
  3288. MDCChipTrailingActionFoundation.prototype.getTriggerFromKey_ = function (key) {
  3289. if (key === keyboard_1.KEY.SPACEBAR) {
  3290. return constants_1.InteractionTrigger.SPACEBAR_KEY;
  3291. }
  3292. if (key === keyboard_1.KEY.ENTER) {
  3293. return constants_1.InteractionTrigger.ENTER_KEY;
  3294. }
  3295. if (key === keyboard_1.KEY.DELETE) {
  3296. return constants_1.InteractionTrigger.DELETE_KEY;
  3297. }
  3298. if (key === keyboard_1.KEY.BACKSPACE) {
  3299. return constants_1.InteractionTrigger.BACKSPACE_KEY;
  3300. }
  3301. // Default case, should never be returned
  3302. return constants_1.InteractionTrigger.UNSPECIFIED;
  3303. };
  3304. return MDCChipTrailingActionFoundation;
  3305. }(foundation_1.MDCFoundation);
  3306. exports.MDCChipTrailingActionFoundation = MDCChipTrailingActionFoundation;
  3307. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3308. exports.default = MDCChipTrailingActionFoundation;
  3309. /***/ }),
  3310. /***/ "./packages/mdc-chips/trailingaction/index.ts":
  3311. /*!****************************************************!*\
  3312. !*** ./packages/mdc-chips/trailingaction/index.ts ***!
  3313. \****************************************************/
  3314. /*! no static exports found */
  3315. /***/ (function(module, exports, __webpack_require__) {
  3316. "use strict";
  3317. /**
  3318. * @license
  3319. * Copyright 2020 Google Inc.
  3320. *
  3321. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3322. * of this software and associated documentation files (the "Software"), to deal
  3323. * in the Software without restriction, including without limitation the rights
  3324. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3325. * copies of the Software, and to permit persons to whom the Software is
  3326. * furnished to do so, subject to the following conditions:
  3327. *
  3328. * The above copyright notice and this permission notice shall be included in
  3329. * all copies or substantial portions of the Software.
  3330. *
  3331. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3332. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3333. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3334. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3335. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3336. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3337. * THE SOFTWARE.
  3338. */
  3339. function __export(m) {
  3340. for (var p in m) {
  3341. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  3342. }
  3343. }
  3344. Object.defineProperty(exports, "__esModule", { value: true });
  3345. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/trailingaction/component.ts"));
  3346. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/trailingaction/foundation.ts"));
  3347. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts");
  3348. exports.trailingActionStrings = constants_1.strings;
  3349. /***/ }),
  3350. /***/ "./packages/mdc-circular-progress/component.ts":
  3351. /*!*****************************************************!*\
  3352. !*** ./packages/mdc-circular-progress/component.ts ***!
  3353. \*****************************************************/
  3354. /*! no static exports found */
  3355. /***/ (function(module, exports, __webpack_require__) {
  3356. "use strict";
  3357. /**
  3358. * @license
  3359. * Copyright 2020 Google Inc.
  3360. *
  3361. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3362. * of this software and associated documentation files (the "Software"), to deal
  3363. * in the Software without restriction, including without limitation the rights
  3364. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3365. * copies of the Software, and to permit persons to whom the Software is
  3366. * furnished to do so, subject to the following conditions:
  3367. *
  3368. * The above copyright notice and this permission notice shall be included in
  3369. * all copies or substantial portions of the Software.
  3370. *
  3371. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3372. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3373. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3374. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3375. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3376. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3377. * THE SOFTWARE.
  3378. */
  3379. var __extends = this && this.__extends || function () {
  3380. var _extendStatics = function extendStatics(d, b) {
  3381. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3382. d.__proto__ = b;
  3383. } || function (d, b) {
  3384. for (var p in b) {
  3385. if (b.hasOwnProperty(p)) d[p] = b[p];
  3386. }
  3387. };
  3388. return _extendStatics(d, b);
  3389. };
  3390. return function (d, b) {
  3391. _extendStatics(d, b);
  3392. function __() {
  3393. this.constructor = d;
  3394. }
  3395. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3396. };
  3397. }();
  3398. Object.defineProperty(exports, "__esModule", { value: true });
  3399. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3400. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts");
  3401. var MDCCircularProgress = /** @class */function (_super) {
  3402. __extends(MDCCircularProgress, _super);
  3403. function MDCCircularProgress() {
  3404. return _super !== null && _super.apply(this, arguments) || this;
  3405. }
  3406. MDCCircularProgress.prototype.initialize = function () {
  3407. this.determinateCircle_ = this.root.querySelector(foundation_1.MDCCircularProgressFoundation.strings.DETERMINATE_CIRCLE_SELECTOR);
  3408. };
  3409. MDCCircularProgress.attachTo = function (root) {
  3410. return new MDCCircularProgress(root);
  3411. };
  3412. Object.defineProperty(MDCCircularProgress.prototype, "determinate", {
  3413. /**
  3414. * Sets whether the progress indicator is in determinate mode.
  3415. * @param isDeterminate Whether the indicator should be determinate.
  3416. */
  3417. set: function set(value) {
  3418. this.foundation.setDeterminate(value);
  3419. },
  3420. enumerable: true,
  3421. configurable: true
  3422. });
  3423. Object.defineProperty(MDCCircularProgress.prototype, "progress", {
  3424. /**
  3425. * Sets the current progress value. In indeterminate mode, this has no
  3426. * visual effect but will be reflected if the indicator is switched to
  3427. * determinate mode.
  3428. * @param value The current progress value, which must be between 0 and 1.
  3429. */
  3430. set: function set(value) {
  3431. this.foundation.setProgress(value);
  3432. },
  3433. enumerable: true,
  3434. configurable: true
  3435. });
  3436. Object.defineProperty(MDCCircularProgress.prototype, "isClosed", {
  3437. /**
  3438. * Whether the progress indicator is hidden.
  3439. */
  3440. get: function get() {
  3441. return this.foundation.isClosed();
  3442. },
  3443. enumerable: true,
  3444. configurable: true
  3445. });
  3446. /**
  3447. * Shows the progress indicator.
  3448. */
  3449. MDCCircularProgress.prototype.open = function () {
  3450. this.foundation.open();
  3451. };
  3452. /**
  3453. * Hides the progress indicator.
  3454. */
  3455. MDCCircularProgress.prototype.close = function () {
  3456. this.foundation.close();
  3457. };
  3458. MDCCircularProgress.prototype.getDefaultFoundation = function () {
  3459. var _this = this;
  3460. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3461. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3462. // methods, we need a separate, strongly typed adapter variable.
  3463. var adapter = {
  3464. addClass: function addClass(className) {
  3465. return _this.root.classList.add(className);
  3466. },
  3467. getDeterminateCircleAttribute: function getDeterminateCircleAttribute(attributeName) {
  3468. return _this.determinateCircle_.getAttribute(attributeName);
  3469. },
  3470. hasClass: function hasClass(className) {
  3471. return _this.root.classList.contains(className);
  3472. },
  3473. removeClass: function removeClass(className) {
  3474. return _this.root.classList.remove(className);
  3475. },
  3476. removeAttribute: function removeAttribute(attributeName) {
  3477. return _this.root.removeAttribute(attributeName);
  3478. },
  3479. setAttribute: function setAttribute(attributeName, value) {
  3480. return _this.root.setAttribute(attributeName, value);
  3481. },
  3482. setDeterminateCircleAttribute: function setDeterminateCircleAttribute(attributeName, value) {
  3483. return _this.determinateCircle_.setAttribute(attributeName, value);
  3484. }
  3485. };
  3486. return new foundation_1.MDCCircularProgressFoundation(adapter);
  3487. };
  3488. return MDCCircularProgress;
  3489. }(component_1.MDCComponent);
  3490. exports.MDCCircularProgress = MDCCircularProgress;
  3491. /***/ }),
  3492. /***/ "./packages/mdc-circular-progress/constants.ts":
  3493. /*!*****************************************************!*\
  3494. !*** ./packages/mdc-circular-progress/constants.ts ***!
  3495. \*****************************************************/
  3496. /*! no static exports found */
  3497. /***/ (function(module, exports, __webpack_require__) {
  3498. "use strict";
  3499. /**
  3500. * @license
  3501. * Copyright 2020 Google Inc.
  3502. *
  3503. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3504. * of this software and associated documentation files (the "Software"), to deal
  3505. * in the Software without restriction, including without limitation the rights
  3506. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3507. * copies of the Software, and to permit persons to whom the Software is
  3508. * furnished to do so, subject to the following conditions:
  3509. *
  3510. * The above copyright notice and this permission notice shall be included in
  3511. * all copies or substantial portions of the Software.
  3512. *
  3513. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3514. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3515. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3516. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3517. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3518. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3519. * THE SOFTWARE.
  3520. */
  3521. Object.defineProperty(exports, "__esModule", { value: true });
  3522. /**
  3523. * CSS class names used in component.
  3524. */
  3525. exports.cssClasses = {
  3526. INDETERMINATE_CLASS: 'mdc-circular-progress--indeterminate',
  3527. CLOSED_CLASS: 'mdc-circular-progress--closed'
  3528. };
  3529. /**
  3530. * Attributes and selectors used in component.
  3531. */
  3532. exports.strings = {
  3533. DETERMINATE_CIRCLE_SELECTOR: '.mdc-circular-progress__determinate-circle',
  3534. ARIA_VALUENOW: 'aria-valuenow',
  3535. RADIUS: 'r',
  3536. STROKE_DASHOFFSET: 'stroke-dashoffset'
  3537. };
  3538. /***/ }),
  3539. /***/ "./packages/mdc-circular-progress/foundation.ts":
  3540. /*!******************************************************!*\
  3541. !*** ./packages/mdc-circular-progress/foundation.ts ***!
  3542. \******************************************************/
  3543. /*! no static exports found */
  3544. /***/ (function(module, exports, __webpack_require__) {
  3545. "use strict";
  3546. /**
  3547. * @license
  3548. * Copyright 2020 Google Inc.
  3549. *
  3550. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3551. * of this software and associated documentation files (the "Software"), to deal
  3552. * in the Software without restriction, including without limitation the rights
  3553. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3554. * copies of the Software, and to permit persons to whom the Software is
  3555. * furnished to do so, subject to the following conditions:
  3556. *
  3557. * The above copyright notice and this permission notice shall be included in
  3558. * all copies or substantial portions of the Software.
  3559. *
  3560. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3561. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3562. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3563. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3564. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3565. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3566. * THE SOFTWARE.
  3567. */
  3568. var __extends = this && this.__extends || function () {
  3569. var _extendStatics = function extendStatics(d, b) {
  3570. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3571. d.__proto__ = b;
  3572. } || function (d, b) {
  3573. for (var p in b) {
  3574. if (b.hasOwnProperty(p)) d[p] = b[p];
  3575. }
  3576. };
  3577. return _extendStatics(d, b);
  3578. };
  3579. return function (d, b) {
  3580. _extendStatics(d, b);
  3581. function __() {
  3582. this.constructor = d;
  3583. }
  3584. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3585. };
  3586. }();
  3587. var __assign = this && this.__assign || function () {
  3588. __assign = Object.assign || function (t) {
  3589. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3590. s = arguments[i];
  3591. for (var p in s) {
  3592. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3593. }
  3594. }
  3595. return t;
  3596. };
  3597. return __assign.apply(this, arguments);
  3598. };
  3599. Object.defineProperty(exports, "__esModule", { value: true });
  3600. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  3601. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts");
  3602. var MDCCircularProgressFoundation = /** @class */function (_super) {
  3603. __extends(MDCCircularProgressFoundation, _super);
  3604. function MDCCircularProgressFoundation(adapter) {
  3605. return _super.call(this, __assign(__assign({}, MDCCircularProgressFoundation.defaultAdapter), adapter)) || this;
  3606. }
  3607. Object.defineProperty(MDCCircularProgressFoundation, "cssClasses", {
  3608. get: function get() {
  3609. return constants_1.cssClasses;
  3610. },
  3611. enumerable: true,
  3612. configurable: true
  3613. });
  3614. Object.defineProperty(MDCCircularProgressFoundation, "strings", {
  3615. get: function get() {
  3616. return constants_1.strings;
  3617. },
  3618. enumerable: true,
  3619. configurable: true
  3620. });
  3621. Object.defineProperty(MDCCircularProgressFoundation, "defaultAdapter", {
  3622. get: function get() {
  3623. return {
  3624. addClass: function addClass() {
  3625. return undefined;
  3626. },
  3627. getDeterminateCircleAttribute: function getDeterminateCircleAttribute() {
  3628. return null;
  3629. },
  3630. hasClass: function hasClass() {
  3631. return false;
  3632. },
  3633. removeClass: function removeClass() {
  3634. return undefined;
  3635. },
  3636. removeAttribute: function removeAttribute() {
  3637. return undefined;
  3638. },
  3639. setAttribute: function setAttribute() {
  3640. return undefined;
  3641. },
  3642. setDeterminateCircleAttribute: function setDeterminateCircleAttribute() {
  3643. return undefined;
  3644. }
  3645. };
  3646. },
  3647. enumerable: true,
  3648. configurable: true
  3649. });
  3650. MDCCircularProgressFoundation.prototype.init = function () {
  3651. this.isClosed_ = this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS);
  3652. this.isDeterminate_ = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  3653. this.progress_ = 0;
  3654. if (this.isDeterminate_) {
  3655. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString());
  3656. }
  3657. this.radius_ = Number(this.adapter.getDeterminateCircleAttribute(constants_1.strings.RADIUS));
  3658. };
  3659. MDCCircularProgressFoundation.prototype.isDeterminate = function () {
  3660. return this.isDeterminate_;
  3661. };
  3662. MDCCircularProgressFoundation.prototype.getProgress = function () {
  3663. return this.progress_;
  3664. };
  3665. /**
  3666. * @return Returns whether the progress indicator is hidden.
  3667. */
  3668. MDCCircularProgressFoundation.prototype.isClosed = function () {
  3669. return this.isClosed_;
  3670. };
  3671. /**
  3672. * Sets whether the progress indicator is in determinate mode.
  3673. * @param isDeterminate Whether the indicator should be determinate.
  3674. */
  3675. MDCCircularProgressFoundation.prototype.setDeterminate = function (isDeterminate) {
  3676. this.isDeterminate_ = isDeterminate;
  3677. if (this.isDeterminate_) {
  3678. this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  3679. this.setProgress(this.progress_);
  3680. } else {
  3681. this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  3682. this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW);
  3683. }
  3684. };
  3685. /**
  3686. * Sets the current progress value. In indeterminate mode, this has no
  3687. * visual effect but will be reflected if the indicator is switched to
  3688. * determinate mode.
  3689. * @param value The current progress value, which must be between 0 and 1.
  3690. */
  3691. MDCCircularProgressFoundation.prototype.setProgress = function (value) {
  3692. this.progress_ = value;
  3693. if (this.isDeterminate_) {
  3694. var unfilledArcLength = (1 - this.progress_) * (2 * Math.PI * this.radius_);
  3695. this.adapter.setDeterminateCircleAttribute(constants_1.strings.STROKE_DASHOFFSET, "" + unfilledArcLength);
  3696. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString());
  3697. }
  3698. };
  3699. /**
  3700. * Shows the progress indicator.
  3701. */
  3702. MDCCircularProgressFoundation.prototype.open = function () {
  3703. this.isClosed_ = false;
  3704. this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS);
  3705. };
  3706. /**
  3707. * Hides the progress indicator
  3708. */
  3709. MDCCircularProgressFoundation.prototype.close = function () {
  3710. this.isClosed_ = true;
  3711. this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS);
  3712. };
  3713. return MDCCircularProgressFoundation;
  3714. }(foundation_1.MDCFoundation);
  3715. exports.MDCCircularProgressFoundation = MDCCircularProgressFoundation;
  3716. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3717. exports.default = MDCCircularProgressFoundation;
  3718. /***/ }),
  3719. /***/ "./packages/mdc-circular-progress/index.ts":
  3720. /*!*************************************************!*\
  3721. !*** ./packages/mdc-circular-progress/index.ts ***!
  3722. \*************************************************/
  3723. /*! no static exports found */
  3724. /***/ (function(module, exports, __webpack_require__) {
  3725. "use strict";
  3726. /**
  3727. * @license
  3728. * Copyright 2020 Google Inc.
  3729. *
  3730. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3731. * of this software and associated documentation files (the "Software"), to deal
  3732. * in the Software without restriction, including without limitation the rights
  3733. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3734. * copies of the Software, and to permit persons to whom the Software is
  3735. * furnished to do so, subject to the following conditions:
  3736. *
  3737. * The above copyright notice and this permission notice shall be included in
  3738. * all copies or substantial portions of the Software.
  3739. *
  3740. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3741. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3742. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3743. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3744. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3745. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3746. * THE SOFTWARE.
  3747. */
  3748. function __export(m) {
  3749. for (var p in m) {
  3750. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  3751. }
  3752. }
  3753. Object.defineProperty(exports, "__esModule", { value: true });
  3754. __export(__webpack_require__(/*! ./component */ "./packages/mdc-circular-progress/component.ts"));
  3755. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts"));
  3756. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts"));
  3757. /***/ }),
  3758. /***/ "./packages/mdc-data-table/component.ts":
  3759. /*!**********************************************!*\
  3760. !*** ./packages/mdc-data-table/component.ts ***!
  3761. \**********************************************/
  3762. /*! no static exports found */
  3763. /***/ (function(module, exports, __webpack_require__) {
  3764. "use strict";
  3765. /**
  3766. * @license
  3767. * Copyright 2019 Google Inc.
  3768. *
  3769. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3770. * of this software and associated documentation files (the "Software"), to deal
  3771. * in the Software without restriction, including without limitation the rights
  3772. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3773. * copies of the Software, and to permit persons to whom the Software is
  3774. * furnished to do so, subject to the following conditions:
  3775. *
  3776. * The above copyright notice and this permission notice shall be included in
  3777. * all copies or substantial portions of the Software.
  3778. *
  3779. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3780. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3781. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3782. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3783. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3784. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3785. * THE SOFTWARE.
  3786. */
  3787. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  3788. var __extends = this && this.__extends || function () {
  3789. var _extendStatics = function extendStatics(d, b) {
  3790. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3791. d.__proto__ = b;
  3792. } || function (d, b) {
  3793. for (var p in b) {
  3794. if (b.hasOwnProperty(p)) d[p] = b[p];
  3795. }
  3796. };
  3797. return _extendStatics(d, b);
  3798. };
  3799. return function (d, b) {
  3800. _extendStatics(d, b);
  3801. function __() {
  3802. this.constructor = d;
  3803. }
  3804. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3805. };
  3806. }();
  3807. Object.defineProperty(exports, "__esModule", { value: true });
  3808. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3809. var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts");
  3810. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  3811. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  3812. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts");
  3813. /**
  3814. * Implementation of `MDCDataTableFoundation`
  3815. */
  3816. var MDCDataTable = /** @class */function (_super) {
  3817. __extends(MDCDataTable, _super);
  3818. function MDCDataTable() {
  3819. return _super !== null && _super.apply(this, arguments) || this;
  3820. }
  3821. MDCDataTable.attachTo = function (root) {
  3822. return new MDCDataTable(root);
  3823. };
  3824. MDCDataTable.prototype.initialize = function (checkboxFactory) {
  3825. if (checkboxFactory === void 0) {
  3826. checkboxFactory = function checkboxFactory(el) {
  3827. return new component_2.MDCCheckbox(el);
  3828. };
  3829. }
  3830. this.checkboxFactory = checkboxFactory;
  3831. };
  3832. MDCDataTable.prototype.initialSyncWithDOM = function () {
  3833. var _this = this;
  3834. this.headerRow = this.root.querySelector("." + constants_1.cssClasses.HEADER_ROW);
  3835. this.handleHeaderRowCheckboxChange = function () {
  3836. return _this.foundation.handleHeaderRowCheckboxChange();
  3837. };
  3838. this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange);
  3839. this.headerRowClickListener = function (event) {
  3840. _this.handleHeaderRowClick(event);
  3841. };
  3842. this.headerRow.addEventListener('click', this.headerRowClickListener);
  3843. this.content = this.root.querySelector("." + constants_1.cssClasses.CONTENT);
  3844. this.handleRowCheckboxChange = function (event) {
  3845. return _this.foundation.handleRowCheckboxChange(event);
  3846. };
  3847. this.content.addEventListener('change', this.handleRowCheckboxChange);
  3848. this.layout();
  3849. };
  3850. /**
  3851. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  3852. */
  3853. MDCDataTable.prototype.layout = function () {
  3854. this.foundation.layout();
  3855. };
  3856. /**
  3857. * @return Returns array of header row cell elements.
  3858. */
  3859. MDCDataTable.prototype.getHeaderCells = function () {
  3860. return [].slice.call(this.root.querySelectorAll(constants_1.selectors.HEADER_CELL));
  3861. };
  3862. /**
  3863. * @return Returns array of row elements.
  3864. */
  3865. MDCDataTable.prototype.getRows = function () {
  3866. return this.foundation.getRows();
  3867. };
  3868. /**
  3869. * @return Returns array of selected row ids.
  3870. */
  3871. MDCDataTable.prototype.getSelectedRowIds = function () {
  3872. return this.foundation.getSelectedRowIds();
  3873. };
  3874. /**
  3875. * Sets selected row ids. Overwrites previously selected rows.
  3876. * @param rowIds Array of row ids that needs to be selected.
  3877. */
  3878. MDCDataTable.prototype.setSelectedRowIds = function (rowIds) {
  3879. this.foundation.setSelectedRowIds(rowIds);
  3880. };
  3881. MDCDataTable.prototype.destroy = function () {
  3882. this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange);
  3883. this.headerRow.removeEventListener('click', this.headerRowClickListener);
  3884. this.content.removeEventListener('change', this.handleRowCheckboxChange);
  3885. this.headerRowCheckbox.destroy();
  3886. this.rowCheckboxList.forEach(function (checkbox) {
  3887. checkbox.destroy();
  3888. });
  3889. };
  3890. MDCDataTable.prototype.getDefaultFoundation = function () {
  3891. var _this = this;
  3892. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  3893. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  3894. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  3895. var adapter = {
  3896. addClass: function addClass(className) {
  3897. _this.root.classList.add(className);
  3898. },
  3899. removeClass: function removeClass(className) {
  3900. _this.root.classList.remove(className);
  3901. },
  3902. getHeaderCellElements: function getHeaderCellElements() {
  3903. return _this.getHeaderCells();
  3904. },
  3905. getHeaderCellCount: function getHeaderCellCount() {
  3906. return _this.getHeaderCells().length;
  3907. },
  3908. getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex(index, attribute) {
  3909. return _this.getHeaderCells()[index].getAttribute(attribute);
  3910. },
  3911. setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex(index, attribute, value) {
  3912. _this.getHeaderCells()[index].setAttribute(attribute, value);
  3913. },
  3914. setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex(index, className) {
  3915. _this.getHeaderCells()[index].classList.add(className);
  3916. },
  3917. removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex(index, className) {
  3918. _this.getHeaderCells()[index].classList.remove(className);
  3919. },
  3920. notifySortAction: function notifySortAction(data) {
  3921. _this.emit(constants_1.events.SORTED, data, /** shouldBubble */true);
  3922. },
  3923. getTableBodyHeight: function getTableBodyHeight() {
  3924. var tableBody = _this.root.querySelector(constants_1.selectors.CONTENT);
  3925. if (!tableBody) {
  3926. throw new Error('MDCDataTable: Table body element not found.');
  3927. }
  3928. return tableBody.getBoundingClientRect().height + "px";
  3929. },
  3930. getTableHeaderHeight: function getTableHeaderHeight() {
  3931. var tableHeader = _this.root.querySelector(constants_1.selectors.HEADER_ROW);
  3932. if (!tableHeader) {
  3933. throw new Error('MDCDataTable: Table header element not found.');
  3934. }
  3935. return tableHeader.getBoundingClientRect().height + "px";
  3936. },
  3937. setProgressIndicatorStyles: function setProgressIndicatorStyles(styles) {
  3938. var progressIndicator = _this.root.querySelector(constants_1.selectors.PROGRESS_INDICATOR);
  3939. if (!progressIndicator) {
  3940. throw new Error('MDCDataTable: Progress indicator element not found.');
  3941. }
  3942. _extends(progressIndicator.style, styles);
  3943. },
  3944. addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) {
  3945. _this.getRows()[rowIndex].classList.add(className);
  3946. },
  3947. getRowCount: function getRowCount() {
  3948. return _this.getRows().length;
  3949. },
  3950. getRowElements: function getRowElements() {
  3951. return [].slice.call(_this.root.querySelectorAll(constants_1.selectors.ROW));
  3952. },
  3953. getRowIdAtIndex: function getRowIdAtIndex(rowIndex) {
  3954. return _this.getRows()[rowIndex].getAttribute(constants_1.dataAttributes.ROW_ID);
  3955. },
  3956. getRowIndexByChildElement: function getRowIndexByChildElement(el) {
  3957. return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.selectors.ROW));
  3958. },
  3959. getSelectedRowCount: function getSelectedRowCount() {
  3960. return _this.root.querySelectorAll(constants_1.selectors.ROW_SELECTED).length;
  3961. },
  3962. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) {
  3963. return _this.rowCheckboxList[rowIndex].checked;
  3964. },
  3965. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  3966. return _this.headerRowCheckbox.checked;
  3967. },
  3968. isRowsSelectable: function isRowsSelectable() {
  3969. return !!_this.root.querySelector(constants_1.selectors.ROW_CHECKBOX);
  3970. },
  3971. notifyRowSelectionChanged: function notifyRowSelectionChanged(data) {
  3972. _this.emit(constants_1.events.ROW_SELECTION_CHANGED, {
  3973. row: _this.getRowByIndex(data.rowIndex),
  3974. rowId: _this.getRowIdByIndex(data.rowIndex),
  3975. rowIndex: data.rowIndex,
  3976. selected: data.selected
  3977. },
  3978. /** shouldBubble */true);
  3979. },
  3980. notifySelectedAll: function notifySelectedAll() {
  3981. _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true);
  3982. },
  3983. notifyUnselectedAll: function notifyUnselectedAll() {
  3984. _this.emit(constants_1.events.UNSELECTED_ALL, {}, /** shouldBubble */true);
  3985. },
  3986. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  3987. if (_this.headerRowCheckbox) {
  3988. _this.headerRowCheckbox.destroy();
  3989. }
  3990. var checkboxEl = _this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX);
  3991. _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl);
  3992. },
  3993. registerRowCheckboxes: function registerRowCheckboxes() {
  3994. if (_this.rowCheckboxList) {
  3995. _this.rowCheckboxList.forEach(function (checkbox) {
  3996. checkbox.destroy();
  3997. });
  3998. }
  3999. _this.rowCheckboxList = [];
  4000. _this.getRows().forEach(function (rowEl) {
  4001. var checkbox = _this.checkboxFactory(rowEl.querySelector(constants_1.selectors.ROW_CHECKBOX));
  4002. _this.rowCheckboxList.push(checkbox);
  4003. });
  4004. },
  4005. removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) {
  4006. _this.getRows()[rowIndex].classList.remove(className);
  4007. },
  4008. setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) {
  4009. _this.getRows()[rowIndex].setAttribute(attr, value);
  4010. },
  4011. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) {
  4012. _this.headerRowCheckbox.checked = checked;
  4013. },
  4014. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) {
  4015. _this.headerRowCheckbox.indeterminate = indeterminate;
  4016. },
  4017. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) {
  4018. _this.rowCheckboxList[rowIndex].checked = checked;
  4019. },
  4020. setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue) {
  4021. var headerCell = _this.getHeaderCells()[columnIndex];
  4022. var sortStatusLabel = headerCell.querySelector(constants_1.selectors.SORT_STATUS_LABEL);
  4023. if (!sortStatusLabel) return;
  4024. sortStatusLabel.textContent = _this.getSortStatusMessageBySortValue(sortValue);
  4025. }
  4026. };
  4027. return new foundation_1.MDCDataTableFoundation(adapter);
  4028. };
  4029. MDCDataTable.prototype.getRowByIndex = function (index) {
  4030. return this.getRows()[index];
  4031. };
  4032. MDCDataTable.prototype.getRowIdByIndex = function (index) {
  4033. return this.getRowByIndex(index).getAttribute(constants_1.dataAttributes.ROW_ID);
  4034. };
  4035. MDCDataTable.prototype.handleHeaderRowClick = function (event) {
  4036. var headerCell = ponyfill_1.closest(event.target, constants_1.selectors.HEADER_CELL_WITH_SORT);
  4037. if (!headerCell) {
  4038. return;
  4039. }
  4040. var columnId = headerCell.getAttribute(constants_1.dataAttributes.COLUMN_ID);
  4041. var columnIndex = this.getHeaderCells().indexOf(headerCell);
  4042. if (columnIndex === -1) {
  4043. return;
  4044. }
  4045. this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell });
  4046. };
  4047. MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) {
  4048. switch (sortValue) {
  4049. case constants_1.SortValue.ASCENDING:
  4050. return constants_1.messages.SORTED_IN_ASCENDING;
  4051. case constants_1.SortValue.DESCENDING:
  4052. return constants_1.messages.SORTED_IN_DESCENDING;
  4053. default:
  4054. return '';
  4055. }
  4056. };
  4057. return MDCDataTable;
  4058. }(component_1.MDCComponent);
  4059. exports.MDCDataTable = MDCDataTable;
  4060. /***/ }),
  4061. /***/ "./packages/mdc-data-table/constants.ts":
  4062. /*!**********************************************!*\
  4063. !*** ./packages/mdc-data-table/constants.ts ***!
  4064. \**********************************************/
  4065. /*! no static exports found */
  4066. /***/ (function(module, exports, __webpack_require__) {
  4067. "use strict";
  4068. /**
  4069. * @license
  4070. * Copyright 2019 Google Inc.
  4071. *
  4072. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4073. * of this software and associated documentation files (the "Software"), to deal
  4074. * in the Software without restriction, including without limitation the rights
  4075. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4076. * copies of the Software, and to permit persons to whom the Software is
  4077. * furnished to do so, subject to the following conditions:
  4078. *
  4079. * The above copyright notice and this permission notice shall be included in
  4080. * all copies or substantial portions of the Software.
  4081. *
  4082. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4083. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4084. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4085. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4086. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4087. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4088. * THE SOFTWARE.
  4089. */
  4090. Object.defineProperty(exports, "__esModule", { value: true });
  4091. /**
  4092. * CSS class names used in component.
  4093. */
  4094. exports.cssClasses = {
  4095. CELL: 'mdc-data-table__cell',
  4096. CELL_NUMERIC: 'mdc-data-table__cell--numeric',
  4097. CONTENT: 'mdc-data-table__content',
  4098. HEADER_CELL: 'mdc-data-table__header-cell',
  4099. HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label',
  4100. HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted',
  4101. HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending',
  4102. HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort',
  4103. HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper',
  4104. HEADER_ROW: 'mdc-data-table__header-row',
  4105. HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',
  4106. IN_PROGRESS: 'mdc-data-table--in-progress',
  4107. PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator',
  4108. ROOT: 'mdc-data-table',
  4109. ROW: 'mdc-data-table__row',
  4110. ROW_CHECKBOX: 'mdc-data-table__row-checkbox',
  4111. ROW_SELECTED: 'mdc-data-table__row--selected',
  4112. SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button',
  4113. SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label',
  4114. PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select',
  4115. PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label'
  4116. };
  4117. /**
  4118. * DOM attributes used in component.
  4119. */
  4120. exports.attributes = {
  4121. ARIA_SELECTED: 'aria-selected',
  4122. ARIA_SORT: 'aria-sort'
  4123. };
  4124. /**
  4125. * List of data attributes used in component.
  4126. */
  4127. exports.dataAttributes = {
  4128. COLUMN_ID: 'data-column-id',
  4129. ROW_ID: 'data-row-id'
  4130. };
  4131. /**
  4132. * CSS selectors used in component.
  4133. */
  4134. exports.selectors = {
  4135. CONTENT: "." + exports.cssClasses.CONTENT,
  4136. HEADER_CELL: "." + exports.cssClasses.HEADER_CELL,
  4137. HEADER_CELL_WITH_SORT: "." + exports.cssClasses.HEADER_CELL_WITH_SORT,
  4138. HEADER_ROW: "." + exports.cssClasses.HEADER_ROW,
  4139. HEADER_ROW_CHECKBOX: "." + exports.cssClasses.HEADER_ROW_CHECKBOX,
  4140. PROGRESS_INDICATOR: "." + exports.cssClasses.PROGRESS_INDICATOR,
  4141. ROW: "." + exports.cssClasses.ROW,
  4142. ROW_CHECKBOX: "." + exports.cssClasses.ROW_CHECKBOX,
  4143. ROW_SELECTED: "." + exports.cssClasses.ROW_SELECTED,
  4144. SORT_ICON_BUTTON: "." + exports.cssClasses.SORT_ICON_BUTTON,
  4145. SORT_STATUS_LABEL: "." + exports.cssClasses.SORT_STATUS_LABEL
  4146. };
  4147. /**
  4148. * Messages used in component.
  4149. */
  4150. exports.messages = {
  4151. SORTED_IN_DESCENDING: 'Sorted in descending order',
  4152. SORTED_IN_ASCENDING: 'Sorted in ascending order'
  4153. };
  4154. /**
  4155. * Attributes and selectors used in component.
  4156. * @deprecated Use `attributes`, `dataAttributes` and `selectors` instead.
  4157. */
  4158. exports.strings = {
  4159. ARIA_SELECTED: exports.attributes.ARIA_SELECTED,
  4160. ARIA_SORT: exports.attributes.ARIA_SORT,
  4161. DATA_ROW_ID_ATTR: exports.dataAttributes.ROW_ID,
  4162. HEADER_ROW_CHECKBOX_SELECTOR: exports.selectors.HEADER_ROW_CHECKBOX,
  4163. ROW_CHECKBOX_SELECTOR: exports.selectors.ROW_CHECKBOX,
  4164. ROW_SELECTED_SELECTOR: exports.selectors.ROW_SELECTED,
  4165. ROW_SELECTOR: exports.selectors.ROW
  4166. };
  4167. /**
  4168. * Sort values defined by ARIA.
  4169. * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort
  4170. */
  4171. var SortValue;
  4172. (function (SortValue) {
  4173. // Items are sorted in ascending order by this column.
  4174. SortValue["ASCENDING"] = "ascending";
  4175. // Items are sorted in descending order by this column.
  4176. SortValue["DESCENDING"] = "descending";
  4177. // There is no defined sort applied to the column.
  4178. SortValue["NONE"] = "none";
  4179. // A sort algorithm other than ascending or descending has been applied.
  4180. SortValue["OTHER"] = "other";
  4181. })(SortValue = exports.SortValue || (exports.SortValue = {}));
  4182. /**
  4183. * Event names used in component.
  4184. */
  4185. exports.events = {
  4186. ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged',
  4187. SELECTED_ALL: 'MDCDataTable:selectedAll',
  4188. UNSELECTED_ALL: 'MDCDataTable:unselectedAll',
  4189. SORTED: 'MDCDataTable:sorted'
  4190. };
  4191. /***/ }),
  4192. /***/ "./packages/mdc-data-table/foundation.ts":
  4193. /*!***********************************************!*\
  4194. !*** ./packages/mdc-data-table/foundation.ts ***!
  4195. \***********************************************/
  4196. /*! no static exports found */
  4197. /***/ (function(module, exports, __webpack_require__) {
  4198. "use strict";
  4199. /**
  4200. * @license
  4201. * Copyright 2019 Google Inc.
  4202. *
  4203. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4204. * of this software and associated documentation files (the "Software"), to deal
  4205. * in the Software without restriction, including without limitation the rights
  4206. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4207. * copies of the Software, and to permit persons to whom the Software is
  4208. * furnished to do so, subject to the following conditions:
  4209. *
  4210. * The above copyright notice and this permission notice shall be included in
  4211. * all copies or substantial portions of the Software.
  4212. *
  4213. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4214. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4215. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4216. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4217. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4218. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4219. * THE SOFTWARE.
  4220. */
  4221. var __extends = this && this.__extends || function () {
  4222. var _extendStatics = function extendStatics(d, b) {
  4223. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4224. d.__proto__ = b;
  4225. } || function (d, b) {
  4226. for (var p in b) {
  4227. if (b.hasOwnProperty(p)) d[p] = b[p];
  4228. }
  4229. };
  4230. return _extendStatics(d, b);
  4231. };
  4232. return function (d, b) {
  4233. _extendStatics(d, b);
  4234. function __() {
  4235. this.constructor = d;
  4236. }
  4237. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4238. };
  4239. }();
  4240. var __assign = this && this.__assign || function () {
  4241. __assign = Object.assign || function (t) {
  4242. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4243. s = arguments[i];
  4244. for (var p in s) {
  4245. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4246. }
  4247. }
  4248. return t;
  4249. };
  4250. return __assign.apply(this, arguments);
  4251. };
  4252. var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
  4253. function adopt(value) {
  4254. return value instanceof P ? value : new P(function (resolve) {
  4255. resolve(value);
  4256. });
  4257. }
  4258. return new (P || (P = Promise))(function (resolve, reject) {
  4259. function fulfilled(value) {
  4260. try {
  4261. step(generator.next(value));
  4262. } catch (e) {
  4263. reject(e);
  4264. }
  4265. }
  4266. function rejected(value) {
  4267. try {
  4268. step(generator["throw"](value));
  4269. } catch (e) {
  4270. reject(e);
  4271. }
  4272. }
  4273. function step(result) {
  4274. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  4275. }
  4276. step((generator = generator.apply(thisArg, _arguments || [])).next());
  4277. });
  4278. };
  4279. var __generator = this && this.__generator || function (thisArg, body) {
  4280. var _ = { label: 0, sent: function sent() {
  4281. if (t[0] & 1) throw t[1];return t[1];
  4282. }, trys: [], ops: [] },
  4283. f,
  4284. y,
  4285. t,
  4286. g;
  4287. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
  4288. return this;
  4289. }), g;
  4290. function verb(n) {
  4291. return function (v) {
  4292. return step([n, v]);
  4293. };
  4294. }
  4295. function step(op) {
  4296. if (f) throw new TypeError("Generator is already executing.");
  4297. while (_) {
  4298. try {
  4299. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  4300. if (y = 0, t) op = [op[0] & 2, t.value];
  4301. switch (op[0]) {
  4302. case 0:case 1:
  4303. t = op;break;
  4304. case 4:
  4305. _.label++;return { value: op[1], done: false };
  4306. case 5:
  4307. _.label++;y = op[1];op = [0];continue;
  4308. case 7:
  4309. op = _.ops.pop();_.trys.pop();continue;
  4310. default:
  4311. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  4312. _ = 0;continue;
  4313. }
  4314. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  4315. _.label = op[1];break;
  4316. }
  4317. if (op[0] === 6 && _.label < t[1]) {
  4318. _.label = t[1];t = op;break;
  4319. }
  4320. if (t && _.label < t[2]) {
  4321. _.label = t[2];_.ops.push(op);break;
  4322. }
  4323. if (t[2]) _.ops.pop();
  4324. _.trys.pop();continue;
  4325. }
  4326. op = body.call(thisArg, _);
  4327. } catch (e) {
  4328. op = [6, e];y = 0;
  4329. } finally {
  4330. f = t = 0;
  4331. }
  4332. }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
  4333. }
  4334. };
  4335. Object.defineProperty(exports, "__esModule", { value: true });
  4336. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4337. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  4338. /**
  4339. * The Foundation of data table component containing pure business logic, any
  4340. * logic requiring DOM manipulation are delegated to adapter methods.
  4341. */
  4342. var MDCDataTableFoundation = /** @class */function (_super) {
  4343. __extends(MDCDataTableFoundation, _super);
  4344. function MDCDataTableFoundation(adapter) {
  4345. return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this;
  4346. }
  4347. Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", {
  4348. get: function get() {
  4349. return {
  4350. addClass: function addClass() {
  4351. return undefined;
  4352. },
  4353. addClassAtRowIndex: function addClassAtRowIndex() {
  4354. return undefined;
  4355. },
  4356. getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex() {
  4357. return '';
  4358. },
  4359. getHeaderCellCount: function getHeaderCellCount() {
  4360. return 0;
  4361. },
  4362. getHeaderCellElements: function getHeaderCellElements() {
  4363. return [];
  4364. },
  4365. getRowCount: function getRowCount() {
  4366. return 0;
  4367. },
  4368. getRowElements: function getRowElements() {
  4369. return [];
  4370. },
  4371. getRowIdAtIndex: function getRowIdAtIndex() {
  4372. return '';
  4373. },
  4374. getRowIndexByChildElement: function getRowIndexByChildElement() {
  4375. return 0;
  4376. },
  4377. getSelectedRowCount: function getSelectedRowCount() {
  4378. return 0;
  4379. },
  4380. getTableBodyHeight: function getTableBodyHeight() {
  4381. return '';
  4382. },
  4383. getTableHeaderHeight: function getTableHeaderHeight() {
  4384. return '';
  4385. },
  4386. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() {
  4387. return false;
  4388. },
  4389. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  4390. return false;
  4391. },
  4392. isRowsSelectable: function isRowsSelectable() {
  4393. return false;
  4394. },
  4395. notifyRowSelectionChanged: function notifyRowSelectionChanged() {
  4396. return undefined;
  4397. },
  4398. notifySelectedAll: function notifySelectedAll() {
  4399. return undefined;
  4400. },
  4401. notifySortAction: function notifySortAction() {
  4402. return undefined;
  4403. },
  4404. notifyUnselectedAll: function notifyUnselectedAll() {
  4405. return undefined;
  4406. },
  4407. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  4408. return undefined;
  4409. },
  4410. registerRowCheckboxes: function registerRowCheckboxes() {
  4411. return undefined;
  4412. },
  4413. removeClass: function removeClass() {
  4414. return undefined;
  4415. },
  4416. removeClassAtRowIndex: function removeClassAtRowIndex() {
  4417. return undefined;
  4418. },
  4419. removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex() {
  4420. return undefined;
  4421. },
  4422. setAttributeAtRowIndex: function setAttributeAtRowIndex() {
  4423. return undefined;
  4424. },
  4425. setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex() {
  4426. return undefined;
  4427. },
  4428. setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex() {
  4429. return undefined;
  4430. },
  4431. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() {
  4432. return undefined;
  4433. },
  4434. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() {
  4435. return undefined;
  4436. },
  4437. setProgressIndicatorStyles: function setProgressIndicatorStyles() {
  4438. return undefined;
  4439. },
  4440. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() {
  4441. return undefined;
  4442. },
  4443. setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex() {
  4444. return undefined;
  4445. }
  4446. };
  4447. },
  4448. enumerable: true,
  4449. configurable: true
  4450. });
  4451. /**
  4452. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  4453. * Use this if registering checkbox is synchronous.
  4454. */
  4455. MDCDataTableFoundation.prototype.layout = function () {
  4456. if (this.adapter.isRowsSelectable()) {
  4457. this.adapter.registerHeaderRowCheckbox();
  4458. this.adapter.registerRowCheckboxes();
  4459. this.setHeaderRowCheckboxState();
  4460. }
  4461. };
  4462. /**
  4463. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  4464. * Use this if registering checkbox is asynchronous.
  4465. */
  4466. MDCDataTableFoundation.prototype.layoutAsync = function () {
  4467. return __awaiter(this, void 0, void 0, function () {
  4468. return __generator(this, function (_a) {
  4469. switch (_a.label) {
  4470. case 0:
  4471. if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3];
  4472. return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()];
  4473. case 1:
  4474. _a.sent();
  4475. return [4 /*yield*/, this.adapter.registerRowCheckboxes()];
  4476. case 2:
  4477. _a.sent();
  4478. this.setHeaderRowCheckboxState();
  4479. _a.label = 3;
  4480. case 3:
  4481. return [2 /*return*/];
  4482. }
  4483. });
  4484. });
  4485. };
  4486. /**
  4487. * @return Returns array of row elements.
  4488. */
  4489. MDCDataTableFoundation.prototype.getRows = function () {
  4490. return this.adapter.getRowElements();
  4491. };
  4492. /**
  4493. * @return Array of header cell elements.
  4494. */
  4495. MDCDataTableFoundation.prototype.getHeaderCells = function () {
  4496. return this.adapter.getHeaderCellElements();
  4497. };
  4498. /**
  4499. * Sets selected row ids. Overwrites previously selected rows.
  4500. * @param rowIds Array of row ids that needs to be selected.
  4501. */
  4502. MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {
  4503. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  4504. var rowId = this.adapter.getRowIdAtIndex(rowIndex);
  4505. var isSelected = false;
  4506. if (rowId && rowIds.indexOf(rowId) >= 0) {
  4507. isSelected = true;
  4508. }
  4509. this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);
  4510. this.selectRowAtIndex(rowIndex, isSelected);
  4511. }
  4512. this.setHeaderRowCheckboxState();
  4513. };
  4514. /**
  4515. * @return Returns array of all row ids.
  4516. */
  4517. MDCDataTableFoundation.prototype.getRowIds = function () {
  4518. var rowIds = [];
  4519. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  4520. rowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
  4521. }
  4522. return rowIds;
  4523. };
  4524. /**
  4525. * @return Returns array of selected row ids.
  4526. */
  4527. MDCDataTableFoundation.prototype.getSelectedRowIds = function () {
  4528. var selectedRowIds = [];
  4529. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  4530. if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) {
  4531. selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
  4532. }
  4533. }
  4534. return selectedRowIds;
  4535. };
  4536. /**
  4537. * Handles header row checkbox change event.
  4538. */
  4539. MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {
  4540. var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked();
  4541. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  4542. this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);
  4543. this.selectRowAtIndex(rowIndex, isHeaderChecked);
  4544. }
  4545. if (isHeaderChecked) {
  4546. this.adapter.notifySelectedAll();
  4547. } else {
  4548. this.adapter.notifyUnselectedAll();
  4549. }
  4550. };
  4551. /**
  4552. * Handles change event originated from row checkboxes.
  4553. */
  4554. MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {
  4555. var rowIndex = this.adapter.getRowIndexByChildElement(event.target);
  4556. if (rowIndex === -1) {
  4557. return;
  4558. }
  4559. var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex);
  4560. this.selectRowAtIndex(rowIndex, selected);
  4561. this.setHeaderRowCheckboxState();
  4562. var rowId = this.adapter.getRowIdAtIndex(rowIndex);
  4563. this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });
  4564. };
  4565. /**
  4566. * Handles sort action on sortable header cell.
  4567. */
  4568. MDCDataTableFoundation.prototype.handleSortAction = function (eventData) {
  4569. var columnId = eventData.columnId,
  4570. columnIndex = eventData.columnIndex,
  4571. headerCell = eventData.headerCell;
  4572. // Reset sort attributes / classes on other header cells.
  4573. for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) {
  4574. if (index === columnIndex) {
  4575. continue;
  4576. }
  4577. this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED);
  4578. this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
  4579. this.adapter.setAttributeByHeaderCellIndex(index, constants_1.strings.ARIA_SORT, constants_1.SortValue.NONE);
  4580. this.adapter.setSortStatusLabelByHeaderCellIndex(index, constants_1.SortValue.NONE);
  4581. }
  4582. // Set appropriate sort attributes / classes on target header cell.
  4583. this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED);
  4584. var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT);
  4585. var sortValue = constants_1.SortValue.NONE;
  4586. // Set to descending if sorted on ascending order.
  4587. if (currentSortValue === constants_1.SortValue.ASCENDING) {
  4588. this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
  4589. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.DESCENDING);
  4590. sortValue = constants_1.SortValue.DESCENDING;
  4591. // Set to ascending if sorted on descending order.
  4592. } else if (currentSortValue === constants_1.SortValue.DESCENDING) {
  4593. this.adapter.removeClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
  4594. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING);
  4595. sortValue = constants_1.SortValue.ASCENDING;
  4596. } else {
  4597. // Set to ascending by default when not sorted.
  4598. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING);
  4599. sortValue = constants_1.SortValue.ASCENDING;
  4600. }
  4601. this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue);
  4602. this.adapter.notifySortAction({
  4603. columnId: columnId,
  4604. columnIndex: columnIndex,
  4605. headerCell: headerCell,
  4606. sortValue: sortValue
  4607. });
  4608. };
  4609. /**
  4610. * Shows progress indicator blocking only the table body content when in
  4611. * loading state.
  4612. */
  4613. MDCDataTableFoundation.prototype.showProgress = function () {
  4614. var height = this.adapter.getTableBodyHeight();
  4615. var top = this.adapter.getTableHeaderHeight();
  4616. this.adapter.setProgressIndicatorStyles({
  4617. height: height,
  4618. top: top
  4619. });
  4620. this.adapter.addClass(constants_1.cssClasses.IN_PROGRESS);
  4621. };
  4622. /**
  4623. * Hides progress indicator when data table is finished loading.
  4624. */
  4625. MDCDataTableFoundation.prototype.hideProgress = function () {
  4626. this.adapter.removeClass(constants_1.cssClasses.IN_PROGRESS);
  4627. };
  4628. /**
  4629. * Updates header row checkbox state based on number of rows selected.
  4630. */
  4631. MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () {
  4632. if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) {
  4633. this.adapter.setHeaderRowCheckboxChecked(true);
  4634. this.adapter.setHeaderRowCheckboxIndeterminate(false);
  4635. } else if (this.adapter.getSelectedRowCount() === 0) {
  4636. this.adapter.setHeaderRowCheckboxIndeterminate(false);
  4637. this.adapter.setHeaderRowCheckboxChecked(false);
  4638. } else {
  4639. this.adapter.setHeaderRowCheckboxIndeterminate(true);
  4640. this.adapter.setHeaderRowCheckboxChecked(false);
  4641. }
  4642. };
  4643. /**
  4644. * Sets the attributes of row element based on selection state.
  4645. */
  4646. MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) {
  4647. if (selected) {
  4648. this.adapter.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  4649. this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true');
  4650. } else {
  4651. this.adapter.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  4652. this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false');
  4653. }
  4654. };
  4655. return MDCDataTableFoundation;
  4656. }(foundation_1.MDCFoundation);
  4657. exports.MDCDataTableFoundation = MDCDataTableFoundation;
  4658. /***/ }),
  4659. /***/ "./packages/mdc-data-table/index.ts":
  4660. /*!******************************************!*\
  4661. !*** ./packages/mdc-data-table/index.ts ***!
  4662. \******************************************/
  4663. /*! no static exports found */
  4664. /***/ (function(module, exports, __webpack_require__) {
  4665. "use strict";
  4666. /**
  4667. * @license
  4668. * Copyright 2019 Google Inc.
  4669. *
  4670. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4671. * of this software and associated documentation files (the "Software"), to deal
  4672. * in the Software without restriction, including without limitation the rights
  4673. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4674. * copies of the Software, and to permit persons to whom the Software is
  4675. * furnished to do so, subject to the following conditions:
  4676. *
  4677. * The above copyright notice and this permission notice shall be included in
  4678. * all copies or substantial portions of the Software.
  4679. *
  4680. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4681. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4682. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4683. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4684. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4685. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4686. * THE SOFTWARE.
  4687. */
  4688. function __export(m) {
  4689. for (var p in m) {
  4690. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  4691. }
  4692. }
  4693. Object.defineProperty(exports, "__esModule", { value: true });
  4694. __export(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts"));
  4695. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"));
  4696. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"));
  4697. /***/ }),
  4698. /***/ "./packages/mdc-dialog/component.ts":
  4699. /*!******************************************!*\
  4700. !*** ./packages/mdc-dialog/component.ts ***!
  4701. \******************************************/
  4702. /*! no static exports found */
  4703. /***/ (function(module, exports, __webpack_require__) {
  4704. "use strict";
  4705. /**
  4706. * @license
  4707. * Copyright 2017 Google Inc.
  4708. *
  4709. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4710. * of this software and associated documentation files (the "Software"), to deal
  4711. * in the Software without restriction, including without limitation the rights
  4712. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4713. * copies of the Software, and to permit persons to whom the Software is
  4714. * furnished to do so, subject to the following conditions:
  4715. *
  4716. * The above copyright notice and this permission notice shall be included in
  4717. * all copies or substantial portions of the Software.
  4718. *
  4719. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4720. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4721. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4722. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4723. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4724. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4725. * THE SOFTWARE.
  4726. */
  4727. var __extends = this && this.__extends || function () {
  4728. var _extendStatics = function extendStatics(d, b) {
  4729. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4730. d.__proto__ = b;
  4731. } || function (d, b) {
  4732. for (var p in b) {
  4733. if (b.hasOwnProperty(p)) d[p] = b[p];
  4734. }
  4735. };
  4736. return _extendStatics(d, b);
  4737. };
  4738. return function (d, b) {
  4739. _extendStatics(d, b);
  4740. function __() {
  4741. this.constructor = d;
  4742. }
  4743. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4744. };
  4745. }();
  4746. var __values = this && this.__values || function (o) {
  4747. var s = typeof Symbol === "function" && Symbol.iterator,
  4748. m = s && o[s],
  4749. i = 0;
  4750. if (m) return m.call(o);
  4751. if (o && typeof o.length === "number") return {
  4752. next: function next() {
  4753. if (o && i >= o.length) o = void 0;
  4754. return { value: o && o[i++], done: !o };
  4755. }
  4756. };
  4757. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  4758. };
  4759. var __importStar = this && this.__importStar || function (mod) {
  4760. if (mod && mod.__esModule) return mod;
  4761. var result = {};
  4762. if (mod != null) for (var k in mod) {
  4763. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  4764. }result["default"] = mod;
  4765. return result;
  4766. };
  4767. Object.defineProperty(exports, "__esModule", { value: true });
  4768. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4769. var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts");
  4770. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  4771. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  4772. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts");
  4773. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts"));
  4774. var strings = foundation_1.MDCDialogFoundation.strings;
  4775. var MDCDialog = /** @class */function (_super) {
  4776. __extends(MDCDialog, _super);
  4777. function MDCDialog() {
  4778. return _super !== null && _super.apply(this, arguments) || this;
  4779. }
  4780. Object.defineProperty(MDCDialog.prototype, "isOpen", {
  4781. get: function get() {
  4782. return this.foundation.isOpen();
  4783. },
  4784. enumerable: true,
  4785. configurable: true
  4786. });
  4787. Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", {
  4788. get: function get() {
  4789. return this.foundation.getEscapeKeyAction();
  4790. },
  4791. set: function set(action) {
  4792. this.foundation.setEscapeKeyAction(action);
  4793. },
  4794. enumerable: true,
  4795. configurable: true
  4796. });
  4797. Object.defineProperty(MDCDialog.prototype, "scrimClickAction", {
  4798. get: function get() {
  4799. return this.foundation.getScrimClickAction();
  4800. },
  4801. set: function set(action) {
  4802. this.foundation.setScrimClickAction(action);
  4803. },
  4804. enumerable: true,
  4805. configurable: true
  4806. });
  4807. Object.defineProperty(MDCDialog.prototype, "autoStackButtons", {
  4808. get: function get() {
  4809. return this.foundation.getAutoStackButtons();
  4810. },
  4811. set: function set(autoStack) {
  4812. this.foundation.setAutoStackButtons(autoStack);
  4813. },
  4814. enumerable: true,
  4815. configurable: true
  4816. });
  4817. MDCDialog.attachTo = function (root) {
  4818. return new MDCDialog(root);
  4819. };
  4820. MDCDialog.prototype.initialize = function (focusTrapFactory) {
  4821. var e_1, _a;
  4822. if (focusTrapFactory === void 0) {
  4823. focusTrapFactory = function focusTrapFactory(el, focusOptions) {
  4824. return new focus_trap_1.FocusTrap(el, focusOptions);
  4825. };
  4826. }
  4827. var container = this.root.querySelector(strings.CONTAINER_SELECTOR);
  4828. if (!container) {
  4829. throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element");
  4830. }
  4831. this.container_ = container;
  4832. this.content_ = this.root.querySelector(strings.CONTENT_SELECTOR);
  4833. this.buttons_ = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR));
  4834. this.defaultButton_ = this.root.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]");
  4835. this.focusTrapFactory_ = focusTrapFactory;
  4836. this.buttonRipples_ = [];
  4837. try {
  4838. for (var _b = __values(this.buttons_), _c = _b.next(); !_c.done; _c = _b.next()) {
  4839. var buttonEl = _c.value;
  4840. this.buttonRipples_.push(new component_2.MDCRipple(buttonEl));
  4841. }
  4842. } catch (e_1_1) {
  4843. e_1 = { error: e_1_1 };
  4844. } finally {
  4845. try {
  4846. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  4847. } finally {
  4848. if (e_1) throw e_1.error;
  4849. }
  4850. }
  4851. };
  4852. MDCDialog.prototype.initialSyncWithDOM = function () {
  4853. var _this = this;
  4854. this.focusTrap_ = util.createFocusTrapInstance(this.container_, this.focusTrapFactory_, this.getInitialFocusEl_() || undefined);
  4855. this.handleClick_ = this.foundation.handleClick.bind(this.foundation);
  4856. this.handleKeydown_ = this.foundation.handleKeydown.bind(this.foundation);
  4857. this.handleDocumentKeydown_ = this.foundation.handleDocumentKeydown.bind(this.foundation);
  4858. this.handleLayout_ = this.layout.bind(this);
  4859. var LAYOUT_EVENTS = ['resize', 'orientationchange'];
  4860. this.handleOpening_ = function () {
  4861. LAYOUT_EVENTS.forEach(function (evtType) {
  4862. return window.addEventListener(evtType, _this.handleLayout_);
  4863. });
  4864. document.addEventListener('keydown', _this.handleDocumentKeydown_);
  4865. };
  4866. this.handleClosing_ = function () {
  4867. LAYOUT_EVENTS.forEach(function (evtType) {
  4868. return window.removeEventListener(evtType, _this.handleLayout_);
  4869. });
  4870. document.removeEventListener('keydown', _this.handleDocumentKeydown_);
  4871. };
  4872. this.listen('click', this.handleClick_);
  4873. this.listen('keydown', this.handleKeydown_);
  4874. this.listen(strings.OPENING_EVENT, this.handleOpening_);
  4875. this.listen(strings.CLOSING_EVENT, this.handleClosing_);
  4876. };
  4877. MDCDialog.prototype.destroy = function () {
  4878. this.unlisten('click', this.handleClick_);
  4879. this.unlisten('keydown', this.handleKeydown_);
  4880. this.unlisten(strings.OPENING_EVENT, this.handleOpening_);
  4881. this.unlisten(strings.CLOSING_EVENT, this.handleClosing_);
  4882. this.handleClosing_();
  4883. this.buttonRipples_.forEach(function (ripple) {
  4884. return ripple.destroy();
  4885. });
  4886. _super.prototype.destroy.call(this);
  4887. };
  4888. MDCDialog.prototype.layout = function () {
  4889. this.foundation.layout();
  4890. };
  4891. MDCDialog.prototype.open = function () {
  4892. this.foundation.open();
  4893. };
  4894. MDCDialog.prototype.close = function (action) {
  4895. if (action === void 0) {
  4896. action = '';
  4897. }
  4898. this.foundation.close(action);
  4899. };
  4900. MDCDialog.prototype.getDefaultFoundation = function () {
  4901. var _this = this;
  4902. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  4903. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  4904. var adapter = {
  4905. addBodyClass: function addBodyClass(className) {
  4906. return document.body.classList.add(className);
  4907. },
  4908. addClass: function addClass(className) {
  4909. return _this.root.classList.add(className);
  4910. },
  4911. areButtonsStacked: function areButtonsStacked() {
  4912. return util.areTopsMisaligned(_this.buttons_);
  4913. },
  4914. clickDefaultButton: function clickDefaultButton() {
  4915. return _this.defaultButton_ && _this.defaultButton_.click();
  4916. },
  4917. eventTargetMatches: function eventTargetMatches(target, selector) {
  4918. return target ? ponyfill_1.matches(target, selector) : false;
  4919. },
  4920. getActionFromEvent: function getActionFromEvent(evt) {
  4921. if (!evt.target) {
  4922. return '';
  4923. }
  4924. var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]");
  4925. return element && element.getAttribute(strings.ACTION_ATTRIBUTE);
  4926. },
  4927. getInitialFocusEl: function getInitialFocusEl() {
  4928. return _this.getInitialFocusEl_();
  4929. },
  4930. hasClass: function hasClass(className) {
  4931. return _this.root.classList.contains(className);
  4932. },
  4933. isContentScrollable: function isContentScrollable() {
  4934. return util.isScrollable(_this.content_);
  4935. },
  4936. notifyClosed: function notifyClosed(action) {
  4937. return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {});
  4938. },
  4939. notifyClosing: function notifyClosing(action) {
  4940. return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {});
  4941. },
  4942. notifyOpened: function notifyOpened() {
  4943. return _this.emit(strings.OPENED_EVENT, {});
  4944. },
  4945. notifyOpening: function notifyOpening() {
  4946. return _this.emit(strings.OPENING_EVENT, {});
  4947. },
  4948. releaseFocus: function releaseFocus() {
  4949. return _this.focusTrap_.releaseFocus();
  4950. },
  4951. removeBodyClass: function removeBodyClass(className) {
  4952. return document.body.classList.remove(className);
  4953. },
  4954. removeClass: function removeClass(className) {
  4955. return _this.root.classList.remove(className);
  4956. },
  4957. reverseButtons: function reverseButtons() {
  4958. _this.buttons_.reverse();
  4959. _this.buttons_.forEach(function (button) {
  4960. button.parentElement.appendChild(button);
  4961. });
  4962. },
  4963. trapFocus: function trapFocus() {
  4964. return _this.focusTrap_.trapFocus();
  4965. }
  4966. };
  4967. return new foundation_1.MDCDialogFoundation(adapter);
  4968. };
  4969. MDCDialog.prototype.getInitialFocusEl_ = function () {
  4970. return document.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]");
  4971. };
  4972. return MDCDialog;
  4973. }(component_1.MDCComponent);
  4974. exports.MDCDialog = MDCDialog;
  4975. /***/ }),
  4976. /***/ "./packages/mdc-dialog/constants.ts":
  4977. /*!******************************************!*\
  4978. !*** ./packages/mdc-dialog/constants.ts ***!
  4979. \******************************************/
  4980. /*! no static exports found */
  4981. /***/ (function(module, exports, __webpack_require__) {
  4982. "use strict";
  4983. /**
  4984. * @license
  4985. * Copyright 2016 Google Inc.
  4986. *
  4987. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4988. * of this software and associated documentation files (the "Software"), to deal
  4989. * in the Software without restriction, including without limitation the rights
  4990. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4991. * copies of the Software, and to permit persons to whom the Software is
  4992. * furnished to do so, subject to the following conditions:
  4993. *
  4994. * The above copyright notice and this permission notice shall be included in
  4995. * all copies or substantial portions of the Software.
  4996. *
  4997. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4998. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4999. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5000. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5001. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5002. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5003. * THE SOFTWARE.
  5004. */
  5005. Object.defineProperty(exports, "__esModule", { value: true });
  5006. exports.cssClasses = {
  5007. CLOSING: 'mdc-dialog--closing',
  5008. OPEN: 'mdc-dialog--open',
  5009. OPENING: 'mdc-dialog--opening',
  5010. SCROLLABLE: 'mdc-dialog--scrollable',
  5011. SCROLL_LOCK: 'mdc-dialog-scroll-lock',
  5012. STACKED: 'mdc-dialog--stacked'
  5013. };
  5014. exports.strings = {
  5015. ACTION_ATTRIBUTE: 'data-mdc-dialog-action',
  5016. BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',
  5017. BUTTON_SELECTOR: '.mdc-dialog__button',
  5018. CLOSED_EVENT: 'MDCDialog:closed',
  5019. CLOSE_ACTION: 'close',
  5020. CLOSING_EVENT: 'MDCDialog:closing',
  5021. CONTAINER_SELECTOR: '.mdc-dialog__container',
  5022. CONTENT_SELECTOR: '.mdc-dialog__content',
  5023. DESTROY_ACTION: 'destroy',
  5024. INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',
  5025. OPENED_EVENT: 'MDCDialog:opened',
  5026. OPENING_EVENT: 'MDCDialog:opening',
  5027. SCRIM_SELECTOR: '.mdc-dialog__scrim',
  5028. SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item'].join(', '),
  5029. SURFACE_SELECTOR: '.mdc-dialog__surface'
  5030. };
  5031. exports.numbers = {
  5032. DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
  5033. DIALOG_ANIMATION_OPEN_TIME_MS: 150
  5034. };
  5035. /***/ }),
  5036. /***/ "./packages/mdc-dialog/foundation.ts":
  5037. /*!*******************************************!*\
  5038. !*** ./packages/mdc-dialog/foundation.ts ***!
  5039. \*******************************************/
  5040. /*! no static exports found */
  5041. /***/ (function(module, exports, __webpack_require__) {
  5042. "use strict";
  5043. /**
  5044. * @license
  5045. * Copyright 2017 Google Inc.
  5046. *
  5047. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5048. * of this software and associated documentation files (the "Software"), to deal
  5049. * in the Software without restriction, including without limitation the rights
  5050. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5051. * copies of the Software, and to permit persons to whom the Software is
  5052. * furnished to do so, subject to the following conditions:
  5053. *
  5054. * The above copyright notice and this permission notice shall be included in
  5055. * all copies or substantial portions of the Software.
  5056. *
  5057. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5058. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5059. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5060. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5061. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5062. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5063. * THE SOFTWARE.
  5064. */
  5065. var __extends = this && this.__extends || function () {
  5066. var _extendStatics = function extendStatics(d, b) {
  5067. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5068. d.__proto__ = b;
  5069. } || function (d, b) {
  5070. for (var p in b) {
  5071. if (b.hasOwnProperty(p)) d[p] = b[p];
  5072. }
  5073. };
  5074. return _extendStatics(d, b);
  5075. };
  5076. return function (d, b) {
  5077. _extendStatics(d, b);
  5078. function __() {
  5079. this.constructor = d;
  5080. }
  5081. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5082. };
  5083. }();
  5084. var __assign = this && this.__assign || function () {
  5085. __assign = Object.assign || function (t) {
  5086. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5087. s = arguments[i];
  5088. for (var p in s) {
  5089. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5090. }
  5091. }
  5092. return t;
  5093. };
  5094. return __assign.apply(this, arguments);
  5095. };
  5096. Object.defineProperty(exports, "__esModule", { value: true });
  5097. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5098. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts");
  5099. var MDCDialogFoundation = /** @class */function (_super) {
  5100. __extends(MDCDialogFoundation, _super);
  5101. function MDCDialogFoundation(adapter) {
  5102. var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this;
  5103. _this.isOpen_ = false;
  5104. _this.animationFrame_ = 0;
  5105. _this.animationTimer_ = 0;
  5106. _this.layoutFrame_ = 0;
  5107. _this.escapeKeyAction_ = constants_1.strings.CLOSE_ACTION;
  5108. _this.scrimClickAction_ = constants_1.strings.CLOSE_ACTION;
  5109. _this.autoStackButtons_ = true;
  5110. _this.areButtonsStacked_ = false;
  5111. return _this;
  5112. }
  5113. Object.defineProperty(MDCDialogFoundation, "cssClasses", {
  5114. get: function get() {
  5115. return constants_1.cssClasses;
  5116. },
  5117. enumerable: true,
  5118. configurable: true
  5119. });
  5120. Object.defineProperty(MDCDialogFoundation, "strings", {
  5121. get: function get() {
  5122. return constants_1.strings;
  5123. },
  5124. enumerable: true,
  5125. configurable: true
  5126. });
  5127. Object.defineProperty(MDCDialogFoundation, "numbers", {
  5128. get: function get() {
  5129. return constants_1.numbers;
  5130. },
  5131. enumerable: true,
  5132. configurable: true
  5133. });
  5134. Object.defineProperty(MDCDialogFoundation, "defaultAdapter", {
  5135. get: function get() {
  5136. return {
  5137. addBodyClass: function addBodyClass() {
  5138. return undefined;
  5139. },
  5140. addClass: function addClass() {
  5141. return undefined;
  5142. },
  5143. areButtonsStacked: function areButtonsStacked() {
  5144. return false;
  5145. },
  5146. clickDefaultButton: function clickDefaultButton() {
  5147. return undefined;
  5148. },
  5149. eventTargetMatches: function eventTargetMatches() {
  5150. return false;
  5151. },
  5152. getActionFromEvent: function getActionFromEvent() {
  5153. return '';
  5154. },
  5155. getInitialFocusEl: function getInitialFocusEl() {
  5156. return null;
  5157. },
  5158. hasClass: function hasClass() {
  5159. return false;
  5160. },
  5161. isContentScrollable: function isContentScrollable() {
  5162. return false;
  5163. },
  5164. notifyClosed: function notifyClosed() {
  5165. return undefined;
  5166. },
  5167. notifyClosing: function notifyClosing() {
  5168. return undefined;
  5169. },
  5170. notifyOpened: function notifyOpened() {
  5171. return undefined;
  5172. },
  5173. notifyOpening: function notifyOpening() {
  5174. return undefined;
  5175. },
  5176. releaseFocus: function releaseFocus() {
  5177. return undefined;
  5178. },
  5179. removeBodyClass: function removeBodyClass() {
  5180. return undefined;
  5181. },
  5182. removeClass: function removeClass() {
  5183. return undefined;
  5184. },
  5185. reverseButtons: function reverseButtons() {
  5186. return undefined;
  5187. },
  5188. trapFocus: function trapFocus() {
  5189. return undefined;
  5190. }
  5191. };
  5192. },
  5193. enumerable: true,
  5194. configurable: true
  5195. });
  5196. MDCDialogFoundation.prototype.init = function () {
  5197. if (this.adapter.hasClass(constants_1.cssClasses.STACKED)) {
  5198. this.setAutoStackButtons(false);
  5199. }
  5200. };
  5201. MDCDialogFoundation.prototype.destroy = function () {
  5202. if (this.isOpen_) {
  5203. this.close(constants_1.strings.DESTROY_ACTION);
  5204. }
  5205. if (this.animationTimer_) {
  5206. clearTimeout(this.animationTimer_);
  5207. this.handleAnimationTimerEnd_();
  5208. }
  5209. if (this.layoutFrame_) {
  5210. cancelAnimationFrame(this.layoutFrame_);
  5211. this.layoutFrame_ = 0;
  5212. }
  5213. };
  5214. MDCDialogFoundation.prototype.open = function () {
  5215. var _this = this;
  5216. this.isOpen_ = true;
  5217. this.adapter.notifyOpening();
  5218. this.adapter.addClass(constants_1.cssClasses.OPENING);
  5219. // Wait a frame once display is no longer "none", to establish basis for animation
  5220. this.runNextAnimationFrame_(function () {
  5221. _this.adapter.addClass(constants_1.cssClasses.OPEN);
  5222. _this.adapter.addBodyClass(constants_1.cssClasses.SCROLL_LOCK);
  5223. _this.layout();
  5224. _this.animationTimer_ = setTimeout(function () {
  5225. _this.handleAnimationTimerEnd_();
  5226. _this.adapter.trapFocus(_this.adapter.getInitialFocusEl());
  5227. _this.adapter.notifyOpened();
  5228. }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS);
  5229. });
  5230. };
  5231. MDCDialogFoundation.prototype.close = function (action) {
  5232. var _this = this;
  5233. if (action === void 0) {
  5234. action = '';
  5235. }
  5236. if (!this.isOpen_) {
  5237. // Avoid redundant close calls (and events), e.g. from keydown on elements that inherently emit click
  5238. return;
  5239. }
  5240. this.isOpen_ = false;
  5241. this.adapter.notifyClosing(action);
  5242. this.adapter.addClass(constants_1.cssClasses.CLOSING);
  5243. this.adapter.removeClass(constants_1.cssClasses.OPEN);
  5244. this.adapter.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK);
  5245. cancelAnimationFrame(this.animationFrame_);
  5246. this.animationFrame_ = 0;
  5247. clearTimeout(this.animationTimer_);
  5248. this.animationTimer_ = setTimeout(function () {
  5249. _this.adapter.releaseFocus();
  5250. _this.handleAnimationTimerEnd_();
  5251. _this.adapter.notifyClosed(action);
  5252. }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);
  5253. };
  5254. MDCDialogFoundation.prototype.isOpen = function () {
  5255. return this.isOpen_;
  5256. };
  5257. MDCDialogFoundation.prototype.getEscapeKeyAction = function () {
  5258. return this.escapeKeyAction_;
  5259. };
  5260. MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {
  5261. this.escapeKeyAction_ = action;
  5262. };
  5263. MDCDialogFoundation.prototype.getScrimClickAction = function () {
  5264. return this.scrimClickAction_;
  5265. };
  5266. MDCDialogFoundation.prototype.setScrimClickAction = function (action) {
  5267. this.scrimClickAction_ = action;
  5268. };
  5269. MDCDialogFoundation.prototype.getAutoStackButtons = function () {
  5270. return this.autoStackButtons_;
  5271. };
  5272. MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {
  5273. this.autoStackButtons_ = autoStack;
  5274. };
  5275. MDCDialogFoundation.prototype.layout = function () {
  5276. var _this = this;
  5277. if (this.layoutFrame_) {
  5278. cancelAnimationFrame(this.layoutFrame_);
  5279. }
  5280. this.layoutFrame_ = requestAnimationFrame(function () {
  5281. _this.layoutInternal_();
  5282. _this.layoutFrame_ = 0;
  5283. });
  5284. };
  5285. /** Handles click on the dialog root element. */
  5286. MDCDialogFoundation.prototype.handleClick = function (evt) {
  5287. var isScrim = this.adapter.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR);
  5288. // Check for scrim click first since it doesn't require querying ancestors.
  5289. if (isScrim && this.scrimClickAction_ !== '') {
  5290. this.close(this.scrimClickAction_);
  5291. } else {
  5292. var action = this.adapter.getActionFromEvent(evt);
  5293. if (action) {
  5294. this.close(action);
  5295. }
  5296. }
  5297. };
  5298. /** Handles keydown on the dialog root element. */
  5299. MDCDialogFoundation.prototype.handleKeydown = function (evt) {
  5300. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  5301. if (!isEnter) {
  5302. return;
  5303. }
  5304. var action = this.adapter.getActionFromEvent(evt);
  5305. if (action) {
  5306. // Action button callback is handled in `handleClick`,
  5307. // since space/enter keydowns on buttons trigger click events.
  5308. return;
  5309. }
  5310. var isDefault = !this.adapter.eventTargetMatches(evt.target, constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR);
  5311. if (isEnter && isDefault) {
  5312. this.adapter.clickDefaultButton();
  5313. }
  5314. };
  5315. /** Handles keydown on the document. */
  5316. MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {
  5317. var isEscape = evt.key === 'Escape' || evt.keyCode === 27;
  5318. if (isEscape && this.escapeKeyAction_ !== '') {
  5319. this.close(this.escapeKeyAction_);
  5320. }
  5321. };
  5322. MDCDialogFoundation.prototype.layoutInternal_ = function () {
  5323. if (this.autoStackButtons_) {
  5324. this.detectStackedButtons_();
  5325. }
  5326. this.detectScrollableContent_();
  5327. };
  5328. MDCDialogFoundation.prototype.handleAnimationTimerEnd_ = function () {
  5329. this.animationTimer_ = 0;
  5330. this.adapter.removeClass(constants_1.cssClasses.OPENING);
  5331. this.adapter.removeClass(constants_1.cssClasses.CLOSING);
  5332. };
  5333. /**
  5334. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  5335. */
  5336. MDCDialogFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  5337. var _this = this;
  5338. cancelAnimationFrame(this.animationFrame_);
  5339. this.animationFrame_ = requestAnimationFrame(function () {
  5340. _this.animationFrame_ = 0;
  5341. clearTimeout(_this.animationTimer_);
  5342. _this.animationTimer_ = setTimeout(callback, 0);
  5343. });
  5344. };
  5345. MDCDialogFoundation.prototype.detectStackedButtons_ = function () {
  5346. // Remove the class first to let us measure the buttons' natural positions.
  5347. this.adapter.removeClass(constants_1.cssClasses.STACKED);
  5348. var areButtonsStacked = this.adapter.areButtonsStacked();
  5349. if (areButtonsStacked) {
  5350. this.adapter.addClass(constants_1.cssClasses.STACKED);
  5351. }
  5352. if (areButtonsStacked !== this.areButtonsStacked_) {
  5353. this.adapter.reverseButtons();
  5354. this.areButtonsStacked_ = areButtonsStacked;
  5355. }
  5356. };
  5357. MDCDialogFoundation.prototype.detectScrollableContent_ = function () {
  5358. // Remove the class first to let us measure the natural height of the content.
  5359. this.adapter.removeClass(constants_1.cssClasses.SCROLLABLE);
  5360. if (this.adapter.isContentScrollable()) {
  5361. this.adapter.addClass(constants_1.cssClasses.SCROLLABLE);
  5362. }
  5363. };
  5364. return MDCDialogFoundation;
  5365. }(foundation_1.MDCFoundation);
  5366. exports.MDCDialogFoundation = MDCDialogFoundation;
  5367. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5368. exports.default = MDCDialogFoundation;
  5369. /***/ }),
  5370. /***/ "./packages/mdc-dialog/index.ts":
  5371. /*!**************************************!*\
  5372. !*** ./packages/mdc-dialog/index.ts ***!
  5373. \**************************************/
  5374. /*! no static exports found */
  5375. /***/ (function(module, exports, __webpack_require__) {
  5376. "use strict";
  5377. /**
  5378. * @license
  5379. * Copyright 2019 Google Inc.
  5380. *
  5381. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5382. * of this software and associated documentation files (the "Software"), to deal
  5383. * in the Software without restriction, including without limitation the rights
  5384. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5385. * copies of the Software, and to permit persons to whom the Software is
  5386. * furnished to do so, subject to the following conditions:
  5387. *
  5388. * The above copyright notice and this permission notice shall be included in
  5389. * all copies or substantial portions of the Software.
  5390. *
  5391. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5392. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5393. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5394. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5395. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5396. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5397. * THE SOFTWARE.
  5398. */
  5399. function __export(m) {
  5400. for (var p in m) {
  5401. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  5402. }
  5403. }
  5404. var __importStar = this && this.__importStar || function (mod) {
  5405. if (mod && mod.__esModule) return mod;
  5406. var result = {};
  5407. if (mod != null) for (var k in mod) {
  5408. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5409. }result["default"] = mod;
  5410. return result;
  5411. };
  5412. Object.defineProperty(exports, "__esModule", { value: true });
  5413. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts"));
  5414. exports.util = util;
  5415. __export(__webpack_require__(/*! ./component */ "./packages/mdc-dialog/component.ts"));
  5416. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"));
  5417. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"));
  5418. /***/ }),
  5419. /***/ "./packages/mdc-dialog/util.ts":
  5420. /*!*************************************!*\
  5421. !*** ./packages/mdc-dialog/util.ts ***!
  5422. \*************************************/
  5423. /*! no static exports found */
  5424. /***/ (function(module, exports, __webpack_require__) {
  5425. "use strict";
  5426. /**
  5427. * @license
  5428. * Copyright 2016 Google Inc.
  5429. *
  5430. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5431. * of this software and associated documentation files (the "Software"), to deal
  5432. * in the Software without restriction, including without limitation the rights
  5433. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5434. * copies of the Software, and to permit persons to whom the Software is
  5435. * furnished to do so, subject to the following conditions:
  5436. *
  5437. * The above copyright notice and this permission notice shall be included in
  5438. * all copies or substantial portions of the Software.
  5439. *
  5440. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5441. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5442. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5443. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5444. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5445. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5446. * THE SOFTWARE.
  5447. */
  5448. Object.defineProperty(exports, "__esModule", { value: true });
  5449. function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) {
  5450. return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl });
  5451. }
  5452. exports.createFocusTrapInstance = createFocusTrapInstance;
  5453. function isScrollable(el) {
  5454. return el ? el.scrollHeight > el.offsetHeight : false;
  5455. }
  5456. exports.isScrollable = isScrollable;
  5457. function areTopsMisaligned(els) {
  5458. var tops = new Set();
  5459. [].forEach.call(els, function (el) {
  5460. return tops.add(el.offsetTop);
  5461. });
  5462. return tops.size > 1;
  5463. }
  5464. exports.areTopsMisaligned = areTopsMisaligned;
  5465. /***/ }),
  5466. /***/ "./packages/mdc-dom/announce.ts":
  5467. /*!**************************************!*\
  5468. !*** ./packages/mdc-dom/announce.ts ***!
  5469. \**************************************/
  5470. /*! no static exports found */
  5471. /***/ (function(module, exports, __webpack_require__) {
  5472. "use strict";
  5473. /**
  5474. * @license
  5475. * Copyright 2020 Google Inc.
  5476. *
  5477. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5478. * of this software and associated documentation files (the "Software"), to deal
  5479. * in the Software without restriction, including without limitation the rights
  5480. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5481. * copies of the Software, and to permit persons to whom the Software is
  5482. * furnished to do so, subject to the following conditions:
  5483. *
  5484. * The above copyright notice and this permission notice shall be included in
  5485. * all copies or substantial portions of the Software.
  5486. *
  5487. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5488. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5489. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5490. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5491. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5492. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5493. * THE SOFTWARE.
  5494. */
  5495. Object.defineProperty(exports, "__esModule", { value: true });
  5496. /**
  5497. * Priorities for the announce function
  5498. */
  5499. var AnnouncerPriority;
  5500. (function (AnnouncerPriority) {
  5501. AnnouncerPriority["POLITE"] = "polite";
  5502. AnnouncerPriority["ASSERTIVE"] = "assertive";
  5503. })(AnnouncerPriority = exports.AnnouncerPriority || (exports.AnnouncerPriority = {}));
  5504. /**
  5505. * Announces the given message with optional priority, defaulting to "polite"
  5506. */
  5507. function announce(message, priority) {
  5508. Announcer.getInstance().say(message, priority);
  5509. }
  5510. exports.announce = announce;
  5511. var Announcer = /** @class */function () {
  5512. // Constructor made private to ensure only the singleton is used
  5513. function Announcer() {
  5514. this.liveRegions = new Map();
  5515. }
  5516. Announcer.getInstance = function () {
  5517. if (!Announcer.instance) {
  5518. Announcer.instance = new Announcer();
  5519. }
  5520. return Announcer.instance;
  5521. };
  5522. Announcer.prototype.say = function (message, priority) {
  5523. if (priority === void 0) {
  5524. priority = AnnouncerPriority.POLITE;
  5525. }
  5526. var liveRegion = this.getLiveRegion(priority);
  5527. // Reset the region to pick up the message, even if the message is the
  5528. // exact same as before.
  5529. liveRegion.textContent = '';
  5530. // Timeout is necessary for screen readers like NVDA and VoiceOver.
  5531. setTimeout(function () {
  5532. liveRegion.textContent = message;
  5533. document.addEventListener('click', clearLiveRegion);
  5534. }, 1);
  5535. function clearLiveRegion() {
  5536. liveRegion.textContent = '';
  5537. document.removeEventListener('click', clearLiveRegion);
  5538. }
  5539. };
  5540. Announcer.prototype.getLiveRegion = function (priority) {
  5541. var existingLiveRegion = this.liveRegions.get(priority);
  5542. if (existingLiveRegion && document.body.contains(existingLiveRegion)) {
  5543. return existingLiveRegion;
  5544. }
  5545. var liveRegion = this.createLiveRegion(priority);
  5546. this.liveRegions.set(priority, liveRegion);
  5547. return liveRegion;
  5548. };
  5549. Announcer.prototype.createLiveRegion = function (priority) {
  5550. var el = document.createElement('div');
  5551. el.style.position = 'absolute';
  5552. el.style.top = '-9999px';
  5553. el.style.left = '-9999px';
  5554. el.style.height = '1px';
  5555. el.style.overflow = 'hidden';
  5556. el.setAttribute('aria-atomic', 'true');
  5557. el.setAttribute('aria-live', priority);
  5558. document.body.appendChild(el);
  5559. return el;
  5560. };
  5561. return Announcer;
  5562. }();
  5563. /***/ }),
  5564. /***/ "./packages/mdc-dom/events.ts":
  5565. /*!************************************!*\
  5566. !*** ./packages/mdc-dom/events.ts ***!
  5567. \************************************/
  5568. /*! no static exports found */
  5569. /***/ (function(module, exports, __webpack_require__) {
  5570. "use strict";
  5571. /**
  5572. * @license
  5573. * Copyright 2019 Google Inc.
  5574. *
  5575. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5576. * of this software and associated documentation files (the "Software"), to deal
  5577. * in the Software without restriction, including without limitation the rights
  5578. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5579. * copies of the Software, and to permit persons to whom the Software is
  5580. * furnished to do so, subject to the following conditions:
  5581. *
  5582. * The above copyright notice and this permission notice shall be included in
  5583. * all copies or substantial portions of the Software.
  5584. *
  5585. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5586. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5587. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5588. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5589. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5590. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5591. * THE SOFTWARE.
  5592. */
  5593. Object.defineProperty(exports, "__esModule", { value: true });
  5594. /**
  5595. * Determine whether the current browser supports passive event listeners, and
  5596. * if so, use them.
  5597. */
  5598. function applyPassive(globalObj) {
  5599. if (globalObj === void 0) {
  5600. globalObj = window;
  5601. }
  5602. return supportsPassiveOption(globalObj) ? { passive: true } : false;
  5603. }
  5604. exports.applyPassive = applyPassive;
  5605. function supportsPassiveOption(globalObj) {
  5606. if (globalObj === void 0) {
  5607. globalObj = window;
  5608. }
  5609. // See
  5610. // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  5611. var passiveSupported = false;
  5612. try {
  5613. var options = {
  5614. // This function will be called when the browser
  5615. // attempts to access the passive property.
  5616. get passive() {
  5617. passiveSupported = true;
  5618. return false;
  5619. }
  5620. };
  5621. var handler = function handler() {};
  5622. globalObj.document.addEventListener('test', handler, options);
  5623. globalObj.document.removeEventListener('test', handler, options);
  5624. } catch (err) {
  5625. passiveSupported = false;
  5626. }
  5627. return passiveSupported;
  5628. }
  5629. /***/ }),
  5630. /***/ "./packages/mdc-dom/focus-trap.ts":
  5631. /*!****************************************!*\
  5632. !*** ./packages/mdc-dom/focus-trap.ts ***!
  5633. \****************************************/
  5634. /*! no static exports found */
  5635. /***/ (function(module, exports, __webpack_require__) {
  5636. "use strict";
  5637. /**
  5638. * @license
  5639. * Copyright 2020 Google Inc.
  5640. *
  5641. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5642. * of this software and associated documentation files (the "Software"), to deal
  5643. * in the Software without restriction, including without limitation the rights
  5644. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5645. * copies of the Software, and to permit persons to whom the Software is
  5646. * furnished to do so, subject to the following conditions:
  5647. *
  5648. * The above copyright notice and this permission notice shall be included in
  5649. * all copies or substantial portions of the Software.
  5650. *
  5651. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5652. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5653. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5654. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5655. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5656. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5657. * THE SOFTWARE.
  5658. */
  5659. Object.defineProperty(exports, "__esModule", { value: true });
  5660. var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel';
  5661. /**
  5662. * Utility to trap focus in a given root element, e.g. for modal components such
  5663. * as dialogs. The root should have at least one focusable child element,
  5664. * for setting initial focus when trapping focus.
  5665. * Also tracks the previously focused element, and restores focus to that
  5666. * element when releasing focus.
  5667. */
  5668. var FocusTrap = /** @class */function () {
  5669. function FocusTrap(root, options) {
  5670. if (options === void 0) {
  5671. options = {};
  5672. }
  5673. this.root = root;
  5674. this.options = options;
  5675. // Previously focused element before trapping focus.
  5676. this.elFocusedBeforeTrapFocus = null;
  5677. }
  5678. /**
  5679. * Traps focus in `root`. Also focuses on either `initialFocusEl` if set;
  5680. * otherwises sets initial focus to the first focusable child element.
  5681. */
  5682. FocusTrap.prototype.trapFocus = function () {
  5683. var focusableEls = this.getFocusableElements(this.root);
  5684. if (focusableEls.length === 0) {
  5685. throw new Error('FocusTrap: Element must have at least one focusable child.');
  5686. }
  5687. this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
  5688. this.wrapTabFocus(this.root, focusableEls);
  5689. if (!this.options.skipInitialFocus) {
  5690. this.focusInitialElement(focusableEls, this.options.initialFocusEl);
  5691. }
  5692. };
  5693. /**
  5694. * Releases focus from `root`. Also restores focus to the previously focused
  5695. * element.
  5696. */
  5697. FocusTrap.prototype.releaseFocus = function () {
  5698. [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) {
  5699. sentinelEl.parentElement.removeChild(sentinelEl);
  5700. });
  5701. if (this.elFocusedBeforeTrapFocus) {
  5702. this.elFocusedBeforeTrapFocus.focus();
  5703. }
  5704. };
  5705. /**
  5706. * Wraps tab focus within `el` by adding two hidden sentinel divs which are
  5707. * used to mark the beginning and the end of the tabbable region. When
  5708. * focused, these sentinel elements redirect focus to the first/last
  5709. * children elements of the tabbable region, ensuring that focus is trapped
  5710. * within that region.
  5711. */
  5712. FocusTrap.prototype.wrapTabFocus = function (el, focusableEls) {
  5713. var sentinelStart = this.createSentinel();
  5714. var sentinelEnd = this.createSentinel();
  5715. sentinelStart.addEventListener('focus', function () {
  5716. if (focusableEls.length > 0) {
  5717. focusableEls[focusableEls.length - 1].focus();
  5718. }
  5719. });
  5720. sentinelEnd.addEventListener('focus', function () {
  5721. if (focusableEls.length > 0) {
  5722. focusableEls[0].focus();
  5723. }
  5724. });
  5725. el.insertBefore(sentinelStart, el.children[0]);
  5726. el.appendChild(sentinelEnd);
  5727. };
  5728. /**
  5729. * Focuses on `initialFocusEl` if defined and a child of the root element.
  5730. * Otherwise, focuses on the first focusable child element of the root.
  5731. */
  5732. FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) {
  5733. var focusIndex = 0;
  5734. if (initialFocusEl) {
  5735. focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0);
  5736. }
  5737. focusableEls[focusIndex].focus();
  5738. };
  5739. FocusTrap.prototype.getFocusableElements = function (root) {
  5740. var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button'));
  5741. return focusableEls.filter(function (el) {
  5742. var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true';
  5743. var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden;
  5744. var isProgrammaticallyHidden = false;
  5745. if (isTabbableAndVisible) {
  5746. var style = getComputedStyle(el);
  5747. isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden';
  5748. }
  5749. return isTabbableAndVisible && !isProgrammaticallyHidden;
  5750. });
  5751. };
  5752. FocusTrap.prototype.createSentinel = function () {
  5753. var sentinel = document.createElement('div');
  5754. sentinel.setAttribute('tabindex', '0');
  5755. // Don't announce in screen readers.
  5756. sentinel.setAttribute('aria-hidden', 'true');
  5757. sentinel.classList.add(FOCUS_SENTINEL_CLASS);
  5758. return sentinel;
  5759. };
  5760. return FocusTrap;
  5761. }();
  5762. exports.FocusTrap = FocusTrap;
  5763. /***/ }),
  5764. /***/ "./packages/mdc-dom/index.ts":
  5765. /*!***********************************!*\
  5766. !*** ./packages/mdc-dom/index.ts ***!
  5767. \***********************************/
  5768. /*! no static exports found */
  5769. /***/ (function(module, exports, __webpack_require__) {
  5770. "use strict";
  5771. /**
  5772. * @license
  5773. * Copyright 2018 Google Inc.
  5774. *
  5775. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5776. * of this software and associated documentation files (the "Software"), to deal
  5777. * in the Software without restriction, including without limitation the rights
  5778. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5779. * copies of the Software, and to permit persons to whom the Software is
  5780. * furnished to do so, subject to the following conditions:
  5781. *
  5782. * The above copyright notice and this permission notice shall be included in
  5783. * all copies or substantial portions of the Software.
  5784. *
  5785. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5786. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5787. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5788. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5789. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5790. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5791. * THE SOFTWARE.
  5792. */
  5793. var __importStar = this && this.__importStar || function (mod) {
  5794. if (mod && mod.__esModule) return mod;
  5795. var result = {};
  5796. if (mod != null) for (var k in mod) {
  5797. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5798. }result["default"] = mod;
  5799. return result;
  5800. };
  5801. Object.defineProperty(exports, "__esModule", { value: true });
  5802. var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts"));
  5803. exports.events = events;
  5804. var focusTrap = __importStar(__webpack_require__(/*! ./focus-trap */ "./packages/mdc-dom/focus-trap.ts"));
  5805. exports.focusTrap = focusTrap;
  5806. var keyboard = __importStar(__webpack_require__(/*! ./keyboard */ "./packages/mdc-dom/keyboard.ts"));
  5807. exports.keyboard = keyboard;
  5808. var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  5809. exports.ponyfill = ponyfill;
  5810. /***/ }),
  5811. /***/ "./packages/mdc-dom/keyboard.ts":
  5812. /*!**************************************!*\
  5813. !*** ./packages/mdc-dom/keyboard.ts ***!
  5814. \**************************************/
  5815. /*! no static exports found */
  5816. /***/ (function(module, exports, __webpack_require__) {
  5817. "use strict";
  5818. /**
  5819. * @license
  5820. * Copyright 2020 Google Inc.
  5821. *
  5822. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5823. * of this software and associated documentation files (the "Software"), to deal
  5824. * in the Software without restriction, including without limitation the rights
  5825. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5826. * copies of the Software, and to permit persons to whom the Software is
  5827. * furnished to do so, subject to the following conditions:
  5828. *
  5829. * The above copyright notice and this permission notice shall be included in
  5830. * all copies or substantial portions of the Software.
  5831. *
  5832. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5833. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5834. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5835. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5836. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5837. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5838. * THE SOFTWARE.
  5839. */
  5840. Object.defineProperty(exports, "__esModule", { value: true });
  5841. /**
  5842. * KEY provides normalized string values for keys.
  5843. */
  5844. exports.KEY = {
  5845. UNKNOWN: 'Unknown',
  5846. BACKSPACE: 'Backspace',
  5847. ENTER: 'Enter',
  5848. SPACEBAR: 'Spacebar',
  5849. PAGE_UP: 'PageUp',
  5850. PAGE_DOWN: 'PageDown',
  5851. END: 'End',
  5852. HOME: 'Home',
  5853. ARROW_LEFT: 'ArrowLeft',
  5854. ARROW_UP: 'ArrowUp',
  5855. ARROW_RIGHT: 'ArrowRight',
  5856. ARROW_DOWN: 'ArrowDown',
  5857. DELETE: 'Delete',
  5858. ESCAPE: 'Escape'
  5859. };
  5860. var normalizedKeys = new Set();
  5861. // IE11 has no support for new Map with iterable so we need to initialize this
  5862. // by hand.
  5863. normalizedKeys.add(exports.KEY.BACKSPACE);
  5864. normalizedKeys.add(exports.KEY.ENTER);
  5865. normalizedKeys.add(exports.KEY.SPACEBAR);
  5866. normalizedKeys.add(exports.KEY.PAGE_UP);
  5867. normalizedKeys.add(exports.KEY.PAGE_DOWN);
  5868. normalizedKeys.add(exports.KEY.END);
  5869. normalizedKeys.add(exports.KEY.HOME);
  5870. normalizedKeys.add(exports.KEY.ARROW_LEFT);
  5871. normalizedKeys.add(exports.KEY.ARROW_UP);
  5872. normalizedKeys.add(exports.KEY.ARROW_RIGHT);
  5873. normalizedKeys.add(exports.KEY.ARROW_DOWN);
  5874. normalizedKeys.add(exports.KEY.DELETE);
  5875. normalizedKeys.add(exports.KEY.ESCAPE);
  5876. var KEY_CODE = {
  5877. BACKSPACE: 8,
  5878. ENTER: 13,
  5879. SPACEBAR: 32,
  5880. PAGE_UP: 33,
  5881. PAGE_DOWN: 34,
  5882. END: 35,
  5883. HOME: 36,
  5884. ARROW_LEFT: 37,
  5885. ARROW_UP: 38,
  5886. ARROW_RIGHT: 39,
  5887. ARROW_DOWN: 40,
  5888. DELETE: 46,
  5889. ESCAPE: 27
  5890. };
  5891. var mappedKeyCodes = new Map();
  5892. // IE11 has no support for new Map with iterable so we need to initialize this
  5893. // by hand.
  5894. mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE);
  5895. mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER);
  5896. mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR);
  5897. mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP);
  5898. mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN);
  5899. mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END);
  5900. mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME);
  5901. mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT);
  5902. mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP);
  5903. mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT);
  5904. mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN);
  5905. mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE);
  5906. mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE);
  5907. var navigationKeys = new Set();
  5908. // IE11 has no support for new Set with iterable so we need to initialize this
  5909. // by hand.
  5910. navigationKeys.add(exports.KEY.PAGE_UP);
  5911. navigationKeys.add(exports.KEY.PAGE_DOWN);
  5912. navigationKeys.add(exports.KEY.END);
  5913. navigationKeys.add(exports.KEY.HOME);
  5914. navigationKeys.add(exports.KEY.ARROW_LEFT);
  5915. navigationKeys.add(exports.KEY.ARROW_UP);
  5916. navigationKeys.add(exports.KEY.ARROW_RIGHT);
  5917. navigationKeys.add(exports.KEY.ARROW_DOWN);
  5918. /**
  5919. * normalizeKey returns the normalized string for a navigational action.
  5920. */
  5921. function normalizeKey(evt) {
  5922. var key = evt.key;
  5923. // If the event already has a normalized key, return it
  5924. if (normalizedKeys.has(key)) {
  5925. return key;
  5926. }
  5927. // tslint:disable-next-line:deprecation
  5928. var mappedKey = mappedKeyCodes.get(evt.keyCode);
  5929. if (mappedKey) {
  5930. return mappedKey;
  5931. }
  5932. return exports.KEY.UNKNOWN;
  5933. }
  5934. exports.normalizeKey = normalizeKey;
  5935. /**
  5936. * isNavigationEvent returns whether the event is a navigation event
  5937. */
  5938. function isNavigationEvent(evt) {
  5939. return navigationKeys.has(normalizeKey(evt));
  5940. }
  5941. exports.isNavigationEvent = isNavigationEvent;
  5942. /***/ }),
  5943. /***/ "./packages/mdc-dom/ponyfill.ts":
  5944. /*!**************************************!*\
  5945. !*** ./packages/mdc-dom/ponyfill.ts ***!
  5946. \**************************************/
  5947. /*! no static exports found */
  5948. /***/ (function(module, exports, __webpack_require__) {
  5949. "use strict";
  5950. /**
  5951. * @license
  5952. * Copyright 2018 Google Inc.
  5953. *
  5954. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5955. * of this software and associated documentation files (the "Software"), to deal
  5956. * in the Software without restriction, including without limitation the rights
  5957. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5958. * copies of the Software, and to permit persons to whom the Software is
  5959. * furnished to do so, subject to the following conditions:
  5960. *
  5961. * The above copyright notice and this permission notice shall be included in
  5962. * all copies or substantial portions of the Software.
  5963. *
  5964. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5965. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5966. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5967. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5968. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5969. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5970. * THE SOFTWARE.
  5971. */
  5972. Object.defineProperty(exports, "__esModule", { value: true });
  5973. /**
  5974. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
  5975. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
  5976. */
  5977. function closest(element, selector) {
  5978. if (element.closest) {
  5979. return element.closest(selector);
  5980. }
  5981. var el = element;
  5982. while (el) {
  5983. if (matches(el, selector)) {
  5984. return el;
  5985. }
  5986. el = el.parentElement;
  5987. }
  5988. return null;
  5989. }
  5990. exports.closest = closest;
  5991. function matches(element, selector) {
  5992. var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
  5993. return nativeMatches.call(element, selector);
  5994. }
  5995. exports.matches = matches;
  5996. /**
  5997. * Used to compute the estimated scroll width of elements. When an element is
  5998. * hidden due to display: none; being applied to a parent element, the width is
  5999. * returned as 0. However, the element will have a true width once no longer
  6000. * inside a display: none context. This method computes an estimated width when
  6001. * the element is hidden or returns the true width when the element is visble.
  6002. * @param {Element} element the element whose width to estimate
  6003. */
  6004. function estimateScrollWidth(element) {
  6005. // Check the offsetParent. If the element inherits display: none from any
  6006. // parent, the offsetParent property will be null (see
  6007. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
  6008. // This check ensures we only clone the node when necessary.
  6009. var htmlEl = element;
  6010. if (htmlEl.offsetParent !== null) {
  6011. return htmlEl.scrollWidth;
  6012. }
  6013. var clone = htmlEl.cloneNode(true);
  6014. clone.style.setProperty('position', 'absolute');
  6015. clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
  6016. document.documentElement.appendChild(clone);
  6017. var scrollWidth = clone.scrollWidth;
  6018. document.documentElement.removeChild(clone);
  6019. return scrollWidth;
  6020. }
  6021. exports.estimateScrollWidth = estimateScrollWidth;
  6022. /***/ }),
  6023. /***/ "./packages/mdc-drawer/component.ts":
  6024. /*!******************************************!*\
  6025. !*** ./packages/mdc-drawer/component.ts ***!
  6026. \******************************************/
  6027. /*! no static exports found */
  6028. /***/ (function(module, exports, __webpack_require__) {
  6029. "use strict";
  6030. /**
  6031. * @license
  6032. * Copyright 2016 Google Inc.
  6033. *
  6034. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6035. * of this software and associated documentation files (the "Software"), to deal
  6036. * in the Software without restriction, including without limitation the rights
  6037. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6038. * copies of the Software, and to permit persons to whom the Software is
  6039. * furnished to do so, subject to the following conditions:
  6040. *
  6041. * The above copyright notice and this permission notice shall be included in
  6042. * all copies or substantial portions of the Software.
  6043. *
  6044. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6045. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6046. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6047. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6048. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6049. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6050. * THE SOFTWARE.
  6051. */
  6052. var __extends = this && this.__extends || function () {
  6053. var _extendStatics = function extendStatics(d, b) {
  6054. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6055. d.__proto__ = b;
  6056. } || function (d, b) {
  6057. for (var p in b) {
  6058. if (b.hasOwnProperty(p)) d[p] = b[p];
  6059. }
  6060. };
  6061. return _extendStatics(d, b);
  6062. };
  6063. return function (d, b) {
  6064. _extendStatics(d, b);
  6065. function __() {
  6066. this.constructor = d;
  6067. }
  6068. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6069. };
  6070. }();
  6071. var __importStar = this && this.__importStar || function (mod) {
  6072. if (mod && mod.__esModule) return mod;
  6073. var result = {};
  6074. if (mod != null) for (var k in mod) {
  6075. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  6076. }result["default"] = mod;
  6077. return result;
  6078. };
  6079. Object.defineProperty(exports, "__esModule", { value: true });
  6080. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6081. var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts");
  6082. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  6083. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  6084. var foundation_2 = __webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts");
  6085. var foundation_3 = __webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts");
  6086. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
  6087. var cssClasses = foundation_2.MDCDismissibleDrawerFoundation.cssClasses,
  6088. strings = foundation_2.MDCDismissibleDrawerFoundation.strings;
  6089. /**
  6090. * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed.
  6091. * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened.
  6092. */
  6093. var MDCDrawer = /** @class */function (_super) {
  6094. __extends(MDCDrawer, _super);
  6095. function MDCDrawer() {
  6096. return _super !== null && _super.apply(this, arguments) || this;
  6097. }
  6098. MDCDrawer.attachTo = function (root) {
  6099. return new MDCDrawer(root);
  6100. };
  6101. Object.defineProperty(MDCDrawer.prototype, "open", {
  6102. /**
  6103. * @return boolean Proxies to the foundation's `open`/`close` methods.
  6104. * Also returns true if drawer is in the open position.
  6105. */
  6106. get: function get() {
  6107. return this.foundation.isOpen();
  6108. },
  6109. /**
  6110. * Toggles the drawer open and closed.
  6111. */
  6112. set: function set(isOpen) {
  6113. if (isOpen) {
  6114. this.foundation.open();
  6115. } else {
  6116. this.foundation.close();
  6117. }
  6118. },
  6119. enumerable: true,
  6120. configurable: true
  6121. });
  6122. Object.defineProperty(MDCDrawer.prototype, "list", {
  6123. get: function get() {
  6124. return this.list_;
  6125. },
  6126. enumerable: true,
  6127. configurable: true
  6128. });
  6129. MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) {
  6130. if (focusTrapFactory === void 0) {
  6131. focusTrapFactory = function focusTrapFactory(el) {
  6132. return new focus_trap_1.FocusTrap(el);
  6133. };
  6134. }
  6135. if (listFactory === void 0) {
  6136. listFactory = function listFactory(el) {
  6137. return new component_2.MDCList(el);
  6138. };
  6139. }
  6140. var listEl = this.root.querySelector("." + foundation_1.MDCListFoundation.cssClasses.ROOT);
  6141. if (listEl) {
  6142. this.list_ = listFactory(listEl);
  6143. this.list_.wrapFocus = true;
  6144. }
  6145. this.focusTrapFactory_ = focusTrapFactory;
  6146. };
  6147. MDCDrawer.prototype.initialSyncWithDOM = function () {
  6148. var _this = this;
  6149. var MODAL = cssClasses.MODAL;
  6150. var SCRIM_SELECTOR = strings.SCRIM_SELECTOR;
  6151. this.scrim_ = this.root.parentNode.querySelector(SCRIM_SELECTOR);
  6152. if (this.scrim_ && this.root.classList.contains(MODAL)) {
  6153. this.handleScrimClick_ = function () {
  6154. return _this.foundation.handleScrimClick();
  6155. };
  6156. this.scrim_.addEventListener('click', this.handleScrimClick_);
  6157. this.focusTrap_ = util.createFocusTrapInstance(this.root, this.focusTrapFactory_);
  6158. }
  6159. this.handleKeydown_ = function (evt) {
  6160. return _this.foundation.handleKeydown(evt);
  6161. };
  6162. this.handleTransitionEnd_ = function (evt) {
  6163. return _this.foundation.handleTransitionEnd(evt);
  6164. };
  6165. this.listen('keydown', this.handleKeydown_);
  6166. this.listen('transitionend', this.handleTransitionEnd_);
  6167. };
  6168. MDCDrawer.prototype.destroy = function () {
  6169. this.unlisten('keydown', this.handleKeydown_);
  6170. this.unlisten('transitionend', this.handleTransitionEnd_);
  6171. if (this.list_) {
  6172. this.list_.destroy();
  6173. }
  6174. var MODAL = cssClasses.MODAL;
  6175. if (this.scrim_ && this.handleScrimClick_ && this.root.classList.contains(MODAL)) {
  6176. this.scrim_.removeEventListener('click', this.handleScrimClick_);
  6177. // Ensure drawer is closed to hide scrim and release focus
  6178. this.open = false;
  6179. }
  6180. };
  6181. MDCDrawer.prototype.getDefaultFoundation = function () {
  6182. var _this = this;
  6183. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6184. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6185. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6186. var adapter = {
  6187. addClass: function addClass(className) {
  6188. return _this.root.classList.add(className);
  6189. },
  6190. removeClass: function removeClass(className) {
  6191. return _this.root.classList.remove(className);
  6192. },
  6193. hasClass: function hasClass(className) {
  6194. return _this.root.classList.contains(className);
  6195. },
  6196. elementHasClass: function elementHasClass(element, className) {
  6197. return element.classList.contains(className);
  6198. },
  6199. saveFocus: function saveFocus() {
  6200. return _this.previousFocus_ = document.activeElement;
  6201. },
  6202. restoreFocus: function restoreFocus() {
  6203. var previousFocus = _this.previousFocus_;
  6204. if (previousFocus && previousFocus.focus && _this.root.contains(document.activeElement)) {
  6205. previousFocus.focus();
  6206. }
  6207. },
  6208. focusActiveNavigationItem: function focusActiveNavigationItem() {
  6209. var activeNavItemEl = _this.root.querySelector("." + foundation_1.MDCListFoundation.cssClasses.LIST_ITEM_ACTIVATED_CLASS);
  6210. if (activeNavItemEl) {
  6211. activeNavItemEl.focus();
  6212. }
  6213. },
  6214. notifyClose: function notifyClose() {
  6215. return _this.emit(strings.CLOSE_EVENT, {}, true /* shouldBubble */);
  6216. },
  6217. notifyOpen: function notifyOpen() {
  6218. return _this.emit(strings.OPEN_EVENT, {}, true /* shouldBubble */);
  6219. },
  6220. trapFocus: function trapFocus() {
  6221. return _this.focusTrap_.trapFocus();
  6222. },
  6223. releaseFocus: function releaseFocus() {
  6224. return _this.focusTrap_.releaseFocus();
  6225. }
  6226. };
  6227. // tslint:enable:object-literal-sort-keys
  6228. var DISMISSIBLE = cssClasses.DISMISSIBLE,
  6229. MODAL = cssClasses.MODAL;
  6230. if (this.root.classList.contains(DISMISSIBLE)) {
  6231. return new foundation_2.MDCDismissibleDrawerFoundation(adapter);
  6232. } else if (this.root.classList.contains(MODAL)) {
  6233. return new foundation_3.MDCModalDrawerFoundation(adapter);
  6234. } else {
  6235. throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + ".");
  6236. }
  6237. };
  6238. return MDCDrawer;
  6239. }(component_1.MDCComponent);
  6240. exports.MDCDrawer = MDCDrawer;
  6241. /***/ }),
  6242. /***/ "./packages/mdc-drawer/constants.ts":
  6243. /*!******************************************!*\
  6244. !*** ./packages/mdc-drawer/constants.ts ***!
  6245. \******************************************/
  6246. /*! no static exports found */
  6247. /***/ (function(module, exports, __webpack_require__) {
  6248. "use strict";
  6249. /**
  6250. * @license
  6251. * Copyright 2016 Google Inc.
  6252. *
  6253. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6254. * of this software and associated documentation files (the "Software"), to deal
  6255. * in the Software without restriction, including without limitation the rights
  6256. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6257. * copies of the Software, and to permit persons to whom the Software is
  6258. * furnished to do so, subject to the following conditions:
  6259. *
  6260. * The above copyright notice and this permission notice shall be included in
  6261. * all copies or substantial portions of the Software.
  6262. *
  6263. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6264. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6265. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6266. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6267. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6268. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6269. * THE SOFTWARE.
  6270. */
  6271. Object.defineProperty(exports, "__esModule", { value: true });
  6272. var cssClasses = {
  6273. ANIMATE: 'mdc-drawer--animate',
  6274. CLOSING: 'mdc-drawer--closing',
  6275. DISMISSIBLE: 'mdc-drawer--dismissible',
  6276. MODAL: 'mdc-drawer--modal',
  6277. OPEN: 'mdc-drawer--open',
  6278. OPENING: 'mdc-drawer--opening',
  6279. ROOT: 'mdc-drawer'
  6280. };
  6281. exports.cssClasses = cssClasses;
  6282. var strings = {
  6283. APP_CONTENT_SELECTOR: '.mdc-drawer-app-content',
  6284. CLOSE_EVENT: 'MDCDrawer:closed',
  6285. OPEN_EVENT: 'MDCDrawer:opened',
  6286. SCRIM_SELECTOR: '.mdc-drawer-scrim'
  6287. };
  6288. exports.strings = strings;
  6289. /***/ }),
  6290. /***/ "./packages/mdc-drawer/dismissible/foundation.ts":
  6291. /*!*******************************************************!*\
  6292. !*** ./packages/mdc-drawer/dismissible/foundation.ts ***!
  6293. \*******************************************************/
  6294. /*! no static exports found */
  6295. /***/ (function(module, exports, __webpack_require__) {
  6296. "use strict";
  6297. /**
  6298. * @license
  6299. * Copyright 2018 Google Inc.
  6300. *
  6301. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6302. * of this software and associated documentation files (the "Software"), to deal
  6303. * in the Software without restriction, including without limitation the rights
  6304. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6305. * copies of the Software, and to permit persons to whom the Software is
  6306. * furnished to do so, subject to the following conditions:
  6307. *
  6308. * The above copyright notice and this permission notice shall be included in
  6309. * all copies or substantial portions of the Software.
  6310. *
  6311. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6312. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6313. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6314. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6315. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6316. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6317. * THE SOFTWARE.
  6318. */
  6319. var __extends = this && this.__extends || function () {
  6320. var _extendStatics = function extendStatics(d, b) {
  6321. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6322. d.__proto__ = b;
  6323. } || function (d, b) {
  6324. for (var p in b) {
  6325. if (b.hasOwnProperty(p)) d[p] = b[p];
  6326. }
  6327. };
  6328. return _extendStatics(d, b);
  6329. };
  6330. return function (d, b) {
  6331. _extendStatics(d, b);
  6332. function __() {
  6333. this.constructor = d;
  6334. }
  6335. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6336. };
  6337. }();
  6338. var __assign = this && this.__assign || function () {
  6339. __assign = Object.assign || function (t) {
  6340. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6341. s = arguments[i];
  6342. for (var p in s) {
  6343. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6344. }
  6345. }
  6346. return t;
  6347. };
  6348. return __assign.apply(this, arguments);
  6349. };
  6350. Object.defineProperty(exports, "__esModule", { value: true });
  6351. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6352. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-drawer/constants.ts");
  6353. var MDCDismissibleDrawerFoundation = /** @class */function (_super) {
  6354. __extends(MDCDismissibleDrawerFoundation, _super);
  6355. function MDCDismissibleDrawerFoundation(adapter) {
  6356. var _this = _super.call(this, __assign(__assign({}, MDCDismissibleDrawerFoundation.defaultAdapter), adapter)) || this;
  6357. _this.animationFrame_ = 0;
  6358. _this.animationTimer_ = 0;
  6359. return _this;
  6360. }
  6361. Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", {
  6362. get: function get() {
  6363. return constants_1.strings;
  6364. },
  6365. enumerable: true,
  6366. configurable: true
  6367. });
  6368. Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", {
  6369. get: function get() {
  6370. return constants_1.cssClasses;
  6371. },
  6372. enumerable: true,
  6373. configurable: true
  6374. });
  6375. Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", {
  6376. get: function get() {
  6377. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6378. return {
  6379. addClass: function addClass() {
  6380. return undefined;
  6381. },
  6382. removeClass: function removeClass() {
  6383. return undefined;
  6384. },
  6385. hasClass: function hasClass() {
  6386. return false;
  6387. },
  6388. elementHasClass: function elementHasClass() {
  6389. return false;
  6390. },
  6391. notifyClose: function notifyClose() {
  6392. return undefined;
  6393. },
  6394. notifyOpen: function notifyOpen() {
  6395. return undefined;
  6396. },
  6397. saveFocus: function saveFocus() {
  6398. return undefined;
  6399. },
  6400. restoreFocus: function restoreFocus() {
  6401. return undefined;
  6402. },
  6403. focusActiveNavigationItem: function focusActiveNavigationItem() {
  6404. return undefined;
  6405. },
  6406. trapFocus: function trapFocus() {
  6407. return undefined;
  6408. },
  6409. releaseFocus: function releaseFocus() {
  6410. return undefined;
  6411. }
  6412. };
  6413. // tslint:enable:object-literal-sort-keys
  6414. },
  6415. enumerable: true,
  6416. configurable: true
  6417. });
  6418. MDCDismissibleDrawerFoundation.prototype.destroy = function () {
  6419. if (this.animationFrame_) {
  6420. cancelAnimationFrame(this.animationFrame_);
  6421. }
  6422. if (this.animationTimer_) {
  6423. clearTimeout(this.animationTimer_);
  6424. }
  6425. };
  6426. /**
  6427. * Opens the drawer from the closed state.
  6428. */
  6429. MDCDismissibleDrawerFoundation.prototype.open = function () {
  6430. var _this = this;
  6431. if (this.isOpen() || this.isOpening() || this.isClosing()) {
  6432. return;
  6433. }
  6434. this.adapter.addClass(constants_1.cssClasses.OPEN);
  6435. this.adapter.addClass(constants_1.cssClasses.ANIMATE);
  6436. // Wait a frame once display is no longer "none", to establish basis for animation
  6437. this.runNextAnimationFrame_(function () {
  6438. _this.adapter.addClass(constants_1.cssClasses.OPENING);
  6439. });
  6440. this.adapter.saveFocus();
  6441. };
  6442. /**
  6443. * Closes the drawer from the open state.
  6444. */
  6445. MDCDismissibleDrawerFoundation.prototype.close = function () {
  6446. if (!this.isOpen() || this.isOpening() || this.isClosing()) {
  6447. return;
  6448. }
  6449. this.adapter.addClass(constants_1.cssClasses.CLOSING);
  6450. };
  6451. /**
  6452. * Returns true if the drawer is in the open position.
  6453. * @return true if drawer is in open state.
  6454. */
  6455. MDCDismissibleDrawerFoundation.prototype.isOpen = function () {
  6456. return this.adapter.hasClass(constants_1.cssClasses.OPEN);
  6457. };
  6458. /**
  6459. * Returns true if the drawer is animating open.
  6460. * @return true if drawer is animating open.
  6461. */
  6462. MDCDismissibleDrawerFoundation.prototype.isOpening = function () {
  6463. return this.adapter.hasClass(constants_1.cssClasses.OPENING) || this.adapter.hasClass(constants_1.cssClasses.ANIMATE);
  6464. };
  6465. /**
  6466. * Returns true if the drawer is animating closed.
  6467. * @return true if drawer is animating closed.
  6468. */
  6469. MDCDismissibleDrawerFoundation.prototype.isClosing = function () {
  6470. return this.adapter.hasClass(constants_1.cssClasses.CLOSING);
  6471. };
  6472. /**
  6473. * Keydown handler to close drawer when key is escape.
  6474. */
  6475. MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) {
  6476. var keyCode = evt.keyCode,
  6477. key = evt.key;
  6478. var isEscape = key === 'Escape' || keyCode === 27;
  6479. if (isEscape) {
  6480. this.close();
  6481. }
  6482. };
  6483. /**
  6484. * Handles the `transitionend` event when the drawer finishes opening/closing.
  6485. */
  6486. MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) {
  6487. var OPENING = constants_1.cssClasses.OPENING,
  6488. CLOSING = constants_1.cssClasses.CLOSING,
  6489. OPEN = constants_1.cssClasses.OPEN,
  6490. ANIMATE = constants_1.cssClasses.ANIMATE,
  6491. ROOT = constants_1.cssClasses.ROOT;
  6492. // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first.
  6493. var isRootElement = this.isElement_(evt.target) && this.adapter.elementHasClass(evt.target, ROOT);
  6494. if (!isRootElement) {
  6495. return;
  6496. }
  6497. if (this.isClosing()) {
  6498. this.adapter.removeClass(OPEN);
  6499. this.closed_();
  6500. this.adapter.restoreFocus();
  6501. this.adapter.notifyClose();
  6502. } else {
  6503. this.adapter.focusActiveNavigationItem();
  6504. this.opened_();
  6505. this.adapter.notifyOpen();
  6506. }
  6507. this.adapter.removeClass(ANIMATE);
  6508. this.adapter.removeClass(OPENING);
  6509. this.adapter.removeClass(CLOSING);
  6510. };
  6511. /**
  6512. * Extension point for when drawer finishes open animation.
  6513. */
  6514. MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty
  6515. /**
  6516. * Extension point for when drawer finishes close animation.
  6517. */
  6518. MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty
  6519. /**
  6520. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  6521. */
  6522. MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  6523. var _this = this;
  6524. cancelAnimationFrame(this.animationFrame_);
  6525. this.animationFrame_ = requestAnimationFrame(function () {
  6526. _this.animationFrame_ = 0;
  6527. clearTimeout(_this.animationTimer_);
  6528. _this.animationTimer_ = setTimeout(callback, 0);
  6529. });
  6530. };
  6531. MDCDismissibleDrawerFoundation.prototype.isElement_ = function (element) {
  6532. // In Edge, transitionend on ripple pseudo-elements yields a target without classList.
  6533. return Boolean(element.classList);
  6534. };
  6535. return MDCDismissibleDrawerFoundation;
  6536. }(foundation_1.MDCFoundation);
  6537. exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation;
  6538. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6539. exports.default = MDCDismissibleDrawerFoundation;
  6540. /***/ }),
  6541. /***/ "./packages/mdc-drawer/index.ts":
  6542. /*!**************************************!*\
  6543. !*** ./packages/mdc-drawer/index.ts ***!
  6544. \**************************************/
  6545. /*! no static exports found */
  6546. /***/ (function(module, exports, __webpack_require__) {
  6547. "use strict";
  6548. /**
  6549. * @license
  6550. * Copyright 2019 Google Inc.
  6551. *
  6552. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6553. * of this software and associated documentation files (the "Software"), to deal
  6554. * in the Software without restriction, including without limitation the rights
  6555. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6556. * copies of the Software, and to permit persons to whom the Software is
  6557. * furnished to do so, subject to the following conditions:
  6558. *
  6559. * The above copyright notice and this permission notice shall be included in
  6560. * all copies or substantial portions of the Software.
  6561. *
  6562. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6563. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6564. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6565. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6566. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6567. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6568. * THE SOFTWARE.
  6569. */
  6570. function __export(m) {
  6571. for (var p in m) {
  6572. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  6573. }
  6574. }
  6575. var __importStar = this && this.__importStar || function (mod) {
  6576. if (mod && mod.__esModule) return mod;
  6577. var result = {};
  6578. if (mod != null) for (var k in mod) {
  6579. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  6580. }result["default"] = mod;
  6581. return result;
  6582. };
  6583. Object.defineProperty(exports, "__esModule", { value: true });
  6584. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
  6585. exports.util = util;
  6586. __export(__webpack_require__(/*! ./component */ "./packages/mdc-drawer/component.ts"));
  6587. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-drawer/constants.ts"));
  6588. __export(__webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"));
  6589. __export(__webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"));
  6590. /***/ }),
  6591. /***/ "./packages/mdc-drawer/modal/foundation.ts":
  6592. /*!*************************************************!*\
  6593. !*** ./packages/mdc-drawer/modal/foundation.ts ***!
  6594. \*************************************************/
  6595. /*! no static exports found */
  6596. /***/ (function(module, exports, __webpack_require__) {
  6597. "use strict";
  6598. /**
  6599. * @license
  6600. * Copyright 2018 Google Inc.
  6601. *
  6602. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6603. * of this software and associated documentation files (the "Software"), to deal
  6604. * in the Software without restriction, including without limitation the rights
  6605. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6606. * copies of the Software, and to permit persons to whom the Software is
  6607. * furnished to do so, subject to the following conditions:
  6608. *
  6609. * The above copyright notice and this permission notice shall be included in
  6610. * all copies or substantial portions of the Software.
  6611. *
  6612. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6613. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6614. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6615. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6616. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6617. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6618. * THE SOFTWARE.
  6619. */
  6620. var __extends = this && this.__extends || function () {
  6621. var _extendStatics = function extendStatics(d, b) {
  6622. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6623. d.__proto__ = b;
  6624. } || function (d, b) {
  6625. for (var p in b) {
  6626. if (b.hasOwnProperty(p)) d[p] = b[p];
  6627. }
  6628. };
  6629. return _extendStatics(d, b);
  6630. };
  6631. return function (d, b) {
  6632. _extendStatics(d, b);
  6633. function __() {
  6634. this.constructor = d;
  6635. }
  6636. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6637. };
  6638. }();
  6639. Object.defineProperty(exports, "__esModule", { value: true });
  6640. var foundation_1 = __webpack_require__(/*! ../dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts");
  6641. /* istanbul ignore next: subclass is not a branch statement */
  6642. var MDCModalDrawerFoundation = /** @class */function (_super) {
  6643. __extends(MDCModalDrawerFoundation, _super);
  6644. function MDCModalDrawerFoundation() {
  6645. return _super !== null && _super.apply(this, arguments) || this;
  6646. }
  6647. /**
  6648. * Handles click event on scrim.
  6649. */
  6650. MDCModalDrawerFoundation.prototype.handleScrimClick = function () {
  6651. this.close();
  6652. };
  6653. /**
  6654. * Called when drawer finishes open animation.
  6655. */
  6656. MDCModalDrawerFoundation.prototype.opened_ = function () {
  6657. this.adapter.trapFocus();
  6658. };
  6659. /**
  6660. * Called when drawer finishes close animation.
  6661. */
  6662. MDCModalDrawerFoundation.prototype.closed_ = function () {
  6663. this.adapter.releaseFocus();
  6664. };
  6665. return MDCModalDrawerFoundation;
  6666. }(foundation_1.MDCDismissibleDrawerFoundation);
  6667. exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation;
  6668. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6669. exports.default = MDCModalDrawerFoundation;
  6670. /***/ }),
  6671. /***/ "./packages/mdc-drawer/util.ts":
  6672. /*!*************************************!*\
  6673. !*** ./packages/mdc-drawer/util.ts ***!
  6674. \*************************************/
  6675. /*! no static exports found */
  6676. /***/ (function(module, exports, __webpack_require__) {
  6677. "use strict";
  6678. /**
  6679. * @license
  6680. * Copyright 2016 Google Inc.
  6681. *
  6682. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6683. * of this software and associated documentation files (the "Software"), to deal
  6684. * in the Software without restriction, including without limitation the rights
  6685. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6686. * copies of the Software, and to permit persons to whom the Software is
  6687. * furnished to do so, subject to the following conditions:
  6688. *
  6689. * The above copyright notice and this permission notice shall be included in
  6690. * all copies or substantial portions of the Software.
  6691. *
  6692. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6693. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6694. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6695. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6696. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6697. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6698. * THE SOFTWARE.
  6699. */
  6700. Object.defineProperty(exports, "__esModule", { value: true });
  6701. function createFocusTrapInstance(surfaceEl, focusTrapFactory) {
  6702. return focusTrapFactory(surfaceEl, {
  6703. // Component handles focusing on active nav item.
  6704. skipInitialFocus: true
  6705. });
  6706. }
  6707. exports.createFocusTrapInstance = createFocusTrapInstance;
  6708. /***/ }),
  6709. /***/ "./packages/mdc-floating-label/component.ts":
  6710. /*!**************************************************!*\
  6711. !*** ./packages/mdc-floating-label/component.ts ***!
  6712. \**************************************************/
  6713. /*! no static exports found */
  6714. /***/ (function(module, exports, __webpack_require__) {
  6715. "use strict";
  6716. /**
  6717. * @license
  6718. * Copyright 2016 Google Inc.
  6719. *
  6720. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6721. * of this software and associated documentation files (the "Software"), to deal
  6722. * in the Software without restriction, including without limitation the rights
  6723. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6724. * copies of the Software, and to permit persons to whom the Software is
  6725. * furnished to do so, subject to the following conditions:
  6726. *
  6727. * The above copyright notice and this permission notice shall be included in
  6728. * all copies or substantial portions of the Software.
  6729. *
  6730. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6731. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6732. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6733. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6734. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6735. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6736. * THE SOFTWARE.
  6737. */
  6738. var __extends = this && this.__extends || function () {
  6739. var _extendStatics = function extendStatics(d, b) {
  6740. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6741. d.__proto__ = b;
  6742. } || function (d, b) {
  6743. for (var p in b) {
  6744. if (b.hasOwnProperty(p)) d[p] = b[p];
  6745. }
  6746. };
  6747. return _extendStatics(d, b);
  6748. };
  6749. return function (d, b) {
  6750. _extendStatics(d, b);
  6751. function __() {
  6752. this.constructor = d;
  6753. }
  6754. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6755. };
  6756. }();
  6757. Object.defineProperty(exports, "__esModule", { value: true });
  6758. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6759. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  6760. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts");
  6761. var MDCFloatingLabel = /** @class */function (_super) {
  6762. __extends(MDCFloatingLabel, _super);
  6763. function MDCFloatingLabel() {
  6764. return _super !== null && _super.apply(this, arguments) || this;
  6765. }
  6766. MDCFloatingLabel.attachTo = function (root) {
  6767. return new MDCFloatingLabel(root);
  6768. };
  6769. /**
  6770. * Styles the label to produce the label shake for errors.
  6771. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
  6772. */
  6773. MDCFloatingLabel.prototype.shake = function (shouldShake) {
  6774. this.foundation.shake(shouldShake);
  6775. };
  6776. /**
  6777. * Styles the label to float/dock.
  6778. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
  6779. */
  6780. MDCFloatingLabel.prototype.float = function (shouldFloat) {
  6781. this.foundation.float(shouldFloat);
  6782. };
  6783. /**
  6784. * Styles the label as required.
  6785. * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
  6786. */
  6787. MDCFloatingLabel.prototype.setRequired = function (isRequired) {
  6788. this.foundation.setRequired(isRequired);
  6789. };
  6790. MDCFloatingLabel.prototype.getWidth = function () {
  6791. return this.foundation.getWidth();
  6792. };
  6793. MDCFloatingLabel.prototype.getDefaultFoundation = function () {
  6794. var _this = this;
  6795. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6796. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6797. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6798. var adapter = {
  6799. addClass: function addClass(className) {
  6800. return _this.root.classList.add(className);
  6801. },
  6802. removeClass: function removeClass(className) {
  6803. return _this.root.classList.remove(className);
  6804. },
  6805. getWidth: function getWidth() {
  6806. return ponyfill_1.estimateScrollWidth(_this.root);
  6807. },
  6808. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  6809. return _this.listen(evtType, handler);
  6810. },
  6811. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  6812. return _this.unlisten(evtType, handler);
  6813. }
  6814. };
  6815. // tslint:enable:object-literal-sort-keys
  6816. return new foundation_1.MDCFloatingLabelFoundation(adapter);
  6817. };
  6818. return MDCFloatingLabel;
  6819. }(component_1.MDCComponent);
  6820. exports.MDCFloatingLabel = MDCFloatingLabel;
  6821. /***/ }),
  6822. /***/ "./packages/mdc-floating-label/constants.ts":
  6823. /*!**************************************************!*\
  6824. !*** ./packages/mdc-floating-label/constants.ts ***!
  6825. \**************************************************/
  6826. /*! no static exports found */
  6827. /***/ (function(module, exports, __webpack_require__) {
  6828. "use strict";
  6829. /**
  6830. * @license
  6831. * Copyright 2016 Google Inc.
  6832. *
  6833. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6834. * of this software and associated documentation files (the "Software"), to deal
  6835. * in the Software without restriction, including without limitation the rights
  6836. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6837. * copies of the Software, and to permit persons to whom the Software is
  6838. * furnished to do so, subject to the following conditions:
  6839. *
  6840. * The above copyright notice and this permission notice shall be included in
  6841. * all copies or substantial portions of the Software.
  6842. *
  6843. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6844. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6845. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6846. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6847. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6848. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6849. * THE SOFTWARE.
  6850. */
  6851. Object.defineProperty(exports, "__esModule", { value: true });
  6852. exports.cssClasses = {
  6853. LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
  6854. LABEL_REQUIRED: 'mdc-floating-label--required',
  6855. LABEL_SHAKE: 'mdc-floating-label--shake',
  6856. ROOT: 'mdc-floating-label'
  6857. };
  6858. /***/ }),
  6859. /***/ "./packages/mdc-floating-label/foundation.ts":
  6860. /*!***************************************************!*\
  6861. !*** ./packages/mdc-floating-label/foundation.ts ***!
  6862. \***************************************************/
  6863. /*! no static exports found */
  6864. /***/ (function(module, exports, __webpack_require__) {
  6865. "use strict";
  6866. /**
  6867. * @license
  6868. * Copyright 2016 Google Inc.
  6869. *
  6870. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6871. * of this software and associated documentation files (the "Software"), to deal
  6872. * in the Software without restriction, including without limitation the rights
  6873. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6874. * copies of the Software, and to permit persons to whom the Software is
  6875. * furnished to do so, subject to the following conditions:
  6876. *
  6877. * The above copyright notice and this permission notice shall be included in
  6878. * all copies or substantial portions of the Software.
  6879. *
  6880. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6881. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6882. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6883. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6884. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6885. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6886. * THE SOFTWARE.
  6887. */
  6888. var __extends = this && this.__extends || function () {
  6889. var _extendStatics = function extendStatics(d, b) {
  6890. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6891. d.__proto__ = b;
  6892. } || function (d, b) {
  6893. for (var p in b) {
  6894. if (b.hasOwnProperty(p)) d[p] = b[p];
  6895. }
  6896. };
  6897. return _extendStatics(d, b);
  6898. };
  6899. return function (d, b) {
  6900. _extendStatics(d, b);
  6901. function __() {
  6902. this.constructor = d;
  6903. }
  6904. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6905. };
  6906. }();
  6907. var __assign = this && this.__assign || function () {
  6908. __assign = Object.assign || function (t) {
  6909. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6910. s = arguments[i];
  6911. for (var p in s) {
  6912. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6913. }
  6914. }
  6915. return t;
  6916. };
  6917. return __assign.apply(this, arguments);
  6918. };
  6919. Object.defineProperty(exports, "__esModule", { value: true });
  6920. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6921. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts");
  6922. var MDCFloatingLabelFoundation = /** @class */function (_super) {
  6923. __extends(MDCFloatingLabelFoundation, _super);
  6924. function MDCFloatingLabelFoundation(adapter) {
  6925. var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
  6926. _this.shakeAnimationEndHandler_ = function () {
  6927. return _this.handleShakeAnimationEnd_();
  6928. };
  6929. return _this;
  6930. }
  6931. Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
  6932. get: function get() {
  6933. return constants_1.cssClasses;
  6934. },
  6935. enumerable: true,
  6936. configurable: true
  6937. });
  6938. Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
  6939. /**
  6940. * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
  6941. */
  6942. get: function get() {
  6943. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6944. return {
  6945. addClass: function addClass() {
  6946. return undefined;
  6947. },
  6948. removeClass: function removeClass() {
  6949. return undefined;
  6950. },
  6951. getWidth: function getWidth() {
  6952. return 0;
  6953. },
  6954. registerInteractionHandler: function registerInteractionHandler() {
  6955. return undefined;
  6956. },
  6957. deregisterInteractionHandler: function deregisterInteractionHandler() {
  6958. return undefined;
  6959. }
  6960. };
  6961. // tslint:enable:object-literal-sort-keys
  6962. },
  6963. enumerable: true,
  6964. configurable: true
  6965. });
  6966. MDCFloatingLabelFoundation.prototype.init = function () {
  6967. this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_);
  6968. };
  6969. MDCFloatingLabelFoundation.prototype.destroy = function () {
  6970. this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_);
  6971. };
  6972. /**
  6973. * Returns the width of the label element.
  6974. */
  6975. MDCFloatingLabelFoundation.prototype.getWidth = function () {
  6976. return this.adapter.getWidth();
  6977. };
  6978. /**
  6979. * Styles the label to produce a shake animation to indicate an error.
  6980. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
  6981. */
  6982. MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
  6983. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  6984. if (shouldShake) {
  6985. this.adapter.addClass(LABEL_SHAKE);
  6986. } else {
  6987. this.adapter.removeClass(LABEL_SHAKE);
  6988. }
  6989. };
  6990. /**
  6991. * Styles the label to float or dock.
  6992. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
  6993. */
  6994. MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
  6995. var _a = MDCFloatingLabelFoundation.cssClasses,
  6996. LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
  6997. LABEL_SHAKE = _a.LABEL_SHAKE;
  6998. if (shouldFloat) {
  6999. this.adapter.addClass(LABEL_FLOAT_ABOVE);
  7000. } else {
  7001. this.adapter.removeClass(LABEL_FLOAT_ABOVE);
  7002. this.adapter.removeClass(LABEL_SHAKE);
  7003. }
  7004. };
  7005. /**
  7006. * Styles the label as required.
  7007. * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
  7008. */
  7009. MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
  7010. var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
  7011. if (isRequired) {
  7012. this.adapter.addClass(LABEL_REQUIRED);
  7013. } else {
  7014. this.adapter.removeClass(LABEL_REQUIRED);
  7015. }
  7016. };
  7017. MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () {
  7018. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  7019. this.adapter.removeClass(LABEL_SHAKE);
  7020. };
  7021. return MDCFloatingLabelFoundation;
  7022. }(foundation_1.MDCFoundation);
  7023. exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
  7024. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7025. exports.default = MDCFloatingLabelFoundation;
  7026. /***/ }),
  7027. /***/ "./packages/mdc-floating-label/index.ts":
  7028. /*!**********************************************!*\
  7029. !*** ./packages/mdc-floating-label/index.ts ***!
  7030. \**********************************************/
  7031. /*! no static exports found */
  7032. /***/ (function(module, exports, __webpack_require__) {
  7033. "use strict";
  7034. /**
  7035. * @license
  7036. * Copyright 2019 Google Inc.
  7037. *
  7038. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7039. * of this software and associated documentation files (the "Software"), to deal
  7040. * in the Software without restriction, including without limitation the rights
  7041. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7042. * copies of the Software, and to permit persons to whom the Software is
  7043. * furnished to do so, subject to the following conditions:
  7044. *
  7045. * The above copyright notice and this permission notice shall be included in
  7046. * all copies or substantial portions of the Software.
  7047. *
  7048. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7049. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7050. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7051. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7052. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7053. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7054. * THE SOFTWARE.
  7055. */
  7056. function __export(m) {
  7057. for (var p in m) {
  7058. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7059. }
  7060. }
  7061. Object.defineProperty(exports, "__esModule", { value: true });
  7062. __export(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts"));
  7063. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"));
  7064. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"));
  7065. /***/ }),
  7066. /***/ "./packages/mdc-form-field/component.ts":
  7067. /*!**********************************************!*\
  7068. !*** ./packages/mdc-form-field/component.ts ***!
  7069. \**********************************************/
  7070. /*! no static exports found */
  7071. /***/ (function(module, exports, __webpack_require__) {
  7072. "use strict";
  7073. /**
  7074. * @license
  7075. * Copyright 2017 Google Inc.
  7076. *
  7077. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7078. * of this software and associated documentation files (the "Software"), to deal
  7079. * in the Software without restriction, including without limitation the rights
  7080. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7081. * copies of the Software, and to permit persons to whom the Software is
  7082. * furnished to do so, subject to the following conditions:
  7083. *
  7084. * The above copyright notice and this permission notice shall be included in
  7085. * all copies or substantial portions of the Software.
  7086. *
  7087. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7088. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7089. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7090. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7091. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7092. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7093. * THE SOFTWARE.
  7094. */
  7095. var __extends = this && this.__extends || function () {
  7096. var _extendStatics = function extendStatics(d, b) {
  7097. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7098. d.__proto__ = b;
  7099. } || function (d, b) {
  7100. for (var p in b) {
  7101. if (b.hasOwnProperty(p)) d[p] = b[p];
  7102. }
  7103. };
  7104. return _extendStatics(d, b);
  7105. };
  7106. return function (d, b) {
  7107. _extendStatics(d, b);
  7108. function __() {
  7109. this.constructor = d;
  7110. }
  7111. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7112. };
  7113. }();
  7114. Object.defineProperty(exports, "__esModule", { value: true });
  7115. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7116. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts");
  7117. var MDCFormField = /** @class */function (_super) {
  7118. __extends(MDCFormField, _super);
  7119. function MDCFormField() {
  7120. return _super !== null && _super.apply(this, arguments) || this;
  7121. }
  7122. MDCFormField.attachTo = function (root) {
  7123. return new MDCFormField(root);
  7124. };
  7125. MDCFormField.prototype.labelEl = function () {
  7126. var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR;
  7127. return this.root.querySelector(LABEL_SELECTOR);
  7128. };
  7129. MDCFormField.prototype.getDefaultFoundation = function () {
  7130. var _this = this;
  7131. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7132. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7133. var adapter = {
  7134. activateInputRipple: function activateInputRipple() {
  7135. if (_this.input && _this.input.ripple) {
  7136. _this.input.ripple.activate();
  7137. }
  7138. },
  7139. deactivateInputRipple: function deactivateInputRipple() {
  7140. if (_this.input && _this.input.ripple) {
  7141. _this.input.ripple.deactivate();
  7142. }
  7143. },
  7144. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  7145. var labelEl = _this.labelEl();
  7146. if (labelEl) {
  7147. labelEl.removeEventListener(evtType, handler);
  7148. }
  7149. },
  7150. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  7151. var labelEl = _this.labelEl();
  7152. if (labelEl) {
  7153. labelEl.addEventListener(evtType, handler);
  7154. }
  7155. }
  7156. };
  7157. return new foundation_1.MDCFormFieldFoundation(adapter);
  7158. };
  7159. return MDCFormField;
  7160. }(component_1.MDCComponent);
  7161. exports.MDCFormField = MDCFormField;
  7162. /***/ }),
  7163. /***/ "./packages/mdc-form-field/constants.ts":
  7164. /*!**********************************************!*\
  7165. !*** ./packages/mdc-form-field/constants.ts ***!
  7166. \**********************************************/
  7167. /*! no static exports found */
  7168. /***/ (function(module, exports, __webpack_require__) {
  7169. "use strict";
  7170. /**
  7171. * @license
  7172. * Copyright 2017 Google Inc.
  7173. *
  7174. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7175. * of this software and associated documentation files (the "Software"), to deal
  7176. * in the Software without restriction, including without limitation the rights
  7177. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7178. * copies of the Software, and to permit persons to whom the Software is
  7179. * furnished to do so, subject to the following conditions:
  7180. *
  7181. * The above copyright notice and this permission notice shall be included in
  7182. * all copies or substantial portions of the Software.
  7183. *
  7184. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7185. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7186. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7187. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7188. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7189. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7190. * THE SOFTWARE.
  7191. */
  7192. Object.defineProperty(exports, "__esModule", { value: true });
  7193. exports.cssClasses = {
  7194. ROOT: 'mdc-form-field'
  7195. };
  7196. exports.strings = {
  7197. LABEL_SELECTOR: '.mdc-form-field > label'
  7198. };
  7199. /***/ }),
  7200. /***/ "./packages/mdc-form-field/foundation.ts":
  7201. /*!***********************************************!*\
  7202. !*** ./packages/mdc-form-field/foundation.ts ***!
  7203. \***********************************************/
  7204. /*! no static exports found */
  7205. /***/ (function(module, exports, __webpack_require__) {
  7206. "use strict";
  7207. /**
  7208. * @license
  7209. * Copyright 2017 Google Inc.
  7210. *
  7211. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7212. * of this software and associated documentation files (the "Software"), to deal
  7213. * in the Software without restriction, including without limitation the rights
  7214. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7215. * copies of the Software, and to permit persons to whom the Software is
  7216. * furnished to do so, subject to the following conditions:
  7217. *
  7218. * The above copyright notice and this permission notice shall be included in
  7219. * all copies or substantial portions of the Software.
  7220. *
  7221. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7222. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7223. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7224. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7225. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7226. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7227. * THE SOFTWARE.
  7228. */
  7229. var __extends = this && this.__extends || function () {
  7230. var _extendStatics = function extendStatics(d, b) {
  7231. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7232. d.__proto__ = b;
  7233. } || function (d, b) {
  7234. for (var p in b) {
  7235. if (b.hasOwnProperty(p)) d[p] = b[p];
  7236. }
  7237. };
  7238. return _extendStatics(d, b);
  7239. };
  7240. return function (d, b) {
  7241. _extendStatics(d, b);
  7242. function __() {
  7243. this.constructor = d;
  7244. }
  7245. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7246. };
  7247. }();
  7248. var __assign = this && this.__assign || function () {
  7249. __assign = Object.assign || function (t) {
  7250. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7251. s = arguments[i];
  7252. for (var p in s) {
  7253. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7254. }
  7255. }
  7256. return t;
  7257. };
  7258. return __assign.apply(this, arguments);
  7259. };
  7260. Object.defineProperty(exports, "__esModule", { value: true });
  7261. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7262. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts");
  7263. var MDCFormFieldFoundation = /** @class */function (_super) {
  7264. __extends(MDCFormFieldFoundation, _super);
  7265. function MDCFormFieldFoundation(adapter) {
  7266. var _this = _super.call(this, __assign(__assign({}, MDCFormFieldFoundation.defaultAdapter), adapter)) || this;
  7267. _this.click = function () {
  7268. _this.handleClick();
  7269. };
  7270. return _this;
  7271. }
  7272. Object.defineProperty(MDCFormFieldFoundation, "cssClasses", {
  7273. get: function get() {
  7274. return constants_1.cssClasses;
  7275. },
  7276. enumerable: true,
  7277. configurable: true
  7278. });
  7279. Object.defineProperty(MDCFormFieldFoundation, "strings", {
  7280. get: function get() {
  7281. return constants_1.strings;
  7282. },
  7283. enumerable: true,
  7284. configurable: true
  7285. });
  7286. Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", {
  7287. get: function get() {
  7288. return {
  7289. activateInputRipple: function activateInputRipple() {
  7290. return undefined;
  7291. },
  7292. deactivateInputRipple: function deactivateInputRipple() {
  7293. return undefined;
  7294. },
  7295. deregisterInteractionHandler: function deregisterInteractionHandler() {
  7296. return undefined;
  7297. },
  7298. registerInteractionHandler: function registerInteractionHandler() {
  7299. return undefined;
  7300. }
  7301. };
  7302. },
  7303. enumerable: true,
  7304. configurable: true
  7305. });
  7306. MDCFormFieldFoundation.prototype.init = function () {
  7307. this.adapter.registerInteractionHandler('click', this.click);
  7308. };
  7309. MDCFormFieldFoundation.prototype.destroy = function () {
  7310. this.adapter.deregisterInteractionHandler('click', this.click);
  7311. };
  7312. MDCFormFieldFoundation.prototype.handleClick = function () {
  7313. var _this = this;
  7314. this.adapter.activateInputRipple();
  7315. requestAnimationFrame(function () {
  7316. _this.adapter.deactivateInputRipple();
  7317. });
  7318. };
  7319. return MDCFormFieldFoundation;
  7320. }(foundation_1.MDCFoundation);
  7321. exports.MDCFormFieldFoundation = MDCFormFieldFoundation;
  7322. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7323. exports.default = MDCFormFieldFoundation;
  7324. /***/ }),
  7325. /***/ "./packages/mdc-form-field/index.ts":
  7326. /*!******************************************!*\
  7327. !*** ./packages/mdc-form-field/index.ts ***!
  7328. \******************************************/
  7329. /*! no static exports found */
  7330. /***/ (function(module, exports, __webpack_require__) {
  7331. "use strict";
  7332. /**
  7333. * @license
  7334. * Copyright 2019 Google Inc.
  7335. *
  7336. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7337. * of this software and associated documentation files (the "Software"), to deal
  7338. * in the Software without restriction, including without limitation the rights
  7339. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7340. * copies of the Software, and to permit persons to whom the Software is
  7341. * furnished to do so, subject to the following conditions:
  7342. *
  7343. * The above copyright notice and this permission notice shall be included in
  7344. * all copies or substantial portions of the Software.
  7345. *
  7346. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7347. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7348. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7349. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7350. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7351. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7352. * THE SOFTWARE.
  7353. */
  7354. function __export(m) {
  7355. for (var p in m) {
  7356. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7357. }
  7358. }
  7359. Object.defineProperty(exports, "__esModule", { value: true });
  7360. __export(__webpack_require__(/*! ./component */ "./packages/mdc-form-field/component.ts"));
  7361. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"));
  7362. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"));
  7363. /***/ }),
  7364. /***/ "./packages/mdc-icon-button/component.ts":
  7365. /*!***********************************************!*\
  7366. !*** ./packages/mdc-icon-button/component.ts ***!
  7367. \***********************************************/
  7368. /*! no static exports found */
  7369. /***/ (function(module, exports, __webpack_require__) {
  7370. "use strict";
  7371. /**
  7372. * @license
  7373. * Copyright 2018 Google Inc.
  7374. *
  7375. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7376. * of this software and associated documentation files (the "Software"), to deal
  7377. * in the Software without restriction, including without limitation the rights
  7378. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7379. * copies of the Software, and to permit persons to whom the Software is
  7380. * furnished to do so, subject to the following conditions:
  7381. *
  7382. * The above copyright notice and this permission notice shall be included in
  7383. * all copies or substantial portions of the Software.
  7384. *
  7385. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7386. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7387. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7388. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7389. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7390. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7391. * THE SOFTWARE.
  7392. */
  7393. var __extends = this && this.__extends || function () {
  7394. var _extendStatics = function extendStatics(d, b) {
  7395. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7396. d.__proto__ = b;
  7397. } || function (d, b) {
  7398. for (var p in b) {
  7399. if (b.hasOwnProperty(p)) d[p] = b[p];
  7400. }
  7401. };
  7402. return _extendStatics(d, b);
  7403. };
  7404. return function (d, b) {
  7405. _extendStatics(d, b);
  7406. function __() {
  7407. this.constructor = d;
  7408. }
  7409. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7410. };
  7411. }();
  7412. Object.defineProperty(exports, "__esModule", { value: true });
  7413. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7414. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  7415. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts");
  7416. var strings = foundation_1.MDCIconButtonToggleFoundation.strings;
  7417. var MDCIconButtonToggle = /** @class */function (_super) {
  7418. __extends(MDCIconButtonToggle, _super);
  7419. function MDCIconButtonToggle() {
  7420. var _this = _super !== null && _super.apply(this, arguments) || this;
  7421. _this.rippleComponent = _this.createRipple();
  7422. return _this;
  7423. }
  7424. MDCIconButtonToggle.attachTo = function (root) {
  7425. return new MDCIconButtonToggle(root);
  7426. };
  7427. MDCIconButtonToggle.prototype.initialSyncWithDOM = function () {
  7428. var _this = this;
  7429. this.handleClick = function () {
  7430. _this.foundation.handleClick();
  7431. };
  7432. this.listen('click', this.handleClick);
  7433. };
  7434. MDCIconButtonToggle.prototype.destroy = function () {
  7435. this.unlisten('click', this.handleClick);
  7436. this.ripple.destroy();
  7437. _super.prototype.destroy.call(this);
  7438. };
  7439. MDCIconButtonToggle.prototype.getDefaultFoundation = function () {
  7440. var _this = this;
  7441. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7442. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7443. var adapter = {
  7444. addClass: function addClass(className) {
  7445. return _this.root.classList.add(className);
  7446. },
  7447. hasClass: function hasClass(className) {
  7448. return _this.root.classList.contains(className);
  7449. },
  7450. notifyChange: function notifyChange(evtData) {
  7451. _this.emit(strings.CHANGE_EVENT, evtData);
  7452. },
  7453. removeClass: function removeClass(className) {
  7454. return _this.root.classList.remove(className);
  7455. },
  7456. getAttr: function getAttr(attrName) {
  7457. return _this.root.getAttribute(attrName);
  7458. },
  7459. setAttr: function setAttr(attrName, attrValue) {
  7460. return _this.root.setAttribute(attrName, attrValue);
  7461. }
  7462. };
  7463. return new foundation_1.MDCIconButtonToggleFoundation(adapter);
  7464. };
  7465. Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", {
  7466. get: function get() {
  7467. return this.rippleComponent;
  7468. },
  7469. enumerable: true,
  7470. configurable: true
  7471. });
  7472. Object.defineProperty(MDCIconButtonToggle.prototype, "on", {
  7473. get: function get() {
  7474. return this.foundation.isOn();
  7475. },
  7476. set: function set(isOn) {
  7477. this.foundation.toggle(isOn);
  7478. },
  7479. enumerable: true,
  7480. configurable: true
  7481. });
  7482. MDCIconButtonToggle.prototype.createRipple = function () {
  7483. var ripple = new component_2.MDCRipple(this.root);
  7484. ripple.unbounded = true;
  7485. return ripple;
  7486. };
  7487. return MDCIconButtonToggle;
  7488. }(component_1.MDCComponent);
  7489. exports.MDCIconButtonToggle = MDCIconButtonToggle;
  7490. /***/ }),
  7491. /***/ "./packages/mdc-icon-button/constants.ts":
  7492. /*!***********************************************!*\
  7493. !*** ./packages/mdc-icon-button/constants.ts ***!
  7494. \***********************************************/
  7495. /*! no static exports found */
  7496. /***/ (function(module, exports, __webpack_require__) {
  7497. "use strict";
  7498. /**
  7499. * @license
  7500. * Copyright 2018 Google Inc.
  7501. *
  7502. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7503. * of this software and associated documentation files (the "Software"), to deal
  7504. * in the Software without restriction, including without limitation the rights
  7505. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7506. * copies of the Software, and to permit persons to whom the Software is
  7507. * furnished to do so, subject to the following conditions:
  7508. *
  7509. * The above copyright notice and this permission notice shall be included in
  7510. * all copies or substantial portions of the Software.
  7511. *
  7512. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7513. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7514. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7515. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7516. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7517. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7518. * THE SOFTWARE.
  7519. */
  7520. Object.defineProperty(exports, "__esModule", { value: true });
  7521. exports.cssClasses = {
  7522. ICON_BUTTON_ON: 'mdc-icon-button--on',
  7523. ROOT: 'mdc-icon-button'
  7524. };
  7525. exports.strings = {
  7526. ARIA_LABEL: 'aria-label',
  7527. ARIA_PRESSED: 'aria-pressed',
  7528. DATA_ARIA_LABEL_OFF: 'data-aria-label-off',
  7529. DATA_ARIA_LABEL_ON: 'data-aria-label-on',
  7530. CHANGE_EVENT: 'MDCIconButtonToggle:change'
  7531. };
  7532. /***/ }),
  7533. /***/ "./packages/mdc-icon-button/foundation.ts":
  7534. /*!************************************************!*\
  7535. !*** ./packages/mdc-icon-button/foundation.ts ***!
  7536. \************************************************/
  7537. /*! no static exports found */
  7538. /***/ (function(module, exports, __webpack_require__) {
  7539. "use strict";
  7540. /**
  7541. * @license
  7542. * Copyright 2018 Google Inc.
  7543. *
  7544. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7545. * of this software and associated documentation files (the "Software"), to deal
  7546. * in the Software without restriction, including without limitation the rights
  7547. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7548. * copies of the Software, and to permit persons to whom the Software is
  7549. * furnished to do so, subject to the following conditions:
  7550. *
  7551. * The above copyright notice and this permission notice shall be included in
  7552. * all copies or substantial portions of the Software.
  7553. *
  7554. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7555. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7556. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7557. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7558. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7559. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7560. * THE SOFTWARE.
  7561. */
  7562. var __extends = this && this.__extends || function () {
  7563. var _extendStatics = function extendStatics(d, b) {
  7564. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7565. d.__proto__ = b;
  7566. } || function (d, b) {
  7567. for (var p in b) {
  7568. if (b.hasOwnProperty(p)) d[p] = b[p];
  7569. }
  7570. };
  7571. return _extendStatics(d, b);
  7572. };
  7573. return function (d, b) {
  7574. _extendStatics(d, b);
  7575. function __() {
  7576. this.constructor = d;
  7577. }
  7578. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7579. };
  7580. }();
  7581. var __assign = this && this.__assign || function () {
  7582. __assign = Object.assign || function (t) {
  7583. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7584. s = arguments[i];
  7585. for (var p in s) {
  7586. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7587. }
  7588. }
  7589. return t;
  7590. };
  7591. return __assign.apply(this, arguments);
  7592. };
  7593. Object.defineProperty(exports, "__esModule", { value: true });
  7594. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7595. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts");
  7596. var MDCIconButtonToggleFoundation = /** @class */function (_super) {
  7597. __extends(MDCIconButtonToggleFoundation, _super);
  7598. function MDCIconButtonToggleFoundation(adapter) {
  7599. var _this = _super.call(this, __assign(__assign({}, MDCIconButtonToggleFoundation.defaultAdapter), adapter)) || this;
  7600. /**
  7601. * Whether the icon button has an aria label that changes depending on
  7602. * toggled state.
  7603. */
  7604. _this.hasToggledAriaLabel = false;
  7605. return _this;
  7606. }
  7607. Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", {
  7608. get: function get() {
  7609. return constants_1.cssClasses;
  7610. },
  7611. enumerable: true,
  7612. configurable: true
  7613. });
  7614. Object.defineProperty(MDCIconButtonToggleFoundation, "strings", {
  7615. get: function get() {
  7616. return constants_1.strings;
  7617. },
  7618. enumerable: true,
  7619. configurable: true
  7620. });
  7621. Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", {
  7622. get: function get() {
  7623. return {
  7624. addClass: function addClass() {
  7625. return undefined;
  7626. },
  7627. hasClass: function hasClass() {
  7628. return false;
  7629. },
  7630. notifyChange: function notifyChange() {
  7631. return undefined;
  7632. },
  7633. removeClass: function removeClass() {
  7634. return undefined;
  7635. },
  7636. getAttr: function getAttr() {
  7637. return null;
  7638. },
  7639. setAttr: function setAttr() {
  7640. return undefined;
  7641. }
  7642. };
  7643. },
  7644. enumerable: true,
  7645. configurable: true
  7646. });
  7647. MDCIconButtonToggleFoundation.prototype.init = function () {
  7648. var ariaLabelOn = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON);
  7649. var ariaLabelOff = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF);
  7650. if (ariaLabelOn && ariaLabelOff) {
  7651. if (this.adapter.getAttr(constants_1.strings.ARIA_PRESSED) !== null) {
  7652. throw new Error('MDCIconButtonToggleFoundation: Button should not set ' + '`aria-pressed` if it has a toggled aria label.');
  7653. }
  7654. this.hasToggledAriaLabel = true;
  7655. } else {
  7656. this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, String(this.isOn()));
  7657. }
  7658. };
  7659. MDCIconButtonToggleFoundation.prototype.handleClick = function () {
  7660. this.toggle();
  7661. this.adapter.notifyChange({ isOn: this.isOn() });
  7662. };
  7663. MDCIconButtonToggleFoundation.prototype.isOn = function () {
  7664. return this.adapter.hasClass(constants_1.cssClasses.ICON_BUTTON_ON);
  7665. };
  7666. MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) {
  7667. if (isOn === void 0) {
  7668. isOn = !this.isOn();
  7669. }
  7670. // Toggle UI based on state.
  7671. if (isOn) {
  7672. this.adapter.addClass(constants_1.cssClasses.ICON_BUTTON_ON);
  7673. } else {
  7674. this.adapter.removeClass(constants_1.cssClasses.ICON_BUTTON_ON);
  7675. }
  7676. // Toggle aria attributes based on state.
  7677. if (this.hasToggledAriaLabel) {
  7678. var ariaLabel = isOn ? this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON) : this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF);
  7679. this.adapter.setAttr(constants_1.strings.ARIA_LABEL, ariaLabel || '');
  7680. } else {
  7681. this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn);
  7682. }
  7683. };
  7684. return MDCIconButtonToggleFoundation;
  7685. }(foundation_1.MDCFoundation);
  7686. exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation;
  7687. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7688. exports.default = MDCIconButtonToggleFoundation;
  7689. /***/ }),
  7690. /***/ "./packages/mdc-icon-button/index.ts":
  7691. /*!*******************************************!*\
  7692. !*** ./packages/mdc-icon-button/index.ts ***!
  7693. \*******************************************/
  7694. /*! no static exports found */
  7695. /***/ (function(module, exports, __webpack_require__) {
  7696. "use strict";
  7697. /**
  7698. * @license
  7699. * Copyright 2019 Google Inc.
  7700. *
  7701. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7702. * of this software and associated documentation files (the "Software"), to deal
  7703. * in the Software without restriction, including without limitation the rights
  7704. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7705. * copies of the Software, and to permit persons to whom the Software is
  7706. * furnished to do so, subject to the following conditions:
  7707. *
  7708. * The above copyright notice and this permission notice shall be included in
  7709. * all copies or substantial portions of the Software.
  7710. *
  7711. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7712. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7713. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7714. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7715. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7716. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7717. * THE SOFTWARE.
  7718. */
  7719. function __export(m) {
  7720. for (var p in m) {
  7721. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7722. }
  7723. }
  7724. Object.defineProperty(exports, "__esModule", { value: true });
  7725. __export(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts"));
  7726. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"));
  7727. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"));
  7728. /***/ }),
  7729. /***/ "./packages/mdc-line-ripple/component.ts":
  7730. /*!***********************************************!*\
  7731. !*** ./packages/mdc-line-ripple/component.ts ***!
  7732. \***********************************************/
  7733. /*! no static exports found */
  7734. /***/ (function(module, exports, __webpack_require__) {
  7735. "use strict";
  7736. /**
  7737. * @license
  7738. * Copyright 2018 Google Inc.
  7739. *
  7740. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7741. * of this software and associated documentation files (the "Software"), to deal
  7742. * in the Software without restriction, including without limitation the rights
  7743. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7744. * copies of the Software, and to permit persons to whom the Software is
  7745. * furnished to do so, subject to the following conditions:
  7746. *
  7747. * The above copyright notice and this permission notice shall be included in
  7748. * all copies or substantial portions of the Software.
  7749. *
  7750. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7751. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7752. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7753. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7754. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7755. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7756. * THE SOFTWARE.
  7757. */
  7758. var __extends = this && this.__extends || function () {
  7759. var _extendStatics = function extendStatics(d, b) {
  7760. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7761. d.__proto__ = b;
  7762. } || function (d, b) {
  7763. for (var p in b) {
  7764. if (b.hasOwnProperty(p)) d[p] = b[p];
  7765. }
  7766. };
  7767. return _extendStatics(d, b);
  7768. };
  7769. return function (d, b) {
  7770. _extendStatics(d, b);
  7771. function __() {
  7772. this.constructor = d;
  7773. }
  7774. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7775. };
  7776. }();
  7777. Object.defineProperty(exports, "__esModule", { value: true });
  7778. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7779. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts");
  7780. var MDCLineRipple = /** @class */function (_super) {
  7781. __extends(MDCLineRipple, _super);
  7782. function MDCLineRipple() {
  7783. return _super !== null && _super.apply(this, arguments) || this;
  7784. }
  7785. MDCLineRipple.attachTo = function (root) {
  7786. return new MDCLineRipple(root);
  7787. };
  7788. /**
  7789. * Activates the line ripple
  7790. */
  7791. MDCLineRipple.prototype.activate = function () {
  7792. this.foundation.activate();
  7793. };
  7794. /**
  7795. * Deactivates the line ripple
  7796. */
  7797. MDCLineRipple.prototype.deactivate = function () {
  7798. this.foundation.deactivate();
  7799. };
  7800. /**
  7801. * Sets the transform origin given a user's click location.
  7802. * The `rippleCenter` is the x-coordinate of the middle of the ripple.
  7803. */
  7804. MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
  7805. this.foundation.setRippleCenter(xCoordinate);
  7806. };
  7807. MDCLineRipple.prototype.getDefaultFoundation = function () {
  7808. var _this = this;
  7809. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7810. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7811. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  7812. var adapter = {
  7813. addClass: function addClass(className) {
  7814. return _this.root.classList.add(className);
  7815. },
  7816. removeClass: function removeClass(className) {
  7817. return _this.root.classList.remove(className);
  7818. },
  7819. hasClass: function hasClass(className) {
  7820. return _this.root.classList.contains(className);
  7821. },
  7822. setStyle: function setStyle(propertyName, value) {
  7823. return _this.root.style.setProperty(propertyName, value);
  7824. },
  7825. registerEventHandler: function registerEventHandler(evtType, handler) {
  7826. return _this.listen(evtType, handler);
  7827. },
  7828. deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
  7829. return _this.unlisten(evtType, handler);
  7830. }
  7831. };
  7832. // tslint:enable:object-literal-sort-keys
  7833. return new foundation_1.MDCLineRippleFoundation(adapter);
  7834. };
  7835. return MDCLineRipple;
  7836. }(component_1.MDCComponent);
  7837. exports.MDCLineRipple = MDCLineRipple;
  7838. /***/ }),
  7839. /***/ "./packages/mdc-line-ripple/constants.ts":
  7840. /*!***********************************************!*\
  7841. !*** ./packages/mdc-line-ripple/constants.ts ***!
  7842. \***********************************************/
  7843. /*! no static exports found */
  7844. /***/ (function(module, exports, __webpack_require__) {
  7845. "use strict";
  7846. /**
  7847. * @license
  7848. * Copyright 2018 Google Inc.
  7849. *
  7850. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7851. * of this software and associated documentation files (the "Software"), to deal
  7852. * in the Software without restriction, including without limitation the rights
  7853. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7854. * copies of the Software, and to permit persons to whom the Software is
  7855. * furnished to do so, subject to the following conditions:
  7856. *
  7857. * The above copyright notice and this permission notice shall be included in
  7858. * all copies or substantial portions of the Software.
  7859. *
  7860. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7861. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7862. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7863. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7864. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7865. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7866. * THE SOFTWARE.
  7867. */
  7868. Object.defineProperty(exports, "__esModule", { value: true });
  7869. var cssClasses = {
  7870. LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
  7871. LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'
  7872. };
  7873. exports.cssClasses = cssClasses;
  7874. /***/ }),
  7875. /***/ "./packages/mdc-line-ripple/foundation.ts":
  7876. /*!************************************************!*\
  7877. !*** ./packages/mdc-line-ripple/foundation.ts ***!
  7878. \************************************************/
  7879. /*! no static exports found */
  7880. /***/ (function(module, exports, __webpack_require__) {
  7881. "use strict";
  7882. /**
  7883. * @license
  7884. * Copyright 2018 Google Inc.
  7885. *
  7886. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7887. * of this software and associated documentation files (the "Software"), to deal
  7888. * in the Software without restriction, including without limitation the rights
  7889. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7890. * copies of the Software, and to permit persons to whom the Software is
  7891. * furnished to do so, subject to the following conditions:
  7892. *
  7893. * The above copyright notice and this permission notice shall be included in
  7894. * all copies or substantial portions of the Software.
  7895. *
  7896. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7897. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7898. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7899. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7900. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7901. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7902. * THE SOFTWARE.
  7903. */
  7904. var __extends = this && this.__extends || function () {
  7905. var _extendStatics = function extendStatics(d, b) {
  7906. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7907. d.__proto__ = b;
  7908. } || function (d, b) {
  7909. for (var p in b) {
  7910. if (b.hasOwnProperty(p)) d[p] = b[p];
  7911. }
  7912. };
  7913. return _extendStatics(d, b);
  7914. };
  7915. return function (d, b) {
  7916. _extendStatics(d, b);
  7917. function __() {
  7918. this.constructor = d;
  7919. }
  7920. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7921. };
  7922. }();
  7923. var __assign = this && this.__assign || function () {
  7924. __assign = Object.assign || function (t) {
  7925. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7926. s = arguments[i];
  7927. for (var p in s) {
  7928. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7929. }
  7930. }
  7931. return t;
  7932. };
  7933. return __assign.apply(this, arguments);
  7934. };
  7935. Object.defineProperty(exports, "__esModule", { value: true });
  7936. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7937. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts");
  7938. var MDCLineRippleFoundation = /** @class */function (_super) {
  7939. __extends(MDCLineRippleFoundation, _super);
  7940. function MDCLineRippleFoundation(adapter) {
  7941. var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
  7942. _this.transitionEndHandler_ = function (evt) {
  7943. return _this.handleTransitionEnd(evt);
  7944. };
  7945. return _this;
  7946. }
  7947. Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
  7948. get: function get() {
  7949. return constants_1.cssClasses;
  7950. },
  7951. enumerable: true,
  7952. configurable: true
  7953. });
  7954. Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
  7955. /**
  7956. * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
  7957. */
  7958. get: function get() {
  7959. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  7960. return {
  7961. addClass: function addClass() {
  7962. return undefined;
  7963. },
  7964. removeClass: function removeClass() {
  7965. return undefined;
  7966. },
  7967. hasClass: function hasClass() {
  7968. return false;
  7969. },
  7970. setStyle: function setStyle() {
  7971. return undefined;
  7972. },
  7973. registerEventHandler: function registerEventHandler() {
  7974. return undefined;
  7975. },
  7976. deregisterEventHandler: function deregisterEventHandler() {
  7977. return undefined;
  7978. }
  7979. };
  7980. // tslint:enable:object-literal-sort-keys
  7981. },
  7982. enumerable: true,
  7983. configurable: true
  7984. });
  7985. MDCLineRippleFoundation.prototype.init = function () {
  7986. this.adapter.registerEventHandler('transitionend', this.transitionEndHandler_);
  7987. };
  7988. MDCLineRippleFoundation.prototype.destroy = function () {
  7989. this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler_);
  7990. };
  7991. MDCLineRippleFoundation.prototype.activate = function () {
  7992. this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  7993. this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  7994. };
  7995. MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
  7996. this.adapter.setStyle('transform-origin', xCoordinate + "px center");
  7997. };
  7998. MDCLineRippleFoundation.prototype.deactivate = function () {
  7999. this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  8000. };
  8001. MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
  8002. // Wait for the line ripple to be either transparent or opaque
  8003. // before emitting the animation end event
  8004. var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  8005. if (evt.propertyName === 'opacity') {
  8006. if (isDeactivating) {
  8007. this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  8008. this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  8009. }
  8010. }
  8011. };
  8012. return MDCLineRippleFoundation;
  8013. }(foundation_1.MDCFoundation);
  8014. exports.MDCLineRippleFoundation = MDCLineRippleFoundation;
  8015. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  8016. exports.default = MDCLineRippleFoundation;
  8017. /***/ }),
  8018. /***/ "./packages/mdc-line-ripple/index.ts":
  8019. /*!*******************************************!*\
  8020. !*** ./packages/mdc-line-ripple/index.ts ***!
  8021. \*******************************************/
  8022. /*! no static exports found */
  8023. /***/ (function(module, exports, __webpack_require__) {
  8024. "use strict";
  8025. /**
  8026. * @license
  8027. * Copyright 2019 Google Inc.
  8028. *
  8029. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8030. * of this software and associated documentation files (the "Software"), to deal
  8031. * in the Software without restriction, including without limitation the rights
  8032. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8033. * copies of the Software, and to permit persons to whom the Software is
  8034. * furnished to do so, subject to the following conditions:
  8035. *
  8036. * The above copyright notice and this permission notice shall be included in
  8037. * all copies or substantial portions of the Software.
  8038. *
  8039. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8040. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8041. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8042. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8043. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8044. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8045. * THE SOFTWARE.
  8046. */
  8047. function __export(m) {
  8048. for (var p in m) {
  8049. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  8050. }
  8051. }
  8052. Object.defineProperty(exports, "__esModule", { value: true });
  8053. __export(__webpack_require__(/*! ./component */ "./packages/mdc-line-ripple/component.ts"));
  8054. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"));
  8055. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"));
  8056. /***/ }),
  8057. /***/ "./packages/mdc-linear-progress/component.ts":
  8058. /*!***************************************************!*\
  8059. !*** ./packages/mdc-linear-progress/component.ts ***!
  8060. \***************************************************/
  8061. /*! no static exports found */
  8062. /***/ (function(module, exports, __webpack_require__) {
  8063. "use strict";
  8064. /**
  8065. * @license
  8066. * Copyright 2017 Google Inc.
  8067. *
  8068. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8069. * of this software and associated documentation files (the "Software"), to deal
  8070. * in the Software without restriction, including without limitation the rights
  8071. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8072. * copies of the Software, and to permit persons to whom the Software is
  8073. * furnished to do so, subject to the following conditions:
  8074. *
  8075. * The above copyright notice and this permission notice shall be included in
  8076. * all copies or substantial portions of the Software.
  8077. *
  8078. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8079. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8080. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8081. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8082. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8083. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8084. * THE SOFTWARE.
  8085. */
  8086. var __extends = this && this.__extends || function () {
  8087. var _extendStatics = function extendStatics(d, b) {
  8088. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8089. d.__proto__ = b;
  8090. } || function (d, b) {
  8091. for (var p in b) {
  8092. if (b.hasOwnProperty(p)) d[p] = b[p];
  8093. }
  8094. };
  8095. return _extendStatics(d, b);
  8096. };
  8097. return function (d, b) {
  8098. _extendStatics(d, b);
  8099. function __() {
  8100. this.constructor = d;
  8101. }
  8102. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8103. };
  8104. }();
  8105. Object.defineProperty(exports, "__esModule", { value: true });
  8106. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8107. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts");
  8108. var MDCLinearProgress = /** @class */function (_super) {
  8109. __extends(MDCLinearProgress, _super);
  8110. function MDCLinearProgress() {
  8111. return _super !== null && _super.apply(this, arguments) || this;
  8112. }
  8113. MDCLinearProgress.attachTo = function (root) {
  8114. return new MDCLinearProgress(root);
  8115. };
  8116. Object.defineProperty(MDCLinearProgress.prototype, "determinate", {
  8117. set: function set(value) {
  8118. this.foundation.setDeterminate(value);
  8119. },
  8120. enumerable: true,
  8121. configurable: true
  8122. });
  8123. Object.defineProperty(MDCLinearProgress.prototype, "progress", {
  8124. set: function set(value) {
  8125. this.foundation.setProgress(value);
  8126. },
  8127. enumerable: true,
  8128. configurable: true
  8129. });
  8130. Object.defineProperty(MDCLinearProgress.prototype, "buffer", {
  8131. set: function set(value) {
  8132. this.foundation.setBuffer(value);
  8133. },
  8134. enumerable: true,
  8135. configurable: true
  8136. });
  8137. Object.defineProperty(MDCLinearProgress.prototype, "reverse", {
  8138. set: function set(value) {
  8139. this.foundation.setReverse(value);
  8140. },
  8141. enumerable: true,
  8142. configurable: true
  8143. });
  8144. MDCLinearProgress.prototype.open = function () {
  8145. this.foundation.open();
  8146. };
  8147. MDCLinearProgress.prototype.close = function () {
  8148. this.foundation.close();
  8149. };
  8150. MDCLinearProgress.prototype.getDefaultFoundation = function () {
  8151. var _this = this;
  8152. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  8153. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  8154. var adapter = {
  8155. addClass: function addClass(className) {
  8156. _this.root.classList.add(className);
  8157. },
  8158. forceLayout: function forceLayout() {
  8159. _this.root.getBoundingClientRect();
  8160. },
  8161. setBufferBarStyle: function setBufferBarStyle(styleProperty, value) {
  8162. var bufferBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR);
  8163. if (bufferBar) {
  8164. bufferBar.style.setProperty(styleProperty, value);
  8165. }
  8166. },
  8167. setPrimaryBarStyle: function setPrimaryBarStyle(styleProperty, value) {
  8168. var primaryBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);
  8169. if (primaryBar) {
  8170. primaryBar.style.setProperty(styleProperty, value);
  8171. }
  8172. },
  8173. hasClass: function hasClass(className) {
  8174. return _this.root.classList.contains(className);
  8175. },
  8176. removeAttribute: function removeAttribute(attributeName) {
  8177. _this.root.removeAttribute(attributeName);
  8178. },
  8179. removeClass: function removeClass(className) {
  8180. _this.root.classList.remove(className);
  8181. },
  8182. setAttribute: function setAttribute(attributeName, value) {
  8183. _this.root.setAttribute(attributeName, value);
  8184. }
  8185. };
  8186. return new foundation_1.MDCLinearProgressFoundation(adapter);
  8187. };
  8188. return MDCLinearProgress;
  8189. }(component_1.MDCComponent);
  8190. exports.MDCLinearProgress = MDCLinearProgress;
  8191. /***/ }),
  8192. /***/ "./packages/mdc-linear-progress/constants.ts":
  8193. /*!***************************************************!*\
  8194. !*** ./packages/mdc-linear-progress/constants.ts ***!
  8195. \***************************************************/
  8196. /*! no static exports found */
  8197. /***/ (function(module, exports, __webpack_require__) {
  8198. "use strict";
  8199. /**
  8200. * @license
  8201. * Copyright 2017 Google Inc.
  8202. *
  8203. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8204. * of this software and associated documentation files (the "Software"), to deal
  8205. * in the Software without restriction, including without limitation the rights
  8206. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8207. * copies of the Software, and to permit persons to whom the Software is
  8208. * furnished to do so, subject to the following conditions:
  8209. *
  8210. * The above copyright notice and this permission notice shall be included in
  8211. * all copies or substantial portions of the Software.
  8212. *
  8213. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8214. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8215. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8216. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8217. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8218. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8219. * THE SOFTWARE.
  8220. */
  8221. Object.defineProperty(exports, "__esModule", { value: true });
  8222. exports.cssClasses = {
  8223. CLOSED_CLASS: 'mdc-linear-progress--closed',
  8224. INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
  8225. REVERSED_CLASS: 'mdc-linear-progress--reversed'
  8226. };
  8227. exports.strings = {
  8228. ARIA_VALUENOW: 'aria-valuenow',
  8229. BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar',
  8230. FLEX_BASIS: 'flex-basis',
  8231. PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar'
  8232. };
  8233. /***/ }),
  8234. /***/ "./packages/mdc-linear-progress/foundation.ts":
  8235. /*!****************************************************!*\
  8236. !*** ./packages/mdc-linear-progress/foundation.ts ***!
  8237. \****************************************************/
  8238. /*! no static exports found */
  8239. /***/ (function(module, exports, __webpack_require__) {
  8240. "use strict";
  8241. /**
  8242. * @license
  8243. * Copyright 2017 Google Inc.
  8244. *
  8245. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8246. * of this software and associated documentation files (the "Software"), to deal
  8247. * in the Software without restriction, including without limitation the rights
  8248. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8249. * copies of the Software, and to permit persons to whom the Software is
  8250. * furnished to do so, subject to the following conditions:
  8251. *
  8252. * The above copyright notice and this permission notice shall be included in
  8253. * all copies or substantial portions of the Software.
  8254. *
  8255. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8256. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8257. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8258. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8259. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8260. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8261. * THE SOFTWARE.
  8262. */
  8263. var __extends = this && this.__extends || function () {
  8264. var _extendStatics = function extendStatics(d, b) {
  8265. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8266. d.__proto__ = b;
  8267. } || function (d, b) {
  8268. for (var p in b) {
  8269. if (b.hasOwnProperty(p)) d[p] = b[p];
  8270. }
  8271. };
  8272. return _extendStatics(d, b);
  8273. };
  8274. return function (d, b) {
  8275. _extendStatics(d, b);
  8276. function __() {
  8277. this.constructor = d;
  8278. }
  8279. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8280. };
  8281. }();
  8282. var __assign = this && this.__assign || function () {
  8283. __assign = Object.assign || function (t) {
  8284. for (var s, i = 1, n = arguments.length; i < n; i++) {
  8285. s = arguments[i];
  8286. for (var p in s) {
  8287. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  8288. }
  8289. }
  8290. return t;
  8291. };
  8292. return __assign.apply(this, arguments);
  8293. };
  8294. Object.defineProperty(exports, "__esModule", { value: true });
  8295. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  8296. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  8297. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts");
  8298. var MDCLinearProgressFoundation = /** @class */function (_super) {
  8299. __extends(MDCLinearProgressFoundation, _super);
  8300. function MDCLinearProgressFoundation(adapter) {
  8301. return _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this;
  8302. }
  8303. Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", {
  8304. get: function get() {
  8305. return constants_1.cssClasses;
  8306. },
  8307. enumerable: true,
  8308. configurable: true
  8309. });
  8310. Object.defineProperty(MDCLinearProgressFoundation, "strings", {
  8311. get: function get() {
  8312. return constants_1.strings;
  8313. },
  8314. enumerable: true,
  8315. configurable: true
  8316. });
  8317. Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", {
  8318. get: function get() {
  8319. return {
  8320. addClass: function addClass() {
  8321. return undefined;
  8322. },
  8323. forceLayout: function forceLayout() {
  8324. return undefined;
  8325. },
  8326. setBufferBarStyle: function setBufferBarStyle() {
  8327. return null;
  8328. },
  8329. setPrimaryBarStyle: function setPrimaryBarStyle() {
  8330. return null;
  8331. },
  8332. hasClass: function hasClass() {
  8333. return false;
  8334. },
  8335. removeAttribute: function removeAttribute() {
  8336. return undefined;
  8337. },
  8338. removeClass: function removeClass() {
  8339. return undefined;
  8340. },
  8341. setAttribute: function setAttribute() {
  8342. return undefined;
  8343. }
  8344. };
  8345. },
  8346. enumerable: true,
  8347. configurable: true
  8348. });
  8349. MDCLinearProgressFoundation.prototype.init = function () {
  8350. this.isDeterminate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  8351. this.isReversed = this.adapter.hasClass(constants_1.cssClasses.REVERSED_CLASS);
  8352. this.progress = 0;
  8353. this.buffer = 1;
  8354. };
  8355. MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) {
  8356. this.isDeterminate = isDeterminate;
  8357. if (this.isDeterminate) {
  8358. this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  8359. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString());
  8360. this.setPrimaryBarProgress(this.progress);
  8361. this.setBufferBarProgress(this.buffer);
  8362. return;
  8363. }
  8364. if (this.isReversed) {
  8365. // Adding/removing REVERSED_CLASS starts a translate animation, while
  8366. // adding INDETERMINATE_CLASS starts a scale animation. Here, we reset
  8367. // the translate animation in order to keep it in sync with the new
  8368. // scale animation that will start from adding INDETERMINATE_CLASS
  8369. // below.
  8370. this.adapter.removeClass(constants_1.cssClasses.REVERSED_CLASS);
  8371. this.adapter.forceLayout();
  8372. this.adapter.addClass(constants_1.cssClasses.REVERSED_CLASS);
  8373. }
  8374. this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  8375. this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW);
  8376. this.setPrimaryBarProgress(1);
  8377. this.setBufferBarProgress(1);
  8378. };
  8379. MDCLinearProgressFoundation.prototype.getDeterminate = function () {
  8380. return this.isDeterminate;
  8381. };
  8382. MDCLinearProgressFoundation.prototype.setProgress = function (value) {
  8383. this.progress = value;
  8384. if (this.isDeterminate) {
  8385. this.setPrimaryBarProgress(value);
  8386. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString());
  8387. }
  8388. };
  8389. MDCLinearProgressFoundation.prototype.getProgress = function () {
  8390. return this.progress;
  8391. };
  8392. MDCLinearProgressFoundation.prototype.setBuffer = function (value) {
  8393. this.buffer = value;
  8394. if (this.isDeterminate) {
  8395. this.setBufferBarProgress(value);
  8396. }
  8397. };
  8398. MDCLinearProgressFoundation.prototype.setReverse = function (isReversed) {
  8399. this.isReversed = isReversed;
  8400. if (!this.isDeterminate) {
  8401. // Adding INDETERMINATE_CLASS starts a scale animation, while
  8402. // adding/removing REVERSED_CLASS starts a translate animation. Here, we
  8403. // reset the scale animation in order to keep it in sync with the new
  8404. // translate animation that will start from adding/removing REVERSED_CLASS
  8405. // below.
  8406. this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  8407. this.adapter.forceLayout();
  8408. this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  8409. }
  8410. if (this.isReversed) {
  8411. this.adapter.addClass(constants_1.cssClasses.REVERSED_CLASS);
  8412. return;
  8413. }
  8414. this.adapter.removeClass(constants_1.cssClasses.REVERSED_CLASS);
  8415. };
  8416. MDCLinearProgressFoundation.prototype.open = function () {
  8417. this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS);
  8418. };
  8419. MDCLinearProgressFoundation.prototype.close = function () {
  8420. this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS);
  8421. };
  8422. MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) {
  8423. var value = "scaleX(" + progressValue + ")";
  8424. // Accessing `window` without a `typeof` check will throw on Node environments.
  8425. var transformProp = typeof window !== 'undefined' ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
  8426. this.adapter.setPrimaryBarStyle(transformProp, value);
  8427. };
  8428. MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) {
  8429. var value = progressValue * 100 + "%";
  8430. this.adapter.setBufferBarStyle(constants_1.strings.FLEX_BASIS, value);
  8431. };
  8432. return MDCLinearProgressFoundation;
  8433. }(foundation_1.MDCFoundation);
  8434. exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation;
  8435. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  8436. exports.default = MDCLinearProgressFoundation;
  8437. /***/ }),
  8438. /***/ "./packages/mdc-linear-progress/index.ts":
  8439. /*!***********************************************!*\
  8440. !*** ./packages/mdc-linear-progress/index.ts ***!
  8441. \***********************************************/
  8442. /*! no static exports found */
  8443. /***/ (function(module, exports, __webpack_require__) {
  8444. "use strict";
  8445. /**
  8446. * @license
  8447. * Copyright 2019 Google Inc.
  8448. *
  8449. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8450. * of this software and associated documentation files (the "Software"), to deal
  8451. * in the Software without restriction, including without limitation the rights
  8452. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8453. * copies of the Software, and to permit persons to whom the Software is
  8454. * furnished to do so, subject to the following conditions:
  8455. *
  8456. * The above copyright notice and this permission notice shall be included in
  8457. * all copies or substantial portions of the Software.
  8458. *
  8459. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8460. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8461. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8462. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8463. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8464. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8465. * THE SOFTWARE.
  8466. */
  8467. function __export(m) {
  8468. for (var p in m) {
  8469. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  8470. }
  8471. }
  8472. Object.defineProperty(exports, "__esModule", { value: true });
  8473. __export(__webpack_require__(/*! ./component */ "./packages/mdc-linear-progress/component.ts"));
  8474. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"));
  8475. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"));
  8476. /***/ }),
  8477. /***/ "./packages/mdc-list/component.ts":
  8478. /*!****************************************!*\
  8479. !*** ./packages/mdc-list/component.ts ***!
  8480. \****************************************/
  8481. /*! no static exports found */
  8482. /***/ (function(module, exports, __webpack_require__) {
  8483. "use strict";
  8484. /**
  8485. * @license
  8486. * Copyright 2018 Google Inc.
  8487. *
  8488. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8489. * of this software and associated documentation files (the "Software"), to deal
  8490. * in the Software without restriction, including without limitation the rights
  8491. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8492. * copies of the Software, and to permit persons to whom the Software is
  8493. * furnished to do so, subject to the following conditions:
  8494. *
  8495. * The above copyright notice and this permission notice shall be included in
  8496. * all copies or substantial portions of the Software.
  8497. *
  8498. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8499. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8500. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8501. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8502. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8503. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8504. * THE SOFTWARE.
  8505. */
  8506. var __extends = this && this.__extends || function () {
  8507. var _extendStatics = function extendStatics(d, b) {
  8508. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8509. d.__proto__ = b;
  8510. } || function (d, b) {
  8511. for (var p in b) {
  8512. if (b.hasOwnProperty(p)) d[p] = b[p];
  8513. }
  8514. };
  8515. return _extendStatics(d, b);
  8516. };
  8517. return function (d, b) {
  8518. _extendStatics(d, b);
  8519. function __() {
  8520. this.constructor = d;
  8521. }
  8522. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8523. };
  8524. }();
  8525. Object.defineProperty(exports, "__esModule", { value: true });
  8526. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8527. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  8528. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  8529. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts");
  8530. var MDCList = /** @class */function (_super) {
  8531. __extends(MDCList, _super);
  8532. function MDCList() {
  8533. return _super !== null && _super.apply(this, arguments) || this;
  8534. }
  8535. Object.defineProperty(MDCList.prototype, "vertical", {
  8536. set: function set(value) {
  8537. this.foundation.setVerticalOrientation(value);
  8538. },
  8539. enumerable: true,
  8540. configurable: true
  8541. });
  8542. Object.defineProperty(MDCList.prototype, "listElements", {
  8543. get: function get() {
  8544. return [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.LIST_ITEM_CLASS));
  8545. },
  8546. enumerable: true,
  8547. configurable: true
  8548. });
  8549. Object.defineProperty(MDCList.prototype, "wrapFocus", {
  8550. set: function set(value) {
  8551. this.foundation.setWrapFocus(value);
  8552. },
  8553. enumerable: true,
  8554. configurable: true
  8555. });
  8556. Object.defineProperty(MDCList.prototype, "typeaheadInProgress", {
  8557. /**
  8558. * @return Whether typeahead is currently matching a user-specified prefix.
  8559. */
  8560. get: function get() {
  8561. return this.foundation.isTypeaheadInProgress();
  8562. },
  8563. enumerable: true,
  8564. configurable: true
  8565. });
  8566. Object.defineProperty(MDCList.prototype, "hasTypeahead", {
  8567. /**
  8568. * Sets whether typeahead functionality is enabled on the list.
  8569. * @param hasTypeahead Whether typeahead is enabled.
  8570. */
  8571. set: function set(hasTypeahead) {
  8572. this.foundation.setHasTypeahead(hasTypeahead);
  8573. },
  8574. enumerable: true,
  8575. configurable: true
  8576. });
  8577. Object.defineProperty(MDCList.prototype, "singleSelection", {
  8578. set: function set(isSingleSelectionList) {
  8579. this.foundation.setSingleSelection(isSingleSelectionList);
  8580. },
  8581. enumerable: true,
  8582. configurable: true
  8583. });
  8584. Object.defineProperty(MDCList.prototype, "selectedIndex", {
  8585. get: function get() {
  8586. return this.foundation.getSelectedIndex();
  8587. },
  8588. set: function set(index) {
  8589. this.foundation.setSelectedIndex(index);
  8590. },
  8591. enumerable: true,
  8592. configurable: true
  8593. });
  8594. MDCList.attachTo = function (root) {
  8595. return new MDCList(root);
  8596. };
  8597. MDCList.prototype.initialSyncWithDOM = function () {
  8598. this.handleClick_ = this.handleClickEvent_.bind(this);
  8599. this.handleKeydown_ = this.handleKeydownEvent_.bind(this);
  8600. this.focusInEventListener_ = this.handleFocusInEvent_.bind(this);
  8601. this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this);
  8602. this.listen('keydown', this.handleKeydown_);
  8603. this.listen('click', this.handleClick_);
  8604. this.listen('focusin', this.focusInEventListener_);
  8605. this.listen('focusout', this.focusOutEventListener_);
  8606. this.layout();
  8607. this.initializeListType();
  8608. };
  8609. MDCList.prototype.destroy = function () {
  8610. this.unlisten('keydown', this.handleKeydown_);
  8611. this.unlisten('click', this.handleClick_);
  8612. this.unlisten('focusin', this.focusInEventListener_);
  8613. this.unlisten('focusout', this.focusOutEventListener_);
  8614. };
  8615. MDCList.prototype.layout = function () {
  8616. var direction = this.root.getAttribute(constants_1.strings.ARIA_ORIENTATION);
  8617. this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL;
  8618. // List items need to have at least tabindex=-1 to be focusable.
  8619. [].slice.call(this.root.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) {
  8620. el.setAttribute('tabindex', '-1');
  8621. });
  8622. // Child button/a elements are not tabbable until the list item is focused.
  8623. [].slice.call(this.root.querySelectorAll(constants_1.strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) {
  8624. return el.setAttribute('tabindex', '-1');
  8625. });
  8626. this.foundation.layout();
  8627. };
  8628. /**
  8629. * Extracts the primary text from a list item.
  8630. * @param item The list item element.
  8631. * @return The primary text in the element.
  8632. */
  8633. MDCList.prototype.getPrimaryText = function (item) {
  8634. var primaryText = item.querySelector("." + constants_1.cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS);
  8635. if (primaryText) {
  8636. return primaryText.textContent || '';
  8637. }
  8638. var singleLineText = item.querySelector("." + constants_1.cssClasses.LIST_ITEM_TEXT_CLASS);
  8639. return singleLineText && singleLineText.textContent || '';
  8640. };
  8641. /**
  8642. * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio.
  8643. */
  8644. MDCList.prototype.initializeListType = function () {
  8645. var _this = this;
  8646. var checkboxListItems = this.root.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR);
  8647. var singleSelectedListItem = this.root.querySelector("\n ." + constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS + "\n ");
  8648. var radioSelectedListItem = this.root.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR);
  8649. if (checkboxListItems.length) {
  8650. var preselectedItems = this.root.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR);
  8651. this.selectedIndex = [].map.call(preselectedItems, function (listItem) {
  8652. return _this.listElements.indexOf(listItem);
  8653. });
  8654. } else if (singleSelectedListItem) {
  8655. if (singleSelectedListItem.classList.contains(constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS)) {
  8656. this.foundation.setUseActivatedClass(true);
  8657. }
  8658. this.singleSelection = true;
  8659. this.selectedIndex = this.listElements.indexOf(singleSelectedListItem);
  8660. } else if (radioSelectedListItem) {
  8661. this.selectedIndex = this.listElements.indexOf(radioSelectedListItem);
  8662. }
  8663. };
  8664. /**
  8665. * Updates the list item at itemIndex to the desired isEnabled state.
  8666. * @param itemIndex Index of the list item
  8667. * @param isEnabled Sets the list item to enabled or disabled.
  8668. */
  8669. MDCList.prototype.setEnabled = function (itemIndex, isEnabled) {
  8670. this.foundation.setEnabled(itemIndex, isEnabled);
  8671. };
  8672. /**
  8673. * Given the next desired character from the user, adds it to the typeahead
  8674. * buffer. Then, attempts to find the next option matching the buffer. Wraps
  8675. * around if at the end of options.
  8676. *
  8677. * @param nextChar The next character to add to the prefix buffer.
  8678. * @param startingIndex The index from which to start matching. Defaults to
  8679. * the currently focused index.
  8680. * @return The index of the matched item.
  8681. */
  8682. MDCList.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
  8683. return this.foundation.typeaheadMatchItem(nextChar, startingIndex, /** skipFocus */true);
  8684. };
  8685. MDCList.prototype.getDefaultFoundation = function () {
  8686. var _this = this;
  8687. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  8688. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  8689. var adapter = {
  8690. addClassForElementIndex: function addClassForElementIndex(index, className) {
  8691. var element = _this.listElements[index];
  8692. if (element) {
  8693. element.classList.add(className);
  8694. }
  8695. },
  8696. focusItemAtIndex: function focusItemAtIndex(index) {
  8697. var element = _this.listElements[index];
  8698. if (element) {
  8699. element.focus();
  8700. }
  8701. },
  8702. getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) {
  8703. return _this.listElements[index].getAttribute(attr);
  8704. },
  8705. getFocusedElementIndex: function getFocusedElementIndex() {
  8706. return _this.listElements.indexOf(document.activeElement);
  8707. },
  8708. getListItemCount: function getListItemCount() {
  8709. return _this.listElements.length;
  8710. },
  8711. getPrimaryTextAtIndex: function getPrimaryTextAtIndex(index) {
  8712. return _this.getPrimaryText(_this.listElements[index]);
  8713. },
  8714. hasCheckboxAtIndex: function hasCheckboxAtIndex(index) {
  8715. var listItem = _this.listElements[index];
  8716. return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  8717. },
  8718. hasRadioAtIndex: function hasRadioAtIndex(index) {
  8719. var listItem = _this.listElements[index];
  8720. return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR);
  8721. },
  8722. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) {
  8723. var listItem = _this.listElements[index];
  8724. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  8725. return toggleEl.checked;
  8726. },
  8727. isFocusInsideList: function isFocusInsideList() {
  8728. return _this.root.contains(document.activeElement);
  8729. },
  8730. isRootFocused: function isRootFocused() {
  8731. return document.activeElement === _this.root;
  8732. },
  8733. listItemAtIndexHasClass: function listItemAtIndexHasClass(index, className) {
  8734. return _this.listElements[index].classList.contains(className);
  8735. },
  8736. notifyAction: function notifyAction(index) {
  8737. _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true);
  8738. },
  8739. removeClassForElementIndex: function removeClassForElementIndex(index, className) {
  8740. var element = _this.listElements[index];
  8741. if (element) {
  8742. element.classList.remove(className);
  8743. }
  8744. },
  8745. setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) {
  8746. var element = _this.listElements[index];
  8747. if (element) {
  8748. element.setAttribute(attr, value);
  8749. }
  8750. },
  8751. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) {
  8752. var listItem = _this.listElements[index];
  8753. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  8754. toggleEl.checked = isChecked;
  8755. var event = document.createEvent('Event');
  8756. event.initEvent('change', true, true);
  8757. toggleEl.dispatchEvent(event);
  8758. },
  8759. setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {
  8760. var element = _this.listElements[listItemIndex];
  8761. var listItemChildren = [].slice.call(element.querySelectorAll(constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX));
  8762. listItemChildren.forEach(function (el) {
  8763. return el.setAttribute('tabindex', tabIndexValue);
  8764. });
  8765. }
  8766. };
  8767. return new foundation_1.MDCListFoundation(adapter);
  8768. };
  8769. /**
  8770. * Used to figure out which list item this event is targetting. Or returns -1 if
  8771. * there is no list item
  8772. */
  8773. MDCList.prototype.getListItemIndex_ = function (evt) {
  8774. var eventTarget = evt.target;
  8775. var nearestParent = ponyfill_1.closest(eventTarget, "." + constants_1.cssClasses.LIST_ITEM_CLASS + ", ." + constants_1.cssClasses.ROOT);
  8776. // Get the index of the element if it is a list item.
  8777. if (nearestParent && ponyfill_1.matches(nearestParent, "." + constants_1.cssClasses.LIST_ITEM_CLASS)) {
  8778. return this.listElements.indexOf(nearestParent);
  8779. }
  8780. return -1;
  8781. };
  8782. /**
  8783. * Used to figure out which element was clicked before sending the event to the foundation.
  8784. */
  8785. MDCList.prototype.handleFocusInEvent_ = function (evt) {
  8786. var index = this.getListItemIndex_(evt);
  8787. this.foundation.handleFocusIn(evt, index);
  8788. };
  8789. /**
  8790. * Used to figure out which element was clicked before sending the event to the foundation.
  8791. */
  8792. MDCList.prototype.handleFocusOutEvent_ = function (evt) {
  8793. var index = this.getListItemIndex_(evt);
  8794. this.foundation.handleFocusOut(evt, index);
  8795. };
  8796. /**
  8797. * Used to figure out which element was focused when keydown event occurred before sending the event to the
  8798. * foundation.
  8799. */
  8800. MDCList.prototype.handleKeydownEvent_ = function (evt) {
  8801. var index = this.getListItemIndex_(evt);
  8802. var target = evt.target;
  8803. this.foundation.handleKeydown(evt, target.classList.contains(constants_1.cssClasses.LIST_ITEM_CLASS), index);
  8804. };
  8805. /**
  8806. * Used to figure out which element was clicked before sending the event to the foundation.
  8807. */
  8808. MDCList.prototype.handleClickEvent_ = function (evt) {
  8809. var index = this.getListItemIndex_(evt);
  8810. var target = evt.target;
  8811. // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
  8812. var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  8813. this.foundation.handleClick(index, toggleCheckbox);
  8814. };
  8815. return MDCList;
  8816. }(component_1.MDCComponent);
  8817. exports.MDCList = MDCList;
  8818. /***/ }),
  8819. /***/ "./packages/mdc-list/constants.ts":
  8820. /*!****************************************!*\
  8821. !*** ./packages/mdc-list/constants.ts ***!
  8822. \****************************************/
  8823. /*! no static exports found */
  8824. /***/ (function(module, exports, __webpack_require__) {
  8825. "use strict";
  8826. /**
  8827. * @license
  8828. * Copyright 2018 Google Inc.
  8829. *
  8830. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8831. * of this software and associated documentation files (the "Software"), to deal
  8832. * in the Software without restriction, including without limitation the rights
  8833. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8834. * copies of the Software, and to permit persons to whom the Software is
  8835. * furnished to do so, subject to the following conditions:
  8836. *
  8837. * The above copyright notice and this permission notice shall be included in
  8838. * all copies or substantial portions of the Software.
  8839. *
  8840. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8841. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8842. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8843. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8844. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8845. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8846. * THE SOFTWARE.
  8847. */
  8848. Object.defineProperty(exports, "__esModule", { value: true });
  8849. var cssClasses = {
  8850. LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
  8851. LIST_ITEM_CLASS: 'mdc-list-item',
  8852. LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
  8853. LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
  8854. LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
  8855. LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
  8856. ROOT: 'mdc-list'
  8857. };
  8858. exports.cssClasses = cssClasses;
  8859. var strings = {
  8860. ACTION_EVENT: 'MDCList:action',
  8861. ARIA_CHECKED: 'aria-checked',
  8862. ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
  8863. ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
  8864. ARIA_CURRENT: 'aria-current',
  8865. ARIA_DISABLED: 'aria-disabled',
  8866. ARIA_ORIENTATION: 'aria-orientation',
  8867. ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
  8868. ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
  8869. ARIA_SELECTED: 'aria-selected',
  8870. CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
  8871. CHECKBOX_SELECTOR: 'input[type="checkbox"]',
  8872. CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ",
  8873. FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled)\n ",
  8874. RADIO_SELECTOR: 'input[type="radio"]'
  8875. };
  8876. exports.strings = strings;
  8877. var numbers = {
  8878. UNSET_INDEX: -1,
  8879. TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
  8880. };
  8881. exports.numbers = numbers;
  8882. /***/ }),
  8883. /***/ "./packages/mdc-list/events.ts":
  8884. /*!*************************************!*\
  8885. !*** ./packages/mdc-list/events.ts ***!
  8886. \*************************************/
  8887. /*! no static exports found */
  8888. /***/ (function(module, exports, __webpack_require__) {
  8889. "use strict";
  8890. /**
  8891. * @license
  8892. * Copyright 2020 Google Inc.
  8893. *
  8894. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8895. * of this software and associated documentation files (the "Software"), to deal
  8896. * in the Software without restriction, including without limitation the rights
  8897. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8898. * copies of the Software, and to permit persons to whom the Software is
  8899. * furnished to do so, subject to the following conditions:
  8900. *
  8901. * The above copyright notice and this permission notice shall be included in
  8902. * all copies or substantial portions of the Software.
  8903. *
  8904. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8905. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8906. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8907. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8908. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8909. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8910. * THE SOFTWARE.
  8911. */
  8912. Object.defineProperty(exports, "__esModule", { value: true });
  8913. var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
  8914. /**
  8915. * Ensures that preventDefault is only called if the containing element
  8916. * doesn't consume the event, and it will cause an unintended scroll.
  8917. *
  8918. * @param evt keyboard event to be prevented.
  8919. */
  8920. exports.preventDefaultEvent = function (evt) {
  8921. var target = evt.target;
  8922. if (!target) {
  8923. return;
  8924. }
  8925. var tagName = ("" + target.tagName).toLowerCase();
  8926. if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
  8927. evt.preventDefault();
  8928. }
  8929. };
  8930. /***/ }),
  8931. /***/ "./packages/mdc-list/foundation.ts":
  8932. /*!*****************************************!*\
  8933. !*** ./packages/mdc-list/foundation.ts ***!
  8934. \*****************************************/
  8935. /*! no static exports found */
  8936. /***/ (function(module, exports, __webpack_require__) {
  8937. "use strict";
  8938. /**
  8939. * @license
  8940. * Copyright 2018 Google Inc.
  8941. *
  8942. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8943. * of this software and associated documentation files (the "Software"), to deal
  8944. * in the Software without restriction, including without limitation the rights
  8945. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8946. * copies of the Software, and to permit persons to whom the Software is
  8947. * furnished to do so, subject to the following conditions:
  8948. *
  8949. * The above copyright notice and this permission notice shall be included in
  8950. * all copies or substantial portions of the Software.
  8951. *
  8952. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8953. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8954. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8955. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8956. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8957. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8958. * THE SOFTWARE.
  8959. */
  8960. var __extends = this && this.__extends || function () {
  8961. var _extendStatics = function extendStatics(d, b) {
  8962. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8963. d.__proto__ = b;
  8964. } || function (d, b) {
  8965. for (var p in b) {
  8966. if (b.hasOwnProperty(p)) d[p] = b[p];
  8967. }
  8968. };
  8969. return _extendStatics(d, b);
  8970. };
  8971. return function (d, b) {
  8972. _extendStatics(d, b);
  8973. function __() {
  8974. this.constructor = d;
  8975. }
  8976. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8977. };
  8978. }();
  8979. var __assign = this && this.__assign || function () {
  8980. __assign = Object.assign || function (t) {
  8981. for (var s, i = 1, n = arguments.length; i < n; i++) {
  8982. s = arguments[i];
  8983. for (var p in s) {
  8984. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  8985. }
  8986. }
  8987. return t;
  8988. };
  8989. return __assign.apply(this, arguments);
  8990. };
  8991. var __importStar = this && this.__importStar || function (mod) {
  8992. if (mod && mod.__esModule) return mod;
  8993. var result = {};
  8994. if (mod != null) for (var k in mod) {
  8995. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8996. }result["default"] = mod;
  8997. return result;
  8998. };
  8999. Object.defineProperty(exports, "__esModule", { value: true });
  9000. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  9001. var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts");
  9002. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  9003. var typeahead = __importStar(__webpack_require__(/*! ./typeahead */ "./packages/mdc-list/typeahead.ts"));
  9004. var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts");
  9005. function isNumberArray(selectedIndex) {
  9006. return selectedIndex instanceof Array;
  9007. }
  9008. var MDCListFoundation = /** @class */function (_super) {
  9009. __extends(MDCListFoundation, _super);
  9010. function MDCListFoundation(adapter) {
  9011. var _this = _super.call(this, __assign(__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this;
  9012. _this.wrapFocus_ = false;
  9013. _this.isVertical_ = true;
  9014. _this.isSingleSelectionList_ = false;
  9015. _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX;
  9016. _this.focusedItemIndex = constants_1.numbers.UNSET_INDEX;
  9017. _this.useActivatedClass_ = false;
  9018. _this.ariaCurrentAttrValue_ = null;
  9019. _this.isCheckboxList_ = false;
  9020. _this.isRadioList_ = false;
  9021. _this.hasTypeahead = false;
  9022. // Transiently holds current typeahead prefix from user.
  9023. _this.typeaheadState = typeahead.initState();
  9024. _this.sortedIndexByFirstChar = new Map();
  9025. return _this;
  9026. }
  9027. Object.defineProperty(MDCListFoundation, "strings", {
  9028. get: function get() {
  9029. return constants_1.strings;
  9030. },
  9031. enumerable: true,
  9032. configurable: true
  9033. });
  9034. Object.defineProperty(MDCListFoundation, "cssClasses", {
  9035. get: function get() {
  9036. return constants_1.cssClasses;
  9037. },
  9038. enumerable: true,
  9039. configurable: true
  9040. });
  9041. Object.defineProperty(MDCListFoundation, "numbers", {
  9042. get: function get() {
  9043. return constants_1.numbers;
  9044. },
  9045. enumerable: true,
  9046. configurable: true
  9047. });
  9048. Object.defineProperty(MDCListFoundation, "defaultAdapter", {
  9049. get: function get() {
  9050. return {
  9051. addClassForElementIndex: function addClassForElementIndex() {
  9052. return undefined;
  9053. },
  9054. focusItemAtIndex: function focusItemAtIndex() {
  9055. return undefined;
  9056. },
  9057. getAttributeForElementIndex: function getAttributeForElementIndex() {
  9058. return null;
  9059. },
  9060. getFocusedElementIndex: function getFocusedElementIndex() {
  9061. return 0;
  9062. },
  9063. getListItemCount: function getListItemCount() {
  9064. return 0;
  9065. },
  9066. hasCheckboxAtIndex: function hasCheckboxAtIndex() {
  9067. return false;
  9068. },
  9069. hasRadioAtIndex: function hasRadioAtIndex() {
  9070. return false;
  9071. },
  9072. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() {
  9073. return false;
  9074. },
  9075. isFocusInsideList: function isFocusInsideList() {
  9076. return false;
  9077. },
  9078. isRootFocused: function isRootFocused() {
  9079. return false;
  9080. },
  9081. listItemAtIndexHasClass: function listItemAtIndexHasClass() {
  9082. return false;
  9083. },
  9084. notifyAction: function notifyAction() {
  9085. return undefined;
  9086. },
  9087. removeClassForElementIndex: function removeClassForElementIndex() {
  9088. return undefined;
  9089. },
  9090. setAttributeForElementIndex: function setAttributeForElementIndex() {
  9091. return undefined;
  9092. },
  9093. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() {
  9094. return undefined;
  9095. },
  9096. setTabIndexForListItemChildren: function setTabIndexForListItemChildren() {
  9097. return undefined;
  9098. },
  9099. getPrimaryTextAtIndex: function getPrimaryTextAtIndex() {
  9100. return '';
  9101. }
  9102. };
  9103. },
  9104. enumerable: true,
  9105. configurable: true
  9106. });
  9107. MDCListFoundation.prototype.layout = function () {
  9108. if (this.adapter.getListItemCount() === 0) {
  9109. return;
  9110. }
  9111. if (this.adapter.hasCheckboxAtIndex(0)) {
  9112. this.isCheckboxList_ = true;
  9113. } else if (this.adapter.hasRadioAtIndex(0)) {
  9114. this.isRadioList_ = true;
  9115. }
  9116. if (this.hasTypeahead) {
  9117. this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
  9118. }
  9119. };
  9120. /**
  9121. * Sets the private wrapFocus_ variable.
  9122. */
  9123. MDCListFoundation.prototype.setWrapFocus = function (value) {
  9124. this.wrapFocus_ = value;
  9125. };
  9126. /**
  9127. * Sets the isVertical_ private variable.
  9128. */
  9129. MDCListFoundation.prototype.setVerticalOrientation = function (value) {
  9130. this.isVertical_ = value;
  9131. };
  9132. /**
  9133. * Sets the isSingleSelectionList_ private variable.
  9134. */
  9135. MDCListFoundation.prototype.setSingleSelection = function (value) {
  9136. this.isSingleSelectionList_ = value;
  9137. };
  9138. /**
  9139. * Sets whether typeahead is enabled on the list.
  9140. * @param hasTypeahead Whether typeahead is enabled.
  9141. */
  9142. MDCListFoundation.prototype.setHasTypeahead = function (hasTypeahead) {
  9143. this.hasTypeahead = hasTypeahead;
  9144. if (hasTypeahead) {
  9145. this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
  9146. }
  9147. };
  9148. /**
  9149. * @return Whether typeahead is currently matching a user-specified prefix.
  9150. */
  9151. MDCListFoundation.prototype.isTypeaheadInProgress = function () {
  9152. return this.hasTypeahead && typeahead.isTypingInProgress(this.typeaheadState);
  9153. };
  9154. /**
  9155. * Sets the useActivatedClass_ private variable.
  9156. */
  9157. MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
  9158. this.useActivatedClass_ = useActivated;
  9159. };
  9160. MDCListFoundation.prototype.getSelectedIndex = function () {
  9161. return this.selectedIndex_;
  9162. };
  9163. MDCListFoundation.prototype.setSelectedIndex = function (index) {
  9164. if (!this.isIndexValid_(index)) {
  9165. return;
  9166. }
  9167. if (this.isCheckboxList_) {
  9168. this.setCheckboxAtIndex_(index);
  9169. } else if (this.isRadioList_) {
  9170. this.setRadioAtIndex_(index);
  9171. } else {
  9172. this.setSingleSelectionAtIndex_(index);
  9173. }
  9174. };
  9175. /**
  9176. * Focus in handler for the list items.
  9177. */
  9178. MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) {
  9179. if (listItemIndex >= 0) {
  9180. this.focusedItemIndex = listItemIndex;
  9181. this.adapter.setTabIndexForListItemChildren(listItemIndex, '0');
  9182. }
  9183. };
  9184. /**
  9185. * Focus out handler for the list items.
  9186. */
  9187. MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) {
  9188. var _this = this;
  9189. if (listItemIndex >= 0) {
  9190. this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1');
  9191. }
  9192. /**
  9193. * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus
  9194. * is moved to next element.
  9195. */
  9196. setTimeout(function () {
  9197. if (!_this.adapter.isFocusInsideList()) {
  9198. _this.setTabindexToFirstSelectedItem_();
  9199. }
  9200. }, 0);
  9201. };
  9202. /**
  9203. * Key handler for the list.
  9204. */
  9205. MDCListFoundation.prototype.handleKeydown = function (event, isRootListItem, listItemIndex) {
  9206. var _this = this;
  9207. var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft';
  9208. var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp';
  9209. var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight';
  9210. var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown';
  9211. var isHome = keyboard_1.normalizeKey(event) === 'Home';
  9212. var isEnd = keyboard_1.normalizeKey(event) === 'End';
  9213. var isEnter = keyboard_1.normalizeKey(event) === 'Enter';
  9214. var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar';
  9215. if (this.adapter.isRootFocused()) {
  9216. if (isArrowUp || isEnd) {
  9217. event.preventDefault();
  9218. this.focusLastElement();
  9219. } else if (isArrowDown || isHome) {
  9220. event.preventDefault();
  9221. this.focusFirstElement();
  9222. }
  9223. if (this.hasTypeahead) {
  9224. var handleKeydownOpts = {
  9225. event: event,
  9226. focusItemAtIndex: function focusItemAtIndex(index) {
  9227. _this.focusItemAtIndex(index);
  9228. },
  9229. focusedItemIndex: -1,
  9230. isTargetListItem: isRootListItem,
  9231. sortedIndexByFirstChar: this.sortedIndexByFirstChar,
  9232. isItemAtIndexDisabled: function isItemAtIndexDisabled(index) {
  9233. return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9234. }
  9235. };
  9236. typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState);
  9237. }
  9238. return;
  9239. }
  9240. var currentIndex = this.adapter.getFocusedElementIndex();
  9241. if (currentIndex === -1) {
  9242. currentIndex = listItemIndex;
  9243. if (currentIndex < 0) {
  9244. // If this event doesn't have a mdc-list-item ancestor from the
  9245. // current list (not from a sublist), return early.
  9246. return;
  9247. }
  9248. }
  9249. if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) {
  9250. events_1.preventDefaultEvent(event);
  9251. this.focusNextElement(currentIndex);
  9252. } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) {
  9253. events_1.preventDefaultEvent(event);
  9254. this.focusPrevElement(currentIndex);
  9255. } else if (isHome) {
  9256. events_1.preventDefaultEvent(event);
  9257. this.focusFirstElement();
  9258. } else if (isEnd) {
  9259. events_1.preventDefaultEvent(event);
  9260. this.focusLastElement();
  9261. } else if (isEnter || isSpace) {
  9262. if (isRootListItem) {
  9263. // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event.
  9264. var target = event.target;
  9265. if (target && target.tagName === 'A' && isEnter) {
  9266. return;
  9267. }
  9268. events_1.preventDefaultEvent(event);
  9269. if (this.adapter.listItemAtIndexHasClass(currentIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) {
  9270. return;
  9271. }
  9272. if (!this.isTypeaheadInProgress()) {
  9273. if (this.isSelectableList_()) {
  9274. this.setSelectedIndexOnAction_(currentIndex);
  9275. }
  9276. this.adapter.notifyAction(currentIndex);
  9277. }
  9278. }
  9279. }
  9280. if (this.hasTypeahead) {
  9281. var handleKeydownOpts = {
  9282. event: event,
  9283. focusItemAtIndex: function focusItemAtIndex(index) {
  9284. _this.focusItemAtIndex(index);
  9285. },
  9286. focusedItemIndex: this.focusedItemIndex,
  9287. isTargetListItem: isRootListItem,
  9288. sortedIndexByFirstChar: this.sortedIndexByFirstChar,
  9289. isItemAtIndexDisabled: function isItemAtIndexDisabled(index) {
  9290. return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9291. }
  9292. };
  9293. typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState);
  9294. }
  9295. };
  9296. /**
  9297. * Click handler for the list.
  9298. */
  9299. MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) {
  9300. if (index === constants_1.numbers.UNSET_INDEX) {
  9301. return;
  9302. }
  9303. this.setTabindexAtIndex_(index);
  9304. this.focusedItemIndex = index;
  9305. if (this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) {
  9306. return;
  9307. }
  9308. if (this.isSelectableList_()) {
  9309. this.setSelectedIndexOnAction_(index, toggleCheckbox);
  9310. }
  9311. this.adapter.notifyAction(index);
  9312. };
  9313. /**
  9314. * Focuses the next element on the list.
  9315. */
  9316. MDCListFoundation.prototype.focusNextElement = function (index) {
  9317. var count = this.adapter.getListItemCount();
  9318. var nextIndex = index + 1;
  9319. if (nextIndex >= count) {
  9320. if (this.wrapFocus_) {
  9321. nextIndex = 0;
  9322. } else {
  9323. // Return early because last item is already focused.
  9324. return index;
  9325. }
  9326. }
  9327. this.focusItemAtIndex(nextIndex);
  9328. return nextIndex;
  9329. };
  9330. /**
  9331. * Focuses the previous element on the list.
  9332. */
  9333. MDCListFoundation.prototype.focusPrevElement = function (index) {
  9334. var prevIndex = index - 1;
  9335. if (prevIndex < 0) {
  9336. if (this.wrapFocus_) {
  9337. prevIndex = this.adapter.getListItemCount() - 1;
  9338. } else {
  9339. // Return early because first item is already focused.
  9340. return index;
  9341. }
  9342. }
  9343. this.focusItemAtIndex(prevIndex);
  9344. return prevIndex;
  9345. };
  9346. MDCListFoundation.prototype.focusFirstElement = function () {
  9347. this.focusItemAtIndex(0);
  9348. return 0;
  9349. };
  9350. MDCListFoundation.prototype.focusLastElement = function () {
  9351. var lastIndex = this.adapter.getListItemCount() - 1;
  9352. this.focusItemAtIndex(lastIndex);
  9353. return lastIndex;
  9354. };
  9355. /**
  9356. * @param itemIndex Index of the list item
  9357. * @param isEnabled Sets the list item to enabled or disabled.
  9358. */
  9359. MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
  9360. if (!this.isIndexValid_(itemIndex)) {
  9361. return;
  9362. }
  9363. if (isEnabled) {
  9364. this.adapter.removeClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9365. this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false');
  9366. } else {
  9367. this.adapter.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9368. this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true');
  9369. }
  9370. };
  9371. MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) {
  9372. if (this.selectedIndex_ === index) {
  9373. return;
  9374. }
  9375. var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS;
  9376. if (this.useActivatedClass_) {
  9377. selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS;
  9378. }
  9379. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  9380. this.adapter.removeClassForElementIndex(this.selectedIndex_, selectedClassName);
  9381. }
  9382. this.adapter.addClassForElementIndex(index, selectedClassName);
  9383. this.setAriaForSingleSelectionAtIndex_(index);
  9384. this.selectedIndex_ = index;
  9385. };
  9386. /**
  9387. * Sets aria attribute for single selection at given index.
  9388. */
  9389. MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) {
  9390. // Detect the presence of aria-current and get the value only during list initialization when it is in unset state.
  9391. if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) {
  9392. this.ariaCurrentAttrValue_ = this.adapter.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT);
  9393. }
  9394. var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
  9395. var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED;
  9396. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  9397. this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
  9398. }
  9399. var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
  9400. this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
  9401. };
  9402. /**
  9403. * Toggles radio at give index. Radio doesn't change the checked state if it is already checked.
  9404. */
  9405. MDCListFoundation.prototype.setRadioAtIndex_ = function (index) {
  9406. this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true);
  9407. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  9408. this.adapter.setAttributeForElementIndex(this.selectedIndex_, constants_1.strings.ARIA_CHECKED, 'false');
  9409. }
  9410. this.adapter.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, 'true');
  9411. this.selectedIndex_ = index;
  9412. };
  9413. MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) {
  9414. for (var i = 0; i < this.adapter.getListItemCount(); i++) {
  9415. var isChecked = false;
  9416. if (index.indexOf(i) >= 0) {
  9417. isChecked = true;
  9418. }
  9419. this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
  9420. this.adapter.setAttributeForElementIndex(i, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  9421. }
  9422. this.selectedIndex_ = index;
  9423. };
  9424. MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) {
  9425. if (this.focusedItemIndex === constants_1.numbers.UNSET_INDEX && index !== 0) {
  9426. // If no list item was selected set first list item's tabindex to -1.
  9427. // Generally, tabindex is set to 0 on first list item of list that has no preselected items.
  9428. this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1');
  9429. } else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) {
  9430. this.adapter.setAttributeForElementIndex(this.focusedItemIndex, 'tabindex', '-1');
  9431. }
  9432. this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
  9433. };
  9434. /**
  9435. * @return Return true if it is single selectin list, checkbox list or radio list.
  9436. */
  9437. MDCListFoundation.prototype.isSelectableList_ = function () {
  9438. return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_;
  9439. };
  9440. MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () {
  9441. var targetIndex = 0;
  9442. if (this.isSelectableList_()) {
  9443. if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  9444. targetIndex = this.selectedIndex_;
  9445. } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) {
  9446. targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) {
  9447. return Math.min(currentIndex, minIndex);
  9448. });
  9449. }
  9450. }
  9451. this.setTabindexAtIndex_(targetIndex);
  9452. };
  9453. MDCListFoundation.prototype.isIndexValid_ = function (index) {
  9454. var _this = this;
  9455. if (index instanceof Array) {
  9456. if (!this.isCheckboxList_) {
  9457. throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
  9458. }
  9459. if (index.length === 0) {
  9460. return true;
  9461. } else {
  9462. return index.some(function (i) {
  9463. return _this.isIndexInRange_(i);
  9464. });
  9465. }
  9466. } else if (typeof index === 'number') {
  9467. if (this.isCheckboxList_) {
  9468. throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index);
  9469. }
  9470. return this.isIndexInRange_(index);
  9471. } else {
  9472. return false;
  9473. }
  9474. };
  9475. MDCListFoundation.prototype.isIndexInRange_ = function (index) {
  9476. var listSize = this.adapter.getListItemCount();
  9477. return index >= 0 && index < listSize;
  9478. };
  9479. /**
  9480. * Sets selected index on user action, toggles checkbox / radio based on toggleCheckbox value.
  9481. * User interaction should not toggle list item(s) when disabled.
  9482. */
  9483. MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) {
  9484. if (toggleCheckbox === void 0) {
  9485. toggleCheckbox = true;
  9486. }
  9487. if (this.isCheckboxList_) {
  9488. this.toggleCheckboxAtIndex_(index, toggleCheckbox);
  9489. } else {
  9490. this.setSelectedIndex(index);
  9491. }
  9492. };
  9493. MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) {
  9494. var isChecked = this.adapter.isCheckboxCheckedAtIndex(index);
  9495. if (toggleCheckbox) {
  9496. isChecked = !isChecked;
  9497. this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
  9498. }
  9499. this.adapter.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  9500. // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value.
  9501. var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice();
  9502. if (isChecked) {
  9503. selectedIndexes.push(index);
  9504. } else {
  9505. selectedIndexes = selectedIndexes.filter(function (i) {
  9506. return i !== index;
  9507. });
  9508. }
  9509. this.selectedIndex_ = selectedIndexes;
  9510. };
  9511. MDCListFoundation.prototype.focusItemAtIndex = function (index) {
  9512. this.setTabindexAtIndex_(index);
  9513. this.adapter.focusItemAtIndex(index);
  9514. this.focusedItemIndex = index;
  9515. };
  9516. /**
  9517. * Given the next desired character from the user, adds it to the typeahead
  9518. * buffer. Then, attempts to find the next option matching the buffer. Wraps
  9519. * around if at the end of options.
  9520. *
  9521. * @param nextChar The next character to add to the prefix buffer.
  9522. * @param startingIndex The index from which to start matching. Only relevant
  9523. * when starting a new match sequence. To start a new match sequence,
  9524. * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
  9525. * to clear after a set interval defined in list foundation. Defaults to
  9526. * the currently focused index.
  9527. * @return The index of the matched item, or -1 if no match.
  9528. */
  9529. MDCListFoundation.prototype.typeaheadMatchItem = function (nextChar, startingIndex, skipFocus) {
  9530. var _this = this;
  9531. if (skipFocus === void 0) {
  9532. skipFocus = false;
  9533. }
  9534. var opts = {
  9535. focusItemAtIndex: function focusItemAtIndex(index) {
  9536. _this.focusItemAtIndex(index);
  9537. },
  9538. focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex,
  9539. nextChar: nextChar,
  9540. sortedIndexByFirstChar: this.sortedIndexByFirstChar,
  9541. skipFocus: skipFocus,
  9542. isItemAtIndexDisabled: function isItemAtIndexDisabled(index) {
  9543. return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9544. }
  9545. };
  9546. return typeahead.matchItem(opts, this.typeaheadState);
  9547. };
  9548. /**
  9549. * Initializes the MDCListTextAndIndex data structure by indexing the current
  9550. * list items by primary text.
  9551. *
  9552. * @return The primary texts of all the list items sorted by first character.
  9553. */
  9554. MDCListFoundation.prototype.typeaheadInitSortedIndex = function () {
  9555. return typeahead.initSortedIndex(this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex);
  9556. };
  9557. /**
  9558. * Clears the typeahead buffer.
  9559. */
  9560. MDCListFoundation.prototype.clearTypeaheadBuffer = function () {
  9561. typeahead.clearBuffer(this.typeaheadState);
  9562. };
  9563. return MDCListFoundation;
  9564. }(foundation_1.MDCFoundation);
  9565. exports.MDCListFoundation = MDCListFoundation;
  9566. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  9567. exports.default = MDCListFoundation;
  9568. /***/ }),
  9569. /***/ "./packages/mdc-list/index.ts":
  9570. /*!************************************!*\
  9571. !*** ./packages/mdc-list/index.ts ***!
  9572. \************************************/
  9573. /*! no static exports found */
  9574. /***/ (function(module, exports, __webpack_require__) {
  9575. "use strict";
  9576. /**
  9577. * @license
  9578. * Copyright 2019 Google Inc.
  9579. *
  9580. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9581. * of this software and associated documentation files (the "Software"), to deal
  9582. * in the Software without restriction, including without limitation the rights
  9583. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9584. * copies of the Software, and to permit persons to whom the Software is
  9585. * furnished to do so, subject to the following conditions:
  9586. *
  9587. * The above copyright notice and this permission notice shall be included in
  9588. * all copies or substantial portions of the Software.
  9589. *
  9590. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9591. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9592. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9593. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9594. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9595. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9596. * THE SOFTWARE.
  9597. */
  9598. function __export(m) {
  9599. for (var p in m) {
  9600. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  9601. }
  9602. }
  9603. Object.defineProperty(exports, "__esModule", { value: true });
  9604. __export(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts"));
  9605. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"));
  9606. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"));
  9607. /***/ }),
  9608. /***/ "./packages/mdc-list/typeahead.ts":
  9609. /*!****************************************!*\
  9610. !*** ./packages/mdc-list/typeahead.ts ***!
  9611. \****************************************/
  9612. /*! no static exports found */
  9613. /***/ (function(module, exports, __webpack_require__) {
  9614. "use strict";
  9615. /**
  9616. * @license
  9617. * Copyright 2020 Google Inc.
  9618. *
  9619. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9620. * of this software and associated documentation files (the "Software"), to deal
  9621. * in the Software without restriction, including without limitation the rights
  9622. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9623. * copies of the Software, and to permit persons to whom the Software is
  9624. * furnished to do so, subject to the following conditions:
  9625. *
  9626. * The above copyright notice and this permission notice shall be included in
  9627. * all copies or substantial portions of the Software.
  9628. *
  9629. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9630. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9631. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9632. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9633. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9634. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9635. * THE SOFTWARE.
  9636. */
  9637. Object.defineProperty(exports, "__esModule", { value: true });
  9638. var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts");
  9639. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  9640. var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts");
  9641. /**
  9642. * Initializes a state object for typeahead. Use the same reference for calls to
  9643. * typeahead functions.
  9644. *
  9645. * @return The current state of the typeahead process. Each state reference
  9646. * represents a typeahead instance as the reference is typically mutated
  9647. * in-place.
  9648. */
  9649. function initState() {
  9650. var state = {
  9651. bufferClearTimeout: 0,
  9652. currentFirstChar: '',
  9653. sortedIndexCursor: 0,
  9654. typeaheadBuffer: ''
  9655. };
  9656. return state;
  9657. }
  9658. exports.initState = initState;
  9659. /**
  9660. * Initializes typeahead state by indexing the current list items by primary
  9661. * text into the sortedIndexByFirstChar data structure.
  9662. *
  9663. * @param listItemCount numer of items in the list
  9664. * @param getPrimaryTextByItemIndex function that returns the primary text at a
  9665. * given index
  9666. *
  9667. * @return Map that maps the first character of the primary text to the full
  9668. * list text and it's index
  9669. */
  9670. function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {
  9671. var sortedIndexByFirstChar = new Map();
  9672. // Aggregate item text to index mapping
  9673. for (var i = 0; i < listItemCount; i++) {
  9674. var primaryText = getPrimaryTextByItemIndex(i).trim();
  9675. if (!primaryText) {
  9676. continue;
  9677. }
  9678. var firstChar = primaryText[0].toLowerCase();
  9679. if (!sortedIndexByFirstChar.has(firstChar)) {
  9680. sortedIndexByFirstChar.set(firstChar, []);
  9681. }
  9682. sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
  9683. }
  9684. // Sort the mapping
  9685. // TODO(b/157162694): Investigate replacing forEach with Map.values()
  9686. sortedIndexByFirstChar.forEach(function (values) {
  9687. values.sort(function (first, second) {
  9688. return first.index - second.index;
  9689. });
  9690. });
  9691. return sortedIndexByFirstChar;
  9692. }
  9693. exports.initSortedIndex = initSortedIndex;
  9694. /**
  9695. * Given the next desired character from the user, it attempts to find the next
  9696. * list option matching the buffer. Wraps around if at the end of options.
  9697. *
  9698. * @param opts Options and accessors
  9699. * - nextChar - the next character to match against items
  9700. * - sortedIndexByFirstChar - output of `initSortedIndex(...)`
  9701. * - focusedItemIndex - the index of the currently focused item
  9702. * - focusItemAtIndex - function that focuses a list item at given index
  9703. * - skipFocus - whether or not to focus the matched item
  9704. * - isItemAtIndexDisabled - function that determines whether an item at a
  9705. * given index is disabled
  9706. * @param state The typeahead state instance. See `initState`.
  9707. *
  9708. * @return The index of the matched item, or -1 if no match.
  9709. */
  9710. function matchItem(opts, state) {
  9711. var nextChar = opts.nextChar,
  9712. focusItemAtIndex = opts.focusItemAtIndex,
  9713. sortedIndexByFirstChar = opts.sortedIndexByFirstChar,
  9714. focusedItemIndex = opts.focusedItemIndex,
  9715. skipFocus = opts.skipFocus,
  9716. isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
  9717. clearTimeout(state.bufferClearTimeout);
  9718. state.bufferClearTimeout = setTimeout(function () {
  9719. clearBuffer(state);
  9720. }, constants_1.numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);
  9721. state.typeaheadBuffer = state.typeaheadBuffer + nextChar;
  9722. var index;
  9723. if (state.typeaheadBuffer.length === 1) {
  9724. index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);
  9725. } else {
  9726. index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);
  9727. }
  9728. if (index !== -1 && !skipFocus) {
  9729. focusItemAtIndex(index);
  9730. }
  9731. return index;
  9732. }
  9733. exports.matchItem = matchItem;
  9734. /**
  9735. * Matches the user's single input character in the buffer to the
  9736. * next option that begins with such character. Wraps around if at
  9737. * end of options. Returns -1 if no match is found.
  9738. */
  9739. function matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) {
  9740. var firstChar = state.typeaheadBuffer[0];
  9741. var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);
  9742. if (!itemsMatchingFirstChar) {
  9743. return -1;
  9744. }
  9745. // Has the same firstChar been recently matched?
  9746. // Also, did starting index remain the same between key presses?
  9747. // If both hold true, simply increment index.
  9748. if (firstChar === state.currentFirstChar && itemsMatchingFirstChar[state.sortedIndexCursor].index === focusedItemIndex) {
  9749. state.sortedIndexCursor = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;
  9750. var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index;
  9751. if (!isItemAtIndexDisabled(newIndex)) {
  9752. return newIndex;
  9753. }
  9754. }
  9755. // If we're here, it means one of the following happened:
  9756. // - either firstChar or startingIndex has changed, invalidating the
  9757. // cursor.
  9758. // - The next item of typeahead is disabled, so we have to look further.
  9759. state.currentFirstChar = firstChar;
  9760. var newCursorPosition = -1;
  9761. var cursorPosition;
  9762. // Find the first non-disabled item as a fallback.
  9763. for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {
  9764. if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {
  9765. newCursorPosition = cursorPosition;
  9766. break;
  9767. }
  9768. }
  9769. // Advance cursor to first item matching the firstChar that is positioned
  9770. // after starting item. Cursor is unchanged from fallback if there's no
  9771. // such item.
  9772. for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {
  9773. if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex && !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {
  9774. newCursorPosition = cursorPosition;
  9775. break;
  9776. }
  9777. }
  9778. if (newCursorPosition !== -1) {
  9779. state.sortedIndexCursor = newCursorPosition;
  9780. return itemsMatchingFirstChar[state.sortedIndexCursor].index;
  9781. }
  9782. return -1;
  9783. }
  9784. /**
  9785. * Attempts to find the next item that matches all of the typeahead buffer.
  9786. * Wraps around if at end of options. Returns -1 if no match is found.
  9787. */
  9788. function matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) {
  9789. var firstChar = state.typeaheadBuffer[0];
  9790. var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);
  9791. if (!itemsMatchingFirstChar) {
  9792. return -1;
  9793. }
  9794. // Do nothing if text already matches
  9795. var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor];
  9796. if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 && !isItemAtIndexDisabled(startingItem.index)) {
  9797. return startingItem.index;
  9798. }
  9799. // Find next item that matches completely; if no match, we'll eventually
  9800. // loop around to same position
  9801. var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;
  9802. var nextCursorPosition = -1;
  9803. while (cursorPosition !== state.sortedIndexCursor) {
  9804. var currentItem = itemsMatchingFirstChar[cursorPosition];
  9805. var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0;
  9806. var isEnabled = !isItemAtIndexDisabled(currentItem.index);
  9807. if (matches && isEnabled) {
  9808. nextCursorPosition = cursorPosition;
  9809. break;
  9810. }
  9811. cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length;
  9812. }
  9813. if (nextCursorPosition !== -1) {
  9814. state.sortedIndexCursor = nextCursorPosition;
  9815. return itemsMatchingFirstChar[state.sortedIndexCursor].index;
  9816. }
  9817. return -1;
  9818. }
  9819. /**
  9820. * Whether or not the given typeahead instaance state is currently typing.
  9821. *
  9822. * @param state The typeahead state instance. See `initState`.
  9823. */
  9824. function isTypingInProgress(state) {
  9825. return state.typeaheadBuffer.length > 0;
  9826. }
  9827. exports.isTypingInProgress = isTypingInProgress;
  9828. /**
  9829. * Clears the typeahaed buffer so that it resets item matching to the first
  9830. * character.
  9831. *
  9832. * @param state The typeahead state instance. See `initState`.
  9833. */
  9834. function clearBuffer(state) {
  9835. state.typeaheadBuffer = '';
  9836. }
  9837. exports.clearBuffer = clearBuffer;
  9838. /**
  9839. * Given a keydown event, it calculates whether or not to automatically focus a
  9840. * list item depending on what was typed mimicing the typeahead functionality of
  9841. * a standard <select> element that is open.
  9842. *
  9843. * @param opts Options and accessors
  9844. * - event - the KeyboardEvent to handle and parse
  9845. * - sortedIndexByFirstChar - output of `initSortedIndex(...)`
  9846. * - focusedItemIndex - the index of the currently focused item
  9847. * - focusItemAtIndex - function that focuses a list item at given index
  9848. * - isItemAtFocusedIndexDisabled - whether or not the currently focused item
  9849. * is disabled
  9850. * - isTargetListItem - whether or not the event target is a list item
  9851. * @param state The typeahead state instance. See `initState`.
  9852. *
  9853. * @returns index of the item matched by the keydown. -1 if not matched.
  9854. */
  9855. function handleKeydown(opts, state) {
  9856. var event = opts.event,
  9857. isTargetListItem = opts.isTargetListItem,
  9858. focusedItemIndex = opts.focusedItemIndex,
  9859. focusItemAtIndex = opts.focusItemAtIndex,
  9860. sortedIndexByFirstChar = opts.sortedIndexByFirstChar,
  9861. isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
  9862. var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft';
  9863. var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp';
  9864. var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight';
  9865. var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown';
  9866. var isHome = keyboard_1.normalizeKey(event) === 'Home';
  9867. var isEnd = keyboard_1.normalizeKey(event) === 'End';
  9868. var isEnter = keyboard_1.normalizeKey(event) === 'Enter';
  9869. var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar';
  9870. if (isArrowLeft || isArrowUp || isArrowRight || isArrowDown || isHome || isEnd || isEnter) {
  9871. return -1;
  9872. }
  9873. var isCharacterKey = !isSpace && event.key.length === 1;
  9874. if (isCharacterKey) {
  9875. events_1.preventDefaultEvent(event);
  9876. var matchItemOpts = {
  9877. focusItemAtIndex: focusItemAtIndex,
  9878. focusedItemIndex: focusedItemIndex,
  9879. nextChar: event.key.toLowerCase(),
  9880. sortedIndexByFirstChar: sortedIndexByFirstChar,
  9881. skipFocus: false,
  9882. isItemAtIndexDisabled: isItemAtIndexDisabled
  9883. };
  9884. return matchItem(matchItemOpts, state);
  9885. }
  9886. if (!isSpace) {
  9887. return -1;
  9888. }
  9889. if (isTargetListItem) {
  9890. events_1.preventDefaultEvent(event);
  9891. }
  9892. var typeaheadOnListItem = isTargetListItem && isTypingInProgress(state);
  9893. if (typeaheadOnListItem) {
  9894. var matchItemOpts = {
  9895. focusItemAtIndex: focusItemAtIndex,
  9896. focusedItemIndex: focusedItemIndex,
  9897. nextChar: ' ',
  9898. sortedIndexByFirstChar: sortedIndexByFirstChar,
  9899. skipFocus: false,
  9900. isItemAtIndexDisabled: isItemAtIndexDisabled
  9901. };
  9902. // space participates in typeahead matching if in rapid typing mode
  9903. return matchItem(matchItemOpts, state);
  9904. }
  9905. return -1;
  9906. }
  9907. exports.handleKeydown = handleKeydown;
  9908. /***/ }),
  9909. /***/ "./packages/mdc-menu-surface/component.ts":
  9910. /*!************************************************!*\
  9911. !*** ./packages/mdc-menu-surface/component.ts ***!
  9912. \************************************************/
  9913. /*! no static exports found */
  9914. /***/ (function(module, exports, __webpack_require__) {
  9915. "use strict";
  9916. /**
  9917. * @license
  9918. * Copyright 2018 Google Inc.
  9919. *
  9920. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9921. * of this software and associated documentation files (the "Software"), to deal
  9922. * in the Software without restriction, including without limitation the rights
  9923. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9924. * copies of the Software, and to permit persons to whom the Software is
  9925. * furnished to do so, subject to the following conditions:
  9926. *
  9927. * The above copyright notice and this permission notice shall be included in
  9928. * all copies or substantial portions of the Software.
  9929. *
  9930. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9931. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9932. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9933. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9934. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9935. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9936. * THE SOFTWARE.
  9937. */
  9938. var __extends = this && this.__extends || function () {
  9939. var _extendStatics = function extendStatics(d, b) {
  9940. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9941. d.__proto__ = b;
  9942. } || function (d, b) {
  9943. for (var p in b) {
  9944. if (b.hasOwnProperty(p)) d[p] = b[p];
  9945. }
  9946. };
  9947. return _extendStatics(d, b);
  9948. };
  9949. return function (d, b) {
  9950. _extendStatics(d, b);
  9951. function __() {
  9952. this.constructor = d;
  9953. }
  9954. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9955. };
  9956. }();
  9957. var __importStar = this && this.__importStar || function (mod) {
  9958. if (mod && mod.__esModule) return mod;
  9959. var result = {};
  9960. if (mod != null) for (var k in mod) {
  9961. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  9962. }result["default"] = mod;
  9963. return result;
  9964. };
  9965. Object.defineProperty(exports, "__esModule", { value: true });
  9966. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  9967. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  9968. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts");
  9969. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  9970. var MDCMenuSurface = /** @class */function (_super) {
  9971. __extends(MDCMenuSurface, _super);
  9972. function MDCMenuSurface() {
  9973. return _super !== null && _super.apply(this, arguments) || this;
  9974. }
  9975. MDCMenuSurface.attachTo = function (root) {
  9976. return new MDCMenuSurface(root);
  9977. };
  9978. MDCMenuSurface.prototype.initialSyncWithDOM = function () {
  9979. var _this = this;
  9980. var parentEl = this.root.parentElement;
  9981. this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
  9982. if (this.root.classList.contains(constants_1.cssClasses.FIXED)) {
  9983. this.setFixedPosition(true);
  9984. }
  9985. this.handleKeydown = function (event) {
  9986. _this.foundation.handleKeydown(event);
  9987. };
  9988. this.handleBodyClick = function (event) {
  9989. _this.foundation.handleBodyClick(event);
  9990. };
  9991. // capture so that no race between handleBodyClick and quickOpen when
  9992. // menusurface opened on button click which registers this listener
  9993. this.registerBodyClickListener = function () {
  9994. document.body.addEventListener('click', _this.handleBodyClick, { capture: true });
  9995. };
  9996. this.deregisterBodyClickListener = function () {
  9997. document.body.removeEventListener('click', _this.handleBodyClick);
  9998. };
  9999. this.listen('keydown', this.handleKeydown);
  10000. this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener);
  10001. this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener);
  10002. };
  10003. MDCMenuSurface.prototype.destroy = function () {
  10004. this.unlisten('keydown', this.handleKeydown);
  10005. this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener);
  10006. this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener);
  10007. _super.prototype.destroy.call(this);
  10008. };
  10009. MDCMenuSurface.prototype.isOpen = function () {
  10010. return this.foundation.isOpen();
  10011. };
  10012. MDCMenuSurface.prototype.open = function () {
  10013. this.foundation.open();
  10014. };
  10015. MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
  10016. if (skipRestoreFocus === void 0) {
  10017. skipRestoreFocus = false;
  10018. }
  10019. this.foundation.close(skipRestoreFocus);
  10020. };
  10021. Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
  10022. set: function set(quickOpen) {
  10023. this.foundation.setQuickOpen(quickOpen);
  10024. },
  10025. enumerable: true,
  10026. configurable: true
  10027. });
  10028. /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */
  10029. MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
  10030. this.foundation.setIsHoisted(isHoisted);
  10031. };
  10032. /** Sets the element that the menu-surface is anchored to. */
  10033. MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
  10034. this.anchorElement = element;
  10035. };
  10036. /** Sets the menu-surface to position: fixed. */
  10037. MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
  10038. if (isFixed) {
  10039. this.root.classList.add(constants_1.cssClasses.FIXED);
  10040. } else {
  10041. this.root.classList.remove(constants_1.cssClasses.FIXED);
  10042. }
  10043. this.foundation.setFixedPosition(isFixed);
  10044. };
  10045. /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */
  10046. MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
  10047. this.foundation.setAbsolutePosition(x, y);
  10048. this.setIsHoisted(true);
  10049. };
  10050. /**
  10051. * @param corner Default anchor corner alignment of top-left surface corner.
  10052. */
  10053. MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
  10054. this.foundation.setAnchorCorner(corner);
  10055. };
  10056. MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
  10057. this.foundation.setAnchorMargin(margin);
  10058. };
  10059. MDCMenuSurface.prototype.getDefaultFoundation = function () {
  10060. var _this = this;
  10061. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10062. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10063. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10064. var adapter = {
  10065. addClass: function addClass(className) {
  10066. return _this.root.classList.add(className);
  10067. },
  10068. removeClass: function removeClass(className) {
  10069. return _this.root.classList.remove(className);
  10070. },
  10071. hasClass: function hasClass(className) {
  10072. return _this.root.classList.contains(className);
  10073. },
  10074. hasAnchor: function hasAnchor() {
  10075. return !!_this.anchorElement;
  10076. },
  10077. notifyClose: function notifyClose() {
  10078. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
  10079. },
  10080. notifyOpen: function notifyOpen() {
  10081. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
  10082. },
  10083. isElementInContainer: function isElementInContainer(el) {
  10084. return _this.root.contains(el);
  10085. },
  10086. isRtl: function isRtl() {
  10087. return getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
  10088. },
  10089. setTransformOrigin: function setTransformOrigin(origin) {
  10090. var propertyName = util.getTransformPropertyName(window) + "-origin";
  10091. _this.root.style.setProperty(propertyName, origin);
  10092. },
  10093. isFocused: function isFocused() {
  10094. return document.activeElement === _this.root;
  10095. },
  10096. saveFocus: function saveFocus() {
  10097. _this.previousFocus = document.activeElement;
  10098. },
  10099. restoreFocus: function restoreFocus() {
  10100. if (_this.root.contains(document.activeElement)) {
  10101. if (_this.previousFocus && _this.previousFocus.focus) {
  10102. _this.previousFocus.focus();
  10103. }
  10104. }
  10105. },
  10106. getInnerDimensions: function getInnerDimensions() {
  10107. return {
  10108. width: _this.root.offsetWidth,
  10109. height: _this.root.offsetHeight
  10110. };
  10111. },
  10112. getAnchorDimensions: function getAnchorDimensions() {
  10113. return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
  10114. },
  10115. getWindowDimensions: function getWindowDimensions() {
  10116. return { width: window.innerWidth, height: window.innerHeight };
  10117. },
  10118. getBodyDimensions: function getBodyDimensions() {
  10119. return { width: document.body.clientWidth, height: document.body.clientHeight };
  10120. },
  10121. getWindowScroll: function getWindowScroll() {
  10122. return { x: window.pageXOffset, y: window.pageYOffset };
  10123. },
  10124. setPosition: function setPosition(position) {
  10125. var rootHTML = _this.root;
  10126. rootHTML.style.left = 'left' in position ? position.left + "px" : '';
  10127. rootHTML.style.right = 'right' in position ? position.right + "px" : '';
  10128. rootHTML.style.top = 'top' in position ? position.top + "px" : '';
  10129. rootHTML.style.bottom = 'bottom' in position ? position.bottom + "px" : '';
  10130. },
  10131. setMaxHeight: function setMaxHeight(height) {
  10132. _this.root.style.maxHeight = height;
  10133. }
  10134. };
  10135. // tslint:enable:object-literal-sort-keys
  10136. return new foundation_1.MDCMenuSurfaceFoundation(adapter);
  10137. };
  10138. return MDCMenuSurface;
  10139. }(component_1.MDCComponent);
  10140. exports.MDCMenuSurface = MDCMenuSurface;
  10141. /***/ }),
  10142. /***/ "./packages/mdc-menu-surface/constants.ts":
  10143. /*!************************************************!*\
  10144. !*** ./packages/mdc-menu-surface/constants.ts ***!
  10145. \************************************************/
  10146. /*! no static exports found */
  10147. /***/ (function(module, exports, __webpack_require__) {
  10148. "use strict";
  10149. /**
  10150. * @license
  10151. * Copyright 2018 Google Inc.
  10152. *
  10153. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10154. * of this software and associated documentation files (the "Software"), to deal
  10155. * in the Software without restriction, including without limitation the rights
  10156. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10157. * copies of the Software, and to permit persons to whom the Software is
  10158. * furnished to do so, subject to the following conditions:
  10159. *
  10160. * The above copyright notice and this permission notice shall be included in
  10161. * all copies or substantial portions of the Software.
  10162. *
  10163. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10164. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10165. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10166. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10167. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10168. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10169. * THE SOFTWARE.
  10170. */
  10171. Object.defineProperty(exports, "__esModule", { value: true });
  10172. var cssClasses = {
  10173. ANCHOR: 'mdc-menu-surface--anchor',
  10174. ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
  10175. ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
  10176. FIXED: 'mdc-menu-surface--fixed',
  10177. IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
  10178. OPEN: 'mdc-menu-surface--open',
  10179. ROOT: 'mdc-menu-surface'
  10180. };
  10181. exports.cssClasses = cssClasses;
  10182. // tslint:disable:object-literal-sort-keys
  10183. var strings = {
  10184. CLOSED_EVENT: 'MDCMenuSurface:closed',
  10185. OPENED_EVENT: 'MDCMenuSurface:opened',
  10186. FOCUSABLE_ELEMENTS: ['button:not(:disabled)', '[href]:not([aria-disabled="true"])', 'input:not(:disabled)', 'select:not(:disabled)', 'textarea:not(:disabled)', '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(', ')
  10187. };
  10188. exports.strings = strings;
  10189. // tslint:enable:object-literal-sort-keys
  10190. var numbers = {
  10191. /** Total duration of menu-surface open animation. */
  10192. TRANSITION_OPEN_DURATION: 120,
  10193. /** Total duration of menu-surface close animation. */
  10194. TRANSITION_CLOSE_DURATION: 75,
  10195. /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. Also used as a viewport margin. */
  10196. MARGIN_TO_EDGE: 32,
  10197. /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */
  10198. ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67
  10199. };
  10200. exports.numbers = numbers;
  10201. /**
  10202. * Enum for bits in the {@see Corner) bitmap.
  10203. */
  10204. var CornerBit;
  10205. (function (CornerBit) {
  10206. CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
  10207. CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
  10208. CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
  10209. CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
  10210. })(CornerBit || (CornerBit = {}));
  10211. exports.CornerBit = CornerBit;
  10212. /**
  10213. * Enum for representing an element corner for positioning the menu-surface.
  10214. *
  10215. * The START constants map to LEFT if element directionality is left
  10216. * to right and RIGHT if the directionality is right to left.
  10217. * Likewise END maps to RIGHT or LEFT depending on the directionality.
  10218. */
  10219. var Corner;
  10220. (function (Corner) {
  10221. Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
  10222. Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
  10223. Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
  10224. Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
  10225. Corner[Corner["TOP_START"] = 8] = "TOP_START";
  10226. Corner[Corner["TOP_END"] = 12] = "TOP_END";
  10227. Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
  10228. Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
  10229. })(Corner || (Corner = {}));
  10230. exports.Corner = Corner;
  10231. /***/ }),
  10232. /***/ "./packages/mdc-menu-surface/foundation.ts":
  10233. /*!*************************************************!*\
  10234. !*** ./packages/mdc-menu-surface/foundation.ts ***!
  10235. \*************************************************/
  10236. /*! no static exports found */
  10237. /***/ (function(module, exports, __webpack_require__) {
  10238. "use strict";
  10239. /**
  10240. * @license
  10241. * Copyright 2018 Google Inc.
  10242. *
  10243. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10244. * of this software and associated documentation files (the "Software"), to deal
  10245. * in the Software without restriction, including without limitation the rights
  10246. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10247. * copies of the Software, and to permit persons to whom the Software is
  10248. * furnished to do so, subject to the following conditions:
  10249. *
  10250. * The above copyright notice and this permission notice shall be included in
  10251. * all copies or substantial portions of the Software.
  10252. *
  10253. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10254. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10255. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10256. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10257. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10258. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10259. * THE SOFTWARE.
  10260. */
  10261. var __extends = this && this.__extends || function () {
  10262. var _extendStatics = function extendStatics(d, b) {
  10263. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10264. d.__proto__ = b;
  10265. } || function (d, b) {
  10266. for (var p in b) {
  10267. if (b.hasOwnProperty(p)) d[p] = b[p];
  10268. }
  10269. };
  10270. return _extendStatics(d, b);
  10271. };
  10272. return function (d, b) {
  10273. _extendStatics(d, b);
  10274. function __() {
  10275. this.constructor = d;
  10276. }
  10277. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10278. };
  10279. }();
  10280. var __assign = this && this.__assign || function () {
  10281. __assign = Object.assign || function (t) {
  10282. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10283. s = arguments[i];
  10284. for (var p in s) {
  10285. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10286. }
  10287. }
  10288. return t;
  10289. };
  10290. return __assign.apply(this, arguments);
  10291. };
  10292. var __values = this && this.__values || function (o) {
  10293. var s = typeof Symbol === "function" && Symbol.iterator,
  10294. m = s && o[s],
  10295. i = 0;
  10296. if (m) return m.call(o);
  10297. if (o && typeof o.length === "number") return {
  10298. next: function next() {
  10299. if (o && i >= o.length) o = void 0;
  10300. return { value: o && o[i++], done: !o };
  10301. }
  10302. };
  10303. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  10304. };
  10305. Object.defineProperty(exports, "__esModule", { value: true });
  10306. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10307. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  10308. var MDCMenuSurfaceFoundation = /** @class */function (_super) {
  10309. __extends(MDCMenuSurfaceFoundation, _super);
  10310. function MDCMenuSurfaceFoundation(adapter) {
  10311. var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
  10312. _this.isSurfaceOpen = false;
  10313. _this.isQuickOpen = false;
  10314. _this.isHoistedElement = false;
  10315. _this.isFixedPosition = false;
  10316. _this.openAnimationEndTimerId = 0;
  10317. _this.closeAnimationEndTimerId = 0;
  10318. _this.animationRequestId = 0;
  10319. _this.anchorCorner = constants_1.Corner.TOP_START;
  10320. /**
  10321. * Corner of the menu surface to which menu surface is attached to anchor.
  10322. *
  10323. * Anchor corner --->+----------+
  10324. * | ANCHOR |
  10325. * +----------+
  10326. * Origin corner --->+--------------+
  10327. * | |
  10328. * | |
  10329. * | MENU SURFACE |
  10330. * | |
  10331. * | |
  10332. * +--------------+
  10333. */
  10334. _this.originCorner = constants_1.Corner.TOP_START;
  10335. _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 };
  10336. _this.position = { x: 0, y: 0 };
  10337. return _this;
  10338. }
  10339. Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
  10340. get: function get() {
  10341. return constants_1.cssClasses;
  10342. },
  10343. enumerable: true,
  10344. configurable: true
  10345. });
  10346. Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
  10347. get: function get() {
  10348. return constants_1.strings;
  10349. },
  10350. enumerable: true,
  10351. configurable: true
  10352. });
  10353. Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
  10354. get: function get() {
  10355. return constants_1.numbers;
  10356. },
  10357. enumerable: true,
  10358. configurable: true
  10359. });
  10360. Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
  10361. get: function get() {
  10362. return constants_1.Corner;
  10363. },
  10364. enumerable: true,
  10365. configurable: true
  10366. });
  10367. Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
  10368. /**
  10369. * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
  10370. */
  10371. get: function get() {
  10372. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10373. return {
  10374. addClass: function addClass() {
  10375. return undefined;
  10376. },
  10377. removeClass: function removeClass() {
  10378. return undefined;
  10379. },
  10380. hasClass: function hasClass() {
  10381. return false;
  10382. },
  10383. hasAnchor: function hasAnchor() {
  10384. return false;
  10385. },
  10386. isElementInContainer: function isElementInContainer() {
  10387. return false;
  10388. },
  10389. isFocused: function isFocused() {
  10390. return false;
  10391. },
  10392. isRtl: function isRtl() {
  10393. return false;
  10394. },
  10395. getInnerDimensions: function getInnerDimensions() {
  10396. return { height: 0, width: 0 };
  10397. },
  10398. getAnchorDimensions: function getAnchorDimensions() {
  10399. return null;
  10400. },
  10401. getWindowDimensions: function getWindowDimensions() {
  10402. return { height: 0, width: 0 };
  10403. },
  10404. getBodyDimensions: function getBodyDimensions() {
  10405. return { height: 0, width: 0 };
  10406. },
  10407. getWindowScroll: function getWindowScroll() {
  10408. return { x: 0, y: 0 };
  10409. },
  10410. setPosition: function setPosition() {
  10411. return undefined;
  10412. },
  10413. setMaxHeight: function setMaxHeight() {
  10414. return undefined;
  10415. },
  10416. setTransformOrigin: function setTransformOrigin() {
  10417. return undefined;
  10418. },
  10419. saveFocus: function saveFocus() {
  10420. return undefined;
  10421. },
  10422. restoreFocus: function restoreFocus() {
  10423. return undefined;
  10424. },
  10425. notifyClose: function notifyClose() {
  10426. return undefined;
  10427. },
  10428. notifyOpen: function notifyOpen() {
  10429. return undefined;
  10430. }
  10431. };
  10432. // tslint:enable:object-literal-sort-keys
  10433. },
  10434. enumerable: true,
  10435. configurable: true
  10436. });
  10437. MDCMenuSurfaceFoundation.prototype.init = function () {
  10438. var _a = MDCMenuSurfaceFoundation.cssClasses,
  10439. ROOT = _a.ROOT,
  10440. OPEN = _a.OPEN;
  10441. if (!this.adapter.hasClass(ROOT)) {
  10442. throw new Error(ROOT + " class required in root element.");
  10443. }
  10444. if (this.adapter.hasClass(OPEN)) {
  10445. this.isSurfaceOpen = true;
  10446. }
  10447. };
  10448. MDCMenuSurfaceFoundation.prototype.destroy = function () {
  10449. clearTimeout(this.openAnimationEndTimerId);
  10450. clearTimeout(this.closeAnimationEndTimerId);
  10451. // Cancel any currently running animations.
  10452. cancelAnimationFrame(this.animationRequestId);
  10453. };
  10454. /**
  10455. * @param corner Default anchor corner alignment of top-left menu surface corner.
  10456. */
  10457. MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
  10458. this.anchorCorner = corner;
  10459. };
  10460. /**
  10461. * Flip menu corner horizontally.
  10462. */
  10463. MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () {
  10464. this.originCorner = this.originCorner ^ constants_1.CornerBit.RIGHT;
  10465. };
  10466. /**
  10467. * @param margin Set of margin values from anchor.
  10468. */
  10469. MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
  10470. this.anchorMargin.top = margin.top || 0;
  10471. this.anchorMargin.right = margin.right || 0;
  10472. this.anchorMargin.bottom = margin.bottom || 0;
  10473. this.anchorMargin.left = margin.left || 0;
  10474. };
  10475. /** Used to indicate if the menu-surface is hoisted to the body. */
  10476. MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
  10477. this.isHoistedElement = isHoisted;
  10478. };
  10479. /** Used to set the menu-surface calculations based on a fixed position menu. */
  10480. MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
  10481. this.isFixedPosition = isFixedPosition;
  10482. };
  10483. /** Sets the menu-surface position on the page. */
  10484. MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
  10485. this.position.x = this.isFinite(x) ? x : 0;
  10486. this.position.y = this.isFinite(y) ? y : 0;
  10487. };
  10488. MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
  10489. this.isQuickOpen = quickOpen;
  10490. };
  10491. MDCMenuSurfaceFoundation.prototype.isOpen = function () {
  10492. return this.isSurfaceOpen;
  10493. };
  10494. /**
  10495. * Open the menu surface.
  10496. */
  10497. MDCMenuSurfaceFoundation.prototype.open = function () {
  10498. var _this = this;
  10499. if (this.isSurfaceOpen) {
  10500. return;
  10501. }
  10502. this.adapter.saveFocus();
  10503. if (this.isQuickOpen) {
  10504. this.isSurfaceOpen = true;
  10505. this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  10506. this.dimensions = this.adapter.getInnerDimensions();
  10507. this.autoposition();
  10508. this.adapter.notifyOpen();
  10509. } else {
  10510. this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  10511. this.animationRequestId = requestAnimationFrame(function () {
  10512. _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  10513. _this.dimensions = _this.adapter.getInnerDimensions();
  10514. _this.autoposition();
  10515. _this.openAnimationEndTimerId = setTimeout(function () {
  10516. _this.openAnimationEndTimerId = 0;
  10517. _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  10518. _this.adapter.notifyOpen();
  10519. }, constants_1.numbers.TRANSITION_OPEN_DURATION);
  10520. });
  10521. this.isSurfaceOpen = true;
  10522. }
  10523. };
  10524. /**
  10525. * Closes the menu surface.
  10526. */
  10527. MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
  10528. var _this = this;
  10529. if (skipRestoreFocus === void 0) {
  10530. skipRestoreFocus = false;
  10531. }
  10532. if (!this.isSurfaceOpen) {
  10533. return;
  10534. }
  10535. if (this.isQuickOpen) {
  10536. this.isSurfaceOpen = false;
  10537. if (!skipRestoreFocus) {
  10538. this.maybeRestoreFocus();
  10539. }
  10540. this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  10541. this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
  10542. this.adapter.notifyClose();
  10543. } else {
  10544. this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  10545. requestAnimationFrame(function () {
  10546. _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  10547. _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
  10548. _this.closeAnimationEndTimerId = setTimeout(function () {
  10549. _this.closeAnimationEndTimerId = 0;
  10550. _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  10551. _this.adapter.notifyClose();
  10552. }, constants_1.numbers.TRANSITION_CLOSE_DURATION);
  10553. });
  10554. this.isSurfaceOpen = false;
  10555. if (!skipRestoreFocus) {
  10556. this.maybeRestoreFocus();
  10557. }
  10558. }
  10559. };
  10560. /** Handle clicks and close if not within menu-surface element. */
  10561. MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
  10562. var el = evt.target;
  10563. if (this.adapter.isElementInContainer(el)) {
  10564. return;
  10565. }
  10566. this.close();
  10567. };
  10568. /** Handle keys that close the surface. */
  10569. MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
  10570. var keyCode = evt.keyCode,
  10571. key = evt.key;
  10572. var isEscape = key === 'Escape' || keyCode === 27;
  10573. if (isEscape) {
  10574. this.close();
  10575. }
  10576. };
  10577. MDCMenuSurfaceFoundation.prototype.autoposition = function () {
  10578. var _a;
  10579. // Compute measurements for autoposition methods reuse.
  10580. this.measurements = this.getAutoLayoutmeasurements();
  10581. var corner = this.getoriginCorner();
  10582. var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);
  10583. var verticalAlignment = this.hasBit(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top';
  10584. var horizontalAlignment = this.hasBit(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left';
  10585. var horizontalOffset = this.getHorizontalOriginOffset(corner);
  10586. var verticalOffset = this.getVerticalOriginOffset(corner);
  10587. var _b = this.measurements,
  10588. anchorSize = _b.anchorSize,
  10589. surfaceSize = _b.surfaceSize;
  10590. var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
  10591. // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner.
  10592. if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
  10593. horizontalAlignment = 'center';
  10594. }
  10595. // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element
  10596. if (this.isHoistedElement || this.isFixedPosition) {
  10597. this.adjustPositionForHoistedElement(position);
  10598. }
  10599. this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
  10600. this.adapter.setPosition(position);
  10601. this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
  10602. // If it is opened from the top then add is-open-below class
  10603. if (!this.hasBit(corner, constants_1.CornerBit.BOTTOM)) {
  10604. this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
  10605. }
  10606. };
  10607. /**
  10608. * @return Measurements used to position menu surface popup.
  10609. */
  10610. MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () {
  10611. var anchorRect = this.adapter.getAnchorDimensions();
  10612. var bodySize = this.adapter.getBodyDimensions();
  10613. var viewportSize = this.adapter.getWindowDimensions();
  10614. var windowScroll = this.adapter.getWindowScroll();
  10615. if (!anchorRect) {
  10616. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  10617. anchorRect = {
  10618. top: this.position.y,
  10619. right: this.position.x,
  10620. bottom: this.position.y,
  10621. left: this.position.x,
  10622. width: 0,
  10623. height: 0
  10624. };
  10625. // tslint:enable:object-literal-sort-keys
  10626. }
  10627. return {
  10628. anchorSize: anchorRect,
  10629. bodySize: bodySize,
  10630. surfaceSize: this.dimensions,
  10631. viewportDistance: {
  10632. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  10633. top: anchorRect.top,
  10634. right: viewportSize.width - anchorRect.right,
  10635. bottom: viewportSize.height - anchorRect.bottom,
  10636. left: anchorRect.left
  10637. },
  10638. viewportSize: viewportSize,
  10639. windowScroll: windowScroll
  10640. };
  10641. };
  10642. /**
  10643. * Computes the corner of the anchor from which to animate and position the
  10644. * menu surface.
  10645. *
  10646. * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL
  10647. * context. E.g., menu surface will be positioned from right side on TOP_END.
  10648. */
  10649. MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () {
  10650. var corner = this.originCorner;
  10651. var _a = this.measurements,
  10652. viewportDistance = _a.viewportDistance,
  10653. anchorSize = _a.anchorSize,
  10654. surfaceSize = _a.surfaceSize;
  10655. var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
  10656. var isAnchoredToBottom = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM);
  10657. var availableTop;
  10658. var availableBottom;
  10659. if (isAnchoredToBottom) {
  10660. availableTop = viewportDistance.top - MARGIN_TO_EDGE + anchorSize.height + this.anchorMargin.bottom;
  10661. availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;
  10662. } else {
  10663. availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;
  10664. availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE + anchorSize.height - this.anchorMargin.top;
  10665. }
  10666. var isAvailableBottom = availableBottom - surfaceSize.height > 0;
  10667. if (!isAvailableBottom && availableTop >= availableBottom) {
  10668. // Attach bottom side of surface to the anchor.
  10669. corner = this.setBit(corner, constants_1.CornerBit.BOTTOM);
  10670. }
  10671. var isRtl = this.adapter.isRtl();
  10672. var isFlipRtl = this.hasBit(this.anchorCorner, constants_1.CornerBit.FLIP_RTL);
  10673. var hasRightBit = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT);
  10674. // Whether surface attached to right side of anchor element.
  10675. var isAnchoredToRight = false;
  10676. // Anchored to start
  10677. if (isRtl && isFlipRtl) {
  10678. isAnchoredToRight = !hasRightBit;
  10679. } else {
  10680. // Anchored to right
  10681. isAnchoredToRight = hasRightBit;
  10682. }
  10683. var availableLeft;
  10684. var availableRight;
  10685. if (isAnchoredToRight) {
  10686. availableLeft = viewportDistance.left + anchorSize.width + this.anchorMargin.right;
  10687. availableRight = viewportDistance.right - this.anchorMargin.right;
  10688. } else {
  10689. availableLeft = viewportDistance.left + this.anchorMargin.left;
  10690. availableRight = viewportDistance.right + anchorSize.width - this.anchorMargin.left;
  10691. }
  10692. var isAvailableLeft = availableLeft - surfaceSize.width > 0;
  10693. var isAvailableRight = availableRight - surfaceSize.width > 0;
  10694. var isOriginCornerAlignedToEnd = this.hasBit(corner, constants_1.CornerBit.FLIP_RTL) && this.hasBit(corner, constants_1.CornerBit.RIGHT);
  10695. if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl || !isAvailableLeft && isOriginCornerAlignedToEnd) {
  10696. // Attach left side of surface to the anchor.
  10697. corner = this.unsetBit(corner, constants_1.CornerBit.RIGHT);
  10698. } else if (isAvailableLeft && isAnchoredToRight && isRtl || isAvailableLeft && !isAnchoredToRight && hasRightBit || !isAvailableRight && availableLeft >= availableRight) {
  10699. // Attach right side of surface to the anchor.
  10700. corner = this.setBit(corner, constants_1.CornerBit.RIGHT);
  10701. }
  10702. return corner;
  10703. };
  10704. /**
  10705. * @param corner Origin corner of the menu surface.
  10706. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set.
  10707. */
  10708. MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
  10709. var viewportDistance = this.measurements.viewportDistance;
  10710. var maxHeight = 0;
  10711. var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM);
  10712. var isBottomAnchored = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM);
  10713. var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
  10714. // When maximum height is not specified, it is handled from CSS.
  10715. if (isBottomAligned) {
  10716. maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;
  10717. if (!isBottomAnchored) {
  10718. maxHeight += this.measurements.anchorSize.height;
  10719. }
  10720. } else {
  10721. maxHeight = viewportDistance.bottom - this.anchorMargin.bottom + this.measurements.anchorSize.height - MARGIN_TO_EDGE;
  10722. if (isBottomAnchored) {
  10723. maxHeight -= this.measurements.anchorSize.height;
  10724. }
  10725. }
  10726. return maxHeight;
  10727. };
  10728. /**
  10729. * @param corner Origin corner of the menu surface.
  10730. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner.
  10731. */
  10732. MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
  10733. var anchorSize = this.measurements.anchorSize;
  10734. // isRightAligned corresponds to using the 'right' property on the surface.
  10735. var isRightAligned = this.hasBit(corner, constants_1.CornerBit.RIGHT);
  10736. var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT);
  10737. if (isRightAligned) {
  10738. var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.left : this.anchorMargin.right;
  10739. // For hoisted or fixed elements, adjust the offset by the difference
  10740. // between viewport width and body width so when we calculate the right
  10741. // value (`adjustPositionForHoistedElement`) based on the element
  10742. // position, the right property is correct.
  10743. if (this.isHoistedElement || this.isFixedPosition) {
  10744. return rightOffset - (this.measurements.viewportSize.width - this.measurements.bodySize.width);
  10745. }
  10746. return rightOffset;
  10747. }
  10748. return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right : this.anchorMargin.left;
  10749. };
  10750. /**
  10751. * @param corner Origin corner of the menu surface.
  10752. * @return Vertical offset of menu surface origin corner from corresponding anchor corner.
  10753. */
  10754. MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
  10755. var anchorSize = this.measurements.anchorSize;
  10756. var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM);
  10757. var avoidVerticalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM);
  10758. var y = 0;
  10759. if (isBottomAligned) {
  10760. y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top : -this.anchorMargin.bottom;
  10761. } else {
  10762. y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin.bottom : this.anchorMargin.top;
  10763. }
  10764. return y;
  10765. };
  10766. /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */
  10767. MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
  10768. var e_1, _a;
  10769. var _b = this.measurements,
  10770. windowScroll = _b.windowScroll,
  10771. viewportDistance = _b.viewportDistance;
  10772. var props = Object.keys(position);
  10773. try {
  10774. for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
  10775. var prop = props_1_1.value;
  10776. var value = position[prop] || 0;
  10777. // Hoisted surfaces need to have the anchor elements location on the page added to the
  10778. // position properties for proper alignment on the body.
  10779. value += viewportDistance[prop];
  10780. // Surfaces that are absolutely positioned need to have additional calculations for scroll
  10781. // and bottom positioning.
  10782. if (!this.isFixedPosition) {
  10783. if (prop === 'top') {
  10784. value += windowScroll.y;
  10785. } else if (prop === 'bottom') {
  10786. value -= windowScroll.y;
  10787. } else if (prop === 'left') {
  10788. value += windowScroll.x;
  10789. } else {
  10790. // prop === 'right'
  10791. value -= windowScroll.x;
  10792. }
  10793. }
  10794. position[prop] = value;
  10795. }
  10796. } catch (e_1_1) {
  10797. e_1 = { error: e_1_1 };
  10798. } finally {
  10799. try {
  10800. if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
  10801. } finally {
  10802. if (e_1) throw e_1.error;
  10803. }
  10804. }
  10805. };
  10806. /**
  10807. * The last focused element when the menu surface was opened should regain focus, if the user is
  10808. * focused on or within the menu surface when it is closed.
  10809. */
  10810. MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
  10811. var isRootFocused = this.adapter.isFocused();
  10812. var childHasFocus = document.activeElement && this.adapter.isElementInContainer(document.activeElement);
  10813. if (isRootFocused || childHasFocus) {
  10814. this.adapter.restoreFocus();
  10815. }
  10816. };
  10817. MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
  10818. return Boolean(corner & bit); // tslint:disable-line:no-bitwise
  10819. };
  10820. MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) {
  10821. return corner | bit; // tslint:disable-line:no-bitwise
  10822. };
  10823. MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) {
  10824. return corner ^ bit;
  10825. };
  10826. /**
  10827. * isFinite that doesn't force conversion to number type.
  10828. * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
  10829. */
  10830. MDCMenuSurfaceFoundation.prototype.isFinite = function (num) {
  10831. return typeof num === 'number' && isFinite(num);
  10832. };
  10833. return MDCMenuSurfaceFoundation;
  10834. }(foundation_1.MDCFoundation);
  10835. exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
  10836. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10837. exports.default = MDCMenuSurfaceFoundation;
  10838. /***/ }),
  10839. /***/ "./packages/mdc-menu-surface/index.ts":
  10840. /*!********************************************!*\
  10841. !*** ./packages/mdc-menu-surface/index.ts ***!
  10842. \********************************************/
  10843. /*! no static exports found */
  10844. /***/ (function(module, exports, __webpack_require__) {
  10845. "use strict";
  10846. /**
  10847. * @license
  10848. * Copyright 2019 Google Inc.
  10849. *
  10850. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10851. * of this software and associated documentation files (the "Software"), to deal
  10852. * in the Software without restriction, including without limitation the rights
  10853. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10854. * copies of the Software, and to permit persons to whom the Software is
  10855. * furnished to do so, subject to the following conditions:
  10856. *
  10857. * The above copyright notice and this permission notice shall be included in
  10858. * all copies or substantial portions of the Software.
  10859. *
  10860. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10861. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10862. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10863. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10864. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10865. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10866. * THE SOFTWARE.
  10867. */
  10868. function __export(m) {
  10869. for (var p in m) {
  10870. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10871. }
  10872. }
  10873. var __importStar = this && this.__importStar || function (mod) {
  10874. if (mod && mod.__esModule) return mod;
  10875. var result = {};
  10876. if (mod != null) for (var k in mod) {
  10877. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  10878. }result["default"] = mod;
  10879. return result;
  10880. };
  10881. Object.defineProperty(exports, "__esModule", { value: true });
  10882. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  10883. exports.util = util;
  10884. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts"));
  10885. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"));
  10886. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"));
  10887. /***/ }),
  10888. /***/ "./packages/mdc-menu-surface/util.ts":
  10889. /*!*******************************************!*\
  10890. !*** ./packages/mdc-menu-surface/util.ts ***!
  10891. \*******************************************/
  10892. /*! no static exports found */
  10893. /***/ (function(module, exports, __webpack_require__) {
  10894. "use strict";
  10895. /**
  10896. * @license
  10897. * Copyright 2018 Google Inc.
  10898. *
  10899. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10900. * of this software and associated documentation files (the "Software"), to deal
  10901. * in the Software without restriction, including without limitation the rights
  10902. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10903. * copies of the Software, and to permit persons to whom the Software is
  10904. * furnished to do so, subject to the following conditions:
  10905. *
  10906. * The above copyright notice and this permission notice shall be included in
  10907. * all copies or substantial portions of the Software.
  10908. *
  10909. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10910. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10911. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10912. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10913. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10914. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10915. * THE SOFTWARE.
  10916. */
  10917. Object.defineProperty(exports, "__esModule", { value: true });
  10918. var cachedCssTransformPropertyName_;
  10919. /**
  10920. * Returns the name of the correct transform property to use on the current browser.
  10921. */
  10922. function getTransformPropertyName(globalObj, forceRefresh) {
  10923. if (forceRefresh === void 0) {
  10924. forceRefresh = false;
  10925. }
  10926. if (cachedCssTransformPropertyName_ === undefined || forceRefresh) {
  10927. var el = globalObj.document.createElement('div');
  10928. cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform';
  10929. }
  10930. return cachedCssTransformPropertyName_;
  10931. }
  10932. exports.getTransformPropertyName = getTransformPropertyName;
  10933. /***/ }),
  10934. /***/ "./packages/mdc-menu/component.ts":
  10935. /*!****************************************!*\
  10936. !*** ./packages/mdc-menu/component.ts ***!
  10937. \****************************************/
  10938. /*! no static exports found */
  10939. /***/ (function(module, exports, __webpack_require__) {
  10940. "use strict";
  10941. /**
  10942. * @license
  10943. * Copyright 2018 Google Inc.
  10944. *
  10945. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10946. * of this software and associated documentation files (the "Software"), to deal
  10947. * in the Software without restriction, including without limitation the rights
  10948. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10949. * copies of the Software, and to permit persons to whom the Software is
  10950. * furnished to do so, subject to the following conditions:
  10951. *
  10952. * The above copyright notice and this permission notice shall be included in
  10953. * all copies or substantial portions of the Software.
  10954. *
  10955. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10956. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10957. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10958. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10959. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10960. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10961. * THE SOFTWARE.
  10962. */
  10963. var __extends = this && this.__extends || function () {
  10964. var _extendStatics = function extendStatics(d, b) {
  10965. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10966. d.__proto__ = b;
  10967. } || function (d, b) {
  10968. for (var p in b) {
  10969. if (b.hasOwnProperty(p)) d[p] = b[p];
  10970. }
  10971. };
  10972. return _extendStatics(d, b);
  10973. };
  10974. return function (d, b) {
  10975. _extendStatics(d, b);
  10976. function __() {
  10977. this.constructor = d;
  10978. }
  10979. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10980. };
  10981. }();
  10982. Object.defineProperty(exports, "__esModule", { value: true });
  10983. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10984. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  10985. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  10986. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  10987. var component_3 = __webpack_require__(/*! @material/menu-surface/component */ "./packages/mdc-menu-surface/component.ts");
  10988. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  10989. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  10990. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts");
  10991. var MDCMenu = /** @class */function (_super) {
  10992. __extends(MDCMenu, _super);
  10993. function MDCMenu() {
  10994. return _super !== null && _super.apply(this, arguments) || this;
  10995. }
  10996. MDCMenu.attachTo = function (root) {
  10997. return new MDCMenu(root);
  10998. };
  10999. MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
  11000. if (menuSurfaceFactory === void 0) {
  11001. menuSurfaceFactory = function menuSurfaceFactory(el) {
  11002. return new component_3.MDCMenuSurface(el);
  11003. };
  11004. }
  11005. if (listFactory === void 0) {
  11006. listFactory = function listFactory(el) {
  11007. return new component_2.MDCList(el);
  11008. };
  11009. }
  11010. this.menuSurfaceFactory_ = menuSurfaceFactory;
  11011. this.listFactory_ = listFactory;
  11012. };
  11013. MDCMenu.prototype.initialSyncWithDOM = function () {
  11014. var _this = this;
  11015. this.menuSurface_ = this.menuSurfaceFactory_(this.root);
  11016. var list = this.root.querySelector(constants_1.strings.LIST_SELECTOR);
  11017. if (list) {
  11018. this.list_ = this.listFactory_(list);
  11019. this.list_.wrapFocus = true;
  11020. } else {
  11021. this.list_ = null;
  11022. }
  11023. this.handleKeydown_ = function (evt) {
  11024. return _this.foundation.handleKeydown(evt);
  11025. };
  11026. this.handleItemAction_ = function (evt) {
  11027. return _this.foundation.handleItemAction(_this.items[evt.detail.index]);
  11028. };
  11029. this.handleMenuSurfaceOpened_ = function () {
  11030. return _this.foundation.handleMenuSurfaceOpened();
  11031. };
  11032. this.menuSurface_.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  11033. this.listen('keydown', this.handleKeydown_);
  11034. this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  11035. };
  11036. MDCMenu.prototype.destroy = function () {
  11037. if (this.list_) {
  11038. this.list_.destroy();
  11039. }
  11040. this.menuSurface_.destroy();
  11041. this.menuSurface_.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  11042. this.unlisten('keydown', this.handleKeydown_);
  11043. this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  11044. _super.prototype.destroy.call(this);
  11045. };
  11046. Object.defineProperty(MDCMenu.prototype, "open", {
  11047. get: function get() {
  11048. return this.menuSurface_.isOpen();
  11049. },
  11050. set: function set(value) {
  11051. if (value) {
  11052. this.menuSurface_.open();
  11053. } else {
  11054. this.menuSurface_.close();
  11055. }
  11056. },
  11057. enumerable: true,
  11058. configurable: true
  11059. });
  11060. Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
  11061. get: function get() {
  11062. return this.list_ ? this.list_.wrapFocus : false;
  11063. },
  11064. set: function set(value) {
  11065. if (this.list_) {
  11066. this.list_.wrapFocus = value;
  11067. }
  11068. },
  11069. enumerable: true,
  11070. configurable: true
  11071. });
  11072. Object.defineProperty(MDCMenu.prototype, "hasTypeahead", {
  11073. /**
  11074. * Sets whether the menu has typeahead functionality.
  11075. * @param value Whether typeahead is enabled.
  11076. */
  11077. set: function set(value) {
  11078. if (this.list_) {
  11079. this.list_.hasTypeahead = value;
  11080. }
  11081. },
  11082. enumerable: true,
  11083. configurable: true
  11084. });
  11085. Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", {
  11086. /**
  11087. * @return Whether typeahead logic is currently matching some user prefix.
  11088. */
  11089. get: function get() {
  11090. return this.list_ ? this.list_.typeaheadInProgress : false;
  11091. },
  11092. enumerable: true,
  11093. configurable: true
  11094. });
  11095. /**
  11096. * Given the next desired character from the user, adds it to the typeahead
  11097. * buffer. Then, attempts to find the next option matching the buffer. Wraps
  11098. * around if at the end of options.
  11099. *
  11100. * @param nextChar The next character to add to the prefix buffer.
  11101. * @param startingIndex The index from which to start matching. Only relevant
  11102. * when starting a new match sequence. To start a new match sequence,
  11103. * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
  11104. * to clear after a set interval defined in list foundation. Defaults to
  11105. * the currently focused index.
  11106. * @return The index of the matched item, or -1 if no match.
  11107. */
  11108. MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
  11109. if (this.list_) {
  11110. return this.list_.typeaheadMatchItem(nextChar, startingIndex);
  11111. }
  11112. return -1;
  11113. };
  11114. /**
  11115. * Layout the underlying list element in the case of any dynamic updates
  11116. * to its structure.
  11117. */
  11118. MDCMenu.prototype.layout = function () {
  11119. if (this.list_) {
  11120. this.list_.layout();
  11121. }
  11122. };
  11123. Object.defineProperty(MDCMenu.prototype, "items", {
  11124. /**
  11125. * Return the items within the menu. Note that this only contains the set of elements within
  11126. * the items container that are proper list items, and not supplemental / presentational DOM
  11127. * elements.
  11128. */
  11129. get: function get() {
  11130. return this.list_ ? this.list_.listElements : [];
  11131. },
  11132. enumerable: true,
  11133. configurable: true
  11134. });
  11135. Object.defineProperty(MDCMenu.prototype, "quickOpen", {
  11136. set: function set(quickOpen) {
  11137. this.menuSurface_.quickOpen = quickOpen;
  11138. },
  11139. enumerable: true,
  11140. configurable: true
  11141. });
  11142. /**
  11143. * Sets default focus state where the menu should focus every time when menu
  11144. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  11145. * default.
  11146. * @param focusState Default focus state.
  11147. */
  11148. MDCMenu.prototype.setDefaultFocusState = function (focusState) {
  11149. this.foundation.setDefaultFocusState(focusState);
  11150. };
  11151. /**
  11152. * @param corner Default anchor corner alignment of top-left menu corner.
  11153. */
  11154. MDCMenu.prototype.setAnchorCorner = function (corner) {
  11155. this.menuSurface_.setAnchorCorner(corner);
  11156. };
  11157. MDCMenu.prototype.setAnchorMargin = function (margin) {
  11158. this.menuSurface_.setAnchorMargin(margin);
  11159. };
  11160. /**
  11161. * Sets the list item as the selected row at the specified index.
  11162. * @param index Index of list item within menu.
  11163. */
  11164. MDCMenu.prototype.setSelectedIndex = function (index) {
  11165. this.foundation.setSelectedIndex(index);
  11166. };
  11167. /**
  11168. * Sets the enabled state to isEnabled for the menu item at the given index.
  11169. * @param index Index of the menu item
  11170. * @param isEnabled The desired enabled state of the menu item.
  11171. */
  11172. MDCMenu.prototype.setEnabled = function (index, isEnabled) {
  11173. this.foundation.setEnabled(index, isEnabled);
  11174. };
  11175. /**
  11176. * @return The item within the menu at the index specified.
  11177. */
  11178. MDCMenu.prototype.getOptionByIndex = function (index) {
  11179. var items = this.items;
  11180. if (index < items.length) {
  11181. return this.items[index];
  11182. } else {
  11183. return null;
  11184. }
  11185. };
  11186. /**
  11187. * @param index A menu item's index.
  11188. * @return The primary text within the menu at the index specified.
  11189. */
  11190. MDCMenu.prototype.getPrimaryTextAtIndex = function (index) {
  11191. var item = this.getOptionByIndex(index);
  11192. if (item && this.list_) {
  11193. return this.list_.getPrimaryText(item) || '';
  11194. }
  11195. return '';
  11196. };
  11197. MDCMenu.prototype.setFixedPosition = function (isFixed) {
  11198. this.menuSurface_.setFixedPosition(isFixed);
  11199. };
  11200. MDCMenu.prototype.setIsHoisted = function (isHoisted) {
  11201. this.menuSurface_.setIsHoisted(isHoisted);
  11202. };
  11203. MDCMenu.prototype.setAbsolutePosition = function (x, y) {
  11204. this.menuSurface_.setAbsolutePosition(x, y);
  11205. };
  11206. /**
  11207. * Sets the element that the menu-surface is anchored to.
  11208. */
  11209. MDCMenu.prototype.setAnchorElement = function (element) {
  11210. this.menuSurface_.anchorElement = element;
  11211. };
  11212. MDCMenu.prototype.getDefaultFoundation = function () {
  11213. var _this = this;
  11214. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  11215. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  11216. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11217. var adapter = {
  11218. addClassToElementAtIndex: function addClassToElementAtIndex(index, className) {
  11219. var list = _this.items;
  11220. list[index].classList.add(className);
  11221. },
  11222. removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) {
  11223. var list = _this.items;
  11224. list[index].classList.remove(className);
  11225. },
  11226. addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) {
  11227. var list = _this.items;
  11228. list[index].setAttribute(attr, value);
  11229. },
  11230. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) {
  11231. var list = _this.items;
  11232. list[index].removeAttribute(attr);
  11233. },
  11234. elementContainsClass: function elementContainsClass(element, className) {
  11235. return element.classList.contains(className);
  11236. },
  11237. closeSurface: function closeSurface(skipRestoreFocus) {
  11238. return _this.menuSurface_.close(skipRestoreFocus);
  11239. },
  11240. getElementIndex: function getElementIndex(element) {
  11241. return _this.items.indexOf(element);
  11242. },
  11243. notifySelected: function notifySelected(evtData) {
  11244. return _this.emit(constants_1.strings.SELECTED_EVENT, {
  11245. index: evtData.index,
  11246. item: _this.items[evtData.index]
  11247. });
  11248. },
  11249. getMenuItemCount: function getMenuItemCount() {
  11250. return _this.items.length;
  11251. },
  11252. focusItemAtIndex: function focusItemAtIndex(index) {
  11253. return _this.items[index].focus();
  11254. },
  11255. focusListRoot: function focusListRoot() {
  11256. return _this.root.querySelector(constants_1.strings.LIST_SELECTOR).focus();
  11257. },
  11258. isSelectableItemAtIndex: function isSelectableItemAtIndex(index) {
  11259. return !!ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  11260. },
  11261. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) {
  11262. var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  11263. var selectedItemEl = selectionGroupEl.querySelector("." + constants_1.cssClasses.MENU_SELECTED_LIST_ITEM);
  11264. return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
  11265. }
  11266. };
  11267. // tslint:enable:object-literal-sort-keys
  11268. return new foundation_3.MDCMenuFoundation(adapter);
  11269. };
  11270. return MDCMenu;
  11271. }(component_1.MDCComponent);
  11272. exports.MDCMenu = MDCMenu;
  11273. /***/ }),
  11274. /***/ "./packages/mdc-menu/constants.ts":
  11275. /*!****************************************!*\
  11276. !*** ./packages/mdc-menu/constants.ts ***!
  11277. \****************************************/
  11278. /*! no static exports found */
  11279. /***/ (function(module, exports, __webpack_require__) {
  11280. "use strict";
  11281. /**
  11282. * @license
  11283. * Copyright 2018 Google Inc.
  11284. *
  11285. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11286. * of this software and associated documentation files (the "Software"), to deal
  11287. * in the Software without restriction, including without limitation the rights
  11288. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11289. * copies of the Software, and to permit persons to whom the Software is
  11290. * furnished to do so, subject to the following conditions:
  11291. *
  11292. * The above copyright notice and this permission notice shall be included in
  11293. * all copies or substantial portions of the Software.
  11294. *
  11295. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11296. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11297. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11298. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11299. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11300. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11301. * THE SOFTWARE.
  11302. */
  11303. Object.defineProperty(exports, "__esModule", { value: true });
  11304. var cssClasses = {
  11305. MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
  11306. MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
  11307. ROOT: 'mdc-menu'
  11308. };
  11309. exports.cssClasses = cssClasses;
  11310. var strings = {
  11311. ARIA_CHECKED_ATTR: 'aria-checked',
  11312. ARIA_DISABLED_ATTR: 'aria-disabled',
  11313. CHECKBOX_SELECTOR: 'input[type="checkbox"]',
  11314. LIST_SELECTOR: '.mdc-list',
  11315. SELECTED_EVENT: 'MDCMenu:selected'
  11316. };
  11317. exports.strings = strings;
  11318. var numbers = {
  11319. FOCUS_ROOT_INDEX: -1
  11320. };
  11321. exports.numbers = numbers;
  11322. var DefaultFocusState;
  11323. (function (DefaultFocusState) {
  11324. DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
  11325. DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
  11326. DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
  11327. DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
  11328. })(DefaultFocusState || (DefaultFocusState = {}));
  11329. exports.DefaultFocusState = DefaultFocusState;
  11330. /***/ }),
  11331. /***/ "./packages/mdc-menu/foundation.ts":
  11332. /*!*****************************************!*\
  11333. !*** ./packages/mdc-menu/foundation.ts ***!
  11334. \*****************************************/
  11335. /*! no static exports found */
  11336. /***/ (function(module, exports, __webpack_require__) {
  11337. "use strict";
  11338. /**
  11339. * @license
  11340. * Copyright 2018 Google Inc.
  11341. *
  11342. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11343. * of this software and associated documentation files (the "Software"), to deal
  11344. * in the Software without restriction, including without limitation the rights
  11345. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11346. * copies of the Software, and to permit persons to whom the Software is
  11347. * furnished to do so, subject to the following conditions:
  11348. *
  11349. * The above copyright notice and this permission notice shall be included in
  11350. * all copies or substantial portions of the Software.
  11351. *
  11352. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11353. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11354. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11355. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11356. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11357. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11358. * THE SOFTWARE.
  11359. */
  11360. var __extends = this && this.__extends || function () {
  11361. var _extendStatics = function extendStatics(d, b) {
  11362. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11363. d.__proto__ = b;
  11364. } || function (d, b) {
  11365. for (var p in b) {
  11366. if (b.hasOwnProperty(p)) d[p] = b[p];
  11367. }
  11368. };
  11369. return _extendStatics(d, b);
  11370. };
  11371. return function (d, b) {
  11372. _extendStatics(d, b);
  11373. function __() {
  11374. this.constructor = d;
  11375. }
  11376. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11377. };
  11378. }();
  11379. var __assign = this && this.__assign || function () {
  11380. __assign = Object.assign || function (t) {
  11381. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11382. s = arguments[i];
  11383. for (var p in s) {
  11384. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11385. }
  11386. }
  11387. return t;
  11388. };
  11389. return __assign.apply(this, arguments);
  11390. };
  11391. Object.defineProperty(exports, "__esModule", { value: true });
  11392. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  11393. var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts");
  11394. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  11395. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  11396. var MDCMenuFoundation = /** @class */function (_super) {
  11397. __extends(MDCMenuFoundation, _super);
  11398. function MDCMenuFoundation(adapter) {
  11399. var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
  11400. _this.closeAnimationEndTimerId_ = 0;
  11401. _this.defaultFocusState_ = constants_2.DefaultFocusState.LIST_ROOT;
  11402. return _this;
  11403. }
  11404. Object.defineProperty(MDCMenuFoundation, "cssClasses", {
  11405. get: function get() {
  11406. return constants_2.cssClasses;
  11407. },
  11408. enumerable: true,
  11409. configurable: true
  11410. });
  11411. Object.defineProperty(MDCMenuFoundation, "strings", {
  11412. get: function get() {
  11413. return constants_2.strings;
  11414. },
  11415. enumerable: true,
  11416. configurable: true
  11417. });
  11418. Object.defineProperty(MDCMenuFoundation, "numbers", {
  11419. get: function get() {
  11420. return constants_2.numbers;
  11421. },
  11422. enumerable: true,
  11423. configurable: true
  11424. });
  11425. Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
  11426. /**
  11427. * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
  11428. */
  11429. get: function get() {
  11430. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11431. return {
  11432. addClassToElementAtIndex: function addClassToElementAtIndex() {
  11433. return undefined;
  11434. },
  11435. removeClassFromElementAtIndex: function removeClassFromElementAtIndex() {
  11436. return undefined;
  11437. },
  11438. addAttributeToElementAtIndex: function addAttributeToElementAtIndex() {
  11439. return undefined;
  11440. },
  11441. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() {
  11442. return undefined;
  11443. },
  11444. elementContainsClass: function elementContainsClass() {
  11445. return false;
  11446. },
  11447. closeSurface: function closeSurface() {
  11448. return undefined;
  11449. },
  11450. getElementIndex: function getElementIndex() {
  11451. return -1;
  11452. },
  11453. notifySelected: function notifySelected() {
  11454. return undefined;
  11455. },
  11456. getMenuItemCount: function getMenuItemCount() {
  11457. return 0;
  11458. },
  11459. focusItemAtIndex: function focusItemAtIndex() {
  11460. return undefined;
  11461. },
  11462. focusListRoot: function focusListRoot() {
  11463. return undefined;
  11464. },
  11465. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() {
  11466. return -1;
  11467. },
  11468. isSelectableItemAtIndex: function isSelectableItemAtIndex() {
  11469. return false;
  11470. }
  11471. };
  11472. // tslint:enable:object-literal-sort-keys
  11473. },
  11474. enumerable: true,
  11475. configurable: true
  11476. });
  11477. MDCMenuFoundation.prototype.destroy = function () {
  11478. if (this.closeAnimationEndTimerId_) {
  11479. clearTimeout(this.closeAnimationEndTimerId_);
  11480. }
  11481. this.adapter.closeSurface();
  11482. };
  11483. MDCMenuFoundation.prototype.handleKeydown = function (evt) {
  11484. var key = evt.key,
  11485. keyCode = evt.keyCode;
  11486. var isTab = key === 'Tab' || keyCode === 9;
  11487. if (isTab) {
  11488. this.adapter.closeSurface( /** skipRestoreFocus */true);
  11489. }
  11490. };
  11491. MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
  11492. var _this = this;
  11493. var index = this.adapter.getElementIndex(listItem);
  11494. if (index < 0) {
  11495. return;
  11496. }
  11497. this.adapter.notifySelected({ index: index });
  11498. this.adapter.closeSurface();
  11499. // Wait for the menu to close before adding/removing classes that affect styles.
  11500. this.closeAnimationEndTimerId_ = setTimeout(function () {
  11501. // Recompute the index in case the menu contents have changed.
  11502. var recomputedIndex = _this.adapter.getElementIndex(listItem);
  11503. if (recomputedIndex >= 0 && _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
  11504. _this.setSelectedIndex(recomputedIndex);
  11505. }
  11506. }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
  11507. };
  11508. MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
  11509. switch (this.defaultFocusState_) {
  11510. case constants_2.DefaultFocusState.FIRST_ITEM:
  11511. this.adapter.focusItemAtIndex(0);
  11512. break;
  11513. case constants_2.DefaultFocusState.LAST_ITEM:
  11514. this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
  11515. break;
  11516. case constants_2.DefaultFocusState.NONE:
  11517. // Do nothing.
  11518. break;
  11519. default:
  11520. this.adapter.focusListRoot();
  11521. break;
  11522. }
  11523. };
  11524. /**
  11525. * Sets default focus state where the menu should focus every time when menu
  11526. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  11527. * default.
  11528. */
  11529. MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
  11530. this.defaultFocusState_ = focusState;
  11531. };
  11532. /**
  11533. * Selects the list item at `index` within the menu.
  11534. * @param index Index of list item within the menu.
  11535. */
  11536. MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
  11537. this.validatedIndex_(index);
  11538. if (!this.adapter.isSelectableItemAtIndex(index)) {
  11539. throw new Error('MDCMenuFoundation: No selection group at specified index.');
  11540. }
  11541. var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
  11542. if (prevSelectedIndex >= 0) {
  11543. this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_2.strings.ARIA_CHECKED_ATTR);
  11544. this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
  11545. }
  11546. this.adapter.addClassToElementAtIndex(index, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
  11547. this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_CHECKED_ATTR, 'true');
  11548. };
  11549. /**
  11550. * Sets the enabled state to isEnabled for the menu item at the given index.
  11551. * @param index Index of the menu item
  11552. * @param isEnabled The desired enabled state of the menu item.
  11553. */
  11554. MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
  11555. this.validatedIndex_(index);
  11556. if (isEnabled) {
  11557. this.adapter.removeClassFromElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  11558. this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'false');
  11559. } else {
  11560. this.adapter.addClassToElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  11561. this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'true');
  11562. }
  11563. };
  11564. MDCMenuFoundation.prototype.validatedIndex_ = function (index) {
  11565. var menuSize = this.adapter.getMenuItemCount();
  11566. var isIndexInRange = index >= 0 && index < menuSize;
  11567. if (!isIndexInRange) {
  11568. throw new Error('MDCMenuFoundation: No list item at specified index.');
  11569. }
  11570. };
  11571. return MDCMenuFoundation;
  11572. }(foundation_1.MDCFoundation);
  11573. exports.MDCMenuFoundation = MDCMenuFoundation;
  11574. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  11575. exports.default = MDCMenuFoundation;
  11576. /***/ }),
  11577. /***/ "./packages/mdc-menu/index.ts":
  11578. /*!************************************!*\
  11579. !*** ./packages/mdc-menu/index.ts ***!
  11580. \************************************/
  11581. /*! no static exports found */
  11582. /***/ (function(module, exports, __webpack_require__) {
  11583. "use strict";
  11584. /**
  11585. * @license
  11586. * Copyright 2019 Google Inc.
  11587. *
  11588. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11589. * of this software and associated documentation files (the "Software"), to deal
  11590. * in the Software without restriction, including without limitation the rights
  11591. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11592. * copies of the Software, and to permit persons to whom the Software is
  11593. * furnished to do so, subject to the following conditions:
  11594. *
  11595. * The above copyright notice and this permission notice shall be included in
  11596. * all copies or substantial portions of the Software.
  11597. *
  11598. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11599. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11600. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11601. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11602. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11603. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11604. * THE SOFTWARE.
  11605. */
  11606. function __export(m) {
  11607. for (var p in m) {
  11608. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  11609. }
  11610. }
  11611. Object.defineProperty(exports, "__esModule", { value: true });
  11612. var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); // for backward compatibility
  11613. exports.Corner = constants_1.Corner;
  11614. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu/component.ts"));
  11615. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"));
  11616. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"));
  11617. /***/ }),
  11618. /***/ "./packages/mdc-notched-outline/component.ts":
  11619. /*!***************************************************!*\
  11620. !*** ./packages/mdc-notched-outline/component.ts ***!
  11621. \***************************************************/
  11622. /*! no static exports found */
  11623. /***/ (function(module, exports, __webpack_require__) {
  11624. "use strict";
  11625. /**
  11626. * @license
  11627. * Copyright 2017 Google Inc.
  11628. *
  11629. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11630. * of this software and associated documentation files (the "Software"), to deal
  11631. * in the Software without restriction, including without limitation the rights
  11632. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11633. * copies of the Software, and to permit persons to whom the Software is
  11634. * furnished to do so, subject to the following conditions:
  11635. *
  11636. * The above copyright notice and this permission notice shall be included in
  11637. * all copies or substantial portions of the Software.
  11638. *
  11639. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11640. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11641. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11642. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11643. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11644. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11645. * THE SOFTWARE.
  11646. */
  11647. var __extends = this && this.__extends || function () {
  11648. var _extendStatics = function extendStatics(d, b) {
  11649. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11650. d.__proto__ = b;
  11651. } || function (d, b) {
  11652. for (var p in b) {
  11653. if (b.hasOwnProperty(p)) d[p] = b[p];
  11654. }
  11655. };
  11656. return _extendStatics(d, b);
  11657. };
  11658. return function (d, b) {
  11659. _extendStatics(d, b);
  11660. function __() {
  11661. this.constructor = d;
  11662. }
  11663. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11664. };
  11665. }();
  11666. Object.defineProperty(exports, "__esModule", { value: true });
  11667. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  11668. var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts");
  11669. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  11670. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts");
  11671. var MDCNotchedOutline = /** @class */function (_super) {
  11672. __extends(MDCNotchedOutline, _super);
  11673. function MDCNotchedOutline() {
  11674. return _super !== null && _super.apply(this, arguments) || this;
  11675. }
  11676. MDCNotchedOutline.attachTo = function (root) {
  11677. return new MDCNotchedOutline(root);
  11678. };
  11679. MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
  11680. this.notchElement_ = this.root.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
  11681. var label = this.root.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
  11682. if (label) {
  11683. label.style.transitionDuration = '0s';
  11684. this.root.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
  11685. requestAnimationFrame(function () {
  11686. label.style.transitionDuration = '';
  11687. });
  11688. } else {
  11689. this.root.classList.add(constants_1.cssClasses.NO_LABEL);
  11690. }
  11691. };
  11692. /**
  11693. * Updates classes and styles to open the notch to the specified width.
  11694. * @param notchWidth The notch width in the outline.
  11695. */
  11696. MDCNotchedOutline.prototype.notch = function (notchWidth) {
  11697. this.foundation.notch(notchWidth);
  11698. };
  11699. /**
  11700. * Updates classes and styles to close the notch.
  11701. */
  11702. MDCNotchedOutline.prototype.closeNotch = function () {
  11703. this.foundation.closeNotch();
  11704. };
  11705. MDCNotchedOutline.prototype.getDefaultFoundation = function () {
  11706. var _this = this;
  11707. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  11708. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  11709. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11710. var adapter = {
  11711. addClass: function addClass(className) {
  11712. return _this.root.classList.add(className);
  11713. },
  11714. removeClass: function removeClass(className) {
  11715. return _this.root.classList.remove(className);
  11716. },
  11717. setNotchWidthProperty: function setNotchWidthProperty(width) {
  11718. return _this.notchElement_.style.setProperty('width', width + 'px');
  11719. },
  11720. removeNotchWidthProperty: function removeNotchWidthProperty() {
  11721. return _this.notchElement_.style.removeProperty('width');
  11722. }
  11723. };
  11724. // tslint:enable:object-literal-sort-keys
  11725. return new foundation_2.MDCNotchedOutlineFoundation(adapter);
  11726. };
  11727. return MDCNotchedOutline;
  11728. }(component_1.MDCComponent);
  11729. exports.MDCNotchedOutline = MDCNotchedOutline;
  11730. /***/ }),
  11731. /***/ "./packages/mdc-notched-outline/constants.ts":
  11732. /*!***************************************************!*\
  11733. !*** ./packages/mdc-notched-outline/constants.ts ***!
  11734. \***************************************************/
  11735. /*! no static exports found */
  11736. /***/ (function(module, exports, __webpack_require__) {
  11737. "use strict";
  11738. /**
  11739. * @license
  11740. * Copyright 2018 Google Inc.
  11741. *
  11742. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11743. * of this software and associated documentation files (the "Software"), to deal
  11744. * in the Software without restriction, including without limitation the rights
  11745. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11746. * copies of the Software, and to permit persons to whom the Software is
  11747. * furnished to do so, subject to the following conditions:
  11748. *
  11749. * The above copyright notice and this permission notice shall be included in
  11750. * all copies or substantial portions of the Software.
  11751. *
  11752. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11753. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11754. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11755. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11756. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11757. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11758. * THE SOFTWARE.
  11759. */
  11760. Object.defineProperty(exports, "__esModule", { value: true });
  11761. var strings = {
  11762. NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
  11763. };
  11764. exports.strings = strings;
  11765. var numbers = {
  11766. // This should stay in sync with $mdc-notched-outline-padding * 2.
  11767. NOTCH_ELEMENT_PADDING: 8
  11768. };
  11769. exports.numbers = numbers;
  11770. var cssClasses = {
  11771. NO_LABEL: 'mdc-notched-outline--no-label',
  11772. OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
  11773. OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
  11774. };
  11775. exports.cssClasses = cssClasses;
  11776. /***/ }),
  11777. /***/ "./packages/mdc-notched-outline/foundation.ts":
  11778. /*!****************************************************!*\
  11779. !*** ./packages/mdc-notched-outline/foundation.ts ***!
  11780. \****************************************************/
  11781. /*! no static exports found */
  11782. /***/ (function(module, exports, __webpack_require__) {
  11783. "use strict";
  11784. /**
  11785. * @license
  11786. * Copyright 2017 Google Inc.
  11787. *
  11788. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11789. * of this software and associated documentation files (the "Software"), to deal
  11790. * in the Software without restriction, including without limitation the rights
  11791. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11792. * copies of the Software, and to permit persons to whom the Software is
  11793. * furnished to do so, subject to the following conditions:
  11794. *
  11795. * The above copyright notice and this permission notice shall be included in
  11796. * all copies or substantial portions of the Software.
  11797. *
  11798. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11799. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11800. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11801. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11802. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11803. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11804. * THE SOFTWARE.
  11805. */
  11806. var __extends = this && this.__extends || function () {
  11807. var _extendStatics = function extendStatics(d, b) {
  11808. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11809. d.__proto__ = b;
  11810. } || function (d, b) {
  11811. for (var p in b) {
  11812. if (b.hasOwnProperty(p)) d[p] = b[p];
  11813. }
  11814. };
  11815. return _extendStatics(d, b);
  11816. };
  11817. return function (d, b) {
  11818. _extendStatics(d, b);
  11819. function __() {
  11820. this.constructor = d;
  11821. }
  11822. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11823. };
  11824. }();
  11825. var __assign = this && this.__assign || function () {
  11826. __assign = Object.assign || function (t) {
  11827. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11828. s = arguments[i];
  11829. for (var p in s) {
  11830. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11831. }
  11832. }
  11833. return t;
  11834. };
  11835. return __assign.apply(this, arguments);
  11836. };
  11837. Object.defineProperty(exports, "__esModule", { value: true });
  11838. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  11839. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  11840. var MDCNotchedOutlineFoundation = /** @class */function (_super) {
  11841. __extends(MDCNotchedOutlineFoundation, _super);
  11842. function MDCNotchedOutlineFoundation(adapter) {
  11843. return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
  11844. }
  11845. Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
  11846. get: function get() {
  11847. return constants_1.strings;
  11848. },
  11849. enumerable: true,
  11850. configurable: true
  11851. });
  11852. Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
  11853. get: function get() {
  11854. return constants_1.cssClasses;
  11855. },
  11856. enumerable: true,
  11857. configurable: true
  11858. });
  11859. Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
  11860. get: function get() {
  11861. return constants_1.numbers;
  11862. },
  11863. enumerable: true,
  11864. configurable: true
  11865. });
  11866. Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
  11867. /**
  11868. * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
  11869. */
  11870. get: function get() {
  11871. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11872. return {
  11873. addClass: function addClass() {
  11874. return undefined;
  11875. },
  11876. removeClass: function removeClass() {
  11877. return undefined;
  11878. },
  11879. setNotchWidthProperty: function setNotchWidthProperty() {
  11880. return undefined;
  11881. },
  11882. removeNotchWidthProperty: function removeNotchWidthProperty() {
  11883. return undefined;
  11884. }
  11885. };
  11886. // tslint:enable:object-literal-sort-keys
  11887. },
  11888. enumerable: true,
  11889. configurable: true
  11890. });
  11891. /**
  11892. * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
  11893. */
  11894. MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
  11895. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  11896. if (notchWidth > 0) {
  11897. notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
  11898. }
  11899. this.adapter.setNotchWidthProperty(notchWidth);
  11900. this.adapter.addClass(OUTLINE_NOTCHED);
  11901. };
  11902. /**
  11903. * Removes notched outline selector to close the notch in the outline.
  11904. */
  11905. MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
  11906. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  11907. this.adapter.removeClass(OUTLINE_NOTCHED);
  11908. this.adapter.removeNotchWidthProperty();
  11909. };
  11910. return MDCNotchedOutlineFoundation;
  11911. }(foundation_1.MDCFoundation);
  11912. exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
  11913. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  11914. exports.default = MDCNotchedOutlineFoundation;
  11915. /***/ }),
  11916. /***/ "./packages/mdc-notched-outline/index.ts":
  11917. /*!***********************************************!*\
  11918. !*** ./packages/mdc-notched-outline/index.ts ***!
  11919. \***********************************************/
  11920. /*! no static exports found */
  11921. /***/ (function(module, exports, __webpack_require__) {
  11922. "use strict";
  11923. /**
  11924. * @license
  11925. * Copyright 2019 Google Inc.
  11926. *
  11927. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11928. * of this software and associated documentation files (the "Software"), to deal
  11929. * in the Software without restriction, including without limitation the rights
  11930. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11931. * copies of the Software, and to permit persons to whom the Software is
  11932. * furnished to do so, subject to the following conditions:
  11933. *
  11934. * The above copyright notice and this permission notice shall be included in
  11935. * all copies or substantial portions of the Software.
  11936. *
  11937. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11938. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11939. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11940. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11941. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11942. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11943. * THE SOFTWARE.
  11944. */
  11945. function __export(m) {
  11946. for (var p in m) {
  11947. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  11948. }
  11949. }
  11950. Object.defineProperty(exports, "__esModule", { value: true });
  11951. __export(__webpack_require__(/*! ./component */ "./packages/mdc-notched-outline/component.ts"));
  11952. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"));
  11953. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"));
  11954. /***/ }),
  11955. /***/ "./packages/mdc-radio/component.ts":
  11956. /*!*****************************************!*\
  11957. !*** ./packages/mdc-radio/component.ts ***!
  11958. \*****************************************/
  11959. /*! no static exports found */
  11960. /***/ (function(module, exports, __webpack_require__) {
  11961. "use strict";
  11962. /**
  11963. * @license
  11964. * Copyright 2016 Google Inc.
  11965. *
  11966. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11967. * of this software and associated documentation files (the "Software"), to deal
  11968. * in the Software without restriction, including without limitation the rights
  11969. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11970. * copies of the Software, and to permit persons to whom the Software is
  11971. * furnished to do so, subject to the following conditions:
  11972. *
  11973. * The above copyright notice and this permission notice shall be included in
  11974. * all copies or substantial portions of the Software.
  11975. *
  11976. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11977. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11978. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11979. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11980. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11981. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11982. * THE SOFTWARE.
  11983. */
  11984. var __extends = this && this.__extends || function () {
  11985. var _extendStatics = function extendStatics(d, b) {
  11986. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11987. d.__proto__ = b;
  11988. } || function (d, b) {
  11989. for (var p in b) {
  11990. if (b.hasOwnProperty(p)) d[p] = b[p];
  11991. }
  11992. };
  11993. return _extendStatics(d, b);
  11994. };
  11995. return function (d, b) {
  11996. _extendStatics(d, b);
  11997. function __() {
  11998. this.constructor = d;
  11999. }
  12000. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12001. };
  12002. }();
  12003. var __assign = this && this.__assign || function () {
  12004. __assign = Object.assign || function (t) {
  12005. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12006. s = arguments[i];
  12007. for (var p in s) {
  12008. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12009. }
  12010. }
  12011. return t;
  12012. };
  12013. return __assign.apply(this, arguments);
  12014. };
  12015. Object.defineProperty(exports, "__esModule", { value: true });
  12016. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12017. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  12018. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  12019. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  12020. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts");
  12021. var MDCRadio = /** @class */function (_super) {
  12022. __extends(MDCRadio, _super);
  12023. function MDCRadio() {
  12024. var _this = _super !== null && _super.apply(this, arguments) || this;
  12025. _this.ripple_ = _this.createRipple_();
  12026. return _this;
  12027. }
  12028. MDCRadio.attachTo = function (root) {
  12029. return new MDCRadio(root);
  12030. };
  12031. Object.defineProperty(MDCRadio.prototype, "checked", {
  12032. get: function get() {
  12033. return this.nativeControl_.checked;
  12034. },
  12035. set: function set(checked) {
  12036. this.nativeControl_.checked = checked;
  12037. },
  12038. enumerable: true,
  12039. configurable: true
  12040. });
  12041. Object.defineProperty(MDCRadio.prototype, "disabled", {
  12042. get: function get() {
  12043. return this.nativeControl_.disabled;
  12044. },
  12045. set: function set(disabled) {
  12046. this.foundation.setDisabled(disabled);
  12047. },
  12048. enumerable: true,
  12049. configurable: true
  12050. });
  12051. Object.defineProperty(MDCRadio.prototype, "value", {
  12052. get: function get() {
  12053. return this.nativeControl_.value;
  12054. },
  12055. set: function set(value) {
  12056. this.nativeControl_.value = value;
  12057. },
  12058. enumerable: true,
  12059. configurable: true
  12060. });
  12061. Object.defineProperty(MDCRadio.prototype, "ripple", {
  12062. get: function get() {
  12063. return this.ripple_;
  12064. },
  12065. enumerable: true,
  12066. configurable: true
  12067. });
  12068. MDCRadio.prototype.destroy = function () {
  12069. this.ripple_.destroy();
  12070. _super.prototype.destroy.call(this);
  12071. };
  12072. MDCRadio.prototype.getDefaultFoundation = function () {
  12073. var _this = this;
  12074. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12075. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12076. var adapter = {
  12077. addClass: function addClass(className) {
  12078. return _this.root.classList.add(className);
  12079. },
  12080. removeClass: function removeClass(className) {
  12081. return _this.root.classList.remove(className);
  12082. },
  12083. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  12084. return _this.nativeControl_.disabled = disabled;
  12085. }
  12086. };
  12087. return new foundation_2.MDCRadioFoundation(adapter);
  12088. };
  12089. MDCRadio.prototype.createRipple_ = function () {
  12090. var _this = this;
  12091. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12092. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12093. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12094. var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  12095. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  12096. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  12097. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  12098. },
  12099. // Radio buttons technically go "active" whenever there is *any* keyboard interaction.
  12100. // This is not the UI we desire.
  12101. isSurfaceActive: function isSurfaceActive() {
  12102. return false;
  12103. }, isUnbounded: function isUnbounded() {
  12104. return true;
  12105. } });
  12106. // tslint:enable:object-literal-sort-keys
  12107. return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
  12108. };
  12109. Object.defineProperty(MDCRadio.prototype, "nativeControl_", {
  12110. get: function get() {
  12111. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR;
  12112. var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
  12113. if (!el) {
  12114. throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  12115. }
  12116. return el;
  12117. },
  12118. enumerable: true,
  12119. configurable: true
  12120. });
  12121. return MDCRadio;
  12122. }(component_1.MDCComponent);
  12123. exports.MDCRadio = MDCRadio;
  12124. /***/ }),
  12125. /***/ "./packages/mdc-radio/constants.ts":
  12126. /*!*****************************************!*\
  12127. !*** ./packages/mdc-radio/constants.ts ***!
  12128. \*****************************************/
  12129. /*! no static exports found */
  12130. /***/ (function(module, exports, __webpack_require__) {
  12131. "use strict";
  12132. /**
  12133. * @license
  12134. * Copyright 2016 Google Inc.
  12135. *
  12136. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12137. * of this software and associated documentation files (the "Software"), to deal
  12138. * in the Software without restriction, including without limitation the rights
  12139. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12140. * copies of the Software, and to permit persons to whom the Software is
  12141. * furnished to do so, subject to the following conditions:
  12142. *
  12143. * The above copyright notice and this permission notice shall be included in
  12144. * all copies or substantial portions of the Software.
  12145. *
  12146. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12147. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12148. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12149. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12150. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12151. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12152. * THE SOFTWARE.
  12153. */
  12154. Object.defineProperty(exports, "__esModule", { value: true });
  12155. var strings = {
  12156. NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control'
  12157. };
  12158. exports.strings = strings;
  12159. var cssClasses = {
  12160. DISABLED: 'mdc-radio--disabled',
  12161. ROOT: 'mdc-radio'
  12162. };
  12163. exports.cssClasses = cssClasses;
  12164. /***/ }),
  12165. /***/ "./packages/mdc-radio/foundation.ts":
  12166. /*!******************************************!*\
  12167. !*** ./packages/mdc-radio/foundation.ts ***!
  12168. \******************************************/
  12169. /*! no static exports found */
  12170. /***/ (function(module, exports, __webpack_require__) {
  12171. "use strict";
  12172. /**
  12173. * @license
  12174. * Copyright 2016 Google Inc.
  12175. *
  12176. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12177. * of this software and associated documentation files (the "Software"), to deal
  12178. * in the Software without restriction, including without limitation the rights
  12179. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12180. * copies of the Software, and to permit persons to whom the Software is
  12181. * furnished to do so, subject to the following conditions:
  12182. *
  12183. * The above copyright notice and this permission notice shall be included in
  12184. * all copies or substantial portions of the Software.
  12185. *
  12186. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12187. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12188. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12189. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12190. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12191. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12192. * THE SOFTWARE.
  12193. */
  12194. var __extends = this && this.__extends || function () {
  12195. var _extendStatics = function extendStatics(d, b) {
  12196. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12197. d.__proto__ = b;
  12198. } || function (d, b) {
  12199. for (var p in b) {
  12200. if (b.hasOwnProperty(p)) d[p] = b[p];
  12201. }
  12202. };
  12203. return _extendStatics(d, b);
  12204. };
  12205. return function (d, b) {
  12206. _extendStatics(d, b);
  12207. function __() {
  12208. this.constructor = d;
  12209. }
  12210. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12211. };
  12212. }();
  12213. var __assign = this && this.__assign || function () {
  12214. __assign = Object.assign || function (t) {
  12215. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12216. s = arguments[i];
  12217. for (var p in s) {
  12218. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12219. }
  12220. }
  12221. return t;
  12222. };
  12223. return __assign.apply(this, arguments);
  12224. };
  12225. Object.defineProperty(exports, "__esModule", { value: true });
  12226. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12227. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts");
  12228. var MDCRadioFoundation = /** @class */function (_super) {
  12229. __extends(MDCRadioFoundation, _super);
  12230. function MDCRadioFoundation(adapter) {
  12231. return _super.call(this, __assign(__assign({}, MDCRadioFoundation.defaultAdapter), adapter)) || this;
  12232. }
  12233. Object.defineProperty(MDCRadioFoundation, "cssClasses", {
  12234. get: function get() {
  12235. return constants_1.cssClasses;
  12236. },
  12237. enumerable: true,
  12238. configurable: true
  12239. });
  12240. Object.defineProperty(MDCRadioFoundation, "strings", {
  12241. get: function get() {
  12242. return constants_1.strings;
  12243. },
  12244. enumerable: true,
  12245. configurable: true
  12246. });
  12247. Object.defineProperty(MDCRadioFoundation, "defaultAdapter", {
  12248. get: function get() {
  12249. return {
  12250. addClass: function addClass() {
  12251. return undefined;
  12252. },
  12253. removeClass: function removeClass() {
  12254. return undefined;
  12255. },
  12256. setNativeControlDisabled: function setNativeControlDisabled() {
  12257. return undefined;
  12258. }
  12259. };
  12260. },
  12261. enumerable: true,
  12262. configurable: true
  12263. });
  12264. MDCRadioFoundation.prototype.setDisabled = function (disabled) {
  12265. var DISABLED = MDCRadioFoundation.cssClasses.DISABLED;
  12266. this.adapter.setNativeControlDisabled(disabled);
  12267. if (disabled) {
  12268. this.adapter.addClass(DISABLED);
  12269. } else {
  12270. this.adapter.removeClass(DISABLED);
  12271. }
  12272. };
  12273. return MDCRadioFoundation;
  12274. }(foundation_1.MDCFoundation);
  12275. exports.MDCRadioFoundation = MDCRadioFoundation;
  12276. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12277. exports.default = MDCRadioFoundation;
  12278. /***/ }),
  12279. /***/ "./packages/mdc-radio/index.ts":
  12280. /*!*************************************!*\
  12281. !*** ./packages/mdc-radio/index.ts ***!
  12282. \*************************************/
  12283. /*! no static exports found */
  12284. /***/ (function(module, exports, __webpack_require__) {
  12285. "use strict";
  12286. /**
  12287. * @license
  12288. * Copyright 2019 Google Inc.
  12289. *
  12290. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12291. * of this software and associated documentation files (the "Software"), to deal
  12292. * in the Software without restriction, including without limitation the rights
  12293. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12294. * copies of the Software, and to permit persons to whom the Software is
  12295. * furnished to do so, subject to the following conditions:
  12296. *
  12297. * The above copyright notice and this permission notice shall be included in
  12298. * all copies or substantial portions of the Software.
  12299. *
  12300. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12301. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12302. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12303. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12304. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12305. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12306. * THE SOFTWARE.
  12307. */
  12308. function __export(m) {
  12309. for (var p in m) {
  12310. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  12311. }
  12312. }
  12313. Object.defineProperty(exports, "__esModule", { value: true });
  12314. __export(__webpack_require__(/*! ./component */ "./packages/mdc-radio/component.ts"));
  12315. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"));
  12316. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"));
  12317. /***/ }),
  12318. /***/ "./packages/mdc-ripple/component.ts":
  12319. /*!******************************************!*\
  12320. !*** ./packages/mdc-ripple/component.ts ***!
  12321. \******************************************/
  12322. /*! no static exports found */
  12323. /***/ (function(module, exports, __webpack_require__) {
  12324. "use strict";
  12325. /**
  12326. * @license
  12327. * Copyright 2016 Google Inc.
  12328. *
  12329. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12330. * of this software and associated documentation files (the "Software"), to deal
  12331. * in the Software without restriction, including without limitation the rights
  12332. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12333. * copies of the Software, and to permit persons to whom the Software is
  12334. * furnished to do so, subject to the following conditions:
  12335. *
  12336. * The above copyright notice and this permission notice shall be included in
  12337. * all copies or substantial portions of the Software.
  12338. *
  12339. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12340. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12341. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12342. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12343. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12344. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12345. * THE SOFTWARE.
  12346. */
  12347. var __extends = this && this.__extends || function () {
  12348. var _extendStatics = function extendStatics(d, b) {
  12349. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12350. d.__proto__ = b;
  12351. } || function (d, b) {
  12352. for (var p in b) {
  12353. if (b.hasOwnProperty(p)) d[p] = b[p];
  12354. }
  12355. };
  12356. return _extendStatics(d, b);
  12357. };
  12358. return function (d, b) {
  12359. _extendStatics(d, b);
  12360. function __() {
  12361. this.constructor = d;
  12362. }
  12363. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12364. };
  12365. }();
  12366. var __importStar = this && this.__importStar || function (mod) {
  12367. if (mod && mod.__esModule) return mod;
  12368. var result = {};
  12369. if (mod != null) for (var k in mod) {
  12370. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  12371. }result["default"] = mod;
  12372. return result;
  12373. };
  12374. Object.defineProperty(exports, "__esModule", { value: true });
  12375. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12376. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  12377. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  12378. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  12379. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  12380. var MDCRipple = /** @class */function (_super) {
  12381. __extends(MDCRipple, _super);
  12382. function MDCRipple() {
  12383. var _this = _super !== null && _super.apply(this, arguments) || this;
  12384. _this.disabled = false;
  12385. return _this;
  12386. }
  12387. MDCRipple.attachTo = function (root, opts) {
  12388. if (opts === void 0) {
  12389. opts = { isUnbounded: undefined };
  12390. }
  12391. var ripple = new MDCRipple(root);
  12392. // Only override unbounded behavior if option is explicitly specified
  12393. if (opts.isUnbounded !== undefined) {
  12394. ripple.unbounded = opts.isUnbounded;
  12395. }
  12396. return ripple;
  12397. };
  12398. MDCRipple.createAdapter = function (instance) {
  12399. return {
  12400. addClass: function addClass(className) {
  12401. return instance.root.classList.add(className);
  12402. },
  12403. browserSupportsCssVars: function browserSupportsCssVars() {
  12404. return util.supportsCssVariables(window);
  12405. },
  12406. computeBoundingRect: function computeBoundingRect() {
  12407. return instance.root.getBoundingClientRect();
  12408. },
  12409. containsEventTarget: function containsEventTarget(target) {
  12410. return instance.root.contains(target);
  12411. },
  12412. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  12413. return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  12414. },
  12415. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  12416. return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
  12417. },
  12418. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  12419. return window.removeEventListener('resize', handler);
  12420. },
  12421. getWindowPageOffset: function getWindowPageOffset() {
  12422. return { x: window.pageXOffset, y: window.pageYOffset };
  12423. },
  12424. isSurfaceActive: function isSurfaceActive() {
  12425. return ponyfill_1.matches(instance.root, ':active');
  12426. },
  12427. isSurfaceDisabled: function isSurfaceDisabled() {
  12428. return Boolean(instance.disabled);
  12429. },
  12430. isUnbounded: function isUnbounded() {
  12431. return Boolean(instance.unbounded);
  12432. },
  12433. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  12434. return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  12435. },
  12436. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  12437. return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
  12438. },
  12439. registerResizeHandler: function registerResizeHandler(handler) {
  12440. return window.addEventListener('resize', handler);
  12441. },
  12442. removeClass: function removeClass(className) {
  12443. return instance.root.classList.remove(className);
  12444. },
  12445. updateCssVariable: function updateCssVariable(varName, value) {
  12446. return instance.root.style.setProperty(varName, value);
  12447. }
  12448. };
  12449. };
  12450. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  12451. get: function get() {
  12452. return Boolean(this.unbounded_);
  12453. },
  12454. set: function set(unbounded) {
  12455. this.unbounded_ = Boolean(unbounded);
  12456. this.setUnbounded_();
  12457. },
  12458. enumerable: true,
  12459. configurable: true
  12460. });
  12461. MDCRipple.prototype.activate = function () {
  12462. this.foundation.activate();
  12463. };
  12464. MDCRipple.prototype.deactivate = function () {
  12465. this.foundation.deactivate();
  12466. };
  12467. MDCRipple.prototype.layout = function () {
  12468. this.foundation.layout();
  12469. };
  12470. MDCRipple.prototype.getDefaultFoundation = function () {
  12471. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  12472. };
  12473. MDCRipple.prototype.initialSyncWithDOM = function () {
  12474. var root = this.root;
  12475. this.unbounded = 'mdcRippleIsUnbounded' in root.dataset;
  12476. };
  12477. /**
  12478. * Closure Compiler throws an access control error when directly accessing a
  12479. * protected or private property inside a getter/setter, like unbounded above.
  12480. * By accessing the protected property inside a method, we solve that problem.
  12481. * That's why this function exists.
  12482. */
  12483. MDCRipple.prototype.setUnbounded_ = function () {
  12484. this.foundation.setUnbounded(Boolean(this.unbounded_));
  12485. };
  12486. return MDCRipple;
  12487. }(component_1.MDCComponent);
  12488. exports.MDCRipple = MDCRipple;
  12489. /***/ }),
  12490. /***/ "./packages/mdc-ripple/constants.ts":
  12491. /*!******************************************!*\
  12492. !*** ./packages/mdc-ripple/constants.ts ***!
  12493. \******************************************/
  12494. /*! no static exports found */
  12495. /***/ (function(module, exports, __webpack_require__) {
  12496. "use strict";
  12497. /**
  12498. * @license
  12499. * Copyright 2016 Google Inc.
  12500. *
  12501. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12502. * of this software and associated documentation files (the "Software"), to deal
  12503. * in the Software without restriction, including without limitation the rights
  12504. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12505. * copies of the Software, and to permit persons to whom the Software is
  12506. * furnished to do so, subject to the following conditions:
  12507. *
  12508. * The above copyright notice and this permission notice shall be included in
  12509. * all copies or substantial portions of the Software.
  12510. *
  12511. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12512. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12513. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12514. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12515. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12516. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12517. * THE SOFTWARE.
  12518. */
  12519. Object.defineProperty(exports, "__esModule", { value: true });
  12520. exports.cssClasses = {
  12521. // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  12522. // given that it's an 'upgrade' to an existing component. That being said it is the root
  12523. // CSS class that all other CSS classes derive from.
  12524. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  12525. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  12526. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  12527. ROOT: 'mdc-ripple-upgraded',
  12528. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  12529. };
  12530. exports.strings = {
  12531. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  12532. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  12533. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  12534. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  12535. VAR_LEFT: '--mdc-ripple-left',
  12536. VAR_TOP: '--mdc-ripple-top'
  12537. };
  12538. exports.numbers = {
  12539. DEACTIVATION_TIMEOUT_MS: 225,
  12540. FG_DEACTIVATION_MS: 150,
  12541. INITIAL_ORIGIN_SCALE: 0.6,
  12542. PADDING: 10,
  12543. TAP_DELAY_MS: 300
  12544. };
  12545. /***/ }),
  12546. /***/ "./packages/mdc-ripple/foundation.ts":
  12547. /*!*******************************************!*\
  12548. !*** ./packages/mdc-ripple/foundation.ts ***!
  12549. \*******************************************/
  12550. /*! no static exports found */
  12551. /***/ (function(module, exports, __webpack_require__) {
  12552. "use strict";
  12553. /**
  12554. * @license
  12555. * Copyright 2016 Google Inc.
  12556. *
  12557. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12558. * of this software and associated documentation files (the "Software"), to deal
  12559. * in the Software without restriction, including without limitation the rights
  12560. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12561. * copies of the Software, and to permit persons to whom the Software is
  12562. * furnished to do so, subject to the following conditions:
  12563. *
  12564. * The above copyright notice and this permission notice shall be included in
  12565. * all copies or substantial portions of the Software.
  12566. *
  12567. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12568. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12569. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12570. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12571. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12572. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12573. * THE SOFTWARE.
  12574. */
  12575. var __extends = this && this.__extends || function () {
  12576. var _extendStatics = function extendStatics(d, b) {
  12577. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12578. d.__proto__ = b;
  12579. } || function (d, b) {
  12580. for (var p in b) {
  12581. if (b.hasOwnProperty(p)) d[p] = b[p];
  12582. }
  12583. };
  12584. return _extendStatics(d, b);
  12585. };
  12586. return function (d, b) {
  12587. _extendStatics(d, b);
  12588. function __() {
  12589. this.constructor = d;
  12590. }
  12591. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12592. };
  12593. }();
  12594. var __assign = this && this.__assign || function () {
  12595. __assign = Object.assign || function (t) {
  12596. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12597. s = arguments[i];
  12598. for (var p in s) {
  12599. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12600. }
  12601. }
  12602. return t;
  12603. };
  12604. return __assign.apply(this, arguments);
  12605. };
  12606. Object.defineProperty(exports, "__esModule", { value: true });
  12607. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12608. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  12609. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  12610. // Activation events registered on the root element of each instance for activation
  12611. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  12612. // Deactivation events registered on documentElement when a pointer-related down event occurs
  12613. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  12614. // simultaneous nested activations
  12615. var activatedTargets = [];
  12616. var MDCRippleFoundation = /** @class */function (_super) {
  12617. __extends(MDCRippleFoundation, _super);
  12618. function MDCRippleFoundation(adapter) {
  12619. var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
  12620. _this.activationAnimationHasEnded_ = false;
  12621. _this.activationTimer_ = 0;
  12622. _this.fgDeactivationRemovalTimer_ = 0;
  12623. _this.fgScale_ = '0';
  12624. _this.frame_ = { width: 0, height: 0 };
  12625. _this.initialSize_ = 0;
  12626. _this.layoutFrame_ = 0;
  12627. _this.maxRadius_ = 0;
  12628. _this.unboundedCoords_ = { left: 0, top: 0 };
  12629. _this.activationState_ = _this.defaultActivationState_();
  12630. _this.activationTimerCallback_ = function () {
  12631. _this.activationAnimationHasEnded_ = true;
  12632. _this.runDeactivationUXLogicIfReady_();
  12633. };
  12634. _this.activateHandler_ = function (e) {
  12635. return _this.activate_(e);
  12636. };
  12637. _this.deactivateHandler_ = function () {
  12638. return _this.deactivate_();
  12639. };
  12640. _this.focusHandler_ = function () {
  12641. return _this.handleFocus();
  12642. };
  12643. _this.blurHandler_ = function () {
  12644. return _this.handleBlur();
  12645. };
  12646. _this.resizeHandler_ = function () {
  12647. return _this.layout();
  12648. };
  12649. return _this;
  12650. }
  12651. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  12652. get: function get() {
  12653. return constants_1.cssClasses;
  12654. },
  12655. enumerable: true,
  12656. configurable: true
  12657. });
  12658. Object.defineProperty(MDCRippleFoundation, "strings", {
  12659. get: function get() {
  12660. return constants_1.strings;
  12661. },
  12662. enumerable: true,
  12663. configurable: true
  12664. });
  12665. Object.defineProperty(MDCRippleFoundation, "numbers", {
  12666. get: function get() {
  12667. return constants_1.numbers;
  12668. },
  12669. enumerable: true,
  12670. configurable: true
  12671. });
  12672. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  12673. get: function get() {
  12674. return {
  12675. addClass: function addClass() {
  12676. return undefined;
  12677. },
  12678. browserSupportsCssVars: function browserSupportsCssVars() {
  12679. return true;
  12680. },
  12681. computeBoundingRect: function computeBoundingRect() {
  12682. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  12683. },
  12684. containsEventTarget: function containsEventTarget() {
  12685. return true;
  12686. },
  12687. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  12688. return undefined;
  12689. },
  12690. deregisterInteractionHandler: function deregisterInteractionHandler() {
  12691. return undefined;
  12692. },
  12693. deregisterResizeHandler: function deregisterResizeHandler() {
  12694. return undefined;
  12695. },
  12696. getWindowPageOffset: function getWindowPageOffset() {
  12697. return { x: 0, y: 0 };
  12698. },
  12699. isSurfaceActive: function isSurfaceActive() {
  12700. return true;
  12701. },
  12702. isSurfaceDisabled: function isSurfaceDisabled() {
  12703. return true;
  12704. },
  12705. isUnbounded: function isUnbounded() {
  12706. return true;
  12707. },
  12708. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  12709. return undefined;
  12710. },
  12711. registerInteractionHandler: function registerInteractionHandler() {
  12712. return undefined;
  12713. },
  12714. registerResizeHandler: function registerResizeHandler() {
  12715. return undefined;
  12716. },
  12717. removeClass: function removeClass() {
  12718. return undefined;
  12719. },
  12720. updateCssVariable: function updateCssVariable() {
  12721. return undefined;
  12722. }
  12723. };
  12724. },
  12725. enumerable: true,
  12726. configurable: true
  12727. });
  12728. MDCRippleFoundation.prototype.init = function () {
  12729. var _this = this;
  12730. var supportsPressRipple = this.supportsPressRipple_();
  12731. this.registerRootHandlers_(supportsPressRipple);
  12732. if (supportsPressRipple) {
  12733. var _a = MDCRippleFoundation.cssClasses,
  12734. ROOT_1 = _a.ROOT,
  12735. UNBOUNDED_1 = _a.UNBOUNDED;
  12736. requestAnimationFrame(function () {
  12737. _this.adapter.addClass(ROOT_1);
  12738. if (_this.adapter.isUnbounded()) {
  12739. _this.adapter.addClass(UNBOUNDED_1);
  12740. // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
  12741. _this.layoutInternal_();
  12742. }
  12743. });
  12744. }
  12745. };
  12746. MDCRippleFoundation.prototype.destroy = function () {
  12747. var _this = this;
  12748. if (this.supportsPressRipple_()) {
  12749. if (this.activationTimer_) {
  12750. clearTimeout(this.activationTimer_);
  12751. this.activationTimer_ = 0;
  12752. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  12753. }
  12754. if (this.fgDeactivationRemovalTimer_) {
  12755. clearTimeout(this.fgDeactivationRemovalTimer_);
  12756. this.fgDeactivationRemovalTimer_ = 0;
  12757. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  12758. }
  12759. var _a = MDCRippleFoundation.cssClasses,
  12760. ROOT_2 = _a.ROOT,
  12761. UNBOUNDED_2 = _a.UNBOUNDED;
  12762. requestAnimationFrame(function () {
  12763. _this.adapter.removeClass(ROOT_2);
  12764. _this.adapter.removeClass(UNBOUNDED_2);
  12765. _this.removeCssVars_();
  12766. });
  12767. }
  12768. this.deregisterRootHandlers_();
  12769. this.deregisterDeactivationHandlers_();
  12770. };
  12771. /**
  12772. * @param evt Optional event containing position information.
  12773. */
  12774. MDCRippleFoundation.prototype.activate = function (evt) {
  12775. this.activate_(evt);
  12776. };
  12777. MDCRippleFoundation.prototype.deactivate = function () {
  12778. this.deactivate_();
  12779. };
  12780. MDCRippleFoundation.prototype.layout = function () {
  12781. var _this = this;
  12782. if (this.layoutFrame_) {
  12783. cancelAnimationFrame(this.layoutFrame_);
  12784. }
  12785. this.layoutFrame_ = requestAnimationFrame(function () {
  12786. _this.layoutInternal_();
  12787. _this.layoutFrame_ = 0;
  12788. });
  12789. };
  12790. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  12791. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  12792. if (unbounded) {
  12793. this.adapter.addClass(UNBOUNDED);
  12794. } else {
  12795. this.adapter.removeClass(UNBOUNDED);
  12796. }
  12797. };
  12798. MDCRippleFoundation.prototype.handleFocus = function () {
  12799. var _this = this;
  12800. requestAnimationFrame(function () {
  12801. return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  12802. });
  12803. };
  12804. MDCRippleFoundation.prototype.handleBlur = function () {
  12805. var _this = this;
  12806. requestAnimationFrame(function () {
  12807. return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  12808. });
  12809. };
  12810. /**
  12811. * We compute this property so that we are not querying information about the client
  12812. * until the point in time where the foundation requests it. This prevents scenarios where
  12813. * client-side feature-detection may happen too early, such as when components are rendered on the server
  12814. * and then initialized at mount time on the client.
  12815. */
  12816. MDCRippleFoundation.prototype.supportsPressRipple_ = function () {
  12817. return this.adapter.browserSupportsCssVars();
  12818. };
  12819. MDCRippleFoundation.prototype.defaultActivationState_ = function () {
  12820. return {
  12821. activationEvent: undefined,
  12822. hasDeactivationUXRun: false,
  12823. isActivated: false,
  12824. isProgrammatic: false,
  12825. wasActivatedByPointer: false,
  12826. wasElementMadeActive: false
  12827. };
  12828. };
  12829. /**
  12830. * supportsPressRipple Passed from init to save a redundant function call
  12831. */
  12832. MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) {
  12833. var _this = this;
  12834. if (supportsPressRipple) {
  12835. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  12836. _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_);
  12837. });
  12838. if (this.adapter.isUnbounded()) {
  12839. this.adapter.registerResizeHandler(this.resizeHandler_);
  12840. }
  12841. }
  12842. this.adapter.registerInteractionHandler('focus', this.focusHandler_);
  12843. this.adapter.registerInteractionHandler('blur', this.blurHandler_);
  12844. };
  12845. MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) {
  12846. var _this = this;
  12847. if (evt.type === 'keydown') {
  12848. this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_);
  12849. } else {
  12850. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  12851. _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  12852. });
  12853. }
  12854. };
  12855. MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () {
  12856. var _this = this;
  12857. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  12858. _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_);
  12859. });
  12860. this.adapter.deregisterInteractionHandler('focus', this.focusHandler_);
  12861. this.adapter.deregisterInteractionHandler('blur', this.blurHandler_);
  12862. if (this.adapter.isUnbounded()) {
  12863. this.adapter.deregisterResizeHandler(this.resizeHandler_);
  12864. }
  12865. };
  12866. MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () {
  12867. var _this = this;
  12868. this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_);
  12869. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  12870. _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  12871. });
  12872. };
  12873. MDCRippleFoundation.prototype.removeCssVars_ = function () {
  12874. var _this = this;
  12875. var rippleStrings = MDCRippleFoundation.strings;
  12876. var keys = Object.keys(rippleStrings);
  12877. keys.forEach(function (key) {
  12878. if (key.indexOf('VAR_') === 0) {
  12879. _this.adapter.updateCssVariable(rippleStrings[key], null);
  12880. }
  12881. });
  12882. };
  12883. MDCRippleFoundation.prototype.activate_ = function (evt) {
  12884. var _this = this;
  12885. if (this.adapter.isSurfaceDisabled()) {
  12886. return;
  12887. }
  12888. var activationState = this.activationState_;
  12889. if (activationState.isActivated) {
  12890. return;
  12891. }
  12892. // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
  12893. var previousActivationEvent = this.previousActivationEvent_;
  12894. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  12895. if (isSameInteraction) {
  12896. return;
  12897. }
  12898. activationState.isActivated = true;
  12899. activationState.isProgrammatic = evt === undefined;
  12900. activationState.activationEvent = evt;
  12901. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  12902. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  12903. return _this.adapter.containsEventTarget(target);
  12904. });
  12905. if (hasActivatedChild) {
  12906. // Immediately reset activation state, while preserving logic that prevents touch follow-on events
  12907. this.resetActivationState_();
  12908. return;
  12909. }
  12910. if (evt !== undefined) {
  12911. activatedTargets.push(evt.target);
  12912. this.registerDeactivationHandlers_(evt);
  12913. }
  12914. activationState.wasElementMadeActive = this.checkElementMadeActive_(evt);
  12915. if (activationState.wasElementMadeActive) {
  12916. this.animateActivation_();
  12917. }
  12918. requestAnimationFrame(function () {
  12919. // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
  12920. activatedTargets = [];
  12921. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  12922. // If space was pressed, try again within an rAF call to detect :active, because different UAs report
  12923. // active states inconsistently when they're called within event handling code:
  12924. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  12925. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  12926. // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
  12927. // variable is set within a rAF callback for a submit button interaction (#2241).
  12928. activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt);
  12929. if (activationState.wasElementMadeActive) {
  12930. _this.animateActivation_();
  12931. }
  12932. }
  12933. if (!activationState.wasElementMadeActive) {
  12934. // Reset activation state immediately if element was not made active.
  12935. _this.activationState_ = _this.defaultActivationState_();
  12936. }
  12937. });
  12938. };
  12939. MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) {
  12940. return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
  12941. };
  12942. MDCRippleFoundation.prototype.animateActivation_ = function () {
  12943. var _this = this;
  12944. var _a = MDCRippleFoundation.strings,
  12945. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  12946. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  12947. var _b = MDCRippleFoundation.cssClasses,
  12948. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  12949. FG_ACTIVATION = _b.FG_ACTIVATION;
  12950. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  12951. this.layoutInternal_();
  12952. var translateStart = '';
  12953. var translateEnd = '';
  12954. if (!this.adapter.isUnbounded()) {
  12955. var _c = this.getFgTranslationCoordinates_(),
  12956. startPoint = _c.startPoint,
  12957. endPoint = _c.endPoint;
  12958. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  12959. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  12960. }
  12961. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  12962. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  12963. // Cancel any ongoing activation/deactivation animations
  12964. clearTimeout(this.activationTimer_);
  12965. clearTimeout(this.fgDeactivationRemovalTimer_);
  12966. this.rmBoundedActivationClasses_();
  12967. this.adapter.removeClass(FG_DEACTIVATION);
  12968. // Force layout in order to re-trigger the animation.
  12969. this.adapter.computeBoundingRect();
  12970. this.adapter.addClass(FG_ACTIVATION);
  12971. this.activationTimer_ = setTimeout(function () {
  12972. return _this.activationTimerCallback_();
  12973. }, DEACTIVATION_TIMEOUT_MS);
  12974. };
  12975. MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () {
  12976. var _a = this.activationState_,
  12977. activationEvent = _a.activationEvent,
  12978. wasActivatedByPointer = _a.wasActivatedByPointer;
  12979. var startPoint;
  12980. if (wasActivatedByPointer) {
  12981. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
  12982. } else {
  12983. startPoint = {
  12984. x: this.frame_.width / 2,
  12985. y: this.frame_.height / 2
  12986. };
  12987. }
  12988. // Center the element around the start point.
  12989. startPoint = {
  12990. x: startPoint.x - this.initialSize_ / 2,
  12991. y: startPoint.y - this.initialSize_ / 2
  12992. };
  12993. var endPoint = {
  12994. x: this.frame_.width / 2 - this.initialSize_ / 2,
  12995. y: this.frame_.height / 2 - this.initialSize_ / 2
  12996. };
  12997. return { startPoint: startPoint, endPoint: endPoint };
  12998. };
  12999. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () {
  13000. var _this = this;
  13001. // This method is called both when a pointing device is released, and when the activation animation ends.
  13002. // The deactivation animation should only run after both of those occur.
  13003. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  13004. var _a = this.activationState_,
  13005. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  13006. isActivated = _a.isActivated;
  13007. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  13008. if (activationHasEnded && this.activationAnimationHasEnded_) {
  13009. this.rmBoundedActivationClasses_();
  13010. this.adapter.addClass(FG_DEACTIVATION);
  13011. this.fgDeactivationRemovalTimer_ = setTimeout(function () {
  13012. _this.adapter.removeClass(FG_DEACTIVATION);
  13013. }, constants_1.numbers.FG_DEACTIVATION_MS);
  13014. }
  13015. };
  13016. MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () {
  13017. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  13018. this.adapter.removeClass(FG_ACTIVATION);
  13019. this.activationAnimationHasEnded_ = false;
  13020. this.adapter.computeBoundingRect();
  13021. };
  13022. MDCRippleFoundation.prototype.resetActivationState_ = function () {
  13023. var _this = this;
  13024. this.previousActivationEvent_ = this.activationState_.activationEvent;
  13025. this.activationState_ = this.defaultActivationState_();
  13026. // Touch devices may fire additional events for the same interaction within a short time.
  13027. // Store the previous event until it's safe to assume that subsequent events are for new interactions.
  13028. setTimeout(function () {
  13029. return _this.previousActivationEvent_ = undefined;
  13030. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  13031. };
  13032. MDCRippleFoundation.prototype.deactivate_ = function () {
  13033. var _this = this;
  13034. var activationState = this.activationState_;
  13035. // This can happen in scenarios such as when you have a keyup event that blurs the element.
  13036. if (!activationState.isActivated) {
  13037. return;
  13038. }
  13039. var state = __assign({}, activationState);
  13040. if (activationState.isProgrammatic) {
  13041. requestAnimationFrame(function () {
  13042. return _this.animateDeactivation_(state);
  13043. });
  13044. this.resetActivationState_();
  13045. } else {
  13046. this.deregisterDeactivationHandlers_();
  13047. requestAnimationFrame(function () {
  13048. _this.activationState_.hasDeactivationUXRun = true;
  13049. _this.animateDeactivation_(state);
  13050. _this.resetActivationState_();
  13051. });
  13052. }
  13053. };
  13054. MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) {
  13055. var wasActivatedByPointer = _a.wasActivatedByPointer,
  13056. wasElementMadeActive = _a.wasElementMadeActive;
  13057. if (wasActivatedByPointer || wasElementMadeActive) {
  13058. this.runDeactivationUXLogicIfReady_();
  13059. }
  13060. };
  13061. MDCRippleFoundation.prototype.layoutInternal_ = function () {
  13062. var _this = this;
  13063. this.frame_ = this.adapter.computeBoundingRect();
  13064. var maxDim = Math.max(this.frame_.height, this.frame_.width);
  13065. // Surface diameter is treated differently for unbounded vs. bounded ripples.
  13066. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
  13067. // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
  13068. // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
  13069. // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
  13070. // `overflow: hidden`.
  13071. var getBoundedRadius = function getBoundedRadius() {
  13072. var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2));
  13073. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  13074. };
  13075. this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
  13076. // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
  13077. var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  13078. // Unbounded ripple size should always be even number to equally center align.
  13079. if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
  13080. this.initialSize_ = initialSize - 1;
  13081. } else {
  13082. this.initialSize_ = initialSize;
  13083. }
  13084. this.fgScale_ = "" + this.maxRadius_ / this.initialSize_;
  13085. this.updateLayoutCssVars_();
  13086. };
  13087. MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () {
  13088. var _a = MDCRippleFoundation.strings,
  13089. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  13090. VAR_LEFT = _a.VAR_LEFT,
  13091. VAR_TOP = _a.VAR_TOP,
  13092. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  13093. this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px");
  13094. this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
  13095. if (this.adapter.isUnbounded()) {
  13096. this.unboundedCoords_ = {
  13097. left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
  13098. top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
  13099. };
  13100. this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px");
  13101. this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px");
  13102. }
  13103. };
  13104. return MDCRippleFoundation;
  13105. }(foundation_1.MDCFoundation);
  13106. exports.MDCRippleFoundation = MDCRippleFoundation;
  13107. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  13108. exports.default = MDCRippleFoundation;
  13109. /***/ }),
  13110. /***/ "./packages/mdc-ripple/index.ts":
  13111. /*!**************************************!*\
  13112. !*** ./packages/mdc-ripple/index.ts ***!
  13113. \**************************************/
  13114. /*! no static exports found */
  13115. /***/ (function(module, exports, __webpack_require__) {
  13116. "use strict";
  13117. /**
  13118. * @license
  13119. * Copyright 2019 Google Inc.
  13120. *
  13121. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13122. * of this software and associated documentation files (the "Software"), to deal
  13123. * in the Software without restriction, including without limitation the rights
  13124. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13125. * copies of the Software, and to permit persons to whom the Software is
  13126. * furnished to do so, subject to the following conditions:
  13127. *
  13128. * The above copyright notice and this permission notice shall be included in
  13129. * all copies or substantial portions of the Software.
  13130. *
  13131. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13132. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13133. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13134. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13135. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13136. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13137. * THE SOFTWARE.
  13138. */
  13139. function __export(m) {
  13140. for (var p in m) {
  13141. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13142. }
  13143. }
  13144. var __importStar = this && this.__importStar || function (mod) {
  13145. if (mod && mod.__esModule) return mod;
  13146. var result = {};
  13147. if (mod != null) for (var k in mod) {
  13148. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  13149. }result["default"] = mod;
  13150. return result;
  13151. };
  13152. Object.defineProperty(exports, "__esModule", { value: true });
  13153. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  13154. exports.util = util;
  13155. __export(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts"));
  13156. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"));
  13157. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"));
  13158. /***/ }),
  13159. /***/ "./packages/mdc-ripple/util.ts":
  13160. /*!*************************************!*\
  13161. !*** ./packages/mdc-ripple/util.ts ***!
  13162. \*************************************/
  13163. /*! no static exports found */
  13164. /***/ (function(module, exports, __webpack_require__) {
  13165. "use strict";
  13166. Object.defineProperty(exports, "__esModule", { value: true });
  13167. /**
  13168. * Stores result from supportsCssVariables to avoid redundant processing to
  13169. * detect CSS custom variable support.
  13170. */
  13171. var supportsCssVariables_;
  13172. function supportsCssVariables(windowObj, forceRefresh) {
  13173. if (forceRefresh === void 0) {
  13174. forceRefresh = false;
  13175. }
  13176. var CSS = windowObj.CSS;
  13177. var supportsCssVars = supportsCssVariables_;
  13178. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  13179. return supportsCssVariables_;
  13180. }
  13181. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  13182. if (!supportsFunctionPresent) {
  13183. return false;
  13184. }
  13185. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  13186. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  13187. // See: README section on Safari
  13188. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  13189. supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
  13190. if (!forceRefresh) {
  13191. supportsCssVariables_ = supportsCssVars;
  13192. }
  13193. return supportsCssVars;
  13194. }
  13195. exports.supportsCssVariables = supportsCssVariables;
  13196. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  13197. if (!evt) {
  13198. return { x: 0, y: 0 };
  13199. }
  13200. var x = pageOffset.x,
  13201. y = pageOffset.y;
  13202. var documentX = x + clientRect.left;
  13203. var documentY = y + clientRect.top;
  13204. var normalizedX;
  13205. var normalizedY;
  13206. // Determine touch point relative to the ripple container.
  13207. if (evt.type === 'touchstart') {
  13208. var touchEvent = evt;
  13209. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  13210. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  13211. } else {
  13212. var mouseEvent = evt;
  13213. normalizedX = mouseEvent.pageX - documentX;
  13214. normalizedY = mouseEvent.pageY - documentY;
  13215. }
  13216. return { x: normalizedX, y: normalizedY };
  13217. }
  13218. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  13219. /***/ }),
  13220. /***/ "./packages/mdc-select/component.ts":
  13221. /*!******************************************!*\
  13222. !*** ./packages/mdc-select/component.ts ***!
  13223. \******************************************/
  13224. /*! no static exports found */
  13225. /***/ (function(module, exports, __webpack_require__) {
  13226. "use strict";
  13227. /**
  13228. * @license
  13229. * Copyright 2016 Google Inc.
  13230. *
  13231. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13232. * of this software and associated documentation files (the "Software"), to deal
  13233. * in the Software without restriction, including without limitation the rights
  13234. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13235. * copies of the Software, and to permit persons to whom the Software is
  13236. * furnished to do so, subject to the following conditions:
  13237. *
  13238. * The above copyright notice and this permission notice shall be included in
  13239. * all copies or substantial portions of the Software.
  13240. *
  13241. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13242. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13243. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13244. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13245. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13246. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13247. * THE SOFTWARE.
  13248. */
  13249. var __extends = this && this.__extends || function () {
  13250. var _extendStatics = function extendStatics(d, b) {
  13251. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13252. d.__proto__ = b;
  13253. } || function (d, b) {
  13254. for (var p in b) {
  13255. if (b.hasOwnProperty(p)) d[p] = b[p];
  13256. }
  13257. };
  13258. return _extendStatics(d, b);
  13259. };
  13260. return function (d, b) {
  13261. _extendStatics(d, b);
  13262. function __() {
  13263. this.constructor = d;
  13264. }
  13265. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13266. };
  13267. }();
  13268. var __assign = this && this.__assign || function () {
  13269. __assign = Object.assign || function (t) {
  13270. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13271. s = arguments[i];
  13272. for (var p in s) {
  13273. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13274. }
  13275. }
  13276. return t;
  13277. };
  13278. return __assign.apply(this, arguments);
  13279. };
  13280. var __importStar = this && this.__importStar || function (mod) {
  13281. if (mod && mod.__esModule) return mod;
  13282. var result = {};
  13283. if (mod != null) for (var k in mod) {
  13284. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  13285. }result["default"] = mod;
  13286. return result;
  13287. };
  13288. Object.defineProperty(exports, "__esModule", { value: true });
  13289. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  13290. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  13291. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  13292. var menuSurfaceConstants = __importStar(__webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"));
  13293. var component_4 = __webpack_require__(/*! @material/menu/component */ "./packages/mdc-menu/component.ts");
  13294. var menuConstants = __importStar(__webpack_require__(/*! @material/menu/constants */ "./packages/mdc-menu/constants.ts"));
  13295. var component_5 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  13296. var component_6 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  13297. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  13298. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  13299. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts");
  13300. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-select/helper-text/component.ts");
  13301. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-select/icon/component.ts");
  13302. var MDCSelect = /** @class */function (_super) {
  13303. __extends(MDCSelect, _super);
  13304. function MDCSelect() {
  13305. return _super !== null && _super.apply(this, arguments) || this;
  13306. }
  13307. MDCSelect.attachTo = function (root) {
  13308. return new MDCSelect(root);
  13309. };
  13310. MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) {
  13311. if (labelFactory === void 0) {
  13312. labelFactory = function labelFactory(el) {
  13313. return new component_2.MDCFloatingLabel(el);
  13314. };
  13315. }
  13316. if (lineRippleFactory === void 0) {
  13317. lineRippleFactory = function lineRippleFactory(el) {
  13318. return new component_3.MDCLineRipple(el);
  13319. };
  13320. }
  13321. if (outlineFactory === void 0) {
  13322. outlineFactory = function outlineFactory(el) {
  13323. return new component_5.MDCNotchedOutline(el);
  13324. };
  13325. }
  13326. if (menuFactory === void 0) {
  13327. menuFactory = function menuFactory(el) {
  13328. return new component_4.MDCMenu(el);
  13329. };
  13330. }
  13331. if (iconFactory === void 0) {
  13332. iconFactory = function iconFactory(el) {
  13333. return new component_8.MDCSelectIcon(el);
  13334. };
  13335. }
  13336. if (helperTextFactory === void 0) {
  13337. helperTextFactory = function helperTextFactory(el) {
  13338. return new component_7.MDCSelectHelperText(el);
  13339. };
  13340. }
  13341. this.selectAnchor = this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR);
  13342. this.selectedText = this.root.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR);
  13343. if (!this.selectedText) {
  13344. throw new Error('MDCSelect: Missing required element: The following selector must be present: ' + ("'" + constants_1.strings.SELECTED_TEXT_SELECTOR + "'"));
  13345. }
  13346. if (this.selectAnchor.hasAttribute(constants_1.strings.ARIA_CONTROLS)) {
  13347. var helperTextElement = document.getElementById(this.selectAnchor.getAttribute(constants_1.strings.ARIA_CONTROLS));
  13348. if (helperTextElement) {
  13349. this.helperText = helperTextFactory(helperTextElement);
  13350. }
  13351. }
  13352. this.menuSetup(menuFactory);
  13353. var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR);
  13354. this.label = labelElement ? labelFactory(labelElement) : null;
  13355. var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  13356. this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  13357. var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  13358. this.outline = outlineElement ? outlineFactory(outlineElement) : null;
  13359. var leadingIcon = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  13360. if (leadingIcon) {
  13361. this.leadingIcon = iconFactory(leadingIcon);
  13362. }
  13363. if (!this.root.classList.contains(constants_1.cssClasses.OUTLINED)) {
  13364. this.ripple = this.createRipple();
  13365. }
  13366. };
  13367. /**
  13368. * Initializes the select's event listeners and internal state based
  13369. * on the environment's state.
  13370. */
  13371. MDCSelect.prototype.initialSyncWithDOM = function () {
  13372. var _this = this;
  13373. this.handleChange = function () {
  13374. _this.foundation.handleChange();
  13375. };
  13376. this.handleFocus = function () {
  13377. _this.foundation.handleFocus();
  13378. };
  13379. this.handleBlur = function () {
  13380. _this.foundation.handleBlur();
  13381. };
  13382. this.handleClick = function (evt) {
  13383. _this.selectAnchor.focus();
  13384. _this.foundation.handleClick(_this.getNormalizedXCoordinate(evt));
  13385. };
  13386. this.handleKeydown = function (evt) {
  13387. _this.foundation.handleKeydown(evt);
  13388. };
  13389. this.handleMenuItemAction = function (evt) {
  13390. _this.foundation.handleMenuItemAction(evt.detail.index);
  13391. };
  13392. this.handleMenuOpened = function () {
  13393. _this.foundation.handleMenuOpened();
  13394. };
  13395. this.handleMenuClosed = function () {
  13396. _this.foundation.handleMenuClosed();
  13397. };
  13398. this.selectAnchor.addEventListener('focus', this.handleFocus);
  13399. this.selectAnchor.addEventListener('blur', this.handleBlur);
  13400. this.selectAnchor.addEventListener('click', this.handleClick);
  13401. this.selectAnchor.addEventListener('keydown', this.handleKeydown);
  13402. this.menu.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed);
  13403. this.menu.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened);
  13404. this.menu.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction);
  13405. };
  13406. MDCSelect.prototype.destroy = function () {
  13407. this.selectAnchor.removeEventListener('change', this.handleChange);
  13408. this.selectAnchor.removeEventListener('focus', this.handleFocus);
  13409. this.selectAnchor.removeEventListener('blur', this.handleBlur);
  13410. this.selectAnchor.removeEventListener('keydown', this.handleKeydown);
  13411. this.selectAnchor.removeEventListener('click', this.handleClick);
  13412. this.menu.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed);
  13413. this.menu.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened);
  13414. this.menu.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction);
  13415. this.menu.destroy();
  13416. if (this.ripple) {
  13417. this.ripple.destroy();
  13418. }
  13419. if (this.outline) {
  13420. this.outline.destroy();
  13421. }
  13422. if (this.leadingIcon) {
  13423. this.leadingIcon.destroy();
  13424. }
  13425. if (this.helperText) {
  13426. this.helperText.destroy();
  13427. }
  13428. _super.prototype.destroy.call(this);
  13429. };
  13430. Object.defineProperty(MDCSelect.prototype, "value", {
  13431. get: function get() {
  13432. return this.foundation.getValue();
  13433. },
  13434. set: function set(value) {
  13435. this.foundation.setValue(value);
  13436. },
  13437. enumerable: true,
  13438. configurable: true
  13439. });
  13440. Object.defineProperty(MDCSelect.prototype, "selectedIndex", {
  13441. get: function get() {
  13442. return this.foundation.getSelectedIndex();
  13443. },
  13444. set: function set(selectedIndex) {
  13445. this.foundation.setSelectedIndex(selectedIndex, /** closeMenu */true);
  13446. },
  13447. enumerable: true,
  13448. configurable: true
  13449. });
  13450. Object.defineProperty(MDCSelect.prototype, "disabled", {
  13451. get: function get() {
  13452. return this.foundation.getDisabled();
  13453. },
  13454. set: function set(disabled) {
  13455. this.foundation.setDisabled(disabled);
  13456. },
  13457. enumerable: true,
  13458. configurable: true
  13459. });
  13460. Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", {
  13461. set: function set(label) {
  13462. this.foundation.setLeadingIconAriaLabel(label);
  13463. },
  13464. enumerable: true,
  13465. configurable: true
  13466. });
  13467. Object.defineProperty(MDCSelect.prototype, "leadingIconContent", {
  13468. /**
  13469. * Sets the text content of the leading icon.
  13470. */
  13471. set: function set(content) {
  13472. this.foundation.setLeadingIconContent(content);
  13473. },
  13474. enumerable: true,
  13475. configurable: true
  13476. });
  13477. Object.defineProperty(MDCSelect.prototype, "helperTextContent", {
  13478. /**
  13479. * Sets the text content of the helper text.
  13480. */
  13481. set: function set(content) {
  13482. this.foundation.setHelperTextContent(content);
  13483. },
  13484. enumerable: true,
  13485. configurable: true
  13486. });
  13487. Object.defineProperty(MDCSelect.prototype, "useDefaultValidation", {
  13488. /**
  13489. * Enables or disables the default validation scheme where a required select
  13490. * must be non-empty. Set to false for custom validation.
  13491. * @param useDefaultValidation Set this to false to ignore default
  13492. * validation scheme.
  13493. */
  13494. set: function set(useDefaultValidation) {
  13495. this.foundation.setUseDefaultValidation(useDefaultValidation);
  13496. },
  13497. enumerable: true,
  13498. configurable: true
  13499. });
  13500. Object.defineProperty(MDCSelect.prototype, "valid", {
  13501. /**
  13502. * Checks if the select is in a valid state.
  13503. */
  13504. get: function get() {
  13505. return this.foundation.isValid();
  13506. },
  13507. /**
  13508. * Sets the current invalid state of the select.
  13509. */
  13510. set: function set(isValid) {
  13511. this.foundation.setValid(isValid);
  13512. },
  13513. enumerable: true,
  13514. configurable: true
  13515. });
  13516. Object.defineProperty(MDCSelect.prototype, "required", {
  13517. /**
  13518. * Returns whether the select is required.
  13519. */
  13520. get: function get() {
  13521. return this.foundation.getRequired();
  13522. },
  13523. /**
  13524. * Sets the control to the required state.
  13525. */
  13526. set: function set(isRequired) {
  13527. this.foundation.setRequired(isRequired);
  13528. },
  13529. enumerable: true,
  13530. configurable: true
  13531. });
  13532. /**
  13533. * Re-calculates if the notched outline should be notched and if the label
  13534. * should float.
  13535. */
  13536. MDCSelect.prototype.layout = function () {
  13537. this.foundation.layout();
  13538. };
  13539. /**
  13540. * Synchronizes the list of options with the state of the foundation. Call
  13541. * this whenever menu options are dynamically updated.
  13542. */
  13543. MDCSelect.prototype.layoutOptions = function () {
  13544. this.foundation.layoutOptions();
  13545. this.menu.layout();
  13546. };
  13547. MDCSelect.prototype.getDefaultFoundation = function () {
  13548. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13549. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13550. var adapter = __assign(__assign(__assign(__assign({}, this.getSelectAdapterMethods()), this.getCommonAdapterMethods()), this.getOutlineAdapterMethods()), this.getLabelAdapterMethods());
  13551. return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap());
  13552. };
  13553. /**
  13554. * Handles setup for the menu.
  13555. */
  13556. MDCSelect.prototype.menuSetup = function (menuFactory) {
  13557. this.menuElement = this.root.querySelector(constants_1.strings.MENU_SELECTOR);
  13558. this.menu = menuFactory(this.menuElement);
  13559. this.menu.hasTypeahead = true;
  13560. };
  13561. MDCSelect.prototype.createRipple = function () {
  13562. var _this = this;
  13563. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13564. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13565. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13566. var adapter = __assign(__assign({}, component_6.MDCRipple.createAdapter({ root: this.selectAnchor })), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  13567. _this.selectAnchor.addEventListener(evtType, handler);
  13568. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  13569. _this.selectAnchor.removeEventListener(evtType, handler);
  13570. } });
  13571. // tslint:enable:object-literal-sort-keys
  13572. return new component_6.MDCRipple(this.selectAnchor, new foundation_1.MDCRippleFoundation(adapter));
  13573. };
  13574. MDCSelect.prototype.getSelectAdapterMethods = function () {
  13575. var _this = this;
  13576. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13577. return {
  13578. getSelectedMenuItem: function getSelectedMenuItem() {
  13579. return _this.menuElement.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  13580. },
  13581. getMenuItemAttr: function getMenuItemAttr(menuItem, attr) {
  13582. return menuItem.getAttribute(attr);
  13583. },
  13584. setSelectedText: function setSelectedText(text) {
  13585. _this.selectedText.textContent = text;
  13586. },
  13587. isSelectAnchorFocused: function isSelectAnchorFocused() {
  13588. return document.activeElement === _this.selectAnchor;
  13589. },
  13590. getSelectAnchorAttr: function getSelectAnchorAttr(attr) {
  13591. return _this.selectAnchor.getAttribute(attr);
  13592. },
  13593. setSelectAnchorAttr: function setSelectAnchorAttr(attr, value) {
  13594. _this.selectAnchor.setAttribute(attr, value);
  13595. },
  13596. removeSelectAnchorAttr: function removeSelectAnchorAttr(attr) {
  13597. _this.selectAnchor.removeAttribute(attr);
  13598. },
  13599. addMenuClass: function addMenuClass(className) {
  13600. _this.menuElement.classList.add(className);
  13601. },
  13602. removeMenuClass: function removeMenuClass(className) {
  13603. _this.menuElement.classList.remove(className);
  13604. },
  13605. openMenu: function openMenu() {
  13606. _this.menu.open = true;
  13607. },
  13608. closeMenu: function closeMenu() {
  13609. _this.menu.open = false;
  13610. },
  13611. getAnchorElement: function getAnchorElement() {
  13612. return _this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR);
  13613. },
  13614. setMenuAnchorElement: function setMenuAnchorElement(anchorEl) {
  13615. _this.menu.setAnchorElement(anchorEl);
  13616. },
  13617. setMenuAnchorCorner: function setMenuAnchorCorner(anchorCorner) {
  13618. _this.menu.setAnchorCorner(anchorCorner);
  13619. },
  13620. setMenuWrapFocus: function setMenuWrapFocus(wrapFocus) {
  13621. _this.menu.wrapFocus = wrapFocus;
  13622. },
  13623. setAttributeAtIndex: function setAttributeAtIndex(index, attributeName, attributeValue) {
  13624. _this.menu.items[index].setAttribute(attributeName, attributeValue);
  13625. },
  13626. removeAttributeAtIndex: function removeAttributeAtIndex(index, attributeName) {
  13627. _this.menu.items[index].removeAttribute(attributeName);
  13628. },
  13629. focusMenuItemAtIndex: function focusMenuItemAtIndex(index) {
  13630. _this.menu.items[index].focus();
  13631. },
  13632. getMenuItemCount: function getMenuItemCount() {
  13633. return _this.menu.items.length;
  13634. },
  13635. getMenuItemValues: function getMenuItemValues() {
  13636. return _this.menu.items.map(function (el) {
  13637. return el.getAttribute(constants_1.strings.VALUE_ATTR) || '';
  13638. });
  13639. },
  13640. getMenuItemTextAtIndex: function getMenuItemTextAtIndex(index) {
  13641. return _this.menu.getPrimaryTextAtIndex(index);
  13642. },
  13643. addClassAtIndex: function addClassAtIndex(index, className) {
  13644. _this.menu.items[index].classList.add(className);
  13645. },
  13646. removeClassAtIndex: function removeClassAtIndex(index, className) {
  13647. _this.menu.items[index].classList.remove(className);
  13648. },
  13649. isTypeaheadInProgress: function isTypeaheadInProgress() {
  13650. return _this.menu.typeaheadInProgress;
  13651. },
  13652. typeaheadMatchItem: function typeaheadMatchItem(nextChar, startingIndex) {
  13653. return _this.menu.typeaheadMatchItem(nextChar, startingIndex);
  13654. }
  13655. };
  13656. // tslint:enable:object-literal-sort-keys
  13657. };
  13658. MDCSelect.prototype.getCommonAdapterMethods = function () {
  13659. var _this = this;
  13660. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13661. return {
  13662. addClass: function addClass(className) {
  13663. _this.root.classList.add(className);
  13664. },
  13665. removeClass: function removeClass(className) {
  13666. _this.root.classList.remove(className);
  13667. },
  13668. hasClass: function hasClass(className) {
  13669. return _this.root.classList.contains(className);
  13670. },
  13671. setRippleCenter: function setRippleCenter(normalizedX) {
  13672. _this.lineRipple && _this.lineRipple.setRippleCenter(normalizedX);
  13673. },
  13674. activateBottomLine: function activateBottomLine() {
  13675. _this.lineRipple && _this.lineRipple.activate();
  13676. },
  13677. deactivateBottomLine: function deactivateBottomLine() {
  13678. _this.lineRipple && _this.lineRipple.deactivate();
  13679. },
  13680. notifyChange: function notifyChange(value) {
  13681. var index = _this.selectedIndex;
  13682. _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */);
  13683. }
  13684. };
  13685. // tslint:enable:object-literal-sort-keys
  13686. };
  13687. MDCSelect.prototype.getOutlineAdapterMethods = function () {
  13688. var _this = this;
  13689. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13690. return {
  13691. hasOutline: function hasOutline() {
  13692. return Boolean(_this.outline);
  13693. },
  13694. notchOutline: function notchOutline(labelWidth) {
  13695. _this.outline && _this.outline.notch(labelWidth);
  13696. },
  13697. closeOutline: function closeOutline() {
  13698. _this.outline && _this.outline.closeNotch();
  13699. }
  13700. };
  13701. // tslint:enable:object-literal-sort-keys
  13702. };
  13703. MDCSelect.prototype.getLabelAdapterMethods = function () {
  13704. var _this = this;
  13705. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13706. return {
  13707. hasLabel: function hasLabel() {
  13708. return !!_this.label;
  13709. },
  13710. floatLabel: function floatLabel(shouldFloat) {
  13711. _this.label && _this.label.float(shouldFloat);
  13712. },
  13713. getLabelWidth: function getLabelWidth() {
  13714. return _this.label ? _this.label.getWidth() : 0;
  13715. },
  13716. setLabelRequired: function setLabelRequired(isRequired) {
  13717. _this.label && _this.label.setRequired(isRequired);
  13718. }
  13719. };
  13720. // tslint:enable:object-literal-sort-keys
  13721. };
  13722. /**
  13723. * Calculates where the line ripple should start based on the x coordinate within the component.
  13724. */
  13725. MDCSelect.prototype.getNormalizedXCoordinate = function (evt) {
  13726. var targetClientRect = evt.target.getBoundingClientRect();
  13727. var xCoordinate = this.isTouchEvent(evt) ? evt.touches[0].clientX : evt.clientX;
  13728. return xCoordinate - targetClientRect.left;
  13729. };
  13730. MDCSelect.prototype.isTouchEvent = function (evt) {
  13731. return Boolean(evt.touches);
  13732. };
  13733. /**
  13734. * Returns a map of all subcomponents to subfoundations.
  13735. */
  13736. MDCSelect.prototype.getFoundationMap = function () {
  13737. return {
  13738. helperText: this.helperText ? this.helperText.foundationForSelect : undefined,
  13739. leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForSelect : undefined
  13740. };
  13741. };
  13742. return MDCSelect;
  13743. }(component_1.MDCComponent);
  13744. exports.MDCSelect = MDCSelect;
  13745. /***/ }),
  13746. /***/ "./packages/mdc-select/constants.ts":
  13747. /*!******************************************!*\
  13748. !*** ./packages/mdc-select/constants.ts ***!
  13749. \******************************************/
  13750. /*! no static exports found */
  13751. /***/ (function(module, exports, __webpack_require__) {
  13752. "use strict";
  13753. /**
  13754. * @license
  13755. * Copyright 2016 Google Inc.
  13756. *
  13757. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13758. * of this software and associated documentation files (the "Software"), to deal
  13759. * in the Software without restriction, including without limitation the rights
  13760. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13761. * copies of the Software, and to permit persons to whom the Software is
  13762. * furnished to do so, subject to the following conditions:
  13763. *
  13764. * The above copyright notice and this permission notice shall be included in
  13765. * all copies or substantial portions of the Software.
  13766. *
  13767. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13768. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13769. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13770. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13771. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13772. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13773. * THE SOFTWARE.
  13774. */
  13775. Object.defineProperty(exports, "__esModule", { value: true });
  13776. var cssClasses = {
  13777. ACTIVATED: 'mdc-select--activated',
  13778. DISABLED: 'mdc-select--disabled',
  13779. FOCUSED: 'mdc-select--focused',
  13780. INVALID: 'mdc-select--invalid',
  13781. MENU_INVALID: 'mdc-select__menu--invalid',
  13782. OUTLINED: 'mdc-select--outlined',
  13783. REQUIRED: 'mdc-select--required',
  13784. ROOT: 'mdc-select',
  13785. SELECTED_ITEM_CLASS: 'mdc-list-item--selected',
  13786. WITH_LEADING_ICON: 'mdc-select--with-leading-icon'
  13787. };
  13788. exports.cssClasses = cssClasses;
  13789. var strings = {
  13790. ARIA_CONTROLS: 'aria-controls',
  13791. ARIA_SELECTED_ATTR: 'aria-selected',
  13792. CHANGE_EVENT: 'MDCSelect:change',
  13793. LABEL_SELECTOR: '.mdc-floating-label',
  13794. LEADING_ICON_SELECTOR: '.mdc-select__icon',
  13795. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  13796. MENU_SELECTOR: '.mdc-select__menu',
  13797. OUTLINE_SELECTOR: '.mdc-notched-outline',
  13798. SELECTED_ITEM_SELECTOR: "." + cssClasses.SELECTED_ITEM_CLASS,
  13799. SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text',
  13800. SELECT_ANCHOR_SELECTOR: '.mdc-select__anchor',
  13801. VALUE_ATTR: 'data-value'
  13802. };
  13803. exports.strings = strings;
  13804. var numbers = {
  13805. LABEL_SCALE: 0.75,
  13806. UNSET_INDEX: -1
  13807. };
  13808. exports.numbers = numbers;
  13809. /***/ }),
  13810. /***/ "./packages/mdc-select/foundation.ts":
  13811. /*!*******************************************!*\
  13812. !*** ./packages/mdc-select/foundation.ts ***!
  13813. \*******************************************/
  13814. /*! no static exports found */
  13815. /***/ (function(module, exports, __webpack_require__) {
  13816. "use strict";
  13817. /**
  13818. * @license
  13819. * Copyright 2016 Google Inc.
  13820. *
  13821. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13822. * of this software and associated documentation files (the "Software"), to deal
  13823. * in the Software without restriction, including without limitation the rights
  13824. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13825. * copies of the Software, and to permit persons to whom the Software is
  13826. * furnished to do so, subject to the following conditions:
  13827. *
  13828. * The above copyright notice and this permission notice shall be included in
  13829. * all copies or substantial portions of the Software.
  13830. *
  13831. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13832. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13833. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13834. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13835. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13836. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13837. * THE SOFTWARE.
  13838. */
  13839. var __extends = this && this.__extends || function () {
  13840. var _extendStatics = function extendStatics(d, b) {
  13841. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13842. d.__proto__ = b;
  13843. } || function (d, b) {
  13844. for (var p in b) {
  13845. if (b.hasOwnProperty(p)) d[p] = b[p];
  13846. }
  13847. };
  13848. return _extendStatics(d, b);
  13849. };
  13850. return function (d, b) {
  13851. _extendStatics(d, b);
  13852. function __() {
  13853. this.constructor = d;
  13854. }
  13855. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13856. };
  13857. }();
  13858. var __assign = this && this.__assign || function () {
  13859. __assign = Object.assign || function (t) {
  13860. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13861. s = arguments[i];
  13862. for (var p in s) {
  13863. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13864. }
  13865. }
  13866. return t;
  13867. };
  13868. return __assign.apply(this, arguments);
  13869. };
  13870. Object.defineProperty(exports, "__esModule", { value: true });
  13871. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  13872. var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts");
  13873. var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts");
  13874. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  13875. var MDCSelectFoundation = /** @class */function (_super) {
  13876. __extends(MDCSelectFoundation, _super);
  13877. /* istanbul ignore next: optional argument is not a branch statement */
  13878. /**
  13879. * @param adapter
  13880. * @param foundationMap Map from subcomponent names to their subfoundations.
  13881. */
  13882. function MDCSelectFoundation(adapter, foundationMap) {
  13883. if (foundationMap === void 0) {
  13884. foundationMap = {};
  13885. }
  13886. var _this = _super.call(this, __assign(__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this;
  13887. // Index of the currently selected menu item.
  13888. _this.selectedIndex = constants_2.numbers.UNSET_INDEX;
  13889. // VALUE_ATTR values of the menu items.
  13890. _this.menuItemValues = [];
  13891. // Disabled state
  13892. _this.disabled = false;
  13893. // isMenuOpen is used to track the state of the menu by listening to the
  13894. // MDCMenuSurface:closed event For reference, menu.open will return false if
  13895. // the menu is still closing, but isMenuOpen returns false only after the menu
  13896. // has closed
  13897. _this.isMenuOpen = false;
  13898. // By default, select is invalid if it is required but no value is selected.
  13899. _this.useDefaultValidation = true;
  13900. _this.customValidity = true;
  13901. _this.leadingIcon = foundationMap.leadingIcon;
  13902. _this.helperText = foundationMap.helperText;
  13903. return _this;
  13904. }
  13905. Object.defineProperty(MDCSelectFoundation, "cssClasses", {
  13906. get: function get() {
  13907. return constants_2.cssClasses;
  13908. },
  13909. enumerable: true,
  13910. configurable: true
  13911. });
  13912. Object.defineProperty(MDCSelectFoundation, "numbers", {
  13913. get: function get() {
  13914. return constants_2.numbers;
  13915. },
  13916. enumerable: true,
  13917. configurable: true
  13918. });
  13919. Object.defineProperty(MDCSelectFoundation, "strings", {
  13920. get: function get() {
  13921. return constants_2.strings;
  13922. },
  13923. enumerable: true,
  13924. configurable: true
  13925. });
  13926. Object.defineProperty(MDCSelectFoundation, "defaultAdapter", {
  13927. /**
  13928. * See {@link MDCSelectAdapter} for typing information on parameters and return types.
  13929. */
  13930. get: function get() {
  13931. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13932. return {
  13933. addClass: function addClass() {
  13934. return undefined;
  13935. },
  13936. removeClass: function removeClass() {
  13937. return undefined;
  13938. },
  13939. hasClass: function hasClass() {
  13940. return false;
  13941. },
  13942. activateBottomLine: function activateBottomLine() {
  13943. return undefined;
  13944. },
  13945. deactivateBottomLine: function deactivateBottomLine() {
  13946. return undefined;
  13947. },
  13948. getSelectedMenuItem: function getSelectedMenuItem() {
  13949. return null;
  13950. },
  13951. hasLabel: function hasLabel() {
  13952. return false;
  13953. },
  13954. floatLabel: function floatLabel() {
  13955. return undefined;
  13956. },
  13957. getLabelWidth: function getLabelWidth() {
  13958. return 0;
  13959. },
  13960. setLabelRequired: function setLabelRequired() {
  13961. return undefined;
  13962. },
  13963. hasOutline: function hasOutline() {
  13964. return false;
  13965. },
  13966. notchOutline: function notchOutline() {
  13967. return undefined;
  13968. },
  13969. closeOutline: function closeOutline() {
  13970. return undefined;
  13971. },
  13972. setRippleCenter: function setRippleCenter() {
  13973. return undefined;
  13974. },
  13975. notifyChange: function notifyChange() {
  13976. return undefined;
  13977. },
  13978. setSelectedText: function setSelectedText() {
  13979. return undefined;
  13980. },
  13981. isSelectAnchorFocused: function isSelectAnchorFocused() {
  13982. return false;
  13983. },
  13984. getSelectAnchorAttr: function getSelectAnchorAttr() {
  13985. return '';
  13986. },
  13987. setSelectAnchorAttr: function setSelectAnchorAttr() {
  13988. return undefined;
  13989. },
  13990. removeSelectAnchorAttr: function removeSelectAnchorAttr() {
  13991. return undefined;
  13992. },
  13993. addMenuClass: function addMenuClass() {
  13994. return undefined;
  13995. },
  13996. removeMenuClass: function removeMenuClass() {
  13997. return undefined;
  13998. },
  13999. openMenu: function openMenu() {
  14000. return undefined;
  14001. },
  14002. closeMenu: function closeMenu() {
  14003. return undefined;
  14004. },
  14005. getAnchorElement: function getAnchorElement() {
  14006. return null;
  14007. },
  14008. setMenuAnchorElement: function setMenuAnchorElement() {
  14009. return undefined;
  14010. },
  14011. setMenuAnchorCorner: function setMenuAnchorCorner() {
  14012. return undefined;
  14013. },
  14014. setMenuWrapFocus: function setMenuWrapFocus() {
  14015. return undefined;
  14016. },
  14017. setAttributeAtIndex: function setAttributeAtIndex() {
  14018. return undefined;
  14019. },
  14020. focusMenuItemAtIndex: function focusMenuItemAtIndex() {
  14021. return undefined;
  14022. },
  14023. getMenuItemCount: function getMenuItemCount() {
  14024. return 0;
  14025. },
  14026. getMenuItemValues: function getMenuItemValues() {
  14027. return [];
  14028. },
  14029. getMenuItemTextAtIndex: function getMenuItemTextAtIndex() {
  14030. return '';
  14031. },
  14032. getMenuItemAttr: function getMenuItemAttr() {
  14033. return '';
  14034. },
  14035. addClassAtIndex: function addClassAtIndex() {
  14036. return undefined;
  14037. },
  14038. removeClassAtIndex: function removeClassAtIndex() {
  14039. return undefined;
  14040. },
  14041. isTypeaheadInProgress: function isTypeaheadInProgress() {
  14042. return false;
  14043. },
  14044. typeaheadMatchItem: function typeaheadMatchItem() {
  14045. return -1;
  14046. }
  14047. };
  14048. // tslint:enable:object-literal-sort-keys
  14049. },
  14050. enumerable: true,
  14051. configurable: true
  14052. });
  14053. /** Returns the index of the currently selected menu item, or -1 if none. */
  14054. MDCSelectFoundation.prototype.getSelectedIndex = function () {
  14055. return this.selectedIndex;
  14056. };
  14057. MDCSelectFoundation.prototype.setSelectedIndex = function (index, closeMenu) {
  14058. if (closeMenu === void 0) {
  14059. closeMenu = false;
  14060. }
  14061. if (index >= this.adapter.getMenuItemCount()) {
  14062. return;
  14063. }
  14064. this.removeSelectionAtIndex(this.selectedIndex);
  14065. this.setSelectionAtIndex(index);
  14066. if (closeMenu) {
  14067. this.adapter.closeMenu();
  14068. }
  14069. this.handleChange();
  14070. };
  14071. MDCSelectFoundation.prototype.setValue = function (value) {
  14072. var index = this.menuItemValues.indexOf(value);
  14073. this.setSelectedIndex(index);
  14074. };
  14075. MDCSelectFoundation.prototype.getValue = function () {
  14076. var listItem = this.adapter.getSelectedMenuItem();
  14077. if (listItem) {
  14078. return this.adapter.getMenuItemAttr(listItem, constants_2.strings.VALUE_ATTR) || '';
  14079. }
  14080. return '';
  14081. };
  14082. MDCSelectFoundation.prototype.getDisabled = function () {
  14083. return this.disabled;
  14084. };
  14085. MDCSelectFoundation.prototype.setDisabled = function (isDisabled) {
  14086. this.disabled = isDisabled;
  14087. if (this.disabled) {
  14088. this.adapter.addClass(constants_2.cssClasses.DISABLED);
  14089. this.adapter.closeMenu();
  14090. } else {
  14091. this.adapter.removeClass(constants_2.cssClasses.DISABLED);
  14092. }
  14093. if (this.leadingIcon) {
  14094. this.leadingIcon.setDisabled(this.disabled);
  14095. }
  14096. if (this.disabled) {
  14097. // Prevent click events from focusing select. Simply pointer-events: none
  14098. // is not enough since screenreader clicks may bypass this.
  14099. this.adapter.removeSelectAnchorAttr('tabindex');
  14100. } else {
  14101. this.adapter.setSelectAnchorAttr('tabindex', '0');
  14102. }
  14103. this.adapter.setSelectAnchorAttr('aria-disabled', this.disabled.toString());
  14104. };
  14105. /** Opens the menu. */
  14106. MDCSelectFoundation.prototype.openMenu = function () {
  14107. this.adapter.addClass(constants_2.cssClasses.ACTIVATED);
  14108. this.adapter.openMenu();
  14109. this.isMenuOpen = true;
  14110. this.adapter.setSelectAnchorAttr('aria-expanded', 'true');
  14111. };
  14112. /**
  14113. * @param content Sets the content of the helper text.
  14114. */
  14115. MDCSelectFoundation.prototype.setHelperTextContent = function (content) {
  14116. if (this.helperText) {
  14117. this.helperText.setContent(content);
  14118. }
  14119. };
  14120. /**
  14121. * Re-calculates if the notched outline should be notched and if the label
  14122. * should float.
  14123. */
  14124. MDCSelectFoundation.prototype.layout = function () {
  14125. if (this.adapter.hasLabel()) {
  14126. var optionHasValue = this.getValue().length > 0;
  14127. var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED);
  14128. var shouldFloatAndNotch = optionHasValue || isFocused;
  14129. var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED);
  14130. this.notchOutline(shouldFloatAndNotch);
  14131. this.adapter.floatLabel(shouldFloatAndNotch);
  14132. this.adapter.setLabelRequired(isRequired);
  14133. }
  14134. };
  14135. /**
  14136. * Synchronizes the list of options with the state of the foundation. Call
  14137. * this whenever menu options are dynamically updated.
  14138. */
  14139. MDCSelectFoundation.prototype.layoutOptions = function () {
  14140. this.menuItemValues = this.adapter.getMenuItemValues();
  14141. var selectedIndex = this.menuItemValues.indexOf(this.getValue());
  14142. this.setSelectionAtIndex(selectedIndex);
  14143. };
  14144. MDCSelectFoundation.prototype.handleMenuOpened = function () {
  14145. if (this.menuItemValues.length === 0) {
  14146. return;
  14147. }
  14148. // Menu should open to the last selected element, should open to first menu item otherwise.
  14149. var focusItemIndex = this.selectedIndex >= 0 ? this.selectedIndex : 0;
  14150. this.adapter.focusMenuItemAtIndex(focusItemIndex);
  14151. };
  14152. MDCSelectFoundation.prototype.handleMenuClosed = function () {
  14153. this.adapter.removeClass(constants_2.cssClasses.ACTIVATED);
  14154. this.isMenuOpen = false;
  14155. this.adapter.setSelectAnchorAttr('aria-expanded', 'false');
  14156. // Unfocus the select if menu is closed without a selection
  14157. if (!this.adapter.isSelectAnchorFocused()) {
  14158. this.blur();
  14159. }
  14160. };
  14161. /**
  14162. * Handles value changes, via change event or programmatic updates.
  14163. */
  14164. MDCSelectFoundation.prototype.handleChange = function () {
  14165. this.layout();
  14166. this.adapter.notifyChange(this.getValue());
  14167. var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED);
  14168. if (isRequired && this.useDefaultValidation) {
  14169. this.setValid(this.isValid());
  14170. if (this.helperText) {
  14171. this.helperText.setValidity(this.isValid());
  14172. }
  14173. }
  14174. };
  14175. MDCSelectFoundation.prototype.handleMenuItemAction = function (index) {
  14176. this.setSelectedIndex(index, /** closeMenu */true);
  14177. };
  14178. /**
  14179. * Handles focus events from select element.
  14180. */
  14181. MDCSelectFoundation.prototype.handleFocus = function () {
  14182. this.adapter.addClass(constants_2.cssClasses.FOCUSED);
  14183. this.layout();
  14184. this.adapter.activateBottomLine();
  14185. };
  14186. /**
  14187. * Handles blur events from select element.
  14188. */
  14189. MDCSelectFoundation.prototype.handleBlur = function () {
  14190. if (this.isMenuOpen) {
  14191. return;
  14192. }
  14193. this.blur();
  14194. };
  14195. MDCSelectFoundation.prototype.handleClick = function (normalizedX) {
  14196. if (this.disabled) {
  14197. return;
  14198. }
  14199. if (this.isMenuOpen) {
  14200. this.adapter.closeMenu();
  14201. return;
  14202. }
  14203. this.adapter.setRippleCenter(normalizedX);
  14204. this.openMenu();
  14205. };
  14206. /**
  14207. * Handles keydown events on select element. Depending on the type of
  14208. * character typed, does typeahead matching or opens menu.
  14209. */
  14210. MDCSelectFoundation.prototype.handleKeydown = function (event) {
  14211. if (this.isMenuOpen || !this.adapter.hasClass(constants_2.cssClasses.FOCUSED)) {
  14212. return;
  14213. }
  14214. var isEnter = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ENTER;
  14215. var isSpace = keyboard_1.normalizeKey(event) === keyboard_1.KEY.SPACEBAR;
  14216. var arrowUp = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_UP;
  14217. var arrowDown = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_DOWN;
  14218. // Typeahead
  14219. if (!isSpace && event.key && event.key.length === 1 || isSpace && this.adapter.isTypeaheadInProgress()) {
  14220. var key = isSpace ? ' ' : event.key;
  14221. var typeaheadNextIndex = this.adapter.typeaheadMatchItem(key, this.selectedIndex);
  14222. if (typeaheadNextIndex >= 0) {
  14223. this.setSelectedIndex(typeaheadNextIndex);
  14224. }
  14225. event.preventDefault();
  14226. return;
  14227. }
  14228. if (!isEnter && !isSpace && !arrowUp && !arrowDown) {
  14229. return;
  14230. }
  14231. // Increment/decrement index as necessary and open menu.
  14232. if (arrowUp && this.selectedIndex > 0) {
  14233. this.setSelectedIndex(this.selectedIndex - 1);
  14234. } else if (arrowDown && this.selectedIndex < this.adapter.getMenuItemCount() - 1) {
  14235. this.setSelectedIndex(this.selectedIndex + 1);
  14236. }
  14237. this.openMenu();
  14238. event.preventDefault();
  14239. };
  14240. /**
  14241. * Opens/closes the notched outline.
  14242. */
  14243. MDCSelectFoundation.prototype.notchOutline = function (openNotch) {
  14244. if (!this.adapter.hasOutline()) {
  14245. return;
  14246. }
  14247. var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED);
  14248. if (openNotch) {
  14249. var labelScale = constants_2.numbers.LABEL_SCALE;
  14250. var labelWidth = this.adapter.getLabelWidth() * labelScale;
  14251. this.adapter.notchOutline(labelWidth);
  14252. } else if (!isFocused) {
  14253. this.adapter.closeOutline();
  14254. }
  14255. };
  14256. /**
  14257. * Sets the aria label of the leading icon.
  14258. */
  14259. MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  14260. if (this.leadingIcon) {
  14261. this.leadingIcon.setAriaLabel(label);
  14262. }
  14263. };
  14264. /**
  14265. * Sets the text content of the leading icon.
  14266. */
  14267. MDCSelectFoundation.prototype.setLeadingIconContent = function (content) {
  14268. if (this.leadingIcon) {
  14269. this.leadingIcon.setContent(content);
  14270. }
  14271. };
  14272. MDCSelectFoundation.prototype.setUseDefaultValidation = function (useDefaultValidation) {
  14273. this.useDefaultValidation = useDefaultValidation;
  14274. };
  14275. MDCSelectFoundation.prototype.setValid = function (isValid) {
  14276. if (!this.useDefaultValidation) {
  14277. this.customValidity = isValid;
  14278. }
  14279. this.adapter.setSelectAnchorAttr('aria-invalid', (!isValid).toString());
  14280. if (isValid) {
  14281. this.adapter.removeClass(constants_2.cssClasses.INVALID);
  14282. this.adapter.removeMenuClass(constants_2.cssClasses.MENU_INVALID);
  14283. } else {
  14284. this.adapter.addClass(constants_2.cssClasses.INVALID);
  14285. this.adapter.addMenuClass(constants_2.cssClasses.MENU_INVALID);
  14286. }
  14287. };
  14288. MDCSelectFoundation.prototype.isValid = function () {
  14289. if (this.useDefaultValidation && this.adapter.hasClass(constants_2.cssClasses.REQUIRED) && !this.adapter.hasClass(constants_2.cssClasses.DISABLED)) {
  14290. // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element
  14291. // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value.
  14292. return this.selectedIndex !== constants_2.numbers.UNSET_INDEX && (this.selectedIndex !== 0 || Boolean(this.getValue()));
  14293. }
  14294. return this.customValidity;
  14295. };
  14296. MDCSelectFoundation.prototype.setRequired = function (isRequired) {
  14297. if (isRequired) {
  14298. this.adapter.addClass(constants_2.cssClasses.REQUIRED);
  14299. } else {
  14300. this.adapter.removeClass(constants_2.cssClasses.REQUIRED);
  14301. }
  14302. this.adapter.setSelectAnchorAttr('aria-required', isRequired.toString());
  14303. this.adapter.setLabelRequired(isRequired);
  14304. };
  14305. MDCSelectFoundation.prototype.getRequired = function () {
  14306. return this.adapter.getSelectAnchorAttr('aria-required') === 'true';
  14307. };
  14308. MDCSelectFoundation.prototype.init = function () {
  14309. var anchorEl = this.adapter.getAnchorElement();
  14310. if (anchorEl) {
  14311. this.adapter.setMenuAnchorElement(anchorEl);
  14312. this.adapter.setMenuAnchorCorner(constants_1.Corner.BOTTOM_START);
  14313. }
  14314. this.adapter.setMenuWrapFocus(false);
  14315. this.setDisabled(this.adapter.hasClass(constants_2.cssClasses.DISABLED));
  14316. this.layoutOptions();
  14317. this.layout();
  14318. };
  14319. /**
  14320. * Unfocuses the select component.
  14321. */
  14322. MDCSelectFoundation.prototype.blur = function () {
  14323. this.adapter.removeClass(constants_2.cssClasses.FOCUSED);
  14324. this.layout();
  14325. this.adapter.deactivateBottomLine();
  14326. var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED);
  14327. if (isRequired && this.useDefaultValidation) {
  14328. this.setValid(this.isValid());
  14329. if (this.helperText) {
  14330. this.helperText.setValidity(this.isValid());
  14331. }
  14332. }
  14333. };
  14334. MDCSelectFoundation.prototype.setSelectionAtIndex = function (index) {
  14335. this.selectedIndex = index;
  14336. if (index === constants_2.numbers.UNSET_INDEX) {
  14337. this.adapter.setSelectedText('');
  14338. return;
  14339. }
  14340. this.adapter.setSelectedText(this.adapter.getMenuItemTextAtIndex(index).trim());
  14341. this.adapter.addClassAtIndex(index, constants_2.cssClasses.SELECTED_ITEM_CLASS);
  14342. this.adapter.setAttributeAtIndex(index, constants_2.strings.ARIA_SELECTED_ATTR, 'true');
  14343. };
  14344. MDCSelectFoundation.prototype.removeSelectionAtIndex = function (index) {
  14345. if (index !== constants_2.numbers.UNSET_INDEX) {
  14346. this.adapter.removeClassAtIndex(index, constants_2.cssClasses.SELECTED_ITEM_CLASS);
  14347. this.adapter.setAttributeAtIndex(index, constants_2.strings.ARIA_SELECTED_ATTR, 'false');
  14348. }
  14349. };
  14350. return MDCSelectFoundation;
  14351. }(foundation_1.MDCFoundation);
  14352. exports.MDCSelectFoundation = MDCSelectFoundation;
  14353. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14354. exports.default = MDCSelectFoundation;
  14355. /***/ }),
  14356. /***/ "./packages/mdc-select/helper-text/component.ts":
  14357. /*!******************************************************!*\
  14358. !*** ./packages/mdc-select/helper-text/component.ts ***!
  14359. \******************************************************/
  14360. /*! no static exports found */
  14361. /***/ (function(module, exports, __webpack_require__) {
  14362. "use strict";
  14363. /**
  14364. * @license
  14365. * Copyright 2018 Google Inc.
  14366. *
  14367. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14368. * of this software and associated documentation files (the "Software"), to deal
  14369. * in the Software without restriction, including without limitation the rights
  14370. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14371. * copies of the Software, and to permit persons to whom the Software is
  14372. * furnished to do so, subject to the following conditions:
  14373. *
  14374. * The above copyright notice and this permission notice shall be included in
  14375. * all copies or substantial portions of the Software.
  14376. *
  14377. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14378. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14379. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14380. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14381. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14382. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14383. * THE SOFTWARE.
  14384. */
  14385. var __extends = this && this.__extends || function () {
  14386. var _extendStatics = function extendStatics(d, b) {
  14387. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14388. d.__proto__ = b;
  14389. } || function (d, b) {
  14390. for (var p in b) {
  14391. if (b.hasOwnProperty(p)) d[p] = b[p];
  14392. }
  14393. };
  14394. return _extendStatics(d, b);
  14395. };
  14396. return function (d, b) {
  14397. _extendStatics(d, b);
  14398. function __() {
  14399. this.constructor = d;
  14400. }
  14401. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14402. };
  14403. }();
  14404. Object.defineProperty(exports, "__esModule", { value: true });
  14405. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  14406. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts");
  14407. var MDCSelectHelperText = /** @class */function (_super) {
  14408. __extends(MDCSelectHelperText, _super);
  14409. function MDCSelectHelperText() {
  14410. return _super !== null && _super.apply(this, arguments) || this;
  14411. }
  14412. MDCSelectHelperText.attachTo = function (root) {
  14413. return new MDCSelectHelperText(root);
  14414. };
  14415. Object.defineProperty(MDCSelectHelperText.prototype, "foundationForSelect", {
  14416. // Provided for access by MDCSelect component
  14417. get: function get() {
  14418. return this.foundation;
  14419. },
  14420. enumerable: true,
  14421. configurable: true
  14422. });
  14423. MDCSelectHelperText.prototype.getDefaultFoundation = function () {
  14424. var _this = this;
  14425. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  14426. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  14427. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  14428. var adapter = {
  14429. addClass: function addClass(className) {
  14430. return _this.root.classList.add(className);
  14431. },
  14432. removeClass: function removeClass(className) {
  14433. return _this.root.classList.remove(className);
  14434. },
  14435. hasClass: function hasClass(className) {
  14436. return _this.root.classList.contains(className);
  14437. },
  14438. setAttr: function setAttr(attr, value) {
  14439. return _this.root.setAttribute(attr, value);
  14440. },
  14441. removeAttr: function removeAttr(attr) {
  14442. return _this.root.removeAttribute(attr);
  14443. },
  14444. setContent: function setContent(content) {
  14445. _this.root.textContent = content;
  14446. }
  14447. };
  14448. // tslint:enable:object-literal-sort-keys
  14449. return new foundation_1.MDCSelectHelperTextFoundation(adapter);
  14450. };
  14451. return MDCSelectHelperText;
  14452. }(component_1.MDCComponent);
  14453. exports.MDCSelectHelperText = MDCSelectHelperText;
  14454. /***/ }),
  14455. /***/ "./packages/mdc-select/helper-text/constants.ts":
  14456. /*!******************************************************!*\
  14457. !*** ./packages/mdc-select/helper-text/constants.ts ***!
  14458. \******************************************************/
  14459. /*! no static exports found */
  14460. /***/ (function(module, exports, __webpack_require__) {
  14461. "use strict";
  14462. /**
  14463. * @license
  14464. * Copyright 2018 Google Inc.
  14465. *
  14466. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14467. * of this software and associated documentation files (the "Software"), to deal
  14468. * in the Software without restriction, including without limitation the rights
  14469. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14470. * copies of the Software, and to permit persons to whom the Software is
  14471. * furnished to do so, subject to the following conditions:
  14472. *
  14473. * The above copyright notice and this permission notice shall be included in
  14474. * all copies or substantial portions of the Software.
  14475. *
  14476. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14477. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14478. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14479. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14480. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14481. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14482. * THE SOFTWARE.
  14483. */
  14484. Object.defineProperty(exports, "__esModule", { value: true });
  14485. var strings = {
  14486. ARIA_HIDDEN: 'aria-hidden',
  14487. ROLE: 'role'
  14488. };
  14489. exports.strings = strings;
  14490. var cssClasses = {
  14491. HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg',
  14492. HELPER_TEXT_VALIDATION_MSG_PERSISTENT: 'mdc-select-helper-text--validation-msg-persistent'
  14493. };
  14494. exports.cssClasses = cssClasses;
  14495. /***/ }),
  14496. /***/ "./packages/mdc-select/helper-text/foundation.ts":
  14497. /*!*******************************************************!*\
  14498. !*** ./packages/mdc-select/helper-text/foundation.ts ***!
  14499. \*******************************************************/
  14500. /*! no static exports found */
  14501. /***/ (function(module, exports, __webpack_require__) {
  14502. "use strict";
  14503. /**
  14504. * @license
  14505. * Copyright 2018 Google Inc.
  14506. *
  14507. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14508. * of this software and associated documentation files (the "Software"), to deal
  14509. * in the Software without restriction, including without limitation the rights
  14510. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14511. * copies of the Software, and to permit persons to whom the Software is
  14512. * furnished to do so, subject to the following conditions:
  14513. *
  14514. * The above copyright notice and this permission notice shall be included in
  14515. * all copies or substantial portions of the Software.
  14516. *
  14517. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14518. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14519. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14520. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14521. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14522. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14523. * THE SOFTWARE.
  14524. */
  14525. var __extends = this && this.__extends || function () {
  14526. var _extendStatics = function extendStatics(d, b) {
  14527. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14528. d.__proto__ = b;
  14529. } || function (d, b) {
  14530. for (var p in b) {
  14531. if (b.hasOwnProperty(p)) d[p] = b[p];
  14532. }
  14533. };
  14534. return _extendStatics(d, b);
  14535. };
  14536. return function (d, b) {
  14537. _extendStatics(d, b);
  14538. function __() {
  14539. this.constructor = d;
  14540. }
  14541. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14542. };
  14543. }();
  14544. var __assign = this && this.__assign || function () {
  14545. __assign = Object.assign || function (t) {
  14546. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14547. s = arguments[i];
  14548. for (var p in s) {
  14549. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14550. }
  14551. }
  14552. return t;
  14553. };
  14554. return __assign.apply(this, arguments);
  14555. };
  14556. Object.defineProperty(exports, "__esModule", { value: true });
  14557. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  14558. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  14559. var MDCSelectHelperTextFoundation = /** @class */function (_super) {
  14560. __extends(MDCSelectHelperTextFoundation, _super);
  14561. function MDCSelectHelperTextFoundation(adapter) {
  14562. return _super.call(this, __assign(__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this;
  14563. }
  14564. Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
  14565. get: function get() {
  14566. return constants_1.cssClasses;
  14567. },
  14568. enumerable: true,
  14569. configurable: true
  14570. });
  14571. Object.defineProperty(MDCSelectHelperTextFoundation, "strings", {
  14572. get: function get() {
  14573. return constants_1.strings;
  14574. },
  14575. enumerable: true,
  14576. configurable: true
  14577. });
  14578. Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", {
  14579. /**
  14580. * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types.
  14581. */
  14582. get: function get() {
  14583. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  14584. return {
  14585. addClass: function addClass() {
  14586. return undefined;
  14587. },
  14588. removeClass: function removeClass() {
  14589. return undefined;
  14590. },
  14591. hasClass: function hasClass() {
  14592. return false;
  14593. },
  14594. setAttr: function setAttr() {
  14595. return undefined;
  14596. },
  14597. removeAttr: function removeAttr() {
  14598. return undefined;
  14599. },
  14600. setContent: function setContent() {
  14601. return undefined;
  14602. }
  14603. };
  14604. // tslint:enable:object-literal-sort-keys
  14605. },
  14606. enumerable: true,
  14607. configurable: true
  14608. });
  14609. /**
  14610. * Sets the content of the helper text field.
  14611. */
  14612. MDCSelectHelperTextFoundation.prototype.setContent = function (content) {
  14613. this.adapter.setContent(content);
  14614. };
  14615. /**
  14616. * Sets the helper text to act as a validation message.
  14617. * By default, validation messages are hidden when the select is valid and
  14618. * visible when the select is invalid.
  14619. *
  14620. * @param isValidation True to make the helper text act as an error validation
  14621. * message.
  14622. */
  14623. MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {
  14624. if (isValidation) {
  14625. this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  14626. } else {
  14627. this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  14628. }
  14629. };
  14630. /**
  14631. * Sets the persistency of the validation helper text.
  14632. * This keeps the validation message visible even if the select is valid,
  14633. * though it will be displayed in the normal (grey) color.
  14634. */
  14635. MDCSelectHelperTextFoundation.prototype.setValidationMsgPersistent = function (isPersistent) {
  14636. if (isPersistent) {
  14637. this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
  14638. } else {
  14639. this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
  14640. }
  14641. };
  14642. /**
  14643. * Makes the helper text visible to screen readers.
  14644. */
  14645. MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {
  14646. this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN);
  14647. };
  14648. /**
  14649. * When acting as a validation message, shows/hides the helper text and
  14650. * triggers alerts as necessary based on the select's validity.
  14651. */
  14652. MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {
  14653. var isValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  14654. if (!isValidationMsg) {
  14655. // Non-validating helper-text is always displayed and does not participate
  14656. // in validation logic.
  14657. return;
  14658. }
  14659. var isPersistentValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
  14660. // Validating helper text is displayed if select is invalid, unless it is
  14661. // set as persistent, in which case it always displays.
  14662. var msgShouldDisplay = !selectIsValid || isPersistentValidationMsg;
  14663. if (msgShouldDisplay) {
  14664. this.showToScreenReader();
  14665. // In addition to displaying, also trigger an alert if the select
  14666. // has become invalid.
  14667. if (!selectIsValid) {
  14668. this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
  14669. } else {
  14670. this.adapter.removeAttr(constants_1.strings.ROLE);
  14671. }
  14672. return;
  14673. }
  14674. // Hide everything.
  14675. this.adapter.removeAttr(constants_1.strings.ROLE);
  14676. this.hide();
  14677. };
  14678. /**
  14679. * Hides the help text from screen readers.
  14680. */
  14681. MDCSelectHelperTextFoundation.prototype.hide = function () {
  14682. this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  14683. };
  14684. return MDCSelectHelperTextFoundation;
  14685. }(foundation_1.MDCFoundation);
  14686. exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation;
  14687. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14688. exports.default = MDCSelectHelperTextFoundation;
  14689. /***/ }),
  14690. /***/ "./packages/mdc-select/helper-text/index.ts":
  14691. /*!**************************************************!*\
  14692. !*** ./packages/mdc-select/helper-text/index.ts ***!
  14693. \**************************************************/
  14694. /*! no static exports found */
  14695. /***/ (function(module, exports, __webpack_require__) {
  14696. "use strict";
  14697. /**
  14698. * @license
  14699. * Copyright 2019 Google Inc.
  14700. *
  14701. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14702. * of this software and associated documentation files (the "Software"), to deal
  14703. * in the Software without restriction, including without limitation the rights
  14704. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14705. * copies of the Software, and to permit persons to whom the Software is
  14706. * furnished to do so, subject to the following conditions:
  14707. *
  14708. * The above copyright notice and this permission notice shall be included in
  14709. * all copies or substantial portions of the Software.
  14710. *
  14711. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14712. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14713. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14714. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14715. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14716. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14717. * THE SOFTWARE.
  14718. */
  14719. function __export(m) {
  14720. for (var p in m) {
  14721. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14722. }
  14723. }
  14724. Object.defineProperty(exports, "__esModule", { value: true });
  14725. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/helper-text/component.ts"));
  14726. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"));
  14727. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  14728. exports.helperTextCssClasses = constants_1.cssClasses;
  14729. exports.helperTextStrings = constants_1.strings;
  14730. /***/ }),
  14731. /***/ "./packages/mdc-select/icon/component.ts":
  14732. /*!***********************************************!*\
  14733. !*** ./packages/mdc-select/icon/component.ts ***!
  14734. \***********************************************/
  14735. /*! no static exports found */
  14736. /***/ (function(module, exports, __webpack_require__) {
  14737. "use strict";
  14738. /**
  14739. * @license
  14740. * Copyright 2018 Google Inc.
  14741. *
  14742. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14743. * of this software and associated documentation files (the "Software"), to deal
  14744. * in the Software without restriction, including without limitation the rights
  14745. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14746. * copies of the Software, and to permit persons to whom the Software is
  14747. * furnished to do so, subject to the following conditions:
  14748. *
  14749. * The above copyright notice and this permission notice shall be included in
  14750. * all copies or substantial portions of the Software.
  14751. *
  14752. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14753. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14754. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14755. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14756. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14757. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14758. * THE SOFTWARE.
  14759. */
  14760. var __extends = this && this.__extends || function () {
  14761. var _extendStatics = function extendStatics(d, b) {
  14762. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14763. d.__proto__ = b;
  14764. } || function (d, b) {
  14765. for (var p in b) {
  14766. if (b.hasOwnProperty(p)) d[p] = b[p];
  14767. }
  14768. };
  14769. return _extendStatics(d, b);
  14770. };
  14771. return function (d, b) {
  14772. _extendStatics(d, b);
  14773. function __() {
  14774. this.constructor = d;
  14775. }
  14776. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14777. };
  14778. }();
  14779. Object.defineProperty(exports, "__esModule", { value: true });
  14780. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  14781. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts");
  14782. var MDCSelectIcon = /** @class */function (_super) {
  14783. __extends(MDCSelectIcon, _super);
  14784. function MDCSelectIcon() {
  14785. return _super !== null && _super.apply(this, arguments) || this;
  14786. }
  14787. MDCSelectIcon.attachTo = function (root) {
  14788. return new MDCSelectIcon(root);
  14789. };
  14790. Object.defineProperty(MDCSelectIcon.prototype, "foundationForSelect", {
  14791. // Provided for access by MDCSelect component
  14792. get: function get() {
  14793. return this.foundation;
  14794. },
  14795. enumerable: true,
  14796. configurable: true
  14797. });
  14798. MDCSelectIcon.prototype.getDefaultFoundation = function () {
  14799. var _this = this;
  14800. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  14801. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  14802. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  14803. var adapter = {
  14804. getAttr: function getAttr(attr) {
  14805. return _this.root.getAttribute(attr);
  14806. },
  14807. setAttr: function setAttr(attr, value) {
  14808. return _this.root.setAttribute(attr, value);
  14809. },
  14810. removeAttr: function removeAttr(attr) {
  14811. return _this.root.removeAttribute(attr);
  14812. },
  14813. setContent: function setContent(content) {
  14814. _this.root.textContent = content;
  14815. },
  14816. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  14817. return _this.listen(evtType, handler);
  14818. },
  14819. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  14820. return _this.unlisten(evtType, handler);
  14821. },
  14822. notifyIconAction: function notifyIconAction() {
  14823. return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  14824. }
  14825. };
  14826. // tslint:enable:object-literal-sort-keys
  14827. return new foundation_1.MDCSelectIconFoundation(adapter);
  14828. };
  14829. return MDCSelectIcon;
  14830. }(component_1.MDCComponent);
  14831. exports.MDCSelectIcon = MDCSelectIcon;
  14832. /***/ }),
  14833. /***/ "./packages/mdc-select/icon/constants.ts":
  14834. /*!***********************************************!*\
  14835. !*** ./packages/mdc-select/icon/constants.ts ***!
  14836. \***********************************************/
  14837. /*! no static exports found */
  14838. /***/ (function(module, exports, __webpack_require__) {
  14839. "use strict";
  14840. /**
  14841. * @license
  14842. * Copyright 2018 Google Inc.
  14843. *
  14844. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14845. * of this software and associated documentation files (the "Software"), to deal
  14846. * in the Software without restriction, including without limitation the rights
  14847. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14848. * copies of the Software, and to permit persons to whom the Software is
  14849. * furnished to do so, subject to the following conditions:
  14850. *
  14851. * The above copyright notice and this permission notice shall be included in
  14852. * all copies or substantial portions of the Software.
  14853. *
  14854. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14855. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14856. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14857. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14858. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14859. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14860. * THE SOFTWARE.
  14861. */
  14862. Object.defineProperty(exports, "__esModule", { value: true });
  14863. var strings = {
  14864. ICON_EVENT: 'MDCSelect:icon',
  14865. ICON_ROLE: 'button'
  14866. };
  14867. exports.strings = strings;
  14868. /***/ }),
  14869. /***/ "./packages/mdc-select/icon/foundation.ts":
  14870. /*!************************************************!*\
  14871. !*** ./packages/mdc-select/icon/foundation.ts ***!
  14872. \************************************************/
  14873. /*! no static exports found */
  14874. /***/ (function(module, exports, __webpack_require__) {
  14875. "use strict";
  14876. /**
  14877. * @license
  14878. * Copyright 2018 Google Inc.
  14879. *
  14880. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14881. * of this software and associated documentation files (the "Software"), to deal
  14882. * in the Software without restriction, including without limitation the rights
  14883. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14884. * copies of the Software, and to permit persons to whom the Software is
  14885. * furnished to do so, subject to the following conditions:
  14886. *
  14887. * The above copyright notice and this permission notice shall be included in
  14888. * all copies or substantial portions of the Software.
  14889. *
  14890. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14891. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14892. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14893. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14894. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14895. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14896. * THE SOFTWARE.
  14897. */
  14898. var __extends = this && this.__extends || function () {
  14899. var _extendStatics = function extendStatics(d, b) {
  14900. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14901. d.__proto__ = b;
  14902. } || function (d, b) {
  14903. for (var p in b) {
  14904. if (b.hasOwnProperty(p)) d[p] = b[p];
  14905. }
  14906. };
  14907. return _extendStatics(d, b);
  14908. };
  14909. return function (d, b) {
  14910. _extendStatics(d, b);
  14911. function __() {
  14912. this.constructor = d;
  14913. }
  14914. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14915. };
  14916. }();
  14917. var __assign = this && this.__assign || function () {
  14918. __assign = Object.assign || function (t) {
  14919. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14920. s = arguments[i];
  14921. for (var p in s) {
  14922. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14923. }
  14924. }
  14925. return t;
  14926. };
  14927. return __assign.apply(this, arguments);
  14928. };
  14929. Object.defineProperty(exports, "__esModule", { value: true });
  14930. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  14931. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  14932. var INTERACTION_EVENTS = ['click', 'keydown'];
  14933. var MDCSelectIconFoundation = /** @class */function (_super) {
  14934. __extends(MDCSelectIconFoundation, _super);
  14935. function MDCSelectIconFoundation(adapter) {
  14936. var _this = _super.call(this, __assign(__assign({}, MDCSelectIconFoundation.defaultAdapter), adapter)) || this;
  14937. _this.savedTabIndex_ = null;
  14938. _this.interactionHandler_ = function (evt) {
  14939. return _this.handleInteraction(evt);
  14940. };
  14941. return _this;
  14942. }
  14943. Object.defineProperty(MDCSelectIconFoundation, "strings", {
  14944. get: function get() {
  14945. return constants_1.strings;
  14946. },
  14947. enumerable: true,
  14948. configurable: true
  14949. });
  14950. Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", {
  14951. /**
  14952. * See {@link MDCSelectIconAdapter} for typing information on parameters and return types.
  14953. */
  14954. get: function get() {
  14955. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  14956. return {
  14957. getAttr: function getAttr() {
  14958. return null;
  14959. },
  14960. setAttr: function setAttr() {
  14961. return undefined;
  14962. },
  14963. removeAttr: function removeAttr() {
  14964. return undefined;
  14965. },
  14966. setContent: function setContent() {
  14967. return undefined;
  14968. },
  14969. registerInteractionHandler: function registerInteractionHandler() {
  14970. return undefined;
  14971. },
  14972. deregisterInteractionHandler: function deregisterInteractionHandler() {
  14973. return undefined;
  14974. },
  14975. notifyIconAction: function notifyIconAction() {
  14976. return undefined;
  14977. }
  14978. };
  14979. // tslint:enable:object-literal-sort-keys
  14980. },
  14981. enumerable: true,
  14982. configurable: true
  14983. });
  14984. MDCSelectIconFoundation.prototype.init = function () {
  14985. var _this = this;
  14986. this.savedTabIndex_ = this.adapter.getAttr('tabindex');
  14987. INTERACTION_EVENTS.forEach(function (evtType) {
  14988. _this.adapter.registerInteractionHandler(evtType, _this.interactionHandler_);
  14989. });
  14990. };
  14991. MDCSelectIconFoundation.prototype.destroy = function () {
  14992. var _this = this;
  14993. INTERACTION_EVENTS.forEach(function (evtType) {
  14994. _this.adapter.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  14995. });
  14996. };
  14997. MDCSelectIconFoundation.prototype.setDisabled = function (disabled) {
  14998. if (!this.savedTabIndex_) {
  14999. return;
  15000. }
  15001. if (disabled) {
  15002. this.adapter.setAttr('tabindex', '-1');
  15003. this.adapter.removeAttr('role');
  15004. } else {
  15005. this.adapter.setAttr('tabindex', this.savedTabIndex_);
  15006. this.adapter.setAttr('role', constants_1.strings.ICON_ROLE);
  15007. }
  15008. };
  15009. MDCSelectIconFoundation.prototype.setAriaLabel = function (label) {
  15010. this.adapter.setAttr('aria-label', label);
  15011. };
  15012. MDCSelectIconFoundation.prototype.setContent = function (content) {
  15013. this.adapter.setContent(content);
  15014. };
  15015. MDCSelectIconFoundation.prototype.handleInteraction = function (evt) {
  15016. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  15017. if (evt.type === 'click' || isEnterKey) {
  15018. this.adapter.notifyIconAction();
  15019. }
  15020. };
  15021. return MDCSelectIconFoundation;
  15022. }(foundation_1.MDCFoundation);
  15023. exports.MDCSelectIconFoundation = MDCSelectIconFoundation;
  15024. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  15025. exports.default = MDCSelectIconFoundation;
  15026. /***/ }),
  15027. /***/ "./packages/mdc-select/icon/index.ts":
  15028. /*!*******************************************!*\
  15029. !*** ./packages/mdc-select/icon/index.ts ***!
  15030. \*******************************************/
  15031. /*! no static exports found */
  15032. /***/ (function(module, exports, __webpack_require__) {
  15033. "use strict";
  15034. /**
  15035. * @license
  15036. * Copyright 2019 Google Inc.
  15037. *
  15038. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15039. * of this software and associated documentation files (the "Software"), to deal
  15040. * in the Software without restriction, including without limitation the rights
  15041. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15042. * copies of the Software, and to permit persons to whom the Software is
  15043. * furnished to do so, subject to the following conditions:
  15044. *
  15045. * The above copyright notice and this permission notice shall be included in
  15046. * all copies or substantial portions of the Software.
  15047. *
  15048. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15049. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15050. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15051. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15052. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15053. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15054. * THE SOFTWARE.
  15055. */
  15056. function __export(m) {
  15057. for (var p in m) {
  15058. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  15059. }
  15060. }
  15061. Object.defineProperty(exports, "__esModule", { value: true });
  15062. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/icon/component.ts"));
  15063. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"));
  15064. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  15065. exports.iconStrings = constants_1.strings;
  15066. /***/ }),
  15067. /***/ "./packages/mdc-select/index.ts":
  15068. /*!**************************************!*\
  15069. !*** ./packages/mdc-select/index.ts ***!
  15070. \**************************************/
  15071. /*! no static exports found */
  15072. /***/ (function(module, exports, __webpack_require__) {
  15073. "use strict";
  15074. /**
  15075. * @license
  15076. * Copyright 2019 Google Inc.
  15077. *
  15078. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15079. * of this software and associated documentation files (the "Software"), to deal
  15080. * in the Software without restriction, including without limitation the rights
  15081. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15082. * copies of the Software, and to permit persons to whom the Software is
  15083. * furnished to do so, subject to the following conditions:
  15084. *
  15085. * The above copyright notice and this permission notice shall be included in
  15086. * all copies or substantial portions of the Software.
  15087. *
  15088. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15089. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15090. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15091. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15092. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15093. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15094. * THE SOFTWARE.
  15095. */
  15096. function __export(m) {
  15097. for (var p in m) {
  15098. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  15099. }
  15100. }
  15101. Object.defineProperty(exports, "__esModule", { value: true });
  15102. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/component.ts"));
  15103. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"));
  15104. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts"));
  15105. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-select/helper-text/index.ts"));
  15106. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-select/icon/index.ts"));
  15107. /***/ }),
  15108. /***/ "./packages/mdc-slider/component.ts":
  15109. /*!******************************************!*\
  15110. !*** ./packages/mdc-slider/component.ts ***!
  15111. \******************************************/
  15112. /*! no static exports found */
  15113. /***/ (function(module, exports, __webpack_require__) {
  15114. "use strict";
  15115. /**
  15116. * @license
  15117. * Copyright 2017 Google Inc.
  15118. *
  15119. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15120. * of this software and associated documentation files (the "Software"), to deal
  15121. * in the Software without restriction, including without limitation the rights
  15122. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15123. * copies of the Software, and to permit persons to whom the Software is
  15124. * furnished to do so, subject to the following conditions:
  15125. *
  15126. * The above copyright notice and this permission notice shall be included in
  15127. * all copies or substantial portions of the Software.
  15128. *
  15129. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15130. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15131. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15132. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15133. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15134. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15135. * THE SOFTWARE.
  15136. */
  15137. var __extends = this && this.__extends || function () {
  15138. var _extendStatics = function extendStatics(d, b) {
  15139. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15140. d.__proto__ = b;
  15141. } || function (d, b) {
  15142. for (var p in b) {
  15143. if (b.hasOwnProperty(p)) d[p] = b[p];
  15144. }
  15145. };
  15146. return _extendStatics(d, b);
  15147. };
  15148. return function (d, b) {
  15149. _extendStatics(d, b);
  15150. function __() {
  15151. this.constructor = d;
  15152. }
  15153. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15154. };
  15155. }();
  15156. Object.defineProperty(exports, "__esModule", { value: true });
  15157. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15158. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  15159. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  15160. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts");
  15161. var MDCSlider = /** @class */function (_super) {
  15162. __extends(MDCSlider, _super);
  15163. function MDCSlider() {
  15164. return _super !== null && _super.apply(this, arguments) || this;
  15165. }
  15166. MDCSlider.attachTo = function (root) {
  15167. return new MDCSlider(root);
  15168. };
  15169. Object.defineProperty(MDCSlider.prototype, "value", {
  15170. get: function get() {
  15171. return this.foundation.getValue();
  15172. },
  15173. set: function set(value) {
  15174. this.foundation.setValue(value);
  15175. },
  15176. enumerable: true,
  15177. configurable: true
  15178. });
  15179. Object.defineProperty(MDCSlider.prototype, "min", {
  15180. get: function get() {
  15181. return this.foundation.getMin();
  15182. },
  15183. set: function set(min) {
  15184. this.foundation.setMin(min);
  15185. },
  15186. enumerable: true,
  15187. configurable: true
  15188. });
  15189. Object.defineProperty(MDCSlider.prototype, "max", {
  15190. get: function get() {
  15191. return this.foundation.getMax();
  15192. },
  15193. set: function set(max) {
  15194. this.foundation.setMax(max);
  15195. },
  15196. enumerable: true,
  15197. configurable: true
  15198. });
  15199. Object.defineProperty(MDCSlider.prototype, "step", {
  15200. get: function get() {
  15201. return this.foundation.getStep();
  15202. },
  15203. set: function set(step) {
  15204. this.foundation.setStep(step);
  15205. },
  15206. enumerable: true,
  15207. configurable: true
  15208. });
  15209. Object.defineProperty(MDCSlider.prototype, "disabled", {
  15210. get: function get() {
  15211. return this.foundation.isDisabled();
  15212. },
  15213. set: function set(disabled) {
  15214. this.foundation.setDisabled(disabled);
  15215. },
  15216. enumerable: true,
  15217. configurable: true
  15218. });
  15219. MDCSlider.prototype.initialize = function () {
  15220. this.thumbContainer_ = this.root.querySelector(constants_1.strings.THUMB_CONTAINER_SELECTOR);
  15221. this.track_ = this.root.querySelector(constants_1.strings.TRACK_SELECTOR);
  15222. this.pinValueMarker_ = this.root.querySelector(constants_1.strings.PIN_VALUE_MARKER_SELECTOR);
  15223. this.trackMarkerContainer_ = this.root.querySelector(constants_1.strings.TRACK_MARKER_CONTAINER_SELECTOR);
  15224. };
  15225. MDCSlider.prototype.getDefaultFoundation = function () {
  15226. var _this = this;
  15227. // DO NOT INLINE this variable. For backward compatibility, foundations take
  15228. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  15229. // methods, we need a separate, strongly typed adapter variable.
  15230. // tslint:disable:object-literal-sort-keys Methods should be in the same
  15231. // order as the adapter interface.
  15232. var adapter = {
  15233. hasClass: function hasClass(className) {
  15234. return _this.root.classList.contains(className);
  15235. },
  15236. addClass: function addClass(className) {
  15237. return _this.root.classList.add(className);
  15238. },
  15239. removeClass: function removeClass(className) {
  15240. return _this.root.classList.remove(className);
  15241. },
  15242. getAttribute: function getAttribute(name) {
  15243. return _this.root.getAttribute(name);
  15244. },
  15245. setAttribute: function setAttribute(name, value) {
  15246. return _this.root.setAttribute(name, value);
  15247. },
  15248. removeAttribute: function removeAttribute(name) {
  15249. return _this.root.removeAttribute(name);
  15250. },
  15251. computeBoundingRect: function computeBoundingRect() {
  15252. return _this.root.getBoundingClientRect();
  15253. },
  15254. getTabIndex: function getTabIndex() {
  15255. return _this.root.tabIndex;
  15256. },
  15257. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  15258. return _this.listen(evtType, handler, events_1.applyPassive());
  15259. },
  15260. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  15261. return _this.unlisten(evtType, handler, events_1.applyPassive());
  15262. },
  15263. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) {
  15264. _this.thumbContainer_.addEventListener(evtType, handler, events_1.applyPassive());
  15265. },
  15266. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) {
  15267. _this.thumbContainer_.removeEventListener(evtType, handler, events_1.applyPassive());
  15268. },
  15269. registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) {
  15270. return document.body.addEventListener(evtType, handler);
  15271. },
  15272. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) {
  15273. return document.body.removeEventListener(evtType, handler);
  15274. },
  15275. registerResizeHandler: function registerResizeHandler(handler) {
  15276. return window.addEventListener('resize', handler);
  15277. },
  15278. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  15279. return window.removeEventListener('resize', handler);
  15280. },
  15281. notifyInput: function notifyInput() {
  15282. return _this.emit(constants_1.strings.INPUT_EVENT, _this);
  15283. },
  15284. notifyChange: function notifyChange() {
  15285. return _this.emit(constants_1.strings.CHANGE_EVENT, _this);
  15286. },
  15287. setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) {
  15288. _this.thumbContainer_.style.setProperty(propertyName, value);
  15289. },
  15290. setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) {
  15291. return _this.track_.style.setProperty(propertyName, value);
  15292. },
  15293. setMarkerValue: function setMarkerValue(value) {
  15294. return _this.pinValueMarker_.innerText = value.toLocaleString();
  15295. },
  15296. setTrackMarkers: function setTrackMarkers(step, max, min) {
  15297. var stepStr = step.toLocaleString();
  15298. var maxStr = max.toLocaleString();
  15299. var minStr = min.toLocaleString();
  15300. // keep calculation in css for better rounding/subpixel behavior
  15301. var markerAmount = "((" + maxStr + " - " + minStr + ") / " + stepStr + ")";
  15302. var markerWidth = "2px";
  15303. var markerBkgdImage = "linear-gradient(to right, currentColor " + markerWidth + ", transparent 0)";
  15304. var markerBkgdLayout = "0 center / calc((100% - " + markerWidth + ") / " + markerAmount + ") 100% repeat-x";
  15305. var markerBkgdShorthand = markerBkgdImage + " " + markerBkgdLayout;
  15306. _this.trackMarkerContainer_.style.setProperty('background', markerBkgdShorthand);
  15307. },
  15308. isRTL: function isRTL() {
  15309. return getComputedStyle(_this.root).direction === 'rtl';
  15310. }
  15311. };
  15312. // tslint:enable:object-literal-sort-keys
  15313. return new foundation_1.MDCSliderFoundation(adapter);
  15314. };
  15315. MDCSlider.prototype.initialSyncWithDOM = function () {
  15316. var origValueNow = this.parseFloat_(this.root.getAttribute(constants_1.strings.ARIA_VALUENOW), this.value);
  15317. var min = this.parseFloat_(this.root.getAttribute(constants_1.strings.ARIA_VALUEMIN), this.min);
  15318. var max = this.parseFloat_(this.root.getAttribute(constants_1.strings.ARIA_VALUEMAX), this.max);
  15319. // min and max need to be set in the right order to avoid throwing an error
  15320. // when the new min is greater than the default max.
  15321. if (min >= this.max) {
  15322. this.max = max;
  15323. this.min = min;
  15324. } else {
  15325. this.min = min;
  15326. this.max = max;
  15327. }
  15328. this.step = this.parseFloat_(this.root.getAttribute(constants_1.strings.STEP_DATA_ATTR), this.step);
  15329. this.value = origValueNow;
  15330. this.disabled = this.root.hasAttribute(constants_1.strings.ARIA_DISABLED) && this.root.getAttribute(constants_1.strings.ARIA_DISABLED) !== 'false';
  15331. this.foundation.setupTrackMarker();
  15332. };
  15333. MDCSlider.prototype.layout = function () {
  15334. this.foundation.layout();
  15335. };
  15336. MDCSlider.prototype.stepUp = function (amount) {
  15337. if (amount === void 0) {
  15338. amount = this.step || 1;
  15339. }
  15340. this.value += amount;
  15341. };
  15342. MDCSlider.prototype.stepDown = function (amount) {
  15343. if (amount === void 0) {
  15344. amount = this.step || 1;
  15345. }
  15346. this.value -= amount;
  15347. };
  15348. MDCSlider.prototype.parseFloat_ = function (str, defaultValue) {
  15349. var num = parseFloat(str); // tslint:disable-line:ban
  15350. var isNumeric = typeof num === 'number' && isFinite(num);
  15351. return isNumeric ? num : defaultValue;
  15352. };
  15353. return MDCSlider;
  15354. }(component_1.MDCComponent);
  15355. exports.MDCSlider = MDCSlider;
  15356. /***/ }),
  15357. /***/ "./packages/mdc-slider/constants.ts":
  15358. /*!******************************************!*\
  15359. !*** ./packages/mdc-slider/constants.ts ***!
  15360. \******************************************/
  15361. /*! no static exports found */
  15362. /***/ (function(module, exports, __webpack_require__) {
  15363. "use strict";
  15364. /**
  15365. * @license
  15366. * Copyright 2017 Google Inc.
  15367. *
  15368. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15369. * of this software and associated documentation files (the "Software"), to deal
  15370. * in the Software without restriction, including without limitation the rights
  15371. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15372. * copies of the Software, and to permit persons to whom the Software is
  15373. * furnished to do so, subject to the following conditions:
  15374. *
  15375. * The above copyright notice and this permission notice shall be included in
  15376. * all copies or substantial portions of the Software.
  15377. *
  15378. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15379. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15380. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15381. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15382. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15383. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15384. * THE SOFTWARE.
  15385. */
  15386. Object.defineProperty(exports, "__esModule", { value: true });
  15387. var cssClasses = {
  15388. ACTIVE: 'mdc-slider--active',
  15389. DISABLED: 'mdc-slider--disabled',
  15390. DISCRETE: 'mdc-slider--discrete',
  15391. FOCUS: 'mdc-slider--focus',
  15392. HAS_TRACK_MARKER: 'mdc-slider--display-markers',
  15393. IN_TRANSIT: 'mdc-slider--in-transit',
  15394. IS_DISCRETE: 'mdc-slider--discrete',
  15395. DISABLE_TOUCH_ACTION: 'mdc-slider--disable-touch-action'
  15396. };
  15397. exports.cssClasses = cssClasses;
  15398. var strings = {
  15399. ARIA_DISABLED: 'aria-disabled',
  15400. ARIA_VALUEMAX: 'aria-valuemax',
  15401. ARIA_VALUEMIN: 'aria-valuemin',
  15402. ARIA_VALUENOW: 'aria-valuenow',
  15403. CHANGE_EVENT: 'MDCSlider:change',
  15404. INPUT_EVENT: 'MDCSlider:input',
  15405. PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker',
  15406. STEP_DATA_ATTR: 'data-step',
  15407. THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container',
  15408. TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container',
  15409. TRACK_SELECTOR: '.mdc-slider__track'
  15410. };
  15411. exports.strings = strings;
  15412. var numbers = {
  15413. PAGE_FACTOR: 4
  15414. };
  15415. exports.numbers = numbers;
  15416. /***/ }),
  15417. /***/ "./packages/mdc-slider/foundation.ts":
  15418. /*!*******************************************!*\
  15419. !*** ./packages/mdc-slider/foundation.ts ***!
  15420. \*******************************************/
  15421. /*! no static exports found */
  15422. /***/ (function(module, exports, __webpack_require__) {
  15423. "use strict";
  15424. /**
  15425. * @license
  15426. * Copyright 2017 Google Inc.
  15427. *
  15428. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15429. * of this software and associated documentation files (the "Software"), to deal
  15430. * in the Software without restriction, including without limitation the rights
  15431. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15432. * copies of the Software, and to permit persons to whom the Software is
  15433. * furnished to do so, subject to the following conditions:
  15434. *
  15435. * The above copyright notice and this permission notice shall be included in
  15436. * all copies or substantial portions of the Software.
  15437. *
  15438. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15439. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15440. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15441. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15442. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15443. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15444. * THE SOFTWARE.
  15445. */
  15446. var __extends = this && this.__extends || function () {
  15447. var _extendStatics = function extendStatics(d, b) {
  15448. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15449. d.__proto__ = b;
  15450. } || function (d, b) {
  15451. for (var p in b) {
  15452. if (b.hasOwnProperty(p)) d[p] = b[p];
  15453. }
  15454. };
  15455. return _extendStatics(d, b);
  15456. };
  15457. return function (d, b) {
  15458. _extendStatics(d, b);
  15459. function __() {
  15460. this.constructor = d;
  15461. }
  15462. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15463. };
  15464. }();
  15465. var __assign = this && this.__assign || function () {
  15466. __assign = Object.assign || function (t) {
  15467. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15468. s = arguments[i];
  15469. for (var p in s) {
  15470. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15471. }
  15472. }
  15473. return t;
  15474. };
  15475. return __assign.apply(this, arguments);
  15476. };
  15477. Object.defineProperty(exports, "__esModule", { value: true });
  15478. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  15479. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  15480. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  15481. // Accessing `window` without a `typeof` check will throw on Node environments.
  15482. var hasWindow = typeof window !== 'undefined';
  15483. var hasPointerEventSupport = hasWindow && !!window.PointerEvent;
  15484. var DOWN_EVENTS = hasPointerEventSupport ? ['pointerdown'] : ['mousedown', 'touchstart'];
  15485. var UP_EVENTS = hasPointerEventSupport ? ['pointerup'] : ['mouseup', 'touchend'];
  15486. var MOVE_EVENT_MAP = {
  15487. mousedown: 'mousemove',
  15488. pointerdown: 'pointermove',
  15489. touchstart: 'touchmove'
  15490. };
  15491. var KEY_IDS = {
  15492. ARROW_DOWN: 'ArrowDown',
  15493. ARROW_LEFT: 'ArrowLeft',
  15494. ARROW_RIGHT: 'ArrowRight',
  15495. ARROW_UP: 'ArrowUp',
  15496. END: 'End',
  15497. HOME: 'Home',
  15498. PAGE_DOWN: 'PageDown',
  15499. PAGE_UP: 'PageUp'
  15500. };
  15501. var MDCSliderFoundation = /** @class */function (_super) {
  15502. __extends(MDCSliderFoundation, _super);
  15503. function MDCSliderFoundation(adapter) {
  15504. var _this = _super.call(this, __assign(__assign({}, MDCSliderFoundation.defaultAdapter), adapter)) || this;
  15505. /**
  15506. * We set this to NaN since we want it to be a number, but we can't use '0' or
  15507. * '-1' because those could be valid tabindices set by the client code.
  15508. */
  15509. _this.savedTabIndex_ = NaN;
  15510. _this.active_ = false;
  15511. _this.inTransit_ = false;
  15512. _this.isDiscrete_ = false;
  15513. _this.hasTrackMarker_ = false;
  15514. _this.handlingThumbTargetEvt_ = false;
  15515. _this.min_ = 0;
  15516. _this.max_ = 100;
  15517. _this.step_ = 0;
  15518. _this.value_ = 0;
  15519. _this.disabled_ = false;
  15520. _this.preventFocusState_ = false;
  15521. _this.thumbContainerPointerHandler_ = function () {
  15522. return _this.handlingThumbTargetEvt_ = true;
  15523. };
  15524. _this.interactionStartHandler_ = function (evt) {
  15525. return _this.handleDown_(evt);
  15526. };
  15527. _this.keydownHandler_ = function (evt) {
  15528. return _this.handleKeydown_(evt);
  15529. };
  15530. _this.focusHandler_ = function () {
  15531. return _this.handleFocus_();
  15532. };
  15533. _this.blurHandler_ = function () {
  15534. return _this.handleBlur_();
  15535. };
  15536. _this.resizeHandler_ = function () {
  15537. return _this.layout();
  15538. };
  15539. return _this;
  15540. }
  15541. Object.defineProperty(MDCSliderFoundation, "cssClasses", {
  15542. get: function get() {
  15543. return constants_1.cssClasses;
  15544. },
  15545. enumerable: true,
  15546. configurable: true
  15547. });
  15548. Object.defineProperty(MDCSliderFoundation, "strings", {
  15549. get: function get() {
  15550. return constants_1.strings;
  15551. },
  15552. enumerable: true,
  15553. configurable: true
  15554. });
  15555. Object.defineProperty(MDCSliderFoundation, "numbers", {
  15556. get: function get() {
  15557. return constants_1.numbers;
  15558. },
  15559. enumerable: true,
  15560. configurable: true
  15561. });
  15562. Object.defineProperty(MDCSliderFoundation, "defaultAdapter", {
  15563. get: function get() {
  15564. // tslint:disable:object-literal-sort-keys Methods should be in the same
  15565. // order as the adapter interface.
  15566. return {
  15567. hasClass: function hasClass() {
  15568. return false;
  15569. },
  15570. addClass: function addClass() {
  15571. return undefined;
  15572. },
  15573. removeClass: function removeClass() {
  15574. return undefined;
  15575. },
  15576. getAttribute: function getAttribute() {
  15577. return null;
  15578. },
  15579. setAttribute: function setAttribute() {
  15580. return undefined;
  15581. },
  15582. removeAttribute: function removeAttribute() {
  15583. return undefined;
  15584. },
  15585. computeBoundingRect: function computeBoundingRect() {
  15586. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  15587. },
  15588. getTabIndex: function getTabIndex() {
  15589. return 0;
  15590. },
  15591. registerInteractionHandler: function registerInteractionHandler() {
  15592. return undefined;
  15593. },
  15594. deregisterInteractionHandler: function deregisterInteractionHandler() {
  15595. return undefined;
  15596. },
  15597. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() {
  15598. return undefined;
  15599. },
  15600. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() {
  15601. return undefined;
  15602. },
  15603. registerBodyInteractionHandler: function registerBodyInteractionHandler() {
  15604. return undefined;
  15605. },
  15606. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() {
  15607. return undefined;
  15608. },
  15609. registerResizeHandler: function registerResizeHandler() {
  15610. return undefined;
  15611. },
  15612. deregisterResizeHandler: function deregisterResizeHandler() {
  15613. return undefined;
  15614. },
  15615. notifyInput: function notifyInput() {
  15616. return undefined;
  15617. },
  15618. notifyChange: function notifyChange() {
  15619. return undefined;
  15620. },
  15621. setThumbContainerStyleProperty: function setThumbContainerStyleProperty() {
  15622. return undefined;
  15623. },
  15624. setTrackStyleProperty: function setTrackStyleProperty() {
  15625. return undefined;
  15626. },
  15627. setMarkerValue: function setMarkerValue() {
  15628. return undefined;
  15629. },
  15630. setTrackMarkers: function setTrackMarkers() {
  15631. return undefined;
  15632. },
  15633. isRTL: function isRTL() {
  15634. return false;
  15635. }
  15636. };
  15637. // tslint:enable:object-literal-sort-keys
  15638. },
  15639. enumerable: true,
  15640. configurable: true
  15641. });
  15642. MDCSliderFoundation.prototype.init = function () {
  15643. var _this = this;
  15644. this.isDiscrete_ = this.adapter.hasClass(constants_1.cssClasses.IS_DISCRETE);
  15645. this.hasTrackMarker_ = this.adapter.hasClass(constants_1.cssClasses.HAS_TRACK_MARKER);
  15646. DOWN_EVENTS.forEach(function (evtName) {
  15647. _this.adapter.registerInteractionHandler(evtName, _this.interactionStartHandler_);
  15648. _this.adapter.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  15649. });
  15650. if (hasPointerEventSupport) {
  15651. /*
  15652. * When pointermove happens, if too much sliding happens, the browser
  15653. * believes you are panning in the x direction and stops firing
  15654. * pointermove events and supplies its own gestures. (similar to
  15655. * preventing default on touchmove)
  15656. */
  15657. this.adapter.addClass(constants_1.cssClasses.DISABLE_TOUCH_ACTION);
  15658. }
  15659. this.adapter.registerInteractionHandler('keydown', this.keydownHandler_);
  15660. this.adapter.registerInteractionHandler('focus', this.focusHandler_);
  15661. this.adapter.registerInteractionHandler('blur', this.blurHandler_);
  15662. this.adapter.registerResizeHandler(this.resizeHandler_);
  15663. this.layout();
  15664. // At last step, provide a reasonable default value to discrete slider
  15665. if (this.isDiscrete_ && this.getStep() === 0) {
  15666. this.step_ = 1;
  15667. }
  15668. };
  15669. MDCSliderFoundation.prototype.destroy = function () {
  15670. var _this = this;
  15671. DOWN_EVENTS.forEach(function (evtName) {
  15672. _this.adapter.deregisterInteractionHandler(evtName, _this.interactionStartHandler_);
  15673. _this.adapter.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  15674. });
  15675. this.adapter.deregisterInteractionHandler('keydown', this.keydownHandler_);
  15676. this.adapter.deregisterInteractionHandler('focus', this.focusHandler_);
  15677. this.adapter.deregisterInteractionHandler('blur', this.blurHandler_);
  15678. this.adapter.deregisterResizeHandler(this.resizeHandler_);
  15679. };
  15680. MDCSliderFoundation.prototype.setupTrackMarker = function () {
  15681. if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) {
  15682. this.adapter.setTrackMarkers(this.getStep(), this.getMax(), this.getMin());
  15683. }
  15684. };
  15685. MDCSliderFoundation.prototype.layout = function () {
  15686. this.rect_ = this.adapter.computeBoundingRect();
  15687. this.updateUIForCurrentValue_();
  15688. };
  15689. MDCSliderFoundation.prototype.getValue = function () {
  15690. return this.value_;
  15691. };
  15692. MDCSliderFoundation.prototype.setValue = function (value) {
  15693. this.setValue_(value, false);
  15694. };
  15695. MDCSliderFoundation.prototype.getMax = function () {
  15696. return this.max_;
  15697. };
  15698. MDCSliderFoundation.prototype.setMax = function (max) {
  15699. if (max < this.min_) {
  15700. throw new Error('Cannot set max to be less than the slider\'s minimum value');
  15701. }
  15702. this.max_ = max;
  15703. this.setValue_(this.value_, false, true);
  15704. this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMAX, String(this.max_));
  15705. this.setupTrackMarker();
  15706. };
  15707. MDCSliderFoundation.prototype.getMin = function () {
  15708. return this.min_;
  15709. };
  15710. MDCSliderFoundation.prototype.setMin = function (min) {
  15711. if (min > this.max_) {
  15712. throw new Error('Cannot set min to be greater than the slider\'s maximum value');
  15713. }
  15714. this.min_ = min;
  15715. this.setValue_(this.value_, false, true);
  15716. this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMIN, String(this.min_));
  15717. this.setupTrackMarker();
  15718. };
  15719. MDCSliderFoundation.prototype.getStep = function () {
  15720. return this.step_;
  15721. };
  15722. MDCSliderFoundation.prototype.setStep = function (step) {
  15723. if (step < 0) {
  15724. throw new Error('Step cannot be set to a negative number');
  15725. }
  15726. if (this.isDiscrete_ && (typeof step !== 'number' || step < 1)) {
  15727. step = 1;
  15728. }
  15729. this.step_ = step;
  15730. this.setValue_(this.value_, false, true);
  15731. this.setupTrackMarker();
  15732. };
  15733. MDCSliderFoundation.prototype.isDisabled = function () {
  15734. return this.disabled_;
  15735. };
  15736. MDCSliderFoundation.prototype.setDisabled = function (disabled) {
  15737. this.disabled_ = disabled;
  15738. this.toggleClass_(constants_1.cssClasses.DISABLED, this.disabled_);
  15739. if (this.disabled_) {
  15740. this.savedTabIndex_ = this.adapter.getTabIndex();
  15741. this.adapter.setAttribute(constants_1.strings.ARIA_DISABLED, 'true');
  15742. this.adapter.removeAttribute('tabindex');
  15743. } else {
  15744. this.adapter.removeAttribute(constants_1.strings.ARIA_DISABLED);
  15745. if (!isNaN(this.savedTabIndex_)) {
  15746. this.adapter.setAttribute('tabindex', String(this.savedTabIndex_));
  15747. }
  15748. }
  15749. };
  15750. /**
  15751. * Called when the user starts interacting with the slider
  15752. */
  15753. MDCSliderFoundation.prototype.handleDown_ = function (downEvent) {
  15754. var _this = this;
  15755. if (this.disabled_) {
  15756. return;
  15757. }
  15758. this.preventFocusState_ = true;
  15759. this.setInTransit_(!this.handlingThumbTargetEvt_);
  15760. this.handlingThumbTargetEvt_ = false;
  15761. this.setActive_(true);
  15762. var moveHandler = function moveHandler(moveEvent) {
  15763. _this.handleMove_(moveEvent);
  15764. };
  15765. var moveEventType = MOVE_EVENT_MAP[downEvent.type];
  15766. // Note: upHandler is [de]registered on ALL potential pointer-related
  15767. // release event types, since some browsers do not always fire these
  15768. // consistently in pairs. (See
  15769. // https://github.com/material-components/material-components-web/issues/1192)
  15770. var upHandler = function upHandler() {
  15771. _this.handleUp_();
  15772. _this.adapter.deregisterBodyInteractionHandler(moveEventType, moveHandler);
  15773. UP_EVENTS.forEach(function (evtName) {
  15774. return _this.adapter.deregisterBodyInteractionHandler(evtName, upHandler);
  15775. });
  15776. };
  15777. this.adapter.registerBodyInteractionHandler(moveEventType, moveHandler);
  15778. UP_EVENTS.forEach(function (evtName) {
  15779. return _this.adapter.registerBodyInteractionHandler(evtName, upHandler);
  15780. });
  15781. this.setValueFromEvt_(downEvent);
  15782. };
  15783. /**
  15784. * Called when the user moves the slider
  15785. */
  15786. MDCSliderFoundation.prototype.handleMove_ = function (evt) {
  15787. evt.preventDefault();
  15788. this.setValueFromEvt_(evt);
  15789. };
  15790. /**
  15791. * Called when the user's interaction with the slider ends
  15792. */
  15793. MDCSliderFoundation.prototype.handleUp_ = function () {
  15794. this.setActive_(false);
  15795. this.adapter.notifyChange();
  15796. };
  15797. /**
  15798. * Returns the clientX of the event
  15799. */
  15800. MDCSliderFoundation.prototype.getClientX_ = function (evt) {
  15801. if (evt.targetTouches && evt.targetTouches.length > 0) {
  15802. return evt.targetTouches[0].clientX;
  15803. }
  15804. return evt.clientX;
  15805. };
  15806. /**
  15807. * Sets the slider value from an event
  15808. */
  15809. MDCSliderFoundation.prototype.setValueFromEvt_ = function (evt) {
  15810. var clientX = this.getClientX_(evt);
  15811. var value = this.computeValueFromClientX_(clientX);
  15812. this.setValue_(value, true);
  15813. };
  15814. /**
  15815. * Computes the new value from the clientX position
  15816. */
  15817. MDCSliderFoundation.prototype.computeValueFromClientX_ = function (clientX) {
  15818. var _a = this,
  15819. max = _a.max_,
  15820. min = _a.min_;
  15821. var xPos = clientX - this.rect_.left;
  15822. var pctComplete = xPos / this.rect_.width;
  15823. if (this.adapter.isRTL()) {
  15824. pctComplete = 1 - pctComplete;
  15825. }
  15826. // Fit the percentage complete between the range [min,max]
  15827. // by remapping from [0, 1] to [min, min+(max-min)].
  15828. return min + pctComplete * (max - min);
  15829. };
  15830. /**
  15831. * Handles keydown events
  15832. */
  15833. MDCSliderFoundation.prototype.handleKeydown_ = function (evt) {
  15834. var keyId = this.getKeyId_(evt);
  15835. var value = this.getValueForKeyId_(keyId);
  15836. if (isNaN(value)) {
  15837. return;
  15838. }
  15839. // Prevent page from scrolling due to key presses that would normally scroll
  15840. // the page
  15841. evt.preventDefault();
  15842. this.adapter.addClass(constants_1.cssClasses.FOCUS);
  15843. this.setValue_(value, true);
  15844. this.adapter.notifyChange();
  15845. };
  15846. /**
  15847. * Returns the computed name of the event
  15848. */
  15849. MDCSliderFoundation.prototype.getKeyId_ = function (kbdEvt) {
  15850. if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) {
  15851. return KEY_IDS.ARROW_LEFT;
  15852. }
  15853. if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) {
  15854. return KEY_IDS.ARROW_RIGHT;
  15855. }
  15856. if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) {
  15857. return KEY_IDS.ARROW_UP;
  15858. }
  15859. if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) {
  15860. return KEY_IDS.ARROW_DOWN;
  15861. }
  15862. if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) {
  15863. return KEY_IDS.HOME;
  15864. }
  15865. if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) {
  15866. return KEY_IDS.END;
  15867. }
  15868. if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) {
  15869. return KEY_IDS.PAGE_UP;
  15870. }
  15871. if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) {
  15872. return KEY_IDS.PAGE_DOWN;
  15873. }
  15874. return '';
  15875. };
  15876. /**
  15877. * Computes the value given a keyboard key ID
  15878. */
  15879. MDCSliderFoundation.prototype.getValueForKeyId_ = function (keyId) {
  15880. var _a = this,
  15881. max = _a.max_,
  15882. min = _a.min_,
  15883. step = _a.step_;
  15884. var delta = step || (max - min) / 100;
  15885. var valueNeedsToBeFlipped = this.adapter.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT);
  15886. if (valueNeedsToBeFlipped) {
  15887. delta = -delta;
  15888. }
  15889. switch (keyId) {
  15890. case KEY_IDS.ARROW_LEFT:
  15891. case KEY_IDS.ARROW_DOWN:
  15892. return this.value_ - delta;
  15893. case KEY_IDS.ARROW_RIGHT:
  15894. case KEY_IDS.ARROW_UP:
  15895. return this.value_ + delta;
  15896. case KEY_IDS.HOME:
  15897. return this.min_;
  15898. case KEY_IDS.END:
  15899. return this.max_;
  15900. case KEY_IDS.PAGE_UP:
  15901. return this.value_ + delta * constants_1.numbers.PAGE_FACTOR;
  15902. case KEY_IDS.PAGE_DOWN:
  15903. return this.value_ - delta * constants_1.numbers.PAGE_FACTOR;
  15904. default:
  15905. return NaN;
  15906. }
  15907. };
  15908. MDCSliderFoundation.prototype.handleFocus_ = function () {
  15909. if (this.preventFocusState_) {
  15910. return;
  15911. }
  15912. this.adapter.addClass(constants_1.cssClasses.FOCUS);
  15913. };
  15914. MDCSliderFoundation.prototype.handleBlur_ = function () {
  15915. this.preventFocusState_ = false;
  15916. this.adapter.removeClass(constants_1.cssClasses.FOCUS);
  15917. };
  15918. /**
  15919. * Sets the value of the slider
  15920. */
  15921. MDCSliderFoundation.prototype.setValue_ = function (value, shouldFireInput, force) {
  15922. if (force === void 0) {
  15923. force = false;
  15924. }
  15925. if (value === this.value_ && !force) {
  15926. return;
  15927. }
  15928. var _a = this,
  15929. min = _a.min_,
  15930. max = _a.max_;
  15931. var valueSetToBoundary = value === min || value === max;
  15932. if (this.step_ && !valueSetToBoundary) {
  15933. value = this.quantize_(value);
  15934. }
  15935. if (value < min) {
  15936. value = min;
  15937. } else if (value > max) {
  15938. value = max;
  15939. }
  15940. value = value || 0; // coerce -0 to 0
  15941. this.value_ = value;
  15942. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, String(this.value_));
  15943. this.updateUIForCurrentValue_();
  15944. if (shouldFireInput) {
  15945. this.adapter.notifyInput();
  15946. if (this.isDiscrete_) {
  15947. this.adapter.setMarkerValue(value);
  15948. }
  15949. }
  15950. };
  15951. /**
  15952. * Calculates the quantized value
  15953. */
  15954. MDCSliderFoundation.prototype.quantize_ = function (value) {
  15955. var numSteps = Math.round(value / this.step_);
  15956. return numSteps * this.step_;
  15957. };
  15958. MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function () {
  15959. var _this = this;
  15960. var _a = this,
  15961. max = _a.max_,
  15962. min = _a.min_,
  15963. value = _a.value_;
  15964. var pctComplete = (value - min) / (max - min);
  15965. var translatePx = pctComplete * this.rect_.width;
  15966. if (this.adapter.isRTL()) {
  15967. translatePx = this.rect_.width - translatePx;
  15968. }
  15969. var transformProp = hasWindow ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
  15970. var transitionendEvtName = hasWindow ? util_1.getCorrectEventName(window, 'transitionend') : 'transitionend';
  15971. if (this.inTransit_) {
  15972. var onTransitionEnd_1 = function onTransitionEnd_1() {
  15973. _this.setInTransit_(false);
  15974. _this.adapter.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  15975. };
  15976. this.adapter.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  15977. }
  15978. requestAnimationFrame(function () {
  15979. // NOTE(traviskaufman): It would be nice to use calc() here,
  15980. // but IE cannot handle calcs in transforms correctly.
  15981. // See: https://goo.gl/NC2itk
  15982. // Also note that the -50% offset is used to center the slider thumb.
  15983. _this.adapter.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)");
  15984. _this.adapter.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
  15985. });
  15986. };
  15987. /**
  15988. * Toggles the active state of the slider
  15989. */
  15990. MDCSliderFoundation.prototype.setActive_ = function (active) {
  15991. this.active_ = active;
  15992. this.toggleClass_(constants_1.cssClasses.ACTIVE, this.active_);
  15993. };
  15994. /**
  15995. * Toggles the inTransit state of the slider
  15996. */
  15997. MDCSliderFoundation.prototype.setInTransit_ = function (inTransit) {
  15998. this.inTransit_ = inTransit;
  15999. this.toggleClass_(constants_1.cssClasses.IN_TRANSIT, this.inTransit_);
  16000. };
  16001. /**
  16002. * Conditionally adds or removes a class based on shouldBePresent
  16003. */
  16004. MDCSliderFoundation.prototype.toggleClass_ = function (className, shouldBePresent) {
  16005. if (shouldBePresent) {
  16006. this.adapter.addClass(className);
  16007. } else {
  16008. this.adapter.removeClass(className);
  16009. }
  16010. };
  16011. return MDCSliderFoundation;
  16012. }(foundation_1.MDCFoundation);
  16013. exports.MDCSliderFoundation = MDCSliderFoundation;
  16014. // tslint:disable-next-line:no-default-export Needed for backward compatibility
  16015. // with MDC Web v0.44.0 and earlier.
  16016. exports.default = MDCSliderFoundation;
  16017. /***/ }),
  16018. /***/ "./packages/mdc-slider/index.ts":
  16019. /*!**************************************!*\
  16020. !*** ./packages/mdc-slider/index.ts ***!
  16021. \**************************************/
  16022. /*! no static exports found */
  16023. /***/ (function(module, exports, __webpack_require__) {
  16024. "use strict";
  16025. /**
  16026. * @license
  16027. * Copyright 2019 Google Inc.
  16028. *
  16029. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16030. * of this software and associated documentation files (the "Software"), to deal
  16031. * in the Software without restriction, including without limitation the rights
  16032. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16033. * copies of the Software, and to permit persons to whom the Software is
  16034. * furnished to do so, subject to the following conditions:
  16035. *
  16036. * The above copyright notice and this permission notice shall be included in
  16037. * all copies or substantial portions of the Software.
  16038. *
  16039. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16040. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16041. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16042. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16043. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16044. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16045. * THE SOFTWARE.
  16046. */
  16047. function __export(m) {
  16048. for (var p in m) {
  16049. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16050. }
  16051. }
  16052. Object.defineProperty(exports, "__esModule", { value: true });
  16053. __export(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts"));
  16054. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"));
  16055. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"));
  16056. /***/ }),
  16057. /***/ "./packages/mdc-snackbar/component.ts":
  16058. /*!********************************************!*\
  16059. !*** ./packages/mdc-snackbar/component.ts ***!
  16060. \********************************************/
  16061. /*! no static exports found */
  16062. /***/ (function(module, exports, __webpack_require__) {
  16063. "use strict";
  16064. /**
  16065. * @license
  16066. * Copyright 2018 Google Inc.
  16067. *
  16068. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16069. * of this software and associated documentation files (the "Software"), to deal
  16070. * in the Software without restriction, including without limitation the rights
  16071. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16072. * copies of the Software, and to permit persons to whom the Software is
  16073. * furnished to do so, subject to the following conditions:
  16074. *
  16075. * The above copyright notice and this permission notice shall be included in
  16076. * all copies or substantial portions of the Software.
  16077. *
  16078. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16079. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16080. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16081. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16082. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16083. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16084. * THE SOFTWARE.
  16085. */
  16086. var __extends = this && this.__extends || function () {
  16087. var _extendStatics = function extendStatics(d, b) {
  16088. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16089. d.__proto__ = b;
  16090. } || function (d, b) {
  16091. for (var p in b) {
  16092. if (b.hasOwnProperty(p)) d[p] = b[p];
  16093. }
  16094. };
  16095. return _extendStatics(d, b);
  16096. };
  16097. return function (d, b) {
  16098. _extendStatics(d, b);
  16099. function __() {
  16100. this.constructor = d;
  16101. }
  16102. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16103. };
  16104. }();
  16105. var __importStar = this && this.__importStar || function (mod) {
  16106. if (mod && mod.__esModule) return mod;
  16107. var result = {};
  16108. if (mod != null) for (var k in mod) {
  16109. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  16110. }result["default"] = mod;
  16111. return result;
  16112. };
  16113. Object.defineProperty(exports, "__esModule", { value: true });
  16114. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16115. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  16116. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  16117. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts");
  16118. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  16119. var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR,
  16120. LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR,
  16121. ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR,
  16122. DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR,
  16123. OPENING_EVENT = constants_1.strings.OPENING_EVENT,
  16124. OPENED_EVENT = constants_1.strings.OPENED_EVENT,
  16125. CLOSING_EVENT = constants_1.strings.CLOSING_EVENT,
  16126. CLOSED_EVENT = constants_1.strings.CLOSED_EVENT;
  16127. var MDCSnackbar = /** @class */function (_super) {
  16128. __extends(MDCSnackbar, _super);
  16129. function MDCSnackbar() {
  16130. return _super !== null && _super.apply(this, arguments) || this;
  16131. }
  16132. MDCSnackbar.attachTo = function (root) {
  16133. return new MDCSnackbar(root);
  16134. };
  16135. MDCSnackbar.prototype.initialize = function (announcerFactory) {
  16136. if (announcerFactory === void 0) {
  16137. announcerFactory = function announcerFactory() {
  16138. return util.announce;
  16139. };
  16140. }
  16141. this.announce_ = announcerFactory();
  16142. };
  16143. MDCSnackbar.prototype.initialSyncWithDOM = function () {
  16144. var _this = this;
  16145. this.surfaceEl_ = this.root.querySelector(SURFACE_SELECTOR);
  16146. this.labelEl_ = this.root.querySelector(LABEL_SELECTOR);
  16147. this.actionEl_ = this.root.querySelector(ACTION_SELECTOR);
  16148. this.handleKeyDown_ = function (evt) {
  16149. return _this.foundation.handleKeyDown(evt);
  16150. };
  16151. this.handleSurfaceClick_ = function (evt) {
  16152. var target = evt.target;
  16153. if (_this.isActionButton_(target)) {
  16154. _this.foundation.handleActionButtonClick(evt);
  16155. } else if (_this.isActionIcon_(target)) {
  16156. _this.foundation.handleActionIconClick(evt);
  16157. }
  16158. };
  16159. this.registerKeyDownHandler_(this.handleKeyDown_);
  16160. this.registerSurfaceClickHandler_(this.handleSurfaceClick_);
  16161. };
  16162. MDCSnackbar.prototype.destroy = function () {
  16163. _super.prototype.destroy.call(this);
  16164. this.deregisterKeyDownHandler_(this.handleKeyDown_);
  16165. this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_);
  16166. };
  16167. MDCSnackbar.prototype.open = function () {
  16168. this.foundation.open();
  16169. };
  16170. /**
  16171. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  16172. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  16173. * client-specific values may also be used if desired.
  16174. */
  16175. MDCSnackbar.prototype.close = function (reason) {
  16176. if (reason === void 0) {
  16177. reason = '';
  16178. }
  16179. this.foundation.close(reason);
  16180. };
  16181. MDCSnackbar.prototype.getDefaultFoundation = function () {
  16182. var _this = this;
  16183. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16184. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16185. var adapter = {
  16186. addClass: function addClass(className) {
  16187. return _this.root.classList.add(className);
  16188. },
  16189. announce: function announce() {
  16190. return _this.announce_(_this.labelEl_);
  16191. },
  16192. notifyClosed: function notifyClosed(reason) {
  16193. return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {});
  16194. },
  16195. notifyClosing: function notifyClosing(reason) {
  16196. return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {});
  16197. },
  16198. notifyOpened: function notifyOpened() {
  16199. return _this.emit(OPENED_EVENT, {});
  16200. },
  16201. notifyOpening: function notifyOpening() {
  16202. return _this.emit(OPENING_EVENT, {});
  16203. },
  16204. removeClass: function removeClass(className) {
  16205. return _this.root.classList.remove(className);
  16206. }
  16207. };
  16208. return new foundation_1.MDCSnackbarFoundation(adapter);
  16209. };
  16210. Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
  16211. get: function get() {
  16212. return this.foundation.getTimeoutMs();
  16213. },
  16214. set: function set(timeoutMs) {
  16215. this.foundation.setTimeoutMs(timeoutMs);
  16216. },
  16217. enumerable: true,
  16218. configurable: true
  16219. });
  16220. Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
  16221. get: function get() {
  16222. return this.foundation.getCloseOnEscape();
  16223. },
  16224. set: function set(closeOnEscape) {
  16225. this.foundation.setCloseOnEscape(closeOnEscape);
  16226. },
  16227. enumerable: true,
  16228. configurable: true
  16229. });
  16230. Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
  16231. get: function get() {
  16232. return this.foundation.isOpen();
  16233. },
  16234. enumerable: true,
  16235. configurable: true
  16236. });
  16237. Object.defineProperty(MDCSnackbar.prototype, "labelText", {
  16238. get: function get() {
  16239. // This property only returns null if the node is a document, DOCTYPE, or notation.
  16240. // On Element nodes, it always returns a string.
  16241. return this.labelEl_.textContent;
  16242. },
  16243. set: function set(labelText) {
  16244. this.labelEl_.textContent = labelText;
  16245. },
  16246. enumerable: true,
  16247. configurable: true
  16248. });
  16249. Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
  16250. get: function get() {
  16251. return this.actionEl_.textContent;
  16252. },
  16253. set: function set(actionButtonText) {
  16254. this.actionEl_.textContent = actionButtonText;
  16255. },
  16256. enumerable: true,
  16257. configurable: true
  16258. });
  16259. MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) {
  16260. this.listen('keydown', handler);
  16261. };
  16262. MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) {
  16263. this.unlisten('keydown', handler);
  16264. };
  16265. MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) {
  16266. this.surfaceEl_.addEventListener('click', handler);
  16267. };
  16268. MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) {
  16269. this.surfaceEl_.removeEventListener('click', handler);
  16270. };
  16271. MDCSnackbar.prototype.isActionButton_ = function (target) {
  16272. return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR));
  16273. };
  16274. MDCSnackbar.prototype.isActionIcon_ = function (target) {
  16275. return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR));
  16276. };
  16277. return MDCSnackbar;
  16278. }(component_1.MDCComponent);
  16279. exports.MDCSnackbar = MDCSnackbar;
  16280. /***/ }),
  16281. /***/ "./packages/mdc-snackbar/constants.ts":
  16282. /*!********************************************!*\
  16283. !*** ./packages/mdc-snackbar/constants.ts ***!
  16284. \********************************************/
  16285. /*! no static exports found */
  16286. /***/ (function(module, exports, __webpack_require__) {
  16287. "use strict";
  16288. /**
  16289. * @license
  16290. * Copyright 2018 Google Inc.
  16291. *
  16292. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16293. * of this software and associated documentation files (the "Software"), to deal
  16294. * in the Software without restriction, including without limitation the rights
  16295. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16296. * copies of the Software, and to permit persons to whom the Software is
  16297. * furnished to do so, subject to the following conditions:
  16298. *
  16299. * The above copyright notice and this permission notice shall be included in
  16300. * all copies or substantial portions of the Software.
  16301. *
  16302. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16303. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16304. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16305. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16306. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16307. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16308. * THE SOFTWARE.
  16309. */
  16310. Object.defineProperty(exports, "__esModule", { value: true });
  16311. var cssClasses = {
  16312. CLOSING: 'mdc-snackbar--closing',
  16313. OPEN: 'mdc-snackbar--open',
  16314. OPENING: 'mdc-snackbar--opening'
  16315. };
  16316. exports.cssClasses = cssClasses;
  16317. var strings = {
  16318. ACTION_SELECTOR: '.mdc-snackbar__action',
  16319. ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',
  16320. CLOSED_EVENT: 'MDCSnackbar:closed',
  16321. CLOSING_EVENT: 'MDCSnackbar:closing',
  16322. DISMISS_SELECTOR: '.mdc-snackbar__dismiss',
  16323. LABEL_SELECTOR: '.mdc-snackbar__label',
  16324. OPENED_EVENT: 'MDCSnackbar:opened',
  16325. OPENING_EVENT: 'MDCSnackbar:opening',
  16326. REASON_ACTION: 'action',
  16327. REASON_DISMISS: 'dismiss',
  16328. SURFACE_SELECTOR: '.mdc-snackbar__surface'
  16329. };
  16330. exports.strings = strings;
  16331. var numbers = {
  16332. DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,
  16333. INDETERMINATE: -1,
  16334. MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,
  16335. MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,
  16336. // These variables need to be kept in sync with the values in _variables.scss.
  16337. SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,
  16338. SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,
  16339. /**
  16340. * Number of milliseconds to wait between temporarily clearing the label text
  16341. * in the DOM and subsequently restoring it. This is necessary to force IE 11
  16342. * to pick up the `aria-live` content change and announce it to the user.
  16343. */
  16344. ARIA_LIVE_DELAY_MS: 1000
  16345. };
  16346. exports.numbers = numbers;
  16347. /***/ }),
  16348. /***/ "./packages/mdc-snackbar/foundation.ts":
  16349. /*!*********************************************!*\
  16350. !*** ./packages/mdc-snackbar/foundation.ts ***!
  16351. \*********************************************/
  16352. /*! no static exports found */
  16353. /***/ (function(module, exports, __webpack_require__) {
  16354. "use strict";
  16355. /**
  16356. * @license
  16357. * Copyright 2018 Google Inc.
  16358. *
  16359. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16360. * of this software and associated documentation files (the "Software"), to deal
  16361. * in the Software without restriction, including without limitation the rights
  16362. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16363. * copies of the Software, and to permit persons to whom the Software is
  16364. * furnished to do so, subject to the following conditions:
  16365. *
  16366. * The above copyright notice and this permission notice shall be included in
  16367. * all copies or substantial portions of the Software.
  16368. *
  16369. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16370. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16371. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16372. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16373. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16374. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16375. * THE SOFTWARE.
  16376. */
  16377. var __extends = this && this.__extends || function () {
  16378. var _extendStatics = function extendStatics(d, b) {
  16379. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16380. d.__proto__ = b;
  16381. } || function (d, b) {
  16382. for (var p in b) {
  16383. if (b.hasOwnProperty(p)) d[p] = b[p];
  16384. }
  16385. };
  16386. return _extendStatics(d, b);
  16387. };
  16388. return function (d, b) {
  16389. _extendStatics(d, b);
  16390. function __() {
  16391. this.constructor = d;
  16392. }
  16393. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16394. };
  16395. }();
  16396. var __assign = this && this.__assign || function () {
  16397. __assign = Object.assign || function (t) {
  16398. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16399. s = arguments[i];
  16400. for (var p in s) {
  16401. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16402. }
  16403. }
  16404. return t;
  16405. };
  16406. return __assign.apply(this, arguments);
  16407. };
  16408. Object.defineProperty(exports, "__esModule", { value: true });
  16409. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  16410. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  16411. var OPENING = constants_1.cssClasses.OPENING,
  16412. OPEN = constants_1.cssClasses.OPEN,
  16413. CLOSING = constants_1.cssClasses.CLOSING;
  16414. var REASON_ACTION = constants_1.strings.REASON_ACTION,
  16415. REASON_DISMISS = constants_1.strings.REASON_DISMISS;
  16416. var MDCSnackbarFoundation = /** @class */function (_super) {
  16417. __extends(MDCSnackbarFoundation, _super);
  16418. function MDCSnackbarFoundation(adapter) {
  16419. var _this = _super.call(this, __assign(__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this;
  16420. _this.isOpen_ = false;
  16421. _this.animationFrame_ = 0;
  16422. _this.animationTimer_ = 0;
  16423. _this.autoDismissTimer_ = 0;
  16424. _this.autoDismissTimeoutMs_ = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
  16425. _this.closeOnEscape_ = true;
  16426. return _this;
  16427. }
  16428. Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
  16429. get: function get() {
  16430. return constants_1.cssClasses;
  16431. },
  16432. enumerable: true,
  16433. configurable: true
  16434. });
  16435. Object.defineProperty(MDCSnackbarFoundation, "strings", {
  16436. get: function get() {
  16437. return constants_1.strings;
  16438. },
  16439. enumerable: true,
  16440. configurable: true
  16441. });
  16442. Object.defineProperty(MDCSnackbarFoundation, "numbers", {
  16443. get: function get() {
  16444. return constants_1.numbers;
  16445. },
  16446. enumerable: true,
  16447. configurable: true
  16448. });
  16449. Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
  16450. get: function get() {
  16451. return {
  16452. addClass: function addClass() {
  16453. return undefined;
  16454. },
  16455. announce: function announce() {
  16456. return undefined;
  16457. },
  16458. notifyClosed: function notifyClosed() {
  16459. return undefined;
  16460. },
  16461. notifyClosing: function notifyClosing() {
  16462. return undefined;
  16463. },
  16464. notifyOpened: function notifyOpened() {
  16465. return undefined;
  16466. },
  16467. notifyOpening: function notifyOpening() {
  16468. return undefined;
  16469. },
  16470. removeClass: function removeClass() {
  16471. return undefined;
  16472. }
  16473. };
  16474. },
  16475. enumerable: true,
  16476. configurable: true
  16477. });
  16478. MDCSnackbarFoundation.prototype.destroy = function () {
  16479. this.clearAutoDismissTimer_();
  16480. cancelAnimationFrame(this.animationFrame_);
  16481. this.animationFrame_ = 0;
  16482. clearTimeout(this.animationTimer_);
  16483. this.animationTimer_ = 0;
  16484. this.adapter.removeClass(OPENING);
  16485. this.adapter.removeClass(OPEN);
  16486. this.adapter.removeClass(CLOSING);
  16487. };
  16488. MDCSnackbarFoundation.prototype.open = function () {
  16489. var _this = this;
  16490. this.clearAutoDismissTimer_();
  16491. this.isOpen_ = true;
  16492. this.adapter.notifyOpening();
  16493. this.adapter.removeClass(CLOSING);
  16494. this.adapter.addClass(OPENING);
  16495. this.adapter.announce();
  16496. // Wait a frame once display is no longer "none", to establish basis for animation
  16497. this.runNextAnimationFrame_(function () {
  16498. _this.adapter.addClass(OPEN);
  16499. _this.animationTimer_ = setTimeout(function () {
  16500. var timeoutMs = _this.getTimeoutMs();
  16501. _this.handleAnimationTimerEnd_();
  16502. _this.adapter.notifyOpened();
  16503. if (timeoutMs !== constants_1.numbers.INDETERMINATE) {
  16504. _this.autoDismissTimer_ = setTimeout(function () {
  16505. _this.close(REASON_DISMISS);
  16506. }, timeoutMs);
  16507. }
  16508. }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
  16509. });
  16510. };
  16511. /**
  16512. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  16513. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  16514. * client-specific values may also be used if desired.
  16515. */
  16516. MDCSnackbarFoundation.prototype.close = function (reason) {
  16517. var _this = this;
  16518. if (reason === void 0) {
  16519. reason = '';
  16520. }
  16521. if (!this.isOpen_) {
  16522. // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed
  16523. return;
  16524. }
  16525. cancelAnimationFrame(this.animationFrame_);
  16526. this.animationFrame_ = 0;
  16527. this.clearAutoDismissTimer_();
  16528. this.isOpen_ = false;
  16529. this.adapter.notifyClosing(reason);
  16530. this.adapter.addClass(constants_1.cssClasses.CLOSING);
  16531. this.adapter.removeClass(constants_1.cssClasses.OPEN);
  16532. this.adapter.removeClass(constants_1.cssClasses.OPENING);
  16533. clearTimeout(this.animationTimer_);
  16534. this.animationTimer_ = setTimeout(function () {
  16535. _this.handleAnimationTimerEnd_();
  16536. _this.adapter.notifyClosed(reason);
  16537. }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
  16538. };
  16539. MDCSnackbarFoundation.prototype.isOpen = function () {
  16540. return this.isOpen_;
  16541. };
  16542. MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
  16543. return this.autoDismissTimeoutMs_;
  16544. };
  16545. MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
  16546. // Use shorter variable names to make the code more readable
  16547. var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
  16548. var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
  16549. var indeterminateValue = constants_1.numbers.INDETERMINATE;
  16550. if (timeoutMs === constants_1.numbers.INDETERMINATE || timeoutMs <= maxValue && timeoutMs >= minValue) {
  16551. this.autoDismissTimeoutMs_ = timeoutMs;
  16552. } else {
  16553. throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'");
  16554. }
  16555. };
  16556. MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
  16557. return this.closeOnEscape_;
  16558. };
  16559. MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
  16560. this.closeOnEscape_ = closeOnEscape;
  16561. };
  16562. MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
  16563. var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
  16564. if (isEscapeKey && this.getCloseOnEscape()) {
  16565. this.close(REASON_DISMISS);
  16566. }
  16567. };
  16568. MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
  16569. this.close(REASON_ACTION);
  16570. };
  16571. MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
  16572. this.close(REASON_DISMISS);
  16573. };
  16574. MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () {
  16575. clearTimeout(this.autoDismissTimer_);
  16576. this.autoDismissTimer_ = 0;
  16577. };
  16578. MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () {
  16579. this.animationTimer_ = 0;
  16580. this.adapter.removeClass(constants_1.cssClasses.OPENING);
  16581. this.adapter.removeClass(constants_1.cssClasses.CLOSING);
  16582. };
  16583. /**
  16584. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  16585. */
  16586. MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  16587. var _this = this;
  16588. cancelAnimationFrame(this.animationFrame_);
  16589. this.animationFrame_ = requestAnimationFrame(function () {
  16590. _this.animationFrame_ = 0;
  16591. clearTimeout(_this.animationTimer_);
  16592. _this.animationTimer_ = setTimeout(callback, 0);
  16593. });
  16594. };
  16595. return MDCSnackbarFoundation;
  16596. }(foundation_1.MDCFoundation);
  16597. exports.MDCSnackbarFoundation = MDCSnackbarFoundation;
  16598. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16599. exports.default = MDCSnackbarFoundation;
  16600. /***/ }),
  16601. /***/ "./packages/mdc-snackbar/index.ts":
  16602. /*!****************************************!*\
  16603. !*** ./packages/mdc-snackbar/index.ts ***!
  16604. \****************************************/
  16605. /*! no static exports found */
  16606. /***/ (function(module, exports, __webpack_require__) {
  16607. "use strict";
  16608. /**
  16609. * @license
  16610. * Copyright 2019 Google Inc.
  16611. *
  16612. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16613. * of this software and associated documentation files (the "Software"), to deal
  16614. * in the Software without restriction, including without limitation the rights
  16615. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16616. * copies of the Software, and to permit persons to whom the Software is
  16617. * furnished to do so, subject to the following conditions:
  16618. *
  16619. * The above copyright notice and this permission notice shall be included in
  16620. * all copies or substantial portions of the Software.
  16621. *
  16622. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16623. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16624. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16625. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16626. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16627. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16628. * THE SOFTWARE.
  16629. */
  16630. function __export(m) {
  16631. for (var p in m) {
  16632. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16633. }
  16634. }
  16635. var __importStar = this && this.__importStar || function (mod) {
  16636. if (mod && mod.__esModule) return mod;
  16637. var result = {};
  16638. if (mod != null) for (var k in mod) {
  16639. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  16640. }result["default"] = mod;
  16641. return result;
  16642. };
  16643. Object.defineProperty(exports, "__esModule", { value: true });
  16644. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  16645. exports.util = util;
  16646. __export(__webpack_require__(/*! ./component */ "./packages/mdc-snackbar/component.ts"));
  16647. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"));
  16648. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"));
  16649. /***/ }),
  16650. /***/ "./packages/mdc-snackbar/util.ts":
  16651. /*!***************************************!*\
  16652. !*** ./packages/mdc-snackbar/util.ts ***!
  16653. \***************************************/
  16654. /*! no static exports found */
  16655. /***/ (function(module, exports, __webpack_require__) {
  16656. "use strict";
  16657. /**
  16658. * @license
  16659. * Copyright 2018 Google Inc.
  16660. *
  16661. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16662. * of this software and associated documentation files (the "Software"), to deal
  16663. * in the Software without restriction, including without limitation the rights
  16664. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16665. * copies of the Software, and to permit persons to whom the Software is
  16666. * furnished to do so, subject to the following conditions:
  16667. *
  16668. * The above copyright notice and this permission notice shall be included in
  16669. * all copies or substantial portions of the Software.
  16670. *
  16671. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16672. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16673. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16674. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16675. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16676. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16677. * THE SOFTWARE.
  16678. */
  16679. Object.defineProperty(exports, "__esModule", { value: true });
  16680. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  16681. var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS;
  16682. var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR;
  16683. function announce(ariaEl, labelEl) {
  16684. if (labelEl === void 0) {
  16685. labelEl = ariaEl;
  16686. }
  16687. var priority = ariaEl.getAttribute('aria-live');
  16688. // Trim text to ignore `&nbsp;` (see below).
  16689. // textContent is only null if the node is a document, DOCTYPE, or notation.
  16690. var labelText = labelEl.textContent.trim();
  16691. if (!labelText || !priority) {
  16692. return;
  16693. }
  16694. // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice.
  16695. ariaEl.setAttribute('aria-live', 'off');
  16696. // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers.
  16697. // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars
  16698. // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first.
  16699. // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event,
  16700. // so screen readers won't announce the second message unless we first clear `textContent`.
  16701. //
  16702. // We have to clear the label text two different ways to make it work in all browsers and screen readers:
  16703. //
  16704. // 1. `textContent = ''` is required for IE11 + JAWS
  16705. // 2. `innerHTML = '&nbsp;'` is required for Chrome + JAWS and NVDA
  16706. //
  16707. // All other browser/screen reader combinations support both methods.
  16708. //
  16709. // The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed.
  16710. // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change.
  16711. //
  16712. // This technique has been tested in:
  16713. //
  16714. // * JAWS 2019:
  16715. // - Chrome 70
  16716. // - Firefox 60 (ESR)
  16717. // - IE 11
  16718. // * NVDA 2018:
  16719. // - Chrome 70
  16720. // - Firefox 60 (ESR)
  16721. // - IE 11
  16722. // * ChromeVox 53
  16723. labelEl.textContent = '';
  16724. labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;">&nbsp;</span>';
  16725. // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element.
  16726. // CSS generated content is normally announced by screen readers
  16727. // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/);
  16728. // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers.
  16729. labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
  16730. setTimeout(function () {
  16731. // Allow screen readers to announce changes to the DOM again.
  16732. ariaEl.setAttribute('aria-live', priority);
  16733. // Remove the message from the ::before pseudo-element.
  16734. labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
  16735. // Restore the original label text, which will be announced by screen readers.
  16736. labelEl.textContent = labelText;
  16737. }, ARIA_LIVE_DELAY_MS);
  16738. }
  16739. exports.announce = announce;
  16740. /***/ }),
  16741. /***/ "./packages/mdc-switch/component.ts":
  16742. /*!******************************************!*\
  16743. !*** ./packages/mdc-switch/component.ts ***!
  16744. \******************************************/
  16745. /*! no static exports found */
  16746. /***/ (function(module, exports, __webpack_require__) {
  16747. "use strict";
  16748. /**
  16749. * @license
  16750. * Copyright 2018 Google Inc.
  16751. *
  16752. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16753. * of this software and associated documentation files (the "Software"), to deal
  16754. * in the Software without restriction, including without limitation the rights
  16755. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16756. * copies of the Software, and to permit persons to whom the Software is
  16757. * furnished to do so, subject to the following conditions:
  16758. *
  16759. * The above copyright notice and this permission notice shall be included in
  16760. * all copies or substantial portions of the Software.
  16761. *
  16762. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16763. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16764. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16765. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16766. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16767. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16768. * THE SOFTWARE.
  16769. */
  16770. var __extends = this && this.__extends || function () {
  16771. var _extendStatics = function extendStatics(d, b) {
  16772. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16773. d.__proto__ = b;
  16774. } || function (d, b) {
  16775. for (var p in b) {
  16776. if (b.hasOwnProperty(p)) d[p] = b[p];
  16777. }
  16778. };
  16779. return _extendStatics(d, b);
  16780. };
  16781. return function (d, b) {
  16782. _extendStatics(d, b);
  16783. function __() {
  16784. this.constructor = d;
  16785. }
  16786. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16787. };
  16788. }();
  16789. var __assign = this && this.__assign || function () {
  16790. __assign = Object.assign || function (t) {
  16791. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16792. s = arguments[i];
  16793. for (var p in s) {
  16794. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16795. }
  16796. }
  16797. return t;
  16798. };
  16799. return __assign.apply(this, arguments);
  16800. };
  16801. var __read = this && this.__read || function (o, n) {
  16802. var m = typeof Symbol === "function" && o[Symbol.iterator];
  16803. if (!m) return o;
  16804. var i = m.call(o),
  16805. r,
  16806. ar = [],
  16807. e;
  16808. try {
  16809. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  16810. ar.push(r.value);
  16811. }
  16812. } catch (error) {
  16813. e = { error: error };
  16814. } finally {
  16815. try {
  16816. if (r && !r.done && (m = i["return"])) m.call(i);
  16817. } finally {
  16818. if (e) throw e.error;
  16819. }
  16820. }
  16821. return ar;
  16822. };
  16823. var __spread = this && this.__spread || function () {
  16824. for (var ar = [], i = 0; i < arguments.length; i++) {
  16825. ar = ar.concat(__read(arguments[i]));
  16826. }return ar;
  16827. };
  16828. Object.defineProperty(exports, "__esModule", { value: true });
  16829. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16830. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  16831. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  16832. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  16833. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  16834. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts");
  16835. var MDCSwitch = /** @class */function (_super) {
  16836. __extends(MDCSwitch, _super);
  16837. function MDCSwitch() {
  16838. var _this = _super !== null && _super.apply(this, arguments) || this;
  16839. _this.ripple_ = _this.createRipple_();
  16840. return _this;
  16841. }
  16842. MDCSwitch.attachTo = function (root) {
  16843. return new MDCSwitch(root);
  16844. };
  16845. MDCSwitch.prototype.destroy = function () {
  16846. _super.prototype.destroy.call(this);
  16847. this.ripple_.destroy();
  16848. this.nativeControl_.removeEventListener('change', this.changeHandler_);
  16849. };
  16850. MDCSwitch.prototype.initialSyncWithDOM = function () {
  16851. var _this = this;
  16852. this.changeHandler_ = function () {
  16853. var _a;
  16854. var args = [];
  16855. for (var _i = 0; _i < arguments.length; _i++) {
  16856. args[_i] = arguments[_i];
  16857. }
  16858. return (_a = _this.foundation).handleChange.apply(_a, __spread(args));
  16859. };
  16860. this.nativeControl_.addEventListener('change', this.changeHandler_);
  16861. // Sometimes the checked state of the input element is saved in the history.
  16862. // The switch styling should match the checked state of the input element.
  16863. // Do an initial sync between the native control and the foundation.
  16864. this.checked = this.checked;
  16865. };
  16866. MDCSwitch.prototype.getDefaultFoundation = function () {
  16867. var _this = this;
  16868. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16869. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16870. var adapter = {
  16871. addClass: function addClass(className) {
  16872. return _this.root.classList.add(className);
  16873. },
  16874. removeClass: function removeClass(className) {
  16875. return _this.root.classList.remove(className);
  16876. },
  16877. setNativeControlChecked: function setNativeControlChecked(checked) {
  16878. return _this.nativeControl_.checked = checked;
  16879. },
  16880. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  16881. return _this.nativeControl_.disabled = disabled;
  16882. },
  16883. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  16884. return _this.nativeControl_.setAttribute(attr, value);
  16885. }
  16886. };
  16887. return new foundation_2.MDCSwitchFoundation(adapter);
  16888. };
  16889. Object.defineProperty(MDCSwitch.prototype, "ripple", {
  16890. get: function get() {
  16891. return this.ripple_;
  16892. },
  16893. enumerable: true,
  16894. configurable: true
  16895. });
  16896. Object.defineProperty(MDCSwitch.prototype, "checked", {
  16897. get: function get() {
  16898. return this.nativeControl_.checked;
  16899. },
  16900. set: function set(checked) {
  16901. this.foundation.setChecked(checked);
  16902. },
  16903. enumerable: true,
  16904. configurable: true
  16905. });
  16906. Object.defineProperty(MDCSwitch.prototype, "disabled", {
  16907. get: function get() {
  16908. return this.nativeControl_.disabled;
  16909. },
  16910. set: function set(disabled) {
  16911. this.foundation.setDisabled(disabled);
  16912. },
  16913. enumerable: true,
  16914. configurable: true
  16915. });
  16916. MDCSwitch.prototype.createRipple_ = function () {
  16917. var _this = this;
  16918. var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
  16919. var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR);
  16920. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16921. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16922. var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) {
  16923. return rippleSurface.classList.add(className);
  16924. }, computeBoundingRect: function computeBoundingRect() {
  16925. return rippleSurface.getBoundingClientRect();
  16926. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  16927. _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  16928. }, isSurfaceActive: function isSurfaceActive() {
  16929. return ponyfill_1.matches(_this.nativeControl_, ':active');
  16930. }, isUnbounded: function isUnbounded() {
  16931. return true;
  16932. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  16933. _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  16934. }, removeClass: function removeClass(className) {
  16935. rippleSurface.classList.remove(className);
  16936. }, updateCssVariable: function updateCssVariable(varName, value) {
  16937. rippleSurface.style.setProperty(varName, value);
  16938. } });
  16939. return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
  16940. };
  16941. Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
  16942. get: function get() {
  16943. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
  16944. return this.root.querySelector(NATIVE_CONTROL_SELECTOR);
  16945. },
  16946. enumerable: true,
  16947. configurable: true
  16948. });
  16949. return MDCSwitch;
  16950. }(component_1.MDCComponent);
  16951. exports.MDCSwitch = MDCSwitch;
  16952. /***/ }),
  16953. /***/ "./packages/mdc-switch/constants.ts":
  16954. /*!******************************************!*\
  16955. !*** ./packages/mdc-switch/constants.ts ***!
  16956. \******************************************/
  16957. /*! no static exports found */
  16958. /***/ (function(module, exports, __webpack_require__) {
  16959. "use strict";
  16960. /**
  16961. * @license
  16962. * Copyright 2018 Google Inc.
  16963. *
  16964. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16965. * of this software and associated documentation files (the "Software"), to deal
  16966. * in the Software without restriction, including without limitation the rights
  16967. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16968. * copies of the Software, and to permit persons to whom the Software is
  16969. * furnished to do so, subject to the following conditions:
  16970. *
  16971. * The above copyright notice and this permission notice shall be included in
  16972. * all copies or substantial portions of the Software.
  16973. *
  16974. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16975. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16976. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16977. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16978. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16979. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16980. * THE SOFTWARE.
  16981. */
  16982. Object.defineProperty(exports, "__esModule", { value: true });
  16983. /** CSS classes used by the switch. */
  16984. var cssClasses = {
  16985. /** Class used for a switch that is in the "checked" (on) position. */
  16986. CHECKED: 'mdc-switch--checked',
  16987. /** Class used for a switch that is disabled. */
  16988. DISABLED: 'mdc-switch--disabled'
  16989. };
  16990. exports.cssClasses = cssClasses;
  16991. /** String constants used by the switch. */
  16992. var strings = {
  16993. /** Aria attribute for checked or unchecked state of switch */
  16994. ARIA_CHECKED_ATTR: 'aria-checked',
  16995. /** A CSS selector used to locate the native HTML control for the switch. */
  16996. NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control',
  16997. /** A CSS selector used to locate the ripple surface element for the switch. */
  16998. RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay'
  16999. };
  17000. exports.strings = strings;
  17001. /***/ }),
  17002. /***/ "./packages/mdc-switch/foundation.ts":
  17003. /*!*******************************************!*\
  17004. !*** ./packages/mdc-switch/foundation.ts ***!
  17005. \*******************************************/
  17006. /*! no static exports found */
  17007. /***/ (function(module, exports, __webpack_require__) {
  17008. "use strict";
  17009. /**
  17010. * @license
  17011. * Copyright 2018 Google Inc.
  17012. *
  17013. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17014. * of this software and associated documentation files (the "Software"), to deal
  17015. * in the Software without restriction, including without limitation the rights
  17016. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17017. * copies of the Software, and to permit persons to whom the Software is
  17018. * furnished to do so, subject to the following conditions:
  17019. *
  17020. * The above copyright notice and this permission notice shall be included in
  17021. * all copies or substantial portions of the Software.
  17022. *
  17023. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17024. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17025. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17026. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17027. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17028. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17029. * THE SOFTWARE.
  17030. */
  17031. var __extends = this && this.__extends || function () {
  17032. var _extendStatics = function extendStatics(d, b) {
  17033. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17034. d.__proto__ = b;
  17035. } || function (d, b) {
  17036. for (var p in b) {
  17037. if (b.hasOwnProperty(p)) d[p] = b[p];
  17038. }
  17039. };
  17040. return _extendStatics(d, b);
  17041. };
  17042. return function (d, b) {
  17043. _extendStatics(d, b);
  17044. function __() {
  17045. this.constructor = d;
  17046. }
  17047. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17048. };
  17049. }();
  17050. var __assign = this && this.__assign || function () {
  17051. __assign = Object.assign || function (t) {
  17052. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17053. s = arguments[i];
  17054. for (var p in s) {
  17055. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17056. }
  17057. }
  17058. return t;
  17059. };
  17060. return __assign.apply(this, arguments);
  17061. };
  17062. Object.defineProperty(exports, "__esModule", { value: true });
  17063. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  17064. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts");
  17065. var MDCSwitchFoundation = /** @class */function (_super) {
  17066. __extends(MDCSwitchFoundation, _super);
  17067. function MDCSwitchFoundation(adapter) {
  17068. return _super.call(this, __assign(__assign({}, MDCSwitchFoundation.defaultAdapter), adapter)) || this;
  17069. }
  17070. Object.defineProperty(MDCSwitchFoundation, "strings", {
  17071. /** The string constants used by the switch. */
  17072. get: function get() {
  17073. return constants_1.strings;
  17074. },
  17075. enumerable: true,
  17076. configurable: true
  17077. });
  17078. Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
  17079. /** The CSS classes used by the switch. */
  17080. get: function get() {
  17081. return constants_1.cssClasses;
  17082. },
  17083. enumerable: true,
  17084. configurable: true
  17085. });
  17086. Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
  17087. /** The default Adapter for the switch. */
  17088. get: function get() {
  17089. return {
  17090. addClass: function addClass() {
  17091. return undefined;
  17092. },
  17093. removeClass: function removeClass() {
  17094. return undefined;
  17095. },
  17096. setNativeControlChecked: function setNativeControlChecked() {
  17097. return undefined;
  17098. },
  17099. setNativeControlDisabled: function setNativeControlDisabled() {
  17100. return undefined;
  17101. },
  17102. setNativeControlAttr: function setNativeControlAttr() {
  17103. return undefined;
  17104. }
  17105. };
  17106. },
  17107. enumerable: true,
  17108. configurable: true
  17109. });
  17110. /** Sets the checked state of the switch. */
  17111. MDCSwitchFoundation.prototype.setChecked = function (checked) {
  17112. this.adapter.setNativeControlChecked(checked);
  17113. this.updateAriaChecked_(checked);
  17114. this.updateCheckedStyling_(checked);
  17115. };
  17116. /** Sets the disabled state of the switch. */
  17117. MDCSwitchFoundation.prototype.setDisabled = function (disabled) {
  17118. this.adapter.setNativeControlDisabled(disabled);
  17119. if (disabled) {
  17120. this.adapter.addClass(constants_1.cssClasses.DISABLED);
  17121. } else {
  17122. this.adapter.removeClass(constants_1.cssClasses.DISABLED);
  17123. }
  17124. };
  17125. /** Handles the change event for the switch native control. */
  17126. MDCSwitchFoundation.prototype.handleChange = function (evt) {
  17127. var nativeControl = evt.target;
  17128. this.updateAriaChecked_(nativeControl.checked);
  17129. this.updateCheckedStyling_(nativeControl.checked);
  17130. };
  17131. /** Updates the styling of the switch based on its checked state. */
  17132. MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) {
  17133. if (checked) {
  17134. this.adapter.addClass(constants_1.cssClasses.CHECKED);
  17135. } else {
  17136. this.adapter.removeClass(constants_1.cssClasses.CHECKED);
  17137. }
  17138. };
  17139. MDCSwitchFoundation.prototype.updateAriaChecked_ = function (checked) {
  17140. this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, "" + !!checked);
  17141. };
  17142. return MDCSwitchFoundation;
  17143. }(foundation_1.MDCFoundation);
  17144. exports.MDCSwitchFoundation = MDCSwitchFoundation;
  17145. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17146. exports.default = MDCSwitchFoundation;
  17147. /***/ }),
  17148. /***/ "./packages/mdc-switch/index.ts":
  17149. /*!**************************************!*\
  17150. !*** ./packages/mdc-switch/index.ts ***!
  17151. \**************************************/
  17152. /*! no static exports found */
  17153. /***/ (function(module, exports, __webpack_require__) {
  17154. "use strict";
  17155. /**
  17156. * @license
  17157. * Copyright 2019 Google Inc.
  17158. *
  17159. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17160. * of this software and associated documentation files (the "Software"), to deal
  17161. * in the Software without restriction, including without limitation the rights
  17162. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17163. * copies of the Software, and to permit persons to whom the Software is
  17164. * furnished to do so, subject to the following conditions:
  17165. *
  17166. * The above copyright notice and this permission notice shall be included in
  17167. * all copies or substantial portions of the Software.
  17168. *
  17169. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17170. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17171. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17172. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17173. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17174. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17175. * THE SOFTWARE.
  17176. */
  17177. function __export(m) {
  17178. for (var p in m) {
  17179. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  17180. }
  17181. }
  17182. Object.defineProperty(exports, "__esModule", { value: true });
  17183. __export(__webpack_require__(/*! ./component */ "./packages/mdc-switch/component.ts"));
  17184. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"));
  17185. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"));
  17186. /***/ }),
  17187. /***/ "./packages/mdc-tab-bar/component.ts":
  17188. /*!*******************************************!*\
  17189. !*** ./packages/mdc-tab-bar/component.ts ***!
  17190. \*******************************************/
  17191. /*! no static exports found */
  17192. /***/ (function(module, exports, __webpack_require__) {
  17193. "use strict";
  17194. /**
  17195. * @license
  17196. * Copyright 2018 Google Inc.
  17197. *
  17198. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17199. * of this software and associated documentation files (the "Software"), to deal
  17200. * in the Software without restriction, including without limitation the rights
  17201. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17202. * copies of the Software, and to permit persons to whom the Software is
  17203. * furnished to do so, subject to the following conditions:
  17204. *
  17205. * The above copyright notice and this permission notice shall be included in
  17206. * all copies or substantial portions of the Software.
  17207. *
  17208. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17209. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17210. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17211. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17212. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17213. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17214. * THE SOFTWARE.
  17215. */
  17216. var __extends = this && this.__extends || function () {
  17217. var _extendStatics = function extendStatics(d, b) {
  17218. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17219. d.__proto__ = b;
  17220. } || function (d, b) {
  17221. for (var p in b) {
  17222. if (b.hasOwnProperty(p)) d[p] = b[p];
  17223. }
  17224. };
  17225. return _extendStatics(d, b);
  17226. };
  17227. return function (d, b) {
  17228. _extendStatics(d, b);
  17229. function __() {
  17230. this.constructor = d;
  17231. }
  17232. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17233. };
  17234. }();
  17235. Object.defineProperty(exports, "__esModule", { value: true });
  17236. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  17237. var component_2 = __webpack_require__(/*! @material/tab-scroller/component */ "./packages/mdc-tab-scroller/component.ts");
  17238. var component_3 = __webpack_require__(/*! @material/tab/component */ "./packages/mdc-tab/component.ts");
  17239. var foundation_1 = __webpack_require__(/*! @material/tab/foundation */ "./packages/mdc-tab/foundation.ts");
  17240. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts");
  17241. var strings = foundation_2.MDCTabBarFoundation.strings;
  17242. var tabIdCounter = 0;
  17243. var MDCTabBar = /** @class */function (_super) {
  17244. __extends(MDCTabBar, _super);
  17245. function MDCTabBar() {
  17246. return _super !== null && _super.apply(this, arguments) || this;
  17247. }
  17248. MDCTabBar.attachTo = function (root) {
  17249. return new MDCTabBar(root);
  17250. };
  17251. Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", {
  17252. set: function set(focusOnActivate) {
  17253. this.tabList_.forEach(function (tab) {
  17254. return tab.focusOnActivate = focusOnActivate;
  17255. });
  17256. },
  17257. enumerable: true,
  17258. configurable: true
  17259. });
  17260. Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", {
  17261. set: function set(useAutomaticActivation) {
  17262. this.foundation.setUseAutomaticActivation(useAutomaticActivation);
  17263. },
  17264. enumerable: true,
  17265. configurable: true
  17266. });
  17267. MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {
  17268. if (tabFactory === void 0) {
  17269. tabFactory = function tabFactory(el) {
  17270. return new component_3.MDCTab(el);
  17271. };
  17272. }
  17273. if (tabScrollerFactory === void 0) {
  17274. tabScrollerFactory = function tabScrollerFactory(el) {
  17275. return new component_2.MDCTabScroller(el);
  17276. };
  17277. }
  17278. this.tabList_ = this.instantiateTabs_(tabFactory);
  17279. this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory);
  17280. };
  17281. MDCTabBar.prototype.initialSyncWithDOM = function () {
  17282. var _this = this;
  17283. this.handleTabInteraction_ = function (evt) {
  17284. return _this.foundation.handleTabInteraction(evt);
  17285. };
  17286. this.handleKeyDown_ = function (evt) {
  17287. return _this.foundation.handleKeyDown(evt);
  17288. };
  17289. this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  17290. this.listen('keydown', this.handleKeyDown_);
  17291. for (var i = 0; i < this.tabList_.length; i++) {
  17292. if (this.tabList_[i].active) {
  17293. this.scrollIntoView(i);
  17294. break;
  17295. }
  17296. }
  17297. };
  17298. MDCTabBar.prototype.destroy = function () {
  17299. _super.prototype.destroy.call(this);
  17300. this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  17301. this.unlisten('keydown', this.handleKeyDown_);
  17302. this.tabList_.forEach(function (tab) {
  17303. return tab.destroy();
  17304. });
  17305. if (this.tabScroller_) {
  17306. this.tabScroller_.destroy();
  17307. }
  17308. };
  17309. MDCTabBar.prototype.getDefaultFoundation = function () {
  17310. var _this = this;
  17311. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  17312. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  17313. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17314. var adapter = {
  17315. scrollTo: function scrollTo(scrollX) {
  17316. return _this.tabScroller_.scrollTo(scrollX);
  17317. },
  17318. incrementScroll: function incrementScroll(scrollXIncrement) {
  17319. return _this.tabScroller_.incrementScroll(scrollXIncrement);
  17320. },
  17321. getScrollPosition: function getScrollPosition() {
  17322. return _this.tabScroller_.getScrollPosition();
  17323. },
  17324. getScrollContentWidth: function getScrollContentWidth() {
  17325. return _this.tabScroller_.getScrollContentWidth();
  17326. },
  17327. getOffsetWidth: function getOffsetWidth() {
  17328. return _this.root.offsetWidth;
  17329. },
  17330. isRTL: function isRTL() {
  17331. return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
  17332. },
  17333. setActiveTab: function setActiveTab(index) {
  17334. return _this.foundation.activateTab(index);
  17335. },
  17336. activateTabAtIndex: function activateTabAtIndex(index, clientRect) {
  17337. return _this.tabList_[index].activate(clientRect);
  17338. },
  17339. deactivateTabAtIndex: function deactivateTabAtIndex(index) {
  17340. return _this.tabList_[index].deactivate();
  17341. },
  17342. focusTabAtIndex: function focusTabAtIndex(index) {
  17343. return _this.tabList_[index].focus();
  17344. },
  17345. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) {
  17346. return _this.tabList_[index].computeIndicatorClientRect();
  17347. },
  17348. getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) {
  17349. return _this.tabList_[index].computeDimensions();
  17350. },
  17351. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  17352. for (var i = 0; i < _this.tabList_.length; i++) {
  17353. if (_this.tabList_[i].active) {
  17354. return i;
  17355. }
  17356. }
  17357. return -1;
  17358. },
  17359. getFocusedTabIndex: function getFocusedTabIndex() {
  17360. var tabElements = _this.getTabElements_();
  17361. var activeElement = document.activeElement;
  17362. return tabElements.indexOf(activeElement);
  17363. },
  17364. getIndexOfTabById: function getIndexOfTabById(id) {
  17365. for (var i = 0; i < _this.tabList_.length; i++) {
  17366. if (_this.tabList_[i].id === id) {
  17367. return i;
  17368. }
  17369. }
  17370. return -1;
  17371. },
  17372. getTabListLength: function getTabListLength() {
  17373. return _this.tabList_.length;
  17374. },
  17375. notifyTabActivated: function notifyTabActivated(index) {
  17376. return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true);
  17377. }
  17378. };
  17379. // tslint:enable:object-literal-sort-keys
  17380. return new foundation_2.MDCTabBarFoundation(adapter);
  17381. };
  17382. /**
  17383. * Activates the tab at the given index
  17384. * @param index The index of the tab
  17385. */
  17386. MDCTabBar.prototype.activateTab = function (index) {
  17387. this.foundation.activateTab(index);
  17388. };
  17389. /**
  17390. * Scrolls the tab at the given index into view
  17391. * @param index THe index of the tab
  17392. */
  17393. MDCTabBar.prototype.scrollIntoView = function (index) {
  17394. this.foundation.scrollIntoView(index);
  17395. };
  17396. /**
  17397. * Returns all the tab elements in a nice clean array
  17398. */
  17399. MDCTabBar.prototype.getTabElements_ = function () {
  17400. return [].slice.call(this.root.querySelectorAll(strings.TAB_SELECTOR));
  17401. };
  17402. /**
  17403. * Instantiates tab components on all child tab elements
  17404. */
  17405. MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) {
  17406. return this.getTabElements_().map(function (el) {
  17407. el.id = el.id || "mdc-tab-" + ++tabIdCounter;
  17408. return tabFactory(el);
  17409. });
  17410. };
  17411. /**
  17412. * Instantiates tab scroller component on the child tab scroller element
  17413. */
  17414. MDCTabBar.prototype.instantiateTabScroller_ = function (tabScrollerFactory) {
  17415. var tabScrollerElement = this.root.querySelector(strings.TAB_SCROLLER_SELECTOR);
  17416. if (tabScrollerElement) {
  17417. return tabScrollerFactory(tabScrollerElement);
  17418. }
  17419. return null;
  17420. };
  17421. return MDCTabBar;
  17422. }(component_1.MDCComponent);
  17423. exports.MDCTabBar = MDCTabBar;
  17424. /***/ }),
  17425. /***/ "./packages/mdc-tab-bar/constants.ts":
  17426. /*!*******************************************!*\
  17427. !*** ./packages/mdc-tab-bar/constants.ts ***!
  17428. \*******************************************/
  17429. /*! no static exports found */
  17430. /***/ (function(module, exports, __webpack_require__) {
  17431. "use strict";
  17432. /**
  17433. * @license
  17434. * Copyright 2018 Google Inc.
  17435. *
  17436. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17437. * of this software and associated documentation files (the "Software"), to deal
  17438. * in the Software without restriction, including without limitation the rights
  17439. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17440. * copies of the Software, and to permit persons to whom the Software is
  17441. * furnished to do so, subject to the following conditions:
  17442. *
  17443. * The above copyright notice and this permission notice shall be included in
  17444. * all copies or substantial portions of the Software.
  17445. *
  17446. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17447. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17448. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17449. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17450. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17451. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17452. * THE SOFTWARE.
  17453. */
  17454. Object.defineProperty(exports, "__esModule", { value: true });
  17455. var strings = {
  17456. ARROW_LEFT_KEY: 'ArrowLeft',
  17457. ARROW_RIGHT_KEY: 'ArrowRight',
  17458. END_KEY: 'End',
  17459. ENTER_KEY: 'Enter',
  17460. HOME_KEY: 'Home',
  17461. SPACE_KEY: 'Space',
  17462. TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
  17463. TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
  17464. TAB_SELECTOR: '.mdc-tab'
  17465. };
  17466. exports.strings = strings;
  17467. var numbers = {
  17468. ARROW_LEFT_KEYCODE: 37,
  17469. ARROW_RIGHT_KEYCODE: 39,
  17470. END_KEYCODE: 35,
  17471. ENTER_KEYCODE: 13,
  17472. EXTRA_SCROLL_AMOUNT: 20,
  17473. HOME_KEYCODE: 36,
  17474. SPACE_KEYCODE: 32
  17475. };
  17476. exports.numbers = numbers;
  17477. /***/ }),
  17478. /***/ "./packages/mdc-tab-bar/foundation.ts":
  17479. /*!********************************************!*\
  17480. !*** ./packages/mdc-tab-bar/foundation.ts ***!
  17481. \********************************************/
  17482. /*! no static exports found */
  17483. /***/ (function(module, exports, __webpack_require__) {
  17484. "use strict";
  17485. /**
  17486. * @license
  17487. * Copyright 2018 Google Inc.
  17488. *
  17489. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17490. * of this software and associated documentation files (the "Software"), to deal
  17491. * in the Software without restriction, including without limitation the rights
  17492. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17493. * copies of the Software, and to permit persons to whom the Software is
  17494. * furnished to do so, subject to the following conditions:
  17495. *
  17496. * The above copyright notice and this permission notice shall be included in
  17497. * all copies or substantial portions of the Software.
  17498. *
  17499. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17500. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17501. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17502. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17503. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17504. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17505. * THE SOFTWARE.
  17506. */
  17507. var __extends = this && this.__extends || function () {
  17508. var _extendStatics = function extendStatics(d, b) {
  17509. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17510. d.__proto__ = b;
  17511. } || function (d, b) {
  17512. for (var p in b) {
  17513. if (b.hasOwnProperty(p)) d[p] = b[p];
  17514. }
  17515. };
  17516. return _extendStatics(d, b);
  17517. };
  17518. return function (d, b) {
  17519. _extendStatics(d, b);
  17520. function __() {
  17521. this.constructor = d;
  17522. }
  17523. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17524. };
  17525. }();
  17526. var __assign = this && this.__assign || function () {
  17527. __assign = Object.assign || function (t) {
  17528. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17529. s = arguments[i];
  17530. for (var p in s) {
  17531. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17532. }
  17533. }
  17534. return t;
  17535. };
  17536. return __assign.apply(this, arguments);
  17537. };
  17538. Object.defineProperty(exports, "__esModule", { value: true });
  17539. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  17540. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts");
  17541. var ACCEPTABLE_KEYS = new Set();
  17542. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  17543. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY);
  17544. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY);
  17545. ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY);
  17546. ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY);
  17547. ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY);
  17548. ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY);
  17549. var KEYCODE_MAP = new Map();
  17550. // IE11 has no support for new Map with iterable so we need to initialize this by hand
  17551. KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY);
  17552. KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY);
  17553. KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY);
  17554. KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY);
  17555. KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY);
  17556. KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY);
  17557. var MDCTabBarFoundation = /** @class */function (_super) {
  17558. __extends(MDCTabBarFoundation, _super);
  17559. function MDCTabBarFoundation(adapter) {
  17560. var _this = _super.call(this, __assign(__assign({}, MDCTabBarFoundation.defaultAdapter), adapter)) || this;
  17561. _this.useAutomaticActivation_ = false;
  17562. return _this;
  17563. }
  17564. Object.defineProperty(MDCTabBarFoundation, "strings", {
  17565. get: function get() {
  17566. return constants_1.strings;
  17567. },
  17568. enumerable: true,
  17569. configurable: true
  17570. });
  17571. Object.defineProperty(MDCTabBarFoundation, "numbers", {
  17572. get: function get() {
  17573. return constants_1.numbers;
  17574. },
  17575. enumerable: true,
  17576. configurable: true
  17577. });
  17578. Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", {
  17579. get: function get() {
  17580. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17581. return {
  17582. scrollTo: function scrollTo() {
  17583. return undefined;
  17584. },
  17585. incrementScroll: function incrementScroll() {
  17586. return undefined;
  17587. },
  17588. getScrollPosition: function getScrollPosition() {
  17589. return 0;
  17590. },
  17591. getScrollContentWidth: function getScrollContentWidth() {
  17592. return 0;
  17593. },
  17594. getOffsetWidth: function getOffsetWidth() {
  17595. return 0;
  17596. },
  17597. isRTL: function isRTL() {
  17598. return false;
  17599. },
  17600. setActiveTab: function setActiveTab() {
  17601. return undefined;
  17602. },
  17603. activateTabAtIndex: function activateTabAtIndex() {
  17604. return undefined;
  17605. },
  17606. deactivateTabAtIndex: function deactivateTabAtIndex() {
  17607. return undefined;
  17608. },
  17609. focusTabAtIndex: function focusTabAtIndex() {
  17610. return undefined;
  17611. },
  17612. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() {
  17613. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  17614. },
  17615. getTabDimensionsAtIndex: function getTabDimensionsAtIndex() {
  17616. return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
  17617. },
  17618. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  17619. return -1;
  17620. },
  17621. getFocusedTabIndex: function getFocusedTabIndex() {
  17622. return -1;
  17623. },
  17624. getIndexOfTabById: function getIndexOfTabById() {
  17625. return -1;
  17626. },
  17627. getTabListLength: function getTabListLength() {
  17628. return 0;
  17629. },
  17630. notifyTabActivated: function notifyTabActivated() {
  17631. return undefined;
  17632. }
  17633. };
  17634. // tslint:enable:object-literal-sort-keys
  17635. },
  17636. enumerable: true,
  17637. configurable: true
  17638. });
  17639. /**
  17640. * Switches between automatic and manual activation modes.
  17641. * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples.
  17642. */
  17643. MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {
  17644. this.useAutomaticActivation_ = useAutomaticActivation;
  17645. };
  17646. MDCTabBarFoundation.prototype.activateTab = function (index) {
  17647. var previousActiveIndex = this.adapter.getPreviousActiveTabIndex();
  17648. if (!this.indexIsInRange_(index) || index === previousActiveIndex) {
  17649. return;
  17650. }
  17651. var previousClientRect;
  17652. if (previousActiveIndex !== -1) {
  17653. this.adapter.deactivateTabAtIndex(previousActiveIndex);
  17654. previousClientRect = this.adapter.getTabIndicatorClientRectAtIndex(previousActiveIndex);
  17655. }
  17656. this.adapter.activateTabAtIndex(index, previousClientRect);
  17657. this.scrollIntoView(index);
  17658. this.adapter.notifyTabActivated(index);
  17659. };
  17660. MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {
  17661. // Get the key from the event
  17662. var key = this.getKeyFromEvent_(evt);
  17663. // Early exit if the event key isn't one of the keyboard navigation keys
  17664. if (key === undefined) {
  17665. return;
  17666. }
  17667. // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple
  17668. if (!this.isActivationKey_(key)) {
  17669. evt.preventDefault();
  17670. }
  17671. if (this.useAutomaticActivation_) {
  17672. if (this.isActivationKey_(key)) {
  17673. return;
  17674. }
  17675. var index = this.determineTargetFromKey_(this.adapter.getPreviousActiveTabIndex(), key);
  17676. this.adapter.setActiveTab(index);
  17677. this.scrollIntoView(index);
  17678. } else {
  17679. var focusedTabIndex = this.adapter.getFocusedTabIndex();
  17680. if (this.isActivationKey_(key)) {
  17681. this.adapter.setActiveTab(focusedTabIndex);
  17682. } else {
  17683. var index = this.determineTargetFromKey_(focusedTabIndex, key);
  17684. this.adapter.focusTabAtIndex(index);
  17685. this.scrollIntoView(index);
  17686. }
  17687. }
  17688. };
  17689. /**
  17690. * Handles the MDCTab:interacted event
  17691. */
  17692. MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {
  17693. this.adapter.setActiveTab(this.adapter.getIndexOfTabById(evt.detail.tabId));
  17694. };
  17695. /**
  17696. * Scrolls the tab at the given index into view
  17697. * @param index The tab index to make visible
  17698. */
  17699. MDCTabBarFoundation.prototype.scrollIntoView = function (index) {
  17700. // Early exit if the index is out of range
  17701. if (!this.indexIsInRange_(index)) {
  17702. return;
  17703. }
  17704. // Always scroll to 0 if scrolling to the 0th index
  17705. if (index === 0) {
  17706. return this.adapter.scrollTo(0);
  17707. }
  17708. // Always scroll to the max value if scrolling to the Nth index
  17709. // MDCTabScroller.scrollTo() will never scroll past the max possible value
  17710. if (index === this.adapter.getTabListLength() - 1) {
  17711. return this.adapter.scrollTo(this.adapter.getScrollContentWidth());
  17712. }
  17713. if (this.isRTL_()) {
  17714. return this.scrollIntoViewRTL_(index);
  17715. }
  17716. this.scrollIntoView_(index);
  17717. };
  17718. /**
  17719. * Private method for determining the index of the destination tab based on what key was pressed
  17720. * @param origin The original index from which to determine the destination
  17721. * @param key The name of the key
  17722. */
  17723. MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) {
  17724. var isRTL = this.isRTL_();
  17725. var maxIndex = this.adapter.getTabListLength() - 1;
  17726. var shouldGoToEnd = key === constants_1.strings.END_KEY;
  17727. var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL;
  17728. var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL;
  17729. var index = origin;
  17730. if (shouldGoToEnd) {
  17731. index = maxIndex;
  17732. } else if (shouldDecrement) {
  17733. index -= 1;
  17734. } else if (shouldIncrement) {
  17735. index += 1;
  17736. } else {
  17737. index = 0;
  17738. }
  17739. if (index < 0) {
  17740. index = maxIndex;
  17741. } else if (index > maxIndex) {
  17742. index = 0;
  17743. }
  17744. return index;
  17745. };
  17746. /**
  17747. * Calculates the scroll increment that will make the tab at the given index visible
  17748. * @param index The index of the tab
  17749. * @param nextIndex The index of the next tab
  17750. * @param scrollPosition The current scroll position
  17751. * @param barWidth The width of the Tab Bar
  17752. */
  17753. MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) {
  17754. var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);
  17755. var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
  17756. var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
  17757. var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  17758. var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  17759. if (nextIndex < index) {
  17760. return Math.min(leftIncrement, 0);
  17761. }
  17762. return Math.max(rightIncrement, 0);
  17763. };
  17764. /**
  17765. * Calculates the scroll increment that will make the tab at the given index visible in RTL
  17766. * @param index The index of the tab
  17767. * @param nextIndex The index of the next tab
  17768. * @param scrollPosition The current scroll position
  17769. * @param barWidth The width of the Tab Bar
  17770. * @param scrollContentWidth The width of the scroll content
  17771. */
  17772. MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {
  17773. var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);
  17774. var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;
  17775. var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;
  17776. var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  17777. var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  17778. if (nextIndex > index) {
  17779. return Math.max(leftIncrement, 0);
  17780. }
  17781. return Math.min(rightIncrement, 0);
  17782. };
  17783. /**
  17784. * Determines the index of the adjacent tab closest to either edge of the Tab Bar
  17785. * @param index The index of the tab
  17786. * @param tabDimensions The dimensions of the tab
  17787. * @param scrollPosition The current scroll position
  17788. * @param barWidth The width of the tab bar
  17789. */
  17790. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) {
  17791. /**
  17792. * Tabs are laid out in the Tab Scroller like this:
  17793. *
  17794. * Scroll Position
  17795. * +---+
  17796. * | | Bar Width
  17797. * | +-----------------------------------+
  17798. * | | |
  17799. * | V V
  17800. * | +-----------------------------------+
  17801. * V | Tab Scroller |
  17802. * +------------+--------------+-------------------+
  17803. * | Tab | Tab | Tab |
  17804. * +------------+--------------+-------------------+
  17805. * | |
  17806. * +-----------------------------------+
  17807. *
  17808. * To determine the next adjacent index, we look at the Tab root left and
  17809. * Tab root right, both relative to the scroll position. If the Tab root
  17810. * left is less than 0, then we know it's out of view to the left. If the
  17811. * Tab root right minus the bar width is greater than 0, we know the Tab is
  17812. * out of view to the right. From there, we either increment or decrement
  17813. * the index.
  17814. */
  17815. var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
  17816. var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
  17817. var relativeRootDelta = relativeRootLeft + relativeRootRight;
  17818. var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
  17819. var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
  17820. if (leftEdgeIsCloser) {
  17821. return index - 1;
  17822. }
  17823. if (rightEdgeIsCloser) {
  17824. return index + 1;
  17825. }
  17826. return -1;
  17827. };
  17828. /**
  17829. * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL
  17830. * @param index The index of the tab
  17831. * @param tabDimensions The dimensions of the tab
  17832. * @param scrollPosition The current scroll position
  17833. * @param barWidth The width of the tab bar
  17834. * @param scrollContentWidth The width of the scroller content
  17835. */
  17836. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {
  17837. var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;
  17838. var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;
  17839. var rootDelta = rootLeft + rootRight;
  17840. var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;
  17841. var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;
  17842. if (leftEdgeIsCloser) {
  17843. return index + 1;
  17844. }
  17845. if (rightEdgeIsCloser) {
  17846. return index - 1;
  17847. }
  17848. return -1;
  17849. };
  17850. /**
  17851. * Returns the key associated with a keydown event
  17852. * @param evt The keydown event
  17853. */
  17854. MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) {
  17855. if (ACCEPTABLE_KEYS.has(evt.key)) {
  17856. return evt.key;
  17857. }
  17858. return KEYCODE_MAP.get(evt.keyCode);
  17859. };
  17860. MDCTabBarFoundation.prototype.isActivationKey_ = function (key) {
  17861. return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY;
  17862. };
  17863. /**
  17864. * Returns whether a given index is inclusively between the ends
  17865. * @param index The index to test
  17866. */
  17867. MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) {
  17868. return index >= 0 && index < this.adapter.getTabListLength();
  17869. };
  17870. /**
  17871. * Returns the view's RTL property
  17872. */
  17873. MDCTabBarFoundation.prototype.isRTL_ = function () {
  17874. return this.adapter.isRTL();
  17875. };
  17876. /**
  17877. * Scrolls the tab at the given index into view for left-to-right user agents.
  17878. * @param index The index of the tab to scroll into view
  17879. */
  17880. MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) {
  17881. var scrollPosition = this.adapter.getScrollPosition();
  17882. var barWidth = this.adapter.getOffsetWidth();
  17883. var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);
  17884. var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth);
  17885. if (!this.indexIsInRange_(nextIndex)) {
  17886. return;
  17887. }
  17888. var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth);
  17889. this.adapter.incrementScroll(scrollIncrement);
  17890. };
  17891. /**
  17892. * Scrolls the tab at the given index into view in RTL
  17893. * @param index The tab index to make visible
  17894. */
  17895. MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) {
  17896. var scrollPosition = this.adapter.getScrollPosition();
  17897. var barWidth = this.adapter.getOffsetWidth();
  17898. var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);
  17899. var scrollWidth = this.adapter.getScrollContentWidth();
  17900. var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth);
  17901. if (!this.indexIsInRange_(nextIndex)) {
  17902. return;
  17903. }
  17904. var scrollIncrement = this.calculateScrollIncrementRTL_(index, nextIndex, scrollPosition, barWidth, scrollWidth);
  17905. this.adapter.incrementScroll(scrollIncrement);
  17906. };
  17907. return MDCTabBarFoundation;
  17908. }(foundation_1.MDCFoundation);
  17909. exports.MDCTabBarFoundation = MDCTabBarFoundation;
  17910. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17911. exports.default = MDCTabBarFoundation;
  17912. /***/ }),
  17913. /***/ "./packages/mdc-tab-bar/index.ts":
  17914. /*!***************************************!*\
  17915. !*** ./packages/mdc-tab-bar/index.ts ***!
  17916. \***************************************/
  17917. /*! no static exports found */
  17918. /***/ (function(module, exports, __webpack_require__) {
  17919. "use strict";
  17920. /**
  17921. * @license
  17922. * Copyright 2019 Google Inc.
  17923. *
  17924. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17925. * of this software and associated documentation files (the "Software"), to deal
  17926. * in the Software without restriction, including without limitation the rights
  17927. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17928. * copies of the Software, and to permit persons to whom the Software is
  17929. * furnished to do so, subject to the following conditions:
  17930. *
  17931. * The above copyright notice and this permission notice shall be included in
  17932. * all copies or substantial portions of the Software.
  17933. *
  17934. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17935. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17936. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17937. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17938. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17939. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17940. * THE SOFTWARE.
  17941. */
  17942. function __export(m) {
  17943. for (var p in m) {
  17944. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  17945. }
  17946. }
  17947. Object.defineProperty(exports, "__esModule", { value: true });
  17948. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-bar/component.ts"));
  17949. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"));
  17950. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"));
  17951. /***/ }),
  17952. /***/ "./packages/mdc-tab-indicator/component.ts":
  17953. /*!*************************************************!*\
  17954. !*** ./packages/mdc-tab-indicator/component.ts ***!
  17955. \*************************************************/
  17956. /*! no static exports found */
  17957. /***/ (function(module, exports, __webpack_require__) {
  17958. "use strict";
  17959. /**
  17960. * @license
  17961. * Copyright 2018 Google Inc.
  17962. *
  17963. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17964. * of this software and associated documentation files (the "Software"), to deal
  17965. * in the Software without restriction, including without limitation the rights
  17966. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17967. * copies of the Software, and to permit persons to whom the Software is
  17968. * furnished to do so, subject to the following conditions:
  17969. *
  17970. * The above copyright notice and this permission notice shall be included in
  17971. * all copies or substantial portions of the Software.
  17972. *
  17973. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17974. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17975. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17976. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17977. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17978. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17979. * THE SOFTWARE.
  17980. */
  17981. var __extends = this && this.__extends || function () {
  17982. var _extendStatics = function extendStatics(d, b) {
  17983. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17984. d.__proto__ = b;
  17985. } || function (d, b) {
  17986. for (var p in b) {
  17987. if (b.hasOwnProperty(p)) d[p] = b[p];
  17988. }
  17989. };
  17990. return _extendStatics(d, b);
  17991. };
  17992. return function (d, b) {
  17993. _extendStatics(d, b);
  17994. function __() {
  17995. this.constructor = d;
  17996. }
  17997. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17998. };
  17999. }();
  18000. Object.defineProperty(exports, "__esModule", { value: true });
  18001. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18002. var fading_foundation_1 = __webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts");
  18003. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  18004. var sliding_foundation_1 = __webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts");
  18005. var MDCTabIndicator = /** @class */function (_super) {
  18006. __extends(MDCTabIndicator, _super);
  18007. function MDCTabIndicator() {
  18008. return _super !== null && _super.apply(this, arguments) || this;
  18009. }
  18010. MDCTabIndicator.attachTo = function (root) {
  18011. return new MDCTabIndicator(root);
  18012. };
  18013. MDCTabIndicator.prototype.initialize = function () {
  18014. this.content_ = this.root.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);
  18015. };
  18016. MDCTabIndicator.prototype.computeContentClientRect = function () {
  18017. return this.foundation.computeContentClientRect();
  18018. };
  18019. MDCTabIndicator.prototype.getDefaultFoundation = function () {
  18020. var _this = this;
  18021. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18022. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18023. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18024. var adapter = {
  18025. addClass: function addClass(className) {
  18026. return _this.root.classList.add(className);
  18027. },
  18028. removeClass: function removeClass(className) {
  18029. return _this.root.classList.remove(className);
  18030. },
  18031. computeContentClientRect: function computeContentClientRect() {
  18032. return _this.content_.getBoundingClientRect();
  18033. },
  18034. setContentStyleProperty: function setContentStyleProperty(prop, value) {
  18035. return _this.content_.style.setProperty(prop, value);
  18036. }
  18037. };
  18038. // tslint:enable:object-literal-sort-keys
  18039. if (this.root.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasses.FADE)) {
  18040. return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter);
  18041. }
  18042. // Default to the sliding indicator
  18043. return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter);
  18044. };
  18045. MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {
  18046. this.foundation.activate(previousIndicatorClientRect);
  18047. };
  18048. MDCTabIndicator.prototype.deactivate = function () {
  18049. this.foundation.deactivate();
  18050. };
  18051. return MDCTabIndicator;
  18052. }(component_1.MDCComponent);
  18053. exports.MDCTabIndicator = MDCTabIndicator;
  18054. /***/ }),
  18055. /***/ "./packages/mdc-tab-indicator/constants.ts":
  18056. /*!*************************************************!*\
  18057. !*** ./packages/mdc-tab-indicator/constants.ts ***!
  18058. \*************************************************/
  18059. /*! no static exports found */
  18060. /***/ (function(module, exports, __webpack_require__) {
  18061. "use strict";
  18062. /**
  18063. * @license
  18064. * Copyright 2018 Google Inc.
  18065. *
  18066. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18067. * of this software and associated documentation files (the "Software"), to deal
  18068. * in the Software without restriction, including without limitation the rights
  18069. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18070. * copies of the Software, and to permit persons to whom the Software is
  18071. * furnished to do so, subject to the following conditions:
  18072. *
  18073. * The above copyright notice and this permission notice shall be included in
  18074. * all copies or substantial portions of the Software.
  18075. *
  18076. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18077. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18078. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18079. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18080. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18081. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18082. * THE SOFTWARE.
  18083. */
  18084. Object.defineProperty(exports, "__esModule", { value: true });
  18085. var cssClasses = {
  18086. ACTIVE: 'mdc-tab-indicator--active',
  18087. FADE: 'mdc-tab-indicator--fade',
  18088. NO_TRANSITION: 'mdc-tab-indicator--no-transition'
  18089. };
  18090. exports.cssClasses = cssClasses;
  18091. var strings = {
  18092. CONTENT_SELECTOR: '.mdc-tab-indicator__content'
  18093. };
  18094. exports.strings = strings;
  18095. /***/ }),
  18096. /***/ "./packages/mdc-tab-indicator/fading-foundation.ts":
  18097. /*!*********************************************************!*\
  18098. !*** ./packages/mdc-tab-indicator/fading-foundation.ts ***!
  18099. \*********************************************************/
  18100. /*! no static exports found */
  18101. /***/ (function(module, exports, __webpack_require__) {
  18102. "use strict";
  18103. /**
  18104. * @license
  18105. * Copyright 2018 Google Inc.
  18106. *
  18107. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18108. * of this software and associated documentation files (the "Software"), to deal
  18109. * in the Software without restriction, including without limitation the rights
  18110. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18111. * copies of the Software, and to permit persons to whom the Software is
  18112. * furnished to do so, subject to the following conditions:
  18113. *
  18114. * The above copyright notice and this permission notice shall be included in
  18115. * all copies or substantial portions of the Software.
  18116. *
  18117. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18118. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18119. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18120. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18121. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18122. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18123. * THE SOFTWARE.
  18124. */
  18125. var __extends = this && this.__extends || function () {
  18126. var _extendStatics = function extendStatics(d, b) {
  18127. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18128. d.__proto__ = b;
  18129. } || function (d, b) {
  18130. for (var p in b) {
  18131. if (b.hasOwnProperty(p)) d[p] = b[p];
  18132. }
  18133. };
  18134. return _extendStatics(d, b);
  18135. };
  18136. return function (d, b) {
  18137. _extendStatics(d, b);
  18138. function __() {
  18139. this.constructor = d;
  18140. }
  18141. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18142. };
  18143. }();
  18144. Object.defineProperty(exports, "__esModule", { value: true });
  18145. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  18146. /* istanbul ignore next: subclass is not a branch statement */
  18147. var MDCFadingTabIndicatorFoundation = /** @class */function (_super) {
  18148. __extends(MDCFadingTabIndicatorFoundation, _super);
  18149. function MDCFadingTabIndicatorFoundation() {
  18150. return _super !== null && _super.apply(this, arguments) || this;
  18151. }
  18152. MDCFadingTabIndicatorFoundation.prototype.activate = function () {
  18153. this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  18154. };
  18155. MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {
  18156. this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  18157. };
  18158. return MDCFadingTabIndicatorFoundation;
  18159. }(foundation_1.MDCTabIndicatorFoundation);
  18160. exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation;
  18161. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18162. exports.default = MDCFadingTabIndicatorFoundation;
  18163. /***/ }),
  18164. /***/ "./packages/mdc-tab-indicator/foundation.ts":
  18165. /*!**************************************************!*\
  18166. !*** ./packages/mdc-tab-indicator/foundation.ts ***!
  18167. \**************************************************/
  18168. /*! no static exports found */
  18169. /***/ (function(module, exports, __webpack_require__) {
  18170. "use strict";
  18171. /**
  18172. * @license
  18173. * Copyright 2018 Google Inc.
  18174. *
  18175. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18176. * of this software and associated documentation files (the "Software"), to deal
  18177. * in the Software without restriction, including without limitation the rights
  18178. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18179. * copies of the Software, and to permit persons to whom the Software is
  18180. * furnished to do so, subject to the following conditions:
  18181. *
  18182. * The above copyright notice and this permission notice shall be included in
  18183. * all copies or substantial portions of the Software.
  18184. *
  18185. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18186. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18187. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18188. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18189. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18190. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18191. * THE SOFTWARE.
  18192. */
  18193. var __extends = this && this.__extends || function () {
  18194. var _extendStatics = function extendStatics(d, b) {
  18195. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18196. d.__proto__ = b;
  18197. } || function (d, b) {
  18198. for (var p in b) {
  18199. if (b.hasOwnProperty(p)) d[p] = b[p];
  18200. }
  18201. };
  18202. return _extendStatics(d, b);
  18203. };
  18204. return function (d, b) {
  18205. _extendStatics(d, b);
  18206. function __() {
  18207. this.constructor = d;
  18208. }
  18209. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18210. };
  18211. }();
  18212. var __assign = this && this.__assign || function () {
  18213. __assign = Object.assign || function (t) {
  18214. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18215. s = arguments[i];
  18216. for (var p in s) {
  18217. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18218. }
  18219. }
  18220. return t;
  18221. };
  18222. return __assign.apply(this, arguments);
  18223. };
  18224. Object.defineProperty(exports, "__esModule", { value: true });
  18225. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18226. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts");
  18227. var MDCTabIndicatorFoundation = /** @class */function (_super) {
  18228. __extends(MDCTabIndicatorFoundation, _super);
  18229. function MDCTabIndicatorFoundation(adapter) {
  18230. return _super.call(this, __assign(__assign({}, MDCTabIndicatorFoundation.defaultAdapter), adapter)) || this;
  18231. }
  18232. Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", {
  18233. get: function get() {
  18234. return constants_1.cssClasses;
  18235. },
  18236. enumerable: true,
  18237. configurable: true
  18238. });
  18239. Object.defineProperty(MDCTabIndicatorFoundation, "strings", {
  18240. get: function get() {
  18241. return constants_1.strings;
  18242. },
  18243. enumerable: true,
  18244. configurable: true
  18245. });
  18246. Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", {
  18247. get: function get() {
  18248. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18249. return {
  18250. addClass: function addClass() {
  18251. return undefined;
  18252. },
  18253. removeClass: function removeClass() {
  18254. return undefined;
  18255. },
  18256. computeContentClientRect: function computeContentClientRect() {
  18257. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  18258. },
  18259. setContentStyleProperty: function setContentStyleProperty() {
  18260. return undefined;
  18261. }
  18262. };
  18263. // tslint:enable:object-literal-sort-keys
  18264. },
  18265. enumerable: true,
  18266. configurable: true
  18267. });
  18268. MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {
  18269. return this.adapter.computeContentClientRect();
  18270. };
  18271. return MDCTabIndicatorFoundation;
  18272. }(foundation_1.MDCFoundation);
  18273. exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation;
  18274. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18275. exports.default = MDCTabIndicatorFoundation;
  18276. /***/ }),
  18277. /***/ "./packages/mdc-tab-indicator/index.ts":
  18278. /*!*********************************************!*\
  18279. !*** ./packages/mdc-tab-indicator/index.ts ***!
  18280. \*********************************************/
  18281. /*! no static exports found */
  18282. /***/ (function(module, exports, __webpack_require__) {
  18283. "use strict";
  18284. /**
  18285. * @license
  18286. * Copyright 2019 Google Inc.
  18287. *
  18288. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18289. * of this software and associated documentation files (the "Software"), to deal
  18290. * in the Software without restriction, including without limitation the rights
  18291. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18292. * copies of the Software, and to permit persons to whom the Software is
  18293. * furnished to do so, subject to the following conditions:
  18294. *
  18295. * The above copyright notice and this permission notice shall be included in
  18296. * all copies or substantial portions of the Software.
  18297. *
  18298. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18299. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18300. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18301. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18302. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18303. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18304. * THE SOFTWARE.
  18305. */
  18306. function __export(m) {
  18307. for (var p in m) {
  18308. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  18309. }
  18310. }
  18311. Object.defineProperty(exports, "__esModule", { value: true });
  18312. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-indicator/component.ts"));
  18313. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"));
  18314. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"));
  18315. __export(__webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"));
  18316. __export(__webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"));
  18317. /***/ }),
  18318. /***/ "./packages/mdc-tab-indicator/sliding-foundation.ts":
  18319. /*!**********************************************************!*\
  18320. !*** ./packages/mdc-tab-indicator/sliding-foundation.ts ***!
  18321. \**********************************************************/
  18322. /*! no static exports found */
  18323. /***/ (function(module, exports, __webpack_require__) {
  18324. "use strict";
  18325. /**
  18326. * @license
  18327. * Copyright 2018 Google Inc.
  18328. *
  18329. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18330. * of this software and associated documentation files (the "Software"), to deal
  18331. * in the Software without restriction, including without limitation the rights
  18332. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18333. * copies of the Software, and to permit persons to whom the Software is
  18334. * furnished to do so, subject to the following conditions:
  18335. *
  18336. * The above copyright notice and this permission notice shall be included in
  18337. * all copies or substantial portions of the Software.
  18338. *
  18339. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18340. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18341. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18342. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18343. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18344. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18345. * THE SOFTWARE.
  18346. */
  18347. var __extends = this && this.__extends || function () {
  18348. var _extendStatics = function extendStatics(d, b) {
  18349. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18350. d.__proto__ = b;
  18351. } || function (d, b) {
  18352. for (var p in b) {
  18353. if (b.hasOwnProperty(p)) d[p] = b[p];
  18354. }
  18355. };
  18356. return _extendStatics(d, b);
  18357. };
  18358. return function (d, b) {
  18359. _extendStatics(d, b);
  18360. function __() {
  18361. this.constructor = d;
  18362. }
  18363. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18364. };
  18365. }();
  18366. Object.defineProperty(exports, "__esModule", { value: true });
  18367. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  18368. /* istanbul ignore next: subclass is not a branch statement */
  18369. var MDCSlidingTabIndicatorFoundation = /** @class */function (_super) {
  18370. __extends(MDCSlidingTabIndicatorFoundation, _super);
  18371. function MDCSlidingTabIndicatorFoundation() {
  18372. return _super !== null && _super.apply(this, arguments) || this;
  18373. }
  18374. MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {
  18375. // Early exit if no indicator is present to handle cases where an indicator
  18376. // may be activated without a prior indicator state
  18377. if (!previousIndicatorClientRect) {
  18378. this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  18379. return;
  18380. }
  18381. // This animation uses the FLIP approach. You can read more about it at the link below:
  18382. // https://aerotwist.com/blog/flip-your-animations/
  18383. // Calculate the dimensions based on the dimensions of the previous indicator
  18384. var currentClientRect = this.computeContentClientRect();
  18385. var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
  18386. var xPosition = previousIndicatorClientRect.left - currentClientRect.left;
  18387. this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  18388. this.adapter.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")");
  18389. // Force repaint before updating classes and transform to ensure the transform properly takes effect
  18390. this.computeContentClientRect();
  18391. this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  18392. this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  18393. this.adapter.setContentStyleProperty('transform', '');
  18394. };
  18395. MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {
  18396. this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  18397. };
  18398. return MDCSlidingTabIndicatorFoundation;
  18399. }(foundation_1.MDCTabIndicatorFoundation);
  18400. exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation;
  18401. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18402. exports.default = MDCSlidingTabIndicatorFoundation;
  18403. /***/ }),
  18404. /***/ "./packages/mdc-tab-scroller/component.ts":
  18405. /*!************************************************!*\
  18406. !*** ./packages/mdc-tab-scroller/component.ts ***!
  18407. \************************************************/
  18408. /*! no static exports found */
  18409. /***/ (function(module, exports, __webpack_require__) {
  18410. "use strict";
  18411. /**
  18412. * @license
  18413. * Copyright 2018 Google Inc.
  18414. *
  18415. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18416. * of this software and associated documentation files (the "Software"), to deal
  18417. * in the Software without restriction, including without limitation the rights
  18418. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18419. * copies of the Software, and to permit persons to whom the Software is
  18420. * furnished to do so, subject to the following conditions:
  18421. *
  18422. * The above copyright notice and this permission notice shall be included in
  18423. * all copies or substantial portions of the Software.
  18424. *
  18425. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18426. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18427. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18428. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18429. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18430. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18431. * THE SOFTWARE.
  18432. */
  18433. var __extends = this && this.__extends || function () {
  18434. var _extendStatics = function extendStatics(d, b) {
  18435. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18436. d.__proto__ = b;
  18437. } || function (d, b) {
  18438. for (var p in b) {
  18439. if (b.hasOwnProperty(p)) d[p] = b[p];
  18440. }
  18441. };
  18442. return _extendStatics(d, b);
  18443. };
  18444. return function (d, b) {
  18445. _extendStatics(d, b);
  18446. function __() {
  18447. this.constructor = d;
  18448. }
  18449. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18450. };
  18451. }();
  18452. var __importStar = this && this.__importStar || function (mod) {
  18453. if (mod && mod.__esModule) return mod;
  18454. var result = {};
  18455. if (mod != null) for (var k in mod) {
  18456. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  18457. }result["default"] = mod;
  18458. return result;
  18459. };
  18460. Object.defineProperty(exports, "__esModule", { value: true });
  18461. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18462. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  18463. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  18464. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts");
  18465. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  18466. var MDCTabScroller = /** @class */function (_super) {
  18467. __extends(MDCTabScroller, _super);
  18468. function MDCTabScroller() {
  18469. return _super !== null && _super.apply(this, arguments) || this;
  18470. }
  18471. MDCTabScroller.attachTo = function (root) {
  18472. return new MDCTabScroller(root);
  18473. };
  18474. MDCTabScroller.prototype.initialize = function () {
  18475. this.area_ = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR);
  18476. this.content_ = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);
  18477. };
  18478. MDCTabScroller.prototype.initialSyncWithDOM = function () {
  18479. var _this = this;
  18480. this.handleInteraction_ = function () {
  18481. return _this.foundation.handleInteraction();
  18482. };
  18483. this.handleTransitionEnd_ = function (evt) {
  18484. return _this.foundation.handleTransitionEnd(evt);
  18485. };
  18486. this.area_.addEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  18487. this.area_.addEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  18488. this.area_.addEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  18489. this.area_.addEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  18490. this.area_.addEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  18491. this.content_.addEventListener('transitionend', this.handleTransitionEnd_);
  18492. };
  18493. MDCTabScroller.prototype.destroy = function () {
  18494. _super.prototype.destroy.call(this);
  18495. this.area_.removeEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  18496. this.area_.removeEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  18497. this.area_.removeEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  18498. this.area_.removeEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  18499. this.area_.removeEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  18500. this.content_.removeEventListener('transitionend', this.handleTransitionEnd_);
  18501. };
  18502. MDCTabScroller.prototype.getDefaultFoundation = function () {
  18503. var _this = this;
  18504. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18505. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18506. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18507. var adapter = {
  18508. eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) {
  18509. return ponyfill_1.matches(evtTarget, selector);
  18510. },
  18511. addClass: function addClass(className) {
  18512. return _this.root.classList.add(className);
  18513. },
  18514. removeClass: function removeClass(className) {
  18515. return _this.root.classList.remove(className);
  18516. },
  18517. addScrollAreaClass: function addScrollAreaClass(className) {
  18518. return _this.area_.classList.add(className);
  18519. },
  18520. setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) {
  18521. return _this.area_.style.setProperty(prop, value);
  18522. },
  18523. setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) {
  18524. return _this.content_.style.setProperty(prop, value);
  18525. },
  18526. getScrollContentStyleValue: function getScrollContentStyleValue(propName) {
  18527. return window.getComputedStyle(_this.content_).getPropertyValue(propName);
  18528. },
  18529. setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) {
  18530. return _this.area_.scrollLeft = scrollX;
  18531. },
  18532. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  18533. return _this.area_.scrollLeft;
  18534. },
  18535. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  18536. return _this.content_.offsetWidth;
  18537. },
  18538. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  18539. return _this.area_.offsetWidth;
  18540. },
  18541. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  18542. return _this.area_.getBoundingClientRect();
  18543. },
  18544. computeScrollContentClientRect: function computeScrollContentClientRect() {
  18545. return _this.content_.getBoundingClientRect();
  18546. },
  18547. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  18548. return util.computeHorizontalScrollbarHeight(document);
  18549. }
  18550. };
  18551. // tslint:enable:object-literal-sort-keys
  18552. return new foundation_1.MDCTabScrollerFoundation(adapter);
  18553. };
  18554. /**
  18555. * Returns the current visual scroll position
  18556. */
  18557. MDCTabScroller.prototype.getScrollPosition = function () {
  18558. return this.foundation.getScrollPosition();
  18559. };
  18560. /**
  18561. * Returns the width of the scroll content
  18562. */
  18563. MDCTabScroller.prototype.getScrollContentWidth = function () {
  18564. return this.content_.offsetWidth;
  18565. };
  18566. /**
  18567. * Increments the scroll value by the given amount
  18568. * @param scrollXIncrement The pixel value by which to increment the scroll value
  18569. */
  18570. MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {
  18571. this.foundation.incrementScroll(scrollXIncrement);
  18572. };
  18573. /**
  18574. * Scrolls to the given pixel position
  18575. * @param scrollX The pixel value to scroll to
  18576. */
  18577. MDCTabScroller.prototype.scrollTo = function (scrollX) {
  18578. this.foundation.scrollTo(scrollX);
  18579. };
  18580. return MDCTabScroller;
  18581. }(component_1.MDCComponent);
  18582. exports.MDCTabScroller = MDCTabScroller;
  18583. /***/ }),
  18584. /***/ "./packages/mdc-tab-scroller/constants.ts":
  18585. /*!************************************************!*\
  18586. !*** ./packages/mdc-tab-scroller/constants.ts ***!
  18587. \************************************************/
  18588. /*! no static exports found */
  18589. /***/ (function(module, exports, __webpack_require__) {
  18590. "use strict";
  18591. /**
  18592. * @license
  18593. * Copyright 2018 Google Inc.
  18594. *
  18595. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18596. * of this software and associated documentation files (the "Software"), to deal
  18597. * in the Software without restriction, including without limitation the rights
  18598. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18599. * copies of the Software, and to permit persons to whom the Software is
  18600. * furnished to do so, subject to the following conditions:
  18601. *
  18602. * The above copyright notice and this permission notice shall be included in
  18603. * all copies or substantial portions of the Software.
  18604. *
  18605. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18606. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18607. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18608. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18609. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18610. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18611. * THE SOFTWARE.
  18612. */
  18613. Object.defineProperty(exports, "__esModule", { value: true });
  18614. var cssClasses = {
  18615. ANIMATING: 'mdc-tab-scroller--animating',
  18616. SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',
  18617. SCROLL_TEST: 'mdc-tab-scroller__test'
  18618. };
  18619. exports.cssClasses = cssClasses;
  18620. var strings = {
  18621. AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',
  18622. CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content'
  18623. };
  18624. exports.strings = strings;
  18625. /***/ }),
  18626. /***/ "./packages/mdc-tab-scroller/foundation.ts":
  18627. /*!*************************************************!*\
  18628. !*** ./packages/mdc-tab-scroller/foundation.ts ***!
  18629. \*************************************************/
  18630. /*! no static exports found */
  18631. /***/ (function(module, exports, __webpack_require__) {
  18632. "use strict";
  18633. /**
  18634. * @license
  18635. * Copyright 2018 Google Inc.
  18636. *
  18637. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18638. * of this software and associated documentation files (the "Software"), to deal
  18639. * in the Software without restriction, including without limitation the rights
  18640. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18641. * copies of the Software, and to permit persons to whom the Software is
  18642. * furnished to do so, subject to the following conditions:
  18643. *
  18644. * The above copyright notice and this permission notice shall be included in
  18645. * all copies or substantial portions of the Software.
  18646. *
  18647. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18648. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18649. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18650. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18651. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18652. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18653. * THE SOFTWARE.
  18654. */
  18655. var __extends = this && this.__extends || function () {
  18656. var _extendStatics = function extendStatics(d, b) {
  18657. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18658. d.__proto__ = b;
  18659. } || function (d, b) {
  18660. for (var p in b) {
  18661. if (b.hasOwnProperty(p)) d[p] = b[p];
  18662. }
  18663. };
  18664. return _extendStatics(d, b);
  18665. };
  18666. return function (d, b) {
  18667. _extendStatics(d, b);
  18668. function __() {
  18669. this.constructor = d;
  18670. }
  18671. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18672. };
  18673. }();
  18674. var __assign = this && this.__assign || function () {
  18675. __assign = Object.assign || function (t) {
  18676. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18677. s = arguments[i];
  18678. for (var p in s) {
  18679. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18680. }
  18681. }
  18682. return t;
  18683. };
  18684. return __assign.apply(this, arguments);
  18685. };
  18686. var __read = this && this.__read || function (o, n) {
  18687. var m = typeof Symbol === "function" && o[Symbol.iterator];
  18688. if (!m) return o;
  18689. var i = m.call(o),
  18690. r,
  18691. ar = [],
  18692. e;
  18693. try {
  18694. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  18695. ar.push(r.value);
  18696. }
  18697. } catch (error) {
  18698. e = { error: error };
  18699. } finally {
  18700. try {
  18701. if (r && !r.done && (m = i["return"])) m.call(i);
  18702. } finally {
  18703. if (e) throw e.error;
  18704. }
  18705. }
  18706. return ar;
  18707. };
  18708. Object.defineProperty(exports, "__esModule", { value: true });
  18709. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18710. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  18711. var rtl_default_scroller_1 = __webpack_require__(/*! ./rtl-default-scroller */ "./packages/mdc-tab-scroller/rtl-default-scroller.ts");
  18712. var rtl_negative_scroller_1 = __webpack_require__(/*! ./rtl-negative-scroller */ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts");
  18713. var rtl_reverse_scroller_1 = __webpack_require__(/*! ./rtl-reverse-scroller */ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts");
  18714. var MDCTabScrollerFoundation = /** @class */function (_super) {
  18715. __extends(MDCTabScrollerFoundation, _super);
  18716. function MDCTabScrollerFoundation(adapter) {
  18717. var _this = _super.call(this, __assign(__assign({}, MDCTabScrollerFoundation.defaultAdapter), adapter)) || this;
  18718. /**
  18719. * Controls whether we should handle the transitionend and interaction events during the animation.
  18720. */
  18721. _this.isAnimating_ = false;
  18722. return _this;
  18723. }
  18724. Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", {
  18725. get: function get() {
  18726. return constants_1.cssClasses;
  18727. },
  18728. enumerable: true,
  18729. configurable: true
  18730. });
  18731. Object.defineProperty(MDCTabScrollerFoundation, "strings", {
  18732. get: function get() {
  18733. return constants_1.strings;
  18734. },
  18735. enumerable: true,
  18736. configurable: true
  18737. });
  18738. Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", {
  18739. get: function get() {
  18740. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18741. return {
  18742. eventTargetMatchesSelector: function eventTargetMatchesSelector() {
  18743. return false;
  18744. },
  18745. addClass: function addClass() {
  18746. return undefined;
  18747. },
  18748. removeClass: function removeClass() {
  18749. return undefined;
  18750. },
  18751. addScrollAreaClass: function addScrollAreaClass() {
  18752. return undefined;
  18753. },
  18754. setScrollAreaStyleProperty: function setScrollAreaStyleProperty() {
  18755. return undefined;
  18756. },
  18757. setScrollContentStyleProperty: function setScrollContentStyleProperty() {
  18758. return undefined;
  18759. },
  18760. getScrollContentStyleValue: function getScrollContentStyleValue() {
  18761. return '';
  18762. },
  18763. setScrollAreaScrollLeft: function setScrollAreaScrollLeft() {
  18764. return undefined;
  18765. },
  18766. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  18767. return 0;
  18768. },
  18769. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  18770. return 0;
  18771. },
  18772. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  18773. return 0;
  18774. },
  18775. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  18776. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  18777. },
  18778. computeScrollContentClientRect: function computeScrollContentClientRect() {
  18779. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  18780. },
  18781. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  18782. return 0;
  18783. }
  18784. };
  18785. // tslint:enable:object-literal-sort-keys
  18786. },
  18787. enumerable: true,
  18788. configurable: true
  18789. });
  18790. MDCTabScrollerFoundation.prototype.init = function () {
  18791. // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll
  18792. // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs.
  18793. var horizontalScrollbarHeight = this.adapter.computeHorizontalScrollbarHeight();
  18794. this.adapter.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');
  18795. this.adapter.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);
  18796. };
  18797. /**
  18798. * Computes the current visual scroll position
  18799. */
  18800. MDCTabScrollerFoundation.prototype.getScrollPosition = function () {
  18801. if (this.isRTL_()) {
  18802. return this.computeCurrentScrollPositionRTL_();
  18803. }
  18804. var currentTranslateX = this.calculateCurrentTranslateX_();
  18805. var scrollLeft = this.adapter.getScrollAreaScrollLeft();
  18806. return scrollLeft - currentTranslateX;
  18807. };
  18808. /**
  18809. * Handles interaction events that occur during transition
  18810. */
  18811. MDCTabScrollerFoundation.prototype.handleInteraction = function () {
  18812. // Early exit if we aren't animating
  18813. if (!this.isAnimating_) {
  18814. return;
  18815. }
  18816. // Prevent other event listeners from handling this event
  18817. this.stopScrollAnimation_();
  18818. };
  18819. /**
  18820. * Handles the transitionend event
  18821. */
  18822. MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {
  18823. // Early exit if we aren't animating or the event was triggered by a different element.
  18824. var evtTarget = evt.target;
  18825. if (!this.isAnimating_ || !this.adapter.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {
  18826. return;
  18827. }
  18828. this.isAnimating_ = false;
  18829. this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  18830. };
  18831. /**
  18832. * Increment the scroll value by the scrollXIncrement using animation.
  18833. * @param scrollXIncrement The value by which to increment the scroll position
  18834. */
  18835. MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {
  18836. // Early exit for non-operational increment values
  18837. if (scrollXIncrement === 0) {
  18838. return;
  18839. }
  18840. this.animate_(this.getIncrementScrollOperation_(scrollXIncrement));
  18841. };
  18842. /**
  18843. * Increment the scroll value by the scrollXIncrement without animation.
  18844. * @param scrollXIncrement The value by which to increment the scroll position
  18845. */
  18846. MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) {
  18847. // Early exit for non-operational increment values
  18848. if (scrollXIncrement === 0) {
  18849. return;
  18850. }
  18851. var operation = this.getIncrementScrollOperation_(scrollXIncrement);
  18852. if (operation.scrollDelta === 0) {
  18853. return;
  18854. }
  18855. this.stopScrollAnimation_();
  18856. this.adapter.setScrollAreaScrollLeft(operation.finalScrollPosition);
  18857. };
  18858. /**
  18859. * Scrolls to the given scrollX value
  18860. */
  18861. MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {
  18862. if (this.isRTL_()) {
  18863. return this.scrollToRTL_(scrollX);
  18864. }
  18865. this.scrollTo_(scrollX);
  18866. };
  18867. /**
  18868. * @return Browser-specific {@link MDCTabScrollerRTL} instance.
  18869. */
  18870. MDCTabScrollerFoundation.prototype.getRTLScroller = function () {
  18871. if (!this.rtlScrollerInstance_) {
  18872. this.rtlScrollerInstance_ = this.rtlScrollerFactory_();
  18873. }
  18874. return this.rtlScrollerInstance_;
  18875. };
  18876. /**
  18877. * @return translateX value from a CSS matrix transform function string.
  18878. */
  18879. MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () {
  18880. var transformValue = this.adapter.getScrollContentStyleValue('transform');
  18881. // Early exit if no transform is present
  18882. if (transformValue === 'none') {
  18883. return 0;
  18884. }
  18885. // The transform value comes back as a matrix transformation in the form
  18886. // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so
  18887. // we're going to grab all the parenthesized values, strip out tx, and
  18888. // parse it.
  18889. var match = /\((.+?)\)/.exec(transformValue);
  18890. if (!match) {
  18891. return 0;
  18892. }
  18893. var matrixParams = match[1];
  18894. // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error.
  18895. // @ts-ignore These unused variables should retain their semantic names for clarity.
  18896. var _a = __read(matrixParams.split(','), 6),
  18897. a = _a[0],
  18898. b = _a[1],
  18899. c = _a[2],
  18900. d = _a[3],
  18901. tx = _a[4],
  18902. ty = _a[5];
  18903. return parseFloat(tx); // tslint:disable-line:ban
  18904. };
  18905. /**
  18906. * Calculates a safe scroll value that is > 0 and < the max scroll value
  18907. * @param scrollX The distance to scroll
  18908. */
  18909. MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) {
  18910. var edges = this.calculateScrollEdges_();
  18911. return Math.min(Math.max(edges.left, scrollX), edges.right);
  18912. };
  18913. MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () {
  18914. var translateX = this.calculateCurrentTranslateX_();
  18915. return this.getRTLScroller().getScrollPositionRTL(translateX);
  18916. };
  18917. MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () {
  18918. var contentWidth = this.adapter.getScrollContentOffsetWidth();
  18919. var rootWidth = this.adapter.getScrollAreaOffsetWidth();
  18920. return {
  18921. left: 0,
  18922. right: contentWidth - rootWidth
  18923. };
  18924. };
  18925. /**
  18926. * Internal scroll method
  18927. * @param scrollX The new scroll position
  18928. */
  18929. MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) {
  18930. var currentScrollX = this.getScrollPosition();
  18931. var safeScrollX = this.clampScrollValue_(scrollX);
  18932. var scrollDelta = safeScrollX - currentScrollX;
  18933. this.animate_({
  18934. finalScrollPosition: safeScrollX,
  18935. scrollDelta: scrollDelta
  18936. });
  18937. };
  18938. /**
  18939. * Internal RTL scroll method
  18940. * @param scrollX The new scroll position
  18941. */
  18942. MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) {
  18943. var animation = this.getRTLScroller().scrollToRTL(scrollX);
  18944. this.animate_(animation);
  18945. };
  18946. /**
  18947. * Internal method to compute the increment scroll operation values.
  18948. * @param scrollX The desired scroll position increment
  18949. * @return MDCTabScrollerAnimation with the sanitized values for performing the scroll operation.
  18950. */
  18951. MDCTabScrollerFoundation.prototype.getIncrementScrollOperation_ = function (scrollX) {
  18952. if (this.isRTL_()) {
  18953. return this.getRTLScroller().incrementScrollRTL(scrollX);
  18954. }
  18955. var currentScrollX = this.getScrollPosition();
  18956. var targetScrollX = scrollX + currentScrollX;
  18957. var safeScrollX = this.clampScrollValue_(targetScrollX);
  18958. var scrollDelta = safeScrollX - currentScrollX;
  18959. return {
  18960. finalScrollPosition: safeScrollX,
  18961. scrollDelta: scrollDelta
  18962. };
  18963. };
  18964. /**
  18965. * Animates the tab scrolling
  18966. * @param animation The animation to apply
  18967. */
  18968. MDCTabScrollerFoundation.prototype.animate_ = function (animation) {
  18969. var _this = this;
  18970. // Early exit if translateX is 0, which means there's no animation to perform
  18971. if (animation.scrollDelta === 0) {
  18972. return;
  18973. }
  18974. this.stopScrollAnimation_();
  18975. // This animation uses the FLIP approach.
  18976. // Read more here: https://aerotwist.com/blog/flip-your-animations/
  18977. this.adapter.setScrollAreaScrollLeft(animation.finalScrollPosition);
  18978. this.adapter.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)");
  18979. // Force repaint
  18980. this.adapter.computeScrollAreaClientRect();
  18981. requestAnimationFrame(function () {
  18982. _this.adapter.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  18983. _this.adapter.setScrollContentStyleProperty('transform', 'none');
  18984. });
  18985. this.isAnimating_ = true;
  18986. };
  18987. /**
  18988. * Stops scroll animation
  18989. */
  18990. MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () {
  18991. this.isAnimating_ = false;
  18992. var currentScrollPosition = this.getAnimatingScrollPosition_();
  18993. this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  18994. this.adapter.setScrollContentStyleProperty('transform', 'translateX(0px)');
  18995. this.adapter.setScrollAreaScrollLeft(currentScrollPosition);
  18996. };
  18997. /**
  18998. * Gets the current scroll position during animation
  18999. */
  19000. MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () {
  19001. var currentTranslateX = this.calculateCurrentTranslateX_();
  19002. var scrollLeft = this.adapter.getScrollAreaScrollLeft();
  19003. if (this.isRTL_()) {
  19004. return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);
  19005. }
  19006. return scrollLeft - currentTranslateX;
  19007. };
  19008. /**
  19009. * Determines the RTL Scroller to use
  19010. */
  19011. MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () {
  19012. // Browsers have three different implementations of scrollLeft in RTL mode,
  19013. // dependent on the browser. The behavior is based off the max LTR
  19014. // scrollLeft value and 0.
  19015. //
  19016. // * Default scrolling in RTL *
  19017. // - Left-most value: 0
  19018. // - Right-most value: Max LTR scrollLeft value
  19019. //
  19020. // * Negative scrolling in RTL *
  19021. // - Left-most value: Negated max LTR scrollLeft value
  19022. // - Right-most value: 0
  19023. //
  19024. // * Reverse scrolling in RTL *
  19025. // - Left-most value: Max LTR scrollLeft value
  19026. // - Right-most value: 0
  19027. //
  19028. // We use those principles below to determine which RTL scrollLeft
  19029. // behavior is implemented in the current browser.
  19030. var initialScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19031. this.adapter.setScrollAreaScrollLeft(initialScrollLeft - 1);
  19032. var newScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19033. // If the newScrollLeft value is negative,then we know that the browser has
  19034. // implemented negative RTL scrolling, since all other implementations have
  19035. // only positive values.
  19036. if (newScrollLeft < 0) {
  19037. // Undo the scrollLeft test check
  19038. this.adapter.setScrollAreaScrollLeft(initialScrollLeft);
  19039. return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter);
  19040. }
  19041. var rootClientRect = this.adapter.computeScrollAreaClientRect();
  19042. var contentClientRect = this.adapter.computeScrollContentClientRect();
  19043. var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);
  19044. // Undo the scrollLeft test check
  19045. this.adapter.setScrollAreaScrollLeft(initialScrollLeft);
  19046. // By calculating the clientRect of the root element and the clientRect of
  19047. // the content element, we can determine how much the scroll value changed
  19048. // when we performed the scrollLeft subtraction above.
  19049. if (rightEdgeDelta === newScrollLeft) {
  19050. return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter);
  19051. }
  19052. return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter);
  19053. };
  19054. MDCTabScrollerFoundation.prototype.isRTL_ = function () {
  19055. return this.adapter.getScrollContentStyleValue('direction') === 'rtl';
  19056. };
  19057. return MDCTabScrollerFoundation;
  19058. }(foundation_1.MDCFoundation);
  19059. exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation;
  19060. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19061. exports.default = MDCTabScrollerFoundation;
  19062. /***/ }),
  19063. /***/ "./packages/mdc-tab-scroller/index.ts":
  19064. /*!********************************************!*\
  19065. !*** ./packages/mdc-tab-scroller/index.ts ***!
  19066. \********************************************/
  19067. /*! no static exports found */
  19068. /***/ (function(module, exports, __webpack_require__) {
  19069. "use strict";
  19070. /**
  19071. * @license
  19072. * Copyright 2019 Google Inc.
  19073. *
  19074. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19075. * of this software and associated documentation files (the "Software"), to deal
  19076. * in the Software without restriction, including without limitation the rights
  19077. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19078. * copies of the Software, and to permit persons to whom the Software is
  19079. * furnished to do so, subject to the following conditions:
  19080. *
  19081. * The above copyright notice and this permission notice shall be included in
  19082. * all copies or substantial portions of the Software.
  19083. *
  19084. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19085. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19086. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19087. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19088. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19089. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19090. * THE SOFTWARE.
  19091. */
  19092. function __export(m) {
  19093. for (var p in m) {
  19094. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  19095. }
  19096. }
  19097. var __importStar = this && this.__importStar || function (mod) {
  19098. if (mod && mod.__esModule) return mod;
  19099. var result = {};
  19100. if (mod != null) for (var k in mod) {
  19101. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  19102. }result["default"] = mod;
  19103. return result;
  19104. };
  19105. Object.defineProperty(exports, "__esModule", { value: true });
  19106. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  19107. exports.util = util;
  19108. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-scroller/component.ts"));
  19109. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"));
  19110. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"));
  19111. /***/ }),
  19112. /***/ "./packages/mdc-tab-scroller/rtl-default-scroller.ts":
  19113. /*!***********************************************************!*\
  19114. !*** ./packages/mdc-tab-scroller/rtl-default-scroller.ts ***!
  19115. \***********************************************************/
  19116. /*! no static exports found */
  19117. /***/ (function(module, exports, __webpack_require__) {
  19118. "use strict";
  19119. /**
  19120. * @license
  19121. * Copyright 2018 Google Inc.
  19122. *
  19123. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19124. * of this software and associated documentation files (the "Software"), to deal
  19125. * in the Software without restriction, including without limitation the rights
  19126. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19127. * copies of the Software, and to permit persons to whom the Software is
  19128. * furnished to do so, subject to the following conditions:
  19129. *
  19130. * The above copyright notice and this permission notice shall be included in
  19131. * all copies or substantial portions of the Software.
  19132. *
  19133. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19134. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19135. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19136. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19137. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19138. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19139. * THE SOFTWARE.
  19140. */
  19141. var __extends = this && this.__extends || function () {
  19142. var _extendStatics = function extendStatics(d, b) {
  19143. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19144. d.__proto__ = b;
  19145. } || function (d, b) {
  19146. for (var p in b) {
  19147. if (b.hasOwnProperty(p)) d[p] = b[p];
  19148. }
  19149. };
  19150. return _extendStatics(d, b);
  19151. };
  19152. return function (d, b) {
  19153. _extendStatics(d, b);
  19154. function __() {
  19155. this.constructor = d;
  19156. }
  19157. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19158. };
  19159. }();
  19160. Object.defineProperty(exports, "__esModule", { value: true });
  19161. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  19162. var MDCTabScrollerRTLDefault = /** @class */function (_super) {
  19163. __extends(MDCTabScrollerRTLDefault, _super);
  19164. function MDCTabScrollerRTLDefault() {
  19165. return _super !== null && _super.apply(this, arguments) || this;
  19166. }
  19167. MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {
  19168. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19169. var right = this.calculateScrollEdges_().right;
  19170. // Scroll values on most browsers are ints instead of floats so we round
  19171. return Math.round(right - currentScrollLeft);
  19172. };
  19173. MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {
  19174. var edges = this.calculateScrollEdges_();
  19175. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19176. var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX);
  19177. return {
  19178. finalScrollPosition: clampedScrollLeft,
  19179. scrollDelta: clampedScrollLeft - currentScrollLeft
  19180. };
  19181. };
  19182. MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {
  19183. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19184. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  19185. return {
  19186. finalScrollPosition: clampedScrollLeft,
  19187. scrollDelta: clampedScrollLeft - currentScrollLeft
  19188. };
  19189. };
  19190. MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {
  19191. return scrollX;
  19192. };
  19193. MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () {
  19194. var contentWidth = this.adapter.getScrollContentOffsetWidth();
  19195. var rootWidth = this.adapter.getScrollAreaOffsetWidth();
  19196. return {
  19197. left: 0,
  19198. right: contentWidth - rootWidth
  19199. };
  19200. };
  19201. MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) {
  19202. var edges = this.calculateScrollEdges_();
  19203. return Math.min(Math.max(edges.left, scrollX), edges.right);
  19204. };
  19205. return MDCTabScrollerRTLDefault;
  19206. }(rtl_scroller_1.MDCTabScrollerRTL);
  19207. exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault;
  19208. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19209. exports.default = MDCTabScrollerRTLDefault;
  19210. /***/ }),
  19211. /***/ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts":
  19212. /*!************************************************************!*\
  19213. !*** ./packages/mdc-tab-scroller/rtl-negative-scroller.ts ***!
  19214. \************************************************************/
  19215. /*! no static exports found */
  19216. /***/ (function(module, exports, __webpack_require__) {
  19217. "use strict";
  19218. /**
  19219. * @license
  19220. * Copyright 2018 Google Inc.
  19221. *
  19222. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19223. * of this software and associated documentation files (the "Software"), to deal
  19224. * in the Software without restriction, including without limitation the rights
  19225. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19226. * copies of the Software, and to permit persons to whom the Software is
  19227. * furnished to do so, subject to the following conditions:
  19228. *
  19229. * The above copyright notice and this permission notice shall be included in
  19230. * all copies or substantial portions of the Software.
  19231. *
  19232. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19233. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19234. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19235. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19236. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19237. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19238. * THE SOFTWARE.
  19239. */
  19240. var __extends = this && this.__extends || function () {
  19241. var _extendStatics = function extendStatics(d, b) {
  19242. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19243. d.__proto__ = b;
  19244. } || function (d, b) {
  19245. for (var p in b) {
  19246. if (b.hasOwnProperty(p)) d[p] = b[p];
  19247. }
  19248. };
  19249. return _extendStatics(d, b);
  19250. };
  19251. return function (d, b) {
  19252. _extendStatics(d, b);
  19253. function __() {
  19254. this.constructor = d;
  19255. }
  19256. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19257. };
  19258. }();
  19259. Object.defineProperty(exports, "__esModule", { value: true });
  19260. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  19261. var MDCTabScrollerRTLNegative = /** @class */function (_super) {
  19262. __extends(MDCTabScrollerRTLNegative, _super);
  19263. function MDCTabScrollerRTLNegative() {
  19264. return _super !== null && _super.apply(this, arguments) || this;
  19265. }
  19266. MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {
  19267. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19268. return Math.round(translateX - currentScrollLeft);
  19269. };
  19270. MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {
  19271. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19272. var clampedScrollLeft = this.clampScrollValue_(-scrollX);
  19273. return {
  19274. finalScrollPosition: clampedScrollLeft,
  19275. scrollDelta: clampedScrollLeft - currentScrollLeft
  19276. };
  19277. };
  19278. MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {
  19279. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19280. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  19281. return {
  19282. finalScrollPosition: clampedScrollLeft,
  19283. scrollDelta: clampedScrollLeft - currentScrollLeft
  19284. };
  19285. };
  19286. MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  19287. return scrollX - translateX;
  19288. };
  19289. MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () {
  19290. var contentWidth = this.adapter.getScrollContentOffsetWidth();
  19291. var rootWidth = this.adapter.getScrollAreaOffsetWidth();
  19292. return {
  19293. left: rootWidth - contentWidth,
  19294. right: 0
  19295. };
  19296. };
  19297. MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) {
  19298. var edges = this.calculateScrollEdges_();
  19299. return Math.max(Math.min(edges.right, scrollX), edges.left);
  19300. };
  19301. return MDCTabScrollerRTLNegative;
  19302. }(rtl_scroller_1.MDCTabScrollerRTL);
  19303. exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative;
  19304. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19305. exports.default = MDCTabScrollerRTLNegative;
  19306. /***/ }),
  19307. /***/ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts":
  19308. /*!***********************************************************!*\
  19309. !*** ./packages/mdc-tab-scroller/rtl-reverse-scroller.ts ***!
  19310. \***********************************************************/
  19311. /*! no static exports found */
  19312. /***/ (function(module, exports, __webpack_require__) {
  19313. "use strict";
  19314. /**
  19315. * @license
  19316. * Copyright 2018 Google Inc.
  19317. *
  19318. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19319. * of this software and associated documentation files (the "Software"), to deal
  19320. * in the Software without restriction, including without limitation the rights
  19321. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19322. * copies of the Software, and to permit persons to whom the Software is
  19323. * furnished to do so, subject to the following conditions:
  19324. *
  19325. * The above copyright notice and this permission notice shall be included in
  19326. * all copies or substantial portions of the Software.
  19327. *
  19328. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19329. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19330. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19331. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19332. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19333. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19334. * THE SOFTWARE.
  19335. */
  19336. var __extends = this && this.__extends || function () {
  19337. var _extendStatics = function extendStatics(d, b) {
  19338. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19339. d.__proto__ = b;
  19340. } || function (d, b) {
  19341. for (var p in b) {
  19342. if (b.hasOwnProperty(p)) d[p] = b[p];
  19343. }
  19344. };
  19345. return _extendStatics(d, b);
  19346. };
  19347. return function (d, b) {
  19348. _extendStatics(d, b);
  19349. function __() {
  19350. this.constructor = d;
  19351. }
  19352. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19353. };
  19354. }();
  19355. Object.defineProperty(exports, "__esModule", { value: true });
  19356. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  19357. var MDCTabScrollerRTLReverse = /** @class */function (_super) {
  19358. __extends(MDCTabScrollerRTLReverse, _super);
  19359. function MDCTabScrollerRTLReverse() {
  19360. return _super !== null && _super.apply(this, arguments) || this;
  19361. }
  19362. MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {
  19363. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19364. // Scroll values on most browsers are ints instead of floats so we round
  19365. return Math.round(currentScrollLeft - translateX);
  19366. };
  19367. MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {
  19368. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19369. var clampedScrollLeft = this.clampScrollValue_(scrollX);
  19370. return {
  19371. finalScrollPosition: clampedScrollLeft,
  19372. scrollDelta: currentScrollLeft - clampedScrollLeft
  19373. };
  19374. };
  19375. MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {
  19376. var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
  19377. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX);
  19378. return {
  19379. finalScrollPosition: clampedScrollLeft,
  19380. scrollDelta: currentScrollLeft - clampedScrollLeft
  19381. };
  19382. };
  19383. MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  19384. return scrollX + translateX;
  19385. };
  19386. MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () {
  19387. var contentWidth = this.adapter.getScrollContentOffsetWidth();
  19388. var rootWidth = this.adapter.getScrollAreaOffsetWidth();
  19389. return {
  19390. left: contentWidth - rootWidth,
  19391. right: 0
  19392. };
  19393. };
  19394. MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) {
  19395. var edges = this.calculateScrollEdges_();
  19396. return Math.min(Math.max(edges.right, scrollX), edges.left);
  19397. };
  19398. return MDCTabScrollerRTLReverse;
  19399. }(rtl_scroller_1.MDCTabScrollerRTL);
  19400. exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse;
  19401. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19402. exports.default = MDCTabScrollerRTLReverse;
  19403. /***/ }),
  19404. /***/ "./packages/mdc-tab-scroller/rtl-scroller.ts":
  19405. /*!***************************************************!*\
  19406. !*** ./packages/mdc-tab-scroller/rtl-scroller.ts ***!
  19407. \***************************************************/
  19408. /*! no static exports found */
  19409. /***/ (function(module, exports, __webpack_require__) {
  19410. "use strict";
  19411. /**
  19412. * @license
  19413. * Copyright 2018 Google Inc.
  19414. *
  19415. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19416. * of this software and associated documentation files (the "Software"), to deal
  19417. * in the Software without restriction, including without limitation the rights
  19418. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19419. * copies of the Software, and to permit persons to whom the Software is
  19420. * furnished to do so, subject to the following conditions:
  19421. *
  19422. * The above copyright notice and this permission notice shall be included in
  19423. * all copies or substantial portions of the Software.
  19424. *
  19425. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19426. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19427. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19428. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19429. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19430. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19431. * THE SOFTWARE.
  19432. */
  19433. Object.defineProperty(exports, "__esModule", { value: true });
  19434. var MDCTabScrollerRTL = /** @class */function () {
  19435. function MDCTabScrollerRTL(adapter) {
  19436. this.adapter = adapter;
  19437. }
  19438. return MDCTabScrollerRTL;
  19439. }();
  19440. exports.MDCTabScrollerRTL = MDCTabScrollerRTL;
  19441. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19442. exports.default = MDCTabScrollerRTL;
  19443. /***/ }),
  19444. /***/ "./packages/mdc-tab-scroller/util.ts":
  19445. /*!*******************************************!*\
  19446. !*** ./packages/mdc-tab-scroller/util.ts ***!
  19447. \*******************************************/
  19448. /*! no static exports found */
  19449. /***/ (function(module, exports, __webpack_require__) {
  19450. "use strict";
  19451. /**
  19452. * @license
  19453. * Copyright 2018 Google Inc.
  19454. *
  19455. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19456. * of this software and associated documentation files (the "Software"), to deal
  19457. * in the Software without restriction, including without limitation the rights
  19458. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19459. * copies of the Software, and to permit persons to whom the Software is
  19460. * furnished to do so, subject to the following conditions:
  19461. *
  19462. * The above copyright notice and this permission notice shall be included in
  19463. * all copies or substantial portions of the Software.
  19464. *
  19465. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19466. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19467. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19468. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19469. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19470. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19471. * THE SOFTWARE.
  19472. */
  19473. Object.defineProperty(exports, "__esModule", { value: true });
  19474. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  19475. /**
  19476. * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.
  19477. */
  19478. var horizontalScrollbarHeight_;
  19479. /**
  19480. * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.
  19481. * May return 0 (e.g. on OS X browsers under default configuration).
  19482. */
  19483. function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {
  19484. if (shouldCacheResult === void 0) {
  19485. shouldCacheResult = true;
  19486. }
  19487. if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {
  19488. return horizontalScrollbarHeight_;
  19489. }
  19490. var el = documentObj.createElement('div');
  19491. el.classList.add(constants_1.cssClasses.SCROLL_TEST);
  19492. documentObj.body.appendChild(el);
  19493. var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;
  19494. documentObj.body.removeChild(el);
  19495. if (shouldCacheResult) {
  19496. horizontalScrollbarHeight_ = horizontalScrollbarHeight;
  19497. }
  19498. return horizontalScrollbarHeight;
  19499. }
  19500. exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight;
  19501. /***/ }),
  19502. /***/ "./packages/mdc-tab/component.ts":
  19503. /*!***************************************!*\
  19504. !*** ./packages/mdc-tab/component.ts ***!
  19505. \***************************************/
  19506. /*! no static exports found */
  19507. /***/ (function(module, exports, __webpack_require__) {
  19508. "use strict";
  19509. /**
  19510. * @license
  19511. * Copyright 2018 Google Inc.
  19512. *
  19513. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19514. * of this software and associated documentation files (the "Software"), to deal
  19515. * in the Software without restriction, including without limitation the rights
  19516. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19517. * copies of the Software, and to permit persons to whom the Software is
  19518. * furnished to do so, subject to the following conditions:
  19519. *
  19520. * The above copyright notice and this permission notice shall be included in
  19521. * all copies or substantial portions of the Software.
  19522. *
  19523. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19524. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19525. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19526. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19527. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19528. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19529. * THE SOFTWARE.
  19530. */
  19531. var __extends = this && this.__extends || function () {
  19532. var _extendStatics = function extendStatics(d, b) {
  19533. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19534. d.__proto__ = b;
  19535. } || function (d, b) {
  19536. for (var p in b) {
  19537. if (b.hasOwnProperty(p)) d[p] = b[p];
  19538. }
  19539. };
  19540. return _extendStatics(d, b);
  19541. };
  19542. return function (d, b) {
  19543. _extendStatics(d, b);
  19544. function __() {
  19545. this.constructor = d;
  19546. }
  19547. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19548. };
  19549. }();
  19550. var __assign = this && this.__assign || function () {
  19551. __assign = Object.assign || function (t) {
  19552. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19553. s = arguments[i];
  19554. for (var p in s) {
  19555. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19556. }
  19557. }
  19558. return t;
  19559. };
  19560. return __assign.apply(this, arguments);
  19561. };
  19562. Object.defineProperty(exports, "__esModule", { value: true });
  19563. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  19564. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  19565. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  19566. var component_3 = __webpack_require__(/*! @material/tab-indicator/component */ "./packages/mdc-tab-indicator/component.ts");
  19567. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts");
  19568. var MDCTab = /** @class */function (_super) {
  19569. __extends(MDCTab, _super);
  19570. function MDCTab() {
  19571. return _super !== null && _super.apply(this, arguments) || this;
  19572. }
  19573. MDCTab.attachTo = function (root) {
  19574. return new MDCTab(root);
  19575. };
  19576. MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {
  19577. if (rippleFactory === void 0) {
  19578. rippleFactory = function rippleFactory(el, foundation) {
  19579. return new component_2.MDCRipple(el, foundation);
  19580. };
  19581. }
  19582. if (tabIndicatorFactory === void 0) {
  19583. tabIndicatorFactory = function tabIndicatorFactory(el) {
  19584. return new component_3.MDCTabIndicator(el);
  19585. };
  19586. }
  19587. this.id = this.root.id;
  19588. var rippleSurface = this.root.querySelector(foundation_2.MDCTabFoundation.strings.RIPPLE_SELECTOR);
  19589. var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) {
  19590. return rippleSurface.classList.add(className);
  19591. }, removeClass: function removeClass(className) {
  19592. return rippleSurface.classList.remove(className);
  19593. }, updateCssVariable: function updateCssVariable(varName, value) {
  19594. return rippleSurface.style.setProperty(varName, value);
  19595. } });
  19596. var rippleFoundation = new foundation_1.MDCRippleFoundation(rippleAdapter);
  19597. this.ripple_ = rippleFactory(this.root, rippleFoundation);
  19598. var tabIndicatorElement = this.root.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);
  19599. this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement);
  19600. this.content_ = this.root.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR);
  19601. };
  19602. MDCTab.prototype.initialSyncWithDOM = function () {
  19603. var _this = this;
  19604. this.handleClick_ = function () {
  19605. return _this.foundation.handleClick();
  19606. };
  19607. this.listen('click', this.handleClick_);
  19608. };
  19609. MDCTab.prototype.destroy = function () {
  19610. this.unlisten('click', this.handleClick_);
  19611. this.ripple_.destroy();
  19612. _super.prototype.destroy.call(this);
  19613. };
  19614. MDCTab.prototype.getDefaultFoundation = function () {
  19615. var _this = this;
  19616. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19617. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19618. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19619. var adapter = {
  19620. setAttr: function setAttr(attr, value) {
  19621. return _this.root.setAttribute(attr, value);
  19622. },
  19623. addClass: function addClass(className) {
  19624. return _this.root.classList.add(className);
  19625. },
  19626. removeClass: function removeClass(className) {
  19627. return _this.root.classList.remove(className);
  19628. },
  19629. hasClass: function hasClass(className) {
  19630. return _this.root.classList.contains(className);
  19631. },
  19632. activateIndicator: function activateIndicator(previousIndicatorClientRect) {
  19633. return _this.tabIndicator_.activate(previousIndicatorClientRect);
  19634. },
  19635. deactivateIndicator: function deactivateIndicator() {
  19636. return _this.tabIndicator_.deactivate();
  19637. },
  19638. notifyInteracted: function notifyInteracted() {
  19639. return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */);
  19640. },
  19641. getOffsetLeft: function getOffsetLeft() {
  19642. return _this.root.offsetLeft;
  19643. },
  19644. getOffsetWidth: function getOffsetWidth() {
  19645. return _this.root.offsetWidth;
  19646. },
  19647. getContentOffsetLeft: function getContentOffsetLeft() {
  19648. return _this.content_.offsetLeft;
  19649. },
  19650. getContentOffsetWidth: function getContentOffsetWidth() {
  19651. return _this.content_.offsetWidth;
  19652. },
  19653. focus: function focus() {
  19654. return _this.root.focus();
  19655. }
  19656. };
  19657. // tslint:enable:object-literal-sort-keys
  19658. return new foundation_2.MDCTabFoundation(adapter);
  19659. };
  19660. Object.defineProperty(MDCTab.prototype, "active", {
  19661. /**
  19662. * Getter for the active state of the tab
  19663. */
  19664. get: function get() {
  19665. return this.foundation.isActive();
  19666. },
  19667. enumerable: true,
  19668. configurable: true
  19669. });
  19670. Object.defineProperty(MDCTab.prototype, "focusOnActivate", {
  19671. set: function set(focusOnActivate) {
  19672. this.foundation.setFocusOnActivate(focusOnActivate);
  19673. },
  19674. enumerable: true,
  19675. configurable: true
  19676. });
  19677. /**
  19678. * Activates the tab
  19679. */
  19680. MDCTab.prototype.activate = function (computeIndicatorClientRect) {
  19681. this.foundation.activate(computeIndicatorClientRect);
  19682. };
  19683. /**
  19684. * Deactivates the tab
  19685. */
  19686. MDCTab.prototype.deactivate = function () {
  19687. this.foundation.deactivate();
  19688. };
  19689. /**
  19690. * Returns the indicator's client rect
  19691. */
  19692. MDCTab.prototype.computeIndicatorClientRect = function () {
  19693. return this.tabIndicator_.computeContentClientRect();
  19694. };
  19695. MDCTab.prototype.computeDimensions = function () {
  19696. return this.foundation.computeDimensions();
  19697. };
  19698. /**
  19699. * Focuses the tab
  19700. */
  19701. MDCTab.prototype.focus = function () {
  19702. this.root.focus();
  19703. };
  19704. return MDCTab;
  19705. }(component_1.MDCComponent);
  19706. exports.MDCTab = MDCTab;
  19707. /***/ }),
  19708. /***/ "./packages/mdc-tab/constants.ts":
  19709. /*!***************************************!*\
  19710. !*** ./packages/mdc-tab/constants.ts ***!
  19711. \***************************************/
  19712. /*! no static exports found */
  19713. /***/ (function(module, exports, __webpack_require__) {
  19714. "use strict";
  19715. /**
  19716. * @license
  19717. * Copyright 2018 Google Inc.
  19718. *
  19719. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19720. * of this software and associated documentation files (the "Software"), to deal
  19721. * in the Software without restriction, including without limitation the rights
  19722. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19723. * copies of the Software, and to permit persons to whom the Software is
  19724. * furnished to do so, subject to the following conditions:
  19725. *
  19726. * The above copyright notice and this permission notice shall be included in
  19727. * all copies or substantial portions of the Software.
  19728. *
  19729. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19730. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19731. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19732. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19733. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19734. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19735. * THE SOFTWARE.
  19736. */
  19737. Object.defineProperty(exports, "__esModule", { value: true });
  19738. var cssClasses = {
  19739. ACTIVE: 'mdc-tab--active'
  19740. };
  19741. exports.cssClasses = cssClasses;
  19742. var strings = {
  19743. ARIA_SELECTED: 'aria-selected',
  19744. CONTENT_SELECTOR: '.mdc-tab__content',
  19745. INTERACTED_EVENT: 'MDCTab:interacted',
  19746. RIPPLE_SELECTOR: '.mdc-tab__ripple',
  19747. TABINDEX: 'tabIndex',
  19748. TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator'
  19749. };
  19750. exports.strings = strings;
  19751. /***/ }),
  19752. /***/ "./packages/mdc-tab/foundation.ts":
  19753. /*!****************************************!*\
  19754. !*** ./packages/mdc-tab/foundation.ts ***!
  19755. \****************************************/
  19756. /*! no static exports found */
  19757. /***/ (function(module, exports, __webpack_require__) {
  19758. "use strict";
  19759. /**
  19760. * @license
  19761. * Copyright 2018 Google Inc.
  19762. *
  19763. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19764. * of this software and associated documentation files (the "Software"), to deal
  19765. * in the Software without restriction, including without limitation the rights
  19766. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19767. * copies of the Software, and to permit persons to whom the Software is
  19768. * furnished to do so, subject to the following conditions:
  19769. *
  19770. * The above copyright notice and this permission notice shall be included in
  19771. * all copies or substantial portions of the Software.
  19772. *
  19773. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19774. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19775. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19776. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19777. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19778. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19779. * THE SOFTWARE.
  19780. */
  19781. var __extends = this && this.__extends || function () {
  19782. var _extendStatics = function extendStatics(d, b) {
  19783. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19784. d.__proto__ = b;
  19785. } || function (d, b) {
  19786. for (var p in b) {
  19787. if (b.hasOwnProperty(p)) d[p] = b[p];
  19788. }
  19789. };
  19790. return _extendStatics(d, b);
  19791. };
  19792. return function (d, b) {
  19793. _extendStatics(d, b);
  19794. function __() {
  19795. this.constructor = d;
  19796. }
  19797. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19798. };
  19799. }();
  19800. var __assign = this && this.__assign || function () {
  19801. __assign = Object.assign || function (t) {
  19802. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19803. s = arguments[i];
  19804. for (var p in s) {
  19805. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19806. }
  19807. }
  19808. return t;
  19809. };
  19810. return __assign.apply(this, arguments);
  19811. };
  19812. Object.defineProperty(exports, "__esModule", { value: true });
  19813. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19814. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts");
  19815. var MDCTabFoundation = /** @class */function (_super) {
  19816. __extends(MDCTabFoundation, _super);
  19817. function MDCTabFoundation(adapter) {
  19818. var _this = _super.call(this, __assign(__assign({}, MDCTabFoundation.defaultAdapter), adapter)) || this;
  19819. _this.focusOnActivate_ = true;
  19820. return _this;
  19821. }
  19822. Object.defineProperty(MDCTabFoundation, "cssClasses", {
  19823. get: function get() {
  19824. return constants_1.cssClasses;
  19825. },
  19826. enumerable: true,
  19827. configurable: true
  19828. });
  19829. Object.defineProperty(MDCTabFoundation, "strings", {
  19830. get: function get() {
  19831. return constants_1.strings;
  19832. },
  19833. enumerable: true,
  19834. configurable: true
  19835. });
  19836. Object.defineProperty(MDCTabFoundation, "defaultAdapter", {
  19837. get: function get() {
  19838. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19839. return {
  19840. addClass: function addClass() {
  19841. return undefined;
  19842. },
  19843. removeClass: function removeClass() {
  19844. return undefined;
  19845. },
  19846. hasClass: function hasClass() {
  19847. return false;
  19848. },
  19849. setAttr: function setAttr() {
  19850. return undefined;
  19851. },
  19852. activateIndicator: function activateIndicator() {
  19853. return undefined;
  19854. },
  19855. deactivateIndicator: function deactivateIndicator() {
  19856. return undefined;
  19857. },
  19858. notifyInteracted: function notifyInteracted() {
  19859. return undefined;
  19860. },
  19861. getOffsetLeft: function getOffsetLeft() {
  19862. return 0;
  19863. },
  19864. getOffsetWidth: function getOffsetWidth() {
  19865. return 0;
  19866. },
  19867. getContentOffsetLeft: function getContentOffsetLeft() {
  19868. return 0;
  19869. },
  19870. getContentOffsetWidth: function getContentOffsetWidth() {
  19871. return 0;
  19872. },
  19873. focus: function focus() {
  19874. return undefined;
  19875. }
  19876. };
  19877. // tslint:enable:object-literal-sort-keys
  19878. },
  19879. enumerable: true,
  19880. configurable: true
  19881. });
  19882. MDCTabFoundation.prototype.handleClick = function () {
  19883. // It's up to the parent component to keep track of the active Tab and
  19884. // ensure we don't activate a Tab that's already active.
  19885. this.adapter.notifyInteracted();
  19886. };
  19887. MDCTabFoundation.prototype.isActive = function () {
  19888. return this.adapter.hasClass(constants_1.cssClasses.ACTIVE);
  19889. };
  19890. /**
  19891. * Sets whether the tab should focus itself when activated
  19892. */
  19893. MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {
  19894. this.focusOnActivate_ = focusOnActivate;
  19895. };
  19896. /**
  19897. * Activates the Tab
  19898. */
  19899. MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {
  19900. this.adapter.addClass(constants_1.cssClasses.ACTIVE);
  19901. this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'true');
  19902. this.adapter.setAttr(constants_1.strings.TABINDEX, '0');
  19903. this.adapter.activateIndicator(previousIndicatorClientRect);
  19904. if (this.focusOnActivate_) {
  19905. this.adapter.focus();
  19906. }
  19907. };
  19908. /**
  19909. * Deactivates the Tab
  19910. */
  19911. MDCTabFoundation.prototype.deactivate = function () {
  19912. // Early exit
  19913. if (!this.isActive()) {
  19914. return;
  19915. }
  19916. this.adapter.removeClass(constants_1.cssClasses.ACTIVE);
  19917. this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'false');
  19918. this.adapter.setAttr(constants_1.strings.TABINDEX, '-1');
  19919. this.adapter.deactivateIndicator();
  19920. };
  19921. /**
  19922. * Returns the dimensions of the Tab
  19923. */
  19924. MDCTabFoundation.prototype.computeDimensions = function () {
  19925. var rootWidth = this.adapter.getOffsetWidth();
  19926. var rootLeft = this.adapter.getOffsetLeft();
  19927. var contentWidth = this.adapter.getContentOffsetWidth();
  19928. var contentLeft = this.adapter.getContentOffsetLeft();
  19929. return {
  19930. contentLeft: rootLeft + contentLeft,
  19931. contentRight: rootLeft + contentLeft + contentWidth,
  19932. rootLeft: rootLeft,
  19933. rootRight: rootLeft + rootWidth
  19934. };
  19935. };
  19936. return MDCTabFoundation;
  19937. }(foundation_1.MDCFoundation);
  19938. exports.MDCTabFoundation = MDCTabFoundation;
  19939. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19940. exports.default = MDCTabFoundation;
  19941. /***/ }),
  19942. /***/ "./packages/mdc-tab/index.ts":
  19943. /*!***********************************!*\
  19944. !*** ./packages/mdc-tab/index.ts ***!
  19945. \***********************************/
  19946. /*! no static exports found */
  19947. /***/ (function(module, exports, __webpack_require__) {
  19948. "use strict";
  19949. /**
  19950. * @license
  19951. * Copyright 2019 Google Inc.
  19952. *
  19953. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19954. * of this software and associated documentation files (the "Software"), to deal
  19955. * in the Software without restriction, including without limitation the rights
  19956. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19957. * copies of the Software, and to permit persons to whom the Software is
  19958. * furnished to do so, subject to the following conditions:
  19959. *
  19960. * The above copyright notice and this permission notice shall be included in
  19961. * all copies or substantial portions of the Software.
  19962. *
  19963. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19964. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19965. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19966. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19967. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19968. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19969. * THE SOFTWARE.
  19970. */
  19971. function __export(m) {
  19972. for (var p in m) {
  19973. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  19974. }
  19975. }
  19976. Object.defineProperty(exports, "__esModule", { value: true });
  19977. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab/component.ts"));
  19978. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"));
  19979. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"));
  19980. /***/ }),
  19981. /***/ "./packages/mdc-textfield/character-counter/component.ts":
  19982. /*!***************************************************************!*\
  19983. !*** ./packages/mdc-textfield/character-counter/component.ts ***!
  19984. \***************************************************************/
  19985. /*! no static exports found */
  19986. /***/ (function(module, exports, __webpack_require__) {
  19987. "use strict";
  19988. /**
  19989. * @license
  19990. * Copyright 2019 Google Inc.
  19991. *
  19992. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19993. * of this software and associated documentation files (the "Software"), to deal
  19994. * in the Software without restriction, including without limitation the rights
  19995. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19996. * copies of the Software, and to permit persons to whom the Software is
  19997. * furnished to do so, subject to the following conditions:
  19998. *
  19999. * The above copyright notice and this permission notice shall be included in
  20000. * all copies or substantial portions of the Software.
  20001. *
  20002. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20003. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20004. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20005. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20006. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20007. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20008. * THE SOFTWARE.
  20009. */
  20010. var __extends = this && this.__extends || function () {
  20011. var _extendStatics = function extendStatics(d, b) {
  20012. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20013. d.__proto__ = b;
  20014. } || function (d, b) {
  20015. for (var p in b) {
  20016. if (b.hasOwnProperty(p)) d[p] = b[p];
  20017. }
  20018. };
  20019. return _extendStatics(d, b);
  20020. };
  20021. return function (d, b) {
  20022. _extendStatics(d, b);
  20023. function __() {
  20024. this.constructor = d;
  20025. }
  20026. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20027. };
  20028. }();
  20029. Object.defineProperty(exports, "__esModule", { value: true });
  20030. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20031. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  20032. var MDCTextFieldCharacterCounter = /** @class */function (_super) {
  20033. __extends(MDCTextFieldCharacterCounter, _super);
  20034. function MDCTextFieldCharacterCounter() {
  20035. return _super !== null && _super.apply(this, arguments) || this;
  20036. }
  20037. MDCTextFieldCharacterCounter.attachTo = function (root) {
  20038. return new MDCTextFieldCharacterCounter(root);
  20039. };
  20040. Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", {
  20041. // Provided for access by MDCTextField component
  20042. get: function get() {
  20043. return this.foundation;
  20044. },
  20045. enumerable: true,
  20046. configurable: true
  20047. });
  20048. MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
  20049. var _this = this;
  20050. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20051. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20052. var adapter = {
  20053. setContent: function setContent(content) {
  20054. _this.root.textContent = content;
  20055. }
  20056. };
  20057. return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
  20058. };
  20059. return MDCTextFieldCharacterCounter;
  20060. }(component_1.MDCComponent);
  20061. exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
  20062. /***/ }),
  20063. /***/ "./packages/mdc-textfield/character-counter/constants.ts":
  20064. /*!***************************************************************!*\
  20065. !*** ./packages/mdc-textfield/character-counter/constants.ts ***!
  20066. \***************************************************************/
  20067. /*! no static exports found */
  20068. /***/ (function(module, exports, __webpack_require__) {
  20069. "use strict";
  20070. /**
  20071. * @license
  20072. * Copyright 2019 Google Inc.
  20073. *
  20074. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20075. * of this software and associated documentation files (the "Software"), to deal
  20076. * in the Software without restriction, including without limitation the rights
  20077. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20078. * copies of the Software, and to permit persons to whom the Software is
  20079. * furnished to do so, subject to the following conditions:
  20080. *
  20081. * The above copyright notice and this permission notice shall be included in
  20082. * all copies or substantial portions of the Software.
  20083. *
  20084. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20085. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20086. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20087. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20088. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20089. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20090. * THE SOFTWARE.
  20091. */
  20092. Object.defineProperty(exports, "__esModule", { value: true });
  20093. var cssClasses = {
  20094. ROOT: 'mdc-text-field-character-counter'
  20095. };
  20096. exports.cssClasses = cssClasses;
  20097. var strings = {
  20098. ROOT_SELECTOR: "." + cssClasses.ROOT
  20099. };
  20100. exports.strings = strings;
  20101. /***/ }),
  20102. /***/ "./packages/mdc-textfield/character-counter/foundation.ts":
  20103. /*!****************************************************************!*\
  20104. !*** ./packages/mdc-textfield/character-counter/foundation.ts ***!
  20105. \****************************************************************/
  20106. /*! no static exports found */
  20107. /***/ (function(module, exports, __webpack_require__) {
  20108. "use strict";
  20109. /**
  20110. * @license
  20111. * Copyright 2019 Google Inc.
  20112. *
  20113. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20114. * of this software and associated documentation files (the "Software"), to deal
  20115. * in the Software without restriction, including without limitation the rights
  20116. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20117. * copies of the Software, and to permit persons to whom the Software is
  20118. * furnished to do so, subject to the following conditions:
  20119. *
  20120. * The above copyright notice and this permission notice shall be included in
  20121. * all copies or substantial portions of the Software.
  20122. *
  20123. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20124. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20125. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20126. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20127. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20128. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20129. * THE SOFTWARE.
  20130. */
  20131. var __extends = this && this.__extends || function () {
  20132. var _extendStatics = function extendStatics(d, b) {
  20133. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20134. d.__proto__ = b;
  20135. } || function (d, b) {
  20136. for (var p in b) {
  20137. if (b.hasOwnProperty(p)) d[p] = b[p];
  20138. }
  20139. };
  20140. return _extendStatics(d, b);
  20141. };
  20142. return function (d, b) {
  20143. _extendStatics(d, b);
  20144. function __() {
  20145. this.constructor = d;
  20146. }
  20147. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20148. };
  20149. }();
  20150. var __assign = this && this.__assign || function () {
  20151. __assign = Object.assign || function (t) {
  20152. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20153. s = arguments[i];
  20154. for (var p in s) {
  20155. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20156. }
  20157. }
  20158. return t;
  20159. };
  20160. return __assign.apply(this, arguments);
  20161. };
  20162. Object.defineProperty(exports, "__esModule", { value: true });
  20163. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20164. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  20165. var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) {
  20166. __extends(MDCTextFieldCharacterCounterFoundation, _super);
  20167. function MDCTextFieldCharacterCounterFoundation(adapter) {
  20168. return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this;
  20169. }
  20170. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
  20171. get: function get() {
  20172. return constants_1.cssClasses;
  20173. },
  20174. enumerable: true,
  20175. configurable: true
  20176. });
  20177. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
  20178. get: function get() {
  20179. return constants_1.strings;
  20180. },
  20181. enumerable: true,
  20182. configurable: true
  20183. });
  20184. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
  20185. /**
  20186. * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
  20187. */
  20188. get: function get() {
  20189. return {
  20190. setContent: function setContent() {
  20191. return undefined;
  20192. }
  20193. };
  20194. },
  20195. enumerable: true,
  20196. configurable: true
  20197. });
  20198. MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
  20199. currentLength = Math.min(currentLength, maxLength);
  20200. this.adapter.setContent(currentLength + " / " + maxLength);
  20201. };
  20202. return MDCTextFieldCharacterCounterFoundation;
  20203. }(foundation_1.MDCFoundation);
  20204. exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
  20205. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20206. exports.default = MDCTextFieldCharacterCounterFoundation;
  20207. /***/ }),
  20208. /***/ "./packages/mdc-textfield/character-counter/index.ts":
  20209. /*!***********************************************************!*\
  20210. !*** ./packages/mdc-textfield/character-counter/index.ts ***!
  20211. \***********************************************************/
  20212. /*! no static exports found */
  20213. /***/ (function(module, exports, __webpack_require__) {
  20214. "use strict";
  20215. /**
  20216. * @license
  20217. * Copyright 2019 Google Inc.
  20218. *
  20219. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20220. * of this software and associated documentation files (the "Software"), to deal
  20221. * in the Software without restriction, including without limitation the rights
  20222. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20223. * copies of the Software, and to permit persons to whom the Software is
  20224. * furnished to do so, subject to the following conditions:
  20225. *
  20226. * The above copyright notice and this permission notice shall be included in
  20227. * all copies or substantial portions of the Software.
  20228. *
  20229. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20230. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20231. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20232. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20233. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20234. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20235. * THE SOFTWARE.
  20236. */
  20237. function __export(m) {
  20238. for (var p in m) {
  20239. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20240. }
  20241. }
  20242. Object.defineProperty(exports, "__esModule", { value: true });
  20243. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"));
  20244. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"));
  20245. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  20246. exports.characterCountCssClasses = constants_1.cssClasses;
  20247. exports.characterCountStrings = constants_1.strings;
  20248. /***/ }),
  20249. /***/ "./packages/mdc-textfield/component.ts":
  20250. /*!*********************************************!*\
  20251. !*** ./packages/mdc-textfield/component.ts ***!
  20252. \*********************************************/
  20253. /*! no static exports found */
  20254. /***/ (function(module, exports, __webpack_require__) {
  20255. "use strict";
  20256. /**
  20257. * @license
  20258. * Copyright 2016 Google Inc.
  20259. *
  20260. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20261. * of this software and associated documentation files (the "Software"), to deal
  20262. * in the Software without restriction, including without limitation the rights
  20263. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20264. * copies of the Software, and to permit persons to whom the Software is
  20265. * furnished to do so, subject to the following conditions:
  20266. *
  20267. * The above copyright notice and this permission notice shall be included in
  20268. * all copies or substantial portions of the Software.
  20269. *
  20270. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20271. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20272. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20273. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20274. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20275. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20276. * THE SOFTWARE.
  20277. */
  20278. var __extends = this && this.__extends || function () {
  20279. var _extendStatics = function extendStatics(d, b) {
  20280. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20281. d.__proto__ = b;
  20282. } || function (d, b) {
  20283. for (var p in b) {
  20284. if (b.hasOwnProperty(p)) d[p] = b[p];
  20285. }
  20286. };
  20287. return _extendStatics(d, b);
  20288. };
  20289. return function (d, b) {
  20290. _extendStatics(d, b);
  20291. function __() {
  20292. this.constructor = d;
  20293. }
  20294. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20295. };
  20296. }();
  20297. var __assign = this && this.__assign || function () {
  20298. __assign = Object.assign || function (t) {
  20299. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20300. s = arguments[i];
  20301. for (var p in s) {
  20302. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20303. }
  20304. }
  20305. return t;
  20306. };
  20307. return __assign.apply(this, arguments);
  20308. };
  20309. var __importStar = this && this.__importStar || function (mod) {
  20310. if (mod && mod.__esModule) return mod;
  20311. var result = {};
  20312. if (mod != null) for (var k in mod) {
  20313. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  20314. }result["default"] = mod;
  20315. return result;
  20316. };
  20317. Object.defineProperty(exports, "__esModule", { value: true });
  20318. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20319. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  20320. var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  20321. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  20322. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  20323. var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  20324. var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  20325. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  20326. var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts");
  20327. var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  20328. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  20329. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
  20330. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts");
  20331. var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  20332. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts");
  20333. var MDCTextField = /** @class */function (_super) {
  20334. __extends(MDCTextField, _super);
  20335. function MDCTextField() {
  20336. return _super !== null && _super.apply(this, arguments) || this;
  20337. }
  20338. MDCTextField.attachTo = function (root) {
  20339. return new MDCTextField(root);
  20340. };
  20341. MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
  20342. if (rippleFactory === void 0) {
  20343. rippleFactory = function rippleFactory(el, foundation) {
  20344. return new component_5.MDCRipple(el, foundation);
  20345. };
  20346. }
  20347. if (lineRippleFactory === void 0) {
  20348. lineRippleFactory = function lineRippleFactory(el) {
  20349. return new component_3.MDCLineRipple(el);
  20350. };
  20351. }
  20352. if (helperTextFactory === void 0) {
  20353. helperTextFactory = function helperTextFactory(el) {
  20354. return new component_7.MDCTextFieldHelperText(el);
  20355. };
  20356. }
  20357. if (characterCounterFactory === void 0) {
  20358. characterCounterFactory = function characterCounterFactory(el) {
  20359. return new component_6.MDCTextFieldCharacterCounter(el);
  20360. };
  20361. }
  20362. if (iconFactory === void 0) {
  20363. iconFactory = function iconFactory(el) {
  20364. return new component_8.MDCTextFieldIcon(el);
  20365. };
  20366. }
  20367. if (labelFactory === void 0) {
  20368. labelFactory = function labelFactory(el) {
  20369. return new component_2.MDCFloatingLabel(el);
  20370. };
  20371. }
  20372. if (outlineFactory === void 0) {
  20373. outlineFactory = function outlineFactory(el) {
  20374. return new component_4.MDCNotchedOutline(el);
  20375. };
  20376. }
  20377. this.input_ = this.root.querySelector(constants_1.strings.INPUT_SELECTOR);
  20378. var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR);
  20379. this.label_ = labelElement ? labelFactory(labelElement) : null;
  20380. var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  20381. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  20382. var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  20383. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  20384. // Helper text
  20385. var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
  20386. var nextElementSibling = this.root.nextElementSibling;
  20387. var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
  20388. var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
  20389. this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null;
  20390. // Character counter
  20391. var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
  20392. var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR);
  20393. // If character counter is not found in root element search in sibling element.
  20394. if (!characterCounterEl && hasHelperLine && nextElementSibling) {
  20395. characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
  20396. }
  20397. this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
  20398. // Leading icon
  20399. var leadingIconEl = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  20400. this.leadingIcon_ = leadingIconEl ? iconFactory(leadingIconEl) : null;
  20401. // Trailing icon
  20402. var trailingIconEl = this.root.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
  20403. this.trailingIcon_ = trailingIconEl ? iconFactory(trailingIconEl) : null;
  20404. // Prefix and Suffix
  20405. this.prefix_ = this.root.querySelector(constants_1.strings.PREFIX_SELECTOR);
  20406. this.suffix_ = this.root.querySelector(constants_1.strings.SUFFIX_SELECTOR);
  20407. this.ripple = this.createRipple_(rippleFactory);
  20408. };
  20409. MDCTextField.prototype.destroy = function () {
  20410. if (this.ripple) {
  20411. this.ripple.destroy();
  20412. }
  20413. if (this.lineRipple_) {
  20414. this.lineRipple_.destroy();
  20415. }
  20416. if (this.helperText_) {
  20417. this.helperText_.destroy();
  20418. }
  20419. if (this.characterCounter_) {
  20420. this.characterCounter_.destroy();
  20421. }
  20422. if (this.leadingIcon_) {
  20423. this.leadingIcon_.destroy();
  20424. }
  20425. if (this.trailingIcon_) {
  20426. this.trailingIcon_.destroy();
  20427. }
  20428. if (this.label_) {
  20429. this.label_.destroy();
  20430. }
  20431. if (this.outline_) {
  20432. this.outline_.destroy();
  20433. }
  20434. _super.prototype.destroy.call(this);
  20435. };
  20436. /**
  20437. * Initializes the Text Field's internal state based on the environment's
  20438. * state.
  20439. */
  20440. MDCTextField.prototype.initialSyncWithDOM = function () {
  20441. this.disabled = this.input_.disabled;
  20442. };
  20443. Object.defineProperty(MDCTextField.prototype, "value", {
  20444. get: function get() {
  20445. return this.foundation.getValue();
  20446. },
  20447. /**
  20448. * @param value The value to set on the input.
  20449. */
  20450. set: function set(value) {
  20451. this.foundation.setValue(value);
  20452. },
  20453. enumerable: true,
  20454. configurable: true
  20455. });
  20456. Object.defineProperty(MDCTextField.prototype, "disabled", {
  20457. get: function get() {
  20458. return this.foundation.isDisabled();
  20459. },
  20460. /**
  20461. * @param disabled Sets the Text Field disabled or enabled.
  20462. */
  20463. set: function set(disabled) {
  20464. this.foundation.setDisabled(disabled);
  20465. },
  20466. enumerable: true,
  20467. configurable: true
  20468. });
  20469. Object.defineProperty(MDCTextField.prototype, "valid", {
  20470. get: function get() {
  20471. return this.foundation.isValid();
  20472. },
  20473. /**
  20474. * @param valid Sets the Text Field valid or invalid.
  20475. */
  20476. set: function set(valid) {
  20477. this.foundation.setValid(valid);
  20478. },
  20479. enumerable: true,
  20480. configurable: true
  20481. });
  20482. Object.defineProperty(MDCTextField.prototype, "required", {
  20483. get: function get() {
  20484. return this.input_.required;
  20485. },
  20486. /**
  20487. * @param required Sets the Text Field to required.
  20488. */
  20489. set: function set(required) {
  20490. this.input_.required = required;
  20491. },
  20492. enumerable: true,
  20493. configurable: true
  20494. });
  20495. Object.defineProperty(MDCTextField.prototype, "pattern", {
  20496. get: function get() {
  20497. return this.input_.pattern;
  20498. },
  20499. /**
  20500. * @param pattern Sets the input element's validation pattern.
  20501. */
  20502. set: function set(pattern) {
  20503. this.input_.pattern = pattern;
  20504. },
  20505. enumerable: true,
  20506. configurable: true
  20507. });
  20508. Object.defineProperty(MDCTextField.prototype, "minLength", {
  20509. get: function get() {
  20510. return this.input_.minLength;
  20511. },
  20512. /**
  20513. * @param minLength Sets the input element's minLength.
  20514. */
  20515. set: function set(minLength) {
  20516. this.input_.minLength = minLength;
  20517. },
  20518. enumerable: true,
  20519. configurable: true
  20520. });
  20521. Object.defineProperty(MDCTextField.prototype, "maxLength", {
  20522. get: function get() {
  20523. return this.input_.maxLength;
  20524. },
  20525. /**
  20526. * @param maxLength Sets the input element's maxLength.
  20527. */
  20528. set: function set(maxLength) {
  20529. // Chrome throws exception if maxLength is set to a value less than zero
  20530. if (maxLength < 0) {
  20531. this.input_.removeAttribute('maxLength');
  20532. } else {
  20533. this.input_.maxLength = maxLength;
  20534. }
  20535. },
  20536. enumerable: true,
  20537. configurable: true
  20538. });
  20539. Object.defineProperty(MDCTextField.prototype, "min", {
  20540. get: function get() {
  20541. return this.input_.min;
  20542. },
  20543. /**
  20544. * @param min Sets the input element's min.
  20545. */
  20546. set: function set(min) {
  20547. this.input_.min = min;
  20548. },
  20549. enumerable: true,
  20550. configurable: true
  20551. });
  20552. Object.defineProperty(MDCTextField.prototype, "max", {
  20553. get: function get() {
  20554. return this.input_.max;
  20555. },
  20556. /**
  20557. * @param max Sets the input element's max.
  20558. */
  20559. set: function set(max) {
  20560. this.input_.max = max;
  20561. },
  20562. enumerable: true,
  20563. configurable: true
  20564. });
  20565. Object.defineProperty(MDCTextField.prototype, "step", {
  20566. get: function get() {
  20567. return this.input_.step;
  20568. },
  20569. /**
  20570. * @param step Sets the input element's step.
  20571. */
  20572. set: function set(step) {
  20573. this.input_.step = step;
  20574. },
  20575. enumerable: true,
  20576. configurable: true
  20577. });
  20578. Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
  20579. /**
  20580. * Sets the helper text element content.
  20581. */
  20582. set: function set(content) {
  20583. this.foundation.setHelperTextContent(content);
  20584. },
  20585. enumerable: true,
  20586. configurable: true
  20587. });
  20588. Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
  20589. /**
  20590. * Sets the aria label of the leading icon.
  20591. */
  20592. set: function set(label) {
  20593. this.foundation.setLeadingIconAriaLabel(label);
  20594. },
  20595. enumerable: true,
  20596. configurable: true
  20597. });
  20598. Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
  20599. /**
  20600. * Sets the text content of the leading icon.
  20601. */
  20602. set: function set(content) {
  20603. this.foundation.setLeadingIconContent(content);
  20604. },
  20605. enumerable: true,
  20606. configurable: true
  20607. });
  20608. Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
  20609. /**
  20610. * Sets the aria label of the trailing icon.
  20611. */
  20612. set: function set(label) {
  20613. this.foundation.setTrailingIconAriaLabel(label);
  20614. },
  20615. enumerable: true,
  20616. configurable: true
  20617. });
  20618. Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
  20619. /**
  20620. * Sets the text content of the trailing icon.
  20621. */
  20622. set: function set(content) {
  20623. this.foundation.setTrailingIconContent(content);
  20624. },
  20625. enumerable: true,
  20626. configurable: true
  20627. });
  20628. Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
  20629. /**
  20630. * Enables or disables the use of native validation. Use this for custom validation.
  20631. * @param useNativeValidation Set this to false to ignore native input validation.
  20632. */
  20633. set: function set(useNativeValidation) {
  20634. this.foundation.setUseNativeValidation(useNativeValidation);
  20635. },
  20636. enumerable: true,
  20637. configurable: true
  20638. });
  20639. Object.defineProperty(MDCTextField.prototype, "prefixText", {
  20640. /**
  20641. * Gets the text content of the prefix, or null if it does not exist.
  20642. */
  20643. get: function get() {
  20644. return this.prefix_ ? this.prefix_.textContent : null;
  20645. },
  20646. /**
  20647. * Sets the text content of the prefix, if it exists.
  20648. */
  20649. set: function set(prefixText) {
  20650. if (this.prefix_) {
  20651. this.prefix_.textContent = prefixText;
  20652. }
  20653. },
  20654. enumerable: true,
  20655. configurable: true
  20656. });
  20657. Object.defineProperty(MDCTextField.prototype, "suffixText", {
  20658. /**
  20659. * Gets the text content of the suffix, or null if it does not exist.
  20660. */
  20661. get: function get() {
  20662. return this.suffix_ ? this.suffix_.textContent : null;
  20663. },
  20664. /**
  20665. * Sets the text content of the suffix, if it exists.
  20666. */
  20667. set: function set(suffixText) {
  20668. if (this.suffix_) {
  20669. this.suffix_.textContent = suffixText;
  20670. }
  20671. },
  20672. enumerable: true,
  20673. configurable: true
  20674. });
  20675. /**
  20676. * Focuses the input element.
  20677. */
  20678. MDCTextField.prototype.focus = function () {
  20679. this.input_.focus();
  20680. };
  20681. /**
  20682. * Recomputes the outline SVG path for the outline element.
  20683. */
  20684. MDCTextField.prototype.layout = function () {
  20685. var openNotch = this.foundation.shouldFloat;
  20686. this.foundation.notchOutline(openNotch);
  20687. };
  20688. MDCTextField.prototype.getDefaultFoundation = function () {
  20689. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20690. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20691. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20692. var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods_()), this.getInputAdapterMethods_()), this.getLabelAdapterMethods_()), this.getLineRippleAdapterMethods_()), this.getOutlineAdapterMethods_());
  20693. // tslint:enable:object-literal-sort-keys
  20694. return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap_());
  20695. };
  20696. MDCTextField.prototype.getRootAdapterMethods_ = function () {
  20697. var _this = this;
  20698. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20699. return {
  20700. addClass: function addClass(className) {
  20701. return _this.root.classList.add(className);
  20702. },
  20703. removeClass: function removeClass(className) {
  20704. return _this.root.classList.remove(className);
  20705. },
  20706. hasClass: function hasClass(className) {
  20707. return _this.root.classList.contains(className);
  20708. },
  20709. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
  20710. return _this.listen(evtType, handler);
  20711. },
  20712. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
  20713. return _this.unlisten(evtType, handler);
  20714. },
  20715. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
  20716. var getAttributesList = function getAttributesList(mutationsList) {
  20717. return mutationsList.map(function (mutation) {
  20718. return mutation.attributeName;
  20719. }).filter(function (attributeName) {
  20720. return attributeName;
  20721. });
  20722. };
  20723. var observer = new MutationObserver(function (mutationsList) {
  20724. return handler(getAttributesList(mutationsList));
  20725. });
  20726. var config = { attributes: true };
  20727. observer.observe(_this.input_, config);
  20728. return observer;
  20729. },
  20730. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
  20731. return observer.disconnect();
  20732. }
  20733. };
  20734. // tslint:enable:object-literal-sort-keys
  20735. };
  20736. MDCTextField.prototype.getInputAdapterMethods_ = function () {
  20737. var _this = this;
  20738. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20739. return {
  20740. getNativeInput: function getNativeInput() {
  20741. return _this.input_;
  20742. },
  20743. isFocused: function isFocused() {
  20744. return document.activeElement === _this.input_;
  20745. },
  20746. registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
  20747. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  20748. },
  20749. deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
  20750. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  20751. }
  20752. };
  20753. // tslint:enable:object-literal-sort-keys
  20754. };
  20755. MDCTextField.prototype.getLabelAdapterMethods_ = function () {
  20756. var _this = this;
  20757. return {
  20758. floatLabel: function floatLabel(shouldFloat) {
  20759. return _this.label_ && _this.label_.float(shouldFloat);
  20760. },
  20761. getLabelWidth: function getLabelWidth() {
  20762. return _this.label_ ? _this.label_.getWidth() : 0;
  20763. },
  20764. hasLabel: function hasLabel() {
  20765. return Boolean(_this.label_);
  20766. },
  20767. shakeLabel: function shakeLabel(shouldShake) {
  20768. return _this.label_ && _this.label_.shake(shouldShake);
  20769. },
  20770. setLabelRequired: function setLabelRequired(isRequired) {
  20771. return _this.label_ && _this.label_.setRequired(isRequired);
  20772. }
  20773. };
  20774. };
  20775. MDCTextField.prototype.getLineRippleAdapterMethods_ = function () {
  20776. var _this = this;
  20777. return {
  20778. activateLineRipple: function activateLineRipple() {
  20779. if (_this.lineRipple_) {
  20780. _this.lineRipple_.activate();
  20781. }
  20782. },
  20783. deactivateLineRipple: function deactivateLineRipple() {
  20784. if (_this.lineRipple_) {
  20785. _this.lineRipple_.deactivate();
  20786. }
  20787. },
  20788. setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
  20789. if (_this.lineRipple_) {
  20790. _this.lineRipple_.setRippleCenter(normalizedX);
  20791. }
  20792. }
  20793. };
  20794. };
  20795. MDCTextField.prototype.getOutlineAdapterMethods_ = function () {
  20796. var _this = this;
  20797. return {
  20798. closeOutline: function closeOutline() {
  20799. return _this.outline_ && _this.outline_.closeNotch();
  20800. },
  20801. hasOutline: function hasOutline() {
  20802. return Boolean(_this.outline_);
  20803. },
  20804. notchOutline: function notchOutline(labelWidth) {
  20805. return _this.outline_ && _this.outline_.notch(labelWidth);
  20806. }
  20807. };
  20808. };
  20809. /**
  20810. * @return A map of all subcomponents to subfoundations.
  20811. */
  20812. MDCTextField.prototype.getFoundationMap_ = function () {
  20813. return {
  20814. characterCounter: this.characterCounter_ ? this.characterCounter_.foundationForTextField : undefined,
  20815. helperText: this.helperText_ ? this.helperText_.foundationForTextField : undefined,
  20816. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundationForTextField : undefined,
  20817. trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundationForTextField : undefined
  20818. };
  20819. };
  20820. MDCTextField.prototype.createRipple_ = function (rippleFactory) {
  20821. var _this = this;
  20822. var isTextArea = this.root.classList.contains(constants_1.cssClasses.TEXTAREA);
  20823. var isOutlined = this.root.classList.contains(constants_1.cssClasses.OUTLINED);
  20824. if (isTextArea || isOutlined) {
  20825. return null;
  20826. }
  20827. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20828. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20829. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20830. var adapter = __assign(__assign({}, component_5.MDCRipple.createAdapter(this)), { isSurfaceActive: function isSurfaceActive() {
  20831. return ponyfill.matches(_this.input_, ':active');
  20832. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  20833. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  20834. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  20835. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  20836. } });
  20837. // tslint:enable:object-literal-sort-keys
  20838. return rippleFactory(this.root, new foundation_1.MDCRippleFoundation(adapter));
  20839. };
  20840. return MDCTextField;
  20841. }(component_1.MDCComponent);
  20842. exports.MDCTextField = MDCTextField;
  20843. /***/ }),
  20844. /***/ "./packages/mdc-textfield/constants.ts":
  20845. /*!*********************************************!*\
  20846. !*** ./packages/mdc-textfield/constants.ts ***!
  20847. \*********************************************/
  20848. /*! no static exports found */
  20849. /***/ (function(module, exports, __webpack_require__) {
  20850. "use strict";
  20851. /**
  20852. * @license
  20853. * Copyright 2016 Google Inc.
  20854. *
  20855. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20856. * of this software and associated documentation files (the "Software"), to deal
  20857. * in the Software without restriction, including without limitation the rights
  20858. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20859. * copies of the Software, and to permit persons to whom the Software is
  20860. * furnished to do so, subject to the following conditions:
  20861. *
  20862. * The above copyright notice and this permission notice shall be included in
  20863. * all copies or substantial portions of the Software.
  20864. *
  20865. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20866. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20867. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20868. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20869. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20870. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20871. * THE SOFTWARE.
  20872. */
  20873. Object.defineProperty(exports, "__esModule", { value: true });
  20874. var strings = {
  20875. ARIA_CONTROLS: 'aria-controls',
  20876. INPUT_SELECTOR: '.mdc-text-field__input',
  20877. LABEL_SELECTOR: '.mdc-floating-label',
  20878. LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
  20879. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  20880. OUTLINE_SELECTOR: '.mdc-notched-outline',
  20881. PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',
  20882. SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',
  20883. TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
  20884. };
  20885. exports.strings = strings;
  20886. var cssClasses = {
  20887. DISABLED: 'mdc-text-field--disabled',
  20888. FOCUSED: 'mdc-text-field--focused',
  20889. FULLWIDTH: 'mdc-text-field--fullwidth',
  20890. HELPER_LINE: 'mdc-text-field-helper-line',
  20891. INVALID: 'mdc-text-field--invalid',
  20892. LABEL_FLOATING: 'mdc-text-field--label-floating',
  20893. NO_LABEL: 'mdc-text-field--no-label',
  20894. OUTLINED: 'mdc-text-field--outlined',
  20895. ROOT: 'mdc-text-field',
  20896. TEXTAREA: 'mdc-text-field--textarea',
  20897. WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
  20898. WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon'
  20899. };
  20900. exports.cssClasses = cssClasses;
  20901. var numbers = {
  20902. LABEL_SCALE: 0.75
  20903. };
  20904. exports.numbers = numbers;
  20905. /**
  20906. * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
  20907. * under the "Validation-related attributes" section.
  20908. */
  20909. var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
  20910. exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
  20911. /**
  20912. * Label should always float for these types as they show some UI even if value is empty.
  20913. */
  20914. var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
  20915. exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
  20916. /***/ }),
  20917. /***/ "./packages/mdc-textfield/foundation.ts":
  20918. /*!**********************************************!*\
  20919. !*** ./packages/mdc-textfield/foundation.ts ***!
  20920. \**********************************************/
  20921. /*! no static exports found */
  20922. /***/ (function(module, exports, __webpack_require__) {
  20923. "use strict";
  20924. /**
  20925. * @license
  20926. * Copyright 2016 Google Inc.
  20927. *
  20928. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20929. * of this software and associated documentation files (the "Software"), to deal
  20930. * in the Software without restriction, including without limitation the rights
  20931. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20932. * copies of the Software, and to permit persons to whom the Software is
  20933. * furnished to do so, subject to the following conditions:
  20934. *
  20935. * The above copyright notice and this permission notice shall be included in
  20936. * all copies or substantial portions of the Software.
  20937. *
  20938. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20939. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20940. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20941. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20942. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20943. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20944. * THE SOFTWARE.
  20945. */
  20946. var __extends = this && this.__extends || function () {
  20947. var _extendStatics = function extendStatics(d, b) {
  20948. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20949. d.__proto__ = b;
  20950. } || function (d, b) {
  20951. for (var p in b) {
  20952. if (b.hasOwnProperty(p)) d[p] = b[p];
  20953. }
  20954. };
  20955. return _extendStatics(d, b);
  20956. };
  20957. return function (d, b) {
  20958. _extendStatics(d, b);
  20959. function __() {
  20960. this.constructor = d;
  20961. }
  20962. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20963. };
  20964. }();
  20965. var __assign = this && this.__assign || function () {
  20966. __assign = Object.assign || function (t) {
  20967. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20968. s = arguments[i];
  20969. for (var p in s) {
  20970. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20971. }
  20972. }
  20973. return t;
  20974. };
  20975. return __assign.apply(this, arguments);
  20976. };
  20977. Object.defineProperty(exports, "__esModule", { value: true });
  20978. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20979. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  20980. var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
  20981. var INTERACTION_EVENTS = ['click', 'keydown'];
  20982. var MDCTextFieldFoundation = /** @class */function (_super) {
  20983. __extends(MDCTextFieldFoundation, _super);
  20984. /**
  20985. * @param adapter
  20986. * @param foundationMap Map from subcomponent names to their subfoundations.
  20987. */
  20988. function MDCTextFieldFoundation(adapter, foundationMap) {
  20989. if (foundationMap === void 0) {
  20990. foundationMap = {};
  20991. }
  20992. var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;
  20993. _this.isFocused_ = false;
  20994. _this.receivedUserInput_ = false;
  20995. _this.isValid_ = true;
  20996. _this.useNativeValidation_ = true;
  20997. _this.helperText_ = foundationMap.helperText;
  20998. _this.characterCounter_ = foundationMap.characterCounter;
  20999. _this.leadingIcon_ = foundationMap.leadingIcon;
  21000. _this.trailingIcon_ = foundationMap.trailingIcon;
  21001. _this.inputFocusHandler_ = function () {
  21002. return _this.activateFocus();
  21003. };
  21004. _this.inputBlurHandler_ = function () {
  21005. return _this.deactivateFocus();
  21006. };
  21007. _this.inputInputHandler_ = function () {
  21008. return _this.handleInput();
  21009. };
  21010. _this.setPointerXOffset_ = function (evt) {
  21011. return _this.setTransformOrigin(evt);
  21012. };
  21013. _this.textFieldInteractionHandler_ = function () {
  21014. return _this.handleTextFieldInteraction();
  21015. };
  21016. _this.validationAttributeChangeHandler_ = function (attributesList) {
  21017. return _this.handleValidationAttributeChange(attributesList);
  21018. };
  21019. return _this;
  21020. }
  21021. Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
  21022. get: function get() {
  21023. return constants_1.cssClasses;
  21024. },
  21025. enumerable: true,
  21026. configurable: true
  21027. });
  21028. Object.defineProperty(MDCTextFieldFoundation, "strings", {
  21029. get: function get() {
  21030. return constants_1.strings;
  21031. },
  21032. enumerable: true,
  21033. configurable: true
  21034. });
  21035. Object.defineProperty(MDCTextFieldFoundation, "numbers", {
  21036. get: function get() {
  21037. return constants_1.numbers;
  21038. },
  21039. enumerable: true,
  21040. configurable: true
  21041. });
  21042. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", {
  21043. get: function get() {
  21044. var type = this.getNativeInput_().type;
  21045. return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
  21046. },
  21047. enumerable: true,
  21048. configurable: true
  21049. });
  21050. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
  21051. get: function get() {
  21052. return this.shouldAlwaysFloat_ || this.isFocused_ || !!this.getValue() || this.isBadInput_();
  21053. },
  21054. enumerable: true,
  21055. configurable: true
  21056. });
  21057. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
  21058. get: function get() {
  21059. return !this.isFocused_ && !this.isValid() && !!this.getValue();
  21060. },
  21061. enumerable: true,
  21062. configurable: true
  21063. });
  21064. Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
  21065. /**
  21066. * See {@link MDCTextFieldAdapter} for typing information on parameters and return types.
  21067. */
  21068. get: function get() {
  21069. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  21070. return {
  21071. addClass: function addClass() {
  21072. return undefined;
  21073. },
  21074. removeClass: function removeClass() {
  21075. return undefined;
  21076. },
  21077. hasClass: function hasClass() {
  21078. return true;
  21079. },
  21080. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
  21081. return undefined;
  21082. },
  21083. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
  21084. return undefined;
  21085. },
  21086. registerInputInteractionHandler: function registerInputInteractionHandler() {
  21087. return undefined;
  21088. },
  21089. deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
  21090. return undefined;
  21091. },
  21092. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
  21093. return new MutationObserver(function () {
  21094. return undefined;
  21095. });
  21096. },
  21097. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
  21098. return undefined;
  21099. },
  21100. getNativeInput: function getNativeInput() {
  21101. return null;
  21102. },
  21103. isFocused: function isFocused() {
  21104. return false;
  21105. },
  21106. activateLineRipple: function activateLineRipple() {
  21107. return undefined;
  21108. },
  21109. deactivateLineRipple: function deactivateLineRipple() {
  21110. return undefined;
  21111. },
  21112. setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
  21113. return undefined;
  21114. },
  21115. shakeLabel: function shakeLabel() {
  21116. return undefined;
  21117. },
  21118. floatLabel: function floatLabel() {
  21119. return undefined;
  21120. },
  21121. setLabelRequired: function setLabelRequired() {
  21122. return undefined;
  21123. },
  21124. hasLabel: function hasLabel() {
  21125. return false;
  21126. },
  21127. getLabelWidth: function getLabelWidth() {
  21128. return 0;
  21129. },
  21130. hasOutline: function hasOutline() {
  21131. return false;
  21132. },
  21133. notchOutline: function notchOutline() {
  21134. return undefined;
  21135. },
  21136. closeOutline: function closeOutline() {
  21137. return undefined;
  21138. }
  21139. };
  21140. // tslint:enable:object-literal-sort-keys
  21141. },
  21142. enumerable: true,
  21143. configurable: true
  21144. });
  21145. MDCTextFieldFoundation.prototype.init = function () {
  21146. var _this = this;
  21147. if (this.adapter.hasLabel() && this.getNativeInput_().required) {
  21148. this.adapter.setLabelRequired(true);
  21149. }
  21150. if (this.adapter.isFocused()) {
  21151. this.inputFocusHandler_();
  21152. } else if (this.adapter.hasLabel() && this.shouldFloat) {
  21153. this.notchOutline(true);
  21154. this.adapter.floatLabel(true);
  21155. this.styleFloating_(true);
  21156. }
  21157. this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler_);
  21158. this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler_);
  21159. this.adapter.registerInputInteractionHandler('input', this.inputInputHandler_);
  21160. POINTERDOWN_EVENTS.forEach(function (evtType) {
  21161. _this.adapter.registerInputInteractionHandler(evtType, _this.setPointerXOffset_);
  21162. });
  21163. INTERACTION_EVENTS.forEach(function (evtType) {
  21164. _this.adapter.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  21165. });
  21166. this.validationObserver_ = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_);
  21167. this.setCharacterCounter_(this.getValue().length);
  21168. };
  21169. MDCTextFieldFoundation.prototype.destroy = function () {
  21170. var _this = this;
  21171. this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler_);
  21172. this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler_);
  21173. this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler_);
  21174. POINTERDOWN_EVENTS.forEach(function (evtType) {
  21175. _this.adapter.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_);
  21176. });
  21177. INTERACTION_EVENTS.forEach(function (evtType) {
  21178. _this.adapter.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  21179. });
  21180. this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver_);
  21181. };
  21182. /**
  21183. * Handles user interactions with the Text Field.
  21184. */
  21185. MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
  21186. var nativeInput = this.adapter.getNativeInput();
  21187. if (nativeInput && nativeInput.disabled) {
  21188. return;
  21189. }
  21190. this.receivedUserInput_ = true;
  21191. };
  21192. /**
  21193. * Handles validation attribute changes
  21194. */
  21195. MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
  21196. var _this = this;
  21197. attributesList.some(function (attributeName) {
  21198. if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
  21199. _this.styleValidity_(true);
  21200. _this.adapter.setLabelRequired(_this.getNativeInput_().required);
  21201. return true;
  21202. }
  21203. return false;
  21204. });
  21205. if (attributesList.indexOf('maxlength') > -1) {
  21206. this.setCharacterCounter_(this.getValue().length);
  21207. }
  21208. };
  21209. /**
  21210. * Opens/closes the notched outline.
  21211. */
  21212. MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
  21213. if (!this.adapter.hasOutline()) {
  21214. return;
  21215. }
  21216. if (openNotch) {
  21217. var labelWidth = this.adapter.getLabelWidth() * constants_1.numbers.LABEL_SCALE;
  21218. this.adapter.notchOutline(labelWidth);
  21219. } else {
  21220. this.adapter.closeOutline();
  21221. }
  21222. };
  21223. /**
  21224. * Activates the text field focus state.
  21225. */
  21226. MDCTextFieldFoundation.prototype.activateFocus = function () {
  21227. this.isFocused_ = true;
  21228. this.styleFocused_(this.isFocused_);
  21229. this.adapter.activateLineRipple();
  21230. if (this.adapter.hasLabel()) {
  21231. this.notchOutline(this.shouldFloat);
  21232. this.adapter.floatLabel(this.shouldFloat);
  21233. this.styleFloating_(this.shouldFloat);
  21234. this.adapter.shakeLabel(this.shouldShake);
  21235. }
  21236. if (this.helperText_) {
  21237. this.helperText_.showToScreenReader();
  21238. }
  21239. };
  21240. /**
  21241. * Sets the line ripple's transform origin, so that the line ripple activate
  21242. * animation will animate out from the user's click location.
  21243. */
  21244. MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
  21245. if (this.isDisabled() || this.adapter.hasOutline()) {
  21246. return;
  21247. }
  21248. var touches = evt.touches;
  21249. var targetEvent = touches ? touches[0] : evt;
  21250. var targetClientRect = targetEvent.target.getBoundingClientRect();
  21251. var normalizedX = targetEvent.clientX - targetClientRect.left;
  21252. this.adapter.setLineRippleTransformOrigin(normalizedX);
  21253. };
  21254. /**
  21255. * Handles input change of text input and text area.
  21256. */
  21257. MDCTextFieldFoundation.prototype.handleInput = function () {
  21258. this.autoCompleteFocus();
  21259. this.setCharacterCounter_(this.getValue().length);
  21260. };
  21261. /**
  21262. * Activates the Text Field's focus state in cases when the input value
  21263. * changes without user input (e.g. programmatically).
  21264. */
  21265. MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
  21266. if (!this.receivedUserInput_) {
  21267. this.activateFocus();
  21268. }
  21269. };
  21270. /**
  21271. * Deactivates the Text Field's focus state.
  21272. */
  21273. MDCTextFieldFoundation.prototype.deactivateFocus = function () {
  21274. this.isFocused_ = false;
  21275. this.adapter.deactivateLineRipple();
  21276. var isValid = this.isValid();
  21277. this.styleValidity_(isValid);
  21278. this.styleFocused_(this.isFocused_);
  21279. if (this.adapter.hasLabel()) {
  21280. this.notchOutline(this.shouldFloat);
  21281. this.adapter.floatLabel(this.shouldFloat);
  21282. this.styleFloating_(this.shouldFloat);
  21283. this.adapter.shakeLabel(this.shouldShake);
  21284. }
  21285. if (!this.shouldFloat) {
  21286. this.receivedUserInput_ = false;
  21287. }
  21288. };
  21289. MDCTextFieldFoundation.prototype.getValue = function () {
  21290. return this.getNativeInput_().value;
  21291. };
  21292. /**
  21293. * @param value The value to set on the input Element.
  21294. */
  21295. MDCTextFieldFoundation.prototype.setValue = function (value) {
  21296. // Prevent Safari from moving the caret to the end of the input when the value has not changed.
  21297. if (this.getValue() !== value) {
  21298. this.getNativeInput_().value = value;
  21299. }
  21300. this.setCharacterCounter_(value.length);
  21301. var isValid = this.isValid();
  21302. this.styleValidity_(isValid);
  21303. if (this.adapter.hasLabel()) {
  21304. this.notchOutline(this.shouldFloat);
  21305. this.adapter.floatLabel(this.shouldFloat);
  21306. this.styleFloating_(this.shouldFloat);
  21307. this.adapter.shakeLabel(this.shouldShake);
  21308. }
  21309. };
  21310. /**
  21311. * @return The custom validity state, if set; otherwise, the result of a native validity check.
  21312. */
  21313. MDCTextFieldFoundation.prototype.isValid = function () {
  21314. return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_;
  21315. };
  21316. /**
  21317. * @param isValid Sets the custom validity state of the Text Field.
  21318. */
  21319. MDCTextFieldFoundation.prototype.setValid = function (isValid) {
  21320. this.isValid_ = isValid;
  21321. this.styleValidity_(isValid);
  21322. var shouldShake = !isValid && !this.isFocused_ && !!this.getValue();
  21323. if (this.adapter.hasLabel()) {
  21324. this.adapter.shakeLabel(shouldShake);
  21325. }
  21326. };
  21327. /**
  21328. * Enables or disables the use of native validation. Use this for custom validation.
  21329. * @param useNativeValidation Set this to false to ignore native input validation.
  21330. */
  21331. MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
  21332. this.useNativeValidation_ = useNativeValidation;
  21333. };
  21334. MDCTextFieldFoundation.prototype.isDisabled = function () {
  21335. return this.getNativeInput_().disabled;
  21336. };
  21337. /**
  21338. * @param disabled Sets the text-field disabled or enabled.
  21339. */
  21340. MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
  21341. this.getNativeInput_().disabled = disabled;
  21342. this.styleDisabled_(disabled);
  21343. };
  21344. /**
  21345. * @param content Sets the content of the helper text.
  21346. */
  21347. MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
  21348. if (this.helperText_) {
  21349. this.helperText_.setContent(content);
  21350. }
  21351. };
  21352. /**
  21353. * Sets the aria label of the leading icon.
  21354. */
  21355. MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  21356. if (this.leadingIcon_) {
  21357. this.leadingIcon_.setAriaLabel(label);
  21358. }
  21359. };
  21360. /**
  21361. * Sets the text content of the leading icon.
  21362. */
  21363. MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
  21364. if (this.leadingIcon_) {
  21365. this.leadingIcon_.setContent(content);
  21366. }
  21367. };
  21368. /**
  21369. * Sets the aria label of the trailing icon.
  21370. */
  21371. MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
  21372. if (this.trailingIcon_) {
  21373. this.trailingIcon_.setAriaLabel(label);
  21374. }
  21375. };
  21376. /**
  21377. * Sets the text content of the trailing icon.
  21378. */
  21379. MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
  21380. if (this.trailingIcon_) {
  21381. this.trailingIcon_.setContent(content);
  21382. }
  21383. };
  21384. /**
  21385. * Sets character counter values that shows characters used and the total character limit.
  21386. */
  21387. MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) {
  21388. if (!this.characterCounter_) {
  21389. return;
  21390. }
  21391. var maxLength = this.getNativeInput_().maxLength;
  21392. if (maxLength === -1) {
  21393. throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
  21394. }
  21395. this.characterCounter_.setCounterValue(currentLength, maxLength);
  21396. };
  21397. /**
  21398. * @return True if the Text Field input fails in converting the user-supplied value.
  21399. */
  21400. MDCTextFieldFoundation.prototype.isBadInput_ = function () {
  21401. // The badInput property is not supported in IE 11 💩.
  21402. return this.getNativeInput_().validity.badInput || false;
  21403. };
  21404. /**
  21405. * @return The result of native validity checking (ValidityState.valid).
  21406. */
  21407. MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () {
  21408. return this.getNativeInput_().validity.valid;
  21409. };
  21410. /**
  21411. * Styles the component based on the validity state.
  21412. */
  21413. MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) {
  21414. var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
  21415. if (isValid) {
  21416. this.adapter.removeClass(INVALID);
  21417. } else {
  21418. this.adapter.addClass(INVALID);
  21419. }
  21420. if (this.helperText_) {
  21421. this.helperText_.setValidity(isValid);
  21422. }
  21423. };
  21424. /**
  21425. * Styles the component based on the focused state.
  21426. */
  21427. MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) {
  21428. var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
  21429. if (isFocused) {
  21430. this.adapter.addClass(FOCUSED);
  21431. } else {
  21432. this.adapter.removeClass(FOCUSED);
  21433. }
  21434. };
  21435. /**
  21436. * Styles the component based on the disabled state.
  21437. */
  21438. MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) {
  21439. var _a = MDCTextFieldFoundation.cssClasses,
  21440. DISABLED = _a.DISABLED,
  21441. INVALID = _a.INVALID;
  21442. if (isDisabled) {
  21443. this.adapter.addClass(DISABLED);
  21444. this.adapter.removeClass(INVALID);
  21445. } else {
  21446. this.adapter.removeClass(DISABLED);
  21447. }
  21448. if (this.leadingIcon_) {
  21449. this.leadingIcon_.setDisabled(isDisabled);
  21450. }
  21451. if (this.trailingIcon_) {
  21452. this.trailingIcon_.setDisabled(isDisabled);
  21453. }
  21454. };
  21455. /**
  21456. * Styles the component based on the label floating state.
  21457. */
  21458. MDCTextFieldFoundation.prototype.styleFloating_ = function (isFloating) {
  21459. var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;
  21460. if (isFloating) {
  21461. this.adapter.addClass(LABEL_FLOATING);
  21462. } else {
  21463. this.adapter.removeClass(LABEL_FLOATING);
  21464. }
  21465. };
  21466. /**
  21467. * @return The native text input element from the host environment, or an object with the same shape for unit tests.
  21468. */
  21469. MDCTextFieldFoundation.prototype.getNativeInput_ = function () {
  21470. // this.adapter may be undefined in foundation unit tests. This happens when testdouble is creating a mock object
  21471. // and invokes the shouldShake/shouldFloat getters (which in turn call getValue(), which calls this method) before
  21472. // init() has been called from the MDCTextField constructor. To work around that issue, we return a dummy object.
  21473. var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;
  21474. return nativeInput || {
  21475. disabled: false,
  21476. maxLength: -1,
  21477. required: false,
  21478. type: 'input',
  21479. validity: {
  21480. badInput: false,
  21481. valid: true
  21482. },
  21483. value: ''
  21484. };
  21485. };
  21486. return MDCTextFieldFoundation;
  21487. }(foundation_1.MDCFoundation);
  21488. exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
  21489. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  21490. exports.default = MDCTextFieldFoundation;
  21491. /***/ }),
  21492. /***/ "./packages/mdc-textfield/helper-text/component.ts":
  21493. /*!*********************************************************!*\
  21494. !*** ./packages/mdc-textfield/helper-text/component.ts ***!
  21495. \*********************************************************/
  21496. /*! no static exports found */
  21497. /***/ (function(module, exports, __webpack_require__) {
  21498. "use strict";
  21499. /**
  21500. * @license
  21501. * Copyright 2017 Google Inc.
  21502. *
  21503. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21504. * of this software and associated documentation files (the "Software"), to deal
  21505. * in the Software without restriction, including without limitation the rights
  21506. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21507. * copies of the Software, and to permit persons to whom the Software is
  21508. * furnished to do so, subject to the following conditions:
  21509. *
  21510. * The above copyright notice and this permission notice shall be included in
  21511. * all copies or substantial portions of the Software.
  21512. *
  21513. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21514. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21515. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21516. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21517. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21518. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21519. * THE SOFTWARE.
  21520. */
  21521. var __extends = this && this.__extends || function () {
  21522. var _extendStatics = function extendStatics(d, b) {
  21523. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  21524. d.__proto__ = b;
  21525. } || function (d, b) {
  21526. for (var p in b) {
  21527. if (b.hasOwnProperty(p)) d[p] = b[p];
  21528. }
  21529. };
  21530. return _extendStatics(d, b);
  21531. };
  21532. return function (d, b) {
  21533. _extendStatics(d, b);
  21534. function __() {
  21535. this.constructor = d;
  21536. }
  21537. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21538. };
  21539. }();
  21540. Object.defineProperty(exports, "__esModule", { value: true });
  21541. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  21542. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  21543. var MDCTextFieldHelperText = /** @class */function (_super) {
  21544. __extends(MDCTextFieldHelperText, _super);
  21545. function MDCTextFieldHelperText() {
  21546. return _super !== null && _super.apply(this, arguments) || this;
  21547. }
  21548. MDCTextFieldHelperText.attachTo = function (root) {
  21549. return new MDCTextFieldHelperText(root);
  21550. };
  21551. Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", {
  21552. // Provided for access by MDCTextField component
  21553. get: function get() {
  21554. return this.foundation;
  21555. },
  21556. enumerable: true,
  21557. configurable: true
  21558. });
  21559. MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
  21560. var _this = this;
  21561. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  21562. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  21563. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  21564. var adapter = {
  21565. addClass: function addClass(className) {
  21566. return _this.root.classList.add(className);
  21567. },
  21568. removeClass: function removeClass(className) {
  21569. return _this.root.classList.remove(className);
  21570. },
  21571. hasClass: function hasClass(className) {
  21572. return _this.root.classList.contains(className);
  21573. },
  21574. setAttr: function setAttr(attr, value) {
  21575. return _this.root.setAttribute(attr, value);
  21576. },
  21577. removeAttr: function removeAttr(attr) {
  21578. return _this.root.removeAttribute(attr);
  21579. },
  21580. setContent: function setContent(content) {
  21581. _this.root.textContent = content;
  21582. }
  21583. };
  21584. // tslint:enable:object-literal-sort-keys
  21585. return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
  21586. };
  21587. return MDCTextFieldHelperText;
  21588. }(component_1.MDCComponent);
  21589. exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
  21590. /***/ }),
  21591. /***/ "./packages/mdc-textfield/helper-text/constants.ts":
  21592. /*!*********************************************************!*\
  21593. !*** ./packages/mdc-textfield/helper-text/constants.ts ***!
  21594. \*********************************************************/
  21595. /*! no static exports found */
  21596. /***/ (function(module, exports, __webpack_require__) {
  21597. "use strict";
  21598. /**
  21599. * @license
  21600. * Copyright 2016 Google Inc.
  21601. *
  21602. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21603. * of this software and associated documentation files (the "Software"), to deal
  21604. * in the Software without restriction, including without limitation the rights
  21605. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21606. * copies of the Software, and to permit persons to whom the Software is
  21607. * furnished to do so, subject to the following conditions:
  21608. *
  21609. * The above copyright notice and this permission notice shall be included in
  21610. * all copies or substantial portions of the Software.
  21611. *
  21612. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21613. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21614. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21615. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21616. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21617. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21618. * THE SOFTWARE.
  21619. */
  21620. Object.defineProperty(exports, "__esModule", { value: true });
  21621. var cssClasses = {
  21622. HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
  21623. HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
  21624. ROOT: 'mdc-text-field-helper-text'
  21625. };
  21626. exports.cssClasses = cssClasses;
  21627. var strings = {
  21628. ARIA_HIDDEN: 'aria-hidden',
  21629. ROLE: 'role',
  21630. ROOT_SELECTOR: "." + cssClasses.ROOT
  21631. };
  21632. exports.strings = strings;
  21633. /***/ }),
  21634. /***/ "./packages/mdc-textfield/helper-text/foundation.ts":
  21635. /*!**********************************************************!*\
  21636. !*** ./packages/mdc-textfield/helper-text/foundation.ts ***!
  21637. \**********************************************************/
  21638. /*! no static exports found */
  21639. /***/ (function(module, exports, __webpack_require__) {
  21640. "use strict";
  21641. /**
  21642. * @license
  21643. * Copyright 2017 Google Inc.
  21644. *
  21645. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21646. * of this software and associated documentation files (the "Software"), to deal
  21647. * in the Software without restriction, including without limitation the rights
  21648. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21649. * copies of the Software, and to permit persons to whom the Software is
  21650. * furnished to do so, subject to the following conditions:
  21651. *
  21652. * The above copyright notice and this permission notice shall be included in
  21653. * all copies or substantial portions of the Software.
  21654. *
  21655. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21656. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21657. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21658. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21659. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21660. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21661. * THE SOFTWARE.
  21662. */
  21663. var __extends = this && this.__extends || function () {
  21664. var _extendStatics = function extendStatics(d, b) {
  21665. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  21666. d.__proto__ = b;
  21667. } || function (d, b) {
  21668. for (var p in b) {
  21669. if (b.hasOwnProperty(p)) d[p] = b[p];
  21670. }
  21671. };
  21672. return _extendStatics(d, b);
  21673. };
  21674. return function (d, b) {
  21675. _extendStatics(d, b);
  21676. function __() {
  21677. this.constructor = d;
  21678. }
  21679. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21680. };
  21681. }();
  21682. var __assign = this && this.__assign || function () {
  21683. __assign = Object.assign || function (t) {
  21684. for (var s, i = 1, n = arguments.length; i < n; i++) {
  21685. s = arguments[i];
  21686. for (var p in s) {
  21687. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  21688. }
  21689. }
  21690. return t;
  21691. };
  21692. return __assign.apply(this, arguments);
  21693. };
  21694. Object.defineProperty(exports, "__esModule", { value: true });
  21695. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  21696. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  21697. var MDCTextFieldHelperTextFoundation = /** @class */function (_super) {
  21698. __extends(MDCTextFieldHelperTextFoundation, _super);
  21699. function MDCTextFieldHelperTextFoundation(adapter) {
  21700. return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;
  21701. }
  21702. Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
  21703. get: function get() {
  21704. return constants_1.cssClasses;
  21705. },
  21706. enumerable: true,
  21707. configurable: true
  21708. });
  21709. Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
  21710. get: function get() {
  21711. return constants_1.strings;
  21712. },
  21713. enumerable: true,
  21714. configurable: true
  21715. });
  21716. Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
  21717. /**
  21718. * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.
  21719. */
  21720. get: function get() {
  21721. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  21722. return {
  21723. addClass: function addClass() {
  21724. return undefined;
  21725. },
  21726. removeClass: function removeClass() {
  21727. return undefined;
  21728. },
  21729. hasClass: function hasClass() {
  21730. return false;
  21731. },
  21732. setAttr: function setAttr() {
  21733. return undefined;
  21734. },
  21735. removeAttr: function removeAttr() {
  21736. return undefined;
  21737. },
  21738. setContent: function setContent() {
  21739. return undefined;
  21740. }
  21741. };
  21742. // tslint:enable:object-literal-sort-keys
  21743. },
  21744. enumerable: true,
  21745. configurable: true
  21746. });
  21747. /**
  21748. * Sets the content of the helper text field.
  21749. */
  21750. MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
  21751. this.adapter.setContent(content);
  21752. };
  21753. /**
  21754. * @param isPersistent Sets the persistency of the helper text.
  21755. */
  21756. MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  21757. if (isPersistent) {
  21758. this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  21759. } else {
  21760. this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  21761. }
  21762. };
  21763. /**
  21764. * @param isValidation True to make the helper text act as an error validation message.
  21765. */
  21766. MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
  21767. if (isValidation) {
  21768. this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  21769. } else {
  21770. this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  21771. }
  21772. };
  21773. /**
  21774. * Makes the helper text visible to the screen reader.
  21775. */
  21776. MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
  21777. this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN);
  21778. };
  21779. /**
  21780. * Sets the validity of the helper text based on the input validity.
  21781. */
  21782. MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
  21783. var helperTextIsPersistent = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  21784. var helperTextIsValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  21785. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
  21786. if (validationMsgNeedsDisplay) {
  21787. this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
  21788. } else {
  21789. this.adapter.removeAttr(constants_1.strings.ROLE);
  21790. }
  21791. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  21792. this.hide_();
  21793. }
  21794. };
  21795. /**
  21796. * Hides the help text from screen readers.
  21797. */
  21798. MDCTextFieldHelperTextFoundation.prototype.hide_ = function () {
  21799. this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  21800. };
  21801. return MDCTextFieldHelperTextFoundation;
  21802. }(foundation_1.MDCFoundation);
  21803. exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
  21804. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  21805. exports.default = MDCTextFieldHelperTextFoundation;
  21806. /***/ }),
  21807. /***/ "./packages/mdc-textfield/helper-text/index.ts":
  21808. /*!*****************************************************!*\
  21809. !*** ./packages/mdc-textfield/helper-text/index.ts ***!
  21810. \*****************************************************/
  21811. /*! no static exports found */
  21812. /***/ (function(module, exports, __webpack_require__) {
  21813. "use strict";
  21814. /**
  21815. * @license
  21816. * Copyright 2019 Google Inc.
  21817. *
  21818. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21819. * of this software and associated documentation files (the "Software"), to deal
  21820. * in the Software without restriction, including without limitation the rights
  21821. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21822. * copies of the Software, and to permit persons to whom the Software is
  21823. * furnished to do so, subject to the following conditions:
  21824. *
  21825. * The above copyright notice and this permission notice shall be included in
  21826. * all copies or substantial portions of the Software.
  21827. *
  21828. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21829. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21830. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21831. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21832. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21833. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21834. * THE SOFTWARE.
  21835. */
  21836. function __export(m) {
  21837. for (var p in m) {
  21838. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  21839. }
  21840. }
  21841. Object.defineProperty(exports, "__esModule", { value: true });
  21842. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"));
  21843. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"));
  21844. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  21845. exports.helperTextCssClasses = constants_1.cssClasses;
  21846. exports.helperTextStrings = constants_1.strings;
  21847. /***/ }),
  21848. /***/ "./packages/mdc-textfield/icon/component.ts":
  21849. /*!**************************************************!*\
  21850. !*** ./packages/mdc-textfield/icon/component.ts ***!
  21851. \**************************************************/
  21852. /*! no static exports found */
  21853. /***/ (function(module, exports, __webpack_require__) {
  21854. "use strict";
  21855. /**
  21856. * @license
  21857. * Copyright 2017 Google Inc.
  21858. *
  21859. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21860. * of this software and associated documentation files (the "Software"), to deal
  21861. * in the Software without restriction, including without limitation the rights
  21862. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21863. * copies of the Software, and to permit persons to whom the Software is
  21864. * furnished to do so, subject to the following conditions:
  21865. *
  21866. * The above copyright notice and this permission notice shall be included in
  21867. * all copies or substantial portions of the Software.
  21868. *
  21869. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21870. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21871. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21872. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21873. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21874. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21875. * THE SOFTWARE.
  21876. */
  21877. var __extends = this && this.__extends || function () {
  21878. var _extendStatics = function extendStatics(d, b) {
  21879. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  21880. d.__proto__ = b;
  21881. } || function (d, b) {
  21882. for (var p in b) {
  21883. if (b.hasOwnProperty(p)) d[p] = b[p];
  21884. }
  21885. };
  21886. return _extendStatics(d, b);
  21887. };
  21888. return function (d, b) {
  21889. _extendStatics(d, b);
  21890. function __() {
  21891. this.constructor = d;
  21892. }
  21893. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21894. };
  21895. }();
  21896. Object.defineProperty(exports, "__esModule", { value: true });
  21897. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  21898. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts");
  21899. var MDCTextFieldIcon = /** @class */function (_super) {
  21900. __extends(MDCTextFieldIcon, _super);
  21901. function MDCTextFieldIcon() {
  21902. return _super !== null && _super.apply(this, arguments) || this;
  21903. }
  21904. MDCTextFieldIcon.attachTo = function (root) {
  21905. return new MDCTextFieldIcon(root);
  21906. };
  21907. Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", {
  21908. // Provided for access by MDCTextField component
  21909. get: function get() {
  21910. return this.foundation;
  21911. },
  21912. enumerable: true,
  21913. configurable: true
  21914. });
  21915. MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
  21916. var _this = this;
  21917. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  21918. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  21919. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  21920. var adapter = {
  21921. getAttr: function getAttr(attr) {
  21922. return _this.root.getAttribute(attr);
  21923. },
  21924. setAttr: function setAttr(attr, value) {
  21925. return _this.root.setAttribute(attr, value);
  21926. },
  21927. removeAttr: function removeAttr(attr) {
  21928. return _this.root.removeAttribute(attr);
  21929. },
  21930. setContent: function setContent(content) {
  21931. _this.root.textContent = content;
  21932. },
  21933. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  21934. return _this.listen(evtType, handler);
  21935. },
  21936. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  21937. return _this.unlisten(evtType, handler);
  21938. },
  21939. notifyIconAction: function notifyIconAction() {
  21940. return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  21941. }
  21942. };
  21943. // tslint:enable:object-literal-sort-keys
  21944. return new foundation_1.MDCTextFieldIconFoundation(adapter);
  21945. };
  21946. return MDCTextFieldIcon;
  21947. }(component_1.MDCComponent);
  21948. exports.MDCTextFieldIcon = MDCTextFieldIcon;
  21949. /***/ }),
  21950. /***/ "./packages/mdc-textfield/icon/constants.ts":
  21951. /*!**************************************************!*\
  21952. !*** ./packages/mdc-textfield/icon/constants.ts ***!
  21953. \**************************************************/
  21954. /*! no static exports found */
  21955. /***/ (function(module, exports, __webpack_require__) {
  21956. "use strict";
  21957. /**
  21958. * @license
  21959. * Copyright 2016 Google Inc.
  21960. *
  21961. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21962. * of this software and associated documentation files (the "Software"), to deal
  21963. * in the Software without restriction, including without limitation the rights
  21964. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21965. * copies of the Software, and to permit persons to whom the Software is
  21966. * furnished to do so, subject to the following conditions:
  21967. *
  21968. * The above copyright notice and this permission notice shall be included in
  21969. * all copies or substantial portions of the Software.
  21970. *
  21971. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21972. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21973. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21974. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21975. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21976. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21977. * THE SOFTWARE.
  21978. */
  21979. Object.defineProperty(exports, "__esModule", { value: true });
  21980. var strings = {
  21981. ICON_EVENT: 'MDCTextField:icon',
  21982. ICON_ROLE: 'button'
  21983. };
  21984. exports.strings = strings;
  21985. var cssClasses = {
  21986. ROOT: 'mdc-text-field__icon'
  21987. };
  21988. exports.cssClasses = cssClasses;
  21989. /***/ }),
  21990. /***/ "./packages/mdc-textfield/icon/foundation.ts":
  21991. /*!***************************************************!*\
  21992. !*** ./packages/mdc-textfield/icon/foundation.ts ***!
  21993. \***************************************************/
  21994. /*! no static exports found */
  21995. /***/ (function(module, exports, __webpack_require__) {
  21996. "use strict";
  21997. /**
  21998. * @license
  21999. * Copyright 2017 Google Inc.
  22000. *
  22001. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22002. * of this software and associated documentation files (the "Software"), to deal
  22003. * in the Software without restriction, including without limitation the rights
  22004. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22005. * copies of the Software, and to permit persons to whom the Software is
  22006. * furnished to do so, subject to the following conditions:
  22007. *
  22008. * The above copyright notice and this permission notice shall be included in
  22009. * all copies or substantial portions of the Software.
  22010. *
  22011. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22012. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22013. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22014. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22015. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22016. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22017. * THE SOFTWARE.
  22018. */
  22019. var __extends = this && this.__extends || function () {
  22020. var _extendStatics = function extendStatics(d, b) {
  22021. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  22022. d.__proto__ = b;
  22023. } || function (d, b) {
  22024. for (var p in b) {
  22025. if (b.hasOwnProperty(p)) d[p] = b[p];
  22026. }
  22027. };
  22028. return _extendStatics(d, b);
  22029. };
  22030. return function (d, b) {
  22031. _extendStatics(d, b);
  22032. function __() {
  22033. this.constructor = d;
  22034. }
  22035. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22036. };
  22037. }();
  22038. var __assign = this && this.__assign || function () {
  22039. __assign = Object.assign || function (t) {
  22040. for (var s, i = 1, n = arguments.length; i < n; i++) {
  22041. s = arguments[i];
  22042. for (var p in s) {
  22043. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  22044. }
  22045. }
  22046. return t;
  22047. };
  22048. return __assign.apply(this, arguments);
  22049. };
  22050. Object.defineProperty(exports, "__esModule", { value: true });
  22051. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  22052. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  22053. var INTERACTION_EVENTS = ['click', 'keydown'];
  22054. var MDCTextFieldIconFoundation = /** @class */function (_super) {
  22055. __extends(MDCTextFieldIconFoundation, _super);
  22056. function MDCTextFieldIconFoundation(adapter) {
  22057. var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this;
  22058. _this.savedTabIndex_ = null;
  22059. _this.interactionHandler_ = function (evt) {
  22060. return _this.handleInteraction(evt);
  22061. };
  22062. return _this;
  22063. }
  22064. Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
  22065. get: function get() {
  22066. return constants_1.strings;
  22067. },
  22068. enumerable: true,
  22069. configurable: true
  22070. });
  22071. Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
  22072. get: function get() {
  22073. return constants_1.cssClasses;
  22074. },
  22075. enumerable: true,
  22076. configurable: true
  22077. });
  22078. Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
  22079. /**
  22080. * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.
  22081. */
  22082. get: function get() {
  22083. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  22084. return {
  22085. getAttr: function getAttr() {
  22086. return null;
  22087. },
  22088. setAttr: function setAttr() {
  22089. return undefined;
  22090. },
  22091. removeAttr: function removeAttr() {
  22092. return undefined;
  22093. },
  22094. setContent: function setContent() {
  22095. return undefined;
  22096. },
  22097. registerInteractionHandler: function registerInteractionHandler() {
  22098. return undefined;
  22099. },
  22100. deregisterInteractionHandler: function deregisterInteractionHandler() {
  22101. return undefined;
  22102. },
  22103. notifyIconAction: function notifyIconAction() {
  22104. return undefined;
  22105. }
  22106. };
  22107. // tslint:enable:object-literal-sort-keys
  22108. },
  22109. enumerable: true,
  22110. configurable: true
  22111. });
  22112. MDCTextFieldIconFoundation.prototype.init = function () {
  22113. var _this = this;
  22114. this.savedTabIndex_ = this.adapter.getAttr('tabindex');
  22115. INTERACTION_EVENTS.forEach(function (evtType) {
  22116. _this.adapter.registerInteractionHandler(evtType, _this.interactionHandler_);
  22117. });
  22118. };
  22119. MDCTextFieldIconFoundation.prototype.destroy = function () {
  22120. var _this = this;
  22121. INTERACTION_EVENTS.forEach(function (evtType) {
  22122. _this.adapter.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  22123. });
  22124. };
  22125. MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
  22126. if (!this.savedTabIndex_) {
  22127. return;
  22128. }
  22129. if (disabled) {
  22130. this.adapter.setAttr('tabindex', '-1');
  22131. this.adapter.removeAttr('role');
  22132. } else {
  22133. this.adapter.setAttr('tabindex', this.savedTabIndex_);
  22134. this.adapter.setAttr('role', constants_1.strings.ICON_ROLE);
  22135. }
  22136. };
  22137. MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
  22138. this.adapter.setAttr('aria-label', label);
  22139. };
  22140. MDCTextFieldIconFoundation.prototype.setContent = function (content) {
  22141. this.adapter.setContent(content);
  22142. };
  22143. MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
  22144. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  22145. if (evt.type === 'click' || isEnterKey) {
  22146. evt.preventDefault(); // stop click from causing host label to focus
  22147. // input
  22148. this.adapter.notifyIconAction();
  22149. }
  22150. };
  22151. return MDCTextFieldIconFoundation;
  22152. }(foundation_1.MDCFoundation);
  22153. exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
  22154. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  22155. exports.default = MDCTextFieldIconFoundation;
  22156. /***/ }),
  22157. /***/ "./packages/mdc-textfield/icon/index.ts":
  22158. /*!**********************************************!*\
  22159. !*** ./packages/mdc-textfield/icon/index.ts ***!
  22160. \**********************************************/
  22161. /*! no static exports found */
  22162. /***/ (function(module, exports, __webpack_require__) {
  22163. "use strict";
  22164. /**
  22165. * @license
  22166. * Copyright 2019 Google Inc.
  22167. *
  22168. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22169. * of this software and associated documentation files (the "Software"), to deal
  22170. * in the Software without restriction, including without limitation the rights
  22171. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22172. * copies of the Software, and to permit persons to whom the Software is
  22173. * furnished to do so, subject to the following conditions:
  22174. *
  22175. * The above copyright notice and this permission notice shall be included in
  22176. * all copies or substantial portions of the Software.
  22177. *
  22178. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22179. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22180. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22181. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22182. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22183. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22184. * THE SOFTWARE.
  22185. */
  22186. function __export(m) {
  22187. for (var p in m) {
  22188. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  22189. }
  22190. }
  22191. Object.defineProperty(exports, "__esModule", { value: true });
  22192. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"));
  22193. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"));
  22194. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  22195. exports.iconCssClasses = constants_1.cssClasses;
  22196. exports.iconStrings = constants_1.strings;
  22197. /***/ }),
  22198. /***/ "./packages/mdc-textfield/index.ts":
  22199. /*!*****************************************!*\
  22200. !*** ./packages/mdc-textfield/index.ts ***!
  22201. \*****************************************/
  22202. /*! no static exports found */
  22203. /***/ (function(module, exports, __webpack_require__) {
  22204. "use strict";
  22205. /**
  22206. * @license
  22207. * Copyright 2019 Google Inc.
  22208. *
  22209. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22210. * of this software and associated documentation files (the "Software"), to deal
  22211. * in the Software without restriction, including without limitation the rights
  22212. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22213. * copies of the Software, and to permit persons to whom the Software is
  22214. * furnished to do so, subject to the following conditions:
  22215. *
  22216. * The above copyright notice and this permission notice shall be included in
  22217. * all copies or substantial portions of the Software.
  22218. *
  22219. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22220. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22221. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22222. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22223. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22224. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22225. * THE SOFTWARE.
  22226. */
  22227. function __export(m) {
  22228. for (var p in m) {
  22229. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  22230. }
  22231. }
  22232. Object.defineProperty(exports, "__esModule", { value: true });
  22233. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"));
  22234. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"));
  22235. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"));
  22236. __export(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"));
  22237. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"));
  22238. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"));
  22239. /***/ }),
  22240. /***/ "./packages/mdc-top-app-bar/component.ts":
  22241. /*!***********************************************!*\
  22242. !*** ./packages/mdc-top-app-bar/component.ts ***!
  22243. \***********************************************/
  22244. /*! no static exports found */
  22245. /***/ (function(module, exports, __webpack_require__) {
  22246. "use strict";
  22247. /**
  22248. * @license
  22249. * Copyright 2018 Google Inc.
  22250. *
  22251. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22252. * of this software and associated documentation files (the "Software"), to deal
  22253. * in the Software without restriction, including without limitation the rights
  22254. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22255. * copies of the Software, and to permit persons to whom the Software is
  22256. * furnished to do so, subject to the following conditions:
  22257. *
  22258. * The above copyright notice and this permission notice shall be included in
  22259. * all copies or substantial portions of the Software.
  22260. *
  22261. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22262. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22263. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22264. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22265. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22266. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22267. * THE SOFTWARE.
  22268. */
  22269. var __extends = this && this.__extends || function () {
  22270. var _extendStatics = function extendStatics(d, b) {
  22271. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  22272. d.__proto__ = b;
  22273. } || function (d, b) {
  22274. for (var p in b) {
  22275. if (b.hasOwnProperty(p)) d[p] = b[p];
  22276. }
  22277. };
  22278. return _extendStatics(d, b);
  22279. };
  22280. return function (d, b) {
  22281. _extendStatics(d, b);
  22282. function __() {
  22283. this.constructor = d;
  22284. }
  22285. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22286. };
  22287. }();
  22288. Object.defineProperty(exports, "__esModule", { value: true });
  22289. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  22290. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  22291. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  22292. var foundation_1 = __webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts");
  22293. var foundation_2 = __webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts");
  22294. var foundation_3 = __webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  22295. var MDCTopAppBar = /** @class */function (_super) {
  22296. __extends(MDCTopAppBar, _super);
  22297. function MDCTopAppBar() {
  22298. return _super !== null && _super.apply(this, arguments) || this;
  22299. }
  22300. MDCTopAppBar.attachTo = function (root) {
  22301. return new MDCTopAppBar(root);
  22302. };
  22303. MDCTopAppBar.prototype.initialize = function (rippleFactory) {
  22304. if (rippleFactory === void 0) {
  22305. rippleFactory = function rippleFactory(el) {
  22306. return component_2.MDCRipple.attachTo(el);
  22307. };
  22308. }
  22309. this.navIcon_ = this.root.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR);
  22310. // Get all icons in the toolbar and instantiate the ripples
  22311. var icons = [].slice.call(this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR));
  22312. if (this.navIcon_) {
  22313. icons.push(this.navIcon_);
  22314. }
  22315. this.iconRipples_ = icons.map(function (icon) {
  22316. var ripple = rippleFactory(icon);
  22317. ripple.unbounded = true;
  22318. return ripple;
  22319. });
  22320. this.scrollTarget_ = window;
  22321. };
  22322. MDCTopAppBar.prototype.initialSyncWithDOM = function () {
  22323. this.handleNavigationClick_ = this.foundation.handleNavigationClick.bind(this.foundation);
  22324. this.handleWindowResize_ = this.foundation.handleWindowResize.bind(this.foundation);
  22325. this.handleTargetScroll_ = this.foundation.handleTargetScroll.bind(this.foundation);
  22326. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  22327. if (this.navIcon_) {
  22328. this.navIcon_.addEventListener('click', this.handleNavigationClick_);
  22329. }
  22330. var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  22331. var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  22332. if (!isShort && !isFixed) {
  22333. window.addEventListener('resize', this.handleWindowResize_);
  22334. }
  22335. };
  22336. MDCTopAppBar.prototype.destroy = function () {
  22337. this.iconRipples_.forEach(function (iconRipple) {
  22338. return iconRipple.destroy();
  22339. });
  22340. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  22341. if (this.navIcon_) {
  22342. this.navIcon_.removeEventListener('click', this.handleNavigationClick_);
  22343. }
  22344. var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  22345. var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  22346. if (!isShort && !isFixed) {
  22347. window.removeEventListener('resize', this.handleWindowResize_);
  22348. }
  22349. _super.prototype.destroy.call(this);
  22350. };
  22351. MDCTopAppBar.prototype.setScrollTarget = function (target) {
  22352. // Remove scroll handler from the previous scroll target
  22353. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  22354. this.scrollTarget_ = target;
  22355. // Initialize scroll handler on the new scroll target
  22356. this.handleTargetScroll_ = this.foundation.handleTargetScroll.bind(this.foundation);
  22357. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  22358. };
  22359. MDCTopAppBar.prototype.getDefaultFoundation = function () {
  22360. var _this = this;
  22361. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  22362. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  22363. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  22364. var adapter = {
  22365. hasClass: function hasClass(className) {
  22366. return _this.root.classList.contains(className);
  22367. },
  22368. addClass: function addClass(className) {
  22369. return _this.root.classList.add(className);
  22370. },
  22371. removeClass: function removeClass(className) {
  22372. return _this.root.classList.remove(className);
  22373. },
  22374. setStyle: function setStyle(property, value) {
  22375. return _this.root.style.setProperty(property, value);
  22376. },
  22377. getTopAppBarHeight: function getTopAppBarHeight() {
  22378. return _this.root.clientHeight;
  22379. },
  22380. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  22381. return _this.emit(constants_1.strings.NAVIGATION_EVENT, {});
  22382. },
  22383. getViewportScrollY: function getViewportScrollY() {
  22384. var win = _this.scrollTarget_;
  22385. var el = _this.scrollTarget_;
  22386. return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop;
  22387. },
  22388. getTotalActionItems: function getTotalActionItems() {
  22389. return _this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length;
  22390. }
  22391. };
  22392. // tslint:enable:object-literal-sort-keys
  22393. var foundation;
  22394. if (this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS)) {
  22395. foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter);
  22396. } else if (this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS)) {
  22397. foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter);
  22398. } else {
  22399. foundation = new foundation_3.MDCTopAppBarFoundation(adapter);
  22400. }
  22401. return foundation;
  22402. };
  22403. return MDCTopAppBar;
  22404. }(component_1.MDCComponent);
  22405. exports.MDCTopAppBar = MDCTopAppBar;
  22406. /***/ }),
  22407. /***/ "./packages/mdc-top-app-bar/constants.ts":
  22408. /*!***********************************************!*\
  22409. !*** ./packages/mdc-top-app-bar/constants.ts ***!
  22410. \***********************************************/
  22411. /*! no static exports found */
  22412. /***/ (function(module, exports, __webpack_require__) {
  22413. "use strict";
  22414. /**
  22415. * @license
  22416. * Copyright 2018 Google Inc.
  22417. *
  22418. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22419. * of this software and associated documentation files (the "Software"), to deal
  22420. * in the Software without restriction, including without limitation the rights
  22421. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22422. * copies of the Software, and to permit persons to whom the Software is
  22423. * furnished to do so, subject to the following conditions:
  22424. *
  22425. * The above copyright notice and this permission notice shall be included in
  22426. * all copies or substantial portions of the Software.
  22427. *
  22428. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22429. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22430. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22431. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22432. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22433. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22434. * THE SOFTWARE.
  22435. */
  22436. Object.defineProperty(exports, "__esModule", { value: true });
  22437. var cssClasses = {
  22438. FIXED_CLASS: 'mdc-top-app-bar--fixed',
  22439. FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled',
  22440. SHORT_CLASS: 'mdc-top-app-bar--short',
  22441. SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed',
  22442. SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'
  22443. };
  22444. exports.cssClasses = cssClasses;
  22445. var numbers = {
  22446. DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100,
  22447. MAX_TOP_APP_BAR_HEIGHT: 128
  22448. };
  22449. exports.numbers = numbers;
  22450. var strings = {
  22451. ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item',
  22452. NAVIGATION_EVENT: 'MDCTopAppBar:nav',
  22453. NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon',
  22454. ROOT_SELECTOR: '.mdc-top-app-bar',
  22455. TITLE_SELECTOR: '.mdc-top-app-bar__title'
  22456. };
  22457. exports.strings = strings;
  22458. /***/ }),
  22459. /***/ "./packages/mdc-top-app-bar/fixed/foundation.ts":
  22460. /*!******************************************************!*\
  22461. !*** ./packages/mdc-top-app-bar/fixed/foundation.ts ***!
  22462. \******************************************************/
  22463. /*! no static exports found */
  22464. /***/ (function(module, exports, __webpack_require__) {
  22465. "use strict";
  22466. /**
  22467. * @license
  22468. * Copyright 2018 Google Inc.
  22469. *
  22470. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22471. * of this software and associated documentation files (the "Software"), to deal
  22472. * in the Software without restriction, including without limitation the rights
  22473. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22474. * copies of the Software, and to permit persons to whom the Software is
  22475. * furnished to do so, subject to the following conditions:
  22476. *
  22477. * The above copyright notice and this permission notice shall be included in
  22478. * all copies or substantial portions of the Software.
  22479. *
  22480. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22481. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22482. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22483. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22484. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22485. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22486. * THE SOFTWARE.
  22487. */
  22488. var __extends = this && this.__extends || function () {
  22489. var _extendStatics = function extendStatics(d, b) {
  22490. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  22491. d.__proto__ = b;
  22492. } || function (d, b) {
  22493. for (var p in b) {
  22494. if (b.hasOwnProperty(p)) d[p] = b[p];
  22495. }
  22496. };
  22497. return _extendStatics(d, b);
  22498. };
  22499. return function (d, b) {
  22500. _extendStatics(d, b);
  22501. function __() {
  22502. this.constructor = d;
  22503. }
  22504. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22505. };
  22506. }();
  22507. Object.defineProperty(exports, "__esModule", { value: true });
  22508. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  22509. var foundation_1 = __webpack_require__(/*! ../standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  22510. var MDCFixedTopAppBarFoundation = /** @class */function (_super) {
  22511. __extends(MDCFixedTopAppBarFoundation, _super);
  22512. function MDCFixedTopAppBarFoundation() {
  22513. var _this = _super !== null && _super.apply(this, arguments) || this;
  22514. /**
  22515. * State variable for the previous scroll iteration top app bar state
  22516. */
  22517. _this.wasScrolled_ = false;
  22518. return _this;
  22519. }
  22520. /**
  22521. * Scroll handler for applying/removing the modifier class on the fixed top app bar.
  22522. * @override
  22523. */
  22524. MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () {
  22525. var currentScroll = this.adapter.getViewportScrollY();
  22526. if (currentScroll <= 0) {
  22527. if (this.wasScrolled_) {
  22528. this.adapter.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  22529. this.wasScrolled_ = false;
  22530. }
  22531. } else {
  22532. if (!this.wasScrolled_) {
  22533. this.adapter.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  22534. this.wasScrolled_ = true;
  22535. }
  22536. }
  22537. };
  22538. return MDCFixedTopAppBarFoundation;
  22539. }(foundation_1.MDCTopAppBarFoundation);
  22540. exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation;
  22541. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  22542. exports.default = MDCFixedTopAppBarFoundation;
  22543. /***/ }),
  22544. /***/ "./packages/mdc-top-app-bar/foundation.ts":
  22545. /*!************************************************!*\
  22546. !*** ./packages/mdc-top-app-bar/foundation.ts ***!
  22547. \************************************************/
  22548. /*! no static exports found */
  22549. /***/ (function(module, exports, __webpack_require__) {
  22550. "use strict";
  22551. /**
  22552. * @license
  22553. * Copyright 2018 Google Inc.
  22554. *
  22555. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22556. * of this software and associated documentation files (the "Software"), to deal
  22557. * in the Software without restriction, including without limitation the rights
  22558. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22559. * copies of the Software, and to permit persons to whom the Software is
  22560. * furnished to do so, subject to the following conditions:
  22561. *
  22562. * The above copyright notice and this permission notice shall be included in
  22563. * all copies or substantial portions of the Software.
  22564. *
  22565. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22566. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22567. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22568. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22569. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22570. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22571. * THE SOFTWARE.
  22572. */
  22573. var __extends = this && this.__extends || function () {
  22574. var _extendStatics = function extendStatics(d, b) {
  22575. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  22576. d.__proto__ = b;
  22577. } || function (d, b) {
  22578. for (var p in b) {
  22579. if (b.hasOwnProperty(p)) d[p] = b[p];
  22580. }
  22581. };
  22582. return _extendStatics(d, b);
  22583. };
  22584. return function (d, b) {
  22585. _extendStatics(d, b);
  22586. function __() {
  22587. this.constructor = d;
  22588. }
  22589. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22590. };
  22591. }();
  22592. var __assign = this && this.__assign || function () {
  22593. __assign = Object.assign || function (t) {
  22594. for (var s, i = 1, n = arguments.length; i < n; i++) {
  22595. s = arguments[i];
  22596. for (var p in s) {
  22597. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  22598. }
  22599. }
  22600. return t;
  22601. };
  22602. return __assign.apply(this, arguments);
  22603. };
  22604. Object.defineProperty(exports, "__esModule", { value: true });
  22605. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  22606. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  22607. var MDCTopAppBarBaseFoundation = /** @class */function (_super) {
  22608. __extends(MDCTopAppBarBaseFoundation, _super);
  22609. /* istanbul ignore next: optional argument is not a branch statement */
  22610. function MDCTopAppBarBaseFoundation(adapter) {
  22611. return _super.call(this, __assign(__assign({}, MDCTopAppBarBaseFoundation.defaultAdapter), adapter)) || this;
  22612. }
  22613. Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", {
  22614. get: function get() {
  22615. return constants_1.strings;
  22616. },
  22617. enumerable: true,
  22618. configurable: true
  22619. });
  22620. Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", {
  22621. get: function get() {
  22622. return constants_1.cssClasses;
  22623. },
  22624. enumerable: true,
  22625. configurable: true
  22626. });
  22627. Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", {
  22628. get: function get() {
  22629. return constants_1.numbers;
  22630. },
  22631. enumerable: true,
  22632. configurable: true
  22633. });
  22634. Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", {
  22635. /**
  22636. * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types.
  22637. */
  22638. get: function get() {
  22639. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  22640. return {
  22641. addClass: function addClass() {
  22642. return undefined;
  22643. },
  22644. removeClass: function removeClass() {
  22645. return undefined;
  22646. },
  22647. hasClass: function hasClass() {
  22648. return false;
  22649. },
  22650. setStyle: function setStyle() {
  22651. return undefined;
  22652. },
  22653. getTopAppBarHeight: function getTopAppBarHeight() {
  22654. return 0;
  22655. },
  22656. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  22657. return undefined;
  22658. },
  22659. getViewportScrollY: function getViewportScrollY() {
  22660. return 0;
  22661. },
  22662. getTotalActionItems: function getTotalActionItems() {
  22663. return 0;
  22664. }
  22665. };
  22666. // tslint:enable:object-literal-sort-keys
  22667. },
  22668. enumerable: true,
  22669. configurable: true
  22670. });
  22671. /** Other variants of TopAppBar foundation overrides this method */
  22672. MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {}; // tslint:disable-line:no-empty
  22673. /** Other variants of TopAppBar foundation overrides this method */
  22674. MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {}; // tslint:disable-line:no-empty
  22675. MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () {
  22676. this.adapter.notifyNavigationIconClicked();
  22677. };
  22678. return MDCTopAppBarBaseFoundation;
  22679. }(foundation_1.MDCFoundation);
  22680. exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation;
  22681. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  22682. exports.default = MDCTopAppBarBaseFoundation;
  22683. /***/ }),
  22684. /***/ "./packages/mdc-top-app-bar/index.ts":
  22685. /*!*******************************************!*\
  22686. !*** ./packages/mdc-top-app-bar/index.ts ***!
  22687. \*******************************************/
  22688. /*! no static exports found */
  22689. /***/ (function(module, exports, __webpack_require__) {
  22690. "use strict";
  22691. /**
  22692. * @license
  22693. * Copyright 2019 Google Inc.
  22694. *
  22695. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22696. * of this software and associated documentation files (the "Software"), to deal
  22697. * in the Software without restriction, including without limitation the rights
  22698. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22699. * copies of the Software, and to permit persons to whom the Software is
  22700. * furnished to do so, subject to the following conditions:
  22701. *
  22702. * The above copyright notice and this permission notice shall be included in
  22703. * all copies or substantial portions of the Software.
  22704. *
  22705. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22706. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22707. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22708. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22709. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22710. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22711. * THE SOFTWARE.
  22712. */
  22713. function __export(m) {
  22714. for (var p in m) {
  22715. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  22716. }
  22717. }
  22718. Object.defineProperty(exports, "__esModule", { value: true });
  22719. __export(__webpack_require__(/*! ./component */ "./packages/mdc-top-app-bar/component.ts"));
  22720. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"));
  22721. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-top-app-bar/foundation.ts"));
  22722. __export(__webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"));
  22723. __export(__webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"));
  22724. __export(__webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"));
  22725. /***/ }),
  22726. /***/ "./packages/mdc-top-app-bar/short/foundation.ts":
  22727. /*!******************************************************!*\
  22728. !*** ./packages/mdc-top-app-bar/short/foundation.ts ***!
  22729. \******************************************************/
  22730. /*! no static exports found */
  22731. /***/ (function(module, exports, __webpack_require__) {
  22732. "use strict";
  22733. /**
  22734. * @license
  22735. * Copyright 2018 Google Inc.
  22736. *
  22737. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22738. * of this software and associated documentation files (the "Software"), to deal
  22739. * in the Software without restriction, including without limitation the rights
  22740. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22741. * copies of the Software, and to permit persons to whom the Software is
  22742. * furnished to do so, subject to the following conditions:
  22743. *
  22744. * The above copyright notice and this permission notice shall be included in
  22745. * all copies or substantial portions of the Software.
  22746. *
  22747. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22748. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22749. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22750. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22751. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22752. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22753. * THE SOFTWARE.
  22754. */
  22755. var __extends = this && this.__extends || function () {
  22756. var _extendStatics = function extendStatics(d, b) {
  22757. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  22758. d.__proto__ = b;
  22759. } || function (d, b) {
  22760. for (var p in b) {
  22761. if (b.hasOwnProperty(p)) d[p] = b[p];
  22762. }
  22763. };
  22764. return _extendStatics(d, b);
  22765. };
  22766. return function (d, b) {
  22767. _extendStatics(d, b);
  22768. function __() {
  22769. this.constructor = d;
  22770. }
  22771. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22772. };
  22773. }();
  22774. Object.defineProperty(exports, "__esModule", { value: true });
  22775. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  22776. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  22777. var MDCShortTopAppBarFoundation = /** @class */function (_super) {
  22778. __extends(MDCShortTopAppBarFoundation, _super);
  22779. /* istanbul ignore next: optional argument is not a branch statement */
  22780. function MDCShortTopAppBarFoundation(adapter) {
  22781. var _this = _super.call(this, adapter) || this;
  22782. _this.isCollapsed_ = false;
  22783. _this.isAlwaysCollapsed_ = false;
  22784. return _this;
  22785. }
  22786. Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", {
  22787. // Public visibility for backward compatibility.
  22788. get: function get() {
  22789. return this.isCollapsed_;
  22790. },
  22791. enumerable: true,
  22792. configurable: true
  22793. });
  22794. MDCShortTopAppBarFoundation.prototype.init = function () {
  22795. _super.prototype.init.call(this);
  22796. if (this.adapter.getTotalActionItems() > 0) {
  22797. this.adapter.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS);
  22798. }
  22799. // If initialized with SHORT_COLLAPSED_CLASS, the bar should always be collapsed
  22800. this.setAlwaysCollapsed(this.adapter.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS));
  22801. };
  22802. /**
  22803. * Set if the short top app bar should always be collapsed.
  22804. *
  22805. * @param value When `true`, bar will always be collapsed. When `false`, bar may collapse or expand based on scroll.
  22806. */
  22807. MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) {
  22808. this.isAlwaysCollapsed_ = !!value;
  22809. if (this.isAlwaysCollapsed_) {
  22810. this.collapse_();
  22811. } else {
  22812. // let maybeCollapseBar_ determine if the bar should be collapsed
  22813. this.maybeCollapseBar_();
  22814. }
  22815. };
  22816. MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () {
  22817. return this.isAlwaysCollapsed_;
  22818. };
  22819. /**
  22820. * Scroll handler for applying/removing the collapsed modifier class on the short top app bar.
  22821. * @override
  22822. */
  22823. MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () {
  22824. this.maybeCollapseBar_();
  22825. };
  22826. MDCShortTopAppBarFoundation.prototype.maybeCollapseBar_ = function () {
  22827. if (this.isAlwaysCollapsed_) {
  22828. return;
  22829. }
  22830. var currentScroll = this.adapter.getViewportScrollY();
  22831. if (currentScroll <= 0) {
  22832. if (this.isCollapsed_) {
  22833. this.uncollapse_();
  22834. }
  22835. } else {
  22836. if (!this.isCollapsed_) {
  22837. this.collapse_();
  22838. }
  22839. }
  22840. };
  22841. MDCShortTopAppBarFoundation.prototype.uncollapse_ = function () {
  22842. this.adapter.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  22843. this.isCollapsed_ = false;
  22844. };
  22845. MDCShortTopAppBarFoundation.prototype.collapse_ = function () {
  22846. this.adapter.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  22847. this.isCollapsed_ = true;
  22848. };
  22849. return MDCShortTopAppBarFoundation;
  22850. }(foundation_1.MDCTopAppBarBaseFoundation);
  22851. exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation;
  22852. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  22853. exports.default = MDCShortTopAppBarFoundation;
  22854. /***/ }),
  22855. /***/ "./packages/mdc-top-app-bar/standard/foundation.ts":
  22856. /*!*********************************************************!*\
  22857. !*** ./packages/mdc-top-app-bar/standard/foundation.ts ***!
  22858. \*********************************************************/
  22859. /*! no static exports found */
  22860. /***/ (function(module, exports, __webpack_require__) {
  22861. "use strict";
  22862. /**
  22863. * @license
  22864. * Copyright 2018 Google Inc.
  22865. *
  22866. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22867. * of this software and associated documentation files (the "Software"), to deal
  22868. * in the Software without restriction, including without limitation the rights
  22869. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22870. * copies of the Software, and to permit persons to whom the Software is
  22871. * furnished to do so, subject to the following conditions:
  22872. *
  22873. * The above copyright notice and this permission notice shall be included in
  22874. * all copies or substantial portions of the Software.
  22875. *
  22876. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22877. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22878. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22879. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22880. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22881. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22882. * THE SOFTWARE.
  22883. */
  22884. var __extends = this && this.__extends || function () {
  22885. var _extendStatics = function extendStatics(d, b) {
  22886. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  22887. d.__proto__ = b;
  22888. } || function (d, b) {
  22889. for (var p in b) {
  22890. if (b.hasOwnProperty(p)) d[p] = b[p];
  22891. }
  22892. };
  22893. return _extendStatics(d, b);
  22894. };
  22895. return function (d, b) {
  22896. _extendStatics(d, b);
  22897. function __() {
  22898. this.constructor = d;
  22899. }
  22900. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  22901. };
  22902. }();
  22903. Object.defineProperty(exports, "__esModule", { value: true });
  22904. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  22905. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  22906. var INITIAL_VALUE = 0;
  22907. var MDCTopAppBarFoundation = /** @class */function (_super) {
  22908. __extends(MDCTopAppBarFoundation, _super);
  22909. /* istanbul ignore next: optional argument is not a branch statement */
  22910. function MDCTopAppBarFoundation(adapter) {
  22911. var _this = _super.call(this, adapter) || this;
  22912. /**
  22913. * Indicates if the top app bar was docked in the previous scroll handler iteration.
  22914. */
  22915. _this.wasDocked_ = true;
  22916. /**
  22917. * Indicates if the top app bar is docked in the fully shown position.
  22918. */
  22919. _this.isDockedShowing_ = true;
  22920. /**
  22921. * Variable for current scroll position of the top app bar
  22922. */
  22923. _this.currentAppBarOffsetTop_ = 0;
  22924. /**
  22925. * Used to prevent the top app bar from being scrolled out of view during resize events
  22926. */
  22927. _this.isCurrentlyBeingResized_ = false;
  22928. /**
  22929. * The timeout that's used to throttle the resize events
  22930. */
  22931. _this.resizeThrottleId_ = INITIAL_VALUE;
  22932. /**
  22933. * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize
  22934. */
  22935. _this.resizeDebounceId_ = INITIAL_VALUE;
  22936. _this.lastScrollPosition_ = _this.adapter.getViewportScrollY();
  22937. _this.topAppBarHeight_ = _this.adapter.getTopAppBarHeight();
  22938. return _this;
  22939. }
  22940. MDCTopAppBarFoundation.prototype.destroy = function () {
  22941. _super.prototype.destroy.call(this);
  22942. this.adapter.setStyle('top', '');
  22943. };
  22944. /**
  22945. * Scroll handler for the default scroll behavior of the top app bar.
  22946. * @override
  22947. */
  22948. MDCTopAppBarFoundation.prototype.handleTargetScroll = function () {
  22949. var currentScrollPosition = Math.max(this.adapter.getViewportScrollY(), 0);
  22950. var diff = currentScrollPosition - this.lastScrollPosition_;
  22951. this.lastScrollPosition_ = currentScrollPosition;
  22952. // If the window is being resized the lastScrollPosition_ needs to be updated but the
  22953. // current scroll of the top app bar should stay in the same position.
  22954. if (!this.isCurrentlyBeingResized_) {
  22955. this.currentAppBarOffsetTop_ -= diff;
  22956. if (this.currentAppBarOffsetTop_ > 0) {
  22957. this.currentAppBarOffsetTop_ = 0;
  22958. } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) {
  22959. this.currentAppBarOffsetTop_ = -this.topAppBarHeight_;
  22960. }
  22961. this.moveTopAppBar_();
  22962. }
  22963. };
  22964. /**
  22965. * Top app bar resize handler that throttle/debounce functions that execute updates.
  22966. * @override
  22967. */
  22968. MDCTopAppBarFoundation.prototype.handleWindowResize = function () {
  22969. var _this = this;
  22970. // Throttle resize events 10 p/s
  22971. if (!this.resizeThrottleId_) {
  22972. this.resizeThrottleId_ = setTimeout(function () {
  22973. _this.resizeThrottleId_ = INITIAL_VALUE;
  22974. _this.throttledResizeHandler_();
  22975. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  22976. }
  22977. this.isCurrentlyBeingResized_ = true;
  22978. if (this.resizeDebounceId_) {
  22979. clearTimeout(this.resizeDebounceId_);
  22980. }
  22981. this.resizeDebounceId_ = setTimeout(function () {
  22982. _this.handleTargetScroll();
  22983. _this.isCurrentlyBeingResized_ = false;
  22984. _this.resizeDebounceId_ = INITIAL_VALUE;
  22985. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  22986. };
  22987. /**
  22988. * Function to determine if the DOM needs to update.
  22989. */
  22990. MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () {
  22991. var offscreenBoundaryTop = -this.topAppBarHeight_;
  22992. var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0;
  22993. var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop;
  22994. var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen;
  22995. // If it's partially showing, it can't be docked.
  22996. if (partiallyShowing) {
  22997. this.wasDocked_ = false;
  22998. } else {
  22999. // Not previously docked and not partially showing, it's now docked.
  23000. if (!this.wasDocked_) {
  23001. this.wasDocked_ = true;
  23002. return true;
  23003. } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) {
  23004. this.isDockedShowing_ = hasAnyPixelsOnscreen;
  23005. return true;
  23006. }
  23007. }
  23008. return partiallyShowing;
  23009. };
  23010. /**
  23011. * Function to move the top app bar if needed.
  23012. */
  23013. MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () {
  23014. if (this.checkForUpdate_()) {
  23015. // Once the top app bar is fully hidden we use the max potential top app bar height as our offset
  23016. // so the top app bar doesn't show if the window resizes and the new height > the old height.
  23017. var offset = this.currentAppBarOffsetTop_;
  23018. if (Math.abs(offset) >= this.topAppBarHeight_) {
  23019. offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT;
  23020. }
  23021. this.adapter.setStyle('top', offset + 'px');
  23022. }
  23023. };
  23024. /**
  23025. * Throttled function that updates the top app bar scrolled values if the
  23026. * top app bar height changes.
  23027. */
  23028. MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () {
  23029. var currentHeight = this.adapter.getTopAppBarHeight();
  23030. if (this.topAppBarHeight_ !== currentHeight) {
  23031. this.wasDocked_ = false;
  23032. // Since the top app bar has a different height depending on the screen width, this
  23033. // will ensure that the top app bar remains in the correct location if
  23034. // completely hidden and a resize makes the top app bar a different height.
  23035. this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight;
  23036. this.topAppBarHeight_ = currentHeight;
  23037. }
  23038. this.handleTargetScroll();
  23039. };
  23040. return MDCTopAppBarFoundation;
  23041. }(foundation_1.MDCTopAppBarBaseFoundation);
  23042. exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation;
  23043. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  23044. exports.default = MDCTopAppBarFoundation;
  23045. /***/ })
  23046. /******/ });
  23047. });
  23048. //# sourceMappingURL=material-components-web.js.map