material-components-web.js 910 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215
  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 dataTable = __importStar(__webpack_require__(/*! @material/data-table/index */ "./packages/mdc-data-table/index.ts"));
  155. exports.dataTable = dataTable;
  156. var dialog = __importStar(__webpack_require__(/*! @material/dialog/index */ "./packages/mdc-dialog/index.ts"));
  157. exports.dialog = dialog;
  158. var dom = __importStar(__webpack_require__(/*! @material/dom/index */ "./packages/mdc-dom/index.ts"));
  159. exports.dom = dom;
  160. var drawer = __importStar(__webpack_require__(/*! @material/drawer/index */ "./packages/mdc-drawer/index.ts"));
  161. exports.drawer = drawer;
  162. var floatingLabel = __importStar(__webpack_require__(/*! @material/floating-label/index */ "./packages/mdc-floating-label/index.ts"));
  163. exports.floatingLabel = floatingLabel;
  164. var formField = __importStar(__webpack_require__(/*! @material/form-field/index */ "./packages/mdc-form-field/index.ts"));
  165. exports.formField = formField;
  166. var gridList = __importStar(__webpack_require__(/*! @material/grid-list/index */ "./packages/mdc-grid-list/index.ts"));
  167. exports.gridList = gridList;
  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('MDCDataTable', dataTable.MDCDataTable);
  211. index_1.default.register('MDCDialog', dialog.MDCDialog);
  212. index_1.default.register('MDCDrawer', drawer.MDCDrawer);
  213. index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel);
  214. index_1.default.register('MDCFormField', formField.MDCFormField);
  215. index_1.default.register('MDCGridList', gridList.MDCGridList);
  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 m = typeof Symbol === "function" && o[Symbol.iterator],
  395. i = 0;
  396. if (m) return m.call(o);
  397. return {
  398. next: function next() {
  399. if (o && i >= o.length) o = void 0;
  400. return { value: o && o[i++], done: !o };
  401. }
  402. };
  403. };
  404. Object.defineProperty(exports, "__esModule", { value: true });
  405. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-auto-init/constants.ts");
  406. var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR,
  407. AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR,
  408. INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE;
  409. var registry = {};
  410. var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console
  411. function emit(evtType, evtData, shouldBubble) {
  412. if (shouldBubble === void 0) {
  413. shouldBubble = false;
  414. }
  415. var evt;
  416. if (typeof CustomEvent === 'function') {
  417. evt = new CustomEvent(evtType, {
  418. bubbles: shouldBubble,
  419. detail: evtData
  420. });
  421. } else {
  422. evt = document.createEvent('CustomEvent');
  423. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  424. }
  425. document.dispatchEvent(evt);
  426. }
  427. /* istanbul ignore next: optional argument is not a branch statement */
  428. /**
  429. * Auto-initializes all MDC components on a page.
  430. */
  431. function mdcAutoInit(root) {
  432. var e_1, _a;
  433. if (root === void 0) {
  434. root = document;
  435. }
  436. var components = [];
  437. var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]"));
  438. nodes = nodes.filter(function (node) {
  439. return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE;
  440. });
  441. try {
  442. for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
  443. var node = nodes_1_1.value;
  444. var ctorName = node.getAttribute(AUTO_INIT_ATTR);
  445. if (!ctorName) {
  446. throw new Error('(mdc-auto-init) Constructor name must be given.');
  447. }
  448. var Constructor = registry[ctorName]; // tslint:disable-line:variable-name
  449. if (typeof Constructor !== 'function') {
  450. throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName);
  451. }
  452. // TODO: Should we make an eslint rule for an attachTo() static method?
  453. // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS
  454. var component = Constructor.attachTo(node);
  455. Object.defineProperty(node, ctorName, {
  456. configurable: true,
  457. enumerable: false,
  458. value: component,
  459. writable: false
  460. });
  461. components.push(component);
  462. node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE);
  463. }
  464. } catch (e_1_1) {
  465. e_1 = { error: e_1_1 };
  466. } finally {
  467. try {
  468. if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
  469. } finally {
  470. if (e_1) throw e_1.error;
  471. }
  472. }
  473. emit('MDCAutoInit:End', {});
  474. return components;
  475. }
  476. exports.mdcAutoInit = mdcAutoInit;
  477. // Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class.
  478. // tslint:disable-next-line:variable-name
  479. mdcAutoInit.register = function (componentName, Constructor, warn) {
  480. if (warn === void 0) {
  481. warn = CONSOLE_WARN;
  482. }
  483. if (typeof Constructor !== 'function') {
  484. throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function.");
  485. }
  486. var registryValue = registry[componentName];
  487. if (registryValue) {
  488. warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue);
  489. }
  490. registry[componentName] = Constructor;
  491. };
  492. mdcAutoInit.deregister = function (componentName) {
  493. delete registry[componentName];
  494. };
  495. mdcAutoInit.deregisterAll = function () {
  496. var keys = Object.keys(registry);
  497. keys.forEach(this.deregister, this);
  498. };
  499. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  500. exports.default = mdcAutoInit;
  501. /***/ }),
  502. /***/ "./packages/mdc-base/component.ts":
  503. /*!****************************************!*\
  504. !*** ./packages/mdc-base/component.ts ***!
  505. \****************************************/
  506. /*! no static exports found */
  507. /***/ (function(module, exports, __webpack_require__) {
  508. "use strict";
  509. /**
  510. * @license
  511. * Copyright 2016 Google Inc.
  512. *
  513. * Permission is hereby granted, free of charge, to any person obtaining a copy
  514. * of this software and associated documentation files (the "Software"), to deal
  515. * in the Software without restriction, including without limitation the rights
  516. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  517. * copies of the Software, and to permit persons to whom the Software is
  518. * furnished to do so, subject to the following conditions:
  519. *
  520. * The above copyright notice and this permission notice shall be included in
  521. * all copies or substantial portions of the Software.
  522. *
  523. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  524. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  525. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  526. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  527. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  528. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  529. * THE SOFTWARE.
  530. */
  531. var __read = this && this.__read || function (o, n) {
  532. var m = typeof Symbol === "function" && o[Symbol.iterator];
  533. if (!m) return o;
  534. var i = m.call(o),
  535. r,
  536. ar = [],
  537. e;
  538. try {
  539. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  540. ar.push(r.value);
  541. }
  542. } catch (error) {
  543. e = { error: error };
  544. } finally {
  545. try {
  546. if (r && !r.done && (m = i["return"])) m.call(i);
  547. } finally {
  548. if (e) throw e.error;
  549. }
  550. }
  551. return ar;
  552. };
  553. var __spread = this && this.__spread || function () {
  554. for (var ar = [], i = 0; i < arguments.length; i++) {
  555. ar = ar.concat(__read(arguments[i]));
  556. }return ar;
  557. };
  558. Object.defineProperty(exports, "__esModule", { value: true });
  559. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
  560. var MDCComponent = /** @class */function () {
  561. function MDCComponent(root, foundation) {
  562. var args = [];
  563. for (var _i = 2; _i < arguments.length; _i++) {
  564. args[_i - 2] = arguments[_i];
  565. }
  566. this.root_ = root;
  567. this.initialize.apply(this, __spread(args));
  568. // Note that we initialize foundation here and not within the constructor's default param so that
  569. // this.root_ is defined and can be used within the foundation class.
  570. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
  571. this.foundation_.init();
  572. this.initialSyncWithDOM();
  573. }
  574. MDCComponent.attachTo = function (root) {
  575. // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
  576. // returns an instantiated component with its root set to that element. Also note that in the cases of
  577. // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
  578. // from getDefaultFoundation().
  579. return new MDCComponent(root, new foundation_1.MDCFoundation({}));
  580. };
  581. /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
  582. MDCComponent.prototype.initialize = function () {
  583. var _args = [];
  584. for (var _i = 0; _i < arguments.length; _i++) {
  585. _args[_i] = arguments[_i];
  586. }
  587. // Subclasses can override this to do any additional setup work that would be considered part of a
  588. // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
  589. // initialized. Any additional arguments besides root and foundation will be passed in here.
  590. };
  591. MDCComponent.prototype.getDefaultFoundation = function () {
  592. // Subclasses must override this method to return a properly configured foundation class for the
  593. // component.
  594. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
  595. };
  596. MDCComponent.prototype.initialSyncWithDOM = function () {
  597. // Subclasses should override this method if they need to perform work to synchronize with a host DOM
  598. // object. An example of this would be a form control wrapper that needs to synchronize its internal state
  599. // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
  600. // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
  601. };
  602. MDCComponent.prototype.destroy = function () {
  603. // Subclasses may implement this method to release any resources / deregister any listeners they have
  604. // attached. An example of this might be deregistering a resize event from the window object.
  605. this.foundation_.destroy();
  606. };
  607. MDCComponent.prototype.listen = function (evtType, handler, options) {
  608. this.root_.addEventListener(evtType, handler, options);
  609. };
  610. MDCComponent.prototype.unlisten = function (evtType, handler, options) {
  611. this.root_.removeEventListener(evtType, handler, options);
  612. };
  613. /**
  614. * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
  615. */
  616. MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
  617. if (shouldBubble === void 0) {
  618. shouldBubble = false;
  619. }
  620. var evt;
  621. if (typeof CustomEvent === 'function') {
  622. evt = new CustomEvent(evtType, {
  623. bubbles: shouldBubble,
  624. detail: evtData
  625. });
  626. } else {
  627. evt = document.createEvent('CustomEvent');
  628. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  629. }
  630. this.root_.dispatchEvent(evt);
  631. };
  632. return MDCComponent;
  633. }();
  634. exports.MDCComponent = MDCComponent;
  635. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  636. exports.default = MDCComponent;
  637. /***/ }),
  638. /***/ "./packages/mdc-base/foundation.ts":
  639. /*!*****************************************!*\
  640. !*** ./packages/mdc-base/foundation.ts ***!
  641. \*****************************************/
  642. /*! no static exports found */
  643. /***/ (function(module, exports, __webpack_require__) {
  644. "use strict";
  645. /**
  646. * @license
  647. * Copyright 2016 Google Inc.
  648. *
  649. * Permission is hereby granted, free of charge, to any person obtaining a copy
  650. * of this software and associated documentation files (the "Software"), to deal
  651. * in the Software without restriction, including without limitation the rights
  652. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  653. * copies of the Software, and to permit persons to whom the Software is
  654. * furnished to do so, subject to the following conditions:
  655. *
  656. * The above copyright notice and this permission notice shall be included in
  657. * all copies or substantial portions of the Software.
  658. *
  659. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  660. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  661. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  662. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  663. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  664. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  665. * THE SOFTWARE.
  666. */
  667. Object.defineProperty(exports, "__esModule", { value: true });
  668. var MDCFoundation = /** @class */function () {
  669. function MDCFoundation(adapter) {
  670. if (adapter === void 0) {
  671. adapter = {};
  672. }
  673. this.adapter_ = adapter;
  674. }
  675. Object.defineProperty(MDCFoundation, "cssClasses", {
  676. get: function get() {
  677. // Classes extending MDCFoundation should implement this method to return an object which exports every
  678. // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
  679. return {};
  680. },
  681. enumerable: true,
  682. configurable: true
  683. });
  684. Object.defineProperty(MDCFoundation, "strings", {
  685. get: function get() {
  686. // Classes extending MDCFoundation should implement this method to return an object which exports all
  687. // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
  688. return {};
  689. },
  690. enumerable: true,
  691. configurable: true
  692. });
  693. Object.defineProperty(MDCFoundation, "numbers", {
  694. get: function get() {
  695. // Classes extending MDCFoundation should implement this method to return an object which exports all
  696. // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
  697. return {};
  698. },
  699. enumerable: true,
  700. configurable: true
  701. });
  702. Object.defineProperty(MDCFoundation, "defaultAdapter", {
  703. get: function get() {
  704. // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
  705. // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
  706. // validation.
  707. return {};
  708. },
  709. enumerable: true,
  710. configurable: true
  711. });
  712. MDCFoundation.prototype.init = function () {
  713. // Subclasses should override this method to perform initialization routines (registering events, etc.)
  714. };
  715. MDCFoundation.prototype.destroy = function () {
  716. // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
  717. };
  718. return MDCFoundation;
  719. }();
  720. exports.MDCFoundation = MDCFoundation;
  721. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  722. exports.default = MDCFoundation;
  723. /***/ }),
  724. /***/ "./packages/mdc-base/index.ts":
  725. /*!************************************!*\
  726. !*** ./packages/mdc-base/index.ts ***!
  727. \************************************/
  728. /*! no static exports found */
  729. /***/ (function(module, exports, __webpack_require__) {
  730. "use strict";
  731. /**
  732. * @license
  733. * Copyright 2019 Google Inc.
  734. *
  735. * Permission is hereby granted, free of charge, to any person obtaining a copy
  736. * of this software and associated documentation files (the "Software"), to deal
  737. * in the Software without restriction, including without limitation the rights
  738. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  739. * copies of the Software, and to permit persons to whom the Software is
  740. * furnished to do so, subject to the following conditions:
  741. *
  742. * The above copyright notice and this permission notice shall be included in
  743. * all copies or substantial portions of the Software.
  744. *
  745. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  746. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  747. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  748. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  749. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  750. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  751. * THE SOFTWARE.
  752. */
  753. function __export(m) {
  754. for (var p in m) {
  755. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  756. }
  757. }
  758. Object.defineProperty(exports, "__esModule", { value: true });
  759. __export(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts"));
  760. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"));
  761. /***/ }),
  762. /***/ "./packages/mdc-checkbox/component.ts":
  763. /*!********************************************!*\
  764. !*** ./packages/mdc-checkbox/component.ts ***!
  765. \********************************************/
  766. /*! no static exports found */
  767. /***/ (function(module, exports, __webpack_require__) {
  768. "use strict";
  769. /**
  770. * @license
  771. * Copyright 2016 Google Inc.
  772. *
  773. * Permission is hereby granted, free of charge, to any person obtaining a copy
  774. * of this software and associated documentation files (the "Software"), to deal
  775. * in the Software without restriction, including without limitation the rights
  776. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  777. * copies of the Software, and to permit persons to whom the Software is
  778. * furnished to do so, subject to the following conditions:
  779. *
  780. * The above copyright notice and this permission notice shall be included in
  781. * all copies or substantial portions of the Software.
  782. *
  783. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  784. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  785. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  786. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  787. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  788. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  789. * THE SOFTWARE.
  790. */
  791. var __extends = this && this.__extends || function () {
  792. var _extendStatics = function extendStatics(d, b) {
  793. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  794. d.__proto__ = b;
  795. } || function (d, b) {
  796. for (var p in b) {
  797. if (b.hasOwnProperty(p)) d[p] = b[p];
  798. }
  799. };
  800. return _extendStatics(d, b);
  801. };
  802. return function (d, b) {
  803. _extendStatics(d, b);
  804. function __() {
  805. this.constructor = d;
  806. }
  807. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  808. };
  809. }();
  810. var __assign = this && this.__assign || function () {
  811. __assign = Object.assign || function (t) {
  812. for (var s, i = 1, n = arguments.length; i < n; i++) {
  813. s = arguments[i];
  814. for (var p in s) {
  815. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  816. }
  817. }
  818. return t;
  819. };
  820. return __assign.apply(this, arguments);
  821. };
  822. Object.defineProperty(exports, "__esModule", { value: true });
  823. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  824. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  825. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  826. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  827. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  828. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  829. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts");
  830. var CB_PROTO_PROPS = ['checked', 'indeterminate'];
  831. var MDCCheckbox = /** @class */function (_super) {
  832. __extends(MDCCheckbox, _super);
  833. function MDCCheckbox() {
  834. var _this = _super !== null && _super.apply(this, arguments) || this;
  835. _this.ripple_ = _this.createRipple_();
  836. return _this;
  837. }
  838. MDCCheckbox.attachTo = function (root) {
  839. return new MDCCheckbox(root);
  840. };
  841. Object.defineProperty(MDCCheckbox.prototype, "ripple", {
  842. get: function get() {
  843. return this.ripple_;
  844. },
  845. enumerable: true,
  846. configurable: true
  847. });
  848. Object.defineProperty(MDCCheckbox.prototype, "checked", {
  849. get: function get() {
  850. return this.nativeControl_.checked;
  851. },
  852. set: function set(checked) {
  853. this.nativeControl_.checked = checked;
  854. },
  855. enumerable: true,
  856. configurable: true
  857. });
  858. Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
  859. get: function get() {
  860. return this.nativeControl_.indeterminate;
  861. },
  862. set: function set(indeterminate) {
  863. this.nativeControl_.indeterminate = indeterminate;
  864. },
  865. enumerable: true,
  866. configurable: true
  867. });
  868. Object.defineProperty(MDCCheckbox.prototype, "disabled", {
  869. get: function get() {
  870. return this.nativeControl_.disabled;
  871. },
  872. set: function set(disabled) {
  873. this.foundation_.setDisabled(disabled);
  874. },
  875. enumerable: true,
  876. configurable: true
  877. });
  878. Object.defineProperty(MDCCheckbox.prototype, "value", {
  879. get: function get() {
  880. return this.nativeControl_.value;
  881. },
  882. set: function set(value) {
  883. this.nativeControl_.value = value;
  884. },
  885. enumerable: true,
  886. configurable: true
  887. });
  888. MDCCheckbox.prototype.initialSyncWithDOM = function () {
  889. var _this = this;
  890. this.handleChange_ = function () {
  891. return _this.foundation_.handleChange();
  892. };
  893. this.handleAnimationEnd_ = function () {
  894. return _this.foundation_.handleAnimationEnd();
  895. };
  896. this.nativeControl_.addEventListener('change', this.handleChange_);
  897. this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
  898. this.installPropertyChangeHooks_();
  899. };
  900. MDCCheckbox.prototype.destroy = function () {
  901. this.ripple_.destroy();
  902. this.nativeControl_.removeEventListener('change', this.handleChange_);
  903. this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
  904. this.uninstallPropertyChangeHooks_();
  905. _super.prototype.destroy.call(this);
  906. };
  907. MDCCheckbox.prototype.getDefaultFoundation = function () {
  908. var _this = this;
  909. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  910. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  911. var adapter = {
  912. addClass: function addClass(className) {
  913. return _this.root_.classList.add(className);
  914. },
  915. forceLayout: function forceLayout() {
  916. return _this.root_.offsetWidth;
  917. },
  918. hasNativeControl: function hasNativeControl() {
  919. return !!_this.nativeControl_;
  920. },
  921. isAttachedToDOM: function isAttachedToDOM() {
  922. return Boolean(_this.root_.parentNode);
  923. },
  924. isChecked: function isChecked() {
  925. return _this.checked;
  926. },
  927. isIndeterminate: function isIndeterminate() {
  928. return _this.indeterminate;
  929. },
  930. removeClass: function removeClass(className) {
  931. return _this.root_.classList.remove(className);
  932. },
  933. removeNativeControlAttr: function removeNativeControlAttr(attr) {
  934. return _this.nativeControl_.removeAttribute(attr);
  935. },
  936. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  937. return _this.nativeControl_.setAttribute(attr, value);
  938. },
  939. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  940. return _this.nativeControl_.disabled = disabled;
  941. }
  942. };
  943. return new foundation_2.MDCCheckboxFoundation(adapter);
  944. };
  945. MDCCheckbox.prototype.createRipple_ = function () {
  946. var _this = this;
  947. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  948. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  949. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  950. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  951. }, isSurfaceActive: function isSurfaceActive() {
  952. return ponyfill_1.matches(_this.nativeControl_, ':active');
  953. }, isUnbounded: function isUnbounded() {
  954. return true;
  955. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  956. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  957. } });
  958. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  959. };
  960. MDCCheckbox.prototype.installPropertyChangeHooks_ = function () {
  961. var _this = this;
  962. var nativeCb = this.nativeControl_;
  963. var cbProto = Object.getPrototypeOf(nativeCb);
  964. CB_PROTO_PROPS.forEach(function (controlState) {
  965. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  966. // We have to check for this descriptor, since some browsers (Safari) don't support its return.
  967. // See: https://bugs.webkit.org/show_bug.cgi?id=49739
  968. if (!validDescriptor(desc)) {
  969. return;
  970. }
  971. // Type cast is needed for compatibility with Closure Compiler.
  972. var nativeGetter = desc.get;
  973. var nativeCbDesc = {
  974. configurable: desc.configurable,
  975. enumerable: desc.enumerable,
  976. get: nativeGetter,
  977. set: function set(state) {
  978. desc.set.call(nativeCb, state);
  979. _this.foundation_.handleChange();
  980. }
  981. };
  982. Object.defineProperty(nativeCb, controlState, nativeCbDesc);
  983. });
  984. };
  985. MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () {
  986. var nativeCb = this.nativeControl_;
  987. var cbProto = Object.getPrototypeOf(nativeCb);
  988. CB_PROTO_PROPS.forEach(function (controlState) {
  989. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  990. if (!validDescriptor(desc)) {
  991. return;
  992. }
  993. Object.defineProperty(nativeCb, controlState, desc);
  994. });
  995. };
  996. Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", {
  997. get: function get() {
  998. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCCheckboxFoundation.strings.NATIVE_CONTROL_SELECTOR;
  999. var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  1000. if (!el) {
  1001. throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  1002. }
  1003. return el;
  1004. },
  1005. enumerable: true,
  1006. configurable: true
  1007. });
  1008. return MDCCheckbox;
  1009. }(component_1.MDCComponent);
  1010. exports.MDCCheckbox = MDCCheckbox;
  1011. function validDescriptor(inputPropDesc) {
  1012. return !!inputPropDesc && typeof inputPropDesc.set === 'function';
  1013. }
  1014. /***/ }),
  1015. /***/ "./packages/mdc-checkbox/constants.ts":
  1016. /*!********************************************!*\
  1017. !*** ./packages/mdc-checkbox/constants.ts ***!
  1018. \********************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. /**
  1023. * @license
  1024. * Copyright 2016 Google Inc.
  1025. *
  1026. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1027. * of this software and associated documentation files (the "Software"), to deal
  1028. * in the Software without restriction, including without limitation the rights
  1029. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1030. * copies of the Software, and to permit persons to whom the Software is
  1031. * furnished to do so, subject to the following conditions:
  1032. *
  1033. * The above copyright notice and this permission notice shall be included in
  1034. * all copies or substantial portions of the Software.
  1035. *
  1036. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1037. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1038. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1039. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1040. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1041. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1042. * THE SOFTWARE.
  1043. */
  1044. Object.defineProperty(exports, "__esModule", { value: true });
  1045. exports.cssClasses = {
  1046. ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
  1047. ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
  1048. ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
  1049. ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
  1050. ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
  1051. ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
  1052. BACKGROUND: 'mdc-checkbox__background',
  1053. CHECKED: 'mdc-checkbox--checked',
  1054. CHECKMARK: 'mdc-checkbox__checkmark',
  1055. CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
  1056. DISABLED: 'mdc-checkbox--disabled',
  1057. INDETERMINATE: 'mdc-checkbox--indeterminate',
  1058. MIXEDMARK: 'mdc-checkbox__mixedmark',
  1059. NATIVE_CONTROL: 'mdc-checkbox__native-control',
  1060. ROOT: 'mdc-checkbox',
  1061. SELECTED: 'mdc-checkbox--selected',
  1062. UPGRADED: 'mdc-checkbox--upgraded'
  1063. };
  1064. exports.strings = {
  1065. ARIA_CHECKED_ATTR: 'aria-checked',
  1066. ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
  1067. NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
  1068. TRANSITION_STATE_CHECKED: 'checked',
  1069. TRANSITION_STATE_INDETERMINATE: 'indeterminate',
  1070. TRANSITION_STATE_INIT: 'init',
  1071. TRANSITION_STATE_UNCHECKED: 'unchecked'
  1072. };
  1073. exports.numbers = {
  1074. ANIM_END_LATCH_MS: 250
  1075. };
  1076. /***/ }),
  1077. /***/ "./packages/mdc-checkbox/foundation.ts":
  1078. /*!*********************************************!*\
  1079. !*** ./packages/mdc-checkbox/foundation.ts ***!
  1080. \*********************************************/
  1081. /*! no static exports found */
  1082. /***/ (function(module, exports, __webpack_require__) {
  1083. "use strict";
  1084. /**
  1085. * @license
  1086. * Copyright 2016 Google Inc.
  1087. *
  1088. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1089. * of this software and associated documentation files (the "Software"), to deal
  1090. * in the Software without restriction, including without limitation the rights
  1091. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1092. * copies of the Software, and to permit persons to whom the Software is
  1093. * furnished to do so, subject to the following conditions:
  1094. *
  1095. * The above copyright notice and this permission notice shall be included in
  1096. * all copies or substantial portions of the Software.
  1097. *
  1098. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1099. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1100. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1101. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1102. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1103. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1104. * THE SOFTWARE.
  1105. */
  1106. var __extends = this && this.__extends || function () {
  1107. var _extendStatics = function extendStatics(d, b) {
  1108. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1109. d.__proto__ = b;
  1110. } || function (d, b) {
  1111. for (var p in b) {
  1112. if (b.hasOwnProperty(p)) d[p] = b[p];
  1113. }
  1114. };
  1115. return _extendStatics(d, b);
  1116. };
  1117. return function (d, b) {
  1118. _extendStatics(d, b);
  1119. function __() {
  1120. this.constructor = d;
  1121. }
  1122. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1123. };
  1124. }();
  1125. var __assign = this && this.__assign || function () {
  1126. __assign = Object.assign || function (t) {
  1127. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1128. s = arguments[i];
  1129. for (var p in s) {
  1130. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1131. }
  1132. }
  1133. return t;
  1134. };
  1135. return __assign.apply(this, arguments);
  1136. };
  1137. Object.defineProperty(exports, "__esModule", { value: true });
  1138. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  1139. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  1140. var MDCCheckboxFoundation = /** @class */function (_super) {
  1141. __extends(MDCCheckboxFoundation, _super);
  1142. function MDCCheckboxFoundation(adapter) {
  1143. var _this = _super.call(this, __assign({}, MDCCheckboxFoundation.defaultAdapter, adapter)) || this;
  1144. _this.currentCheckState_ = constants_1.strings.TRANSITION_STATE_INIT;
  1145. _this.currentAnimationClass_ = '';
  1146. _this.animEndLatchTimer_ = 0;
  1147. _this.enableAnimationEndHandler_ = false;
  1148. return _this;
  1149. }
  1150. Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
  1151. get: function get() {
  1152. return constants_1.cssClasses;
  1153. },
  1154. enumerable: true,
  1155. configurable: true
  1156. });
  1157. Object.defineProperty(MDCCheckboxFoundation, "strings", {
  1158. get: function get() {
  1159. return constants_1.strings;
  1160. },
  1161. enumerable: true,
  1162. configurable: true
  1163. });
  1164. Object.defineProperty(MDCCheckboxFoundation, "numbers", {
  1165. get: function get() {
  1166. return constants_1.numbers;
  1167. },
  1168. enumerable: true,
  1169. configurable: true
  1170. });
  1171. Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
  1172. get: function get() {
  1173. return {
  1174. addClass: function addClass() {
  1175. return undefined;
  1176. },
  1177. forceLayout: function forceLayout() {
  1178. return undefined;
  1179. },
  1180. hasNativeControl: function hasNativeControl() {
  1181. return false;
  1182. },
  1183. isAttachedToDOM: function isAttachedToDOM() {
  1184. return false;
  1185. },
  1186. isChecked: function isChecked() {
  1187. return false;
  1188. },
  1189. isIndeterminate: function isIndeterminate() {
  1190. return false;
  1191. },
  1192. removeClass: function removeClass() {
  1193. return undefined;
  1194. },
  1195. removeNativeControlAttr: function removeNativeControlAttr() {
  1196. return undefined;
  1197. },
  1198. setNativeControlAttr: function setNativeControlAttr() {
  1199. return undefined;
  1200. },
  1201. setNativeControlDisabled: function setNativeControlDisabled() {
  1202. return undefined;
  1203. }
  1204. };
  1205. },
  1206. enumerable: true,
  1207. configurable: true
  1208. });
  1209. MDCCheckboxFoundation.prototype.init = function () {
  1210. this.currentCheckState_ = this.determineCheckState_();
  1211. this.updateAriaChecked_();
  1212. this.adapter_.addClass(constants_1.cssClasses.UPGRADED);
  1213. };
  1214. MDCCheckboxFoundation.prototype.destroy = function () {
  1215. clearTimeout(this.animEndLatchTimer_);
  1216. };
  1217. MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
  1218. this.adapter_.setNativeControlDisabled(disabled);
  1219. if (disabled) {
  1220. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  1221. } else {
  1222. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  1223. }
  1224. };
  1225. /**
  1226. * Handles the animationend event for the checkbox
  1227. */
  1228. MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
  1229. var _this = this;
  1230. if (!this.enableAnimationEndHandler_) {
  1231. return;
  1232. }
  1233. clearTimeout(this.animEndLatchTimer_);
  1234. this.animEndLatchTimer_ = setTimeout(function () {
  1235. _this.adapter_.removeClass(_this.currentAnimationClass_);
  1236. _this.enableAnimationEndHandler_ = false;
  1237. }, constants_1.numbers.ANIM_END_LATCH_MS);
  1238. };
  1239. /**
  1240. * Handles the change event for the checkbox
  1241. */
  1242. MDCCheckboxFoundation.prototype.handleChange = function () {
  1243. this.transitionCheckState_();
  1244. };
  1245. MDCCheckboxFoundation.prototype.transitionCheckState_ = function () {
  1246. if (!this.adapter_.hasNativeControl()) {
  1247. return;
  1248. }
  1249. var oldState = this.currentCheckState_;
  1250. var newState = this.determineCheckState_();
  1251. if (oldState === newState) {
  1252. return;
  1253. }
  1254. this.updateAriaChecked_();
  1255. var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1256. var SELECTED = constants_1.cssClasses.SELECTED;
  1257. if (newState === TRANSITION_STATE_UNCHECKED) {
  1258. this.adapter_.removeClass(SELECTED);
  1259. } else {
  1260. this.adapter_.addClass(SELECTED);
  1261. }
  1262. // Check to ensure that there isn't a previously existing animation class, in case for example
  1263. // the user interacted with the checkbox before the animation was finished.
  1264. if (this.currentAnimationClass_.length > 0) {
  1265. clearTimeout(this.animEndLatchTimer_);
  1266. this.adapter_.forceLayout();
  1267. this.adapter_.removeClass(this.currentAnimationClass_);
  1268. }
  1269. this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState);
  1270. this.currentCheckState_ = newState;
  1271. // Check for parentNode so that animations are only run when the element is attached
  1272. // to the DOM.
  1273. if (this.adapter_.isAttachedToDOM() && this.currentAnimationClass_.length > 0) {
  1274. this.adapter_.addClass(this.currentAnimationClass_);
  1275. this.enableAnimationEndHandler_ = true;
  1276. }
  1277. };
  1278. MDCCheckboxFoundation.prototype.determineCheckState_ = function () {
  1279. var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
  1280. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  1281. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1282. if (this.adapter_.isIndeterminate()) {
  1283. return TRANSITION_STATE_INDETERMINATE;
  1284. }
  1285. return this.adapter_.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
  1286. };
  1287. MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) {
  1288. var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
  1289. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  1290. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1291. var _a = MDCCheckboxFoundation.cssClasses,
  1292. ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
  1293. ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
  1294. ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
  1295. ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
  1296. ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
  1297. ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
  1298. switch (oldState) {
  1299. case TRANSITION_STATE_INIT:
  1300. if (newState === TRANSITION_STATE_UNCHECKED) {
  1301. return '';
  1302. }
  1303. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  1304. case TRANSITION_STATE_UNCHECKED:
  1305. return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
  1306. case TRANSITION_STATE_CHECKED:
  1307. return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
  1308. default:
  1309. // TRANSITION_STATE_INDETERMINATE
  1310. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  1311. }
  1312. };
  1313. MDCCheckboxFoundation.prototype.updateAriaChecked_ = function () {
  1314. // Ensure aria-checked is set to mixed if checkbox is in indeterminate state.
  1315. if (this.adapter_.isIndeterminate()) {
  1316. this.adapter_.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
  1317. } else {
  1318. // The on/off state does not need to keep track of aria-checked, since
  1319. // the screenreader uses the checked property on the checkbox element.
  1320. this.adapter_.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
  1321. }
  1322. };
  1323. return MDCCheckboxFoundation;
  1324. }(foundation_1.MDCFoundation);
  1325. exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
  1326. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  1327. exports.default = MDCCheckboxFoundation;
  1328. /***/ }),
  1329. /***/ "./packages/mdc-checkbox/index.ts":
  1330. /*!****************************************!*\
  1331. !*** ./packages/mdc-checkbox/index.ts ***!
  1332. \****************************************/
  1333. /*! no static exports found */
  1334. /***/ (function(module, exports, __webpack_require__) {
  1335. "use strict";
  1336. /**
  1337. * @license
  1338. * Copyright 2019 Google Inc.
  1339. *
  1340. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1341. * of this software and associated documentation files (the "Software"), to deal
  1342. * in the Software without restriction, including without limitation the rights
  1343. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1344. * copies of the Software, and to permit persons to whom the Software is
  1345. * furnished to do so, subject to the following conditions:
  1346. *
  1347. * The above copyright notice and this permission notice shall be included in
  1348. * all copies or substantial portions of the Software.
  1349. *
  1350. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1351. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1352. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1353. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1354. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1355. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1356. * THE SOFTWARE.
  1357. */
  1358. function __export(m) {
  1359. for (var p in m) {
  1360. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  1361. }
  1362. }
  1363. Object.defineProperty(exports, "__esModule", { value: true });
  1364. __export(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts"));
  1365. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"));
  1366. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"));
  1367. /***/ }),
  1368. /***/ "./packages/mdc-chips/chip-set/component.ts":
  1369. /*!**************************************************!*\
  1370. !*** ./packages/mdc-chips/chip-set/component.ts ***!
  1371. \**************************************************/
  1372. /*! no static exports found */
  1373. /***/ (function(module, exports, __webpack_require__) {
  1374. "use strict";
  1375. /**
  1376. * @license
  1377. * Copyright 2016 Google Inc.
  1378. *
  1379. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1380. * of this software and associated documentation files (the "Software"), to deal
  1381. * in the Software without restriction, including without limitation the rights
  1382. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1383. * copies of the Software, and to permit persons to whom the Software is
  1384. * furnished to do so, subject to the following conditions:
  1385. *
  1386. * The above copyright notice and this permission notice shall be included in
  1387. * all copies or substantial portions of the Software.
  1388. *
  1389. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1390. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1391. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1392. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1393. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1394. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1395. * THE SOFTWARE.
  1396. */
  1397. var __extends = this && this.__extends || function () {
  1398. var _extendStatics = function extendStatics(d, b) {
  1399. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1400. d.__proto__ = b;
  1401. } || function (d, b) {
  1402. for (var p in b) {
  1403. if (b.hasOwnProperty(p)) d[p] = b[p];
  1404. }
  1405. };
  1406. return _extendStatics(d, b);
  1407. };
  1408. return function (d, b) {
  1409. _extendStatics(d, b);
  1410. function __() {
  1411. this.constructor = d;
  1412. }
  1413. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1414. };
  1415. }();
  1416. Object.defineProperty(exports, "__esModule", { value: true });
  1417. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  1418. var component_2 = __webpack_require__(/*! ../chip/component */ "./packages/mdc-chips/chip/component.ts");
  1419. var foundation_1 = __webpack_require__(/*! ../chip/foundation */ "./packages/mdc-chips/chip/foundation.ts");
  1420. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts");
  1421. var _a = foundation_1.MDCChipFoundation.strings,
  1422. INTERACTION_EVENT = _a.INTERACTION_EVENT,
  1423. SELECTION_EVENT = _a.SELECTION_EVENT,
  1424. REMOVAL_EVENT = _a.REMOVAL_EVENT;
  1425. var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR;
  1426. var idCounter = 0;
  1427. var MDCChipSet = /** @class */function (_super) {
  1428. __extends(MDCChipSet, _super);
  1429. function MDCChipSet() {
  1430. return _super !== null && _super.apply(this, arguments) || this;
  1431. }
  1432. MDCChipSet.attachTo = function (root) {
  1433. return new MDCChipSet(root);
  1434. };
  1435. Object.defineProperty(MDCChipSet.prototype, "chips", {
  1436. get: function get() {
  1437. return this.chips_.slice();
  1438. },
  1439. enumerable: true,
  1440. configurable: true
  1441. });
  1442. Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", {
  1443. /**
  1444. * @return An array of the IDs of all selected chips.
  1445. */
  1446. get: function get() {
  1447. return this.foundation_.getSelectedChipIds();
  1448. },
  1449. enumerable: true,
  1450. configurable: true
  1451. });
  1452. /**
  1453. * @param chipFactory A function which creates a new MDCChip.
  1454. */
  1455. MDCChipSet.prototype.initialize = function (chipFactory) {
  1456. if (chipFactory === void 0) {
  1457. chipFactory = function chipFactory(el) {
  1458. return new component_2.MDCChip(el);
  1459. };
  1460. }
  1461. this.chipFactory_ = chipFactory;
  1462. this.chips_ = this.instantiateChips_(this.chipFactory_);
  1463. };
  1464. MDCChipSet.prototype.initialSyncWithDOM = function () {
  1465. var _this = this;
  1466. this.chips_.forEach(function (chip) {
  1467. if (chip.id && chip.selected) {
  1468. _this.foundation_.select(chip.id);
  1469. }
  1470. });
  1471. this.handleChipInteraction_ = function (evt) {
  1472. return _this.foundation_.handleChipInteraction(evt.detail.chipId);
  1473. };
  1474. this.handleChipSelection_ = function (evt) {
  1475. return _this.foundation_.handleChipSelection(evt.detail.chipId, evt.detail.selected);
  1476. };
  1477. this.handleChipRemoval_ = function (evt) {
  1478. return _this.foundation_.handleChipRemoval(evt.detail.chipId);
  1479. };
  1480. this.listen(INTERACTION_EVENT, this.handleChipInteraction_);
  1481. this.listen(SELECTION_EVENT, this.handleChipSelection_);
  1482. this.listen(REMOVAL_EVENT, this.handleChipRemoval_);
  1483. };
  1484. MDCChipSet.prototype.destroy = function () {
  1485. this.chips_.forEach(function (chip) {
  1486. chip.destroy();
  1487. });
  1488. this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_);
  1489. this.unlisten(SELECTION_EVENT, this.handleChipSelection_);
  1490. this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_);
  1491. _super.prototype.destroy.call(this);
  1492. };
  1493. /**
  1494. * Adds a new chip object to the chip set from the given chip element.
  1495. */
  1496. MDCChipSet.prototype.addChip = function (chipEl) {
  1497. chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter;
  1498. this.chips_.push(this.chipFactory_(chipEl));
  1499. };
  1500. MDCChipSet.prototype.getDefaultFoundation = function () {
  1501. var _this = this;
  1502. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  1503. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  1504. var adapter = {
  1505. hasClass: function hasClass(className) {
  1506. return _this.root_.classList.contains(className);
  1507. },
  1508. removeChip: function removeChip(chipId) {
  1509. var index = _this.findChipIndex_(chipId);
  1510. if (index >= 0) {
  1511. _this.chips_[index].destroy();
  1512. _this.chips_.splice(index, 1);
  1513. }
  1514. },
  1515. setSelected: function setSelected(chipId, selected) {
  1516. var index = _this.findChipIndex_(chipId);
  1517. if (index >= 0) {
  1518. _this.chips_[index].selected = selected;
  1519. }
  1520. }
  1521. };
  1522. return new foundation_2.MDCChipSetFoundation(adapter);
  1523. };
  1524. /**
  1525. * Instantiates chip components on all of the chip set's child chip elements.
  1526. */
  1527. MDCChipSet.prototype.instantiateChips_ = function (chipFactory) {
  1528. var chipElements = [].slice.call(this.root_.querySelectorAll(CHIP_SELECTOR));
  1529. return chipElements.map(function (el) {
  1530. el.id = el.id || "mdc-chip-" + ++idCounter;
  1531. return chipFactory(el);
  1532. });
  1533. };
  1534. /**
  1535. * Returns the index of the chip with the given id, or -1 if the chip does not exist.
  1536. */
  1537. MDCChipSet.prototype.findChipIndex_ = function (chipId) {
  1538. for (var i = 0; i < this.chips_.length; i++) {
  1539. if (this.chips_[i].id === chipId) {
  1540. return i;
  1541. }
  1542. }
  1543. return -1;
  1544. };
  1545. return MDCChipSet;
  1546. }(component_1.MDCComponent);
  1547. exports.MDCChipSet = MDCChipSet;
  1548. /***/ }),
  1549. /***/ "./packages/mdc-chips/chip-set/constants.ts":
  1550. /*!**************************************************!*\
  1551. !*** ./packages/mdc-chips/chip-set/constants.ts ***!
  1552. \**************************************************/
  1553. /*! no static exports found */
  1554. /***/ (function(module, exports, __webpack_require__) {
  1555. "use strict";
  1556. /**
  1557. * @license
  1558. * Copyright 2016 Google Inc.
  1559. *
  1560. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1561. * of this software and associated documentation files (the "Software"), to deal
  1562. * in the Software without restriction, including without limitation the rights
  1563. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1564. * copies of the Software, and to permit persons to whom the Software is
  1565. * furnished to do so, subject to the following conditions:
  1566. *
  1567. * The above copyright notice and this permission notice shall be included in
  1568. * all copies or substantial portions of the Software.
  1569. *
  1570. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1571. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1572. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1573. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1574. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1575. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1576. * THE SOFTWARE.
  1577. */
  1578. Object.defineProperty(exports, "__esModule", { value: true });
  1579. exports.strings = {
  1580. CHIP_SELECTOR: '.mdc-chip'
  1581. };
  1582. exports.cssClasses = {
  1583. CHOICE: 'mdc-chip-set--choice',
  1584. FILTER: 'mdc-chip-set--filter'
  1585. };
  1586. /***/ }),
  1587. /***/ "./packages/mdc-chips/chip-set/foundation.ts":
  1588. /*!***************************************************!*\
  1589. !*** ./packages/mdc-chips/chip-set/foundation.ts ***!
  1590. \***************************************************/
  1591. /*! no static exports found */
  1592. /***/ (function(module, exports, __webpack_require__) {
  1593. "use strict";
  1594. /**
  1595. * @license
  1596. * Copyright 2017 Google Inc.
  1597. *
  1598. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1599. * of this software and associated documentation files (the "Software"), to deal
  1600. * in the Software without restriction, including without limitation the rights
  1601. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1602. * copies of the Software, and to permit persons to whom the Software is
  1603. * furnished to do so, subject to the following conditions:
  1604. *
  1605. * The above copyright notice and this permission notice shall be included in
  1606. * all copies or substantial portions of the Software.
  1607. *
  1608. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1609. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1610. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1611. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1612. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1613. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1614. * THE SOFTWARE.
  1615. */
  1616. var __extends = this && this.__extends || function () {
  1617. var _extendStatics = function extendStatics(d, b) {
  1618. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1619. d.__proto__ = b;
  1620. } || function (d, b) {
  1621. for (var p in b) {
  1622. if (b.hasOwnProperty(p)) d[p] = b[p];
  1623. }
  1624. };
  1625. return _extendStatics(d, b);
  1626. };
  1627. return function (d, b) {
  1628. _extendStatics(d, b);
  1629. function __() {
  1630. this.constructor = d;
  1631. }
  1632. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1633. };
  1634. }();
  1635. var __assign = this && this.__assign || function () {
  1636. __assign = Object.assign || function (t) {
  1637. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1638. s = arguments[i];
  1639. for (var p in s) {
  1640. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1641. }
  1642. }
  1643. return t;
  1644. };
  1645. return __assign.apply(this, arguments);
  1646. };
  1647. Object.defineProperty(exports, "__esModule", { value: true });
  1648. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  1649. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
  1650. var MDCChipSetFoundation = /** @class */function (_super) {
  1651. __extends(MDCChipSetFoundation, _super);
  1652. function MDCChipSetFoundation(adapter) {
  1653. var _this = _super.call(this, __assign({}, MDCChipSetFoundation.defaultAdapter, adapter)) || this;
  1654. /**
  1655. * The ids of the selected chips in the set. Only used for choice chip set or filter chip set.
  1656. */
  1657. _this.selectedChipIds_ = [];
  1658. return _this;
  1659. }
  1660. Object.defineProperty(MDCChipSetFoundation, "strings", {
  1661. get: function get() {
  1662. return constants_1.strings;
  1663. },
  1664. enumerable: true,
  1665. configurable: true
  1666. });
  1667. Object.defineProperty(MDCChipSetFoundation, "cssClasses", {
  1668. get: function get() {
  1669. return constants_1.cssClasses;
  1670. },
  1671. enumerable: true,
  1672. configurable: true
  1673. });
  1674. Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", {
  1675. get: function get() {
  1676. return {
  1677. hasClass: function hasClass() {
  1678. return false;
  1679. },
  1680. removeChip: function removeChip() {
  1681. return undefined;
  1682. },
  1683. setSelected: function setSelected() {
  1684. return undefined;
  1685. }
  1686. };
  1687. },
  1688. enumerable: true,
  1689. configurable: true
  1690. });
  1691. /**
  1692. * Returns an array of the IDs of all selected chips.
  1693. */
  1694. MDCChipSetFoundation.prototype.getSelectedChipIds = function () {
  1695. return this.selectedChipIds_.slice();
  1696. };
  1697. /**
  1698. * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant.
  1699. */
  1700. MDCChipSetFoundation.prototype.select = function (chipId) {
  1701. if (this.selectedChipIds_.indexOf(chipId) >= 0) {
  1702. return;
  1703. }
  1704. if (this.adapter_.hasClass(constants_1.cssClasses.CHOICE) && this.selectedChipIds_.length > 0) {
  1705. var previouslySelectedChip = this.selectedChipIds_[0];
  1706. this.selectedChipIds_.length = 0;
  1707. this.adapter_.setSelected(previouslySelectedChip, false);
  1708. }
  1709. this.selectedChipIds_.push(chipId);
  1710. this.adapter_.setSelected(chipId, true);
  1711. };
  1712. /**
  1713. * Handles a chip interaction event
  1714. */
  1715. MDCChipSetFoundation.prototype.handleChipInteraction = function (chipId) {
  1716. if (this.adapter_.hasClass(constants_1.cssClasses.CHOICE) || this.adapter_.hasClass(constants_1.cssClasses.FILTER)) {
  1717. this.toggleSelect_(chipId);
  1718. }
  1719. };
  1720. /**
  1721. * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip.
  1722. */
  1723. MDCChipSetFoundation.prototype.handleChipSelection = function (chipId, selected) {
  1724. var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0;
  1725. if (selected && !chipIsSelected) {
  1726. this.select(chipId);
  1727. } else if (!selected && chipIsSelected) {
  1728. this.deselect_(chipId);
  1729. }
  1730. };
  1731. /**
  1732. * Handles the event when a chip is removed.
  1733. */
  1734. MDCChipSetFoundation.prototype.handleChipRemoval = function (chipId) {
  1735. this.deselect_(chipId);
  1736. this.adapter_.removeChip(chipId);
  1737. };
  1738. /**
  1739. * Deselects the chip with the given id.
  1740. */
  1741. MDCChipSetFoundation.prototype.deselect_ = function (chipId) {
  1742. var index = this.selectedChipIds_.indexOf(chipId);
  1743. if (index >= 0) {
  1744. this.selectedChipIds_.splice(index, 1);
  1745. this.adapter_.setSelected(chipId, false);
  1746. }
  1747. };
  1748. /**
  1749. * Toggles selection of the chip with the given id.
  1750. */
  1751. MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) {
  1752. if (this.selectedChipIds_.indexOf(chipId) >= 0) {
  1753. this.deselect_(chipId);
  1754. } else {
  1755. this.select(chipId);
  1756. }
  1757. };
  1758. return MDCChipSetFoundation;
  1759. }(foundation_1.MDCFoundation);
  1760. exports.MDCChipSetFoundation = MDCChipSetFoundation;
  1761. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  1762. exports.default = MDCChipSetFoundation;
  1763. /***/ }),
  1764. /***/ "./packages/mdc-chips/chip-set/index.ts":
  1765. /*!**********************************************!*\
  1766. !*** ./packages/mdc-chips/chip-set/index.ts ***!
  1767. \**********************************************/
  1768. /*! no static exports found */
  1769. /***/ (function(module, exports, __webpack_require__) {
  1770. "use strict";
  1771. /**
  1772. * @license
  1773. * Copyright 2019 Google Inc.
  1774. *
  1775. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1776. * of this software and associated documentation files (the "Software"), to deal
  1777. * in the Software without restriction, including without limitation the rights
  1778. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1779. * copies of the Software, and to permit persons to whom the Software is
  1780. * furnished to do so, subject to the following conditions:
  1781. *
  1782. * The above copyright notice and this permission notice shall be included in
  1783. * all copies or substantial portions of the Software.
  1784. *
  1785. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1786. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1787. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1788. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1789. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1790. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1791. * THE SOFTWARE.
  1792. */
  1793. function __export(m) {
  1794. for (var p in m) {
  1795. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  1796. }
  1797. }
  1798. Object.defineProperty(exports, "__esModule", { value: true });
  1799. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip-set/component.ts"));
  1800. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts"));
  1801. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
  1802. exports.chipSetCssClasses = constants_1.cssClasses;
  1803. exports.chipSetStrings = constants_1.strings;
  1804. /***/ }),
  1805. /***/ "./packages/mdc-chips/chip/component.ts":
  1806. /*!**********************************************!*\
  1807. !*** ./packages/mdc-chips/chip/component.ts ***!
  1808. \**********************************************/
  1809. /*! no static exports found */
  1810. /***/ (function(module, exports, __webpack_require__) {
  1811. "use strict";
  1812. /**
  1813. * @license
  1814. * Copyright 2016 Google Inc.
  1815. *
  1816. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1817. * of this software and associated documentation files (the "Software"), to deal
  1818. * in the Software without restriction, including without limitation the rights
  1819. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1820. * copies of the Software, and to permit persons to whom the Software is
  1821. * furnished to do so, subject to the following conditions:
  1822. *
  1823. * The above copyright notice and this permission notice shall be included in
  1824. * all copies or substantial portions of the Software.
  1825. *
  1826. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1827. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1828. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1829. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1830. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1831. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1832. * THE SOFTWARE.
  1833. */
  1834. var __extends = this && this.__extends || function () {
  1835. var _extendStatics = function extendStatics(d, b) {
  1836. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1837. d.__proto__ = b;
  1838. } || function (d, b) {
  1839. for (var p in b) {
  1840. if (b.hasOwnProperty(p)) d[p] = b[p];
  1841. }
  1842. };
  1843. return _extendStatics(d, b);
  1844. };
  1845. return function (d, b) {
  1846. _extendStatics(d, b);
  1847. function __() {
  1848. this.constructor = d;
  1849. }
  1850. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1851. };
  1852. }();
  1853. var __assign = this && this.__assign || function () {
  1854. __assign = Object.assign || function (t) {
  1855. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1856. s = arguments[i];
  1857. for (var p in s) {
  1858. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1859. }
  1860. }
  1861. return t;
  1862. };
  1863. return __assign.apply(this, arguments);
  1864. };
  1865. Object.defineProperty(exports, "__esModule", { value: true });
  1866. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  1867. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  1868. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  1869. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  1870. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts");
  1871. var INTERACTION_EVENTS = ['click', 'keydown'];
  1872. var MDCChip = /** @class */function (_super) {
  1873. __extends(MDCChip, _super);
  1874. function MDCChip() {
  1875. return _super !== null && _super.apply(this, arguments) || this;
  1876. }
  1877. Object.defineProperty(MDCChip.prototype, "selected", {
  1878. /**
  1879. * @return Whether the chip is selected.
  1880. */
  1881. get: function get() {
  1882. return this.foundation_.isSelected();
  1883. },
  1884. /**
  1885. * Sets selected state on the chip.
  1886. */
  1887. set: function set(selected) {
  1888. this.foundation_.setSelected(selected);
  1889. },
  1890. enumerable: true,
  1891. configurable: true
  1892. });
  1893. Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", {
  1894. /**
  1895. * @return Whether a trailing icon click should trigger exit/removal of the chip.
  1896. */
  1897. get: function get() {
  1898. return this.foundation_.getShouldRemoveOnTrailingIconClick();
  1899. },
  1900. /**
  1901. * Sets whether a trailing icon click should trigger exit/removal of the chip.
  1902. */
  1903. set: function set(shouldRemove) {
  1904. this.foundation_.setShouldRemoveOnTrailingIconClick(shouldRemove);
  1905. },
  1906. enumerable: true,
  1907. configurable: true
  1908. });
  1909. Object.defineProperty(MDCChip.prototype, "ripple", {
  1910. get: function get() {
  1911. return this.ripple_;
  1912. },
  1913. enumerable: true,
  1914. configurable: true
  1915. });
  1916. Object.defineProperty(MDCChip.prototype, "id", {
  1917. get: function get() {
  1918. return this.root_.id;
  1919. },
  1920. enumerable: true,
  1921. configurable: true
  1922. });
  1923. MDCChip.attachTo = function (root) {
  1924. return new MDCChip(root);
  1925. };
  1926. MDCChip.prototype.initialize = function (rippleFactory) {
  1927. var _this = this;
  1928. if (rippleFactory === void 0) {
  1929. rippleFactory = function rippleFactory(el, foundation) {
  1930. return new component_2.MDCRipple(el, foundation);
  1931. };
  1932. }
  1933. this.leadingIcon_ = this.root_.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  1934. this.trailingIcon_ = this.root_.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
  1935. this.checkmark_ = this.root_.querySelector(constants_1.strings.CHECKMARK_SELECTOR);
  1936. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  1937. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  1938. var rippleAdapter = __assign({}, component_2.MDCRipple.createAdapter(this), { computeBoundingRect: function computeBoundingRect() {
  1939. return _this.foundation_.getDimensions();
  1940. } });
  1941. this.ripple_ = rippleFactory(this.root_, new foundation_1.MDCRippleFoundation(rippleAdapter));
  1942. };
  1943. MDCChip.prototype.initialSyncWithDOM = function () {
  1944. var _this = this;
  1945. this.handleInteraction_ = function (evt) {
  1946. return _this.foundation_.handleInteraction(evt);
  1947. };
  1948. this.handleTransitionEnd_ = function (evt) {
  1949. return _this.foundation_.handleTransitionEnd(evt);
  1950. };
  1951. this.handleTrailingIconInteraction_ = function (evt) {
  1952. return _this.foundation_.handleTrailingIconInteraction(evt);
  1953. };
  1954. INTERACTION_EVENTS.forEach(function (evtType) {
  1955. _this.listen(evtType, _this.handleInteraction_);
  1956. });
  1957. this.listen('transitionend', this.handleTransitionEnd_);
  1958. if (this.trailingIcon_) {
  1959. INTERACTION_EVENTS.forEach(function (evtType) {
  1960. _this.trailingIcon_.addEventListener(evtType, _this.handleTrailingIconInteraction_);
  1961. });
  1962. }
  1963. };
  1964. MDCChip.prototype.destroy = function () {
  1965. var _this = this;
  1966. this.ripple_.destroy();
  1967. INTERACTION_EVENTS.forEach(function (evtType) {
  1968. _this.unlisten(evtType, _this.handleInteraction_);
  1969. });
  1970. this.unlisten('transitionend', this.handleTransitionEnd_);
  1971. if (this.trailingIcon_) {
  1972. INTERACTION_EVENTS.forEach(function (evtType) {
  1973. _this.trailingIcon_.removeEventListener(evtType, _this.handleTrailingIconInteraction_);
  1974. });
  1975. }
  1976. _super.prototype.destroy.call(this);
  1977. };
  1978. /**
  1979. * Begins the exit animation which leads to removal of the chip.
  1980. */
  1981. MDCChip.prototype.beginExit = function () {
  1982. this.foundation_.beginExit();
  1983. };
  1984. MDCChip.prototype.getDefaultFoundation = function () {
  1985. var _this = this;
  1986. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  1987. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  1988. var adapter = {
  1989. addClass: function addClass(className) {
  1990. return _this.root_.classList.add(className);
  1991. },
  1992. addClassToLeadingIcon: function addClassToLeadingIcon(className) {
  1993. if (_this.leadingIcon_) {
  1994. _this.leadingIcon_.classList.add(className);
  1995. }
  1996. },
  1997. eventTargetHasClass: function eventTargetHasClass(target, className) {
  1998. return target ? target.classList.contains(className) : false;
  1999. },
  2000. getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
  2001. return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null;
  2002. },
  2003. getComputedStyleValue: function getComputedStyleValue(propertyName) {
  2004. return window.getComputedStyle(_this.root_).getPropertyValue(propertyName);
  2005. },
  2006. getRootBoundingClientRect: function getRootBoundingClientRect() {
  2007. return _this.root_.getBoundingClientRect();
  2008. },
  2009. hasClass: function hasClass(className) {
  2010. return _this.root_.classList.contains(className);
  2011. },
  2012. hasLeadingIcon: function hasLeadingIcon() {
  2013. return !!_this.leadingIcon_;
  2014. },
  2015. notifyInteraction: function notifyInteraction() {
  2016. return _this.emit(constants_1.strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
  2017. },
  2018. notifyRemoval: function notifyRemoval() {
  2019. return _this.emit(constants_1.strings.REMOVAL_EVENT, { chipId: _this.id, root: _this.root_ }, true /* shouldBubble */);
  2020. },
  2021. notifySelection: function notifySelection(selected) {
  2022. return _this.emit(constants_1.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected }, true /* shouldBubble */);
  2023. },
  2024. notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
  2025. return _this.emit(constants_1.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
  2026. },
  2027. removeClass: function removeClass(className) {
  2028. return _this.root_.classList.remove(className);
  2029. },
  2030. removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) {
  2031. if (_this.leadingIcon_) {
  2032. _this.leadingIcon_.classList.remove(className);
  2033. }
  2034. },
  2035. setAttr: function setAttr(attr, value) {
  2036. return _this.root_.setAttribute(attr, value);
  2037. },
  2038. setStyleProperty: function setStyleProperty(propertyName, value) {
  2039. return _this.root_.style.setProperty(propertyName, value);
  2040. }
  2041. };
  2042. return new foundation_2.MDCChipFoundation(adapter);
  2043. };
  2044. return MDCChip;
  2045. }(component_1.MDCComponent);
  2046. exports.MDCChip = MDCChip;
  2047. /***/ }),
  2048. /***/ "./packages/mdc-chips/chip/constants.ts":
  2049. /*!**********************************************!*\
  2050. !*** ./packages/mdc-chips/chip/constants.ts ***!
  2051. \**********************************************/
  2052. /*! no static exports found */
  2053. /***/ (function(module, exports, __webpack_require__) {
  2054. "use strict";
  2055. /**
  2056. * @license
  2057. * Copyright 2016 Google Inc.
  2058. *
  2059. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2060. * of this software and associated documentation files (the "Software"), to deal
  2061. * in the Software without restriction, including without limitation the rights
  2062. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2063. * copies of the Software, and to permit persons to whom the Software is
  2064. * furnished to do so, subject to the following conditions:
  2065. *
  2066. * The above copyright notice and this permission notice shall be included in
  2067. * all copies or substantial portions of the Software.
  2068. *
  2069. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2070. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2071. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2072. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2073. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2074. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2075. * THE SOFTWARE.
  2076. */
  2077. Object.defineProperty(exports, "__esModule", { value: true });
  2078. exports.strings = {
  2079. ARIA_CHECKED: 'aria-checked',
  2080. CHECKMARK_SELECTOR: '.mdc-chip__checkmark',
  2081. ENTRY_ANIMATION_NAME: 'mdc-chip-entry',
  2082. INTERACTION_EVENT: 'MDCChip:interaction',
  2083. LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading',
  2084. REMOVAL_EVENT: 'MDCChip:removal',
  2085. SELECTION_EVENT: 'MDCChip:selection',
  2086. TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction',
  2087. TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing'
  2088. };
  2089. exports.cssClasses = {
  2090. CHECKMARK: 'mdc-chip__checkmark',
  2091. CHIP_EXIT: 'mdc-chip--exit',
  2092. HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden',
  2093. LEADING_ICON: 'mdc-chip__icon--leading',
  2094. SELECTED: 'mdc-chip--selected',
  2095. TRAILING_ICON: 'mdc-chip__icon--trailing'
  2096. };
  2097. /***/ }),
  2098. /***/ "./packages/mdc-chips/chip/foundation.ts":
  2099. /*!***********************************************!*\
  2100. !*** ./packages/mdc-chips/chip/foundation.ts ***!
  2101. \***********************************************/
  2102. /*! no static exports found */
  2103. /***/ (function(module, exports, __webpack_require__) {
  2104. "use strict";
  2105. /**
  2106. * @license
  2107. * Copyright 2016 Google Inc.
  2108. *
  2109. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2110. * of this software and associated documentation files (the "Software"), to deal
  2111. * in the Software without restriction, including without limitation the rights
  2112. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2113. * copies of the Software, and to permit persons to whom the Software is
  2114. * furnished to do so, subject to the following conditions:
  2115. *
  2116. * The above copyright notice and this permission notice shall be included in
  2117. * all copies or substantial portions of the Software.
  2118. *
  2119. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2120. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2121. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2122. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2123. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2124. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2125. * THE SOFTWARE.
  2126. */
  2127. var __extends = this && this.__extends || function () {
  2128. var _extendStatics = function extendStatics(d, b) {
  2129. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2130. d.__proto__ = b;
  2131. } || function (d, b) {
  2132. for (var p in b) {
  2133. if (b.hasOwnProperty(p)) d[p] = b[p];
  2134. }
  2135. };
  2136. return _extendStatics(d, b);
  2137. };
  2138. return function (d, b) {
  2139. _extendStatics(d, b);
  2140. function __() {
  2141. this.constructor = d;
  2142. }
  2143. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2144. };
  2145. }();
  2146. var __assign = this && this.__assign || function () {
  2147. __assign = Object.assign || function (t) {
  2148. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2149. s = arguments[i];
  2150. for (var p in s) {
  2151. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  2152. }
  2153. }
  2154. return t;
  2155. };
  2156. return __assign.apply(this, arguments);
  2157. };
  2158. Object.defineProperty(exports, "__esModule", { value: true });
  2159. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  2160. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2161. var emptyClientRect = {
  2162. bottom: 0,
  2163. height: 0,
  2164. left: 0,
  2165. right: 0,
  2166. top: 0,
  2167. width: 0
  2168. };
  2169. var MDCChipFoundation = /** @class */function (_super) {
  2170. __extends(MDCChipFoundation, _super);
  2171. function MDCChipFoundation(adapter) {
  2172. var _this = _super.call(this, __assign({}, MDCChipFoundation.defaultAdapter, adapter)) || this;
  2173. /**
  2174. * Whether a trailing icon click should immediately trigger exit/removal of the chip.
  2175. */
  2176. _this.shouldRemoveOnTrailingIconClick_ = true;
  2177. return _this;
  2178. }
  2179. Object.defineProperty(MDCChipFoundation, "strings", {
  2180. get: function get() {
  2181. return constants_1.strings;
  2182. },
  2183. enumerable: true,
  2184. configurable: true
  2185. });
  2186. Object.defineProperty(MDCChipFoundation, "cssClasses", {
  2187. get: function get() {
  2188. return constants_1.cssClasses;
  2189. },
  2190. enumerable: true,
  2191. configurable: true
  2192. });
  2193. Object.defineProperty(MDCChipFoundation, "defaultAdapter", {
  2194. get: function get() {
  2195. return {
  2196. addClass: function addClass() {
  2197. return undefined;
  2198. },
  2199. addClassToLeadingIcon: function addClassToLeadingIcon() {
  2200. return undefined;
  2201. },
  2202. eventTargetHasClass: function eventTargetHasClass() {
  2203. return false;
  2204. },
  2205. getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
  2206. return emptyClientRect;
  2207. },
  2208. getComputedStyleValue: function getComputedStyleValue() {
  2209. return '';
  2210. },
  2211. getRootBoundingClientRect: function getRootBoundingClientRect() {
  2212. return emptyClientRect;
  2213. },
  2214. hasClass: function hasClass() {
  2215. return false;
  2216. },
  2217. hasLeadingIcon: function hasLeadingIcon() {
  2218. return false;
  2219. },
  2220. notifyInteraction: function notifyInteraction() {
  2221. return undefined;
  2222. },
  2223. notifyRemoval: function notifyRemoval() {
  2224. return undefined;
  2225. },
  2226. notifySelection: function notifySelection() {
  2227. return undefined;
  2228. },
  2229. notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
  2230. return undefined;
  2231. },
  2232. removeClass: function removeClass() {
  2233. return undefined;
  2234. },
  2235. removeClassFromLeadingIcon: function removeClassFromLeadingIcon() {
  2236. return undefined;
  2237. },
  2238. setAttr: function setAttr() {
  2239. return undefined;
  2240. },
  2241. setStyleProperty: function setStyleProperty() {
  2242. return undefined;
  2243. }
  2244. };
  2245. },
  2246. enumerable: true,
  2247. configurable: true
  2248. });
  2249. MDCChipFoundation.prototype.isSelected = function () {
  2250. return this.adapter_.hasClass(constants_1.cssClasses.SELECTED);
  2251. };
  2252. MDCChipFoundation.prototype.setSelected = function (selected) {
  2253. if (selected) {
  2254. this.adapter_.addClass(constants_1.cssClasses.SELECTED);
  2255. this.adapter_.setAttr(constants_1.strings.ARIA_CHECKED, 'true');
  2256. } else {
  2257. this.adapter_.removeClass(constants_1.cssClasses.SELECTED);
  2258. this.adapter_.setAttr(constants_1.strings.ARIA_CHECKED, 'false');
  2259. }
  2260. this.adapter_.notifySelection(selected);
  2261. };
  2262. MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () {
  2263. return this.shouldRemoveOnTrailingIconClick_;
  2264. };
  2265. MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) {
  2266. this.shouldRemoveOnTrailingIconClick_ = shouldRemove;
  2267. };
  2268. MDCChipFoundation.prototype.getDimensions = function () {
  2269. var _this = this;
  2270. var getRootRect = function getRootRect() {
  2271. return _this.adapter_.getRootBoundingClientRect();
  2272. };
  2273. var getCheckmarkRect = function getCheckmarkRect() {
  2274. return _this.adapter_.getCheckmarkBoundingClientRect();
  2275. };
  2276. // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current
  2277. // size of the checkmark.
  2278. if (!this.adapter_.hasLeadingIcon()) {
  2279. var checkmarkRect = getCheckmarkRect();
  2280. if (checkmarkRect) {
  2281. var rootRect = getRootRect();
  2282. // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes.
  2283. // However, the checkbox is initially hidden by setting the width to 0.
  2284. // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width)
  2285. // when adding it to the root client rect's width.
  2286. return {
  2287. bottom: rootRect.bottom,
  2288. height: rootRect.height,
  2289. left: rootRect.left,
  2290. right: rootRect.right,
  2291. top: rootRect.top,
  2292. width: rootRect.width + checkmarkRect.height
  2293. };
  2294. }
  2295. }
  2296. return getRootRect();
  2297. };
  2298. /**
  2299. * Begins the exit animation which leads to removal of the chip.
  2300. */
  2301. MDCChipFoundation.prototype.beginExit = function () {
  2302. this.adapter_.addClass(constants_1.cssClasses.CHIP_EXIT);
  2303. };
  2304. /**
  2305. * Handles an interaction event on the root element.
  2306. */
  2307. MDCChipFoundation.prototype.handleInteraction = function (evt) {
  2308. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  2309. if (evt.type === 'click' || isEnter) {
  2310. this.adapter_.notifyInteraction();
  2311. }
  2312. };
  2313. /**
  2314. * Handles a transition end event on the root element.
  2315. */
  2316. MDCChipFoundation.prototype.handleTransitionEnd = function (evt) {
  2317. var _this = this;
  2318. // Handle transition end event on the chip when it is about to be removed.
  2319. if (this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT)) {
  2320. if (evt.propertyName === 'width') {
  2321. this.adapter_.notifyRemoval();
  2322. } else if (evt.propertyName === 'opacity') {
  2323. // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5
  2324. var chipWidth_1 = this.adapter_.getComputedStyleValue('width');
  2325. // On the next frame (once we get the computed width), explicitly set the chip's width
  2326. // to its current pixel width, so we aren't transitioning out of 'auto'.
  2327. requestAnimationFrame(function () {
  2328. _this.adapter_.setStyleProperty('width', chipWidth_1);
  2329. // To mitigate jitter, start transitioning padding and margin before width.
  2330. _this.adapter_.setStyleProperty('padding', '0');
  2331. _this.adapter_.setStyleProperty('margin', '0');
  2332. // On the next frame (once width is explicitly set), transition width to 0.
  2333. requestAnimationFrame(function () {
  2334. _this.adapter_.setStyleProperty('width', '0');
  2335. });
  2336. });
  2337. }
  2338. return;
  2339. }
  2340. // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles.
  2341. if (evt.propertyName !== 'opacity') {
  2342. return;
  2343. }
  2344. if (this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.LEADING_ICON) && this.adapter_.hasClass(constants_1.cssClasses.SELECTED)) {
  2345. this.adapter_.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
  2346. } else if (this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter_.hasClass(constants_1.cssClasses.SELECTED)) {
  2347. this.adapter_.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
  2348. }
  2349. };
  2350. /**
  2351. * Handles an interaction event on the trailing icon element. This is used to
  2352. * prevent the ripple from activating on interaction with the trailing icon.
  2353. */
  2354. MDCChipFoundation.prototype.handleTrailingIconInteraction = function (evt) {
  2355. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  2356. evt.stopPropagation();
  2357. if (evt.type === 'click' || isEnter) {
  2358. this.adapter_.notifyTrailingIconInteraction();
  2359. if (this.shouldRemoveOnTrailingIconClick_) {
  2360. this.beginExit();
  2361. }
  2362. }
  2363. };
  2364. return MDCChipFoundation;
  2365. }(foundation_1.MDCFoundation);
  2366. exports.MDCChipFoundation = MDCChipFoundation;
  2367. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  2368. exports.default = MDCChipFoundation;
  2369. /***/ }),
  2370. /***/ "./packages/mdc-chips/chip/index.ts":
  2371. /*!******************************************!*\
  2372. !*** ./packages/mdc-chips/chip/index.ts ***!
  2373. \******************************************/
  2374. /*! no static exports found */
  2375. /***/ (function(module, exports, __webpack_require__) {
  2376. "use strict";
  2377. /**
  2378. * @license
  2379. * Copyright 2019 Google Inc.
  2380. *
  2381. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2382. * of this software and associated documentation files (the "Software"), to deal
  2383. * in the Software without restriction, including without limitation the rights
  2384. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2385. * copies of the Software, and to permit persons to whom the Software is
  2386. * furnished to do so, subject to the following conditions:
  2387. *
  2388. * The above copyright notice and this permission notice shall be included in
  2389. * all copies or substantial portions of the Software.
  2390. *
  2391. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2392. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2393. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2394. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2395. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2396. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2397. * THE SOFTWARE.
  2398. */
  2399. function __export(m) {
  2400. for (var p in m) {
  2401. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  2402. }
  2403. }
  2404. Object.defineProperty(exports, "__esModule", { value: true });
  2405. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip/component.ts"));
  2406. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts"));
  2407. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2408. exports.chipCssClasses = constants_1.cssClasses;
  2409. exports.chipStrings = constants_1.strings;
  2410. /***/ }),
  2411. /***/ "./packages/mdc-chips/index.ts":
  2412. /*!*************************************!*\
  2413. !*** ./packages/mdc-chips/index.ts ***!
  2414. \*************************************/
  2415. /*! no static exports found */
  2416. /***/ (function(module, exports, __webpack_require__) {
  2417. "use strict";
  2418. /**
  2419. * @license
  2420. * Copyright 2019 Google Inc.
  2421. *
  2422. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2423. * of this software and associated documentation files (the "Software"), to deal
  2424. * in the Software without restriction, including without limitation the rights
  2425. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2426. * copies of the Software, and to permit persons to whom the Software is
  2427. * furnished to do so, subject to the following conditions:
  2428. *
  2429. * The above copyright notice and this permission notice shall be included in
  2430. * all copies or substantial portions of the Software.
  2431. *
  2432. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2433. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2434. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2435. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2436. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2437. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2438. * THE SOFTWARE.
  2439. */
  2440. function __export(m) {
  2441. for (var p in m) {
  2442. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  2443. }
  2444. }
  2445. Object.defineProperty(exports, "__esModule", { value: true });
  2446. __export(__webpack_require__(/*! ./chip/index */ "./packages/mdc-chips/chip/index.ts"));
  2447. __export(__webpack_require__(/*! ./chip-set/index */ "./packages/mdc-chips/chip-set/index.ts"));
  2448. /***/ }),
  2449. /***/ "./packages/mdc-data-table/component.ts":
  2450. /*!**********************************************!*\
  2451. !*** ./packages/mdc-data-table/component.ts ***!
  2452. \**********************************************/
  2453. /*! no static exports found */
  2454. /***/ (function(module, exports, __webpack_require__) {
  2455. "use strict";
  2456. /**
  2457. * @license
  2458. * Copyright 2019 Google Inc.
  2459. *
  2460. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2461. * of this software and associated documentation files (the "Software"), to deal
  2462. * in the Software without restriction, including without limitation the rights
  2463. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2464. * copies of the Software, and to permit persons to whom the Software is
  2465. * furnished to do so, subject to the following conditions:
  2466. *
  2467. * The above copyright notice and this permission notice shall be included in
  2468. * all copies or substantial portions of the Software.
  2469. *
  2470. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2471. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2472. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2473. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2474. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2475. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2476. * THE SOFTWARE.
  2477. */
  2478. var __extends = this && this.__extends || function () {
  2479. var _extendStatics = function extendStatics(d, b) {
  2480. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2481. d.__proto__ = b;
  2482. } || function (d, b) {
  2483. for (var p in b) {
  2484. if (b.hasOwnProperty(p)) d[p] = b[p];
  2485. }
  2486. };
  2487. return _extendStatics(d, b);
  2488. };
  2489. return function (d, b) {
  2490. _extendStatics(d, b);
  2491. function __() {
  2492. this.constructor = d;
  2493. }
  2494. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2495. };
  2496. }();
  2497. Object.defineProperty(exports, "__esModule", { value: true });
  2498. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  2499. var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts");
  2500. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  2501. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  2502. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts");
  2503. var MDCDataTable = /** @class */function (_super) {
  2504. __extends(MDCDataTable, _super);
  2505. function MDCDataTable() {
  2506. return _super !== null && _super.apply(this, arguments) || this;
  2507. }
  2508. MDCDataTable.attachTo = function (root) {
  2509. return new MDCDataTable(root);
  2510. };
  2511. MDCDataTable.prototype.initialize = function (checkboxFactory) {
  2512. if (checkboxFactory === void 0) {
  2513. checkboxFactory = function checkboxFactory(el) {
  2514. return new component_2.MDCCheckbox(el);
  2515. };
  2516. }
  2517. this.checkboxFactory_ = checkboxFactory;
  2518. };
  2519. MDCDataTable.prototype.initialSyncWithDOM = function () {
  2520. var _this = this;
  2521. this.headerRow_ = this.root_.querySelector("." + constants_1.cssClasses.HEADER_ROW);
  2522. this.handleHeaderRowCheckboxChange_ = function () {
  2523. return _this.foundation_.handleHeaderRowCheckboxChange();
  2524. };
  2525. this.headerRow_.addEventListener('change', this.handleHeaderRowCheckboxChange_);
  2526. this.content_ = this.root_.querySelector("." + constants_1.cssClasses.CONTENT);
  2527. this.handleRowCheckboxChange_ = function (event) {
  2528. return _this.foundation_.handleRowCheckboxChange(event);
  2529. };
  2530. this.content_.addEventListener('change', this.handleRowCheckboxChange_);
  2531. this.layout();
  2532. };
  2533. /**
  2534. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  2535. */
  2536. MDCDataTable.prototype.layout = function () {
  2537. this.foundation_.layout();
  2538. };
  2539. /**
  2540. * @return Returns array of row elements.
  2541. */
  2542. MDCDataTable.prototype.getRows = function () {
  2543. return this.foundation_.getRows();
  2544. };
  2545. /**
  2546. * @return Returns array of selected row ids.
  2547. */
  2548. MDCDataTable.prototype.getSelectedRowIds = function () {
  2549. return this.foundation_.getSelectedRowIds();
  2550. };
  2551. /**
  2552. * Sets selected row ids. Overwrites previously selected rows.
  2553. * @param rowIds Array of row ids that needs to be selected.
  2554. */
  2555. MDCDataTable.prototype.setSelectedRowIds = function (rowIds) {
  2556. this.foundation_.setSelectedRowIds(rowIds);
  2557. };
  2558. MDCDataTable.prototype.destroy = function () {
  2559. this.headerRow_.removeEventListener('change', this.handleHeaderRowCheckboxChange_);
  2560. this.content_.removeEventListener('change', this.handleRowCheckboxChange_);
  2561. this.headerRowCheckbox_.destroy();
  2562. this.rowCheckboxList_.forEach(function (checkbox) {
  2563. return checkbox.destroy();
  2564. });
  2565. };
  2566. MDCDataTable.prototype.getDefaultFoundation = function () {
  2567. var _this = this;
  2568. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  2569. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  2570. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  2571. var adapter = {
  2572. addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) {
  2573. return _this.getRows()[rowIndex].classList.add(className);
  2574. },
  2575. getRowCount: function getRowCount() {
  2576. return _this.getRows().length;
  2577. },
  2578. getRowElements: function getRowElements() {
  2579. return [].slice.call(_this.root_.querySelectorAll(constants_1.strings.ROW_SELECTOR));
  2580. },
  2581. getRowIdAtIndex: function getRowIdAtIndex(rowIndex) {
  2582. return _this.getRows()[rowIndex].getAttribute(constants_1.strings.DATA_ROW_ID_ATTR);
  2583. },
  2584. getRowIndexByChildElement: function getRowIndexByChildElement(el) {
  2585. return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.strings.ROW_SELECTOR));
  2586. },
  2587. getSelectedRowCount: function getSelectedRowCount() {
  2588. return _this.root_.querySelectorAll(constants_1.strings.ROW_SELECTED_SELECTOR).length;
  2589. },
  2590. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) {
  2591. return _this.rowCheckboxList_[rowIndex].checked;
  2592. },
  2593. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  2594. return _this.headerRowCheckbox_.checked;
  2595. },
  2596. isRowsSelectable: function isRowsSelectable() {
  2597. return !!_this.root_.querySelector(constants_1.strings.ROW_CHECKBOX_SELECTOR);
  2598. },
  2599. notifyRowSelectionChanged: function notifyRowSelectionChanged(data) {
  2600. _this.emit(constants_1.events.ROW_SELECTION_CHANGED, {
  2601. row: _this.getRowByIndex_(data.rowIndex),
  2602. rowId: _this.getRowIdByIndex_(data.rowIndex),
  2603. rowIndex: data.rowIndex,
  2604. selected: data.selected
  2605. },
  2606. /** shouldBubble */true);
  2607. },
  2608. notifySelectedAll: function notifySelectedAll() {
  2609. return _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true);
  2610. },
  2611. notifyUnselectedAll: function notifyUnselectedAll() {
  2612. return _this.emit(constants_1.events.UNSELECTED_ALL, {}, /** shouldBubble */true);
  2613. },
  2614. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  2615. if (_this.headerRowCheckbox_) {
  2616. _this.headerRowCheckbox_.destroy();
  2617. }
  2618. var checkboxEl = _this.root_.querySelector(constants_1.strings.HEADER_ROW_CHECKBOX_SELECTOR);
  2619. _this.headerRowCheckbox_ = _this.checkboxFactory_(checkboxEl);
  2620. },
  2621. registerRowCheckboxes: function registerRowCheckboxes() {
  2622. if (_this.rowCheckboxList_) {
  2623. _this.rowCheckboxList_.forEach(function (checkbox) {
  2624. return checkbox.destroy();
  2625. });
  2626. }
  2627. _this.rowCheckboxList_ = [];
  2628. _this.getRows().forEach(function (rowEl) {
  2629. var checkbox = _this.checkboxFactory_(rowEl.querySelector(constants_1.strings.ROW_CHECKBOX_SELECTOR));
  2630. _this.rowCheckboxList_.push(checkbox);
  2631. });
  2632. },
  2633. removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) {
  2634. _this.getRows()[rowIndex].classList.remove(className);
  2635. },
  2636. setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) {
  2637. _this.getRows()[rowIndex].setAttribute(attr, value);
  2638. },
  2639. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) {
  2640. _this.headerRowCheckbox_.checked = checked;
  2641. },
  2642. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) {
  2643. _this.headerRowCheckbox_.indeterminate = indeterminate;
  2644. },
  2645. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) {
  2646. _this.rowCheckboxList_[rowIndex].checked = checked;
  2647. }
  2648. };
  2649. return new foundation_1.MDCDataTableFoundation(adapter);
  2650. };
  2651. MDCDataTable.prototype.getRowByIndex_ = function (index) {
  2652. return this.getRows()[index];
  2653. };
  2654. MDCDataTable.prototype.getRowIdByIndex_ = function (index) {
  2655. return this.getRowByIndex_(index).getAttribute(constants_1.strings.DATA_ROW_ID_ATTR);
  2656. };
  2657. return MDCDataTable;
  2658. }(component_1.MDCComponent);
  2659. exports.MDCDataTable = MDCDataTable;
  2660. /***/ }),
  2661. /***/ "./packages/mdc-data-table/constants.ts":
  2662. /*!**********************************************!*\
  2663. !*** ./packages/mdc-data-table/constants.ts ***!
  2664. \**********************************************/
  2665. /*! no static exports found */
  2666. /***/ (function(module, exports, __webpack_require__) {
  2667. "use strict";
  2668. /**
  2669. * @license
  2670. * Copyright 2019 Google Inc.
  2671. *
  2672. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2673. * of this software and associated documentation files (the "Software"), to deal
  2674. * in the Software without restriction, including without limitation the rights
  2675. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2676. * copies of the Software, and to permit persons to whom the Software is
  2677. * furnished to do so, subject to the following conditions:
  2678. *
  2679. * The above copyright notice and this permission notice shall be included in
  2680. * all copies or substantial portions of the Software.
  2681. *
  2682. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2683. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2684. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2685. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2686. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2687. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2688. * THE SOFTWARE.
  2689. */
  2690. Object.defineProperty(exports, "__esModule", { value: true });
  2691. exports.cssClasses = {
  2692. CELL: 'mdc-data-table__cell',
  2693. CELL_NUMERIC: 'mdc-data-table__cell--numeric',
  2694. CONTENT: 'mdc-data-table__content',
  2695. HEADER_ROW: 'mdc-data-table__header-row',
  2696. HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',
  2697. ROOT: 'mdc-data-table',
  2698. ROW: 'mdc-data-table__row',
  2699. ROW_CHECKBOX: 'mdc-data-table__row-checkbox',
  2700. ROW_SELECTED: 'mdc-data-table__row--selected'
  2701. };
  2702. exports.strings = {
  2703. ARIA_SELECTED: 'aria-selected',
  2704. DATA_ROW_ID_ATTR: 'data-row-id',
  2705. HEADER_ROW_CHECKBOX_SELECTOR: "." + exports.cssClasses.HEADER_ROW_CHECKBOX,
  2706. ROW_CHECKBOX_SELECTOR: "." + exports.cssClasses.ROW_CHECKBOX,
  2707. ROW_SELECTED_SELECTOR: "." + exports.cssClasses.ROW_SELECTED,
  2708. ROW_SELECTOR: "." + exports.cssClasses.ROW
  2709. };
  2710. exports.events = {
  2711. ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged',
  2712. SELECTED_ALL: 'MDCDataTable:selectedAll',
  2713. UNSELECTED_ALL: 'MDCDataTable:unselectedAll'
  2714. };
  2715. /***/ }),
  2716. /***/ "./packages/mdc-data-table/foundation.ts":
  2717. /*!***********************************************!*\
  2718. !*** ./packages/mdc-data-table/foundation.ts ***!
  2719. \***********************************************/
  2720. /*! no static exports found */
  2721. /***/ (function(module, exports, __webpack_require__) {
  2722. "use strict";
  2723. /**
  2724. * @license
  2725. * Copyright 2019 Google Inc.
  2726. *
  2727. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2728. * of this software and associated documentation files (the "Software"), to deal
  2729. * in the Software without restriction, including without limitation the rights
  2730. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2731. * copies of the Software, and to permit persons to whom the Software is
  2732. * furnished to do so, subject to the following conditions:
  2733. *
  2734. * The above copyright notice and this permission notice shall be included in
  2735. * all copies or substantial portions of the Software.
  2736. *
  2737. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2738. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2739. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2740. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2741. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2742. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2743. * THE SOFTWARE.
  2744. */
  2745. var __extends = this && this.__extends || function () {
  2746. var _extendStatics = function extendStatics(d, b) {
  2747. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2748. d.__proto__ = b;
  2749. } || function (d, b) {
  2750. for (var p in b) {
  2751. if (b.hasOwnProperty(p)) d[p] = b[p];
  2752. }
  2753. };
  2754. return _extendStatics(d, b);
  2755. };
  2756. return function (d, b) {
  2757. _extendStatics(d, b);
  2758. function __() {
  2759. this.constructor = d;
  2760. }
  2761. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2762. };
  2763. }();
  2764. var __assign = this && this.__assign || function () {
  2765. __assign = Object.assign || function (t) {
  2766. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2767. s = arguments[i];
  2768. for (var p in s) {
  2769. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  2770. }
  2771. }
  2772. return t;
  2773. };
  2774. return __assign.apply(this, arguments);
  2775. };
  2776. var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
  2777. return new (P || (P = Promise))(function (resolve, reject) {
  2778. function fulfilled(value) {
  2779. try {
  2780. step(generator.next(value));
  2781. } catch (e) {
  2782. reject(e);
  2783. }
  2784. }
  2785. function rejected(value) {
  2786. try {
  2787. step(generator["throw"](value));
  2788. } catch (e) {
  2789. reject(e);
  2790. }
  2791. }
  2792. function step(result) {
  2793. result.done ? resolve(result.value) : new P(function (resolve) {
  2794. resolve(result.value);
  2795. }).then(fulfilled, rejected);
  2796. }
  2797. step((generator = generator.apply(thisArg, _arguments || [])).next());
  2798. });
  2799. };
  2800. var __generator = this && this.__generator || function (thisArg, body) {
  2801. var _ = { label: 0, sent: function sent() {
  2802. if (t[0] & 1) throw t[1];return t[1];
  2803. }, trys: [], ops: [] },
  2804. f,
  2805. y,
  2806. t,
  2807. g;
  2808. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
  2809. return this;
  2810. }), g;
  2811. function verb(n) {
  2812. return function (v) {
  2813. return step([n, v]);
  2814. };
  2815. }
  2816. function step(op) {
  2817. if (f) throw new TypeError("Generator is already executing.");
  2818. while (_) {
  2819. try {
  2820. 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;
  2821. if (y = 0, t) op = [op[0] & 2, t.value];
  2822. switch (op[0]) {
  2823. case 0:case 1:
  2824. t = op;break;
  2825. case 4:
  2826. _.label++;return { value: op[1], done: false };
  2827. case 5:
  2828. _.label++;y = op[1];op = [0];continue;
  2829. case 7:
  2830. op = _.ops.pop();_.trys.pop();continue;
  2831. default:
  2832. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  2833. _ = 0;continue;
  2834. }
  2835. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  2836. _.label = op[1];break;
  2837. }
  2838. if (op[0] === 6 && _.label < t[1]) {
  2839. _.label = t[1];t = op;break;
  2840. }
  2841. if (t && _.label < t[2]) {
  2842. _.label = t[2];_.ops.push(op);break;
  2843. }
  2844. if (t[2]) _.ops.pop();
  2845. _.trys.pop();continue;
  2846. }
  2847. op = body.call(thisArg, _);
  2848. } catch (e) {
  2849. op = [6, e];y = 0;
  2850. } finally {
  2851. f = t = 0;
  2852. }
  2853. }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
  2854. }
  2855. };
  2856. Object.defineProperty(exports, "__esModule", { value: true });
  2857. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  2858. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  2859. var MDCDataTableFoundation = /** @class */function (_super) {
  2860. __extends(MDCDataTableFoundation, _super);
  2861. function MDCDataTableFoundation(adapter) {
  2862. return _super.call(this, __assign({}, MDCDataTableFoundation.defaultAdapter, adapter)) || this;
  2863. }
  2864. Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", {
  2865. get: function get() {
  2866. return {
  2867. addClassAtRowIndex: function addClassAtRowIndex() {
  2868. return undefined;
  2869. },
  2870. getRowCount: function getRowCount() {
  2871. return 0;
  2872. },
  2873. getRowElements: function getRowElements() {
  2874. return [];
  2875. },
  2876. getRowIdAtIndex: function getRowIdAtIndex() {
  2877. return '';
  2878. },
  2879. getRowIndexByChildElement: function getRowIndexByChildElement() {
  2880. return 0;
  2881. },
  2882. getSelectedRowCount: function getSelectedRowCount() {
  2883. return 0;
  2884. },
  2885. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() {
  2886. return false;
  2887. },
  2888. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  2889. return false;
  2890. },
  2891. isRowsSelectable: function isRowsSelectable() {
  2892. return false;
  2893. },
  2894. notifyRowSelectionChanged: function notifyRowSelectionChanged() {
  2895. return undefined;
  2896. },
  2897. notifySelectedAll: function notifySelectedAll() {
  2898. return undefined;
  2899. },
  2900. notifyUnselectedAll: function notifyUnselectedAll() {
  2901. return undefined;
  2902. },
  2903. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  2904. return undefined;
  2905. },
  2906. registerRowCheckboxes: function registerRowCheckboxes() {
  2907. return undefined;
  2908. },
  2909. removeClassAtRowIndex: function removeClassAtRowIndex() {
  2910. return undefined;
  2911. },
  2912. setAttributeAtRowIndex: function setAttributeAtRowIndex() {
  2913. return undefined;
  2914. },
  2915. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() {
  2916. return undefined;
  2917. },
  2918. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() {
  2919. return undefined;
  2920. },
  2921. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() {
  2922. return undefined;
  2923. }
  2924. };
  2925. },
  2926. enumerable: true,
  2927. configurable: true
  2928. });
  2929. /**
  2930. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  2931. * Use this if registering checkbox is synchronous.
  2932. */
  2933. MDCDataTableFoundation.prototype.layout = function () {
  2934. if (this.adapter_.isRowsSelectable()) {
  2935. this.adapter_.registerHeaderRowCheckbox();
  2936. this.adapter_.registerRowCheckboxes();
  2937. this.setHeaderRowCheckboxState_();
  2938. }
  2939. };
  2940. /**
  2941. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  2942. * Use this if registering checkbox is asynchronous.
  2943. */
  2944. MDCDataTableFoundation.prototype.layoutAsync = function () {
  2945. return __awaiter(this, void 0, void 0, function () {
  2946. return __generator(this, function (_a) {
  2947. switch (_a.label) {
  2948. case 0:
  2949. if (!this.adapter_.isRowsSelectable()) return [3 /*break*/, 3];
  2950. return [4 /*yield*/, this.adapter_.registerHeaderRowCheckbox()];
  2951. case 1:
  2952. _a.sent();
  2953. return [4 /*yield*/, this.adapter_.registerRowCheckboxes()];
  2954. case 2:
  2955. _a.sent();
  2956. this.setHeaderRowCheckboxState_();
  2957. _a.label = 3;
  2958. case 3:
  2959. return [2 /*return*/];
  2960. }
  2961. });
  2962. });
  2963. };
  2964. /**
  2965. * @return Returns array of row elements.
  2966. */
  2967. MDCDataTableFoundation.prototype.getRows = function () {
  2968. return this.adapter_.getRowElements();
  2969. };
  2970. /**
  2971. * Sets selected row ids. Overwrites previously selected rows.
  2972. * @param rowIds Array of row ids that needs to be selected.
  2973. */
  2974. MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {
  2975. for (var rowIndex = 0; rowIndex < this.adapter_.getRowCount(); rowIndex++) {
  2976. var rowId = this.adapter_.getRowIdAtIndex(rowIndex);
  2977. var isSelected = false;
  2978. if (rowId && rowIds.indexOf(rowId) >= 0) {
  2979. isSelected = true;
  2980. }
  2981. this.adapter_.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);
  2982. this.selectRowAtIndex_(rowIndex, isSelected);
  2983. }
  2984. this.setHeaderRowCheckboxState_();
  2985. };
  2986. /**
  2987. * @return Returns array of selected row ids.
  2988. */
  2989. MDCDataTableFoundation.prototype.getSelectedRowIds = function () {
  2990. var selectedRowIds = [];
  2991. for (var rowIndex = 0; rowIndex < this.adapter_.getRowCount(); rowIndex++) {
  2992. if (this.adapter_.isCheckboxAtRowIndexChecked(rowIndex)) {
  2993. selectedRowIds.push(this.adapter_.getRowIdAtIndex(rowIndex));
  2994. }
  2995. }
  2996. return selectedRowIds;
  2997. };
  2998. /**
  2999. * Handles header row checkbox change event.
  3000. */
  3001. MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {
  3002. var isHeaderChecked = this.adapter_.isHeaderRowCheckboxChecked();
  3003. for (var rowIndex = 0; rowIndex < this.adapter_.getRowCount(); rowIndex++) {
  3004. this.adapter_.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);
  3005. this.selectRowAtIndex_(rowIndex, isHeaderChecked);
  3006. }
  3007. if (isHeaderChecked) {
  3008. this.adapter_.notifySelectedAll();
  3009. } else {
  3010. this.adapter_.notifyUnselectedAll();
  3011. }
  3012. };
  3013. /**
  3014. * Handles change event originated from row checkboxes.
  3015. */
  3016. MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {
  3017. var rowIndex = this.adapter_.getRowIndexByChildElement(event.target);
  3018. if (rowIndex === -1) {
  3019. return;
  3020. }
  3021. var selected = this.adapter_.isCheckboxAtRowIndexChecked(rowIndex);
  3022. this.selectRowAtIndex_(rowIndex, selected);
  3023. this.setHeaderRowCheckboxState_();
  3024. var rowId = this.adapter_.getRowIdAtIndex(rowIndex);
  3025. this.adapter_.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });
  3026. };
  3027. /**
  3028. * Updates header row checkbox state based on number of rows selected.
  3029. */
  3030. MDCDataTableFoundation.prototype.setHeaderRowCheckboxState_ = function () {
  3031. if (this.adapter_.getSelectedRowCount() === this.adapter_.getRowCount()) {
  3032. this.adapter_.setHeaderRowCheckboxChecked(true);
  3033. this.adapter_.setHeaderRowCheckboxIndeterminate(false);
  3034. } else if (this.adapter_.getSelectedRowCount() === 0) {
  3035. this.adapter_.setHeaderRowCheckboxIndeterminate(false);
  3036. this.adapter_.setHeaderRowCheckboxChecked(false);
  3037. } else {
  3038. this.adapter_.setHeaderRowCheckboxIndeterminate(true);
  3039. this.adapter_.setHeaderRowCheckboxChecked(false);
  3040. }
  3041. };
  3042. /**
  3043. * Sets the attributes of row element based on selection state.
  3044. */
  3045. MDCDataTableFoundation.prototype.selectRowAtIndex_ = function (rowIndex, selected) {
  3046. if (selected) {
  3047. this.adapter_.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  3048. this.adapter_.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true');
  3049. } else {
  3050. this.adapter_.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  3051. this.adapter_.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false');
  3052. }
  3053. };
  3054. return MDCDataTableFoundation;
  3055. }(foundation_1.MDCFoundation);
  3056. exports.MDCDataTableFoundation = MDCDataTableFoundation;
  3057. /***/ }),
  3058. /***/ "./packages/mdc-data-table/index.ts":
  3059. /*!******************************************!*\
  3060. !*** ./packages/mdc-data-table/index.ts ***!
  3061. \******************************************/
  3062. /*! no static exports found */
  3063. /***/ (function(module, exports, __webpack_require__) {
  3064. "use strict";
  3065. /**
  3066. * @license
  3067. * Copyright 2019 Google Inc.
  3068. *
  3069. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3070. * of this software and associated documentation files (the "Software"), to deal
  3071. * in the Software without restriction, including without limitation the rights
  3072. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3073. * copies of the Software, and to permit persons to whom the Software is
  3074. * furnished to do so, subject to the following conditions:
  3075. *
  3076. * The above copyright notice and this permission notice shall be included in
  3077. * all copies or substantial portions of the Software.
  3078. *
  3079. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3080. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3081. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3082. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3083. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3084. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3085. * THE SOFTWARE.
  3086. */
  3087. function __export(m) {
  3088. for (var p in m) {
  3089. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  3090. }
  3091. }
  3092. Object.defineProperty(exports, "__esModule", { value: true });
  3093. __export(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts"));
  3094. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"));
  3095. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"));
  3096. /***/ }),
  3097. /***/ "./packages/mdc-dialog/component.ts":
  3098. /*!******************************************!*\
  3099. !*** ./packages/mdc-dialog/component.ts ***!
  3100. \******************************************/
  3101. /*! no static exports found */
  3102. /***/ (function(module, exports, __webpack_require__) {
  3103. "use strict";
  3104. /**
  3105. * @license
  3106. * Copyright 2017 Google Inc.
  3107. *
  3108. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3109. * of this software and associated documentation files (the "Software"), to deal
  3110. * in the Software without restriction, including without limitation the rights
  3111. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3112. * copies of the Software, and to permit persons to whom the Software is
  3113. * furnished to do so, subject to the following conditions:
  3114. *
  3115. * The above copyright notice and this permission notice shall be included in
  3116. * all copies or substantial portions of the Software.
  3117. *
  3118. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3119. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3120. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3121. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3122. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3123. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3124. * THE SOFTWARE.
  3125. */
  3126. var __extends = this && this.__extends || function () {
  3127. var _extendStatics = function extendStatics(d, b) {
  3128. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3129. d.__proto__ = b;
  3130. } || function (d, b) {
  3131. for (var p in b) {
  3132. if (b.hasOwnProperty(p)) d[p] = b[p];
  3133. }
  3134. };
  3135. return _extendStatics(d, b);
  3136. };
  3137. return function (d, b) {
  3138. _extendStatics(d, b);
  3139. function __() {
  3140. this.constructor = d;
  3141. }
  3142. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3143. };
  3144. }();
  3145. var __values = this && this.__values || function (o) {
  3146. var m = typeof Symbol === "function" && o[Symbol.iterator],
  3147. i = 0;
  3148. if (m) return m.call(o);
  3149. return {
  3150. next: function next() {
  3151. if (o && i >= o.length) o = void 0;
  3152. return { value: o && o[i++], done: !o };
  3153. }
  3154. };
  3155. };
  3156. var __importStar = this && this.__importStar || function (mod) {
  3157. if (mod && mod.__esModule) return mod;
  3158. var result = {};
  3159. if (mod != null) for (var k in mod) {
  3160. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  3161. }result["default"] = mod;
  3162. return result;
  3163. };
  3164. Object.defineProperty(exports, "__esModule", { value: true });
  3165. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3166. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  3167. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  3168. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts");
  3169. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts"));
  3170. var strings = foundation_1.MDCDialogFoundation.strings;
  3171. var MDCDialog = /** @class */function (_super) {
  3172. __extends(MDCDialog, _super);
  3173. function MDCDialog() {
  3174. return _super !== null && _super.apply(this, arguments) || this;
  3175. }
  3176. Object.defineProperty(MDCDialog.prototype, "isOpen", {
  3177. get: function get() {
  3178. return this.foundation_.isOpen();
  3179. },
  3180. enumerable: true,
  3181. configurable: true
  3182. });
  3183. Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", {
  3184. get: function get() {
  3185. return this.foundation_.getEscapeKeyAction();
  3186. },
  3187. set: function set(action) {
  3188. this.foundation_.setEscapeKeyAction(action);
  3189. },
  3190. enumerable: true,
  3191. configurable: true
  3192. });
  3193. Object.defineProperty(MDCDialog.prototype, "scrimClickAction", {
  3194. get: function get() {
  3195. return this.foundation_.getScrimClickAction();
  3196. },
  3197. set: function set(action) {
  3198. this.foundation_.setScrimClickAction(action);
  3199. },
  3200. enumerable: true,
  3201. configurable: true
  3202. });
  3203. Object.defineProperty(MDCDialog.prototype, "autoStackButtons", {
  3204. get: function get() {
  3205. return this.foundation_.getAutoStackButtons();
  3206. },
  3207. set: function set(autoStack) {
  3208. this.foundation_.setAutoStackButtons(autoStack);
  3209. },
  3210. enumerable: true,
  3211. configurable: true
  3212. });
  3213. MDCDialog.attachTo = function (root) {
  3214. return new MDCDialog(root);
  3215. };
  3216. MDCDialog.prototype.initialize = function (focusTrapFactory) {
  3217. var e_1, _a;
  3218. var container = this.root_.querySelector(strings.CONTAINER_SELECTOR);
  3219. if (!container) {
  3220. throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element");
  3221. }
  3222. this.container_ = container;
  3223. this.content_ = this.root_.querySelector(strings.CONTENT_SELECTOR);
  3224. this.buttons_ = [].slice.call(this.root_.querySelectorAll(strings.BUTTON_SELECTOR));
  3225. this.defaultButton_ = this.root_.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]");
  3226. this.focusTrapFactory_ = focusTrapFactory;
  3227. this.buttonRipples_ = [];
  3228. try {
  3229. for (var _b = __values(this.buttons_), _c = _b.next(); !_c.done; _c = _b.next()) {
  3230. var buttonEl = _c.value;
  3231. this.buttonRipples_.push(new component_2.MDCRipple(buttonEl));
  3232. }
  3233. } catch (e_1_1) {
  3234. e_1 = { error: e_1_1 };
  3235. } finally {
  3236. try {
  3237. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  3238. } finally {
  3239. if (e_1) throw e_1.error;
  3240. }
  3241. }
  3242. };
  3243. MDCDialog.prototype.initialSyncWithDOM = function () {
  3244. var _this = this;
  3245. this.focusTrap_ = util.createFocusTrapInstance(this.container_, this.focusTrapFactory_, this.getInitialFocusEl_() || undefined);
  3246. this.handleClick_ = this.foundation_.handleClick.bind(this.foundation_);
  3247. this.handleKeydown_ = this.foundation_.handleKeydown.bind(this.foundation_);
  3248. this.handleDocumentKeydown_ = this.foundation_.handleDocumentKeydown.bind(this.foundation_);
  3249. this.handleLayout_ = this.layout.bind(this);
  3250. var LAYOUT_EVENTS = ['resize', 'orientationchange'];
  3251. this.handleOpening_ = function () {
  3252. LAYOUT_EVENTS.forEach(function (evtType) {
  3253. return window.addEventListener(evtType, _this.handleLayout_);
  3254. });
  3255. document.addEventListener('keydown', _this.handleDocumentKeydown_);
  3256. };
  3257. this.handleClosing_ = function () {
  3258. LAYOUT_EVENTS.forEach(function (evtType) {
  3259. return window.removeEventListener(evtType, _this.handleLayout_);
  3260. });
  3261. document.removeEventListener('keydown', _this.handleDocumentKeydown_);
  3262. };
  3263. this.listen('click', this.handleClick_);
  3264. this.listen('keydown', this.handleKeydown_);
  3265. this.listen(strings.OPENING_EVENT, this.handleOpening_);
  3266. this.listen(strings.CLOSING_EVENT, this.handleClosing_);
  3267. };
  3268. MDCDialog.prototype.destroy = function () {
  3269. this.unlisten('click', this.handleClick_);
  3270. this.unlisten('keydown', this.handleKeydown_);
  3271. this.unlisten(strings.OPENING_EVENT, this.handleOpening_);
  3272. this.unlisten(strings.CLOSING_EVENT, this.handleClosing_);
  3273. this.handleClosing_();
  3274. this.buttonRipples_.forEach(function (ripple) {
  3275. return ripple.destroy();
  3276. });
  3277. _super.prototype.destroy.call(this);
  3278. };
  3279. MDCDialog.prototype.layout = function () {
  3280. this.foundation_.layout();
  3281. };
  3282. MDCDialog.prototype.open = function () {
  3283. this.foundation_.open();
  3284. };
  3285. MDCDialog.prototype.close = function (action) {
  3286. if (action === void 0) {
  3287. action = '';
  3288. }
  3289. this.foundation_.close(action);
  3290. };
  3291. MDCDialog.prototype.getDefaultFoundation = function () {
  3292. var _this = this;
  3293. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  3294. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  3295. var adapter = {
  3296. addBodyClass: function addBodyClass(className) {
  3297. return document.body.classList.add(className);
  3298. },
  3299. addClass: function addClass(className) {
  3300. return _this.root_.classList.add(className);
  3301. },
  3302. areButtonsStacked: function areButtonsStacked() {
  3303. return util.areTopsMisaligned(_this.buttons_);
  3304. },
  3305. clickDefaultButton: function clickDefaultButton() {
  3306. return _this.defaultButton_ && _this.defaultButton_.click();
  3307. },
  3308. eventTargetMatches: function eventTargetMatches(target, selector) {
  3309. return target ? ponyfill_1.matches(target, selector) : false;
  3310. },
  3311. getActionFromEvent: function getActionFromEvent(evt) {
  3312. if (!evt.target) {
  3313. return '';
  3314. }
  3315. var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]");
  3316. return element && element.getAttribute(strings.ACTION_ATTRIBUTE);
  3317. },
  3318. getInitialFocusEl: function getInitialFocusEl() {
  3319. return _this.getInitialFocusEl_();
  3320. },
  3321. hasClass: function hasClass(className) {
  3322. return _this.root_.classList.contains(className);
  3323. },
  3324. isContentScrollable: function isContentScrollable() {
  3325. return util.isScrollable(_this.content_);
  3326. },
  3327. notifyClosed: function notifyClosed(action) {
  3328. return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {});
  3329. },
  3330. notifyClosing: function notifyClosing(action) {
  3331. return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {});
  3332. },
  3333. notifyOpened: function notifyOpened() {
  3334. return _this.emit(strings.OPENED_EVENT, {});
  3335. },
  3336. notifyOpening: function notifyOpening() {
  3337. return _this.emit(strings.OPENING_EVENT, {});
  3338. },
  3339. releaseFocus: function releaseFocus() {
  3340. return _this.focusTrap_.deactivate();
  3341. },
  3342. removeBodyClass: function removeBodyClass(className) {
  3343. return document.body.classList.remove(className);
  3344. },
  3345. removeClass: function removeClass(className) {
  3346. return _this.root_.classList.remove(className);
  3347. },
  3348. reverseButtons: function reverseButtons() {
  3349. _this.buttons_.reverse();
  3350. _this.buttons_.forEach(function (button) {
  3351. button.parentElement.appendChild(button);
  3352. });
  3353. },
  3354. trapFocus: function trapFocus() {
  3355. return _this.focusTrap_.activate();
  3356. }
  3357. };
  3358. return new foundation_1.MDCDialogFoundation(adapter);
  3359. };
  3360. MDCDialog.prototype.getInitialFocusEl_ = function () {
  3361. return document.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]");
  3362. };
  3363. return MDCDialog;
  3364. }(component_1.MDCComponent);
  3365. exports.MDCDialog = MDCDialog;
  3366. /***/ }),
  3367. /***/ "./packages/mdc-dialog/constants.ts":
  3368. /*!******************************************!*\
  3369. !*** ./packages/mdc-dialog/constants.ts ***!
  3370. \******************************************/
  3371. /*! no static exports found */
  3372. /***/ (function(module, exports, __webpack_require__) {
  3373. "use strict";
  3374. /**
  3375. * @license
  3376. * Copyright 2016 Google Inc.
  3377. *
  3378. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3379. * of this software and associated documentation files (the "Software"), to deal
  3380. * in the Software without restriction, including without limitation the rights
  3381. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3382. * copies of the Software, and to permit persons to whom the Software is
  3383. * furnished to do so, subject to the following conditions:
  3384. *
  3385. * The above copyright notice and this permission notice shall be included in
  3386. * all copies or substantial portions of the Software.
  3387. *
  3388. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3389. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3390. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3391. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3392. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3393. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3394. * THE SOFTWARE.
  3395. */
  3396. Object.defineProperty(exports, "__esModule", { value: true });
  3397. exports.cssClasses = {
  3398. CLOSING: 'mdc-dialog--closing',
  3399. OPEN: 'mdc-dialog--open',
  3400. OPENING: 'mdc-dialog--opening',
  3401. SCROLLABLE: 'mdc-dialog--scrollable',
  3402. SCROLL_LOCK: 'mdc-dialog-scroll-lock',
  3403. STACKED: 'mdc-dialog--stacked'
  3404. };
  3405. exports.strings = {
  3406. ACTION_ATTRIBUTE: 'data-mdc-dialog-action',
  3407. BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',
  3408. BUTTON_SELECTOR: '.mdc-dialog__button',
  3409. CLOSED_EVENT: 'MDCDialog:closed',
  3410. CLOSE_ACTION: 'close',
  3411. CLOSING_EVENT: 'MDCDialog:closing',
  3412. CONTAINER_SELECTOR: '.mdc-dialog__container',
  3413. CONTENT_SELECTOR: '.mdc-dialog__content',
  3414. DESTROY_ACTION: 'destroy',
  3415. INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',
  3416. OPENED_EVENT: 'MDCDialog:opened',
  3417. OPENING_EVENT: 'MDCDialog:opening',
  3418. SCRIM_SELECTOR: '.mdc-dialog__scrim',
  3419. SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item'].join(', '),
  3420. SURFACE_SELECTOR: '.mdc-dialog__surface'
  3421. };
  3422. exports.numbers = {
  3423. DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
  3424. DIALOG_ANIMATION_OPEN_TIME_MS: 150
  3425. };
  3426. /***/ }),
  3427. /***/ "./packages/mdc-dialog/foundation.ts":
  3428. /*!*******************************************!*\
  3429. !*** ./packages/mdc-dialog/foundation.ts ***!
  3430. \*******************************************/
  3431. /*! no static exports found */
  3432. /***/ (function(module, exports, __webpack_require__) {
  3433. "use strict";
  3434. /**
  3435. * @license
  3436. * Copyright 2017 Google Inc.
  3437. *
  3438. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3439. * of this software and associated documentation files (the "Software"), to deal
  3440. * in the Software without restriction, including without limitation the rights
  3441. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3442. * copies of the Software, and to permit persons to whom the Software is
  3443. * furnished to do so, subject to the following conditions:
  3444. *
  3445. * The above copyright notice and this permission notice shall be included in
  3446. * all copies or substantial portions of the Software.
  3447. *
  3448. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3449. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3450. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3451. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3452. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3453. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3454. * THE SOFTWARE.
  3455. */
  3456. var __extends = this && this.__extends || function () {
  3457. var _extendStatics = function extendStatics(d, b) {
  3458. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3459. d.__proto__ = b;
  3460. } || function (d, b) {
  3461. for (var p in b) {
  3462. if (b.hasOwnProperty(p)) d[p] = b[p];
  3463. }
  3464. };
  3465. return _extendStatics(d, b);
  3466. };
  3467. return function (d, b) {
  3468. _extendStatics(d, b);
  3469. function __() {
  3470. this.constructor = d;
  3471. }
  3472. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3473. };
  3474. }();
  3475. var __assign = this && this.__assign || function () {
  3476. __assign = Object.assign || function (t) {
  3477. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3478. s = arguments[i];
  3479. for (var p in s) {
  3480. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3481. }
  3482. }
  3483. return t;
  3484. };
  3485. return __assign.apply(this, arguments);
  3486. };
  3487. Object.defineProperty(exports, "__esModule", { value: true });
  3488. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  3489. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts");
  3490. var MDCDialogFoundation = /** @class */function (_super) {
  3491. __extends(MDCDialogFoundation, _super);
  3492. function MDCDialogFoundation(adapter) {
  3493. var _this = _super.call(this, __assign({}, MDCDialogFoundation.defaultAdapter, adapter)) || this;
  3494. _this.isOpen_ = false;
  3495. _this.animationFrame_ = 0;
  3496. _this.animationTimer_ = 0;
  3497. _this.layoutFrame_ = 0;
  3498. _this.escapeKeyAction_ = constants_1.strings.CLOSE_ACTION;
  3499. _this.scrimClickAction_ = constants_1.strings.CLOSE_ACTION;
  3500. _this.autoStackButtons_ = true;
  3501. _this.areButtonsStacked_ = false;
  3502. return _this;
  3503. }
  3504. Object.defineProperty(MDCDialogFoundation, "cssClasses", {
  3505. get: function get() {
  3506. return constants_1.cssClasses;
  3507. },
  3508. enumerable: true,
  3509. configurable: true
  3510. });
  3511. Object.defineProperty(MDCDialogFoundation, "strings", {
  3512. get: function get() {
  3513. return constants_1.strings;
  3514. },
  3515. enumerable: true,
  3516. configurable: true
  3517. });
  3518. Object.defineProperty(MDCDialogFoundation, "numbers", {
  3519. get: function get() {
  3520. return constants_1.numbers;
  3521. },
  3522. enumerable: true,
  3523. configurable: true
  3524. });
  3525. Object.defineProperty(MDCDialogFoundation, "defaultAdapter", {
  3526. get: function get() {
  3527. return {
  3528. addBodyClass: function addBodyClass() {
  3529. return undefined;
  3530. },
  3531. addClass: function addClass() {
  3532. return undefined;
  3533. },
  3534. areButtonsStacked: function areButtonsStacked() {
  3535. return false;
  3536. },
  3537. clickDefaultButton: function clickDefaultButton() {
  3538. return undefined;
  3539. },
  3540. eventTargetMatches: function eventTargetMatches() {
  3541. return false;
  3542. },
  3543. getActionFromEvent: function getActionFromEvent() {
  3544. return '';
  3545. },
  3546. getInitialFocusEl: function getInitialFocusEl() {
  3547. return null;
  3548. },
  3549. hasClass: function hasClass() {
  3550. return false;
  3551. },
  3552. isContentScrollable: function isContentScrollable() {
  3553. return false;
  3554. },
  3555. notifyClosed: function notifyClosed() {
  3556. return undefined;
  3557. },
  3558. notifyClosing: function notifyClosing() {
  3559. return undefined;
  3560. },
  3561. notifyOpened: function notifyOpened() {
  3562. return undefined;
  3563. },
  3564. notifyOpening: function notifyOpening() {
  3565. return undefined;
  3566. },
  3567. releaseFocus: function releaseFocus() {
  3568. return undefined;
  3569. },
  3570. removeBodyClass: function removeBodyClass() {
  3571. return undefined;
  3572. },
  3573. removeClass: function removeClass() {
  3574. return undefined;
  3575. },
  3576. reverseButtons: function reverseButtons() {
  3577. return undefined;
  3578. },
  3579. trapFocus: function trapFocus() {
  3580. return undefined;
  3581. }
  3582. };
  3583. },
  3584. enumerable: true,
  3585. configurable: true
  3586. });
  3587. MDCDialogFoundation.prototype.init = function () {
  3588. if (this.adapter_.hasClass(constants_1.cssClasses.STACKED)) {
  3589. this.setAutoStackButtons(false);
  3590. }
  3591. };
  3592. MDCDialogFoundation.prototype.destroy = function () {
  3593. if (this.isOpen_) {
  3594. this.close(constants_1.strings.DESTROY_ACTION);
  3595. }
  3596. if (this.animationTimer_) {
  3597. clearTimeout(this.animationTimer_);
  3598. this.handleAnimationTimerEnd_();
  3599. }
  3600. if (this.layoutFrame_) {
  3601. cancelAnimationFrame(this.layoutFrame_);
  3602. this.layoutFrame_ = 0;
  3603. }
  3604. };
  3605. MDCDialogFoundation.prototype.open = function () {
  3606. var _this = this;
  3607. this.isOpen_ = true;
  3608. this.adapter_.notifyOpening();
  3609. this.adapter_.addClass(constants_1.cssClasses.OPENING);
  3610. // Wait a frame once display is no longer "none", to establish basis for animation
  3611. this.runNextAnimationFrame_(function () {
  3612. _this.adapter_.addClass(constants_1.cssClasses.OPEN);
  3613. _this.adapter_.addBodyClass(constants_1.cssClasses.SCROLL_LOCK);
  3614. _this.layout();
  3615. _this.animationTimer_ = setTimeout(function () {
  3616. _this.handleAnimationTimerEnd_();
  3617. _this.adapter_.trapFocus(_this.adapter_.getInitialFocusEl());
  3618. _this.adapter_.notifyOpened();
  3619. }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS);
  3620. });
  3621. };
  3622. MDCDialogFoundation.prototype.close = function (action) {
  3623. var _this = this;
  3624. if (action === void 0) {
  3625. action = '';
  3626. }
  3627. if (!this.isOpen_) {
  3628. // Avoid redundant close calls (and events), e.g. from keydown on elements that inherently emit click
  3629. return;
  3630. }
  3631. this.isOpen_ = false;
  3632. this.adapter_.notifyClosing(action);
  3633. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  3634. this.adapter_.removeClass(constants_1.cssClasses.OPEN);
  3635. this.adapter_.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK);
  3636. cancelAnimationFrame(this.animationFrame_);
  3637. this.animationFrame_ = 0;
  3638. clearTimeout(this.animationTimer_);
  3639. this.animationTimer_ = setTimeout(function () {
  3640. _this.adapter_.releaseFocus();
  3641. _this.handleAnimationTimerEnd_();
  3642. _this.adapter_.notifyClosed(action);
  3643. }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);
  3644. };
  3645. MDCDialogFoundation.prototype.isOpen = function () {
  3646. return this.isOpen_;
  3647. };
  3648. MDCDialogFoundation.prototype.getEscapeKeyAction = function () {
  3649. return this.escapeKeyAction_;
  3650. };
  3651. MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {
  3652. this.escapeKeyAction_ = action;
  3653. };
  3654. MDCDialogFoundation.prototype.getScrimClickAction = function () {
  3655. return this.scrimClickAction_;
  3656. };
  3657. MDCDialogFoundation.prototype.setScrimClickAction = function (action) {
  3658. this.scrimClickAction_ = action;
  3659. };
  3660. MDCDialogFoundation.prototype.getAutoStackButtons = function () {
  3661. return this.autoStackButtons_;
  3662. };
  3663. MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {
  3664. this.autoStackButtons_ = autoStack;
  3665. };
  3666. MDCDialogFoundation.prototype.layout = function () {
  3667. var _this = this;
  3668. if (this.layoutFrame_) {
  3669. cancelAnimationFrame(this.layoutFrame_);
  3670. }
  3671. this.layoutFrame_ = requestAnimationFrame(function () {
  3672. _this.layoutInternal_();
  3673. _this.layoutFrame_ = 0;
  3674. });
  3675. };
  3676. /** Handles click on the dialog root element. */
  3677. MDCDialogFoundation.prototype.handleClick = function (evt) {
  3678. var isScrim = this.adapter_.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR);
  3679. // Check for scrim click first since it doesn't require querying ancestors.
  3680. if (isScrim && this.scrimClickAction_ !== '') {
  3681. this.close(this.scrimClickAction_);
  3682. } else {
  3683. var action = this.adapter_.getActionFromEvent(evt);
  3684. if (action) {
  3685. this.close(action);
  3686. }
  3687. }
  3688. };
  3689. /** Handles keydown on the dialog root element. */
  3690. MDCDialogFoundation.prototype.handleKeydown = function (evt) {
  3691. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  3692. if (!isEnter) {
  3693. return;
  3694. }
  3695. var action = this.adapter_.getActionFromEvent(evt);
  3696. if (action) {
  3697. // Action button callback is handled in `handleClick`,
  3698. // since space/enter keydowns on buttons trigger click events.
  3699. return;
  3700. }
  3701. var isDefault = !this.adapter_.eventTargetMatches(evt.target, constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR);
  3702. if (isEnter && isDefault) {
  3703. this.adapter_.clickDefaultButton();
  3704. }
  3705. };
  3706. /** Handles keydown on the document. */
  3707. MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {
  3708. var isEscape = evt.key === 'Escape' || evt.keyCode === 27;
  3709. if (isEscape && this.escapeKeyAction_ !== '') {
  3710. this.close(this.escapeKeyAction_);
  3711. }
  3712. };
  3713. MDCDialogFoundation.prototype.layoutInternal_ = function () {
  3714. if (this.autoStackButtons_) {
  3715. this.detectStackedButtons_();
  3716. }
  3717. this.detectScrollableContent_();
  3718. };
  3719. MDCDialogFoundation.prototype.handleAnimationTimerEnd_ = function () {
  3720. this.animationTimer_ = 0;
  3721. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  3722. this.adapter_.removeClass(constants_1.cssClasses.CLOSING);
  3723. };
  3724. /**
  3725. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  3726. */
  3727. MDCDialogFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  3728. var _this = this;
  3729. cancelAnimationFrame(this.animationFrame_);
  3730. this.animationFrame_ = requestAnimationFrame(function () {
  3731. _this.animationFrame_ = 0;
  3732. clearTimeout(_this.animationTimer_);
  3733. _this.animationTimer_ = setTimeout(callback, 0);
  3734. });
  3735. };
  3736. MDCDialogFoundation.prototype.detectStackedButtons_ = function () {
  3737. // Remove the class first to let us measure the buttons' natural positions.
  3738. this.adapter_.removeClass(constants_1.cssClasses.STACKED);
  3739. var areButtonsStacked = this.adapter_.areButtonsStacked();
  3740. if (areButtonsStacked) {
  3741. this.adapter_.addClass(constants_1.cssClasses.STACKED);
  3742. }
  3743. if (areButtonsStacked !== this.areButtonsStacked_) {
  3744. this.adapter_.reverseButtons();
  3745. this.areButtonsStacked_ = areButtonsStacked;
  3746. }
  3747. };
  3748. MDCDialogFoundation.prototype.detectScrollableContent_ = function () {
  3749. // Remove the class first to let us measure the natural height of the content.
  3750. this.adapter_.removeClass(constants_1.cssClasses.SCROLLABLE);
  3751. if (this.adapter_.isContentScrollable()) {
  3752. this.adapter_.addClass(constants_1.cssClasses.SCROLLABLE);
  3753. }
  3754. };
  3755. return MDCDialogFoundation;
  3756. }(foundation_1.MDCFoundation);
  3757. exports.MDCDialogFoundation = MDCDialogFoundation;
  3758. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3759. exports.default = MDCDialogFoundation;
  3760. /***/ }),
  3761. /***/ "./packages/mdc-dialog/index.ts":
  3762. /*!**************************************!*\
  3763. !*** ./packages/mdc-dialog/index.ts ***!
  3764. \**************************************/
  3765. /*! no static exports found */
  3766. /***/ (function(module, exports, __webpack_require__) {
  3767. "use strict";
  3768. /**
  3769. * @license
  3770. * Copyright 2019 Google Inc.
  3771. *
  3772. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3773. * of this software and associated documentation files (the "Software"), to deal
  3774. * in the Software without restriction, including without limitation the rights
  3775. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3776. * copies of the Software, and to permit persons to whom the Software is
  3777. * furnished to do so, subject to the following conditions:
  3778. *
  3779. * The above copyright notice and this permission notice shall be included in
  3780. * all copies or substantial portions of the Software.
  3781. *
  3782. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3783. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3784. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3785. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3786. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3787. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3788. * THE SOFTWARE.
  3789. */
  3790. function __export(m) {
  3791. for (var p in m) {
  3792. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  3793. }
  3794. }
  3795. var __importStar = this && this.__importStar || function (mod) {
  3796. if (mod && mod.__esModule) return mod;
  3797. var result = {};
  3798. if (mod != null) for (var k in mod) {
  3799. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  3800. }result["default"] = mod;
  3801. return result;
  3802. };
  3803. Object.defineProperty(exports, "__esModule", { value: true });
  3804. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts"));
  3805. exports.util = util;
  3806. __export(__webpack_require__(/*! ./component */ "./packages/mdc-dialog/component.ts"));
  3807. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"));
  3808. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"));
  3809. /***/ }),
  3810. /***/ "./packages/mdc-dialog/node_modules/focus-trap/index.js":
  3811. /*!**************************************************************!*\
  3812. !*** ./packages/mdc-dialog/node_modules/focus-trap/index.js ***!
  3813. \**************************************************************/
  3814. /*! no static exports found */
  3815. /***/ (function(module, exports, __webpack_require__) {
  3816. var tabbable = __webpack_require__(/*! tabbable */ "./packages/mdc-dialog/node_modules/tabbable/index.js");
  3817. var xtend = __webpack_require__(/*! xtend */ "./packages/mdc-dialog/node_modules/xtend/immutable.js");
  3818. var activeFocusTraps = (function() {
  3819. var trapQueue = [];
  3820. return {
  3821. activateTrap: function(trap) {
  3822. if (trapQueue.length > 0) {
  3823. var activeTrap = trapQueue[trapQueue.length - 1];
  3824. if (activeTrap !== trap) {
  3825. activeTrap.pause();
  3826. }
  3827. }
  3828. var trapIndex = trapQueue.indexOf(trap);
  3829. if (trapIndex === -1) {
  3830. trapQueue.push(trap);
  3831. } else {
  3832. // move this existing trap to the front of the queue
  3833. trapQueue.splice(trapIndex, 1);
  3834. trapQueue.push(trap);
  3835. }
  3836. },
  3837. deactivateTrap: function(trap) {
  3838. var trapIndex = trapQueue.indexOf(trap);
  3839. if (trapIndex !== -1) {
  3840. trapQueue.splice(trapIndex, 1);
  3841. }
  3842. if (trapQueue.length > 0) {
  3843. trapQueue[trapQueue.length - 1].unpause();
  3844. }
  3845. }
  3846. };
  3847. })();
  3848. function focusTrap(element, userOptions) {
  3849. var doc = document;
  3850. var container =
  3851. typeof element === 'string' ? doc.querySelector(element) : element;
  3852. var config = xtend(
  3853. {
  3854. returnFocusOnDeactivate: true,
  3855. escapeDeactivates: true
  3856. },
  3857. userOptions
  3858. );
  3859. var state = {
  3860. firstTabbableNode: null,
  3861. lastTabbableNode: null,
  3862. nodeFocusedBeforeActivation: null,
  3863. mostRecentlyFocusedNode: null,
  3864. active: false,
  3865. paused: false
  3866. };
  3867. var trap = {
  3868. activate: activate,
  3869. deactivate: deactivate,
  3870. pause: pause,
  3871. unpause: unpause
  3872. };
  3873. return trap;
  3874. function activate(activateOptions) {
  3875. if (state.active) return;
  3876. updateTabbableNodes();
  3877. state.active = true;
  3878. state.paused = false;
  3879. state.nodeFocusedBeforeActivation = doc.activeElement;
  3880. var onActivate =
  3881. activateOptions && activateOptions.onActivate
  3882. ? activateOptions.onActivate
  3883. : config.onActivate;
  3884. if (onActivate) {
  3885. onActivate();
  3886. }
  3887. addListeners();
  3888. return trap;
  3889. }
  3890. function deactivate(deactivateOptions) {
  3891. if (!state.active) return;
  3892. removeListeners();
  3893. state.active = false;
  3894. state.paused = false;
  3895. activeFocusTraps.deactivateTrap(trap);
  3896. var onDeactivate =
  3897. deactivateOptions && deactivateOptions.onDeactivate !== undefined
  3898. ? deactivateOptions.onDeactivate
  3899. : config.onDeactivate;
  3900. if (onDeactivate) {
  3901. onDeactivate();
  3902. }
  3903. var returnFocus =
  3904. deactivateOptions && deactivateOptions.returnFocus !== undefined
  3905. ? deactivateOptions.returnFocus
  3906. : config.returnFocusOnDeactivate;
  3907. if (returnFocus) {
  3908. delay(function() {
  3909. tryFocus(state.nodeFocusedBeforeActivation);
  3910. });
  3911. }
  3912. return trap;
  3913. }
  3914. function pause() {
  3915. if (state.paused || !state.active) return;
  3916. state.paused = true;
  3917. removeListeners();
  3918. }
  3919. function unpause() {
  3920. if (!state.paused || !state.active) return;
  3921. state.paused = false;
  3922. updateTabbableNodes();
  3923. addListeners();
  3924. }
  3925. function addListeners() {
  3926. if (!state.active) return;
  3927. // There can be only one listening focus trap at a time
  3928. activeFocusTraps.activateTrap(trap);
  3929. // Delay ensures that the focused element doesn't capture the event
  3930. // that caused the focus trap activation.
  3931. delay(function() {
  3932. tryFocus(getInitialFocusNode());
  3933. });
  3934. doc.addEventListener('focusin', checkFocusIn, true);
  3935. doc.addEventListener('mousedown', checkPointerDown, {
  3936. capture: true,
  3937. passive: false
  3938. });
  3939. doc.addEventListener('touchstart', checkPointerDown, {
  3940. capture: true,
  3941. passive: false
  3942. });
  3943. doc.addEventListener('click', checkClick, {
  3944. capture: true,
  3945. passive: false
  3946. });
  3947. doc.addEventListener('keydown', checkKey, {
  3948. capture: true,
  3949. passive: false
  3950. });
  3951. return trap;
  3952. }
  3953. function removeListeners() {
  3954. if (!state.active) return;
  3955. doc.removeEventListener('focusin', checkFocusIn, true);
  3956. doc.removeEventListener('mousedown', checkPointerDown, true);
  3957. doc.removeEventListener('touchstart', checkPointerDown, true);
  3958. doc.removeEventListener('click', checkClick, true);
  3959. doc.removeEventListener('keydown', checkKey, true);
  3960. return trap;
  3961. }
  3962. function getNodeForOption(optionName) {
  3963. var optionValue = config[optionName];
  3964. var node = optionValue;
  3965. if (!optionValue) {
  3966. return null;
  3967. }
  3968. if (typeof optionValue === 'string') {
  3969. node = doc.querySelector(optionValue);
  3970. if (!node) {
  3971. throw new Error('`' + optionName + '` refers to no known node');
  3972. }
  3973. }
  3974. if (typeof optionValue === 'function') {
  3975. node = optionValue();
  3976. if (!node) {
  3977. throw new Error('`' + optionName + '` did not return a node');
  3978. }
  3979. }
  3980. return node;
  3981. }
  3982. function getInitialFocusNode() {
  3983. var node;
  3984. if (getNodeForOption('initialFocus') !== null) {
  3985. node = getNodeForOption('initialFocus');
  3986. } else if (container.contains(doc.activeElement)) {
  3987. node = doc.activeElement;
  3988. } else {
  3989. node = state.firstTabbableNode || getNodeForOption('fallbackFocus');
  3990. }
  3991. if (!node) {
  3992. throw new Error(
  3993. "You can't have a focus-trap without at least one focusable element"
  3994. );
  3995. }
  3996. return node;
  3997. }
  3998. // This needs to be done on mousedown and touchstart instead of click
  3999. // so that it precedes the focus event.
  4000. function checkPointerDown(e) {
  4001. if (container.contains(e.target)) return;
  4002. if (config.clickOutsideDeactivates) {
  4003. deactivate({
  4004. returnFocus: !tabbable.isFocusable(e.target)
  4005. });
  4006. } else {
  4007. e.preventDefault();
  4008. }
  4009. }
  4010. // In case focus escapes the trap for some strange reason, pull it back in.
  4011. function checkFocusIn(e) {
  4012. // In Firefox when you Tab out of an iframe the Document is briefly focused.
  4013. if (container.contains(e.target) || e.target instanceof Document) {
  4014. return;
  4015. }
  4016. e.stopImmediatePropagation();
  4017. tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
  4018. }
  4019. function checkKey(e) {
  4020. if (config.escapeDeactivates !== false && isEscapeEvent(e)) {
  4021. e.preventDefault();
  4022. deactivate();
  4023. return;
  4024. }
  4025. if (isTabEvent(e)) {
  4026. checkTab(e);
  4027. return;
  4028. }
  4029. }
  4030. // Hijack Tab events on the first and last focusable nodes of the trap,
  4031. // in order to prevent focus from escaping. If it escapes for even a
  4032. // moment it can end up scrolling the page and causing confusion so we
  4033. // kind of need to capture the action at the keydown phase.
  4034. function checkTab(e) {
  4035. updateTabbableNodes();
  4036. if (e.shiftKey && e.target === state.firstTabbableNode) {
  4037. e.preventDefault();
  4038. tryFocus(state.lastTabbableNode);
  4039. return;
  4040. }
  4041. if (!e.shiftKey && e.target === state.lastTabbableNode) {
  4042. e.preventDefault();
  4043. tryFocus(state.firstTabbableNode);
  4044. return;
  4045. }
  4046. }
  4047. function checkClick(e) {
  4048. if (config.clickOutsideDeactivates) return;
  4049. if (container.contains(e.target)) return;
  4050. e.preventDefault();
  4051. e.stopImmediatePropagation();
  4052. }
  4053. function updateTabbableNodes() {
  4054. var tabbableNodes = tabbable(container);
  4055. state.firstTabbableNode = tabbableNodes[0] || getInitialFocusNode();
  4056. state.lastTabbableNode =
  4057. tabbableNodes[tabbableNodes.length - 1] || getInitialFocusNode();
  4058. }
  4059. function tryFocus(node) {
  4060. if (node === doc.activeElement) return;
  4061. if (!node || !node.focus) {
  4062. tryFocus(getInitialFocusNode());
  4063. return;
  4064. }
  4065. node.focus();
  4066. state.mostRecentlyFocusedNode = node;
  4067. if (isSelectableInput(node)) {
  4068. node.select();
  4069. }
  4070. }
  4071. }
  4072. function isSelectableInput(node) {
  4073. return (
  4074. node.tagName &&
  4075. node.tagName.toLowerCase() === 'input' &&
  4076. typeof node.select === 'function'
  4077. );
  4078. }
  4079. function isEscapeEvent(e) {
  4080. return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
  4081. }
  4082. function isTabEvent(e) {
  4083. return e.key === 'Tab' || e.keyCode === 9;
  4084. }
  4085. function delay(fn) {
  4086. return setTimeout(fn, 0);
  4087. }
  4088. module.exports = focusTrap;
  4089. /***/ }),
  4090. /***/ "./packages/mdc-dialog/node_modules/tabbable/index.js":
  4091. /*!************************************************************!*\
  4092. !*** ./packages/mdc-dialog/node_modules/tabbable/index.js ***!
  4093. \************************************************************/
  4094. /*! no static exports found */
  4095. /***/ (function(module, exports) {
  4096. var candidateSelectors = [
  4097. 'input',
  4098. 'select',
  4099. 'textarea',
  4100. 'a[href]',
  4101. 'button',
  4102. '[tabindex]',
  4103. 'audio[controls]',
  4104. 'video[controls]',
  4105. '[contenteditable]:not([contenteditable="false"])',
  4106. ];
  4107. var candidateSelector = candidateSelectors.join(',');
  4108. var matches = typeof Element === 'undefined'
  4109. ? function () {}
  4110. : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  4111. function tabbable(el, options) {
  4112. options = options || {};
  4113. var regularTabbables = [];
  4114. var orderedTabbables = [];
  4115. var candidates = el.querySelectorAll(candidateSelector);
  4116. if (options.includeContainer) {
  4117. if (matches.call(el, candidateSelector)) {
  4118. candidates = Array.prototype.slice.apply(candidates);
  4119. candidates.unshift(el);
  4120. }
  4121. }
  4122. var i, candidate, candidateTabindex;
  4123. for (i = 0; i < candidates.length; i++) {
  4124. candidate = candidates[i];
  4125. if (!isNodeMatchingSelectorTabbable(candidate)) continue;
  4126. candidateTabindex = getTabindex(candidate);
  4127. if (candidateTabindex === 0) {
  4128. regularTabbables.push(candidate);
  4129. } else {
  4130. orderedTabbables.push({
  4131. documentOrder: i,
  4132. tabIndex: candidateTabindex,
  4133. node: candidate,
  4134. });
  4135. }
  4136. }
  4137. var tabbableNodes = orderedTabbables
  4138. .sort(sortOrderedTabbables)
  4139. .map(function(a) { return a.node })
  4140. .concat(regularTabbables);
  4141. return tabbableNodes;
  4142. }
  4143. tabbable.isTabbable = isTabbable;
  4144. tabbable.isFocusable = isFocusable;
  4145. function isNodeMatchingSelectorTabbable(node) {
  4146. if (
  4147. !isNodeMatchingSelectorFocusable(node)
  4148. || isNonTabbableRadio(node)
  4149. || getTabindex(node) < 0
  4150. ) {
  4151. return false;
  4152. }
  4153. return true;
  4154. }
  4155. function isTabbable(node) {
  4156. if (!node) throw new Error('No node provided');
  4157. if (matches.call(node, candidateSelector) === false) return false;
  4158. return isNodeMatchingSelectorTabbable(node);
  4159. }
  4160. function isNodeMatchingSelectorFocusable(node) {
  4161. if (
  4162. node.disabled
  4163. || isHiddenInput(node)
  4164. || isHidden(node)
  4165. ) {
  4166. return false;
  4167. }
  4168. return true;
  4169. }
  4170. var focusableCandidateSelector = candidateSelectors.concat('iframe').join(',');
  4171. function isFocusable(node) {
  4172. if (!node) throw new Error('No node provided');
  4173. if (matches.call(node, focusableCandidateSelector) === false) return false;
  4174. return isNodeMatchingSelectorFocusable(node);
  4175. }
  4176. function getTabindex(node) {
  4177. var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
  4178. if (!isNaN(tabindexAttr)) return tabindexAttr;
  4179. // Browsers do not return `tabIndex` correctly for contentEditable nodes;
  4180. // so if they don't have a tabindex attribute specifically set, assume it's 0.
  4181. if (isContentEditable(node)) return 0;
  4182. return node.tabIndex;
  4183. }
  4184. function sortOrderedTabbables(a, b) {
  4185. return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
  4186. }
  4187. function isContentEditable(node) {
  4188. return node.contentEditable === 'true';
  4189. }
  4190. function isInput(node) {
  4191. return node.tagName === 'INPUT';
  4192. }
  4193. function isHiddenInput(node) {
  4194. return isInput(node) && node.type === 'hidden';
  4195. }
  4196. function isRadio(node) {
  4197. return isInput(node) && node.type === 'radio';
  4198. }
  4199. function isNonTabbableRadio(node) {
  4200. return isRadio(node) && !isTabbableRadio(node);
  4201. }
  4202. function getCheckedRadio(nodes) {
  4203. for (var i = 0; i < nodes.length; i++) {
  4204. if (nodes[i].checked) {
  4205. return nodes[i];
  4206. }
  4207. }
  4208. }
  4209. function isTabbableRadio(node) {
  4210. if (!node.name) return true;
  4211. // This won't account for the edge case where you have radio groups with the same
  4212. // in separate forms on the same page.
  4213. var radioSet = node.ownerDocument.querySelectorAll('input[type="radio"][name="' + node.name + '"]');
  4214. var checked = getCheckedRadio(radioSet);
  4215. return !checked || checked === node;
  4216. }
  4217. function isHidden(node) {
  4218. // offsetParent being null will allow detecting cases where an element is invisible or inside an invisible element,
  4219. // as long as the element does not use position: fixed. For them, their visibility has to be checked directly as well.
  4220. return node.offsetParent === null || getComputedStyle(node).visibility === 'hidden';
  4221. }
  4222. module.exports = tabbable;
  4223. /***/ }),
  4224. /***/ "./packages/mdc-dialog/node_modules/xtend/immutable.js":
  4225. /*!*************************************************************!*\
  4226. !*** ./packages/mdc-dialog/node_modules/xtend/immutable.js ***!
  4227. \*************************************************************/
  4228. /*! no static exports found */
  4229. /***/ (function(module, exports) {
  4230. module.exports = extend
  4231. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4232. function extend() {
  4233. var target = {}
  4234. for (var i = 0; i < arguments.length; i++) {
  4235. var source = arguments[i]
  4236. for (var key in source) {
  4237. if (hasOwnProperty.call(source, key)) {
  4238. target[key] = source[key]
  4239. }
  4240. }
  4241. }
  4242. return target
  4243. }
  4244. /***/ }),
  4245. /***/ "./packages/mdc-dialog/util.ts":
  4246. /*!*************************************!*\
  4247. !*** ./packages/mdc-dialog/util.ts ***!
  4248. \*************************************/
  4249. /*! no static exports found */
  4250. /***/ (function(module, exports, __webpack_require__) {
  4251. "use strict";
  4252. /**
  4253. * @license
  4254. * Copyright 2016 Google Inc.
  4255. *
  4256. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4257. * of this software and associated documentation files (the "Software"), to deal
  4258. * in the Software without restriction, including without limitation the rights
  4259. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4260. * copies of the Software, and to permit persons to whom the Software is
  4261. * furnished to do so, subject to the following conditions:
  4262. *
  4263. * The above copyright notice and this permission notice shall be included in
  4264. * all copies or substantial portions of the Software.
  4265. *
  4266. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4267. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4268. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4269. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4270. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4271. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4272. * THE SOFTWARE.
  4273. */
  4274. var __importDefault = this && this.__importDefault || function (mod) {
  4275. return mod && mod.__esModule ? mod : { "default": mod };
  4276. };
  4277. Object.defineProperty(exports, "__esModule", { value: true });
  4278. var focus_trap_1 = __importDefault(__webpack_require__(/*! focus-trap */ "./packages/mdc-dialog/node_modules/focus-trap/index.js"));
  4279. function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) {
  4280. if (focusTrapFactory === void 0) {
  4281. focusTrapFactory = focus_trap_1.default;
  4282. }
  4283. return focusTrapFactory(surfaceEl, {
  4284. clickOutsideDeactivates: true,
  4285. escapeDeactivates: false,
  4286. initialFocus: initialFocusEl
  4287. });
  4288. }
  4289. exports.createFocusTrapInstance = createFocusTrapInstance;
  4290. function isScrollable(el) {
  4291. return el ? el.scrollHeight > el.offsetHeight : false;
  4292. }
  4293. exports.isScrollable = isScrollable;
  4294. function areTopsMisaligned(els) {
  4295. var tops = new Set();
  4296. [].forEach.call(els, function (el) {
  4297. return tops.add(el.offsetTop);
  4298. });
  4299. return tops.size > 1;
  4300. }
  4301. exports.areTopsMisaligned = areTopsMisaligned;
  4302. /***/ }),
  4303. /***/ "./packages/mdc-dom/events.ts":
  4304. /*!************************************!*\
  4305. !*** ./packages/mdc-dom/events.ts ***!
  4306. \************************************/
  4307. /*! no static exports found */
  4308. /***/ (function(module, exports, __webpack_require__) {
  4309. "use strict";
  4310. /**
  4311. * @license
  4312. * Copyright 2019 Google Inc.
  4313. *
  4314. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4315. * of this software and associated documentation files (the "Software"), to deal
  4316. * in the Software without restriction, including without limitation the rights
  4317. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4318. * copies of the Software, and to permit persons to whom the Software is
  4319. * furnished to do so, subject to the following conditions:
  4320. *
  4321. * The above copyright notice and this permission notice shall be included in
  4322. * all copies or substantial portions of the Software.
  4323. *
  4324. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4325. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4326. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4327. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4328. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4329. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4330. * THE SOFTWARE.
  4331. */
  4332. Object.defineProperty(exports, "__esModule", { value: true });
  4333. /**
  4334. * Stores result from applyPassive to avoid redundant processing to detect
  4335. * passive event listener support.
  4336. */
  4337. var supportsPassive_;
  4338. /**
  4339. * Determine whether the current browser supports passive event listeners, and
  4340. * if so, use them.
  4341. */
  4342. function applyPassive(globalObj, forceRefresh) {
  4343. if (globalObj === void 0) {
  4344. globalObj = window;
  4345. }
  4346. if (forceRefresh === void 0) {
  4347. forceRefresh = false;
  4348. }
  4349. if (supportsPassive_ === undefined || forceRefresh) {
  4350. var isSupported_1 = false;
  4351. try {
  4352. globalObj.document.addEventListener('test', function () {
  4353. return undefined;
  4354. }, {
  4355. get passive() {
  4356. isSupported_1 = true;
  4357. return isSupported_1;
  4358. }
  4359. });
  4360. } catch (e) {} // tslint:disable-line:no-empty cannot throw error due to tests. tslint also disables console.log.
  4361. supportsPassive_ = isSupported_1;
  4362. }
  4363. return supportsPassive_ ? { passive: true } : false;
  4364. }
  4365. exports.applyPassive = applyPassive;
  4366. /***/ }),
  4367. /***/ "./packages/mdc-dom/index.ts":
  4368. /*!***********************************!*\
  4369. !*** ./packages/mdc-dom/index.ts ***!
  4370. \***********************************/
  4371. /*! no static exports found */
  4372. /***/ (function(module, exports, __webpack_require__) {
  4373. "use strict";
  4374. /**
  4375. * @license
  4376. * Copyright 2018 Google Inc.
  4377. *
  4378. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4379. * of this software and associated documentation files (the "Software"), to deal
  4380. * in the Software without restriction, including without limitation the rights
  4381. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4382. * copies of the Software, and to permit persons to whom the Software is
  4383. * furnished to do so, subject to the following conditions:
  4384. *
  4385. * The above copyright notice and this permission notice shall be included in
  4386. * all copies or substantial portions of the Software.
  4387. *
  4388. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4389. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4390. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4391. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4392. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4393. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4394. * THE SOFTWARE.
  4395. */
  4396. var __importStar = this && this.__importStar || function (mod) {
  4397. if (mod && mod.__esModule) return mod;
  4398. var result = {};
  4399. if (mod != null) for (var k in mod) {
  4400. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  4401. }result["default"] = mod;
  4402. return result;
  4403. };
  4404. Object.defineProperty(exports, "__esModule", { value: true });
  4405. var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts"));
  4406. exports.events = events;
  4407. var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  4408. exports.ponyfill = ponyfill;
  4409. /***/ }),
  4410. /***/ "./packages/mdc-dom/ponyfill.ts":
  4411. /*!**************************************!*\
  4412. !*** ./packages/mdc-dom/ponyfill.ts ***!
  4413. \**************************************/
  4414. /*! no static exports found */
  4415. /***/ (function(module, exports, __webpack_require__) {
  4416. "use strict";
  4417. /**
  4418. * @license
  4419. * Copyright 2018 Google Inc.
  4420. *
  4421. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4422. * of this software and associated documentation files (the "Software"), to deal
  4423. * in the Software without restriction, including without limitation the rights
  4424. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4425. * copies of the Software, and to permit persons to whom the Software is
  4426. * furnished to do so, subject to the following conditions:
  4427. *
  4428. * The above copyright notice and this permission notice shall be included in
  4429. * all copies or substantial portions of the Software.
  4430. *
  4431. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4432. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4433. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4434. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4435. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4436. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4437. * THE SOFTWARE.
  4438. */
  4439. Object.defineProperty(exports, "__esModule", { value: true });
  4440. /**
  4441. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
  4442. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
  4443. */
  4444. function closest(element, selector) {
  4445. if (element.closest) {
  4446. return element.closest(selector);
  4447. }
  4448. var el = element;
  4449. while (el) {
  4450. if (matches(el, selector)) {
  4451. return el;
  4452. }
  4453. el = el.parentElement;
  4454. }
  4455. return null;
  4456. }
  4457. exports.closest = closest;
  4458. function matches(element, selector) {
  4459. var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
  4460. return nativeMatches.call(element, selector);
  4461. }
  4462. exports.matches = matches;
  4463. /***/ }),
  4464. /***/ "./packages/mdc-drawer/component.ts":
  4465. /*!******************************************!*\
  4466. !*** ./packages/mdc-drawer/component.ts ***!
  4467. \******************************************/
  4468. /*! no static exports found */
  4469. /***/ (function(module, exports, __webpack_require__) {
  4470. "use strict";
  4471. /**
  4472. * @license
  4473. * Copyright 2016 Google Inc.
  4474. *
  4475. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4476. * of this software and associated documentation files (the "Software"), to deal
  4477. * in the Software without restriction, including without limitation the rights
  4478. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4479. * copies of the Software, and to permit persons to whom the Software is
  4480. * furnished to do so, subject to the following conditions:
  4481. *
  4482. * The above copyright notice and this permission notice shall be included in
  4483. * all copies or substantial portions of the Software.
  4484. *
  4485. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4486. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4487. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4488. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4489. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4490. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4491. * THE SOFTWARE.
  4492. */
  4493. var __extends = this && this.__extends || function () {
  4494. var _extendStatics = function extendStatics(d, b) {
  4495. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4496. d.__proto__ = b;
  4497. } || function (d, b) {
  4498. for (var p in b) {
  4499. if (b.hasOwnProperty(p)) d[p] = b[p];
  4500. }
  4501. };
  4502. return _extendStatics(d, b);
  4503. };
  4504. return function (d, b) {
  4505. _extendStatics(d, b);
  4506. function __() {
  4507. this.constructor = d;
  4508. }
  4509. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4510. };
  4511. }();
  4512. var __importDefault = this && this.__importDefault || function (mod) {
  4513. return mod && mod.__esModule ? mod : { "default": mod };
  4514. };
  4515. var __importStar = this && this.__importStar || function (mod) {
  4516. if (mod && mod.__esModule) return mod;
  4517. var result = {};
  4518. if (mod != null) for (var k in mod) {
  4519. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  4520. }result["default"] = mod;
  4521. return result;
  4522. };
  4523. Object.defineProperty(exports, "__esModule", { value: true });
  4524. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4525. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  4526. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  4527. var focus_trap_1 = __importDefault(__webpack_require__(/*! focus-trap */ "./packages/mdc-drawer/node_modules/focus-trap/index.js"));
  4528. var foundation_2 = __webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts");
  4529. var foundation_3 = __webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts");
  4530. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
  4531. var cssClasses = foundation_2.MDCDismissibleDrawerFoundation.cssClasses,
  4532. strings = foundation_2.MDCDismissibleDrawerFoundation.strings;
  4533. /**
  4534. * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed.
  4535. * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened.
  4536. */
  4537. var MDCDrawer = /** @class */function (_super) {
  4538. __extends(MDCDrawer, _super);
  4539. function MDCDrawer() {
  4540. return _super !== null && _super.apply(this, arguments) || this;
  4541. }
  4542. MDCDrawer.attachTo = function (root) {
  4543. return new MDCDrawer(root);
  4544. };
  4545. Object.defineProperty(MDCDrawer.prototype, "open", {
  4546. /**
  4547. * @return boolean Proxies to the foundation's `open`/`close` methods.
  4548. * Also returns true if drawer is in the open position.
  4549. */
  4550. get: function get() {
  4551. return this.foundation_.isOpen();
  4552. },
  4553. /**
  4554. * Toggles the drawer open and closed.
  4555. */
  4556. set: function set(isOpen) {
  4557. if (isOpen) {
  4558. this.foundation_.open();
  4559. } else {
  4560. this.foundation_.close();
  4561. }
  4562. },
  4563. enumerable: true,
  4564. configurable: true
  4565. });
  4566. Object.defineProperty(MDCDrawer.prototype, "list", {
  4567. get: function get() {
  4568. return this.list_;
  4569. },
  4570. enumerable: true,
  4571. configurable: true
  4572. });
  4573. MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) {
  4574. if (focusTrapFactory === void 0) {
  4575. focusTrapFactory = focus_trap_1.default;
  4576. }
  4577. if (listFactory === void 0) {
  4578. listFactory = function listFactory(el) {
  4579. return new component_2.MDCList(el);
  4580. };
  4581. }
  4582. var listEl = this.root_.querySelector("." + foundation_1.MDCListFoundation.cssClasses.ROOT);
  4583. if (listEl) {
  4584. this.list_ = listFactory(listEl);
  4585. this.list_.wrapFocus = true;
  4586. }
  4587. this.focusTrapFactory_ = focusTrapFactory;
  4588. };
  4589. MDCDrawer.prototype.initialSyncWithDOM = function () {
  4590. var _this = this;
  4591. var MODAL = cssClasses.MODAL;
  4592. var SCRIM_SELECTOR = strings.SCRIM_SELECTOR;
  4593. this.scrim_ = this.root_.parentNode.querySelector(SCRIM_SELECTOR);
  4594. if (this.scrim_ && this.root_.classList.contains(MODAL)) {
  4595. this.handleScrimClick_ = function () {
  4596. return _this.foundation_.handleScrimClick();
  4597. };
  4598. this.scrim_.addEventListener('click', this.handleScrimClick_);
  4599. this.focusTrap_ = util.createFocusTrapInstance(this.root_, this.focusTrapFactory_);
  4600. }
  4601. this.handleKeydown_ = function (evt) {
  4602. return _this.foundation_.handleKeydown(evt);
  4603. };
  4604. this.handleTransitionEnd_ = function (evt) {
  4605. return _this.foundation_.handleTransitionEnd(evt);
  4606. };
  4607. this.listen('keydown', this.handleKeydown_);
  4608. this.listen('transitionend', this.handleTransitionEnd_);
  4609. };
  4610. MDCDrawer.prototype.destroy = function () {
  4611. this.unlisten('keydown', this.handleKeydown_);
  4612. this.unlisten('transitionend', this.handleTransitionEnd_);
  4613. if (this.list_) {
  4614. this.list_.destroy();
  4615. }
  4616. var MODAL = cssClasses.MODAL;
  4617. if (this.scrim_ && this.handleScrimClick_ && this.root_.classList.contains(MODAL)) {
  4618. this.scrim_.removeEventListener('click', this.handleScrimClick_);
  4619. // Ensure drawer is closed to hide scrim and release focus
  4620. this.open = false;
  4621. }
  4622. };
  4623. MDCDrawer.prototype.getDefaultFoundation = function () {
  4624. var _this = this;
  4625. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  4626. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  4627. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4628. var adapter = {
  4629. addClass: function addClass(className) {
  4630. return _this.root_.classList.add(className);
  4631. },
  4632. removeClass: function removeClass(className) {
  4633. return _this.root_.classList.remove(className);
  4634. },
  4635. hasClass: function hasClass(className) {
  4636. return _this.root_.classList.contains(className);
  4637. },
  4638. elementHasClass: function elementHasClass(element, className) {
  4639. return element.classList.contains(className);
  4640. },
  4641. saveFocus: function saveFocus() {
  4642. return _this.previousFocus_ = document.activeElement;
  4643. },
  4644. restoreFocus: function restoreFocus() {
  4645. var previousFocus = _this.previousFocus_;
  4646. if (previousFocus && previousFocus.focus && _this.root_.contains(document.activeElement)) {
  4647. previousFocus.focus();
  4648. }
  4649. },
  4650. focusActiveNavigationItem: function focusActiveNavigationItem() {
  4651. var activeNavItemEl = _this.root_.querySelector("." + foundation_1.MDCListFoundation.cssClasses.LIST_ITEM_ACTIVATED_CLASS);
  4652. if (activeNavItemEl) {
  4653. activeNavItemEl.focus();
  4654. }
  4655. },
  4656. notifyClose: function notifyClose() {
  4657. return _this.emit(strings.CLOSE_EVENT, {}, true /* shouldBubble */);
  4658. },
  4659. notifyOpen: function notifyOpen() {
  4660. return _this.emit(strings.OPEN_EVENT, {}, true /* shouldBubble */);
  4661. },
  4662. trapFocus: function trapFocus() {
  4663. return _this.focusTrap_.activate();
  4664. },
  4665. releaseFocus: function releaseFocus() {
  4666. return _this.focusTrap_.deactivate();
  4667. }
  4668. };
  4669. // tslint:enable:object-literal-sort-keys
  4670. var DISMISSIBLE = cssClasses.DISMISSIBLE,
  4671. MODAL = cssClasses.MODAL;
  4672. if (this.root_.classList.contains(DISMISSIBLE)) {
  4673. return new foundation_2.MDCDismissibleDrawerFoundation(adapter);
  4674. } else if (this.root_.classList.contains(MODAL)) {
  4675. return new foundation_3.MDCModalDrawerFoundation(adapter);
  4676. } else {
  4677. throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + ".");
  4678. }
  4679. };
  4680. return MDCDrawer;
  4681. }(component_1.MDCComponent);
  4682. exports.MDCDrawer = MDCDrawer;
  4683. /***/ }),
  4684. /***/ "./packages/mdc-drawer/constants.ts":
  4685. /*!******************************************!*\
  4686. !*** ./packages/mdc-drawer/constants.ts ***!
  4687. \******************************************/
  4688. /*! no static exports found */
  4689. /***/ (function(module, exports, __webpack_require__) {
  4690. "use strict";
  4691. /**
  4692. * @license
  4693. * Copyright 2016 Google Inc.
  4694. *
  4695. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4696. * of this software and associated documentation files (the "Software"), to deal
  4697. * in the Software without restriction, including without limitation the rights
  4698. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4699. * copies of the Software, and to permit persons to whom the Software is
  4700. * furnished to do so, subject to the following conditions:
  4701. *
  4702. * The above copyright notice and this permission notice shall be included in
  4703. * all copies or substantial portions of the Software.
  4704. *
  4705. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4706. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4707. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4708. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4709. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4710. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4711. * THE SOFTWARE.
  4712. */
  4713. Object.defineProperty(exports, "__esModule", { value: true });
  4714. var cssClasses = {
  4715. ANIMATE: 'mdc-drawer--animate',
  4716. CLOSING: 'mdc-drawer--closing',
  4717. DISMISSIBLE: 'mdc-drawer--dismissible',
  4718. MODAL: 'mdc-drawer--modal',
  4719. OPEN: 'mdc-drawer--open',
  4720. OPENING: 'mdc-drawer--opening',
  4721. ROOT: 'mdc-drawer'
  4722. };
  4723. exports.cssClasses = cssClasses;
  4724. var strings = {
  4725. APP_CONTENT_SELECTOR: '.mdc-drawer-app-content',
  4726. CLOSE_EVENT: 'MDCDrawer:closed',
  4727. OPEN_EVENT: 'MDCDrawer:opened',
  4728. SCRIM_SELECTOR: '.mdc-drawer-scrim'
  4729. };
  4730. exports.strings = strings;
  4731. /***/ }),
  4732. /***/ "./packages/mdc-drawer/dismissible/foundation.ts":
  4733. /*!*******************************************************!*\
  4734. !*** ./packages/mdc-drawer/dismissible/foundation.ts ***!
  4735. \*******************************************************/
  4736. /*! no static exports found */
  4737. /***/ (function(module, exports, __webpack_require__) {
  4738. "use strict";
  4739. /**
  4740. * @license
  4741. * Copyright 2018 Google Inc.
  4742. *
  4743. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4744. * of this software and associated documentation files (the "Software"), to deal
  4745. * in the Software without restriction, including without limitation the rights
  4746. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4747. * copies of the Software, and to permit persons to whom the Software is
  4748. * furnished to do so, subject to the following conditions:
  4749. *
  4750. * The above copyright notice and this permission notice shall be included in
  4751. * all copies or substantial portions of the Software.
  4752. *
  4753. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4754. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4755. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4756. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4757. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4758. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4759. * THE SOFTWARE.
  4760. */
  4761. var __extends = this && this.__extends || function () {
  4762. var _extendStatics = function extendStatics(d, b) {
  4763. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4764. d.__proto__ = b;
  4765. } || function (d, b) {
  4766. for (var p in b) {
  4767. if (b.hasOwnProperty(p)) d[p] = b[p];
  4768. }
  4769. };
  4770. return _extendStatics(d, b);
  4771. };
  4772. return function (d, b) {
  4773. _extendStatics(d, b);
  4774. function __() {
  4775. this.constructor = d;
  4776. }
  4777. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4778. };
  4779. }();
  4780. var __assign = this && this.__assign || function () {
  4781. __assign = Object.assign || function (t) {
  4782. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4783. s = arguments[i];
  4784. for (var p in s) {
  4785. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4786. }
  4787. }
  4788. return t;
  4789. };
  4790. return __assign.apply(this, arguments);
  4791. };
  4792. Object.defineProperty(exports, "__esModule", { value: true });
  4793. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4794. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-drawer/constants.ts");
  4795. var MDCDismissibleDrawerFoundation = /** @class */function (_super) {
  4796. __extends(MDCDismissibleDrawerFoundation, _super);
  4797. function MDCDismissibleDrawerFoundation(adapter) {
  4798. var _this = _super.call(this, __assign({}, MDCDismissibleDrawerFoundation.defaultAdapter, adapter)) || this;
  4799. _this.animationFrame_ = 0;
  4800. _this.animationTimer_ = 0;
  4801. return _this;
  4802. }
  4803. Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", {
  4804. get: function get() {
  4805. return constants_1.strings;
  4806. },
  4807. enumerable: true,
  4808. configurable: true
  4809. });
  4810. Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", {
  4811. get: function get() {
  4812. return constants_1.cssClasses;
  4813. },
  4814. enumerable: true,
  4815. configurable: true
  4816. });
  4817. Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", {
  4818. get: function get() {
  4819. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4820. return {
  4821. addClass: function addClass() {
  4822. return undefined;
  4823. },
  4824. removeClass: function removeClass() {
  4825. return undefined;
  4826. },
  4827. hasClass: function hasClass() {
  4828. return false;
  4829. },
  4830. elementHasClass: function elementHasClass() {
  4831. return false;
  4832. },
  4833. notifyClose: function notifyClose() {
  4834. return undefined;
  4835. },
  4836. notifyOpen: function notifyOpen() {
  4837. return undefined;
  4838. },
  4839. saveFocus: function saveFocus() {
  4840. return undefined;
  4841. },
  4842. restoreFocus: function restoreFocus() {
  4843. return undefined;
  4844. },
  4845. focusActiveNavigationItem: function focusActiveNavigationItem() {
  4846. return undefined;
  4847. },
  4848. trapFocus: function trapFocus() {
  4849. return undefined;
  4850. },
  4851. releaseFocus: function releaseFocus() {
  4852. return undefined;
  4853. }
  4854. };
  4855. // tslint:enable:object-literal-sort-keys
  4856. },
  4857. enumerable: true,
  4858. configurable: true
  4859. });
  4860. MDCDismissibleDrawerFoundation.prototype.destroy = function () {
  4861. if (this.animationFrame_) {
  4862. cancelAnimationFrame(this.animationFrame_);
  4863. }
  4864. if (this.animationTimer_) {
  4865. clearTimeout(this.animationTimer_);
  4866. }
  4867. };
  4868. /**
  4869. * Opens the drawer from the closed state.
  4870. */
  4871. MDCDismissibleDrawerFoundation.prototype.open = function () {
  4872. var _this = this;
  4873. if (this.isOpen() || this.isOpening() || this.isClosing()) {
  4874. return;
  4875. }
  4876. this.adapter_.addClass(constants_1.cssClasses.OPEN);
  4877. this.adapter_.addClass(constants_1.cssClasses.ANIMATE);
  4878. // Wait a frame once display is no longer "none", to establish basis for animation
  4879. this.runNextAnimationFrame_(function () {
  4880. _this.adapter_.addClass(constants_1.cssClasses.OPENING);
  4881. });
  4882. this.adapter_.saveFocus();
  4883. };
  4884. /**
  4885. * Closes the drawer from the open state.
  4886. */
  4887. MDCDismissibleDrawerFoundation.prototype.close = function () {
  4888. if (!this.isOpen() || this.isOpening() || this.isClosing()) {
  4889. return;
  4890. }
  4891. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  4892. };
  4893. /**
  4894. * Returns true if the drawer is in the open position.
  4895. * @return true if drawer is in open state.
  4896. */
  4897. MDCDismissibleDrawerFoundation.prototype.isOpen = function () {
  4898. return this.adapter_.hasClass(constants_1.cssClasses.OPEN);
  4899. };
  4900. /**
  4901. * Returns true if the drawer is animating open.
  4902. * @return true if drawer is animating open.
  4903. */
  4904. MDCDismissibleDrawerFoundation.prototype.isOpening = function () {
  4905. return this.adapter_.hasClass(constants_1.cssClasses.OPENING) || this.adapter_.hasClass(constants_1.cssClasses.ANIMATE);
  4906. };
  4907. /**
  4908. * Returns true if the drawer is animating closed.
  4909. * @return true if drawer is animating closed.
  4910. */
  4911. MDCDismissibleDrawerFoundation.prototype.isClosing = function () {
  4912. return this.adapter_.hasClass(constants_1.cssClasses.CLOSING);
  4913. };
  4914. /**
  4915. * Keydown handler to close drawer when key is escape.
  4916. */
  4917. MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) {
  4918. var keyCode = evt.keyCode,
  4919. key = evt.key;
  4920. var isEscape = key === 'Escape' || keyCode === 27;
  4921. if (isEscape) {
  4922. this.close();
  4923. }
  4924. };
  4925. /**
  4926. * Handles the `transitionend` event when the drawer finishes opening/closing.
  4927. */
  4928. MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) {
  4929. var OPENING = constants_1.cssClasses.OPENING,
  4930. CLOSING = constants_1.cssClasses.CLOSING,
  4931. OPEN = constants_1.cssClasses.OPEN,
  4932. ANIMATE = constants_1.cssClasses.ANIMATE,
  4933. ROOT = constants_1.cssClasses.ROOT;
  4934. // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first.
  4935. var isRootElement = this.isElement_(evt.target) && this.adapter_.elementHasClass(evt.target, ROOT);
  4936. if (!isRootElement) {
  4937. return;
  4938. }
  4939. if (this.isClosing()) {
  4940. this.adapter_.removeClass(OPEN);
  4941. this.closed_();
  4942. this.adapter_.restoreFocus();
  4943. this.adapter_.notifyClose();
  4944. } else {
  4945. this.adapter_.focusActiveNavigationItem();
  4946. this.opened_();
  4947. this.adapter_.notifyOpen();
  4948. }
  4949. this.adapter_.removeClass(ANIMATE);
  4950. this.adapter_.removeClass(OPENING);
  4951. this.adapter_.removeClass(CLOSING);
  4952. };
  4953. /**
  4954. * Extension point for when drawer finishes open animation.
  4955. */
  4956. MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty
  4957. /**
  4958. * Extension point for when drawer finishes close animation.
  4959. */
  4960. MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty
  4961. /**
  4962. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  4963. */
  4964. MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  4965. var _this = this;
  4966. cancelAnimationFrame(this.animationFrame_);
  4967. this.animationFrame_ = requestAnimationFrame(function () {
  4968. _this.animationFrame_ = 0;
  4969. clearTimeout(_this.animationTimer_);
  4970. _this.animationTimer_ = setTimeout(callback, 0);
  4971. });
  4972. };
  4973. MDCDismissibleDrawerFoundation.prototype.isElement_ = function (element) {
  4974. // In Edge, transitionend on ripple pseudo-elements yields a target without classList.
  4975. return Boolean(element.classList);
  4976. };
  4977. return MDCDismissibleDrawerFoundation;
  4978. }(foundation_1.MDCFoundation);
  4979. exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation;
  4980. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4981. exports.default = MDCDismissibleDrawerFoundation;
  4982. /***/ }),
  4983. /***/ "./packages/mdc-drawer/index.ts":
  4984. /*!**************************************!*\
  4985. !*** ./packages/mdc-drawer/index.ts ***!
  4986. \**************************************/
  4987. /*! no static exports found */
  4988. /***/ (function(module, exports, __webpack_require__) {
  4989. "use strict";
  4990. /**
  4991. * @license
  4992. * Copyright 2019 Google Inc.
  4993. *
  4994. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4995. * of this software and associated documentation files (the "Software"), to deal
  4996. * in the Software without restriction, including without limitation the rights
  4997. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4998. * copies of the Software, and to permit persons to whom the Software is
  4999. * furnished to do so, subject to the following conditions:
  5000. *
  5001. * The above copyright notice and this permission notice shall be included in
  5002. * all copies or substantial portions of the Software.
  5003. *
  5004. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5005. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5006. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5007. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5008. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5009. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5010. * THE SOFTWARE.
  5011. */
  5012. function __export(m) {
  5013. for (var p in m) {
  5014. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  5015. }
  5016. }
  5017. var __importStar = this && this.__importStar || function (mod) {
  5018. if (mod && mod.__esModule) return mod;
  5019. var result = {};
  5020. if (mod != null) for (var k in mod) {
  5021. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5022. }result["default"] = mod;
  5023. return result;
  5024. };
  5025. Object.defineProperty(exports, "__esModule", { value: true });
  5026. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
  5027. exports.util = util;
  5028. __export(__webpack_require__(/*! ./component */ "./packages/mdc-drawer/component.ts"));
  5029. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-drawer/constants.ts"));
  5030. __export(__webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"));
  5031. __export(__webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"));
  5032. /***/ }),
  5033. /***/ "./packages/mdc-drawer/modal/foundation.ts":
  5034. /*!*************************************************!*\
  5035. !*** ./packages/mdc-drawer/modal/foundation.ts ***!
  5036. \*************************************************/
  5037. /*! no static exports found */
  5038. /***/ (function(module, exports, __webpack_require__) {
  5039. "use strict";
  5040. /**
  5041. * @license
  5042. * Copyright 2018 Google Inc.
  5043. *
  5044. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5045. * of this software and associated documentation files (the "Software"), to deal
  5046. * in the Software without restriction, including without limitation the rights
  5047. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5048. * copies of the Software, and to permit persons to whom the Software is
  5049. * furnished to do so, subject to the following conditions:
  5050. *
  5051. * The above copyright notice and this permission notice shall be included in
  5052. * all copies or substantial portions of the Software.
  5053. *
  5054. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5055. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5056. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5057. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5058. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5059. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5060. * THE SOFTWARE.
  5061. */
  5062. var __extends = this && this.__extends || function () {
  5063. var _extendStatics = function extendStatics(d, b) {
  5064. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5065. d.__proto__ = b;
  5066. } || function (d, b) {
  5067. for (var p in b) {
  5068. if (b.hasOwnProperty(p)) d[p] = b[p];
  5069. }
  5070. };
  5071. return _extendStatics(d, b);
  5072. };
  5073. return function (d, b) {
  5074. _extendStatics(d, b);
  5075. function __() {
  5076. this.constructor = d;
  5077. }
  5078. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5079. };
  5080. }();
  5081. Object.defineProperty(exports, "__esModule", { value: true });
  5082. var foundation_1 = __webpack_require__(/*! ../dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts");
  5083. /* istanbul ignore next: subclass is not a branch statement */
  5084. var MDCModalDrawerFoundation = /** @class */function (_super) {
  5085. __extends(MDCModalDrawerFoundation, _super);
  5086. function MDCModalDrawerFoundation() {
  5087. return _super !== null && _super.apply(this, arguments) || this;
  5088. }
  5089. /**
  5090. * Handles click event on scrim.
  5091. */
  5092. MDCModalDrawerFoundation.prototype.handleScrimClick = function () {
  5093. this.close();
  5094. };
  5095. /**
  5096. * Called when drawer finishes open animation.
  5097. */
  5098. MDCModalDrawerFoundation.prototype.opened_ = function () {
  5099. this.adapter_.trapFocus();
  5100. };
  5101. /**
  5102. * Called when drawer finishes close animation.
  5103. */
  5104. MDCModalDrawerFoundation.prototype.closed_ = function () {
  5105. this.adapter_.releaseFocus();
  5106. };
  5107. return MDCModalDrawerFoundation;
  5108. }(foundation_1.MDCDismissibleDrawerFoundation);
  5109. exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation;
  5110. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5111. exports.default = MDCModalDrawerFoundation;
  5112. /***/ }),
  5113. /***/ "./packages/mdc-drawer/node_modules/focus-trap/index.js":
  5114. /*!**************************************************************!*\
  5115. !*** ./packages/mdc-drawer/node_modules/focus-trap/index.js ***!
  5116. \**************************************************************/
  5117. /*! no static exports found */
  5118. /***/ (function(module, exports, __webpack_require__) {
  5119. var tabbable = __webpack_require__(/*! tabbable */ "./packages/mdc-drawer/node_modules/tabbable/index.js");
  5120. var xtend = __webpack_require__(/*! xtend */ "./packages/mdc-drawer/node_modules/xtend/immutable.js");
  5121. var activeFocusTraps = (function() {
  5122. var trapQueue = [];
  5123. return {
  5124. activateTrap: function(trap) {
  5125. if (trapQueue.length > 0) {
  5126. var activeTrap = trapQueue[trapQueue.length - 1];
  5127. if (activeTrap !== trap) {
  5128. activeTrap.pause();
  5129. }
  5130. }
  5131. var trapIndex = trapQueue.indexOf(trap);
  5132. if (trapIndex === -1) {
  5133. trapQueue.push(trap);
  5134. } else {
  5135. // move this existing trap to the front of the queue
  5136. trapQueue.splice(trapIndex, 1);
  5137. trapQueue.push(trap);
  5138. }
  5139. },
  5140. deactivateTrap: function(trap) {
  5141. var trapIndex = trapQueue.indexOf(trap);
  5142. if (trapIndex !== -1) {
  5143. trapQueue.splice(trapIndex, 1);
  5144. }
  5145. if (trapQueue.length > 0) {
  5146. trapQueue[trapQueue.length - 1].unpause();
  5147. }
  5148. }
  5149. };
  5150. })();
  5151. function focusTrap(element, userOptions) {
  5152. var doc = document;
  5153. var container =
  5154. typeof element === 'string' ? doc.querySelector(element) : element;
  5155. var config = xtend(
  5156. {
  5157. returnFocusOnDeactivate: true,
  5158. escapeDeactivates: true
  5159. },
  5160. userOptions
  5161. );
  5162. var state = {
  5163. firstTabbableNode: null,
  5164. lastTabbableNode: null,
  5165. nodeFocusedBeforeActivation: null,
  5166. mostRecentlyFocusedNode: null,
  5167. active: false,
  5168. paused: false
  5169. };
  5170. var trap = {
  5171. activate: activate,
  5172. deactivate: deactivate,
  5173. pause: pause,
  5174. unpause: unpause
  5175. };
  5176. return trap;
  5177. function activate(activateOptions) {
  5178. if (state.active) return;
  5179. updateTabbableNodes();
  5180. state.active = true;
  5181. state.paused = false;
  5182. state.nodeFocusedBeforeActivation = doc.activeElement;
  5183. var onActivate =
  5184. activateOptions && activateOptions.onActivate
  5185. ? activateOptions.onActivate
  5186. : config.onActivate;
  5187. if (onActivate) {
  5188. onActivate();
  5189. }
  5190. addListeners();
  5191. return trap;
  5192. }
  5193. function deactivate(deactivateOptions) {
  5194. if (!state.active) return;
  5195. removeListeners();
  5196. state.active = false;
  5197. state.paused = false;
  5198. activeFocusTraps.deactivateTrap(trap);
  5199. var onDeactivate =
  5200. deactivateOptions && deactivateOptions.onDeactivate !== undefined
  5201. ? deactivateOptions.onDeactivate
  5202. : config.onDeactivate;
  5203. if (onDeactivate) {
  5204. onDeactivate();
  5205. }
  5206. var returnFocus =
  5207. deactivateOptions && deactivateOptions.returnFocus !== undefined
  5208. ? deactivateOptions.returnFocus
  5209. : config.returnFocusOnDeactivate;
  5210. if (returnFocus) {
  5211. delay(function() {
  5212. tryFocus(state.nodeFocusedBeforeActivation);
  5213. });
  5214. }
  5215. return trap;
  5216. }
  5217. function pause() {
  5218. if (state.paused || !state.active) return;
  5219. state.paused = true;
  5220. removeListeners();
  5221. }
  5222. function unpause() {
  5223. if (!state.paused || !state.active) return;
  5224. state.paused = false;
  5225. updateTabbableNodes();
  5226. addListeners();
  5227. }
  5228. function addListeners() {
  5229. if (!state.active) return;
  5230. // There can be only one listening focus trap at a time
  5231. activeFocusTraps.activateTrap(trap);
  5232. // Delay ensures that the focused element doesn't capture the event
  5233. // that caused the focus trap activation.
  5234. delay(function() {
  5235. tryFocus(getInitialFocusNode());
  5236. });
  5237. doc.addEventListener('focusin', checkFocusIn, true);
  5238. doc.addEventListener('mousedown', checkPointerDown, {
  5239. capture: true,
  5240. passive: false
  5241. });
  5242. doc.addEventListener('touchstart', checkPointerDown, {
  5243. capture: true,
  5244. passive: false
  5245. });
  5246. doc.addEventListener('click', checkClick, {
  5247. capture: true,
  5248. passive: false
  5249. });
  5250. doc.addEventListener('keydown', checkKey, {
  5251. capture: true,
  5252. passive: false
  5253. });
  5254. return trap;
  5255. }
  5256. function removeListeners() {
  5257. if (!state.active) return;
  5258. doc.removeEventListener('focusin', checkFocusIn, true);
  5259. doc.removeEventListener('mousedown', checkPointerDown, true);
  5260. doc.removeEventListener('touchstart', checkPointerDown, true);
  5261. doc.removeEventListener('click', checkClick, true);
  5262. doc.removeEventListener('keydown', checkKey, true);
  5263. return trap;
  5264. }
  5265. function getNodeForOption(optionName) {
  5266. var optionValue = config[optionName];
  5267. var node = optionValue;
  5268. if (!optionValue) {
  5269. return null;
  5270. }
  5271. if (typeof optionValue === 'string') {
  5272. node = doc.querySelector(optionValue);
  5273. if (!node) {
  5274. throw new Error('`' + optionName + '` refers to no known node');
  5275. }
  5276. }
  5277. if (typeof optionValue === 'function') {
  5278. node = optionValue();
  5279. if (!node) {
  5280. throw new Error('`' + optionName + '` did not return a node');
  5281. }
  5282. }
  5283. return node;
  5284. }
  5285. function getInitialFocusNode() {
  5286. var node;
  5287. if (getNodeForOption('initialFocus') !== null) {
  5288. node = getNodeForOption('initialFocus');
  5289. } else if (container.contains(doc.activeElement)) {
  5290. node = doc.activeElement;
  5291. } else {
  5292. node = state.firstTabbableNode || getNodeForOption('fallbackFocus');
  5293. }
  5294. if (!node) {
  5295. throw new Error(
  5296. "You can't have a focus-trap without at least one focusable element"
  5297. );
  5298. }
  5299. return node;
  5300. }
  5301. // This needs to be done on mousedown and touchstart instead of click
  5302. // so that it precedes the focus event.
  5303. function checkPointerDown(e) {
  5304. if (container.contains(e.target)) return;
  5305. if (config.clickOutsideDeactivates) {
  5306. deactivate({
  5307. returnFocus: !tabbable.isFocusable(e.target)
  5308. });
  5309. } else {
  5310. e.preventDefault();
  5311. }
  5312. }
  5313. // In case focus escapes the trap for some strange reason, pull it back in.
  5314. function checkFocusIn(e) {
  5315. // In Firefox when you Tab out of an iframe the Document is briefly focused.
  5316. if (container.contains(e.target) || e.target instanceof Document) {
  5317. return;
  5318. }
  5319. e.stopImmediatePropagation();
  5320. tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
  5321. }
  5322. function checkKey(e) {
  5323. if (config.escapeDeactivates !== false && isEscapeEvent(e)) {
  5324. e.preventDefault();
  5325. deactivate();
  5326. return;
  5327. }
  5328. if (isTabEvent(e)) {
  5329. checkTab(e);
  5330. return;
  5331. }
  5332. }
  5333. // Hijack Tab events on the first and last focusable nodes of the trap,
  5334. // in order to prevent focus from escaping. If it escapes for even a
  5335. // moment it can end up scrolling the page and causing confusion so we
  5336. // kind of need to capture the action at the keydown phase.
  5337. function checkTab(e) {
  5338. updateTabbableNodes();
  5339. if (e.shiftKey && e.target === state.firstTabbableNode) {
  5340. e.preventDefault();
  5341. tryFocus(state.lastTabbableNode);
  5342. return;
  5343. }
  5344. if (!e.shiftKey && e.target === state.lastTabbableNode) {
  5345. e.preventDefault();
  5346. tryFocus(state.firstTabbableNode);
  5347. return;
  5348. }
  5349. }
  5350. function checkClick(e) {
  5351. if (config.clickOutsideDeactivates) return;
  5352. if (container.contains(e.target)) return;
  5353. e.preventDefault();
  5354. e.stopImmediatePropagation();
  5355. }
  5356. function updateTabbableNodes() {
  5357. var tabbableNodes = tabbable(container);
  5358. state.firstTabbableNode = tabbableNodes[0] || getInitialFocusNode();
  5359. state.lastTabbableNode =
  5360. tabbableNodes[tabbableNodes.length - 1] || getInitialFocusNode();
  5361. }
  5362. function tryFocus(node) {
  5363. if (node === doc.activeElement) return;
  5364. if (!node || !node.focus) {
  5365. tryFocus(getInitialFocusNode());
  5366. return;
  5367. }
  5368. node.focus();
  5369. state.mostRecentlyFocusedNode = node;
  5370. if (isSelectableInput(node)) {
  5371. node.select();
  5372. }
  5373. }
  5374. }
  5375. function isSelectableInput(node) {
  5376. return (
  5377. node.tagName &&
  5378. node.tagName.toLowerCase() === 'input' &&
  5379. typeof node.select === 'function'
  5380. );
  5381. }
  5382. function isEscapeEvent(e) {
  5383. return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
  5384. }
  5385. function isTabEvent(e) {
  5386. return e.key === 'Tab' || e.keyCode === 9;
  5387. }
  5388. function delay(fn) {
  5389. return setTimeout(fn, 0);
  5390. }
  5391. module.exports = focusTrap;
  5392. /***/ }),
  5393. /***/ "./packages/mdc-drawer/node_modules/tabbable/index.js":
  5394. /*!************************************************************!*\
  5395. !*** ./packages/mdc-drawer/node_modules/tabbable/index.js ***!
  5396. \************************************************************/
  5397. /*! no static exports found */
  5398. /***/ (function(module, exports) {
  5399. var candidateSelectors = [
  5400. 'input',
  5401. 'select',
  5402. 'textarea',
  5403. 'a[href]',
  5404. 'button',
  5405. '[tabindex]',
  5406. 'audio[controls]',
  5407. 'video[controls]',
  5408. '[contenteditable]:not([contenteditable="false"])',
  5409. ];
  5410. var candidateSelector = candidateSelectors.join(',');
  5411. var matches = typeof Element === 'undefined'
  5412. ? function () {}
  5413. : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  5414. function tabbable(el, options) {
  5415. options = options || {};
  5416. var regularTabbables = [];
  5417. var orderedTabbables = [];
  5418. var candidates = el.querySelectorAll(candidateSelector);
  5419. if (options.includeContainer) {
  5420. if (matches.call(el, candidateSelector)) {
  5421. candidates = Array.prototype.slice.apply(candidates);
  5422. candidates.unshift(el);
  5423. }
  5424. }
  5425. var i, candidate, candidateTabindex;
  5426. for (i = 0; i < candidates.length; i++) {
  5427. candidate = candidates[i];
  5428. if (!isNodeMatchingSelectorTabbable(candidate)) continue;
  5429. candidateTabindex = getTabindex(candidate);
  5430. if (candidateTabindex === 0) {
  5431. regularTabbables.push(candidate);
  5432. } else {
  5433. orderedTabbables.push({
  5434. documentOrder: i,
  5435. tabIndex: candidateTabindex,
  5436. node: candidate,
  5437. });
  5438. }
  5439. }
  5440. var tabbableNodes = orderedTabbables
  5441. .sort(sortOrderedTabbables)
  5442. .map(function(a) { return a.node })
  5443. .concat(regularTabbables);
  5444. return tabbableNodes;
  5445. }
  5446. tabbable.isTabbable = isTabbable;
  5447. tabbable.isFocusable = isFocusable;
  5448. function isNodeMatchingSelectorTabbable(node) {
  5449. if (
  5450. !isNodeMatchingSelectorFocusable(node)
  5451. || isNonTabbableRadio(node)
  5452. || getTabindex(node) < 0
  5453. ) {
  5454. return false;
  5455. }
  5456. return true;
  5457. }
  5458. function isTabbable(node) {
  5459. if (!node) throw new Error('No node provided');
  5460. if (matches.call(node, candidateSelector) === false) return false;
  5461. return isNodeMatchingSelectorTabbable(node);
  5462. }
  5463. function isNodeMatchingSelectorFocusable(node) {
  5464. if (
  5465. node.disabled
  5466. || isHiddenInput(node)
  5467. || isHidden(node)
  5468. ) {
  5469. return false;
  5470. }
  5471. return true;
  5472. }
  5473. var focusableCandidateSelector = candidateSelectors.concat('iframe').join(',');
  5474. function isFocusable(node) {
  5475. if (!node) throw new Error('No node provided');
  5476. if (matches.call(node, focusableCandidateSelector) === false) return false;
  5477. return isNodeMatchingSelectorFocusable(node);
  5478. }
  5479. function getTabindex(node) {
  5480. var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
  5481. if (!isNaN(tabindexAttr)) return tabindexAttr;
  5482. // Browsers do not return `tabIndex` correctly for contentEditable nodes;
  5483. // so if they don't have a tabindex attribute specifically set, assume it's 0.
  5484. if (isContentEditable(node)) return 0;
  5485. return node.tabIndex;
  5486. }
  5487. function sortOrderedTabbables(a, b) {
  5488. return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
  5489. }
  5490. function isContentEditable(node) {
  5491. return node.contentEditable === 'true';
  5492. }
  5493. function isInput(node) {
  5494. return node.tagName === 'INPUT';
  5495. }
  5496. function isHiddenInput(node) {
  5497. return isInput(node) && node.type === 'hidden';
  5498. }
  5499. function isRadio(node) {
  5500. return isInput(node) && node.type === 'radio';
  5501. }
  5502. function isNonTabbableRadio(node) {
  5503. return isRadio(node) && !isTabbableRadio(node);
  5504. }
  5505. function getCheckedRadio(nodes) {
  5506. for (var i = 0; i < nodes.length; i++) {
  5507. if (nodes[i].checked) {
  5508. return nodes[i];
  5509. }
  5510. }
  5511. }
  5512. function isTabbableRadio(node) {
  5513. if (!node.name) return true;
  5514. // This won't account for the edge case where you have radio groups with the same
  5515. // in separate forms on the same page.
  5516. var radioSet = node.ownerDocument.querySelectorAll('input[type="radio"][name="' + node.name + '"]');
  5517. var checked = getCheckedRadio(radioSet);
  5518. return !checked || checked === node;
  5519. }
  5520. function isHidden(node) {
  5521. // offsetParent being null will allow detecting cases where an element is invisible or inside an invisible element,
  5522. // as long as the element does not use position: fixed. For them, their visibility has to be checked directly as well.
  5523. return node.offsetParent === null || getComputedStyle(node).visibility === 'hidden';
  5524. }
  5525. module.exports = tabbable;
  5526. /***/ }),
  5527. /***/ "./packages/mdc-drawer/node_modules/xtend/immutable.js":
  5528. /*!*************************************************************!*\
  5529. !*** ./packages/mdc-drawer/node_modules/xtend/immutable.js ***!
  5530. \*************************************************************/
  5531. /*! no static exports found */
  5532. /***/ (function(module, exports) {
  5533. module.exports = extend
  5534. var hasOwnProperty = Object.prototype.hasOwnProperty;
  5535. function extend() {
  5536. var target = {}
  5537. for (var i = 0; i < arguments.length; i++) {
  5538. var source = arguments[i]
  5539. for (var key in source) {
  5540. if (hasOwnProperty.call(source, key)) {
  5541. target[key] = source[key]
  5542. }
  5543. }
  5544. }
  5545. return target
  5546. }
  5547. /***/ }),
  5548. /***/ "./packages/mdc-drawer/util.ts":
  5549. /*!*************************************!*\
  5550. !*** ./packages/mdc-drawer/util.ts ***!
  5551. \*************************************/
  5552. /*! no static exports found */
  5553. /***/ (function(module, exports, __webpack_require__) {
  5554. "use strict";
  5555. /**
  5556. * @license
  5557. * Copyright 2016 Google Inc.
  5558. *
  5559. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5560. * of this software and associated documentation files (the "Software"), to deal
  5561. * in the Software without restriction, including without limitation the rights
  5562. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5563. * copies of the Software, and to permit persons to whom the Software is
  5564. * furnished to do so, subject to the following conditions:
  5565. *
  5566. * The above copyright notice and this permission notice shall be included in
  5567. * all copies or substantial portions of the Software.
  5568. *
  5569. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5570. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5571. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5572. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5573. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5574. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5575. * THE SOFTWARE.
  5576. */
  5577. var __importDefault = this && this.__importDefault || function (mod) {
  5578. return mod && mod.__esModule ? mod : { "default": mod };
  5579. };
  5580. Object.defineProperty(exports, "__esModule", { value: true });
  5581. var focus_trap_1 = __importDefault(__webpack_require__(/*! focus-trap */ "./packages/mdc-drawer/node_modules/focus-trap/index.js"));
  5582. function createFocusTrapInstance(surfaceEl, focusTrapFactory) {
  5583. if (focusTrapFactory === void 0) {
  5584. focusTrapFactory = focus_trap_1.default;
  5585. }
  5586. return focusTrapFactory(surfaceEl, {
  5587. clickOutsideDeactivates: true,
  5588. escapeDeactivates: false,
  5589. initialFocus: undefined,
  5590. returnFocusOnDeactivate: false
  5591. });
  5592. }
  5593. exports.createFocusTrapInstance = createFocusTrapInstance;
  5594. /***/ }),
  5595. /***/ "./packages/mdc-floating-label/component.ts":
  5596. /*!**************************************************!*\
  5597. !*** ./packages/mdc-floating-label/component.ts ***!
  5598. \**************************************************/
  5599. /*! no static exports found */
  5600. /***/ (function(module, exports, __webpack_require__) {
  5601. "use strict";
  5602. /**
  5603. * @license
  5604. * Copyright 2016 Google Inc.
  5605. *
  5606. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5607. * of this software and associated documentation files (the "Software"), to deal
  5608. * in the Software without restriction, including without limitation the rights
  5609. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5610. * copies of the Software, and to permit persons to whom the Software is
  5611. * furnished to do so, subject to the following conditions:
  5612. *
  5613. * The above copyright notice and this permission notice shall be included in
  5614. * all copies or substantial portions of the Software.
  5615. *
  5616. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5617. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5618. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5619. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5620. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5621. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5622. * THE SOFTWARE.
  5623. */
  5624. var __extends = this && this.__extends || function () {
  5625. var _extendStatics = function extendStatics(d, b) {
  5626. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5627. d.__proto__ = b;
  5628. } || function (d, b) {
  5629. for (var p in b) {
  5630. if (b.hasOwnProperty(p)) d[p] = b[p];
  5631. }
  5632. };
  5633. return _extendStatics(d, b);
  5634. };
  5635. return function (d, b) {
  5636. _extendStatics(d, b);
  5637. function __() {
  5638. this.constructor = d;
  5639. }
  5640. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5641. };
  5642. }();
  5643. Object.defineProperty(exports, "__esModule", { value: true });
  5644. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  5645. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts");
  5646. var MDCFloatingLabel = /** @class */function (_super) {
  5647. __extends(MDCFloatingLabel, _super);
  5648. function MDCFloatingLabel() {
  5649. return _super !== null && _super.apply(this, arguments) || this;
  5650. }
  5651. MDCFloatingLabel.attachTo = function (root) {
  5652. return new MDCFloatingLabel(root);
  5653. };
  5654. /**
  5655. * Styles the label to produce the label shake for errors.
  5656. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
  5657. */
  5658. MDCFloatingLabel.prototype.shake = function (shouldShake) {
  5659. this.foundation_.shake(shouldShake);
  5660. };
  5661. /**
  5662. * Styles the label to float/dock.
  5663. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
  5664. */
  5665. MDCFloatingLabel.prototype.float = function (shouldFloat) {
  5666. this.foundation_.float(shouldFloat);
  5667. };
  5668. MDCFloatingLabel.prototype.getWidth = function () {
  5669. return this.foundation_.getWidth();
  5670. };
  5671. MDCFloatingLabel.prototype.getDefaultFoundation = function () {
  5672. var _this = this;
  5673. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  5674. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  5675. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  5676. var adapter = {
  5677. addClass: function addClass(className) {
  5678. return _this.root_.classList.add(className);
  5679. },
  5680. removeClass: function removeClass(className) {
  5681. return _this.root_.classList.remove(className);
  5682. },
  5683. getWidth: function getWidth() {
  5684. return _this.root_.scrollWidth;
  5685. },
  5686. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  5687. return _this.listen(evtType, handler);
  5688. },
  5689. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  5690. return _this.unlisten(evtType, handler);
  5691. }
  5692. };
  5693. // tslint:enable:object-literal-sort-keys
  5694. return new foundation_1.MDCFloatingLabelFoundation(adapter);
  5695. };
  5696. return MDCFloatingLabel;
  5697. }(component_1.MDCComponent);
  5698. exports.MDCFloatingLabel = MDCFloatingLabel;
  5699. /***/ }),
  5700. /***/ "./packages/mdc-floating-label/constants.ts":
  5701. /*!**************************************************!*\
  5702. !*** ./packages/mdc-floating-label/constants.ts ***!
  5703. \**************************************************/
  5704. /*! no static exports found */
  5705. /***/ (function(module, exports, __webpack_require__) {
  5706. "use strict";
  5707. /**
  5708. * @license
  5709. * Copyright 2016 Google Inc.
  5710. *
  5711. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5712. * of this software and associated documentation files (the "Software"), to deal
  5713. * in the Software without restriction, including without limitation the rights
  5714. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5715. * copies of the Software, and to permit persons to whom the Software is
  5716. * furnished to do so, subject to the following conditions:
  5717. *
  5718. * The above copyright notice and this permission notice shall be included in
  5719. * all copies or substantial portions of the Software.
  5720. *
  5721. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5722. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5723. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5724. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5725. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5726. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5727. * THE SOFTWARE.
  5728. */
  5729. Object.defineProperty(exports, "__esModule", { value: true });
  5730. exports.cssClasses = {
  5731. LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
  5732. LABEL_SHAKE: 'mdc-floating-label--shake',
  5733. ROOT: 'mdc-floating-label'
  5734. };
  5735. /***/ }),
  5736. /***/ "./packages/mdc-floating-label/foundation.ts":
  5737. /*!***************************************************!*\
  5738. !*** ./packages/mdc-floating-label/foundation.ts ***!
  5739. \***************************************************/
  5740. /*! no static exports found */
  5741. /***/ (function(module, exports, __webpack_require__) {
  5742. "use strict";
  5743. /**
  5744. * @license
  5745. * Copyright 2016 Google Inc.
  5746. *
  5747. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5748. * of this software and associated documentation files (the "Software"), to deal
  5749. * in the Software without restriction, including without limitation the rights
  5750. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5751. * copies of the Software, and to permit persons to whom the Software is
  5752. * furnished to do so, subject to the following conditions:
  5753. *
  5754. * The above copyright notice and this permission notice shall be included in
  5755. * all copies or substantial portions of the Software.
  5756. *
  5757. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5758. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5759. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5760. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5761. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5762. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5763. * THE SOFTWARE.
  5764. */
  5765. var __extends = this && this.__extends || function () {
  5766. var _extendStatics = function extendStatics(d, b) {
  5767. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5768. d.__proto__ = b;
  5769. } || function (d, b) {
  5770. for (var p in b) {
  5771. if (b.hasOwnProperty(p)) d[p] = b[p];
  5772. }
  5773. };
  5774. return _extendStatics(d, b);
  5775. };
  5776. return function (d, b) {
  5777. _extendStatics(d, b);
  5778. function __() {
  5779. this.constructor = d;
  5780. }
  5781. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5782. };
  5783. }();
  5784. var __assign = this && this.__assign || function () {
  5785. __assign = Object.assign || function (t) {
  5786. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5787. s = arguments[i];
  5788. for (var p in s) {
  5789. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5790. }
  5791. }
  5792. return t;
  5793. };
  5794. return __assign.apply(this, arguments);
  5795. };
  5796. Object.defineProperty(exports, "__esModule", { value: true });
  5797. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5798. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts");
  5799. var MDCFloatingLabelFoundation = /** @class */function (_super) {
  5800. __extends(MDCFloatingLabelFoundation, _super);
  5801. function MDCFloatingLabelFoundation(adapter) {
  5802. var _this = _super.call(this, __assign({}, MDCFloatingLabelFoundation.defaultAdapter, adapter)) || this;
  5803. _this.shakeAnimationEndHandler_ = function () {
  5804. return _this.handleShakeAnimationEnd_();
  5805. };
  5806. return _this;
  5807. }
  5808. Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
  5809. get: function get() {
  5810. return constants_1.cssClasses;
  5811. },
  5812. enumerable: true,
  5813. configurable: true
  5814. });
  5815. Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
  5816. /**
  5817. * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
  5818. */
  5819. get: function get() {
  5820. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  5821. return {
  5822. addClass: function addClass() {
  5823. return undefined;
  5824. },
  5825. removeClass: function removeClass() {
  5826. return undefined;
  5827. },
  5828. getWidth: function getWidth() {
  5829. return 0;
  5830. },
  5831. registerInteractionHandler: function registerInteractionHandler() {
  5832. return undefined;
  5833. },
  5834. deregisterInteractionHandler: function deregisterInteractionHandler() {
  5835. return undefined;
  5836. }
  5837. };
  5838. // tslint:enable:object-literal-sort-keys
  5839. },
  5840. enumerable: true,
  5841. configurable: true
  5842. });
  5843. MDCFloatingLabelFoundation.prototype.init = function () {
  5844. this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_);
  5845. };
  5846. MDCFloatingLabelFoundation.prototype.destroy = function () {
  5847. this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_);
  5848. };
  5849. /**
  5850. * Returns the width of the label element.
  5851. */
  5852. MDCFloatingLabelFoundation.prototype.getWidth = function () {
  5853. return this.adapter_.getWidth();
  5854. };
  5855. /**
  5856. * Styles the label to produce a shake animation to indicate an error.
  5857. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
  5858. */
  5859. MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
  5860. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  5861. if (shouldShake) {
  5862. this.adapter_.addClass(LABEL_SHAKE);
  5863. } else {
  5864. this.adapter_.removeClass(LABEL_SHAKE);
  5865. }
  5866. };
  5867. /**
  5868. * Styles the label to float or dock.
  5869. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
  5870. */
  5871. MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
  5872. var _a = MDCFloatingLabelFoundation.cssClasses,
  5873. LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
  5874. LABEL_SHAKE = _a.LABEL_SHAKE;
  5875. if (shouldFloat) {
  5876. this.adapter_.addClass(LABEL_FLOAT_ABOVE);
  5877. } else {
  5878. this.adapter_.removeClass(LABEL_FLOAT_ABOVE);
  5879. this.adapter_.removeClass(LABEL_SHAKE);
  5880. }
  5881. };
  5882. MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () {
  5883. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  5884. this.adapter_.removeClass(LABEL_SHAKE);
  5885. };
  5886. return MDCFloatingLabelFoundation;
  5887. }(foundation_1.MDCFoundation);
  5888. exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
  5889. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5890. exports.default = MDCFloatingLabelFoundation;
  5891. /***/ }),
  5892. /***/ "./packages/mdc-floating-label/index.ts":
  5893. /*!**********************************************!*\
  5894. !*** ./packages/mdc-floating-label/index.ts ***!
  5895. \**********************************************/
  5896. /*! no static exports found */
  5897. /***/ (function(module, exports, __webpack_require__) {
  5898. "use strict";
  5899. /**
  5900. * @license
  5901. * Copyright 2019 Google Inc.
  5902. *
  5903. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5904. * of this software and associated documentation files (the "Software"), to deal
  5905. * in the Software without restriction, including without limitation the rights
  5906. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5907. * copies of the Software, and to permit persons to whom the Software is
  5908. * furnished to do so, subject to the following conditions:
  5909. *
  5910. * The above copyright notice and this permission notice shall be included in
  5911. * all copies or substantial portions of the Software.
  5912. *
  5913. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5914. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5915. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5916. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5917. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5918. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5919. * THE SOFTWARE.
  5920. */
  5921. function __export(m) {
  5922. for (var p in m) {
  5923. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  5924. }
  5925. }
  5926. Object.defineProperty(exports, "__esModule", { value: true });
  5927. __export(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts"));
  5928. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"));
  5929. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"));
  5930. /***/ }),
  5931. /***/ "./packages/mdc-form-field/component.ts":
  5932. /*!**********************************************!*\
  5933. !*** ./packages/mdc-form-field/component.ts ***!
  5934. \**********************************************/
  5935. /*! no static exports found */
  5936. /***/ (function(module, exports, __webpack_require__) {
  5937. "use strict";
  5938. /**
  5939. * @license
  5940. * Copyright 2017 Google Inc.
  5941. *
  5942. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5943. * of this software and associated documentation files (the "Software"), to deal
  5944. * in the Software without restriction, including without limitation the rights
  5945. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5946. * copies of the Software, and to permit persons to whom the Software is
  5947. * furnished to do so, subject to the following conditions:
  5948. *
  5949. * The above copyright notice and this permission notice shall be included in
  5950. * all copies or substantial portions of the Software.
  5951. *
  5952. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5953. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5954. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5955. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5956. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5957. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5958. * THE SOFTWARE.
  5959. */
  5960. var __extends = this && this.__extends || function () {
  5961. var _extendStatics = function extendStatics(d, b) {
  5962. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5963. d.__proto__ = b;
  5964. } || function (d, b) {
  5965. for (var p in b) {
  5966. if (b.hasOwnProperty(p)) d[p] = b[p];
  5967. }
  5968. };
  5969. return _extendStatics(d, b);
  5970. };
  5971. return function (d, b) {
  5972. _extendStatics(d, b);
  5973. function __() {
  5974. this.constructor = d;
  5975. }
  5976. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5977. };
  5978. }();
  5979. Object.defineProperty(exports, "__esModule", { value: true });
  5980. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  5981. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts");
  5982. var MDCFormField = /** @class */function (_super) {
  5983. __extends(MDCFormField, _super);
  5984. function MDCFormField() {
  5985. return _super !== null && _super.apply(this, arguments) || this;
  5986. }
  5987. MDCFormField.attachTo = function (root) {
  5988. return new MDCFormField(root);
  5989. };
  5990. Object.defineProperty(MDCFormField.prototype, "input", {
  5991. get: function get() {
  5992. return this.input_;
  5993. },
  5994. set: function set(input) {
  5995. this.input_ = input;
  5996. },
  5997. enumerable: true,
  5998. configurable: true
  5999. });
  6000. Object.defineProperty(MDCFormField.prototype, "label_", {
  6001. get: function get() {
  6002. var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR;
  6003. return this.root_.querySelector(LABEL_SELECTOR);
  6004. },
  6005. enumerable: true,
  6006. configurable: true
  6007. });
  6008. MDCFormField.prototype.getDefaultFoundation = function () {
  6009. var _this = this;
  6010. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6011. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6012. var adapter = {
  6013. activateInputRipple: function activateInputRipple() {
  6014. if (_this.input_ && _this.input_.ripple) {
  6015. _this.input_.ripple.activate();
  6016. }
  6017. },
  6018. deactivateInputRipple: function deactivateInputRipple() {
  6019. if (_this.input_ && _this.input_.ripple) {
  6020. _this.input_.ripple.deactivate();
  6021. }
  6022. },
  6023. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  6024. if (_this.label_) {
  6025. _this.label_.removeEventListener(evtType, handler);
  6026. }
  6027. },
  6028. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  6029. if (_this.label_) {
  6030. _this.label_.addEventListener(evtType, handler);
  6031. }
  6032. }
  6033. };
  6034. return new foundation_1.MDCFormFieldFoundation(adapter);
  6035. };
  6036. return MDCFormField;
  6037. }(component_1.MDCComponent);
  6038. exports.MDCFormField = MDCFormField;
  6039. /***/ }),
  6040. /***/ "./packages/mdc-form-field/constants.ts":
  6041. /*!**********************************************!*\
  6042. !*** ./packages/mdc-form-field/constants.ts ***!
  6043. \**********************************************/
  6044. /*! no static exports found */
  6045. /***/ (function(module, exports, __webpack_require__) {
  6046. "use strict";
  6047. /**
  6048. * @license
  6049. * Copyright 2017 Google Inc.
  6050. *
  6051. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6052. * of this software and associated documentation files (the "Software"), to deal
  6053. * in the Software without restriction, including without limitation the rights
  6054. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6055. * copies of the Software, and to permit persons to whom the Software is
  6056. * furnished to do so, subject to the following conditions:
  6057. *
  6058. * The above copyright notice and this permission notice shall be included in
  6059. * all copies or substantial portions of the Software.
  6060. *
  6061. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6062. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6063. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6064. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6065. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6066. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6067. * THE SOFTWARE.
  6068. */
  6069. Object.defineProperty(exports, "__esModule", { value: true });
  6070. exports.cssClasses = {
  6071. ROOT: 'mdc-form-field'
  6072. };
  6073. exports.strings = {
  6074. LABEL_SELECTOR: '.mdc-form-field > label'
  6075. };
  6076. /***/ }),
  6077. /***/ "./packages/mdc-form-field/foundation.ts":
  6078. /*!***********************************************!*\
  6079. !*** ./packages/mdc-form-field/foundation.ts ***!
  6080. \***********************************************/
  6081. /*! no static exports found */
  6082. /***/ (function(module, exports, __webpack_require__) {
  6083. "use strict";
  6084. /**
  6085. * @license
  6086. * Copyright 2017 Google Inc.
  6087. *
  6088. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6089. * of this software and associated documentation files (the "Software"), to deal
  6090. * in the Software without restriction, including without limitation the rights
  6091. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6092. * copies of the Software, and to permit persons to whom the Software is
  6093. * furnished to do so, subject to the following conditions:
  6094. *
  6095. * The above copyright notice and this permission notice shall be included in
  6096. * all copies or substantial portions of the Software.
  6097. *
  6098. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6099. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6100. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6101. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6102. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6103. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6104. * THE SOFTWARE.
  6105. */
  6106. var __extends = this && this.__extends || function () {
  6107. var _extendStatics = function extendStatics(d, b) {
  6108. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6109. d.__proto__ = b;
  6110. } || function (d, b) {
  6111. for (var p in b) {
  6112. if (b.hasOwnProperty(p)) d[p] = b[p];
  6113. }
  6114. };
  6115. return _extendStatics(d, b);
  6116. };
  6117. return function (d, b) {
  6118. _extendStatics(d, b);
  6119. function __() {
  6120. this.constructor = d;
  6121. }
  6122. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6123. };
  6124. }();
  6125. var __assign = this && this.__assign || function () {
  6126. __assign = Object.assign || function (t) {
  6127. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6128. s = arguments[i];
  6129. for (var p in s) {
  6130. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6131. }
  6132. }
  6133. return t;
  6134. };
  6135. return __assign.apply(this, arguments);
  6136. };
  6137. Object.defineProperty(exports, "__esModule", { value: true });
  6138. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6139. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts");
  6140. var MDCFormFieldFoundation = /** @class */function (_super) {
  6141. __extends(MDCFormFieldFoundation, _super);
  6142. function MDCFormFieldFoundation(adapter) {
  6143. var _this = _super.call(this, __assign({}, MDCFormFieldFoundation.defaultAdapter, adapter)) || this;
  6144. _this.clickHandler_ = function () {
  6145. return _this.handleClick_();
  6146. };
  6147. return _this;
  6148. }
  6149. Object.defineProperty(MDCFormFieldFoundation, "cssClasses", {
  6150. get: function get() {
  6151. return constants_1.cssClasses;
  6152. },
  6153. enumerable: true,
  6154. configurable: true
  6155. });
  6156. Object.defineProperty(MDCFormFieldFoundation, "strings", {
  6157. get: function get() {
  6158. return constants_1.strings;
  6159. },
  6160. enumerable: true,
  6161. configurable: true
  6162. });
  6163. Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", {
  6164. get: function get() {
  6165. return {
  6166. activateInputRipple: function activateInputRipple() {
  6167. return undefined;
  6168. },
  6169. deactivateInputRipple: function deactivateInputRipple() {
  6170. return undefined;
  6171. },
  6172. deregisterInteractionHandler: function deregisterInteractionHandler() {
  6173. return undefined;
  6174. },
  6175. registerInteractionHandler: function registerInteractionHandler() {
  6176. return undefined;
  6177. }
  6178. };
  6179. },
  6180. enumerable: true,
  6181. configurable: true
  6182. });
  6183. MDCFormFieldFoundation.prototype.init = function () {
  6184. this.adapter_.registerInteractionHandler('click', this.clickHandler_);
  6185. };
  6186. MDCFormFieldFoundation.prototype.destroy = function () {
  6187. this.adapter_.deregisterInteractionHandler('click', this.clickHandler_);
  6188. };
  6189. MDCFormFieldFoundation.prototype.handleClick_ = function () {
  6190. var _this = this;
  6191. this.adapter_.activateInputRipple();
  6192. requestAnimationFrame(function () {
  6193. return _this.adapter_.deactivateInputRipple();
  6194. });
  6195. };
  6196. return MDCFormFieldFoundation;
  6197. }(foundation_1.MDCFoundation);
  6198. exports.MDCFormFieldFoundation = MDCFormFieldFoundation;
  6199. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6200. exports.default = MDCFormFieldFoundation;
  6201. /***/ }),
  6202. /***/ "./packages/mdc-form-field/index.ts":
  6203. /*!******************************************!*\
  6204. !*** ./packages/mdc-form-field/index.ts ***!
  6205. \******************************************/
  6206. /*! no static exports found */
  6207. /***/ (function(module, exports, __webpack_require__) {
  6208. "use strict";
  6209. /**
  6210. * @license
  6211. * Copyright 2019 Google Inc.
  6212. *
  6213. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6214. * of this software and associated documentation files (the "Software"), to deal
  6215. * in the Software without restriction, including without limitation the rights
  6216. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6217. * copies of the Software, and to permit persons to whom the Software is
  6218. * furnished to do so, subject to the following conditions:
  6219. *
  6220. * The above copyright notice and this permission notice shall be included in
  6221. * all copies or substantial portions of the Software.
  6222. *
  6223. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6224. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6225. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6226. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6227. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6228. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6229. * THE SOFTWARE.
  6230. */
  6231. function __export(m) {
  6232. for (var p in m) {
  6233. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  6234. }
  6235. }
  6236. Object.defineProperty(exports, "__esModule", { value: true });
  6237. __export(__webpack_require__(/*! ./component */ "./packages/mdc-form-field/component.ts"));
  6238. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"));
  6239. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"));
  6240. /***/ }),
  6241. /***/ "./packages/mdc-grid-list/component.ts":
  6242. /*!*********************************************!*\
  6243. !*** ./packages/mdc-grid-list/component.ts ***!
  6244. \*********************************************/
  6245. /*! no static exports found */
  6246. /***/ (function(module, exports, __webpack_require__) {
  6247. "use strict";
  6248. /**
  6249. * @license
  6250. * Copyright 2016 Google Inc.
  6251. *
  6252. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6253. * of this software and associated documentation files (the "Software"), to deal
  6254. * in the Software without restriction, including without limitation the rights
  6255. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6256. * copies of the Software, and to permit persons to whom the Software is
  6257. * furnished to do so, subject to the following conditions:
  6258. *
  6259. * The above copyright notice and this permission notice shall be included in
  6260. * all copies or substantial portions of the Software.
  6261. *
  6262. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6263. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6264. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6265. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6266. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6267. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6268. * THE SOFTWARE.
  6269. */
  6270. var __extends = this && this.__extends || function () {
  6271. var _extendStatics = function extendStatics(d, b) {
  6272. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6273. d.__proto__ = b;
  6274. } || function (d, b) {
  6275. for (var p in b) {
  6276. if (b.hasOwnProperty(p)) d[p] = b[p];
  6277. }
  6278. };
  6279. return _extendStatics(d, b);
  6280. };
  6281. return function (d, b) {
  6282. _extendStatics(d, b);
  6283. function __() {
  6284. this.constructor = d;
  6285. }
  6286. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6287. };
  6288. }();
  6289. Object.defineProperty(exports, "__esModule", { value: true });
  6290. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6291. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-grid-list/foundation.ts");
  6292. var MDCGridList = /** @class */function (_super) {
  6293. __extends(MDCGridList, _super);
  6294. function MDCGridList() {
  6295. return _super !== null && _super.apply(this, arguments) || this;
  6296. }
  6297. MDCGridList.attachTo = function (root) {
  6298. return new MDCGridList(root);
  6299. };
  6300. MDCGridList.prototype.getDefaultFoundation = function () {
  6301. var _this = this;
  6302. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6303. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6304. var adapter = {
  6305. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  6306. return window.removeEventListener('resize', handler);
  6307. },
  6308. getNumberOfTiles: function getNumberOfTiles() {
  6309. return _this.root_.querySelectorAll(foundation_1.MDCGridListFoundation.strings.TILE_SELECTOR).length;
  6310. },
  6311. getOffsetWidth: function getOffsetWidth() {
  6312. return _this.root_.offsetWidth;
  6313. },
  6314. getOffsetWidthForTileAtIndex: function getOffsetWidthForTileAtIndex(index) {
  6315. var tileEl = _this.root_.querySelectorAll(foundation_1.MDCGridListFoundation.strings.TILE_SELECTOR)[index];
  6316. return tileEl.offsetWidth;
  6317. },
  6318. registerResizeHandler: function registerResizeHandler(handler) {
  6319. return window.addEventListener('resize', handler);
  6320. },
  6321. setStyleForTilesElement: function setStyleForTilesElement(property, value) {
  6322. var tilesEl = _this.root_.querySelector(foundation_1.MDCGridListFoundation.strings.TILES_SELECTOR);
  6323. tilesEl.style[property] = value;
  6324. }
  6325. };
  6326. return new foundation_1.MDCGridListFoundation(adapter);
  6327. };
  6328. return MDCGridList;
  6329. }(component_1.MDCComponent);
  6330. exports.MDCGridList = MDCGridList;
  6331. /***/ }),
  6332. /***/ "./packages/mdc-grid-list/constants.ts":
  6333. /*!*********************************************!*\
  6334. !*** ./packages/mdc-grid-list/constants.ts ***!
  6335. \*********************************************/
  6336. /*! no static exports found */
  6337. /***/ (function(module, exports, __webpack_require__) {
  6338. "use strict";
  6339. /**
  6340. * @license
  6341. * Copyright 2016 Google Inc.
  6342. *
  6343. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6344. * of this software and associated documentation files (the "Software"), to deal
  6345. * in the Software without restriction, including without limitation the rights
  6346. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6347. * copies of the Software, and to permit persons to whom the Software is
  6348. * furnished to do so, subject to the following conditions:
  6349. *
  6350. * The above copyright notice and this permission notice shall be included in
  6351. * all copies or substantial portions of the Software.
  6352. *
  6353. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6354. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6355. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6356. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6357. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6358. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6359. * THE SOFTWARE.
  6360. */
  6361. Object.defineProperty(exports, "__esModule", { value: true });
  6362. exports.strings = {
  6363. TILES_SELECTOR: '.mdc-grid-list__tiles',
  6364. TILE_SELECTOR: '.mdc-grid-tile'
  6365. };
  6366. /***/ }),
  6367. /***/ "./packages/mdc-grid-list/foundation.ts":
  6368. /*!**********************************************!*\
  6369. !*** ./packages/mdc-grid-list/foundation.ts ***!
  6370. \**********************************************/
  6371. /*! no static exports found */
  6372. /***/ (function(module, exports, __webpack_require__) {
  6373. "use strict";
  6374. /**
  6375. * @license
  6376. * Copyright 2016 Google Inc.
  6377. *
  6378. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6379. * of this software and associated documentation files (the "Software"), to deal
  6380. * in the Software without restriction, including without limitation the rights
  6381. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6382. * copies of the Software, and to permit persons to whom the Software is
  6383. * furnished to do so, subject to the following conditions:
  6384. *
  6385. * The above copyright notice and this permission notice shall be included in
  6386. * all copies or substantial portions of the Software.
  6387. *
  6388. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6389. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6390. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6391. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6392. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6393. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6394. * THE SOFTWARE.
  6395. */
  6396. var __extends = this && this.__extends || function () {
  6397. var _extendStatics = function extendStatics(d, b) {
  6398. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6399. d.__proto__ = b;
  6400. } || function (d, b) {
  6401. for (var p in b) {
  6402. if (b.hasOwnProperty(p)) d[p] = b[p];
  6403. }
  6404. };
  6405. return _extendStatics(d, b);
  6406. };
  6407. return function (d, b) {
  6408. _extendStatics(d, b);
  6409. function __() {
  6410. this.constructor = d;
  6411. }
  6412. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6413. };
  6414. }();
  6415. var __assign = this && this.__assign || function () {
  6416. __assign = Object.assign || function (t) {
  6417. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6418. s = arguments[i];
  6419. for (var p in s) {
  6420. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6421. }
  6422. }
  6423. return t;
  6424. };
  6425. return __assign.apply(this, arguments);
  6426. };
  6427. Object.defineProperty(exports, "__esModule", { value: true });
  6428. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6429. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-grid-list/constants.ts");
  6430. var MDCGridListFoundation = /** @class */function (_super) {
  6431. __extends(MDCGridListFoundation, _super);
  6432. /* istanbul ignore next: optional argument is not a branch statement */
  6433. function MDCGridListFoundation(adapter) {
  6434. var _this = _super.call(this, __assign({}, MDCGridListFoundation.defaultAdapter, adapter)) || this;
  6435. _this.resizeFrame_ = 0;
  6436. _this.resizeHandler_ = _this.alignCenter.bind(_this);
  6437. return _this;
  6438. }
  6439. Object.defineProperty(MDCGridListFoundation, "strings", {
  6440. get: function get() {
  6441. return constants_1.strings;
  6442. },
  6443. enumerable: true,
  6444. configurable: true
  6445. });
  6446. Object.defineProperty(MDCGridListFoundation, "defaultAdapter", {
  6447. get: function get() {
  6448. return {
  6449. deregisterResizeHandler: function deregisterResizeHandler() {
  6450. return undefined;
  6451. },
  6452. getNumberOfTiles: function getNumberOfTiles() {
  6453. return 0;
  6454. },
  6455. getOffsetWidth: function getOffsetWidth() {
  6456. return 0;
  6457. },
  6458. getOffsetWidthForTileAtIndex: function getOffsetWidthForTileAtIndex() {
  6459. return 0;
  6460. },
  6461. registerResizeHandler: function registerResizeHandler() {
  6462. return undefined;
  6463. },
  6464. setStyleForTilesElement: function setStyleForTilesElement() {
  6465. return undefined;
  6466. }
  6467. };
  6468. },
  6469. enumerable: true,
  6470. configurable: true
  6471. });
  6472. MDCGridListFoundation.prototype.init = function () {
  6473. this.alignCenter();
  6474. this.adapter_.registerResizeHandler(this.resizeHandler_);
  6475. };
  6476. MDCGridListFoundation.prototype.destroy = function () {
  6477. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  6478. };
  6479. MDCGridListFoundation.prototype.alignCenter = function () {
  6480. var _this = this;
  6481. cancelAnimationFrame(this.resizeFrame_);
  6482. this.resizeFrame_ = requestAnimationFrame(function () {
  6483. _this.alignCenter_();
  6484. _this.resizeFrame_ = 0;
  6485. });
  6486. };
  6487. MDCGridListFoundation.prototype.alignCenter_ = function () {
  6488. if (this.adapter_.getNumberOfTiles() === 0) {
  6489. return;
  6490. }
  6491. var gridWidth = this.adapter_.getOffsetWidth();
  6492. var itemWidth = this.adapter_.getOffsetWidthForTileAtIndex(0);
  6493. var tilesWidth = itemWidth * Math.floor(gridWidth / itemWidth);
  6494. this.adapter_.setStyleForTilesElement('width', tilesWidth + "px");
  6495. };
  6496. return MDCGridListFoundation;
  6497. }(foundation_1.MDCFoundation);
  6498. exports.MDCGridListFoundation = MDCGridListFoundation;
  6499. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6500. exports.default = MDCGridListFoundation;
  6501. /***/ }),
  6502. /***/ "./packages/mdc-grid-list/index.ts":
  6503. /*!*****************************************!*\
  6504. !*** ./packages/mdc-grid-list/index.ts ***!
  6505. \*****************************************/
  6506. /*! no static exports found */
  6507. /***/ (function(module, exports, __webpack_require__) {
  6508. "use strict";
  6509. /**
  6510. * @license
  6511. * Copyright 2019 Google Inc.
  6512. *
  6513. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6514. * of this software and associated documentation files (the "Software"), to deal
  6515. * in the Software without restriction, including without limitation the rights
  6516. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6517. * copies of the Software, and to permit persons to whom the Software is
  6518. * furnished to do so, subject to the following conditions:
  6519. *
  6520. * The above copyright notice and this permission notice shall be included in
  6521. * all copies or substantial portions of the Software.
  6522. *
  6523. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6524. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6525. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6526. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6527. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6528. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6529. * THE SOFTWARE.
  6530. */
  6531. function __export(m) {
  6532. for (var p in m) {
  6533. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  6534. }
  6535. }
  6536. Object.defineProperty(exports, "__esModule", { value: true });
  6537. __export(__webpack_require__(/*! ./component */ "./packages/mdc-grid-list/component.ts"));
  6538. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-grid-list/constants.ts"));
  6539. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-grid-list/foundation.ts"));
  6540. /***/ }),
  6541. /***/ "./packages/mdc-icon-button/component.ts":
  6542. /*!***********************************************!*\
  6543. !*** ./packages/mdc-icon-button/component.ts ***!
  6544. \***********************************************/
  6545. /*! no static exports found */
  6546. /***/ (function(module, exports, __webpack_require__) {
  6547. "use strict";
  6548. /**
  6549. * @license
  6550. * Copyright 2018 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. var __extends = this && this.__extends || function () {
  6571. var _extendStatics = function extendStatics(d, b) {
  6572. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6573. d.__proto__ = b;
  6574. } || function (d, b) {
  6575. for (var p in b) {
  6576. if (b.hasOwnProperty(p)) d[p] = b[p];
  6577. }
  6578. };
  6579. return _extendStatics(d, b);
  6580. };
  6581. return function (d, b) {
  6582. _extendStatics(d, b);
  6583. function __() {
  6584. this.constructor = d;
  6585. }
  6586. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6587. };
  6588. }();
  6589. Object.defineProperty(exports, "__esModule", { value: true });
  6590. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6591. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  6592. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts");
  6593. var strings = foundation_1.MDCIconButtonToggleFoundation.strings;
  6594. var MDCIconButtonToggle = /** @class */function (_super) {
  6595. __extends(MDCIconButtonToggle, _super);
  6596. function MDCIconButtonToggle() {
  6597. var _this = _super !== null && _super.apply(this, arguments) || this;
  6598. _this.ripple_ = _this.createRipple_();
  6599. return _this;
  6600. }
  6601. MDCIconButtonToggle.attachTo = function (root) {
  6602. return new MDCIconButtonToggle(root);
  6603. };
  6604. MDCIconButtonToggle.prototype.initialSyncWithDOM = function () {
  6605. var _this = this;
  6606. this.handleClick_ = function () {
  6607. return _this.foundation_.handleClick();
  6608. };
  6609. this.listen('click', this.handleClick_);
  6610. };
  6611. MDCIconButtonToggle.prototype.destroy = function () {
  6612. this.unlisten('click', this.handleClick_);
  6613. this.ripple_.destroy();
  6614. _super.prototype.destroy.call(this);
  6615. };
  6616. MDCIconButtonToggle.prototype.getDefaultFoundation = function () {
  6617. var _this = this;
  6618. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6619. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6620. var adapter = {
  6621. addClass: function addClass(className) {
  6622. return _this.root_.classList.add(className);
  6623. },
  6624. hasClass: function hasClass(className) {
  6625. return _this.root_.classList.contains(className);
  6626. },
  6627. notifyChange: function notifyChange(evtData) {
  6628. return _this.emit(strings.CHANGE_EVENT, evtData);
  6629. },
  6630. removeClass: function removeClass(className) {
  6631. return _this.root_.classList.remove(className);
  6632. },
  6633. setAttr: function setAttr(attrName, attrValue) {
  6634. return _this.root_.setAttribute(attrName, attrValue);
  6635. }
  6636. };
  6637. return new foundation_1.MDCIconButtonToggleFoundation(adapter);
  6638. };
  6639. Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", {
  6640. get: function get() {
  6641. return this.ripple_;
  6642. },
  6643. enumerable: true,
  6644. configurable: true
  6645. });
  6646. Object.defineProperty(MDCIconButtonToggle.prototype, "on", {
  6647. get: function get() {
  6648. return this.foundation_.isOn();
  6649. },
  6650. set: function set(isOn) {
  6651. this.foundation_.toggle(isOn);
  6652. },
  6653. enumerable: true,
  6654. configurable: true
  6655. });
  6656. MDCIconButtonToggle.prototype.createRipple_ = function () {
  6657. var ripple = new component_2.MDCRipple(this.root_);
  6658. ripple.unbounded = true;
  6659. return ripple;
  6660. };
  6661. return MDCIconButtonToggle;
  6662. }(component_1.MDCComponent);
  6663. exports.MDCIconButtonToggle = MDCIconButtonToggle;
  6664. /***/ }),
  6665. /***/ "./packages/mdc-icon-button/constants.ts":
  6666. /*!***********************************************!*\
  6667. !*** ./packages/mdc-icon-button/constants.ts ***!
  6668. \***********************************************/
  6669. /*! no static exports found */
  6670. /***/ (function(module, exports, __webpack_require__) {
  6671. "use strict";
  6672. /**
  6673. * @license
  6674. * Copyright 2018 Google Inc.
  6675. *
  6676. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6677. * of this software and associated documentation files (the "Software"), to deal
  6678. * in the Software without restriction, including without limitation the rights
  6679. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6680. * copies of the Software, and to permit persons to whom the Software is
  6681. * furnished to do so, subject to the following conditions:
  6682. *
  6683. * The above copyright notice and this permission notice shall be included in
  6684. * all copies or substantial portions of the Software.
  6685. *
  6686. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6687. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6688. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6689. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6690. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6691. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6692. * THE SOFTWARE.
  6693. */
  6694. Object.defineProperty(exports, "__esModule", { value: true });
  6695. exports.cssClasses = {
  6696. ICON_BUTTON_ON: 'mdc-icon-button--on',
  6697. ROOT: 'mdc-icon-button'
  6698. };
  6699. exports.strings = {
  6700. ARIA_PRESSED: 'aria-pressed',
  6701. CHANGE_EVENT: 'MDCIconButtonToggle:change'
  6702. };
  6703. /***/ }),
  6704. /***/ "./packages/mdc-icon-button/foundation.ts":
  6705. /*!************************************************!*\
  6706. !*** ./packages/mdc-icon-button/foundation.ts ***!
  6707. \************************************************/
  6708. /*! no static exports found */
  6709. /***/ (function(module, exports, __webpack_require__) {
  6710. "use strict";
  6711. /**
  6712. * @license
  6713. * Copyright 2018 Google Inc.
  6714. *
  6715. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6716. * of this software and associated documentation files (the "Software"), to deal
  6717. * in the Software without restriction, including without limitation the rights
  6718. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6719. * copies of the Software, and to permit persons to whom the Software is
  6720. * furnished to do so, subject to the following conditions:
  6721. *
  6722. * The above copyright notice and this permission notice shall be included in
  6723. * all copies or substantial portions of the Software.
  6724. *
  6725. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6726. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6727. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6728. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6729. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6730. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6731. * THE SOFTWARE.
  6732. */
  6733. var __extends = this && this.__extends || function () {
  6734. var _extendStatics = function extendStatics(d, b) {
  6735. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6736. d.__proto__ = b;
  6737. } || function (d, b) {
  6738. for (var p in b) {
  6739. if (b.hasOwnProperty(p)) d[p] = b[p];
  6740. }
  6741. };
  6742. return _extendStatics(d, b);
  6743. };
  6744. return function (d, b) {
  6745. _extendStatics(d, b);
  6746. function __() {
  6747. this.constructor = d;
  6748. }
  6749. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6750. };
  6751. }();
  6752. var __assign = this && this.__assign || function () {
  6753. __assign = Object.assign || function (t) {
  6754. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6755. s = arguments[i];
  6756. for (var p in s) {
  6757. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6758. }
  6759. }
  6760. return t;
  6761. };
  6762. return __assign.apply(this, arguments);
  6763. };
  6764. Object.defineProperty(exports, "__esModule", { value: true });
  6765. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6766. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts");
  6767. var MDCIconButtonToggleFoundation = /** @class */function (_super) {
  6768. __extends(MDCIconButtonToggleFoundation, _super);
  6769. function MDCIconButtonToggleFoundation(adapter) {
  6770. return _super.call(this, __assign({}, MDCIconButtonToggleFoundation.defaultAdapter, adapter)) || this;
  6771. }
  6772. Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", {
  6773. get: function get() {
  6774. return constants_1.cssClasses;
  6775. },
  6776. enumerable: true,
  6777. configurable: true
  6778. });
  6779. Object.defineProperty(MDCIconButtonToggleFoundation, "strings", {
  6780. get: function get() {
  6781. return constants_1.strings;
  6782. },
  6783. enumerable: true,
  6784. configurable: true
  6785. });
  6786. Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", {
  6787. get: function get() {
  6788. return {
  6789. addClass: function addClass() {
  6790. return undefined;
  6791. },
  6792. hasClass: function hasClass() {
  6793. return false;
  6794. },
  6795. notifyChange: function notifyChange() {
  6796. return undefined;
  6797. },
  6798. removeClass: function removeClass() {
  6799. return undefined;
  6800. },
  6801. setAttr: function setAttr() {
  6802. return undefined;
  6803. }
  6804. };
  6805. },
  6806. enumerable: true,
  6807. configurable: true
  6808. });
  6809. MDCIconButtonToggleFoundation.prototype.init = function () {
  6810. this.adapter_.setAttr(constants_1.strings.ARIA_PRESSED, "" + this.isOn());
  6811. };
  6812. MDCIconButtonToggleFoundation.prototype.handleClick = function () {
  6813. this.toggle();
  6814. this.adapter_.notifyChange({ isOn: this.isOn() });
  6815. };
  6816. MDCIconButtonToggleFoundation.prototype.isOn = function () {
  6817. return this.adapter_.hasClass(constants_1.cssClasses.ICON_BUTTON_ON);
  6818. };
  6819. MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) {
  6820. if (isOn === void 0) {
  6821. isOn = !this.isOn();
  6822. }
  6823. if (isOn) {
  6824. this.adapter_.addClass(constants_1.cssClasses.ICON_BUTTON_ON);
  6825. } else {
  6826. this.adapter_.removeClass(constants_1.cssClasses.ICON_BUTTON_ON);
  6827. }
  6828. this.adapter_.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn);
  6829. };
  6830. return MDCIconButtonToggleFoundation;
  6831. }(foundation_1.MDCFoundation);
  6832. exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation;
  6833. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6834. exports.default = MDCIconButtonToggleFoundation;
  6835. /***/ }),
  6836. /***/ "./packages/mdc-icon-button/index.ts":
  6837. /*!*******************************************!*\
  6838. !*** ./packages/mdc-icon-button/index.ts ***!
  6839. \*******************************************/
  6840. /*! no static exports found */
  6841. /***/ (function(module, exports, __webpack_require__) {
  6842. "use strict";
  6843. /**
  6844. * @license
  6845. * Copyright 2019 Google Inc.
  6846. *
  6847. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6848. * of this software and associated documentation files (the "Software"), to deal
  6849. * in the Software without restriction, including without limitation the rights
  6850. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6851. * copies of the Software, and to permit persons to whom the Software is
  6852. * furnished to do so, subject to the following conditions:
  6853. *
  6854. * The above copyright notice and this permission notice shall be included in
  6855. * all copies or substantial portions of the Software.
  6856. *
  6857. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6858. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6859. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6860. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6861. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6862. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6863. * THE SOFTWARE.
  6864. */
  6865. function __export(m) {
  6866. for (var p in m) {
  6867. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  6868. }
  6869. }
  6870. Object.defineProperty(exports, "__esModule", { value: true });
  6871. __export(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts"));
  6872. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"));
  6873. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"));
  6874. /***/ }),
  6875. /***/ "./packages/mdc-line-ripple/component.ts":
  6876. /*!***********************************************!*\
  6877. !*** ./packages/mdc-line-ripple/component.ts ***!
  6878. \***********************************************/
  6879. /*! no static exports found */
  6880. /***/ (function(module, exports, __webpack_require__) {
  6881. "use strict";
  6882. /**
  6883. * @license
  6884. * Copyright 2018 Google Inc.
  6885. *
  6886. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6887. * of this software and associated documentation files (the "Software"), to deal
  6888. * in the Software without restriction, including without limitation the rights
  6889. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6890. * copies of the Software, and to permit persons to whom the Software is
  6891. * furnished to do so, subject to the following conditions:
  6892. *
  6893. * The above copyright notice and this permission notice shall be included in
  6894. * all copies or substantial portions of the Software.
  6895. *
  6896. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6897. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6898. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6899. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6900. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6901. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6902. * THE SOFTWARE.
  6903. */
  6904. var __extends = this && this.__extends || function () {
  6905. var _extendStatics = function extendStatics(d, b) {
  6906. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6907. d.__proto__ = b;
  6908. } || function (d, b) {
  6909. for (var p in b) {
  6910. if (b.hasOwnProperty(p)) d[p] = b[p];
  6911. }
  6912. };
  6913. return _extendStatics(d, b);
  6914. };
  6915. return function (d, b) {
  6916. _extendStatics(d, b);
  6917. function __() {
  6918. this.constructor = d;
  6919. }
  6920. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6921. };
  6922. }();
  6923. Object.defineProperty(exports, "__esModule", { value: true });
  6924. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6925. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts");
  6926. var MDCLineRipple = /** @class */function (_super) {
  6927. __extends(MDCLineRipple, _super);
  6928. function MDCLineRipple() {
  6929. return _super !== null && _super.apply(this, arguments) || this;
  6930. }
  6931. MDCLineRipple.attachTo = function (root) {
  6932. return new MDCLineRipple(root);
  6933. };
  6934. /**
  6935. * Activates the line ripple
  6936. */
  6937. MDCLineRipple.prototype.activate = function () {
  6938. this.foundation_.activate();
  6939. };
  6940. /**
  6941. * Deactivates the line ripple
  6942. */
  6943. MDCLineRipple.prototype.deactivate = function () {
  6944. this.foundation_.deactivate();
  6945. };
  6946. /**
  6947. * Sets the transform origin given a user's click location.
  6948. * The `rippleCenter` is the x-coordinate of the middle of the ripple.
  6949. */
  6950. MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
  6951. this.foundation_.setRippleCenter(xCoordinate);
  6952. };
  6953. MDCLineRipple.prototype.getDefaultFoundation = function () {
  6954. var _this = this;
  6955. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6956. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6957. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6958. var adapter = {
  6959. addClass: function addClass(className) {
  6960. return _this.root_.classList.add(className);
  6961. },
  6962. removeClass: function removeClass(className) {
  6963. return _this.root_.classList.remove(className);
  6964. },
  6965. hasClass: function hasClass(className) {
  6966. return _this.root_.classList.contains(className);
  6967. },
  6968. setStyle: function setStyle(propertyName, value) {
  6969. return _this.root_.style.setProperty(propertyName, value);
  6970. },
  6971. registerEventHandler: function registerEventHandler(evtType, handler) {
  6972. return _this.listen(evtType, handler);
  6973. },
  6974. deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
  6975. return _this.unlisten(evtType, handler);
  6976. }
  6977. };
  6978. // tslint:enable:object-literal-sort-keys
  6979. return new foundation_1.MDCLineRippleFoundation(adapter);
  6980. };
  6981. return MDCLineRipple;
  6982. }(component_1.MDCComponent);
  6983. exports.MDCLineRipple = MDCLineRipple;
  6984. /***/ }),
  6985. /***/ "./packages/mdc-line-ripple/constants.ts":
  6986. /*!***********************************************!*\
  6987. !*** ./packages/mdc-line-ripple/constants.ts ***!
  6988. \***********************************************/
  6989. /*! no static exports found */
  6990. /***/ (function(module, exports, __webpack_require__) {
  6991. "use strict";
  6992. /**
  6993. * @license
  6994. * Copyright 2018 Google Inc.
  6995. *
  6996. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6997. * of this software and associated documentation files (the "Software"), to deal
  6998. * in the Software without restriction, including without limitation the rights
  6999. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7000. * copies of the Software, and to permit persons to whom the Software is
  7001. * furnished to do so, subject to the following conditions:
  7002. *
  7003. * The above copyright notice and this permission notice shall be included in
  7004. * all copies or substantial portions of the Software.
  7005. *
  7006. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7007. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7008. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7009. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7010. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7011. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7012. * THE SOFTWARE.
  7013. */
  7014. Object.defineProperty(exports, "__esModule", { value: true });
  7015. var cssClasses = {
  7016. LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
  7017. LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'
  7018. };
  7019. exports.cssClasses = cssClasses;
  7020. /***/ }),
  7021. /***/ "./packages/mdc-line-ripple/foundation.ts":
  7022. /*!************************************************!*\
  7023. !*** ./packages/mdc-line-ripple/foundation.ts ***!
  7024. \************************************************/
  7025. /*! no static exports found */
  7026. /***/ (function(module, exports, __webpack_require__) {
  7027. "use strict";
  7028. /**
  7029. * @license
  7030. * Copyright 2018 Google Inc.
  7031. *
  7032. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7033. * of this software and associated documentation files (the "Software"), to deal
  7034. * in the Software without restriction, including without limitation the rights
  7035. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7036. * copies of the Software, and to permit persons to whom the Software is
  7037. * furnished to do so, subject to the following conditions:
  7038. *
  7039. * The above copyright notice and this permission notice shall be included in
  7040. * all copies or substantial portions of the Software.
  7041. *
  7042. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7043. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7044. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7045. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7046. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7047. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7048. * THE SOFTWARE.
  7049. */
  7050. var __extends = this && this.__extends || function () {
  7051. var _extendStatics = function extendStatics(d, b) {
  7052. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7053. d.__proto__ = b;
  7054. } || function (d, b) {
  7055. for (var p in b) {
  7056. if (b.hasOwnProperty(p)) d[p] = b[p];
  7057. }
  7058. };
  7059. return _extendStatics(d, b);
  7060. };
  7061. return function (d, b) {
  7062. _extendStatics(d, b);
  7063. function __() {
  7064. this.constructor = d;
  7065. }
  7066. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7067. };
  7068. }();
  7069. var __assign = this && this.__assign || function () {
  7070. __assign = Object.assign || function (t) {
  7071. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7072. s = arguments[i];
  7073. for (var p in s) {
  7074. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7075. }
  7076. }
  7077. return t;
  7078. };
  7079. return __assign.apply(this, arguments);
  7080. };
  7081. Object.defineProperty(exports, "__esModule", { value: true });
  7082. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7083. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts");
  7084. var MDCLineRippleFoundation = /** @class */function (_super) {
  7085. __extends(MDCLineRippleFoundation, _super);
  7086. function MDCLineRippleFoundation(adapter) {
  7087. var _this = _super.call(this, __assign({}, MDCLineRippleFoundation.defaultAdapter, adapter)) || this;
  7088. _this.transitionEndHandler_ = function (evt) {
  7089. return _this.handleTransitionEnd(evt);
  7090. };
  7091. return _this;
  7092. }
  7093. Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
  7094. get: function get() {
  7095. return constants_1.cssClasses;
  7096. },
  7097. enumerable: true,
  7098. configurable: true
  7099. });
  7100. Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
  7101. /**
  7102. * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
  7103. */
  7104. get: function get() {
  7105. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  7106. return {
  7107. addClass: function addClass() {
  7108. return undefined;
  7109. },
  7110. removeClass: function removeClass() {
  7111. return undefined;
  7112. },
  7113. hasClass: function hasClass() {
  7114. return false;
  7115. },
  7116. setStyle: function setStyle() {
  7117. return undefined;
  7118. },
  7119. registerEventHandler: function registerEventHandler() {
  7120. return undefined;
  7121. },
  7122. deregisterEventHandler: function deregisterEventHandler() {
  7123. return undefined;
  7124. }
  7125. };
  7126. // tslint:enable:object-literal-sort-keys
  7127. },
  7128. enumerable: true,
  7129. configurable: true
  7130. });
  7131. MDCLineRippleFoundation.prototype.init = function () {
  7132. this.adapter_.registerEventHandler('transitionend', this.transitionEndHandler_);
  7133. };
  7134. MDCLineRippleFoundation.prototype.destroy = function () {
  7135. this.adapter_.deregisterEventHandler('transitionend', this.transitionEndHandler_);
  7136. };
  7137. MDCLineRippleFoundation.prototype.activate = function () {
  7138. this.adapter_.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  7139. this.adapter_.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  7140. };
  7141. MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
  7142. this.adapter_.setStyle('transform-origin', xCoordinate + "px center");
  7143. };
  7144. MDCLineRippleFoundation.prototype.deactivate = function () {
  7145. this.adapter_.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  7146. };
  7147. MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
  7148. // Wait for the line ripple to be either transparent or opaque
  7149. // before emitting the animation end event
  7150. var isDeactivating = this.adapter_.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  7151. if (evt.propertyName === 'opacity') {
  7152. if (isDeactivating) {
  7153. this.adapter_.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  7154. this.adapter_.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  7155. }
  7156. }
  7157. };
  7158. return MDCLineRippleFoundation;
  7159. }(foundation_1.MDCFoundation);
  7160. exports.MDCLineRippleFoundation = MDCLineRippleFoundation;
  7161. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7162. exports.default = MDCLineRippleFoundation;
  7163. /***/ }),
  7164. /***/ "./packages/mdc-line-ripple/index.ts":
  7165. /*!*******************************************!*\
  7166. !*** ./packages/mdc-line-ripple/index.ts ***!
  7167. \*******************************************/
  7168. /*! no static exports found */
  7169. /***/ (function(module, exports, __webpack_require__) {
  7170. "use strict";
  7171. /**
  7172. * @license
  7173. * Copyright 2019 Google Inc.
  7174. *
  7175. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7176. * of this software and associated documentation files (the "Software"), to deal
  7177. * in the Software without restriction, including without limitation the rights
  7178. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7179. * copies of the Software, and to permit persons to whom the Software is
  7180. * furnished to do so, subject to the following conditions:
  7181. *
  7182. * The above copyright notice and this permission notice shall be included in
  7183. * all copies or substantial portions of the Software.
  7184. *
  7185. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7186. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7187. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7188. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7189. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7190. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7191. * THE SOFTWARE.
  7192. */
  7193. function __export(m) {
  7194. for (var p in m) {
  7195. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7196. }
  7197. }
  7198. Object.defineProperty(exports, "__esModule", { value: true });
  7199. __export(__webpack_require__(/*! ./component */ "./packages/mdc-line-ripple/component.ts"));
  7200. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"));
  7201. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"));
  7202. /***/ }),
  7203. /***/ "./packages/mdc-linear-progress/component.ts":
  7204. /*!***************************************************!*\
  7205. !*** ./packages/mdc-linear-progress/component.ts ***!
  7206. \***************************************************/
  7207. /*! no static exports found */
  7208. /***/ (function(module, exports, __webpack_require__) {
  7209. "use strict";
  7210. /**
  7211. * @license
  7212. * Copyright 2017 Google Inc.
  7213. *
  7214. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7215. * of this software and associated documentation files (the "Software"), to deal
  7216. * in the Software without restriction, including without limitation the rights
  7217. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7218. * copies of the Software, and to permit persons to whom the Software is
  7219. * furnished to do so, subject to the following conditions:
  7220. *
  7221. * The above copyright notice and this permission notice shall be included in
  7222. * all copies or substantial portions of the Software.
  7223. *
  7224. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7225. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7226. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7227. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7228. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7229. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7230. * THE SOFTWARE.
  7231. */
  7232. var __extends = this && this.__extends || function () {
  7233. var _extendStatics = function extendStatics(d, b) {
  7234. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7235. d.__proto__ = b;
  7236. } || function (d, b) {
  7237. for (var p in b) {
  7238. if (b.hasOwnProperty(p)) d[p] = b[p];
  7239. }
  7240. };
  7241. return _extendStatics(d, b);
  7242. };
  7243. return function (d, b) {
  7244. _extendStatics(d, b);
  7245. function __() {
  7246. this.constructor = d;
  7247. }
  7248. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7249. };
  7250. }();
  7251. Object.defineProperty(exports, "__esModule", { value: true });
  7252. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7253. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts");
  7254. var MDCLinearProgress = /** @class */function (_super) {
  7255. __extends(MDCLinearProgress, _super);
  7256. function MDCLinearProgress() {
  7257. return _super !== null && _super.apply(this, arguments) || this;
  7258. }
  7259. MDCLinearProgress.attachTo = function (root) {
  7260. return new MDCLinearProgress(root);
  7261. };
  7262. Object.defineProperty(MDCLinearProgress.prototype, "determinate", {
  7263. set: function set(value) {
  7264. this.foundation_.setDeterminate(value);
  7265. },
  7266. enumerable: true,
  7267. configurable: true
  7268. });
  7269. Object.defineProperty(MDCLinearProgress.prototype, "progress", {
  7270. set: function set(value) {
  7271. this.foundation_.setProgress(value);
  7272. },
  7273. enumerable: true,
  7274. configurable: true
  7275. });
  7276. Object.defineProperty(MDCLinearProgress.prototype, "buffer", {
  7277. set: function set(value) {
  7278. this.foundation_.setBuffer(value);
  7279. },
  7280. enumerable: true,
  7281. configurable: true
  7282. });
  7283. Object.defineProperty(MDCLinearProgress.prototype, "reverse", {
  7284. set: function set(value) {
  7285. this.foundation_.setReverse(value);
  7286. },
  7287. enumerable: true,
  7288. configurable: true
  7289. });
  7290. MDCLinearProgress.prototype.open = function () {
  7291. this.foundation_.open();
  7292. };
  7293. MDCLinearProgress.prototype.close = function () {
  7294. this.foundation_.close();
  7295. };
  7296. MDCLinearProgress.prototype.getDefaultFoundation = function () {
  7297. var _this = this;
  7298. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7299. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7300. var adapter = {
  7301. addClass: function addClass(className) {
  7302. return _this.root_.classList.add(className);
  7303. },
  7304. getBuffer: function getBuffer() {
  7305. return _this.root_.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_SELECTOR);
  7306. },
  7307. getPrimaryBar: function getPrimaryBar() {
  7308. return _this.root_.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);
  7309. },
  7310. hasClass: function hasClass(className) {
  7311. return _this.root_.classList.contains(className);
  7312. },
  7313. removeClass: function removeClass(className) {
  7314. return _this.root_.classList.remove(className);
  7315. },
  7316. setStyle: function setStyle(el, styleProperty, value) {
  7317. return el.style.setProperty(styleProperty, value);
  7318. }
  7319. };
  7320. return new foundation_1.MDCLinearProgressFoundation(adapter);
  7321. };
  7322. return MDCLinearProgress;
  7323. }(component_1.MDCComponent);
  7324. exports.MDCLinearProgress = MDCLinearProgress;
  7325. /***/ }),
  7326. /***/ "./packages/mdc-linear-progress/constants.ts":
  7327. /*!***************************************************!*\
  7328. !*** ./packages/mdc-linear-progress/constants.ts ***!
  7329. \***************************************************/
  7330. /*! no static exports found */
  7331. /***/ (function(module, exports, __webpack_require__) {
  7332. "use strict";
  7333. /**
  7334. * @license
  7335. * Copyright 2017 Google Inc.
  7336. *
  7337. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7338. * of this software and associated documentation files (the "Software"), to deal
  7339. * in the Software without restriction, including without limitation the rights
  7340. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7341. * copies of the Software, and to permit persons to whom the Software is
  7342. * furnished to do so, subject to the following conditions:
  7343. *
  7344. * The above copyright notice and this permission notice shall be included in
  7345. * all copies or substantial portions of the Software.
  7346. *
  7347. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7348. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7349. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7350. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7351. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7352. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7353. * THE SOFTWARE.
  7354. */
  7355. Object.defineProperty(exports, "__esModule", { value: true });
  7356. exports.cssClasses = {
  7357. CLOSED_CLASS: 'mdc-linear-progress--closed',
  7358. INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
  7359. REVERSED_CLASS: 'mdc-linear-progress--reversed'
  7360. };
  7361. exports.strings = {
  7362. BUFFER_SELECTOR: '.mdc-linear-progress__buffer',
  7363. PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar'
  7364. };
  7365. /***/ }),
  7366. /***/ "./packages/mdc-linear-progress/foundation.ts":
  7367. /*!****************************************************!*\
  7368. !*** ./packages/mdc-linear-progress/foundation.ts ***!
  7369. \****************************************************/
  7370. /*! no static exports found */
  7371. /***/ (function(module, exports, __webpack_require__) {
  7372. "use strict";
  7373. /**
  7374. * @license
  7375. * Copyright 2017 Google Inc.
  7376. *
  7377. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7378. * of this software and associated documentation files (the "Software"), to deal
  7379. * in the Software without restriction, including without limitation the rights
  7380. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7381. * copies of the Software, and to permit persons to whom the Software is
  7382. * furnished to do so, subject to the following conditions:
  7383. *
  7384. * The above copyright notice and this permission notice shall be included in
  7385. * all copies or substantial portions of the Software.
  7386. *
  7387. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7388. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7389. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7390. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7391. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7392. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7393. * THE SOFTWARE.
  7394. */
  7395. var __extends = this && this.__extends || function () {
  7396. var _extendStatics = function extendStatics(d, b) {
  7397. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7398. d.__proto__ = b;
  7399. } || function (d, b) {
  7400. for (var p in b) {
  7401. if (b.hasOwnProperty(p)) d[p] = b[p];
  7402. }
  7403. };
  7404. return _extendStatics(d, b);
  7405. };
  7406. return function (d, b) {
  7407. _extendStatics(d, b);
  7408. function __() {
  7409. this.constructor = d;
  7410. }
  7411. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7412. };
  7413. }();
  7414. var __assign = this && this.__assign || function () {
  7415. __assign = Object.assign || function (t) {
  7416. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7417. s = arguments[i];
  7418. for (var p in s) {
  7419. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7420. }
  7421. }
  7422. return t;
  7423. };
  7424. return __assign.apply(this, arguments);
  7425. };
  7426. Object.defineProperty(exports, "__esModule", { value: true });
  7427. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  7428. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7429. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts");
  7430. var MDCLinearProgressFoundation = /** @class */function (_super) {
  7431. __extends(MDCLinearProgressFoundation, _super);
  7432. function MDCLinearProgressFoundation(adapter) {
  7433. return _super.call(this, __assign({}, MDCLinearProgressFoundation.defaultAdapter, adapter)) || this;
  7434. }
  7435. Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", {
  7436. get: function get() {
  7437. return constants_1.cssClasses;
  7438. },
  7439. enumerable: true,
  7440. configurable: true
  7441. });
  7442. Object.defineProperty(MDCLinearProgressFoundation, "strings", {
  7443. get: function get() {
  7444. return constants_1.strings;
  7445. },
  7446. enumerable: true,
  7447. configurable: true
  7448. });
  7449. Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", {
  7450. get: function get() {
  7451. return {
  7452. addClass: function addClass() {
  7453. return undefined;
  7454. },
  7455. getBuffer: function getBuffer() {
  7456. return null;
  7457. },
  7458. getPrimaryBar: function getPrimaryBar() {
  7459. return null;
  7460. },
  7461. hasClass: function hasClass() {
  7462. return false;
  7463. },
  7464. removeClass: function removeClass() {
  7465. return undefined;
  7466. },
  7467. setStyle: function setStyle() {
  7468. return undefined;
  7469. }
  7470. };
  7471. },
  7472. enumerable: true,
  7473. configurable: true
  7474. });
  7475. MDCLinearProgressFoundation.prototype.init = function () {
  7476. this.isDeterminate_ = !this.adapter_.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  7477. this.isReversed_ = this.adapter_.hasClass(constants_1.cssClasses.REVERSED_CLASS);
  7478. this.progress_ = 0;
  7479. };
  7480. MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) {
  7481. this.isDeterminate_ = isDeterminate;
  7482. if (this.isDeterminate_) {
  7483. this.adapter_.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  7484. this.setScale_(this.adapter_.getPrimaryBar(), this.progress_);
  7485. } else {
  7486. this.adapter_.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  7487. this.setScale_(this.adapter_.getPrimaryBar(), 1);
  7488. this.setScale_(this.adapter_.getBuffer(), 1);
  7489. }
  7490. };
  7491. MDCLinearProgressFoundation.prototype.setProgress = function (value) {
  7492. this.progress_ = value;
  7493. if (this.isDeterminate_) {
  7494. this.setScale_(this.adapter_.getPrimaryBar(), value);
  7495. }
  7496. };
  7497. MDCLinearProgressFoundation.prototype.setBuffer = function (value) {
  7498. if (this.isDeterminate_) {
  7499. this.setScale_(this.adapter_.getBuffer(), value);
  7500. }
  7501. };
  7502. MDCLinearProgressFoundation.prototype.setReverse = function (isReversed) {
  7503. this.isReversed_ = isReversed;
  7504. if (this.isReversed_) {
  7505. this.adapter_.addClass(constants_1.cssClasses.REVERSED_CLASS);
  7506. } else {
  7507. this.adapter_.removeClass(constants_1.cssClasses.REVERSED_CLASS);
  7508. }
  7509. };
  7510. MDCLinearProgressFoundation.prototype.open = function () {
  7511. this.adapter_.removeClass(constants_1.cssClasses.CLOSED_CLASS);
  7512. };
  7513. MDCLinearProgressFoundation.prototype.close = function () {
  7514. this.adapter_.addClass(constants_1.cssClasses.CLOSED_CLASS);
  7515. };
  7516. MDCLinearProgressFoundation.prototype.setScale_ = function (el, scaleValue) {
  7517. if (!el) {
  7518. return;
  7519. }
  7520. var value = "scaleX(" + scaleValue + ")";
  7521. this.adapter_.setStyle(el, util_1.getCorrectPropertyName(window, 'transform'), value);
  7522. };
  7523. return MDCLinearProgressFoundation;
  7524. }(foundation_1.MDCFoundation);
  7525. exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation;
  7526. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7527. exports.default = MDCLinearProgressFoundation;
  7528. /***/ }),
  7529. /***/ "./packages/mdc-linear-progress/index.ts":
  7530. /*!***********************************************!*\
  7531. !*** ./packages/mdc-linear-progress/index.ts ***!
  7532. \***********************************************/
  7533. /*! no static exports found */
  7534. /***/ (function(module, exports, __webpack_require__) {
  7535. "use strict";
  7536. /**
  7537. * @license
  7538. * Copyright 2019 Google Inc.
  7539. *
  7540. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7541. * of this software and associated documentation files (the "Software"), to deal
  7542. * in the Software without restriction, including without limitation the rights
  7543. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7544. * copies of the Software, and to permit persons to whom the Software is
  7545. * furnished to do so, subject to the following conditions:
  7546. *
  7547. * The above copyright notice and this permission notice shall be included in
  7548. * all copies or substantial portions of the Software.
  7549. *
  7550. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7551. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7552. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7553. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7554. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7555. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7556. * THE SOFTWARE.
  7557. */
  7558. function __export(m) {
  7559. for (var p in m) {
  7560. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7561. }
  7562. }
  7563. Object.defineProperty(exports, "__esModule", { value: true });
  7564. __export(__webpack_require__(/*! ./component */ "./packages/mdc-linear-progress/component.ts"));
  7565. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"));
  7566. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"));
  7567. /***/ }),
  7568. /***/ "./packages/mdc-list/component.ts":
  7569. /*!****************************************!*\
  7570. !*** ./packages/mdc-list/component.ts ***!
  7571. \****************************************/
  7572. /*! no static exports found */
  7573. /***/ (function(module, exports, __webpack_require__) {
  7574. "use strict";
  7575. /**
  7576. * @license
  7577. * Copyright 2018 Google Inc.
  7578. *
  7579. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7580. * of this software and associated documentation files (the "Software"), to deal
  7581. * in the Software without restriction, including without limitation the rights
  7582. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7583. * copies of the Software, and to permit persons to whom the Software is
  7584. * furnished to do so, subject to the following conditions:
  7585. *
  7586. * The above copyright notice and this permission notice shall be included in
  7587. * all copies or substantial portions of the Software.
  7588. *
  7589. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7590. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7591. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7592. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7593. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7594. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7595. * THE SOFTWARE.
  7596. */
  7597. var __extends = this && this.__extends || function () {
  7598. var _extendStatics = function extendStatics(d, b) {
  7599. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7600. d.__proto__ = b;
  7601. } || function (d, b) {
  7602. for (var p in b) {
  7603. if (b.hasOwnProperty(p)) d[p] = b[p];
  7604. }
  7605. };
  7606. return _extendStatics(d, b);
  7607. };
  7608. return function (d, b) {
  7609. _extendStatics(d, b);
  7610. function __() {
  7611. this.constructor = d;
  7612. }
  7613. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7614. };
  7615. }();
  7616. Object.defineProperty(exports, "__esModule", { value: true });
  7617. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7618. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  7619. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  7620. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts");
  7621. var MDCList = /** @class */function (_super) {
  7622. __extends(MDCList, _super);
  7623. function MDCList() {
  7624. return _super !== null && _super.apply(this, arguments) || this;
  7625. }
  7626. Object.defineProperty(MDCList.prototype, "vertical", {
  7627. set: function set(value) {
  7628. this.foundation_.setVerticalOrientation(value);
  7629. },
  7630. enumerable: true,
  7631. configurable: true
  7632. });
  7633. Object.defineProperty(MDCList.prototype, "listElements", {
  7634. get: function get() {
  7635. return [].slice.call(this.root_.querySelectorAll("." + constants_1.cssClasses.LIST_ITEM_CLASS));
  7636. },
  7637. enumerable: true,
  7638. configurable: true
  7639. });
  7640. Object.defineProperty(MDCList.prototype, "wrapFocus", {
  7641. set: function set(value) {
  7642. this.foundation_.setWrapFocus(value);
  7643. },
  7644. enumerable: true,
  7645. configurable: true
  7646. });
  7647. Object.defineProperty(MDCList.prototype, "singleSelection", {
  7648. set: function set(isSingleSelectionList) {
  7649. this.foundation_.setSingleSelection(isSingleSelectionList);
  7650. },
  7651. enumerable: true,
  7652. configurable: true
  7653. });
  7654. Object.defineProperty(MDCList.prototype, "selectedIndex", {
  7655. get: function get() {
  7656. return this.foundation_.getSelectedIndex();
  7657. },
  7658. set: function set(index) {
  7659. this.foundation_.setSelectedIndex(index);
  7660. },
  7661. enumerable: true,
  7662. configurable: true
  7663. });
  7664. MDCList.attachTo = function (root) {
  7665. return new MDCList(root);
  7666. };
  7667. MDCList.prototype.initialSyncWithDOM = function () {
  7668. this.handleClick_ = this.handleClickEvent_.bind(this);
  7669. this.handleKeydown_ = this.handleKeydownEvent_.bind(this);
  7670. this.focusInEventListener_ = this.handleFocusInEvent_.bind(this);
  7671. this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this);
  7672. this.listen('keydown', this.handleKeydown_);
  7673. this.listen('click', this.handleClick_);
  7674. this.listen('focusin', this.focusInEventListener_);
  7675. this.listen('focusout', this.focusOutEventListener_);
  7676. this.layout();
  7677. this.initializeListType();
  7678. };
  7679. MDCList.prototype.destroy = function () {
  7680. this.unlisten('keydown', this.handleKeydown_);
  7681. this.unlisten('click', this.handleClick_);
  7682. this.unlisten('focusin', this.focusInEventListener_);
  7683. this.unlisten('focusout', this.focusOutEventListener_);
  7684. };
  7685. MDCList.prototype.layout = function () {
  7686. var direction = this.root_.getAttribute(constants_1.strings.ARIA_ORIENTATION);
  7687. this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL;
  7688. // List items need to have at least tabindex=-1 to be focusable.
  7689. [].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) {
  7690. el.setAttribute('tabindex', '-1');
  7691. });
  7692. // Child button/a elements are not tabbable until the list item is focused.
  7693. [].slice.call(this.root_.querySelectorAll(constants_1.strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) {
  7694. return el.setAttribute('tabindex', '-1');
  7695. });
  7696. this.foundation_.layout();
  7697. };
  7698. /**
  7699. * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio.
  7700. */
  7701. MDCList.prototype.initializeListType = function () {
  7702. var _this = this;
  7703. var checkboxListItems = this.root_.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR);
  7704. var singleSelectedListItem = this.root_.querySelector("\n ." + constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS + "\n ");
  7705. var radioSelectedListItem = this.root_.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR);
  7706. if (checkboxListItems.length) {
  7707. var preselectedItems = this.root_.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR);
  7708. this.selectedIndex = [].map.call(preselectedItems, function (listItem) {
  7709. return _this.listElements.indexOf(listItem);
  7710. });
  7711. } else if (singleSelectedListItem) {
  7712. if (singleSelectedListItem.classList.contains(constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS)) {
  7713. this.foundation_.setUseActivatedClass(true);
  7714. }
  7715. this.singleSelection = true;
  7716. this.selectedIndex = this.listElements.indexOf(singleSelectedListItem);
  7717. } else if (radioSelectedListItem) {
  7718. this.selectedIndex = this.listElements.indexOf(radioSelectedListItem);
  7719. }
  7720. };
  7721. MDCList.prototype.getDefaultFoundation = function () {
  7722. var _this = this;
  7723. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7724. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7725. var adapter = {
  7726. addClassForElementIndex: function addClassForElementIndex(index, className) {
  7727. var element = _this.listElements[index];
  7728. if (element) {
  7729. element.classList.add(className);
  7730. }
  7731. },
  7732. focusItemAtIndex: function focusItemAtIndex(index) {
  7733. var element = _this.listElements[index];
  7734. if (element) {
  7735. element.focus();
  7736. }
  7737. },
  7738. getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) {
  7739. return _this.listElements[index].getAttribute(attr);
  7740. },
  7741. getFocusedElementIndex: function getFocusedElementIndex() {
  7742. return _this.listElements.indexOf(document.activeElement);
  7743. },
  7744. getListItemCount: function getListItemCount() {
  7745. return _this.listElements.length;
  7746. },
  7747. hasCheckboxAtIndex: function hasCheckboxAtIndex(index) {
  7748. var listItem = _this.listElements[index];
  7749. return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  7750. },
  7751. hasRadioAtIndex: function hasRadioAtIndex(index) {
  7752. var listItem = _this.listElements[index];
  7753. return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR);
  7754. },
  7755. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) {
  7756. var listItem = _this.listElements[index];
  7757. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  7758. return toggleEl.checked;
  7759. },
  7760. isFocusInsideList: function isFocusInsideList() {
  7761. return _this.root_.contains(document.activeElement);
  7762. },
  7763. isRootFocused: function isRootFocused() {
  7764. return document.activeElement === _this.root_;
  7765. },
  7766. notifyAction: function notifyAction(index) {
  7767. _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true);
  7768. },
  7769. removeClassForElementIndex: function removeClassForElementIndex(index, className) {
  7770. var element = _this.listElements[index];
  7771. if (element) {
  7772. element.classList.remove(className);
  7773. }
  7774. },
  7775. setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) {
  7776. var element = _this.listElements[index];
  7777. if (element) {
  7778. element.setAttribute(attr, value);
  7779. }
  7780. },
  7781. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) {
  7782. var listItem = _this.listElements[index];
  7783. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  7784. toggleEl.checked = isChecked;
  7785. var event = document.createEvent('Event');
  7786. event.initEvent('change', true, true);
  7787. toggleEl.dispatchEvent(event);
  7788. },
  7789. setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {
  7790. var element = _this.listElements[listItemIndex];
  7791. var listItemChildren = [].slice.call(element.querySelectorAll(constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX));
  7792. listItemChildren.forEach(function (el) {
  7793. return el.setAttribute('tabindex', tabIndexValue);
  7794. });
  7795. }
  7796. };
  7797. return new foundation_1.MDCListFoundation(adapter);
  7798. };
  7799. /**
  7800. * Used to figure out which list item this event is targetting. Or returns -1 if
  7801. * there is no list item
  7802. */
  7803. MDCList.prototype.getListItemIndex_ = function (evt) {
  7804. var eventTarget = evt.target;
  7805. var nearestParent = ponyfill_1.closest(eventTarget, "." + constants_1.cssClasses.LIST_ITEM_CLASS + ", ." + constants_1.cssClasses.ROOT);
  7806. // Get the index of the element if it is a list item.
  7807. if (nearestParent && ponyfill_1.matches(nearestParent, "." + constants_1.cssClasses.LIST_ITEM_CLASS)) {
  7808. return this.listElements.indexOf(nearestParent);
  7809. }
  7810. return -1;
  7811. };
  7812. /**
  7813. * Used to figure out which element was clicked before sending the event to the foundation.
  7814. */
  7815. MDCList.prototype.handleFocusInEvent_ = function (evt) {
  7816. var index = this.getListItemIndex_(evt);
  7817. this.foundation_.handleFocusIn(evt, index);
  7818. };
  7819. /**
  7820. * Used to figure out which element was clicked before sending the event to the foundation.
  7821. */
  7822. MDCList.prototype.handleFocusOutEvent_ = function (evt) {
  7823. var index = this.getListItemIndex_(evt);
  7824. this.foundation_.handleFocusOut(evt, index);
  7825. };
  7826. /**
  7827. * Used to figure out which element was focused when keydown event occurred before sending the event to the
  7828. * foundation.
  7829. */
  7830. MDCList.prototype.handleKeydownEvent_ = function (evt) {
  7831. var index = this.getListItemIndex_(evt);
  7832. var target = evt.target;
  7833. this.foundation_.handleKeydown(evt, target.classList.contains(constants_1.cssClasses.LIST_ITEM_CLASS), index);
  7834. };
  7835. /**
  7836. * Used to figure out which element was clicked before sending the event to the foundation.
  7837. */
  7838. MDCList.prototype.handleClickEvent_ = function (evt) {
  7839. var index = this.getListItemIndex_(evt);
  7840. var target = evt.target;
  7841. // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
  7842. var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  7843. this.foundation_.handleClick(index, toggleCheckbox);
  7844. };
  7845. return MDCList;
  7846. }(component_1.MDCComponent);
  7847. exports.MDCList = MDCList;
  7848. /***/ }),
  7849. /***/ "./packages/mdc-list/constants.ts":
  7850. /*!****************************************!*\
  7851. !*** ./packages/mdc-list/constants.ts ***!
  7852. \****************************************/
  7853. /*! no static exports found */
  7854. /***/ (function(module, exports, __webpack_require__) {
  7855. "use strict";
  7856. /**
  7857. * @license
  7858. * Copyright 2018 Google Inc.
  7859. *
  7860. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7861. * of this software and associated documentation files (the "Software"), to deal
  7862. * in the Software without restriction, including without limitation the rights
  7863. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7864. * copies of the Software, and to permit persons to whom the Software is
  7865. * furnished to do so, subject to the following conditions:
  7866. *
  7867. * The above copyright notice and this permission notice shall be included in
  7868. * all copies or substantial portions of the Software.
  7869. *
  7870. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7871. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7872. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7873. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7874. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7875. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7876. * THE SOFTWARE.
  7877. */
  7878. Object.defineProperty(exports, "__esModule", { value: true });
  7879. var cssClasses = {
  7880. LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
  7881. LIST_ITEM_CLASS: 'mdc-list-item',
  7882. LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
  7883. LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
  7884. ROOT: 'mdc-list'
  7885. };
  7886. exports.cssClasses = cssClasses;
  7887. var strings = {
  7888. ACTION_EVENT: 'MDCList:action',
  7889. ARIA_CHECKED: 'aria-checked',
  7890. ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
  7891. ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
  7892. ARIA_CURRENT: 'aria-current',
  7893. ARIA_ORIENTATION: 'aria-orientation',
  7894. ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
  7895. ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
  7896. ARIA_SELECTED: 'aria-selected',
  7897. CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)',
  7898. CHECKBOX_SELECTOR: 'input[type="checkbox"]:not(:disabled)',
  7899. CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ",
  7900. 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 ",
  7901. RADIO_SELECTOR: 'input[type="radio"]:not(:disabled)'
  7902. };
  7903. exports.strings = strings;
  7904. var numbers = {
  7905. UNSET_INDEX: -1
  7906. };
  7907. exports.numbers = numbers;
  7908. /***/ }),
  7909. /***/ "./packages/mdc-list/foundation.ts":
  7910. /*!*****************************************!*\
  7911. !*** ./packages/mdc-list/foundation.ts ***!
  7912. \*****************************************/
  7913. /*! no static exports found */
  7914. /***/ (function(module, exports, __webpack_require__) {
  7915. "use strict";
  7916. /**
  7917. * @license
  7918. * Copyright 2018 Google Inc.
  7919. *
  7920. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7921. * of this software and associated documentation files (the "Software"), to deal
  7922. * in the Software without restriction, including without limitation the rights
  7923. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7924. * copies of the Software, and to permit persons to whom the Software is
  7925. * furnished to do so, subject to the following conditions:
  7926. *
  7927. * The above copyright notice and this permission notice shall be included in
  7928. * all copies or substantial portions of the Software.
  7929. *
  7930. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7931. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7932. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7933. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7934. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7935. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7936. * THE SOFTWARE.
  7937. */
  7938. var __extends = this && this.__extends || function () {
  7939. var _extendStatics = function extendStatics(d, b) {
  7940. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7941. d.__proto__ = b;
  7942. } || function (d, b) {
  7943. for (var p in b) {
  7944. if (b.hasOwnProperty(p)) d[p] = b[p];
  7945. }
  7946. };
  7947. return _extendStatics(d, b);
  7948. };
  7949. return function (d, b) {
  7950. _extendStatics(d, b);
  7951. function __() {
  7952. this.constructor = d;
  7953. }
  7954. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7955. };
  7956. }();
  7957. var __assign = this && this.__assign || function () {
  7958. __assign = Object.assign || function (t) {
  7959. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7960. s = arguments[i];
  7961. for (var p in s) {
  7962. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7963. }
  7964. }
  7965. return t;
  7966. };
  7967. return __assign.apply(this, arguments);
  7968. };
  7969. Object.defineProperty(exports, "__esModule", { value: true });
  7970. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7971. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  7972. var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
  7973. function isNumberArray(selectedIndex) {
  7974. return selectedIndex instanceof Array;
  7975. }
  7976. var MDCListFoundation = /** @class */function (_super) {
  7977. __extends(MDCListFoundation, _super);
  7978. function MDCListFoundation(adapter) {
  7979. var _this = _super.call(this, __assign({}, MDCListFoundation.defaultAdapter, adapter)) || this;
  7980. _this.wrapFocus_ = false;
  7981. _this.isVertical_ = true;
  7982. _this.isSingleSelectionList_ = false;
  7983. _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX;
  7984. _this.focusedItemIndex_ = constants_1.numbers.UNSET_INDEX;
  7985. _this.useActivatedClass_ = false;
  7986. _this.ariaCurrentAttrValue_ = null;
  7987. _this.isCheckboxList_ = false;
  7988. _this.isRadioList_ = false;
  7989. return _this;
  7990. }
  7991. Object.defineProperty(MDCListFoundation, "strings", {
  7992. get: function get() {
  7993. return constants_1.strings;
  7994. },
  7995. enumerable: true,
  7996. configurable: true
  7997. });
  7998. Object.defineProperty(MDCListFoundation, "cssClasses", {
  7999. get: function get() {
  8000. return constants_1.cssClasses;
  8001. },
  8002. enumerable: true,
  8003. configurable: true
  8004. });
  8005. Object.defineProperty(MDCListFoundation, "numbers", {
  8006. get: function get() {
  8007. return constants_1.numbers;
  8008. },
  8009. enumerable: true,
  8010. configurable: true
  8011. });
  8012. Object.defineProperty(MDCListFoundation, "defaultAdapter", {
  8013. get: function get() {
  8014. return {
  8015. addClassForElementIndex: function addClassForElementIndex() {
  8016. return undefined;
  8017. },
  8018. focusItemAtIndex: function focusItemAtIndex() {
  8019. return undefined;
  8020. },
  8021. getAttributeForElementIndex: function getAttributeForElementIndex() {
  8022. return null;
  8023. },
  8024. getFocusedElementIndex: function getFocusedElementIndex() {
  8025. return 0;
  8026. },
  8027. getListItemCount: function getListItemCount() {
  8028. return 0;
  8029. },
  8030. hasCheckboxAtIndex: function hasCheckboxAtIndex() {
  8031. return false;
  8032. },
  8033. hasRadioAtIndex: function hasRadioAtIndex() {
  8034. return false;
  8035. },
  8036. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() {
  8037. return false;
  8038. },
  8039. isFocusInsideList: function isFocusInsideList() {
  8040. return false;
  8041. },
  8042. isRootFocused: function isRootFocused() {
  8043. return false;
  8044. },
  8045. notifyAction: function notifyAction() {
  8046. return undefined;
  8047. },
  8048. removeClassForElementIndex: function removeClassForElementIndex() {
  8049. return undefined;
  8050. },
  8051. setAttributeForElementIndex: function setAttributeForElementIndex() {
  8052. return undefined;
  8053. },
  8054. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() {
  8055. return undefined;
  8056. },
  8057. setTabIndexForListItemChildren: function setTabIndexForListItemChildren() {
  8058. return undefined;
  8059. }
  8060. };
  8061. },
  8062. enumerable: true,
  8063. configurable: true
  8064. });
  8065. MDCListFoundation.prototype.layout = function () {
  8066. if (this.adapter_.getListItemCount() === 0) {
  8067. return;
  8068. }
  8069. if (this.adapter_.hasCheckboxAtIndex(0)) {
  8070. this.isCheckboxList_ = true;
  8071. } else if (this.adapter_.hasRadioAtIndex(0)) {
  8072. this.isRadioList_ = true;
  8073. }
  8074. };
  8075. /**
  8076. * Sets the private wrapFocus_ variable.
  8077. */
  8078. MDCListFoundation.prototype.setWrapFocus = function (value) {
  8079. this.wrapFocus_ = value;
  8080. };
  8081. /**
  8082. * Sets the isVertical_ private variable.
  8083. */
  8084. MDCListFoundation.prototype.setVerticalOrientation = function (value) {
  8085. this.isVertical_ = value;
  8086. };
  8087. /**
  8088. * Sets the isSingleSelectionList_ private variable.
  8089. */
  8090. MDCListFoundation.prototype.setSingleSelection = function (value) {
  8091. this.isSingleSelectionList_ = value;
  8092. };
  8093. /**
  8094. * Sets the useActivatedClass_ private variable.
  8095. */
  8096. MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
  8097. this.useActivatedClass_ = useActivated;
  8098. };
  8099. MDCListFoundation.prototype.getSelectedIndex = function () {
  8100. return this.selectedIndex_;
  8101. };
  8102. MDCListFoundation.prototype.setSelectedIndex = function (index) {
  8103. if (!this.isIndexValid_(index)) {
  8104. return;
  8105. }
  8106. if (this.isCheckboxList_) {
  8107. this.setCheckboxAtIndex_(index);
  8108. } else if (this.isRadioList_) {
  8109. this.setRadioAtIndex_(index);
  8110. } else {
  8111. this.setSingleSelectionAtIndex_(index);
  8112. }
  8113. };
  8114. /**
  8115. * Focus in handler for the list items.
  8116. */
  8117. MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) {
  8118. if (listItemIndex >= 0) {
  8119. this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0');
  8120. }
  8121. };
  8122. /**
  8123. * Focus out handler for the list items.
  8124. */
  8125. MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) {
  8126. var _this = this;
  8127. if (listItemIndex >= 0) {
  8128. this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1');
  8129. }
  8130. /**
  8131. * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus
  8132. * is moved to next element.
  8133. */
  8134. setTimeout(function () {
  8135. if (!_this.adapter_.isFocusInsideList()) {
  8136. _this.setTabindexToFirstSelectedItem_();
  8137. }
  8138. }, 0);
  8139. };
  8140. /**
  8141. * Key handler for the list.
  8142. */
  8143. MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) {
  8144. var isArrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37;
  8145. var isArrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38;
  8146. var isArrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39;
  8147. var isArrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40;
  8148. var isHome = evt.key === 'Home' || evt.keyCode === 36;
  8149. var isEnd = evt.key === 'End' || evt.keyCode === 35;
  8150. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  8151. var isSpace = evt.key === 'Space' || evt.keyCode === 32;
  8152. if (this.adapter_.isRootFocused()) {
  8153. if (isArrowUp || isEnd) {
  8154. evt.preventDefault();
  8155. this.focusLastElement();
  8156. } else if (isArrowDown || isHome) {
  8157. evt.preventDefault();
  8158. this.focusFirstElement();
  8159. }
  8160. return;
  8161. }
  8162. var currentIndex = this.adapter_.getFocusedElementIndex();
  8163. if (currentIndex === -1) {
  8164. currentIndex = listItemIndex;
  8165. if (currentIndex < 0) {
  8166. // If this event doesn't have a mdc-list-item ancestor from the
  8167. // current list (not from a sublist), return early.
  8168. return;
  8169. }
  8170. }
  8171. var nextIndex;
  8172. if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) {
  8173. this.preventDefaultEvent_(evt);
  8174. nextIndex = this.focusNextElement(currentIndex);
  8175. } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) {
  8176. this.preventDefaultEvent_(evt);
  8177. nextIndex = this.focusPrevElement(currentIndex);
  8178. } else if (isHome) {
  8179. this.preventDefaultEvent_(evt);
  8180. nextIndex = this.focusFirstElement();
  8181. } else if (isEnd) {
  8182. this.preventDefaultEvent_(evt);
  8183. nextIndex = this.focusLastElement();
  8184. } else if (isEnter || isSpace) {
  8185. if (isRootListItem) {
  8186. // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event.
  8187. var target = evt.target;
  8188. if (target && target.tagName === 'A' && isEnter) {
  8189. return;
  8190. }
  8191. this.preventDefaultEvent_(evt);
  8192. if (this.isSelectableList_()) {
  8193. this.setSelectedIndexOnAction_(currentIndex);
  8194. }
  8195. this.adapter_.notifyAction(currentIndex);
  8196. }
  8197. }
  8198. this.focusedItemIndex_ = currentIndex;
  8199. if (nextIndex !== undefined) {
  8200. this.setTabindexAtIndex_(nextIndex);
  8201. this.focusedItemIndex_ = nextIndex;
  8202. }
  8203. };
  8204. /**
  8205. * Click handler for the list.
  8206. */
  8207. MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) {
  8208. if (index === constants_1.numbers.UNSET_INDEX) {
  8209. return;
  8210. }
  8211. if (this.isSelectableList_()) {
  8212. this.setSelectedIndexOnAction_(index, toggleCheckbox);
  8213. }
  8214. this.adapter_.notifyAction(index);
  8215. this.setTabindexAtIndex_(index);
  8216. this.focusedItemIndex_ = index;
  8217. };
  8218. /**
  8219. * Focuses the next element on the list.
  8220. */
  8221. MDCListFoundation.prototype.focusNextElement = function (index) {
  8222. var count = this.adapter_.getListItemCount();
  8223. var nextIndex = index + 1;
  8224. if (nextIndex >= count) {
  8225. if (this.wrapFocus_) {
  8226. nextIndex = 0;
  8227. } else {
  8228. // Return early because last item is already focused.
  8229. return index;
  8230. }
  8231. }
  8232. this.adapter_.focusItemAtIndex(nextIndex);
  8233. return nextIndex;
  8234. };
  8235. /**
  8236. * Focuses the previous element on the list.
  8237. */
  8238. MDCListFoundation.prototype.focusPrevElement = function (index) {
  8239. var prevIndex = index - 1;
  8240. if (prevIndex < 0) {
  8241. if (this.wrapFocus_) {
  8242. prevIndex = this.adapter_.getListItemCount() - 1;
  8243. } else {
  8244. // Return early because first item is already focused.
  8245. return index;
  8246. }
  8247. }
  8248. this.adapter_.focusItemAtIndex(prevIndex);
  8249. return prevIndex;
  8250. };
  8251. MDCListFoundation.prototype.focusFirstElement = function () {
  8252. this.adapter_.focusItemAtIndex(0);
  8253. return 0;
  8254. };
  8255. MDCListFoundation.prototype.focusLastElement = function () {
  8256. var lastIndex = this.adapter_.getListItemCount() - 1;
  8257. this.adapter_.focusItemAtIndex(lastIndex);
  8258. return lastIndex;
  8259. };
  8260. /**
  8261. * Ensures that preventDefault is only called if the containing element doesn't
  8262. * consume the event, and it will cause an unintended scroll.
  8263. */
  8264. MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) {
  8265. var target = evt.target;
  8266. var tagName = ("" + target.tagName).toLowerCase();
  8267. if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
  8268. evt.preventDefault();
  8269. }
  8270. };
  8271. MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) {
  8272. if (this.selectedIndex_ === index) {
  8273. return;
  8274. }
  8275. var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS;
  8276. if (this.useActivatedClass_) {
  8277. selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS;
  8278. }
  8279. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8280. this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName);
  8281. }
  8282. this.adapter_.addClassForElementIndex(index, selectedClassName);
  8283. this.setAriaForSingleSelectionAtIndex_(index);
  8284. this.selectedIndex_ = index;
  8285. };
  8286. /**
  8287. * Sets aria attribute for single selection at given index.
  8288. */
  8289. MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) {
  8290. // Detect the presence of aria-current and get the value only during list initialization when it is in unset state.
  8291. if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) {
  8292. this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT);
  8293. }
  8294. var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
  8295. var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED;
  8296. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8297. this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
  8298. }
  8299. var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
  8300. this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
  8301. };
  8302. /**
  8303. * Toggles radio at give index. Radio doesn't change the checked state if it is already checked.
  8304. */
  8305. MDCListFoundation.prototype.setRadioAtIndex_ = function (index) {
  8306. this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true);
  8307. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8308. this.adapter_.setAttributeForElementIndex(this.selectedIndex_, constants_1.strings.ARIA_CHECKED, 'false');
  8309. }
  8310. this.adapter_.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, 'true');
  8311. this.selectedIndex_ = index;
  8312. };
  8313. MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) {
  8314. for (var i = 0; i < this.adapter_.getListItemCount(); i++) {
  8315. var isChecked = false;
  8316. if (index.indexOf(i) >= 0) {
  8317. isChecked = true;
  8318. }
  8319. this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
  8320. this.adapter_.setAttributeForElementIndex(i, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  8321. }
  8322. this.selectedIndex_ = index;
  8323. };
  8324. MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) {
  8325. if (this.focusedItemIndex_ === constants_1.numbers.UNSET_INDEX && index !== 0) {
  8326. // If no list item was selected set first list item's tabindex to -1.
  8327. // Generally, tabindex is set to 0 on first list item of list that has no preselected items.
  8328. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1');
  8329. } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) {
  8330. this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1');
  8331. }
  8332. this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0');
  8333. };
  8334. /**
  8335. * @return Return true if it is single selectin list, checkbox list or radio list.
  8336. */
  8337. MDCListFoundation.prototype.isSelectableList_ = function () {
  8338. return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_;
  8339. };
  8340. MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () {
  8341. var targetIndex = 0;
  8342. if (this.isSelectableList_()) {
  8343. if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8344. targetIndex = this.selectedIndex_;
  8345. } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) {
  8346. targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) {
  8347. return Math.min(currentIndex, minIndex);
  8348. });
  8349. }
  8350. }
  8351. this.setTabindexAtIndex_(targetIndex);
  8352. };
  8353. MDCListFoundation.prototype.isIndexValid_ = function (index) {
  8354. var _this = this;
  8355. if (index instanceof Array) {
  8356. if (!this.isCheckboxList_) {
  8357. throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
  8358. }
  8359. if (index.length === 0) {
  8360. return true;
  8361. } else {
  8362. return index.some(function (i) {
  8363. return _this.isIndexInRange_(i);
  8364. });
  8365. }
  8366. } else if (typeof index === 'number') {
  8367. if (this.isCheckboxList_) {
  8368. throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index);
  8369. }
  8370. return this.isIndexInRange_(index);
  8371. } else {
  8372. return false;
  8373. }
  8374. };
  8375. MDCListFoundation.prototype.isIndexInRange_ = function (index) {
  8376. var listSize = this.adapter_.getListItemCount();
  8377. return index >= 0 && index < listSize;
  8378. };
  8379. MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) {
  8380. if (toggleCheckbox === void 0) {
  8381. toggleCheckbox = true;
  8382. }
  8383. if (this.isCheckboxList_) {
  8384. this.toggleCheckboxAtIndex_(index, toggleCheckbox);
  8385. } else {
  8386. this.setSelectedIndex(index);
  8387. }
  8388. };
  8389. MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) {
  8390. var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index);
  8391. if (toggleCheckbox) {
  8392. isChecked = !isChecked;
  8393. this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
  8394. }
  8395. this.adapter_.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  8396. // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value.
  8397. var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice();
  8398. if (isChecked) {
  8399. selectedIndexes.push(index);
  8400. } else {
  8401. selectedIndexes = selectedIndexes.filter(function (i) {
  8402. return i !== index;
  8403. });
  8404. }
  8405. this.selectedIndex_ = selectedIndexes;
  8406. };
  8407. return MDCListFoundation;
  8408. }(foundation_1.MDCFoundation);
  8409. exports.MDCListFoundation = MDCListFoundation;
  8410. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  8411. exports.default = MDCListFoundation;
  8412. /***/ }),
  8413. /***/ "./packages/mdc-list/index.ts":
  8414. /*!************************************!*\
  8415. !*** ./packages/mdc-list/index.ts ***!
  8416. \************************************/
  8417. /*! no static exports found */
  8418. /***/ (function(module, exports, __webpack_require__) {
  8419. "use strict";
  8420. /**
  8421. * @license
  8422. * Copyright 2019 Google Inc.
  8423. *
  8424. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8425. * of this software and associated documentation files (the "Software"), to deal
  8426. * in the Software without restriction, including without limitation the rights
  8427. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8428. * copies of the Software, and to permit persons to whom the Software is
  8429. * furnished to do so, subject to the following conditions:
  8430. *
  8431. * The above copyright notice and this permission notice shall be included in
  8432. * all copies or substantial portions of the Software.
  8433. *
  8434. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8435. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8436. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8437. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8438. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8439. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8440. * THE SOFTWARE.
  8441. */
  8442. function __export(m) {
  8443. for (var p in m) {
  8444. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  8445. }
  8446. }
  8447. Object.defineProperty(exports, "__esModule", { value: true });
  8448. __export(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts"));
  8449. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"));
  8450. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"));
  8451. /***/ }),
  8452. /***/ "./packages/mdc-menu-surface/component.ts":
  8453. /*!************************************************!*\
  8454. !*** ./packages/mdc-menu-surface/component.ts ***!
  8455. \************************************************/
  8456. /*! no static exports found */
  8457. /***/ (function(module, exports, __webpack_require__) {
  8458. "use strict";
  8459. /**
  8460. * @license
  8461. * Copyright 2018 Google Inc.
  8462. *
  8463. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8464. * of this software and associated documentation files (the "Software"), to deal
  8465. * in the Software without restriction, including without limitation the rights
  8466. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8467. * copies of the Software, and to permit persons to whom the Software is
  8468. * furnished to do so, subject to the following conditions:
  8469. *
  8470. * The above copyright notice and this permission notice shall be included in
  8471. * all copies or substantial portions of the Software.
  8472. *
  8473. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8474. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8475. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8476. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8477. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8478. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8479. * THE SOFTWARE.
  8480. */
  8481. var __extends = this && this.__extends || function () {
  8482. var _extendStatics = function extendStatics(d, b) {
  8483. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8484. d.__proto__ = b;
  8485. } || function (d, b) {
  8486. for (var p in b) {
  8487. if (b.hasOwnProperty(p)) d[p] = b[p];
  8488. }
  8489. };
  8490. return _extendStatics(d, b);
  8491. };
  8492. return function (d, b) {
  8493. _extendStatics(d, b);
  8494. function __() {
  8495. this.constructor = d;
  8496. }
  8497. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8498. };
  8499. }();
  8500. var __importStar = this && this.__importStar || function (mod) {
  8501. if (mod && mod.__esModule) return mod;
  8502. var result = {};
  8503. if (mod != null) for (var k in mod) {
  8504. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8505. }result["default"] = mod;
  8506. return result;
  8507. };
  8508. Object.defineProperty(exports, "__esModule", { value: true });
  8509. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8510. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  8511. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts");
  8512. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  8513. var MDCMenuSurface = /** @class */function (_super) {
  8514. __extends(MDCMenuSurface, _super);
  8515. function MDCMenuSurface() {
  8516. return _super !== null && _super.apply(this, arguments) || this;
  8517. }
  8518. MDCMenuSurface.attachTo = function (root) {
  8519. return new MDCMenuSurface(root);
  8520. };
  8521. MDCMenuSurface.prototype.initialSyncWithDOM = function () {
  8522. var _this = this;
  8523. var parentEl = this.root_.parentElement;
  8524. this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
  8525. if (this.root_.classList.contains(constants_1.cssClasses.FIXED)) {
  8526. this.setFixedPosition(true);
  8527. }
  8528. this.handleKeydown_ = function (evt) {
  8529. return _this.foundation_.handleKeydown(evt);
  8530. };
  8531. this.handleBodyClick_ = function (evt) {
  8532. return _this.foundation_.handleBodyClick(evt);
  8533. };
  8534. this.registerBodyClickListener_ = function () {
  8535. return document.body.addEventListener('click', _this.handleBodyClick_);
  8536. };
  8537. this.deregisterBodyClickListener_ = function () {
  8538. return document.body.removeEventListener('click', _this.handleBodyClick_);
  8539. };
  8540. this.listen('keydown', this.handleKeydown_);
  8541. this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
  8542. this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
  8543. };
  8544. MDCMenuSurface.prototype.destroy = function () {
  8545. this.unlisten('keydown', this.handleKeydown_);
  8546. this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
  8547. this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
  8548. _super.prototype.destroy.call(this);
  8549. };
  8550. MDCMenuSurface.prototype.isOpen = function () {
  8551. return this.foundation_.isOpen();
  8552. };
  8553. MDCMenuSurface.prototype.open = function () {
  8554. this.foundation_.open();
  8555. };
  8556. MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
  8557. if (skipRestoreFocus === void 0) {
  8558. skipRestoreFocus = false;
  8559. }
  8560. this.foundation_.close(skipRestoreFocus);
  8561. };
  8562. Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
  8563. set: function set(quickOpen) {
  8564. this.foundation_.setQuickOpen(quickOpen);
  8565. },
  8566. enumerable: true,
  8567. configurable: true
  8568. });
  8569. /**
  8570. * Removes the menu-surface from it's current location and appends it to the
  8571. * body to overcome any overflow:hidden issues.
  8572. */
  8573. MDCMenuSurface.prototype.hoistMenuToBody = function () {
  8574. document.body.appendChild(this.root_);
  8575. this.setIsHoisted(true);
  8576. };
  8577. /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */
  8578. MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
  8579. this.foundation_.setIsHoisted(isHoisted);
  8580. };
  8581. /** Sets the element that the menu-surface is anchored to. */
  8582. MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
  8583. this.anchorElement = element;
  8584. };
  8585. /** Sets the menu-surface to position: fixed. */
  8586. MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
  8587. if (isFixed) {
  8588. this.root_.classList.add(constants_1.cssClasses.FIXED);
  8589. } else {
  8590. this.root_.classList.remove(constants_1.cssClasses.FIXED);
  8591. }
  8592. this.foundation_.setFixedPosition(isFixed);
  8593. };
  8594. /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */
  8595. MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
  8596. this.foundation_.setAbsolutePosition(x, y);
  8597. this.setIsHoisted(true);
  8598. };
  8599. /**
  8600. * @param corner Default anchor corner alignment of top-left surface corner.
  8601. */
  8602. MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
  8603. this.foundation_.setAnchorCorner(corner);
  8604. };
  8605. MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
  8606. this.foundation_.setAnchorMargin(margin);
  8607. };
  8608. MDCMenuSurface.prototype.getDefaultFoundation = function () {
  8609. var _this = this;
  8610. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  8611. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  8612. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8613. var adapter = {
  8614. addClass: function addClass(className) {
  8615. return _this.root_.classList.add(className);
  8616. },
  8617. removeClass: function removeClass(className) {
  8618. return _this.root_.classList.remove(className);
  8619. },
  8620. hasClass: function hasClass(className) {
  8621. return _this.root_.classList.contains(className);
  8622. },
  8623. hasAnchor: function hasAnchor() {
  8624. return !!_this.anchorElement;
  8625. },
  8626. notifyClose: function notifyClose() {
  8627. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
  8628. },
  8629. notifyOpen: function notifyOpen() {
  8630. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
  8631. },
  8632. isElementInContainer: function isElementInContainer(el) {
  8633. return _this.root_.contains(el);
  8634. },
  8635. isRtl: function isRtl() {
  8636. return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  8637. },
  8638. setTransformOrigin: function setTransformOrigin(origin) {
  8639. var propertyName = util.getTransformPropertyName(window) + "-origin";
  8640. _this.root_.style.setProperty(propertyName, origin);
  8641. },
  8642. isFocused: function isFocused() {
  8643. return document.activeElement === _this.root_;
  8644. },
  8645. saveFocus: function saveFocus() {
  8646. _this.previousFocus_ = document.activeElement;
  8647. },
  8648. restoreFocus: function restoreFocus() {
  8649. if (_this.root_.contains(document.activeElement)) {
  8650. if (_this.previousFocus_ && _this.previousFocus_.focus) {
  8651. _this.previousFocus_.focus();
  8652. }
  8653. }
  8654. },
  8655. getInnerDimensions: function getInnerDimensions() {
  8656. return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight };
  8657. },
  8658. getAnchorDimensions: function getAnchorDimensions() {
  8659. return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
  8660. },
  8661. getWindowDimensions: function getWindowDimensions() {
  8662. return { width: window.innerWidth, height: window.innerHeight };
  8663. },
  8664. getBodyDimensions: function getBodyDimensions() {
  8665. return { width: document.body.clientWidth, height: document.body.clientHeight };
  8666. },
  8667. getWindowScroll: function getWindowScroll() {
  8668. return { x: window.pageXOffset, y: window.pageYOffset };
  8669. },
  8670. setPosition: function setPosition(position) {
  8671. _this.root_.style.left = 'left' in position ? position.left + "px" : '';
  8672. _this.root_.style.right = 'right' in position ? position.right + "px" : '';
  8673. _this.root_.style.top = 'top' in position ? position.top + "px" : '';
  8674. _this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : '';
  8675. },
  8676. setMaxHeight: function setMaxHeight(height) {
  8677. _this.root_.style.maxHeight = height;
  8678. }
  8679. };
  8680. // tslint:enable:object-literal-sort-keys
  8681. return new foundation_1.MDCMenuSurfaceFoundation(adapter);
  8682. };
  8683. return MDCMenuSurface;
  8684. }(component_1.MDCComponent);
  8685. exports.MDCMenuSurface = MDCMenuSurface;
  8686. /***/ }),
  8687. /***/ "./packages/mdc-menu-surface/constants.ts":
  8688. /*!************************************************!*\
  8689. !*** ./packages/mdc-menu-surface/constants.ts ***!
  8690. \************************************************/
  8691. /*! no static exports found */
  8692. /***/ (function(module, exports, __webpack_require__) {
  8693. "use strict";
  8694. /**
  8695. * @license
  8696. * Copyright 2018 Google Inc.
  8697. *
  8698. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8699. * of this software and associated documentation files (the "Software"), to deal
  8700. * in the Software without restriction, including without limitation the rights
  8701. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8702. * copies of the Software, and to permit persons to whom the Software is
  8703. * furnished to do so, subject to the following conditions:
  8704. *
  8705. * The above copyright notice and this permission notice shall be included in
  8706. * all copies or substantial portions of the Software.
  8707. *
  8708. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8709. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8710. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8711. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8712. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8713. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8714. * THE SOFTWARE.
  8715. */
  8716. Object.defineProperty(exports, "__esModule", { value: true });
  8717. var cssClasses = {
  8718. ANCHOR: 'mdc-menu-surface--anchor',
  8719. ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
  8720. ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
  8721. FIXED: 'mdc-menu-surface--fixed',
  8722. OPEN: 'mdc-menu-surface--open',
  8723. ROOT: 'mdc-menu-surface'
  8724. };
  8725. exports.cssClasses = cssClasses;
  8726. // tslint:disable:object-literal-sort-keys
  8727. var strings = {
  8728. CLOSED_EVENT: 'MDCMenuSurface:closed',
  8729. OPENED_EVENT: 'MDCMenuSurface:opened',
  8730. 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(', ')
  8731. };
  8732. exports.strings = strings;
  8733. // tslint:enable:object-literal-sort-keys
  8734. var numbers = {
  8735. /** Total duration of menu-surface open animation. */
  8736. TRANSITION_OPEN_DURATION: 120,
  8737. /** Total duration of menu-surface close animation. */
  8738. TRANSITION_CLOSE_DURATION: 75,
  8739. /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */
  8740. MARGIN_TO_EDGE: 32,
  8741. /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */
  8742. ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67
  8743. };
  8744. exports.numbers = numbers;
  8745. /**
  8746. * Enum for bits in the {@see Corner) bitmap.
  8747. */
  8748. var CornerBit;
  8749. (function (CornerBit) {
  8750. CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
  8751. CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
  8752. CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
  8753. CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
  8754. })(CornerBit || (CornerBit = {}));
  8755. exports.CornerBit = CornerBit;
  8756. /**
  8757. * Enum for representing an element corner for positioning the menu-surface.
  8758. *
  8759. * The START constants map to LEFT if element directionality is left
  8760. * to right and RIGHT if the directionality is right to left.
  8761. * Likewise END maps to RIGHT or LEFT depending on the directionality.
  8762. */
  8763. var Corner;
  8764. (function (Corner) {
  8765. Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
  8766. Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
  8767. Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
  8768. Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
  8769. Corner[Corner["TOP_START"] = 8] = "TOP_START";
  8770. Corner[Corner["TOP_END"] = 12] = "TOP_END";
  8771. Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
  8772. Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
  8773. })(Corner || (Corner = {}));
  8774. exports.Corner = Corner;
  8775. /***/ }),
  8776. /***/ "./packages/mdc-menu-surface/foundation.ts":
  8777. /*!*************************************************!*\
  8778. !*** ./packages/mdc-menu-surface/foundation.ts ***!
  8779. \*************************************************/
  8780. /*! no static exports found */
  8781. /***/ (function(module, exports, __webpack_require__) {
  8782. "use strict";
  8783. /**
  8784. * @license
  8785. * Copyright 2018 Google Inc.
  8786. *
  8787. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8788. * of this software and associated documentation files (the "Software"), to deal
  8789. * in the Software without restriction, including without limitation the rights
  8790. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8791. * copies of the Software, and to permit persons to whom the Software is
  8792. * furnished to do so, subject to the following conditions:
  8793. *
  8794. * The above copyright notice and this permission notice shall be included in
  8795. * all copies or substantial portions of the Software.
  8796. *
  8797. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8798. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8799. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8800. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8801. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8802. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8803. * THE SOFTWARE.
  8804. */
  8805. var __extends = this && this.__extends || function () {
  8806. var _extendStatics = function extendStatics(d, b) {
  8807. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8808. d.__proto__ = b;
  8809. } || function (d, b) {
  8810. for (var p in b) {
  8811. if (b.hasOwnProperty(p)) d[p] = b[p];
  8812. }
  8813. };
  8814. return _extendStatics(d, b);
  8815. };
  8816. return function (d, b) {
  8817. _extendStatics(d, b);
  8818. function __() {
  8819. this.constructor = d;
  8820. }
  8821. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8822. };
  8823. }();
  8824. var __assign = this && this.__assign || function () {
  8825. __assign = Object.assign || function (t) {
  8826. for (var s, i = 1, n = arguments.length; i < n; i++) {
  8827. s = arguments[i];
  8828. for (var p in s) {
  8829. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  8830. }
  8831. }
  8832. return t;
  8833. };
  8834. return __assign.apply(this, arguments);
  8835. };
  8836. var __values = this && this.__values || function (o) {
  8837. var m = typeof Symbol === "function" && o[Symbol.iterator],
  8838. i = 0;
  8839. if (m) return m.call(o);
  8840. return {
  8841. next: function next() {
  8842. if (o && i >= o.length) o = void 0;
  8843. return { value: o && o[i++], done: !o };
  8844. }
  8845. };
  8846. };
  8847. Object.defineProperty(exports, "__esModule", { value: true });
  8848. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  8849. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  8850. var MDCMenuSurfaceFoundation = /** @class */function (_super) {
  8851. __extends(MDCMenuSurfaceFoundation, _super);
  8852. function MDCMenuSurfaceFoundation(adapter) {
  8853. var _this = _super.call(this, __assign({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this;
  8854. _this.isOpen_ = false;
  8855. _this.isQuickOpen_ = false;
  8856. _this.isHoistedElement_ = false;
  8857. _this.isFixedPosition_ = false;
  8858. _this.openAnimationEndTimerId_ = 0;
  8859. _this.closeAnimationEndTimerId_ = 0;
  8860. _this.animationRequestId_ = 0;
  8861. _this.anchorCorner_ = constants_1.Corner.TOP_START;
  8862. _this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 };
  8863. _this.position_ = { x: 0, y: 0 };
  8864. return _this;
  8865. }
  8866. Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
  8867. get: function get() {
  8868. return constants_1.cssClasses;
  8869. },
  8870. enumerable: true,
  8871. configurable: true
  8872. });
  8873. Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
  8874. get: function get() {
  8875. return constants_1.strings;
  8876. },
  8877. enumerable: true,
  8878. configurable: true
  8879. });
  8880. Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
  8881. get: function get() {
  8882. return constants_1.numbers;
  8883. },
  8884. enumerable: true,
  8885. configurable: true
  8886. });
  8887. Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
  8888. get: function get() {
  8889. return constants_1.Corner;
  8890. },
  8891. enumerable: true,
  8892. configurable: true
  8893. });
  8894. Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
  8895. /**
  8896. * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
  8897. */
  8898. get: function get() {
  8899. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8900. return {
  8901. addClass: function addClass() {
  8902. return undefined;
  8903. },
  8904. removeClass: function removeClass() {
  8905. return undefined;
  8906. },
  8907. hasClass: function hasClass() {
  8908. return false;
  8909. },
  8910. hasAnchor: function hasAnchor() {
  8911. return false;
  8912. },
  8913. isElementInContainer: function isElementInContainer() {
  8914. return false;
  8915. },
  8916. isFocused: function isFocused() {
  8917. return false;
  8918. },
  8919. isRtl: function isRtl() {
  8920. return false;
  8921. },
  8922. getInnerDimensions: function getInnerDimensions() {
  8923. return { height: 0, width: 0 };
  8924. },
  8925. getAnchorDimensions: function getAnchorDimensions() {
  8926. return null;
  8927. },
  8928. getWindowDimensions: function getWindowDimensions() {
  8929. return { height: 0, width: 0 };
  8930. },
  8931. getBodyDimensions: function getBodyDimensions() {
  8932. return { height: 0, width: 0 };
  8933. },
  8934. getWindowScroll: function getWindowScroll() {
  8935. return { x: 0, y: 0 };
  8936. },
  8937. setPosition: function setPosition() {
  8938. return undefined;
  8939. },
  8940. setMaxHeight: function setMaxHeight() {
  8941. return undefined;
  8942. },
  8943. setTransformOrigin: function setTransformOrigin() {
  8944. return undefined;
  8945. },
  8946. saveFocus: function saveFocus() {
  8947. return undefined;
  8948. },
  8949. restoreFocus: function restoreFocus() {
  8950. return undefined;
  8951. },
  8952. notifyClose: function notifyClose() {
  8953. return undefined;
  8954. },
  8955. notifyOpen: function notifyOpen() {
  8956. return undefined;
  8957. }
  8958. };
  8959. // tslint:enable:object-literal-sort-keys
  8960. },
  8961. enumerable: true,
  8962. configurable: true
  8963. });
  8964. MDCMenuSurfaceFoundation.prototype.init = function () {
  8965. var _a = MDCMenuSurfaceFoundation.cssClasses,
  8966. ROOT = _a.ROOT,
  8967. OPEN = _a.OPEN;
  8968. if (!this.adapter_.hasClass(ROOT)) {
  8969. throw new Error(ROOT + " class required in root element.");
  8970. }
  8971. if (this.adapter_.hasClass(OPEN)) {
  8972. this.isOpen_ = true;
  8973. }
  8974. };
  8975. MDCMenuSurfaceFoundation.prototype.destroy = function () {
  8976. clearTimeout(this.openAnimationEndTimerId_);
  8977. clearTimeout(this.closeAnimationEndTimerId_);
  8978. // Cancel any currently running animations.
  8979. cancelAnimationFrame(this.animationRequestId_);
  8980. };
  8981. /**
  8982. * @param corner Default anchor corner alignment of top-left menu surface corner.
  8983. */
  8984. MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
  8985. this.anchorCorner_ = corner;
  8986. };
  8987. /**
  8988. * @param margin Set of margin values from anchor.
  8989. */
  8990. MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
  8991. this.anchorMargin_.top = margin.top || 0;
  8992. this.anchorMargin_.right = margin.right || 0;
  8993. this.anchorMargin_.bottom = margin.bottom || 0;
  8994. this.anchorMargin_.left = margin.left || 0;
  8995. };
  8996. /** Used to indicate if the menu-surface is hoisted to the body. */
  8997. MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
  8998. this.isHoistedElement_ = isHoisted;
  8999. };
  9000. /** Used to set the menu-surface calculations based on a fixed position menu. */
  9001. MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
  9002. this.isFixedPosition_ = isFixedPosition;
  9003. };
  9004. /** Sets the menu-surface position on the page. */
  9005. MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
  9006. this.position_.x = this.isFinite_(x) ? x : 0;
  9007. this.position_.y = this.isFinite_(y) ? y : 0;
  9008. };
  9009. MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
  9010. this.isQuickOpen_ = quickOpen;
  9011. };
  9012. MDCMenuSurfaceFoundation.prototype.isOpen = function () {
  9013. return this.isOpen_;
  9014. };
  9015. /**
  9016. * Open the menu surface.
  9017. */
  9018. MDCMenuSurfaceFoundation.prototype.open = function () {
  9019. var _this = this;
  9020. this.adapter_.saveFocus();
  9021. if (!this.isQuickOpen_) {
  9022. this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  9023. }
  9024. this.animationRequestId_ = requestAnimationFrame(function () {
  9025. _this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  9026. _this.dimensions_ = _this.adapter_.getInnerDimensions();
  9027. _this.autoPosition_();
  9028. if (_this.isQuickOpen_) {
  9029. _this.adapter_.notifyOpen();
  9030. } else {
  9031. _this.openAnimationEndTimerId_ = setTimeout(function () {
  9032. _this.openAnimationEndTimerId_ = 0;
  9033. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  9034. _this.adapter_.notifyOpen();
  9035. }, constants_1.numbers.TRANSITION_OPEN_DURATION);
  9036. }
  9037. });
  9038. this.isOpen_ = true;
  9039. };
  9040. /**
  9041. * Closes the menu surface.
  9042. */
  9043. MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
  9044. var _this = this;
  9045. if (skipRestoreFocus === void 0) {
  9046. skipRestoreFocus = false;
  9047. }
  9048. if (!this.isQuickOpen_) {
  9049. this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  9050. }
  9051. requestAnimationFrame(function () {
  9052. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  9053. if (_this.isQuickOpen_) {
  9054. _this.adapter_.notifyClose();
  9055. } else {
  9056. _this.closeAnimationEndTimerId_ = setTimeout(function () {
  9057. _this.closeAnimationEndTimerId_ = 0;
  9058. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  9059. _this.adapter_.notifyClose();
  9060. }, constants_1.numbers.TRANSITION_CLOSE_DURATION);
  9061. }
  9062. });
  9063. this.isOpen_ = false;
  9064. if (!skipRestoreFocus) {
  9065. this.maybeRestoreFocus_();
  9066. }
  9067. };
  9068. /** Handle clicks and close if not within menu-surface element. */
  9069. MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
  9070. var el = evt.target;
  9071. if (this.adapter_.isElementInContainer(el)) {
  9072. return;
  9073. }
  9074. this.close();
  9075. };
  9076. /** Handle keys that close the surface. */
  9077. MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
  9078. var keyCode = evt.keyCode,
  9079. key = evt.key;
  9080. var isEscape = key === 'Escape' || keyCode === 27;
  9081. if (isEscape) {
  9082. this.close();
  9083. }
  9084. };
  9085. MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () {
  9086. var _a;
  9087. // Compute measurements for autoposition methods reuse.
  9088. this.measurements_ = this.getAutoLayoutMeasurements_();
  9089. var corner = this.getOriginCorner_();
  9090. var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner);
  9091. var verticalAlignment = this.hasBit_(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top';
  9092. var horizontalAlignment = this.hasBit_(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left';
  9093. var horizontalOffset = this.getHorizontalOriginOffset_(corner);
  9094. var verticalOffset = this.getVerticalOriginOffset_(corner);
  9095. var _b = this.measurements_,
  9096. anchorSize = _b.anchorSize,
  9097. surfaceSize = _b.surfaceSize;
  9098. var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
  9099. // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner.
  9100. if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
  9101. horizontalAlignment = 'center';
  9102. }
  9103. // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element
  9104. if (this.isHoistedElement_ || this.isFixedPosition_) {
  9105. this.adjustPositionForHoistedElement_(position);
  9106. }
  9107. this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
  9108. this.adapter_.setPosition(position);
  9109. this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
  9110. };
  9111. /**
  9112. * @return Measurements used to position menu surface popup.
  9113. */
  9114. MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () {
  9115. var anchorRect = this.adapter_.getAnchorDimensions();
  9116. var bodySize = this.adapter_.getBodyDimensions();
  9117. var viewportSize = this.adapter_.getWindowDimensions();
  9118. var windowScroll = this.adapter_.getWindowScroll();
  9119. if (!anchorRect) {
  9120. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  9121. anchorRect = {
  9122. top: this.position_.y,
  9123. right: this.position_.x,
  9124. bottom: this.position_.y,
  9125. left: this.position_.x,
  9126. width: 0,
  9127. height: 0
  9128. };
  9129. // tslint:enable:object-literal-sort-keys
  9130. }
  9131. return {
  9132. anchorSize: anchorRect,
  9133. bodySize: bodySize,
  9134. surfaceSize: this.dimensions_,
  9135. viewportDistance: {
  9136. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  9137. top: anchorRect.top,
  9138. right: viewportSize.width - anchorRect.right,
  9139. bottom: viewportSize.height - anchorRect.bottom,
  9140. left: anchorRect.left
  9141. },
  9142. viewportSize: viewportSize,
  9143. windowScroll: windowScroll
  9144. };
  9145. };
  9146. /**
  9147. * Computes the corner of the anchor from which to animate and position the menu surface.
  9148. */
  9149. MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () {
  9150. // Defaults: open from the top left.
  9151. var corner = constants_1.Corner.TOP_LEFT;
  9152. var _a = this.measurements_,
  9153. viewportDistance = _a.viewportDistance,
  9154. anchorSize = _a.anchorSize,
  9155. surfaceSize = _a.surfaceSize;
  9156. var isBottomAligned = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  9157. var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top;
  9158. var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top;
  9159. var topOverflow = surfaceSize.height - availableTop;
  9160. var bottomOverflow = surfaceSize.height - availableBottom;
  9161. if (bottomOverflow > 0 && topOverflow < bottomOverflow) {
  9162. corner = this.setBit_(corner, constants_1.CornerBit.BOTTOM);
  9163. }
  9164. var isRtl = this.adapter_.isRtl();
  9165. var isFlipRtl = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.FLIP_RTL);
  9166. var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
  9167. var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl;
  9168. var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left;
  9169. var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left;
  9170. var leftOverflow = surfaceSize.width - availableLeft;
  9171. var rightOverflow = surfaceSize.width - availableRight;
  9172. if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) {
  9173. corner = this.setBit_(corner, constants_1.CornerBit.RIGHT);
  9174. }
  9175. return corner;
  9176. };
  9177. /**
  9178. * @param corner Origin corner of the menu surface.
  9179. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set.
  9180. */
  9181. MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) {
  9182. var viewportDistance = this.measurements_.viewportDistance;
  9183. var maxHeight = 0;
  9184. var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
  9185. var isBottomAnchored = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  9186. var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
  9187. // When maximum height is not specified, it is handled from CSS.
  9188. if (isBottomAligned) {
  9189. maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE;
  9190. if (!isBottomAnchored) {
  9191. maxHeight += this.measurements_.anchorSize.height;
  9192. }
  9193. } else {
  9194. maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE;
  9195. if (isBottomAnchored) {
  9196. maxHeight -= this.measurements_.anchorSize.height;
  9197. }
  9198. }
  9199. return maxHeight;
  9200. };
  9201. /**
  9202. * @param corner Origin corner of the menu surface.
  9203. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner.
  9204. */
  9205. MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) {
  9206. var anchorSize = this.measurements_.anchorSize;
  9207. // isRightAligned corresponds to using the 'right' property on the surface.
  9208. var isRightAligned = this.hasBit_(corner, constants_1.CornerBit.RIGHT);
  9209. var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
  9210. if (isRightAligned) {
  9211. var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right;
  9212. // For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so
  9213. // when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position,
  9214. // the right property is correct.
  9215. if (this.isHoistedElement_ || this.isFixedPosition_) {
  9216. return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width);
  9217. }
  9218. return rightOffset;
  9219. }
  9220. return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left;
  9221. };
  9222. /**
  9223. * @param corner Origin corner of the menu surface.
  9224. * @return Vertical offset of menu surface origin corner from corresponding anchor corner.
  9225. */
  9226. MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) {
  9227. var anchorSize = this.measurements_.anchorSize;
  9228. var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
  9229. var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  9230. var y = 0;
  9231. if (isBottomAligned) {
  9232. y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom;
  9233. } else {
  9234. y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top;
  9235. }
  9236. return y;
  9237. };
  9238. /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */
  9239. MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) {
  9240. var e_1, _a;
  9241. var _b = this.measurements_,
  9242. windowScroll = _b.windowScroll,
  9243. viewportDistance = _b.viewportDistance;
  9244. var props = Object.keys(position);
  9245. try {
  9246. for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
  9247. var prop = props_1_1.value;
  9248. var value = position[prop] || 0;
  9249. // Hoisted surfaces need to have the anchor elements location on the page added to the
  9250. // position properties for proper alignment on the body.
  9251. value += viewportDistance[prop];
  9252. // Surfaces that are absolutely positioned need to have additional calculations for scroll
  9253. // and bottom positioning.
  9254. if (!this.isFixedPosition_) {
  9255. if (prop === 'top') {
  9256. value += windowScroll.y;
  9257. } else if (prop === 'bottom') {
  9258. value -= windowScroll.y;
  9259. } else if (prop === 'left') {
  9260. value += windowScroll.x;
  9261. } else {
  9262. // prop === 'right'
  9263. value -= windowScroll.x;
  9264. }
  9265. }
  9266. position[prop] = value;
  9267. }
  9268. } catch (e_1_1) {
  9269. e_1 = { error: e_1_1 };
  9270. } finally {
  9271. try {
  9272. if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
  9273. } finally {
  9274. if (e_1) throw e_1.error;
  9275. }
  9276. }
  9277. };
  9278. /**
  9279. * The last focused element when the menu surface was opened should regain focus, if the user is
  9280. * focused on or within the menu surface when it is closed.
  9281. */
  9282. MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () {
  9283. var isRootFocused = this.adapter_.isFocused();
  9284. var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement);
  9285. if (isRootFocused || childHasFocus) {
  9286. this.adapter_.restoreFocus();
  9287. }
  9288. };
  9289. MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) {
  9290. return Boolean(corner & bit); // tslint:disable-line:no-bitwise
  9291. };
  9292. MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) {
  9293. return corner | bit; // tslint:disable-line:no-bitwise
  9294. };
  9295. /**
  9296. * isFinite that doesn't force conversion to number type.
  9297. * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
  9298. */
  9299. MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) {
  9300. return typeof num === 'number' && isFinite(num);
  9301. };
  9302. return MDCMenuSurfaceFoundation;
  9303. }(foundation_1.MDCFoundation);
  9304. exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
  9305. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  9306. exports.default = MDCMenuSurfaceFoundation;
  9307. /***/ }),
  9308. /***/ "./packages/mdc-menu-surface/index.ts":
  9309. /*!********************************************!*\
  9310. !*** ./packages/mdc-menu-surface/index.ts ***!
  9311. \********************************************/
  9312. /*! no static exports found */
  9313. /***/ (function(module, exports, __webpack_require__) {
  9314. "use strict";
  9315. /**
  9316. * @license
  9317. * Copyright 2019 Google Inc.
  9318. *
  9319. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9320. * of this software and associated documentation files (the "Software"), to deal
  9321. * in the Software without restriction, including without limitation the rights
  9322. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9323. * copies of the Software, and to permit persons to whom the Software is
  9324. * furnished to do so, subject to the following conditions:
  9325. *
  9326. * The above copyright notice and this permission notice shall be included in
  9327. * all copies or substantial portions of the Software.
  9328. *
  9329. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9330. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9331. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9332. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9333. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9334. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9335. * THE SOFTWARE.
  9336. */
  9337. function __export(m) {
  9338. for (var p in m) {
  9339. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  9340. }
  9341. }
  9342. var __importStar = this && this.__importStar || function (mod) {
  9343. if (mod && mod.__esModule) return mod;
  9344. var result = {};
  9345. if (mod != null) for (var k in mod) {
  9346. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  9347. }result["default"] = mod;
  9348. return result;
  9349. };
  9350. Object.defineProperty(exports, "__esModule", { value: true });
  9351. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  9352. exports.util = util;
  9353. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  9354. exports.Corner = constants_1.Corner;
  9355. exports.CornerBit = constants_1.CornerBit;
  9356. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts"));
  9357. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"));
  9358. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"));
  9359. /***/ }),
  9360. /***/ "./packages/mdc-menu-surface/util.ts":
  9361. /*!*******************************************!*\
  9362. !*** ./packages/mdc-menu-surface/util.ts ***!
  9363. \*******************************************/
  9364. /*! no static exports found */
  9365. /***/ (function(module, exports, __webpack_require__) {
  9366. "use strict";
  9367. /**
  9368. * @license
  9369. * Copyright 2018 Google Inc.
  9370. *
  9371. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9372. * of this software and associated documentation files (the "Software"), to deal
  9373. * in the Software without restriction, including without limitation the rights
  9374. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9375. * copies of the Software, and to permit persons to whom the Software is
  9376. * furnished to do so, subject to the following conditions:
  9377. *
  9378. * The above copyright notice and this permission notice shall be included in
  9379. * all copies or substantial portions of the Software.
  9380. *
  9381. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9382. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9383. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9384. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9385. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9386. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9387. * THE SOFTWARE.
  9388. */
  9389. Object.defineProperty(exports, "__esModule", { value: true });
  9390. var cachedCssTransformPropertyName_;
  9391. /**
  9392. * Returns the name of the correct transform property to use on the current browser.
  9393. */
  9394. function getTransformPropertyName(globalObj, forceRefresh) {
  9395. if (forceRefresh === void 0) {
  9396. forceRefresh = false;
  9397. }
  9398. if (cachedCssTransformPropertyName_ === undefined || forceRefresh) {
  9399. var el = globalObj.document.createElement('div');
  9400. cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform';
  9401. }
  9402. return cachedCssTransformPropertyName_;
  9403. }
  9404. exports.getTransformPropertyName = getTransformPropertyName;
  9405. /***/ }),
  9406. /***/ "./packages/mdc-menu/component.ts":
  9407. /*!****************************************!*\
  9408. !*** ./packages/mdc-menu/component.ts ***!
  9409. \****************************************/
  9410. /*! no static exports found */
  9411. /***/ (function(module, exports, __webpack_require__) {
  9412. "use strict";
  9413. /**
  9414. * @license
  9415. * Copyright 2018 Google Inc.
  9416. *
  9417. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9418. * of this software and associated documentation files (the "Software"), to deal
  9419. * in the Software without restriction, including without limitation the rights
  9420. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9421. * copies of the Software, and to permit persons to whom the Software is
  9422. * furnished to do so, subject to the following conditions:
  9423. *
  9424. * The above copyright notice and this permission notice shall be included in
  9425. * all copies or substantial portions of the Software.
  9426. *
  9427. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9428. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9429. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9430. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9431. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9432. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9433. * THE SOFTWARE.
  9434. */
  9435. var __extends = this && this.__extends || function () {
  9436. var _extendStatics = function extendStatics(d, b) {
  9437. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9438. d.__proto__ = b;
  9439. } || function (d, b) {
  9440. for (var p in b) {
  9441. if (b.hasOwnProperty(p)) d[p] = b[p];
  9442. }
  9443. };
  9444. return _extendStatics(d, b);
  9445. };
  9446. return function (d, b) {
  9447. _extendStatics(d, b);
  9448. function __() {
  9449. this.constructor = d;
  9450. }
  9451. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9452. };
  9453. }();
  9454. Object.defineProperty(exports, "__esModule", { value: true });
  9455. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  9456. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  9457. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  9458. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  9459. var component_3 = __webpack_require__(/*! @material/menu-surface/component */ "./packages/mdc-menu-surface/component.ts");
  9460. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  9461. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  9462. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts");
  9463. var MDCMenu = /** @class */function (_super) {
  9464. __extends(MDCMenu, _super);
  9465. function MDCMenu() {
  9466. return _super !== null && _super.apply(this, arguments) || this;
  9467. }
  9468. MDCMenu.attachTo = function (root) {
  9469. return new MDCMenu(root);
  9470. };
  9471. MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
  9472. if (menuSurfaceFactory === void 0) {
  9473. menuSurfaceFactory = function menuSurfaceFactory(el) {
  9474. return new component_3.MDCMenuSurface(el);
  9475. };
  9476. }
  9477. if (listFactory === void 0) {
  9478. listFactory = function listFactory(el) {
  9479. return new component_2.MDCList(el);
  9480. };
  9481. }
  9482. this.menuSurfaceFactory_ = menuSurfaceFactory;
  9483. this.listFactory_ = listFactory;
  9484. };
  9485. MDCMenu.prototype.initialSyncWithDOM = function () {
  9486. var _this = this;
  9487. this.menuSurface_ = this.menuSurfaceFactory_(this.root_);
  9488. var list = this.root_.querySelector(constants_1.strings.LIST_SELECTOR);
  9489. if (list) {
  9490. this.list_ = this.listFactory_(list);
  9491. this.list_.wrapFocus = true;
  9492. } else {
  9493. this.list_ = null;
  9494. }
  9495. this.handleKeydown_ = function (evt) {
  9496. return _this.foundation_.handleKeydown(evt);
  9497. };
  9498. this.handleItemAction_ = function (evt) {
  9499. return _this.foundation_.handleItemAction(_this.items[evt.detail.index]);
  9500. };
  9501. this.handleMenuSurfaceOpened_ = function () {
  9502. return _this.foundation_.handleMenuSurfaceOpened();
  9503. };
  9504. this.menuSurface_.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  9505. this.listen('keydown', this.handleKeydown_);
  9506. this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  9507. };
  9508. MDCMenu.prototype.destroy = function () {
  9509. if (this.list_) {
  9510. this.list_.destroy();
  9511. }
  9512. this.menuSurface_.destroy();
  9513. this.menuSurface_.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  9514. this.unlisten('keydown', this.handleKeydown_);
  9515. this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  9516. _super.prototype.destroy.call(this);
  9517. };
  9518. Object.defineProperty(MDCMenu.prototype, "open", {
  9519. get: function get() {
  9520. return this.menuSurface_.isOpen();
  9521. },
  9522. set: function set(value) {
  9523. if (value) {
  9524. this.menuSurface_.open();
  9525. } else {
  9526. this.menuSurface_.close();
  9527. }
  9528. },
  9529. enumerable: true,
  9530. configurable: true
  9531. });
  9532. Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
  9533. get: function get() {
  9534. return this.list_ ? this.list_.wrapFocus : false;
  9535. },
  9536. set: function set(value) {
  9537. if (this.list_) {
  9538. this.list_.wrapFocus = value;
  9539. }
  9540. },
  9541. enumerable: true,
  9542. configurable: true
  9543. });
  9544. Object.defineProperty(MDCMenu.prototype, "items", {
  9545. /**
  9546. * Return the items within the menu. Note that this only contains the set of elements within
  9547. * the items container that are proper list items, and not supplemental / presentational DOM
  9548. * elements.
  9549. */
  9550. get: function get() {
  9551. return this.list_ ? this.list_.listElements : [];
  9552. },
  9553. enumerable: true,
  9554. configurable: true
  9555. });
  9556. Object.defineProperty(MDCMenu.prototype, "quickOpen", {
  9557. set: function set(quickOpen) {
  9558. this.menuSurface_.quickOpen = quickOpen;
  9559. },
  9560. enumerable: true,
  9561. configurable: true
  9562. });
  9563. /**
  9564. * Sets default focus state where the menu should focus every time when menu
  9565. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  9566. * default.
  9567. * @param focusState Default focus state.
  9568. */
  9569. MDCMenu.prototype.setDefaultFocusState = function (focusState) {
  9570. this.foundation_.setDefaultFocusState(focusState);
  9571. };
  9572. /**
  9573. * @param corner Default anchor corner alignment of top-left menu corner.
  9574. */
  9575. MDCMenu.prototype.setAnchorCorner = function (corner) {
  9576. this.menuSurface_.setAnchorCorner(corner);
  9577. };
  9578. MDCMenu.prototype.setAnchorMargin = function (margin) {
  9579. this.menuSurface_.setAnchorMargin(margin);
  9580. };
  9581. /**
  9582. * Sets the list item as the selected row at the specified index.
  9583. * @param index Index of list item within menu.
  9584. */
  9585. MDCMenu.prototype.setSelectedIndex = function (index) {
  9586. this.foundation_.setSelectedIndex(index);
  9587. };
  9588. /**
  9589. * @return The item within the menu at the index specified.
  9590. */
  9591. MDCMenu.prototype.getOptionByIndex = function (index) {
  9592. var items = this.items;
  9593. if (index < items.length) {
  9594. return this.items[index];
  9595. } else {
  9596. return null;
  9597. }
  9598. };
  9599. MDCMenu.prototype.setFixedPosition = function (isFixed) {
  9600. this.menuSurface_.setFixedPosition(isFixed);
  9601. };
  9602. MDCMenu.prototype.hoistMenuToBody = function () {
  9603. this.menuSurface_.hoistMenuToBody();
  9604. };
  9605. MDCMenu.prototype.setIsHoisted = function (isHoisted) {
  9606. this.menuSurface_.setIsHoisted(isHoisted);
  9607. };
  9608. MDCMenu.prototype.setAbsolutePosition = function (x, y) {
  9609. this.menuSurface_.setAbsolutePosition(x, y);
  9610. };
  9611. /**
  9612. * Sets the element that the menu-surface is anchored to.
  9613. */
  9614. MDCMenu.prototype.setAnchorElement = function (element) {
  9615. this.menuSurface_.anchorElement = element;
  9616. };
  9617. MDCMenu.prototype.getDefaultFoundation = function () {
  9618. var _this = this;
  9619. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  9620. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  9621. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9622. var adapter = {
  9623. addClassToElementAtIndex: function addClassToElementAtIndex(index, className) {
  9624. var list = _this.items;
  9625. list[index].classList.add(className);
  9626. },
  9627. removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) {
  9628. var list = _this.items;
  9629. list[index].classList.remove(className);
  9630. },
  9631. addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) {
  9632. var list = _this.items;
  9633. list[index].setAttribute(attr, value);
  9634. },
  9635. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) {
  9636. var list = _this.items;
  9637. list[index].removeAttribute(attr);
  9638. },
  9639. elementContainsClass: function elementContainsClass(element, className) {
  9640. return element.classList.contains(className);
  9641. },
  9642. closeSurface: function closeSurface(skipRestoreFocus) {
  9643. return _this.menuSurface_.close(skipRestoreFocus);
  9644. },
  9645. getElementIndex: function getElementIndex(element) {
  9646. return _this.items.indexOf(element);
  9647. },
  9648. notifySelected: function notifySelected(evtData) {
  9649. return _this.emit(constants_1.strings.SELECTED_EVENT, {
  9650. index: evtData.index,
  9651. item: _this.items[evtData.index]
  9652. });
  9653. },
  9654. getMenuItemCount: function getMenuItemCount() {
  9655. return _this.items.length;
  9656. },
  9657. focusItemAtIndex: function focusItemAtIndex(index) {
  9658. return _this.items[index].focus();
  9659. },
  9660. focusListRoot: function focusListRoot() {
  9661. return _this.root_.querySelector(constants_1.strings.LIST_SELECTOR).focus();
  9662. },
  9663. isSelectableItemAtIndex: function isSelectableItemAtIndex(index) {
  9664. return !!ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  9665. },
  9666. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) {
  9667. var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  9668. var selectedItemEl = selectionGroupEl.querySelector("." + constants_1.cssClasses.MENU_SELECTED_LIST_ITEM);
  9669. return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
  9670. }
  9671. };
  9672. // tslint:enable:object-literal-sort-keys
  9673. return new foundation_3.MDCMenuFoundation(adapter);
  9674. };
  9675. return MDCMenu;
  9676. }(component_1.MDCComponent);
  9677. exports.MDCMenu = MDCMenu;
  9678. /***/ }),
  9679. /***/ "./packages/mdc-menu/constants.ts":
  9680. /*!****************************************!*\
  9681. !*** ./packages/mdc-menu/constants.ts ***!
  9682. \****************************************/
  9683. /*! no static exports found */
  9684. /***/ (function(module, exports, __webpack_require__) {
  9685. "use strict";
  9686. /**
  9687. * @license
  9688. * Copyright 2018 Google Inc.
  9689. *
  9690. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9691. * of this software and associated documentation files (the "Software"), to deal
  9692. * in the Software without restriction, including without limitation the rights
  9693. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9694. * copies of the Software, and to permit persons to whom the Software is
  9695. * furnished to do so, subject to the following conditions:
  9696. *
  9697. * The above copyright notice and this permission notice shall be included in
  9698. * all copies or substantial portions of the Software.
  9699. *
  9700. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9701. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9702. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9703. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9704. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9705. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9706. * THE SOFTWARE.
  9707. */
  9708. Object.defineProperty(exports, "__esModule", { value: true });
  9709. var cssClasses = {
  9710. MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
  9711. MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
  9712. ROOT: 'mdc-menu'
  9713. };
  9714. exports.cssClasses = cssClasses;
  9715. var strings = {
  9716. ARIA_CHECKED_ATTR: 'aria-checked',
  9717. CHECKBOX_SELECTOR: 'input[type="checkbox"]',
  9718. LIST_SELECTOR: '.mdc-list',
  9719. SELECTED_EVENT: 'MDCMenu:selected'
  9720. };
  9721. exports.strings = strings;
  9722. var numbers = {
  9723. FOCUS_ROOT_INDEX: -1
  9724. };
  9725. exports.numbers = numbers;
  9726. var DefaultFocusState;
  9727. (function (DefaultFocusState) {
  9728. DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
  9729. DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
  9730. DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
  9731. DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
  9732. })(DefaultFocusState || (DefaultFocusState = {}));
  9733. exports.DefaultFocusState = DefaultFocusState;
  9734. /***/ }),
  9735. /***/ "./packages/mdc-menu/foundation.ts":
  9736. /*!*****************************************!*\
  9737. !*** ./packages/mdc-menu/foundation.ts ***!
  9738. \*****************************************/
  9739. /*! no static exports found */
  9740. /***/ (function(module, exports, __webpack_require__) {
  9741. "use strict";
  9742. /**
  9743. * @license
  9744. * Copyright 2018 Google Inc.
  9745. *
  9746. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9747. * of this software and associated documentation files (the "Software"), to deal
  9748. * in the Software without restriction, including without limitation the rights
  9749. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9750. * copies of the Software, and to permit persons to whom the Software is
  9751. * furnished to do so, subject to the following conditions:
  9752. *
  9753. * The above copyright notice and this permission notice shall be included in
  9754. * all copies or substantial portions of the Software.
  9755. *
  9756. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9757. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9758. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9759. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9760. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9761. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9762. * THE SOFTWARE.
  9763. */
  9764. var __extends = this && this.__extends || function () {
  9765. var _extendStatics = function extendStatics(d, b) {
  9766. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9767. d.__proto__ = b;
  9768. } || function (d, b) {
  9769. for (var p in b) {
  9770. if (b.hasOwnProperty(p)) d[p] = b[p];
  9771. }
  9772. };
  9773. return _extendStatics(d, b);
  9774. };
  9775. return function (d, b) {
  9776. _extendStatics(d, b);
  9777. function __() {
  9778. this.constructor = d;
  9779. }
  9780. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9781. };
  9782. }();
  9783. var __assign = this && this.__assign || function () {
  9784. __assign = Object.assign || function (t) {
  9785. for (var s, i = 1, n = arguments.length; i < n; i++) {
  9786. s = arguments[i];
  9787. for (var p in s) {
  9788. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  9789. }
  9790. }
  9791. return t;
  9792. };
  9793. return __assign.apply(this, arguments);
  9794. };
  9795. Object.defineProperty(exports, "__esModule", { value: true });
  9796. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  9797. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  9798. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  9799. var MDCMenuFoundation = /** @class */function (_super) {
  9800. __extends(MDCMenuFoundation, _super);
  9801. function MDCMenuFoundation(adapter) {
  9802. var _this = _super.call(this, __assign({}, MDCMenuFoundation.defaultAdapter, adapter)) || this;
  9803. _this.closeAnimationEndTimerId_ = 0;
  9804. _this.defaultFocusState_ = constants_1.DefaultFocusState.LIST_ROOT;
  9805. return _this;
  9806. }
  9807. Object.defineProperty(MDCMenuFoundation, "cssClasses", {
  9808. get: function get() {
  9809. return constants_1.cssClasses;
  9810. },
  9811. enumerable: true,
  9812. configurable: true
  9813. });
  9814. Object.defineProperty(MDCMenuFoundation, "strings", {
  9815. get: function get() {
  9816. return constants_1.strings;
  9817. },
  9818. enumerable: true,
  9819. configurable: true
  9820. });
  9821. Object.defineProperty(MDCMenuFoundation, "numbers", {
  9822. get: function get() {
  9823. return constants_1.numbers;
  9824. },
  9825. enumerable: true,
  9826. configurable: true
  9827. });
  9828. Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
  9829. /**
  9830. * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
  9831. */
  9832. get: function get() {
  9833. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9834. return {
  9835. addClassToElementAtIndex: function addClassToElementAtIndex() {
  9836. return undefined;
  9837. },
  9838. removeClassFromElementAtIndex: function removeClassFromElementAtIndex() {
  9839. return undefined;
  9840. },
  9841. addAttributeToElementAtIndex: function addAttributeToElementAtIndex() {
  9842. return undefined;
  9843. },
  9844. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() {
  9845. return undefined;
  9846. },
  9847. elementContainsClass: function elementContainsClass() {
  9848. return false;
  9849. },
  9850. closeSurface: function closeSurface() {
  9851. return undefined;
  9852. },
  9853. getElementIndex: function getElementIndex() {
  9854. return -1;
  9855. },
  9856. notifySelected: function notifySelected() {
  9857. return undefined;
  9858. },
  9859. getMenuItemCount: function getMenuItemCount() {
  9860. return 0;
  9861. },
  9862. focusItemAtIndex: function focusItemAtIndex() {
  9863. return undefined;
  9864. },
  9865. focusListRoot: function focusListRoot() {
  9866. return undefined;
  9867. },
  9868. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() {
  9869. return -1;
  9870. },
  9871. isSelectableItemAtIndex: function isSelectableItemAtIndex() {
  9872. return false;
  9873. }
  9874. };
  9875. // tslint:enable:object-literal-sort-keys
  9876. },
  9877. enumerable: true,
  9878. configurable: true
  9879. });
  9880. MDCMenuFoundation.prototype.destroy = function () {
  9881. if (this.closeAnimationEndTimerId_) {
  9882. clearTimeout(this.closeAnimationEndTimerId_);
  9883. }
  9884. this.adapter_.closeSurface();
  9885. };
  9886. MDCMenuFoundation.prototype.handleKeydown = function (evt) {
  9887. var key = evt.key,
  9888. keyCode = evt.keyCode;
  9889. var isTab = key === 'Tab' || keyCode === 9;
  9890. if (isTab) {
  9891. this.adapter_.closeSurface( /** skipRestoreFocus */true);
  9892. }
  9893. };
  9894. MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
  9895. var _this = this;
  9896. var index = this.adapter_.getElementIndex(listItem);
  9897. if (index < 0) {
  9898. return;
  9899. }
  9900. this.adapter_.notifySelected({ index: index });
  9901. this.adapter_.closeSurface();
  9902. // Wait for the menu to close before adding/removing classes that affect styles.
  9903. this.closeAnimationEndTimerId_ = setTimeout(function () {
  9904. if (_this.adapter_.isSelectableItemAtIndex(index)) {
  9905. _this.setSelectedIndex(index);
  9906. }
  9907. }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
  9908. };
  9909. MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
  9910. switch (this.defaultFocusState_) {
  9911. case constants_1.DefaultFocusState.FIRST_ITEM:
  9912. this.adapter_.focusItemAtIndex(0);
  9913. break;
  9914. case constants_1.DefaultFocusState.LAST_ITEM:
  9915. this.adapter_.focusItemAtIndex(this.adapter_.getMenuItemCount() - 1);
  9916. break;
  9917. case constants_1.DefaultFocusState.NONE:
  9918. // Do nothing.
  9919. break;
  9920. default:
  9921. this.adapter_.focusListRoot();
  9922. break;
  9923. }
  9924. };
  9925. /**
  9926. * Sets default focus state where the menu should focus every time when menu
  9927. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  9928. * default.
  9929. */
  9930. MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
  9931. this.defaultFocusState_ = focusState;
  9932. };
  9933. /**
  9934. * Selects the list item at `index` within the menu.
  9935. * @param index Index of list item within the menu.
  9936. */
  9937. MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
  9938. this.validatedIndex_(index);
  9939. if (!this.adapter_.isSelectableItemAtIndex(index)) {
  9940. throw new Error('MDCMenuFoundation: No selection group at specified index.');
  9941. }
  9942. var prevSelectedIndex = this.adapter_.getSelectedSiblingOfItemAtIndex(index);
  9943. if (prevSelectedIndex >= 0) {
  9944. this.adapter_.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_1.strings.ARIA_CHECKED_ATTR);
  9945. this.adapter_.removeClassFromElementAtIndex(prevSelectedIndex, constants_1.cssClasses.MENU_SELECTED_LIST_ITEM);
  9946. }
  9947. this.adapter_.addClassToElementAtIndex(index, constants_1.cssClasses.MENU_SELECTED_LIST_ITEM);
  9948. this.adapter_.addAttributeToElementAtIndex(index, constants_1.strings.ARIA_CHECKED_ATTR, 'true');
  9949. };
  9950. MDCMenuFoundation.prototype.validatedIndex_ = function (index) {
  9951. var menuSize = this.adapter_.getMenuItemCount();
  9952. var isIndexInRange = index >= 0 && index < menuSize;
  9953. if (!isIndexInRange) {
  9954. throw new Error('MDCMenuFoundation: No list item at specified index.');
  9955. }
  9956. };
  9957. return MDCMenuFoundation;
  9958. }(foundation_1.MDCFoundation);
  9959. exports.MDCMenuFoundation = MDCMenuFoundation;
  9960. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  9961. exports.default = MDCMenuFoundation;
  9962. /***/ }),
  9963. /***/ "./packages/mdc-menu/index.ts":
  9964. /*!************************************!*\
  9965. !*** ./packages/mdc-menu/index.ts ***!
  9966. \************************************/
  9967. /*! no static exports found */
  9968. /***/ (function(module, exports, __webpack_require__) {
  9969. "use strict";
  9970. /**
  9971. * @license
  9972. * Copyright 2019 Google Inc.
  9973. *
  9974. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9975. * of this software and associated documentation files (the "Software"), to deal
  9976. * in the Software without restriction, including without limitation the rights
  9977. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9978. * copies of the Software, and to permit persons to whom the Software is
  9979. * furnished to do so, subject to the following conditions:
  9980. *
  9981. * The above copyright notice and this permission notice shall be included in
  9982. * all copies or substantial portions of the Software.
  9983. *
  9984. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9985. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9986. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9987. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9988. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9989. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9990. * THE SOFTWARE.
  9991. */
  9992. function __export(m) {
  9993. for (var p in m) {
  9994. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  9995. }
  9996. }
  9997. Object.defineProperty(exports, "__esModule", { value: true });
  9998. var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); // for backward compatibility
  9999. exports.Corner = constants_1.Corner;
  10000. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu/component.ts"));
  10001. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"));
  10002. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"));
  10003. /***/ }),
  10004. /***/ "./packages/mdc-notched-outline/component.ts":
  10005. /*!***************************************************!*\
  10006. !*** ./packages/mdc-notched-outline/component.ts ***!
  10007. \***************************************************/
  10008. /*! no static exports found */
  10009. /***/ (function(module, exports, __webpack_require__) {
  10010. "use strict";
  10011. /**
  10012. * @license
  10013. * Copyright 2017 Google Inc.
  10014. *
  10015. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10016. * of this software and associated documentation files (the "Software"), to deal
  10017. * in the Software without restriction, including without limitation the rights
  10018. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10019. * copies of the Software, and to permit persons to whom the Software is
  10020. * furnished to do so, subject to the following conditions:
  10021. *
  10022. * The above copyright notice and this permission notice shall be included in
  10023. * all copies or substantial portions of the Software.
  10024. *
  10025. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10026. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10027. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10028. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10029. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10030. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10031. * THE SOFTWARE.
  10032. */
  10033. var __extends = this && this.__extends || function () {
  10034. var _extendStatics = function extendStatics(d, b) {
  10035. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10036. d.__proto__ = b;
  10037. } || function (d, b) {
  10038. for (var p in b) {
  10039. if (b.hasOwnProperty(p)) d[p] = b[p];
  10040. }
  10041. };
  10042. return _extendStatics(d, b);
  10043. };
  10044. return function (d, b) {
  10045. _extendStatics(d, b);
  10046. function __() {
  10047. this.constructor = d;
  10048. }
  10049. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10050. };
  10051. }();
  10052. Object.defineProperty(exports, "__esModule", { value: true });
  10053. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10054. var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts");
  10055. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  10056. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts");
  10057. var MDCNotchedOutline = /** @class */function (_super) {
  10058. __extends(MDCNotchedOutline, _super);
  10059. function MDCNotchedOutline() {
  10060. return _super !== null && _super.apply(this, arguments) || this;
  10061. }
  10062. MDCNotchedOutline.attachTo = function (root) {
  10063. return new MDCNotchedOutline(root);
  10064. };
  10065. MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
  10066. this.notchElement_ = this.root_.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
  10067. var label = this.root_.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
  10068. if (label) {
  10069. label.style.transitionDuration = '0s';
  10070. this.root_.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
  10071. requestAnimationFrame(function () {
  10072. label.style.transitionDuration = '';
  10073. });
  10074. } else {
  10075. this.root_.classList.add(constants_1.cssClasses.NO_LABEL);
  10076. }
  10077. };
  10078. /**
  10079. * Updates classes and styles to open the notch to the specified width.
  10080. * @param notchWidth The notch width in the outline.
  10081. */
  10082. MDCNotchedOutline.prototype.notch = function (notchWidth) {
  10083. this.foundation_.notch(notchWidth);
  10084. };
  10085. /**
  10086. * Updates classes and styles to close the notch.
  10087. */
  10088. MDCNotchedOutline.prototype.closeNotch = function () {
  10089. this.foundation_.closeNotch();
  10090. };
  10091. MDCNotchedOutline.prototype.getDefaultFoundation = function () {
  10092. var _this = this;
  10093. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10094. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10095. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10096. var adapter = {
  10097. addClass: function addClass(className) {
  10098. return _this.root_.classList.add(className);
  10099. },
  10100. removeClass: function removeClass(className) {
  10101. return _this.root_.classList.remove(className);
  10102. },
  10103. setNotchWidthProperty: function setNotchWidthProperty(width) {
  10104. return _this.notchElement_.style.setProperty('width', width + 'px');
  10105. },
  10106. removeNotchWidthProperty: function removeNotchWidthProperty() {
  10107. return _this.notchElement_.style.removeProperty('width');
  10108. }
  10109. };
  10110. // tslint:enable:object-literal-sort-keys
  10111. return new foundation_2.MDCNotchedOutlineFoundation(adapter);
  10112. };
  10113. return MDCNotchedOutline;
  10114. }(component_1.MDCComponent);
  10115. exports.MDCNotchedOutline = MDCNotchedOutline;
  10116. /***/ }),
  10117. /***/ "./packages/mdc-notched-outline/constants.ts":
  10118. /*!***************************************************!*\
  10119. !*** ./packages/mdc-notched-outline/constants.ts ***!
  10120. \***************************************************/
  10121. /*! no static exports found */
  10122. /***/ (function(module, exports, __webpack_require__) {
  10123. "use strict";
  10124. /**
  10125. * @license
  10126. * Copyright 2018 Google Inc.
  10127. *
  10128. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10129. * of this software and associated documentation files (the "Software"), to deal
  10130. * in the Software without restriction, including without limitation the rights
  10131. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10132. * copies of the Software, and to permit persons to whom the Software is
  10133. * furnished to do so, subject to the following conditions:
  10134. *
  10135. * The above copyright notice and this permission notice shall be included in
  10136. * all copies or substantial portions of the Software.
  10137. *
  10138. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10139. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10140. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10141. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10142. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10143. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10144. * THE SOFTWARE.
  10145. */
  10146. Object.defineProperty(exports, "__esModule", { value: true });
  10147. var strings = {
  10148. NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
  10149. };
  10150. exports.strings = strings;
  10151. var numbers = {
  10152. // This should stay in sync with $mdc-notched-outline-padding * 2.
  10153. NOTCH_ELEMENT_PADDING: 8
  10154. };
  10155. exports.numbers = numbers;
  10156. var cssClasses = {
  10157. NO_LABEL: 'mdc-notched-outline--no-label',
  10158. OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
  10159. OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
  10160. };
  10161. exports.cssClasses = cssClasses;
  10162. /***/ }),
  10163. /***/ "./packages/mdc-notched-outline/foundation.ts":
  10164. /*!****************************************************!*\
  10165. !*** ./packages/mdc-notched-outline/foundation.ts ***!
  10166. \****************************************************/
  10167. /*! no static exports found */
  10168. /***/ (function(module, exports, __webpack_require__) {
  10169. "use strict";
  10170. /**
  10171. * @license
  10172. * Copyright 2017 Google Inc.
  10173. *
  10174. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10175. * of this software and associated documentation files (the "Software"), to deal
  10176. * in the Software without restriction, including without limitation the rights
  10177. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10178. * copies of the Software, and to permit persons to whom the Software is
  10179. * furnished to do so, subject to the following conditions:
  10180. *
  10181. * The above copyright notice and this permission notice shall be included in
  10182. * all copies or substantial portions of the Software.
  10183. *
  10184. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10185. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10186. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10187. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10188. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10189. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10190. * THE SOFTWARE.
  10191. */
  10192. var __extends = this && this.__extends || function () {
  10193. var _extendStatics = function extendStatics(d, b) {
  10194. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10195. d.__proto__ = b;
  10196. } || function (d, b) {
  10197. for (var p in b) {
  10198. if (b.hasOwnProperty(p)) d[p] = b[p];
  10199. }
  10200. };
  10201. return _extendStatics(d, b);
  10202. };
  10203. return function (d, b) {
  10204. _extendStatics(d, b);
  10205. function __() {
  10206. this.constructor = d;
  10207. }
  10208. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10209. };
  10210. }();
  10211. var __assign = this && this.__assign || function () {
  10212. __assign = Object.assign || function (t) {
  10213. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10214. s = arguments[i];
  10215. for (var p in s) {
  10216. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10217. }
  10218. }
  10219. return t;
  10220. };
  10221. return __assign.apply(this, arguments);
  10222. };
  10223. Object.defineProperty(exports, "__esModule", { value: true });
  10224. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10225. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  10226. var MDCNotchedOutlineFoundation = /** @class */function (_super) {
  10227. __extends(MDCNotchedOutlineFoundation, _super);
  10228. function MDCNotchedOutlineFoundation(adapter) {
  10229. return _super.call(this, __assign({}, MDCNotchedOutlineFoundation.defaultAdapter, adapter)) || this;
  10230. }
  10231. Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
  10232. get: function get() {
  10233. return constants_1.strings;
  10234. },
  10235. enumerable: true,
  10236. configurable: true
  10237. });
  10238. Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
  10239. get: function get() {
  10240. return constants_1.cssClasses;
  10241. },
  10242. enumerable: true,
  10243. configurable: true
  10244. });
  10245. Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
  10246. get: function get() {
  10247. return constants_1.numbers;
  10248. },
  10249. enumerable: true,
  10250. configurable: true
  10251. });
  10252. Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
  10253. /**
  10254. * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
  10255. */
  10256. get: function get() {
  10257. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10258. return {
  10259. addClass: function addClass() {
  10260. return undefined;
  10261. },
  10262. removeClass: function removeClass() {
  10263. return undefined;
  10264. },
  10265. setNotchWidthProperty: function setNotchWidthProperty() {
  10266. return undefined;
  10267. },
  10268. removeNotchWidthProperty: function removeNotchWidthProperty() {
  10269. return undefined;
  10270. }
  10271. };
  10272. // tslint:enable:object-literal-sort-keys
  10273. },
  10274. enumerable: true,
  10275. configurable: true
  10276. });
  10277. /**
  10278. * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
  10279. */
  10280. MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
  10281. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  10282. if (notchWidth > 0) {
  10283. notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
  10284. }
  10285. this.adapter_.setNotchWidthProperty(notchWidth);
  10286. this.adapter_.addClass(OUTLINE_NOTCHED);
  10287. };
  10288. /**
  10289. * Removes notched outline selector to close the notch in the outline.
  10290. */
  10291. MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
  10292. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  10293. this.adapter_.removeClass(OUTLINE_NOTCHED);
  10294. this.adapter_.removeNotchWidthProperty();
  10295. };
  10296. return MDCNotchedOutlineFoundation;
  10297. }(foundation_1.MDCFoundation);
  10298. exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
  10299. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10300. exports.default = MDCNotchedOutlineFoundation;
  10301. /***/ }),
  10302. /***/ "./packages/mdc-notched-outline/index.ts":
  10303. /*!***********************************************!*\
  10304. !*** ./packages/mdc-notched-outline/index.ts ***!
  10305. \***********************************************/
  10306. /*! no static exports found */
  10307. /***/ (function(module, exports, __webpack_require__) {
  10308. "use strict";
  10309. /**
  10310. * @license
  10311. * Copyright 2019 Google Inc.
  10312. *
  10313. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10314. * of this software and associated documentation files (the "Software"), to deal
  10315. * in the Software without restriction, including without limitation the rights
  10316. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10317. * copies of the Software, and to permit persons to whom the Software is
  10318. * furnished to do so, subject to the following conditions:
  10319. *
  10320. * The above copyright notice and this permission notice shall be included in
  10321. * all copies or substantial portions of the Software.
  10322. *
  10323. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10324. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10325. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10326. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10327. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10328. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10329. * THE SOFTWARE.
  10330. */
  10331. function __export(m) {
  10332. for (var p in m) {
  10333. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10334. }
  10335. }
  10336. Object.defineProperty(exports, "__esModule", { value: true });
  10337. __export(__webpack_require__(/*! ./component */ "./packages/mdc-notched-outline/component.ts"));
  10338. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"));
  10339. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"));
  10340. /***/ }),
  10341. /***/ "./packages/mdc-radio/component.ts":
  10342. /*!*****************************************!*\
  10343. !*** ./packages/mdc-radio/component.ts ***!
  10344. \*****************************************/
  10345. /*! no static exports found */
  10346. /***/ (function(module, exports, __webpack_require__) {
  10347. "use strict";
  10348. /**
  10349. * @license
  10350. * Copyright 2016 Google Inc.
  10351. *
  10352. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10353. * of this software and associated documentation files (the "Software"), to deal
  10354. * in the Software without restriction, including without limitation the rights
  10355. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10356. * copies of the Software, and to permit persons to whom the Software is
  10357. * furnished to do so, subject to the following conditions:
  10358. *
  10359. * The above copyright notice and this permission notice shall be included in
  10360. * all copies or substantial portions of the Software.
  10361. *
  10362. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10363. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10364. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10365. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10366. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10367. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10368. * THE SOFTWARE.
  10369. */
  10370. var __extends = this && this.__extends || function () {
  10371. var _extendStatics = function extendStatics(d, b) {
  10372. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10373. d.__proto__ = b;
  10374. } || function (d, b) {
  10375. for (var p in b) {
  10376. if (b.hasOwnProperty(p)) d[p] = b[p];
  10377. }
  10378. };
  10379. return _extendStatics(d, b);
  10380. };
  10381. return function (d, b) {
  10382. _extendStatics(d, b);
  10383. function __() {
  10384. this.constructor = d;
  10385. }
  10386. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10387. };
  10388. }();
  10389. var __assign = this && this.__assign || function () {
  10390. __assign = Object.assign || function (t) {
  10391. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10392. s = arguments[i];
  10393. for (var p in s) {
  10394. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10395. }
  10396. }
  10397. return t;
  10398. };
  10399. return __assign.apply(this, arguments);
  10400. };
  10401. Object.defineProperty(exports, "__esModule", { value: true });
  10402. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10403. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  10404. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  10405. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  10406. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts");
  10407. var MDCRadio = /** @class */function (_super) {
  10408. __extends(MDCRadio, _super);
  10409. function MDCRadio() {
  10410. var _this = _super !== null && _super.apply(this, arguments) || this;
  10411. _this.ripple_ = _this.createRipple_();
  10412. return _this;
  10413. }
  10414. MDCRadio.attachTo = function (root) {
  10415. return new MDCRadio(root);
  10416. };
  10417. Object.defineProperty(MDCRadio.prototype, "checked", {
  10418. get: function get() {
  10419. return this.nativeControl_.checked;
  10420. },
  10421. set: function set(checked) {
  10422. this.nativeControl_.checked = checked;
  10423. },
  10424. enumerable: true,
  10425. configurable: true
  10426. });
  10427. Object.defineProperty(MDCRadio.prototype, "disabled", {
  10428. get: function get() {
  10429. return this.nativeControl_.disabled;
  10430. },
  10431. set: function set(disabled) {
  10432. this.foundation_.setDisabled(disabled);
  10433. },
  10434. enumerable: true,
  10435. configurable: true
  10436. });
  10437. Object.defineProperty(MDCRadio.prototype, "value", {
  10438. get: function get() {
  10439. return this.nativeControl_.value;
  10440. },
  10441. set: function set(value) {
  10442. this.nativeControl_.value = value;
  10443. },
  10444. enumerable: true,
  10445. configurable: true
  10446. });
  10447. Object.defineProperty(MDCRadio.prototype, "ripple", {
  10448. get: function get() {
  10449. return this.ripple_;
  10450. },
  10451. enumerable: true,
  10452. configurable: true
  10453. });
  10454. MDCRadio.prototype.destroy = function () {
  10455. this.ripple_.destroy();
  10456. _super.prototype.destroy.call(this);
  10457. };
  10458. MDCRadio.prototype.getDefaultFoundation = function () {
  10459. var _this = this;
  10460. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10461. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10462. var adapter = {
  10463. addClass: function addClass(className) {
  10464. return _this.root_.classList.add(className);
  10465. },
  10466. removeClass: function removeClass(className) {
  10467. return _this.root_.classList.remove(className);
  10468. },
  10469. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  10470. return _this.nativeControl_.disabled = disabled;
  10471. }
  10472. };
  10473. return new foundation_2.MDCRadioFoundation(adapter);
  10474. };
  10475. MDCRadio.prototype.createRipple_ = function () {
  10476. var _this = this;
  10477. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10478. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10479. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10480. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  10481. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  10482. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  10483. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  10484. },
  10485. // Radio buttons technically go "active" whenever there is *any* keyboard interaction.
  10486. // This is not the UI we desire.
  10487. isSurfaceActive: function isSurfaceActive() {
  10488. return false;
  10489. }, isUnbounded: function isUnbounded() {
  10490. return true;
  10491. } });
  10492. // tslint:enable:object-literal-sort-keys
  10493. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  10494. };
  10495. Object.defineProperty(MDCRadio.prototype, "nativeControl_", {
  10496. get: function get() {
  10497. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR;
  10498. var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  10499. if (!el) {
  10500. throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  10501. }
  10502. return el;
  10503. },
  10504. enumerable: true,
  10505. configurable: true
  10506. });
  10507. return MDCRadio;
  10508. }(component_1.MDCComponent);
  10509. exports.MDCRadio = MDCRadio;
  10510. /***/ }),
  10511. /***/ "./packages/mdc-radio/constants.ts":
  10512. /*!*****************************************!*\
  10513. !*** ./packages/mdc-radio/constants.ts ***!
  10514. \*****************************************/
  10515. /*! no static exports found */
  10516. /***/ (function(module, exports, __webpack_require__) {
  10517. "use strict";
  10518. /**
  10519. * @license
  10520. * Copyright 2016 Google Inc.
  10521. *
  10522. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10523. * of this software and associated documentation files (the "Software"), to deal
  10524. * in the Software without restriction, including without limitation the rights
  10525. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10526. * copies of the Software, and to permit persons to whom the Software is
  10527. * furnished to do so, subject to the following conditions:
  10528. *
  10529. * The above copyright notice and this permission notice shall be included in
  10530. * all copies or substantial portions of the Software.
  10531. *
  10532. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10533. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10534. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10535. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10536. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10537. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10538. * THE SOFTWARE.
  10539. */
  10540. Object.defineProperty(exports, "__esModule", { value: true });
  10541. var strings = {
  10542. NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control'
  10543. };
  10544. exports.strings = strings;
  10545. var cssClasses = {
  10546. DISABLED: 'mdc-radio--disabled',
  10547. ROOT: 'mdc-radio'
  10548. };
  10549. exports.cssClasses = cssClasses;
  10550. /***/ }),
  10551. /***/ "./packages/mdc-radio/foundation.ts":
  10552. /*!******************************************!*\
  10553. !*** ./packages/mdc-radio/foundation.ts ***!
  10554. \******************************************/
  10555. /*! no static exports found */
  10556. /***/ (function(module, exports, __webpack_require__) {
  10557. "use strict";
  10558. /**
  10559. * @license
  10560. * Copyright 2016 Google Inc.
  10561. *
  10562. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10563. * of this software and associated documentation files (the "Software"), to deal
  10564. * in the Software without restriction, including without limitation the rights
  10565. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10566. * copies of the Software, and to permit persons to whom the Software is
  10567. * furnished to do so, subject to the following conditions:
  10568. *
  10569. * The above copyright notice and this permission notice shall be included in
  10570. * all copies or substantial portions of the Software.
  10571. *
  10572. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10573. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10574. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10575. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10576. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10577. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10578. * THE SOFTWARE.
  10579. */
  10580. var __extends = this && this.__extends || function () {
  10581. var _extendStatics = function extendStatics(d, b) {
  10582. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10583. d.__proto__ = b;
  10584. } || function (d, b) {
  10585. for (var p in b) {
  10586. if (b.hasOwnProperty(p)) d[p] = b[p];
  10587. }
  10588. };
  10589. return _extendStatics(d, b);
  10590. };
  10591. return function (d, b) {
  10592. _extendStatics(d, b);
  10593. function __() {
  10594. this.constructor = d;
  10595. }
  10596. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10597. };
  10598. }();
  10599. var __assign = this && this.__assign || function () {
  10600. __assign = Object.assign || function (t) {
  10601. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10602. s = arguments[i];
  10603. for (var p in s) {
  10604. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10605. }
  10606. }
  10607. return t;
  10608. };
  10609. return __assign.apply(this, arguments);
  10610. };
  10611. Object.defineProperty(exports, "__esModule", { value: true });
  10612. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10613. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts");
  10614. var MDCRadioFoundation = /** @class */function (_super) {
  10615. __extends(MDCRadioFoundation, _super);
  10616. function MDCRadioFoundation(adapter) {
  10617. return _super.call(this, __assign({}, MDCRadioFoundation.defaultAdapter, adapter)) || this;
  10618. }
  10619. Object.defineProperty(MDCRadioFoundation, "cssClasses", {
  10620. get: function get() {
  10621. return constants_1.cssClasses;
  10622. },
  10623. enumerable: true,
  10624. configurable: true
  10625. });
  10626. Object.defineProperty(MDCRadioFoundation, "strings", {
  10627. get: function get() {
  10628. return constants_1.strings;
  10629. },
  10630. enumerable: true,
  10631. configurable: true
  10632. });
  10633. Object.defineProperty(MDCRadioFoundation, "defaultAdapter", {
  10634. get: function get() {
  10635. return {
  10636. addClass: function addClass() {
  10637. return undefined;
  10638. },
  10639. removeClass: function removeClass() {
  10640. return undefined;
  10641. },
  10642. setNativeControlDisabled: function setNativeControlDisabled() {
  10643. return undefined;
  10644. }
  10645. };
  10646. },
  10647. enumerable: true,
  10648. configurable: true
  10649. });
  10650. MDCRadioFoundation.prototype.setDisabled = function (disabled) {
  10651. var DISABLED = MDCRadioFoundation.cssClasses.DISABLED;
  10652. this.adapter_.setNativeControlDisabled(disabled);
  10653. if (disabled) {
  10654. this.adapter_.addClass(DISABLED);
  10655. } else {
  10656. this.adapter_.removeClass(DISABLED);
  10657. }
  10658. };
  10659. return MDCRadioFoundation;
  10660. }(foundation_1.MDCFoundation);
  10661. exports.MDCRadioFoundation = MDCRadioFoundation;
  10662. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10663. exports.default = MDCRadioFoundation;
  10664. /***/ }),
  10665. /***/ "./packages/mdc-radio/index.ts":
  10666. /*!*************************************!*\
  10667. !*** ./packages/mdc-radio/index.ts ***!
  10668. \*************************************/
  10669. /*! no static exports found */
  10670. /***/ (function(module, exports, __webpack_require__) {
  10671. "use strict";
  10672. /**
  10673. * @license
  10674. * Copyright 2019 Google Inc.
  10675. *
  10676. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10677. * of this software and associated documentation files (the "Software"), to deal
  10678. * in the Software without restriction, including without limitation the rights
  10679. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10680. * copies of the Software, and to permit persons to whom the Software is
  10681. * furnished to do so, subject to the following conditions:
  10682. *
  10683. * The above copyright notice and this permission notice shall be included in
  10684. * all copies or substantial portions of the Software.
  10685. *
  10686. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10687. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10688. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10689. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10690. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10691. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10692. * THE SOFTWARE.
  10693. */
  10694. function __export(m) {
  10695. for (var p in m) {
  10696. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10697. }
  10698. }
  10699. Object.defineProperty(exports, "__esModule", { value: true });
  10700. __export(__webpack_require__(/*! ./component */ "./packages/mdc-radio/component.ts"));
  10701. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"));
  10702. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"));
  10703. /***/ }),
  10704. /***/ "./packages/mdc-ripple/component.ts":
  10705. /*!******************************************!*\
  10706. !*** ./packages/mdc-ripple/component.ts ***!
  10707. \******************************************/
  10708. /*! no static exports found */
  10709. /***/ (function(module, exports, __webpack_require__) {
  10710. "use strict";
  10711. /**
  10712. * @license
  10713. * Copyright 2016 Google Inc.
  10714. *
  10715. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10716. * of this software and associated documentation files (the "Software"), to deal
  10717. * in the Software without restriction, including without limitation the rights
  10718. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10719. * copies of the Software, and to permit persons to whom the Software is
  10720. * furnished to do so, subject to the following conditions:
  10721. *
  10722. * The above copyright notice and this permission notice shall be included in
  10723. * all copies or substantial portions of the Software.
  10724. *
  10725. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10726. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10727. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10728. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10729. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10730. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10731. * THE SOFTWARE.
  10732. */
  10733. var __extends = this && this.__extends || function () {
  10734. var _extendStatics = function extendStatics(d, b) {
  10735. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10736. d.__proto__ = b;
  10737. } || function (d, b) {
  10738. for (var p in b) {
  10739. if (b.hasOwnProperty(p)) d[p] = b[p];
  10740. }
  10741. };
  10742. return _extendStatics(d, b);
  10743. };
  10744. return function (d, b) {
  10745. _extendStatics(d, b);
  10746. function __() {
  10747. this.constructor = d;
  10748. }
  10749. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10750. };
  10751. }();
  10752. var __importStar = this && this.__importStar || function (mod) {
  10753. if (mod && mod.__esModule) return mod;
  10754. var result = {};
  10755. if (mod != null) for (var k in mod) {
  10756. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  10757. }result["default"] = mod;
  10758. return result;
  10759. };
  10760. Object.defineProperty(exports, "__esModule", { value: true });
  10761. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10762. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  10763. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  10764. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  10765. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  10766. var MDCRipple = /** @class */function (_super) {
  10767. __extends(MDCRipple, _super);
  10768. function MDCRipple() {
  10769. var _this = _super !== null && _super.apply(this, arguments) || this;
  10770. _this.disabled = false;
  10771. return _this;
  10772. }
  10773. MDCRipple.attachTo = function (root, opts) {
  10774. if (opts === void 0) {
  10775. opts = { isUnbounded: undefined };
  10776. }
  10777. var ripple = new MDCRipple(root);
  10778. // Only override unbounded behavior if option is explicitly specified
  10779. if (opts.isUnbounded !== undefined) {
  10780. ripple.unbounded = opts.isUnbounded;
  10781. }
  10782. return ripple;
  10783. };
  10784. MDCRipple.createAdapter = function (instance) {
  10785. return {
  10786. addClass: function addClass(className) {
  10787. return instance.root_.classList.add(className);
  10788. },
  10789. browserSupportsCssVars: function browserSupportsCssVars() {
  10790. return util.supportsCssVariables(window);
  10791. },
  10792. computeBoundingRect: function computeBoundingRect() {
  10793. return instance.root_.getBoundingClientRect();
  10794. },
  10795. containsEventTarget: function containsEventTarget(target) {
  10796. return instance.root_.contains(target);
  10797. },
  10798. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  10799. return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  10800. },
  10801. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  10802. return instance.root_.removeEventListener(evtType, handler, events_1.applyPassive());
  10803. },
  10804. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  10805. return window.removeEventListener('resize', handler);
  10806. },
  10807. getWindowPageOffset: function getWindowPageOffset() {
  10808. return { x: window.pageXOffset, y: window.pageYOffset };
  10809. },
  10810. isSurfaceActive: function isSurfaceActive() {
  10811. return ponyfill_1.matches(instance.root_, ':active');
  10812. },
  10813. isSurfaceDisabled: function isSurfaceDisabled() {
  10814. return Boolean(instance.disabled);
  10815. },
  10816. isUnbounded: function isUnbounded() {
  10817. return Boolean(instance.unbounded);
  10818. },
  10819. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  10820. return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  10821. },
  10822. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  10823. return instance.root_.addEventListener(evtType, handler, events_1.applyPassive());
  10824. },
  10825. registerResizeHandler: function registerResizeHandler(handler) {
  10826. return window.addEventListener('resize', handler);
  10827. },
  10828. removeClass: function removeClass(className) {
  10829. return instance.root_.classList.remove(className);
  10830. },
  10831. updateCssVariable: function updateCssVariable(varName, value) {
  10832. return instance.root_.style.setProperty(varName, value);
  10833. }
  10834. };
  10835. };
  10836. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  10837. get: function get() {
  10838. return Boolean(this.unbounded_);
  10839. },
  10840. set: function set(unbounded) {
  10841. this.unbounded_ = Boolean(unbounded);
  10842. this.setUnbounded_();
  10843. },
  10844. enumerable: true,
  10845. configurable: true
  10846. });
  10847. MDCRipple.prototype.activate = function () {
  10848. this.foundation_.activate();
  10849. };
  10850. MDCRipple.prototype.deactivate = function () {
  10851. this.foundation_.deactivate();
  10852. };
  10853. MDCRipple.prototype.layout = function () {
  10854. this.foundation_.layout();
  10855. };
  10856. MDCRipple.prototype.getDefaultFoundation = function () {
  10857. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  10858. };
  10859. MDCRipple.prototype.initialSyncWithDOM = function () {
  10860. var root = this.root_;
  10861. this.unbounded = 'mdcRippleIsUnbounded' in root.dataset;
  10862. };
  10863. /**
  10864. * Closure Compiler throws an access control error when directly accessing a
  10865. * protected or private property inside a getter/setter, like unbounded above.
  10866. * By accessing the protected property inside a method, we solve that problem.
  10867. * That's why this function exists.
  10868. */
  10869. MDCRipple.prototype.setUnbounded_ = function () {
  10870. this.foundation_.setUnbounded(Boolean(this.unbounded_));
  10871. };
  10872. return MDCRipple;
  10873. }(component_1.MDCComponent);
  10874. exports.MDCRipple = MDCRipple;
  10875. /***/ }),
  10876. /***/ "./packages/mdc-ripple/constants.ts":
  10877. /*!******************************************!*\
  10878. !*** ./packages/mdc-ripple/constants.ts ***!
  10879. \******************************************/
  10880. /*! no static exports found */
  10881. /***/ (function(module, exports, __webpack_require__) {
  10882. "use strict";
  10883. /**
  10884. * @license
  10885. * Copyright 2016 Google Inc.
  10886. *
  10887. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10888. * of this software and associated documentation files (the "Software"), to deal
  10889. * in the Software without restriction, including without limitation the rights
  10890. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10891. * copies of the Software, and to permit persons to whom the Software is
  10892. * furnished to do so, subject to the following conditions:
  10893. *
  10894. * The above copyright notice and this permission notice shall be included in
  10895. * all copies or substantial portions of the Software.
  10896. *
  10897. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10898. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10899. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10900. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10901. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10902. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10903. * THE SOFTWARE.
  10904. */
  10905. Object.defineProperty(exports, "__esModule", { value: true });
  10906. exports.cssClasses = {
  10907. // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  10908. // given that it's an 'upgrade' to an existing component. That being said it is the root
  10909. // CSS class that all other CSS classes derive from.
  10910. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  10911. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  10912. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  10913. ROOT: 'mdc-ripple-upgraded',
  10914. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  10915. };
  10916. exports.strings = {
  10917. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  10918. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  10919. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  10920. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  10921. VAR_LEFT: '--mdc-ripple-left',
  10922. VAR_TOP: '--mdc-ripple-top'
  10923. };
  10924. exports.numbers = {
  10925. DEACTIVATION_TIMEOUT_MS: 225,
  10926. FG_DEACTIVATION_MS: 150,
  10927. INITIAL_ORIGIN_SCALE: 0.6,
  10928. PADDING: 10,
  10929. TAP_DELAY_MS: 300
  10930. };
  10931. /***/ }),
  10932. /***/ "./packages/mdc-ripple/foundation.ts":
  10933. /*!*******************************************!*\
  10934. !*** ./packages/mdc-ripple/foundation.ts ***!
  10935. \*******************************************/
  10936. /*! no static exports found */
  10937. /***/ (function(module, exports, __webpack_require__) {
  10938. "use strict";
  10939. /**
  10940. * @license
  10941. * Copyright 2016 Google Inc.
  10942. *
  10943. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10944. * of this software and associated documentation files (the "Software"), to deal
  10945. * in the Software without restriction, including without limitation the rights
  10946. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10947. * copies of the Software, and to permit persons to whom the Software is
  10948. * furnished to do so, subject to the following conditions:
  10949. *
  10950. * The above copyright notice and this permission notice shall be included in
  10951. * all copies or substantial portions of the Software.
  10952. *
  10953. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10954. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10955. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10956. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10957. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10958. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10959. * THE SOFTWARE.
  10960. */
  10961. var __extends = this && this.__extends || function () {
  10962. var _extendStatics = function extendStatics(d, b) {
  10963. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10964. d.__proto__ = b;
  10965. } || function (d, b) {
  10966. for (var p in b) {
  10967. if (b.hasOwnProperty(p)) d[p] = b[p];
  10968. }
  10969. };
  10970. return _extendStatics(d, b);
  10971. };
  10972. return function (d, b) {
  10973. _extendStatics(d, b);
  10974. function __() {
  10975. this.constructor = d;
  10976. }
  10977. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10978. };
  10979. }();
  10980. var __assign = this && this.__assign || function () {
  10981. __assign = Object.assign || function (t) {
  10982. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10983. s = arguments[i];
  10984. for (var p in s) {
  10985. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10986. }
  10987. }
  10988. return t;
  10989. };
  10990. return __assign.apply(this, arguments);
  10991. };
  10992. Object.defineProperty(exports, "__esModule", { value: true });
  10993. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10994. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  10995. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  10996. // Activation events registered on the root element of each instance for activation
  10997. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  10998. // Deactivation events registered on documentElement when a pointer-related down event occurs
  10999. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  11000. // simultaneous nested activations
  11001. var activatedTargets = [];
  11002. var MDCRippleFoundation = /** @class */function (_super) {
  11003. __extends(MDCRippleFoundation, _super);
  11004. function MDCRippleFoundation(adapter) {
  11005. var _this = _super.call(this, __assign({}, MDCRippleFoundation.defaultAdapter, adapter)) || this;
  11006. _this.activationAnimationHasEnded_ = false;
  11007. _this.activationTimer_ = 0;
  11008. _this.fgDeactivationRemovalTimer_ = 0;
  11009. _this.fgScale_ = '0';
  11010. _this.frame_ = { width: 0, height: 0 };
  11011. _this.initialSize_ = 0;
  11012. _this.layoutFrame_ = 0;
  11013. _this.maxRadius_ = 0;
  11014. _this.unboundedCoords_ = { left: 0, top: 0 };
  11015. _this.activationState_ = _this.defaultActivationState_();
  11016. _this.activationTimerCallback_ = function () {
  11017. _this.activationAnimationHasEnded_ = true;
  11018. _this.runDeactivationUXLogicIfReady_();
  11019. };
  11020. _this.activateHandler_ = function (e) {
  11021. return _this.activate_(e);
  11022. };
  11023. _this.deactivateHandler_ = function () {
  11024. return _this.deactivate_();
  11025. };
  11026. _this.focusHandler_ = function () {
  11027. return _this.handleFocus();
  11028. };
  11029. _this.blurHandler_ = function () {
  11030. return _this.handleBlur();
  11031. };
  11032. _this.resizeHandler_ = function () {
  11033. return _this.layout();
  11034. };
  11035. return _this;
  11036. }
  11037. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  11038. get: function get() {
  11039. return constants_1.cssClasses;
  11040. },
  11041. enumerable: true,
  11042. configurable: true
  11043. });
  11044. Object.defineProperty(MDCRippleFoundation, "strings", {
  11045. get: function get() {
  11046. return constants_1.strings;
  11047. },
  11048. enumerable: true,
  11049. configurable: true
  11050. });
  11051. Object.defineProperty(MDCRippleFoundation, "numbers", {
  11052. get: function get() {
  11053. return constants_1.numbers;
  11054. },
  11055. enumerable: true,
  11056. configurable: true
  11057. });
  11058. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  11059. get: function get() {
  11060. return {
  11061. addClass: function addClass() {
  11062. return undefined;
  11063. },
  11064. browserSupportsCssVars: function browserSupportsCssVars() {
  11065. return true;
  11066. },
  11067. computeBoundingRect: function computeBoundingRect() {
  11068. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  11069. },
  11070. containsEventTarget: function containsEventTarget() {
  11071. return true;
  11072. },
  11073. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  11074. return undefined;
  11075. },
  11076. deregisterInteractionHandler: function deregisterInteractionHandler() {
  11077. return undefined;
  11078. },
  11079. deregisterResizeHandler: function deregisterResizeHandler() {
  11080. return undefined;
  11081. },
  11082. getWindowPageOffset: function getWindowPageOffset() {
  11083. return { x: 0, y: 0 };
  11084. },
  11085. isSurfaceActive: function isSurfaceActive() {
  11086. return true;
  11087. },
  11088. isSurfaceDisabled: function isSurfaceDisabled() {
  11089. return true;
  11090. },
  11091. isUnbounded: function isUnbounded() {
  11092. return true;
  11093. },
  11094. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  11095. return undefined;
  11096. },
  11097. registerInteractionHandler: function registerInteractionHandler() {
  11098. return undefined;
  11099. },
  11100. registerResizeHandler: function registerResizeHandler() {
  11101. return undefined;
  11102. },
  11103. removeClass: function removeClass() {
  11104. return undefined;
  11105. },
  11106. updateCssVariable: function updateCssVariable() {
  11107. return undefined;
  11108. }
  11109. };
  11110. },
  11111. enumerable: true,
  11112. configurable: true
  11113. });
  11114. MDCRippleFoundation.prototype.init = function () {
  11115. var _this = this;
  11116. var supportsPressRipple = this.supportsPressRipple_();
  11117. this.registerRootHandlers_(supportsPressRipple);
  11118. if (supportsPressRipple) {
  11119. var _a = MDCRippleFoundation.cssClasses,
  11120. ROOT_1 = _a.ROOT,
  11121. UNBOUNDED_1 = _a.UNBOUNDED;
  11122. requestAnimationFrame(function () {
  11123. _this.adapter_.addClass(ROOT_1);
  11124. if (_this.adapter_.isUnbounded()) {
  11125. _this.adapter_.addClass(UNBOUNDED_1);
  11126. // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
  11127. _this.layoutInternal_();
  11128. }
  11129. });
  11130. }
  11131. };
  11132. MDCRippleFoundation.prototype.destroy = function () {
  11133. var _this = this;
  11134. if (this.supportsPressRipple_()) {
  11135. if (this.activationTimer_) {
  11136. clearTimeout(this.activationTimer_);
  11137. this.activationTimer_ = 0;
  11138. this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  11139. }
  11140. if (this.fgDeactivationRemovalTimer_) {
  11141. clearTimeout(this.fgDeactivationRemovalTimer_);
  11142. this.fgDeactivationRemovalTimer_ = 0;
  11143. this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  11144. }
  11145. var _a = MDCRippleFoundation.cssClasses,
  11146. ROOT_2 = _a.ROOT,
  11147. UNBOUNDED_2 = _a.UNBOUNDED;
  11148. requestAnimationFrame(function () {
  11149. _this.adapter_.removeClass(ROOT_2);
  11150. _this.adapter_.removeClass(UNBOUNDED_2);
  11151. _this.removeCssVars_();
  11152. });
  11153. }
  11154. this.deregisterRootHandlers_();
  11155. this.deregisterDeactivationHandlers_();
  11156. };
  11157. /**
  11158. * @param evt Optional event containing position information.
  11159. */
  11160. MDCRippleFoundation.prototype.activate = function (evt) {
  11161. this.activate_(evt);
  11162. };
  11163. MDCRippleFoundation.prototype.deactivate = function () {
  11164. this.deactivate_();
  11165. };
  11166. MDCRippleFoundation.prototype.layout = function () {
  11167. var _this = this;
  11168. if (this.layoutFrame_) {
  11169. cancelAnimationFrame(this.layoutFrame_);
  11170. }
  11171. this.layoutFrame_ = requestAnimationFrame(function () {
  11172. _this.layoutInternal_();
  11173. _this.layoutFrame_ = 0;
  11174. });
  11175. };
  11176. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  11177. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  11178. if (unbounded) {
  11179. this.adapter_.addClass(UNBOUNDED);
  11180. } else {
  11181. this.adapter_.removeClass(UNBOUNDED);
  11182. }
  11183. };
  11184. MDCRippleFoundation.prototype.handleFocus = function () {
  11185. var _this = this;
  11186. requestAnimationFrame(function () {
  11187. return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  11188. });
  11189. };
  11190. MDCRippleFoundation.prototype.handleBlur = function () {
  11191. var _this = this;
  11192. requestAnimationFrame(function () {
  11193. return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  11194. });
  11195. };
  11196. /**
  11197. * We compute this property so that we are not querying information about the client
  11198. * until the point in time where the foundation requests it. This prevents scenarios where
  11199. * client-side feature-detection may happen too early, such as when components are rendered on the server
  11200. * and then initialized at mount time on the client.
  11201. */
  11202. MDCRippleFoundation.prototype.supportsPressRipple_ = function () {
  11203. return this.adapter_.browserSupportsCssVars();
  11204. };
  11205. MDCRippleFoundation.prototype.defaultActivationState_ = function () {
  11206. return {
  11207. activationEvent: undefined,
  11208. hasDeactivationUXRun: false,
  11209. isActivated: false,
  11210. isProgrammatic: false,
  11211. wasActivatedByPointer: false,
  11212. wasElementMadeActive: false
  11213. };
  11214. };
  11215. /**
  11216. * supportsPressRipple Passed from init to save a redundant function call
  11217. */
  11218. MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) {
  11219. var _this = this;
  11220. if (supportsPressRipple) {
  11221. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11222. _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_);
  11223. });
  11224. if (this.adapter_.isUnbounded()) {
  11225. this.adapter_.registerResizeHandler(this.resizeHandler_);
  11226. }
  11227. }
  11228. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  11229. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  11230. };
  11231. MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) {
  11232. var _this = this;
  11233. if (evt.type === 'keydown') {
  11234. this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
  11235. } else {
  11236. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11237. _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  11238. });
  11239. }
  11240. };
  11241. MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () {
  11242. var _this = this;
  11243. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11244. _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_);
  11245. });
  11246. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  11247. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  11248. if (this.adapter_.isUnbounded()) {
  11249. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  11250. }
  11251. };
  11252. MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () {
  11253. var _this = this;
  11254. this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
  11255. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11256. _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  11257. });
  11258. };
  11259. MDCRippleFoundation.prototype.removeCssVars_ = function () {
  11260. var _this = this;
  11261. var rippleStrings = MDCRippleFoundation.strings;
  11262. var keys = Object.keys(rippleStrings);
  11263. keys.forEach(function (key) {
  11264. if (key.indexOf('VAR_') === 0) {
  11265. _this.adapter_.updateCssVariable(rippleStrings[key], null);
  11266. }
  11267. });
  11268. };
  11269. MDCRippleFoundation.prototype.activate_ = function (evt) {
  11270. var _this = this;
  11271. if (this.adapter_.isSurfaceDisabled()) {
  11272. return;
  11273. }
  11274. var activationState = this.activationState_;
  11275. if (activationState.isActivated) {
  11276. return;
  11277. }
  11278. // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
  11279. var previousActivationEvent = this.previousActivationEvent_;
  11280. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  11281. if (isSameInteraction) {
  11282. return;
  11283. }
  11284. activationState.isActivated = true;
  11285. activationState.isProgrammatic = evt === undefined;
  11286. activationState.activationEvent = evt;
  11287. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  11288. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  11289. return _this.adapter_.containsEventTarget(target);
  11290. });
  11291. if (hasActivatedChild) {
  11292. // Immediately reset activation state, while preserving logic that prevents touch follow-on events
  11293. this.resetActivationState_();
  11294. return;
  11295. }
  11296. if (evt !== undefined) {
  11297. activatedTargets.push(evt.target);
  11298. this.registerDeactivationHandlers_(evt);
  11299. }
  11300. activationState.wasElementMadeActive = this.checkElementMadeActive_(evt);
  11301. if (activationState.wasElementMadeActive) {
  11302. this.animateActivation_();
  11303. }
  11304. requestAnimationFrame(function () {
  11305. // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
  11306. activatedTargets = [];
  11307. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  11308. // If space was pressed, try again within an rAF call to detect :active, because different UAs report
  11309. // active states inconsistently when they're called within event handling code:
  11310. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  11311. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  11312. // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
  11313. // variable is set within a rAF callback for a submit button interaction (#2241).
  11314. activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt);
  11315. if (activationState.wasElementMadeActive) {
  11316. _this.animateActivation_();
  11317. }
  11318. }
  11319. if (!activationState.wasElementMadeActive) {
  11320. // Reset activation state immediately if element was not made active.
  11321. _this.activationState_ = _this.defaultActivationState_();
  11322. }
  11323. });
  11324. };
  11325. MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) {
  11326. return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true;
  11327. };
  11328. MDCRippleFoundation.prototype.animateActivation_ = function () {
  11329. var _this = this;
  11330. var _a = MDCRippleFoundation.strings,
  11331. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  11332. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  11333. var _b = MDCRippleFoundation.cssClasses,
  11334. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  11335. FG_ACTIVATION = _b.FG_ACTIVATION;
  11336. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  11337. this.layoutInternal_();
  11338. var translateStart = '';
  11339. var translateEnd = '';
  11340. if (!this.adapter_.isUnbounded()) {
  11341. var _c = this.getFgTranslationCoordinates_(),
  11342. startPoint = _c.startPoint,
  11343. endPoint = _c.endPoint;
  11344. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  11345. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  11346. }
  11347. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  11348. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  11349. // Cancel any ongoing activation/deactivation animations
  11350. clearTimeout(this.activationTimer_);
  11351. clearTimeout(this.fgDeactivationRemovalTimer_);
  11352. this.rmBoundedActivationClasses_();
  11353. this.adapter_.removeClass(FG_DEACTIVATION);
  11354. // Force layout in order to re-trigger the animation.
  11355. this.adapter_.computeBoundingRect();
  11356. this.adapter_.addClass(FG_ACTIVATION);
  11357. this.activationTimer_ = setTimeout(function () {
  11358. return _this.activationTimerCallback_();
  11359. }, DEACTIVATION_TIMEOUT_MS);
  11360. };
  11361. MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () {
  11362. var _a = this.activationState_,
  11363. activationEvent = _a.activationEvent,
  11364. wasActivatedByPointer = _a.wasActivatedByPointer;
  11365. var startPoint;
  11366. if (wasActivatedByPointer) {
  11367. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
  11368. } else {
  11369. startPoint = {
  11370. x: this.frame_.width / 2,
  11371. y: this.frame_.height / 2
  11372. };
  11373. }
  11374. // Center the element around the start point.
  11375. startPoint = {
  11376. x: startPoint.x - this.initialSize_ / 2,
  11377. y: startPoint.y - this.initialSize_ / 2
  11378. };
  11379. var endPoint = {
  11380. x: this.frame_.width / 2 - this.initialSize_ / 2,
  11381. y: this.frame_.height / 2 - this.initialSize_ / 2
  11382. };
  11383. return { startPoint: startPoint, endPoint: endPoint };
  11384. };
  11385. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () {
  11386. var _this = this;
  11387. // This method is called both when a pointing device is released, and when the activation animation ends.
  11388. // The deactivation animation should only run after both of those occur.
  11389. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  11390. var _a = this.activationState_,
  11391. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  11392. isActivated = _a.isActivated;
  11393. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  11394. if (activationHasEnded && this.activationAnimationHasEnded_) {
  11395. this.rmBoundedActivationClasses_();
  11396. this.adapter_.addClass(FG_DEACTIVATION);
  11397. this.fgDeactivationRemovalTimer_ = setTimeout(function () {
  11398. _this.adapter_.removeClass(FG_DEACTIVATION);
  11399. }, constants_1.numbers.FG_DEACTIVATION_MS);
  11400. }
  11401. };
  11402. MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () {
  11403. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  11404. this.adapter_.removeClass(FG_ACTIVATION);
  11405. this.activationAnimationHasEnded_ = false;
  11406. this.adapter_.computeBoundingRect();
  11407. };
  11408. MDCRippleFoundation.prototype.resetActivationState_ = function () {
  11409. var _this = this;
  11410. this.previousActivationEvent_ = this.activationState_.activationEvent;
  11411. this.activationState_ = this.defaultActivationState_();
  11412. // Touch devices may fire additional events for the same interaction within a short time.
  11413. // Store the previous event until it's safe to assume that subsequent events are for new interactions.
  11414. setTimeout(function () {
  11415. return _this.previousActivationEvent_ = undefined;
  11416. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  11417. };
  11418. MDCRippleFoundation.prototype.deactivate_ = function () {
  11419. var _this = this;
  11420. var activationState = this.activationState_;
  11421. // This can happen in scenarios such as when you have a keyup event that blurs the element.
  11422. if (!activationState.isActivated) {
  11423. return;
  11424. }
  11425. var state = __assign({}, activationState);
  11426. if (activationState.isProgrammatic) {
  11427. requestAnimationFrame(function () {
  11428. return _this.animateDeactivation_(state);
  11429. });
  11430. this.resetActivationState_();
  11431. } else {
  11432. this.deregisterDeactivationHandlers_();
  11433. requestAnimationFrame(function () {
  11434. _this.activationState_.hasDeactivationUXRun = true;
  11435. _this.animateDeactivation_(state);
  11436. _this.resetActivationState_();
  11437. });
  11438. }
  11439. };
  11440. MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) {
  11441. var wasActivatedByPointer = _a.wasActivatedByPointer,
  11442. wasElementMadeActive = _a.wasElementMadeActive;
  11443. if (wasActivatedByPointer || wasElementMadeActive) {
  11444. this.runDeactivationUXLogicIfReady_();
  11445. }
  11446. };
  11447. MDCRippleFoundation.prototype.layoutInternal_ = function () {
  11448. var _this = this;
  11449. this.frame_ = this.adapter_.computeBoundingRect();
  11450. var maxDim = Math.max(this.frame_.height, this.frame_.width);
  11451. // Surface diameter is treated differently for unbounded vs. bounded ripples.
  11452. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
  11453. // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
  11454. // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
  11455. // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
  11456. // `overflow: hidden`.
  11457. var getBoundedRadius = function getBoundedRadius() {
  11458. var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2));
  11459. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  11460. };
  11461. this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
  11462. // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
  11463. this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  11464. this.fgScale_ = "" + this.maxRadius_ / this.initialSize_;
  11465. this.updateLayoutCssVars_();
  11466. };
  11467. MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () {
  11468. var _a = MDCRippleFoundation.strings,
  11469. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  11470. VAR_LEFT = _a.VAR_LEFT,
  11471. VAR_TOP = _a.VAR_TOP,
  11472. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  11473. this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px");
  11474. this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
  11475. if (this.adapter_.isUnbounded()) {
  11476. this.unboundedCoords_ = {
  11477. left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
  11478. top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
  11479. };
  11480. this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px");
  11481. this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px");
  11482. }
  11483. };
  11484. return MDCRippleFoundation;
  11485. }(foundation_1.MDCFoundation);
  11486. exports.MDCRippleFoundation = MDCRippleFoundation;
  11487. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  11488. exports.default = MDCRippleFoundation;
  11489. /***/ }),
  11490. /***/ "./packages/mdc-ripple/index.ts":
  11491. /*!**************************************!*\
  11492. !*** ./packages/mdc-ripple/index.ts ***!
  11493. \**************************************/
  11494. /*! no static exports found */
  11495. /***/ (function(module, exports, __webpack_require__) {
  11496. "use strict";
  11497. /**
  11498. * @license
  11499. * Copyright 2019 Google Inc.
  11500. *
  11501. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11502. * of this software and associated documentation files (the "Software"), to deal
  11503. * in the Software without restriction, including without limitation the rights
  11504. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11505. * copies of the Software, and to permit persons to whom the Software is
  11506. * furnished to do so, subject to the following conditions:
  11507. *
  11508. * The above copyright notice and this permission notice shall be included in
  11509. * all copies or substantial portions of the Software.
  11510. *
  11511. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11512. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11513. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11514. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11515. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11516. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11517. * THE SOFTWARE.
  11518. */
  11519. function __export(m) {
  11520. for (var p in m) {
  11521. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  11522. }
  11523. }
  11524. var __importStar = this && this.__importStar || function (mod) {
  11525. if (mod && mod.__esModule) return mod;
  11526. var result = {};
  11527. if (mod != null) for (var k in mod) {
  11528. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  11529. }result["default"] = mod;
  11530. return result;
  11531. };
  11532. Object.defineProperty(exports, "__esModule", { value: true });
  11533. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  11534. exports.util = util;
  11535. __export(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts"));
  11536. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"));
  11537. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"));
  11538. /***/ }),
  11539. /***/ "./packages/mdc-ripple/util.ts":
  11540. /*!*************************************!*\
  11541. !*** ./packages/mdc-ripple/util.ts ***!
  11542. \*************************************/
  11543. /*! no static exports found */
  11544. /***/ (function(module, exports, __webpack_require__) {
  11545. "use strict";
  11546. Object.defineProperty(exports, "__esModule", { value: true });
  11547. /**
  11548. * Stores result from supportsCssVariables to avoid redundant processing to
  11549. * detect CSS custom variable support.
  11550. */
  11551. var supportsCssVariables_;
  11552. function detectEdgePseudoVarBug(windowObj) {
  11553. // Detect versions of Edge with buggy var() support
  11554. // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
  11555. var document = windowObj.document;
  11556. var node = document.createElement('div');
  11557. node.className = 'mdc-ripple-surface--test-edge-var-bug';
  11558. document.body.appendChild(node);
  11559. // The bug exists if ::before style ends up propagating to the parent element.
  11560. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
  11561. // but Firefox is known to support CSS custom properties correctly.
  11562. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  11563. var computedStyle = windowObj.getComputedStyle(node);
  11564. var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
  11565. if (node.parentNode) {
  11566. node.parentNode.removeChild(node);
  11567. }
  11568. return hasPseudoVarBug;
  11569. }
  11570. function supportsCssVariables(windowObj, forceRefresh) {
  11571. if (forceRefresh === void 0) {
  11572. forceRefresh = false;
  11573. }
  11574. var CSS = windowObj.CSS;
  11575. var supportsCssVars = supportsCssVariables_;
  11576. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  11577. return supportsCssVariables_;
  11578. }
  11579. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  11580. if (!supportsFunctionPresent) {
  11581. return false;
  11582. }
  11583. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  11584. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  11585. // See: README section on Safari
  11586. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  11587. if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
  11588. supportsCssVars = !detectEdgePseudoVarBug(windowObj);
  11589. } else {
  11590. supportsCssVars = false;
  11591. }
  11592. if (!forceRefresh) {
  11593. supportsCssVariables_ = supportsCssVars;
  11594. }
  11595. return supportsCssVars;
  11596. }
  11597. exports.supportsCssVariables = supportsCssVariables;
  11598. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  11599. if (!evt) {
  11600. return { x: 0, y: 0 };
  11601. }
  11602. var x = pageOffset.x,
  11603. y = pageOffset.y;
  11604. var documentX = x + clientRect.left;
  11605. var documentY = y + clientRect.top;
  11606. var normalizedX;
  11607. var normalizedY;
  11608. // Determine touch point relative to the ripple container.
  11609. if (evt.type === 'touchstart') {
  11610. var touchEvent = evt;
  11611. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  11612. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  11613. } else {
  11614. var mouseEvent = evt;
  11615. normalizedX = mouseEvent.pageX - documentX;
  11616. normalizedY = mouseEvent.pageY - documentY;
  11617. }
  11618. return { x: normalizedX, y: normalizedY };
  11619. }
  11620. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  11621. /***/ }),
  11622. /***/ "./packages/mdc-select/component.ts":
  11623. /*!******************************************!*\
  11624. !*** ./packages/mdc-select/component.ts ***!
  11625. \******************************************/
  11626. /*! no static exports found */
  11627. /***/ (function(module, exports, __webpack_require__) {
  11628. "use strict";
  11629. /**
  11630. * @license
  11631. * Copyright 2016 Google Inc.
  11632. *
  11633. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11634. * of this software and associated documentation files (the "Software"), to deal
  11635. * in the Software without restriction, including without limitation the rights
  11636. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11637. * copies of the Software, and to permit persons to whom the Software is
  11638. * furnished to do so, subject to the following conditions:
  11639. *
  11640. * The above copyright notice and this permission notice shall be included in
  11641. * all copies or substantial portions of the Software.
  11642. *
  11643. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11644. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11645. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11646. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11647. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11648. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11649. * THE SOFTWARE.
  11650. */
  11651. var __extends = this && this.__extends || function () {
  11652. var _extendStatics = function extendStatics(d, b) {
  11653. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11654. d.__proto__ = b;
  11655. } || function (d, b) {
  11656. for (var p in b) {
  11657. if (b.hasOwnProperty(p)) d[p] = b[p];
  11658. }
  11659. };
  11660. return _extendStatics(d, b);
  11661. };
  11662. return function (d, b) {
  11663. _extendStatics(d, b);
  11664. function __() {
  11665. this.constructor = d;
  11666. }
  11667. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11668. };
  11669. }();
  11670. var __assign = this && this.__assign || function () {
  11671. __assign = Object.assign || function (t) {
  11672. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11673. s = arguments[i];
  11674. for (var p in s) {
  11675. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11676. }
  11677. }
  11678. return t;
  11679. };
  11680. return __assign.apply(this, arguments);
  11681. };
  11682. var __importStar = this && this.__importStar || function (mod) {
  11683. if (mod && mod.__esModule) return mod;
  11684. var result = {};
  11685. if (mod != null) for (var k in mod) {
  11686. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  11687. }result["default"] = mod;
  11688. return result;
  11689. };
  11690. Object.defineProperty(exports, "__esModule", { value: true });
  11691. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  11692. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  11693. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  11694. var menuSurfaceConstants = __importStar(__webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"));
  11695. var component_4 = __webpack_require__(/*! @material/menu/component */ "./packages/mdc-menu/component.ts");
  11696. var menuConstants = __importStar(__webpack_require__(/*! @material/menu/constants */ "./packages/mdc-menu/constants.ts"));
  11697. var component_5 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  11698. var component_6 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  11699. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  11700. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  11701. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts");
  11702. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-select/helper-text/component.ts");
  11703. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-select/icon/component.ts");
  11704. var VALIDATION_ATTR_WHITELIST = ['required', 'aria-required'];
  11705. var MDCSelect = /** @class */function (_super) {
  11706. __extends(MDCSelect, _super);
  11707. function MDCSelect() {
  11708. return _super !== null && _super.apply(this, arguments) || this;
  11709. }
  11710. MDCSelect.attachTo = function (root) {
  11711. return new MDCSelect(root);
  11712. };
  11713. MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) {
  11714. if (labelFactory === void 0) {
  11715. labelFactory = function labelFactory(el) {
  11716. return new component_2.MDCFloatingLabel(el);
  11717. };
  11718. }
  11719. if (lineRippleFactory === void 0) {
  11720. lineRippleFactory = function lineRippleFactory(el) {
  11721. return new component_3.MDCLineRipple(el);
  11722. };
  11723. }
  11724. if (outlineFactory === void 0) {
  11725. outlineFactory = function outlineFactory(el) {
  11726. return new component_5.MDCNotchedOutline(el);
  11727. };
  11728. }
  11729. if (menuFactory === void 0) {
  11730. menuFactory = function menuFactory(el) {
  11731. return new component_4.MDCMenu(el);
  11732. };
  11733. }
  11734. if (iconFactory === void 0) {
  11735. iconFactory = function iconFactory(el) {
  11736. return new component_8.MDCSelectIcon(el);
  11737. };
  11738. }
  11739. if (helperTextFactory === void 0) {
  11740. helperTextFactory = function helperTextFactory(el) {
  11741. return new component_7.MDCSelectHelperText(el);
  11742. };
  11743. }
  11744. this.isMenuOpen_ = false;
  11745. this.nativeControl_ = this.root_.querySelector(constants_1.strings.NATIVE_CONTROL_SELECTOR);
  11746. this.selectedText_ = this.root_.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR);
  11747. var targetElement = this.nativeControl_ || this.selectedText_;
  11748. if (!targetElement) {
  11749. throw new Error('MDCSelect: Missing required element: Exactly one of the following selectors must be present: ' + ("'" + constants_1.strings.NATIVE_CONTROL_SELECTOR + "' or '" + constants_1.strings.SELECTED_TEXT_SELECTOR + "'"));
  11750. }
  11751. this.targetElement_ = targetElement;
  11752. if (this.targetElement_.hasAttribute(constants_1.strings.ARIA_CONTROLS)) {
  11753. var helperTextElement = document.getElementById(this.targetElement_.getAttribute(constants_1.strings.ARIA_CONTROLS));
  11754. if (helperTextElement) {
  11755. this.helperText_ = helperTextFactory(helperTextElement);
  11756. }
  11757. }
  11758. if (this.selectedText_) {
  11759. this.enhancedSelectSetup_(menuFactory);
  11760. }
  11761. var labelElement = this.root_.querySelector(constants_1.strings.LABEL_SELECTOR);
  11762. this.label_ = labelElement ? labelFactory(labelElement) : null;
  11763. var lineRippleElement = this.root_.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  11764. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  11765. var outlineElement = this.root_.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  11766. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  11767. var leadingIcon = this.root_.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  11768. if (leadingIcon) {
  11769. this.root_.classList.add(constants_1.cssClasses.WITH_LEADING_ICON);
  11770. this.leadingIcon_ = iconFactory(leadingIcon);
  11771. if (this.menuElement_) {
  11772. this.menuElement_.classList.add(constants_1.cssClasses.WITH_LEADING_ICON);
  11773. }
  11774. }
  11775. if (!this.root_.classList.contains(constants_1.cssClasses.OUTLINED)) {
  11776. this.ripple = this.createRipple_();
  11777. }
  11778. // The required state needs to be sync'd before the mutation observer is added.
  11779. this.initialSyncRequiredState_();
  11780. this.addMutationObserverForRequired_();
  11781. };
  11782. /**
  11783. * Initializes the select's event listeners and internal state based
  11784. * on the environment's state.
  11785. */
  11786. MDCSelect.prototype.initialSyncWithDOM = function () {
  11787. var _this = this;
  11788. this.handleChange_ = function () {
  11789. return _this.foundation_.handleChange( /* didChange */true);
  11790. };
  11791. this.handleFocus_ = function () {
  11792. return _this.foundation_.handleFocus();
  11793. };
  11794. this.handleBlur_ = function () {
  11795. return _this.foundation_.handleBlur();
  11796. };
  11797. this.handleClick_ = function (evt) {
  11798. if (_this.selectedText_) {
  11799. _this.selectedText_.focus();
  11800. }
  11801. _this.foundation_.handleClick(_this.getNormalizedXCoordinate_(evt));
  11802. };
  11803. this.handleKeydown_ = function (evt) {
  11804. return _this.foundation_.handleKeydown(evt);
  11805. };
  11806. this.handleMenuSelected_ = function (evtData) {
  11807. return _this.selectedIndex = evtData.detail.index;
  11808. };
  11809. this.handleMenuOpened_ = function () {
  11810. _this.foundation_.handleMenuOpened();
  11811. if (_this.menu_.items.length === 0) {
  11812. return;
  11813. }
  11814. // Menu should open to the last selected element, should open to first menu item otherwise.
  11815. var focusItemIndex = _this.selectedIndex >= 0 ? _this.selectedIndex : 0;
  11816. var focusItemEl = _this.menu_.items[focusItemIndex];
  11817. focusItemEl.focus();
  11818. };
  11819. this.handleMenuClosed_ = function () {
  11820. _this.foundation_.handleMenuClosed();
  11821. // isMenuOpen_ is used to track the state of the menu opening or closing since the menu.open function
  11822. // will return false if the menu is still closing and this method listens to the closed event which
  11823. // occurs after the menu is already closed.
  11824. _this.isMenuOpen_ = false;
  11825. _this.selectedText_.removeAttribute('aria-expanded');
  11826. if (document.activeElement !== _this.selectedText_) {
  11827. _this.foundation_.handleBlur();
  11828. }
  11829. };
  11830. this.targetElement_.addEventListener('change', this.handleChange_);
  11831. this.targetElement_.addEventListener('focus', this.handleFocus_);
  11832. this.targetElement_.addEventListener('blur', this.handleBlur_);
  11833. this.targetElement_.addEventListener('click', this.handleClick_);
  11834. if (this.menuElement_) {
  11835. this.selectedText_.addEventListener('keydown', this.handleKeydown_);
  11836. this.menu_.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed_);
  11837. this.menu_.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened_);
  11838. this.menu_.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuSelected_);
  11839. if (this.hiddenInput_ && this.hiddenInput_.value) {
  11840. // If the hidden input already has a value, use it to restore the select's value.
  11841. // This can happen e.g. if the user goes back or (in some browsers) refreshes the page.
  11842. var enhancedAdapterMethods = this.getEnhancedSelectAdapterMethods_();
  11843. enhancedAdapterMethods.setValue(this.hiddenInput_.value);
  11844. } else if (this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR)) {
  11845. // If an element is selected, the select should set the initial selected text.
  11846. var enhancedAdapterMethods = this.getEnhancedSelectAdapterMethods_();
  11847. enhancedAdapterMethods.setValue(enhancedAdapterMethods.getValue());
  11848. }
  11849. }
  11850. // Initially sync floating label
  11851. this.foundation_.handleChange( /* didChange */false);
  11852. if (this.root_.classList.contains(constants_1.cssClasses.DISABLED) || this.nativeControl_ && this.nativeControl_.disabled) {
  11853. this.disabled = true;
  11854. }
  11855. };
  11856. MDCSelect.prototype.destroy = function () {
  11857. this.targetElement_.removeEventListener('change', this.handleChange_);
  11858. this.targetElement_.removeEventListener('focus', this.handleFocus_);
  11859. this.targetElement_.removeEventListener('blur', this.handleBlur_);
  11860. this.targetElement_.removeEventListener('keydown', this.handleKeydown_);
  11861. this.targetElement_.removeEventListener('click', this.handleClick_);
  11862. if (this.menu_) {
  11863. this.menu_.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed_);
  11864. this.menu_.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened_);
  11865. this.menu_.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuSelected_);
  11866. this.menu_.destroy();
  11867. }
  11868. if (this.ripple) {
  11869. this.ripple.destroy();
  11870. }
  11871. if (this.outline_) {
  11872. this.outline_.destroy();
  11873. }
  11874. if (this.leadingIcon_) {
  11875. this.leadingIcon_.destroy();
  11876. }
  11877. if (this.helperText_) {
  11878. this.helperText_.destroy();
  11879. }
  11880. if (this.validationObserver_) {
  11881. this.validationObserver_.disconnect();
  11882. }
  11883. _super.prototype.destroy.call(this);
  11884. };
  11885. Object.defineProperty(MDCSelect.prototype, "value", {
  11886. get: function get() {
  11887. return this.foundation_.getValue();
  11888. },
  11889. set: function set(value) {
  11890. this.foundation_.setValue(value);
  11891. },
  11892. enumerable: true,
  11893. configurable: true
  11894. });
  11895. Object.defineProperty(MDCSelect.prototype, "selectedIndex", {
  11896. get: function get() {
  11897. var selectedIndex = -1;
  11898. if (this.menuElement_ && this.menu_) {
  11899. var selectedEl = this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  11900. selectedIndex = this.menu_.items.indexOf(selectedEl);
  11901. } else if (this.nativeControl_) {
  11902. selectedIndex = this.nativeControl_.selectedIndex;
  11903. }
  11904. return selectedIndex;
  11905. },
  11906. set: function set(selectedIndex) {
  11907. this.foundation_.setSelectedIndex(selectedIndex);
  11908. },
  11909. enumerable: true,
  11910. configurable: true
  11911. });
  11912. Object.defineProperty(MDCSelect.prototype, "disabled", {
  11913. get: function get() {
  11914. return this.root_.classList.contains(constants_1.cssClasses.DISABLED) || (this.nativeControl_ ? this.nativeControl_.disabled : false);
  11915. },
  11916. set: function set(disabled) {
  11917. this.foundation_.setDisabled(disabled);
  11918. },
  11919. enumerable: true,
  11920. configurable: true
  11921. });
  11922. Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", {
  11923. set: function set(label) {
  11924. this.foundation_.setLeadingIconAriaLabel(label);
  11925. },
  11926. enumerable: true,
  11927. configurable: true
  11928. });
  11929. Object.defineProperty(MDCSelect.prototype, "leadingIconContent", {
  11930. /**
  11931. * Sets the text content of the leading icon.
  11932. */
  11933. set: function set(content) {
  11934. this.foundation_.setLeadingIconContent(content);
  11935. },
  11936. enumerable: true,
  11937. configurable: true
  11938. });
  11939. Object.defineProperty(MDCSelect.prototype, "helperTextContent", {
  11940. /**
  11941. * Sets the text content of the helper text.
  11942. */
  11943. set: function set(content) {
  11944. this.foundation_.setHelperTextContent(content);
  11945. },
  11946. enumerable: true,
  11947. configurable: true
  11948. });
  11949. Object.defineProperty(MDCSelect.prototype, "valid", {
  11950. /**
  11951. * Checks if the select is in a valid state.
  11952. */
  11953. get: function get() {
  11954. return this.foundation_.isValid();
  11955. },
  11956. /**
  11957. * Sets the current invalid state of the select.
  11958. */
  11959. set: function set(isValid) {
  11960. this.foundation_.setValid(isValid);
  11961. },
  11962. enumerable: true,
  11963. configurable: true
  11964. });
  11965. Object.defineProperty(MDCSelect.prototype, "required", {
  11966. /**
  11967. * Returns whether the select is required.
  11968. */
  11969. get: function get() {
  11970. if (this.nativeControl_) {
  11971. return this.nativeControl_.required;
  11972. } else {
  11973. return this.selectedText_.getAttribute('aria-required') === 'true';
  11974. }
  11975. },
  11976. /**
  11977. * Sets the control to the required state.
  11978. */
  11979. set: function set(isRequired) {
  11980. if (this.nativeControl_) {
  11981. this.nativeControl_.required = isRequired;
  11982. } else {
  11983. if (isRequired) {
  11984. this.selectedText_.setAttribute('aria-required', isRequired.toString());
  11985. } else {
  11986. this.selectedText_.removeAttribute('aria-required');
  11987. }
  11988. }
  11989. },
  11990. enumerable: true,
  11991. configurable: true
  11992. });
  11993. /**
  11994. * Recomputes the outline SVG path for the outline element.
  11995. */
  11996. MDCSelect.prototype.layout = function () {
  11997. this.foundation_.layout();
  11998. };
  11999. MDCSelect.prototype.getDefaultFoundation = function () {
  12000. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12001. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12002. var adapter = __assign({}, this.nativeControl_ ? this.getNativeSelectAdapterMethods_() : this.getEnhancedSelectAdapterMethods_(), this.getCommonAdapterMethods_(), this.getOutlineAdapterMethods_(), this.getLabelAdapterMethods_());
  12003. return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap_());
  12004. };
  12005. /**
  12006. * Handles setup for the enhanced menu.
  12007. */
  12008. MDCSelect.prototype.enhancedSelectSetup_ = function (menuFactory) {
  12009. var isDisabled = this.root_.classList.contains(constants_1.cssClasses.DISABLED);
  12010. this.selectedText_.setAttribute('tabindex', isDisabled ? '-1' : '0');
  12011. this.hiddenInput_ = this.root_.querySelector(constants_1.strings.HIDDEN_INPUT_SELECTOR);
  12012. this.menuElement_ = this.root_.querySelector(constants_1.strings.MENU_SELECTOR);
  12013. this.menu_ = menuFactory(this.menuElement_);
  12014. this.menu_.hoistMenuToBody();
  12015. this.menu_.setAnchorElement(this.root_);
  12016. this.menu_.setAnchorCorner(menuSurfaceConstants.Corner.BOTTOM_START);
  12017. this.menu_.wrapFocus = false;
  12018. };
  12019. MDCSelect.prototype.createRipple_ = function () {
  12020. var _this = this;
  12021. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12022. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12023. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12024. var adapter = __assign({}, component_6.MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  12025. return _this.targetElement_.addEventListener(evtType, handler);
  12026. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  12027. return _this.targetElement_.removeEventListener(evtType, handler);
  12028. } });
  12029. // tslint:enable:object-literal-sort-keys
  12030. return new component_6.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  12031. };
  12032. MDCSelect.prototype.getNativeSelectAdapterMethods_ = function () {
  12033. var _this = this;
  12034. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12035. return {
  12036. getValue: function getValue() {
  12037. return _this.nativeControl_.value;
  12038. },
  12039. setValue: function setValue(value) {
  12040. _this.nativeControl_.value = value;
  12041. },
  12042. openMenu: function openMenu() {
  12043. return undefined;
  12044. },
  12045. closeMenu: function closeMenu() {
  12046. return undefined;
  12047. },
  12048. isMenuOpen: function isMenuOpen() {
  12049. return false;
  12050. },
  12051. setSelectedIndex: function setSelectedIndex(index) {
  12052. _this.nativeControl_.selectedIndex = index;
  12053. },
  12054. setDisabled: function setDisabled(isDisabled) {
  12055. _this.nativeControl_.disabled = isDisabled;
  12056. },
  12057. setValid: function setValid(isValid) {
  12058. if (isValid) {
  12059. _this.root_.classList.remove(constants_1.cssClasses.INVALID);
  12060. } else {
  12061. _this.root_.classList.add(constants_1.cssClasses.INVALID);
  12062. }
  12063. },
  12064. checkValidity: function checkValidity() {
  12065. return _this.nativeControl_.checkValidity();
  12066. }
  12067. };
  12068. // tslint:enable:object-literal-sort-keys
  12069. };
  12070. MDCSelect.prototype.getEnhancedSelectAdapterMethods_ = function () {
  12071. var _this = this;
  12072. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12073. return {
  12074. getValue: function getValue() {
  12075. var listItem = _this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  12076. if (listItem && listItem.hasAttribute(constants_1.strings.ENHANCED_VALUE_ATTR)) {
  12077. return listItem.getAttribute(constants_1.strings.ENHANCED_VALUE_ATTR) || '';
  12078. }
  12079. return '';
  12080. },
  12081. setValue: function setValue(value) {
  12082. var element = _this.menuElement_.querySelector("[" + constants_1.strings.ENHANCED_VALUE_ATTR + "=\"" + value + "\"]");
  12083. _this.setEnhancedSelectedIndex_(element ? _this.menu_.items.indexOf(element) : -1);
  12084. },
  12085. openMenu: function openMenu() {
  12086. if (_this.menu_ && !_this.menu_.open) {
  12087. _this.menu_.open = true;
  12088. _this.isMenuOpen_ = true;
  12089. _this.selectedText_.setAttribute('aria-expanded', 'true');
  12090. }
  12091. },
  12092. closeMenu: function closeMenu() {
  12093. if (_this.menu_ && _this.menu_.open) {
  12094. _this.menu_.open = false;
  12095. }
  12096. },
  12097. isMenuOpen: function isMenuOpen() {
  12098. return Boolean(_this.menu_) && _this.isMenuOpen_;
  12099. },
  12100. setSelectedIndex: function setSelectedIndex(index) {
  12101. return _this.setEnhancedSelectedIndex_(index);
  12102. },
  12103. setDisabled: function setDisabled(isDisabled) {
  12104. _this.selectedText_.setAttribute('tabindex', isDisabled ? '-1' : '0');
  12105. _this.selectedText_.setAttribute('aria-disabled', isDisabled.toString());
  12106. if (_this.hiddenInput_) {
  12107. _this.hiddenInput_.disabled = isDisabled;
  12108. }
  12109. },
  12110. checkValidity: function checkValidity() {
  12111. var classList = _this.root_.classList;
  12112. if (classList.contains(constants_1.cssClasses.REQUIRED) && !classList.contains(constants_1.cssClasses.DISABLED)) {
  12113. // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element
  12114. // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value.
  12115. return _this.selectedIndex !== -1 && (_this.selectedIndex !== 0 || Boolean(_this.value));
  12116. } else {
  12117. return true;
  12118. }
  12119. },
  12120. setValid: function setValid(isValid) {
  12121. _this.selectedText_.setAttribute('aria-invalid', (!isValid).toString());
  12122. if (isValid) {
  12123. _this.root_.classList.remove(constants_1.cssClasses.INVALID);
  12124. } else {
  12125. _this.root_.classList.add(constants_1.cssClasses.INVALID);
  12126. }
  12127. }
  12128. };
  12129. // tslint:enable:object-literal-sort-keys
  12130. };
  12131. MDCSelect.prototype.getCommonAdapterMethods_ = function () {
  12132. var _this = this;
  12133. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12134. return {
  12135. addClass: function addClass(className) {
  12136. return _this.root_.classList.add(className);
  12137. },
  12138. removeClass: function removeClass(className) {
  12139. return _this.root_.classList.remove(className);
  12140. },
  12141. hasClass: function hasClass(className) {
  12142. return _this.root_.classList.contains(className);
  12143. },
  12144. setRippleCenter: function setRippleCenter(normalizedX) {
  12145. return _this.lineRipple_ && _this.lineRipple_.setRippleCenter(normalizedX);
  12146. },
  12147. activateBottomLine: function activateBottomLine() {
  12148. return _this.lineRipple_ && _this.lineRipple_.activate();
  12149. },
  12150. deactivateBottomLine: function deactivateBottomLine() {
  12151. return _this.lineRipple_ && _this.lineRipple_.deactivate();
  12152. },
  12153. notifyChange: function notifyChange(value) {
  12154. var index = _this.selectedIndex;
  12155. _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */);
  12156. }
  12157. };
  12158. // tslint:enable:object-literal-sort-keys
  12159. };
  12160. MDCSelect.prototype.getOutlineAdapterMethods_ = function () {
  12161. var _this = this;
  12162. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12163. return {
  12164. hasOutline: function hasOutline() {
  12165. return Boolean(_this.outline_);
  12166. },
  12167. notchOutline: function notchOutline(labelWidth) {
  12168. return _this.outline_ && _this.outline_.notch(labelWidth);
  12169. },
  12170. closeOutline: function closeOutline() {
  12171. return _this.outline_ && _this.outline_.closeNotch();
  12172. }
  12173. };
  12174. // tslint:enable:object-literal-sort-keys
  12175. };
  12176. MDCSelect.prototype.getLabelAdapterMethods_ = function () {
  12177. var _this = this;
  12178. return {
  12179. floatLabel: function floatLabel(shouldFloat) {
  12180. return _this.label_ && _this.label_.float(shouldFloat);
  12181. },
  12182. getLabelWidth: function getLabelWidth() {
  12183. return _this.label_ ? _this.label_.getWidth() : 0;
  12184. }
  12185. };
  12186. };
  12187. /**
  12188. * Calculates where the line ripple should start based on the x coordinate within the component.
  12189. */
  12190. MDCSelect.prototype.getNormalizedXCoordinate_ = function (evt) {
  12191. var targetClientRect = evt.target.getBoundingClientRect();
  12192. var xCoordinate = this.isTouchEvent_(evt) ? evt.touches[0].clientX : evt.clientX;
  12193. return xCoordinate - targetClientRect.left;
  12194. };
  12195. MDCSelect.prototype.isTouchEvent_ = function (evt) {
  12196. return Boolean(evt.touches);
  12197. };
  12198. /**
  12199. * Returns a map of all subcomponents to subfoundations.
  12200. */
  12201. MDCSelect.prototype.getFoundationMap_ = function () {
  12202. return {
  12203. helperText: this.helperText_ ? this.helperText_.foundation : undefined,
  12204. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined
  12205. };
  12206. };
  12207. MDCSelect.prototype.setEnhancedSelectedIndex_ = function (index) {
  12208. var selectedItem = this.menu_.items[index];
  12209. this.selectedText_.textContent = selectedItem ? selectedItem.textContent.trim() : '';
  12210. var previouslySelected = this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  12211. if (previouslySelected) {
  12212. previouslySelected.classList.remove(constants_1.cssClasses.SELECTED_ITEM_CLASS);
  12213. previouslySelected.removeAttribute(constants_1.strings.ARIA_SELECTED_ATTR);
  12214. }
  12215. if (selectedItem) {
  12216. selectedItem.classList.add(constants_1.cssClasses.SELECTED_ITEM_CLASS);
  12217. selectedItem.setAttribute(constants_1.strings.ARIA_SELECTED_ATTR, 'true');
  12218. }
  12219. // Synchronize hidden input's value with data-value attribute of selected item.
  12220. // This code path is also followed when setting value directly, so this covers all cases.
  12221. if (this.hiddenInput_) {
  12222. this.hiddenInput_.value = selectedItem ? selectedItem.getAttribute(constants_1.strings.ENHANCED_VALUE_ATTR) || '' : '';
  12223. }
  12224. this.layout();
  12225. };
  12226. MDCSelect.prototype.initialSyncRequiredState_ = function () {
  12227. var isRequired = this.targetElement_.required || this.targetElement_.getAttribute('aria-required') === 'true' || this.root_.classList.contains(constants_1.cssClasses.REQUIRED);
  12228. if (isRequired) {
  12229. if (this.nativeControl_) {
  12230. this.nativeControl_.required = true;
  12231. } else {
  12232. this.selectedText_.setAttribute('aria-required', 'true');
  12233. }
  12234. this.root_.classList.add(constants_1.cssClasses.REQUIRED);
  12235. }
  12236. };
  12237. MDCSelect.prototype.addMutationObserverForRequired_ = function () {
  12238. var _this = this;
  12239. var observerHandler = function observerHandler(attributesList) {
  12240. attributesList.some(function (attributeName) {
  12241. if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) === -1) {
  12242. return false;
  12243. }
  12244. if (_this.selectedText_) {
  12245. if (_this.selectedText_.getAttribute('aria-required') === 'true') {
  12246. _this.root_.classList.add(constants_1.cssClasses.REQUIRED);
  12247. } else {
  12248. _this.root_.classList.remove(constants_1.cssClasses.REQUIRED);
  12249. }
  12250. } else {
  12251. if (_this.nativeControl_.required) {
  12252. _this.root_.classList.add(constants_1.cssClasses.REQUIRED);
  12253. } else {
  12254. _this.root_.classList.remove(constants_1.cssClasses.REQUIRED);
  12255. }
  12256. }
  12257. return true;
  12258. });
  12259. };
  12260. var getAttributesList = function getAttributesList(mutationsList) {
  12261. return mutationsList.map(function (mutation) {
  12262. return mutation.attributeName;
  12263. }).filter(function (attributeName) {
  12264. return attributeName;
  12265. });
  12266. };
  12267. var observer = new MutationObserver(function (mutationsList) {
  12268. return observerHandler(getAttributesList(mutationsList));
  12269. });
  12270. observer.observe(this.targetElement_, { attributes: true });
  12271. this.validationObserver_ = observer;
  12272. };
  12273. return MDCSelect;
  12274. }(component_1.MDCComponent);
  12275. exports.MDCSelect = MDCSelect;
  12276. /***/ }),
  12277. /***/ "./packages/mdc-select/constants.ts":
  12278. /*!******************************************!*\
  12279. !*** ./packages/mdc-select/constants.ts ***!
  12280. \******************************************/
  12281. /*! no static exports found */
  12282. /***/ (function(module, exports, __webpack_require__) {
  12283. "use strict";
  12284. /**
  12285. * @license
  12286. * Copyright 2016 Google Inc.
  12287. *
  12288. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12289. * of this software and associated documentation files (the "Software"), to deal
  12290. * in the Software without restriction, including without limitation the rights
  12291. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12292. * copies of the Software, and to permit persons to whom the Software is
  12293. * furnished to do so, subject to the following conditions:
  12294. *
  12295. * The above copyright notice and this permission notice shall be included in
  12296. * all copies or substantial portions of the Software.
  12297. *
  12298. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12299. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12300. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12301. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12302. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12303. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12304. * THE SOFTWARE.
  12305. */
  12306. Object.defineProperty(exports, "__esModule", { value: true });
  12307. var cssClasses = {
  12308. ACTIVATED: 'mdc-select--activated',
  12309. DISABLED: 'mdc-select--disabled',
  12310. FOCUSED: 'mdc-select--focused',
  12311. INVALID: 'mdc-select--invalid',
  12312. OUTLINED: 'mdc-select--outlined',
  12313. REQUIRED: 'mdc-select--required',
  12314. ROOT: 'mdc-select',
  12315. SELECTED_ITEM_CLASS: 'mdc-list-item--selected',
  12316. WITH_LEADING_ICON: 'mdc-select--with-leading-icon'
  12317. };
  12318. exports.cssClasses = cssClasses;
  12319. var strings = {
  12320. ARIA_CONTROLS: 'aria-controls',
  12321. ARIA_SELECTED_ATTR: 'aria-selected',
  12322. CHANGE_EVENT: 'MDCSelect:change',
  12323. ENHANCED_VALUE_ATTR: 'data-value',
  12324. HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]',
  12325. LABEL_SELECTOR: '.mdc-floating-label',
  12326. LEADING_ICON_SELECTOR: '.mdc-select__icon',
  12327. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  12328. MENU_SELECTOR: '.mdc-select__menu',
  12329. NATIVE_CONTROL_SELECTOR: '.mdc-select__native-control',
  12330. OUTLINE_SELECTOR: '.mdc-notched-outline',
  12331. SELECTED_ITEM_SELECTOR: "." + cssClasses.SELECTED_ITEM_CLASS,
  12332. SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text'
  12333. };
  12334. exports.strings = strings;
  12335. var numbers = {
  12336. LABEL_SCALE: 0.75
  12337. };
  12338. exports.numbers = numbers;
  12339. /***/ }),
  12340. /***/ "./packages/mdc-select/foundation.ts":
  12341. /*!*******************************************!*\
  12342. !*** ./packages/mdc-select/foundation.ts ***!
  12343. \*******************************************/
  12344. /*! no static exports found */
  12345. /***/ (function(module, exports, __webpack_require__) {
  12346. "use strict";
  12347. /**
  12348. * @license
  12349. * Copyright 2016 Google Inc.
  12350. *
  12351. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12352. * of this software and associated documentation files (the "Software"), to deal
  12353. * in the Software without restriction, including without limitation the rights
  12354. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12355. * copies of the Software, and to permit persons to whom the Software is
  12356. * furnished to do so, subject to the following conditions:
  12357. *
  12358. * The above copyright notice and this permission notice shall be included in
  12359. * all copies or substantial portions of the Software.
  12360. *
  12361. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12362. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12363. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12364. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12365. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12366. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12367. * THE SOFTWARE.
  12368. */
  12369. var __extends = this && this.__extends || function () {
  12370. var _extendStatics = function extendStatics(d, b) {
  12371. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12372. d.__proto__ = b;
  12373. } || function (d, b) {
  12374. for (var p in b) {
  12375. if (b.hasOwnProperty(p)) d[p] = b[p];
  12376. }
  12377. };
  12378. return _extendStatics(d, b);
  12379. };
  12380. return function (d, b) {
  12381. _extendStatics(d, b);
  12382. function __() {
  12383. this.constructor = d;
  12384. }
  12385. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12386. };
  12387. }();
  12388. var __assign = this && this.__assign || function () {
  12389. __assign = Object.assign || function (t) {
  12390. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12391. s = arguments[i];
  12392. for (var p in s) {
  12393. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12394. }
  12395. }
  12396. return t;
  12397. };
  12398. return __assign.apply(this, arguments);
  12399. };
  12400. Object.defineProperty(exports, "__esModule", { value: true });
  12401. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12402. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  12403. var MDCSelectFoundation = /** @class */function (_super) {
  12404. __extends(MDCSelectFoundation, _super);
  12405. /* istanbul ignore next: optional argument is not a branch statement */
  12406. /**
  12407. * @param adapter
  12408. * @param foundationMap Map from subcomponent names to their subfoundations.
  12409. */
  12410. function MDCSelectFoundation(adapter, foundationMap) {
  12411. if (foundationMap === void 0) {
  12412. foundationMap = {};
  12413. }
  12414. var _this = _super.call(this, __assign({}, MDCSelectFoundation.defaultAdapter, adapter)) || this;
  12415. _this.leadingIcon_ = foundationMap.leadingIcon;
  12416. _this.helperText_ = foundationMap.helperText;
  12417. return _this;
  12418. }
  12419. Object.defineProperty(MDCSelectFoundation, "cssClasses", {
  12420. get: function get() {
  12421. return constants_1.cssClasses;
  12422. },
  12423. enumerable: true,
  12424. configurable: true
  12425. });
  12426. Object.defineProperty(MDCSelectFoundation, "numbers", {
  12427. get: function get() {
  12428. return constants_1.numbers;
  12429. },
  12430. enumerable: true,
  12431. configurable: true
  12432. });
  12433. Object.defineProperty(MDCSelectFoundation, "strings", {
  12434. get: function get() {
  12435. return constants_1.strings;
  12436. },
  12437. enumerable: true,
  12438. configurable: true
  12439. });
  12440. Object.defineProperty(MDCSelectFoundation, "defaultAdapter", {
  12441. /**
  12442. * See {@link MDCSelectAdapter} for typing information on parameters and return types.
  12443. */
  12444. get: function get() {
  12445. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12446. return {
  12447. addClass: function addClass() {
  12448. return undefined;
  12449. },
  12450. removeClass: function removeClass() {
  12451. return undefined;
  12452. },
  12453. hasClass: function hasClass() {
  12454. return false;
  12455. },
  12456. activateBottomLine: function activateBottomLine() {
  12457. return undefined;
  12458. },
  12459. deactivateBottomLine: function deactivateBottomLine() {
  12460. return undefined;
  12461. },
  12462. setValue: function setValue() {
  12463. return undefined;
  12464. },
  12465. getValue: function getValue() {
  12466. return '';
  12467. },
  12468. floatLabel: function floatLabel() {
  12469. return undefined;
  12470. },
  12471. getLabelWidth: function getLabelWidth() {
  12472. return 0;
  12473. },
  12474. hasOutline: function hasOutline() {
  12475. return false;
  12476. },
  12477. notchOutline: function notchOutline() {
  12478. return undefined;
  12479. },
  12480. closeOutline: function closeOutline() {
  12481. return undefined;
  12482. },
  12483. openMenu: function openMenu() {
  12484. return undefined;
  12485. },
  12486. closeMenu: function closeMenu() {
  12487. return undefined;
  12488. },
  12489. isMenuOpen: function isMenuOpen() {
  12490. return false;
  12491. },
  12492. setSelectedIndex: function setSelectedIndex() {
  12493. return undefined;
  12494. },
  12495. setDisabled: function setDisabled() {
  12496. return undefined;
  12497. },
  12498. setRippleCenter: function setRippleCenter() {
  12499. return undefined;
  12500. },
  12501. notifyChange: function notifyChange() {
  12502. return undefined;
  12503. },
  12504. checkValidity: function checkValidity() {
  12505. return false;
  12506. },
  12507. setValid: function setValid() {
  12508. return undefined;
  12509. }
  12510. };
  12511. // tslint:enable:object-literal-sort-keys
  12512. },
  12513. enumerable: true,
  12514. configurable: true
  12515. });
  12516. MDCSelectFoundation.prototype.setSelectedIndex = function (index) {
  12517. this.adapter_.setSelectedIndex(index);
  12518. this.adapter_.closeMenu();
  12519. var didChange = true;
  12520. this.handleChange(didChange);
  12521. };
  12522. MDCSelectFoundation.prototype.setValue = function (value) {
  12523. this.adapter_.setValue(value);
  12524. var didChange = true;
  12525. this.handleChange(didChange);
  12526. };
  12527. MDCSelectFoundation.prototype.getValue = function () {
  12528. return this.adapter_.getValue();
  12529. };
  12530. MDCSelectFoundation.prototype.setDisabled = function (isDisabled) {
  12531. if (isDisabled) {
  12532. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  12533. } else {
  12534. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  12535. }
  12536. this.adapter_.setDisabled(isDisabled);
  12537. this.adapter_.closeMenu();
  12538. if (this.leadingIcon_) {
  12539. this.leadingIcon_.setDisabled(isDisabled);
  12540. }
  12541. };
  12542. /**
  12543. * @param content Sets the content of the helper text.
  12544. */
  12545. MDCSelectFoundation.prototype.setHelperTextContent = function (content) {
  12546. if (this.helperText_) {
  12547. this.helperText_.setContent(content);
  12548. }
  12549. };
  12550. MDCSelectFoundation.prototype.layout = function () {
  12551. var openNotch = this.getValue().length > 0;
  12552. this.notchOutline(openNotch);
  12553. };
  12554. MDCSelectFoundation.prototype.handleMenuOpened = function () {
  12555. this.adapter_.addClass(constants_1.cssClasses.ACTIVATED);
  12556. };
  12557. MDCSelectFoundation.prototype.handleMenuClosed = function () {
  12558. this.adapter_.removeClass(constants_1.cssClasses.ACTIVATED);
  12559. };
  12560. /**
  12561. * Handles value changes, via change event or programmatic updates.
  12562. */
  12563. MDCSelectFoundation.prototype.handleChange = function (didChange) {
  12564. if (didChange === void 0) {
  12565. didChange = true;
  12566. }
  12567. var value = this.getValue();
  12568. var optionHasValue = value.length > 0;
  12569. var isRequired = this.adapter_.hasClass(constants_1.cssClasses.REQUIRED);
  12570. this.notchOutline(optionHasValue);
  12571. if (!this.adapter_.hasClass(constants_1.cssClasses.FOCUSED)) {
  12572. this.adapter_.floatLabel(optionHasValue);
  12573. }
  12574. if (didChange) {
  12575. this.adapter_.notifyChange(value);
  12576. if (isRequired) {
  12577. this.setValid(this.isValid());
  12578. if (this.helperText_) {
  12579. this.helperText_.setValidity(this.isValid());
  12580. }
  12581. }
  12582. }
  12583. };
  12584. /**
  12585. * Handles focus events from select element.
  12586. */
  12587. MDCSelectFoundation.prototype.handleFocus = function () {
  12588. this.adapter_.addClass(constants_1.cssClasses.FOCUSED);
  12589. this.adapter_.floatLabel(true);
  12590. this.notchOutline(true);
  12591. this.adapter_.activateBottomLine();
  12592. if (this.helperText_) {
  12593. this.helperText_.showToScreenReader();
  12594. }
  12595. };
  12596. /**
  12597. * Handles blur events from select element.
  12598. */
  12599. MDCSelectFoundation.prototype.handleBlur = function () {
  12600. if (this.adapter_.isMenuOpen()) {
  12601. return;
  12602. }
  12603. this.adapter_.removeClass(constants_1.cssClasses.FOCUSED);
  12604. this.handleChange(false);
  12605. this.adapter_.deactivateBottomLine();
  12606. var isRequired = this.adapter_.hasClass(constants_1.cssClasses.REQUIRED);
  12607. if (isRequired) {
  12608. this.setValid(this.isValid());
  12609. if (this.helperText_) {
  12610. this.helperText_.setValidity(this.isValid());
  12611. }
  12612. }
  12613. };
  12614. MDCSelectFoundation.prototype.handleClick = function (normalizedX) {
  12615. if (this.adapter_.isMenuOpen()) {
  12616. return;
  12617. }
  12618. this.adapter_.setRippleCenter(normalizedX);
  12619. this.adapter_.openMenu();
  12620. };
  12621. MDCSelectFoundation.prototype.handleKeydown = function (event) {
  12622. if (this.adapter_.isMenuOpen()) {
  12623. return;
  12624. }
  12625. var isEnter = event.key === 'Enter' || event.keyCode === 13;
  12626. var isSpace = event.key === 'Space' || event.keyCode === 32;
  12627. var arrowUp = event.key === 'ArrowUp' || event.keyCode === 38;
  12628. var arrowDown = event.key === 'ArrowDown' || event.keyCode === 40;
  12629. if (this.adapter_.hasClass(constants_1.cssClasses.FOCUSED) && (isEnter || isSpace || arrowUp || arrowDown)) {
  12630. this.adapter_.openMenu();
  12631. event.preventDefault();
  12632. }
  12633. };
  12634. /**
  12635. * Opens/closes the notched outline.
  12636. */
  12637. MDCSelectFoundation.prototype.notchOutline = function (openNotch) {
  12638. if (!this.adapter_.hasOutline()) {
  12639. return;
  12640. }
  12641. var isFocused = this.adapter_.hasClass(constants_1.cssClasses.FOCUSED);
  12642. if (openNotch) {
  12643. var labelScale = constants_1.numbers.LABEL_SCALE;
  12644. var labelWidth = this.adapter_.getLabelWidth() * labelScale;
  12645. this.adapter_.notchOutline(labelWidth);
  12646. } else if (!isFocused) {
  12647. this.adapter_.closeOutline();
  12648. }
  12649. };
  12650. /**
  12651. * Sets the aria label of the leading icon.
  12652. */
  12653. MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  12654. if (this.leadingIcon_) {
  12655. this.leadingIcon_.setAriaLabel(label);
  12656. }
  12657. };
  12658. /**
  12659. * Sets the text content of the leading icon.
  12660. */
  12661. MDCSelectFoundation.prototype.setLeadingIconContent = function (content) {
  12662. if (this.leadingIcon_) {
  12663. this.leadingIcon_.setContent(content);
  12664. }
  12665. };
  12666. MDCSelectFoundation.prototype.setValid = function (isValid) {
  12667. this.adapter_.setValid(isValid);
  12668. };
  12669. MDCSelectFoundation.prototype.isValid = function () {
  12670. return this.adapter_.checkValidity();
  12671. };
  12672. return MDCSelectFoundation;
  12673. }(foundation_1.MDCFoundation);
  12674. exports.MDCSelectFoundation = MDCSelectFoundation;
  12675. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12676. exports.default = MDCSelectFoundation;
  12677. /***/ }),
  12678. /***/ "./packages/mdc-select/helper-text/component.ts":
  12679. /*!******************************************************!*\
  12680. !*** ./packages/mdc-select/helper-text/component.ts ***!
  12681. \******************************************************/
  12682. /*! no static exports found */
  12683. /***/ (function(module, exports, __webpack_require__) {
  12684. "use strict";
  12685. /**
  12686. * @license
  12687. * Copyright 2018 Google Inc.
  12688. *
  12689. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12690. * of this software and associated documentation files (the "Software"), to deal
  12691. * in the Software without restriction, including without limitation the rights
  12692. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12693. * copies of the Software, and to permit persons to whom the Software is
  12694. * furnished to do so, subject to the following conditions:
  12695. *
  12696. * The above copyright notice and this permission notice shall be included in
  12697. * all copies or substantial portions of the Software.
  12698. *
  12699. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12700. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12701. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12702. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12703. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12704. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12705. * THE SOFTWARE.
  12706. */
  12707. var __extends = this && this.__extends || function () {
  12708. var _extendStatics = function extendStatics(d, b) {
  12709. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12710. d.__proto__ = b;
  12711. } || function (d, b) {
  12712. for (var p in b) {
  12713. if (b.hasOwnProperty(p)) d[p] = b[p];
  12714. }
  12715. };
  12716. return _extendStatics(d, b);
  12717. };
  12718. return function (d, b) {
  12719. _extendStatics(d, b);
  12720. function __() {
  12721. this.constructor = d;
  12722. }
  12723. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12724. };
  12725. }();
  12726. Object.defineProperty(exports, "__esModule", { value: true });
  12727. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12728. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts");
  12729. var MDCSelectHelperText = /** @class */function (_super) {
  12730. __extends(MDCSelectHelperText, _super);
  12731. function MDCSelectHelperText() {
  12732. return _super !== null && _super.apply(this, arguments) || this;
  12733. }
  12734. MDCSelectHelperText.attachTo = function (root) {
  12735. return new MDCSelectHelperText(root);
  12736. };
  12737. Object.defineProperty(MDCSelectHelperText.prototype, "foundation", {
  12738. get: function get() {
  12739. return this.foundation_;
  12740. },
  12741. enumerable: true,
  12742. configurable: true
  12743. });
  12744. MDCSelectHelperText.prototype.getDefaultFoundation = function () {
  12745. var _this = this;
  12746. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12747. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12748. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12749. var adapter = {
  12750. addClass: function addClass(className) {
  12751. return _this.root_.classList.add(className);
  12752. },
  12753. removeClass: function removeClass(className) {
  12754. return _this.root_.classList.remove(className);
  12755. },
  12756. hasClass: function hasClass(className) {
  12757. return _this.root_.classList.contains(className);
  12758. },
  12759. setAttr: function setAttr(attr, value) {
  12760. return _this.root_.setAttribute(attr, value);
  12761. },
  12762. removeAttr: function removeAttr(attr) {
  12763. return _this.root_.removeAttribute(attr);
  12764. },
  12765. setContent: function setContent(content) {
  12766. _this.root_.textContent = content;
  12767. }
  12768. };
  12769. // tslint:enable:object-literal-sort-keys
  12770. return new foundation_1.MDCSelectHelperTextFoundation(adapter);
  12771. };
  12772. return MDCSelectHelperText;
  12773. }(component_1.MDCComponent);
  12774. exports.MDCSelectHelperText = MDCSelectHelperText;
  12775. /***/ }),
  12776. /***/ "./packages/mdc-select/helper-text/constants.ts":
  12777. /*!******************************************************!*\
  12778. !*** ./packages/mdc-select/helper-text/constants.ts ***!
  12779. \******************************************************/
  12780. /*! no static exports found */
  12781. /***/ (function(module, exports, __webpack_require__) {
  12782. "use strict";
  12783. /**
  12784. * @license
  12785. * Copyright 2018 Google Inc.
  12786. *
  12787. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12788. * of this software and associated documentation files (the "Software"), to deal
  12789. * in the Software without restriction, including without limitation the rights
  12790. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12791. * copies of the Software, and to permit persons to whom the Software is
  12792. * furnished to do so, subject to the following conditions:
  12793. *
  12794. * The above copyright notice and this permission notice shall be included in
  12795. * all copies or substantial portions of the Software.
  12796. *
  12797. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12798. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12799. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12800. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12801. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12802. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12803. * THE SOFTWARE.
  12804. */
  12805. Object.defineProperty(exports, "__esModule", { value: true });
  12806. var strings = {
  12807. ARIA_HIDDEN: 'aria-hidden',
  12808. ROLE: 'role'
  12809. };
  12810. exports.strings = strings;
  12811. var cssClasses = {
  12812. HELPER_TEXT_PERSISTENT: 'mdc-select-helper-text--persistent',
  12813. HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg'
  12814. };
  12815. exports.cssClasses = cssClasses;
  12816. /***/ }),
  12817. /***/ "./packages/mdc-select/helper-text/foundation.ts":
  12818. /*!*******************************************************!*\
  12819. !*** ./packages/mdc-select/helper-text/foundation.ts ***!
  12820. \*******************************************************/
  12821. /*! no static exports found */
  12822. /***/ (function(module, exports, __webpack_require__) {
  12823. "use strict";
  12824. /**
  12825. * @license
  12826. * Copyright 2018 Google Inc.
  12827. *
  12828. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12829. * of this software and associated documentation files (the "Software"), to deal
  12830. * in the Software without restriction, including without limitation the rights
  12831. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12832. * copies of the Software, and to permit persons to whom the Software is
  12833. * furnished to do so, subject to the following conditions:
  12834. *
  12835. * The above copyright notice and this permission notice shall be included in
  12836. * all copies or substantial portions of the Software.
  12837. *
  12838. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12839. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12840. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12841. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12842. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12843. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12844. * THE SOFTWARE.
  12845. */
  12846. var __extends = this && this.__extends || function () {
  12847. var _extendStatics = function extendStatics(d, b) {
  12848. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12849. d.__proto__ = b;
  12850. } || function (d, b) {
  12851. for (var p in b) {
  12852. if (b.hasOwnProperty(p)) d[p] = b[p];
  12853. }
  12854. };
  12855. return _extendStatics(d, b);
  12856. };
  12857. return function (d, b) {
  12858. _extendStatics(d, b);
  12859. function __() {
  12860. this.constructor = d;
  12861. }
  12862. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12863. };
  12864. }();
  12865. var __assign = this && this.__assign || function () {
  12866. __assign = Object.assign || function (t) {
  12867. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12868. s = arguments[i];
  12869. for (var p in s) {
  12870. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12871. }
  12872. }
  12873. return t;
  12874. };
  12875. return __assign.apply(this, arguments);
  12876. };
  12877. Object.defineProperty(exports, "__esModule", { value: true });
  12878. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12879. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  12880. var MDCSelectHelperTextFoundation = /** @class */function (_super) {
  12881. __extends(MDCSelectHelperTextFoundation, _super);
  12882. function MDCSelectHelperTextFoundation(adapter) {
  12883. return _super.call(this, __assign({}, MDCSelectHelperTextFoundation.defaultAdapter, adapter)) || this;
  12884. }
  12885. Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
  12886. get: function get() {
  12887. return constants_1.cssClasses;
  12888. },
  12889. enumerable: true,
  12890. configurable: true
  12891. });
  12892. Object.defineProperty(MDCSelectHelperTextFoundation, "strings", {
  12893. get: function get() {
  12894. return constants_1.strings;
  12895. },
  12896. enumerable: true,
  12897. configurable: true
  12898. });
  12899. Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", {
  12900. /**
  12901. * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types.
  12902. */
  12903. get: function get() {
  12904. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12905. return {
  12906. addClass: function addClass() {
  12907. return undefined;
  12908. },
  12909. removeClass: function removeClass() {
  12910. return undefined;
  12911. },
  12912. hasClass: function hasClass() {
  12913. return false;
  12914. },
  12915. setAttr: function setAttr() {
  12916. return undefined;
  12917. },
  12918. removeAttr: function removeAttr() {
  12919. return undefined;
  12920. },
  12921. setContent: function setContent() {
  12922. return undefined;
  12923. }
  12924. };
  12925. // tslint:enable:object-literal-sort-keys
  12926. },
  12927. enumerable: true,
  12928. configurable: true
  12929. });
  12930. /**
  12931. * Sets the content of the helper text field.
  12932. */
  12933. MDCSelectHelperTextFoundation.prototype.setContent = function (content) {
  12934. this.adapter_.setContent(content);
  12935. };
  12936. /**
  12937. * Sets the persistency of the helper text.
  12938. */
  12939. MDCSelectHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  12940. if (isPersistent) {
  12941. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12942. } else {
  12943. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12944. }
  12945. };
  12946. /**
  12947. * @param isValidation True to make the helper text act as an error validation message.
  12948. */
  12949. MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {
  12950. if (isValidation) {
  12951. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  12952. } else {
  12953. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  12954. }
  12955. };
  12956. /**
  12957. * Makes the helper text visible to screen readers.
  12958. */
  12959. MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {
  12960. this.adapter_.removeAttr(constants_1.strings.ARIA_HIDDEN);
  12961. };
  12962. /**
  12963. * Sets the validity of the helper text based on the select validity.
  12964. */
  12965. MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {
  12966. var helperTextIsPersistent = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12967. var helperTextIsValidationMsg = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  12968. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !selectIsValid;
  12969. if (validationMsgNeedsDisplay) {
  12970. this.adapter_.setAttr(constants_1.strings.ROLE, 'alert');
  12971. } else {
  12972. this.adapter_.removeAttr(constants_1.strings.ROLE);
  12973. }
  12974. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  12975. this.hide_();
  12976. }
  12977. };
  12978. /**
  12979. * Hides the help text from screen readers.
  12980. */
  12981. MDCSelectHelperTextFoundation.prototype.hide_ = function () {
  12982. this.adapter_.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  12983. };
  12984. return MDCSelectHelperTextFoundation;
  12985. }(foundation_1.MDCFoundation);
  12986. exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation;
  12987. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12988. exports.default = MDCSelectHelperTextFoundation;
  12989. /***/ }),
  12990. /***/ "./packages/mdc-select/helper-text/index.ts":
  12991. /*!**************************************************!*\
  12992. !*** ./packages/mdc-select/helper-text/index.ts ***!
  12993. \**************************************************/
  12994. /*! no static exports found */
  12995. /***/ (function(module, exports, __webpack_require__) {
  12996. "use strict";
  12997. /**
  12998. * @license
  12999. * Copyright 2019 Google Inc.
  13000. *
  13001. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13002. * of this software and associated documentation files (the "Software"), to deal
  13003. * in the Software without restriction, including without limitation the rights
  13004. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13005. * copies of the Software, and to permit persons to whom the Software is
  13006. * furnished to do so, subject to the following conditions:
  13007. *
  13008. * The above copyright notice and this permission notice shall be included in
  13009. * all copies or substantial portions of the Software.
  13010. *
  13011. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13012. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13013. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13014. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13015. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13016. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13017. * THE SOFTWARE.
  13018. */
  13019. function __export(m) {
  13020. for (var p in m) {
  13021. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13022. }
  13023. }
  13024. Object.defineProperty(exports, "__esModule", { value: true });
  13025. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/helper-text/component.ts"));
  13026. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"));
  13027. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  13028. exports.helperTextCssClasses = constants_1.cssClasses;
  13029. exports.helperTextStrings = constants_1.strings;
  13030. /***/ }),
  13031. /***/ "./packages/mdc-select/icon/component.ts":
  13032. /*!***********************************************!*\
  13033. !*** ./packages/mdc-select/icon/component.ts ***!
  13034. \***********************************************/
  13035. /*! no static exports found */
  13036. /***/ (function(module, exports, __webpack_require__) {
  13037. "use strict";
  13038. /**
  13039. * @license
  13040. * Copyright 2018 Google Inc.
  13041. *
  13042. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13043. * of this software and associated documentation files (the "Software"), to deal
  13044. * in the Software without restriction, including without limitation the rights
  13045. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13046. * copies of the Software, and to permit persons to whom the Software is
  13047. * furnished to do so, subject to the following conditions:
  13048. *
  13049. * The above copyright notice and this permission notice shall be included in
  13050. * all copies or substantial portions of the Software.
  13051. *
  13052. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13053. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13054. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13055. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13056. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13057. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13058. * THE SOFTWARE.
  13059. */
  13060. var __extends = this && this.__extends || function () {
  13061. var _extendStatics = function extendStatics(d, b) {
  13062. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13063. d.__proto__ = b;
  13064. } || function (d, b) {
  13065. for (var p in b) {
  13066. if (b.hasOwnProperty(p)) d[p] = b[p];
  13067. }
  13068. };
  13069. return _extendStatics(d, b);
  13070. };
  13071. return function (d, b) {
  13072. _extendStatics(d, b);
  13073. function __() {
  13074. this.constructor = d;
  13075. }
  13076. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13077. };
  13078. }();
  13079. Object.defineProperty(exports, "__esModule", { value: true });
  13080. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  13081. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts");
  13082. var MDCSelectIcon = /** @class */function (_super) {
  13083. __extends(MDCSelectIcon, _super);
  13084. function MDCSelectIcon() {
  13085. return _super !== null && _super.apply(this, arguments) || this;
  13086. }
  13087. MDCSelectIcon.attachTo = function (root) {
  13088. return new MDCSelectIcon(root);
  13089. };
  13090. Object.defineProperty(MDCSelectIcon.prototype, "foundation", {
  13091. get: function get() {
  13092. return this.foundation_;
  13093. },
  13094. enumerable: true,
  13095. configurable: true
  13096. });
  13097. MDCSelectIcon.prototype.getDefaultFoundation = function () {
  13098. var _this = this;
  13099. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13100. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13101. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13102. var adapter = {
  13103. getAttr: function getAttr(attr) {
  13104. return _this.root_.getAttribute(attr);
  13105. },
  13106. setAttr: function setAttr(attr, value) {
  13107. return _this.root_.setAttribute(attr, value);
  13108. },
  13109. removeAttr: function removeAttr(attr) {
  13110. return _this.root_.removeAttribute(attr);
  13111. },
  13112. setContent: function setContent(content) {
  13113. _this.root_.textContent = content;
  13114. },
  13115. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  13116. return _this.listen(evtType, handler);
  13117. },
  13118. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  13119. return _this.unlisten(evtType, handler);
  13120. },
  13121. notifyIconAction: function notifyIconAction() {
  13122. return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  13123. }
  13124. };
  13125. // tslint:enable:object-literal-sort-keys
  13126. return new foundation_1.MDCSelectIconFoundation(adapter);
  13127. };
  13128. return MDCSelectIcon;
  13129. }(component_1.MDCComponent);
  13130. exports.MDCSelectIcon = MDCSelectIcon;
  13131. /***/ }),
  13132. /***/ "./packages/mdc-select/icon/constants.ts":
  13133. /*!***********************************************!*\
  13134. !*** ./packages/mdc-select/icon/constants.ts ***!
  13135. \***********************************************/
  13136. /*! no static exports found */
  13137. /***/ (function(module, exports, __webpack_require__) {
  13138. "use strict";
  13139. /**
  13140. * @license
  13141. * Copyright 2018 Google Inc.
  13142. *
  13143. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13144. * of this software and associated documentation files (the "Software"), to deal
  13145. * in the Software without restriction, including without limitation the rights
  13146. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13147. * copies of the Software, and to permit persons to whom the Software is
  13148. * furnished to do so, subject to the following conditions:
  13149. *
  13150. * The above copyright notice and this permission notice shall be included in
  13151. * all copies or substantial portions of the Software.
  13152. *
  13153. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13154. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13155. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13156. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13157. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13158. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13159. * THE SOFTWARE.
  13160. */
  13161. Object.defineProperty(exports, "__esModule", { value: true });
  13162. var strings = {
  13163. ICON_EVENT: 'MDCSelect:icon',
  13164. ICON_ROLE: 'button'
  13165. };
  13166. exports.strings = strings;
  13167. /***/ }),
  13168. /***/ "./packages/mdc-select/icon/foundation.ts":
  13169. /*!************************************************!*\
  13170. !*** ./packages/mdc-select/icon/foundation.ts ***!
  13171. \************************************************/
  13172. /*! no static exports found */
  13173. /***/ (function(module, exports, __webpack_require__) {
  13174. "use strict";
  13175. /**
  13176. * @license
  13177. * Copyright 2018 Google Inc.
  13178. *
  13179. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13180. * of this software and associated documentation files (the "Software"), to deal
  13181. * in the Software without restriction, including without limitation the rights
  13182. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13183. * copies of the Software, and to permit persons to whom the Software is
  13184. * furnished to do so, subject to the following conditions:
  13185. *
  13186. * The above copyright notice and this permission notice shall be included in
  13187. * all copies or substantial portions of the Software.
  13188. *
  13189. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13190. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13191. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13192. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13193. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13194. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13195. * THE SOFTWARE.
  13196. */
  13197. var __extends = this && this.__extends || function () {
  13198. var _extendStatics = function extendStatics(d, b) {
  13199. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13200. d.__proto__ = b;
  13201. } || function (d, b) {
  13202. for (var p in b) {
  13203. if (b.hasOwnProperty(p)) d[p] = b[p];
  13204. }
  13205. };
  13206. return _extendStatics(d, b);
  13207. };
  13208. return function (d, b) {
  13209. _extendStatics(d, b);
  13210. function __() {
  13211. this.constructor = d;
  13212. }
  13213. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13214. };
  13215. }();
  13216. var __assign = this && this.__assign || function () {
  13217. __assign = Object.assign || function (t) {
  13218. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13219. s = arguments[i];
  13220. for (var p in s) {
  13221. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13222. }
  13223. }
  13224. return t;
  13225. };
  13226. return __assign.apply(this, arguments);
  13227. };
  13228. Object.defineProperty(exports, "__esModule", { value: true });
  13229. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  13230. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  13231. var INTERACTION_EVENTS = ['click', 'keydown'];
  13232. var MDCSelectIconFoundation = /** @class */function (_super) {
  13233. __extends(MDCSelectIconFoundation, _super);
  13234. function MDCSelectIconFoundation(adapter) {
  13235. var _this = _super.call(this, __assign({}, MDCSelectIconFoundation.defaultAdapter, adapter)) || this;
  13236. _this.savedTabIndex_ = null;
  13237. _this.interactionHandler_ = function (evt) {
  13238. return _this.handleInteraction(evt);
  13239. };
  13240. return _this;
  13241. }
  13242. Object.defineProperty(MDCSelectIconFoundation, "strings", {
  13243. get: function get() {
  13244. return constants_1.strings;
  13245. },
  13246. enumerable: true,
  13247. configurable: true
  13248. });
  13249. Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", {
  13250. /**
  13251. * See {@link MDCSelectIconAdapter} for typing information on parameters and return types.
  13252. */
  13253. get: function get() {
  13254. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13255. return {
  13256. getAttr: function getAttr() {
  13257. return null;
  13258. },
  13259. setAttr: function setAttr() {
  13260. return undefined;
  13261. },
  13262. removeAttr: function removeAttr() {
  13263. return undefined;
  13264. },
  13265. setContent: function setContent() {
  13266. return undefined;
  13267. },
  13268. registerInteractionHandler: function registerInteractionHandler() {
  13269. return undefined;
  13270. },
  13271. deregisterInteractionHandler: function deregisterInteractionHandler() {
  13272. return undefined;
  13273. },
  13274. notifyIconAction: function notifyIconAction() {
  13275. return undefined;
  13276. }
  13277. };
  13278. // tslint:enable:object-literal-sort-keys
  13279. },
  13280. enumerable: true,
  13281. configurable: true
  13282. });
  13283. MDCSelectIconFoundation.prototype.init = function () {
  13284. var _this = this;
  13285. this.savedTabIndex_ = this.adapter_.getAttr('tabindex');
  13286. INTERACTION_EVENTS.forEach(function (evtType) {
  13287. _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_);
  13288. });
  13289. };
  13290. MDCSelectIconFoundation.prototype.destroy = function () {
  13291. var _this = this;
  13292. INTERACTION_EVENTS.forEach(function (evtType) {
  13293. _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  13294. });
  13295. };
  13296. MDCSelectIconFoundation.prototype.setDisabled = function (disabled) {
  13297. if (!this.savedTabIndex_) {
  13298. return;
  13299. }
  13300. if (disabled) {
  13301. this.adapter_.setAttr('tabindex', '-1');
  13302. this.adapter_.removeAttr('role');
  13303. } else {
  13304. this.adapter_.setAttr('tabindex', this.savedTabIndex_);
  13305. this.adapter_.setAttr('role', constants_1.strings.ICON_ROLE);
  13306. }
  13307. };
  13308. MDCSelectIconFoundation.prototype.setAriaLabel = function (label) {
  13309. this.adapter_.setAttr('aria-label', label);
  13310. };
  13311. MDCSelectIconFoundation.prototype.setContent = function (content) {
  13312. this.adapter_.setContent(content);
  13313. };
  13314. MDCSelectIconFoundation.prototype.handleInteraction = function (evt) {
  13315. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  13316. if (evt.type === 'click' || isEnterKey) {
  13317. this.adapter_.notifyIconAction();
  13318. }
  13319. };
  13320. return MDCSelectIconFoundation;
  13321. }(foundation_1.MDCFoundation);
  13322. exports.MDCSelectIconFoundation = MDCSelectIconFoundation;
  13323. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  13324. exports.default = MDCSelectIconFoundation;
  13325. /***/ }),
  13326. /***/ "./packages/mdc-select/icon/index.ts":
  13327. /*!*******************************************!*\
  13328. !*** ./packages/mdc-select/icon/index.ts ***!
  13329. \*******************************************/
  13330. /*! no static exports found */
  13331. /***/ (function(module, exports, __webpack_require__) {
  13332. "use strict";
  13333. /**
  13334. * @license
  13335. * Copyright 2019 Google Inc.
  13336. *
  13337. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13338. * of this software and associated documentation files (the "Software"), to deal
  13339. * in the Software without restriction, including without limitation the rights
  13340. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13341. * copies of the Software, and to permit persons to whom the Software is
  13342. * furnished to do so, subject to the following conditions:
  13343. *
  13344. * The above copyright notice and this permission notice shall be included in
  13345. * all copies or substantial portions of the Software.
  13346. *
  13347. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13348. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13349. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13350. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13351. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13352. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13353. * THE SOFTWARE.
  13354. */
  13355. function __export(m) {
  13356. for (var p in m) {
  13357. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13358. }
  13359. }
  13360. Object.defineProperty(exports, "__esModule", { value: true });
  13361. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/icon/component.ts"));
  13362. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"));
  13363. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  13364. exports.iconStrings = constants_1.strings;
  13365. /***/ }),
  13366. /***/ "./packages/mdc-select/index.ts":
  13367. /*!**************************************!*\
  13368. !*** ./packages/mdc-select/index.ts ***!
  13369. \**************************************/
  13370. /*! no static exports found */
  13371. /***/ (function(module, exports, __webpack_require__) {
  13372. "use strict";
  13373. /**
  13374. * @license
  13375. * Copyright 2019 Google Inc.
  13376. *
  13377. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13378. * of this software and associated documentation files (the "Software"), to deal
  13379. * in the Software without restriction, including without limitation the rights
  13380. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13381. * copies of the Software, and to permit persons to whom the Software is
  13382. * furnished to do so, subject to the following conditions:
  13383. *
  13384. * The above copyright notice and this permission notice shall be included in
  13385. * all copies or substantial portions of the Software.
  13386. *
  13387. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13388. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13389. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13390. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13391. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13392. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13393. * THE SOFTWARE.
  13394. */
  13395. function __export(m) {
  13396. for (var p in m) {
  13397. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13398. }
  13399. }
  13400. Object.defineProperty(exports, "__esModule", { value: true });
  13401. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/component.ts"));
  13402. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"));
  13403. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts"));
  13404. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-select/helper-text/index.ts"));
  13405. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-select/icon/index.ts"));
  13406. /***/ }),
  13407. /***/ "./packages/mdc-slider/component.ts":
  13408. /*!******************************************!*\
  13409. !*** ./packages/mdc-slider/component.ts ***!
  13410. \******************************************/
  13411. /*! no static exports found */
  13412. /***/ (function(module, exports, __webpack_require__) {
  13413. "use strict";
  13414. /**
  13415. * @license
  13416. * Copyright 2017 Google Inc.
  13417. *
  13418. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13419. * of this software and associated documentation files (the "Software"), to deal
  13420. * in the Software without restriction, including without limitation the rights
  13421. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13422. * copies of the Software, and to permit persons to whom the Software is
  13423. * furnished to do so, subject to the following conditions:
  13424. *
  13425. * The above copyright notice and this permission notice shall be included in
  13426. * all copies or substantial portions of the Software.
  13427. *
  13428. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13429. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13430. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13431. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13432. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13433. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13434. * THE SOFTWARE.
  13435. */
  13436. var __extends = this && this.__extends || function () {
  13437. var _extendStatics = function extendStatics(d, b) {
  13438. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13439. d.__proto__ = b;
  13440. } || function (d, b) {
  13441. for (var p in b) {
  13442. if (b.hasOwnProperty(p)) d[p] = b[p];
  13443. }
  13444. };
  13445. return _extendStatics(d, b);
  13446. };
  13447. return function (d, b) {
  13448. _extendStatics(d, b);
  13449. function __() {
  13450. this.constructor = d;
  13451. }
  13452. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13453. };
  13454. }();
  13455. Object.defineProperty(exports, "__esModule", { value: true });
  13456. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  13457. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  13458. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  13459. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts");
  13460. var MDCSlider = /** @class */function (_super) {
  13461. __extends(MDCSlider, _super);
  13462. function MDCSlider() {
  13463. return _super !== null && _super.apply(this, arguments) || this;
  13464. }
  13465. MDCSlider.attachTo = function (root) {
  13466. return new MDCSlider(root);
  13467. };
  13468. Object.defineProperty(MDCSlider.prototype, "value", {
  13469. get: function get() {
  13470. return this.foundation_.getValue();
  13471. },
  13472. set: function set(value) {
  13473. this.foundation_.setValue(value);
  13474. },
  13475. enumerable: true,
  13476. configurable: true
  13477. });
  13478. Object.defineProperty(MDCSlider.prototype, "min", {
  13479. get: function get() {
  13480. return this.foundation_.getMin();
  13481. },
  13482. set: function set(min) {
  13483. this.foundation_.setMin(min);
  13484. },
  13485. enumerable: true,
  13486. configurable: true
  13487. });
  13488. Object.defineProperty(MDCSlider.prototype, "max", {
  13489. get: function get() {
  13490. return this.foundation_.getMax();
  13491. },
  13492. set: function set(max) {
  13493. this.foundation_.setMax(max);
  13494. },
  13495. enumerable: true,
  13496. configurable: true
  13497. });
  13498. Object.defineProperty(MDCSlider.prototype, "step", {
  13499. get: function get() {
  13500. return this.foundation_.getStep();
  13501. },
  13502. set: function set(step) {
  13503. this.foundation_.setStep(step);
  13504. },
  13505. enumerable: true,
  13506. configurable: true
  13507. });
  13508. Object.defineProperty(MDCSlider.prototype, "disabled", {
  13509. get: function get() {
  13510. return this.foundation_.isDisabled();
  13511. },
  13512. set: function set(disabled) {
  13513. this.foundation_.setDisabled(disabled);
  13514. },
  13515. enumerable: true,
  13516. configurable: true
  13517. });
  13518. MDCSlider.prototype.initialize = function () {
  13519. this.thumbContainer_ = this.root_.querySelector(constants_1.strings.THUMB_CONTAINER_SELECTOR);
  13520. this.track_ = this.root_.querySelector(constants_1.strings.TRACK_SELECTOR);
  13521. this.pinValueMarker_ = this.root_.querySelector(constants_1.strings.PIN_VALUE_MARKER_SELECTOR);
  13522. this.trackMarkerContainer_ = this.root_.querySelector(constants_1.strings.TRACK_MARKER_CONTAINER_SELECTOR);
  13523. };
  13524. MDCSlider.prototype.getDefaultFoundation = function () {
  13525. var _this = this;
  13526. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13527. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13528. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13529. var adapter = {
  13530. hasClass: function hasClass(className) {
  13531. return _this.root_.classList.contains(className);
  13532. },
  13533. addClass: function addClass(className) {
  13534. return _this.root_.classList.add(className);
  13535. },
  13536. removeClass: function removeClass(className) {
  13537. return _this.root_.classList.remove(className);
  13538. },
  13539. getAttribute: function getAttribute(name) {
  13540. return _this.root_.getAttribute(name);
  13541. },
  13542. setAttribute: function setAttribute(name, value) {
  13543. return _this.root_.setAttribute(name, value);
  13544. },
  13545. removeAttribute: function removeAttribute(name) {
  13546. return _this.root_.removeAttribute(name);
  13547. },
  13548. computeBoundingRect: function computeBoundingRect() {
  13549. return _this.root_.getBoundingClientRect();
  13550. },
  13551. getTabIndex: function getTabIndex() {
  13552. return _this.root_.tabIndex;
  13553. },
  13554. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  13555. return _this.listen(evtType, handler, events_1.applyPassive());
  13556. },
  13557. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  13558. return _this.unlisten(evtType, handler, events_1.applyPassive());
  13559. },
  13560. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) {
  13561. _this.thumbContainer_.addEventListener(evtType, handler, events_1.applyPassive());
  13562. },
  13563. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) {
  13564. _this.thumbContainer_.removeEventListener(evtType, handler, events_1.applyPassive());
  13565. },
  13566. registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) {
  13567. return document.body.addEventListener(evtType, handler);
  13568. },
  13569. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) {
  13570. return document.body.removeEventListener(evtType, handler);
  13571. },
  13572. registerResizeHandler: function registerResizeHandler(handler) {
  13573. return window.addEventListener('resize', handler);
  13574. },
  13575. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  13576. return window.removeEventListener('resize', handler);
  13577. },
  13578. notifyInput: function notifyInput() {
  13579. return _this.emit(constants_1.strings.INPUT_EVENT, _this);
  13580. },
  13581. notifyChange: function notifyChange() {
  13582. return _this.emit(constants_1.strings.CHANGE_EVENT, _this);
  13583. },
  13584. setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) {
  13585. _this.thumbContainer_.style.setProperty(propertyName, value);
  13586. },
  13587. setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) {
  13588. return _this.track_.style.setProperty(propertyName, value);
  13589. },
  13590. setMarkerValue: function setMarkerValue(value) {
  13591. return _this.pinValueMarker_.innerText = value.toLocaleString();
  13592. },
  13593. appendTrackMarkers: function appendTrackMarkers(numMarkers) {
  13594. var frag = document.createDocumentFragment();
  13595. for (var i = 0; i < numMarkers; i++) {
  13596. var marker = document.createElement('div');
  13597. marker.classList.add('mdc-slider__track-marker');
  13598. frag.appendChild(marker);
  13599. }
  13600. _this.trackMarkerContainer_.appendChild(frag);
  13601. },
  13602. removeTrackMarkers: function removeTrackMarkers() {
  13603. while (_this.trackMarkerContainer_.firstChild) {
  13604. _this.trackMarkerContainer_.removeChild(_this.trackMarkerContainer_.firstChild);
  13605. }
  13606. },
  13607. setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty(propertyName, value) {
  13608. // We remove and append new nodes, thus, the last track marker must be dynamically found.
  13609. var lastTrackMarker = _this.root_.querySelector(constants_1.strings.LAST_TRACK_MARKER_SELECTOR);
  13610. lastTrackMarker.style.setProperty(propertyName, value);
  13611. },
  13612. isRTL: function isRTL() {
  13613. return getComputedStyle(_this.root_).direction === 'rtl';
  13614. }
  13615. };
  13616. // tslint:enable:object-literal-sort-keys
  13617. return new foundation_1.MDCSliderFoundation(adapter);
  13618. };
  13619. MDCSlider.prototype.initialSyncWithDOM = function () {
  13620. var origValueNow = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUENOW), this.value);
  13621. var min = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMIN), this.min);
  13622. var max = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMAX), this.max);
  13623. // min and max need to be set in the right order to avoid throwing an error
  13624. // when the new min is greater than the default max.
  13625. if (min >= this.max) {
  13626. this.max = max;
  13627. this.min = min;
  13628. } else {
  13629. this.min = min;
  13630. this.max = max;
  13631. }
  13632. this.step = this.parseFloat_(this.root_.getAttribute(constants_1.strings.STEP_DATA_ATTR), this.step);
  13633. this.value = origValueNow;
  13634. this.disabled = this.root_.hasAttribute(constants_1.strings.ARIA_DISABLED) && this.root_.getAttribute(constants_1.strings.ARIA_DISABLED) !== 'false';
  13635. this.foundation_.setupTrackMarker();
  13636. };
  13637. MDCSlider.prototype.layout = function () {
  13638. this.foundation_.layout();
  13639. };
  13640. MDCSlider.prototype.stepUp = function (amount) {
  13641. if (amount === void 0) {
  13642. amount = this.step || 1;
  13643. }
  13644. this.value += amount;
  13645. };
  13646. MDCSlider.prototype.stepDown = function (amount) {
  13647. if (amount === void 0) {
  13648. amount = this.step || 1;
  13649. }
  13650. this.value -= amount;
  13651. };
  13652. MDCSlider.prototype.parseFloat_ = function (str, defaultValue) {
  13653. var num = parseFloat(str); // tslint:disable-line:ban
  13654. var isNumeric = typeof num === 'number' && isFinite(num);
  13655. return isNumeric ? num : defaultValue;
  13656. };
  13657. return MDCSlider;
  13658. }(component_1.MDCComponent);
  13659. exports.MDCSlider = MDCSlider;
  13660. /***/ }),
  13661. /***/ "./packages/mdc-slider/constants.ts":
  13662. /*!******************************************!*\
  13663. !*** ./packages/mdc-slider/constants.ts ***!
  13664. \******************************************/
  13665. /*! no static exports found */
  13666. /***/ (function(module, exports, __webpack_require__) {
  13667. "use strict";
  13668. /**
  13669. * @license
  13670. * Copyright 2017 Google Inc.
  13671. *
  13672. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13673. * of this software and associated documentation files (the "Software"), to deal
  13674. * in the Software without restriction, including without limitation the rights
  13675. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13676. * copies of the Software, and to permit persons to whom the Software is
  13677. * furnished to do so, subject to the following conditions:
  13678. *
  13679. * The above copyright notice and this permission notice shall be included in
  13680. * all copies or substantial portions of the Software.
  13681. *
  13682. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13683. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13684. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13685. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13686. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13687. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13688. * THE SOFTWARE.
  13689. */
  13690. Object.defineProperty(exports, "__esModule", { value: true });
  13691. var cssClasses = {
  13692. ACTIVE: 'mdc-slider--active',
  13693. DISABLED: 'mdc-slider--disabled',
  13694. DISCRETE: 'mdc-slider--discrete',
  13695. FOCUS: 'mdc-slider--focus',
  13696. HAS_TRACK_MARKER: 'mdc-slider--display-markers',
  13697. IN_TRANSIT: 'mdc-slider--in-transit',
  13698. IS_DISCRETE: 'mdc-slider--discrete'
  13699. };
  13700. exports.cssClasses = cssClasses;
  13701. var strings = {
  13702. ARIA_DISABLED: 'aria-disabled',
  13703. ARIA_VALUEMAX: 'aria-valuemax',
  13704. ARIA_VALUEMIN: 'aria-valuemin',
  13705. ARIA_VALUENOW: 'aria-valuenow',
  13706. CHANGE_EVENT: 'MDCSlider:change',
  13707. INPUT_EVENT: 'MDCSlider:input',
  13708. LAST_TRACK_MARKER_SELECTOR: '.mdc-slider__track-marker:last-child',
  13709. PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker',
  13710. STEP_DATA_ATTR: 'data-step',
  13711. THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container',
  13712. TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container',
  13713. TRACK_SELECTOR: '.mdc-slider__track'
  13714. };
  13715. exports.strings = strings;
  13716. var numbers = {
  13717. PAGE_FACTOR: 4
  13718. };
  13719. exports.numbers = numbers;
  13720. /***/ }),
  13721. /***/ "./packages/mdc-slider/foundation.ts":
  13722. /*!*******************************************!*\
  13723. !*** ./packages/mdc-slider/foundation.ts ***!
  13724. \*******************************************/
  13725. /*! no static exports found */
  13726. /***/ (function(module, exports, __webpack_require__) {
  13727. "use strict";
  13728. /**
  13729. * @license
  13730. * Copyright 2017 Google Inc.
  13731. *
  13732. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13733. * of this software and associated documentation files (the "Software"), to deal
  13734. * in the Software without restriction, including without limitation the rights
  13735. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13736. * copies of the Software, and to permit persons to whom the Software is
  13737. * furnished to do so, subject to the following conditions:
  13738. *
  13739. * The above copyright notice and this permission notice shall be included in
  13740. * all copies or substantial portions of the Software.
  13741. *
  13742. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13743. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13744. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13745. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13746. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13747. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13748. * THE SOFTWARE.
  13749. */
  13750. var __extends = this && this.__extends || function () {
  13751. var _extendStatics = function extendStatics(d, b) {
  13752. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13753. d.__proto__ = b;
  13754. } || function (d, b) {
  13755. for (var p in b) {
  13756. if (b.hasOwnProperty(p)) d[p] = b[p];
  13757. }
  13758. };
  13759. return _extendStatics(d, b);
  13760. };
  13761. return function (d, b) {
  13762. _extendStatics(d, b);
  13763. function __() {
  13764. this.constructor = d;
  13765. }
  13766. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13767. };
  13768. }();
  13769. var __assign = this && this.__assign || function () {
  13770. __assign = Object.assign || function (t) {
  13771. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13772. s = arguments[i];
  13773. for (var p in s) {
  13774. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13775. }
  13776. }
  13777. return t;
  13778. };
  13779. return __assign.apply(this, arguments);
  13780. };
  13781. Object.defineProperty(exports, "__esModule", { value: true });
  13782. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  13783. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  13784. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  13785. var DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart'];
  13786. var UP_EVENTS = ['mouseup', 'pointerup', 'touchend'];
  13787. var MOVE_EVENT_MAP = {
  13788. mousedown: 'mousemove',
  13789. pointerdown: 'pointermove',
  13790. touchstart: 'touchmove'
  13791. };
  13792. var KEY_IDS = {
  13793. ARROW_DOWN: 'ArrowDown',
  13794. ARROW_LEFT: 'ArrowLeft',
  13795. ARROW_RIGHT: 'ArrowRight',
  13796. ARROW_UP: 'ArrowUp',
  13797. END: 'End',
  13798. HOME: 'Home',
  13799. PAGE_DOWN: 'PageDown',
  13800. PAGE_UP: 'PageUp'
  13801. };
  13802. var MDCSliderFoundation = /** @class */function (_super) {
  13803. __extends(MDCSliderFoundation, _super);
  13804. function MDCSliderFoundation(adapter) {
  13805. var _this = _super.call(this, __assign({}, MDCSliderFoundation.defaultAdapter, adapter)) || this;
  13806. /**
  13807. * We set this to NaN since we want it to be a number, but we can't use '0' or '-1'
  13808. * because those could be valid tabindices set by the client code.
  13809. */
  13810. _this.savedTabIndex_ = NaN;
  13811. _this.active_ = false;
  13812. _this.inTransit_ = false;
  13813. _this.isDiscrete_ = false;
  13814. _this.hasTrackMarker_ = false;
  13815. _this.handlingThumbTargetEvt_ = false;
  13816. _this.min_ = 0;
  13817. _this.max_ = 100;
  13818. _this.step_ = 0;
  13819. _this.value_ = 0;
  13820. _this.disabled_ = false;
  13821. _this.preventFocusState_ = false;
  13822. _this.thumbContainerPointerHandler_ = function () {
  13823. return _this.handlingThumbTargetEvt_ = true;
  13824. };
  13825. _this.interactionStartHandler_ = function (evt) {
  13826. return _this.handleDown_(evt);
  13827. };
  13828. _this.keydownHandler_ = function (evt) {
  13829. return _this.handleKeydown_(evt);
  13830. };
  13831. _this.focusHandler_ = function () {
  13832. return _this.handleFocus_();
  13833. };
  13834. _this.blurHandler_ = function () {
  13835. return _this.handleBlur_();
  13836. };
  13837. _this.resizeHandler_ = function () {
  13838. return _this.layout();
  13839. };
  13840. return _this;
  13841. }
  13842. Object.defineProperty(MDCSliderFoundation, "cssClasses", {
  13843. get: function get() {
  13844. return constants_1.cssClasses;
  13845. },
  13846. enumerable: true,
  13847. configurable: true
  13848. });
  13849. Object.defineProperty(MDCSliderFoundation, "strings", {
  13850. get: function get() {
  13851. return constants_1.strings;
  13852. },
  13853. enumerable: true,
  13854. configurable: true
  13855. });
  13856. Object.defineProperty(MDCSliderFoundation, "numbers", {
  13857. get: function get() {
  13858. return constants_1.numbers;
  13859. },
  13860. enumerable: true,
  13861. configurable: true
  13862. });
  13863. Object.defineProperty(MDCSliderFoundation, "defaultAdapter", {
  13864. get: function get() {
  13865. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13866. return {
  13867. hasClass: function hasClass() {
  13868. return false;
  13869. },
  13870. addClass: function addClass() {
  13871. return undefined;
  13872. },
  13873. removeClass: function removeClass() {
  13874. return undefined;
  13875. },
  13876. getAttribute: function getAttribute() {
  13877. return null;
  13878. },
  13879. setAttribute: function setAttribute() {
  13880. return undefined;
  13881. },
  13882. removeAttribute: function removeAttribute() {
  13883. return undefined;
  13884. },
  13885. computeBoundingRect: function computeBoundingRect() {
  13886. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  13887. },
  13888. getTabIndex: function getTabIndex() {
  13889. return 0;
  13890. },
  13891. registerInteractionHandler: function registerInteractionHandler() {
  13892. return undefined;
  13893. },
  13894. deregisterInteractionHandler: function deregisterInteractionHandler() {
  13895. return undefined;
  13896. },
  13897. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() {
  13898. return undefined;
  13899. },
  13900. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() {
  13901. return undefined;
  13902. },
  13903. registerBodyInteractionHandler: function registerBodyInteractionHandler() {
  13904. return undefined;
  13905. },
  13906. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() {
  13907. return undefined;
  13908. },
  13909. registerResizeHandler: function registerResizeHandler() {
  13910. return undefined;
  13911. },
  13912. deregisterResizeHandler: function deregisterResizeHandler() {
  13913. return undefined;
  13914. },
  13915. notifyInput: function notifyInput() {
  13916. return undefined;
  13917. },
  13918. notifyChange: function notifyChange() {
  13919. return undefined;
  13920. },
  13921. setThumbContainerStyleProperty: function setThumbContainerStyleProperty() {
  13922. return undefined;
  13923. },
  13924. setTrackStyleProperty: function setTrackStyleProperty() {
  13925. return undefined;
  13926. },
  13927. setMarkerValue: function setMarkerValue() {
  13928. return undefined;
  13929. },
  13930. appendTrackMarkers: function appendTrackMarkers() {
  13931. return undefined;
  13932. },
  13933. removeTrackMarkers: function removeTrackMarkers() {
  13934. return undefined;
  13935. },
  13936. setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty() {
  13937. return undefined;
  13938. },
  13939. isRTL: function isRTL() {
  13940. return false;
  13941. }
  13942. };
  13943. // tslint:enable:object-literal-sort-keys
  13944. },
  13945. enumerable: true,
  13946. configurable: true
  13947. });
  13948. MDCSliderFoundation.prototype.init = function () {
  13949. var _this = this;
  13950. this.isDiscrete_ = this.adapter_.hasClass(constants_1.cssClasses.IS_DISCRETE);
  13951. this.hasTrackMarker_ = this.adapter_.hasClass(constants_1.cssClasses.HAS_TRACK_MARKER);
  13952. DOWN_EVENTS.forEach(function (evtName) {
  13953. _this.adapter_.registerInteractionHandler(evtName, _this.interactionStartHandler_);
  13954. _this.adapter_.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  13955. });
  13956. this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_);
  13957. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  13958. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  13959. this.adapter_.registerResizeHandler(this.resizeHandler_);
  13960. this.layout();
  13961. // At last step, provide a reasonable default value to discrete slider
  13962. if (this.isDiscrete_ && this.getStep() === 0) {
  13963. this.step_ = 1;
  13964. }
  13965. };
  13966. MDCSliderFoundation.prototype.destroy = function () {
  13967. var _this = this;
  13968. DOWN_EVENTS.forEach(function (evtName) {
  13969. _this.adapter_.deregisterInteractionHandler(evtName, _this.interactionStartHandler_);
  13970. _this.adapter_.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  13971. });
  13972. this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_);
  13973. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  13974. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  13975. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  13976. };
  13977. MDCSliderFoundation.prototype.setupTrackMarker = function () {
  13978. if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) {
  13979. var min = this.getMin();
  13980. var max = this.getMax();
  13981. var step = this.getStep();
  13982. var numMarkers = (max - min) / step;
  13983. // In case distance between max & min is indivisible to step,
  13984. // we place the secondary to last marker proportionally at where thumb
  13985. // could reach and place the last marker at max value
  13986. var indivisible = Math.ceil(numMarkers) !== numMarkers;
  13987. if (indivisible) {
  13988. numMarkers = Math.ceil(numMarkers);
  13989. }
  13990. this.adapter_.removeTrackMarkers();
  13991. this.adapter_.appendTrackMarkers(numMarkers);
  13992. if (indivisible) {
  13993. var lastStepRatio = (max - numMarkers * step) / step + 1;
  13994. this.adapter_.setLastTrackMarkersStyleProperty('flex-grow', String(lastStepRatio));
  13995. }
  13996. }
  13997. };
  13998. MDCSliderFoundation.prototype.layout = function () {
  13999. this.rect_ = this.adapter_.computeBoundingRect();
  14000. this.updateUIForCurrentValue_();
  14001. };
  14002. MDCSliderFoundation.prototype.getValue = function () {
  14003. return this.value_;
  14004. };
  14005. MDCSliderFoundation.prototype.setValue = function (value) {
  14006. this.setValue_(value, false);
  14007. };
  14008. MDCSliderFoundation.prototype.getMax = function () {
  14009. return this.max_;
  14010. };
  14011. MDCSliderFoundation.prototype.setMax = function (max) {
  14012. if (max < this.min_) {
  14013. throw new Error('Cannot set max to be less than the slider\'s minimum value');
  14014. }
  14015. this.max_ = max;
  14016. this.setValue_(this.value_, false, true);
  14017. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMAX, String(this.max_));
  14018. this.setupTrackMarker();
  14019. };
  14020. MDCSliderFoundation.prototype.getMin = function () {
  14021. return this.min_;
  14022. };
  14023. MDCSliderFoundation.prototype.setMin = function (min) {
  14024. if (min > this.max_) {
  14025. throw new Error('Cannot set min to be greater than the slider\'s maximum value');
  14026. }
  14027. this.min_ = min;
  14028. this.setValue_(this.value_, false, true);
  14029. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMIN, String(this.min_));
  14030. this.setupTrackMarker();
  14031. };
  14032. MDCSliderFoundation.prototype.getStep = function () {
  14033. return this.step_;
  14034. };
  14035. MDCSliderFoundation.prototype.setStep = function (step) {
  14036. if (step < 0) {
  14037. throw new Error('Step cannot be set to a negative number');
  14038. }
  14039. if (this.isDiscrete_ && (typeof step !== 'number' || step < 1)) {
  14040. step = 1;
  14041. }
  14042. this.step_ = step;
  14043. this.setValue_(this.value_, false, true);
  14044. this.setupTrackMarker();
  14045. };
  14046. MDCSliderFoundation.prototype.isDisabled = function () {
  14047. return this.disabled_;
  14048. };
  14049. MDCSliderFoundation.prototype.setDisabled = function (disabled) {
  14050. this.disabled_ = disabled;
  14051. this.toggleClass_(constants_1.cssClasses.DISABLED, this.disabled_);
  14052. if (this.disabled_) {
  14053. this.savedTabIndex_ = this.adapter_.getTabIndex();
  14054. this.adapter_.setAttribute(constants_1.strings.ARIA_DISABLED, 'true');
  14055. this.adapter_.removeAttribute('tabindex');
  14056. } else {
  14057. this.adapter_.removeAttribute(constants_1.strings.ARIA_DISABLED);
  14058. if (!isNaN(this.savedTabIndex_)) {
  14059. this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_));
  14060. }
  14061. }
  14062. };
  14063. /**
  14064. * Called when the user starts interacting with the slider
  14065. */
  14066. MDCSliderFoundation.prototype.handleDown_ = function (downEvent) {
  14067. var _this = this;
  14068. if (this.disabled_) {
  14069. return;
  14070. }
  14071. this.preventFocusState_ = true;
  14072. this.setInTransit_(!this.handlingThumbTargetEvt_);
  14073. this.handlingThumbTargetEvt_ = false;
  14074. this.setActive_(true);
  14075. var moveHandler = function moveHandler(moveEvent) {
  14076. _this.handleMove_(moveEvent);
  14077. };
  14078. var moveEventType = MOVE_EVENT_MAP[downEvent.type];
  14079. // Note: upHandler is [de]registered on ALL potential pointer-related release event types, since some browsers
  14080. // do not always fire these consistently in pairs.
  14081. // (See https://github.com/material-components/material-components-web/issues/1192)
  14082. var upHandler = function upHandler() {
  14083. _this.handleUp_();
  14084. _this.adapter_.deregisterBodyInteractionHandler(moveEventType, moveHandler);
  14085. UP_EVENTS.forEach(function (evtName) {
  14086. return _this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler);
  14087. });
  14088. };
  14089. this.adapter_.registerBodyInteractionHandler(moveEventType, moveHandler);
  14090. UP_EVENTS.forEach(function (evtName) {
  14091. return _this.adapter_.registerBodyInteractionHandler(evtName, upHandler);
  14092. });
  14093. this.setValueFromEvt_(downEvent);
  14094. };
  14095. /**
  14096. * Called when the user moves the slider
  14097. */
  14098. MDCSliderFoundation.prototype.handleMove_ = function (evt) {
  14099. evt.preventDefault();
  14100. this.setValueFromEvt_(evt);
  14101. };
  14102. /**
  14103. * Called when the user's interaction with the slider ends
  14104. */
  14105. MDCSliderFoundation.prototype.handleUp_ = function () {
  14106. this.setActive_(false);
  14107. this.adapter_.notifyChange();
  14108. };
  14109. /**
  14110. * Returns the pageX of the event
  14111. */
  14112. MDCSliderFoundation.prototype.getPageX_ = function (evt) {
  14113. if (evt.targetTouches && evt.targetTouches.length > 0) {
  14114. return evt.targetTouches[0].pageX;
  14115. }
  14116. return evt.pageX;
  14117. };
  14118. /**
  14119. * Sets the slider value from an event
  14120. */
  14121. MDCSliderFoundation.prototype.setValueFromEvt_ = function (evt) {
  14122. var pageX = this.getPageX_(evt);
  14123. var value = this.computeValueFromPageX_(pageX);
  14124. this.setValue_(value, true);
  14125. };
  14126. /**
  14127. * Computes the new value from the pageX position
  14128. */
  14129. MDCSliderFoundation.prototype.computeValueFromPageX_ = function (pageX) {
  14130. var _a = this,
  14131. max = _a.max_,
  14132. min = _a.min_;
  14133. var xPos = pageX - this.rect_.left;
  14134. var pctComplete = xPos / this.rect_.width;
  14135. if (this.adapter_.isRTL()) {
  14136. pctComplete = 1 - pctComplete;
  14137. }
  14138. // Fit the percentage complete between the range [min,max]
  14139. // by remapping from [0, 1] to [min, min+(max-min)].
  14140. return min + pctComplete * (max - min);
  14141. };
  14142. /**
  14143. * Handles keydown events
  14144. */
  14145. MDCSliderFoundation.prototype.handleKeydown_ = function (evt) {
  14146. var keyId = this.getKeyId_(evt);
  14147. var value = this.getValueForKeyId_(keyId);
  14148. if (isNaN(value)) {
  14149. return;
  14150. }
  14151. // Prevent page from scrolling due to key presses that would normally scroll the page
  14152. evt.preventDefault();
  14153. this.adapter_.addClass(constants_1.cssClasses.FOCUS);
  14154. this.setValue_(value, true);
  14155. this.adapter_.notifyChange();
  14156. };
  14157. /**
  14158. * Returns the computed name of the event
  14159. */
  14160. MDCSliderFoundation.prototype.getKeyId_ = function (kbdEvt) {
  14161. if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) {
  14162. return KEY_IDS.ARROW_LEFT;
  14163. }
  14164. if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) {
  14165. return KEY_IDS.ARROW_RIGHT;
  14166. }
  14167. if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) {
  14168. return KEY_IDS.ARROW_UP;
  14169. }
  14170. if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) {
  14171. return KEY_IDS.ARROW_DOWN;
  14172. }
  14173. if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) {
  14174. return KEY_IDS.HOME;
  14175. }
  14176. if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) {
  14177. return KEY_IDS.END;
  14178. }
  14179. if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) {
  14180. return KEY_IDS.PAGE_UP;
  14181. }
  14182. if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) {
  14183. return KEY_IDS.PAGE_DOWN;
  14184. }
  14185. return '';
  14186. };
  14187. /**
  14188. * Computes the value given a keyboard key ID
  14189. */
  14190. MDCSliderFoundation.prototype.getValueForKeyId_ = function (keyId) {
  14191. var _a = this,
  14192. max = _a.max_,
  14193. min = _a.min_,
  14194. step = _a.step_;
  14195. var delta = step || (max - min) / 100;
  14196. var valueNeedsToBeFlipped = this.adapter_.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT);
  14197. if (valueNeedsToBeFlipped) {
  14198. delta = -delta;
  14199. }
  14200. switch (keyId) {
  14201. case KEY_IDS.ARROW_LEFT:
  14202. case KEY_IDS.ARROW_DOWN:
  14203. return this.value_ - delta;
  14204. case KEY_IDS.ARROW_RIGHT:
  14205. case KEY_IDS.ARROW_UP:
  14206. return this.value_ + delta;
  14207. case KEY_IDS.HOME:
  14208. return this.min_;
  14209. case KEY_IDS.END:
  14210. return this.max_;
  14211. case KEY_IDS.PAGE_UP:
  14212. return this.value_ + delta * constants_1.numbers.PAGE_FACTOR;
  14213. case KEY_IDS.PAGE_DOWN:
  14214. return this.value_ - delta * constants_1.numbers.PAGE_FACTOR;
  14215. default:
  14216. return NaN;
  14217. }
  14218. };
  14219. MDCSliderFoundation.prototype.handleFocus_ = function () {
  14220. if (this.preventFocusState_) {
  14221. return;
  14222. }
  14223. this.adapter_.addClass(constants_1.cssClasses.FOCUS);
  14224. };
  14225. MDCSliderFoundation.prototype.handleBlur_ = function () {
  14226. this.preventFocusState_ = false;
  14227. this.adapter_.removeClass(constants_1.cssClasses.FOCUS);
  14228. };
  14229. /**
  14230. * Sets the value of the slider
  14231. */
  14232. MDCSliderFoundation.prototype.setValue_ = function (value, shouldFireInput, force) {
  14233. if (force === void 0) {
  14234. force = false;
  14235. }
  14236. if (value === this.value_ && !force) {
  14237. return;
  14238. }
  14239. var _a = this,
  14240. min = _a.min_,
  14241. max = _a.max_;
  14242. var valueSetToBoundary = value === min || value === max;
  14243. if (this.step_ && !valueSetToBoundary) {
  14244. value = this.quantize_(value);
  14245. }
  14246. if (value < min) {
  14247. value = min;
  14248. } else if (value > max) {
  14249. value = max;
  14250. }
  14251. this.value_ = value;
  14252. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, String(this.value_));
  14253. this.updateUIForCurrentValue_();
  14254. if (shouldFireInput) {
  14255. this.adapter_.notifyInput();
  14256. if (this.isDiscrete_) {
  14257. this.adapter_.setMarkerValue(value);
  14258. }
  14259. }
  14260. };
  14261. /**
  14262. * Calculates the quantized value
  14263. */
  14264. MDCSliderFoundation.prototype.quantize_ = function (value) {
  14265. var numSteps = Math.round(value / this.step_);
  14266. return numSteps * this.step_;
  14267. };
  14268. MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function () {
  14269. var _this = this;
  14270. var _a = this,
  14271. max = _a.max_,
  14272. min = _a.min_,
  14273. value = _a.value_;
  14274. var pctComplete = (value - min) / (max - min);
  14275. var translatePx = pctComplete * this.rect_.width;
  14276. if (this.adapter_.isRTL()) {
  14277. translatePx = this.rect_.width - translatePx;
  14278. }
  14279. var transformProp = util_1.getCorrectPropertyName(window, 'transform');
  14280. var transitionendEvtName = util_1.getCorrectEventName(window, 'transitionend');
  14281. if (this.inTransit_) {
  14282. var onTransitionEnd_1 = function onTransitionEnd_1() {
  14283. _this.setInTransit_(false);
  14284. _this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  14285. };
  14286. this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  14287. }
  14288. requestAnimationFrame(function () {
  14289. // NOTE(traviskaufman): It would be nice to use calc() here,
  14290. // but IE cannot handle calcs in transforms correctly.
  14291. // See: https://goo.gl/NC2itk
  14292. // Also note that the -50% offset is used to center the slider thumb.
  14293. _this.adapter_.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)");
  14294. _this.adapter_.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
  14295. });
  14296. };
  14297. /**
  14298. * Toggles the active state of the slider
  14299. */
  14300. MDCSliderFoundation.prototype.setActive_ = function (active) {
  14301. this.active_ = active;
  14302. this.toggleClass_(constants_1.cssClasses.ACTIVE, this.active_);
  14303. };
  14304. /**
  14305. * Toggles the inTransit state of the slider
  14306. */
  14307. MDCSliderFoundation.prototype.setInTransit_ = function (inTransit) {
  14308. this.inTransit_ = inTransit;
  14309. this.toggleClass_(constants_1.cssClasses.IN_TRANSIT, this.inTransit_);
  14310. };
  14311. /**
  14312. * Conditionally adds or removes a class based on shouldBePresent
  14313. */
  14314. MDCSliderFoundation.prototype.toggleClass_ = function (className, shouldBePresent) {
  14315. if (shouldBePresent) {
  14316. this.adapter_.addClass(className);
  14317. } else {
  14318. this.adapter_.removeClass(className);
  14319. }
  14320. };
  14321. return MDCSliderFoundation;
  14322. }(foundation_1.MDCFoundation);
  14323. exports.MDCSliderFoundation = MDCSliderFoundation;
  14324. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14325. exports.default = MDCSliderFoundation;
  14326. /***/ }),
  14327. /***/ "./packages/mdc-slider/index.ts":
  14328. /*!**************************************!*\
  14329. !*** ./packages/mdc-slider/index.ts ***!
  14330. \**************************************/
  14331. /*! no static exports found */
  14332. /***/ (function(module, exports, __webpack_require__) {
  14333. "use strict";
  14334. /**
  14335. * @license
  14336. * Copyright 2019 Google Inc.
  14337. *
  14338. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14339. * of this software and associated documentation files (the "Software"), to deal
  14340. * in the Software without restriction, including without limitation the rights
  14341. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14342. * copies of the Software, and to permit persons to whom the Software is
  14343. * furnished to do so, subject to the following conditions:
  14344. *
  14345. * The above copyright notice and this permission notice shall be included in
  14346. * all copies or substantial portions of the Software.
  14347. *
  14348. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14349. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14350. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14351. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14352. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14353. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14354. * THE SOFTWARE.
  14355. */
  14356. function __export(m) {
  14357. for (var p in m) {
  14358. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14359. }
  14360. }
  14361. Object.defineProperty(exports, "__esModule", { value: true });
  14362. __export(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts"));
  14363. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"));
  14364. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"));
  14365. /***/ }),
  14366. /***/ "./packages/mdc-snackbar/component.ts":
  14367. /*!********************************************!*\
  14368. !*** ./packages/mdc-snackbar/component.ts ***!
  14369. \********************************************/
  14370. /*! no static exports found */
  14371. /***/ (function(module, exports, __webpack_require__) {
  14372. "use strict";
  14373. /**
  14374. * @license
  14375. * Copyright 2018 Google Inc.
  14376. *
  14377. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14378. * of this software and associated documentation files (the "Software"), to deal
  14379. * in the Software without restriction, including without limitation the rights
  14380. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14381. * copies of the Software, and to permit persons to whom the Software is
  14382. * furnished to do so, subject to the following conditions:
  14383. *
  14384. * The above copyright notice and this permission notice shall be included in
  14385. * all copies or substantial portions of the Software.
  14386. *
  14387. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14388. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14389. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14390. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14391. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14392. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14393. * THE SOFTWARE.
  14394. */
  14395. var __extends = this && this.__extends || function () {
  14396. var _extendStatics = function extendStatics(d, b) {
  14397. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14398. d.__proto__ = b;
  14399. } || function (d, b) {
  14400. for (var p in b) {
  14401. if (b.hasOwnProperty(p)) d[p] = b[p];
  14402. }
  14403. };
  14404. return _extendStatics(d, b);
  14405. };
  14406. return function (d, b) {
  14407. _extendStatics(d, b);
  14408. function __() {
  14409. this.constructor = d;
  14410. }
  14411. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14412. };
  14413. }();
  14414. var __importStar = this && this.__importStar || function (mod) {
  14415. if (mod && mod.__esModule) return mod;
  14416. var result = {};
  14417. if (mod != null) for (var k in mod) {
  14418. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  14419. }result["default"] = mod;
  14420. return result;
  14421. };
  14422. Object.defineProperty(exports, "__esModule", { value: true });
  14423. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  14424. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  14425. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14426. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts");
  14427. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  14428. var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR,
  14429. LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR,
  14430. ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR,
  14431. DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR,
  14432. OPENING_EVENT = constants_1.strings.OPENING_EVENT,
  14433. OPENED_EVENT = constants_1.strings.OPENED_EVENT,
  14434. CLOSING_EVENT = constants_1.strings.CLOSING_EVENT,
  14435. CLOSED_EVENT = constants_1.strings.CLOSED_EVENT;
  14436. var MDCSnackbar = /** @class */function (_super) {
  14437. __extends(MDCSnackbar, _super);
  14438. function MDCSnackbar() {
  14439. return _super !== null && _super.apply(this, arguments) || this;
  14440. }
  14441. MDCSnackbar.attachTo = function (root) {
  14442. return new MDCSnackbar(root);
  14443. };
  14444. MDCSnackbar.prototype.initialize = function (announcerFactory) {
  14445. if (announcerFactory === void 0) {
  14446. announcerFactory = function announcerFactory() {
  14447. return util.announce;
  14448. };
  14449. }
  14450. this.announce_ = announcerFactory();
  14451. };
  14452. MDCSnackbar.prototype.initialSyncWithDOM = function () {
  14453. var _this = this;
  14454. this.surfaceEl_ = this.root_.querySelector(SURFACE_SELECTOR);
  14455. this.labelEl_ = this.root_.querySelector(LABEL_SELECTOR);
  14456. this.actionEl_ = this.root_.querySelector(ACTION_SELECTOR);
  14457. this.handleKeyDown_ = function (evt) {
  14458. return _this.foundation_.handleKeyDown(evt);
  14459. };
  14460. this.handleSurfaceClick_ = function (evt) {
  14461. var target = evt.target;
  14462. if (_this.isActionButton_(target)) {
  14463. _this.foundation_.handleActionButtonClick(evt);
  14464. } else if (_this.isActionIcon_(target)) {
  14465. _this.foundation_.handleActionIconClick(evt);
  14466. }
  14467. };
  14468. this.registerKeyDownHandler_(this.handleKeyDown_);
  14469. this.registerSurfaceClickHandler_(this.handleSurfaceClick_);
  14470. };
  14471. MDCSnackbar.prototype.destroy = function () {
  14472. _super.prototype.destroy.call(this);
  14473. this.deregisterKeyDownHandler_(this.handleKeyDown_);
  14474. this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_);
  14475. };
  14476. MDCSnackbar.prototype.open = function () {
  14477. this.foundation_.open();
  14478. };
  14479. /**
  14480. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  14481. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  14482. * client-specific values may also be used if desired.
  14483. */
  14484. MDCSnackbar.prototype.close = function (reason) {
  14485. if (reason === void 0) {
  14486. reason = '';
  14487. }
  14488. this.foundation_.close(reason);
  14489. };
  14490. MDCSnackbar.prototype.getDefaultFoundation = function () {
  14491. var _this = this;
  14492. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  14493. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  14494. var adapter = {
  14495. addClass: function addClass(className) {
  14496. return _this.root_.classList.add(className);
  14497. },
  14498. announce: function announce() {
  14499. return _this.announce_(_this.labelEl_);
  14500. },
  14501. notifyClosed: function notifyClosed(reason) {
  14502. return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {});
  14503. },
  14504. notifyClosing: function notifyClosing(reason) {
  14505. return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {});
  14506. },
  14507. notifyOpened: function notifyOpened() {
  14508. return _this.emit(OPENED_EVENT, {});
  14509. },
  14510. notifyOpening: function notifyOpening() {
  14511. return _this.emit(OPENING_EVENT, {});
  14512. },
  14513. removeClass: function removeClass(className) {
  14514. return _this.root_.classList.remove(className);
  14515. }
  14516. };
  14517. return new foundation_1.MDCSnackbarFoundation(adapter);
  14518. };
  14519. Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
  14520. get: function get() {
  14521. return this.foundation_.getTimeoutMs();
  14522. },
  14523. set: function set(timeoutMs) {
  14524. this.foundation_.setTimeoutMs(timeoutMs);
  14525. },
  14526. enumerable: true,
  14527. configurable: true
  14528. });
  14529. Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
  14530. get: function get() {
  14531. return this.foundation_.getCloseOnEscape();
  14532. },
  14533. set: function set(closeOnEscape) {
  14534. this.foundation_.setCloseOnEscape(closeOnEscape);
  14535. },
  14536. enumerable: true,
  14537. configurable: true
  14538. });
  14539. Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
  14540. get: function get() {
  14541. return this.foundation_.isOpen();
  14542. },
  14543. enumerable: true,
  14544. configurable: true
  14545. });
  14546. Object.defineProperty(MDCSnackbar.prototype, "labelText", {
  14547. get: function get() {
  14548. // This property only returns null if the node is a document, DOCTYPE, or notation.
  14549. // On Element nodes, it always returns a string.
  14550. return this.labelEl_.textContent;
  14551. },
  14552. set: function set(labelText) {
  14553. this.labelEl_.textContent = labelText;
  14554. },
  14555. enumerable: true,
  14556. configurable: true
  14557. });
  14558. Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
  14559. get: function get() {
  14560. return this.actionEl_.textContent;
  14561. },
  14562. set: function set(actionButtonText) {
  14563. this.actionEl_.textContent = actionButtonText;
  14564. },
  14565. enumerable: true,
  14566. configurable: true
  14567. });
  14568. MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) {
  14569. this.listen('keydown', handler);
  14570. };
  14571. MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) {
  14572. this.unlisten('keydown', handler);
  14573. };
  14574. MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) {
  14575. this.surfaceEl_.addEventListener('click', handler);
  14576. };
  14577. MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) {
  14578. this.surfaceEl_.removeEventListener('click', handler);
  14579. };
  14580. MDCSnackbar.prototype.isActionButton_ = function (target) {
  14581. return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR));
  14582. };
  14583. MDCSnackbar.prototype.isActionIcon_ = function (target) {
  14584. return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR));
  14585. };
  14586. return MDCSnackbar;
  14587. }(component_1.MDCComponent);
  14588. exports.MDCSnackbar = MDCSnackbar;
  14589. /***/ }),
  14590. /***/ "./packages/mdc-snackbar/constants.ts":
  14591. /*!********************************************!*\
  14592. !*** ./packages/mdc-snackbar/constants.ts ***!
  14593. \********************************************/
  14594. /*! no static exports found */
  14595. /***/ (function(module, exports, __webpack_require__) {
  14596. "use strict";
  14597. /**
  14598. * @license
  14599. * Copyright 2018 Google Inc.
  14600. *
  14601. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14602. * of this software and associated documentation files (the "Software"), to deal
  14603. * in the Software without restriction, including without limitation the rights
  14604. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14605. * copies of the Software, and to permit persons to whom the Software is
  14606. * furnished to do so, subject to the following conditions:
  14607. *
  14608. * The above copyright notice and this permission notice shall be included in
  14609. * all copies or substantial portions of the Software.
  14610. *
  14611. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14612. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14613. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14614. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14615. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14616. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14617. * THE SOFTWARE.
  14618. */
  14619. Object.defineProperty(exports, "__esModule", { value: true });
  14620. var cssClasses = {
  14621. CLOSING: 'mdc-snackbar--closing',
  14622. OPEN: 'mdc-snackbar--open',
  14623. OPENING: 'mdc-snackbar--opening'
  14624. };
  14625. exports.cssClasses = cssClasses;
  14626. var strings = {
  14627. ACTION_SELECTOR: '.mdc-snackbar__action',
  14628. ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',
  14629. CLOSED_EVENT: 'MDCSnackbar:closed',
  14630. CLOSING_EVENT: 'MDCSnackbar:closing',
  14631. DISMISS_SELECTOR: '.mdc-snackbar__dismiss',
  14632. LABEL_SELECTOR: '.mdc-snackbar__label',
  14633. OPENED_EVENT: 'MDCSnackbar:opened',
  14634. OPENING_EVENT: 'MDCSnackbar:opening',
  14635. REASON_ACTION: 'action',
  14636. REASON_DISMISS: 'dismiss',
  14637. SURFACE_SELECTOR: '.mdc-snackbar__surface'
  14638. };
  14639. exports.strings = strings;
  14640. var numbers = {
  14641. DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,
  14642. MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,
  14643. MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,
  14644. // These variables need to be kept in sync with the values in _variables.scss.
  14645. SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,
  14646. SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,
  14647. /**
  14648. * Number of milliseconds to wait between temporarily clearing the label text
  14649. * in the DOM and subsequently restoring it. This is necessary to force IE 11
  14650. * to pick up the `aria-live` content change and announce it to the user.
  14651. */
  14652. ARIA_LIVE_DELAY_MS: 1000
  14653. };
  14654. exports.numbers = numbers;
  14655. /***/ }),
  14656. /***/ "./packages/mdc-snackbar/foundation.ts":
  14657. /*!*********************************************!*\
  14658. !*** ./packages/mdc-snackbar/foundation.ts ***!
  14659. \*********************************************/
  14660. /*! no static exports found */
  14661. /***/ (function(module, exports, __webpack_require__) {
  14662. "use strict";
  14663. /**
  14664. * @license
  14665. * Copyright 2018 Google Inc.
  14666. *
  14667. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14668. * of this software and associated documentation files (the "Software"), to deal
  14669. * in the Software without restriction, including without limitation the rights
  14670. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14671. * copies of the Software, and to permit persons to whom the Software is
  14672. * furnished to do so, subject to the following conditions:
  14673. *
  14674. * The above copyright notice and this permission notice shall be included in
  14675. * all copies or substantial portions of the Software.
  14676. *
  14677. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14678. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14679. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14680. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14681. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14682. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14683. * THE SOFTWARE.
  14684. */
  14685. var __extends = this && this.__extends || function () {
  14686. var _extendStatics = function extendStatics(d, b) {
  14687. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14688. d.__proto__ = b;
  14689. } || function (d, b) {
  14690. for (var p in b) {
  14691. if (b.hasOwnProperty(p)) d[p] = b[p];
  14692. }
  14693. };
  14694. return _extendStatics(d, b);
  14695. };
  14696. return function (d, b) {
  14697. _extendStatics(d, b);
  14698. function __() {
  14699. this.constructor = d;
  14700. }
  14701. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14702. };
  14703. }();
  14704. var __assign = this && this.__assign || function () {
  14705. __assign = Object.assign || function (t) {
  14706. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14707. s = arguments[i];
  14708. for (var p in s) {
  14709. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14710. }
  14711. }
  14712. return t;
  14713. };
  14714. return __assign.apply(this, arguments);
  14715. };
  14716. Object.defineProperty(exports, "__esModule", { value: true });
  14717. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  14718. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14719. var OPENING = constants_1.cssClasses.OPENING,
  14720. OPEN = constants_1.cssClasses.OPEN,
  14721. CLOSING = constants_1.cssClasses.CLOSING;
  14722. var REASON_ACTION = constants_1.strings.REASON_ACTION,
  14723. REASON_DISMISS = constants_1.strings.REASON_DISMISS;
  14724. var MDCSnackbarFoundation = /** @class */function (_super) {
  14725. __extends(MDCSnackbarFoundation, _super);
  14726. function MDCSnackbarFoundation(adapter) {
  14727. var _this = _super.call(this, __assign({}, MDCSnackbarFoundation.defaultAdapter, adapter)) || this;
  14728. _this.isOpen_ = false;
  14729. _this.animationFrame_ = 0;
  14730. _this.animationTimer_ = 0;
  14731. _this.autoDismissTimer_ = 0;
  14732. _this.autoDismissTimeoutMs_ = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
  14733. _this.closeOnEscape_ = true;
  14734. return _this;
  14735. }
  14736. Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
  14737. get: function get() {
  14738. return constants_1.cssClasses;
  14739. },
  14740. enumerable: true,
  14741. configurable: true
  14742. });
  14743. Object.defineProperty(MDCSnackbarFoundation, "strings", {
  14744. get: function get() {
  14745. return constants_1.strings;
  14746. },
  14747. enumerable: true,
  14748. configurable: true
  14749. });
  14750. Object.defineProperty(MDCSnackbarFoundation, "numbers", {
  14751. get: function get() {
  14752. return constants_1.numbers;
  14753. },
  14754. enumerable: true,
  14755. configurable: true
  14756. });
  14757. Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
  14758. get: function get() {
  14759. return {
  14760. addClass: function addClass() {
  14761. return undefined;
  14762. },
  14763. announce: function announce() {
  14764. return undefined;
  14765. },
  14766. notifyClosed: function notifyClosed() {
  14767. return undefined;
  14768. },
  14769. notifyClosing: function notifyClosing() {
  14770. return undefined;
  14771. },
  14772. notifyOpened: function notifyOpened() {
  14773. return undefined;
  14774. },
  14775. notifyOpening: function notifyOpening() {
  14776. return undefined;
  14777. },
  14778. removeClass: function removeClass() {
  14779. return undefined;
  14780. }
  14781. };
  14782. },
  14783. enumerable: true,
  14784. configurable: true
  14785. });
  14786. MDCSnackbarFoundation.prototype.destroy = function () {
  14787. this.clearAutoDismissTimer_();
  14788. cancelAnimationFrame(this.animationFrame_);
  14789. this.animationFrame_ = 0;
  14790. clearTimeout(this.animationTimer_);
  14791. this.animationTimer_ = 0;
  14792. this.adapter_.removeClass(OPENING);
  14793. this.adapter_.removeClass(OPEN);
  14794. this.adapter_.removeClass(CLOSING);
  14795. };
  14796. MDCSnackbarFoundation.prototype.open = function () {
  14797. var _this = this;
  14798. this.clearAutoDismissTimer_();
  14799. this.isOpen_ = true;
  14800. this.adapter_.notifyOpening();
  14801. this.adapter_.removeClass(CLOSING);
  14802. this.adapter_.addClass(OPENING);
  14803. this.adapter_.announce();
  14804. // Wait a frame once display is no longer "none", to establish basis for animation
  14805. this.runNextAnimationFrame_(function () {
  14806. _this.adapter_.addClass(OPEN);
  14807. _this.animationTimer_ = setTimeout(function () {
  14808. _this.handleAnimationTimerEnd_();
  14809. _this.adapter_.notifyOpened();
  14810. _this.autoDismissTimer_ = setTimeout(function () {
  14811. _this.close(REASON_DISMISS);
  14812. }, _this.getTimeoutMs());
  14813. }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
  14814. });
  14815. };
  14816. /**
  14817. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  14818. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  14819. * client-specific values may also be used if desired.
  14820. */
  14821. MDCSnackbarFoundation.prototype.close = function (reason) {
  14822. var _this = this;
  14823. if (reason === void 0) {
  14824. reason = '';
  14825. }
  14826. if (!this.isOpen_) {
  14827. // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed
  14828. return;
  14829. }
  14830. cancelAnimationFrame(this.animationFrame_);
  14831. this.animationFrame_ = 0;
  14832. this.clearAutoDismissTimer_();
  14833. this.isOpen_ = false;
  14834. this.adapter_.notifyClosing(reason);
  14835. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  14836. this.adapter_.removeClass(constants_1.cssClasses.OPEN);
  14837. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  14838. clearTimeout(this.animationTimer_);
  14839. this.animationTimer_ = setTimeout(function () {
  14840. _this.handleAnimationTimerEnd_();
  14841. _this.adapter_.notifyClosed(reason);
  14842. }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
  14843. };
  14844. MDCSnackbarFoundation.prototype.isOpen = function () {
  14845. return this.isOpen_;
  14846. };
  14847. MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
  14848. return this.autoDismissTimeoutMs_;
  14849. };
  14850. MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
  14851. // Use shorter variable names to make the code more readable
  14852. var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
  14853. var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
  14854. if (timeoutMs <= maxValue && timeoutMs >= minValue) {
  14855. this.autoDismissTimeoutMs_ = timeoutMs;
  14856. } else {
  14857. throw new Error("timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + ", but got '" + timeoutMs + "'");
  14858. }
  14859. };
  14860. MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
  14861. return this.closeOnEscape_;
  14862. };
  14863. MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
  14864. this.closeOnEscape_ = closeOnEscape;
  14865. };
  14866. MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
  14867. var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
  14868. if (isEscapeKey && this.getCloseOnEscape()) {
  14869. this.close(REASON_DISMISS);
  14870. }
  14871. };
  14872. MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
  14873. this.close(REASON_ACTION);
  14874. };
  14875. MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
  14876. this.close(REASON_DISMISS);
  14877. };
  14878. MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () {
  14879. clearTimeout(this.autoDismissTimer_);
  14880. this.autoDismissTimer_ = 0;
  14881. };
  14882. MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () {
  14883. this.animationTimer_ = 0;
  14884. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  14885. this.adapter_.removeClass(constants_1.cssClasses.CLOSING);
  14886. };
  14887. /**
  14888. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  14889. */
  14890. MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  14891. var _this = this;
  14892. cancelAnimationFrame(this.animationFrame_);
  14893. this.animationFrame_ = requestAnimationFrame(function () {
  14894. _this.animationFrame_ = 0;
  14895. clearTimeout(_this.animationTimer_);
  14896. _this.animationTimer_ = setTimeout(callback, 0);
  14897. });
  14898. };
  14899. return MDCSnackbarFoundation;
  14900. }(foundation_1.MDCFoundation);
  14901. exports.MDCSnackbarFoundation = MDCSnackbarFoundation;
  14902. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14903. exports.default = MDCSnackbarFoundation;
  14904. /***/ }),
  14905. /***/ "./packages/mdc-snackbar/index.ts":
  14906. /*!****************************************!*\
  14907. !*** ./packages/mdc-snackbar/index.ts ***!
  14908. \****************************************/
  14909. /*! no static exports found */
  14910. /***/ (function(module, exports, __webpack_require__) {
  14911. "use strict";
  14912. /**
  14913. * @license
  14914. * Copyright 2019 Google Inc.
  14915. *
  14916. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14917. * of this software and associated documentation files (the "Software"), to deal
  14918. * in the Software without restriction, including without limitation the rights
  14919. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14920. * copies of the Software, and to permit persons to whom the Software is
  14921. * furnished to do so, subject to the following conditions:
  14922. *
  14923. * The above copyright notice and this permission notice shall be included in
  14924. * all copies or substantial portions of the Software.
  14925. *
  14926. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14927. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14928. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14929. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14930. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14931. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14932. * THE SOFTWARE.
  14933. */
  14934. function __export(m) {
  14935. for (var p in m) {
  14936. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14937. }
  14938. }
  14939. var __importStar = this && this.__importStar || function (mod) {
  14940. if (mod && mod.__esModule) return mod;
  14941. var result = {};
  14942. if (mod != null) for (var k in mod) {
  14943. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  14944. }result["default"] = mod;
  14945. return result;
  14946. };
  14947. Object.defineProperty(exports, "__esModule", { value: true });
  14948. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  14949. exports.util = util;
  14950. __export(__webpack_require__(/*! ./component */ "./packages/mdc-snackbar/component.ts"));
  14951. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"));
  14952. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"));
  14953. /***/ }),
  14954. /***/ "./packages/mdc-snackbar/util.ts":
  14955. /*!***************************************!*\
  14956. !*** ./packages/mdc-snackbar/util.ts ***!
  14957. \***************************************/
  14958. /*! no static exports found */
  14959. /***/ (function(module, exports, __webpack_require__) {
  14960. "use strict";
  14961. /**
  14962. * @license
  14963. * Copyright 2018 Google Inc.
  14964. *
  14965. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14966. * of this software and associated documentation files (the "Software"), to deal
  14967. * in the Software without restriction, including without limitation the rights
  14968. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14969. * copies of the Software, and to permit persons to whom the Software is
  14970. * furnished to do so, subject to the following conditions:
  14971. *
  14972. * The above copyright notice and this permission notice shall be included in
  14973. * all copies or substantial portions of the Software.
  14974. *
  14975. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14976. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14977. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14978. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14979. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14980. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14981. * THE SOFTWARE.
  14982. */
  14983. Object.defineProperty(exports, "__esModule", { value: true });
  14984. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14985. var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS;
  14986. var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR;
  14987. function announce(ariaEl, labelEl) {
  14988. if (labelEl === void 0) {
  14989. labelEl = ariaEl;
  14990. }
  14991. var priority = ariaEl.getAttribute('aria-live');
  14992. // Trim text to ignore `&nbsp;` (see below).
  14993. // textContent is only null if the node is a document, DOCTYPE, or notation.
  14994. var labelText = labelEl.textContent.trim();
  14995. if (!labelText || !priority) {
  14996. return;
  14997. }
  14998. // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice.
  14999. ariaEl.setAttribute('aria-live', 'off');
  15000. // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers.
  15001. // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars
  15002. // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first.
  15003. // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event,
  15004. // so screen readers won't announce the second message unless we first clear `textContent`.
  15005. //
  15006. // We have to clear the label text two different ways to make it work in all browsers and screen readers:
  15007. //
  15008. // 1. `textContent = ''` is required for IE11 + JAWS
  15009. // 2. `innerHTML = '&nbsp;'` is required for Chrome + JAWS and NVDA
  15010. //
  15011. // All other browser/screen reader combinations support both methods.
  15012. //
  15013. // The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed.
  15014. // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change.
  15015. //
  15016. // This technique has been tested in:
  15017. //
  15018. // * JAWS 2019:
  15019. // - Chrome 70
  15020. // - Firefox 60 (ESR)
  15021. // - IE 11
  15022. // * NVDA 2018:
  15023. // - Chrome 70
  15024. // - Firefox 60 (ESR)
  15025. // - IE 11
  15026. // * ChromeVox 53
  15027. labelEl.textContent = '';
  15028. labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;">&nbsp;</span>';
  15029. // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element.
  15030. // CSS generated content is normally announced by screen readers
  15031. // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/);
  15032. // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers.
  15033. labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
  15034. setTimeout(function () {
  15035. // Allow screen readers to announce changes to the DOM again.
  15036. ariaEl.setAttribute('aria-live', priority);
  15037. // Remove the message from the ::before pseudo-element.
  15038. labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
  15039. // Restore the original label text, which will be announced by screen readers.
  15040. labelEl.textContent = labelText;
  15041. }, ARIA_LIVE_DELAY_MS);
  15042. }
  15043. exports.announce = announce;
  15044. /***/ }),
  15045. /***/ "./packages/mdc-switch/component.ts":
  15046. /*!******************************************!*\
  15047. !*** ./packages/mdc-switch/component.ts ***!
  15048. \******************************************/
  15049. /*! no static exports found */
  15050. /***/ (function(module, exports, __webpack_require__) {
  15051. "use strict";
  15052. /**
  15053. * @license
  15054. * Copyright 2018 Google Inc.
  15055. *
  15056. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15057. * of this software and associated documentation files (the "Software"), to deal
  15058. * in the Software without restriction, including without limitation the rights
  15059. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15060. * copies of the Software, and to permit persons to whom the Software is
  15061. * furnished to do so, subject to the following conditions:
  15062. *
  15063. * The above copyright notice and this permission notice shall be included in
  15064. * all copies or substantial portions of the Software.
  15065. *
  15066. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15067. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15068. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15069. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15070. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15071. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15072. * THE SOFTWARE.
  15073. */
  15074. var __extends = this && this.__extends || function () {
  15075. var _extendStatics = function extendStatics(d, b) {
  15076. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15077. d.__proto__ = b;
  15078. } || function (d, b) {
  15079. for (var p in b) {
  15080. if (b.hasOwnProperty(p)) d[p] = b[p];
  15081. }
  15082. };
  15083. return _extendStatics(d, b);
  15084. };
  15085. return function (d, b) {
  15086. _extendStatics(d, b);
  15087. function __() {
  15088. this.constructor = d;
  15089. }
  15090. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15091. };
  15092. }();
  15093. var __assign = this && this.__assign || function () {
  15094. __assign = Object.assign || function (t) {
  15095. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15096. s = arguments[i];
  15097. for (var p in s) {
  15098. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15099. }
  15100. }
  15101. return t;
  15102. };
  15103. return __assign.apply(this, arguments);
  15104. };
  15105. var __read = this && this.__read || function (o, n) {
  15106. var m = typeof Symbol === "function" && o[Symbol.iterator];
  15107. if (!m) return o;
  15108. var i = m.call(o),
  15109. r,
  15110. ar = [],
  15111. e;
  15112. try {
  15113. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  15114. ar.push(r.value);
  15115. }
  15116. } catch (error) {
  15117. e = { error: error };
  15118. } finally {
  15119. try {
  15120. if (r && !r.done && (m = i["return"])) m.call(i);
  15121. } finally {
  15122. if (e) throw e.error;
  15123. }
  15124. }
  15125. return ar;
  15126. };
  15127. var __spread = this && this.__spread || function () {
  15128. for (var ar = [], i = 0; i < arguments.length; i++) {
  15129. ar = ar.concat(__read(arguments[i]));
  15130. }return ar;
  15131. };
  15132. Object.defineProperty(exports, "__esModule", { value: true });
  15133. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15134. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  15135. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  15136. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  15137. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  15138. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts");
  15139. var MDCSwitch = /** @class */function (_super) {
  15140. __extends(MDCSwitch, _super);
  15141. function MDCSwitch() {
  15142. var _this = _super !== null && _super.apply(this, arguments) || this;
  15143. _this.ripple_ = _this.createRipple_();
  15144. return _this;
  15145. }
  15146. MDCSwitch.attachTo = function (root) {
  15147. return new MDCSwitch(root);
  15148. };
  15149. MDCSwitch.prototype.destroy = function () {
  15150. _super.prototype.destroy.call(this);
  15151. this.ripple_.destroy();
  15152. this.nativeControl_.removeEventListener('change', this.changeHandler_);
  15153. };
  15154. MDCSwitch.prototype.initialSyncWithDOM = function () {
  15155. var _this = this;
  15156. this.changeHandler_ = function () {
  15157. var _a;
  15158. var args = [];
  15159. for (var _i = 0; _i < arguments.length; _i++) {
  15160. args[_i] = arguments[_i];
  15161. }
  15162. return (_a = _this.foundation_).handleChange.apply(_a, __spread(args));
  15163. };
  15164. this.nativeControl_.addEventListener('change', this.changeHandler_);
  15165. // Sometimes the checked state of the input element is saved in the history.
  15166. // The switch styling should match the checked state of the input element.
  15167. // Do an initial sync between the native control and the foundation.
  15168. this.checked = this.checked;
  15169. };
  15170. MDCSwitch.prototype.getDefaultFoundation = function () {
  15171. var _this = this;
  15172. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15173. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15174. var adapter = {
  15175. addClass: function addClass(className) {
  15176. return _this.root_.classList.add(className);
  15177. },
  15178. removeClass: function removeClass(className) {
  15179. return _this.root_.classList.remove(className);
  15180. },
  15181. setNativeControlChecked: function setNativeControlChecked(checked) {
  15182. return _this.nativeControl_.checked = checked;
  15183. },
  15184. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  15185. return _this.nativeControl_.disabled = disabled;
  15186. }
  15187. };
  15188. return new foundation_2.MDCSwitchFoundation(adapter);
  15189. };
  15190. Object.defineProperty(MDCSwitch.prototype, "ripple", {
  15191. get: function get() {
  15192. return this.ripple_;
  15193. },
  15194. enumerable: true,
  15195. configurable: true
  15196. });
  15197. Object.defineProperty(MDCSwitch.prototype, "checked", {
  15198. get: function get() {
  15199. return this.nativeControl_.checked;
  15200. },
  15201. set: function set(checked) {
  15202. this.foundation_.setChecked(checked);
  15203. },
  15204. enumerable: true,
  15205. configurable: true
  15206. });
  15207. Object.defineProperty(MDCSwitch.prototype, "disabled", {
  15208. get: function get() {
  15209. return this.nativeControl_.disabled;
  15210. },
  15211. set: function set(disabled) {
  15212. this.foundation_.setDisabled(disabled);
  15213. },
  15214. enumerable: true,
  15215. configurable: true
  15216. });
  15217. MDCSwitch.prototype.createRipple_ = function () {
  15218. var _this = this;
  15219. var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
  15220. var rippleSurface = this.root_.querySelector(RIPPLE_SURFACE_SELECTOR);
  15221. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15222. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15223. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { addClass: function addClass(className) {
  15224. return rippleSurface.classList.add(className);
  15225. }, computeBoundingRect: function computeBoundingRect() {
  15226. return rippleSurface.getBoundingClientRect();
  15227. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  15228. _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  15229. }, isSurfaceActive: function isSurfaceActive() {
  15230. return ponyfill_1.matches(_this.nativeControl_, ':active');
  15231. }, isUnbounded: function isUnbounded() {
  15232. return true;
  15233. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  15234. _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  15235. }, removeClass: function removeClass(className) {
  15236. return rippleSurface.classList.remove(className);
  15237. }, updateCssVariable: function updateCssVariable(varName, value) {
  15238. rippleSurface.style.setProperty(varName, value);
  15239. } });
  15240. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  15241. };
  15242. Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
  15243. get: function get() {
  15244. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
  15245. return this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  15246. },
  15247. enumerable: true,
  15248. configurable: true
  15249. });
  15250. return MDCSwitch;
  15251. }(component_1.MDCComponent);
  15252. exports.MDCSwitch = MDCSwitch;
  15253. /***/ }),
  15254. /***/ "./packages/mdc-switch/constants.ts":
  15255. /*!******************************************!*\
  15256. !*** ./packages/mdc-switch/constants.ts ***!
  15257. \******************************************/
  15258. /*! no static exports found */
  15259. /***/ (function(module, exports, __webpack_require__) {
  15260. "use strict";
  15261. /**
  15262. * @license
  15263. * Copyright 2018 Google Inc.
  15264. *
  15265. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15266. * of this software and associated documentation files (the "Software"), to deal
  15267. * in the Software without restriction, including without limitation the rights
  15268. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15269. * copies of the Software, and to permit persons to whom the Software is
  15270. * furnished to do so, subject to the following conditions:
  15271. *
  15272. * The above copyright notice and this permission notice shall be included in
  15273. * all copies or substantial portions of the Software.
  15274. *
  15275. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15276. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15277. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15278. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15279. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15280. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15281. * THE SOFTWARE.
  15282. */
  15283. Object.defineProperty(exports, "__esModule", { value: true });
  15284. /** CSS classes used by the switch. */
  15285. var cssClasses = {
  15286. /** Class used for a switch that is in the "checked" (on) position. */
  15287. CHECKED: 'mdc-switch--checked',
  15288. /** Class used for a switch that is disabled. */
  15289. DISABLED: 'mdc-switch--disabled'
  15290. };
  15291. exports.cssClasses = cssClasses;
  15292. /** String constants used by the switch. */
  15293. var strings = {
  15294. /** A CSS selector used to locate the native HTML control for the switch. */
  15295. NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control',
  15296. /** A CSS selector used to locate the ripple surface element for the switch. */
  15297. RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay'
  15298. };
  15299. exports.strings = strings;
  15300. /***/ }),
  15301. /***/ "./packages/mdc-switch/foundation.ts":
  15302. /*!*******************************************!*\
  15303. !*** ./packages/mdc-switch/foundation.ts ***!
  15304. \*******************************************/
  15305. /*! no static exports found */
  15306. /***/ (function(module, exports, __webpack_require__) {
  15307. "use strict";
  15308. /**
  15309. * @license
  15310. * Copyright 2018 Google Inc.
  15311. *
  15312. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15313. * of this software and associated documentation files (the "Software"), to deal
  15314. * in the Software without restriction, including without limitation the rights
  15315. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15316. * copies of the Software, and to permit persons to whom the Software is
  15317. * furnished to do so, subject to the following conditions:
  15318. *
  15319. * The above copyright notice and this permission notice shall be included in
  15320. * all copies or substantial portions of the Software.
  15321. *
  15322. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15323. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15324. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15325. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15326. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15327. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15328. * THE SOFTWARE.
  15329. */
  15330. var __extends = this && this.__extends || function () {
  15331. var _extendStatics = function extendStatics(d, b) {
  15332. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15333. d.__proto__ = b;
  15334. } || function (d, b) {
  15335. for (var p in b) {
  15336. if (b.hasOwnProperty(p)) d[p] = b[p];
  15337. }
  15338. };
  15339. return _extendStatics(d, b);
  15340. };
  15341. return function (d, b) {
  15342. _extendStatics(d, b);
  15343. function __() {
  15344. this.constructor = d;
  15345. }
  15346. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15347. };
  15348. }();
  15349. var __assign = this && this.__assign || function () {
  15350. __assign = Object.assign || function (t) {
  15351. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15352. s = arguments[i];
  15353. for (var p in s) {
  15354. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15355. }
  15356. }
  15357. return t;
  15358. };
  15359. return __assign.apply(this, arguments);
  15360. };
  15361. Object.defineProperty(exports, "__esModule", { value: true });
  15362. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  15363. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts");
  15364. var MDCSwitchFoundation = /** @class */function (_super) {
  15365. __extends(MDCSwitchFoundation, _super);
  15366. function MDCSwitchFoundation(adapter) {
  15367. return _super.call(this, __assign({}, MDCSwitchFoundation.defaultAdapter, adapter)) || this;
  15368. }
  15369. Object.defineProperty(MDCSwitchFoundation, "strings", {
  15370. /** The string constants used by the switch. */
  15371. get: function get() {
  15372. return constants_1.strings;
  15373. },
  15374. enumerable: true,
  15375. configurable: true
  15376. });
  15377. Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
  15378. /** The CSS classes used by the switch. */
  15379. get: function get() {
  15380. return constants_1.cssClasses;
  15381. },
  15382. enumerable: true,
  15383. configurable: true
  15384. });
  15385. Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
  15386. /** The default Adapter for the switch. */
  15387. get: function get() {
  15388. return {
  15389. addClass: function addClass() {
  15390. return undefined;
  15391. },
  15392. removeClass: function removeClass() {
  15393. return undefined;
  15394. },
  15395. setNativeControlChecked: function setNativeControlChecked() {
  15396. return undefined;
  15397. },
  15398. setNativeControlDisabled: function setNativeControlDisabled() {
  15399. return undefined;
  15400. }
  15401. };
  15402. },
  15403. enumerable: true,
  15404. configurable: true
  15405. });
  15406. /** Sets the checked state of the switch. */
  15407. MDCSwitchFoundation.prototype.setChecked = function (checked) {
  15408. this.adapter_.setNativeControlChecked(checked);
  15409. this.updateCheckedStyling_(checked);
  15410. };
  15411. /** Sets the disabled state of the switch. */
  15412. MDCSwitchFoundation.prototype.setDisabled = function (disabled) {
  15413. this.adapter_.setNativeControlDisabled(disabled);
  15414. if (disabled) {
  15415. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  15416. } else {
  15417. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  15418. }
  15419. };
  15420. /** Handles the change event for the switch native control. */
  15421. MDCSwitchFoundation.prototype.handleChange = function (evt) {
  15422. var nativeControl = evt.target;
  15423. this.updateCheckedStyling_(nativeControl.checked);
  15424. };
  15425. /** Updates the styling of the switch based on its checked state. */
  15426. MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) {
  15427. if (checked) {
  15428. this.adapter_.addClass(constants_1.cssClasses.CHECKED);
  15429. } else {
  15430. this.adapter_.removeClass(constants_1.cssClasses.CHECKED);
  15431. }
  15432. };
  15433. return MDCSwitchFoundation;
  15434. }(foundation_1.MDCFoundation);
  15435. exports.MDCSwitchFoundation = MDCSwitchFoundation;
  15436. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  15437. exports.default = MDCSwitchFoundation;
  15438. /***/ }),
  15439. /***/ "./packages/mdc-switch/index.ts":
  15440. /*!**************************************!*\
  15441. !*** ./packages/mdc-switch/index.ts ***!
  15442. \**************************************/
  15443. /*! no static exports found */
  15444. /***/ (function(module, exports, __webpack_require__) {
  15445. "use strict";
  15446. /**
  15447. * @license
  15448. * Copyright 2019 Google Inc.
  15449. *
  15450. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15451. * of this software and associated documentation files (the "Software"), to deal
  15452. * in the Software without restriction, including without limitation the rights
  15453. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15454. * copies of the Software, and to permit persons to whom the Software is
  15455. * furnished to do so, subject to the following conditions:
  15456. *
  15457. * The above copyright notice and this permission notice shall be included in
  15458. * all copies or substantial portions of the Software.
  15459. *
  15460. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15461. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15462. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15463. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15464. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15465. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15466. * THE SOFTWARE.
  15467. */
  15468. function __export(m) {
  15469. for (var p in m) {
  15470. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  15471. }
  15472. }
  15473. Object.defineProperty(exports, "__esModule", { value: true });
  15474. __export(__webpack_require__(/*! ./component */ "./packages/mdc-switch/component.ts"));
  15475. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"));
  15476. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"));
  15477. /***/ }),
  15478. /***/ "./packages/mdc-tab-bar/component.ts":
  15479. /*!*******************************************!*\
  15480. !*** ./packages/mdc-tab-bar/component.ts ***!
  15481. \*******************************************/
  15482. /*! no static exports found */
  15483. /***/ (function(module, exports, __webpack_require__) {
  15484. "use strict";
  15485. /**
  15486. * @license
  15487. * Copyright 2018 Google Inc.
  15488. *
  15489. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15490. * of this software and associated documentation files (the "Software"), to deal
  15491. * in the Software without restriction, including without limitation the rights
  15492. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15493. * copies of the Software, and to permit persons to whom the Software is
  15494. * furnished to do so, subject to the following conditions:
  15495. *
  15496. * The above copyright notice and this permission notice shall be included in
  15497. * all copies or substantial portions of the Software.
  15498. *
  15499. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15500. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15501. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15502. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15503. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15504. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15505. * THE SOFTWARE.
  15506. */
  15507. var __extends = this && this.__extends || function () {
  15508. var _extendStatics = function extendStatics(d, b) {
  15509. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15510. d.__proto__ = b;
  15511. } || function (d, b) {
  15512. for (var p in b) {
  15513. if (b.hasOwnProperty(p)) d[p] = b[p];
  15514. }
  15515. };
  15516. return _extendStatics(d, b);
  15517. };
  15518. return function (d, b) {
  15519. _extendStatics(d, b);
  15520. function __() {
  15521. this.constructor = d;
  15522. }
  15523. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15524. };
  15525. }();
  15526. Object.defineProperty(exports, "__esModule", { value: true });
  15527. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15528. var component_2 = __webpack_require__(/*! @material/tab-scroller/component */ "./packages/mdc-tab-scroller/component.ts");
  15529. var component_3 = __webpack_require__(/*! @material/tab/component */ "./packages/mdc-tab/component.ts");
  15530. var foundation_1 = __webpack_require__(/*! @material/tab/foundation */ "./packages/mdc-tab/foundation.ts");
  15531. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts");
  15532. var strings = foundation_2.MDCTabBarFoundation.strings;
  15533. var tabIdCounter = 0;
  15534. var MDCTabBar = /** @class */function (_super) {
  15535. __extends(MDCTabBar, _super);
  15536. function MDCTabBar() {
  15537. return _super !== null && _super.apply(this, arguments) || this;
  15538. }
  15539. MDCTabBar.attachTo = function (root) {
  15540. return new MDCTabBar(root);
  15541. };
  15542. Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", {
  15543. set: function set(focusOnActivate) {
  15544. this.tabList_.forEach(function (tab) {
  15545. return tab.focusOnActivate = focusOnActivate;
  15546. });
  15547. },
  15548. enumerable: true,
  15549. configurable: true
  15550. });
  15551. Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", {
  15552. set: function set(useAutomaticActivation) {
  15553. this.foundation_.setUseAutomaticActivation(useAutomaticActivation);
  15554. },
  15555. enumerable: true,
  15556. configurable: true
  15557. });
  15558. MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {
  15559. if (tabFactory === void 0) {
  15560. tabFactory = function tabFactory(el) {
  15561. return new component_3.MDCTab(el);
  15562. };
  15563. }
  15564. if (tabScrollerFactory === void 0) {
  15565. tabScrollerFactory = function tabScrollerFactory(el) {
  15566. return new component_2.MDCTabScroller(el);
  15567. };
  15568. }
  15569. this.tabList_ = this.instantiateTabs_(tabFactory);
  15570. this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory);
  15571. };
  15572. MDCTabBar.prototype.initialSyncWithDOM = function () {
  15573. var _this = this;
  15574. this.handleTabInteraction_ = function (evt) {
  15575. return _this.foundation_.handleTabInteraction(evt);
  15576. };
  15577. this.handleKeyDown_ = function (evt) {
  15578. return _this.foundation_.handleKeyDown(evt);
  15579. };
  15580. this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  15581. this.listen('keydown', this.handleKeyDown_);
  15582. for (var i = 0; i < this.tabList_.length; i++) {
  15583. if (this.tabList_[i].active) {
  15584. this.scrollIntoView(i);
  15585. break;
  15586. }
  15587. }
  15588. };
  15589. MDCTabBar.prototype.destroy = function () {
  15590. _super.prototype.destroy.call(this);
  15591. this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  15592. this.unlisten('keydown', this.handleKeyDown_);
  15593. this.tabList_.forEach(function (tab) {
  15594. return tab.destroy();
  15595. });
  15596. if (this.tabScroller_) {
  15597. this.tabScroller_.destroy();
  15598. }
  15599. };
  15600. MDCTabBar.prototype.getDefaultFoundation = function () {
  15601. var _this = this;
  15602. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15603. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15604. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15605. var adapter = {
  15606. scrollTo: function scrollTo(scrollX) {
  15607. return _this.tabScroller_.scrollTo(scrollX);
  15608. },
  15609. incrementScroll: function incrementScroll(scrollXIncrement) {
  15610. return _this.tabScroller_.incrementScroll(scrollXIncrement);
  15611. },
  15612. getScrollPosition: function getScrollPosition() {
  15613. return _this.tabScroller_.getScrollPosition();
  15614. },
  15615. getScrollContentWidth: function getScrollContentWidth() {
  15616. return _this.tabScroller_.getScrollContentWidth();
  15617. },
  15618. getOffsetWidth: function getOffsetWidth() {
  15619. return _this.root_.offsetWidth;
  15620. },
  15621. isRTL: function isRTL() {
  15622. return window.getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  15623. },
  15624. setActiveTab: function setActiveTab(index) {
  15625. return _this.foundation_.activateTab(index);
  15626. },
  15627. activateTabAtIndex: function activateTabAtIndex(index, clientRect) {
  15628. return _this.tabList_[index].activate(clientRect);
  15629. },
  15630. deactivateTabAtIndex: function deactivateTabAtIndex(index) {
  15631. return _this.tabList_[index].deactivate();
  15632. },
  15633. focusTabAtIndex: function focusTabAtIndex(index) {
  15634. return _this.tabList_[index].focus();
  15635. },
  15636. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) {
  15637. return _this.tabList_[index].computeIndicatorClientRect();
  15638. },
  15639. getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) {
  15640. return _this.tabList_[index].computeDimensions();
  15641. },
  15642. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  15643. for (var i = 0; i < _this.tabList_.length; i++) {
  15644. if (_this.tabList_[i].active) {
  15645. return i;
  15646. }
  15647. }
  15648. return -1;
  15649. },
  15650. getFocusedTabIndex: function getFocusedTabIndex() {
  15651. var tabElements = _this.getTabElements_();
  15652. var activeElement = document.activeElement;
  15653. return tabElements.indexOf(activeElement);
  15654. },
  15655. getIndexOfTabById: function getIndexOfTabById(id) {
  15656. for (var i = 0; i < _this.tabList_.length; i++) {
  15657. if (_this.tabList_[i].id === id) {
  15658. return i;
  15659. }
  15660. }
  15661. return -1;
  15662. },
  15663. getTabListLength: function getTabListLength() {
  15664. return _this.tabList_.length;
  15665. },
  15666. notifyTabActivated: function notifyTabActivated(index) {
  15667. return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true);
  15668. }
  15669. };
  15670. // tslint:enable:object-literal-sort-keys
  15671. return new foundation_2.MDCTabBarFoundation(adapter);
  15672. };
  15673. /**
  15674. * Activates the tab at the given index
  15675. * @param index The index of the tab
  15676. */
  15677. MDCTabBar.prototype.activateTab = function (index) {
  15678. this.foundation_.activateTab(index);
  15679. };
  15680. /**
  15681. * Scrolls the tab at the given index into view
  15682. * @param index THe index of the tab
  15683. */
  15684. MDCTabBar.prototype.scrollIntoView = function (index) {
  15685. this.foundation_.scrollIntoView(index);
  15686. };
  15687. /**
  15688. * Returns all the tab elements in a nice clean array
  15689. */
  15690. MDCTabBar.prototype.getTabElements_ = function () {
  15691. return [].slice.call(this.root_.querySelectorAll(strings.TAB_SELECTOR));
  15692. };
  15693. /**
  15694. * Instantiates tab components on all child tab elements
  15695. */
  15696. MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) {
  15697. return this.getTabElements_().map(function (el) {
  15698. el.id = el.id || "mdc-tab-" + ++tabIdCounter;
  15699. return tabFactory(el);
  15700. });
  15701. };
  15702. /**
  15703. * Instantiates tab scroller component on the child tab scroller element
  15704. */
  15705. MDCTabBar.prototype.instantiateTabScroller_ = function (tabScrollerFactory) {
  15706. var tabScrollerElement = this.root_.querySelector(strings.TAB_SCROLLER_SELECTOR);
  15707. if (tabScrollerElement) {
  15708. return tabScrollerFactory(tabScrollerElement);
  15709. }
  15710. return null;
  15711. };
  15712. return MDCTabBar;
  15713. }(component_1.MDCComponent);
  15714. exports.MDCTabBar = MDCTabBar;
  15715. /***/ }),
  15716. /***/ "./packages/mdc-tab-bar/constants.ts":
  15717. /*!*******************************************!*\
  15718. !*** ./packages/mdc-tab-bar/constants.ts ***!
  15719. \*******************************************/
  15720. /*! no static exports found */
  15721. /***/ (function(module, exports, __webpack_require__) {
  15722. "use strict";
  15723. /**
  15724. * @license
  15725. * Copyright 2018 Google Inc.
  15726. *
  15727. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15728. * of this software and associated documentation files (the "Software"), to deal
  15729. * in the Software without restriction, including without limitation the rights
  15730. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15731. * copies of the Software, and to permit persons to whom the Software is
  15732. * furnished to do so, subject to the following conditions:
  15733. *
  15734. * The above copyright notice and this permission notice shall be included in
  15735. * all copies or substantial portions of the Software.
  15736. *
  15737. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15738. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15739. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15740. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15741. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15742. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15743. * THE SOFTWARE.
  15744. */
  15745. Object.defineProperty(exports, "__esModule", { value: true });
  15746. var strings = {
  15747. ARROW_LEFT_KEY: 'ArrowLeft',
  15748. ARROW_RIGHT_KEY: 'ArrowRight',
  15749. END_KEY: 'End',
  15750. ENTER_KEY: 'Enter',
  15751. HOME_KEY: 'Home',
  15752. SPACE_KEY: 'Space',
  15753. TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
  15754. TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
  15755. TAB_SELECTOR: '.mdc-tab'
  15756. };
  15757. exports.strings = strings;
  15758. var numbers = {
  15759. ARROW_LEFT_KEYCODE: 37,
  15760. ARROW_RIGHT_KEYCODE: 39,
  15761. END_KEYCODE: 35,
  15762. ENTER_KEYCODE: 13,
  15763. EXTRA_SCROLL_AMOUNT: 20,
  15764. HOME_KEYCODE: 36,
  15765. SPACE_KEYCODE: 32
  15766. };
  15767. exports.numbers = numbers;
  15768. /***/ }),
  15769. /***/ "./packages/mdc-tab-bar/foundation.ts":
  15770. /*!********************************************!*\
  15771. !*** ./packages/mdc-tab-bar/foundation.ts ***!
  15772. \********************************************/
  15773. /*! no static exports found */
  15774. /***/ (function(module, exports, __webpack_require__) {
  15775. "use strict";
  15776. /**
  15777. * @license
  15778. * Copyright 2018 Google Inc.
  15779. *
  15780. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15781. * of this software and associated documentation files (the "Software"), to deal
  15782. * in the Software without restriction, including without limitation the rights
  15783. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15784. * copies of the Software, and to permit persons to whom the Software is
  15785. * furnished to do so, subject to the following conditions:
  15786. *
  15787. * The above copyright notice and this permission notice shall be included in
  15788. * all copies or substantial portions of the Software.
  15789. *
  15790. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15791. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15792. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15793. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15794. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15795. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15796. * THE SOFTWARE.
  15797. */
  15798. var __extends = this && this.__extends || function () {
  15799. var _extendStatics = function extendStatics(d, b) {
  15800. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15801. d.__proto__ = b;
  15802. } || function (d, b) {
  15803. for (var p in b) {
  15804. if (b.hasOwnProperty(p)) d[p] = b[p];
  15805. }
  15806. };
  15807. return _extendStatics(d, b);
  15808. };
  15809. return function (d, b) {
  15810. _extendStatics(d, b);
  15811. function __() {
  15812. this.constructor = d;
  15813. }
  15814. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15815. };
  15816. }();
  15817. var __assign = this && this.__assign || function () {
  15818. __assign = Object.assign || function (t) {
  15819. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15820. s = arguments[i];
  15821. for (var p in s) {
  15822. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15823. }
  15824. }
  15825. return t;
  15826. };
  15827. return __assign.apply(this, arguments);
  15828. };
  15829. Object.defineProperty(exports, "__esModule", { value: true });
  15830. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  15831. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts");
  15832. var ACCEPTABLE_KEYS = new Set();
  15833. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  15834. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY);
  15835. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY);
  15836. ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY);
  15837. ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY);
  15838. ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY);
  15839. ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY);
  15840. var KEYCODE_MAP = new Map();
  15841. // IE11 has no support for new Map with iterable so we need to initialize this by hand
  15842. KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY);
  15843. KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY);
  15844. KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY);
  15845. KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY);
  15846. KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY);
  15847. KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY);
  15848. var MDCTabBarFoundation = /** @class */function (_super) {
  15849. __extends(MDCTabBarFoundation, _super);
  15850. function MDCTabBarFoundation(adapter) {
  15851. var _this = _super.call(this, __assign({}, MDCTabBarFoundation.defaultAdapter, adapter)) || this;
  15852. _this.useAutomaticActivation_ = false;
  15853. return _this;
  15854. }
  15855. Object.defineProperty(MDCTabBarFoundation, "strings", {
  15856. get: function get() {
  15857. return constants_1.strings;
  15858. },
  15859. enumerable: true,
  15860. configurable: true
  15861. });
  15862. Object.defineProperty(MDCTabBarFoundation, "numbers", {
  15863. get: function get() {
  15864. return constants_1.numbers;
  15865. },
  15866. enumerable: true,
  15867. configurable: true
  15868. });
  15869. Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", {
  15870. get: function get() {
  15871. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15872. return {
  15873. scrollTo: function scrollTo() {
  15874. return undefined;
  15875. },
  15876. incrementScroll: function incrementScroll() {
  15877. return undefined;
  15878. },
  15879. getScrollPosition: function getScrollPosition() {
  15880. return 0;
  15881. },
  15882. getScrollContentWidth: function getScrollContentWidth() {
  15883. return 0;
  15884. },
  15885. getOffsetWidth: function getOffsetWidth() {
  15886. return 0;
  15887. },
  15888. isRTL: function isRTL() {
  15889. return false;
  15890. },
  15891. setActiveTab: function setActiveTab() {
  15892. return undefined;
  15893. },
  15894. activateTabAtIndex: function activateTabAtIndex() {
  15895. return undefined;
  15896. },
  15897. deactivateTabAtIndex: function deactivateTabAtIndex() {
  15898. return undefined;
  15899. },
  15900. focusTabAtIndex: function focusTabAtIndex() {
  15901. return undefined;
  15902. },
  15903. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() {
  15904. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  15905. },
  15906. getTabDimensionsAtIndex: function getTabDimensionsAtIndex() {
  15907. return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
  15908. },
  15909. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  15910. return -1;
  15911. },
  15912. getFocusedTabIndex: function getFocusedTabIndex() {
  15913. return -1;
  15914. },
  15915. getIndexOfTabById: function getIndexOfTabById() {
  15916. return -1;
  15917. },
  15918. getTabListLength: function getTabListLength() {
  15919. return 0;
  15920. },
  15921. notifyTabActivated: function notifyTabActivated() {
  15922. return undefined;
  15923. }
  15924. };
  15925. // tslint:enable:object-literal-sort-keys
  15926. },
  15927. enumerable: true,
  15928. configurable: true
  15929. });
  15930. /**
  15931. * Switches between automatic and manual activation modes.
  15932. * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples.
  15933. */
  15934. MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {
  15935. this.useAutomaticActivation_ = useAutomaticActivation;
  15936. };
  15937. MDCTabBarFoundation.prototype.activateTab = function (index) {
  15938. var previousActiveIndex = this.adapter_.getPreviousActiveTabIndex();
  15939. if (!this.indexIsInRange_(index) || index === previousActiveIndex) {
  15940. return;
  15941. }
  15942. var previousClientRect;
  15943. if (previousActiveIndex !== -1) {
  15944. this.adapter_.deactivateTabAtIndex(previousActiveIndex);
  15945. previousClientRect = this.adapter_.getTabIndicatorClientRectAtIndex(previousActiveIndex);
  15946. }
  15947. this.adapter_.activateTabAtIndex(index, previousClientRect);
  15948. this.scrollIntoView(index);
  15949. this.adapter_.notifyTabActivated(index);
  15950. };
  15951. MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {
  15952. // Get the key from the event
  15953. var key = this.getKeyFromEvent_(evt);
  15954. // Early exit if the event key isn't one of the keyboard navigation keys
  15955. if (key === undefined) {
  15956. return;
  15957. }
  15958. // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple
  15959. if (!this.isActivationKey_(key)) {
  15960. evt.preventDefault();
  15961. }
  15962. if (this.useAutomaticActivation_) {
  15963. if (this.isActivationKey_(key)) {
  15964. return;
  15965. }
  15966. var index = this.determineTargetFromKey_(this.adapter_.getPreviousActiveTabIndex(), key);
  15967. this.adapter_.setActiveTab(index);
  15968. this.scrollIntoView(index);
  15969. } else {
  15970. var focusedTabIndex = this.adapter_.getFocusedTabIndex();
  15971. if (this.isActivationKey_(key)) {
  15972. this.adapter_.setActiveTab(focusedTabIndex);
  15973. } else {
  15974. var index = this.determineTargetFromKey_(focusedTabIndex, key);
  15975. this.adapter_.focusTabAtIndex(index);
  15976. this.scrollIntoView(index);
  15977. }
  15978. }
  15979. };
  15980. /**
  15981. * Handles the MDCTab:interacted event
  15982. */
  15983. MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {
  15984. this.adapter_.setActiveTab(this.adapter_.getIndexOfTabById(evt.detail.tabId));
  15985. };
  15986. /**
  15987. * Scrolls the tab at the given index into view
  15988. * @param index The tab index to make visible
  15989. */
  15990. MDCTabBarFoundation.prototype.scrollIntoView = function (index) {
  15991. // Early exit if the index is out of range
  15992. if (!this.indexIsInRange_(index)) {
  15993. return;
  15994. }
  15995. // Always scroll to 0 if scrolling to the 0th index
  15996. if (index === 0) {
  15997. return this.adapter_.scrollTo(0);
  15998. }
  15999. // Always scroll to the max value if scrolling to the Nth index
  16000. // MDCTabScroller.scrollTo() will never scroll past the max possible value
  16001. if (index === this.adapter_.getTabListLength() - 1) {
  16002. return this.adapter_.scrollTo(this.adapter_.getScrollContentWidth());
  16003. }
  16004. if (this.isRTL_()) {
  16005. return this.scrollIntoViewRTL_(index);
  16006. }
  16007. this.scrollIntoView_(index);
  16008. };
  16009. /**
  16010. * Private method for determining the index of the destination tab based on what key was pressed
  16011. * @param origin The original index from which to determine the destination
  16012. * @param key The name of the key
  16013. */
  16014. MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) {
  16015. var isRTL = this.isRTL_();
  16016. var maxIndex = this.adapter_.getTabListLength() - 1;
  16017. var shouldGoToEnd = key === constants_1.strings.END_KEY;
  16018. var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL;
  16019. var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL;
  16020. var index = origin;
  16021. if (shouldGoToEnd) {
  16022. index = maxIndex;
  16023. } else if (shouldDecrement) {
  16024. index -= 1;
  16025. } else if (shouldIncrement) {
  16026. index += 1;
  16027. } else {
  16028. index = 0;
  16029. }
  16030. if (index < 0) {
  16031. index = maxIndex;
  16032. } else if (index > maxIndex) {
  16033. index = 0;
  16034. }
  16035. return index;
  16036. };
  16037. /**
  16038. * Calculates the scroll increment that will make the tab at the given index visible
  16039. * @param index The index of the tab
  16040. * @param nextIndex The index of the next tab
  16041. * @param scrollPosition The current scroll position
  16042. * @param barWidth The width of the Tab Bar
  16043. */
  16044. MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) {
  16045. var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex);
  16046. var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
  16047. var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
  16048. var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16049. var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16050. if (nextIndex < index) {
  16051. return Math.min(leftIncrement, 0);
  16052. }
  16053. return Math.max(rightIncrement, 0);
  16054. };
  16055. /**
  16056. * Calculates the scroll increment that will make the tab at the given index visible in RTL
  16057. * @param index The index of the tab
  16058. * @param nextIndex The index of the next tab
  16059. * @param scrollPosition The current scroll position
  16060. * @param barWidth The width of the Tab Bar
  16061. * @param scrollContentWidth The width of the scroll content
  16062. */
  16063. MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {
  16064. var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex);
  16065. var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;
  16066. var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;
  16067. var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16068. var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16069. if (nextIndex > index) {
  16070. return Math.max(leftIncrement, 0);
  16071. }
  16072. return Math.min(rightIncrement, 0);
  16073. };
  16074. /**
  16075. * Determines the index of the adjacent tab closest to either edge of the Tab Bar
  16076. * @param index The index of the tab
  16077. * @param tabDimensions The dimensions of the tab
  16078. * @param scrollPosition The current scroll position
  16079. * @param barWidth The width of the tab bar
  16080. */
  16081. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) {
  16082. /**
  16083. * Tabs are laid out in the Tab Scroller like this:
  16084. *
  16085. * Scroll Position
  16086. * +---+
  16087. * | | Bar Width
  16088. * | +-----------------------------------+
  16089. * | | |
  16090. * | V V
  16091. * | +-----------------------------------+
  16092. * V | Tab Scroller |
  16093. * +------------+--------------+-------------------+
  16094. * | Tab | Tab | Tab |
  16095. * +------------+--------------+-------------------+
  16096. * | |
  16097. * +-----------------------------------+
  16098. *
  16099. * To determine the next adjacent index, we look at the Tab root left and
  16100. * Tab root right, both relative to the scroll position. If the Tab root
  16101. * left is less than 0, then we know it's out of view to the left. If the
  16102. * Tab root right minus the bar width is greater than 0, we know the Tab is
  16103. * out of view to the right. From there, we either increment or decrement
  16104. * the index.
  16105. */
  16106. var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
  16107. var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
  16108. var relativeRootDelta = relativeRootLeft + relativeRootRight;
  16109. var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
  16110. var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
  16111. if (leftEdgeIsCloser) {
  16112. return index - 1;
  16113. }
  16114. if (rightEdgeIsCloser) {
  16115. return index + 1;
  16116. }
  16117. return -1;
  16118. };
  16119. /**
  16120. * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL
  16121. * @param index The index of the tab
  16122. * @param tabDimensions The dimensions of the tab
  16123. * @param scrollPosition The current scroll position
  16124. * @param barWidth The width of the tab bar
  16125. * @param scrollContentWidth The width of the scroller content
  16126. */
  16127. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {
  16128. var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;
  16129. var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;
  16130. var rootDelta = rootLeft + rootRight;
  16131. var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;
  16132. var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;
  16133. if (leftEdgeIsCloser) {
  16134. return index + 1;
  16135. }
  16136. if (rightEdgeIsCloser) {
  16137. return index - 1;
  16138. }
  16139. return -1;
  16140. };
  16141. /**
  16142. * Returns the key associated with a keydown event
  16143. * @param evt The keydown event
  16144. */
  16145. MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) {
  16146. if (ACCEPTABLE_KEYS.has(evt.key)) {
  16147. return evt.key;
  16148. }
  16149. return KEYCODE_MAP.get(evt.keyCode);
  16150. };
  16151. MDCTabBarFoundation.prototype.isActivationKey_ = function (key) {
  16152. return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY;
  16153. };
  16154. /**
  16155. * Returns whether a given index is inclusively between the ends
  16156. * @param index The index to test
  16157. */
  16158. MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) {
  16159. return index >= 0 && index < this.adapter_.getTabListLength();
  16160. };
  16161. /**
  16162. * Returns the view's RTL property
  16163. */
  16164. MDCTabBarFoundation.prototype.isRTL_ = function () {
  16165. return this.adapter_.isRTL();
  16166. };
  16167. /**
  16168. * Scrolls the tab at the given index into view for left-to-right user agents.
  16169. * @param index The index of the tab to scroll into view
  16170. */
  16171. MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) {
  16172. var scrollPosition = this.adapter_.getScrollPosition();
  16173. var barWidth = this.adapter_.getOffsetWidth();
  16174. var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index);
  16175. var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth);
  16176. if (!this.indexIsInRange_(nextIndex)) {
  16177. return;
  16178. }
  16179. var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth);
  16180. this.adapter_.incrementScroll(scrollIncrement);
  16181. };
  16182. /**
  16183. * Scrolls the tab at the given index into view in RTL
  16184. * @param index The tab index to make visible
  16185. */
  16186. MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) {
  16187. var scrollPosition = this.adapter_.getScrollPosition();
  16188. var barWidth = this.adapter_.getOffsetWidth();
  16189. var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index);
  16190. var scrollWidth = this.adapter_.getScrollContentWidth();
  16191. var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth);
  16192. if (!this.indexIsInRange_(nextIndex)) {
  16193. return;
  16194. }
  16195. var scrollIncrement = this.calculateScrollIncrementRTL_(index, nextIndex, scrollPosition, barWidth, scrollWidth);
  16196. this.adapter_.incrementScroll(scrollIncrement);
  16197. };
  16198. return MDCTabBarFoundation;
  16199. }(foundation_1.MDCFoundation);
  16200. exports.MDCTabBarFoundation = MDCTabBarFoundation;
  16201. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16202. exports.default = MDCTabBarFoundation;
  16203. /***/ }),
  16204. /***/ "./packages/mdc-tab-bar/index.ts":
  16205. /*!***************************************!*\
  16206. !*** ./packages/mdc-tab-bar/index.ts ***!
  16207. \***************************************/
  16208. /*! no static exports found */
  16209. /***/ (function(module, exports, __webpack_require__) {
  16210. "use strict";
  16211. /**
  16212. * @license
  16213. * Copyright 2019 Google Inc.
  16214. *
  16215. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16216. * of this software and associated documentation files (the "Software"), to deal
  16217. * in the Software without restriction, including without limitation the rights
  16218. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16219. * copies of the Software, and to permit persons to whom the Software is
  16220. * furnished to do so, subject to the following conditions:
  16221. *
  16222. * The above copyright notice and this permission notice shall be included in
  16223. * all copies or substantial portions of the Software.
  16224. *
  16225. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16226. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16227. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16228. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16229. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16230. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16231. * THE SOFTWARE.
  16232. */
  16233. function __export(m) {
  16234. for (var p in m) {
  16235. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16236. }
  16237. }
  16238. Object.defineProperty(exports, "__esModule", { value: true });
  16239. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-bar/component.ts"));
  16240. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"));
  16241. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"));
  16242. /***/ }),
  16243. /***/ "./packages/mdc-tab-indicator/component.ts":
  16244. /*!*************************************************!*\
  16245. !*** ./packages/mdc-tab-indicator/component.ts ***!
  16246. \*************************************************/
  16247. /*! no static exports found */
  16248. /***/ (function(module, exports, __webpack_require__) {
  16249. "use strict";
  16250. /**
  16251. * @license
  16252. * Copyright 2018 Google Inc.
  16253. *
  16254. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16255. * of this software and associated documentation files (the "Software"), to deal
  16256. * in the Software without restriction, including without limitation the rights
  16257. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16258. * copies of the Software, and to permit persons to whom the Software is
  16259. * furnished to do so, subject to the following conditions:
  16260. *
  16261. * The above copyright notice and this permission notice shall be included in
  16262. * all copies or substantial portions of the Software.
  16263. *
  16264. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16265. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16266. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16267. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16268. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16269. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16270. * THE SOFTWARE.
  16271. */
  16272. var __extends = this && this.__extends || function () {
  16273. var _extendStatics = function extendStatics(d, b) {
  16274. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16275. d.__proto__ = b;
  16276. } || function (d, b) {
  16277. for (var p in b) {
  16278. if (b.hasOwnProperty(p)) d[p] = b[p];
  16279. }
  16280. };
  16281. return _extendStatics(d, b);
  16282. };
  16283. return function (d, b) {
  16284. _extendStatics(d, b);
  16285. function __() {
  16286. this.constructor = d;
  16287. }
  16288. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16289. };
  16290. }();
  16291. Object.defineProperty(exports, "__esModule", { value: true });
  16292. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16293. var fading_foundation_1 = __webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts");
  16294. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16295. var sliding_foundation_1 = __webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts");
  16296. var MDCTabIndicator = /** @class */function (_super) {
  16297. __extends(MDCTabIndicator, _super);
  16298. function MDCTabIndicator() {
  16299. return _super !== null && _super.apply(this, arguments) || this;
  16300. }
  16301. MDCTabIndicator.attachTo = function (root) {
  16302. return new MDCTabIndicator(root);
  16303. };
  16304. MDCTabIndicator.prototype.initialize = function () {
  16305. this.content_ = this.root_.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);
  16306. };
  16307. MDCTabIndicator.prototype.computeContentClientRect = function () {
  16308. return this.foundation_.computeContentClientRect();
  16309. };
  16310. MDCTabIndicator.prototype.getDefaultFoundation = function () {
  16311. var _this = this;
  16312. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16313. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16314. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16315. var adapter = {
  16316. addClass: function addClass(className) {
  16317. return _this.root_.classList.add(className);
  16318. },
  16319. removeClass: function removeClass(className) {
  16320. return _this.root_.classList.remove(className);
  16321. },
  16322. computeContentClientRect: function computeContentClientRect() {
  16323. return _this.content_.getBoundingClientRect();
  16324. },
  16325. setContentStyleProperty: function setContentStyleProperty(prop, value) {
  16326. return _this.content_.style.setProperty(prop, value);
  16327. }
  16328. };
  16329. // tslint:enable:object-literal-sort-keys
  16330. if (this.root_.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasses.FADE)) {
  16331. return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter);
  16332. }
  16333. // Default to the sliding indicator
  16334. return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter);
  16335. };
  16336. MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {
  16337. this.foundation_.activate(previousIndicatorClientRect);
  16338. };
  16339. MDCTabIndicator.prototype.deactivate = function () {
  16340. this.foundation_.deactivate();
  16341. };
  16342. return MDCTabIndicator;
  16343. }(component_1.MDCComponent);
  16344. exports.MDCTabIndicator = MDCTabIndicator;
  16345. /***/ }),
  16346. /***/ "./packages/mdc-tab-indicator/constants.ts":
  16347. /*!*************************************************!*\
  16348. !*** ./packages/mdc-tab-indicator/constants.ts ***!
  16349. \*************************************************/
  16350. /*! no static exports found */
  16351. /***/ (function(module, exports, __webpack_require__) {
  16352. "use strict";
  16353. /**
  16354. * @license
  16355. * Copyright 2018 Google Inc.
  16356. *
  16357. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16358. * of this software and associated documentation files (the "Software"), to deal
  16359. * in the Software without restriction, including without limitation the rights
  16360. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16361. * copies of the Software, and to permit persons to whom the Software is
  16362. * furnished to do so, subject to the following conditions:
  16363. *
  16364. * The above copyright notice and this permission notice shall be included in
  16365. * all copies or substantial portions of the Software.
  16366. *
  16367. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16368. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16369. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16370. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16371. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16372. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16373. * THE SOFTWARE.
  16374. */
  16375. Object.defineProperty(exports, "__esModule", { value: true });
  16376. var cssClasses = {
  16377. ACTIVE: 'mdc-tab-indicator--active',
  16378. FADE: 'mdc-tab-indicator--fade',
  16379. NO_TRANSITION: 'mdc-tab-indicator--no-transition'
  16380. };
  16381. exports.cssClasses = cssClasses;
  16382. var strings = {
  16383. CONTENT_SELECTOR: '.mdc-tab-indicator__content'
  16384. };
  16385. exports.strings = strings;
  16386. /***/ }),
  16387. /***/ "./packages/mdc-tab-indicator/fading-foundation.ts":
  16388. /*!*********************************************************!*\
  16389. !*** ./packages/mdc-tab-indicator/fading-foundation.ts ***!
  16390. \*********************************************************/
  16391. /*! no static exports found */
  16392. /***/ (function(module, exports, __webpack_require__) {
  16393. "use strict";
  16394. /**
  16395. * @license
  16396. * Copyright 2018 Google Inc.
  16397. *
  16398. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16399. * of this software and associated documentation files (the "Software"), to deal
  16400. * in the Software without restriction, including without limitation the rights
  16401. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16402. * copies of the Software, and to permit persons to whom the Software is
  16403. * furnished to do so, subject to the following conditions:
  16404. *
  16405. * The above copyright notice and this permission notice shall be included in
  16406. * all copies or substantial portions of the Software.
  16407. *
  16408. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16409. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16410. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16411. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16412. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16413. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16414. * THE SOFTWARE.
  16415. */
  16416. var __extends = this && this.__extends || function () {
  16417. var _extendStatics = function extendStatics(d, b) {
  16418. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16419. d.__proto__ = b;
  16420. } || function (d, b) {
  16421. for (var p in b) {
  16422. if (b.hasOwnProperty(p)) d[p] = b[p];
  16423. }
  16424. };
  16425. return _extendStatics(d, b);
  16426. };
  16427. return function (d, b) {
  16428. _extendStatics(d, b);
  16429. function __() {
  16430. this.constructor = d;
  16431. }
  16432. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16433. };
  16434. }();
  16435. Object.defineProperty(exports, "__esModule", { value: true });
  16436. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16437. /* istanbul ignore next: subclass is not a branch statement */
  16438. var MDCFadingTabIndicatorFoundation = /** @class */function (_super) {
  16439. __extends(MDCFadingTabIndicatorFoundation, _super);
  16440. function MDCFadingTabIndicatorFoundation() {
  16441. return _super !== null && _super.apply(this, arguments) || this;
  16442. }
  16443. MDCFadingTabIndicatorFoundation.prototype.activate = function () {
  16444. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16445. };
  16446. MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {
  16447. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16448. };
  16449. return MDCFadingTabIndicatorFoundation;
  16450. }(foundation_1.MDCTabIndicatorFoundation);
  16451. exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation;
  16452. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16453. exports.default = MDCFadingTabIndicatorFoundation;
  16454. /***/ }),
  16455. /***/ "./packages/mdc-tab-indicator/foundation.ts":
  16456. /*!**************************************************!*\
  16457. !*** ./packages/mdc-tab-indicator/foundation.ts ***!
  16458. \**************************************************/
  16459. /*! no static exports found */
  16460. /***/ (function(module, exports, __webpack_require__) {
  16461. "use strict";
  16462. /**
  16463. * @license
  16464. * Copyright 2018 Google Inc.
  16465. *
  16466. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16467. * of this software and associated documentation files (the "Software"), to deal
  16468. * in the Software without restriction, including without limitation the rights
  16469. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16470. * copies of the Software, and to permit persons to whom the Software is
  16471. * furnished to do so, subject to the following conditions:
  16472. *
  16473. * The above copyright notice and this permission notice shall be included in
  16474. * all copies or substantial portions of the Software.
  16475. *
  16476. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16477. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16478. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16479. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16480. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16481. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16482. * THE SOFTWARE.
  16483. */
  16484. var __extends = this && this.__extends || function () {
  16485. var _extendStatics = function extendStatics(d, b) {
  16486. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16487. d.__proto__ = b;
  16488. } || function (d, b) {
  16489. for (var p in b) {
  16490. if (b.hasOwnProperty(p)) d[p] = b[p];
  16491. }
  16492. };
  16493. return _extendStatics(d, b);
  16494. };
  16495. return function (d, b) {
  16496. _extendStatics(d, b);
  16497. function __() {
  16498. this.constructor = d;
  16499. }
  16500. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16501. };
  16502. }();
  16503. var __assign = this && this.__assign || function () {
  16504. __assign = Object.assign || function (t) {
  16505. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16506. s = arguments[i];
  16507. for (var p in s) {
  16508. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16509. }
  16510. }
  16511. return t;
  16512. };
  16513. return __assign.apply(this, arguments);
  16514. };
  16515. Object.defineProperty(exports, "__esModule", { value: true });
  16516. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  16517. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts");
  16518. var MDCTabIndicatorFoundation = /** @class */function (_super) {
  16519. __extends(MDCTabIndicatorFoundation, _super);
  16520. function MDCTabIndicatorFoundation(adapter) {
  16521. return _super.call(this, __assign({}, MDCTabIndicatorFoundation.defaultAdapter, adapter)) || this;
  16522. }
  16523. Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", {
  16524. get: function get() {
  16525. return constants_1.cssClasses;
  16526. },
  16527. enumerable: true,
  16528. configurable: true
  16529. });
  16530. Object.defineProperty(MDCTabIndicatorFoundation, "strings", {
  16531. get: function get() {
  16532. return constants_1.strings;
  16533. },
  16534. enumerable: true,
  16535. configurable: true
  16536. });
  16537. Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", {
  16538. get: function get() {
  16539. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16540. return {
  16541. addClass: function addClass() {
  16542. return undefined;
  16543. },
  16544. removeClass: function removeClass() {
  16545. return undefined;
  16546. },
  16547. computeContentClientRect: function computeContentClientRect() {
  16548. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  16549. },
  16550. setContentStyleProperty: function setContentStyleProperty() {
  16551. return undefined;
  16552. }
  16553. };
  16554. // tslint:enable:object-literal-sort-keys
  16555. },
  16556. enumerable: true,
  16557. configurable: true
  16558. });
  16559. MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {
  16560. return this.adapter_.computeContentClientRect();
  16561. };
  16562. return MDCTabIndicatorFoundation;
  16563. }(foundation_1.MDCFoundation);
  16564. exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation;
  16565. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16566. exports.default = MDCTabIndicatorFoundation;
  16567. /***/ }),
  16568. /***/ "./packages/mdc-tab-indicator/index.ts":
  16569. /*!*********************************************!*\
  16570. !*** ./packages/mdc-tab-indicator/index.ts ***!
  16571. \*********************************************/
  16572. /*! no static exports found */
  16573. /***/ (function(module, exports, __webpack_require__) {
  16574. "use strict";
  16575. /**
  16576. * @license
  16577. * Copyright 2019 Google Inc.
  16578. *
  16579. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16580. * of this software and associated documentation files (the "Software"), to deal
  16581. * in the Software without restriction, including without limitation the rights
  16582. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16583. * copies of the Software, and to permit persons to whom the Software is
  16584. * furnished to do so, subject to the following conditions:
  16585. *
  16586. * The above copyright notice and this permission notice shall be included in
  16587. * all copies or substantial portions of the Software.
  16588. *
  16589. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16590. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16591. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16592. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16593. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16594. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16595. * THE SOFTWARE.
  16596. */
  16597. function __export(m) {
  16598. for (var p in m) {
  16599. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16600. }
  16601. }
  16602. Object.defineProperty(exports, "__esModule", { value: true });
  16603. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-indicator/component.ts"));
  16604. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"));
  16605. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"));
  16606. __export(__webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"));
  16607. __export(__webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"));
  16608. /***/ }),
  16609. /***/ "./packages/mdc-tab-indicator/sliding-foundation.ts":
  16610. /*!**********************************************************!*\
  16611. !*** ./packages/mdc-tab-indicator/sliding-foundation.ts ***!
  16612. \**********************************************************/
  16613. /*! no static exports found */
  16614. /***/ (function(module, exports, __webpack_require__) {
  16615. "use strict";
  16616. /**
  16617. * @license
  16618. * Copyright 2018 Google Inc.
  16619. *
  16620. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16621. * of this software and associated documentation files (the "Software"), to deal
  16622. * in the Software without restriction, including without limitation the rights
  16623. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16624. * copies of the Software, and to permit persons to whom the Software is
  16625. * furnished to do so, subject to the following conditions:
  16626. *
  16627. * The above copyright notice and this permission notice shall be included in
  16628. * all copies or substantial portions of the Software.
  16629. *
  16630. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16631. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16632. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16633. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16634. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16635. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16636. * THE SOFTWARE.
  16637. */
  16638. var __extends = this && this.__extends || function () {
  16639. var _extendStatics = function extendStatics(d, b) {
  16640. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16641. d.__proto__ = b;
  16642. } || function (d, b) {
  16643. for (var p in b) {
  16644. if (b.hasOwnProperty(p)) d[p] = b[p];
  16645. }
  16646. };
  16647. return _extendStatics(d, b);
  16648. };
  16649. return function (d, b) {
  16650. _extendStatics(d, b);
  16651. function __() {
  16652. this.constructor = d;
  16653. }
  16654. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16655. };
  16656. }();
  16657. Object.defineProperty(exports, "__esModule", { value: true });
  16658. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16659. /* istanbul ignore next: subclass is not a branch statement */
  16660. var MDCSlidingTabIndicatorFoundation = /** @class */function (_super) {
  16661. __extends(MDCSlidingTabIndicatorFoundation, _super);
  16662. function MDCSlidingTabIndicatorFoundation() {
  16663. return _super !== null && _super.apply(this, arguments) || this;
  16664. }
  16665. MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {
  16666. // Early exit if no indicator is present to handle cases where an indicator
  16667. // may be activated without a prior indicator state
  16668. if (!previousIndicatorClientRect) {
  16669. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16670. return;
  16671. }
  16672. // This animation uses the FLIP approach. You can read more about it at the link below:
  16673. // https://aerotwist.com/blog/flip-your-animations/
  16674. // Calculate the dimensions based on the dimensions of the previous indicator
  16675. var currentClientRect = this.computeContentClientRect();
  16676. var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
  16677. var xPosition = previousIndicatorClientRect.left - currentClientRect.left;
  16678. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  16679. this.adapter_.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")");
  16680. // Force repaint before updating classes and transform to ensure the transform properly takes effect
  16681. this.computeContentClientRect();
  16682. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  16683. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16684. this.adapter_.setContentStyleProperty('transform', '');
  16685. };
  16686. MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {
  16687. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16688. };
  16689. return MDCSlidingTabIndicatorFoundation;
  16690. }(foundation_1.MDCTabIndicatorFoundation);
  16691. exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation;
  16692. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16693. exports.default = MDCSlidingTabIndicatorFoundation;
  16694. /***/ }),
  16695. /***/ "./packages/mdc-tab-scroller/component.ts":
  16696. /*!************************************************!*\
  16697. !*** ./packages/mdc-tab-scroller/component.ts ***!
  16698. \************************************************/
  16699. /*! no static exports found */
  16700. /***/ (function(module, exports, __webpack_require__) {
  16701. "use strict";
  16702. /**
  16703. * @license
  16704. * Copyright 2018 Google Inc.
  16705. *
  16706. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16707. * of this software and associated documentation files (the "Software"), to deal
  16708. * in the Software without restriction, including without limitation the rights
  16709. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16710. * copies of the Software, and to permit persons to whom the Software is
  16711. * furnished to do so, subject to the following conditions:
  16712. *
  16713. * The above copyright notice and this permission notice shall be included in
  16714. * all copies or substantial portions of the Software.
  16715. *
  16716. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16717. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16718. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16719. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16720. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16721. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16722. * THE SOFTWARE.
  16723. */
  16724. var __extends = this && this.__extends || function () {
  16725. var _extendStatics = function extendStatics(d, b) {
  16726. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16727. d.__proto__ = b;
  16728. } || function (d, b) {
  16729. for (var p in b) {
  16730. if (b.hasOwnProperty(p)) d[p] = b[p];
  16731. }
  16732. };
  16733. return _extendStatics(d, b);
  16734. };
  16735. return function (d, b) {
  16736. _extendStatics(d, b);
  16737. function __() {
  16738. this.constructor = d;
  16739. }
  16740. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16741. };
  16742. }();
  16743. var __importStar = this && this.__importStar || function (mod) {
  16744. if (mod && mod.__esModule) return mod;
  16745. var result = {};
  16746. if (mod != null) for (var k in mod) {
  16747. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  16748. }result["default"] = mod;
  16749. return result;
  16750. };
  16751. Object.defineProperty(exports, "__esModule", { value: true });
  16752. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16753. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  16754. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  16755. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts");
  16756. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  16757. var MDCTabScroller = /** @class */function (_super) {
  16758. __extends(MDCTabScroller, _super);
  16759. function MDCTabScroller() {
  16760. return _super !== null && _super.apply(this, arguments) || this;
  16761. }
  16762. MDCTabScroller.attachTo = function (root) {
  16763. return new MDCTabScroller(root);
  16764. };
  16765. MDCTabScroller.prototype.initialize = function () {
  16766. this.area_ = this.root_.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR);
  16767. this.content_ = this.root_.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);
  16768. };
  16769. MDCTabScroller.prototype.initialSyncWithDOM = function () {
  16770. var _this = this;
  16771. this.handleInteraction_ = function () {
  16772. return _this.foundation_.handleInteraction();
  16773. };
  16774. this.handleTransitionEnd_ = function (evt) {
  16775. return _this.foundation_.handleTransitionEnd(evt);
  16776. };
  16777. this.area_.addEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  16778. this.area_.addEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  16779. this.area_.addEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  16780. this.area_.addEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  16781. this.area_.addEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  16782. this.content_.addEventListener('transitionend', this.handleTransitionEnd_);
  16783. };
  16784. MDCTabScroller.prototype.destroy = function () {
  16785. _super.prototype.destroy.call(this);
  16786. this.area_.removeEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  16787. this.area_.removeEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  16788. this.area_.removeEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  16789. this.area_.removeEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  16790. this.area_.removeEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  16791. this.content_.removeEventListener('transitionend', this.handleTransitionEnd_);
  16792. };
  16793. MDCTabScroller.prototype.getDefaultFoundation = function () {
  16794. var _this = this;
  16795. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16796. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16797. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16798. var adapter = {
  16799. eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) {
  16800. return ponyfill_1.matches(evtTarget, selector);
  16801. },
  16802. addClass: function addClass(className) {
  16803. return _this.root_.classList.add(className);
  16804. },
  16805. removeClass: function removeClass(className) {
  16806. return _this.root_.classList.remove(className);
  16807. },
  16808. addScrollAreaClass: function addScrollAreaClass(className) {
  16809. return _this.area_.classList.add(className);
  16810. },
  16811. setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) {
  16812. return _this.area_.style.setProperty(prop, value);
  16813. },
  16814. setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) {
  16815. return _this.content_.style.setProperty(prop, value);
  16816. },
  16817. getScrollContentStyleValue: function getScrollContentStyleValue(propName) {
  16818. return window.getComputedStyle(_this.content_).getPropertyValue(propName);
  16819. },
  16820. setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) {
  16821. return _this.area_.scrollLeft = scrollX;
  16822. },
  16823. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  16824. return _this.area_.scrollLeft;
  16825. },
  16826. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  16827. return _this.content_.offsetWidth;
  16828. },
  16829. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  16830. return _this.area_.offsetWidth;
  16831. },
  16832. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  16833. return _this.area_.getBoundingClientRect();
  16834. },
  16835. computeScrollContentClientRect: function computeScrollContentClientRect() {
  16836. return _this.content_.getBoundingClientRect();
  16837. },
  16838. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  16839. return util.computeHorizontalScrollbarHeight(document);
  16840. }
  16841. };
  16842. // tslint:enable:object-literal-sort-keys
  16843. return new foundation_1.MDCTabScrollerFoundation(adapter);
  16844. };
  16845. /**
  16846. * Returns the current visual scroll position
  16847. */
  16848. MDCTabScroller.prototype.getScrollPosition = function () {
  16849. return this.foundation_.getScrollPosition();
  16850. };
  16851. /**
  16852. * Returns the width of the scroll content
  16853. */
  16854. MDCTabScroller.prototype.getScrollContentWidth = function () {
  16855. return this.content_.offsetWidth;
  16856. };
  16857. /**
  16858. * Increments the scroll value by the given amount
  16859. * @param scrollXIncrement The pixel value by which to increment the scroll value
  16860. */
  16861. MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {
  16862. this.foundation_.incrementScroll(scrollXIncrement);
  16863. };
  16864. /**
  16865. * Scrolls to the given pixel position
  16866. * @param scrollX The pixel value to scroll to
  16867. */
  16868. MDCTabScroller.prototype.scrollTo = function (scrollX) {
  16869. this.foundation_.scrollTo(scrollX);
  16870. };
  16871. return MDCTabScroller;
  16872. }(component_1.MDCComponent);
  16873. exports.MDCTabScroller = MDCTabScroller;
  16874. /***/ }),
  16875. /***/ "./packages/mdc-tab-scroller/constants.ts":
  16876. /*!************************************************!*\
  16877. !*** ./packages/mdc-tab-scroller/constants.ts ***!
  16878. \************************************************/
  16879. /*! no static exports found */
  16880. /***/ (function(module, exports, __webpack_require__) {
  16881. "use strict";
  16882. /**
  16883. * @license
  16884. * Copyright 2018 Google Inc.
  16885. *
  16886. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16887. * of this software and associated documentation files (the "Software"), to deal
  16888. * in the Software without restriction, including without limitation the rights
  16889. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16890. * copies of the Software, and to permit persons to whom the Software is
  16891. * furnished to do so, subject to the following conditions:
  16892. *
  16893. * The above copyright notice and this permission notice shall be included in
  16894. * all copies or substantial portions of the Software.
  16895. *
  16896. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16897. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16898. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16899. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16900. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16901. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16902. * THE SOFTWARE.
  16903. */
  16904. Object.defineProperty(exports, "__esModule", { value: true });
  16905. var cssClasses = {
  16906. ANIMATING: 'mdc-tab-scroller--animating',
  16907. SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',
  16908. SCROLL_TEST: 'mdc-tab-scroller__test'
  16909. };
  16910. exports.cssClasses = cssClasses;
  16911. var strings = {
  16912. AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',
  16913. CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content'
  16914. };
  16915. exports.strings = strings;
  16916. /***/ }),
  16917. /***/ "./packages/mdc-tab-scroller/foundation.ts":
  16918. /*!*************************************************!*\
  16919. !*** ./packages/mdc-tab-scroller/foundation.ts ***!
  16920. \*************************************************/
  16921. /*! no static exports found */
  16922. /***/ (function(module, exports, __webpack_require__) {
  16923. "use strict";
  16924. /**
  16925. * @license
  16926. * Copyright 2018 Google Inc.
  16927. *
  16928. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16929. * of this software and associated documentation files (the "Software"), to deal
  16930. * in the Software without restriction, including without limitation the rights
  16931. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16932. * copies of the Software, and to permit persons to whom the Software is
  16933. * furnished to do so, subject to the following conditions:
  16934. *
  16935. * The above copyright notice and this permission notice shall be included in
  16936. * all copies or substantial portions of the Software.
  16937. *
  16938. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16939. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16940. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16941. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16942. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16943. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16944. * THE SOFTWARE.
  16945. */
  16946. var __extends = this && this.__extends || function () {
  16947. var _extendStatics = function extendStatics(d, b) {
  16948. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16949. d.__proto__ = b;
  16950. } || function (d, b) {
  16951. for (var p in b) {
  16952. if (b.hasOwnProperty(p)) d[p] = b[p];
  16953. }
  16954. };
  16955. return _extendStatics(d, b);
  16956. };
  16957. return function (d, b) {
  16958. _extendStatics(d, b);
  16959. function __() {
  16960. this.constructor = d;
  16961. }
  16962. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16963. };
  16964. }();
  16965. var __assign = this && this.__assign || function () {
  16966. __assign = Object.assign || function (t) {
  16967. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16968. s = arguments[i];
  16969. for (var p in s) {
  16970. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16971. }
  16972. }
  16973. return t;
  16974. };
  16975. return __assign.apply(this, arguments);
  16976. };
  16977. var __read = this && this.__read || function (o, n) {
  16978. var m = typeof Symbol === "function" && o[Symbol.iterator];
  16979. if (!m) return o;
  16980. var i = m.call(o),
  16981. r,
  16982. ar = [],
  16983. e;
  16984. try {
  16985. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  16986. ar.push(r.value);
  16987. }
  16988. } catch (error) {
  16989. e = { error: error };
  16990. } finally {
  16991. try {
  16992. if (r && !r.done && (m = i["return"])) m.call(i);
  16993. } finally {
  16994. if (e) throw e.error;
  16995. }
  16996. }
  16997. return ar;
  16998. };
  16999. Object.defineProperty(exports, "__esModule", { value: true });
  17000. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  17001. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  17002. var rtl_default_scroller_1 = __webpack_require__(/*! ./rtl-default-scroller */ "./packages/mdc-tab-scroller/rtl-default-scroller.ts");
  17003. var rtl_negative_scroller_1 = __webpack_require__(/*! ./rtl-negative-scroller */ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts");
  17004. var rtl_reverse_scroller_1 = __webpack_require__(/*! ./rtl-reverse-scroller */ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts");
  17005. var MDCTabScrollerFoundation = /** @class */function (_super) {
  17006. __extends(MDCTabScrollerFoundation, _super);
  17007. function MDCTabScrollerFoundation(adapter) {
  17008. var _this = _super.call(this, __assign({}, MDCTabScrollerFoundation.defaultAdapter, adapter)) || this;
  17009. /**
  17010. * Controls whether we should handle the transitionend and interaction events during the animation.
  17011. */
  17012. _this.isAnimating_ = false;
  17013. return _this;
  17014. }
  17015. Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", {
  17016. get: function get() {
  17017. return constants_1.cssClasses;
  17018. },
  17019. enumerable: true,
  17020. configurable: true
  17021. });
  17022. Object.defineProperty(MDCTabScrollerFoundation, "strings", {
  17023. get: function get() {
  17024. return constants_1.strings;
  17025. },
  17026. enumerable: true,
  17027. configurable: true
  17028. });
  17029. Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", {
  17030. get: function get() {
  17031. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17032. return {
  17033. eventTargetMatchesSelector: function eventTargetMatchesSelector() {
  17034. return false;
  17035. },
  17036. addClass: function addClass() {
  17037. return undefined;
  17038. },
  17039. removeClass: function removeClass() {
  17040. return undefined;
  17041. },
  17042. addScrollAreaClass: function addScrollAreaClass() {
  17043. return undefined;
  17044. },
  17045. setScrollAreaStyleProperty: function setScrollAreaStyleProperty() {
  17046. return undefined;
  17047. },
  17048. setScrollContentStyleProperty: function setScrollContentStyleProperty() {
  17049. return undefined;
  17050. },
  17051. getScrollContentStyleValue: function getScrollContentStyleValue() {
  17052. return '';
  17053. },
  17054. setScrollAreaScrollLeft: function setScrollAreaScrollLeft() {
  17055. return undefined;
  17056. },
  17057. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  17058. return 0;
  17059. },
  17060. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  17061. return 0;
  17062. },
  17063. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  17064. return 0;
  17065. },
  17066. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  17067. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  17068. },
  17069. computeScrollContentClientRect: function computeScrollContentClientRect() {
  17070. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  17071. },
  17072. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  17073. return 0;
  17074. }
  17075. };
  17076. // tslint:enable:object-literal-sort-keys
  17077. },
  17078. enumerable: true,
  17079. configurable: true
  17080. });
  17081. MDCTabScrollerFoundation.prototype.init = function () {
  17082. // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll
  17083. // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs.
  17084. var horizontalScrollbarHeight = this.adapter_.computeHorizontalScrollbarHeight();
  17085. this.adapter_.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');
  17086. this.adapter_.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);
  17087. };
  17088. /**
  17089. * Computes the current visual scroll position
  17090. */
  17091. MDCTabScrollerFoundation.prototype.getScrollPosition = function () {
  17092. if (this.isRTL_()) {
  17093. return this.computeCurrentScrollPositionRTL_();
  17094. }
  17095. var currentTranslateX = this.calculateCurrentTranslateX_();
  17096. var scrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17097. return scrollLeft - currentTranslateX;
  17098. };
  17099. /**
  17100. * Handles interaction events that occur during transition
  17101. */
  17102. MDCTabScrollerFoundation.prototype.handleInteraction = function () {
  17103. // Early exit if we aren't animating
  17104. if (!this.isAnimating_) {
  17105. return;
  17106. }
  17107. // Prevent other event listeners from handling this event
  17108. this.stopScrollAnimation_();
  17109. };
  17110. /**
  17111. * Handles the transitionend event
  17112. */
  17113. MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {
  17114. // Early exit if we aren't animating or the event was triggered by a different element.
  17115. var evtTarget = evt.target;
  17116. if (!this.isAnimating_ || !this.adapter_.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {
  17117. return;
  17118. }
  17119. this.isAnimating_ = false;
  17120. this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  17121. };
  17122. /**
  17123. * Increment the scroll value by the scrollXIncrement
  17124. * @param scrollXIncrement The value by which to increment the scroll position
  17125. */
  17126. MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {
  17127. // Early exit for non-operational increment values
  17128. if (scrollXIncrement === 0) {
  17129. return;
  17130. }
  17131. if (this.isRTL_()) {
  17132. return this.incrementScrollRTL_(scrollXIncrement);
  17133. }
  17134. this.incrementScroll_(scrollXIncrement);
  17135. };
  17136. /**
  17137. * Scrolls to the given scrollX value
  17138. */
  17139. MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {
  17140. if (this.isRTL_()) {
  17141. return this.scrollToRTL_(scrollX);
  17142. }
  17143. this.scrollTo_(scrollX);
  17144. };
  17145. /**
  17146. * @return Browser-specific {@link MDCTabScrollerRTL} instance.
  17147. */
  17148. MDCTabScrollerFoundation.prototype.getRTLScroller = function () {
  17149. if (!this.rtlScrollerInstance_) {
  17150. this.rtlScrollerInstance_ = this.rtlScrollerFactory_();
  17151. }
  17152. return this.rtlScrollerInstance_;
  17153. };
  17154. /**
  17155. * @return translateX value from a CSS matrix transform function string.
  17156. */
  17157. MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () {
  17158. var transformValue = this.adapter_.getScrollContentStyleValue('transform');
  17159. // Early exit if no transform is present
  17160. if (transformValue === 'none') {
  17161. return 0;
  17162. }
  17163. // The transform value comes back as a matrix transformation in the form
  17164. // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so
  17165. // we're going to grab all the parenthesized values, strip out tx, and
  17166. // parse it.
  17167. var match = /\((.+?)\)/.exec(transformValue);
  17168. if (!match) {
  17169. return 0;
  17170. }
  17171. var matrixParams = match[1];
  17172. // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error.
  17173. // @ts-ignore These unused variables should retain their semantic names for clarity.
  17174. var _a = __read(matrixParams.split(','), 6),
  17175. a = _a[0],
  17176. b = _a[1],
  17177. c = _a[2],
  17178. d = _a[3],
  17179. tx = _a[4],
  17180. ty = _a[5];
  17181. return parseFloat(tx); // tslint:disable-line:ban
  17182. };
  17183. /**
  17184. * Calculates a safe scroll value that is > 0 and < the max scroll value
  17185. * @param scrollX The distance to scroll
  17186. */
  17187. MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) {
  17188. var edges = this.calculateScrollEdges_();
  17189. return Math.min(Math.max(edges.left, scrollX), edges.right);
  17190. };
  17191. MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () {
  17192. var translateX = this.calculateCurrentTranslateX_();
  17193. return this.getRTLScroller().getScrollPositionRTL(translateX);
  17194. };
  17195. MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () {
  17196. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17197. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17198. return {
  17199. left: 0,
  17200. right: contentWidth - rootWidth
  17201. };
  17202. };
  17203. /**
  17204. * Internal scroll method
  17205. * @param scrollX The new scroll position
  17206. */
  17207. MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) {
  17208. var currentScrollX = this.getScrollPosition();
  17209. var safeScrollX = this.clampScrollValue_(scrollX);
  17210. var scrollDelta = safeScrollX - currentScrollX;
  17211. this.animate_({
  17212. finalScrollPosition: safeScrollX,
  17213. scrollDelta: scrollDelta
  17214. });
  17215. };
  17216. /**
  17217. * Internal RTL scroll method
  17218. * @param scrollX The new scroll position
  17219. */
  17220. MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) {
  17221. var animation = this.getRTLScroller().scrollToRTL(scrollX);
  17222. this.animate_(animation);
  17223. };
  17224. /**
  17225. * Internal increment scroll method
  17226. * @param scrollX The new scroll position increment
  17227. */
  17228. MDCTabScrollerFoundation.prototype.incrementScroll_ = function (scrollX) {
  17229. var currentScrollX = this.getScrollPosition();
  17230. var targetScrollX = scrollX + currentScrollX;
  17231. var safeScrollX = this.clampScrollValue_(targetScrollX);
  17232. var scrollDelta = safeScrollX - currentScrollX;
  17233. this.animate_({
  17234. finalScrollPosition: safeScrollX,
  17235. scrollDelta: scrollDelta
  17236. });
  17237. };
  17238. /**
  17239. * Internal increment scroll RTL method
  17240. * @param scrollX The new scroll position RTL increment
  17241. */
  17242. MDCTabScrollerFoundation.prototype.incrementScrollRTL_ = function (scrollX) {
  17243. var animation = this.getRTLScroller().incrementScrollRTL(scrollX);
  17244. this.animate_(animation);
  17245. };
  17246. /**
  17247. * Animates the tab scrolling
  17248. * @param animation The animation to apply
  17249. */
  17250. MDCTabScrollerFoundation.prototype.animate_ = function (animation) {
  17251. var _this = this;
  17252. // Early exit if translateX is 0, which means there's no animation to perform
  17253. if (animation.scrollDelta === 0) {
  17254. return;
  17255. }
  17256. this.stopScrollAnimation_();
  17257. // This animation uses the FLIP approach.
  17258. // Read more here: https://aerotwist.com/blog/flip-your-animations/
  17259. this.adapter_.setScrollAreaScrollLeft(animation.finalScrollPosition);
  17260. this.adapter_.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)");
  17261. // Force repaint
  17262. this.adapter_.computeScrollAreaClientRect();
  17263. requestAnimationFrame(function () {
  17264. _this.adapter_.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  17265. _this.adapter_.setScrollContentStyleProperty('transform', 'none');
  17266. });
  17267. this.isAnimating_ = true;
  17268. };
  17269. /**
  17270. * Stops scroll animation
  17271. */
  17272. MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () {
  17273. this.isAnimating_ = false;
  17274. var currentScrollPosition = this.getAnimatingScrollPosition_();
  17275. this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  17276. this.adapter_.setScrollContentStyleProperty('transform', 'translateX(0px)');
  17277. this.adapter_.setScrollAreaScrollLeft(currentScrollPosition);
  17278. };
  17279. /**
  17280. * Gets the current scroll position during animation
  17281. */
  17282. MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () {
  17283. var currentTranslateX = this.calculateCurrentTranslateX_();
  17284. var scrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17285. if (this.isRTL_()) {
  17286. return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);
  17287. }
  17288. return scrollLeft - currentTranslateX;
  17289. };
  17290. /**
  17291. * Determines the RTL Scroller to use
  17292. */
  17293. MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () {
  17294. // Browsers have three different implementations of scrollLeft in RTL mode,
  17295. // dependent on the browser. The behavior is based off the max LTR
  17296. // scrollLeft value and 0.
  17297. //
  17298. // * Default scrolling in RTL *
  17299. // - Left-most value: 0
  17300. // - Right-most value: Max LTR scrollLeft value
  17301. //
  17302. // * Negative scrolling in RTL *
  17303. // - Left-most value: Negated max LTR scrollLeft value
  17304. // - Right-most value: 0
  17305. //
  17306. // * Reverse scrolling in RTL *
  17307. // - Left-most value: Max LTR scrollLeft value
  17308. // - Right-most value: 0
  17309. //
  17310. // We use those principles below to determine which RTL scrollLeft
  17311. // behavior is implemented in the current browser.
  17312. var initialScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17313. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft - 1);
  17314. var newScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17315. // If the newScrollLeft value is negative,then we know that the browser has
  17316. // implemented negative RTL scrolling, since all other implementations have
  17317. // only positive values.
  17318. if (newScrollLeft < 0) {
  17319. // Undo the scrollLeft test check
  17320. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft);
  17321. return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter_);
  17322. }
  17323. var rootClientRect = this.adapter_.computeScrollAreaClientRect();
  17324. var contentClientRect = this.adapter_.computeScrollContentClientRect();
  17325. var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);
  17326. // Undo the scrollLeft test check
  17327. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft);
  17328. // By calculating the clientRect of the root element and the clientRect of
  17329. // the content element, we can determine how much the scroll value changed
  17330. // when we performed the scrollLeft subtraction above.
  17331. if (rightEdgeDelta === newScrollLeft) {
  17332. return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter_);
  17333. }
  17334. return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter_);
  17335. };
  17336. MDCTabScrollerFoundation.prototype.isRTL_ = function () {
  17337. return this.adapter_.getScrollContentStyleValue('direction') === 'rtl';
  17338. };
  17339. return MDCTabScrollerFoundation;
  17340. }(foundation_1.MDCFoundation);
  17341. exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation;
  17342. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17343. exports.default = MDCTabScrollerFoundation;
  17344. /***/ }),
  17345. /***/ "./packages/mdc-tab-scroller/index.ts":
  17346. /*!********************************************!*\
  17347. !*** ./packages/mdc-tab-scroller/index.ts ***!
  17348. \********************************************/
  17349. /*! no static exports found */
  17350. /***/ (function(module, exports, __webpack_require__) {
  17351. "use strict";
  17352. /**
  17353. * @license
  17354. * Copyright 2019 Google Inc.
  17355. *
  17356. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17357. * of this software and associated documentation files (the "Software"), to deal
  17358. * in the Software without restriction, including without limitation the rights
  17359. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17360. * copies of the Software, and to permit persons to whom the Software is
  17361. * furnished to do so, subject to the following conditions:
  17362. *
  17363. * The above copyright notice and this permission notice shall be included in
  17364. * all copies or substantial portions of the Software.
  17365. *
  17366. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17367. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17368. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17369. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17370. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17371. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17372. * THE SOFTWARE.
  17373. */
  17374. function __export(m) {
  17375. for (var p in m) {
  17376. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  17377. }
  17378. }
  17379. var __importStar = this && this.__importStar || function (mod) {
  17380. if (mod && mod.__esModule) return mod;
  17381. var result = {};
  17382. if (mod != null) for (var k in mod) {
  17383. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  17384. }result["default"] = mod;
  17385. return result;
  17386. };
  17387. Object.defineProperty(exports, "__esModule", { value: true });
  17388. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  17389. exports.util = util;
  17390. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-scroller/component.ts"));
  17391. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"));
  17392. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"));
  17393. /***/ }),
  17394. /***/ "./packages/mdc-tab-scroller/rtl-default-scroller.ts":
  17395. /*!***********************************************************!*\
  17396. !*** ./packages/mdc-tab-scroller/rtl-default-scroller.ts ***!
  17397. \***********************************************************/
  17398. /*! no static exports found */
  17399. /***/ (function(module, exports, __webpack_require__) {
  17400. "use strict";
  17401. /**
  17402. * @license
  17403. * Copyright 2018 Google Inc.
  17404. *
  17405. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17406. * of this software and associated documentation files (the "Software"), to deal
  17407. * in the Software without restriction, including without limitation the rights
  17408. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17409. * copies of the Software, and to permit persons to whom the Software is
  17410. * furnished to do so, subject to the following conditions:
  17411. *
  17412. * The above copyright notice and this permission notice shall be included in
  17413. * all copies or substantial portions of the Software.
  17414. *
  17415. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17416. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17417. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17418. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17419. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17420. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17421. * THE SOFTWARE.
  17422. */
  17423. var __extends = this && this.__extends || function () {
  17424. var _extendStatics = function extendStatics(d, b) {
  17425. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17426. d.__proto__ = b;
  17427. } || function (d, b) {
  17428. for (var p in b) {
  17429. if (b.hasOwnProperty(p)) d[p] = b[p];
  17430. }
  17431. };
  17432. return _extendStatics(d, b);
  17433. };
  17434. return function (d, b) {
  17435. _extendStatics(d, b);
  17436. function __() {
  17437. this.constructor = d;
  17438. }
  17439. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17440. };
  17441. }();
  17442. Object.defineProperty(exports, "__esModule", { value: true });
  17443. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17444. var MDCTabScrollerRTLDefault = /** @class */function (_super) {
  17445. __extends(MDCTabScrollerRTLDefault, _super);
  17446. function MDCTabScrollerRTLDefault() {
  17447. return _super !== null && _super.apply(this, arguments) || this;
  17448. }
  17449. MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {
  17450. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17451. var right = this.calculateScrollEdges_().right;
  17452. // Scroll values on most browsers are ints instead of floats so we round
  17453. return Math.round(right - currentScrollLeft);
  17454. };
  17455. MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {
  17456. var edges = this.calculateScrollEdges_();
  17457. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17458. var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX);
  17459. return {
  17460. finalScrollPosition: clampedScrollLeft,
  17461. scrollDelta: clampedScrollLeft - currentScrollLeft
  17462. };
  17463. };
  17464. MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {
  17465. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17466. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  17467. return {
  17468. finalScrollPosition: clampedScrollLeft,
  17469. scrollDelta: clampedScrollLeft - currentScrollLeft
  17470. };
  17471. };
  17472. MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {
  17473. return scrollX;
  17474. };
  17475. MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () {
  17476. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17477. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17478. return {
  17479. left: 0,
  17480. right: contentWidth - rootWidth
  17481. };
  17482. };
  17483. MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) {
  17484. var edges = this.calculateScrollEdges_();
  17485. return Math.min(Math.max(edges.left, scrollX), edges.right);
  17486. };
  17487. return MDCTabScrollerRTLDefault;
  17488. }(rtl_scroller_1.MDCTabScrollerRTL);
  17489. exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault;
  17490. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17491. exports.default = MDCTabScrollerRTLDefault;
  17492. /***/ }),
  17493. /***/ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts":
  17494. /*!************************************************************!*\
  17495. !*** ./packages/mdc-tab-scroller/rtl-negative-scroller.ts ***!
  17496. \************************************************************/
  17497. /*! no static exports found */
  17498. /***/ (function(module, exports, __webpack_require__) {
  17499. "use strict";
  17500. /**
  17501. * @license
  17502. * Copyright 2018 Google Inc.
  17503. *
  17504. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17505. * of this software and associated documentation files (the "Software"), to deal
  17506. * in the Software without restriction, including without limitation the rights
  17507. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17508. * copies of the Software, and to permit persons to whom the Software is
  17509. * furnished to do so, subject to the following conditions:
  17510. *
  17511. * The above copyright notice and this permission notice shall be included in
  17512. * all copies or substantial portions of the Software.
  17513. *
  17514. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17515. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17516. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17517. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17518. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17519. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17520. * THE SOFTWARE.
  17521. */
  17522. var __extends = this && this.__extends || function () {
  17523. var _extendStatics = function extendStatics(d, b) {
  17524. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17525. d.__proto__ = b;
  17526. } || function (d, b) {
  17527. for (var p in b) {
  17528. if (b.hasOwnProperty(p)) d[p] = b[p];
  17529. }
  17530. };
  17531. return _extendStatics(d, b);
  17532. };
  17533. return function (d, b) {
  17534. _extendStatics(d, b);
  17535. function __() {
  17536. this.constructor = d;
  17537. }
  17538. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17539. };
  17540. }();
  17541. Object.defineProperty(exports, "__esModule", { value: true });
  17542. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17543. var MDCTabScrollerRTLNegative = /** @class */function (_super) {
  17544. __extends(MDCTabScrollerRTLNegative, _super);
  17545. function MDCTabScrollerRTLNegative() {
  17546. return _super !== null && _super.apply(this, arguments) || this;
  17547. }
  17548. MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {
  17549. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17550. return Math.round(translateX - currentScrollLeft);
  17551. };
  17552. MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {
  17553. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17554. var clampedScrollLeft = this.clampScrollValue_(-scrollX);
  17555. return {
  17556. finalScrollPosition: clampedScrollLeft,
  17557. scrollDelta: clampedScrollLeft - currentScrollLeft
  17558. };
  17559. };
  17560. MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {
  17561. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17562. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  17563. return {
  17564. finalScrollPosition: clampedScrollLeft,
  17565. scrollDelta: clampedScrollLeft - currentScrollLeft
  17566. };
  17567. };
  17568. MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  17569. return scrollX - translateX;
  17570. };
  17571. MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () {
  17572. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17573. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17574. return {
  17575. left: rootWidth - contentWidth,
  17576. right: 0
  17577. };
  17578. };
  17579. MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) {
  17580. var edges = this.calculateScrollEdges_();
  17581. return Math.max(Math.min(edges.right, scrollX), edges.left);
  17582. };
  17583. return MDCTabScrollerRTLNegative;
  17584. }(rtl_scroller_1.MDCTabScrollerRTL);
  17585. exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative;
  17586. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17587. exports.default = MDCTabScrollerRTLNegative;
  17588. /***/ }),
  17589. /***/ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts":
  17590. /*!***********************************************************!*\
  17591. !*** ./packages/mdc-tab-scroller/rtl-reverse-scroller.ts ***!
  17592. \***********************************************************/
  17593. /*! no static exports found */
  17594. /***/ (function(module, exports, __webpack_require__) {
  17595. "use strict";
  17596. /**
  17597. * @license
  17598. * Copyright 2018 Google Inc.
  17599. *
  17600. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17601. * of this software and associated documentation files (the "Software"), to deal
  17602. * in the Software without restriction, including without limitation the rights
  17603. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17604. * copies of the Software, and to permit persons to whom the Software is
  17605. * furnished to do so, subject to the following conditions:
  17606. *
  17607. * The above copyright notice and this permission notice shall be included in
  17608. * all copies or substantial portions of the Software.
  17609. *
  17610. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17611. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17612. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17613. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17614. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17615. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17616. * THE SOFTWARE.
  17617. */
  17618. var __extends = this && this.__extends || function () {
  17619. var _extendStatics = function extendStatics(d, b) {
  17620. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17621. d.__proto__ = b;
  17622. } || function (d, b) {
  17623. for (var p in b) {
  17624. if (b.hasOwnProperty(p)) d[p] = b[p];
  17625. }
  17626. };
  17627. return _extendStatics(d, b);
  17628. };
  17629. return function (d, b) {
  17630. _extendStatics(d, b);
  17631. function __() {
  17632. this.constructor = d;
  17633. }
  17634. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17635. };
  17636. }();
  17637. Object.defineProperty(exports, "__esModule", { value: true });
  17638. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17639. var MDCTabScrollerRTLReverse = /** @class */function (_super) {
  17640. __extends(MDCTabScrollerRTLReverse, _super);
  17641. function MDCTabScrollerRTLReverse() {
  17642. return _super !== null && _super.apply(this, arguments) || this;
  17643. }
  17644. MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {
  17645. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17646. // Scroll values on most browsers are ints instead of floats so we round
  17647. return Math.round(currentScrollLeft - translateX);
  17648. };
  17649. MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {
  17650. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17651. var clampedScrollLeft = this.clampScrollValue_(scrollX);
  17652. return {
  17653. finalScrollPosition: clampedScrollLeft,
  17654. scrollDelta: currentScrollLeft - clampedScrollLeft
  17655. };
  17656. };
  17657. MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {
  17658. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17659. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX);
  17660. return {
  17661. finalScrollPosition: clampedScrollLeft,
  17662. scrollDelta: currentScrollLeft - clampedScrollLeft
  17663. };
  17664. };
  17665. MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  17666. return scrollX + translateX;
  17667. };
  17668. MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () {
  17669. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17670. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17671. return {
  17672. left: contentWidth - rootWidth,
  17673. right: 0
  17674. };
  17675. };
  17676. MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) {
  17677. var edges = this.calculateScrollEdges_();
  17678. return Math.min(Math.max(edges.right, scrollX), edges.left);
  17679. };
  17680. return MDCTabScrollerRTLReverse;
  17681. }(rtl_scroller_1.MDCTabScrollerRTL);
  17682. exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse;
  17683. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17684. exports.default = MDCTabScrollerRTLReverse;
  17685. /***/ }),
  17686. /***/ "./packages/mdc-tab-scroller/rtl-scroller.ts":
  17687. /*!***************************************************!*\
  17688. !*** ./packages/mdc-tab-scroller/rtl-scroller.ts ***!
  17689. \***************************************************/
  17690. /*! no static exports found */
  17691. /***/ (function(module, exports, __webpack_require__) {
  17692. "use strict";
  17693. /**
  17694. * @license
  17695. * Copyright 2018 Google Inc.
  17696. *
  17697. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17698. * of this software and associated documentation files (the "Software"), to deal
  17699. * in the Software without restriction, including without limitation the rights
  17700. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17701. * copies of the Software, and to permit persons to whom the Software is
  17702. * furnished to do so, subject to the following conditions:
  17703. *
  17704. * The above copyright notice and this permission notice shall be included in
  17705. * all copies or substantial portions of the Software.
  17706. *
  17707. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17708. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17709. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17710. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17711. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17712. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17713. * THE SOFTWARE.
  17714. */
  17715. Object.defineProperty(exports, "__esModule", { value: true });
  17716. var MDCTabScrollerRTL = /** @class */function () {
  17717. function MDCTabScrollerRTL(adapter) {
  17718. this.adapter_ = adapter;
  17719. }
  17720. return MDCTabScrollerRTL;
  17721. }();
  17722. exports.MDCTabScrollerRTL = MDCTabScrollerRTL;
  17723. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17724. exports.default = MDCTabScrollerRTL;
  17725. /***/ }),
  17726. /***/ "./packages/mdc-tab-scroller/util.ts":
  17727. /*!*******************************************!*\
  17728. !*** ./packages/mdc-tab-scroller/util.ts ***!
  17729. \*******************************************/
  17730. /*! no static exports found */
  17731. /***/ (function(module, exports, __webpack_require__) {
  17732. "use strict";
  17733. /**
  17734. * @license
  17735. * Copyright 2018 Google Inc.
  17736. *
  17737. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17738. * of this software and associated documentation files (the "Software"), to deal
  17739. * in the Software without restriction, including without limitation the rights
  17740. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17741. * copies of the Software, and to permit persons to whom the Software is
  17742. * furnished to do so, subject to the following conditions:
  17743. *
  17744. * The above copyright notice and this permission notice shall be included in
  17745. * all copies or substantial portions of the Software.
  17746. *
  17747. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17748. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17749. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17750. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17751. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17752. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17753. * THE SOFTWARE.
  17754. */
  17755. Object.defineProperty(exports, "__esModule", { value: true });
  17756. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  17757. /**
  17758. * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.
  17759. */
  17760. var horizontalScrollbarHeight_;
  17761. /**
  17762. * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.
  17763. * May return 0 (e.g. on OS X browsers under default configuration).
  17764. */
  17765. function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {
  17766. if (shouldCacheResult === void 0) {
  17767. shouldCacheResult = true;
  17768. }
  17769. if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {
  17770. return horizontalScrollbarHeight_;
  17771. }
  17772. var el = documentObj.createElement('div');
  17773. el.classList.add(constants_1.cssClasses.SCROLL_TEST);
  17774. documentObj.body.appendChild(el);
  17775. var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;
  17776. documentObj.body.removeChild(el);
  17777. if (shouldCacheResult) {
  17778. horizontalScrollbarHeight_ = horizontalScrollbarHeight;
  17779. }
  17780. return horizontalScrollbarHeight;
  17781. }
  17782. exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight;
  17783. /***/ }),
  17784. /***/ "./packages/mdc-tab/component.ts":
  17785. /*!***************************************!*\
  17786. !*** ./packages/mdc-tab/component.ts ***!
  17787. \***************************************/
  17788. /*! no static exports found */
  17789. /***/ (function(module, exports, __webpack_require__) {
  17790. "use strict";
  17791. /**
  17792. * @license
  17793. * Copyright 2018 Google Inc.
  17794. *
  17795. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17796. * of this software and associated documentation files (the "Software"), to deal
  17797. * in the Software without restriction, including without limitation the rights
  17798. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17799. * copies of the Software, and to permit persons to whom the Software is
  17800. * furnished to do so, subject to the following conditions:
  17801. *
  17802. * The above copyright notice and this permission notice shall be included in
  17803. * all copies or substantial portions of the Software.
  17804. *
  17805. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17806. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17807. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17808. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17809. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17810. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17811. * THE SOFTWARE.
  17812. */
  17813. var __extends = this && this.__extends || function () {
  17814. var _extendStatics = function extendStatics(d, b) {
  17815. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17816. d.__proto__ = b;
  17817. } || function (d, b) {
  17818. for (var p in b) {
  17819. if (b.hasOwnProperty(p)) d[p] = b[p];
  17820. }
  17821. };
  17822. return _extendStatics(d, b);
  17823. };
  17824. return function (d, b) {
  17825. _extendStatics(d, b);
  17826. function __() {
  17827. this.constructor = d;
  17828. }
  17829. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17830. };
  17831. }();
  17832. var __assign = this && this.__assign || function () {
  17833. __assign = Object.assign || function (t) {
  17834. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17835. s = arguments[i];
  17836. for (var p in s) {
  17837. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17838. }
  17839. }
  17840. return t;
  17841. };
  17842. return __assign.apply(this, arguments);
  17843. };
  17844. Object.defineProperty(exports, "__esModule", { value: true });
  17845. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  17846. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  17847. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  17848. var component_3 = __webpack_require__(/*! @material/tab-indicator/component */ "./packages/mdc-tab-indicator/component.ts");
  17849. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts");
  17850. var MDCTab = /** @class */function (_super) {
  17851. __extends(MDCTab, _super);
  17852. function MDCTab() {
  17853. return _super !== null && _super.apply(this, arguments) || this;
  17854. }
  17855. MDCTab.attachTo = function (root) {
  17856. return new MDCTab(root);
  17857. };
  17858. MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {
  17859. if (rippleFactory === void 0) {
  17860. rippleFactory = function rippleFactory(el, foundation) {
  17861. return new component_2.MDCRipple(el, foundation);
  17862. };
  17863. }
  17864. if (tabIndicatorFactory === void 0) {
  17865. tabIndicatorFactory = function tabIndicatorFactory(el) {
  17866. return new component_3.MDCTabIndicator(el);
  17867. };
  17868. }
  17869. this.id = this.root_.id;
  17870. var rippleSurface = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.RIPPLE_SELECTOR);
  17871. var rippleAdapter = __assign({}, component_2.MDCRipple.createAdapter(this), { addClass: function addClass(className) {
  17872. return rippleSurface.classList.add(className);
  17873. }, removeClass: function removeClass(className) {
  17874. return rippleSurface.classList.remove(className);
  17875. }, updateCssVariable: function updateCssVariable(varName, value) {
  17876. return rippleSurface.style.setProperty(varName, value);
  17877. } });
  17878. var rippleFoundation = new foundation_1.MDCRippleFoundation(rippleAdapter);
  17879. this.ripple_ = rippleFactory(this.root_, rippleFoundation);
  17880. var tabIndicatorElement = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);
  17881. this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement);
  17882. this.content_ = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR);
  17883. };
  17884. MDCTab.prototype.initialSyncWithDOM = function () {
  17885. var _this = this;
  17886. this.handleClick_ = function () {
  17887. return _this.foundation_.handleClick();
  17888. };
  17889. this.listen('click', this.handleClick_);
  17890. };
  17891. MDCTab.prototype.destroy = function () {
  17892. this.unlisten('click', this.handleClick_);
  17893. this.ripple_.destroy();
  17894. _super.prototype.destroy.call(this);
  17895. };
  17896. MDCTab.prototype.getDefaultFoundation = function () {
  17897. var _this = this;
  17898. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  17899. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  17900. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17901. var adapter = {
  17902. setAttr: function setAttr(attr, value) {
  17903. return _this.root_.setAttribute(attr, value);
  17904. },
  17905. addClass: function addClass(className) {
  17906. return _this.root_.classList.add(className);
  17907. },
  17908. removeClass: function removeClass(className) {
  17909. return _this.root_.classList.remove(className);
  17910. },
  17911. hasClass: function hasClass(className) {
  17912. return _this.root_.classList.contains(className);
  17913. },
  17914. activateIndicator: function activateIndicator(previousIndicatorClientRect) {
  17915. return _this.tabIndicator_.activate(previousIndicatorClientRect);
  17916. },
  17917. deactivateIndicator: function deactivateIndicator() {
  17918. return _this.tabIndicator_.deactivate();
  17919. },
  17920. notifyInteracted: function notifyInteracted() {
  17921. return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */);
  17922. },
  17923. getOffsetLeft: function getOffsetLeft() {
  17924. return _this.root_.offsetLeft;
  17925. },
  17926. getOffsetWidth: function getOffsetWidth() {
  17927. return _this.root_.offsetWidth;
  17928. },
  17929. getContentOffsetLeft: function getContentOffsetLeft() {
  17930. return _this.content_.offsetLeft;
  17931. },
  17932. getContentOffsetWidth: function getContentOffsetWidth() {
  17933. return _this.content_.offsetWidth;
  17934. },
  17935. focus: function focus() {
  17936. return _this.root_.focus();
  17937. }
  17938. };
  17939. // tslint:enable:object-literal-sort-keys
  17940. return new foundation_2.MDCTabFoundation(adapter);
  17941. };
  17942. Object.defineProperty(MDCTab.prototype, "active", {
  17943. /**
  17944. * Getter for the active state of the tab
  17945. */
  17946. get: function get() {
  17947. return this.foundation_.isActive();
  17948. },
  17949. enumerable: true,
  17950. configurable: true
  17951. });
  17952. Object.defineProperty(MDCTab.prototype, "focusOnActivate", {
  17953. set: function set(focusOnActivate) {
  17954. this.foundation_.setFocusOnActivate(focusOnActivate);
  17955. },
  17956. enumerable: true,
  17957. configurable: true
  17958. });
  17959. /**
  17960. * Activates the tab
  17961. */
  17962. MDCTab.prototype.activate = function (computeIndicatorClientRect) {
  17963. this.foundation_.activate(computeIndicatorClientRect);
  17964. };
  17965. /**
  17966. * Deactivates the tab
  17967. */
  17968. MDCTab.prototype.deactivate = function () {
  17969. this.foundation_.deactivate();
  17970. };
  17971. /**
  17972. * Returns the indicator's client rect
  17973. */
  17974. MDCTab.prototype.computeIndicatorClientRect = function () {
  17975. return this.tabIndicator_.computeContentClientRect();
  17976. };
  17977. MDCTab.prototype.computeDimensions = function () {
  17978. return this.foundation_.computeDimensions();
  17979. };
  17980. /**
  17981. * Focuses the tab
  17982. */
  17983. MDCTab.prototype.focus = function () {
  17984. this.root_.focus();
  17985. };
  17986. return MDCTab;
  17987. }(component_1.MDCComponent);
  17988. exports.MDCTab = MDCTab;
  17989. /***/ }),
  17990. /***/ "./packages/mdc-tab/constants.ts":
  17991. /*!***************************************!*\
  17992. !*** ./packages/mdc-tab/constants.ts ***!
  17993. \***************************************/
  17994. /*! no static exports found */
  17995. /***/ (function(module, exports, __webpack_require__) {
  17996. "use strict";
  17997. /**
  17998. * @license
  17999. * Copyright 2018 Google Inc.
  18000. *
  18001. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18002. * of this software and associated documentation files (the "Software"), to deal
  18003. * in the Software without restriction, including without limitation the rights
  18004. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18005. * copies of the Software, and to permit persons to whom the Software is
  18006. * furnished to do so, subject to the following conditions:
  18007. *
  18008. * The above copyright notice and this permission notice shall be included in
  18009. * all copies or substantial portions of the Software.
  18010. *
  18011. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18012. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18013. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18014. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18015. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18016. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18017. * THE SOFTWARE.
  18018. */
  18019. Object.defineProperty(exports, "__esModule", { value: true });
  18020. var cssClasses = {
  18021. ACTIVE: 'mdc-tab--active'
  18022. };
  18023. exports.cssClasses = cssClasses;
  18024. var strings = {
  18025. ARIA_SELECTED: 'aria-selected',
  18026. CONTENT_SELECTOR: '.mdc-tab__content',
  18027. INTERACTED_EVENT: 'MDCTab:interacted',
  18028. RIPPLE_SELECTOR: '.mdc-tab__ripple',
  18029. TABINDEX: 'tabIndex',
  18030. TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator'
  18031. };
  18032. exports.strings = strings;
  18033. /***/ }),
  18034. /***/ "./packages/mdc-tab/foundation.ts":
  18035. /*!****************************************!*\
  18036. !*** ./packages/mdc-tab/foundation.ts ***!
  18037. \****************************************/
  18038. /*! no static exports found */
  18039. /***/ (function(module, exports, __webpack_require__) {
  18040. "use strict";
  18041. /**
  18042. * @license
  18043. * Copyright 2018 Google Inc.
  18044. *
  18045. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18046. * of this software and associated documentation files (the "Software"), to deal
  18047. * in the Software without restriction, including without limitation the rights
  18048. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18049. * copies of the Software, and to permit persons to whom the Software is
  18050. * furnished to do so, subject to the following conditions:
  18051. *
  18052. * The above copyright notice and this permission notice shall be included in
  18053. * all copies or substantial portions of the Software.
  18054. *
  18055. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18056. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18057. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18058. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18059. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18060. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18061. * THE SOFTWARE.
  18062. */
  18063. var __extends = this && this.__extends || function () {
  18064. var _extendStatics = function extendStatics(d, b) {
  18065. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18066. d.__proto__ = b;
  18067. } || function (d, b) {
  18068. for (var p in b) {
  18069. if (b.hasOwnProperty(p)) d[p] = b[p];
  18070. }
  18071. };
  18072. return _extendStatics(d, b);
  18073. };
  18074. return function (d, b) {
  18075. _extendStatics(d, b);
  18076. function __() {
  18077. this.constructor = d;
  18078. }
  18079. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18080. };
  18081. }();
  18082. var __assign = this && this.__assign || function () {
  18083. __assign = Object.assign || function (t) {
  18084. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18085. s = arguments[i];
  18086. for (var p in s) {
  18087. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18088. }
  18089. }
  18090. return t;
  18091. };
  18092. return __assign.apply(this, arguments);
  18093. };
  18094. Object.defineProperty(exports, "__esModule", { value: true });
  18095. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18096. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts");
  18097. var MDCTabFoundation = /** @class */function (_super) {
  18098. __extends(MDCTabFoundation, _super);
  18099. function MDCTabFoundation(adapter) {
  18100. var _this = _super.call(this, __assign({}, MDCTabFoundation.defaultAdapter, adapter)) || this;
  18101. _this.focusOnActivate_ = true;
  18102. return _this;
  18103. }
  18104. Object.defineProperty(MDCTabFoundation, "cssClasses", {
  18105. get: function get() {
  18106. return constants_1.cssClasses;
  18107. },
  18108. enumerable: true,
  18109. configurable: true
  18110. });
  18111. Object.defineProperty(MDCTabFoundation, "strings", {
  18112. get: function get() {
  18113. return constants_1.strings;
  18114. },
  18115. enumerable: true,
  18116. configurable: true
  18117. });
  18118. Object.defineProperty(MDCTabFoundation, "defaultAdapter", {
  18119. get: function get() {
  18120. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18121. return {
  18122. addClass: function addClass() {
  18123. return undefined;
  18124. },
  18125. removeClass: function removeClass() {
  18126. return undefined;
  18127. },
  18128. hasClass: function hasClass() {
  18129. return false;
  18130. },
  18131. setAttr: function setAttr() {
  18132. return undefined;
  18133. },
  18134. activateIndicator: function activateIndicator() {
  18135. return undefined;
  18136. },
  18137. deactivateIndicator: function deactivateIndicator() {
  18138. return undefined;
  18139. },
  18140. notifyInteracted: function notifyInteracted() {
  18141. return undefined;
  18142. },
  18143. getOffsetLeft: function getOffsetLeft() {
  18144. return 0;
  18145. },
  18146. getOffsetWidth: function getOffsetWidth() {
  18147. return 0;
  18148. },
  18149. getContentOffsetLeft: function getContentOffsetLeft() {
  18150. return 0;
  18151. },
  18152. getContentOffsetWidth: function getContentOffsetWidth() {
  18153. return 0;
  18154. },
  18155. focus: function focus() {
  18156. return undefined;
  18157. }
  18158. };
  18159. // tslint:enable:object-literal-sort-keys
  18160. },
  18161. enumerable: true,
  18162. configurable: true
  18163. });
  18164. MDCTabFoundation.prototype.handleClick = function () {
  18165. // It's up to the parent component to keep track of the active Tab and
  18166. // ensure we don't activate a Tab that's already active.
  18167. this.adapter_.notifyInteracted();
  18168. };
  18169. MDCTabFoundation.prototype.isActive = function () {
  18170. return this.adapter_.hasClass(constants_1.cssClasses.ACTIVE);
  18171. };
  18172. /**
  18173. * Sets whether the tab should focus itself when activated
  18174. */
  18175. MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {
  18176. this.focusOnActivate_ = focusOnActivate;
  18177. };
  18178. /**
  18179. * Activates the Tab
  18180. */
  18181. MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {
  18182. this.adapter_.addClass(constants_1.cssClasses.ACTIVE);
  18183. this.adapter_.setAttr(constants_1.strings.ARIA_SELECTED, 'true');
  18184. this.adapter_.setAttr(constants_1.strings.TABINDEX, '0');
  18185. this.adapter_.activateIndicator(previousIndicatorClientRect);
  18186. if (this.focusOnActivate_) {
  18187. this.adapter_.focus();
  18188. }
  18189. };
  18190. /**
  18191. * Deactivates the Tab
  18192. */
  18193. MDCTabFoundation.prototype.deactivate = function () {
  18194. // Early exit
  18195. if (!this.isActive()) {
  18196. return;
  18197. }
  18198. this.adapter_.removeClass(constants_1.cssClasses.ACTIVE);
  18199. this.adapter_.setAttr(constants_1.strings.ARIA_SELECTED, 'false');
  18200. this.adapter_.setAttr(constants_1.strings.TABINDEX, '-1');
  18201. this.adapter_.deactivateIndicator();
  18202. };
  18203. /**
  18204. * Returns the dimensions of the Tab
  18205. */
  18206. MDCTabFoundation.prototype.computeDimensions = function () {
  18207. var rootWidth = this.adapter_.getOffsetWidth();
  18208. var rootLeft = this.adapter_.getOffsetLeft();
  18209. var contentWidth = this.adapter_.getContentOffsetWidth();
  18210. var contentLeft = this.adapter_.getContentOffsetLeft();
  18211. return {
  18212. contentLeft: rootLeft + contentLeft,
  18213. contentRight: rootLeft + contentLeft + contentWidth,
  18214. rootLeft: rootLeft,
  18215. rootRight: rootLeft + rootWidth
  18216. };
  18217. };
  18218. return MDCTabFoundation;
  18219. }(foundation_1.MDCFoundation);
  18220. exports.MDCTabFoundation = MDCTabFoundation;
  18221. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18222. exports.default = MDCTabFoundation;
  18223. /***/ }),
  18224. /***/ "./packages/mdc-tab/index.ts":
  18225. /*!***********************************!*\
  18226. !*** ./packages/mdc-tab/index.ts ***!
  18227. \***********************************/
  18228. /*! no static exports found */
  18229. /***/ (function(module, exports, __webpack_require__) {
  18230. "use strict";
  18231. /**
  18232. * @license
  18233. * Copyright 2019 Google Inc.
  18234. *
  18235. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18236. * of this software and associated documentation files (the "Software"), to deal
  18237. * in the Software without restriction, including without limitation the rights
  18238. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18239. * copies of the Software, and to permit persons to whom the Software is
  18240. * furnished to do so, subject to the following conditions:
  18241. *
  18242. * The above copyright notice and this permission notice shall be included in
  18243. * all copies or substantial portions of the Software.
  18244. *
  18245. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18246. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18247. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18248. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18249. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18250. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18251. * THE SOFTWARE.
  18252. */
  18253. function __export(m) {
  18254. for (var p in m) {
  18255. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  18256. }
  18257. }
  18258. Object.defineProperty(exports, "__esModule", { value: true });
  18259. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab/component.ts"));
  18260. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"));
  18261. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"));
  18262. /***/ }),
  18263. /***/ "./packages/mdc-textfield/character-counter/component.ts":
  18264. /*!***************************************************************!*\
  18265. !*** ./packages/mdc-textfield/character-counter/component.ts ***!
  18266. \***************************************************************/
  18267. /*! no static exports found */
  18268. /***/ (function(module, exports, __webpack_require__) {
  18269. "use strict";
  18270. /**
  18271. * @license
  18272. * Copyright 2019 Google Inc.
  18273. *
  18274. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18275. * of this software and associated documentation files (the "Software"), to deal
  18276. * in the Software without restriction, including without limitation the rights
  18277. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18278. * copies of the Software, and to permit persons to whom the Software is
  18279. * furnished to do so, subject to the following conditions:
  18280. *
  18281. * The above copyright notice and this permission notice shall be included in
  18282. * all copies or substantial portions of the Software.
  18283. *
  18284. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18285. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18286. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18287. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18288. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18289. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18290. * THE SOFTWARE.
  18291. */
  18292. var __extends = this && this.__extends || function () {
  18293. var _extendStatics = function extendStatics(d, b) {
  18294. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18295. d.__proto__ = b;
  18296. } || function (d, b) {
  18297. for (var p in b) {
  18298. if (b.hasOwnProperty(p)) d[p] = b[p];
  18299. }
  18300. };
  18301. return _extendStatics(d, b);
  18302. };
  18303. return function (d, b) {
  18304. _extendStatics(d, b);
  18305. function __() {
  18306. this.constructor = d;
  18307. }
  18308. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18309. };
  18310. }();
  18311. Object.defineProperty(exports, "__esModule", { value: true });
  18312. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18313. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  18314. var MDCTextFieldCharacterCounter = /** @class */function (_super) {
  18315. __extends(MDCTextFieldCharacterCounter, _super);
  18316. function MDCTextFieldCharacterCounter() {
  18317. return _super !== null && _super.apply(this, arguments) || this;
  18318. }
  18319. MDCTextFieldCharacterCounter.attachTo = function (root) {
  18320. return new MDCTextFieldCharacterCounter(root);
  18321. };
  18322. Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundation", {
  18323. get: function get() {
  18324. return this.foundation_;
  18325. },
  18326. enumerable: true,
  18327. configurable: true
  18328. });
  18329. MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
  18330. var _this = this;
  18331. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18332. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18333. var adapter = {
  18334. setContent: function setContent(content) {
  18335. _this.root_.textContent = content;
  18336. }
  18337. };
  18338. return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
  18339. };
  18340. return MDCTextFieldCharacterCounter;
  18341. }(component_1.MDCComponent);
  18342. exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
  18343. /***/ }),
  18344. /***/ "./packages/mdc-textfield/character-counter/constants.ts":
  18345. /*!***************************************************************!*\
  18346. !*** ./packages/mdc-textfield/character-counter/constants.ts ***!
  18347. \***************************************************************/
  18348. /*! no static exports found */
  18349. /***/ (function(module, exports, __webpack_require__) {
  18350. "use strict";
  18351. /**
  18352. * @license
  18353. * Copyright 2019 Google Inc.
  18354. *
  18355. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18356. * of this software and associated documentation files (the "Software"), to deal
  18357. * in the Software without restriction, including without limitation the rights
  18358. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18359. * copies of the Software, and to permit persons to whom the Software is
  18360. * furnished to do so, subject to the following conditions:
  18361. *
  18362. * The above copyright notice and this permission notice shall be included in
  18363. * all copies or substantial portions of the Software.
  18364. *
  18365. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18366. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18367. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18368. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18369. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18370. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18371. * THE SOFTWARE.
  18372. */
  18373. Object.defineProperty(exports, "__esModule", { value: true });
  18374. var cssClasses = {
  18375. ROOT: 'mdc-text-field-character-counter'
  18376. };
  18377. exports.cssClasses = cssClasses;
  18378. var strings = {
  18379. ROOT_SELECTOR: "." + cssClasses.ROOT
  18380. };
  18381. exports.strings = strings;
  18382. /***/ }),
  18383. /***/ "./packages/mdc-textfield/character-counter/foundation.ts":
  18384. /*!****************************************************************!*\
  18385. !*** ./packages/mdc-textfield/character-counter/foundation.ts ***!
  18386. \****************************************************************/
  18387. /*! no static exports found */
  18388. /***/ (function(module, exports, __webpack_require__) {
  18389. "use strict";
  18390. /**
  18391. * @license
  18392. * Copyright 2019 Google Inc.
  18393. *
  18394. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18395. * of this software and associated documentation files (the "Software"), to deal
  18396. * in the Software without restriction, including without limitation the rights
  18397. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18398. * copies of the Software, and to permit persons to whom the Software is
  18399. * furnished to do so, subject to the following conditions:
  18400. *
  18401. * The above copyright notice and this permission notice shall be included in
  18402. * all copies or substantial portions of the Software.
  18403. *
  18404. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18405. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18406. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18407. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18408. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18409. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18410. * THE SOFTWARE.
  18411. */
  18412. var __extends = this && this.__extends || function () {
  18413. var _extendStatics = function extendStatics(d, b) {
  18414. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18415. d.__proto__ = b;
  18416. } || function (d, b) {
  18417. for (var p in b) {
  18418. if (b.hasOwnProperty(p)) d[p] = b[p];
  18419. }
  18420. };
  18421. return _extendStatics(d, b);
  18422. };
  18423. return function (d, b) {
  18424. _extendStatics(d, b);
  18425. function __() {
  18426. this.constructor = d;
  18427. }
  18428. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18429. };
  18430. }();
  18431. var __assign = this && this.__assign || function () {
  18432. __assign = Object.assign || function (t) {
  18433. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18434. s = arguments[i];
  18435. for (var p in s) {
  18436. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18437. }
  18438. }
  18439. return t;
  18440. };
  18441. return __assign.apply(this, arguments);
  18442. };
  18443. Object.defineProperty(exports, "__esModule", { value: true });
  18444. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18445. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  18446. var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) {
  18447. __extends(MDCTextFieldCharacterCounterFoundation, _super);
  18448. function MDCTextFieldCharacterCounterFoundation(adapter) {
  18449. return _super.call(this, __assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter, adapter)) || this;
  18450. }
  18451. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
  18452. get: function get() {
  18453. return constants_1.cssClasses;
  18454. },
  18455. enumerable: true,
  18456. configurable: true
  18457. });
  18458. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
  18459. get: function get() {
  18460. return constants_1.strings;
  18461. },
  18462. enumerable: true,
  18463. configurable: true
  18464. });
  18465. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
  18466. /**
  18467. * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
  18468. */
  18469. get: function get() {
  18470. return {
  18471. setContent: function setContent() {
  18472. return undefined;
  18473. }
  18474. };
  18475. },
  18476. enumerable: true,
  18477. configurable: true
  18478. });
  18479. MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
  18480. currentLength = Math.min(currentLength, maxLength);
  18481. this.adapter_.setContent(currentLength + " / " + maxLength);
  18482. };
  18483. return MDCTextFieldCharacterCounterFoundation;
  18484. }(foundation_1.MDCFoundation);
  18485. exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
  18486. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18487. exports.default = MDCTextFieldCharacterCounterFoundation;
  18488. /***/ }),
  18489. /***/ "./packages/mdc-textfield/character-counter/index.ts":
  18490. /*!***********************************************************!*\
  18491. !*** ./packages/mdc-textfield/character-counter/index.ts ***!
  18492. \***********************************************************/
  18493. /*! no static exports found */
  18494. /***/ (function(module, exports, __webpack_require__) {
  18495. "use strict";
  18496. /**
  18497. * @license
  18498. * Copyright 2019 Google Inc.
  18499. *
  18500. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18501. * of this software and associated documentation files (the "Software"), to deal
  18502. * in the Software without restriction, including without limitation the rights
  18503. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18504. * copies of the Software, and to permit persons to whom the Software is
  18505. * furnished to do so, subject to the following conditions:
  18506. *
  18507. * The above copyright notice and this permission notice shall be included in
  18508. * all copies or substantial portions of the Software.
  18509. *
  18510. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18511. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18512. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18513. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18514. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18515. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18516. * THE SOFTWARE.
  18517. */
  18518. function __export(m) {
  18519. for (var p in m) {
  18520. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  18521. }
  18522. }
  18523. Object.defineProperty(exports, "__esModule", { value: true });
  18524. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"));
  18525. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"));
  18526. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  18527. exports.characterCountCssClasses = constants_1.cssClasses;
  18528. exports.characterCountStrings = constants_1.strings;
  18529. /***/ }),
  18530. /***/ "./packages/mdc-textfield/component.ts":
  18531. /*!*********************************************!*\
  18532. !*** ./packages/mdc-textfield/component.ts ***!
  18533. \*********************************************/
  18534. /*! no static exports found */
  18535. /***/ (function(module, exports, __webpack_require__) {
  18536. "use strict";
  18537. /**
  18538. * @license
  18539. * Copyright 2016 Google Inc.
  18540. *
  18541. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18542. * of this software and associated documentation files (the "Software"), to deal
  18543. * in the Software without restriction, including without limitation the rights
  18544. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18545. * copies of the Software, and to permit persons to whom the Software is
  18546. * furnished to do so, subject to the following conditions:
  18547. *
  18548. * The above copyright notice and this permission notice shall be included in
  18549. * all copies or substantial portions of the Software.
  18550. *
  18551. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18552. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18553. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18554. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18555. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18556. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18557. * THE SOFTWARE.
  18558. */
  18559. var __extends = this && this.__extends || function () {
  18560. var _extendStatics = function extendStatics(d, b) {
  18561. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18562. d.__proto__ = b;
  18563. } || function (d, b) {
  18564. for (var p in b) {
  18565. if (b.hasOwnProperty(p)) d[p] = b[p];
  18566. }
  18567. };
  18568. return _extendStatics(d, b);
  18569. };
  18570. return function (d, b) {
  18571. _extendStatics(d, b);
  18572. function __() {
  18573. this.constructor = d;
  18574. }
  18575. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18576. };
  18577. }();
  18578. var __assign = this && this.__assign || function () {
  18579. __assign = Object.assign || function (t) {
  18580. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18581. s = arguments[i];
  18582. for (var p in s) {
  18583. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18584. }
  18585. }
  18586. return t;
  18587. };
  18588. return __assign.apply(this, arguments);
  18589. };
  18590. var __importStar = this && this.__importStar || function (mod) {
  18591. if (mod && mod.__esModule) return mod;
  18592. var result = {};
  18593. if (mod != null) for (var k in mod) {
  18594. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  18595. }result["default"] = mod;
  18596. return result;
  18597. };
  18598. Object.defineProperty(exports, "__esModule", { value: true });
  18599. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18600. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  18601. var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  18602. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  18603. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  18604. var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  18605. var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  18606. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  18607. var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts");
  18608. var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  18609. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  18610. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
  18611. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts");
  18612. var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  18613. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts");
  18614. var MDCTextField = /** @class */function (_super) {
  18615. __extends(MDCTextField, _super);
  18616. function MDCTextField() {
  18617. return _super !== null && _super.apply(this, arguments) || this;
  18618. }
  18619. MDCTextField.attachTo = function (root) {
  18620. return new MDCTextField(root);
  18621. };
  18622. MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
  18623. if (rippleFactory === void 0) {
  18624. rippleFactory = function rippleFactory(el, foundation) {
  18625. return new component_5.MDCRipple(el, foundation);
  18626. };
  18627. }
  18628. if (lineRippleFactory === void 0) {
  18629. lineRippleFactory = function lineRippleFactory(el) {
  18630. return new component_3.MDCLineRipple(el);
  18631. };
  18632. }
  18633. if (helperTextFactory === void 0) {
  18634. helperTextFactory = function helperTextFactory(el) {
  18635. return new component_7.MDCTextFieldHelperText(el);
  18636. };
  18637. }
  18638. if (characterCounterFactory === void 0) {
  18639. characterCounterFactory = function characterCounterFactory(el) {
  18640. return new component_6.MDCTextFieldCharacterCounter(el);
  18641. };
  18642. }
  18643. if (iconFactory === void 0) {
  18644. iconFactory = function iconFactory(el) {
  18645. return new component_8.MDCTextFieldIcon(el);
  18646. };
  18647. }
  18648. if (labelFactory === void 0) {
  18649. labelFactory = function labelFactory(el) {
  18650. return new component_2.MDCFloatingLabel(el);
  18651. };
  18652. }
  18653. if (outlineFactory === void 0) {
  18654. outlineFactory = function outlineFactory(el) {
  18655. return new component_4.MDCNotchedOutline(el);
  18656. };
  18657. }
  18658. this.input_ = this.root_.querySelector(constants_1.strings.INPUT_SELECTOR);
  18659. var labelElement = this.root_.querySelector(constants_1.strings.LABEL_SELECTOR);
  18660. this.label_ = labelElement ? labelFactory(labelElement) : null;
  18661. var lineRippleElement = this.root_.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  18662. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  18663. var outlineElement = this.root_.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  18664. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  18665. // Helper text
  18666. var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
  18667. var nextElementSibling = this.root_.nextElementSibling;
  18668. var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
  18669. var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
  18670. this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null;
  18671. // Character counter
  18672. var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
  18673. var characterCounterEl = this.root_.querySelector(characterCounterStrings.ROOT_SELECTOR);
  18674. // If character counter is not found in root element search in sibling element.
  18675. if (!characterCounterEl && hasHelperLine && nextElementSibling) {
  18676. characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
  18677. }
  18678. this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
  18679. this.leadingIcon_ = null;
  18680. this.trailingIcon_ = null;
  18681. var iconElements = this.root_.querySelectorAll(constants_1.strings.ICON_SELECTOR);
  18682. if (iconElements.length > 0) {
  18683. if (iconElements.length > 1) {
  18684. // Has both icons.
  18685. this.leadingIcon_ = iconFactory(iconElements[0]);
  18686. this.trailingIcon_ = iconFactory(iconElements[1]);
  18687. } else {
  18688. if (this.root_.classList.contains(constants_1.cssClasses.WITH_LEADING_ICON)) {
  18689. this.leadingIcon_ = iconFactory(iconElements[0]);
  18690. } else {
  18691. this.trailingIcon_ = iconFactory(iconElements[0]);
  18692. }
  18693. }
  18694. }
  18695. this.ripple = this.createRipple_(rippleFactory);
  18696. };
  18697. MDCTextField.prototype.destroy = function () {
  18698. if (this.ripple) {
  18699. this.ripple.destroy();
  18700. }
  18701. if (this.lineRipple_) {
  18702. this.lineRipple_.destroy();
  18703. }
  18704. if (this.helperText_) {
  18705. this.helperText_.destroy();
  18706. }
  18707. if (this.characterCounter_) {
  18708. this.characterCounter_.destroy();
  18709. }
  18710. if (this.leadingIcon_) {
  18711. this.leadingIcon_.destroy();
  18712. }
  18713. if (this.trailingIcon_) {
  18714. this.trailingIcon_.destroy();
  18715. }
  18716. if (this.label_) {
  18717. this.label_.destroy();
  18718. }
  18719. if (this.outline_) {
  18720. this.outline_.destroy();
  18721. }
  18722. _super.prototype.destroy.call(this);
  18723. };
  18724. /**
  18725. * Initializes the Text Field's internal state based on the environment's
  18726. * state.
  18727. */
  18728. MDCTextField.prototype.initialSyncWithDOM = function () {
  18729. this.disabled = this.input_.disabled;
  18730. };
  18731. Object.defineProperty(MDCTextField.prototype, "value", {
  18732. get: function get() {
  18733. return this.foundation_.getValue();
  18734. },
  18735. /**
  18736. * @param value The value to set on the input.
  18737. */
  18738. set: function set(value) {
  18739. this.foundation_.setValue(value);
  18740. },
  18741. enumerable: true,
  18742. configurable: true
  18743. });
  18744. Object.defineProperty(MDCTextField.prototype, "disabled", {
  18745. get: function get() {
  18746. return this.foundation_.isDisabled();
  18747. },
  18748. /**
  18749. * @param disabled Sets the Text Field disabled or enabled.
  18750. */
  18751. set: function set(disabled) {
  18752. this.foundation_.setDisabled(disabled);
  18753. },
  18754. enumerable: true,
  18755. configurable: true
  18756. });
  18757. Object.defineProperty(MDCTextField.prototype, "valid", {
  18758. get: function get() {
  18759. return this.foundation_.isValid();
  18760. },
  18761. /**
  18762. * @param valid Sets the Text Field valid or invalid.
  18763. */
  18764. set: function set(valid) {
  18765. this.foundation_.setValid(valid);
  18766. },
  18767. enumerable: true,
  18768. configurable: true
  18769. });
  18770. Object.defineProperty(MDCTextField.prototype, "required", {
  18771. get: function get() {
  18772. return this.input_.required;
  18773. },
  18774. /**
  18775. * @param required Sets the Text Field to required.
  18776. */
  18777. set: function set(required) {
  18778. this.input_.required = required;
  18779. },
  18780. enumerable: true,
  18781. configurable: true
  18782. });
  18783. Object.defineProperty(MDCTextField.prototype, "pattern", {
  18784. get: function get() {
  18785. return this.input_.pattern;
  18786. },
  18787. /**
  18788. * @param pattern Sets the input element's validation pattern.
  18789. */
  18790. set: function set(pattern) {
  18791. this.input_.pattern = pattern;
  18792. },
  18793. enumerable: true,
  18794. configurable: true
  18795. });
  18796. Object.defineProperty(MDCTextField.prototype, "minLength", {
  18797. get: function get() {
  18798. return this.input_.minLength;
  18799. },
  18800. /**
  18801. * @param minLength Sets the input element's minLength.
  18802. */
  18803. set: function set(minLength) {
  18804. this.input_.minLength = minLength;
  18805. },
  18806. enumerable: true,
  18807. configurable: true
  18808. });
  18809. Object.defineProperty(MDCTextField.prototype, "maxLength", {
  18810. get: function get() {
  18811. return this.input_.maxLength;
  18812. },
  18813. /**
  18814. * @param maxLength Sets the input element's maxLength.
  18815. */
  18816. set: function set(maxLength) {
  18817. // Chrome throws exception if maxLength is set to a value less than zero
  18818. if (maxLength < 0) {
  18819. this.input_.removeAttribute('maxLength');
  18820. } else {
  18821. this.input_.maxLength = maxLength;
  18822. }
  18823. },
  18824. enumerable: true,
  18825. configurable: true
  18826. });
  18827. Object.defineProperty(MDCTextField.prototype, "min", {
  18828. get: function get() {
  18829. return this.input_.min;
  18830. },
  18831. /**
  18832. * @param min Sets the input element's min.
  18833. */
  18834. set: function set(min) {
  18835. this.input_.min = min;
  18836. },
  18837. enumerable: true,
  18838. configurable: true
  18839. });
  18840. Object.defineProperty(MDCTextField.prototype, "max", {
  18841. get: function get() {
  18842. return this.input_.max;
  18843. },
  18844. /**
  18845. * @param max Sets the input element's max.
  18846. */
  18847. set: function set(max) {
  18848. this.input_.max = max;
  18849. },
  18850. enumerable: true,
  18851. configurable: true
  18852. });
  18853. Object.defineProperty(MDCTextField.prototype, "step", {
  18854. get: function get() {
  18855. return this.input_.step;
  18856. },
  18857. /**
  18858. * @param step Sets the input element's step.
  18859. */
  18860. set: function set(step) {
  18861. this.input_.step = step;
  18862. },
  18863. enumerable: true,
  18864. configurable: true
  18865. });
  18866. Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
  18867. /**
  18868. * Sets the helper text element content.
  18869. */
  18870. set: function set(content) {
  18871. this.foundation_.setHelperTextContent(content);
  18872. },
  18873. enumerable: true,
  18874. configurable: true
  18875. });
  18876. Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
  18877. /**
  18878. * Sets the aria label of the leading icon.
  18879. */
  18880. set: function set(label) {
  18881. this.foundation_.setLeadingIconAriaLabel(label);
  18882. },
  18883. enumerable: true,
  18884. configurable: true
  18885. });
  18886. Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
  18887. /**
  18888. * Sets the text content of the leading icon.
  18889. */
  18890. set: function set(content) {
  18891. this.foundation_.setLeadingIconContent(content);
  18892. },
  18893. enumerable: true,
  18894. configurable: true
  18895. });
  18896. Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
  18897. /**
  18898. * Sets the aria label of the trailing icon.
  18899. */
  18900. set: function set(label) {
  18901. this.foundation_.setTrailingIconAriaLabel(label);
  18902. },
  18903. enumerable: true,
  18904. configurable: true
  18905. });
  18906. Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
  18907. /**
  18908. * Sets the text content of the trailing icon.
  18909. */
  18910. set: function set(content) {
  18911. this.foundation_.setTrailingIconContent(content);
  18912. },
  18913. enumerable: true,
  18914. configurable: true
  18915. });
  18916. Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
  18917. /**
  18918. * Enables or disables the use of native validation. Use this for custom validation.
  18919. * @param useNativeValidation Set this to false to ignore native input validation.
  18920. */
  18921. set: function set(useNativeValidation) {
  18922. this.foundation_.setUseNativeValidation(useNativeValidation);
  18923. },
  18924. enumerable: true,
  18925. configurable: true
  18926. });
  18927. /**
  18928. * Focuses the input element.
  18929. */
  18930. MDCTextField.prototype.focus = function () {
  18931. this.input_.focus();
  18932. };
  18933. /**
  18934. * Recomputes the outline SVG path for the outline element.
  18935. */
  18936. MDCTextField.prototype.layout = function () {
  18937. var openNotch = this.foundation_.shouldFloat;
  18938. this.foundation_.notchOutline(openNotch);
  18939. };
  18940. MDCTextField.prototype.getDefaultFoundation = function () {
  18941. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18942. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18943. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18944. var adapter = __assign({}, this.getRootAdapterMethods_(), this.getInputAdapterMethods_(), this.getLabelAdapterMethods_(), this.getLineRippleAdapterMethods_(), this.getOutlineAdapterMethods_());
  18945. // tslint:enable:object-literal-sort-keys
  18946. return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap_());
  18947. };
  18948. MDCTextField.prototype.getRootAdapterMethods_ = function () {
  18949. var _this = this;
  18950. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18951. return {
  18952. addClass: function addClass(className) {
  18953. return _this.root_.classList.add(className);
  18954. },
  18955. removeClass: function removeClass(className) {
  18956. return _this.root_.classList.remove(className);
  18957. },
  18958. hasClass: function hasClass(className) {
  18959. return _this.root_.classList.contains(className);
  18960. },
  18961. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
  18962. return _this.listen(evtType, handler);
  18963. },
  18964. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
  18965. return _this.unlisten(evtType, handler);
  18966. },
  18967. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
  18968. var getAttributesList = function getAttributesList(mutationsList) {
  18969. return mutationsList.map(function (mutation) {
  18970. return mutation.attributeName;
  18971. }).filter(function (attributeName) {
  18972. return attributeName;
  18973. });
  18974. };
  18975. var observer = new MutationObserver(function (mutationsList) {
  18976. return handler(getAttributesList(mutationsList));
  18977. });
  18978. var config = { attributes: true };
  18979. observer.observe(_this.input_, config);
  18980. return observer;
  18981. },
  18982. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
  18983. return observer.disconnect();
  18984. }
  18985. };
  18986. // tslint:enable:object-literal-sort-keys
  18987. };
  18988. MDCTextField.prototype.getInputAdapterMethods_ = function () {
  18989. var _this = this;
  18990. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18991. return {
  18992. getNativeInput: function getNativeInput() {
  18993. return _this.input_;
  18994. },
  18995. isFocused: function isFocused() {
  18996. return document.activeElement === _this.input_;
  18997. },
  18998. registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
  18999. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  19000. },
  19001. deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
  19002. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  19003. }
  19004. };
  19005. // tslint:enable:object-literal-sort-keys
  19006. };
  19007. MDCTextField.prototype.getLabelAdapterMethods_ = function () {
  19008. var _this = this;
  19009. return {
  19010. floatLabel: function floatLabel(shouldFloat) {
  19011. return _this.label_ && _this.label_.float(shouldFloat);
  19012. },
  19013. getLabelWidth: function getLabelWidth() {
  19014. return _this.label_ ? _this.label_.getWidth() : 0;
  19015. },
  19016. hasLabel: function hasLabel() {
  19017. return Boolean(_this.label_);
  19018. },
  19019. shakeLabel: function shakeLabel(shouldShake) {
  19020. return _this.label_ && _this.label_.shake(shouldShake);
  19021. }
  19022. };
  19023. };
  19024. MDCTextField.prototype.getLineRippleAdapterMethods_ = function () {
  19025. var _this = this;
  19026. return {
  19027. activateLineRipple: function activateLineRipple() {
  19028. if (_this.lineRipple_) {
  19029. _this.lineRipple_.activate();
  19030. }
  19031. },
  19032. deactivateLineRipple: function deactivateLineRipple() {
  19033. if (_this.lineRipple_) {
  19034. _this.lineRipple_.deactivate();
  19035. }
  19036. },
  19037. setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
  19038. if (_this.lineRipple_) {
  19039. _this.lineRipple_.setRippleCenter(normalizedX);
  19040. }
  19041. }
  19042. };
  19043. };
  19044. MDCTextField.prototype.getOutlineAdapterMethods_ = function () {
  19045. var _this = this;
  19046. return {
  19047. closeOutline: function closeOutline() {
  19048. return _this.outline_ && _this.outline_.closeNotch();
  19049. },
  19050. hasOutline: function hasOutline() {
  19051. return Boolean(_this.outline_);
  19052. },
  19053. notchOutline: function notchOutline(labelWidth) {
  19054. return _this.outline_ && _this.outline_.notch(labelWidth);
  19055. }
  19056. };
  19057. };
  19058. /**
  19059. * @return A map of all subcomponents to subfoundations.
  19060. */
  19061. MDCTextField.prototype.getFoundationMap_ = function () {
  19062. return {
  19063. characterCounter: this.characterCounter_ ? this.characterCounter_.foundation : undefined,
  19064. helperText: this.helperText_ ? this.helperText_.foundation : undefined,
  19065. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined,
  19066. trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundation : undefined
  19067. };
  19068. };
  19069. MDCTextField.prototype.createRipple_ = function (rippleFactory) {
  19070. var _this = this;
  19071. var isTextArea = this.root_.classList.contains(constants_1.cssClasses.TEXTAREA);
  19072. var isOutlined = this.root_.classList.contains(constants_1.cssClasses.OUTLINED);
  19073. if (isTextArea || isOutlined) {
  19074. return null;
  19075. }
  19076. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19077. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19078. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19079. var adapter = __assign({}, component_5.MDCRipple.createAdapter(this), { isSurfaceActive: function isSurfaceActive() {
  19080. return ponyfill.matches(_this.input_, ':active');
  19081. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  19082. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  19083. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  19084. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  19085. } });
  19086. // tslint:enable:object-literal-sort-keys
  19087. return rippleFactory(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  19088. };
  19089. return MDCTextField;
  19090. }(component_1.MDCComponent);
  19091. exports.MDCTextField = MDCTextField;
  19092. /***/ }),
  19093. /***/ "./packages/mdc-textfield/constants.ts":
  19094. /*!*********************************************!*\
  19095. !*** ./packages/mdc-textfield/constants.ts ***!
  19096. \*********************************************/
  19097. /*! no static exports found */
  19098. /***/ (function(module, exports, __webpack_require__) {
  19099. "use strict";
  19100. /**
  19101. * @license
  19102. * Copyright 2016 Google Inc.
  19103. *
  19104. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19105. * of this software and associated documentation files (the "Software"), to deal
  19106. * in the Software without restriction, including without limitation the rights
  19107. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19108. * copies of the Software, and to permit persons to whom the Software is
  19109. * furnished to do so, subject to the following conditions:
  19110. *
  19111. * The above copyright notice and this permission notice shall be included in
  19112. * all copies or substantial portions of the Software.
  19113. *
  19114. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19115. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19116. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19117. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19118. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19119. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19120. * THE SOFTWARE.
  19121. */
  19122. Object.defineProperty(exports, "__esModule", { value: true });
  19123. var strings = {
  19124. ARIA_CONTROLS: 'aria-controls',
  19125. ICON_SELECTOR: '.mdc-text-field__icon',
  19126. INPUT_SELECTOR: '.mdc-text-field__input',
  19127. LABEL_SELECTOR: '.mdc-floating-label',
  19128. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  19129. OUTLINE_SELECTOR: '.mdc-notched-outline'
  19130. };
  19131. exports.strings = strings;
  19132. var cssClasses = {
  19133. DENSE: 'mdc-text-field--dense',
  19134. DISABLED: 'mdc-text-field--disabled',
  19135. FOCUSED: 'mdc-text-field--focused',
  19136. FULLWIDTH: 'mdc-text-field--fullwidth',
  19137. HELPER_LINE: 'mdc-text-field-helper-line',
  19138. INVALID: 'mdc-text-field--invalid',
  19139. NO_LABEL: 'mdc-text-field--no-label',
  19140. OUTLINED: 'mdc-text-field--outlined',
  19141. ROOT: 'mdc-text-field',
  19142. TEXTAREA: 'mdc-text-field--textarea',
  19143. WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
  19144. WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon'
  19145. };
  19146. exports.cssClasses = cssClasses;
  19147. var numbers = {
  19148. DENSE_LABEL_SCALE: 0.923,
  19149. LABEL_SCALE: 0.75
  19150. };
  19151. exports.numbers = numbers;
  19152. /**
  19153. * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
  19154. * under the "Validation-related attributes" section.
  19155. */
  19156. var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
  19157. exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
  19158. /**
  19159. * Label should always float for these types as they show some UI even if value is empty.
  19160. */
  19161. var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
  19162. exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
  19163. /***/ }),
  19164. /***/ "./packages/mdc-textfield/foundation.ts":
  19165. /*!**********************************************!*\
  19166. !*** ./packages/mdc-textfield/foundation.ts ***!
  19167. \**********************************************/
  19168. /*! no static exports found */
  19169. /***/ (function(module, exports, __webpack_require__) {
  19170. "use strict";
  19171. /**
  19172. * @license
  19173. * Copyright 2016 Google Inc.
  19174. *
  19175. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19176. * of this software and associated documentation files (the "Software"), to deal
  19177. * in the Software without restriction, including without limitation the rights
  19178. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19179. * copies of the Software, and to permit persons to whom the Software is
  19180. * furnished to do so, subject to the following conditions:
  19181. *
  19182. * The above copyright notice and this permission notice shall be included in
  19183. * all copies or substantial portions of the Software.
  19184. *
  19185. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19186. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19187. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19188. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19189. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19190. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19191. * THE SOFTWARE.
  19192. */
  19193. var __extends = this && this.__extends || function () {
  19194. var _extendStatics = function extendStatics(d, b) {
  19195. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19196. d.__proto__ = b;
  19197. } || function (d, b) {
  19198. for (var p in b) {
  19199. if (b.hasOwnProperty(p)) d[p] = b[p];
  19200. }
  19201. };
  19202. return _extendStatics(d, b);
  19203. };
  19204. return function (d, b) {
  19205. _extendStatics(d, b);
  19206. function __() {
  19207. this.constructor = d;
  19208. }
  19209. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19210. };
  19211. }();
  19212. var __assign = this && this.__assign || function () {
  19213. __assign = Object.assign || function (t) {
  19214. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19215. s = arguments[i];
  19216. for (var p in s) {
  19217. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19218. }
  19219. }
  19220. return t;
  19221. };
  19222. return __assign.apply(this, arguments);
  19223. };
  19224. Object.defineProperty(exports, "__esModule", { value: true });
  19225. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19226. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  19227. var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
  19228. var INTERACTION_EVENTS = ['click', 'keydown'];
  19229. var MDCTextFieldFoundation = /** @class */function (_super) {
  19230. __extends(MDCTextFieldFoundation, _super);
  19231. /**
  19232. * @param adapter
  19233. * @param foundationMap Map from subcomponent names to their subfoundations.
  19234. */
  19235. function MDCTextFieldFoundation(adapter, foundationMap) {
  19236. if (foundationMap === void 0) {
  19237. foundationMap = {};
  19238. }
  19239. var _this = _super.call(this, __assign({}, MDCTextFieldFoundation.defaultAdapter, adapter)) || this;
  19240. _this.isFocused_ = false;
  19241. _this.receivedUserInput_ = false;
  19242. _this.isValid_ = true;
  19243. _this.useNativeValidation_ = true;
  19244. _this.helperText_ = foundationMap.helperText;
  19245. _this.characterCounter_ = foundationMap.characterCounter;
  19246. _this.leadingIcon_ = foundationMap.leadingIcon;
  19247. _this.trailingIcon_ = foundationMap.trailingIcon;
  19248. _this.inputFocusHandler_ = function () {
  19249. return _this.activateFocus();
  19250. };
  19251. _this.inputBlurHandler_ = function () {
  19252. return _this.deactivateFocus();
  19253. };
  19254. _this.inputInputHandler_ = function () {
  19255. return _this.handleInput();
  19256. };
  19257. _this.setPointerXOffset_ = function (evt) {
  19258. return _this.setTransformOrigin(evt);
  19259. };
  19260. _this.textFieldInteractionHandler_ = function () {
  19261. return _this.handleTextFieldInteraction();
  19262. };
  19263. _this.validationAttributeChangeHandler_ = function (attributesList) {
  19264. return _this.handleValidationAttributeChange(attributesList);
  19265. };
  19266. return _this;
  19267. }
  19268. Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
  19269. get: function get() {
  19270. return constants_1.cssClasses;
  19271. },
  19272. enumerable: true,
  19273. configurable: true
  19274. });
  19275. Object.defineProperty(MDCTextFieldFoundation, "strings", {
  19276. get: function get() {
  19277. return constants_1.strings;
  19278. },
  19279. enumerable: true,
  19280. configurable: true
  19281. });
  19282. Object.defineProperty(MDCTextFieldFoundation, "numbers", {
  19283. get: function get() {
  19284. return constants_1.numbers;
  19285. },
  19286. enumerable: true,
  19287. configurable: true
  19288. });
  19289. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", {
  19290. get: function get() {
  19291. var type = this.getNativeInput_().type;
  19292. return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
  19293. },
  19294. enumerable: true,
  19295. configurable: true
  19296. });
  19297. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
  19298. get: function get() {
  19299. return this.shouldAlwaysFloat_ || this.isFocused_ || Boolean(this.getValue()) || this.isBadInput_();
  19300. },
  19301. enumerable: true,
  19302. configurable: true
  19303. });
  19304. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
  19305. get: function get() {
  19306. return !this.isFocused_ && !this.isValid() && Boolean(this.getValue());
  19307. },
  19308. enumerable: true,
  19309. configurable: true
  19310. });
  19311. Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
  19312. /**
  19313. * See {@link MDCTextFieldAdapter} for typing information on parameters and return types.
  19314. */
  19315. get: function get() {
  19316. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19317. return {
  19318. addClass: function addClass() {
  19319. return undefined;
  19320. },
  19321. removeClass: function removeClass() {
  19322. return undefined;
  19323. },
  19324. hasClass: function hasClass() {
  19325. return true;
  19326. },
  19327. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
  19328. return undefined;
  19329. },
  19330. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
  19331. return undefined;
  19332. },
  19333. registerInputInteractionHandler: function registerInputInteractionHandler() {
  19334. return undefined;
  19335. },
  19336. deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
  19337. return undefined;
  19338. },
  19339. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
  19340. return new MutationObserver(function () {
  19341. return undefined;
  19342. });
  19343. },
  19344. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
  19345. return undefined;
  19346. },
  19347. getNativeInput: function getNativeInput() {
  19348. return null;
  19349. },
  19350. isFocused: function isFocused() {
  19351. return false;
  19352. },
  19353. activateLineRipple: function activateLineRipple() {
  19354. return undefined;
  19355. },
  19356. deactivateLineRipple: function deactivateLineRipple() {
  19357. return undefined;
  19358. },
  19359. setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
  19360. return undefined;
  19361. },
  19362. shakeLabel: function shakeLabel() {
  19363. return undefined;
  19364. },
  19365. floatLabel: function floatLabel() {
  19366. return undefined;
  19367. },
  19368. hasLabel: function hasLabel() {
  19369. return false;
  19370. },
  19371. getLabelWidth: function getLabelWidth() {
  19372. return 0;
  19373. },
  19374. hasOutline: function hasOutline() {
  19375. return false;
  19376. },
  19377. notchOutline: function notchOutline() {
  19378. return undefined;
  19379. },
  19380. closeOutline: function closeOutline() {
  19381. return undefined;
  19382. }
  19383. };
  19384. // tslint:enable:object-literal-sort-keys
  19385. },
  19386. enumerable: true,
  19387. configurable: true
  19388. });
  19389. MDCTextFieldFoundation.prototype.init = function () {
  19390. var _this = this;
  19391. if (this.adapter_.isFocused()) {
  19392. this.inputFocusHandler_();
  19393. } else if (this.adapter_.hasLabel() && this.shouldFloat) {
  19394. this.notchOutline(true);
  19395. this.adapter_.floatLabel(true);
  19396. }
  19397. this.adapter_.registerInputInteractionHandler('focus', this.inputFocusHandler_);
  19398. this.adapter_.registerInputInteractionHandler('blur', this.inputBlurHandler_);
  19399. this.adapter_.registerInputInteractionHandler('input', this.inputInputHandler_);
  19400. POINTERDOWN_EVENTS.forEach(function (evtType) {
  19401. _this.adapter_.registerInputInteractionHandler(evtType, _this.setPointerXOffset_);
  19402. });
  19403. INTERACTION_EVENTS.forEach(function (evtType) {
  19404. _this.adapter_.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  19405. });
  19406. this.validationObserver_ = this.adapter_.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_);
  19407. this.setCharacterCounter_(this.getValue().length);
  19408. };
  19409. MDCTextFieldFoundation.prototype.destroy = function () {
  19410. var _this = this;
  19411. this.adapter_.deregisterInputInteractionHandler('focus', this.inputFocusHandler_);
  19412. this.adapter_.deregisterInputInteractionHandler('blur', this.inputBlurHandler_);
  19413. this.adapter_.deregisterInputInteractionHandler('input', this.inputInputHandler_);
  19414. POINTERDOWN_EVENTS.forEach(function (evtType) {
  19415. _this.adapter_.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_);
  19416. });
  19417. INTERACTION_EVENTS.forEach(function (evtType) {
  19418. _this.adapter_.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  19419. });
  19420. this.adapter_.deregisterValidationAttributeChangeHandler(this.validationObserver_);
  19421. };
  19422. /**
  19423. * Handles user interactions with the Text Field.
  19424. */
  19425. MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
  19426. var nativeInput = this.adapter_.getNativeInput();
  19427. if (nativeInput && nativeInput.disabled) {
  19428. return;
  19429. }
  19430. this.receivedUserInput_ = true;
  19431. };
  19432. /**
  19433. * Handles validation attribute changes
  19434. */
  19435. MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
  19436. var _this = this;
  19437. attributesList.some(function (attributeName) {
  19438. if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
  19439. _this.styleValidity_(true);
  19440. return true;
  19441. }
  19442. return false;
  19443. });
  19444. if (attributesList.indexOf('maxlength') > -1) {
  19445. this.setCharacterCounter_(this.getValue().length);
  19446. }
  19447. };
  19448. /**
  19449. * Opens/closes the notched outline.
  19450. */
  19451. MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
  19452. if (!this.adapter_.hasOutline()) {
  19453. return;
  19454. }
  19455. if (openNotch) {
  19456. var isDense = this.adapter_.hasClass(constants_1.cssClasses.DENSE);
  19457. var labelScale = isDense ? constants_1.numbers.DENSE_LABEL_SCALE : constants_1.numbers.LABEL_SCALE;
  19458. var labelWidth = this.adapter_.getLabelWidth() * labelScale;
  19459. this.adapter_.notchOutline(labelWidth);
  19460. } else {
  19461. this.adapter_.closeOutline();
  19462. }
  19463. };
  19464. /**
  19465. * Activates the text field focus state.
  19466. */
  19467. MDCTextFieldFoundation.prototype.activateFocus = function () {
  19468. this.isFocused_ = true;
  19469. this.styleFocused_(this.isFocused_);
  19470. this.adapter_.activateLineRipple();
  19471. if (this.adapter_.hasLabel()) {
  19472. this.notchOutline(this.shouldFloat);
  19473. this.adapter_.floatLabel(this.shouldFloat);
  19474. this.adapter_.shakeLabel(this.shouldShake);
  19475. }
  19476. if (this.helperText_) {
  19477. this.helperText_.showToScreenReader();
  19478. }
  19479. };
  19480. /**
  19481. * Sets the line ripple's transform origin, so that the line ripple activate
  19482. * animation will animate out from the user's click location.
  19483. */
  19484. MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
  19485. var touches = evt.touches;
  19486. var targetEvent = touches ? touches[0] : evt;
  19487. var targetClientRect = targetEvent.target.getBoundingClientRect();
  19488. var normalizedX = targetEvent.clientX - targetClientRect.left;
  19489. this.adapter_.setLineRippleTransformOrigin(normalizedX);
  19490. };
  19491. /**
  19492. * Handles input change of text input and text area.
  19493. */
  19494. MDCTextFieldFoundation.prototype.handleInput = function () {
  19495. this.autoCompleteFocus();
  19496. this.setCharacterCounter_(this.getValue().length);
  19497. };
  19498. /**
  19499. * Activates the Text Field's focus state in cases when the input value
  19500. * changes without user input (e.g. programmatically).
  19501. */
  19502. MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
  19503. if (!this.receivedUserInput_) {
  19504. this.activateFocus();
  19505. }
  19506. };
  19507. /**
  19508. * Deactivates the Text Field's focus state.
  19509. */
  19510. MDCTextFieldFoundation.prototype.deactivateFocus = function () {
  19511. this.isFocused_ = false;
  19512. this.adapter_.deactivateLineRipple();
  19513. var isValid = this.isValid();
  19514. this.styleValidity_(isValid);
  19515. this.styleFocused_(this.isFocused_);
  19516. if (this.adapter_.hasLabel()) {
  19517. this.notchOutline(this.shouldFloat);
  19518. this.adapter_.floatLabel(this.shouldFloat);
  19519. this.adapter_.shakeLabel(this.shouldShake);
  19520. }
  19521. if (!this.shouldFloat) {
  19522. this.receivedUserInput_ = false;
  19523. }
  19524. };
  19525. MDCTextFieldFoundation.prototype.getValue = function () {
  19526. return this.getNativeInput_().value;
  19527. };
  19528. /**
  19529. * @param value The value to set on the input Element.
  19530. */
  19531. MDCTextFieldFoundation.prototype.setValue = function (value) {
  19532. // Prevent Safari from moving the caret to the end of the input when the value has not changed.
  19533. if (this.getValue() !== value) {
  19534. this.getNativeInput_().value = value;
  19535. }
  19536. this.setCharacterCounter_(value.length);
  19537. var isValid = this.isValid();
  19538. this.styleValidity_(isValid);
  19539. if (this.adapter_.hasLabel()) {
  19540. this.notchOutline(this.shouldFloat);
  19541. this.adapter_.floatLabel(this.shouldFloat);
  19542. this.adapter_.shakeLabel(this.shouldShake);
  19543. }
  19544. };
  19545. /**
  19546. * @return The custom validity state, if set; otherwise, the result of a native validity check.
  19547. */
  19548. MDCTextFieldFoundation.prototype.isValid = function () {
  19549. return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_;
  19550. };
  19551. /**
  19552. * @param isValid Sets the custom validity state of the Text Field.
  19553. */
  19554. MDCTextFieldFoundation.prototype.setValid = function (isValid) {
  19555. this.isValid_ = isValid;
  19556. this.styleValidity_(isValid);
  19557. var shouldShake = !isValid && !this.isFocused_;
  19558. if (this.adapter_.hasLabel()) {
  19559. this.adapter_.shakeLabel(shouldShake);
  19560. }
  19561. };
  19562. /**
  19563. * Enables or disables the use of native validation. Use this for custom validation.
  19564. * @param useNativeValidation Set this to false to ignore native input validation.
  19565. */
  19566. MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
  19567. this.useNativeValidation_ = useNativeValidation;
  19568. };
  19569. MDCTextFieldFoundation.prototype.isDisabled = function () {
  19570. return this.getNativeInput_().disabled;
  19571. };
  19572. /**
  19573. * @param disabled Sets the text-field disabled or enabled.
  19574. */
  19575. MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
  19576. this.getNativeInput_().disabled = disabled;
  19577. this.styleDisabled_(disabled);
  19578. };
  19579. /**
  19580. * @param content Sets the content of the helper text.
  19581. */
  19582. MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
  19583. if (this.helperText_) {
  19584. this.helperText_.setContent(content);
  19585. }
  19586. };
  19587. /**
  19588. * Sets the aria label of the leading icon.
  19589. */
  19590. MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  19591. if (this.leadingIcon_) {
  19592. this.leadingIcon_.setAriaLabel(label);
  19593. }
  19594. };
  19595. /**
  19596. * Sets the text content of the leading icon.
  19597. */
  19598. MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
  19599. if (this.leadingIcon_) {
  19600. this.leadingIcon_.setContent(content);
  19601. }
  19602. };
  19603. /**
  19604. * Sets the aria label of the trailing icon.
  19605. */
  19606. MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
  19607. if (this.trailingIcon_) {
  19608. this.trailingIcon_.setAriaLabel(label);
  19609. }
  19610. };
  19611. /**
  19612. * Sets the text content of the trailing icon.
  19613. */
  19614. MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
  19615. if (this.trailingIcon_) {
  19616. this.trailingIcon_.setContent(content);
  19617. }
  19618. };
  19619. /**
  19620. * Sets character counter values that shows characters used and the total character limit.
  19621. */
  19622. MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) {
  19623. if (!this.characterCounter_) {
  19624. return;
  19625. }
  19626. var maxLength = this.getNativeInput_().maxLength;
  19627. if (maxLength === -1) {
  19628. throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
  19629. }
  19630. this.characterCounter_.setCounterValue(currentLength, maxLength);
  19631. };
  19632. /**
  19633. * @return True if the Text Field input fails in converting the user-supplied value.
  19634. */
  19635. MDCTextFieldFoundation.prototype.isBadInput_ = function () {
  19636. // The badInput property is not supported in IE 11 💩.
  19637. return this.getNativeInput_().validity.badInput || false;
  19638. };
  19639. /**
  19640. * @return The result of native validity checking (ValidityState.valid).
  19641. */
  19642. MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () {
  19643. return this.getNativeInput_().validity.valid;
  19644. };
  19645. /**
  19646. * Styles the component based on the validity state.
  19647. */
  19648. MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) {
  19649. var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
  19650. if (isValid) {
  19651. this.adapter_.removeClass(INVALID);
  19652. } else {
  19653. this.adapter_.addClass(INVALID);
  19654. }
  19655. if (this.helperText_) {
  19656. this.helperText_.setValidity(isValid);
  19657. }
  19658. };
  19659. /**
  19660. * Styles the component based on the focused state.
  19661. */
  19662. MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) {
  19663. var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
  19664. if (isFocused) {
  19665. this.adapter_.addClass(FOCUSED);
  19666. } else {
  19667. this.adapter_.removeClass(FOCUSED);
  19668. }
  19669. };
  19670. /**
  19671. * Styles the component based on the disabled state.
  19672. */
  19673. MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) {
  19674. var _a = MDCTextFieldFoundation.cssClasses,
  19675. DISABLED = _a.DISABLED,
  19676. INVALID = _a.INVALID;
  19677. if (isDisabled) {
  19678. this.adapter_.addClass(DISABLED);
  19679. this.adapter_.removeClass(INVALID);
  19680. } else {
  19681. this.adapter_.removeClass(DISABLED);
  19682. }
  19683. if (this.leadingIcon_) {
  19684. this.leadingIcon_.setDisabled(isDisabled);
  19685. }
  19686. if (this.trailingIcon_) {
  19687. this.trailingIcon_.setDisabled(isDisabled);
  19688. }
  19689. };
  19690. /**
  19691. * @return The native text input element from the host environment, or an object with the same shape for unit tests.
  19692. */
  19693. MDCTextFieldFoundation.prototype.getNativeInput_ = function () {
  19694. // this.adapter_ may be undefined in foundation unit tests. This happens when testdouble is creating a mock object
  19695. // and invokes the shouldShake/shouldFloat getters (which in turn call getValue(), which calls this method) before
  19696. // init() has been called from the MDCTextField constructor. To work around that issue, we return a dummy object.
  19697. var nativeInput = this.adapter_ ? this.adapter_.getNativeInput() : null;
  19698. return nativeInput || {
  19699. disabled: false,
  19700. maxLength: -1,
  19701. type: 'input',
  19702. validity: {
  19703. badInput: false,
  19704. valid: true
  19705. },
  19706. value: ''
  19707. };
  19708. };
  19709. return MDCTextFieldFoundation;
  19710. }(foundation_1.MDCFoundation);
  19711. exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
  19712. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19713. exports.default = MDCTextFieldFoundation;
  19714. /***/ }),
  19715. /***/ "./packages/mdc-textfield/helper-text/component.ts":
  19716. /*!*********************************************************!*\
  19717. !*** ./packages/mdc-textfield/helper-text/component.ts ***!
  19718. \*********************************************************/
  19719. /*! no static exports found */
  19720. /***/ (function(module, exports, __webpack_require__) {
  19721. "use strict";
  19722. /**
  19723. * @license
  19724. * Copyright 2017 Google Inc.
  19725. *
  19726. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19727. * of this software and associated documentation files (the "Software"), to deal
  19728. * in the Software without restriction, including without limitation the rights
  19729. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19730. * copies of the Software, and to permit persons to whom the Software is
  19731. * furnished to do so, subject to the following conditions:
  19732. *
  19733. * The above copyright notice and this permission notice shall be included in
  19734. * all copies or substantial portions of the Software.
  19735. *
  19736. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19737. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19738. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19739. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19740. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19741. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19742. * THE SOFTWARE.
  19743. */
  19744. var __extends = this && this.__extends || function () {
  19745. var _extendStatics = function extendStatics(d, b) {
  19746. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19747. d.__proto__ = b;
  19748. } || function (d, b) {
  19749. for (var p in b) {
  19750. if (b.hasOwnProperty(p)) d[p] = b[p];
  19751. }
  19752. };
  19753. return _extendStatics(d, b);
  19754. };
  19755. return function (d, b) {
  19756. _extendStatics(d, b);
  19757. function __() {
  19758. this.constructor = d;
  19759. }
  19760. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19761. };
  19762. }();
  19763. Object.defineProperty(exports, "__esModule", { value: true });
  19764. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  19765. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  19766. var MDCTextFieldHelperText = /** @class */function (_super) {
  19767. __extends(MDCTextFieldHelperText, _super);
  19768. function MDCTextFieldHelperText() {
  19769. return _super !== null && _super.apply(this, arguments) || this;
  19770. }
  19771. MDCTextFieldHelperText.attachTo = function (root) {
  19772. return new MDCTextFieldHelperText(root);
  19773. };
  19774. Object.defineProperty(MDCTextFieldHelperText.prototype, "foundation", {
  19775. get: function get() {
  19776. return this.foundation_;
  19777. },
  19778. enumerable: true,
  19779. configurable: true
  19780. });
  19781. MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
  19782. var _this = this;
  19783. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19784. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19785. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19786. var adapter = {
  19787. addClass: function addClass(className) {
  19788. return _this.root_.classList.add(className);
  19789. },
  19790. removeClass: function removeClass(className) {
  19791. return _this.root_.classList.remove(className);
  19792. },
  19793. hasClass: function hasClass(className) {
  19794. return _this.root_.classList.contains(className);
  19795. },
  19796. setAttr: function setAttr(attr, value) {
  19797. return _this.root_.setAttribute(attr, value);
  19798. },
  19799. removeAttr: function removeAttr(attr) {
  19800. return _this.root_.removeAttribute(attr);
  19801. },
  19802. setContent: function setContent(content) {
  19803. _this.root_.textContent = content;
  19804. }
  19805. };
  19806. // tslint:enable:object-literal-sort-keys
  19807. return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
  19808. };
  19809. return MDCTextFieldHelperText;
  19810. }(component_1.MDCComponent);
  19811. exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
  19812. /***/ }),
  19813. /***/ "./packages/mdc-textfield/helper-text/constants.ts":
  19814. /*!*********************************************************!*\
  19815. !*** ./packages/mdc-textfield/helper-text/constants.ts ***!
  19816. \*********************************************************/
  19817. /*! no static exports found */
  19818. /***/ (function(module, exports, __webpack_require__) {
  19819. "use strict";
  19820. /**
  19821. * @license
  19822. * Copyright 2016 Google Inc.
  19823. *
  19824. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19825. * of this software and associated documentation files (the "Software"), to deal
  19826. * in the Software without restriction, including without limitation the rights
  19827. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19828. * copies of the Software, and to permit persons to whom the Software is
  19829. * furnished to do so, subject to the following conditions:
  19830. *
  19831. * The above copyright notice and this permission notice shall be included in
  19832. * all copies or substantial portions of the Software.
  19833. *
  19834. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19835. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19836. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19837. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19838. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19839. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19840. * THE SOFTWARE.
  19841. */
  19842. Object.defineProperty(exports, "__esModule", { value: true });
  19843. var cssClasses = {
  19844. HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
  19845. HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
  19846. ROOT: 'mdc-text-field-helper-text'
  19847. };
  19848. exports.cssClasses = cssClasses;
  19849. var strings = {
  19850. ARIA_HIDDEN: 'aria-hidden',
  19851. ROLE: 'role',
  19852. ROOT_SELECTOR: "." + cssClasses.ROOT
  19853. };
  19854. exports.strings = strings;
  19855. /***/ }),
  19856. /***/ "./packages/mdc-textfield/helper-text/foundation.ts":
  19857. /*!**********************************************************!*\
  19858. !*** ./packages/mdc-textfield/helper-text/foundation.ts ***!
  19859. \**********************************************************/
  19860. /*! no static exports found */
  19861. /***/ (function(module, exports, __webpack_require__) {
  19862. "use strict";
  19863. /**
  19864. * @license
  19865. * Copyright 2017 Google Inc.
  19866. *
  19867. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19868. * of this software and associated documentation files (the "Software"), to deal
  19869. * in the Software without restriction, including without limitation the rights
  19870. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19871. * copies of the Software, and to permit persons to whom the Software is
  19872. * furnished to do so, subject to the following conditions:
  19873. *
  19874. * The above copyright notice and this permission notice shall be included in
  19875. * all copies or substantial portions of the Software.
  19876. *
  19877. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19878. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19879. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19880. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19881. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19882. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19883. * THE SOFTWARE.
  19884. */
  19885. var __extends = this && this.__extends || function () {
  19886. var _extendStatics = function extendStatics(d, b) {
  19887. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19888. d.__proto__ = b;
  19889. } || function (d, b) {
  19890. for (var p in b) {
  19891. if (b.hasOwnProperty(p)) d[p] = b[p];
  19892. }
  19893. };
  19894. return _extendStatics(d, b);
  19895. };
  19896. return function (d, b) {
  19897. _extendStatics(d, b);
  19898. function __() {
  19899. this.constructor = d;
  19900. }
  19901. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19902. };
  19903. }();
  19904. var __assign = this && this.__assign || function () {
  19905. __assign = Object.assign || function (t) {
  19906. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19907. s = arguments[i];
  19908. for (var p in s) {
  19909. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19910. }
  19911. }
  19912. return t;
  19913. };
  19914. return __assign.apply(this, arguments);
  19915. };
  19916. Object.defineProperty(exports, "__esModule", { value: true });
  19917. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19918. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  19919. var MDCTextFieldHelperTextFoundation = /** @class */function (_super) {
  19920. __extends(MDCTextFieldHelperTextFoundation, _super);
  19921. function MDCTextFieldHelperTextFoundation(adapter) {
  19922. return _super.call(this, __assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter, adapter)) || this;
  19923. }
  19924. Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
  19925. get: function get() {
  19926. return constants_1.cssClasses;
  19927. },
  19928. enumerable: true,
  19929. configurable: true
  19930. });
  19931. Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
  19932. get: function get() {
  19933. return constants_1.strings;
  19934. },
  19935. enumerable: true,
  19936. configurable: true
  19937. });
  19938. Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
  19939. /**
  19940. * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.
  19941. */
  19942. get: function get() {
  19943. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19944. return {
  19945. addClass: function addClass() {
  19946. return undefined;
  19947. },
  19948. removeClass: function removeClass() {
  19949. return undefined;
  19950. },
  19951. hasClass: function hasClass() {
  19952. return false;
  19953. },
  19954. setAttr: function setAttr() {
  19955. return undefined;
  19956. },
  19957. removeAttr: function removeAttr() {
  19958. return undefined;
  19959. },
  19960. setContent: function setContent() {
  19961. return undefined;
  19962. }
  19963. };
  19964. // tslint:enable:object-literal-sort-keys
  19965. },
  19966. enumerable: true,
  19967. configurable: true
  19968. });
  19969. /**
  19970. * Sets the content of the helper text field.
  19971. */
  19972. MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
  19973. this.adapter_.setContent(content);
  19974. };
  19975. /**
  19976. * @param isPersistent Sets the persistency of the helper text.
  19977. */
  19978. MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  19979. if (isPersistent) {
  19980. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  19981. } else {
  19982. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  19983. }
  19984. };
  19985. /**
  19986. * @param isValidation True to make the helper text act as an error validation message.
  19987. */
  19988. MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
  19989. if (isValidation) {
  19990. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  19991. } else {
  19992. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  19993. }
  19994. };
  19995. /**
  19996. * Makes the helper text visible to the screen reader.
  19997. */
  19998. MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
  19999. this.adapter_.removeAttr(constants_1.strings.ARIA_HIDDEN);
  20000. };
  20001. /**
  20002. * Sets the validity of the helper text based on the input validity.
  20003. */
  20004. MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
  20005. var helperTextIsPersistent = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  20006. var helperTextIsValidationMsg = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  20007. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
  20008. if (validationMsgNeedsDisplay) {
  20009. this.adapter_.setAttr(constants_1.strings.ROLE, 'alert');
  20010. } else {
  20011. this.adapter_.removeAttr(constants_1.strings.ROLE);
  20012. }
  20013. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  20014. this.hide_();
  20015. }
  20016. };
  20017. /**
  20018. * Hides the help text from screen readers.
  20019. */
  20020. MDCTextFieldHelperTextFoundation.prototype.hide_ = function () {
  20021. this.adapter_.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  20022. };
  20023. return MDCTextFieldHelperTextFoundation;
  20024. }(foundation_1.MDCFoundation);
  20025. exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
  20026. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20027. exports.default = MDCTextFieldHelperTextFoundation;
  20028. /***/ }),
  20029. /***/ "./packages/mdc-textfield/helper-text/index.ts":
  20030. /*!*****************************************************!*\
  20031. !*** ./packages/mdc-textfield/helper-text/index.ts ***!
  20032. \*****************************************************/
  20033. /*! no static exports found */
  20034. /***/ (function(module, exports, __webpack_require__) {
  20035. "use strict";
  20036. /**
  20037. * @license
  20038. * Copyright 2019 Google Inc.
  20039. *
  20040. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20041. * of this software and associated documentation files (the "Software"), to deal
  20042. * in the Software without restriction, including without limitation the rights
  20043. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20044. * copies of the Software, and to permit persons to whom the Software is
  20045. * furnished to do so, subject to the following conditions:
  20046. *
  20047. * The above copyright notice and this permission notice shall be included in
  20048. * all copies or substantial portions of the Software.
  20049. *
  20050. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20051. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20052. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20053. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20054. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20055. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20056. * THE SOFTWARE.
  20057. */
  20058. function __export(m) {
  20059. for (var p in m) {
  20060. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20061. }
  20062. }
  20063. Object.defineProperty(exports, "__esModule", { value: true });
  20064. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"));
  20065. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"));
  20066. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  20067. exports.helperTextCssClasses = constants_1.cssClasses;
  20068. exports.helperTextStrings = constants_1.strings;
  20069. /***/ }),
  20070. /***/ "./packages/mdc-textfield/icon/component.ts":
  20071. /*!**************************************************!*\
  20072. !*** ./packages/mdc-textfield/icon/component.ts ***!
  20073. \**************************************************/
  20074. /*! no static exports found */
  20075. /***/ (function(module, exports, __webpack_require__) {
  20076. "use strict";
  20077. /**
  20078. * @license
  20079. * Copyright 2017 Google Inc.
  20080. *
  20081. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20082. * of this software and associated documentation files (the "Software"), to deal
  20083. * in the Software without restriction, including without limitation the rights
  20084. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20085. * copies of the Software, and to permit persons to whom the Software is
  20086. * furnished to do so, subject to the following conditions:
  20087. *
  20088. * The above copyright notice and this permission notice shall be included in
  20089. * all copies or substantial portions of the Software.
  20090. *
  20091. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20092. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20093. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20094. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20095. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20096. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20097. * THE SOFTWARE.
  20098. */
  20099. var __extends = this && this.__extends || function () {
  20100. var _extendStatics = function extendStatics(d, b) {
  20101. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20102. d.__proto__ = b;
  20103. } || function (d, b) {
  20104. for (var p in b) {
  20105. if (b.hasOwnProperty(p)) d[p] = b[p];
  20106. }
  20107. };
  20108. return _extendStatics(d, b);
  20109. };
  20110. return function (d, b) {
  20111. _extendStatics(d, b);
  20112. function __() {
  20113. this.constructor = d;
  20114. }
  20115. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20116. };
  20117. }();
  20118. Object.defineProperty(exports, "__esModule", { value: true });
  20119. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20120. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts");
  20121. var MDCTextFieldIcon = /** @class */function (_super) {
  20122. __extends(MDCTextFieldIcon, _super);
  20123. function MDCTextFieldIcon() {
  20124. return _super !== null && _super.apply(this, arguments) || this;
  20125. }
  20126. MDCTextFieldIcon.attachTo = function (root) {
  20127. return new MDCTextFieldIcon(root);
  20128. };
  20129. Object.defineProperty(MDCTextFieldIcon.prototype, "foundation", {
  20130. get: function get() {
  20131. return this.foundation_;
  20132. },
  20133. enumerable: true,
  20134. configurable: true
  20135. });
  20136. MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
  20137. var _this = this;
  20138. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20139. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20140. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20141. var adapter = {
  20142. getAttr: function getAttr(attr) {
  20143. return _this.root_.getAttribute(attr);
  20144. },
  20145. setAttr: function setAttr(attr, value) {
  20146. return _this.root_.setAttribute(attr, value);
  20147. },
  20148. removeAttr: function removeAttr(attr) {
  20149. return _this.root_.removeAttribute(attr);
  20150. },
  20151. setContent: function setContent(content) {
  20152. _this.root_.textContent = content;
  20153. },
  20154. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  20155. return _this.listen(evtType, handler);
  20156. },
  20157. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  20158. return _this.unlisten(evtType, handler);
  20159. },
  20160. notifyIconAction: function notifyIconAction() {
  20161. return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  20162. }
  20163. };
  20164. // tslint:enable:object-literal-sort-keys
  20165. return new foundation_1.MDCTextFieldIconFoundation(adapter);
  20166. };
  20167. return MDCTextFieldIcon;
  20168. }(component_1.MDCComponent);
  20169. exports.MDCTextFieldIcon = MDCTextFieldIcon;
  20170. /***/ }),
  20171. /***/ "./packages/mdc-textfield/icon/constants.ts":
  20172. /*!**************************************************!*\
  20173. !*** ./packages/mdc-textfield/icon/constants.ts ***!
  20174. \**************************************************/
  20175. /*! no static exports found */
  20176. /***/ (function(module, exports, __webpack_require__) {
  20177. "use strict";
  20178. /**
  20179. * @license
  20180. * Copyright 2016 Google Inc.
  20181. *
  20182. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20183. * of this software and associated documentation files (the "Software"), to deal
  20184. * in the Software without restriction, including without limitation the rights
  20185. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20186. * copies of the Software, and to permit persons to whom the Software is
  20187. * furnished to do so, subject to the following conditions:
  20188. *
  20189. * The above copyright notice and this permission notice shall be included in
  20190. * all copies or substantial portions of the Software.
  20191. *
  20192. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20193. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20194. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20195. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20196. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20197. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20198. * THE SOFTWARE.
  20199. */
  20200. Object.defineProperty(exports, "__esModule", { value: true });
  20201. var strings = {
  20202. ICON_EVENT: 'MDCTextField:icon',
  20203. ICON_ROLE: 'button'
  20204. };
  20205. exports.strings = strings;
  20206. var cssClasses = {
  20207. ROOT: 'mdc-text-field__icon'
  20208. };
  20209. exports.cssClasses = cssClasses;
  20210. /***/ }),
  20211. /***/ "./packages/mdc-textfield/icon/foundation.ts":
  20212. /*!***************************************************!*\
  20213. !*** ./packages/mdc-textfield/icon/foundation.ts ***!
  20214. \***************************************************/
  20215. /*! no static exports found */
  20216. /***/ (function(module, exports, __webpack_require__) {
  20217. "use strict";
  20218. /**
  20219. * @license
  20220. * Copyright 2017 Google Inc.
  20221. *
  20222. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20223. * of this software and associated documentation files (the "Software"), to deal
  20224. * in the Software without restriction, including without limitation the rights
  20225. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20226. * copies of the Software, and to permit persons to whom the Software is
  20227. * furnished to do so, subject to the following conditions:
  20228. *
  20229. * The above copyright notice and this permission notice shall be included in
  20230. * all copies or substantial portions of the Software.
  20231. *
  20232. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20233. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20234. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20235. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20236. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20237. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20238. * THE SOFTWARE.
  20239. */
  20240. var __extends = this && this.__extends || function () {
  20241. var _extendStatics = function extendStatics(d, b) {
  20242. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20243. d.__proto__ = b;
  20244. } || function (d, b) {
  20245. for (var p in b) {
  20246. if (b.hasOwnProperty(p)) d[p] = b[p];
  20247. }
  20248. };
  20249. return _extendStatics(d, b);
  20250. };
  20251. return function (d, b) {
  20252. _extendStatics(d, b);
  20253. function __() {
  20254. this.constructor = d;
  20255. }
  20256. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20257. };
  20258. }();
  20259. var __assign = this && this.__assign || function () {
  20260. __assign = Object.assign || function (t) {
  20261. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20262. s = arguments[i];
  20263. for (var p in s) {
  20264. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20265. }
  20266. }
  20267. return t;
  20268. };
  20269. return __assign.apply(this, arguments);
  20270. };
  20271. Object.defineProperty(exports, "__esModule", { value: true });
  20272. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20273. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  20274. var INTERACTION_EVENTS = ['click', 'keydown'];
  20275. var MDCTextFieldIconFoundation = /** @class */function (_super) {
  20276. __extends(MDCTextFieldIconFoundation, _super);
  20277. function MDCTextFieldIconFoundation(adapter) {
  20278. var _this = _super.call(this, __assign({}, MDCTextFieldIconFoundation.defaultAdapter, adapter)) || this;
  20279. _this.savedTabIndex_ = null;
  20280. _this.interactionHandler_ = function (evt) {
  20281. return _this.handleInteraction(evt);
  20282. };
  20283. return _this;
  20284. }
  20285. Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
  20286. get: function get() {
  20287. return constants_1.strings;
  20288. },
  20289. enumerable: true,
  20290. configurable: true
  20291. });
  20292. Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
  20293. get: function get() {
  20294. return constants_1.cssClasses;
  20295. },
  20296. enumerable: true,
  20297. configurable: true
  20298. });
  20299. Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
  20300. /**
  20301. * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.
  20302. */
  20303. get: function get() {
  20304. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20305. return {
  20306. getAttr: function getAttr() {
  20307. return null;
  20308. },
  20309. setAttr: function setAttr() {
  20310. return undefined;
  20311. },
  20312. removeAttr: function removeAttr() {
  20313. return undefined;
  20314. },
  20315. setContent: function setContent() {
  20316. return undefined;
  20317. },
  20318. registerInteractionHandler: function registerInteractionHandler() {
  20319. return undefined;
  20320. },
  20321. deregisterInteractionHandler: function deregisterInteractionHandler() {
  20322. return undefined;
  20323. },
  20324. notifyIconAction: function notifyIconAction() {
  20325. return undefined;
  20326. }
  20327. };
  20328. // tslint:enable:object-literal-sort-keys
  20329. },
  20330. enumerable: true,
  20331. configurable: true
  20332. });
  20333. MDCTextFieldIconFoundation.prototype.init = function () {
  20334. var _this = this;
  20335. this.savedTabIndex_ = this.adapter_.getAttr('tabindex');
  20336. INTERACTION_EVENTS.forEach(function (evtType) {
  20337. _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_);
  20338. });
  20339. };
  20340. MDCTextFieldIconFoundation.prototype.destroy = function () {
  20341. var _this = this;
  20342. INTERACTION_EVENTS.forEach(function (evtType) {
  20343. _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  20344. });
  20345. };
  20346. MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
  20347. if (!this.savedTabIndex_) {
  20348. return;
  20349. }
  20350. if (disabled) {
  20351. this.adapter_.setAttr('tabindex', '-1');
  20352. this.adapter_.removeAttr('role');
  20353. } else {
  20354. this.adapter_.setAttr('tabindex', this.savedTabIndex_);
  20355. this.adapter_.setAttr('role', constants_1.strings.ICON_ROLE);
  20356. }
  20357. };
  20358. MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
  20359. this.adapter_.setAttr('aria-label', label);
  20360. };
  20361. MDCTextFieldIconFoundation.prototype.setContent = function (content) {
  20362. this.adapter_.setContent(content);
  20363. };
  20364. MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
  20365. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  20366. if (evt.type === 'click' || isEnterKey) {
  20367. this.adapter_.notifyIconAction();
  20368. }
  20369. };
  20370. return MDCTextFieldIconFoundation;
  20371. }(foundation_1.MDCFoundation);
  20372. exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
  20373. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20374. exports.default = MDCTextFieldIconFoundation;
  20375. /***/ }),
  20376. /***/ "./packages/mdc-textfield/icon/index.ts":
  20377. /*!**********************************************!*\
  20378. !*** ./packages/mdc-textfield/icon/index.ts ***!
  20379. \**********************************************/
  20380. /*! no static exports found */
  20381. /***/ (function(module, exports, __webpack_require__) {
  20382. "use strict";
  20383. /**
  20384. * @license
  20385. * Copyright 2019 Google Inc.
  20386. *
  20387. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20388. * of this software and associated documentation files (the "Software"), to deal
  20389. * in the Software without restriction, including without limitation the rights
  20390. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20391. * copies of the Software, and to permit persons to whom the Software is
  20392. * furnished to do so, subject to the following conditions:
  20393. *
  20394. * The above copyright notice and this permission notice shall be included in
  20395. * all copies or substantial portions of the Software.
  20396. *
  20397. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20398. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20399. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20400. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20401. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20402. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20403. * THE SOFTWARE.
  20404. */
  20405. function __export(m) {
  20406. for (var p in m) {
  20407. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20408. }
  20409. }
  20410. Object.defineProperty(exports, "__esModule", { value: true });
  20411. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"));
  20412. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"));
  20413. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  20414. exports.iconCssClasses = constants_1.cssClasses;
  20415. exports.iconStrings = constants_1.strings;
  20416. /***/ }),
  20417. /***/ "./packages/mdc-textfield/index.ts":
  20418. /*!*****************************************!*\
  20419. !*** ./packages/mdc-textfield/index.ts ***!
  20420. \*****************************************/
  20421. /*! no static exports found */
  20422. /***/ (function(module, exports, __webpack_require__) {
  20423. "use strict";
  20424. /**
  20425. * @license
  20426. * Copyright 2019 Google Inc.
  20427. *
  20428. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20429. * of this software and associated documentation files (the "Software"), to deal
  20430. * in the Software without restriction, including without limitation the rights
  20431. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20432. * copies of the Software, and to permit persons to whom the Software is
  20433. * furnished to do so, subject to the following conditions:
  20434. *
  20435. * The above copyright notice and this permission notice shall be included in
  20436. * all copies or substantial portions of the Software.
  20437. *
  20438. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20439. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20440. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20441. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20442. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20443. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20444. * THE SOFTWARE.
  20445. */
  20446. function __export(m) {
  20447. for (var p in m) {
  20448. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20449. }
  20450. }
  20451. Object.defineProperty(exports, "__esModule", { value: true });
  20452. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"));
  20453. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"));
  20454. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"));
  20455. __export(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"));
  20456. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"));
  20457. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"));
  20458. /***/ }),
  20459. /***/ "./packages/mdc-top-app-bar/component.ts":
  20460. /*!***********************************************!*\
  20461. !*** ./packages/mdc-top-app-bar/component.ts ***!
  20462. \***********************************************/
  20463. /*! no static exports found */
  20464. /***/ (function(module, exports, __webpack_require__) {
  20465. "use strict";
  20466. /**
  20467. * @license
  20468. * Copyright 2018 Google Inc.
  20469. *
  20470. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20471. * of this software and associated documentation files (the "Software"), to deal
  20472. * in the Software without restriction, including without limitation the rights
  20473. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20474. * copies of the Software, and to permit persons to whom the Software is
  20475. * furnished to do so, subject to the following conditions:
  20476. *
  20477. * The above copyright notice and this permission notice shall be included in
  20478. * all copies or substantial portions of the Software.
  20479. *
  20480. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20481. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20482. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20483. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20484. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20485. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20486. * THE SOFTWARE.
  20487. */
  20488. var __extends = this && this.__extends || function () {
  20489. var _extendStatics = function extendStatics(d, b) {
  20490. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20491. d.__proto__ = b;
  20492. } || function (d, b) {
  20493. for (var p in b) {
  20494. if (b.hasOwnProperty(p)) d[p] = b[p];
  20495. }
  20496. };
  20497. return _extendStatics(d, b);
  20498. };
  20499. return function (d, b) {
  20500. _extendStatics(d, b);
  20501. function __() {
  20502. this.constructor = d;
  20503. }
  20504. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20505. };
  20506. }();
  20507. Object.defineProperty(exports, "__esModule", { value: true });
  20508. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20509. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  20510. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  20511. var foundation_1 = __webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts");
  20512. var foundation_2 = __webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts");
  20513. var foundation_3 = __webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  20514. var MDCTopAppBar = /** @class */function (_super) {
  20515. __extends(MDCTopAppBar, _super);
  20516. function MDCTopAppBar() {
  20517. return _super !== null && _super.apply(this, arguments) || this;
  20518. }
  20519. MDCTopAppBar.attachTo = function (root) {
  20520. return new MDCTopAppBar(root);
  20521. };
  20522. MDCTopAppBar.prototype.initialize = function (rippleFactory) {
  20523. if (rippleFactory === void 0) {
  20524. rippleFactory = function rippleFactory(el) {
  20525. return component_2.MDCRipple.attachTo(el);
  20526. };
  20527. }
  20528. this.navIcon_ = this.root_.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR);
  20529. // Get all icons in the toolbar and instantiate the ripples
  20530. var icons = [].slice.call(this.root_.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR));
  20531. if (this.navIcon_) {
  20532. icons.push(this.navIcon_);
  20533. }
  20534. this.iconRipples_ = icons.map(function (icon) {
  20535. var ripple = rippleFactory(icon);
  20536. ripple.unbounded = true;
  20537. return ripple;
  20538. });
  20539. this.scrollTarget_ = window;
  20540. };
  20541. MDCTopAppBar.prototype.initialSyncWithDOM = function () {
  20542. this.handleNavigationClick_ = this.foundation_.handleNavigationClick.bind(this.foundation_);
  20543. this.handleWindowResize_ = this.foundation_.handleWindowResize.bind(this.foundation_);
  20544. this.handleTargetScroll_ = this.foundation_.handleTargetScroll.bind(this.foundation_);
  20545. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  20546. if (this.navIcon_) {
  20547. this.navIcon_.addEventListener('click', this.handleNavigationClick_);
  20548. }
  20549. var isFixed = this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  20550. var isShort = this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  20551. if (!isShort && !isFixed) {
  20552. window.addEventListener('resize', this.handleWindowResize_);
  20553. }
  20554. };
  20555. MDCTopAppBar.prototype.destroy = function () {
  20556. this.iconRipples_.forEach(function (iconRipple) {
  20557. return iconRipple.destroy();
  20558. });
  20559. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  20560. if (this.navIcon_) {
  20561. this.navIcon_.removeEventListener('click', this.handleNavigationClick_);
  20562. }
  20563. var isFixed = this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  20564. var isShort = this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  20565. if (!isShort && !isFixed) {
  20566. window.removeEventListener('resize', this.handleWindowResize_);
  20567. }
  20568. _super.prototype.destroy.call(this);
  20569. };
  20570. MDCTopAppBar.prototype.setScrollTarget = function (target) {
  20571. // Remove scroll handler from the previous scroll target
  20572. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  20573. this.scrollTarget_ = target;
  20574. // Initialize scroll handler on the new scroll target
  20575. this.handleTargetScroll_ = this.foundation_.handleTargetScroll.bind(this.foundation_);
  20576. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  20577. };
  20578. MDCTopAppBar.prototype.getDefaultFoundation = function () {
  20579. var _this = this;
  20580. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20581. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20582. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20583. var adapter = {
  20584. hasClass: function hasClass(className) {
  20585. return _this.root_.classList.contains(className);
  20586. },
  20587. addClass: function addClass(className) {
  20588. return _this.root_.classList.add(className);
  20589. },
  20590. removeClass: function removeClass(className) {
  20591. return _this.root_.classList.remove(className);
  20592. },
  20593. setStyle: function setStyle(property, value) {
  20594. return _this.root_.style.setProperty(property, value);
  20595. },
  20596. getTopAppBarHeight: function getTopAppBarHeight() {
  20597. return _this.root_.clientHeight;
  20598. },
  20599. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  20600. return _this.emit(constants_1.strings.NAVIGATION_EVENT, {});
  20601. },
  20602. getViewportScrollY: function getViewportScrollY() {
  20603. var win = _this.scrollTarget_;
  20604. var el = _this.scrollTarget_;
  20605. return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop;
  20606. },
  20607. getTotalActionItems: function getTotalActionItems() {
  20608. return _this.root_.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length;
  20609. }
  20610. };
  20611. // tslint:enable:object-literal-sort-keys
  20612. var foundation;
  20613. if (this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS)) {
  20614. foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter);
  20615. } else if (this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS)) {
  20616. foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter);
  20617. } else {
  20618. foundation = new foundation_3.MDCTopAppBarFoundation(adapter);
  20619. }
  20620. return foundation;
  20621. };
  20622. return MDCTopAppBar;
  20623. }(component_1.MDCComponent);
  20624. exports.MDCTopAppBar = MDCTopAppBar;
  20625. /***/ }),
  20626. /***/ "./packages/mdc-top-app-bar/constants.ts":
  20627. /*!***********************************************!*\
  20628. !*** ./packages/mdc-top-app-bar/constants.ts ***!
  20629. \***********************************************/
  20630. /*! no static exports found */
  20631. /***/ (function(module, exports, __webpack_require__) {
  20632. "use strict";
  20633. /**
  20634. * @license
  20635. * Copyright 2018 Google Inc.
  20636. *
  20637. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20638. * of this software and associated documentation files (the "Software"), to deal
  20639. * in the Software without restriction, including without limitation the rights
  20640. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20641. * copies of the Software, and to permit persons to whom the Software is
  20642. * furnished to do so, subject to the following conditions:
  20643. *
  20644. * The above copyright notice and this permission notice shall be included in
  20645. * all copies or substantial portions of the Software.
  20646. *
  20647. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20648. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20649. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20650. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20651. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20652. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20653. * THE SOFTWARE.
  20654. */
  20655. Object.defineProperty(exports, "__esModule", { value: true });
  20656. var cssClasses = {
  20657. FIXED_CLASS: 'mdc-top-app-bar--fixed',
  20658. FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled',
  20659. SHORT_CLASS: 'mdc-top-app-bar--short',
  20660. SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed',
  20661. SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'
  20662. };
  20663. exports.cssClasses = cssClasses;
  20664. var numbers = {
  20665. DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100,
  20666. MAX_TOP_APP_BAR_HEIGHT: 128
  20667. };
  20668. exports.numbers = numbers;
  20669. var strings = {
  20670. ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item',
  20671. NAVIGATION_EVENT: 'MDCTopAppBar:nav',
  20672. NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon',
  20673. ROOT_SELECTOR: '.mdc-top-app-bar',
  20674. TITLE_SELECTOR: '.mdc-top-app-bar__title'
  20675. };
  20676. exports.strings = strings;
  20677. /***/ }),
  20678. /***/ "./packages/mdc-top-app-bar/fixed/foundation.ts":
  20679. /*!******************************************************!*\
  20680. !*** ./packages/mdc-top-app-bar/fixed/foundation.ts ***!
  20681. \******************************************************/
  20682. /*! no static exports found */
  20683. /***/ (function(module, exports, __webpack_require__) {
  20684. "use strict";
  20685. /**
  20686. * @license
  20687. * Copyright 2018 Google Inc.
  20688. *
  20689. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20690. * of this software and associated documentation files (the "Software"), to deal
  20691. * in the Software without restriction, including without limitation the rights
  20692. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20693. * copies of the Software, and to permit persons to whom the Software is
  20694. * furnished to do so, subject to the following conditions:
  20695. *
  20696. * The above copyright notice and this permission notice shall be included in
  20697. * all copies or substantial portions of the Software.
  20698. *
  20699. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20700. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20701. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20702. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20703. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20704. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20705. * THE SOFTWARE.
  20706. */
  20707. var __extends = this && this.__extends || function () {
  20708. var _extendStatics = function extendStatics(d, b) {
  20709. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20710. d.__proto__ = b;
  20711. } || function (d, b) {
  20712. for (var p in b) {
  20713. if (b.hasOwnProperty(p)) d[p] = b[p];
  20714. }
  20715. };
  20716. return _extendStatics(d, b);
  20717. };
  20718. return function (d, b) {
  20719. _extendStatics(d, b);
  20720. function __() {
  20721. this.constructor = d;
  20722. }
  20723. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20724. };
  20725. }();
  20726. Object.defineProperty(exports, "__esModule", { value: true });
  20727. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  20728. var foundation_1 = __webpack_require__(/*! ../standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  20729. var MDCFixedTopAppBarFoundation = /** @class */function (_super) {
  20730. __extends(MDCFixedTopAppBarFoundation, _super);
  20731. function MDCFixedTopAppBarFoundation() {
  20732. var _this = _super !== null && _super.apply(this, arguments) || this;
  20733. /**
  20734. * State variable for the previous scroll iteration top app bar state
  20735. */
  20736. _this.wasScrolled_ = false;
  20737. return _this;
  20738. }
  20739. /**
  20740. * Scroll handler for applying/removing the modifier class on the fixed top app bar.
  20741. * @override
  20742. */
  20743. MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () {
  20744. var currentScroll = this.adapter_.getViewportScrollY();
  20745. if (currentScroll <= 0) {
  20746. if (this.wasScrolled_) {
  20747. this.adapter_.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  20748. this.wasScrolled_ = false;
  20749. }
  20750. } else {
  20751. if (!this.wasScrolled_) {
  20752. this.adapter_.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  20753. this.wasScrolled_ = true;
  20754. }
  20755. }
  20756. };
  20757. return MDCFixedTopAppBarFoundation;
  20758. }(foundation_1.MDCTopAppBarFoundation);
  20759. exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation;
  20760. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20761. exports.default = MDCFixedTopAppBarFoundation;
  20762. /***/ }),
  20763. /***/ "./packages/mdc-top-app-bar/foundation.ts":
  20764. /*!************************************************!*\
  20765. !*** ./packages/mdc-top-app-bar/foundation.ts ***!
  20766. \************************************************/
  20767. /*! no static exports found */
  20768. /***/ (function(module, exports, __webpack_require__) {
  20769. "use strict";
  20770. /**
  20771. * @license
  20772. * Copyright 2018 Google Inc.
  20773. *
  20774. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20775. * of this software and associated documentation files (the "Software"), to deal
  20776. * in the Software without restriction, including without limitation the rights
  20777. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20778. * copies of the Software, and to permit persons to whom the Software is
  20779. * furnished to do so, subject to the following conditions:
  20780. *
  20781. * The above copyright notice and this permission notice shall be included in
  20782. * all copies or substantial portions of the Software.
  20783. *
  20784. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20785. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20786. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20787. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20788. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20789. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20790. * THE SOFTWARE.
  20791. */
  20792. var __extends = this && this.__extends || function () {
  20793. var _extendStatics = function extendStatics(d, b) {
  20794. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20795. d.__proto__ = b;
  20796. } || function (d, b) {
  20797. for (var p in b) {
  20798. if (b.hasOwnProperty(p)) d[p] = b[p];
  20799. }
  20800. };
  20801. return _extendStatics(d, b);
  20802. };
  20803. return function (d, b) {
  20804. _extendStatics(d, b);
  20805. function __() {
  20806. this.constructor = d;
  20807. }
  20808. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20809. };
  20810. }();
  20811. var __assign = this && this.__assign || function () {
  20812. __assign = Object.assign || function (t) {
  20813. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20814. s = arguments[i];
  20815. for (var p in s) {
  20816. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20817. }
  20818. }
  20819. return t;
  20820. };
  20821. return __assign.apply(this, arguments);
  20822. };
  20823. Object.defineProperty(exports, "__esModule", { value: true });
  20824. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20825. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  20826. var MDCTopAppBarBaseFoundation = /** @class */function (_super) {
  20827. __extends(MDCTopAppBarBaseFoundation, _super);
  20828. /* istanbul ignore next: optional argument is not a branch statement */
  20829. function MDCTopAppBarBaseFoundation(adapter) {
  20830. return _super.call(this, __assign({}, MDCTopAppBarBaseFoundation.defaultAdapter, adapter)) || this;
  20831. }
  20832. Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", {
  20833. get: function get() {
  20834. return constants_1.strings;
  20835. },
  20836. enumerable: true,
  20837. configurable: true
  20838. });
  20839. Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", {
  20840. get: function get() {
  20841. return constants_1.cssClasses;
  20842. },
  20843. enumerable: true,
  20844. configurable: true
  20845. });
  20846. Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", {
  20847. get: function get() {
  20848. return constants_1.numbers;
  20849. },
  20850. enumerable: true,
  20851. configurable: true
  20852. });
  20853. Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", {
  20854. /**
  20855. * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types.
  20856. */
  20857. get: function get() {
  20858. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20859. return {
  20860. addClass: function addClass() {
  20861. return undefined;
  20862. },
  20863. removeClass: function removeClass() {
  20864. return undefined;
  20865. },
  20866. hasClass: function hasClass() {
  20867. return false;
  20868. },
  20869. setStyle: function setStyle() {
  20870. return undefined;
  20871. },
  20872. getTopAppBarHeight: function getTopAppBarHeight() {
  20873. return 0;
  20874. },
  20875. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  20876. return undefined;
  20877. },
  20878. getViewportScrollY: function getViewportScrollY() {
  20879. return 0;
  20880. },
  20881. getTotalActionItems: function getTotalActionItems() {
  20882. return 0;
  20883. }
  20884. };
  20885. // tslint:enable:object-literal-sort-keys
  20886. },
  20887. enumerable: true,
  20888. configurable: true
  20889. });
  20890. /** Other variants of TopAppBar foundation overrides this method */
  20891. MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {}; // tslint:disable-line:no-empty
  20892. /** Other variants of TopAppBar foundation overrides this method */
  20893. MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {}; // tslint:disable-line:no-empty
  20894. MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () {
  20895. this.adapter_.notifyNavigationIconClicked();
  20896. };
  20897. return MDCTopAppBarBaseFoundation;
  20898. }(foundation_1.MDCFoundation);
  20899. exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation;
  20900. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20901. exports.default = MDCTopAppBarBaseFoundation;
  20902. /***/ }),
  20903. /***/ "./packages/mdc-top-app-bar/index.ts":
  20904. /*!*******************************************!*\
  20905. !*** ./packages/mdc-top-app-bar/index.ts ***!
  20906. \*******************************************/
  20907. /*! no static exports found */
  20908. /***/ (function(module, exports, __webpack_require__) {
  20909. "use strict";
  20910. /**
  20911. * @license
  20912. * Copyright 2019 Google Inc.
  20913. *
  20914. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20915. * of this software and associated documentation files (the "Software"), to deal
  20916. * in the Software without restriction, including without limitation the rights
  20917. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20918. * copies of the Software, and to permit persons to whom the Software is
  20919. * furnished to do so, subject to the following conditions:
  20920. *
  20921. * The above copyright notice and this permission notice shall be included in
  20922. * all copies or substantial portions of the Software.
  20923. *
  20924. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20925. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20926. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20927. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20928. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20929. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20930. * THE SOFTWARE.
  20931. */
  20932. function __export(m) {
  20933. for (var p in m) {
  20934. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20935. }
  20936. }
  20937. Object.defineProperty(exports, "__esModule", { value: true });
  20938. __export(__webpack_require__(/*! ./component */ "./packages/mdc-top-app-bar/component.ts"));
  20939. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"));
  20940. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-top-app-bar/foundation.ts"));
  20941. __export(__webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"));
  20942. __export(__webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"));
  20943. __export(__webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"));
  20944. /***/ }),
  20945. /***/ "./packages/mdc-top-app-bar/short/foundation.ts":
  20946. /*!******************************************************!*\
  20947. !*** ./packages/mdc-top-app-bar/short/foundation.ts ***!
  20948. \******************************************************/
  20949. /*! no static exports found */
  20950. /***/ (function(module, exports, __webpack_require__) {
  20951. "use strict";
  20952. /**
  20953. * @license
  20954. * Copyright 2018 Google Inc.
  20955. *
  20956. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20957. * of this software and associated documentation files (the "Software"), to deal
  20958. * in the Software without restriction, including without limitation the rights
  20959. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20960. * copies of the Software, and to permit persons to whom the Software is
  20961. * furnished to do so, subject to the following conditions:
  20962. *
  20963. * The above copyright notice and this permission notice shall be included in
  20964. * all copies or substantial portions of the Software.
  20965. *
  20966. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20967. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20968. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20969. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20970. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20971. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20972. * THE SOFTWARE.
  20973. */
  20974. var __extends = this && this.__extends || function () {
  20975. var _extendStatics = function extendStatics(d, b) {
  20976. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20977. d.__proto__ = b;
  20978. } || function (d, b) {
  20979. for (var p in b) {
  20980. if (b.hasOwnProperty(p)) d[p] = b[p];
  20981. }
  20982. };
  20983. return _extendStatics(d, b);
  20984. };
  20985. return function (d, b) {
  20986. _extendStatics(d, b);
  20987. function __() {
  20988. this.constructor = d;
  20989. }
  20990. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20991. };
  20992. }();
  20993. Object.defineProperty(exports, "__esModule", { value: true });
  20994. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  20995. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  20996. var MDCShortTopAppBarFoundation = /** @class */function (_super) {
  20997. __extends(MDCShortTopAppBarFoundation, _super);
  20998. /* istanbul ignore next: optional argument is not a branch statement */
  20999. function MDCShortTopAppBarFoundation(adapter) {
  21000. var _this = _super.call(this, adapter) || this;
  21001. _this.isCollapsed_ = false;
  21002. return _this;
  21003. }
  21004. Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", {
  21005. // Public visibility for backward compatibility.
  21006. get: function get() {
  21007. return this.isCollapsed_;
  21008. },
  21009. enumerable: true,
  21010. configurable: true
  21011. });
  21012. MDCShortTopAppBarFoundation.prototype.init = function () {
  21013. _super.prototype.init.call(this);
  21014. if (this.adapter_.getTotalActionItems() > 0) {
  21015. this.adapter_.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS);
  21016. }
  21017. // this is intended as the short variant must calculate if the
  21018. // page starts off from the top of the page.
  21019. this.handleTargetScroll();
  21020. };
  21021. /**
  21022. * Scroll handler for applying/removing the collapsed modifier class on the short top app bar.
  21023. * @override
  21024. */
  21025. MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () {
  21026. if (this.adapter_.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS)) {
  21027. return;
  21028. }
  21029. var currentScroll = this.adapter_.getViewportScrollY();
  21030. if (currentScroll <= 0) {
  21031. if (this.isCollapsed_) {
  21032. this.adapter_.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  21033. this.isCollapsed_ = false;
  21034. }
  21035. } else {
  21036. if (!this.isCollapsed_) {
  21037. this.adapter_.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  21038. this.isCollapsed_ = true;
  21039. }
  21040. }
  21041. };
  21042. return MDCShortTopAppBarFoundation;
  21043. }(foundation_1.MDCTopAppBarBaseFoundation);
  21044. exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation;
  21045. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  21046. exports.default = MDCShortTopAppBarFoundation;
  21047. /***/ }),
  21048. /***/ "./packages/mdc-top-app-bar/standard/foundation.ts":
  21049. /*!*********************************************************!*\
  21050. !*** ./packages/mdc-top-app-bar/standard/foundation.ts ***!
  21051. \*********************************************************/
  21052. /*! no static exports found */
  21053. /***/ (function(module, exports, __webpack_require__) {
  21054. "use strict";
  21055. /**
  21056. * @license
  21057. * Copyright 2018 Google Inc.
  21058. *
  21059. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21060. * of this software and associated documentation files (the "Software"), to deal
  21061. * in the Software without restriction, including without limitation the rights
  21062. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21063. * copies of the Software, and to permit persons to whom the Software is
  21064. * furnished to do so, subject to the following conditions:
  21065. *
  21066. * The above copyright notice and this permission notice shall be included in
  21067. * all copies or substantial portions of the Software.
  21068. *
  21069. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21070. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21071. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21072. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21073. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21074. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21075. * THE SOFTWARE.
  21076. */
  21077. var __extends = this && this.__extends || function () {
  21078. var _extendStatics = function extendStatics(d, b) {
  21079. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  21080. d.__proto__ = b;
  21081. } || function (d, b) {
  21082. for (var p in b) {
  21083. if (b.hasOwnProperty(p)) d[p] = b[p];
  21084. }
  21085. };
  21086. return _extendStatics(d, b);
  21087. };
  21088. return function (d, b) {
  21089. _extendStatics(d, b);
  21090. function __() {
  21091. this.constructor = d;
  21092. }
  21093. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21094. };
  21095. }();
  21096. Object.defineProperty(exports, "__esModule", { value: true });
  21097. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  21098. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  21099. var INITIAL_VALUE = 0;
  21100. var MDCTopAppBarFoundation = /** @class */function (_super) {
  21101. __extends(MDCTopAppBarFoundation, _super);
  21102. /* istanbul ignore next: optional argument is not a branch statement */
  21103. function MDCTopAppBarFoundation(adapter) {
  21104. var _this = _super.call(this, adapter) || this;
  21105. /**
  21106. * Indicates if the top app bar was docked in the previous scroll handler iteration.
  21107. */
  21108. _this.wasDocked_ = true;
  21109. /**
  21110. * Indicates if the top app bar is docked in the fully shown position.
  21111. */
  21112. _this.isDockedShowing_ = true;
  21113. /**
  21114. * Variable for current scroll position of the top app bar
  21115. */
  21116. _this.currentAppBarOffsetTop_ = 0;
  21117. /**
  21118. * Used to prevent the top app bar from being scrolled out of view during resize events
  21119. */
  21120. _this.isCurrentlyBeingResized_ = false;
  21121. /**
  21122. * The timeout that's used to throttle the resize events
  21123. */
  21124. _this.resizeThrottleId_ = INITIAL_VALUE;
  21125. /**
  21126. * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize
  21127. */
  21128. _this.resizeDebounceId_ = INITIAL_VALUE;
  21129. _this.lastScrollPosition_ = _this.adapter_.getViewportScrollY();
  21130. _this.topAppBarHeight_ = _this.adapter_.getTopAppBarHeight();
  21131. return _this;
  21132. }
  21133. MDCTopAppBarFoundation.prototype.destroy = function () {
  21134. _super.prototype.destroy.call(this);
  21135. this.adapter_.setStyle('top', '');
  21136. };
  21137. /**
  21138. * Scroll handler for the default scroll behavior of the top app bar.
  21139. * @override
  21140. */
  21141. MDCTopAppBarFoundation.prototype.handleTargetScroll = function () {
  21142. var currentScrollPosition = Math.max(this.adapter_.getViewportScrollY(), 0);
  21143. var diff = currentScrollPosition - this.lastScrollPosition_;
  21144. this.lastScrollPosition_ = currentScrollPosition;
  21145. // If the window is being resized the lastScrollPosition_ needs to be updated but the
  21146. // current scroll of the top app bar should stay in the same position.
  21147. if (!this.isCurrentlyBeingResized_) {
  21148. this.currentAppBarOffsetTop_ -= diff;
  21149. if (this.currentAppBarOffsetTop_ > 0) {
  21150. this.currentAppBarOffsetTop_ = 0;
  21151. } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) {
  21152. this.currentAppBarOffsetTop_ = -this.topAppBarHeight_;
  21153. }
  21154. this.moveTopAppBar_();
  21155. }
  21156. };
  21157. /**
  21158. * Top app bar resize handler that throttle/debounce functions that execute updates.
  21159. * @override
  21160. */
  21161. MDCTopAppBarFoundation.prototype.handleWindowResize = function () {
  21162. var _this = this;
  21163. // Throttle resize events 10 p/s
  21164. if (!this.resizeThrottleId_) {
  21165. this.resizeThrottleId_ = setTimeout(function () {
  21166. _this.resizeThrottleId_ = INITIAL_VALUE;
  21167. _this.throttledResizeHandler_();
  21168. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  21169. }
  21170. this.isCurrentlyBeingResized_ = true;
  21171. if (this.resizeDebounceId_) {
  21172. clearTimeout(this.resizeDebounceId_);
  21173. }
  21174. this.resizeDebounceId_ = setTimeout(function () {
  21175. _this.handleTargetScroll();
  21176. _this.isCurrentlyBeingResized_ = false;
  21177. _this.resizeDebounceId_ = INITIAL_VALUE;
  21178. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  21179. };
  21180. /**
  21181. * Function to determine if the DOM needs to update.
  21182. */
  21183. MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () {
  21184. var offscreenBoundaryTop = -this.topAppBarHeight_;
  21185. var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0;
  21186. var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop;
  21187. var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen;
  21188. // If it's partially showing, it can't be docked.
  21189. if (partiallyShowing) {
  21190. this.wasDocked_ = false;
  21191. } else {
  21192. // Not previously docked and not partially showing, it's now docked.
  21193. if (!this.wasDocked_) {
  21194. this.wasDocked_ = true;
  21195. return true;
  21196. } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) {
  21197. this.isDockedShowing_ = hasAnyPixelsOnscreen;
  21198. return true;
  21199. }
  21200. }
  21201. return partiallyShowing;
  21202. };
  21203. /**
  21204. * Function to move the top app bar if needed.
  21205. */
  21206. MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () {
  21207. if (this.checkForUpdate_()) {
  21208. // Once the top app bar is fully hidden we use the max potential top app bar height as our offset
  21209. // so the top app bar doesn't show if the window resizes and the new height > the old height.
  21210. var offset = this.currentAppBarOffsetTop_;
  21211. if (Math.abs(offset) >= this.topAppBarHeight_) {
  21212. offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT;
  21213. }
  21214. this.adapter_.setStyle('top', offset + 'px');
  21215. }
  21216. };
  21217. /**
  21218. * Throttled function that updates the top app bar scrolled values if the
  21219. * top app bar height changes.
  21220. */
  21221. MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () {
  21222. var currentHeight = this.adapter_.getTopAppBarHeight();
  21223. if (this.topAppBarHeight_ !== currentHeight) {
  21224. this.wasDocked_ = false;
  21225. // Since the top app bar has a different height depending on the screen width, this
  21226. // will ensure that the top app bar remains in the correct location if
  21227. // completely hidden and a resize makes the top app bar a different height.
  21228. this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight;
  21229. this.topAppBarHeight_ = currentHeight;
  21230. }
  21231. this.handleTargetScroll();
  21232. };
  21233. return MDCTopAppBarFoundation;
  21234. }(foundation_1.MDCTopAppBarBaseFoundation);
  21235. exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation;
  21236. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  21237. exports.default = MDCTopAppBarFoundation;
  21238. /***/ })
  21239. /******/ });
  21240. });
  21241. //# sourceMappingURL=material-components-web.js.map