material-components-web.js 913 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295
  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. /**
  7722. * Updates the list item at itemIndex to the desired isEnabled state.
  7723. * @param itemIndex Index of the list item
  7724. * @param isEnabled Sets the list item to enabled or disabled.
  7725. */
  7726. MDCList.prototype.setEnabled = function (itemIndex, isEnabled) {
  7727. this.foundation_.setEnabled(itemIndex, isEnabled);
  7728. };
  7729. MDCList.prototype.getDefaultFoundation = function () {
  7730. var _this = this;
  7731. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7732. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7733. var adapter = {
  7734. addClassForElementIndex: function addClassForElementIndex(index, className) {
  7735. var element = _this.listElements[index];
  7736. if (element) {
  7737. element.classList.add(className);
  7738. }
  7739. },
  7740. focusItemAtIndex: function focusItemAtIndex(index) {
  7741. var element = _this.listElements[index];
  7742. if (element) {
  7743. element.focus();
  7744. }
  7745. },
  7746. getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) {
  7747. return _this.listElements[index].getAttribute(attr);
  7748. },
  7749. getFocusedElementIndex: function getFocusedElementIndex() {
  7750. return _this.listElements.indexOf(document.activeElement);
  7751. },
  7752. getListItemCount: function getListItemCount() {
  7753. return _this.listElements.length;
  7754. },
  7755. hasCheckboxAtIndex: function hasCheckboxAtIndex(index) {
  7756. var listItem = _this.listElements[index];
  7757. return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  7758. },
  7759. hasRadioAtIndex: function hasRadioAtIndex(index) {
  7760. var listItem = _this.listElements[index];
  7761. return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR);
  7762. },
  7763. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) {
  7764. var listItem = _this.listElements[index];
  7765. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  7766. return toggleEl.checked;
  7767. },
  7768. isFocusInsideList: function isFocusInsideList() {
  7769. return _this.root_.contains(document.activeElement);
  7770. },
  7771. isRootFocused: function isRootFocused() {
  7772. return document.activeElement === _this.root_;
  7773. },
  7774. notifyAction: function notifyAction(index) {
  7775. _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true);
  7776. },
  7777. removeClassForElementIndex: function removeClassForElementIndex(index, className) {
  7778. var element = _this.listElements[index];
  7779. if (element) {
  7780. element.classList.remove(className);
  7781. }
  7782. },
  7783. setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) {
  7784. var element = _this.listElements[index];
  7785. if (element) {
  7786. element.setAttribute(attr, value);
  7787. }
  7788. },
  7789. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) {
  7790. var listItem = _this.listElements[index];
  7791. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  7792. toggleEl.checked = isChecked;
  7793. var event = document.createEvent('Event');
  7794. event.initEvent('change', true, true);
  7795. toggleEl.dispatchEvent(event);
  7796. },
  7797. setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {
  7798. var element = _this.listElements[listItemIndex];
  7799. var listItemChildren = [].slice.call(element.querySelectorAll(constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX));
  7800. listItemChildren.forEach(function (el) {
  7801. return el.setAttribute('tabindex', tabIndexValue);
  7802. });
  7803. }
  7804. };
  7805. return new foundation_1.MDCListFoundation(adapter);
  7806. };
  7807. /**
  7808. * Used to figure out which list item this event is targetting. Or returns -1 if
  7809. * there is no list item
  7810. */
  7811. MDCList.prototype.getListItemIndex_ = function (evt) {
  7812. var eventTarget = evt.target;
  7813. var nearestParent = ponyfill_1.closest(eventTarget, "." + constants_1.cssClasses.LIST_ITEM_CLASS + ", ." + constants_1.cssClasses.ROOT);
  7814. // Get the index of the element if it is a list item.
  7815. if (nearestParent && ponyfill_1.matches(nearestParent, "." + constants_1.cssClasses.LIST_ITEM_CLASS)) {
  7816. return this.listElements.indexOf(nearestParent);
  7817. }
  7818. return -1;
  7819. };
  7820. /**
  7821. * Used to figure out which element was clicked before sending the event to the foundation.
  7822. */
  7823. MDCList.prototype.handleFocusInEvent_ = function (evt) {
  7824. var index = this.getListItemIndex_(evt);
  7825. this.foundation_.handleFocusIn(evt, index);
  7826. };
  7827. /**
  7828. * Used to figure out which element was clicked before sending the event to the foundation.
  7829. */
  7830. MDCList.prototype.handleFocusOutEvent_ = function (evt) {
  7831. var index = this.getListItemIndex_(evt);
  7832. this.foundation_.handleFocusOut(evt, index);
  7833. };
  7834. /**
  7835. * Used to figure out which element was focused when keydown event occurred before sending the event to the
  7836. * foundation.
  7837. */
  7838. MDCList.prototype.handleKeydownEvent_ = function (evt) {
  7839. var index = this.getListItemIndex_(evt);
  7840. var target = evt.target;
  7841. this.foundation_.handleKeydown(evt, target.classList.contains(constants_1.cssClasses.LIST_ITEM_CLASS), index);
  7842. };
  7843. /**
  7844. * Used to figure out which element was clicked before sending the event to the foundation.
  7845. */
  7846. MDCList.prototype.handleClickEvent_ = function (evt) {
  7847. var index = this.getListItemIndex_(evt);
  7848. var target = evt.target;
  7849. // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
  7850. var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  7851. this.foundation_.handleClick(index, toggleCheckbox);
  7852. };
  7853. return MDCList;
  7854. }(component_1.MDCComponent);
  7855. exports.MDCList = MDCList;
  7856. /***/ }),
  7857. /***/ "./packages/mdc-list/constants.ts":
  7858. /*!****************************************!*\
  7859. !*** ./packages/mdc-list/constants.ts ***!
  7860. \****************************************/
  7861. /*! no static exports found */
  7862. /***/ (function(module, exports, __webpack_require__) {
  7863. "use strict";
  7864. /**
  7865. * @license
  7866. * Copyright 2018 Google Inc.
  7867. *
  7868. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7869. * of this software and associated documentation files (the "Software"), to deal
  7870. * in the Software without restriction, including without limitation the rights
  7871. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7872. * copies of the Software, and to permit persons to whom the Software is
  7873. * furnished to do so, subject to the following conditions:
  7874. *
  7875. * The above copyright notice and this permission notice shall be included in
  7876. * all copies or substantial portions of the Software.
  7877. *
  7878. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7879. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7880. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7881. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7882. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7883. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7884. * THE SOFTWARE.
  7885. */
  7886. Object.defineProperty(exports, "__esModule", { value: true });
  7887. var cssClasses = {
  7888. LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
  7889. LIST_ITEM_CLASS: 'mdc-list-item',
  7890. LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
  7891. LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
  7892. ROOT: 'mdc-list'
  7893. };
  7894. exports.cssClasses = cssClasses;
  7895. var strings = {
  7896. ACTION_EVENT: 'MDCList:action',
  7897. ARIA_CHECKED: 'aria-checked',
  7898. ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
  7899. ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
  7900. ARIA_CURRENT: 'aria-current',
  7901. ARIA_DISABLED: 'aria-disabled',
  7902. ARIA_ORIENTATION: 'aria-orientation',
  7903. ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
  7904. ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
  7905. ARIA_SELECTED: 'aria-selected',
  7906. CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)',
  7907. CHECKBOX_SELECTOR: 'input[type="checkbox"]:not(:disabled)',
  7908. CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ",
  7909. 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 ",
  7910. RADIO_SELECTOR: 'input[type="radio"]:not(:disabled)'
  7911. };
  7912. exports.strings = strings;
  7913. var numbers = {
  7914. UNSET_INDEX: -1
  7915. };
  7916. exports.numbers = numbers;
  7917. /***/ }),
  7918. /***/ "./packages/mdc-list/foundation.ts":
  7919. /*!*****************************************!*\
  7920. !*** ./packages/mdc-list/foundation.ts ***!
  7921. \*****************************************/
  7922. /*! no static exports found */
  7923. /***/ (function(module, exports, __webpack_require__) {
  7924. "use strict";
  7925. /**
  7926. * @license
  7927. * Copyright 2018 Google Inc.
  7928. *
  7929. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7930. * of this software and associated documentation files (the "Software"), to deal
  7931. * in the Software without restriction, including without limitation the rights
  7932. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7933. * copies of the Software, and to permit persons to whom the Software is
  7934. * furnished to do so, subject to the following conditions:
  7935. *
  7936. * The above copyright notice and this permission notice shall be included in
  7937. * all copies or substantial portions of the Software.
  7938. *
  7939. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7940. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7941. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7942. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7943. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7944. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7945. * THE SOFTWARE.
  7946. */
  7947. var __extends = this && this.__extends || function () {
  7948. var _extendStatics = function extendStatics(d, b) {
  7949. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7950. d.__proto__ = b;
  7951. } || function (d, b) {
  7952. for (var p in b) {
  7953. if (b.hasOwnProperty(p)) d[p] = b[p];
  7954. }
  7955. };
  7956. return _extendStatics(d, b);
  7957. };
  7958. return function (d, b) {
  7959. _extendStatics(d, b);
  7960. function __() {
  7961. this.constructor = d;
  7962. }
  7963. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7964. };
  7965. }();
  7966. var __assign = this && this.__assign || function () {
  7967. __assign = Object.assign || function (t) {
  7968. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7969. s = arguments[i];
  7970. for (var p in s) {
  7971. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7972. }
  7973. }
  7974. return t;
  7975. };
  7976. return __assign.apply(this, arguments);
  7977. };
  7978. Object.defineProperty(exports, "__esModule", { value: true });
  7979. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7980. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  7981. var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
  7982. function isNumberArray(selectedIndex) {
  7983. return selectedIndex instanceof Array;
  7984. }
  7985. var MDCListFoundation = /** @class */function (_super) {
  7986. __extends(MDCListFoundation, _super);
  7987. function MDCListFoundation(adapter) {
  7988. var _this = _super.call(this, __assign({}, MDCListFoundation.defaultAdapter, adapter)) || this;
  7989. _this.wrapFocus_ = false;
  7990. _this.isVertical_ = true;
  7991. _this.isSingleSelectionList_ = false;
  7992. _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX;
  7993. _this.focusedItemIndex_ = constants_1.numbers.UNSET_INDEX;
  7994. _this.useActivatedClass_ = false;
  7995. _this.ariaCurrentAttrValue_ = null;
  7996. _this.isCheckboxList_ = false;
  7997. _this.isRadioList_ = false;
  7998. return _this;
  7999. }
  8000. Object.defineProperty(MDCListFoundation, "strings", {
  8001. get: function get() {
  8002. return constants_1.strings;
  8003. },
  8004. enumerable: true,
  8005. configurable: true
  8006. });
  8007. Object.defineProperty(MDCListFoundation, "cssClasses", {
  8008. get: function get() {
  8009. return constants_1.cssClasses;
  8010. },
  8011. enumerable: true,
  8012. configurable: true
  8013. });
  8014. Object.defineProperty(MDCListFoundation, "numbers", {
  8015. get: function get() {
  8016. return constants_1.numbers;
  8017. },
  8018. enumerable: true,
  8019. configurable: true
  8020. });
  8021. Object.defineProperty(MDCListFoundation, "defaultAdapter", {
  8022. get: function get() {
  8023. return {
  8024. addClassForElementIndex: function addClassForElementIndex() {
  8025. return undefined;
  8026. },
  8027. focusItemAtIndex: function focusItemAtIndex() {
  8028. return undefined;
  8029. },
  8030. getAttributeForElementIndex: function getAttributeForElementIndex() {
  8031. return null;
  8032. },
  8033. getFocusedElementIndex: function getFocusedElementIndex() {
  8034. return 0;
  8035. },
  8036. getListItemCount: function getListItemCount() {
  8037. return 0;
  8038. },
  8039. hasCheckboxAtIndex: function hasCheckboxAtIndex() {
  8040. return false;
  8041. },
  8042. hasRadioAtIndex: function hasRadioAtIndex() {
  8043. return false;
  8044. },
  8045. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() {
  8046. return false;
  8047. },
  8048. isFocusInsideList: function isFocusInsideList() {
  8049. return false;
  8050. },
  8051. isRootFocused: function isRootFocused() {
  8052. return false;
  8053. },
  8054. notifyAction: function notifyAction() {
  8055. return undefined;
  8056. },
  8057. removeClassForElementIndex: function removeClassForElementIndex() {
  8058. return undefined;
  8059. },
  8060. setAttributeForElementIndex: function setAttributeForElementIndex() {
  8061. return undefined;
  8062. },
  8063. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() {
  8064. return undefined;
  8065. },
  8066. setTabIndexForListItemChildren: function setTabIndexForListItemChildren() {
  8067. return undefined;
  8068. }
  8069. };
  8070. },
  8071. enumerable: true,
  8072. configurable: true
  8073. });
  8074. MDCListFoundation.prototype.layout = function () {
  8075. if (this.adapter_.getListItemCount() === 0) {
  8076. return;
  8077. }
  8078. if (this.adapter_.hasCheckboxAtIndex(0)) {
  8079. this.isCheckboxList_ = true;
  8080. } else if (this.adapter_.hasRadioAtIndex(0)) {
  8081. this.isRadioList_ = true;
  8082. }
  8083. };
  8084. /**
  8085. * Sets the private wrapFocus_ variable.
  8086. */
  8087. MDCListFoundation.prototype.setWrapFocus = function (value) {
  8088. this.wrapFocus_ = value;
  8089. };
  8090. /**
  8091. * Sets the isVertical_ private variable.
  8092. */
  8093. MDCListFoundation.prototype.setVerticalOrientation = function (value) {
  8094. this.isVertical_ = value;
  8095. };
  8096. /**
  8097. * Sets the isSingleSelectionList_ private variable.
  8098. */
  8099. MDCListFoundation.prototype.setSingleSelection = function (value) {
  8100. this.isSingleSelectionList_ = value;
  8101. };
  8102. /**
  8103. * Sets the useActivatedClass_ private variable.
  8104. */
  8105. MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
  8106. this.useActivatedClass_ = useActivated;
  8107. };
  8108. MDCListFoundation.prototype.getSelectedIndex = function () {
  8109. return this.selectedIndex_;
  8110. };
  8111. MDCListFoundation.prototype.setSelectedIndex = function (index) {
  8112. if (!this.isIndexValid_(index)) {
  8113. return;
  8114. }
  8115. if (this.isCheckboxList_) {
  8116. this.setCheckboxAtIndex_(index);
  8117. } else if (this.isRadioList_) {
  8118. this.setRadioAtIndex_(index);
  8119. } else {
  8120. this.setSingleSelectionAtIndex_(index);
  8121. }
  8122. };
  8123. /**
  8124. * Focus in handler for the list items.
  8125. */
  8126. MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) {
  8127. if (listItemIndex >= 0) {
  8128. this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0');
  8129. }
  8130. };
  8131. /**
  8132. * Focus out handler for the list items.
  8133. */
  8134. MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) {
  8135. var _this = this;
  8136. if (listItemIndex >= 0) {
  8137. this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1');
  8138. }
  8139. /**
  8140. * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus
  8141. * is moved to next element.
  8142. */
  8143. setTimeout(function () {
  8144. if (!_this.adapter_.isFocusInsideList()) {
  8145. _this.setTabindexToFirstSelectedItem_();
  8146. }
  8147. }, 0);
  8148. };
  8149. /**
  8150. * Key handler for the list.
  8151. */
  8152. MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) {
  8153. var isArrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37;
  8154. var isArrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38;
  8155. var isArrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39;
  8156. var isArrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40;
  8157. var isHome = evt.key === 'Home' || evt.keyCode === 36;
  8158. var isEnd = evt.key === 'End' || evt.keyCode === 35;
  8159. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  8160. var isSpace = evt.key === 'Space' || evt.keyCode === 32;
  8161. if (this.adapter_.isRootFocused()) {
  8162. if (isArrowUp || isEnd) {
  8163. evt.preventDefault();
  8164. this.focusLastElement();
  8165. } else if (isArrowDown || isHome) {
  8166. evt.preventDefault();
  8167. this.focusFirstElement();
  8168. }
  8169. return;
  8170. }
  8171. var currentIndex = this.adapter_.getFocusedElementIndex();
  8172. if (currentIndex === -1) {
  8173. currentIndex = listItemIndex;
  8174. if (currentIndex < 0) {
  8175. // If this event doesn't have a mdc-list-item ancestor from the
  8176. // current list (not from a sublist), return early.
  8177. return;
  8178. }
  8179. }
  8180. var nextIndex;
  8181. if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) {
  8182. this.preventDefaultEvent_(evt);
  8183. nextIndex = this.focusNextElement(currentIndex);
  8184. } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) {
  8185. this.preventDefaultEvent_(evt);
  8186. nextIndex = this.focusPrevElement(currentIndex);
  8187. } else if (isHome) {
  8188. this.preventDefaultEvent_(evt);
  8189. nextIndex = this.focusFirstElement();
  8190. } else if (isEnd) {
  8191. this.preventDefaultEvent_(evt);
  8192. nextIndex = this.focusLastElement();
  8193. } else if (isEnter || isSpace) {
  8194. if (isRootListItem) {
  8195. // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event.
  8196. var target = evt.target;
  8197. if (target && target.tagName === 'A' && isEnter) {
  8198. return;
  8199. }
  8200. this.preventDefaultEvent_(evt);
  8201. if (this.isSelectableList_()) {
  8202. this.setSelectedIndexOnAction_(currentIndex);
  8203. }
  8204. this.adapter_.notifyAction(currentIndex);
  8205. }
  8206. }
  8207. this.focusedItemIndex_ = currentIndex;
  8208. if (nextIndex !== undefined) {
  8209. this.setTabindexAtIndex_(nextIndex);
  8210. this.focusedItemIndex_ = nextIndex;
  8211. }
  8212. };
  8213. /**
  8214. * Click handler for the list.
  8215. */
  8216. MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) {
  8217. if (index === constants_1.numbers.UNSET_INDEX) {
  8218. return;
  8219. }
  8220. if (this.isSelectableList_()) {
  8221. this.setSelectedIndexOnAction_(index, toggleCheckbox);
  8222. }
  8223. this.adapter_.notifyAction(index);
  8224. this.setTabindexAtIndex_(index);
  8225. this.focusedItemIndex_ = index;
  8226. };
  8227. /**
  8228. * Focuses the next element on the list.
  8229. */
  8230. MDCListFoundation.prototype.focusNextElement = function (index) {
  8231. var count = this.adapter_.getListItemCount();
  8232. var nextIndex = index + 1;
  8233. if (nextIndex >= count) {
  8234. if (this.wrapFocus_) {
  8235. nextIndex = 0;
  8236. } else {
  8237. // Return early because last item is already focused.
  8238. return index;
  8239. }
  8240. }
  8241. this.adapter_.focusItemAtIndex(nextIndex);
  8242. return nextIndex;
  8243. };
  8244. /**
  8245. * Focuses the previous element on the list.
  8246. */
  8247. MDCListFoundation.prototype.focusPrevElement = function (index) {
  8248. var prevIndex = index - 1;
  8249. if (prevIndex < 0) {
  8250. if (this.wrapFocus_) {
  8251. prevIndex = this.adapter_.getListItemCount() - 1;
  8252. } else {
  8253. // Return early because first item is already focused.
  8254. return index;
  8255. }
  8256. }
  8257. this.adapter_.focusItemAtIndex(prevIndex);
  8258. return prevIndex;
  8259. };
  8260. MDCListFoundation.prototype.focusFirstElement = function () {
  8261. this.adapter_.focusItemAtIndex(0);
  8262. return 0;
  8263. };
  8264. MDCListFoundation.prototype.focusLastElement = function () {
  8265. var lastIndex = this.adapter_.getListItemCount() - 1;
  8266. this.adapter_.focusItemAtIndex(lastIndex);
  8267. return lastIndex;
  8268. };
  8269. /**
  8270. * @param itemIndex Index of the list item
  8271. * @param isEnabled Sets the list item to enabled or disabled.
  8272. */
  8273. MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
  8274. if (!this.isIndexValid_(itemIndex)) {
  8275. return;
  8276. }
  8277. if (isEnabled) {
  8278. this.adapter_.removeClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  8279. this.adapter_.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false');
  8280. } else {
  8281. this.adapter_.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  8282. this.adapter_.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true');
  8283. }
  8284. };
  8285. /**
  8286. * Ensures that preventDefault is only called if the containing element doesn't
  8287. * consume the event, and it will cause an unintended scroll.
  8288. */
  8289. MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) {
  8290. var target = evt.target;
  8291. var tagName = ("" + target.tagName).toLowerCase();
  8292. if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
  8293. evt.preventDefault();
  8294. }
  8295. };
  8296. MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) {
  8297. if (this.selectedIndex_ === index) {
  8298. return;
  8299. }
  8300. var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS;
  8301. if (this.useActivatedClass_) {
  8302. selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS;
  8303. }
  8304. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8305. this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName);
  8306. }
  8307. this.adapter_.addClassForElementIndex(index, selectedClassName);
  8308. this.setAriaForSingleSelectionAtIndex_(index);
  8309. this.selectedIndex_ = index;
  8310. };
  8311. /**
  8312. * Sets aria attribute for single selection at given index.
  8313. */
  8314. MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) {
  8315. // Detect the presence of aria-current and get the value only during list initialization when it is in unset state.
  8316. if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) {
  8317. this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT);
  8318. }
  8319. var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
  8320. var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED;
  8321. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8322. this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
  8323. }
  8324. var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
  8325. this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
  8326. };
  8327. /**
  8328. * Toggles radio at give index. Radio doesn't change the checked state if it is already checked.
  8329. */
  8330. MDCListFoundation.prototype.setRadioAtIndex_ = function (index) {
  8331. this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true);
  8332. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8333. this.adapter_.setAttributeForElementIndex(this.selectedIndex_, constants_1.strings.ARIA_CHECKED, 'false');
  8334. }
  8335. this.adapter_.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, 'true');
  8336. this.selectedIndex_ = index;
  8337. };
  8338. MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) {
  8339. for (var i = 0; i < this.adapter_.getListItemCount(); i++) {
  8340. var isChecked = false;
  8341. if (index.indexOf(i) >= 0) {
  8342. isChecked = true;
  8343. }
  8344. this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
  8345. this.adapter_.setAttributeForElementIndex(i, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  8346. }
  8347. this.selectedIndex_ = index;
  8348. };
  8349. MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) {
  8350. if (this.focusedItemIndex_ === constants_1.numbers.UNSET_INDEX && index !== 0) {
  8351. // If no list item was selected set first list item's tabindex to -1.
  8352. // Generally, tabindex is set to 0 on first list item of list that has no preselected items.
  8353. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1');
  8354. } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) {
  8355. this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1');
  8356. }
  8357. this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0');
  8358. };
  8359. /**
  8360. * @return Return true if it is single selectin list, checkbox list or radio list.
  8361. */
  8362. MDCListFoundation.prototype.isSelectableList_ = function () {
  8363. return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_;
  8364. };
  8365. MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () {
  8366. var targetIndex = 0;
  8367. if (this.isSelectableList_()) {
  8368. if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  8369. targetIndex = this.selectedIndex_;
  8370. } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) {
  8371. targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) {
  8372. return Math.min(currentIndex, minIndex);
  8373. });
  8374. }
  8375. }
  8376. this.setTabindexAtIndex_(targetIndex);
  8377. };
  8378. MDCListFoundation.prototype.isIndexValid_ = function (index) {
  8379. var _this = this;
  8380. if (index instanceof Array) {
  8381. if (!this.isCheckboxList_) {
  8382. throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
  8383. }
  8384. if (index.length === 0) {
  8385. return true;
  8386. } else {
  8387. return index.some(function (i) {
  8388. return _this.isIndexInRange_(i);
  8389. });
  8390. }
  8391. } else if (typeof index === 'number') {
  8392. if (this.isCheckboxList_) {
  8393. throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index);
  8394. }
  8395. return this.isIndexInRange_(index);
  8396. } else {
  8397. return false;
  8398. }
  8399. };
  8400. MDCListFoundation.prototype.isIndexInRange_ = function (index) {
  8401. var listSize = this.adapter_.getListItemCount();
  8402. return index >= 0 && index < listSize;
  8403. };
  8404. MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) {
  8405. if (toggleCheckbox === void 0) {
  8406. toggleCheckbox = true;
  8407. }
  8408. if (this.isCheckboxList_) {
  8409. this.toggleCheckboxAtIndex_(index, toggleCheckbox);
  8410. } else {
  8411. this.setSelectedIndex(index);
  8412. }
  8413. };
  8414. MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) {
  8415. var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index);
  8416. if (toggleCheckbox) {
  8417. isChecked = !isChecked;
  8418. this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
  8419. }
  8420. this.adapter_.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  8421. // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value.
  8422. var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice();
  8423. if (isChecked) {
  8424. selectedIndexes.push(index);
  8425. } else {
  8426. selectedIndexes = selectedIndexes.filter(function (i) {
  8427. return i !== index;
  8428. });
  8429. }
  8430. this.selectedIndex_ = selectedIndexes;
  8431. };
  8432. return MDCListFoundation;
  8433. }(foundation_1.MDCFoundation);
  8434. exports.MDCListFoundation = MDCListFoundation;
  8435. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  8436. exports.default = MDCListFoundation;
  8437. /***/ }),
  8438. /***/ "./packages/mdc-list/index.ts":
  8439. /*!************************************!*\
  8440. !*** ./packages/mdc-list/index.ts ***!
  8441. \************************************/
  8442. /*! no static exports found */
  8443. /***/ (function(module, exports, __webpack_require__) {
  8444. "use strict";
  8445. /**
  8446. * @license
  8447. * Copyright 2019 Google Inc.
  8448. *
  8449. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8450. * of this software and associated documentation files (the "Software"), to deal
  8451. * in the Software without restriction, including without limitation the rights
  8452. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8453. * copies of the Software, and to permit persons to whom the Software is
  8454. * furnished to do so, subject to the following conditions:
  8455. *
  8456. * The above copyright notice and this permission notice shall be included in
  8457. * all copies or substantial portions of the Software.
  8458. *
  8459. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8460. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8461. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8462. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8463. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8464. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8465. * THE SOFTWARE.
  8466. */
  8467. function __export(m) {
  8468. for (var p in m) {
  8469. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  8470. }
  8471. }
  8472. Object.defineProperty(exports, "__esModule", { value: true });
  8473. __export(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts"));
  8474. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"));
  8475. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"));
  8476. /***/ }),
  8477. /***/ "./packages/mdc-menu-surface/component.ts":
  8478. /*!************************************************!*\
  8479. !*** ./packages/mdc-menu-surface/component.ts ***!
  8480. \************************************************/
  8481. /*! no static exports found */
  8482. /***/ (function(module, exports, __webpack_require__) {
  8483. "use strict";
  8484. /**
  8485. * @license
  8486. * Copyright 2018 Google Inc.
  8487. *
  8488. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8489. * of this software and associated documentation files (the "Software"), to deal
  8490. * in the Software without restriction, including without limitation the rights
  8491. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8492. * copies of the Software, and to permit persons to whom the Software is
  8493. * furnished to do so, subject to the following conditions:
  8494. *
  8495. * The above copyright notice and this permission notice shall be included in
  8496. * all copies or substantial portions of the Software.
  8497. *
  8498. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8499. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8500. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8501. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8502. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8503. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8504. * THE SOFTWARE.
  8505. */
  8506. var __extends = this && this.__extends || function () {
  8507. var _extendStatics = function extendStatics(d, b) {
  8508. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8509. d.__proto__ = b;
  8510. } || function (d, b) {
  8511. for (var p in b) {
  8512. if (b.hasOwnProperty(p)) d[p] = b[p];
  8513. }
  8514. };
  8515. return _extendStatics(d, b);
  8516. };
  8517. return function (d, b) {
  8518. _extendStatics(d, b);
  8519. function __() {
  8520. this.constructor = d;
  8521. }
  8522. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8523. };
  8524. }();
  8525. var __importStar = this && this.__importStar || function (mod) {
  8526. if (mod && mod.__esModule) return mod;
  8527. var result = {};
  8528. if (mod != null) for (var k in mod) {
  8529. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8530. }result["default"] = mod;
  8531. return result;
  8532. };
  8533. Object.defineProperty(exports, "__esModule", { value: true });
  8534. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8535. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  8536. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts");
  8537. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  8538. var MDCMenuSurface = /** @class */function (_super) {
  8539. __extends(MDCMenuSurface, _super);
  8540. function MDCMenuSurface() {
  8541. return _super !== null && _super.apply(this, arguments) || this;
  8542. }
  8543. MDCMenuSurface.attachTo = function (root) {
  8544. return new MDCMenuSurface(root);
  8545. };
  8546. MDCMenuSurface.prototype.initialSyncWithDOM = function () {
  8547. var _this = this;
  8548. var parentEl = this.root_.parentElement;
  8549. this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
  8550. if (this.root_.classList.contains(constants_1.cssClasses.FIXED)) {
  8551. this.setFixedPosition(true);
  8552. }
  8553. this.handleKeydown_ = function (evt) {
  8554. return _this.foundation_.handleKeydown(evt);
  8555. };
  8556. this.handleBodyClick_ = function (evt) {
  8557. return _this.foundation_.handleBodyClick(evt);
  8558. };
  8559. this.registerBodyClickListener_ = function () {
  8560. return document.body.addEventListener('click', _this.handleBodyClick_);
  8561. };
  8562. this.deregisterBodyClickListener_ = function () {
  8563. return document.body.removeEventListener('click', _this.handleBodyClick_);
  8564. };
  8565. this.listen('keydown', this.handleKeydown_);
  8566. this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
  8567. this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
  8568. };
  8569. MDCMenuSurface.prototype.destroy = function () {
  8570. this.unlisten('keydown', this.handleKeydown_);
  8571. this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
  8572. this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
  8573. _super.prototype.destroy.call(this);
  8574. };
  8575. MDCMenuSurface.prototype.isOpen = function () {
  8576. return this.foundation_.isOpen();
  8577. };
  8578. MDCMenuSurface.prototype.open = function () {
  8579. this.foundation_.open();
  8580. };
  8581. MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
  8582. if (skipRestoreFocus === void 0) {
  8583. skipRestoreFocus = false;
  8584. }
  8585. this.foundation_.close(skipRestoreFocus);
  8586. };
  8587. Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
  8588. set: function set(quickOpen) {
  8589. this.foundation_.setQuickOpen(quickOpen);
  8590. },
  8591. enumerable: true,
  8592. configurable: true
  8593. });
  8594. /**
  8595. * Removes the menu-surface from it's current location and appends it to the
  8596. * body to overcome any overflow:hidden issues.
  8597. */
  8598. MDCMenuSurface.prototype.hoistMenuToBody = function () {
  8599. document.body.appendChild(this.root_);
  8600. this.setIsHoisted(true);
  8601. };
  8602. /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */
  8603. MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
  8604. this.foundation_.setIsHoisted(isHoisted);
  8605. };
  8606. /** Sets the element that the menu-surface is anchored to. */
  8607. MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
  8608. this.anchorElement = element;
  8609. };
  8610. /** Sets the menu-surface to position: fixed. */
  8611. MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
  8612. if (isFixed) {
  8613. this.root_.classList.add(constants_1.cssClasses.FIXED);
  8614. } else {
  8615. this.root_.classList.remove(constants_1.cssClasses.FIXED);
  8616. }
  8617. this.foundation_.setFixedPosition(isFixed);
  8618. };
  8619. /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */
  8620. MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
  8621. this.foundation_.setAbsolutePosition(x, y);
  8622. this.setIsHoisted(true);
  8623. };
  8624. /**
  8625. * @param corner Default anchor corner alignment of top-left surface corner.
  8626. */
  8627. MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
  8628. this.foundation_.setAnchorCorner(corner);
  8629. };
  8630. MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
  8631. this.foundation_.setAnchorMargin(margin);
  8632. };
  8633. MDCMenuSurface.prototype.getDefaultFoundation = function () {
  8634. var _this = this;
  8635. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  8636. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  8637. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8638. var adapter = {
  8639. addClass: function addClass(className) {
  8640. return _this.root_.classList.add(className);
  8641. },
  8642. removeClass: function removeClass(className) {
  8643. return _this.root_.classList.remove(className);
  8644. },
  8645. hasClass: function hasClass(className) {
  8646. return _this.root_.classList.contains(className);
  8647. },
  8648. hasAnchor: function hasAnchor() {
  8649. return !!_this.anchorElement;
  8650. },
  8651. notifyClose: function notifyClose() {
  8652. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
  8653. },
  8654. notifyOpen: function notifyOpen() {
  8655. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
  8656. },
  8657. isElementInContainer: function isElementInContainer(el) {
  8658. return _this.root_.contains(el);
  8659. },
  8660. isRtl: function isRtl() {
  8661. return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  8662. },
  8663. setTransformOrigin: function setTransformOrigin(origin) {
  8664. var propertyName = util.getTransformPropertyName(window) + "-origin";
  8665. _this.root_.style.setProperty(propertyName, origin);
  8666. },
  8667. isFocused: function isFocused() {
  8668. return document.activeElement === _this.root_;
  8669. },
  8670. saveFocus: function saveFocus() {
  8671. _this.previousFocus_ = document.activeElement;
  8672. },
  8673. restoreFocus: function restoreFocus() {
  8674. if (_this.root_.contains(document.activeElement)) {
  8675. if (_this.previousFocus_ && _this.previousFocus_.focus) {
  8676. _this.previousFocus_.focus();
  8677. }
  8678. }
  8679. },
  8680. getInnerDimensions: function getInnerDimensions() {
  8681. return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight };
  8682. },
  8683. getAnchorDimensions: function getAnchorDimensions() {
  8684. return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
  8685. },
  8686. getWindowDimensions: function getWindowDimensions() {
  8687. return { width: window.innerWidth, height: window.innerHeight };
  8688. },
  8689. getBodyDimensions: function getBodyDimensions() {
  8690. return { width: document.body.clientWidth, height: document.body.clientHeight };
  8691. },
  8692. getWindowScroll: function getWindowScroll() {
  8693. return { x: window.pageXOffset, y: window.pageYOffset };
  8694. },
  8695. setPosition: function setPosition(position) {
  8696. _this.root_.style.left = 'left' in position ? position.left + "px" : '';
  8697. _this.root_.style.right = 'right' in position ? position.right + "px" : '';
  8698. _this.root_.style.top = 'top' in position ? position.top + "px" : '';
  8699. _this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : '';
  8700. },
  8701. setMaxHeight: function setMaxHeight(height) {
  8702. _this.root_.style.maxHeight = height;
  8703. }
  8704. };
  8705. // tslint:enable:object-literal-sort-keys
  8706. return new foundation_1.MDCMenuSurfaceFoundation(adapter);
  8707. };
  8708. return MDCMenuSurface;
  8709. }(component_1.MDCComponent);
  8710. exports.MDCMenuSurface = MDCMenuSurface;
  8711. /***/ }),
  8712. /***/ "./packages/mdc-menu-surface/constants.ts":
  8713. /*!************************************************!*\
  8714. !*** ./packages/mdc-menu-surface/constants.ts ***!
  8715. \************************************************/
  8716. /*! no static exports found */
  8717. /***/ (function(module, exports, __webpack_require__) {
  8718. "use strict";
  8719. /**
  8720. * @license
  8721. * Copyright 2018 Google Inc.
  8722. *
  8723. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8724. * of this software and associated documentation files (the "Software"), to deal
  8725. * in the Software without restriction, including without limitation the rights
  8726. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8727. * copies of the Software, and to permit persons to whom the Software is
  8728. * furnished to do so, subject to the following conditions:
  8729. *
  8730. * The above copyright notice and this permission notice shall be included in
  8731. * all copies or substantial portions of the Software.
  8732. *
  8733. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8734. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8735. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8736. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8737. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8738. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8739. * THE SOFTWARE.
  8740. */
  8741. Object.defineProperty(exports, "__esModule", { value: true });
  8742. var cssClasses = {
  8743. ANCHOR: 'mdc-menu-surface--anchor',
  8744. ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
  8745. ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
  8746. FIXED: 'mdc-menu-surface--fixed',
  8747. OPEN: 'mdc-menu-surface--open',
  8748. ROOT: 'mdc-menu-surface'
  8749. };
  8750. exports.cssClasses = cssClasses;
  8751. // tslint:disable:object-literal-sort-keys
  8752. var strings = {
  8753. CLOSED_EVENT: 'MDCMenuSurface:closed',
  8754. OPENED_EVENT: 'MDCMenuSurface:opened',
  8755. 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(', ')
  8756. };
  8757. exports.strings = strings;
  8758. // tslint:enable:object-literal-sort-keys
  8759. var numbers = {
  8760. /** Total duration of menu-surface open animation. */
  8761. TRANSITION_OPEN_DURATION: 120,
  8762. /** Total duration of menu-surface close animation. */
  8763. TRANSITION_CLOSE_DURATION: 75,
  8764. /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */
  8765. MARGIN_TO_EDGE: 32,
  8766. /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */
  8767. ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67
  8768. };
  8769. exports.numbers = numbers;
  8770. /**
  8771. * Enum for bits in the {@see Corner) bitmap.
  8772. */
  8773. var CornerBit;
  8774. (function (CornerBit) {
  8775. CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
  8776. CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
  8777. CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
  8778. CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
  8779. })(CornerBit || (CornerBit = {}));
  8780. exports.CornerBit = CornerBit;
  8781. /**
  8782. * Enum for representing an element corner for positioning the menu-surface.
  8783. *
  8784. * The START constants map to LEFT if element directionality is left
  8785. * to right and RIGHT if the directionality is right to left.
  8786. * Likewise END maps to RIGHT or LEFT depending on the directionality.
  8787. */
  8788. var Corner;
  8789. (function (Corner) {
  8790. Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
  8791. Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
  8792. Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
  8793. Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
  8794. Corner[Corner["TOP_START"] = 8] = "TOP_START";
  8795. Corner[Corner["TOP_END"] = 12] = "TOP_END";
  8796. Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
  8797. Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
  8798. })(Corner || (Corner = {}));
  8799. exports.Corner = Corner;
  8800. /***/ }),
  8801. /***/ "./packages/mdc-menu-surface/foundation.ts":
  8802. /*!*************************************************!*\
  8803. !*** ./packages/mdc-menu-surface/foundation.ts ***!
  8804. \*************************************************/
  8805. /*! no static exports found */
  8806. /***/ (function(module, exports, __webpack_require__) {
  8807. "use strict";
  8808. /**
  8809. * @license
  8810. * Copyright 2018 Google Inc.
  8811. *
  8812. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8813. * of this software and associated documentation files (the "Software"), to deal
  8814. * in the Software without restriction, including without limitation the rights
  8815. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8816. * copies of the Software, and to permit persons to whom the Software is
  8817. * furnished to do so, subject to the following conditions:
  8818. *
  8819. * The above copyright notice and this permission notice shall be included in
  8820. * all copies or substantial portions of the Software.
  8821. *
  8822. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8823. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8824. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8825. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8826. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8827. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8828. * THE SOFTWARE.
  8829. */
  8830. var __extends = this && this.__extends || function () {
  8831. var _extendStatics = function extendStatics(d, b) {
  8832. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8833. d.__proto__ = b;
  8834. } || function (d, b) {
  8835. for (var p in b) {
  8836. if (b.hasOwnProperty(p)) d[p] = b[p];
  8837. }
  8838. };
  8839. return _extendStatics(d, b);
  8840. };
  8841. return function (d, b) {
  8842. _extendStatics(d, b);
  8843. function __() {
  8844. this.constructor = d;
  8845. }
  8846. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8847. };
  8848. }();
  8849. var __assign = this && this.__assign || function () {
  8850. __assign = Object.assign || function (t) {
  8851. for (var s, i = 1, n = arguments.length; i < n; i++) {
  8852. s = arguments[i];
  8853. for (var p in s) {
  8854. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  8855. }
  8856. }
  8857. return t;
  8858. };
  8859. return __assign.apply(this, arguments);
  8860. };
  8861. var __values = this && this.__values || function (o) {
  8862. var m = typeof Symbol === "function" && o[Symbol.iterator],
  8863. i = 0;
  8864. if (m) return m.call(o);
  8865. return {
  8866. next: function next() {
  8867. if (o && i >= o.length) o = void 0;
  8868. return { value: o && o[i++], done: !o };
  8869. }
  8870. };
  8871. };
  8872. Object.defineProperty(exports, "__esModule", { value: true });
  8873. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  8874. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  8875. var MDCMenuSurfaceFoundation = /** @class */function (_super) {
  8876. __extends(MDCMenuSurfaceFoundation, _super);
  8877. function MDCMenuSurfaceFoundation(adapter) {
  8878. var _this = _super.call(this, __assign({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this;
  8879. _this.isOpen_ = false;
  8880. _this.isQuickOpen_ = false;
  8881. _this.isHoistedElement_ = false;
  8882. _this.isFixedPosition_ = false;
  8883. _this.openAnimationEndTimerId_ = 0;
  8884. _this.closeAnimationEndTimerId_ = 0;
  8885. _this.animationRequestId_ = 0;
  8886. _this.anchorCorner_ = constants_1.Corner.TOP_START;
  8887. _this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 };
  8888. _this.position_ = { x: 0, y: 0 };
  8889. return _this;
  8890. }
  8891. Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
  8892. get: function get() {
  8893. return constants_1.cssClasses;
  8894. },
  8895. enumerable: true,
  8896. configurable: true
  8897. });
  8898. Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
  8899. get: function get() {
  8900. return constants_1.strings;
  8901. },
  8902. enumerable: true,
  8903. configurable: true
  8904. });
  8905. Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
  8906. get: function get() {
  8907. return constants_1.numbers;
  8908. },
  8909. enumerable: true,
  8910. configurable: true
  8911. });
  8912. Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
  8913. get: function get() {
  8914. return constants_1.Corner;
  8915. },
  8916. enumerable: true,
  8917. configurable: true
  8918. });
  8919. Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
  8920. /**
  8921. * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
  8922. */
  8923. get: function get() {
  8924. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8925. return {
  8926. addClass: function addClass() {
  8927. return undefined;
  8928. },
  8929. removeClass: function removeClass() {
  8930. return undefined;
  8931. },
  8932. hasClass: function hasClass() {
  8933. return false;
  8934. },
  8935. hasAnchor: function hasAnchor() {
  8936. return false;
  8937. },
  8938. isElementInContainer: function isElementInContainer() {
  8939. return false;
  8940. },
  8941. isFocused: function isFocused() {
  8942. return false;
  8943. },
  8944. isRtl: function isRtl() {
  8945. return false;
  8946. },
  8947. getInnerDimensions: function getInnerDimensions() {
  8948. return { height: 0, width: 0 };
  8949. },
  8950. getAnchorDimensions: function getAnchorDimensions() {
  8951. return null;
  8952. },
  8953. getWindowDimensions: function getWindowDimensions() {
  8954. return { height: 0, width: 0 };
  8955. },
  8956. getBodyDimensions: function getBodyDimensions() {
  8957. return { height: 0, width: 0 };
  8958. },
  8959. getWindowScroll: function getWindowScroll() {
  8960. return { x: 0, y: 0 };
  8961. },
  8962. setPosition: function setPosition() {
  8963. return undefined;
  8964. },
  8965. setMaxHeight: function setMaxHeight() {
  8966. return undefined;
  8967. },
  8968. setTransformOrigin: function setTransformOrigin() {
  8969. return undefined;
  8970. },
  8971. saveFocus: function saveFocus() {
  8972. return undefined;
  8973. },
  8974. restoreFocus: function restoreFocus() {
  8975. return undefined;
  8976. },
  8977. notifyClose: function notifyClose() {
  8978. return undefined;
  8979. },
  8980. notifyOpen: function notifyOpen() {
  8981. return undefined;
  8982. }
  8983. };
  8984. // tslint:enable:object-literal-sort-keys
  8985. },
  8986. enumerable: true,
  8987. configurable: true
  8988. });
  8989. MDCMenuSurfaceFoundation.prototype.init = function () {
  8990. var _a = MDCMenuSurfaceFoundation.cssClasses,
  8991. ROOT = _a.ROOT,
  8992. OPEN = _a.OPEN;
  8993. if (!this.adapter_.hasClass(ROOT)) {
  8994. throw new Error(ROOT + " class required in root element.");
  8995. }
  8996. if (this.adapter_.hasClass(OPEN)) {
  8997. this.isOpen_ = true;
  8998. }
  8999. };
  9000. MDCMenuSurfaceFoundation.prototype.destroy = function () {
  9001. clearTimeout(this.openAnimationEndTimerId_);
  9002. clearTimeout(this.closeAnimationEndTimerId_);
  9003. // Cancel any currently running animations.
  9004. cancelAnimationFrame(this.animationRequestId_);
  9005. };
  9006. /**
  9007. * @param corner Default anchor corner alignment of top-left menu surface corner.
  9008. */
  9009. MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
  9010. this.anchorCorner_ = corner;
  9011. };
  9012. /**
  9013. * @param margin Set of margin values from anchor.
  9014. */
  9015. MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
  9016. this.anchorMargin_.top = margin.top || 0;
  9017. this.anchorMargin_.right = margin.right || 0;
  9018. this.anchorMargin_.bottom = margin.bottom || 0;
  9019. this.anchorMargin_.left = margin.left || 0;
  9020. };
  9021. /** Used to indicate if the menu-surface is hoisted to the body. */
  9022. MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
  9023. this.isHoistedElement_ = isHoisted;
  9024. };
  9025. /** Used to set the menu-surface calculations based on a fixed position menu. */
  9026. MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
  9027. this.isFixedPosition_ = isFixedPosition;
  9028. };
  9029. /** Sets the menu-surface position on the page. */
  9030. MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
  9031. this.position_.x = this.isFinite_(x) ? x : 0;
  9032. this.position_.y = this.isFinite_(y) ? y : 0;
  9033. };
  9034. MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
  9035. this.isQuickOpen_ = quickOpen;
  9036. };
  9037. MDCMenuSurfaceFoundation.prototype.isOpen = function () {
  9038. return this.isOpen_;
  9039. };
  9040. /**
  9041. * Open the menu surface.
  9042. */
  9043. MDCMenuSurfaceFoundation.prototype.open = function () {
  9044. var _this = this;
  9045. this.adapter_.saveFocus();
  9046. if (!this.isQuickOpen_) {
  9047. this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  9048. }
  9049. this.animationRequestId_ = requestAnimationFrame(function () {
  9050. _this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  9051. _this.dimensions_ = _this.adapter_.getInnerDimensions();
  9052. _this.autoPosition_();
  9053. if (_this.isQuickOpen_) {
  9054. _this.adapter_.notifyOpen();
  9055. } else {
  9056. _this.openAnimationEndTimerId_ = setTimeout(function () {
  9057. _this.openAnimationEndTimerId_ = 0;
  9058. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  9059. _this.adapter_.notifyOpen();
  9060. }, constants_1.numbers.TRANSITION_OPEN_DURATION);
  9061. }
  9062. });
  9063. this.isOpen_ = true;
  9064. };
  9065. /**
  9066. * Closes the menu surface.
  9067. */
  9068. MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
  9069. var _this = this;
  9070. if (skipRestoreFocus === void 0) {
  9071. skipRestoreFocus = false;
  9072. }
  9073. if (!this.isQuickOpen_) {
  9074. this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  9075. }
  9076. requestAnimationFrame(function () {
  9077. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  9078. if (_this.isQuickOpen_) {
  9079. _this.adapter_.notifyClose();
  9080. } else {
  9081. _this.closeAnimationEndTimerId_ = setTimeout(function () {
  9082. _this.closeAnimationEndTimerId_ = 0;
  9083. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  9084. _this.adapter_.notifyClose();
  9085. }, constants_1.numbers.TRANSITION_CLOSE_DURATION);
  9086. }
  9087. });
  9088. this.isOpen_ = false;
  9089. if (!skipRestoreFocus) {
  9090. this.maybeRestoreFocus_();
  9091. }
  9092. };
  9093. /** Handle clicks and close if not within menu-surface element. */
  9094. MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
  9095. var el = evt.target;
  9096. if (this.adapter_.isElementInContainer(el)) {
  9097. return;
  9098. }
  9099. this.close();
  9100. };
  9101. /** Handle keys that close the surface. */
  9102. MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
  9103. var keyCode = evt.keyCode,
  9104. key = evt.key;
  9105. var isEscape = key === 'Escape' || keyCode === 27;
  9106. if (isEscape) {
  9107. this.close();
  9108. }
  9109. };
  9110. MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () {
  9111. var _a;
  9112. // Compute measurements for autoposition methods reuse.
  9113. this.measurements_ = this.getAutoLayoutMeasurements_();
  9114. var corner = this.getOriginCorner_();
  9115. var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner);
  9116. var verticalAlignment = this.hasBit_(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top';
  9117. var horizontalAlignment = this.hasBit_(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left';
  9118. var horizontalOffset = this.getHorizontalOriginOffset_(corner);
  9119. var verticalOffset = this.getVerticalOriginOffset_(corner);
  9120. var _b = this.measurements_,
  9121. anchorSize = _b.anchorSize,
  9122. surfaceSize = _b.surfaceSize;
  9123. var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
  9124. // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner.
  9125. if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
  9126. horizontalAlignment = 'center';
  9127. }
  9128. // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element
  9129. if (this.isHoistedElement_ || this.isFixedPosition_) {
  9130. this.adjustPositionForHoistedElement_(position);
  9131. }
  9132. this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
  9133. this.adapter_.setPosition(position);
  9134. this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
  9135. };
  9136. /**
  9137. * @return Measurements used to position menu surface popup.
  9138. */
  9139. MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () {
  9140. var anchorRect = this.adapter_.getAnchorDimensions();
  9141. var bodySize = this.adapter_.getBodyDimensions();
  9142. var viewportSize = this.adapter_.getWindowDimensions();
  9143. var windowScroll = this.adapter_.getWindowScroll();
  9144. if (!anchorRect) {
  9145. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  9146. anchorRect = {
  9147. top: this.position_.y,
  9148. right: this.position_.x,
  9149. bottom: this.position_.y,
  9150. left: this.position_.x,
  9151. width: 0,
  9152. height: 0
  9153. };
  9154. // tslint:enable:object-literal-sort-keys
  9155. }
  9156. return {
  9157. anchorSize: anchorRect,
  9158. bodySize: bodySize,
  9159. surfaceSize: this.dimensions_,
  9160. viewportDistance: {
  9161. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  9162. top: anchorRect.top,
  9163. right: viewportSize.width - anchorRect.right,
  9164. bottom: viewportSize.height - anchorRect.bottom,
  9165. left: anchorRect.left
  9166. },
  9167. viewportSize: viewportSize,
  9168. windowScroll: windowScroll
  9169. };
  9170. };
  9171. /**
  9172. * Computes the corner of the anchor from which to animate and position the menu surface.
  9173. */
  9174. MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () {
  9175. // Defaults: open from the top left.
  9176. var corner = constants_1.Corner.TOP_LEFT;
  9177. var _a = this.measurements_,
  9178. viewportDistance = _a.viewportDistance,
  9179. anchorSize = _a.anchorSize,
  9180. surfaceSize = _a.surfaceSize;
  9181. var isBottomAligned = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  9182. var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top;
  9183. var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top;
  9184. var topOverflow = surfaceSize.height - availableTop;
  9185. var bottomOverflow = surfaceSize.height - availableBottom;
  9186. if (bottomOverflow > 0 && topOverflow < bottomOverflow) {
  9187. corner = this.setBit_(corner, constants_1.CornerBit.BOTTOM);
  9188. }
  9189. var isRtl = this.adapter_.isRtl();
  9190. var isFlipRtl = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.FLIP_RTL);
  9191. var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
  9192. var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl;
  9193. var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left;
  9194. var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left;
  9195. var leftOverflow = surfaceSize.width - availableLeft;
  9196. var rightOverflow = surfaceSize.width - availableRight;
  9197. if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) {
  9198. corner = this.setBit_(corner, constants_1.CornerBit.RIGHT);
  9199. }
  9200. return corner;
  9201. };
  9202. /**
  9203. * @param corner Origin corner of the menu surface.
  9204. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set.
  9205. */
  9206. MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) {
  9207. var viewportDistance = this.measurements_.viewportDistance;
  9208. var maxHeight = 0;
  9209. var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
  9210. var isBottomAnchored = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  9211. var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
  9212. // When maximum height is not specified, it is handled from CSS.
  9213. if (isBottomAligned) {
  9214. maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE;
  9215. if (!isBottomAnchored) {
  9216. maxHeight += this.measurements_.anchorSize.height;
  9217. }
  9218. } else {
  9219. maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE;
  9220. if (isBottomAnchored) {
  9221. maxHeight -= this.measurements_.anchorSize.height;
  9222. }
  9223. }
  9224. return maxHeight;
  9225. };
  9226. /**
  9227. * @param corner Origin corner of the menu surface.
  9228. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner.
  9229. */
  9230. MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) {
  9231. var anchorSize = this.measurements_.anchorSize;
  9232. // isRightAligned corresponds to using the 'right' property on the surface.
  9233. var isRightAligned = this.hasBit_(corner, constants_1.CornerBit.RIGHT);
  9234. var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
  9235. if (isRightAligned) {
  9236. var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right;
  9237. // For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so
  9238. // when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position,
  9239. // the right property is correct.
  9240. if (this.isHoistedElement_ || this.isFixedPosition_) {
  9241. return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width);
  9242. }
  9243. return rightOffset;
  9244. }
  9245. return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left;
  9246. };
  9247. /**
  9248. * @param corner Origin corner of the menu surface.
  9249. * @return Vertical offset of menu surface origin corner from corresponding anchor corner.
  9250. */
  9251. MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) {
  9252. var anchorSize = this.measurements_.anchorSize;
  9253. var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
  9254. var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  9255. var y = 0;
  9256. if (isBottomAligned) {
  9257. y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom;
  9258. } else {
  9259. y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top;
  9260. }
  9261. return y;
  9262. };
  9263. /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */
  9264. MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) {
  9265. var e_1, _a;
  9266. var _b = this.measurements_,
  9267. windowScroll = _b.windowScroll,
  9268. viewportDistance = _b.viewportDistance;
  9269. var props = Object.keys(position);
  9270. try {
  9271. for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
  9272. var prop = props_1_1.value;
  9273. var value = position[prop] || 0;
  9274. // Hoisted surfaces need to have the anchor elements location on the page added to the
  9275. // position properties for proper alignment on the body.
  9276. value += viewportDistance[prop];
  9277. // Surfaces that are absolutely positioned need to have additional calculations for scroll
  9278. // and bottom positioning.
  9279. if (!this.isFixedPosition_) {
  9280. if (prop === 'top') {
  9281. value += windowScroll.y;
  9282. } else if (prop === 'bottom') {
  9283. value -= windowScroll.y;
  9284. } else if (prop === 'left') {
  9285. value += windowScroll.x;
  9286. } else {
  9287. // prop === 'right'
  9288. value -= windowScroll.x;
  9289. }
  9290. }
  9291. position[prop] = value;
  9292. }
  9293. } catch (e_1_1) {
  9294. e_1 = { error: e_1_1 };
  9295. } finally {
  9296. try {
  9297. if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
  9298. } finally {
  9299. if (e_1) throw e_1.error;
  9300. }
  9301. }
  9302. };
  9303. /**
  9304. * The last focused element when the menu surface was opened should regain focus, if the user is
  9305. * focused on or within the menu surface when it is closed.
  9306. */
  9307. MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () {
  9308. var isRootFocused = this.adapter_.isFocused();
  9309. var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement);
  9310. if (isRootFocused || childHasFocus) {
  9311. this.adapter_.restoreFocus();
  9312. }
  9313. };
  9314. MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) {
  9315. return Boolean(corner & bit); // tslint:disable-line:no-bitwise
  9316. };
  9317. MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) {
  9318. return corner | bit; // tslint:disable-line:no-bitwise
  9319. };
  9320. /**
  9321. * isFinite that doesn't force conversion to number type.
  9322. * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
  9323. */
  9324. MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) {
  9325. return typeof num === 'number' && isFinite(num);
  9326. };
  9327. return MDCMenuSurfaceFoundation;
  9328. }(foundation_1.MDCFoundation);
  9329. exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
  9330. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  9331. exports.default = MDCMenuSurfaceFoundation;
  9332. /***/ }),
  9333. /***/ "./packages/mdc-menu-surface/index.ts":
  9334. /*!********************************************!*\
  9335. !*** ./packages/mdc-menu-surface/index.ts ***!
  9336. \********************************************/
  9337. /*! no static exports found */
  9338. /***/ (function(module, exports, __webpack_require__) {
  9339. "use strict";
  9340. /**
  9341. * @license
  9342. * Copyright 2019 Google Inc.
  9343. *
  9344. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9345. * of this software and associated documentation files (the "Software"), to deal
  9346. * in the Software without restriction, including without limitation the rights
  9347. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9348. * copies of the Software, and to permit persons to whom the Software is
  9349. * furnished to do so, subject to the following conditions:
  9350. *
  9351. * The above copyright notice and this permission notice shall be included in
  9352. * all copies or substantial portions of the Software.
  9353. *
  9354. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9355. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9356. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9357. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9358. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9359. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9360. * THE SOFTWARE.
  9361. */
  9362. function __export(m) {
  9363. for (var p in m) {
  9364. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  9365. }
  9366. }
  9367. var __importStar = this && this.__importStar || function (mod) {
  9368. if (mod && mod.__esModule) return mod;
  9369. var result = {};
  9370. if (mod != null) for (var k in mod) {
  9371. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  9372. }result["default"] = mod;
  9373. return result;
  9374. };
  9375. Object.defineProperty(exports, "__esModule", { value: true });
  9376. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  9377. exports.util = util;
  9378. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  9379. exports.Corner = constants_1.Corner;
  9380. exports.CornerBit = constants_1.CornerBit;
  9381. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts"));
  9382. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"));
  9383. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"));
  9384. /***/ }),
  9385. /***/ "./packages/mdc-menu-surface/util.ts":
  9386. /*!*******************************************!*\
  9387. !*** ./packages/mdc-menu-surface/util.ts ***!
  9388. \*******************************************/
  9389. /*! no static exports found */
  9390. /***/ (function(module, exports, __webpack_require__) {
  9391. "use strict";
  9392. /**
  9393. * @license
  9394. * Copyright 2018 Google Inc.
  9395. *
  9396. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9397. * of this software and associated documentation files (the "Software"), to deal
  9398. * in the Software without restriction, including without limitation the rights
  9399. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9400. * copies of the Software, and to permit persons to whom the Software is
  9401. * furnished to do so, subject to the following conditions:
  9402. *
  9403. * The above copyright notice and this permission notice shall be included in
  9404. * all copies or substantial portions of the Software.
  9405. *
  9406. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9407. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9408. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9409. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9410. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9411. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9412. * THE SOFTWARE.
  9413. */
  9414. Object.defineProperty(exports, "__esModule", { value: true });
  9415. var cachedCssTransformPropertyName_;
  9416. /**
  9417. * Returns the name of the correct transform property to use on the current browser.
  9418. */
  9419. function getTransformPropertyName(globalObj, forceRefresh) {
  9420. if (forceRefresh === void 0) {
  9421. forceRefresh = false;
  9422. }
  9423. if (cachedCssTransformPropertyName_ === undefined || forceRefresh) {
  9424. var el = globalObj.document.createElement('div');
  9425. cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform';
  9426. }
  9427. return cachedCssTransformPropertyName_;
  9428. }
  9429. exports.getTransformPropertyName = getTransformPropertyName;
  9430. /***/ }),
  9431. /***/ "./packages/mdc-menu/component.ts":
  9432. /*!****************************************!*\
  9433. !*** ./packages/mdc-menu/component.ts ***!
  9434. \****************************************/
  9435. /*! no static exports found */
  9436. /***/ (function(module, exports, __webpack_require__) {
  9437. "use strict";
  9438. /**
  9439. * @license
  9440. * Copyright 2018 Google Inc.
  9441. *
  9442. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9443. * of this software and associated documentation files (the "Software"), to deal
  9444. * in the Software without restriction, including without limitation the rights
  9445. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9446. * copies of the Software, and to permit persons to whom the Software is
  9447. * furnished to do so, subject to the following conditions:
  9448. *
  9449. * The above copyright notice and this permission notice shall be included in
  9450. * all copies or substantial portions of the Software.
  9451. *
  9452. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9453. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9454. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9455. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9456. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9457. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9458. * THE SOFTWARE.
  9459. */
  9460. var __extends = this && this.__extends || function () {
  9461. var _extendStatics = function extendStatics(d, b) {
  9462. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9463. d.__proto__ = b;
  9464. } || function (d, b) {
  9465. for (var p in b) {
  9466. if (b.hasOwnProperty(p)) d[p] = b[p];
  9467. }
  9468. };
  9469. return _extendStatics(d, b);
  9470. };
  9471. return function (d, b) {
  9472. _extendStatics(d, b);
  9473. function __() {
  9474. this.constructor = d;
  9475. }
  9476. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9477. };
  9478. }();
  9479. Object.defineProperty(exports, "__esModule", { value: true });
  9480. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  9481. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  9482. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  9483. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  9484. var component_3 = __webpack_require__(/*! @material/menu-surface/component */ "./packages/mdc-menu-surface/component.ts");
  9485. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  9486. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  9487. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts");
  9488. var MDCMenu = /** @class */function (_super) {
  9489. __extends(MDCMenu, _super);
  9490. function MDCMenu() {
  9491. return _super !== null && _super.apply(this, arguments) || this;
  9492. }
  9493. MDCMenu.attachTo = function (root) {
  9494. return new MDCMenu(root);
  9495. };
  9496. MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
  9497. if (menuSurfaceFactory === void 0) {
  9498. menuSurfaceFactory = function menuSurfaceFactory(el) {
  9499. return new component_3.MDCMenuSurface(el);
  9500. };
  9501. }
  9502. if (listFactory === void 0) {
  9503. listFactory = function listFactory(el) {
  9504. return new component_2.MDCList(el);
  9505. };
  9506. }
  9507. this.menuSurfaceFactory_ = menuSurfaceFactory;
  9508. this.listFactory_ = listFactory;
  9509. };
  9510. MDCMenu.prototype.initialSyncWithDOM = function () {
  9511. var _this = this;
  9512. this.menuSurface_ = this.menuSurfaceFactory_(this.root_);
  9513. var list = this.root_.querySelector(constants_1.strings.LIST_SELECTOR);
  9514. if (list) {
  9515. this.list_ = this.listFactory_(list);
  9516. this.list_.wrapFocus = true;
  9517. } else {
  9518. this.list_ = null;
  9519. }
  9520. this.handleKeydown_ = function (evt) {
  9521. return _this.foundation_.handleKeydown(evt);
  9522. };
  9523. this.handleItemAction_ = function (evt) {
  9524. return _this.foundation_.handleItemAction(_this.items[evt.detail.index]);
  9525. };
  9526. this.handleMenuSurfaceOpened_ = function () {
  9527. return _this.foundation_.handleMenuSurfaceOpened();
  9528. };
  9529. this.menuSurface_.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  9530. this.listen('keydown', this.handleKeydown_);
  9531. this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  9532. };
  9533. MDCMenu.prototype.destroy = function () {
  9534. if (this.list_) {
  9535. this.list_.destroy();
  9536. }
  9537. this.menuSurface_.destroy();
  9538. this.menuSurface_.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  9539. this.unlisten('keydown', this.handleKeydown_);
  9540. this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  9541. _super.prototype.destroy.call(this);
  9542. };
  9543. Object.defineProperty(MDCMenu.prototype, "open", {
  9544. get: function get() {
  9545. return this.menuSurface_.isOpen();
  9546. },
  9547. set: function set(value) {
  9548. if (value) {
  9549. this.menuSurface_.open();
  9550. } else {
  9551. this.menuSurface_.close();
  9552. }
  9553. },
  9554. enumerable: true,
  9555. configurable: true
  9556. });
  9557. Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
  9558. get: function get() {
  9559. return this.list_ ? this.list_.wrapFocus : false;
  9560. },
  9561. set: function set(value) {
  9562. if (this.list_) {
  9563. this.list_.wrapFocus = value;
  9564. }
  9565. },
  9566. enumerable: true,
  9567. configurable: true
  9568. });
  9569. Object.defineProperty(MDCMenu.prototype, "items", {
  9570. /**
  9571. * Return the items within the menu. Note that this only contains the set of elements within
  9572. * the items container that are proper list items, and not supplemental / presentational DOM
  9573. * elements.
  9574. */
  9575. get: function get() {
  9576. return this.list_ ? this.list_.listElements : [];
  9577. },
  9578. enumerable: true,
  9579. configurable: true
  9580. });
  9581. Object.defineProperty(MDCMenu.prototype, "quickOpen", {
  9582. set: function set(quickOpen) {
  9583. this.menuSurface_.quickOpen = quickOpen;
  9584. },
  9585. enumerable: true,
  9586. configurable: true
  9587. });
  9588. /**
  9589. * Sets default focus state where the menu should focus every time when menu
  9590. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  9591. * default.
  9592. * @param focusState Default focus state.
  9593. */
  9594. MDCMenu.prototype.setDefaultFocusState = function (focusState) {
  9595. this.foundation_.setDefaultFocusState(focusState);
  9596. };
  9597. /**
  9598. * @param corner Default anchor corner alignment of top-left menu corner.
  9599. */
  9600. MDCMenu.prototype.setAnchorCorner = function (corner) {
  9601. this.menuSurface_.setAnchorCorner(corner);
  9602. };
  9603. MDCMenu.prototype.setAnchorMargin = function (margin) {
  9604. this.menuSurface_.setAnchorMargin(margin);
  9605. };
  9606. /**
  9607. * Sets the list item as the selected row at the specified index.
  9608. * @param index Index of list item within menu.
  9609. */
  9610. MDCMenu.prototype.setSelectedIndex = function (index) {
  9611. this.foundation_.setSelectedIndex(index);
  9612. };
  9613. /**
  9614. * Sets the enabled state to isEnabled for the menu item at the given index.
  9615. * @param index Index of the menu item
  9616. * @param isEnabled The desired enabled state of the menu item.
  9617. */
  9618. MDCMenu.prototype.setEnabled = function (index, isEnabled) {
  9619. this.foundation_.setEnabled(index, isEnabled);
  9620. };
  9621. /**
  9622. * @return The item within the menu at the index specified.
  9623. */
  9624. MDCMenu.prototype.getOptionByIndex = function (index) {
  9625. var items = this.items;
  9626. if (index < items.length) {
  9627. return this.items[index];
  9628. } else {
  9629. return null;
  9630. }
  9631. };
  9632. MDCMenu.prototype.setFixedPosition = function (isFixed) {
  9633. this.menuSurface_.setFixedPosition(isFixed);
  9634. };
  9635. MDCMenu.prototype.hoistMenuToBody = function () {
  9636. this.menuSurface_.hoistMenuToBody();
  9637. };
  9638. MDCMenu.prototype.setIsHoisted = function (isHoisted) {
  9639. this.menuSurface_.setIsHoisted(isHoisted);
  9640. };
  9641. MDCMenu.prototype.setAbsolutePosition = function (x, y) {
  9642. this.menuSurface_.setAbsolutePosition(x, y);
  9643. };
  9644. /**
  9645. * Sets the element that the menu-surface is anchored to.
  9646. */
  9647. MDCMenu.prototype.setAnchorElement = function (element) {
  9648. this.menuSurface_.anchorElement = element;
  9649. };
  9650. MDCMenu.prototype.getDefaultFoundation = function () {
  9651. var _this = this;
  9652. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  9653. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  9654. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9655. var adapter = {
  9656. addClassToElementAtIndex: function addClassToElementAtIndex(index, className) {
  9657. var list = _this.items;
  9658. list[index].classList.add(className);
  9659. },
  9660. removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) {
  9661. var list = _this.items;
  9662. list[index].classList.remove(className);
  9663. },
  9664. addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) {
  9665. var list = _this.items;
  9666. list[index].setAttribute(attr, value);
  9667. },
  9668. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) {
  9669. var list = _this.items;
  9670. list[index].removeAttribute(attr);
  9671. },
  9672. elementContainsClass: function elementContainsClass(element, className) {
  9673. return element.classList.contains(className);
  9674. },
  9675. closeSurface: function closeSurface(skipRestoreFocus) {
  9676. return _this.menuSurface_.close(skipRestoreFocus);
  9677. },
  9678. getElementIndex: function getElementIndex(element) {
  9679. return _this.items.indexOf(element);
  9680. },
  9681. notifySelected: function notifySelected(evtData) {
  9682. return _this.emit(constants_1.strings.SELECTED_EVENT, {
  9683. index: evtData.index,
  9684. item: _this.items[evtData.index]
  9685. });
  9686. },
  9687. getMenuItemCount: function getMenuItemCount() {
  9688. return _this.items.length;
  9689. },
  9690. focusItemAtIndex: function focusItemAtIndex(index) {
  9691. return _this.items[index].focus();
  9692. },
  9693. focusListRoot: function focusListRoot() {
  9694. return _this.root_.querySelector(constants_1.strings.LIST_SELECTOR).focus();
  9695. },
  9696. isSelectableItemAtIndex: function isSelectableItemAtIndex(index) {
  9697. return !!ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  9698. },
  9699. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) {
  9700. var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  9701. var selectedItemEl = selectionGroupEl.querySelector("." + constants_1.cssClasses.MENU_SELECTED_LIST_ITEM);
  9702. return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
  9703. }
  9704. };
  9705. // tslint:enable:object-literal-sort-keys
  9706. return new foundation_3.MDCMenuFoundation(adapter);
  9707. };
  9708. return MDCMenu;
  9709. }(component_1.MDCComponent);
  9710. exports.MDCMenu = MDCMenu;
  9711. /***/ }),
  9712. /***/ "./packages/mdc-menu/constants.ts":
  9713. /*!****************************************!*\
  9714. !*** ./packages/mdc-menu/constants.ts ***!
  9715. \****************************************/
  9716. /*! no static exports found */
  9717. /***/ (function(module, exports, __webpack_require__) {
  9718. "use strict";
  9719. /**
  9720. * @license
  9721. * Copyright 2018 Google Inc.
  9722. *
  9723. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9724. * of this software and associated documentation files (the "Software"), to deal
  9725. * in the Software without restriction, including without limitation the rights
  9726. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9727. * copies of the Software, and to permit persons to whom the Software is
  9728. * furnished to do so, subject to the following conditions:
  9729. *
  9730. * The above copyright notice and this permission notice shall be included in
  9731. * all copies or substantial portions of the Software.
  9732. *
  9733. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9734. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9735. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9736. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9737. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9738. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9739. * THE SOFTWARE.
  9740. */
  9741. Object.defineProperty(exports, "__esModule", { value: true });
  9742. var cssClasses = {
  9743. MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
  9744. MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
  9745. ROOT: 'mdc-menu'
  9746. };
  9747. exports.cssClasses = cssClasses;
  9748. var strings = {
  9749. ARIA_CHECKED_ATTR: 'aria-checked',
  9750. ARIA_DISABLED_ATTR: 'aria-disabled',
  9751. CHECKBOX_SELECTOR: 'input[type="checkbox"]',
  9752. LIST_SELECTOR: '.mdc-list',
  9753. SELECTED_EVENT: 'MDCMenu:selected'
  9754. };
  9755. exports.strings = strings;
  9756. var numbers = {
  9757. FOCUS_ROOT_INDEX: -1
  9758. };
  9759. exports.numbers = numbers;
  9760. var DefaultFocusState;
  9761. (function (DefaultFocusState) {
  9762. DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
  9763. DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
  9764. DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
  9765. DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
  9766. })(DefaultFocusState || (DefaultFocusState = {}));
  9767. exports.DefaultFocusState = DefaultFocusState;
  9768. /***/ }),
  9769. /***/ "./packages/mdc-menu/foundation.ts":
  9770. /*!*****************************************!*\
  9771. !*** ./packages/mdc-menu/foundation.ts ***!
  9772. \*****************************************/
  9773. /*! no static exports found */
  9774. /***/ (function(module, exports, __webpack_require__) {
  9775. "use strict";
  9776. /**
  9777. * @license
  9778. * Copyright 2018 Google Inc.
  9779. *
  9780. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9781. * of this software and associated documentation files (the "Software"), to deal
  9782. * in the Software without restriction, including without limitation the rights
  9783. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9784. * copies of the Software, and to permit persons to whom the Software is
  9785. * furnished to do so, subject to the following conditions:
  9786. *
  9787. * The above copyright notice and this permission notice shall be included in
  9788. * all copies or substantial portions of the Software.
  9789. *
  9790. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9791. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9792. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9793. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9794. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9795. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9796. * THE SOFTWARE.
  9797. */
  9798. var __extends = this && this.__extends || function () {
  9799. var _extendStatics = function extendStatics(d, b) {
  9800. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9801. d.__proto__ = b;
  9802. } || function (d, b) {
  9803. for (var p in b) {
  9804. if (b.hasOwnProperty(p)) d[p] = b[p];
  9805. }
  9806. };
  9807. return _extendStatics(d, b);
  9808. };
  9809. return function (d, b) {
  9810. _extendStatics(d, b);
  9811. function __() {
  9812. this.constructor = d;
  9813. }
  9814. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9815. };
  9816. }();
  9817. var __assign = this && this.__assign || function () {
  9818. __assign = Object.assign || function (t) {
  9819. for (var s, i = 1, n = arguments.length; i < n; i++) {
  9820. s = arguments[i];
  9821. for (var p in s) {
  9822. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  9823. }
  9824. }
  9825. return t;
  9826. };
  9827. return __assign.apply(this, arguments);
  9828. };
  9829. Object.defineProperty(exports, "__esModule", { value: true });
  9830. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  9831. var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts");
  9832. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  9833. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  9834. var MDCMenuFoundation = /** @class */function (_super) {
  9835. __extends(MDCMenuFoundation, _super);
  9836. function MDCMenuFoundation(adapter) {
  9837. var _this = _super.call(this, __assign({}, MDCMenuFoundation.defaultAdapter, adapter)) || this;
  9838. _this.closeAnimationEndTimerId_ = 0;
  9839. _this.defaultFocusState_ = constants_2.DefaultFocusState.LIST_ROOT;
  9840. return _this;
  9841. }
  9842. Object.defineProperty(MDCMenuFoundation, "cssClasses", {
  9843. get: function get() {
  9844. return constants_2.cssClasses;
  9845. },
  9846. enumerable: true,
  9847. configurable: true
  9848. });
  9849. Object.defineProperty(MDCMenuFoundation, "strings", {
  9850. get: function get() {
  9851. return constants_2.strings;
  9852. },
  9853. enumerable: true,
  9854. configurable: true
  9855. });
  9856. Object.defineProperty(MDCMenuFoundation, "numbers", {
  9857. get: function get() {
  9858. return constants_2.numbers;
  9859. },
  9860. enumerable: true,
  9861. configurable: true
  9862. });
  9863. Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
  9864. /**
  9865. * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
  9866. */
  9867. get: function get() {
  9868. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9869. return {
  9870. addClassToElementAtIndex: function addClassToElementAtIndex() {
  9871. return undefined;
  9872. },
  9873. removeClassFromElementAtIndex: function removeClassFromElementAtIndex() {
  9874. return undefined;
  9875. },
  9876. addAttributeToElementAtIndex: function addAttributeToElementAtIndex() {
  9877. return undefined;
  9878. },
  9879. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() {
  9880. return undefined;
  9881. },
  9882. elementContainsClass: function elementContainsClass() {
  9883. return false;
  9884. },
  9885. closeSurface: function closeSurface() {
  9886. return undefined;
  9887. },
  9888. getElementIndex: function getElementIndex() {
  9889. return -1;
  9890. },
  9891. notifySelected: function notifySelected() {
  9892. return undefined;
  9893. },
  9894. getMenuItemCount: function getMenuItemCount() {
  9895. return 0;
  9896. },
  9897. focusItemAtIndex: function focusItemAtIndex() {
  9898. return undefined;
  9899. },
  9900. focusListRoot: function focusListRoot() {
  9901. return undefined;
  9902. },
  9903. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() {
  9904. return -1;
  9905. },
  9906. isSelectableItemAtIndex: function isSelectableItemAtIndex() {
  9907. return false;
  9908. }
  9909. };
  9910. // tslint:enable:object-literal-sort-keys
  9911. },
  9912. enumerable: true,
  9913. configurable: true
  9914. });
  9915. MDCMenuFoundation.prototype.destroy = function () {
  9916. if (this.closeAnimationEndTimerId_) {
  9917. clearTimeout(this.closeAnimationEndTimerId_);
  9918. }
  9919. this.adapter_.closeSurface();
  9920. };
  9921. MDCMenuFoundation.prototype.handleKeydown = function (evt) {
  9922. var key = evt.key,
  9923. keyCode = evt.keyCode;
  9924. var isTab = key === 'Tab' || keyCode === 9;
  9925. if (isTab) {
  9926. this.adapter_.closeSurface( /** skipRestoreFocus */true);
  9927. }
  9928. };
  9929. MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
  9930. var _this = this;
  9931. var index = this.adapter_.getElementIndex(listItem);
  9932. if (index < 0) {
  9933. return;
  9934. }
  9935. this.adapter_.notifySelected({ index: index });
  9936. this.adapter_.closeSurface();
  9937. // Wait for the menu to close before adding/removing classes that affect styles.
  9938. this.closeAnimationEndTimerId_ = setTimeout(function () {
  9939. // Recompute the index in case the menu contents have changed.
  9940. var recomputedIndex = _this.adapter_.getElementIndex(listItem);
  9941. if (_this.adapter_.isSelectableItemAtIndex(recomputedIndex)) {
  9942. _this.setSelectedIndex(recomputedIndex);
  9943. }
  9944. }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
  9945. };
  9946. MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
  9947. switch (this.defaultFocusState_) {
  9948. case constants_2.DefaultFocusState.FIRST_ITEM:
  9949. this.adapter_.focusItemAtIndex(0);
  9950. break;
  9951. case constants_2.DefaultFocusState.LAST_ITEM:
  9952. this.adapter_.focusItemAtIndex(this.adapter_.getMenuItemCount() - 1);
  9953. break;
  9954. case constants_2.DefaultFocusState.NONE:
  9955. // Do nothing.
  9956. break;
  9957. default:
  9958. this.adapter_.focusListRoot();
  9959. break;
  9960. }
  9961. };
  9962. /**
  9963. * Sets default focus state where the menu should focus every time when menu
  9964. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  9965. * default.
  9966. */
  9967. MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
  9968. this.defaultFocusState_ = focusState;
  9969. };
  9970. /**
  9971. * Selects the list item at `index` within the menu.
  9972. * @param index Index of list item within the menu.
  9973. */
  9974. MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
  9975. this.validatedIndex_(index);
  9976. if (!this.adapter_.isSelectableItemAtIndex(index)) {
  9977. throw new Error('MDCMenuFoundation: No selection group at specified index.');
  9978. }
  9979. var prevSelectedIndex = this.adapter_.getSelectedSiblingOfItemAtIndex(index);
  9980. if (prevSelectedIndex >= 0) {
  9981. this.adapter_.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_2.strings.ARIA_CHECKED_ATTR);
  9982. this.adapter_.removeClassFromElementAtIndex(prevSelectedIndex, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
  9983. }
  9984. this.adapter_.addClassToElementAtIndex(index, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
  9985. this.adapter_.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_CHECKED_ATTR, 'true');
  9986. };
  9987. /**
  9988. * Sets the enabled state to isEnabled for the menu item at the given index.
  9989. * @param index Index of the menu item
  9990. * @param isEnabled The desired enabled state of the menu item.
  9991. */
  9992. MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
  9993. this.validatedIndex_(index);
  9994. if (isEnabled) {
  9995. this.adapter_.removeClassFromElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9996. this.adapter_.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'false');
  9997. } else {
  9998. this.adapter_.addClassToElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9999. this.adapter_.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'true');
  10000. }
  10001. };
  10002. MDCMenuFoundation.prototype.validatedIndex_ = function (index) {
  10003. var menuSize = this.adapter_.getMenuItemCount();
  10004. var isIndexInRange = index >= 0 && index < menuSize;
  10005. if (!isIndexInRange) {
  10006. throw new Error('MDCMenuFoundation: No list item at specified index.');
  10007. }
  10008. };
  10009. return MDCMenuFoundation;
  10010. }(foundation_1.MDCFoundation);
  10011. exports.MDCMenuFoundation = MDCMenuFoundation;
  10012. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10013. exports.default = MDCMenuFoundation;
  10014. /***/ }),
  10015. /***/ "./packages/mdc-menu/index.ts":
  10016. /*!************************************!*\
  10017. !*** ./packages/mdc-menu/index.ts ***!
  10018. \************************************/
  10019. /*! no static exports found */
  10020. /***/ (function(module, exports, __webpack_require__) {
  10021. "use strict";
  10022. /**
  10023. * @license
  10024. * Copyright 2019 Google Inc.
  10025. *
  10026. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10027. * of this software and associated documentation files (the "Software"), to deal
  10028. * in the Software without restriction, including without limitation the rights
  10029. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10030. * copies of the Software, and to permit persons to whom the Software is
  10031. * furnished to do so, subject to the following conditions:
  10032. *
  10033. * The above copyright notice and this permission notice shall be included in
  10034. * all copies or substantial portions of the Software.
  10035. *
  10036. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10037. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10038. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10039. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10040. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10041. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10042. * THE SOFTWARE.
  10043. */
  10044. function __export(m) {
  10045. for (var p in m) {
  10046. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10047. }
  10048. }
  10049. Object.defineProperty(exports, "__esModule", { value: true });
  10050. var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); // for backward compatibility
  10051. exports.Corner = constants_1.Corner;
  10052. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu/component.ts"));
  10053. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"));
  10054. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"));
  10055. /***/ }),
  10056. /***/ "./packages/mdc-notched-outline/component.ts":
  10057. /*!***************************************************!*\
  10058. !*** ./packages/mdc-notched-outline/component.ts ***!
  10059. \***************************************************/
  10060. /*! no static exports found */
  10061. /***/ (function(module, exports, __webpack_require__) {
  10062. "use strict";
  10063. /**
  10064. * @license
  10065. * Copyright 2017 Google Inc.
  10066. *
  10067. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10068. * of this software and associated documentation files (the "Software"), to deal
  10069. * in the Software without restriction, including without limitation the rights
  10070. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10071. * copies of the Software, and to permit persons to whom the Software is
  10072. * furnished to do so, subject to the following conditions:
  10073. *
  10074. * The above copyright notice and this permission notice shall be included in
  10075. * all copies or substantial portions of the Software.
  10076. *
  10077. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10078. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10079. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10080. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10081. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10082. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10083. * THE SOFTWARE.
  10084. */
  10085. var __extends = this && this.__extends || function () {
  10086. var _extendStatics = function extendStatics(d, b) {
  10087. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10088. d.__proto__ = b;
  10089. } || function (d, b) {
  10090. for (var p in b) {
  10091. if (b.hasOwnProperty(p)) d[p] = b[p];
  10092. }
  10093. };
  10094. return _extendStatics(d, b);
  10095. };
  10096. return function (d, b) {
  10097. _extendStatics(d, b);
  10098. function __() {
  10099. this.constructor = d;
  10100. }
  10101. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10102. };
  10103. }();
  10104. Object.defineProperty(exports, "__esModule", { value: true });
  10105. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10106. var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts");
  10107. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  10108. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts");
  10109. var MDCNotchedOutline = /** @class */function (_super) {
  10110. __extends(MDCNotchedOutline, _super);
  10111. function MDCNotchedOutline() {
  10112. return _super !== null && _super.apply(this, arguments) || this;
  10113. }
  10114. MDCNotchedOutline.attachTo = function (root) {
  10115. return new MDCNotchedOutline(root);
  10116. };
  10117. MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
  10118. this.notchElement_ = this.root_.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
  10119. var label = this.root_.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
  10120. if (label) {
  10121. label.style.transitionDuration = '0s';
  10122. this.root_.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
  10123. requestAnimationFrame(function () {
  10124. label.style.transitionDuration = '';
  10125. });
  10126. } else {
  10127. this.root_.classList.add(constants_1.cssClasses.NO_LABEL);
  10128. }
  10129. };
  10130. /**
  10131. * Updates classes and styles to open the notch to the specified width.
  10132. * @param notchWidth The notch width in the outline.
  10133. */
  10134. MDCNotchedOutline.prototype.notch = function (notchWidth) {
  10135. this.foundation_.notch(notchWidth);
  10136. };
  10137. /**
  10138. * Updates classes and styles to close the notch.
  10139. */
  10140. MDCNotchedOutline.prototype.closeNotch = function () {
  10141. this.foundation_.closeNotch();
  10142. };
  10143. MDCNotchedOutline.prototype.getDefaultFoundation = function () {
  10144. var _this = this;
  10145. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10146. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10147. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10148. var adapter = {
  10149. addClass: function addClass(className) {
  10150. return _this.root_.classList.add(className);
  10151. },
  10152. removeClass: function removeClass(className) {
  10153. return _this.root_.classList.remove(className);
  10154. },
  10155. setNotchWidthProperty: function setNotchWidthProperty(width) {
  10156. return _this.notchElement_.style.setProperty('width', width + 'px');
  10157. },
  10158. removeNotchWidthProperty: function removeNotchWidthProperty() {
  10159. return _this.notchElement_.style.removeProperty('width');
  10160. }
  10161. };
  10162. // tslint:enable:object-literal-sort-keys
  10163. return new foundation_2.MDCNotchedOutlineFoundation(adapter);
  10164. };
  10165. return MDCNotchedOutline;
  10166. }(component_1.MDCComponent);
  10167. exports.MDCNotchedOutline = MDCNotchedOutline;
  10168. /***/ }),
  10169. /***/ "./packages/mdc-notched-outline/constants.ts":
  10170. /*!***************************************************!*\
  10171. !*** ./packages/mdc-notched-outline/constants.ts ***!
  10172. \***************************************************/
  10173. /*! no static exports found */
  10174. /***/ (function(module, exports, __webpack_require__) {
  10175. "use strict";
  10176. /**
  10177. * @license
  10178. * Copyright 2018 Google Inc.
  10179. *
  10180. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10181. * of this software and associated documentation files (the "Software"), to deal
  10182. * in the Software without restriction, including without limitation the rights
  10183. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10184. * copies of the Software, and to permit persons to whom the Software is
  10185. * furnished to do so, subject to the following conditions:
  10186. *
  10187. * The above copyright notice and this permission notice shall be included in
  10188. * all copies or substantial portions of the Software.
  10189. *
  10190. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10191. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10192. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10193. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10194. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10195. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10196. * THE SOFTWARE.
  10197. */
  10198. Object.defineProperty(exports, "__esModule", { value: true });
  10199. var strings = {
  10200. NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
  10201. };
  10202. exports.strings = strings;
  10203. var numbers = {
  10204. // This should stay in sync with $mdc-notched-outline-padding * 2.
  10205. NOTCH_ELEMENT_PADDING: 8
  10206. };
  10207. exports.numbers = numbers;
  10208. var cssClasses = {
  10209. NO_LABEL: 'mdc-notched-outline--no-label',
  10210. OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
  10211. OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
  10212. };
  10213. exports.cssClasses = cssClasses;
  10214. /***/ }),
  10215. /***/ "./packages/mdc-notched-outline/foundation.ts":
  10216. /*!****************************************************!*\
  10217. !*** ./packages/mdc-notched-outline/foundation.ts ***!
  10218. \****************************************************/
  10219. /*! no static exports found */
  10220. /***/ (function(module, exports, __webpack_require__) {
  10221. "use strict";
  10222. /**
  10223. * @license
  10224. * Copyright 2017 Google Inc.
  10225. *
  10226. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10227. * of this software and associated documentation files (the "Software"), to deal
  10228. * in the Software without restriction, including without limitation the rights
  10229. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10230. * copies of the Software, and to permit persons to whom the Software is
  10231. * furnished to do so, subject to the following conditions:
  10232. *
  10233. * The above copyright notice and this permission notice shall be included in
  10234. * all copies or substantial portions of the Software.
  10235. *
  10236. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10237. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10238. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10239. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10240. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10241. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10242. * THE SOFTWARE.
  10243. */
  10244. var __extends = this && this.__extends || function () {
  10245. var _extendStatics = function extendStatics(d, b) {
  10246. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10247. d.__proto__ = b;
  10248. } || function (d, b) {
  10249. for (var p in b) {
  10250. if (b.hasOwnProperty(p)) d[p] = b[p];
  10251. }
  10252. };
  10253. return _extendStatics(d, b);
  10254. };
  10255. return function (d, b) {
  10256. _extendStatics(d, b);
  10257. function __() {
  10258. this.constructor = d;
  10259. }
  10260. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10261. };
  10262. }();
  10263. var __assign = this && this.__assign || function () {
  10264. __assign = Object.assign || function (t) {
  10265. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10266. s = arguments[i];
  10267. for (var p in s) {
  10268. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10269. }
  10270. }
  10271. return t;
  10272. };
  10273. return __assign.apply(this, arguments);
  10274. };
  10275. Object.defineProperty(exports, "__esModule", { value: true });
  10276. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10277. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  10278. var MDCNotchedOutlineFoundation = /** @class */function (_super) {
  10279. __extends(MDCNotchedOutlineFoundation, _super);
  10280. function MDCNotchedOutlineFoundation(adapter) {
  10281. return _super.call(this, __assign({}, MDCNotchedOutlineFoundation.defaultAdapter, adapter)) || this;
  10282. }
  10283. Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
  10284. get: function get() {
  10285. return constants_1.strings;
  10286. },
  10287. enumerable: true,
  10288. configurable: true
  10289. });
  10290. Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
  10291. get: function get() {
  10292. return constants_1.cssClasses;
  10293. },
  10294. enumerable: true,
  10295. configurable: true
  10296. });
  10297. Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
  10298. get: function get() {
  10299. return constants_1.numbers;
  10300. },
  10301. enumerable: true,
  10302. configurable: true
  10303. });
  10304. Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
  10305. /**
  10306. * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
  10307. */
  10308. get: function get() {
  10309. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10310. return {
  10311. addClass: function addClass() {
  10312. return undefined;
  10313. },
  10314. removeClass: function removeClass() {
  10315. return undefined;
  10316. },
  10317. setNotchWidthProperty: function setNotchWidthProperty() {
  10318. return undefined;
  10319. },
  10320. removeNotchWidthProperty: function removeNotchWidthProperty() {
  10321. return undefined;
  10322. }
  10323. };
  10324. // tslint:enable:object-literal-sort-keys
  10325. },
  10326. enumerable: true,
  10327. configurable: true
  10328. });
  10329. /**
  10330. * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
  10331. */
  10332. MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
  10333. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  10334. if (notchWidth > 0) {
  10335. notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
  10336. }
  10337. this.adapter_.setNotchWidthProperty(notchWidth);
  10338. this.adapter_.addClass(OUTLINE_NOTCHED);
  10339. };
  10340. /**
  10341. * Removes notched outline selector to close the notch in the outline.
  10342. */
  10343. MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
  10344. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  10345. this.adapter_.removeClass(OUTLINE_NOTCHED);
  10346. this.adapter_.removeNotchWidthProperty();
  10347. };
  10348. return MDCNotchedOutlineFoundation;
  10349. }(foundation_1.MDCFoundation);
  10350. exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
  10351. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10352. exports.default = MDCNotchedOutlineFoundation;
  10353. /***/ }),
  10354. /***/ "./packages/mdc-notched-outline/index.ts":
  10355. /*!***********************************************!*\
  10356. !*** ./packages/mdc-notched-outline/index.ts ***!
  10357. \***********************************************/
  10358. /*! no static exports found */
  10359. /***/ (function(module, exports, __webpack_require__) {
  10360. "use strict";
  10361. /**
  10362. * @license
  10363. * Copyright 2019 Google Inc.
  10364. *
  10365. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10366. * of this software and associated documentation files (the "Software"), to deal
  10367. * in the Software without restriction, including without limitation the rights
  10368. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10369. * copies of the Software, and to permit persons to whom the Software is
  10370. * furnished to do so, subject to the following conditions:
  10371. *
  10372. * The above copyright notice and this permission notice shall be included in
  10373. * all copies or substantial portions of the Software.
  10374. *
  10375. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10376. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10377. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10378. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10379. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10380. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10381. * THE SOFTWARE.
  10382. */
  10383. function __export(m) {
  10384. for (var p in m) {
  10385. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10386. }
  10387. }
  10388. Object.defineProperty(exports, "__esModule", { value: true });
  10389. __export(__webpack_require__(/*! ./component */ "./packages/mdc-notched-outline/component.ts"));
  10390. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"));
  10391. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"));
  10392. /***/ }),
  10393. /***/ "./packages/mdc-radio/component.ts":
  10394. /*!*****************************************!*\
  10395. !*** ./packages/mdc-radio/component.ts ***!
  10396. \*****************************************/
  10397. /*! no static exports found */
  10398. /***/ (function(module, exports, __webpack_require__) {
  10399. "use strict";
  10400. /**
  10401. * @license
  10402. * Copyright 2016 Google Inc.
  10403. *
  10404. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10405. * of this software and associated documentation files (the "Software"), to deal
  10406. * in the Software without restriction, including without limitation the rights
  10407. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10408. * copies of the Software, and to permit persons to whom the Software is
  10409. * furnished to do so, subject to the following conditions:
  10410. *
  10411. * The above copyright notice and this permission notice shall be included in
  10412. * all copies or substantial portions of the Software.
  10413. *
  10414. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10415. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10416. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10417. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10418. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10419. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10420. * THE SOFTWARE.
  10421. */
  10422. var __extends = this && this.__extends || function () {
  10423. var _extendStatics = function extendStatics(d, b) {
  10424. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10425. d.__proto__ = b;
  10426. } || function (d, b) {
  10427. for (var p in b) {
  10428. if (b.hasOwnProperty(p)) d[p] = b[p];
  10429. }
  10430. };
  10431. return _extendStatics(d, b);
  10432. };
  10433. return function (d, b) {
  10434. _extendStatics(d, b);
  10435. function __() {
  10436. this.constructor = d;
  10437. }
  10438. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10439. };
  10440. }();
  10441. var __assign = this && this.__assign || function () {
  10442. __assign = Object.assign || function (t) {
  10443. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10444. s = arguments[i];
  10445. for (var p in s) {
  10446. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10447. }
  10448. }
  10449. return t;
  10450. };
  10451. return __assign.apply(this, arguments);
  10452. };
  10453. Object.defineProperty(exports, "__esModule", { value: true });
  10454. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10455. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  10456. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  10457. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  10458. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts");
  10459. var MDCRadio = /** @class */function (_super) {
  10460. __extends(MDCRadio, _super);
  10461. function MDCRadio() {
  10462. var _this = _super !== null && _super.apply(this, arguments) || this;
  10463. _this.ripple_ = _this.createRipple_();
  10464. return _this;
  10465. }
  10466. MDCRadio.attachTo = function (root) {
  10467. return new MDCRadio(root);
  10468. };
  10469. Object.defineProperty(MDCRadio.prototype, "checked", {
  10470. get: function get() {
  10471. return this.nativeControl_.checked;
  10472. },
  10473. set: function set(checked) {
  10474. this.nativeControl_.checked = checked;
  10475. },
  10476. enumerable: true,
  10477. configurable: true
  10478. });
  10479. Object.defineProperty(MDCRadio.prototype, "disabled", {
  10480. get: function get() {
  10481. return this.nativeControl_.disabled;
  10482. },
  10483. set: function set(disabled) {
  10484. this.foundation_.setDisabled(disabled);
  10485. },
  10486. enumerable: true,
  10487. configurable: true
  10488. });
  10489. Object.defineProperty(MDCRadio.prototype, "value", {
  10490. get: function get() {
  10491. return this.nativeControl_.value;
  10492. },
  10493. set: function set(value) {
  10494. this.nativeControl_.value = value;
  10495. },
  10496. enumerable: true,
  10497. configurable: true
  10498. });
  10499. Object.defineProperty(MDCRadio.prototype, "ripple", {
  10500. get: function get() {
  10501. return this.ripple_;
  10502. },
  10503. enumerable: true,
  10504. configurable: true
  10505. });
  10506. MDCRadio.prototype.destroy = function () {
  10507. this.ripple_.destroy();
  10508. _super.prototype.destroy.call(this);
  10509. };
  10510. MDCRadio.prototype.getDefaultFoundation = function () {
  10511. var _this = this;
  10512. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10513. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10514. var adapter = {
  10515. addClass: function addClass(className) {
  10516. return _this.root_.classList.add(className);
  10517. },
  10518. removeClass: function removeClass(className) {
  10519. return _this.root_.classList.remove(className);
  10520. },
  10521. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  10522. return _this.nativeControl_.disabled = disabled;
  10523. }
  10524. };
  10525. return new foundation_2.MDCRadioFoundation(adapter);
  10526. };
  10527. MDCRadio.prototype.createRipple_ = function () {
  10528. var _this = this;
  10529. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10530. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10531. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10532. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  10533. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  10534. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  10535. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  10536. },
  10537. // Radio buttons technically go "active" whenever there is *any* keyboard interaction.
  10538. // This is not the UI we desire.
  10539. isSurfaceActive: function isSurfaceActive() {
  10540. return false;
  10541. }, isUnbounded: function isUnbounded() {
  10542. return true;
  10543. } });
  10544. // tslint:enable:object-literal-sort-keys
  10545. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  10546. };
  10547. Object.defineProperty(MDCRadio.prototype, "nativeControl_", {
  10548. get: function get() {
  10549. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR;
  10550. var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  10551. if (!el) {
  10552. throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  10553. }
  10554. return el;
  10555. },
  10556. enumerable: true,
  10557. configurable: true
  10558. });
  10559. return MDCRadio;
  10560. }(component_1.MDCComponent);
  10561. exports.MDCRadio = MDCRadio;
  10562. /***/ }),
  10563. /***/ "./packages/mdc-radio/constants.ts":
  10564. /*!*****************************************!*\
  10565. !*** ./packages/mdc-radio/constants.ts ***!
  10566. \*****************************************/
  10567. /*! no static exports found */
  10568. /***/ (function(module, exports, __webpack_require__) {
  10569. "use strict";
  10570. /**
  10571. * @license
  10572. * Copyright 2016 Google Inc.
  10573. *
  10574. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10575. * of this software and associated documentation files (the "Software"), to deal
  10576. * in the Software without restriction, including without limitation the rights
  10577. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10578. * copies of the Software, and to permit persons to whom the Software is
  10579. * furnished to do so, subject to the following conditions:
  10580. *
  10581. * The above copyright notice and this permission notice shall be included in
  10582. * all copies or substantial portions of the Software.
  10583. *
  10584. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10585. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10586. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10587. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10588. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10589. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10590. * THE SOFTWARE.
  10591. */
  10592. Object.defineProperty(exports, "__esModule", { value: true });
  10593. var strings = {
  10594. NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control'
  10595. };
  10596. exports.strings = strings;
  10597. var cssClasses = {
  10598. DISABLED: 'mdc-radio--disabled',
  10599. ROOT: 'mdc-radio'
  10600. };
  10601. exports.cssClasses = cssClasses;
  10602. /***/ }),
  10603. /***/ "./packages/mdc-radio/foundation.ts":
  10604. /*!******************************************!*\
  10605. !*** ./packages/mdc-radio/foundation.ts ***!
  10606. \******************************************/
  10607. /*! no static exports found */
  10608. /***/ (function(module, exports, __webpack_require__) {
  10609. "use strict";
  10610. /**
  10611. * @license
  10612. * Copyright 2016 Google Inc.
  10613. *
  10614. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10615. * of this software and associated documentation files (the "Software"), to deal
  10616. * in the Software without restriction, including without limitation the rights
  10617. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10618. * copies of the Software, and to permit persons to whom the Software is
  10619. * furnished to do so, subject to the following conditions:
  10620. *
  10621. * The above copyright notice and this permission notice shall be included in
  10622. * all copies or substantial portions of the Software.
  10623. *
  10624. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10625. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10626. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10627. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10628. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10629. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10630. * THE SOFTWARE.
  10631. */
  10632. var __extends = this && this.__extends || function () {
  10633. var _extendStatics = function extendStatics(d, b) {
  10634. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10635. d.__proto__ = b;
  10636. } || function (d, b) {
  10637. for (var p in b) {
  10638. if (b.hasOwnProperty(p)) d[p] = b[p];
  10639. }
  10640. };
  10641. return _extendStatics(d, b);
  10642. };
  10643. return function (d, b) {
  10644. _extendStatics(d, b);
  10645. function __() {
  10646. this.constructor = d;
  10647. }
  10648. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10649. };
  10650. }();
  10651. var __assign = this && this.__assign || function () {
  10652. __assign = Object.assign || function (t) {
  10653. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10654. s = arguments[i];
  10655. for (var p in s) {
  10656. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10657. }
  10658. }
  10659. return t;
  10660. };
  10661. return __assign.apply(this, arguments);
  10662. };
  10663. Object.defineProperty(exports, "__esModule", { value: true });
  10664. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10665. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts");
  10666. var MDCRadioFoundation = /** @class */function (_super) {
  10667. __extends(MDCRadioFoundation, _super);
  10668. function MDCRadioFoundation(adapter) {
  10669. return _super.call(this, __assign({}, MDCRadioFoundation.defaultAdapter, adapter)) || this;
  10670. }
  10671. Object.defineProperty(MDCRadioFoundation, "cssClasses", {
  10672. get: function get() {
  10673. return constants_1.cssClasses;
  10674. },
  10675. enumerable: true,
  10676. configurable: true
  10677. });
  10678. Object.defineProperty(MDCRadioFoundation, "strings", {
  10679. get: function get() {
  10680. return constants_1.strings;
  10681. },
  10682. enumerable: true,
  10683. configurable: true
  10684. });
  10685. Object.defineProperty(MDCRadioFoundation, "defaultAdapter", {
  10686. get: function get() {
  10687. return {
  10688. addClass: function addClass() {
  10689. return undefined;
  10690. },
  10691. removeClass: function removeClass() {
  10692. return undefined;
  10693. },
  10694. setNativeControlDisabled: function setNativeControlDisabled() {
  10695. return undefined;
  10696. }
  10697. };
  10698. },
  10699. enumerable: true,
  10700. configurable: true
  10701. });
  10702. MDCRadioFoundation.prototype.setDisabled = function (disabled) {
  10703. var DISABLED = MDCRadioFoundation.cssClasses.DISABLED;
  10704. this.adapter_.setNativeControlDisabled(disabled);
  10705. if (disabled) {
  10706. this.adapter_.addClass(DISABLED);
  10707. } else {
  10708. this.adapter_.removeClass(DISABLED);
  10709. }
  10710. };
  10711. return MDCRadioFoundation;
  10712. }(foundation_1.MDCFoundation);
  10713. exports.MDCRadioFoundation = MDCRadioFoundation;
  10714. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10715. exports.default = MDCRadioFoundation;
  10716. /***/ }),
  10717. /***/ "./packages/mdc-radio/index.ts":
  10718. /*!*************************************!*\
  10719. !*** ./packages/mdc-radio/index.ts ***!
  10720. \*************************************/
  10721. /*! no static exports found */
  10722. /***/ (function(module, exports, __webpack_require__) {
  10723. "use strict";
  10724. /**
  10725. * @license
  10726. * Copyright 2019 Google Inc.
  10727. *
  10728. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10729. * of this software and associated documentation files (the "Software"), to deal
  10730. * in the Software without restriction, including without limitation the rights
  10731. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10732. * copies of the Software, and to permit persons to whom the Software is
  10733. * furnished to do so, subject to the following conditions:
  10734. *
  10735. * The above copyright notice and this permission notice shall be included in
  10736. * all copies or substantial portions of the Software.
  10737. *
  10738. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10739. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10740. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10741. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10742. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10743. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10744. * THE SOFTWARE.
  10745. */
  10746. function __export(m) {
  10747. for (var p in m) {
  10748. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10749. }
  10750. }
  10751. Object.defineProperty(exports, "__esModule", { value: true });
  10752. __export(__webpack_require__(/*! ./component */ "./packages/mdc-radio/component.ts"));
  10753. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"));
  10754. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"));
  10755. /***/ }),
  10756. /***/ "./packages/mdc-ripple/component.ts":
  10757. /*!******************************************!*\
  10758. !*** ./packages/mdc-ripple/component.ts ***!
  10759. \******************************************/
  10760. /*! no static exports found */
  10761. /***/ (function(module, exports, __webpack_require__) {
  10762. "use strict";
  10763. /**
  10764. * @license
  10765. * Copyright 2016 Google Inc.
  10766. *
  10767. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10768. * of this software and associated documentation files (the "Software"), to deal
  10769. * in the Software without restriction, including without limitation the rights
  10770. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10771. * copies of the Software, and to permit persons to whom the Software is
  10772. * furnished to do so, subject to the following conditions:
  10773. *
  10774. * The above copyright notice and this permission notice shall be included in
  10775. * all copies or substantial portions of the Software.
  10776. *
  10777. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10778. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10779. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10780. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10781. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10782. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10783. * THE SOFTWARE.
  10784. */
  10785. var __extends = this && this.__extends || function () {
  10786. var _extendStatics = function extendStatics(d, b) {
  10787. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10788. d.__proto__ = b;
  10789. } || function (d, b) {
  10790. for (var p in b) {
  10791. if (b.hasOwnProperty(p)) d[p] = b[p];
  10792. }
  10793. };
  10794. return _extendStatics(d, b);
  10795. };
  10796. return function (d, b) {
  10797. _extendStatics(d, b);
  10798. function __() {
  10799. this.constructor = d;
  10800. }
  10801. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10802. };
  10803. }();
  10804. var __importStar = this && this.__importStar || function (mod) {
  10805. if (mod && mod.__esModule) return mod;
  10806. var result = {};
  10807. if (mod != null) for (var k in mod) {
  10808. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  10809. }result["default"] = mod;
  10810. return result;
  10811. };
  10812. Object.defineProperty(exports, "__esModule", { value: true });
  10813. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10814. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  10815. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  10816. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  10817. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  10818. var MDCRipple = /** @class */function (_super) {
  10819. __extends(MDCRipple, _super);
  10820. function MDCRipple() {
  10821. var _this = _super !== null && _super.apply(this, arguments) || this;
  10822. _this.disabled = false;
  10823. return _this;
  10824. }
  10825. MDCRipple.attachTo = function (root, opts) {
  10826. if (opts === void 0) {
  10827. opts = { isUnbounded: undefined };
  10828. }
  10829. var ripple = new MDCRipple(root);
  10830. // Only override unbounded behavior if option is explicitly specified
  10831. if (opts.isUnbounded !== undefined) {
  10832. ripple.unbounded = opts.isUnbounded;
  10833. }
  10834. return ripple;
  10835. };
  10836. MDCRipple.createAdapter = function (instance) {
  10837. return {
  10838. addClass: function addClass(className) {
  10839. return instance.root_.classList.add(className);
  10840. },
  10841. browserSupportsCssVars: function browserSupportsCssVars() {
  10842. return util.supportsCssVariables(window);
  10843. },
  10844. computeBoundingRect: function computeBoundingRect() {
  10845. return instance.root_.getBoundingClientRect();
  10846. },
  10847. containsEventTarget: function containsEventTarget(target) {
  10848. return instance.root_.contains(target);
  10849. },
  10850. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  10851. return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  10852. },
  10853. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  10854. return instance.root_.removeEventListener(evtType, handler, events_1.applyPassive());
  10855. },
  10856. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  10857. return window.removeEventListener('resize', handler);
  10858. },
  10859. getWindowPageOffset: function getWindowPageOffset() {
  10860. return { x: window.pageXOffset, y: window.pageYOffset };
  10861. },
  10862. isSurfaceActive: function isSurfaceActive() {
  10863. return ponyfill_1.matches(instance.root_, ':active');
  10864. },
  10865. isSurfaceDisabled: function isSurfaceDisabled() {
  10866. return Boolean(instance.disabled);
  10867. },
  10868. isUnbounded: function isUnbounded() {
  10869. return Boolean(instance.unbounded);
  10870. },
  10871. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  10872. return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  10873. },
  10874. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  10875. return instance.root_.addEventListener(evtType, handler, events_1.applyPassive());
  10876. },
  10877. registerResizeHandler: function registerResizeHandler(handler) {
  10878. return window.addEventListener('resize', handler);
  10879. },
  10880. removeClass: function removeClass(className) {
  10881. return instance.root_.classList.remove(className);
  10882. },
  10883. updateCssVariable: function updateCssVariable(varName, value) {
  10884. return instance.root_.style.setProperty(varName, value);
  10885. }
  10886. };
  10887. };
  10888. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  10889. get: function get() {
  10890. return Boolean(this.unbounded_);
  10891. },
  10892. set: function set(unbounded) {
  10893. this.unbounded_ = Boolean(unbounded);
  10894. this.setUnbounded_();
  10895. },
  10896. enumerable: true,
  10897. configurable: true
  10898. });
  10899. MDCRipple.prototype.activate = function () {
  10900. this.foundation_.activate();
  10901. };
  10902. MDCRipple.prototype.deactivate = function () {
  10903. this.foundation_.deactivate();
  10904. };
  10905. MDCRipple.prototype.layout = function () {
  10906. this.foundation_.layout();
  10907. };
  10908. MDCRipple.prototype.getDefaultFoundation = function () {
  10909. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  10910. };
  10911. MDCRipple.prototype.initialSyncWithDOM = function () {
  10912. var root = this.root_;
  10913. this.unbounded = 'mdcRippleIsUnbounded' in root.dataset;
  10914. };
  10915. /**
  10916. * Closure Compiler throws an access control error when directly accessing a
  10917. * protected or private property inside a getter/setter, like unbounded above.
  10918. * By accessing the protected property inside a method, we solve that problem.
  10919. * That's why this function exists.
  10920. */
  10921. MDCRipple.prototype.setUnbounded_ = function () {
  10922. this.foundation_.setUnbounded(Boolean(this.unbounded_));
  10923. };
  10924. return MDCRipple;
  10925. }(component_1.MDCComponent);
  10926. exports.MDCRipple = MDCRipple;
  10927. /***/ }),
  10928. /***/ "./packages/mdc-ripple/constants.ts":
  10929. /*!******************************************!*\
  10930. !*** ./packages/mdc-ripple/constants.ts ***!
  10931. \******************************************/
  10932. /*! no static exports found */
  10933. /***/ (function(module, exports, __webpack_require__) {
  10934. "use strict";
  10935. /**
  10936. * @license
  10937. * Copyright 2016 Google Inc.
  10938. *
  10939. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10940. * of this software and associated documentation files (the "Software"), to deal
  10941. * in the Software without restriction, including without limitation the rights
  10942. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10943. * copies of the Software, and to permit persons to whom the Software is
  10944. * furnished to do so, subject to the following conditions:
  10945. *
  10946. * The above copyright notice and this permission notice shall be included in
  10947. * all copies or substantial portions of the Software.
  10948. *
  10949. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10950. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10951. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10952. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10953. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10954. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10955. * THE SOFTWARE.
  10956. */
  10957. Object.defineProperty(exports, "__esModule", { value: true });
  10958. exports.cssClasses = {
  10959. // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  10960. // given that it's an 'upgrade' to an existing component. That being said it is the root
  10961. // CSS class that all other CSS classes derive from.
  10962. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  10963. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  10964. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  10965. ROOT: 'mdc-ripple-upgraded',
  10966. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  10967. };
  10968. exports.strings = {
  10969. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  10970. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  10971. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  10972. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  10973. VAR_LEFT: '--mdc-ripple-left',
  10974. VAR_TOP: '--mdc-ripple-top'
  10975. };
  10976. exports.numbers = {
  10977. DEACTIVATION_TIMEOUT_MS: 225,
  10978. FG_DEACTIVATION_MS: 150,
  10979. INITIAL_ORIGIN_SCALE: 0.6,
  10980. PADDING: 10,
  10981. TAP_DELAY_MS: 300
  10982. };
  10983. /***/ }),
  10984. /***/ "./packages/mdc-ripple/foundation.ts":
  10985. /*!*******************************************!*\
  10986. !*** ./packages/mdc-ripple/foundation.ts ***!
  10987. \*******************************************/
  10988. /*! no static exports found */
  10989. /***/ (function(module, exports, __webpack_require__) {
  10990. "use strict";
  10991. /**
  10992. * @license
  10993. * Copyright 2016 Google Inc.
  10994. *
  10995. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10996. * of this software and associated documentation files (the "Software"), to deal
  10997. * in the Software without restriction, including without limitation the rights
  10998. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10999. * copies of the Software, and to permit persons to whom the Software is
  11000. * furnished to do so, subject to the following conditions:
  11001. *
  11002. * The above copyright notice and this permission notice shall be included in
  11003. * all copies or substantial portions of the Software.
  11004. *
  11005. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11006. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11007. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11008. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11009. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11010. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11011. * THE SOFTWARE.
  11012. */
  11013. var __extends = this && this.__extends || function () {
  11014. var _extendStatics = function extendStatics(d, b) {
  11015. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11016. d.__proto__ = b;
  11017. } || function (d, b) {
  11018. for (var p in b) {
  11019. if (b.hasOwnProperty(p)) d[p] = b[p];
  11020. }
  11021. };
  11022. return _extendStatics(d, b);
  11023. };
  11024. return function (d, b) {
  11025. _extendStatics(d, b);
  11026. function __() {
  11027. this.constructor = d;
  11028. }
  11029. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11030. };
  11031. }();
  11032. var __assign = this && this.__assign || function () {
  11033. __assign = Object.assign || function (t) {
  11034. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11035. s = arguments[i];
  11036. for (var p in s) {
  11037. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11038. }
  11039. }
  11040. return t;
  11041. };
  11042. return __assign.apply(this, arguments);
  11043. };
  11044. Object.defineProperty(exports, "__esModule", { value: true });
  11045. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  11046. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  11047. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  11048. // Activation events registered on the root element of each instance for activation
  11049. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  11050. // Deactivation events registered on documentElement when a pointer-related down event occurs
  11051. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  11052. // simultaneous nested activations
  11053. var activatedTargets = [];
  11054. var MDCRippleFoundation = /** @class */function (_super) {
  11055. __extends(MDCRippleFoundation, _super);
  11056. function MDCRippleFoundation(adapter) {
  11057. var _this = _super.call(this, __assign({}, MDCRippleFoundation.defaultAdapter, adapter)) || this;
  11058. _this.activationAnimationHasEnded_ = false;
  11059. _this.activationTimer_ = 0;
  11060. _this.fgDeactivationRemovalTimer_ = 0;
  11061. _this.fgScale_ = '0';
  11062. _this.frame_ = { width: 0, height: 0 };
  11063. _this.initialSize_ = 0;
  11064. _this.layoutFrame_ = 0;
  11065. _this.maxRadius_ = 0;
  11066. _this.unboundedCoords_ = { left: 0, top: 0 };
  11067. _this.activationState_ = _this.defaultActivationState_();
  11068. _this.activationTimerCallback_ = function () {
  11069. _this.activationAnimationHasEnded_ = true;
  11070. _this.runDeactivationUXLogicIfReady_();
  11071. };
  11072. _this.activateHandler_ = function (e) {
  11073. return _this.activate_(e);
  11074. };
  11075. _this.deactivateHandler_ = function () {
  11076. return _this.deactivate_();
  11077. };
  11078. _this.focusHandler_ = function () {
  11079. return _this.handleFocus();
  11080. };
  11081. _this.blurHandler_ = function () {
  11082. return _this.handleBlur();
  11083. };
  11084. _this.resizeHandler_ = function () {
  11085. return _this.layout();
  11086. };
  11087. return _this;
  11088. }
  11089. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  11090. get: function get() {
  11091. return constants_1.cssClasses;
  11092. },
  11093. enumerable: true,
  11094. configurable: true
  11095. });
  11096. Object.defineProperty(MDCRippleFoundation, "strings", {
  11097. get: function get() {
  11098. return constants_1.strings;
  11099. },
  11100. enumerable: true,
  11101. configurable: true
  11102. });
  11103. Object.defineProperty(MDCRippleFoundation, "numbers", {
  11104. get: function get() {
  11105. return constants_1.numbers;
  11106. },
  11107. enumerable: true,
  11108. configurable: true
  11109. });
  11110. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  11111. get: function get() {
  11112. return {
  11113. addClass: function addClass() {
  11114. return undefined;
  11115. },
  11116. browserSupportsCssVars: function browserSupportsCssVars() {
  11117. return true;
  11118. },
  11119. computeBoundingRect: function computeBoundingRect() {
  11120. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  11121. },
  11122. containsEventTarget: function containsEventTarget() {
  11123. return true;
  11124. },
  11125. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  11126. return undefined;
  11127. },
  11128. deregisterInteractionHandler: function deregisterInteractionHandler() {
  11129. return undefined;
  11130. },
  11131. deregisterResizeHandler: function deregisterResizeHandler() {
  11132. return undefined;
  11133. },
  11134. getWindowPageOffset: function getWindowPageOffset() {
  11135. return { x: 0, y: 0 };
  11136. },
  11137. isSurfaceActive: function isSurfaceActive() {
  11138. return true;
  11139. },
  11140. isSurfaceDisabled: function isSurfaceDisabled() {
  11141. return true;
  11142. },
  11143. isUnbounded: function isUnbounded() {
  11144. return true;
  11145. },
  11146. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  11147. return undefined;
  11148. },
  11149. registerInteractionHandler: function registerInteractionHandler() {
  11150. return undefined;
  11151. },
  11152. registerResizeHandler: function registerResizeHandler() {
  11153. return undefined;
  11154. },
  11155. removeClass: function removeClass() {
  11156. return undefined;
  11157. },
  11158. updateCssVariable: function updateCssVariable() {
  11159. return undefined;
  11160. }
  11161. };
  11162. },
  11163. enumerable: true,
  11164. configurable: true
  11165. });
  11166. MDCRippleFoundation.prototype.init = function () {
  11167. var _this = this;
  11168. var supportsPressRipple = this.supportsPressRipple_();
  11169. this.registerRootHandlers_(supportsPressRipple);
  11170. if (supportsPressRipple) {
  11171. var _a = MDCRippleFoundation.cssClasses,
  11172. ROOT_1 = _a.ROOT,
  11173. UNBOUNDED_1 = _a.UNBOUNDED;
  11174. requestAnimationFrame(function () {
  11175. _this.adapter_.addClass(ROOT_1);
  11176. if (_this.adapter_.isUnbounded()) {
  11177. _this.adapter_.addClass(UNBOUNDED_1);
  11178. // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
  11179. _this.layoutInternal_();
  11180. }
  11181. });
  11182. }
  11183. };
  11184. MDCRippleFoundation.prototype.destroy = function () {
  11185. var _this = this;
  11186. if (this.supportsPressRipple_()) {
  11187. if (this.activationTimer_) {
  11188. clearTimeout(this.activationTimer_);
  11189. this.activationTimer_ = 0;
  11190. this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  11191. }
  11192. if (this.fgDeactivationRemovalTimer_) {
  11193. clearTimeout(this.fgDeactivationRemovalTimer_);
  11194. this.fgDeactivationRemovalTimer_ = 0;
  11195. this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  11196. }
  11197. var _a = MDCRippleFoundation.cssClasses,
  11198. ROOT_2 = _a.ROOT,
  11199. UNBOUNDED_2 = _a.UNBOUNDED;
  11200. requestAnimationFrame(function () {
  11201. _this.adapter_.removeClass(ROOT_2);
  11202. _this.adapter_.removeClass(UNBOUNDED_2);
  11203. _this.removeCssVars_();
  11204. });
  11205. }
  11206. this.deregisterRootHandlers_();
  11207. this.deregisterDeactivationHandlers_();
  11208. };
  11209. /**
  11210. * @param evt Optional event containing position information.
  11211. */
  11212. MDCRippleFoundation.prototype.activate = function (evt) {
  11213. this.activate_(evt);
  11214. };
  11215. MDCRippleFoundation.prototype.deactivate = function () {
  11216. this.deactivate_();
  11217. };
  11218. MDCRippleFoundation.prototype.layout = function () {
  11219. var _this = this;
  11220. if (this.layoutFrame_) {
  11221. cancelAnimationFrame(this.layoutFrame_);
  11222. }
  11223. this.layoutFrame_ = requestAnimationFrame(function () {
  11224. _this.layoutInternal_();
  11225. _this.layoutFrame_ = 0;
  11226. });
  11227. };
  11228. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  11229. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  11230. if (unbounded) {
  11231. this.adapter_.addClass(UNBOUNDED);
  11232. } else {
  11233. this.adapter_.removeClass(UNBOUNDED);
  11234. }
  11235. };
  11236. MDCRippleFoundation.prototype.handleFocus = function () {
  11237. var _this = this;
  11238. requestAnimationFrame(function () {
  11239. return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  11240. });
  11241. };
  11242. MDCRippleFoundation.prototype.handleBlur = function () {
  11243. var _this = this;
  11244. requestAnimationFrame(function () {
  11245. return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  11246. });
  11247. };
  11248. /**
  11249. * We compute this property so that we are not querying information about the client
  11250. * until the point in time where the foundation requests it. This prevents scenarios where
  11251. * client-side feature-detection may happen too early, such as when components are rendered on the server
  11252. * and then initialized at mount time on the client.
  11253. */
  11254. MDCRippleFoundation.prototype.supportsPressRipple_ = function () {
  11255. return this.adapter_.browserSupportsCssVars();
  11256. };
  11257. MDCRippleFoundation.prototype.defaultActivationState_ = function () {
  11258. return {
  11259. activationEvent: undefined,
  11260. hasDeactivationUXRun: false,
  11261. isActivated: false,
  11262. isProgrammatic: false,
  11263. wasActivatedByPointer: false,
  11264. wasElementMadeActive: false
  11265. };
  11266. };
  11267. /**
  11268. * supportsPressRipple Passed from init to save a redundant function call
  11269. */
  11270. MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) {
  11271. var _this = this;
  11272. if (supportsPressRipple) {
  11273. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11274. _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_);
  11275. });
  11276. if (this.adapter_.isUnbounded()) {
  11277. this.adapter_.registerResizeHandler(this.resizeHandler_);
  11278. }
  11279. }
  11280. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  11281. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  11282. };
  11283. MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) {
  11284. var _this = this;
  11285. if (evt.type === 'keydown') {
  11286. this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
  11287. } else {
  11288. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11289. _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  11290. });
  11291. }
  11292. };
  11293. MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () {
  11294. var _this = this;
  11295. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11296. _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_);
  11297. });
  11298. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  11299. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  11300. if (this.adapter_.isUnbounded()) {
  11301. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  11302. }
  11303. };
  11304. MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () {
  11305. var _this = this;
  11306. this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
  11307. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  11308. _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  11309. });
  11310. };
  11311. MDCRippleFoundation.prototype.removeCssVars_ = function () {
  11312. var _this = this;
  11313. var rippleStrings = MDCRippleFoundation.strings;
  11314. var keys = Object.keys(rippleStrings);
  11315. keys.forEach(function (key) {
  11316. if (key.indexOf('VAR_') === 0) {
  11317. _this.adapter_.updateCssVariable(rippleStrings[key], null);
  11318. }
  11319. });
  11320. };
  11321. MDCRippleFoundation.prototype.activate_ = function (evt) {
  11322. var _this = this;
  11323. if (this.adapter_.isSurfaceDisabled()) {
  11324. return;
  11325. }
  11326. var activationState = this.activationState_;
  11327. if (activationState.isActivated) {
  11328. return;
  11329. }
  11330. // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
  11331. var previousActivationEvent = this.previousActivationEvent_;
  11332. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  11333. if (isSameInteraction) {
  11334. return;
  11335. }
  11336. activationState.isActivated = true;
  11337. activationState.isProgrammatic = evt === undefined;
  11338. activationState.activationEvent = evt;
  11339. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  11340. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  11341. return _this.adapter_.containsEventTarget(target);
  11342. });
  11343. if (hasActivatedChild) {
  11344. // Immediately reset activation state, while preserving logic that prevents touch follow-on events
  11345. this.resetActivationState_();
  11346. return;
  11347. }
  11348. if (evt !== undefined) {
  11349. activatedTargets.push(evt.target);
  11350. this.registerDeactivationHandlers_(evt);
  11351. }
  11352. activationState.wasElementMadeActive = this.checkElementMadeActive_(evt);
  11353. if (activationState.wasElementMadeActive) {
  11354. this.animateActivation_();
  11355. }
  11356. requestAnimationFrame(function () {
  11357. // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
  11358. activatedTargets = [];
  11359. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  11360. // If space was pressed, try again within an rAF call to detect :active, because different UAs report
  11361. // active states inconsistently when they're called within event handling code:
  11362. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  11363. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  11364. // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
  11365. // variable is set within a rAF callback for a submit button interaction (#2241).
  11366. activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt);
  11367. if (activationState.wasElementMadeActive) {
  11368. _this.animateActivation_();
  11369. }
  11370. }
  11371. if (!activationState.wasElementMadeActive) {
  11372. // Reset activation state immediately if element was not made active.
  11373. _this.activationState_ = _this.defaultActivationState_();
  11374. }
  11375. });
  11376. };
  11377. MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) {
  11378. return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true;
  11379. };
  11380. MDCRippleFoundation.prototype.animateActivation_ = function () {
  11381. var _this = this;
  11382. var _a = MDCRippleFoundation.strings,
  11383. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  11384. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  11385. var _b = MDCRippleFoundation.cssClasses,
  11386. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  11387. FG_ACTIVATION = _b.FG_ACTIVATION;
  11388. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  11389. this.layoutInternal_();
  11390. var translateStart = '';
  11391. var translateEnd = '';
  11392. if (!this.adapter_.isUnbounded()) {
  11393. var _c = this.getFgTranslationCoordinates_(),
  11394. startPoint = _c.startPoint,
  11395. endPoint = _c.endPoint;
  11396. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  11397. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  11398. }
  11399. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  11400. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  11401. // Cancel any ongoing activation/deactivation animations
  11402. clearTimeout(this.activationTimer_);
  11403. clearTimeout(this.fgDeactivationRemovalTimer_);
  11404. this.rmBoundedActivationClasses_();
  11405. this.adapter_.removeClass(FG_DEACTIVATION);
  11406. // Force layout in order to re-trigger the animation.
  11407. this.adapter_.computeBoundingRect();
  11408. this.adapter_.addClass(FG_ACTIVATION);
  11409. this.activationTimer_ = setTimeout(function () {
  11410. return _this.activationTimerCallback_();
  11411. }, DEACTIVATION_TIMEOUT_MS);
  11412. };
  11413. MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () {
  11414. var _a = this.activationState_,
  11415. activationEvent = _a.activationEvent,
  11416. wasActivatedByPointer = _a.wasActivatedByPointer;
  11417. var startPoint;
  11418. if (wasActivatedByPointer) {
  11419. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
  11420. } else {
  11421. startPoint = {
  11422. x: this.frame_.width / 2,
  11423. y: this.frame_.height / 2
  11424. };
  11425. }
  11426. // Center the element around the start point.
  11427. startPoint = {
  11428. x: startPoint.x - this.initialSize_ / 2,
  11429. y: startPoint.y - this.initialSize_ / 2
  11430. };
  11431. var endPoint = {
  11432. x: this.frame_.width / 2 - this.initialSize_ / 2,
  11433. y: this.frame_.height / 2 - this.initialSize_ / 2
  11434. };
  11435. return { startPoint: startPoint, endPoint: endPoint };
  11436. };
  11437. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () {
  11438. var _this = this;
  11439. // This method is called both when a pointing device is released, and when the activation animation ends.
  11440. // The deactivation animation should only run after both of those occur.
  11441. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  11442. var _a = this.activationState_,
  11443. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  11444. isActivated = _a.isActivated;
  11445. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  11446. if (activationHasEnded && this.activationAnimationHasEnded_) {
  11447. this.rmBoundedActivationClasses_();
  11448. this.adapter_.addClass(FG_DEACTIVATION);
  11449. this.fgDeactivationRemovalTimer_ = setTimeout(function () {
  11450. _this.adapter_.removeClass(FG_DEACTIVATION);
  11451. }, constants_1.numbers.FG_DEACTIVATION_MS);
  11452. }
  11453. };
  11454. MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () {
  11455. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  11456. this.adapter_.removeClass(FG_ACTIVATION);
  11457. this.activationAnimationHasEnded_ = false;
  11458. this.adapter_.computeBoundingRect();
  11459. };
  11460. MDCRippleFoundation.prototype.resetActivationState_ = function () {
  11461. var _this = this;
  11462. this.previousActivationEvent_ = this.activationState_.activationEvent;
  11463. this.activationState_ = this.defaultActivationState_();
  11464. // Touch devices may fire additional events for the same interaction within a short time.
  11465. // Store the previous event until it's safe to assume that subsequent events are for new interactions.
  11466. setTimeout(function () {
  11467. return _this.previousActivationEvent_ = undefined;
  11468. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  11469. };
  11470. MDCRippleFoundation.prototype.deactivate_ = function () {
  11471. var _this = this;
  11472. var activationState = this.activationState_;
  11473. // This can happen in scenarios such as when you have a keyup event that blurs the element.
  11474. if (!activationState.isActivated) {
  11475. return;
  11476. }
  11477. var state = __assign({}, activationState);
  11478. if (activationState.isProgrammatic) {
  11479. requestAnimationFrame(function () {
  11480. return _this.animateDeactivation_(state);
  11481. });
  11482. this.resetActivationState_();
  11483. } else {
  11484. this.deregisterDeactivationHandlers_();
  11485. requestAnimationFrame(function () {
  11486. _this.activationState_.hasDeactivationUXRun = true;
  11487. _this.animateDeactivation_(state);
  11488. _this.resetActivationState_();
  11489. });
  11490. }
  11491. };
  11492. MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) {
  11493. var wasActivatedByPointer = _a.wasActivatedByPointer,
  11494. wasElementMadeActive = _a.wasElementMadeActive;
  11495. if (wasActivatedByPointer || wasElementMadeActive) {
  11496. this.runDeactivationUXLogicIfReady_();
  11497. }
  11498. };
  11499. MDCRippleFoundation.prototype.layoutInternal_ = function () {
  11500. var _this = this;
  11501. this.frame_ = this.adapter_.computeBoundingRect();
  11502. var maxDim = Math.max(this.frame_.height, this.frame_.width);
  11503. // Surface diameter is treated differently for unbounded vs. bounded ripples.
  11504. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
  11505. // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
  11506. // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
  11507. // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
  11508. // `overflow: hidden`.
  11509. var getBoundedRadius = function getBoundedRadius() {
  11510. var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2));
  11511. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  11512. };
  11513. this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
  11514. // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
  11515. this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  11516. this.fgScale_ = "" + this.maxRadius_ / this.initialSize_;
  11517. this.updateLayoutCssVars_();
  11518. };
  11519. MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () {
  11520. var _a = MDCRippleFoundation.strings,
  11521. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  11522. VAR_LEFT = _a.VAR_LEFT,
  11523. VAR_TOP = _a.VAR_TOP,
  11524. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  11525. this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px");
  11526. this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
  11527. if (this.adapter_.isUnbounded()) {
  11528. this.unboundedCoords_ = {
  11529. left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
  11530. top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
  11531. };
  11532. this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px");
  11533. this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px");
  11534. }
  11535. };
  11536. return MDCRippleFoundation;
  11537. }(foundation_1.MDCFoundation);
  11538. exports.MDCRippleFoundation = MDCRippleFoundation;
  11539. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  11540. exports.default = MDCRippleFoundation;
  11541. /***/ }),
  11542. /***/ "./packages/mdc-ripple/index.ts":
  11543. /*!**************************************!*\
  11544. !*** ./packages/mdc-ripple/index.ts ***!
  11545. \**************************************/
  11546. /*! no static exports found */
  11547. /***/ (function(module, exports, __webpack_require__) {
  11548. "use strict";
  11549. /**
  11550. * @license
  11551. * Copyright 2019 Google Inc.
  11552. *
  11553. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11554. * of this software and associated documentation files (the "Software"), to deal
  11555. * in the Software without restriction, including without limitation the rights
  11556. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11557. * copies of the Software, and to permit persons to whom the Software is
  11558. * furnished to do so, subject to the following conditions:
  11559. *
  11560. * The above copyright notice and this permission notice shall be included in
  11561. * all copies or substantial portions of the Software.
  11562. *
  11563. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11564. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11565. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11566. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11567. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11568. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11569. * THE SOFTWARE.
  11570. */
  11571. function __export(m) {
  11572. for (var p in m) {
  11573. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  11574. }
  11575. }
  11576. var __importStar = this && this.__importStar || function (mod) {
  11577. if (mod && mod.__esModule) return mod;
  11578. var result = {};
  11579. if (mod != null) for (var k in mod) {
  11580. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  11581. }result["default"] = mod;
  11582. return result;
  11583. };
  11584. Object.defineProperty(exports, "__esModule", { value: true });
  11585. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  11586. exports.util = util;
  11587. __export(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts"));
  11588. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"));
  11589. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"));
  11590. /***/ }),
  11591. /***/ "./packages/mdc-ripple/util.ts":
  11592. /*!*************************************!*\
  11593. !*** ./packages/mdc-ripple/util.ts ***!
  11594. \*************************************/
  11595. /*! no static exports found */
  11596. /***/ (function(module, exports, __webpack_require__) {
  11597. "use strict";
  11598. Object.defineProperty(exports, "__esModule", { value: true });
  11599. /**
  11600. * Stores result from supportsCssVariables to avoid redundant processing to
  11601. * detect CSS custom variable support.
  11602. */
  11603. var supportsCssVariables_;
  11604. function detectEdgePseudoVarBug(windowObj) {
  11605. // Detect versions of Edge with buggy var() support
  11606. // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
  11607. var document = windowObj.document;
  11608. var node = document.createElement('div');
  11609. node.className = 'mdc-ripple-surface--test-edge-var-bug';
  11610. // Append to head instead of body because this script might be invoked in the
  11611. // head, in which case the body doesn't exist yet. The probe works either way.
  11612. document.head.appendChild(node);
  11613. // The bug exists if ::before style ends up propagating to the parent element.
  11614. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
  11615. // but Firefox is known to support CSS custom properties correctly.
  11616. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  11617. var computedStyle = windowObj.getComputedStyle(node);
  11618. var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
  11619. if (node.parentNode) {
  11620. node.parentNode.removeChild(node);
  11621. }
  11622. return hasPseudoVarBug;
  11623. }
  11624. function supportsCssVariables(windowObj, forceRefresh) {
  11625. if (forceRefresh === void 0) {
  11626. forceRefresh = false;
  11627. }
  11628. var CSS = windowObj.CSS;
  11629. var supportsCssVars = supportsCssVariables_;
  11630. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  11631. return supportsCssVariables_;
  11632. }
  11633. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  11634. if (!supportsFunctionPresent) {
  11635. return false;
  11636. }
  11637. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  11638. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  11639. // See: README section on Safari
  11640. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  11641. if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
  11642. supportsCssVars = !detectEdgePseudoVarBug(windowObj);
  11643. } else {
  11644. supportsCssVars = false;
  11645. }
  11646. if (!forceRefresh) {
  11647. supportsCssVariables_ = supportsCssVars;
  11648. }
  11649. return supportsCssVars;
  11650. }
  11651. exports.supportsCssVariables = supportsCssVariables;
  11652. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  11653. if (!evt) {
  11654. return { x: 0, y: 0 };
  11655. }
  11656. var x = pageOffset.x,
  11657. y = pageOffset.y;
  11658. var documentX = x + clientRect.left;
  11659. var documentY = y + clientRect.top;
  11660. var normalizedX;
  11661. var normalizedY;
  11662. // Determine touch point relative to the ripple container.
  11663. if (evt.type === 'touchstart') {
  11664. var touchEvent = evt;
  11665. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  11666. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  11667. } else {
  11668. var mouseEvent = evt;
  11669. normalizedX = mouseEvent.pageX - documentX;
  11670. normalizedY = mouseEvent.pageY - documentY;
  11671. }
  11672. return { x: normalizedX, y: normalizedY };
  11673. }
  11674. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  11675. /***/ }),
  11676. /***/ "./packages/mdc-select/component.ts":
  11677. /*!******************************************!*\
  11678. !*** ./packages/mdc-select/component.ts ***!
  11679. \******************************************/
  11680. /*! no static exports found */
  11681. /***/ (function(module, exports, __webpack_require__) {
  11682. "use strict";
  11683. /**
  11684. * @license
  11685. * Copyright 2016 Google Inc.
  11686. *
  11687. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11688. * of this software and associated documentation files (the "Software"), to deal
  11689. * in the Software without restriction, including without limitation the rights
  11690. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11691. * copies of the Software, and to permit persons to whom the Software is
  11692. * furnished to do so, subject to the following conditions:
  11693. *
  11694. * The above copyright notice and this permission notice shall be included in
  11695. * all copies or substantial portions of the Software.
  11696. *
  11697. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11698. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11699. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11700. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11701. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11702. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11703. * THE SOFTWARE.
  11704. */
  11705. var __extends = this && this.__extends || function () {
  11706. var _extendStatics = function extendStatics(d, b) {
  11707. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11708. d.__proto__ = b;
  11709. } || function (d, b) {
  11710. for (var p in b) {
  11711. if (b.hasOwnProperty(p)) d[p] = b[p];
  11712. }
  11713. };
  11714. return _extendStatics(d, b);
  11715. };
  11716. return function (d, b) {
  11717. _extendStatics(d, b);
  11718. function __() {
  11719. this.constructor = d;
  11720. }
  11721. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11722. };
  11723. }();
  11724. var __assign = this && this.__assign || function () {
  11725. __assign = Object.assign || function (t) {
  11726. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11727. s = arguments[i];
  11728. for (var p in s) {
  11729. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11730. }
  11731. }
  11732. return t;
  11733. };
  11734. return __assign.apply(this, arguments);
  11735. };
  11736. var __importStar = this && this.__importStar || function (mod) {
  11737. if (mod && mod.__esModule) return mod;
  11738. var result = {};
  11739. if (mod != null) for (var k in mod) {
  11740. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  11741. }result["default"] = mod;
  11742. return result;
  11743. };
  11744. Object.defineProperty(exports, "__esModule", { value: true });
  11745. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  11746. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  11747. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  11748. var menuSurfaceConstants = __importStar(__webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"));
  11749. var component_4 = __webpack_require__(/*! @material/menu/component */ "./packages/mdc-menu/component.ts");
  11750. var menuConstants = __importStar(__webpack_require__(/*! @material/menu/constants */ "./packages/mdc-menu/constants.ts"));
  11751. var component_5 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  11752. var component_6 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  11753. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  11754. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  11755. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts");
  11756. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-select/helper-text/component.ts");
  11757. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-select/icon/component.ts");
  11758. var VALIDATION_ATTR_WHITELIST = ['required', 'aria-required'];
  11759. var MDCSelect = /** @class */function (_super) {
  11760. __extends(MDCSelect, _super);
  11761. function MDCSelect() {
  11762. return _super !== null && _super.apply(this, arguments) || this;
  11763. }
  11764. MDCSelect.attachTo = function (root) {
  11765. return new MDCSelect(root);
  11766. };
  11767. MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) {
  11768. if (labelFactory === void 0) {
  11769. labelFactory = function labelFactory(el) {
  11770. return new component_2.MDCFloatingLabel(el);
  11771. };
  11772. }
  11773. if (lineRippleFactory === void 0) {
  11774. lineRippleFactory = function lineRippleFactory(el) {
  11775. return new component_3.MDCLineRipple(el);
  11776. };
  11777. }
  11778. if (outlineFactory === void 0) {
  11779. outlineFactory = function outlineFactory(el) {
  11780. return new component_5.MDCNotchedOutline(el);
  11781. };
  11782. }
  11783. if (menuFactory === void 0) {
  11784. menuFactory = function menuFactory(el) {
  11785. return new component_4.MDCMenu(el);
  11786. };
  11787. }
  11788. if (iconFactory === void 0) {
  11789. iconFactory = function iconFactory(el) {
  11790. return new component_8.MDCSelectIcon(el);
  11791. };
  11792. }
  11793. if (helperTextFactory === void 0) {
  11794. helperTextFactory = function helperTextFactory(el) {
  11795. return new component_7.MDCSelectHelperText(el);
  11796. };
  11797. }
  11798. this.isMenuOpen_ = false;
  11799. this.nativeControl_ = this.root_.querySelector(constants_1.strings.NATIVE_CONTROL_SELECTOR);
  11800. this.selectedText_ = this.root_.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR);
  11801. var targetElement = this.nativeControl_ || this.selectedText_;
  11802. if (!targetElement) {
  11803. 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 + "'"));
  11804. }
  11805. this.targetElement_ = targetElement;
  11806. if (this.targetElement_.hasAttribute(constants_1.strings.ARIA_CONTROLS)) {
  11807. var helperTextElement = document.getElementById(this.targetElement_.getAttribute(constants_1.strings.ARIA_CONTROLS));
  11808. if (helperTextElement) {
  11809. this.helperText_ = helperTextFactory(helperTextElement);
  11810. }
  11811. }
  11812. if (this.selectedText_) {
  11813. this.enhancedSelectSetup_(menuFactory);
  11814. }
  11815. var labelElement = this.root_.querySelector(constants_1.strings.LABEL_SELECTOR);
  11816. this.label_ = labelElement ? labelFactory(labelElement) : null;
  11817. var lineRippleElement = this.root_.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  11818. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  11819. var outlineElement = this.root_.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  11820. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  11821. var leadingIcon = this.root_.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  11822. if (leadingIcon) {
  11823. this.root_.classList.add(constants_1.cssClasses.WITH_LEADING_ICON);
  11824. this.leadingIcon_ = iconFactory(leadingIcon);
  11825. if (this.menuElement_) {
  11826. this.menuElement_.classList.add(constants_1.cssClasses.WITH_LEADING_ICON);
  11827. }
  11828. }
  11829. if (!this.root_.classList.contains(constants_1.cssClasses.OUTLINED)) {
  11830. this.ripple = this.createRipple_();
  11831. }
  11832. // The required state needs to be sync'd before the mutation observer is added.
  11833. this.initialSyncRequiredState_();
  11834. this.addMutationObserverForRequired_();
  11835. };
  11836. /**
  11837. * Initializes the select's event listeners and internal state based
  11838. * on the environment's state.
  11839. */
  11840. MDCSelect.prototype.initialSyncWithDOM = function () {
  11841. var _this = this;
  11842. this.handleChange_ = function () {
  11843. return _this.foundation_.handleChange( /* didChange */true);
  11844. };
  11845. this.handleFocus_ = function () {
  11846. return _this.foundation_.handleFocus();
  11847. };
  11848. this.handleBlur_ = function () {
  11849. return _this.foundation_.handleBlur();
  11850. };
  11851. this.handleClick_ = function (evt) {
  11852. if (_this.selectedText_) {
  11853. _this.selectedText_.focus();
  11854. }
  11855. _this.foundation_.handleClick(_this.getNormalizedXCoordinate_(evt));
  11856. };
  11857. this.handleKeydown_ = function (evt) {
  11858. return _this.foundation_.handleKeydown(evt);
  11859. };
  11860. this.handleMenuSelected_ = function (evtData) {
  11861. return _this.selectedIndex = evtData.detail.index;
  11862. };
  11863. this.handleMenuOpened_ = function () {
  11864. _this.foundation_.handleMenuOpened();
  11865. if (_this.menu_.items.length === 0) {
  11866. return;
  11867. }
  11868. // Menu should open to the last selected element, should open to first menu item otherwise.
  11869. var focusItemIndex = _this.selectedIndex >= 0 ? _this.selectedIndex : 0;
  11870. var focusItemEl = _this.menu_.items[focusItemIndex];
  11871. focusItemEl.focus();
  11872. };
  11873. this.handleMenuClosed_ = function () {
  11874. _this.foundation_.handleMenuClosed();
  11875. // isMenuOpen_ is used to track the state of the menu opening or closing since the menu.open function
  11876. // will return false if the menu is still closing and this method listens to the closed event which
  11877. // occurs after the menu is already closed.
  11878. _this.isMenuOpen_ = false;
  11879. _this.selectedText_.removeAttribute('aria-expanded');
  11880. if (document.activeElement !== _this.selectedText_) {
  11881. _this.foundation_.handleBlur();
  11882. }
  11883. };
  11884. this.targetElement_.addEventListener('change', this.handleChange_);
  11885. this.targetElement_.addEventListener('focus', this.handleFocus_);
  11886. this.targetElement_.addEventListener('blur', this.handleBlur_);
  11887. this.targetElement_.addEventListener('click', this.handleClick_);
  11888. if (this.menuElement_) {
  11889. this.selectedText_.addEventListener('keydown', this.handleKeydown_);
  11890. this.menu_.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed_);
  11891. this.menu_.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened_);
  11892. this.menu_.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuSelected_);
  11893. if (this.hiddenInput_ && this.hiddenInput_.value) {
  11894. // If the hidden input already has a value, use it to restore the select's value.
  11895. // This can happen e.g. if the user goes back or (in some browsers) refreshes the page.
  11896. var enhancedAdapterMethods = this.getEnhancedSelectAdapterMethods_();
  11897. enhancedAdapterMethods.setValue(this.hiddenInput_.value);
  11898. } else if (this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR)) {
  11899. // If an element is selected, the select should set the initial selected text.
  11900. var enhancedAdapterMethods = this.getEnhancedSelectAdapterMethods_();
  11901. enhancedAdapterMethods.setValue(enhancedAdapterMethods.getValue());
  11902. }
  11903. }
  11904. // Initially sync floating label
  11905. this.foundation_.handleChange( /* didChange */false);
  11906. if (this.root_.classList.contains(constants_1.cssClasses.DISABLED) || this.nativeControl_ && this.nativeControl_.disabled) {
  11907. this.disabled = true;
  11908. }
  11909. };
  11910. MDCSelect.prototype.destroy = function () {
  11911. this.targetElement_.removeEventListener('change', this.handleChange_);
  11912. this.targetElement_.removeEventListener('focus', this.handleFocus_);
  11913. this.targetElement_.removeEventListener('blur', this.handleBlur_);
  11914. this.targetElement_.removeEventListener('keydown', this.handleKeydown_);
  11915. this.targetElement_.removeEventListener('click', this.handleClick_);
  11916. if (this.menu_) {
  11917. this.menu_.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed_);
  11918. this.menu_.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened_);
  11919. this.menu_.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuSelected_);
  11920. this.menu_.destroy();
  11921. }
  11922. if (this.ripple) {
  11923. this.ripple.destroy();
  11924. }
  11925. if (this.outline_) {
  11926. this.outline_.destroy();
  11927. }
  11928. if (this.leadingIcon_) {
  11929. this.leadingIcon_.destroy();
  11930. }
  11931. if (this.helperText_) {
  11932. this.helperText_.destroy();
  11933. }
  11934. if (this.validationObserver_) {
  11935. this.validationObserver_.disconnect();
  11936. }
  11937. _super.prototype.destroy.call(this);
  11938. };
  11939. Object.defineProperty(MDCSelect.prototype, "value", {
  11940. get: function get() {
  11941. return this.foundation_.getValue();
  11942. },
  11943. set: function set(value) {
  11944. this.foundation_.setValue(value);
  11945. },
  11946. enumerable: true,
  11947. configurable: true
  11948. });
  11949. Object.defineProperty(MDCSelect.prototype, "selectedIndex", {
  11950. get: function get() {
  11951. var selectedIndex = -1;
  11952. if (this.menuElement_ && this.menu_) {
  11953. var selectedEl = this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  11954. selectedIndex = this.menu_.items.indexOf(selectedEl);
  11955. } else if (this.nativeControl_) {
  11956. selectedIndex = this.nativeControl_.selectedIndex;
  11957. }
  11958. return selectedIndex;
  11959. },
  11960. set: function set(selectedIndex) {
  11961. this.foundation_.setSelectedIndex(selectedIndex);
  11962. },
  11963. enumerable: true,
  11964. configurable: true
  11965. });
  11966. Object.defineProperty(MDCSelect.prototype, "disabled", {
  11967. get: function get() {
  11968. return this.root_.classList.contains(constants_1.cssClasses.DISABLED) || (this.nativeControl_ ? this.nativeControl_.disabled : false);
  11969. },
  11970. set: function set(disabled) {
  11971. this.foundation_.setDisabled(disabled);
  11972. },
  11973. enumerable: true,
  11974. configurable: true
  11975. });
  11976. Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", {
  11977. set: function set(label) {
  11978. this.foundation_.setLeadingIconAriaLabel(label);
  11979. },
  11980. enumerable: true,
  11981. configurable: true
  11982. });
  11983. Object.defineProperty(MDCSelect.prototype, "leadingIconContent", {
  11984. /**
  11985. * Sets the text content of the leading icon.
  11986. */
  11987. set: function set(content) {
  11988. this.foundation_.setLeadingIconContent(content);
  11989. },
  11990. enumerable: true,
  11991. configurable: true
  11992. });
  11993. Object.defineProperty(MDCSelect.prototype, "helperTextContent", {
  11994. /**
  11995. * Sets the text content of the helper text.
  11996. */
  11997. set: function set(content) {
  11998. this.foundation_.setHelperTextContent(content);
  11999. },
  12000. enumerable: true,
  12001. configurable: true
  12002. });
  12003. Object.defineProperty(MDCSelect.prototype, "valid", {
  12004. /**
  12005. * Checks if the select is in a valid state.
  12006. */
  12007. get: function get() {
  12008. return this.foundation_.isValid();
  12009. },
  12010. /**
  12011. * Sets the current invalid state of the select.
  12012. */
  12013. set: function set(isValid) {
  12014. this.foundation_.setValid(isValid);
  12015. },
  12016. enumerable: true,
  12017. configurable: true
  12018. });
  12019. Object.defineProperty(MDCSelect.prototype, "required", {
  12020. /**
  12021. * Returns whether the select is required.
  12022. */
  12023. get: function get() {
  12024. if (this.nativeControl_) {
  12025. return this.nativeControl_.required;
  12026. } else {
  12027. return this.selectedText_.getAttribute('aria-required') === 'true';
  12028. }
  12029. },
  12030. /**
  12031. * Sets the control to the required state.
  12032. */
  12033. set: function set(isRequired) {
  12034. if (this.nativeControl_) {
  12035. this.nativeControl_.required = isRequired;
  12036. } else {
  12037. if (isRequired) {
  12038. this.selectedText_.setAttribute('aria-required', isRequired.toString());
  12039. } else {
  12040. this.selectedText_.removeAttribute('aria-required');
  12041. }
  12042. }
  12043. },
  12044. enumerable: true,
  12045. configurable: true
  12046. });
  12047. /**
  12048. * Recomputes the outline SVG path for the outline element.
  12049. */
  12050. MDCSelect.prototype.layout = function () {
  12051. this.foundation_.layout();
  12052. };
  12053. MDCSelect.prototype.getDefaultFoundation = function () {
  12054. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12055. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12056. var adapter = __assign({}, this.nativeControl_ ? this.getNativeSelectAdapterMethods_() : this.getEnhancedSelectAdapterMethods_(), this.getCommonAdapterMethods_(), this.getOutlineAdapterMethods_(), this.getLabelAdapterMethods_());
  12057. return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap_());
  12058. };
  12059. /**
  12060. * Handles setup for the enhanced menu.
  12061. */
  12062. MDCSelect.prototype.enhancedSelectSetup_ = function (menuFactory) {
  12063. var isDisabled = this.root_.classList.contains(constants_1.cssClasses.DISABLED);
  12064. this.selectedText_.setAttribute('tabindex', isDisabled ? '-1' : '0');
  12065. this.hiddenInput_ = this.root_.querySelector(constants_1.strings.HIDDEN_INPUT_SELECTOR);
  12066. this.menuElement_ = this.root_.querySelector(constants_1.strings.MENU_SELECTOR);
  12067. this.menu_ = menuFactory(this.menuElement_);
  12068. this.menu_.hoistMenuToBody();
  12069. this.menu_.setAnchorElement(this.root_);
  12070. this.menu_.setAnchorCorner(menuSurfaceConstants.Corner.BOTTOM_START);
  12071. this.menu_.wrapFocus = false;
  12072. };
  12073. MDCSelect.prototype.createRipple_ = function () {
  12074. var _this = this;
  12075. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12076. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12077. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12078. var adapter = __assign({}, component_6.MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  12079. return _this.targetElement_.addEventListener(evtType, handler);
  12080. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  12081. return _this.targetElement_.removeEventListener(evtType, handler);
  12082. } });
  12083. // tslint:enable:object-literal-sort-keys
  12084. return new component_6.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  12085. };
  12086. MDCSelect.prototype.getNativeSelectAdapterMethods_ = function () {
  12087. var _this = this;
  12088. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12089. return {
  12090. getValue: function getValue() {
  12091. return _this.nativeControl_.value;
  12092. },
  12093. setValue: function setValue(value) {
  12094. _this.nativeControl_.value = value;
  12095. },
  12096. openMenu: function openMenu() {
  12097. return undefined;
  12098. },
  12099. closeMenu: function closeMenu() {
  12100. return undefined;
  12101. },
  12102. isMenuOpen: function isMenuOpen() {
  12103. return false;
  12104. },
  12105. setSelectedIndex: function setSelectedIndex(index) {
  12106. _this.nativeControl_.selectedIndex = index;
  12107. },
  12108. setDisabled: function setDisabled(isDisabled) {
  12109. _this.nativeControl_.disabled = isDisabled;
  12110. },
  12111. setValid: function setValid(isValid) {
  12112. if (isValid) {
  12113. _this.root_.classList.remove(constants_1.cssClasses.INVALID);
  12114. } else {
  12115. _this.root_.classList.add(constants_1.cssClasses.INVALID);
  12116. }
  12117. },
  12118. checkValidity: function checkValidity() {
  12119. return _this.nativeControl_.checkValidity();
  12120. }
  12121. };
  12122. // tslint:enable:object-literal-sort-keys
  12123. };
  12124. MDCSelect.prototype.getEnhancedSelectAdapterMethods_ = function () {
  12125. var _this = this;
  12126. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12127. return {
  12128. getValue: function getValue() {
  12129. var listItem = _this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  12130. if (listItem && listItem.hasAttribute(constants_1.strings.ENHANCED_VALUE_ATTR)) {
  12131. return listItem.getAttribute(constants_1.strings.ENHANCED_VALUE_ATTR) || '';
  12132. }
  12133. return '';
  12134. },
  12135. setValue: function setValue(value) {
  12136. var element = _this.menuElement_.querySelector("[" + constants_1.strings.ENHANCED_VALUE_ATTR + "=\"" + value + "\"]");
  12137. _this.setEnhancedSelectedIndex_(element ? _this.menu_.items.indexOf(element) : -1);
  12138. },
  12139. openMenu: function openMenu() {
  12140. if (_this.menu_ && !_this.menu_.open) {
  12141. _this.menu_.open = true;
  12142. _this.isMenuOpen_ = true;
  12143. _this.selectedText_.setAttribute('aria-expanded', 'true');
  12144. }
  12145. },
  12146. closeMenu: function closeMenu() {
  12147. if (_this.menu_ && _this.menu_.open) {
  12148. _this.menu_.open = false;
  12149. }
  12150. },
  12151. isMenuOpen: function isMenuOpen() {
  12152. return Boolean(_this.menu_) && _this.isMenuOpen_;
  12153. },
  12154. setSelectedIndex: function setSelectedIndex(index) {
  12155. return _this.setEnhancedSelectedIndex_(index);
  12156. },
  12157. setDisabled: function setDisabled(isDisabled) {
  12158. _this.selectedText_.setAttribute('tabindex', isDisabled ? '-1' : '0');
  12159. _this.selectedText_.setAttribute('aria-disabled', isDisabled.toString());
  12160. if (_this.hiddenInput_) {
  12161. _this.hiddenInput_.disabled = isDisabled;
  12162. }
  12163. },
  12164. checkValidity: function checkValidity() {
  12165. var classList = _this.root_.classList;
  12166. if (classList.contains(constants_1.cssClasses.REQUIRED) && !classList.contains(constants_1.cssClasses.DISABLED)) {
  12167. // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element
  12168. // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value.
  12169. return _this.selectedIndex !== -1 && (_this.selectedIndex !== 0 || Boolean(_this.value));
  12170. } else {
  12171. return true;
  12172. }
  12173. },
  12174. setValid: function setValid(isValid) {
  12175. _this.selectedText_.setAttribute('aria-invalid', (!isValid).toString());
  12176. if (isValid) {
  12177. _this.root_.classList.remove(constants_1.cssClasses.INVALID);
  12178. } else {
  12179. _this.root_.classList.add(constants_1.cssClasses.INVALID);
  12180. }
  12181. }
  12182. };
  12183. // tslint:enable:object-literal-sort-keys
  12184. };
  12185. MDCSelect.prototype.getCommonAdapterMethods_ = function () {
  12186. var _this = this;
  12187. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12188. return {
  12189. addClass: function addClass(className) {
  12190. return _this.root_.classList.add(className);
  12191. },
  12192. removeClass: function removeClass(className) {
  12193. return _this.root_.classList.remove(className);
  12194. },
  12195. hasClass: function hasClass(className) {
  12196. return _this.root_.classList.contains(className);
  12197. },
  12198. setRippleCenter: function setRippleCenter(normalizedX) {
  12199. return _this.lineRipple_ && _this.lineRipple_.setRippleCenter(normalizedX);
  12200. },
  12201. activateBottomLine: function activateBottomLine() {
  12202. return _this.lineRipple_ && _this.lineRipple_.activate();
  12203. },
  12204. deactivateBottomLine: function deactivateBottomLine() {
  12205. return _this.lineRipple_ && _this.lineRipple_.deactivate();
  12206. },
  12207. notifyChange: function notifyChange(value) {
  12208. var index = _this.selectedIndex;
  12209. _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */);
  12210. }
  12211. };
  12212. // tslint:enable:object-literal-sort-keys
  12213. };
  12214. MDCSelect.prototype.getOutlineAdapterMethods_ = function () {
  12215. var _this = this;
  12216. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12217. return {
  12218. hasOutline: function hasOutline() {
  12219. return Boolean(_this.outline_);
  12220. },
  12221. notchOutline: function notchOutline(labelWidth) {
  12222. return _this.outline_ && _this.outline_.notch(labelWidth);
  12223. },
  12224. closeOutline: function closeOutline() {
  12225. return _this.outline_ && _this.outline_.closeNotch();
  12226. }
  12227. };
  12228. // tslint:enable:object-literal-sort-keys
  12229. };
  12230. MDCSelect.prototype.getLabelAdapterMethods_ = function () {
  12231. var _this = this;
  12232. return {
  12233. floatLabel: function floatLabel(shouldFloat) {
  12234. return _this.label_ && _this.label_.float(shouldFloat);
  12235. },
  12236. getLabelWidth: function getLabelWidth() {
  12237. return _this.label_ ? _this.label_.getWidth() : 0;
  12238. }
  12239. };
  12240. };
  12241. /**
  12242. * Calculates where the line ripple should start based on the x coordinate within the component.
  12243. */
  12244. MDCSelect.prototype.getNormalizedXCoordinate_ = function (evt) {
  12245. var targetClientRect = evt.target.getBoundingClientRect();
  12246. var xCoordinate = this.isTouchEvent_(evt) ? evt.touches[0].clientX : evt.clientX;
  12247. return xCoordinate - targetClientRect.left;
  12248. };
  12249. MDCSelect.prototype.isTouchEvent_ = function (evt) {
  12250. return Boolean(evt.touches);
  12251. };
  12252. /**
  12253. * Returns a map of all subcomponents to subfoundations.
  12254. */
  12255. MDCSelect.prototype.getFoundationMap_ = function () {
  12256. return {
  12257. helperText: this.helperText_ ? this.helperText_.foundation : undefined,
  12258. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined
  12259. };
  12260. };
  12261. MDCSelect.prototype.setEnhancedSelectedIndex_ = function (index) {
  12262. var selectedItem = this.menu_.items[index];
  12263. this.selectedText_.textContent = selectedItem ? selectedItem.textContent.trim() : '';
  12264. var previouslySelected = this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  12265. if (previouslySelected) {
  12266. previouslySelected.classList.remove(constants_1.cssClasses.SELECTED_ITEM_CLASS);
  12267. previouslySelected.removeAttribute(constants_1.strings.ARIA_SELECTED_ATTR);
  12268. }
  12269. if (selectedItem) {
  12270. selectedItem.classList.add(constants_1.cssClasses.SELECTED_ITEM_CLASS);
  12271. selectedItem.setAttribute(constants_1.strings.ARIA_SELECTED_ATTR, 'true');
  12272. }
  12273. // Synchronize hidden input's value with data-value attribute of selected item.
  12274. // This code path is also followed when setting value directly, so this covers all cases.
  12275. if (this.hiddenInput_) {
  12276. this.hiddenInput_.value = selectedItem ? selectedItem.getAttribute(constants_1.strings.ENHANCED_VALUE_ATTR) || '' : '';
  12277. }
  12278. this.layout();
  12279. };
  12280. MDCSelect.prototype.initialSyncRequiredState_ = function () {
  12281. var isRequired = this.targetElement_.required || this.targetElement_.getAttribute('aria-required') === 'true' || this.root_.classList.contains(constants_1.cssClasses.REQUIRED);
  12282. if (isRequired) {
  12283. if (this.nativeControl_) {
  12284. this.nativeControl_.required = true;
  12285. } else {
  12286. this.selectedText_.setAttribute('aria-required', 'true');
  12287. }
  12288. this.root_.classList.add(constants_1.cssClasses.REQUIRED);
  12289. }
  12290. };
  12291. MDCSelect.prototype.addMutationObserverForRequired_ = function () {
  12292. var _this = this;
  12293. var observerHandler = function observerHandler(attributesList) {
  12294. attributesList.some(function (attributeName) {
  12295. if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) === -1) {
  12296. return false;
  12297. }
  12298. if (_this.selectedText_) {
  12299. if (_this.selectedText_.getAttribute('aria-required') === 'true') {
  12300. _this.root_.classList.add(constants_1.cssClasses.REQUIRED);
  12301. } else {
  12302. _this.root_.classList.remove(constants_1.cssClasses.REQUIRED);
  12303. }
  12304. } else {
  12305. if (_this.nativeControl_.required) {
  12306. _this.root_.classList.add(constants_1.cssClasses.REQUIRED);
  12307. } else {
  12308. _this.root_.classList.remove(constants_1.cssClasses.REQUIRED);
  12309. }
  12310. }
  12311. return true;
  12312. });
  12313. };
  12314. var getAttributesList = function getAttributesList(mutationsList) {
  12315. return mutationsList.map(function (mutation) {
  12316. return mutation.attributeName;
  12317. }).filter(function (attributeName) {
  12318. return attributeName;
  12319. });
  12320. };
  12321. var observer = new MutationObserver(function (mutationsList) {
  12322. return observerHandler(getAttributesList(mutationsList));
  12323. });
  12324. observer.observe(this.targetElement_, { attributes: true });
  12325. this.validationObserver_ = observer;
  12326. };
  12327. return MDCSelect;
  12328. }(component_1.MDCComponent);
  12329. exports.MDCSelect = MDCSelect;
  12330. /***/ }),
  12331. /***/ "./packages/mdc-select/constants.ts":
  12332. /*!******************************************!*\
  12333. !*** ./packages/mdc-select/constants.ts ***!
  12334. \******************************************/
  12335. /*! no static exports found */
  12336. /***/ (function(module, exports, __webpack_require__) {
  12337. "use strict";
  12338. /**
  12339. * @license
  12340. * Copyright 2016 Google Inc.
  12341. *
  12342. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12343. * of this software and associated documentation files (the "Software"), to deal
  12344. * in the Software without restriction, including without limitation the rights
  12345. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12346. * copies of the Software, and to permit persons to whom the Software is
  12347. * furnished to do so, subject to the following conditions:
  12348. *
  12349. * The above copyright notice and this permission notice shall be included in
  12350. * all copies or substantial portions of the Software.
  12351. *
  12352. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12353. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12354. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12355. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12356. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12357. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12358. * THE SOFTWARE.
  12359. */
  12360. Object.defineProperty(exports, "__esModule", { value: true });
  12361. var cssClasses = {
  12362. ACTIVATED: 'mdc-select--activated',
  12363. DISABLED: 'mdc-select--disabled',
  12364. FOCUSED: 'mdc-select--focused',
  12365. INVALID: 'mdc-select--invalid',
  12366. OUTLINED: 'mdc-select--outlined',
  12367. REQUIRED: 'mdc-select--required',
  12368. ROOT: 'mdc-select',
  12369. SELECTED_ITEM_CLASS: 'mdc-list-item--selected',
  12370. WITH_LEADING_ICON: 'mdc-select--with-leading-icon'
  12371. };
  12372. exports.cssClasses = cssClasses;
  12373. var strings = {
  12374. ARIA_CONTROLS: 'aria-controls',
  12375. ARIA_SELECTED_ATTR: 'aria-selected',
  12376. CHANGE_EVENT: 'MDCSelect:change',
  12377. ENHANCED_VALUE_ATTR: 'data-value',
  12378. HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]',
  12379. LABEL_SELECTOR: '.mdc-floating-label',
  12380. LEADING_ICON_SELECTOR: '.mdc-select__icon',
  12381. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  12382. MENU_SELECTOR: '.mdc-select__menu',
  12383. NATIVE_CONTROL_SELECTOR: '.mdc-select__native-control',
  12384. OUTLINE_SELECTOR: '.mdc-notched-outline',
  12385. SELECTED_ITEM_SELECTOR: "." + cssClasses.SELECTED_ITEM_CLASS,
  12386. SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text'
  12387. };
  12388. exports.strings = strings;
  12389. var numbers = {
  12390. LABEL_SCALE: 0.75
  12391. };
  12392. exports.numbers = numbers;
  12393. /***/ }),
  12394. /***/ "./packages/mdc-select/foundation.ts":
  12395. /*!*******************************************!*\
  12396. !*** ./packages/mdc-select/foundation.ts ***!
  12397. \*******************************************/
  12398. /*! no static exports found */
  12399. /***/ (function(module, exports, __webpack_require__) {
  12400. "use strict";
  12401. /**
  12402. * @license
  12403. * Copyright 2016 Google Inc.
  12404. *
  12405. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12406. * of this software and associated documentation files (the "Software"), to deal
  12407. * in the Software without restriction, including without limitation the rights
  12408. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12409. * copies of the Software, and to permit persons to whom the Software is
  12410. * furnished to do so, subject to the following conditions:
  12411. *
  12412. * The above copyright notice and this permission notice shall be included in
  12413. * all copies or substantial portions of the Software.
  12414. *
  12415. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12416. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12417. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12418. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12419. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12420. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12421. * THE SOFTWARE.
  12422. */
  12423. var __extends = this && this.__extends || function () {
  12424. var _extendStatics = function extendStatics(d, b) {
  12425. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12426. d.__proto__ = b;
  12427. } || function (d, b) {
  12428. for (var p in b) {
  12429. if (b.hasOwnProperty(p)) d[p] = b[p];
  12430. }
  12431. };
  12432. return _extendStatics(d, b);
  12433. };
  12434. return function (d, b) {
  12435. _extendStatics(d, b);
  12436. function __() {
  12437. this.constructor = d;
  12438. }
  12439. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12440. };
  12441. }();
  12442. var __assign = this && this.__assign || function () {
  12443. __assign = Object.assign || function (t) {
  12444. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12445. s = arguments[i];
  12446. for (var p in s) {
  12447. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12448. }
  12449. }
  12450. return t;
  12451. };
  12452. return __assign.apply(this, arguments);
  12453. };
  12454. Object.defineProperty(exports, "__esModule", { value: true });
  12455. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12456. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  12457. var MDCSelectFoundation = /** @class */function (_super) {
  12458. __extends(MDCSelectFoundation, _super);
  12459. /* istanbul ignore next: optional argument is not a branch statement */
  12460. /**
  12461. * @param adapter
  12462. * @param foundationMap Map from subcomponent names to their subfoundations.
  12463. */
  12464. function MDCSelectFoundation(adapter, foundationMap) {
  12465. if (foundationMap === void 0) {
  12466. foundationMap = {};
  12467. }
  12468. var _this = _super.call(this, __assign({}, MDCSelectFoundation.defaultAdapter, adapter)) || this;
  12469. _this.leadingIcon_ = foundationMap.leadingIcon;
  12470. _this.helperText_ = foundationMap.helperText;
  12471. return _this;
  12472. }
  12473. Object.defineProperty(MDCSelectFoundation, "cssClasses", {
  12474. get: function get() {
  12475. return constants_1.cssClasses;
  12476. },
  12477. enumerable: true,
  12478. configurable: true
  12479. });
  12480. Object.defineProperty(MDCSelectFoundation, "numbers", {
  12481. get: function get() {
  12482. return constants_1.numbers;
  12483. },
  12484. enumerable: true,
  12485. configurable: true
  12486. });
  12487. Object.defineProperty(MDCSelectFoundation, "strings", {
  12488. get: function get() {
  12489. return constants_1.strings;
  12490. },
  12491. enumerable: true,
  12492. configurable: true
  12493. });
  12494. Object.defineProperty(MDCSelectFoundation, "defaultAdapter", {
  12495. /**
  12496. * See {@link MDCSelectAdapter} for typing information on parameters and return types.
  12497. */
  12498. get: function get() {
  12499. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12500. return {
  12501. addClass: function addClass() {
  12502. return undefined;
  12503. },
  12504. removeClass: function removeClass() {
  12505. return undefined;
  12506. },
  12507. hasClass: function hasClass() {
  12508. return false;
  12509. },
  12510. activateBottomLine: function activateBottomLine() {
  12511. return undefined;
  12512. },
  12513. deactivateBottomLine: function deactivateBottomLine() {
  12514. return undefined;
  12515. },
  12516. setValue: function setValue() {
  12517. return undefined;
  12518. },
  12519. getValue: function getValue() {
  12520. return '';
  12521. },
  12522. floatLabel: function floatLabel() {
  12523. return undefined;
  12524. },
  12525. getLabelWidth: function getLabelWidth() {
  12526. return 0;
  12527. },
  12528. hasOutline: function hasOutline() {
  12529. return false;
  12530. },
  12531. notchOutline: function notchOutline() {
  12532. return undefined;
  12533. },
  12534. closeOutline: function closeOutline() {
  12535. return undefined;
  12536. },
  12537. openMenu: function openMenu() {
  12538. return undefined;
  12539. },
  12540. closeMenu: function closeMenu() {
  12541. return undefined;
  12542. },
  12543. isMenuOpen: function isMenuOpen() {
  12544. return false;
  12545. },
  12546. setSelectedIndex: function setSelectedIndex() {
  12547. return undefined;
  12548. },
  12549. setDisabled: function setDisabled() {
  12550. return undefined;
  12551. },
  12552. setRippleCenter: function setRippleCenter() {
  12553. return undefined;
  12554. },
  12555. notifyChange: function notifyChange() {
  12556. return undefined;
  12557. },
  12558. checkValidity: function checkValidity() {
  12559. return false;
  12560. },
  12561. setValid: function setValid() {
  12562. return undefined;
  12563. }
  12564. };
  12565. // tslint:enable:object-literal-sort-keys
  12566. },
  12567. enumerable: true,
  12568. configurable: true
  12569. });
  12570. MDCSelectFoundation.prototype.setSelectedIndex = function (index) {
  12571. this.adapter_.setSelectedIndex(index);
  12572. this.adapter_.closeMenu();
  12573. var didChange = true;
  12574. this.handleChange(didChange);
  12575. };
  12576. MDCSelectFoundation.prototype.setValue = function (value) {
  12577. this.adapter_.setValue(value);
  12578. var didChange = true;
  12579. this.handleChange(didChange);
  12580. };
  12581. MDCSelectFoundation.prototype.getValue = function () {
  12582. return this.adapter_.getValue();
  12583. };
  12584. MDCSelectFoundation.prototype.setDisabled = function (isDisabled) {
  12585. if (isDisabled) {
  12586. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  12587. } else {
  12588. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  12589. }
  12590. this.adapter_.setDisabled(isDisabled);
  12591. this.adapter_.closeMenu();
  12592. if (this.leadingIcon_) {
  12593. this.leadingIcon_.setDisabled(isDisabled);
  12594. }
  12595. };
  12596. /**
  12597. * @param content Sets the content of the helper text.
  12598. */
  12599. MDCSelectFoundation.prototype.setHelperTextContent = function (content) {
  12600. if (this.helperText_) {
  12601. this.helperText_.setContent(content);
  12602. }
  12603. };
  12604. MDCSelectFoundation.prototype.layout = function () {
  12605. var openNotch = this.getValue().length > 0;
  12606. this.notchOutline(openNotch);
  12607. };
  12608. MDCSelectFoundation.prototype.handleMenuOpened = function () {
  12609. this.adapter_.addClass(constants_1.cssClasses.ACTIVATED);
  12610. };
  12611. MDCSelectFoundation.prototype.handleMenuClosed = function () {
  12612. this.adapter_.removeClass(constants_1.cssClasses.ACTIVATED);
  12613. };
  12614. /**
  12615. * Handles value changes, via change event or programmatic updates.
  12616. */
  12617. MDCSelectFoundation.prototype.handleChange = function (didChange) {
  12618. if (didChange === void 0) {
  12619. didChange = true;
  12620. }
  12621. var value = this.getValue();
  12622. var optionHasValue = value.length > 0;
  12623. var isRequired = this.adapter_.hasClass(constants_1.cssClasses.REQUIRED);
  12624. this.notchOutline(optionHasValue);
  12625. if (!this.adapter_.hasClass(constants_1.cssClasses.FOCUSED)) {
  12626. this.adapter_.floatLabel(optionHasValue);
  12627. }
  12628. if (didChange) {
  12629. this.adapter_.notifyChange(value);
  12630. if (isRequired) {
  12631. this.setValid(this.isValid());
  12632. if (this.helperText_) {
  12633. this.helperText_.setValidity(this.isValid());
  12634. }
  12635. }
  12636. }
  12637. };
  12638. /**
  12639. * Handles focus events from select element.
  12640. */
  12641. MDCSelectFoundation.prototype.handleFocus = function () {
  12642. this.adapter_.addClass(constants_1.cssClasses.FOCUSED);
  12643. this.adapter_.floatLabel(true);
  12644. this.notchOutline(true);
  12645. this.adapter_.activateBottomLine();
  12646. if (this.helperText_) {
  12647. this.helperText_.showToScreenReader();
  12648. }
  12649. };
  12650. /**
  12651. * Handles blur events from select element.
  12652. */
  12653. MDCSelectFoundation.prototype.handleBlur = function () {
  12654. if (this.adapter_.isMenuOpen()) {
  12655. return;
  12656. }
  12657. this.adapter_.removeClass(constants_1.cssClasses.FOCUSED);
  12658. this.handleChange(false);
  12659. this.adapter_.deactivateBottomLine();
  12660. var isRequired = this.adapter_.hasClass(constants_1.cssClasses.REQUIRED);
  12661. if (isRequired) {
  12662. this.setValid(this.isValid());
  12663. if (this.helperText_) {
  12664. this.helperText_.setValidity(this.isValid());
  12665. }
  12666. }
  12667. };
  12668. MDCSelectFoundation.prototype.handleClick = function (normalizedX) {
  12669. if (this.adapter_.isMenuOpen()) {
  12670. return;
  12671. }
  12672. this.adapter_.setRippleCenter(normalizedX);
  12673. this.adapter_.openMenu();
  12674. };
  12675. MDCSelectFoundation.prototype.handleKeydown = function (event) {
  12676. if (this.adapter_.isMenuOpen()) {
  12677. return;
  12678. }
  12679. var isEnter = event.key === 'Enter' || event.keyCode === 13;
  12680. var isSpace = event.key === 'Space' || event.keyCode === 32;
  12681. var arrowUp = event.key === 'ArrowUp' || event.keyCode === 38;
  12682. var arrowDown = event.key === 'ArrowDown' || event.keyCode === 40;
  12683. if (this.adapter_.hasClass(constants_1.cssClasses.FOCUSED) && (isEnter || isSpace || arrowUp || arrowDown)) {
  12684. this.adapter_.openMenu();
  12685. event.preventDefault();
  12686. }
  12687. };
  12688. /**
  12689. * Opens/closes the notched outline.
  12690. */
  12691. MDCSelectFoundation.prototype.notchOutline = function (openNotch) {
  12692. if (!this.adapter_.hasOutline()) {
  12693. return;
  12694. }
  12695. var isFocused = this.adapter_.hasClass(constants_1.cssClasses.FOCUSED);
  12696. if (openNotch) {
  12697. var labelScale = constants_1.numbers.LABEL_SCALE;
  12698. var labelWidth = this.adapter_.getLabelWidth() * labelScale;
  12699. this.adapter_.notchOutline(labelWidth);
  12700. } else if (!isFocused) {
  12701. this.adapter_.closeOutline();
  12702. }
  12703. };
  12704. /**
  12705. * Sets the aria label of the leading icon.
  12706. */
  12707. MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  12708. if (this.leadingIcon_) {
  12709. this.leadingIcon_.setAriaLabel(label);
  12710. }
  12711. };
  12712. /**
  12713. * Sets the text content of the leading icon.
  12714. */
  12715. MDCSelectFoundation.prototype.setLeadingIconContent = function (content) {
  12716. if (this.leadingIcon_) {
  12717. this.leadingIcon_.setContent(content);
  12718. }
  12719. };
  12720. MDCSelectFoundation.prototype.setValid = function (isValid) {
  12721. this.adapter_.setValid(isValid);
  12722. };
  12723. MDCSelectFoundation.prototype.isValid = function () {
  12724. return this.adapter_.checkValidity();
  12725. };
  12726. return MDCSelectFoundation;
  12727. }(foundation_1.MDCFoundation);
  12728. exports.MDCSelectFoundation = MDCSelectFoundation;
  12729. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12730. exports.default = MDCSelectFoundation;
  12731. /***/ }),
  12732. /***/ "./packages/mdc-select/helper-text/component.ts":
  12733. /*!******************************************************!*\
  12734. !*** ./packages/mdc-select/helper-text/component.ts ***!
  12735. \******************************************************/
  12736. /*! no static exports found */
  12737. /***/ (function(module, exports, __webpack_require__) {
  12738. "use strict";
  12739. /**
  12740. * @license
  12741. * Copyright 2018 Google Inc.
  12742. *
  12743. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12744. * of this software and associated documentation files (the "Software"), to deal
  12745. * in the Software without restriction, including without limitation the rights
  12746. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12747. * copies of the Software, and to permit persons to whom the Software is
  12748. * furnished to do so, subject to the following conditions:
  12749. *
  12750. * The above copyright notice and this permission notice shall be included in
  12751. * all copies or substantial portions of the Software.
  12752. *
  12753. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12754. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12755. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12756. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12757. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12758. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12759. * THE SOFTWARE.
  12760. */
  12761. var __extends = this && this.__extends || function () {
  12762. var _extendStatics = function extendStatics(d, b) {
  12763. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12764. d.__proto__ = b;
  12765. } || function (d, b) {
  12766. for (var p in b) {
  12767. if (b.hasOwnProperty(p)) d[p] = b[p];
  12768. }
  12769. };
  12770. return _extendStatics(d, b);
  12771. };
  12772. return function (d, b) {
  12773. _extendStatics(d, b);
  12774. function __() {
  12775. this.constructor = d;
  12776. }
  12777. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12778. };
  12779. }();
  12780. Object.defineProperty(exports, "__esModule", { value: true });
  12781. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12782. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts");
  12783. var MDCSelectHelperText = /** @class */function (_super) {
  12784. __extends(MDCSelectHelperText, _super);
  12785. function MDCSelectHelperText() {
  12786. return _super !== null && _super.apply(this, arguments) || this;
  12787. }
  12788. MDCSelectHelperText.attachTo = function (root) {
  12789. return new MDCSelectHelperText(root);
  12790. };
  12791. Object.defineProperty(MDCSelectHelperText.prototype, "foundation", {
  12792. get: function get() {
  12793. return this.foundation_;
  12794. },
  12795. enumerable: true,
  12796. configurable: true
  12797. });
  12798. MDCSelectHelperText.prototype.getDefaultFoundation = function () {
  12799. var _this = this;
  12800. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12801. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12802. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12803. var adapter = {
  12804. addClass: function addClass(className) {
  12805. return _this.root_.classList.add(className);
  12806. },
  12807. removeClass: function removeClass(className) {
  12808. return _this.root_.classList.remove(className);
  12809. },
  12810. hasClass: function hasClass(className) {
  12811. return _this.root_.classList.contains(className);
  12812. },
  12813. setAttr: function setAttr(attr, value) {
  12814. return _this.root_.setAttribute(attr, value);
  12815. },
  12816. removeAttr: function removeAttr(attr) {
  12817. return _this.root_.removeAttribute(attr);
  12818. },
  12819. setContent: function setContent(content) {
  12820. _this.root_.textContent = content;
  12821. }
  12822. };
  12823. // tslint:enable:object-literal-sort-keys
  12824. return new foundation_1.MDCSelectHelperTextFoundation(adapter);
  12825. };
  12826. return MDCSelectHelperText;
  12827. }(component_1.MDCComponent);
  12828. exports.MDCSelectHelperText = MDCSelectHelperText;
  12829. /***/ }),
  12830. /***/ "./packages/mdc-select/helper-text/constants.ts":
  12831. /*!******************************************************!*\
  12832. !*** ./packages/mdc-select/helper-text/constants.ts ***!
  12833. \******************************************************/
  12834. /*! no static exports found */
  12835. /***/ (function(module, exports, __webpack_require__) {
  12836. "use strict";
  12837. /**
  12838. * @license
  12839. * Copyright 2018 Google Inc.
  12840. *
  12841. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12842. * of this software and associated documentation files (the "Software"), to deal
  12843. * in the Software without restriction, including without limitation the rights
  12844. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12845. * copies of the Software, and to permit persons to whom the Software is
  12846. * furnished to do so, subject to the following conditions:
  12847. *
  12848. * The above copyright notice and this permission notice shall be included in
  12849. * all copies or substantial portions of the Software.
  12850. *
  12851. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12852. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12853. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12854. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12855. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12856. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12857. * THE SOFTWARE.
  12858. */
  12859. Object.defineProperty(exports, "__esModule", { value: true });
  12860. var strings = {
  12861. ARIA_HIDDEN: 'aria-hidden',
  12862. ROLE: 'role'
  12863. };
  12864. exports.strings = strings;
  12865. var cssClasses = {
  12866. HELPER_TEXT_PERSISTENT: 'mdc-select-helper-text--persistent',
  12867. HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg'
  12868. };
  12869. exports.cssClasses = cssClasses;
  12870. /***/ }),
  12871. /***/ "./packages/mdc-select/helper-text/foundation.ts":
  12872. /*!*******************************************************!*\
  12873. !*** ./packages/mdc-select/helper-text/foundation.ts ***!
  12874. \*******************************************************/
  12875. /*! no static exports found */
  12876. /***/ (function(module, exports, __webpack_require__) {
  12877. "use strict";
  12878. /**
  12879. * @license
  12880. * Copyright 2018 Google Inc.
  12881. *
  12882. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12883. * of this software and associated documentation files (the "Software"), to deal
  12884. * in the Software without restriction, including without limitation the rights
  12885. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12886. * copies of the Software, and to permit persons to whom the Software is
  12887. * furnished to do so, subject to the following conditions:
  12888. *
  12889. * The above copyright notice and this permission notice shall be included in
  12890. * all copies or substantial portions of the Software.
  12891. *
  12892. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12893. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12894. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12895. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12896. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12897. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12898. * THE SOFTWARE.
  12899. */
  12900. var __extends = this && this.__extends || function () {
  12901. var _extendStatics = function extendStatics(d, b) {
  12902. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12903. d.__proto__ = b;
  12904. } || function (d, b) {
  12905. for (var p in b) {
  12906. if (b.hasOwnProperty(p)) d[p] = b[p];
  12907. }
  12908. };
  12909. return _extendStatics(d, b);
  12910. };
  12911. return function (d, b) {
  12912. _extendStatics(d, b);
  12913. function __() {
  12914. this.constructor = d;
  12915. }
  12916. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12917. };
  12918. }();
  12919. var __assign = this && this.__assign || function () {
  12920. __assign = Object.assign || function (t) {
  12921. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12922. s = arguments[i];
  12923. for (var p in s) {
  12924. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12925. }
  12926. }
  12927. return t;
  12928. };
  12929. return __assign.apply(this, arguments);
  12930. };
  12931. Object.defineProperty(exports, "__esModule", { value: true });
  12932. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12933. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  12934. var MDCSelectHelperTextFoundation = /** @class */function (_super) {
  12935. __extends(MDCSelectHelperTextFoundation, _super);
  12936. function MDCSelectHelperTextFoundation(adapter) {
  12937. return _super.call(this, __assign({}, MDCSelectHelperTextFoundation.defaultAdapter, adapter)) || this;
  12938. }
  12939. Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
  12940. get: function get() {
  12941. return constants_1.cssClasses;
  12942. },
  12943. enumerable: true,
  12944. configurable: true
  12945. });
  12946. Object.defineProperty(MDCSelectHelperTextFoundation, "strings", {
  12947. get: function get() {
  12948. return constants_1.strings;
  12949. },
  12950. enumerable: true,
  12951. configurable: true
  12952. });
  12953. Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", {
  12954. /**
  12955. * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types.
  12956. */
  12957. get: function get() {
  12958. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12959. return {
  12960. addClass: function addClass() {
  12961. return undefined;
  12962. },
  12963. removeClass: function removeClass() {
  12964. return undefined;
  12965. },
  12966. hasClass: function hasClass() {
  12967. return false;
  12968. },
  12969. setAttr: function setAttr() {
  12970. return undefined;
  12971. },
  12972. removeAttr: function removeAttr() {
  12973. return undefined;
  12974. },
  12975. setContent: function setContent() {
  12976. return undefined;
  12977. }
  12978. };
  12979. // tslint:enable:object-literal-sort-keys
  12980. },
  12981. enumerable: true,
  12982. configurable: true
  12983. });
  12984. /**
  12985. * Sets the content of the helper text field.
  12986. */
  12987. MDCSelectHelperTextFoundation.prototype.setContent = function (content) {
  12988. this.adapter_.setContent(content);
  12989. };
  12990. /**
  12991. * Sets the persistency of the helper text.
  12992. */
  12993. MDCSelectHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  12994. if (isPersistent) {
  12995. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12996. } else {
  12997. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12998. }
  12999. };
  13000. /**
  13001. * @param isValidation True to make the helper text act as an error validation message.
  13002. */
  13003. MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {
  13004. if (isValidation) {
  13005. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  13006. } else {
  13007. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  13008. }
  13009. };
  13010. /**
  13011. * Makes the helper text visible to screen readers.
  13012. */
  13013. MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {
  13014. this.adapter_.removeAttr(constants_1.strings.ARIA_HIDDEN);
  13015. };
  13016. /**
  13017. * Sets the validity of the helper text based on the select validity.
  13018. */
  13019. MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {
  13020. var helperTextIsPersistent = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  13021. var helperTextIsValidationMsg = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  13022. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !selectIsValid;
  13023. if (validationMsgNeedsDisplay) {
  13024. this.adapter_.setAttr(constants_1.strings.ROLE, 'alert');
  13025. } else {
  13026. this.adapter_.removeAttr(constants_1.strings.ROLE);
  13027. }
  13028. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  13029. this.hide_();
  13030. }
  13031. };
  13032. /**
  13033. * Hides the help text from screen readers.
  13034. */
  13035. MDCSelectHelperTextFoundation.prototype.hide_ = function () {
  13036. this.adapter_.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  13037. };
  13038. return MDCSelectHelperTextFoundation;
  13039. }(foundation_1.MDCFoundation);
  13040. exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation;
  13041. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  13042. exports.default = MDCSelectHelperTextFoundation;
  13043. /***/ }),
  13044. /***/ "./packages/mdc-select/helper-text/index.ts":
  13045. /*!**************************************************!*\
  13046. !*** ./packages/mdc-select/helper-text/index.ts ***!
  13047. \**************************************************/
  13048. /*! no static exports found */
  13049. /***/ (function(module, exports, __webpack_require__) {
  13050. "use strict";
  13051. /**
  13052. * @license
  13053. * Copyright 2019 Google Inc.
  13054. *
  13055. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13056. * of this software and associated documentation files (the "Software"), to deal
  13057. * in the Software without restriction, including without limitation the rights
  13058. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13059. * copies of the Software, and to permit persons to whom the Software is
  13060. * furnished to do so, subject to the following conditions:
  13061. *
  13062. * The above copyright notice and this permission notice shall be included in
  13063. * all copies or substantial portions of the Software.
  13064. *
  13065. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13066. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13067. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13068. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13069. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13070. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13071. * THE SOFTWARE.
  13072. */
  13073. function __export(m) {
  13074. for (var p in m) {
  13075. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13076. }
  13077. }
  13078. Object.defineProperty(exports, "__esModule", { value: true });
  13079. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/helper-text/component.ts"));
  13080. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"));
  13081. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  13082. exports.helperTextCssClasses = constants_1.cssClasses;
  13083. exports.helperTextStrings = constants_1.strings;
  13084. /***/ }),
  13085. /***/ "./packages/mdc-select/icon/component.ts":
  13086. /*!***********************************************!*\
  13087. !*** ./packages/mdc-select/icon/component.ts ***!
  13088. \***********************************************/
  13089. /*! no static exports found */
  13090. /***/ (function(module, exports, __webpack_require__) {
  13091. "use strict";
  13092. /**
  13093. * @license
  13094. * Copyright 2018 Google Inc.
  13095. *
  13096. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13097. * of this software and associated documentation files (the "Software"), to deal
  13098. * in the Software without restriction, including without limitation the rights
  13099. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13100. * copies of the Software, and to permit persons to whom the Software is
  13101. * furnished to do so, subject to the following conditions:
  13102. *
  13103. * The above copyright notice and this permission notice shall be included in
  13104. * all copies or substantial portions of the Software.
  13105. *
  13106. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13107. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13108. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13109. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13110. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13111. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13112. * THE SOFTWARE.
  13113. */
  13114. var __extends = this && this.__extends || function () {
  13115. var _extendStatics = function extendStatics(d, b) {
  13116. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13117. d.__proto__ = b;
  13118. } || function (d, b) {
  13119. for (var p in b) {
  13120. if (b.hasOwnProperty(p)) d[p] = b[p];
  13121. }
  13122. };
  13123. return _extendStatics(d, b);
  13124. };
  13125. return function (d, b) {
  13126. _extendStatics(d, b);
  13127. function __() {
  13128. this.constructor = d;
  13129. }
  13130. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13131. };
  13132. }();
  13133. Object.defineProperty(exports, "__esModule", { value: true });
  13134. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  13135. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts");
  13136. var MDCSelectIcon = /** @class */function (_super) {
  13137. __extends(MDCSelectIcon, _super);
  13138. function MDCSelectIcon() {
  13139. return _super !== null && _super.apply(this, arguments) || this;
  13140. }
  13141. MDCSelectIcon.attachTo = function (root) {
  13142. return new MDCSelectIcon(root);
  13143. };
  13144. Object.defineProperty(MDCSelectIcon.prototype, "foundation", {
  13145. get: function get() {
  13146. return this.foundation_;
  13147. },
  13148. enumerable: true,
  13149. configurable: true
  13150. });
  13151. MDCSelectIcon.prototype.getDefaultFoundation = function () {
  13152. var _this = this;
  13153. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13154. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13155. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13156. var adapter = {
  13157. getAttr: function getAttr(attr) {
  13158. return _this.root_.getAttribute(attr);
  13159. },
  13160. setAttr: function setAttr(attr, value) {
  13161. return _this.root_.setAttribute(attr, value);
  13162. },
  13163. removeAttr: function removeAttr(attr) {
  13164. return _this.root_.removeAttribute(attr);
  13165. },
  13166. setContent: function setContent(content) {
  13167. _this.root_.textContent = content;
  13168. },
  13169. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  13170. return _this.listen(evtType, handler);
  13171. },
  13172. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  13173. return _this.unlisten(evtType, handler);
  13174. },
  13175. notifyIconAction: function notifyIconAction() {
  13176. return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  13177. }
  13178. };
  13179. // tslint:enable:object-literal-sort-keys
  13180. return new foundation_1.MDCSelectIconFoundation(adapter);
  13181. };
  13182. return MDCSelectIcon;
  13183. }(component_1.MDCComponent);
  13184. exports.MDCSelectIcon = MDCSelectIcon;
  13185. /***/ }),
  13186. /***/ "./packages/mdc-select/icon/constants.ts":
  13187. /*!***********************************************!*\
  13188. !*** ./packages/mdc-select/icon/constants.ts ***!
  13189. \***********************************************/
  13190. /*! no static exports found */
  13191. /***/ (function(module, exports, __webpack_require__) {
  13192. "use strict";
  13193. /**
  13194. * @license
  13195. * Copyright 2018 Google Inc.
  13196. *
  13197. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13198. * of this software and associated documentation files (the "Software"), to deal
  13199. * in the Software without restriction, including without limitation the rights
  13200. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13201. * copies of the Software, and to permit persons to whom the Software is
  13202. * furnished to do so, subject to the following conditions:
  13203. *
  13204. * The above copyright notice and this permission notice shall be included in
  13205. * all copies or substantial portions of the Software.
  13206. *
  13207. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13208. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13209. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13210. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13211. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13212. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13213. * THE SOFTWARE.
  13214. */
  13215. Object.defineProperty(exports, "__esModule", { value: true });
  13216. var strings = {
  13217. ICON_EVENT: 'MDCSelect:icon',
  13218. ICON_ROLE: 'button'
  13219. };
  13220. exports.strings = strings;
  13221. /***/ }),
  13222. /***/ "./packages/mdc-select/icon/foundation.ts":
  13223. /*!************************************************!*\
  13224. !*** ./packages/mdc-select/icon/foundation.ts ***!
  13225. \************************************************/
  13226. /*! no static exports found */
  13227. /***/ (function(module, exports, __webpack_require__) {
  13228. "use strict";
  13229. /**
  13230. * @license
  13231. * Copyright 2018 Google Inc.
  13232. *
  13233. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13234. * of this software and associated documentation files (the "Software"), to deal
  13235. * in the Software without restriction, including without limitation the rights
  13236. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13237. * copies of the Software, and to permit persons to whom the Software is
  13238. * furnished to do so, subject to the following conditions:
  13239. *
  13240. * The above copyright notice and this permission notice shall be included in
  13241. * all copies or substantial portions of the Software.
  13242. *
  13243. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13244. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13245. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13246. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13247. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13248. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13249. * THE SOFTWARE.
  13250. */
  13251. var __extends = this && this.__extends || function () {
  13252. var _extendStatics = function extendStatics(d, b) {
  13253. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13254. d.__proto__ = b;
  13255. } || function (d, b) {
  13256. for (var p in b) {
  13257. if (b.hasOwnProperty(p)) d[p] = b[p];
  13258. }
  13259. };
  13260. return _extendStatics(d, b);
  13261. };
  13262. return function (d, b) {
  13263. _extendStatics(d, b);
  13264. function __() {
  13265. this.constructor = d;
  13266. }
  13267. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13268. };
  13269. }();
  13270. var __assign = this && this.__assign || function () {
  13271. __assign = Object.assign || function (t) {
  13272. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13273. s = arguments[i];
  13274. for (var p in s) {
  13275. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13276. }
  13277. }
  13278. return t;
  13279. };
  13280. return __assign.apply(this, arguments);
  13281. };
  13282. Object.defineProperty(exports, "__esModule", { value: true });
  13283. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  13284. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  13285. var INTERACTION_EVENTS = ['click', 'keydown'];
  13286. var MDCSelectIconFoundation = /** @class */function (_super) {
  13287. __extends(MDCSelectIconFoundation, _super);
  13288. function MDCSelectIconFoundation(adapter) {
  13289. var _this = _super.call(this, __assign({}, MDCSelectIconFoundation.defaultAdapter, adapter)) || this;
  13290. _this.savedTabIndex_ = null;
  13291. _this.interactionHandler_ = function (evt) {
  13292. return _this.handleInteraction(evt);
  13293. };
  13294. return _this;
  13295. }
  13296. Object.defineProperty(MDCSelectIconFoundation, "strings", {
  13297. get: function get() {
  13298. return constants_1.strings;
  13299. },
  13300. enumerable: true,
  13301. configurable: true
  13302. });
  13303. Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", {
  13304. /**
  13305. * See {@link MDCSelectIconAdapter} for typing information on parameters and return types.
  13306. */
  13307. get: function get() {
  13308. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13309. return {
  13310. getAttr: function getAttr() {
  13311. return null;
  13312. },
  13313. setAttr: function setAttr() {
  13314. return undefined;
  13315. },
  13316. removeAttr: function removeAttr() {
  13317. return undefined;
  13318. },
  13319. setContent: function setContent() {
  13320. return undefined;
  13321. },
  13322. registerInteractionHandler: function registerInteractionHandler() {
  13323. return undefined;
  13324. },
  13325. deregisterInteractionHandler: function deregisterInteractionHandler() {
  13326. return undefined;
  13327. },
  13328. notifyIconAction: function notifyIconAction() {
  13329. return undefined;
  13330. }
  13331. };
  13332. // tslint:enable:object-literal-sort-keys
  13333. },
  13334. enumerable: true,
  13335. configurable: true
  13336. });
  13337. MDCSelectIconFoundation.prototype.init = function () {
  13338. var _this = this;
  13339. this.savedTabIndex_ = this.adapter_.getAttr('tabindex');
  13340. INTERACTION_EVENTS.forEach(function (evtType) {
  13341. _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_);
  13342. });
  13343. };
  13344. MDCSelectIconFoundation.prototype.destroy = function () {
  13345. var _this = this;
  13346. INTERACTION_EVENTS.forEach(function (evtType) {
  13347. _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  13348. });
  13349. };
  13350. MDCSelectIconFoundation.prototype.setDisabled = function (disabled) {
  13351. if (!this.savedTabIndex_) {
  13352. return;
  13353. }
  13354. if (disabled) {
  13355. this.adapter_.setAttr('tabindex', '-1');
  13356. this.adapter_.removeAttr('role');
  13357. } else {
  13358. this.adapter_.setAttr('tabindex', this.savedTabIndex_);
  13359. this.adapter_.setAttr('role', constants_1.strings.ICON_ROLE);
  13360. }
  13361. };
  13362. MDCSelectIconFoundation.prototype.setAriaLabel = function (label) {
  13363. this.adapter_.setAttr('aria-label', label);
  13364. };
  13365. MDCSelectIconFoundation.prototype.setContent = function (content) {
  13366. this.adapter_.setContent(content);
  13367. };
  13368. MDCSelectIconFoundation.prototype.handleInteraction = function (evt) {
  13369. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  13370. if (evt.type === 'click' || isEnterKey) {
  13371. this.adapter_.notifyIconAction();
  13372. }
  13373. };
  13374. return MDCSelectIconFoundation;
  13375. }(foundation_1.MDCFoundation);
  13376. exports.MDCSelectIconFoundation = MDCSelectIconFoundation;
  13377. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  13378. exports.default = MDCSelectIconFoundation;
  13379. /***/ }),
  13380. /***/ "./packages/mdc-select/icon/index.ts":
  13381. /*!*******************************************!*\
  13382. !*** ./packages/mdc-select/icon/index.ts ***!
  13383. \*******************************************/
  13384. /*! no static exports found */
  13385. /***/ (function(module, exports, __webpack_require__) {
  13386. "use strict";
  13387. /**
  13388. * @license
  13389. * Copyright 2019 Google Inc.
  13390. *
  13391. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13392. * of this software and associated documentation files (the "Software"), to deal
  13393. * in the Software without restriction, including without limitation the rights
  13394. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13395. * copies of the Software, and to permit persons to whom the Software is
  13396. * furnished to do so, subject to the following conditions:
  13397. *
  13398. * The above copyright notice and this permission notice shall be included in
  13399. * all copies or substantial portions of the Software.
  13400. *
  13401. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13402. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13403. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13404. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13405. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13406. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13407. * THE SOFTWARE.
  13408. */
  13409. function __export(m) {
  13410. for (var p in m) {
  13411. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13412. }
  13413. }
  13414. Object.defineProperty(exports, "__esModule", { value: true });
  13415. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/icon/component.ts"));
  13416. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"));
  13417. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  13418. exports.iconStrings = constants_1.strings;
  13419. /***/ }),
  13420. /***/ "./packages/mdc-select/index.ts":
  13421. /*!**************************************!*\
  13422. !*** ./packages/mdc-select/index.ts ***!
  13423. \**************************************/
  13424. /*! no static exports found */
  13425. /***/ (function(module, exports, __webpack_require__) {
  13426. "use strict";
  13427. /**
  13428. * @license
  13429. * Copyright 2019 Google Inc.
  13430. *
  13431. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13432. * of this software and associated documentation files (the "Software"), to deal
  13433. * in the Software without restriction, including without limitation the rights
  13434. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13435. * copies of the Software, and to permit persons to whom the Software is
  13436. * furnished to do so, subject to the following conditions:
  13437. *
  13438. * The above copyright notice and this permission notice shall be included in
  13439. * all copies or substantial portions of the Software.
  13440. *
  13441. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13442. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13443. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13444. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13445. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13446. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13447. * THE SOFTWARE.
  13448. */
  13449. function __export(m) {
  13450. for (var p in m) {
  13451. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13452. }
  13453. }
  13454. Object.defineProperty(exports, "__esModule", { value: true });
  13455. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/component.ts"));
  13456. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"));
  13457. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts"));
  13458. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-select/helper-text/index.ts"));
  13459. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-select/icon/index.ts"));
  13460. /***/ }),
  13461. /***/ "./packages/mdc-slider/component.ts":
  13462. /*!******************************************!*\
  13463. !*** ./packages/mdc-slider/component.ts ***!
  13464. \******************************************/
  13465. /*! no static exports found */
  13466. /***/ (function(module, exports, __webpack_require__) {
  13467. "use strict";
  13468. /**
  13469. * @license
  13470. * Copyright 2017 Google Inc.
  13471. *
  13472. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13473. * of this software and associated documentation files (the "Software"), to deal
  13474. * in the Software without restriction, including without limitation the rights
  13475. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13476. * copies of the Software, and to permit persons to whom the Software is
  13477. * furnished to do so, subject to the following conditions:
  13478. *
  13479. * The above copyright notice and this permission notice shall be included in
  13480. * all copies or substantial portions of the Software.
  13481. *
  13482. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13483. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13484. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13485. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13486. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13487. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13488. * THE SOFTWARE.
  13489. */
  13490. var __extends = this && this.__extends || function () {
  13491. var _extendStatics = function extendStatics(d, b) {
  13492. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13493. d.__proto__ = b;
  13494. } || function (d, b) {
  13495. for (var p in b) {
  13496. if (b.hasOwnProperty(p)) d[p] = b[p];
  13497. }
  13498. };
  13499. return _extendStatics(d, b);
  13500. };
  13501. return function (d, b) {
  13502. _extendStatics(d, b);
  13503. function __() {
  13504. this.constructor = d;
  13505. }
  13506. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13507. };
  13508. }();
  13509. Object.defineProperty(exports, "__esModule", { value: true });
  13510. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  13511. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  13512. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  13513. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts");
  13514. var MDCSlider = /** @class */function (_super) {
  13515. __extends(MDCSlider, _super);
  13516. function MDCSlider() {
  13517. return _super !== null && _super.apply(this, arguments) || this;
  13518. }
  13519. MDCSlider.attachTo = function (root) {
  13520. return new MDCSlider(root);
  13521. };
  13522. Object.defineProperty(MDCSlider.prototype, "value", {
  13523. get: function get() {
  13524. return this.foundation_.getValue();
  13525. },
  13526. set: function set(value) {
  13527. this.foundation_.setValue(value);
  13528. },
  13529. enumerable: true,
  13530. configurable: true
  13531. });
  13532. Object.defineProperty(MDCSlider.prototype, "min", {
  13533. get: function get() {
  13534. return this.foundation_.getMin();
  13535. },
  13536. set: function set(min) {
  13537. this.foundation_.setMin(min);
  13538. },
  13539. enumerable: true,
  13540. configurable: true
  13541. });
  13542. Object.defineProperty(MDCSlider.prototype, "max", {
  13543. get: function get() {
  13544. return this.foundation_.getMax();
  13545. },
  13546. set: function set(max) {
  13547. this.foundation_.setMax(max);
  13548. },
  13549. enumerable: true,
  13550. configurable: true
  13551. });
  13552. Object.defineProperty(MDCSlider.prototype, "step", {
  13553. get: function get() {
  13554. return this.foundation_.getStep();
  13555. },
  13556. set: function set(step) {
  13557. this.foundation_.setStep(step);
  13558. },
  13559. enumerable: true,
  13560. configurable: true
  13561. });
  13562. Object.defineProperty(MDCSlider.prototype, "disabled", {
  13563. get: function get() {
  13564. return this.foundation_.isDisabled();
  13565. },
  13566. set: function set(disabled) {
  13567. this.foundation_.setDisabled(disabled);
  13568. },
  13569. enumerable: true,
  13570. configurable: true
  13571. });
  13572. MDCSlider.prototype.initialize = function () {
  13573. this.thumbContainer_ = this.root_.querySelector(constants_1.strings.THUMB_CONTAINER_SELECTOR);
  13574. this.track_ = this.root_.querySelector(constants_1.strings.TRACK_SELECTOR);
  13575. this.pinValueMarker_ = this.root_.querySelector(constants_1.strings.PIN_VALUE_MARKER_SELECTOR);
  13576. this.trackMarkerContainer_ = this.root_.querySelector(constants_1.strings.TRACK_MARKER_CONTAINER_SELECTOR);
  13577. };
  13578. MDCSlider.prototype.getDefaultFoundation = function () {
  13579. var _this = this;
  13580. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13581. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13582. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13583. var adapter = {
  13584. hasClass: function hasClass(className) {
  13585. return _this.root_.classList.contains(className);
  13586. },
  13587. addClass: function addClass(className) {
  13588. return _this.root_.classList.add(className);
  13589. },
  13590. removeClass: function removeClass(className) {
  13591. return _this.root_.classList.remove(className);
  13592. },
  13593. getAttribute: function getAttribute(name) {
  13594. return _this.root_.getAttribute(name);
  13595. },
  13596. setAttribute: function setAttribute(name, value) {
  13597. return _this.root_.setAttribute(name, value);
  13598. },
  13599. removeAttribute: function removeAttribute(name) {
  13600. return _this.root_.removeAttribute(name);
  13601. },
  13602. computeBoundingRect: function computeBoundingRect() {
  13603. return _this.root_.getBoundingClientRect();
  13604. },
  13605. getTabIndex: function getTabIndex() {
  13606. return _this.root_.tabIndex;
  13607. },
  13608. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  13609. return _this.listen(evtType, handler, events_1.applyPassive());
  13610. },
  13611. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  13612. return _this.unlisten(evtType, handler, events_1.applyPassive());
  13613. },
  13614. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) {
  13615. _this.thumbContainer_.addEventListener(evtType, handler, events_1.applyPassive());
  13616. },
  13617. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) {
  13618. _this.thumbContainer_.removeEventListener(evtType, handler, events_1.applyPassive());
  13619. },
  13620. registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) {
  13621. return document.body.addEventListener(evtType, handler);
  13622. },
  13623. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) {
  13624. return document.body.removeEventListener(evtType, handler);
  13625. },
  13626. registerResizeHandler: function registerResizeHandler(handler) {
  13627. return window.addEventListener('resize', handler);
  13628. },
  13629. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  13630. return window.removeEventListener('resize', handler);
  13631. },
  13632. notifyInput: function notifyInput() {
  13633. return _this.emit(constants_1.strings.INPUT_EVENT, _this);
  13634. },
  13635. notifyChange: function notifyChange() {
  13636. return _this.emit(constants_1.strings.CHANGE_EVENT, _this);
  13637. },
  13638. setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) {
  13639. _this.thumbContainer_.style.setProperty(propertyName, value);
  13640. },
  13641. setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) {
  13642. return _this.track_.style.setProperty(propertyName, value);
  13643. },
  13644. setMarkerValue: function setMarkerValue(value) {
  13645. return _this.pinValueMarker_.innerText = value.toLocaleString();
  13646. },
  13647. appendTrackMarkers: function appendTrackMarkers(numMarkers) {
  13648. var frag = document.createDocumentFragment();
  13649. for (var i = 0; i < numMarkers; i++) {
  13650. var marker = document.createElement('div');
  13651. marker.classList.add('mdc-slider__track-marker');
  13652. frag.appendChild(marker);
  13653. }
  13654. _this.trackMarkerContainer_.appendChild(frag);
  13655. },
  13656. removeTrackMarkers: function removeTrackMarkers() {
  13657. while (_this.trackMarkerContainer_.firstChild) {
  13658. _this.trackMarkerContainer_.removeChild(_this.trackMarkerContainer_.firstChild);
  13659. }
  13660. },
  13661. setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty(propertyName, value) {
  13662. // We remove and append new nodes, thus, the last track marker must be dynamically found.
  13663. var lastTrackMarker = _this.root_.querySelector(constants_1.strings.LAST_TRACK_MARKER_SELECTOR);
  13664. lastTrackMarker.style.setProperty(propertyName, value);
  13665. },
  13666. isRTL: function isRTL() {
  13667. return getComputedStyle(_this.root_).direction === 'rtl';
  13668. }
  13669. };
  13670. // tslint:enable:object-literal-sort-keys
  13671. return new foundation_1.MDCSliderFoundation(adapter);
  13672. };
  13673. MDCSlider.prototype.initialSyncWithDOM = function () {
  13674. var origValueNow = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUENOW), this.value);
  13675. var min = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMIN), this.min);
  13676. var max = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMAX), this.max);
  13677. // min and max need to be set in the right order to avoid throwing an error
  13678. // when the new min is greater than the default max.
  13679. if (min >= this.max) {
  13680. this.max = max;
  13681. this.min = min;
  13682. } else {
  13683. this.min = min;
  13684. this.max = max;
  13685. }
  13686. this.step = this.parseFloat_(this.root_.getAttribute(constants_1.strings.STEP_DATA_ATTR), this.step);
  13687. this.value = origValueNow;
  13688. this.disabled = this.root_.hasAttribute(constants_1.strings.ARIA_DISABLED) && this.root_.getAttribute(constants_1.strings.ARIA_DISABLED) !== 'false';
  13689. this.foundation_.setupTrackMarker();
  13690. };
  13691. MDCSlider.prototype.layout = function () {
  13692. this.foundation_.layout();
  13693. };
  13694. MDCSlider.prototype.stepUp = function (amount) {
  13695. if (amount === void 0) {
  13696. amount = this.step || 1;
  13697. }
  13698. this.value += amount;
  13699. };
  13700. MDCSlider.prototype.stepDown = function (amount) {
  13701. if (amount === void 0) {
  13702. amount = this.step || 1;
  13703. }
  13704. this.value -= amount;
  13705. };
  13706. MDCSlider.prototype.parseFloat_ = function (str, defaultValue) {
  13707. var num = parseFloat(str); // tslint:disable-line:ban
  13708. var isNumeric = typeof num === 'number' && isFinite(num);
  13709. return isNumeric ? num : defaultValue;
  13710. };
  13711. return MDCSlider;
  13712. }(component_1.MDCComponent);
  13713. exports.MDCSlider = MDCSlider;
  13714. /***/ }),
  13715. /***/ "./packages/mdc-slider/constants.ts":
  13716. /*!******************************************!*\
  13717. !*** ./packages/mdc-slider/constants.ts ***!
  13718. \******************************************/
  13719. /*! no static exports found */
  13720. /***/ (function(module, exports, __webpack_require__) {
  13721. "use strict";
  13722. /**
  13723. * @license
  13724. * Copyright 2017 Google Inc.
  13725. *
  13726. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13727. * of this software and associated documentation files (the "Software"), to deal
  13728. * in the Software without restriction, including without limitation the rights
  13729. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13730. * copies of the Software, and to permit persons to whom the Software is
  13731. * furnished to do so, subject to the following conditions:
  13732. *
  13733. * The above copyright notice and this permission notice shall be included in
  13734. * all copies or substantial portions of the Software.
  13735. *
  13736. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13737. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13738. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13739. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13740. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13741. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13742. * THE SOFTWARE.
  13743. */
  13744. Object.defineProperty(exports, "__esModule", { value: true });
  13745. var cssClasses = {
  13746. ACTIVE: 'mdc-slider--active',
  13747. DISABLED: 'mdc-slider--disabled',
  13748. DISCRETE: 'mdc-slider--discrete',
  13749. FOCUS: 'mdc-slider--focus',
  13750. HAS_TRACK_MARKER: 'mdc-slider--display-markers',
  13751. IN_TRANSIT: 'mdc-slider--in-transit',
  13752. IS_DISCRETE: 'mdc-slider--discrete'
  13753. };
  13754. exports.cssClasses = cssClasses;
  13755. var strings = {
  13756. ARIA_DISABLED: 'aria-disabled',
  13757. ARIA_VALUEMAX: 'aria-valuemax',
  13758. ARIA_VALUEMIN: 'aria-valuemin',
  13759. ARIA_VALUENOW: 'aria-valuenow',
  13760. CHANGE_EVENT: 'MDCSlider:change',
  13761. INPUT_EVENT: 'MDCSlider:input',
  13762. LAST_TRACK_MARKER_SELECTOR: '.mdc-slider__track-marker:last-child',
  13763. PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker',
  13764. STEP_DATA_ATTR: 'data-step',
  13765. THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container',
  13766. TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container',
  13767. TRACK_SELECTOR: '.mdc-slider__track'
  13768. };
  13769. exports.strings = strings;
  13770. var numbers = {
  13771. PAGE_FACTOR: 4
  13772. };
  13773. exports.numbers = numbers;
  13774. /***/ }),
  13775. /***/ "./packages/mdc-slider/foundation.ts":
  13776. /*!*******************************************!*\
  13777. !*** ./packages/mdc-slider/foundation.ts ***!
  13778. \*******************************************/
  13779. /*! no static exports found */
  13780. /***/ (function(module, exports, __webpack_require__) {
  13781. "use strict";
  13782. /**
  13783. * @license
  13784. * Copyright 2017 Google Inc.
  13785. *
  13786. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13787. * of this software and associated documentation files (the "Software"), to deal
  13788. * in the Software without restriction, including without limitation the rights
  13789. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13790. * copies of the Software, and to permit persons to whom the Software is
  13791. * furnished to do so, subject to the following conditions:
  13792. *
  13793. * The above copyright notice and this permission notice shall be included in
  13794. * all copies or substantial portions of the Software.
  13795. *
  13796. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13797. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13798. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13799. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13800. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13801. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13802. * THE SOFTWARE.
  13803. */
  13804. var __extends = this && this.__extends || function () {
  13805. var _extendStatics = function extendStatics(d, b) {
  13806. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13807. d.__proto__ = b;
  13808. } || function (d, b) {
  13809. for (var p in b) {
  13810. if (b.hasOwnProperty(p)) d[p] = b[p];
  13811. }
  13812. };
  13813. return _extendStatics(d, b);
  13814. };
  13815. return function (d, b) {
  13816. _extendStatics(d, b);
  13817. function __() {
  13818. this.constructor = d;
  13819. }
  13820. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13821. };
  13822. }();
  13823. var __assign = this && this.__assign || function () {
  13824. __assign = Object.assign || function (t) {
  13825. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13826. s = arguments[i];
  13827. for (var p in s) {
  13828. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13829. }
  13830. }
  13831. return t;
  13832. };
  13833. return __assign.apply(this, arguments);
  13834. };
  13835. Object.defineProperty(exports, "__esModule", { value: true });
  13836. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  13837. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  13838. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  13839. var DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart'];
  13840. var UP_EVENTS = ['mouseup', 'pointerup', 'touchend'];
  13841. var MOVE_EVENT_MAP = {
  13842. mousedown: 'mousemove',
  13843. pointerdown: 'pointermove',
  13844. touchstart: 'touchmove'
  13845. };
  13846. var KEY_IDS = {
  13847. ARROW_DOWN: 'ArrowDown',
  13848. ARROW_LEFT: 'ArrowLeft',
  13849. ARROW_RIGHT: 'ArrowRight',
  13850. ARROW_UP: 'ArrowUp',
  13851. END: 'End',
  13852. HOME: 'Home',
  13853. PAGE_DOWN: 'PageDown',
  13854. PAGE_UP: 'PageUp'
  13855. };
  13856. var MDCSliderFoundation = /** @class */function (_super) {
  13857. __extends(MDCSliderFoundation, _super);
  13858. function MDCSliderFoundation(adapter) {
  13859. var _this = _super.call(this, __assign({}, MDCSliderFoundation.defaultAdapter, adapter)) || this;
  13860. /**
  13861. * We set this to NaN since we want it to be a number, but we can't use '0' or '-1'
  13862. * because those could be valid tabindices set by the client code.
  13863. */
  13864. _this.savedTabIndex_ = NaN;
  13865. _this.active_ = false;
  13866. _this.inTransit_ = false;
  13867. _this.isDiscrete_ = false;
  13868. _this.hasTrackMarker_ = false;
  13869. _this.handlingThumbTargetEvt_ = false;
  13870. _this.min_ = 0;
  13871. _this.max_ = 100;
  13872. _this.step_ = 0;
  13873. _this.value_ = 0;
  13874. _this.disabled_ = false;
  13875. _this.preventFocusState_ = false;
  13876. _this.thumbContainerPointerHandler_ = function () {
  13877. return _this.handlingThumbTargetEvt_ = true;
  13878. };
  13879. _this.interactionStartHandler_ = function (evt) {
  13880. return _this.handleDown_(evt);
  13881. };
  13882. _this.keydownHandler_ = function (evt) {
  13883. return _this.handleKeydown_(evt);
  13884. };
  13885. _this.focusHandler_ = function () {
  13886. return _this.handleFocus_();
  13887. };
  13888. _this.blurHandler_ = function () {
  13889. return _this.handleBlur_();
  13890. };
  13891. _this.resizeHandler_ = function () {
  13892. return _this.layout();
  13893. };
  13894. return _this;
  13895. }
  13896. Object.defineProperty(MDCSliderFoundation, "cssClasses", {
  13897. get: function get() {
  13898. return constants_1.cssClasses;
  13899. },
  13900. enumerable: true,
  13901. configurable: true
  13902. });
  13903. Object.defineProperty(MDCSliderFoundation, "strings", {
  13904. get: function get() {
  13905. return constants_1.strings;
  13906. },
  13907. enumerable: true,
  13908. configurable: true
  13909. });
  13910. Object.defineProperty(MDCSliderFoundation, "numbers", {
  13911. get: function get() {
  13912. return constants_1.numbers;
  13913. },
  13914. enumerable: true,
  13915. configurable: true
  13916. });
  13917. Object.defineProperty(MDCSliderFoundation, "defaultAdapter", {
  13918. get: function get() {
  13919. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  13920. return {
  13921. hasClass: function hasClass() {
  13922. return false;
  13923. },
  13924. addClass: function addClass() {
  13925. return undefined;
  13926. },
  13927. removeClass: function removeClass() {
  13928. return undefined;
  13929. },
  13930. getAttribute: function getAttribute() {
  13931. return null;
  13932. },
  13933. setAttribute: function setAttribute() {
  13934. return undefined;
  13935. },
  13936. removeAttribute: function removeAttribute() {
  13937. return undefined;
  13938. },
  13939. computeBoundingRect: function computeBoundingRect() {
  13940. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  13941. },
  13942. getTabIndex: function getTabIndex() {
  13943. return 0;
  13944. },
  13945. registerInteractionHandler: function registerInteractionHandler() {
  13946. return undefined;
  13947. },
  13948. deregisterInteractionHandler: function deregisterInteractionHandler() {
  13949. return undefined;
  13950. },
  13951. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() {
  13952. return undefined;
  13953. },
  13954. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() {
  13955. return undefined;
  13956. },
  13957. registerBodyInteractionHandler: function registerBodyInteractionHandler() {
  13958. return undefined;
  13959. },
  13960. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() {
  13961. return undefined;
  13962. },
  13963. registerResizeHandler: function registerResizeHandler() {
  13964. return undefined;
  13965. },
  13966. deregisterResizeHandler: function deregisterResizeHandler() {
  13967. return undefined;
  13968. },
  13969. notifyInput: function notifyInput() {
  13970. return undefined;
  13971. },
  13972. notifyChange: function notifyChange() {
  13973. return undefined;
  13974. },
  13975. setThumbContainerStyleProperty: function setThumbContainerStyleProperty() {
  13976. return undefined;
  13977. },
  13978. setTrackStyleProperty: function setTrackStyleProperty() {
  13979. return undefined;
  13980. },
  13981. setMarkerValue: function setMarkerValue() {
  13982. return undefined;
  13983. },
  13984. appendTrackMarkers: function appendTrackMarkers() {
  13985. return undefined;
  13986. },
  13987. removeTrackMarkers: function removeTrackMarkers() {
  13988. return undefined;
  13989. },
  13990. setLastTrackMarkersStyleProperty: function setLastTrackMarkersStyleProperty() {
  13991. return undefined;
  13992. },
  13993. isRTL: function isRTL() {
  13994. return false;
  13995. }
  13996. };
  13997. // tslint:enable:object-literal-sort-keys
  13998. },
  13999. enumerable: true,
  14000. configurable: true
  14001. });
  14002. MDCSliderFoundation.prototype.init = function () {
  14003. var _this = this;
  14004. this.isDiscrete_ = this.adapter_.hasClass(constants_1.cssClasses.IS_DISCRETE);
  14005. this.hasTrackMarker_ = this.adapter_.hasClass(constants_1.cssClasses.HAS_TRACK_MARKER);
  14006. DOWN_EVENTS.forEach(function (evtName) {
  14007. _this.adapter_.registerInteractionHandler(evtName, _this.interactionStartHandler_);
  14008. _this.adapter_.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  14009. });
  14010. this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_);
  14011. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  14012. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  14013. this.adapter_.registerResizeHandler(this.resizeHandler_);
  14014. this.layout();
  14015. // At last step, provide a reasonable default value to discrete slider
  14016. if (this.isDiscrete_ && this.getStep() === 0) {
  14017. this.step_ = 1;
  14018. }
  14019. };
  14020. MDCSliderFoundation.prototype.destroy = function () {
  14021. var _this = this;
  14022. DOWN_EVENTS.forEach(function (evtName) {
  14023. _this.adapter_.deregisterInteractionHandler(evtName, _this.interactionStartHandler_);
  14024. _this.adapter_.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  14025. });
  14026. this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_);
  14027. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  14028. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  14029. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  14030. };
  14031. MDCSliderFoundation.prototype.setupTrackMarker = function () {
  14032. if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) {
  14033. var min = this.getMin();
  14034. var max = this.getMax();
  14035. var step = this.getStep();
  14036. var numMarkers = (max - min) / step;
  14037. // In case distance between max & min is indivisible to step,
  14038. // we place the secondary to last marker proportionally at where thumb
  14039. // could reach and place the last marker at max value
  14040. var indivisible = Math.ceil(numMarkers) !== numMarkers;
  14041. if (indivisible) {
  14042. numMarkers = Math.ceil(numMarkers);
  14043. }
  14044. this.adapter_.removeTrackMarkers();
  14045. this.adapter_.appendTrackMarkers(numMarkers);
  14046. if (indivisible) {
  14047. var lastStepRatio = (max - numMarkers * step) / step + 1;
  14048. this.adapter_.setLastTrackMarkersStyleProperty('flex-grow', String(lastStepRatio));
  14049. }
  14050. }
  14051. };
  14052. MDCSliderFoundation.prototype.layout = function () {
  14053. this.rect_ = this.adapter_.computeBoundingRect();
  14054. this.updateUIForCurrentValue_();
  14055. };
  14056. MDCSliderFoundation.prototype.getValue = function () {
  14057. return this.value_;
  14058. };
  14059. MDCSliderFoundation.prototype.setValue = function (value) {
  14060. this.setValue_(value, false);
  14061. };
  14062. MDCSliderFoundation.prototype.getMax = function () {
  14063. return this.max_;
  14064. };
  14065. MDCSliderFoundation.prototype.setMax = function (max) {
  14066. if (max < this.min_) {
  14067. throw new Error('Cannot set max to be less than the slider\'s minimum value');
  14068. }
  14069. this.max_ = max;
  14070. this.setValue_(this.value_, false, true);
  14071. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMAX, String(this.max_));
  14072. this.setupTrackMarker();
  14073. };
  14074. MDCSliderFoundation.prototype.getMin = function () {
  14075. return this.min_;
  14076. };
  14077. MDCSliderFoundation.prototype.setMin = function (min) {
  14078. if (min > this.max_) {
  14079. throw new Error('Cannot set min to be greater than the slider\'s maximum value');
  14080. }
  14081. this.min_ = min;
  14082. this.setValue_(this.value_, false, true);
  14083. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMIN, String(this.min_));
  14084. this.setupTrackMarker();
  14085. };
  14086. MDCSliderFoundation.prototype.getStep = function () {
  14087. return this.step_;
  14088. };
  14089. MDCSliderFoundation.prototype.setStep = function (step) {
  14090. if (step < 0) {
  14091. throw new Error('Step cannot be set to a negative number');
  14092. }
  14093. if (this.isDiscrete_ && (typeof step !== 'number' || step < 1)) {
  14094. step = 1;
  14095. }
  14096. this.step_ = step;
  14097. this.setValue_(this.value_, false, true);
  14098. this.setupTrackMarker();
  14099. };
  14100. MDCSliderFoundation.prototype.isDisabled = function () {
  14101. return this.disabled_;
  14102. };
  14103. MDCSliderFoundation.prototype.setDisabled = function (disabled) {
  14104. this.disabled_ = disabled;
  14105. this.toggleClass_(constants_1.cssClasses.DISABLED, this.disabled_);
  14106. if (this.disabled_) {
  14107. this.savedTabIndex_ = this.adapter_.getTabIndex();
  14108. this.adapter_.setAttribute(constants_1.strings.ARIA_DISABLED, 'true');
  14109. this.adapter_.removeAttribute('tabindex');
  14110. } else {
  14111. this.adapter_.removeAttribute(constants_1.strings.ARIA_DISABLED);
  14112. if (!isNaN(this.savedTabIndex_)) {
  14113. this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_));
  14114. }
  14115. }
  14116. };
  14117. /**
  14118. * Called when the user starts interacting with the slider
  14119. */
  14120. MDCSliderFoundation.prototype.handleDown_ = function (downEvent) {
  14121. var _this = this;
  14122. if (this.disabled_) {
  14123. return;
  14124. }
  14125. this.preventFocusState_ = true;
  14126. this.setInTransit_(!this.handlingThumbTargetEvt_);
  14127. this.handlingThumbTargetEvt_ = false;
  14128. this.setActive_(true);
  14129. var moveHandler = function moveHandler(moveEvent) {
  14130. _this.handleMove_(moveEvent);
  14131. };
  14132. var moveEventType = MOVE_EVENT_MAP[downEvent.type];
  14133. // Note: upHandler is [de]registered on ALL potential pointer-related release event types, since some browsers
  14134. // do not always fire these consistently in pairs.
  14135. // (See https://github.com/material-components/material-components-web/issues/1192)
  14136. var upHandler = function upHandler() {
  14137. _this.handleUp_();
  14138. _this.adapter_.deregisterBodyInteractionHandler(moveEventType, moveHandler);
  14139. UP_EVENTS.forEach(function (evtName) {
  14140. return _this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler);
  14141. });
  14142. };
  14143. this.adapter_.registerBodyInteractionHandler(moveEventType, moveHandler);
  14144. UP_EVENTS.forEach(function (evtName) {
  14145. return _this.adapter_.registerBodyInteractionHandler(evtName, upHandler);
  14146. });
  14147. this.setValueFromEvt_(downEvent);
  14148. };
  14149. /**
  14150. * Called when the user moves the slider
  14151. */
  14152. MDCSliderFoundation.prototype.handleMove_ = function (evt) {
  14153. evt.preventDefault();
  14154. this.setValueFromEvt_(evt);
  14155. };
  14156. /**
  14157. * Called when the user's interaction with the slider ends
  14158. */
  14159. MDCSliderFoundation.prototype.handleUp_ = function () {
  14160. this.setActive_(false);
  14161. this.adapter_.notifyChange();
  14162. };
  14163. /**
  14164. * Returns the pageX of the event
  14165. */
  14166. MDCSliderFoundation.prototype.getPageX_ = function (evt) {
  14167. if (evt.targetTouches && evt.targetTouches.length > 0) {
  14168. return evt.targetTouches[0].pageX;
  14169. }
  14170. return evt.pageX;
  14171. };
  14172. /**
  14173. * Sets the slider value from an event
  14174. */
  14175. MDCSliderFoundation.prototype.setValueFromEvt_ = function (evt) {
  14176. var pageX = this.getPageX_(evt);
  14177. var value = this.computeValueFromPageX_(pageX);
  14178. this.setValue_(value, true);
  14179. };
  14180. /**
  14181. * Computes the new value from the pageX position
  14182. */
  14183. MDCSliderFoundation.prototype.computeValueFromPageX_ = function (pageX) {
  14184. var _a = this,
  14185. max = _a.max_,
  14186. min = _a.min_;
  14187. var xPos = pageX - this.rect_.left;
  14188. var pctComplete = xPos / this.rect_.width;
  14189. if (this.adapter_.isRTL()) {
  14190. pctComplete = 1 - pctComplete;
  14191. }
  14192. // Fit the percentage complete between the range [min,max]
  14193. // by remapping from [0, 1] to [min, min+(max-min)].
  14194. return min + pctComplete * (max - min);
  14195. };
  14196. /**
  14197. * Handles keydown events
  14198. */
  14199. MDCSliderFoundation.prototype.handleKeydown_ = function (evt) {
  14200. var keyId = this.getKeyId_(evt);
  14201. var value = this.getValueForKeyId_(keyId);
  14202. if (isNaN(value)) {
  14203. return;
  14204. }
  14205. // Prevent page from scrolling due to key presses that would normally scroll the page
  14206. evt.preventDefault();
  14207. this.adapter_.addClass(constants_1.cssClasses.FOCUS);
  14208. this.setValue_(value, true);
  14209. this.adapter_.notifyChange();
  14210. };
  14211. /**
  14212. * Returns the computed name of the event
  14213. */
  14214. MDCSliderFoundation.prototype.getKeyId_ = function (kbdEvt) {
  14215. if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) {
  14216. return KEY_IDS.ARROW_LEFT;
  14217. }
  14218. if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) {
  14219. return KEY_IDS.ARROW_RIGHT;
  14220. }
  14221. if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) {
  14222. return KEY_IDS.ARROW_UP;
  14223. }
  14224. if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) {
  14225. return KEY_IDS.ARROW_DOWN;
  14226. }
  14227. if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) {
  14228. return KEY_IDS.HOME;
  14229. }
  14230. if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) {
  14231. return KEY_IDS.END;
  14232. }
  14233. if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) {
  14234. return KEY_IDS.PAGE_UP;
  14235. }
  14236. if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) {
  14237. return KEY_IDS.PAGE_DOWN;
  14238. }
  14239. return '';
  14240. };
  14241. /**
  14242. * Computes the value given a keyboard key ID
  14243. */
  14244. MDCSliderFoundation.prototype.getValueForKeyId_ = function (keyId) {
  14245. var _a = this,
  14246. max = _a.max_,
  14247. min = _a.min_,
  14248. step = _a.step_;
  14249. var delta = step || (max - min) / 100;
  14250. var valueNeedsToBeFlipped = this.adapter_.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT);
  14251. if (valueNeedsToBeFlipped) {
  14252. delta = -delta;
  14253. }
  14254. switch (keyId) {
  14255. case KEY_IDS.ARROW_LEFT:
  14256. case KEY_IDS.ARROW_DOWN:
  14257. return this.value_ - delta;
  14258. case KEY_IDS.ARROW_RIGHT:
  14259. case KEY_IDS.ARROW_UP:
  14260. return this.value_ + delta;
  14261. case KEY_IDS.HOME:
  14262. return this.min_;
  14263. case KEY_IDS.END:
  14264. return this.max_;
  14265. case KEY_IDS.PAGE_UP:
  14266. return this.value_ + delta * constants_1.numbers.PAGE_FACTOR;
  14267. case KEY_IDS.PAGE_DOWN:
  14268. return this.value_ - delta * constants_1.numbers.PAGE_FACTOR;
  14269. default:
  14270. return NaN;
  14271. }
  14272. };
  14273. MDCSliderFoundation.prototype.handleFocus_ = function () {
  14274. if (this.preventFocusState_) {
  14275. return;
  14276. }
  14277. this.adapter_.addClass(constants_1.cssClasses.FOCUS);
  14278. };
  14279. MDCSliderFoundation.prototype.handleBlur_ = function () {
  14280. this.preventFocusState_ = false;
  14281. this.adapter_.removeClass(constants_1.cssClasses.FOCUS);
  14282. };
  14283. /**
  14284. * Sets the value of the slider
  14285. */
  14286. MDCSliderFoundation.prototype.setValue_ = function (value, shouldFireInput, force) {
  14287. if (force === void 0) {
  14288. force = false;
  14289. }
  14290. if (value === this.value_ && !force) {
  14291. return;
  14292. }
  14293. var _a = this,
  14294. min = _a.min_,
  14295. max = _a.max_;
  14296. var valueSetToBoundary = value === min || value === max;
  14297. if (this.step_ && !valueSetToBoundary) {
  14298. value = this.quantize_(value);
  14299. }
  14300. if (value < min) {
  14301. value = min;
  14302. } else if (value > max) {
  14303. value = max;
  14304. }
  14305. this.value_ = value;
  14306. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, String(this.value_));
  14307. this.updateUIForCurrentValue_();
  14308. if (shouldFireInput) {
  14309. this.adapter_.notifyInput();
  14310. if (this.isDiscrete_) {
  14311. this.adapter_.setMarkerValue(value);
  14312. }
  14313. }
  14314. };
  14315. /**
  14316. * Calculates the quantized value
  14317. */
  14318. MDCSliderFoundation.prototype.quantize_ = function (value) {
  14319. var numSteps = Math.round(value / this.step_);
  14320. return numSteps * this.step_;
  14321. };
  14322. MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function () {
  14323. var _this = this;
  14324. var _a = this,
  14325. max = _a.max_,
  14326. min = _a.min_,
  14327. value = _a.value_;
  14328. var pctComplete = (value - min) / (max - min);
  14329. var translatePx = pctComplete * this.rect_.width;
  14330. if (this.adapter_.isRTL()) {
  14331. translatePx = this.rect_.width - translatePx;
  14332. }
  14333. var transformProp = util_1.getCorrectPropertyName(window, 'transform');
  14334. var transitionendEvtName = util_1.getCorrectEventName(window, 'transitionend');
  14335. if (this.inTransit_) {
  14336. var onTransitionEnd_1 = function onTransitionEnd_1() {
  14337. _this.setInTransit_(false);
  14338. _this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  14339. };
  14340. this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  14341. }
  14342. requestAnimationFrame(function () {
  14343. // NOTE(traviskaufman): It would be nice to use calc() here,
  14344. // but IE cannot handle calcs in transforms correctly.
  14345. // See: https://goo.gl/NC2itk
  14346. // Also note that the -50% offset is used to center the slider thumb.
  14347. _this.adapter_.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)");
  14348. _this.adapter_.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
  14349. });
  14350. };
  14351. /**
  14352. * Toggles the active state of the slider
  14353. */
  14354. MDCSliderFoundation.prototype.setActive_ = function (active) {
  14355. this.active_ = active;
  14356. this.toggleClass_(constants_1.cssClasses.ACTIVE, this.active_);
  14357. };
  14358. /**
  14359. * Toggles the inTransit state of the slider
  14360. */
  14361. MDCSliderFoundation.prototype.setInTransit_ = function (inTransit) {
  14362. this.inTransit_ = inTransit;
  14363. this.toggleClass_(constants_1.cssClasses.IN_TRANSIT, this.inTransit_);
  14364. };
  14365. /**
  14366. * Conditionally adds or removes a class based on shouldBePresent
  14367. */
  14368. MDCSliderFoundation.prototype.toggleClass_ = function (className, shouldBePresent) {
  14369. if (shouldBePresent) {
  14370. this.adapter_.addClass(className);
  14371. } else {
  14372. this.adapter_.removeClass(className);
  14373. }
  14374. };
  14375. return MDCSliderFoundation;
  14376. }(foundation_1.MDCFoundation);
  14377. exports.MDCSliderFoundation = MDCSliderFoundation;
  14378. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14379. exports.default = MDCSliderFoundation;
  14380. /***/ }),
  14381. /***/ "./packages/mdc-slider/index.ts":
  14382. /*!**************************************!*\
  14383. !*** ./packages/mdc-slider/index.ts ***!
  14384. \**************************************/
  14385. /*! no static exports found */
  14386. /***/ (function(module, exports, __webpack_require__) {
  14387. "use strict";
  14388. /**
  14389. * @license
  14390. * Copyright 2019 Google Inc.
  14391. *
  14392. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14393. * of this software and associated documentation files (the "Software"), to deal
  14394. * in the Software without restriction, including without limitation the rights
  14395. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14396. * copies of the Software, and to permit persons to whom the Software is
  14397. * furnished to do so, subject to the following conditions:
  14398. *
  14399. * The above copyright notice and this permission notice shall be included in
  14400. * all copies or substantial portions of the Software.
  14401. *
  14402. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14403. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14404. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14405. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14406. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14407. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14408. * THE SOFTWARE.
  14409. */
  14410. function __export(m) {
  14411. for (var p in m) {
  14412. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14413. }
  14414. }
  14415. Object.defineProperty(exports, "__esModule", { value: true });
  14416. __export(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts"));
  14417. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"));
  14418. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"));
  14419. /***/ }),
  14420. /***/ "./packages/mdc-snackbar/component.ts":
  14421. /*!********************************************!*\
  14422. !*** ./packages/mdc-snackbar/component.ts ***!
  14423. \********************************************/
  14424. /*! no static exports found */
  14425. /***/ (function(module, exports, __webpack_require__) {
  14426. "use strict";
  14427. /**
  14428. * @license
  14429. * Copyright 2018 Google Inc.
  14430. *
  14431. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14432. * of this software and associated documentation files (the "Software"), to deal
  14433. * in the Software without restriction, including without limitation the rights
  14434. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14435. * copies of the Software, and to permit persons to whom the Software is
  14436. * furnished to do so, subject to the following conditions:
  14437. *
  14438. * The above copyright notice and this permission notice shall be included in
  14439. * all copies or substantial portions of the Software.
  14440. *
  14441. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14442. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14443. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14444. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14445. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14446. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14447. * THE SOFTWARE.
  14448. */
  14449. var __extends = this && this.__extends || function () {
  14450. var _extendStatics = function extendStatics(d, b) {
  14451. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14452. d.__proto__ = b;
  14453. } || function (d, b) {
  14454. for (var p in b) {
  14455. if (b.hasOwnProperty(p)) d[p] = b[p];
  14456. }
  14457. };
  14458. return _extendStatics(d, b);
  14459. };
  14460. return function (d, b) {
  14461. _extendStatics(d, b);
  14462. function __() {
  14463. this.constructor = d;
  14464. }
  14465. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14466. };
  14467. }();
  14468. var __importStar = this && this.__importStar || function (mod) {
  14469. if (mod && mod.__esModule) return mod;
  14470. var result = {};
  14471. if (mod != null) for (var k in mod) {
  14472. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  14473. }result["default"] = mod;
  14474. return result;
  14475. };
  14476. Object.defineProperty(exports, "__esModule", { value: true });
  14477. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  14478. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  14479. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14480. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts");
  14481. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  14482. var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR,
  14483. LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR,
  14484. ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR,
  14485. DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR,
  14486. OPENING_EVENT = constants_1.strings.OPENING_EVENT,
  14487. OPENED_EVENT = constants_1.strings.OPENED_EVENT,
  14488. CLOSING_EVENT = constants_1.strings.CLOSING_EVENT,
  14489. CLOSED_EVENT = constants_1.strings.CLOSED_EVENT;
  14490. var MDCSnackbar = /** @class */function (_super) {
  14491. __extends(MDCSnackbar, _super);
  14492. function MDCSnackbar() {
  14493. return _super !== null && _super.apply(this, arguments) || this;
  14494. }
  14495. MDCSnackbar.attachTo = function (root) {
  14496. return new MDCSnackbar(root);
  14497. };
  14498. MDCSnackbar.prototype.initialize = function (announcerFactory) {
  14499. if (announcerFactory === void 0) {
  14500. announcerFactory = function announcerFactory() {
  14501. return util.announce;
  14502. };
  14503. }
  14504. this.announce_ = announcerFactory();
  14505. };
  14506. MDCSnackbar.prototype.initialSyncWithDOM = function () {
  14507. var _this = this;
  14508. this.surfaceEl_ = this.root_.querySelector(SURFACE_SELECTOR);
  14509. this.labelEl_ = this.root_.querySelector(LABEL_SELECTOR);
  14510. this.actionEl_ = this.root_.querySelector(ACTION_SELECTOR);
  14511. this.handleKeyDown_ = function (evt) {
  14512. return _this.foundation_.handleKeyDown(evt);
  14513. };
  14514. this.handleSurfaceClick_ = function (evt) {
  14515. var target = evt.target;
  14516. if (_this.isActionButton_(target)) {
  14517. _this.foundation_.handleActionButtonClick(evt);
  14518. } else if (_this.isActionIcon_(target)) {
  14519. _this.foundation_.handleActionIconClick(evt);
  14520. }
  14521. };
  14522. this.registerKeyDownHandler_(this.handleKeyDown_);
  14523. this.registerSurfaceClickHandler_(this.handleSurfaceClick_);
  14524. };
  14525. MDCSnackbar.prototype.destroy = function () {
  14526. _super.prototype.destroy.call(this);
  14527. this.deregisterKeyDownHandler_(this.handleKeyDown_);
  14528. this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_);
  14529. };
  14530. MDCSnackbar.prototype.open = function () {
  14531. this.foundation_.open();
  14532. };
  14533. /**
  14534. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  14535. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  14536. * client-specific values may also be used if desired.
  14537. */
  14538. MDCSnackbar.prototype.close = function (reason) {
  14539. if (reason === void 0) {
  14540. reason = '';
  14541. }
  14542. this.foundation_.close(reason);
  14543. };
  14544. MDCSnackbar.prototype.getDefaultFoundation = function () {
  14545. var _this = this;
  14546. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  14547. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  14548. var adapter = {
  14549. addClass: function addClass(className) {
  14550. return _this.root_.classList.add(className);
  14551. },
  14552. announce: function announce() {
  14553. return _this.announce_(_this.labelEl_);
  14554. },
  14555. notifyClosed: function notifyClosed(reason) {
  14556. return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {});
  14557. },
  14558. notifyClosing: function notifyClosing(reason) {
  14559. return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {});
  14560. },
  14561. notifyOpened: function notifyOpened() {
  14562. return _this.emit(OPENED_EVENT, {});
  14563. },
  14564. notifyOpening: function notifyOpening() {
  14565. return _this.emit(OPENING_EVENT, {});
  14566. },
  14567. removeClass: function removeClass(className) {
  14568. return _this.root_.classList.remove(className);
  14569. }
  14570. };
  14571. return new foundation_1.MDCSnackbarFoundation(adapter);
  14572. };
  14573. Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
  14574. get: function get() {
  14575. return this.foundation_.getTimeoutMs();
  14576. },
  14577. set: function set(timeoutMs) {
  14578. this.foundation_.setTimeoutMs(timeoutMs);
  14579. },
  14580. enumerable: true,
  14581. configurable: true
  14582. });
  14583. Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
  14584. get: function get() {
  14585. return this.foundation_.getCloseOnEscape();
  14586. },
  14587. set: function set(closeOnEscape) {
  14588. this.foundation_.setCloseOnEscape(closeOnEscape);
  14589. },
  14590. enumerable: true,
  14591. configurable: true
  14592. });
  14593. Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
  14594. get: function get() {
  14595. return this.foundation_.isOpen();
  14596. },
  14597. enumerable: true,
  14598. configurable: true
  14599. });
  14600. Object.defineProperty(MDCSnackbar.prototype, "labelText", {
  14601. get: function get() {
  14602. // This property only returns null if the node is a document, DOCTYPE, or notation.
  14603. // On Element nodes, it always returns a string.
  14604. return this.labelEl_.textContent;
  14605. },
  14606. set: function set(labelText) {
  14607. this.labelEl_.textContent = labelText;
  14608. },
  14609. enumerable: true,
  14610. configurable: true
  14611. });
  14612. Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
  14613. get: function get() {
  14614. return this.actionEl_.textContent;
  14615. },
  14616. set: function set(actionButtonText) {
  14617. this.actionEl_.textContent = actionButtonText;
  14618. },
  14619. enumerable: true,
  14620. configurable: true
  14621. });
  14622. MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) {
  14623. this.listen('keydown', handler);
  14624. };
  14625. MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) {
  14626. this.unlisten('keydown', handler);
  14627. };
  14628. MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) {
  14629. this.surfaceEl_.addEventListener('click', handler);
  14630. };
  14631. MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) {
  14632. this.surfaceEl_.removeEventListener('click', handler);
  14633. };
  14634. MDCSnackbar.prototype.isActionButton_ = function (target) {
  14635. return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR));
  14636. };
  14637. MDCSnackbar.prototype.isActionIcon_ = function (target) {
  14638. return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR));
  14639. };
  14640. return MDCSnackbar;
  14641. }(component_1.MDCComponent);
  14642. exports.MDCSnackbar = MDCSnackbar;
  14643. /***/ }),
  14644. /***/ "./packages/mdc-snackbar/constants.ts":
  14645. /*!********************************************!*\
  14646. !*** ./packages/mdc-snackbar/constants.ts ***!
  14647. \********************************************/
  14648. /*! no static exports found */
  14649. /***/ (function(module, exports, __webpack_require__) {
  14650. "use strict";
  14651. /**
  14652. * @license
  14653. * Copyright 2018 Google Inc.
  14654. *
  14655. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14656. * of this software and associated documentation files (the "Software"), to deal
  14657. * in the Software without restriction, including without limitation the rights
  14658. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14659. * copies of the Software, and to permit persons to whom the Software is
  14660. * furnished to do so, subject to the following conditions:
  14661. *
  14662. * The above copyright notice and this permission notice shall be included in
  14663. * all copies or substantial portions of the Software.
  14664. *
  14665. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14666. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14667. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14668. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14669. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14670. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14671. * THE SOFTWARE.
  14672. */
  14673. Object.defineProperty(exports, "__esModule", { value: true });
  14674. var cssClasses = {
  14675. CLOSING: 'mdc-snackbar--closing',
  14676. OPEN: 'mdc-snackbar--open',
  14677. OPENING: 'mdc-snackbar--opening'
  14678. };
  14679. exports.cssClasses = cssClasses;
  14680. var strings = {
  14681. ACTION_SELECTOR: '.mdc-snackbar__action',
  14682. ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',
  14683. CLOSED_EVENT: 'MDCSnackbar:closed',
  14684. CLOSING_EVENT: 'MDCSnackbar:closing',
  14685. DISMISS_SELECTOR: '.mdc-snackbar__dismiss',
  14686. LABEL_SELECTOR: '.mdc-snackbar__label',
  14687. OPENED_EVENT: 'MDCSnackbar:opened',
  14688. OPENING_EVENT: 'MDCSnackbar:opening',
  14689. REASON_ACTION: 'action',
  14690. REASON_DISMISS: 'dismiss',
  14691. SURFACE_SELECTOR: '.mdc-snackbar__surface'
  14692. };
  14693. exports.strings = strings;
  14694. var numbers = {
  14695. DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,
  14696. MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,
  14697. MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,
  14698. // These variables need to be kept in sync with the values in _variables.scss.
  14699. SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,
  14700. SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,
  14701. /**
  14702. * Number of milliseconds to wait between temporarily clearing the label text
  14703. * in the DOM and subsequently restoring it. This is necessary to force IE 11
  14704. * to pick up the `aria-live` content change and announce it to the user.
  14705. */
  14706. ARIA_LIVE_DELAY_MS: 1000
  14707. };
  14708. exports.numbers = numbers;
  14709. /***/ }),
  14710. /***/ "./packages/mdc-snackbar/foundation.ts":
  14711. /*!*********************************************!*\
  14712. !*** ./packages/mdc-snackbar/foundation.ts ***!
  14713. \*********************************************/
  14714. /*! no static exports found */
  14715. /***/ (function(module, exports, __webpack_require__) {
  14716. "use strict";
  14717. /**
  14718. * @license
  14719. * Copyright 2018 Google Inc.
  14720. *
  14721. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14722. * of this software and associated documentation files (the "Software"), to deal
  14723. * in the Software without restriction, including without limitation the rights
  14724. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14725. * copies of the Software, and to permit persons to whom the Software is
  14726. * furnished to do so, subject to the following conditions:
  14727. *
  14728. * The above copyright notice and this permission notice shall be included in
  14729. * all copies or substantial portions of the Software.
  14730. *
  14731. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14732. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14733. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14734. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14735. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14736. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14737. * THE SOFTWARE.
  14738. */
  14739. var __extends = this && this.__extends || function () {
  14740. var _extendStatics = function extendStatics(d, b) {
  14741. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14742. d.__proto__ = b;
  14743. } || function (d, b) {
  14744. for (var p in b) {
  14745. if (b.hasOwnProperty(p)) d[p] = b[p];
  14746. }
  14747. };
  14748. return _extendStatics(d, b);
  14749. };
  14750. return function (d, b) {
  14751. _extendStatics(d, b);
  14752. function __() {
  14753. this.constructor = d;
  14754. }
  14755. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14756. };
  14757. }();
  14758. var __assign = this && this.__assign || function () {
  14759. __assign = Object.assign || function (t) {
  14760. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14761. s = arguments[i];
  14762. for (var p in s) {
  14763. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14764. }
  14765. }
  14766. return t;
  14767. };
  14768. return __assign.apply(this, arguments);
  14769. };
  14770. Object.defineProperty(exports, "__esModule", { value: true });
  14771. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  14772. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14773. var OPENING = constants_1.cssClasses.OPENING,
  14774. OPEN = constants_1.cssClasses.OPEN,
  14775. CLOSING = constants_1.cssClasses.CLOSING;
  14776. var REASON_ACTION = constants_1.strings.REASON_ACTION,
  14777. REASON_DISMISS = constants_1.strings.REASON_DISMISS;
  14778. var MDCSnackbarFoundation = /** @class */function (_super) {
  14779. __extends(MDCSnackbarFoundation, _super);
  14780. function MDCSnackbarFoundation(adapter) {
  14781. var _this = _super.call(this, __assign({}, MDCSnackbarFoundation.defaultAdapter, adapter)) || this;
  14782. _this.isOpen_ = false;
  14783. _this.animationFrame_ = 0;
  14784. _this.animationTimer_ = 0;
  14785. _this.autoDismissTimer_ = 0;
  14786. _this.autoDismissTimeoutMs_ = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
  14787. _this.closeOnEscape_ = true;
  14788. return _this;
  14789. }
  14790. Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
  14791. get: function get() {
  14792. return constants_1.cssClasses;
  14793. },
  14794. enumerable: true,
  14795. configurable: true
  14796. });
  14797. Object.defineProperty(MDCSnackbarFoundation, "strings", {
  14798. get: function get() {
  14799. return constants_1.strings;
  14800. },
  14801. enumerable: true,
  14802. configurable: true
  14803. });
  14804. Object.defineProperty(MDCSnackbarFoundation, "numbers", {
  14805. get: function get() {
  14806. return constants_1.numbers;
  14807. },
  14808. enumerable: true,
  14809. configurable: true
  14810. });
  14811. Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
  14812. get: function get() {
  14813. return {
  14814. addClass: function addClass() {
  14815. return undefined;
  14816. },
  14817. announce: function announce() {
  14818. return undefined;
  14819. },
  14820. notifyClosed: function notifyClosed() {
  14821. return undefined;
  14822. },
  14823. notifyClosing: function notifyClosing() {
  14824. return undefined;
  14825. },
  14826. notifyOpened: function notifyOpened() {
  14827. return undefined;
  14828. },
  14829. notifyOpening: function notifyOpening() {
  14830. return undefined;
  14831. },
  14832. removeClass: function removeClass() {
  14833. return undefined;
  14834. }
  14835. };
  14836. },
  14837. enumerable: true,
  14838. configurable: true
  14839. });
  14840. MDCSnackbarFoundation.prototype.destroy = function () {
  14841. this.clearAutoDismissTimer_();
  14842. cancelAnimationFrame(this.animationFrame_);
  14843. this.animationFrame_ = 0;
  14844. clearTimeout(this.animationTimer_);
  14845. this.animationTimer_ = 0;
  14846. this.adapter_.removeClass(OPENING);
  14847. this.adapter_.removeClass(OPEN);
  14848. this.adapter_.removeClass(CLOSING);
  14849. };
  14850. MDCSnackbarFoundation.prototype.open = function () {
  14851. var _this = this;
  14852. this.clearAutoDismissTimer_();
  14853. this.isOpen_ = true;
  14854. this.adapter_.notifyOpening();
  14855. this.adapter_.removeClass(CLOSING);
  14856. this.adapter_.addClass(OPENING);
  14857. this.adapter_.announce();
  14858. // Wait a frame once display is no longer "none", to establish basis for animation
  14859. this.runNextAnimationFrame_(function () {
  14860. _this.adapter_.addClass(OPEN);
  14861. _this.animationTimer_ = setTimeout(function () {
  14862. _this.handleAnimationTimerEnd_();
  14863. _this.adapter_.notifyOpened();
  14864. _this.autoDismissTimer_ = setTimeout(function () {
  14865. _this.close(REASON_DISMISS);
  14866. }, _this.getTimeoutMs());
  14867. }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
  14868. });
  14869. };
  14870. /**
  14871. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  14872. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  14873. * client-specific values may also be used if desired.
  14874. */
  14875. MDCSnackbarFoundation.prototype.close = function (reason) {
  14876. var _this = this;
  14877. if (reason === void 0) {
  14878. reason = '';
  14879. }
  14880. if (!this.isOpen_) {
  14881. // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed
  14882. return;
  14883. }
  14884. cancelAnimationFrame(this.animationFrame_);
  14885. this.animationFrame_ = 0;
  14886. this.clearAutoDismissTimer_();
  14887. this.isOpen_ = false;
  14888. this.adapter_.notifyClosing(reason);
  14889. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  14890. this.adapter_.removeClass(constants_1.cssClasses.OPEN);
  14891. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  14892. clearTimeout(this.animationTimer_);
  14893. this.animationTimer_ = setTimeout(function () {
  14894. _this.handleAnimationTimerEnd_();
  14895. _this.adapter_.notifyClosed(reason);
  14896. }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
  14897. };
  14898. MDCSnackbarFoundation.prototype.isOpen = function () {
  14899. return this.isOpen_;
  14900. };
  14901. MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
  14902. return this.autoDismissTimeoutMs_;
  14903. };
  14904. MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
  14905. // Use shorter variable names to make the code more readable
  14906. var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
  14907. var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
  14908. if (timeoutMs <= maxValue && timeoutMs >= minValue) {
  14909. this.autoDismissTimeoutMs_ = timeoutMs;
  14910. } else {
  14911. throw new Error("timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + ", but got '" + timeoutMs + "'");
  14912. }
  14913. };
  14914. MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
  14915. return this.closeOnEscape_;
  14916. };
  14917. MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
  14918. this.closeOnEscape_ = closeOnEscape;
  14919. };
  14920. MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
  14921. var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
  14922. if (isEscapeKey && this.getCloseOnEscape()) {
  14923. this.close(REASON_DISMISS);
  14924. }
  14925. };
  14926. MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
  14927. this.close(REASON_ACTION);
  14928. };
  14929. MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
  14930. this.close(REASON_DISMISS);
  14931. };
  14932. MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () {
  14933. clearTimeout(this.autoDismissTimer_);
  14934. this.autoDismissTimer_ = 0;
  14935. };
  14936. MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () {
  14937. this.animationTimer_ = 0;
  14938. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  14939. this.adapter_.removeClass(constants_1.cssClasses.CLOSING);
  14940. };
  14941. /**
  14942. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  14943. */
  14944. MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  14945. var _this = this;
  14946. cancelAnimationFrame(this.animationFrame_);
  14947. this.animationFrame_ = requestAnimationFrame(function () {
  14948. _this.animationFrame_ = 0;
  14949. clearTimeout(_this.animationTimer_);
  14950. _this.animationTimer_ = setTimeout(callback, 0);
  14951. });
  14952. };
  14953. return MDCSnackbarFoundation;
  14954. }(foundation_1.MDCFoundation);
  14955. exports.MDCSnackbarFoundation = MDCSnackbarFoundation;
  14956. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14957. exports.default = MDCSnackbarFoundation;
  14958. /***/ }),
  14959. /***/ "./packages/mdc-snackbar/index.ts":
  14960. /*!****************************************!*\
  14961. !*** ./packages/mdc-snackbar/index.ts ***!
  14962. \****************************************/
  14963. /*! no static exports found */
  14964. /***/ (function(module, exports, __webpack_require__) {
  14965. "use strict";
  14966. /**
  14967. * @license
  14968. * Copyright 2019 Google Inc.
  14969. *
  14970. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14971. * of this software and associated documentation files (the "Software"), to deal
  14972. * in the Software without restriction, including without limitation the rights
  14973. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14974. * copies of the Software, and to permit persons to whom the Software is
  14975. * furnished to do so, subject to the following conditions:
  14976. *
  14977. * The above copyright notice and this permission notice shall be included in
  14978. * all copies or substantial portions of the Software.
  14979. *
  14980. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14981. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14982. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14983. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14984. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14985. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14986. * THE SOFTWARE.
  14987. */
  14988. function __export(m) {
  14989. for (var p in m) {
  14990. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14991. }
  14992. }
  14993. var __importStar = this && this.__importStar || function (mod) {
  14994. if (mod && mod.__esModule) return mod;
  14995. var result = {};
  14996. if (mod != null) for (var k in mod) {
  14997. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  14998. }result["default"] = mod;
  14999. return result;
  15000. };
  15001. Object.defineProperty(exports, "__esModule", { value: true });
  15002. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  15003. exports.util = util;
  15004. __export(__webpack_require__(/*! ./component */ "./packages/mdc-snackbar/component.ts"));
  15005. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"));
  15006. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"));
  15007. /***/ }),
  15008. /***/ "./packages/mdc-snackbar/util.ts":
  15009. /*!***************************************!*\
  15010. !*** ./packages/mdc-snackbar/util.ts ***!
  15011. \***************************************/
  15012. /*! no static exports found */
  15013. /***/ (function(module, exports, __webpack_require__) {
  15014. "use strict";
  15015. /**
  15016. * @license
  15017. * Copyright 2018 Google Inc.
  15018. *
  15019. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15020. * of this software and associated documentation files (the "Software"), to deal
  15021. * in the Software without restriction, including without limitation the rights
  15022. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15023. * copies of the Software, and to permit persons to whom the Software is
  15024. * furnished to do so, subject to the following conditions:
  15025. *
  15026. * The above copyright notice and this permission notice shall be included in
  15027. * all copies or substantial portions of the Software.
  15028. *
  15029. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15030. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15031. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15032. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15033. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15034. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15035. * THE SOFTWARE.
  15036. */
  15037. Object.defineProperty(exports, "__esModule", { value: true });
  15038. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  15039. var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS;
  15040. var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR;
  15041. function announce(ariaEl, labelEl) {
  15042. if (labelEl === void 0) {
  15043. labelEl = ariaEl;
  15044. }
  15045. var priority = ariaEl.getAttribute('aria-live');
  15046. // Trim text to ignore `&nbsp;` (see below).
  15047. // textContent is only null if the node is a document, DOCTYPE, or notation.
  15048. var labelText = labelEl.textContent.trim();
  15049. if (!labelText || !priority) {
  15050. return;
  15051. }
  15052. // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice.
  15053. ariaEl.setAttribute('aria-live', 'off');
  15054. // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers.
  15055. // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars
  15056. // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first.
  15057. // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event,
  15058. // so screen readers won't announce the second message unless we first clear `textContent`.
  15059. //
  15060. // We have to clear the label text two different ways to make it work in all browsers and screen readers:
  15061. //
  15062. // 1. `textContent = ''` is required for IE11 + JAWS
  15063. // 2. `innerHTML = '&nbsp;'` is required for Chrome + JAWS and NVDA
  15064. //
  15065. // All other browser/screen reader combinations support both methods.
  15066. //
  15067. // The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed.
  15068. // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change.
  15069. //
  15070. // This technique has been tested in:
  15071. //
  15072. // * JAWS 2019:
  15073. // - Chrome 70
  15074. // - Firefox 60 (ESR)
  15075. // - IE 11
  15076. // * NVDA 2018:
  15077. // - Chrome 70
  15078. // - Firefox 60 (ESR)
  15079. // - IE 11
  15080. // * ChromeVox 53
  15081. labelEl.textContent = '';
  15082. labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;">&nbsp;</span>';
  15083. // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element.
  15084. // CSS generated content is normally announced by screen readers
  15085. // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/);
  15086. // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers.
  15087. labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
  15088. setTimeout(function () {
  15089. // Allow screen readers to announce changes to the DOM again.
  15090. ariaEl.setAttribute('aria-live', priority);
  15091. // Remove the message from the ::before pseudo-element.
  15092. labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
  15093. // Restore the original label text, which will be announced by screen readers.
  15094. labelEl.textContent = labelText;
  15095. }, ARIA_LIVE_DELAY_MS);
  15096. }
  15097. exports.announce = announce;
  15098. /***/ }),
  15099. /***/ "./packages/mdc-switch/component.ts":
  15100. /*!******************************************!*\
  15101. !*** ./packages/mdc-switch/component.ts ***!
  15102. \******************************************/
  15103. /*! no static exports found */
  15104. /***/ (function(module, exports, __webpack_require__) {
  15105. "use strict";
  15106. /**
  15107. * @license
  15108. * Copyright 2018 Google Inc.
  15109. *
  15110. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15111. * of this software and associated documentation files (the "Software"), to deal
  15112. * in the Software without restriction, including without limitation the rights
  15113. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15114. * copies of the Software, and to permit persons to whom the Software is
  15115. * furnished to do so, subject to the following conditions:
  15116. *
  15117. * The above copyright notice and this permission notice shall be included in
  15118. * all copies or substantial portions of the Software.
  15119. *
  15120. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15121. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15122. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15123. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15124. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15125. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15126. * THE SOFTWARE.
  15127. */
  15128. var __extends = this && this.__extends || function () {
  15129. var _extendStatics = function extendStatics(d, b) {
  15130. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15131. d.__proto__ = b;
  15132. } || function (d, b) {
  15133. for (var p in b) {
  15134. if (b.hasOwnProperty(p)) d[p] = b[p];
  15135. }
  15136. };
  15137. return _extendStatics(d, b);
  15138. };
  15139. return function (d, b) {
  15140. _extendStatics(d, b);
  15141. function __() {
  15142. this.constructor = d;
  15143. }
  15144. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15145. };
  15146. }();
  15147. var __assign = this && this.__assign || function () {
  15148. __assign = Object.assign || function (t) {
  15149. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15150. s = arguments[i];
  15151. for (var p in s) {
  15152. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15153. }
  15154. }
  15155. return t;
  15156. };
  15157. return __assign.apply(this, arguments);
  15158. };
  15159. var __read = this && this.__read || function (o, n) {
  15160. var m = typeof Symbol === "function" && o[Symbol.iterator];
  15161. if (!m) return o;
  15162. var i = m.call(o),
  15163. r,
  15164. ar = [],
  15165. e;
  15166. try {
  15167. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  15168. ar.push(r.value);
  15169. }
  15170. } catch (error) {
  15171. e = { error: error };
  15172. } finally {
  15173. try {
  15174. if (r && !r.done && (m = i["return"])) m.call(i);
  15175. } finally {
  15176. if (e) throw e.error;
  15177. }
  15178. }
  15179. return ar;
  15180. };
  15181. var __spread = this && this.__spread || function () {
  15182. for (var ar = [], i = 0; i < arguments.length; i++) {
  15183. ar = ar.concat(__read(arguments[i]));
  15184. }return ar;
  15185. };
  15186. Object.defineProperty(exports, "__esModule", { value: true });
  15187. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15188. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  15189. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  15190. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  15191. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  15192. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts");
  15193. var MDCSwitch = /** @class */function (_super) {
  15194. __extends(MDCSwitch, _super);
  15195. function MDCSwitch() {
  15196. var _this = _super !== null && _super.apply(this, arguments) || this;
  15197. _this.ripple_ = _this.createRipple_();
  15198. return _this;
  15199. }
  15200. MDCSwitch.attachTo = function (root) {
  15201. return new MDCSwitch(root);
  15202. };
  15203. MDCSwitch.prototype.destroy = function () {
  15204. _super.prototype.destroy.call(this);
  15205. this.ripple_.destroy();
  15206. this.nativeControl_.removeEventListener('change', this.changeHandler_);
  15207. };
  15208. MDCSwitch.prototype.initialSyncWithDOM = function () {
  15209. var _this = this;
  15210. this.changeHandler_ = function () {
  15211. var _a;
  15212. var args = [];
  15213. for (var _i = 0; _i < arguments.length; _i++) {
  15214. args[_i] = arguments[_i];
  15215. }
  15216. return (_a = _this.foundation_).handleChange.apply(_a, __spread(args));
  15217. };
  15218. this.nativeControl_.addEventListener('change', this.changeHandler_);
  15219. // Sometimes the checked state of the input element is saved in the history.
  15220. // The switch styling should match the checked state of the input element.
  15221. // Do an initial sync between the native control and the foundation.
  15222. this.checked = this.checked;
  15223. };
  15224. MDCSwitch.prototype.getDefaultFoundation = function () {
  15225. var _this = this;
  15226. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15227. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15228. var adapter = {
  15229. addClass: function addClass(className) {
  15230. return _this.root_.classList.add(className);
  15231. },
  15232. removeClass: function removeClass(className) {
  15233. return _this.root_.classList.remove(className);
  15234. },
  15235. setNativeControlChecked: function setNativeControlChecked(checked) {
  15236. return _this.nativeControl_.checked = checked;
  15237. },
  15238. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  15239. return _this.nativeControl_.disabled = disabled;
  15240. }
  15241. };
  15242. return new foundation_2.MDCSwitchFoundation(adapter);
  15243. };
  15244. Object.defineProperty(MDCSwitch.prototype, "ripple", {
  15245. get: function get() {
  15246. return this.ripple_;
  15247. },
  15248. enumerable: true,
  15249. configurable: true
  15250. });
  15251. Object.defineProperty(MDCSwitch.prototype, "checked", {
  15252. get: function get() {
  15253. return this.nativeControl_.checked;
  15254. },
  15255. set: function set(checked) {
  15256. this.foundation_.setChecked(checked);
  15257. },
  15258. enumerable: true,
  15259. configurable: true
  15260. });
  15261. Object.defineProperty(MDCSwitch.prototype, "disabled", {
  15262. get: function get() {
  15263. return this.nativeControl_.disabled;
  15264. },
  15265. set: function set(disabled) {
  15266. this.foundation_.setDisabled(disabled);
  15267. },
  15268. enumerable: true,
  15269. configurable: true
  15270. });
  15271. MDCSwitch.prototype.createRipple_ = function () {
  15272. var _this = this;
  15273. var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
  15274. var rippleSurface = this.root_.querySelector(RIPPLE_SURFACE_SELECTOR);
  15275. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15276. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15277. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { addClass: function addClass(className) {
  15278. return rippleSurface.classList.add(className);
  15279. }, computeBoundingRect: function computeBoundingRect() {
  15280. return rippleSurface.getBoundingClientRect();
  15281. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  15282. _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  15283. }, isSurfaceActive: function isSurfaceActive() {
  15284. return ponyfill_1.matches(_this.nativeControl_, ':active');
  15285. }, isUnbounded: function isUnbounded() {
  15286. return true;
  15287. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  15288. _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  15289. }, removeClass: function removeClass(className) {
  15290. return rippleSurface.classList.remove(className);
  15291. }, updateCssVariable: function updateCssVariable(varName, value) {
  15292. rippleSurface.style.setProperty(varName, value);
  15293. } });
  15294. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  15295. };
  15296. Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
  15297. get: function get() {
  15298. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
  15299. return this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  15300. },
  15301. enumerable: true,
  15302. configurable: true
  15303. });
  15304. return MDCSwitch;
  15305. }(component_1.MDCComponent);
  15306. exports.MDCSwitch = MDCSwitch;
  15307. /***/ }),
  15308. /***/ "./packages/mdc-switch/constants.ts":
  15309. /*!******************************************!*\
  15310. !*** ./packages/mdc-switch/constants.ts ***!
  15311. \******************************************/
  15312. /*! no static exports found */
  15313. /***/ (function(module, exports, __webpack_require__) {
  15314. "use strict";
  15315. /**
  15316. * @license
  15317. * Copyright 2018 Google Inc.
  15318. *
  15319. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15320. * of this software and associated documentation files (the "Software"), to deal
  15321. * in the Software without restriction, including without limitation the rights
  15322. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15323. * copies of the Software, and to permit persons to whom the Software is
  15324. * furnished to do so, subject to the following conditions:
  15325. *
  15326. * The above copyright notice and this permission notice shall be included in
  15327. * all copies or substantial portions of the Software.
  15328. *
  15329. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15330. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15331. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15332. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15333. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15334. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15335. * THE SOFTWARE.
  15336. */
  15337. Object.defineProperty(exports, "__esModule", { value: true });
  15338. /** CSS classes used by the switch. */
  15339. var cssClasses = {
  15340. /** Class used for a switch that is in the "checked" (on) position. */
  15341. CHECKED: 'mdc-switch--checked',
  15342. /** Class used for a switch that is disabled. */
  15343. DISABLED: 'mdc-switch--disabled'
  15344. };
  15345. exports.cssClasses = cssClasses;
  15346. /** String constants used by the switch. */
  15347. var strings = {
  15348. /** A CSS selector used to locate the native HTML control for the switch. */
  15349. NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control',
  15350. /** A CSS selector used to locate the ripple surface element for the switch. */
  15351. RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay'
  15352. };
  15353. exports.strings = strings;
  15354. /***/ }),
  15355. /***/ "./packages/mdc-switch/foundation.ts":
  15356. /*!*******************************************!*\
  15357. !*** ./packages/mdc-switch/foundation.ts ***!
  15358. \*******************************************/
  15359. /*! no static exports found */
  15360. /***/ (function(module, exports, __webpack_require__) {
  15361. "use strict";
  15362. /**
  15363. * @license
  15364. * Copyright 2018 Google Inc.
  15365. *
  15366. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15367. * of this software and associated documentation files (the "Software"), to deal
  15368. * in the Software without restriction, including without limitation the rights
  15369. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15370. * copies of the Software, and to permit persons to whom the Software is
  15371. * furnished to do so, subject to the following conditions:
  15372. *
  15373. * The above copyright notice and this permission notice shall be included in
  15374. * all copies or substantial portions of the Software.
  15375. *
  15376. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15377. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15378. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15379. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15380. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15381. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15382. * THE SOFTWARE.
  15383. */
  15384. var __extends = this && this.__extends || function () {
  15385. var _extendStatics = function extendStatics(d, b) {
  15386. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15387. d.__proto__ = b;
  15388. } || function (d, b) {
  15389. for (var p in b) {
  15390. if (b.hasOwnProperty(p)) d[p] = b[p];
  15391. }
  15392. };
  15393. return _extendStatics(d, b);
  15394. };
  15395. return function (d, b) {
  15396. _extendStatics(d, b);
  15397. function __() {
  15398. this.constructor = d;
  15399. }
  15400. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15401. };
  15402. }();
  15403. var __assign = this && this.__assign || function () {
  15404. __assign = Object.assign || function (t) {
  15405. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15406. s = arguments[i];
  15407. for (var p in s) {
  15408. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15409. }
  15410. }
  15411. return t;
  15412. };
  15413. return __assign.apply(this, arguments);
  15414. };
  15415. Object.defineProperty(exports, "__esModule", { value: true });
  15416. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  15417. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts");
  15418. var MDCSwitchFoundation = /** @class */function (_super) {
  15419. __extends(MDCSwitchFoundation, _super);
  15420. function MDCSwitchFoundation(adapter) {
  15421. return _super.call(this, __assign({}, MDCSwitchFoundation.defaultAdapter, adapter)) || this;
  15422. }
  15423. Object.defineProperty(MDCSwitchFoundation, "strings", {
  15424. /** The string constants used by the switch. */
  15425. get: function get() {
  15426. return constants_1.strings;
  15427. },
  15428. enumerable: true,
  15429. configurable: true
  15430. });
  15431. Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
  15432. /** The CSS classes used by the switch. */
  15433. get: function get() {
  15434. return constants_1.cssClasses;
  15435. },
  15436. enumerable: true,
  15437. configurable: true
  15438. });
  15439. Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
  15440. /** The default Adapter for the switch. */
  15441. get: function get() {
  15442. return {
  15443. addClass: function addClass() {
  15444. return undefined;
  15445. },
  15446. removeClass: function removeClass() {
  15447. return undefined;
  15448. },
  15449. setNativeControlChecked: function setNativeControlChecked() {
  15450. return undefined;
  15451. },
  15452. setNativeControlDisabled: function setNativeControlDisabled() {
  15453. return undefined;
  15454. }
  15455. };
  15456. },
  15457. enumerable: true,
  15458. configurable: true
  15459. });
  15460. /** Sets the checked state of the switch. */
  15461. MDCSwitchFoundation.prototype.setChecked = function (checked) {
  15462. this.adapter_.setNativeControlChecked(checked);
  15463. this.updateCheckedStyling_(checked);
  15464. };
  15465. /** Sets the disabled state of the switch. */
  15466. MDCSwitchFoundation.prototype.setDisabled = function (disabled) {
  15467. this.adapter_.setNativeControlDisabled(disabled);
  15468. if (disabled) {
  15469. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  15470. } else {
  15471. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  15472. }
  15473. };
  15474. /** Handles the change event for the switch native control. */
  15475. MDCSwitchFoundation.prototype.handleChange = function (evt) {
  15476. var nativeControl = evt.target;
  15477. this.updateCheckedStyling_(nativeControl.checked);
  15478. };
  15479. /** Updates the styling of the switch based on its checked state. */
  15480. MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) {
  15481. if (checked) {
  15482. this.adapter_.addClass(constants_1.cssClasses.CHECKED);
  15483. } else {
  15484. this.adapter_.removeClass(constants_1.cssClasses.CHECKED);
  15485. }
  15486. };
  15487. return MDCSwitchFoundation;
  15488. }(foundation_1.MDCFoundation);
  15489. exports.MDCSwitchFoundation = MDCSwitchFoundation;
  15490. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  15491. exports.default = MDCSwitchFoundation;
  15492. /***/ }),
  15493. /***/ "./packages/mdc-switch/index.ts":
  15494. /*!**************************************!*\
  15495. !*** ./packages/mdc-switch/index.ts ***!
  15496. \**************************************/
  15497. /*! no static exports found */
  15498. /***/ (function(module, exports, __webpack_require__) {
  15499. "use strict";
  15500. /**
  15501. * @license
  15502. * Copyright 2019 Google Inc.
  15503. *
  15504. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15505. * of this software and associated documentation files (the "Software"), to deal
  15506. * in the Software without restriction, including without limitation the rights
  15507. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15508. * copies of the Software, and to permit persons to whom the Software is
  15509. * furnished to do so, subject to the following conditions:
  15510. *
  15511. * The above copyright notice and this permission notice shall be included in
  15512. * all copies or substantial portions of the Software.
  15513. *
  15514. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15515. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15516. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15517. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15518. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15519. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15520. * THE SOFTWARE.
  15521. */
  15522. function __export(m) {
  15523. for (var p in m) {
  15524. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  15525. }
  15526. }
  15527. Object.defineProperty(exports, "__esModule", { value: true });
  15528. __export(__webpack_require__(/*! ./component */ "./packages/mdc-switch/component.ts"));
  15529. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"));
  15530. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"));
  15531. /***/ }),
  15532. /***/ "./packages/mdc-tab-bar/component.ts":
  15533. /*!*******************************************!*\
  15534. !*** ./packages/mdc-tab-bar/component.ts ***!
  15535. \*******************************************/
  15536. /*! no static exports found */
  15537. /***/ (function(module, exports, __webpack_require__) {
  15538. "use strict";
  15539. /**
  15540. * @license
  15541. * Copyright 2018 Google Inc.
  15542. *
  15543. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15544. * of this software and associated documentation files (the "Software"), to deal
  15545. * in the Software without restriction, including without limitation the rights
  15546. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15547. * copies of the Software, and to permit persons to whom the Software is
  15548. * furnished to do so, subject to the following conditions:
  15549. *
  15550. * The above copyright notice and this permission notice shall be included in
  15551. * all copies or substantial portions of the Software.
  15552. *
  15553. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15554. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15555. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15556. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15557. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15558. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15559. * THE SOFTWARE.
  15560. */
  15561. var __extends = this && this.__extends || function () {
  15562. var _extendStatics = function extendStatics(d, b) {
  15563. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15564. d.__proto__ = b;
  15565. } || function (d, b) {
  15566. for (var p in b) {
  15567. if (b.hasOwnProperty(p)) d[p] = b[p];
  15568. }
  15569. };
  15570. return _extendStatics(d, b);
  15571. };
  15572. return function (d, b) {
  15573. _extendStatics(d, b);
  15574. function __() {
  15575. this.constructor = d;
  15576. }
  15577. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15578. };
  15579. }();
  15580. Object.defineProperty(exports, "__esModule", { value: true });
  15581. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15582. var component_2 = __webpack_require__(/*! @material/tab-scroller/component */ "./packages/mdc-tab-scroller/component.ts");
  15583. var component_3 = __webpack_require__(/*! @material/tab/component */ "./packages/mdc-tab/component.ts");
  15584. var foundation_1 = __webpack_require__(/*! @material/tab/foundation */ "./packages/mdc-tab/foundation.ts");
  15585. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts");
  15586. var strings = foundation_2.MDCTabBarFoundation.strings;
  15587. var tabIdCounter = 0;
  15588. var MDCTabBar = /** @class */function (_super) {
  15589. __extends(MDCTabBar, _super);
  15590. function MDCTabBar() {
  15591. return _super !== null && _super.apply(this, arguments) || this;
  15592. }
  15593. MDCTabBar.attachTo = function (root) {
  15594. return new MDCTabBar(root);
  15595. };
  15596. Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", {
  15597. set: function set(focusOnActivate) {
  15598. this.tabList_.forEach(function (tab) {
  15599. return tab.focusOnActivate = focusOnActivate;
  15600. });
  15601. },
  15602. enumerable: true,
  15603. configurable: true
  15604. });
  15605. Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", {
  15606. set: function set(useAutomaticActivation) {
  15607. this.foundation_.setUseAutomaticActivation(useAutomaticActivation);
  15608. },
  15609. enumerable: true,
  15610. configurable: true
  15611. });
  15612. MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {
  15613. if (tabFactory === void 0) {
  15614. tabFactory = function tabFactory(el) {
  15615. return new component_3.MDCTab(el);
  15616. };
  15617. }
  15618. if (tabScrollerFactory === void 0) {
  15619. tabScrollerFactory = function tabScrollerFactory(el) {
  15620. return new component_2.MDCTabScroller(el);
  15621. };
  15622. }
  15623. this.tabList_ = this.instantiateTabs_(tabFactory);
  15624. this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory);
  15625. };
  15626. MDCTabBar.prototype.initialSyncWithDOM = function () {
  15627. var _this = this;
  15628. this.handleTabInteraction_ = function (evt) {
  15629. return _this.foundation_.handleTabInteraction(evt);
  15630. };
  15631. this.handleKeyDown_ = function (evt) {
  15632. return _this.foundation_.handleKeyDown(evt);
  15633. };
  15634. this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  15635. this.listen('keydown', this.handleKeyDown_);
  15636. for (var i = 0; i < this.tabList_.length; i++) {
  15637. if (this.tabList_[i].active) {
  15638. this.scrollIntoView(i);
  15639. break;
  15640. }
  15641. }
  15642. };
  15643. MDCTabBar.prototype.destroy = function () {
  15644. _super.prototype.destroy.call(this);
  15645. this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  15646. this.unlisten('keydown', this.handleKeyDown_);
  15647. this.tabList_.forEach(function (tab) {
  15648. return tab.destroy();
  15649. });
  15650. if (this.tabScroller_) {
  15651. this.tabScroller_.destroy();
  15652. }
  15653. };
  15654. MDCTabBar.prototype.getDefaultFoundation = function () {
  15655. var _this = this;
  15656. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15657. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15658. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15659. var adapter = {
  15660. scrollTo: function scrollTo(scrollX) {
  15661. return _this.tabScroller_.scrollTo(scrollX);
  15662. },
  15663. incrementScroll: function incrementScroll(scrollXIncrement) {
  15664. return _this.tabScroller_.incrementScroll(scrollXIncrement);
  15665. },
  15666. getScrollPosition: function getScrollPosition() {
  15667. return _this.tabScroller_.getScrollPosition();
  15668. },
  15669. getScrollContentWidth: function getScrollContentWidth() {
  15670. return _this.tabScroller_.getScrollContentWidth();
  15671. },
  15672. getOffsetWidth: function getOffsetWidth() {
  15673. return _this.root_.offsetWidth;
  15674. },
  15675. isRTL: function isRTL() {
  15676. return window.getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  15677. },
  15678. setActiveTab: function setActiveTab(index) {
  15679. return _this.foundation_.activateTab(index);
  15680. },
  15681. activateTabAtIndex: function activateTabAtIndex(index, clientRect) {
  15682. return _this.tabList_[index].activate(clientRect);
  15683. },
  15684. deactivateTabAtIndex: function deactivateTabAtIndex(index) {
  15685. return _this.tabList_[index].deactivate();
  15686. },
  15687. focusTabAtIndex: function focusTabAtIndex(index) {
  15688. return _this.tabList_[index].focus();
  15689. },
  15690. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) {
  15691. return _this.tabList_[index].computeIndicatorClientRect();
  15692. },
  15693. getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) {
  15694. return _this.tabList_[index].computeDimensions();
  15695. },
  15696. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  15697. for (var i = 0; i < _this.tabList_.length; i++) {
  15698. if (_this.tabList_[i].active) {
  15699. return i;
  15700. }
  15701. }
  15702. return -1;
  15703. },
  15704. getFocusedTabIndex: function getFocusedTabIndex() {
  15705. var tabElements = _this.getTabElements_();
  15706. var activeElement = document.activeElement;
  15707. return tabElements.indexOf(activeElement);
  15708. },
  15709. getIndexOfTabById: function getIndexOfTabById(id) {
  15710. for (var i = 0; i < _this.tabList_.length; i++) {
  15711. if (_this.tabList_[i].id === id) {
  15712. return i;
  15713. }
  15714. }
  15715. return -1;
  15716. },
  15717. getTabListLength: function getTabListLength() {
  15718. return _this.tabList_.length;
  15719. },
  15720. notifyTabActivated: function notifyTabActivated(index) {
  15721. return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true);
  15722. }
  15723. };
  15724. // tslint:enable:object-literal-sort-keys
  15725. return new foundation_2.MDCTabBarFoundation(adapter);
  15726. };
  15727. /**
  15728. * Activates the tab at the given index
  15729. * @param index The index of the tab
  15730. */
  15731. MDCTabBar.prototype.activateTab = function (index) {
  15732. this.foundation_.activateTab(index);
  15733. };
  15734. /**
  15735. * Scrolls the tab at the given index into view
  15736. * @param index THe index of the tab
  15737. */
  15738. MDCTabBar.prototype.scrollIntoView = function (index) {
  15739. this.foundation_.scrollIntoView(index);
  15740. };
  15741. /**
  15742. * Returns all the tab elements in a nice clean array
  15743. */
  15744. MDCTabBar.prototype.getTabElements_ = function () {
  15745. return [].slice.call(this.root_.querySelectorAll(strings.TAB_SELECTOR));
  15746. };
  15747. /**
  15748. * Instantiates tab components on all child tab elements
  15749. */
  15750. MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) {
  15751. return this.getTabElements_().map(function (el) {
  15752. el.id = el.id || "mdc-tab-" + ++tabIdCounter;
  15753. return tabFactory(el);
  15754. });
  15755. };
  15756. /**
  15757. * Instantiates tab scroller component on the child tab scroller element
  15758. */
  15759. MDCTabBar.prototype.instantiateTabScroller_ = function (tabScrollerFactory) {
  15760. var tabScrollerElement = this.root_.querySelector(strings.TAB_SCROLLER_SELECTOR);
  15761. if (tabScrollerElement) {
  15762. return tabScrollerFactory(tabScrollerElement);
  15763. }
  15764. return null;
  15765. };
  15766. return MDCTabBar;
  15767. }(component_1.MDCComponent);
  15768. exports.MDCTabBar = MDCTabBar;
  15769. /***/ }),
  15770. /***/ "./packages/mdc-tab-bar/constants.ts":
  15771. /*!*******************************************!*\
  15772. !*** ./packages/mdc-tab-bar/constants.ts ***!
  15773. \*******************************************/
  15774. /*! no static exports found */
  15775. /***/ (function(module, exports, __webpack_require__) {
  15776. "use strict";
  15777. /**
  15778. * @license
  15779. * Copyright 2018 Google Inc.
  15780. *
  15781. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15782. * of this software and associated documentation files (the "Software"), to deal
  15783. * in the Software without restriction, including without limitation the rights
  15784. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15785. * copies of the Software, and to permit persons to whom the Software is
  15786. * furnished to do so, subject to the following conditions:
  15787. *
  15788. * The above copyright notice and this permission notice shall be included in
  15789. * all copies or substantial portions of the Software.
  15790. *
  15791. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15792. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15793. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15794. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15795. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15796. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15797. * THE SOFTWARE.
  15798. */
  15799. Object.defineProperty(exports, "__esModule", { value: true });
  15800. var strings = {
  15801. ARROW_LEFT_KEY: 'ArrowLeft',
  15802. ARROW_RIGHT_KEY: 'ArrowRight',
  15803. END_KEY: 'End',
  15804. ENTER_KEY: 'Enter',
  15805. HOME_KEY: 'Home',
  15806. SPACE_KEY: 'Space',
  15807. TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
  15808. TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
  15809. TAB_SELECTOR: '.mdc-tab'
  15810. };
  15811. exports.strings = strings;
  15812. var numbers = {
  15813. ARROW_LEFT_KEYCODE: 37,
  15814. ARROW_RIGHT_KEYCODE: 39,
  15815. END_KEYCODE: 35,
  15816. ENTER_KEYCODE: 13,
  15817. EXTRA_SCROLL_AMOUNT: 20,
  15818. HOME_KEYCODE: 36,
  15819. SPACE_KEYCODE: 32
  15820. };
  15821. exports.numbers = numbers;
  15822. /***/ }),
  15823. /***/ "./packages/mdc-tab-bar/foundation.ts":
  15824. /*!********************************************!*\
  15825. !*** ./packages/mdc-tab-bar/foundation.ts ***!
  15826. \********************************************/
  15827. /*! no static exports found */
  15828. /***/ (function(module, exports, __webpack_require__) {
  15829. "use strict";
  15830. /**
  15831. * @license
  15832. * Copyright 2018 Google Inc.
  15833. *
  15834. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15835. * of this software and associated documentation files (the "Software"), to deal
  15836. * in the Software without restriction, including without limitation the rights
  15837. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15838. * copies of the Software, and to permit persons to whom the Software is
  15839. * furnished to do so, subject to the following conditions:
  15840. *
  15841. * The above copyright notice and this permission notice shall be included in
  15842. * all copies or substantial portions of the Software.
  15843. *
  15844. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15845. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15846. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15847. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15848. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15849. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15850. * THE SOFTWARE.
  15851. */
  15852. var __extends = this && this.__extends || function () {
  15853. var _extendStatics = function extendStatics(d, b) {
  15854. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15855. d.__proto__ = b;
  15856. } || function (d, b) {
  15857. for (var p in b) {
  15858. if (b.hasOwnProperty(p)) d[p] = b[p];
  15859. }
  15860. };
  15861. return _extendStatics(d, b);
  15862. };
  15863. return function (d, b) {
  15864. _extendStatics(d, b);
  15865. function __() {
  15866. this.constructor = d;
  15867. }
  15868. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15869. };
  15870. }();
  15871. var __assign = this && this.__assign || function () {
  15872. __assign = Object.assign || function (t) {
  15873. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15874. s = arguments[i];
  15875. for (var p in s) {
  15876. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15877. }
  15878. }
  15879. return t;
  15880. };
  15881. return __assign.apply(this, arguments);
  15882. };
  15883. Object.defineProperty(exports, "__esModule", { value: true });
  15884. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  15885. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts");
  15886. var ACCEPTABLE_KEYS = new Set();
  15887. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  15888. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY);
  15889. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY);
  15890. ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY);
  15891. ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY);
  15892. ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY);
  15893. ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY);
  15894. var KEYCODE_MAP = new Map();
  15895. // IE11 has no support for new Map with iterable so we need to initialize this by hand
  15896. KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY);
  15897. KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY);
  15898. KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY);
  15899. KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY);
  15900. KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY);
  15901. KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY);
  15902. var MDCTabBarFoundation = /** @class */function (_super) {
  15903. __extends(MDCTabBarFoundation, _super);
  15904. function MDCTabBarFoundation(adapter) {
  15905. var _this = _super.call(this, __assign({}, MDCTabBarFoundation.defaultAdapter, adapter)) || this;
  15906. _this.useAutomaticActivation_ = false;
  15907. return _this;
  15908. }
  15909. Object.defineProperty(MDCTabBarFoundation, "strings", {
  15910. get: function get() {
  15911. return constants_1.strings;
  15912. },
  15913. enumerable: true,
  15914. configurable: true
  15915. });
  15916. Object.defineProperty(MDCTabBarFoundation, "numbers", {
  15917. get: function get() {
  15918. return constants_1.numbers;
  15919. },
  15920. enumerable: true,
  15921. configurable: true
  15922. });
  15923. Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", {
  15924. get: function get() {
  15925. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15926. return {
  15927. scrollTo: function scrollTo() {
  15928. return undefined;
  15929. },
  15930. incrementScroll: function incrementScroll() {
  15931. return undefined;
  15932. },
  15933. getScrollPosition: function getScrollPosition() {
  15934. return 0;
  15935. },
  15936. getScrollContentWidth: function getScrollContentWidth() {
  15937. return 0;
  15938. },
  15939. getOffsetWidth: function getOffsetWidth() {
  15940. return 0;
  15941. },
  15942. isRTL: function isRTL() {
  15943. return false;
  15944. },
  15945. setActiveTab: function setActiveTab() {
  15946. return undefined;
  15947. },
  15948. activateTabAtIndex: function activateTabAtIndex() {
  15949. return undefined;
  15950. },
  15951. deactivateTabAtIndex: function deactivateTabAtIndex() {
  15952. return undefined;
  15953. },
  15954. focusTabAtIndex: function focusTabAtIndex() {
  15955. return undefined;
  15956. },
  15957. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() {
  15958. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  15959. },
  15960. getTabDimensionsAtIndex: function getTabDimensionsAtIndex() {
  15961. return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
  15962. },
  15963. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  15964. return -1;
  15965. },
  15966. getFocusedTabIndex: function getFocusedTabIndex() {
  15967. return -1;
  15968. },
  15969. getIndexOfTabById: function getIndexOfTabById() {
  15970. return -1;
  15971. },
  15972. getTabListLength: function getTabListLength() {
  15973. return 0;
  15974. },
  15975. notifyTabActivated: function notifyTabActivated() {
  15976. return undefined;
  15977. }
  15978. };
  15979. // tslint:enable:object-literal-sort-keys
  15980. },
  15981. enumerable: true,
  15982. configurable: true
  15983. });
  15984. /**
  15985. * Switches between automatic and manual activation modes.
  15986. * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples.
  15987. */
  15988. MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {
  15989. this.useAutomaticActivation_ = useAutomaticActivation;
  15990. };
  15991. MDCTabBarFoundation.prototype.activateTab = function (index) {
  15992. var previousActiveIndex = this.adapter_.getPreviousActiveTabIndex();
  15993. if (!this.indexIsInRange_(index) || index === previousActiveIndex) {
  15994. return;
  15995. }
  15996. var previousClientRect;
  15997. if (previousActiveIndex !== -1) {
  15998. this.adapter_.deactivateTabAtIndex(previousActiveIndex);
  15999. previousClientRect = this.adapter_.getTabIndicatorClientRectAtIndex(previousActiveIndex);
  16000. }
  16001. this.adapter_.activateTabAtIndex(index, previousClientRect);
  16002. this.scrollIntoView(index);
  16003. this.adapter_.notifyTabActivated(index);
  16004. };
  16005. MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {
  16006. // Get the key from the event
  16007. var key = this.getKeyFromEvent_(evt);
  16008. // Early exit if the event key isn't one of the keyboard navigation keys
  16009. if (key === undefined) {
  16010. return;
  16011. }
  16012. // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple
  16013. if (!this.isActivationKey_(key)) {
  16014. evt.preventDefault();
  16015. }
  16016. if (this.useAutomaticActivation_) {
  16017. if (this.isActivationKey_(key)) {
  16018. return;
  16019. }
  16020. var index = this.determineTargetFromKey_(this.adapter_.getPreviousActiveTabIndex(), key);
  16021. this.adapter_.setActiveTab(index);
  16022. this.scrollIntoView(index);
  16023. } else {
  16024. var focusedTabIndex = this.adapter_.getFocusedTabIndex();
  16025. if (this.isActivationKey_(key)) {
  16026. this.adapter_.setActiveTab(focusedTabIndex);
  16027. } else {
  16028. var index = this.determineTargetFromKey_(focusedTabIndex, key);
  16029. this.adapter_.focusTabAtIndex(index);
  16030. this.scrollIntoView(index);
  16031. }
  16032. }
  16033. };
  16034. /**
  16035. * Handles the MDCTab:interacted event
  16036. */
  16037. MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {
  16038. this.adapter_.setActiveTab(this.adapter_.getIndexOfTabById(evt.detail.tabId));
  16039. };
  16040. /**
  16041. * Scrolls the tab at the given index into view
  16042. * @param index The tab index to make visible
  16043. */
  16044. MDCTabBarFoundation.prototype.scrollIntoView = function (index) {
  16045. // Early exit if the index is out of range
  16046. if (!this.indexIsInRange_(index)) {
  16047. return;
  16048. }
  16049. // Always scroll to 0 if scrolling to the 0th index
  16050. if (index === 0) {
  16051. return this.adapter_.scrollTo(0);
  16052. }
  16053. // Always scroll to the max value if scrolling to the Nth index
  16054. // MDCTabScroller.scrollTo() will never scroll past the max possible value
  16055. if (index === this.adapter_.getTabListLength() - 1) {
  16056. return this.adapter_.scrollTo(this.adapter_.getScrollContentWidth());
  16057. }
  16058. if (this.isRTL_()) {
  16059. return this.scrollIntoViewRTL_(index);
  16060. }
  16061. this.scrollIntoView_(index);
  16062. };
  16063. /**
  16064. * Private method for determining the index of the destination tab based on what key was pressed
  16065. * @param origin The original index from which to determine the destination
  16066. * @param key The name of the key
  16067. */
  16068. MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) {
  16069. var isRTL = this.isRTL_();
  16070. var maxIndex = this.adapter_.getTabListLength() - 1;
  16071. var shouldGoToEnd = key === constants_1.strings.END_KEY;
  16072. var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL;
  16073. var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL;
  16074. var index = origin;
  16075. if (shouldGoToEnd) {
  16076. index = maxIndex;
  16077. } else if (shouldDecrement) {
  16078. index -= 1;
  16079. } else if (shouldIncrement) {
  16080. index += 1;
  16081. } else {
  16082. index = 0;
  16083. }
  16084. if (index < 0) {
  16085. index = maxIndex;
  16086. } else if (index > maxIndex) {
  16087. index = 0;
  16088. }
  16089. return index;
  16090. };
  16091. /**
  16092. * Calculates the scroll increment that will make the tab at the given index visible
  16093. * @param index The index of the tab
  16094. * @param nextIndex The index of the next tab
  16095. * @param scrollPosition The current scroll position
  16096. * @param barWidth The width of the Tab Bar
  16097. */
  16098. MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) {
  16099. var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex);
  16100. var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
  16101. var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
  16102. var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16103. var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16104. if (nextIndex < index) {
  16105. return Math.min(leftIncrement, 0);
  16106. }
  16107. return Math.max(rightIncrement, 0);
  16108. };
  16109. /**
  16110. * Calculates the scroll increment that will make the tab at the given index visible in RTL
  16111. * @param index The index of the tab
  16112. * @param nextIndex The index of the next tab
  16113. * @param scrollPosition The current scroll position
  16114. * @param barWidth The width of the Tab Bar
  16115. * @param scrollContentWidth The width of the scroll content
  16116. */
  16117. MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {
  16118. var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex);
  16119. var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;
  16120. var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;
  16121. var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16122. var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  16123. if (nextIndex > index) {
  16124. return Math.max(leftIncrement, 0);
  16125. }
  16126. return Math.min(rightIncrement, 0);
  16127. };
  16128. /**
  16129. * Determines the index of the adjacent tab closest to either edge of the Tab Bar
  16130. * @param index The index of the tab
  16131. * @param tabDimensions The dimensions of the tab
  16132. * @param scrollPosition The current scroll position
  16133. * @param barWidth The width of the tab bar
  16134. */
  16135. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) {
  16136. /**
  16137. * Tabs are laid out in the Tab Scroller like this:
  16138. *
  16139. * Scroll Position
  16140. * +---+
  16141. * | | Bar Width
  16142. * | +-----------------------------------+
  16143. * | | |
  16144. * | V V
  16145. * | +-----------------------------------+
  16146. * V | Tab Scroller |
  16147. * +------------+--------------+-------------------+
  16148. * | Tab | Tab | Tab |
  16149. * +------------+--------------+-------------------+
  16150. * | |
  16151. * +-----------------------------------+
  16152. *
  16153. * To determine the next adjacent index, we look at the Tab root left and
  16154. * Tab root right, both relative to the scroll position. If the Tab root
  16155. * left is less than 0, then we know it's out of view to the left. If the
  16156. * Tab root right minus the bar width is greater than 0, we know the Tab is
  16157. * out of view to the right. From there, we either increment or decrement
  16158. * the index.
  16159. */
  16160. var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
  16161. var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
  16162. var relativeRootDelta = relativeRootLeft + relativeRootRight;
  16163. var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
  16164. var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
  16165. if (leftEdgeIsCloser) {
  16166. return index - 1;
  16167. }
  16168. if (rightEdgeIsCloser) {
  16169. return index + 1;
  16170. }
  16171. return -1;
  16172. };
  16173. /**
  16174. * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL
  16175. * @param index The index of the tab
  16176. * @param tabDimensions The dimensions of the tab
  16177. * @param scrollPosition The current scroll position
  16178. * @param barWidth The width of the tab bar
  16179. * @param scrollContentWidth The width of the scroller content
  16180. */
  16181. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {
  16182. var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;
  16183. var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;
  16184. var rootDelta = rootLeft + rootRight;
  16185. var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;
  16186. var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;
  16187. if (leftEdgeIsCloser) {
  16188. return index + 1;
  16189. }
  16190. if (rightEdgeIsCloser) {
  16191. return index - 1;
  16192. }
  16193. return -1;
  16194. };
  16195. /**
  16196. * Returns the key associated with a keydown event
  16197. * @param evt The keydown event
  16198. */
  16199. MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) {
  16200. if (ACCEPTABLE_KEYS.has(evt.key)) {
  16201. return evt.key;
  16202. }
  16203. return KEYCODE_MAP.get(evt.keyCode);
  16204. };
  16205. MDCTabBarFoundation.prototype.isActivationKey_ = function (key) {
  16206. return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY;
  16207. };
  16208. /**
  16209. * Returns whether a given index is inclusively between the ends
  16210. * @param index The index to test
  16211. */
  16212. MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) {
  16213. return index >= 0 && index < this.adapter_.getTabListLength();
  16214. };
  16215. /**
  16216. * Returns the view's RTL property
  16217. */
  16218. MDCTabBarFoundation.prototype.isRTL_ = function () {
  16219. return this.adapter_.isRTL();
  16220. };
  16221. /**
  16222. * Scrolls the tab at the given index into view for left-to-right user agents.
  16223. * @param index The index of the tab to scroll into view
  16224. */
  16225. MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) {
  16226. var scrollPosition = this.adapter_.getScrollPosition();
  16227. var barWidth = this.adapter_.getOffsetWidth();
  16228. var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index);
  16229. var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth);
  16230. if (!this.indexIsInRange_(nextIndex)) {
  16231. return;
  16232. }
  16233. var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth);
  16234. this.adapter_.incrementScroll(scrollIncrement);
  16235. };
  16236. /**
  16237. * Scrolls the tab at the given index into view in RTL
  16238. * @param index The tab index to make visible
  16239. */
  16240. MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) {
  16241. var scrollPosition = this.adapter_.getScrollPosition();
  16242. var barWidth = this.adapter_.getOffsetWidth();
  16243. var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index);
  16244. var scrollWidth = this.adapter_.getScrollContentWidth();
  16245. var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth);
  16246. if (!this.indexIsInRange_(nextIndex)) {
  16247. return;
  16248. }
  16249. var scrollIncrement = this.calculateScrollIncrementRTL_(index, nextIndex, scrollPosition, barWidth, scrollWidth);
  16250. this.adapter_.incrementScroll(scrollIncrement);
  16251. };
  16252. return MDCTabBarFoundation;
  16253. }(foundation_1.MDCFoundation);
  16254. exports.MDCTabBarFoundation = MDCTabBarFoundation;
  16255. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16256. exports.default = MDCTabBarFoundation;
  16257. /***/ }),
  16258. /***/ "./packages/mdc-tab-bar/index.ts":
  16259. /*!***************************************!*\
  16260. !*** ./packages/mdc-tab-bar/index.ts ***!
  16261. \***************************************/
  16262. /*! no static exports found */
  16263. /***/ (function(module, exports, __webpack_require__) {
  16264. "use strict";
  16265. /**
  16266. * @license
  16267. * Copyright 2019 Google Inc.
  16268. *
  16269. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16270. * of this software and associated documentation files (the "Software"), to deal
  16271. * in the Software without restriction, including without limitation the rights
  16272. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16273. * copies of the Software, and to permit persons to whom the Software is
  16274. * furnished to do so, subject to the following conditions:
  16275. *
  16276. * The above copyright notice and this permission notice shall be included in
  16277. * all copies or substantial portions of the Software.
  16278. *
  16279. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16280. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16281. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16282. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16283. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16284. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16285. * THE SOFTWARE.
  16286. */
  16287. function __export(m) {
  16288. for (var p in m) {
  16289. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16290. }
  16291. }
  16292. Object.defineProperty(exports, "__esModule", { value: true });
  16293. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-bar/component.ts"));
  16294. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"));
  16295. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"));
  16296. /***/ }),
  16297. /***/ "./packages/mdc-tab-indicator/component.ts":
  16298. /*!*************************************************!*\
  16299. !*** ./packages/mdc-tab-indicator/component.ts ***!
  16300. \*************************************************/
  16301. /*! no static exports found */
  16302. /***/ (function(module, exports, __webpack_require__) {
  16303. "use strict";
  16304. /**
  16305. * @license
  16306. * Copyright 2018 Google Inc.
  16307. *
  16308. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16309. * of this software and associated documentation files (the "Software"), to deal
  16310. * in the Software without restriction, including without limitation the rights
  16311. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16312. * copies of the Software, and to permit persons to whom the Software is
  16313. * furnished to do so, subject to the following conditions:
  16314. *
  16315. * The above copyright notice and this permission notice shall be included in
  16316. * all copies or substantial portions of the Software.
  16317. *
  16318. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16319. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16320. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16321. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16322. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16323. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16324. * THE SOFTWARE.
  16325. */
  16326. var __extends = this && this.__extends || function () {
  16327. var _extendStatics = function extendStatics(d, b) {
  16328. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16329. d.__proto__ = b;
  16330. } || function (d, b) {
  16331. for (var p in b) {
  16332. if (b.hasOwnProperty(p)) d[p] = b[p];
  16333. }
  16334. };
  16335. return _extendStatics(d, b);
  16336. };
  16337. return function (d, b) {
  16338. _extendStatics(d, b);
  16339. function __() {
  16340. this.constructor = d;
  16341. }
  16342. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16343. };
  16344. }();
  16345. Object.defineProperty(exports, "__esModule", { value: true });
  16346. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16347. var fading_foundation_1 = __webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts");
  16348. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16349. var sliding_foundation_1 = __webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts");
  16350. var MDCTabIndicator = /** @class */function (_super) {
  16351. __extends(MDCTabIndicator, _super);
  16352. function MDCTabIndicator() {
  16353. return _super !== null && _super.apply(this, arguments) || this;
  16354. }
  16355. MDCTabIndicator.attachTo = function (root) {
  16356. return new MDCTabIndicator(root);
  16357. };
  16358. MDCTabIndicator.prototype.initialize = function () {
  16359. this.content_ = this.root_.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);
  16360. };
  16361. MDCTabIndicator.prototype.computeContentClientRect = function () {
  16362. return this.foundation_.computeContentClientRect();
  16363. };
  16364. MDCTabIndicator.prototype.getDefaultFoundation = function () {
  16365. var _this = this;
  16366. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16367. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16368. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16369. var adapter = {
  16370. addClass: function addClass(className) {
  16371. return _this.root_.classList.add(className);
  16372. },
  16373. removeClass: function removeClass(className) {
  16374. return _this.root_.classList.remove(className);
  16375. },
  16376. computeContentClientRect: function computeContentClientRect() {
  16377. return _this.content_.getBoundingClientRect();
  16378. },
  16379. setContentStyleProperty: function setContentStyleProperty(prop, value) {
  16380. return _this.content_.style.setProperty(prop, value);
  16381. }
  16382. };
  16383. // tslint:enable:object-literal-sort-keys
  16384. if (this.root_.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasses.FADE)) {
  16385. return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter);
  16386. }
  16387. // Default to the sliding indicator
  16388. return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter);
  16389. };
  16390. MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {
  16391. this.foundation_.activate(previousIndicatorClientRect);
  16392. };
  16393. MDCTabIndicator.prototype.deactivate = function () {
  16394. this.foundation_.deactivate();
  16395. };
  16396. return MDCTabIndicator;
  16397. }(component_1.MDCComponent);
  16398. exports.MDCTabIndicator = MDCTabIndicator;
  16399. /***/ }),
  16400. /***/ "./packages/mdc-tab-indicator/constants.ts":
  16401. /*!*************************************************!*\
  16402. !*** ./packages/mdc-tab-indicator/constants.ts ***!
  16403. \*************************************************/
  16404. /*! no static exports found */
  16405. /***/ (function(module, exports, __webpack_require__) {
  16406. "use strict";
  16407. /**
  16408. * @license
  16409. * Copyright 2018 Google Inc.
  16410. *
  16411. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16412. * of this software and associated documentation files (the "Software"), to deal
  16413. * in the Software without restriction, including without limitation the rights
  16414. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16415. * copies of the Software, and to permit persons to whom the Software is
  16416. * furnished to do so, subject to the following conditions:
  16417. *
  16418. * The above copyright notice and this permission notice shall be included in
  16419. * all copies or substantial portions of the Software.
  16420. *
  16421. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16422. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16423. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16424. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16425. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16426. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16427. * THE SOFTWARE.
  16428. */
  16429. Object.defineProperty(exports, "__esModule", { value: true });
  16430. var cssClasses = {
  16431. ACTIVE: 'mdc-tab-indicator--active',
  16432. FADE: 'mdc-tab-indicator--fade',
  16433. NO_TRANSITION: 'mdc-tab-indicator--no-transition'
  16434. };
  16435. exports.cssClasses = cssClasses;
  16436. var strings = {
  16437. CONTENT_SELECTOR: '.mdc-tab-indicator__content'
  16438. };
  16439. exports.strings = strings;
  16440. /***/ }),
  16441. /***/ "./packages/mdc-tab-indicator/fading-foundation.ts":
  16442. /*!*********************************************************!*\
  16443. !*** ./packages/mdc-tab-indicator/fading-foundation.ts ***!
  16444. \*********************************************************/
  16445. /*! no static exports found */
  16446. /***/ (function(module, exports, __webpack_require__) {
  16447. "use strict";
  16448. /**
  16449. * @license
  16450. * Copyright 2018 Google Inc.
  16451. *
  16452. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16453. * of this software and associated documentation files (the "Software"), to deal
  16454. * in the Software without restriction, including without limitation the rights
  16455. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16456. * copies of the Software, and to permit persons to whom the Software is
  16457. * furnished to do so, subject to the following conditions:
  16458. *
  16459. * The above copyright notice and this permission notice shall be included in
  16460. * all copies or substantial portions of the Software.
  16461. *
  16462. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16463. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16464. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16465. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16466. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16467. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16468. * THE SOFTWARE.
  16469. */
  16470. var __extends = this && this.__extends || function () {
  16471. var _extendStatics = function extendStatics(d, b) {
  16472. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16473. d.__proto__ = b;
  16474. } || function (d, b) {
  16475. for (var p in b) {
  16476. if (b.hasOwnProperty(p)) d[p] = b[p];
  16477. }
  16478. };
  16479. return _extendStatics(d, b);
  16480. };
  16481. return function (d, b) {
  16482. _extendStatics(d, b);
  16483. function __() {
  16484. this.constructor = d;
  16485. }
  16486. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16487. };
  16488. }();
  16489. Object.defineProperty(exports, "__esModule", { value: true });
  16490. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16491. /* istanbul ignore next: subclass is not a branch statement */
  16492. var MDCFadingTabIndicatorFoundation = /** @class */function (_super) {
  16493. __extends(MDCFadingTabIndicatorFoundation, _super);
  16494. function MDCFadingTabIndicatorFoundation() {
  16495. return _super !== null && _super.apply(this, arguments) || this;
  16496. }
  16497. MDCFadingTabIndicatorFoundation.prototype.activate = function () {
  16498. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16499. };
  16500. MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {
  16501. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16502. };
  16503. return MDCFadingTabIndicatorFoundation;
  16504. }(foundation_1.MDCTabIndicatorFoundation);
  16505. exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation;
  16506. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16507. exports.default = MDCFadingTabIndicatorFoundation;
  16508. /***/ }),
  16509. /***/ "./packages/mdc-tab-indicator/foundation.ts":
  16510. /*!**************************************************!*\
  16511. !*** ./packages/mdc-tab-indicator/foundation.ts ***!
  16512. \**************************************************/
  16513. /*! no static exports found */
  16514. /***/ (function(module, exports, __webpack_require__) {
  16515. "use strict";
  16516. /**
  16517. * @license
  16518. * Copyright 2018 Google Inc.
  16519. *
  16520. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16521. * of this software and associated documentation files (the "Software"), to deal
  16522. * in the Software without restriction, including without limitation the rights
  16523. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16524. * copies of the Software, and to permit persons to whom the Software is
  16525. * furnished to do so, subject to the following conditions:
  16526. *
  16527. * The above copyright notice and this permission notice shall be included in
  16528. * all copies or substantial portions of the Software.
  16529. *
  16530. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16531. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16532. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16533. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16534. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16535. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16536. * THE SOFTWARE.
  16537. */
  16538. var __extends = this && this.__extends || function () {
  16539. var _extendStatics = function extendStatics(d, b) {
  16540. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16541. d.__proto__ = b;
  16542. } || function (d, b) {
  16543. for (var p in b) {
  16544. if (b.hasOwnProperty(p)) d[p] = b[p];
  16545. }
  16546. };
  16547. return _extendStatics(d, b);
  16548. };
  16549. return function (d, b) {
  16550. _extendStatics(d, b);
  16551. function __() {
  16552. this.constructor = d;
  16553. }
  16554. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16555. };
  16556. }();
  16557. var __assign = this && this.__assign || function () {
  16558. __assign = Object.assign || function (t) {
  16559. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16560. s = arguments[i];
  16561. for (var p in s) {
  16562. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16563. }
  16564. }
  16565. return t;
  16566. };
  16567. return __assign.apply(this, arguments);
  16568. };
  16569. Object.defineProperty(exports, "__esModule", { value: true });
  16570. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  16571. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts");
  16572. var MDCTabIndicatorFoundation = /** @class */function (_super) {
  16573. __extends(MDCTabIndicatorFoundation, _super);
  16574. function MDCTabIndicatorFoundation(adapter) {
  16575. return _super.call(this, __assign({}, MDCTabIndicatorFoundation.defaultAdapter, adapter)) || this;
  16576. }
  16577. Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", {
  16578. get: function get() {
  16579. return constants_1.cssClasses;
  16580. },
  16581. enumerable: true,
  16582. configurable: true
  16583. });
  16584. Object.defineProperty(MDCTabIndicatorFoundation, "strings", {
  16585. get: function get() {
  16586. return constants_1.strings;
  16587. },
  16588. enumerable: true,
  16589. configurable: true
  16590. });
  16591. Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", {
  16592. get: function get() {
  16593. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16594. return {
  16595. addClass: function addClass() {
  16596. return undefined;
  16597. },
  16598. removeClass: function removeClass() {
  16599. return undefined;
  16600. },
  16601. computeContentClientRect: function computeContentClientRect() {
  16602. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  16603. },
  16604. setContentStyleProperty: function setContentStyleProperty() {
  16605. return undefined;
  16606. }
  16607. };
  16608. // tslint:enable:object-literal-sort-keys
  16609. },
  16610. enumerable: true,
  16611. configurable: true
  16612. });
  16613. MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {
  16614. return this.adapter_.computeContentClientRect();
  16615. };
  16616. return MDCTabIndicatorFoundation;
  16617. }(foundation_1.MDCFoundation);
  16618. exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation;
  16619. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16620. exports.default = MDCTabIndicatorFoundation;
  16621. /***/ }),
  16622. /***/ "./packages/mdc-tab-indicator/index.ts":
  16623. /*!*********************************************!*\
  16624. !*** ./packages/mdc-tab-indicator/index.ts ***!
  16625. \*********************************************/
  16626. /*! no static exports found */
  16627. /***/ (function(module, exports, __webpack_require__) {
  16628. "use strict";
  16629. /**
  16630. * @license
  16631. * Copyright 2019 Google Inc.
  16632. *
  16633. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16634. * of this software and associated documentation files (the "Software"), to deal
  16635. * in the Software without restriction, including without limitation the rights
  16636. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16637. * copies of the Software, and to permit persons to whom the Software is
  16638. * furnished to do so, subject to the following conditions:
  16639. *
  16640. * The above copyright notice and this permission notice shall be included in
  16641. * all copies or substantial portions of the Software.
  16642. *
  16643. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16644. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16645. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16646. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16647. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16648. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16649. * THE SOFTWARE.
  16650. */
  16651. function __export(m) {
  16652. for (var p in m) {
  16653. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16654. }
  16655. }
  16656. Object.defineProperty(exports, "__esModule", { value: true });
  16657. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-indicator/component.ts"));
  16658. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"));
  16659. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"));
  16660. __export(__webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"));
  16661. __export(__webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"));
  16662. /***/ }),
  16663. /***/ "./packages/mdc-tab-indicator/sliding-foundation.ts":
  16664. /*!**********************************************************!*\
  16665. !*** ./packages/mdc-tab-indicator/sliding-foundation.ts ***!
  16666. \**********************************************************/
  16667. /*! no static exports found */
  16668. /***/ (function(module, exports, __webpack_require__) {
  16669. "use strict";
  16670. /**
  16671. * @license
  16672. * Copyright 2018 Google Inc.
  16673. *
  16674. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16675. * of this software and associated documentation files (the "Software"), to deal
  16676. * in the Software without restriction, including without limitation the rights
  16677. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16678. * copies of the Software, and to permit persons to whom the Software is
  16679. * furnished to do so, subject to the following conditions:
  16680. *
  16681. * The above copyright notice and this permission notice shall be included in
  16682. * all copies or substantial portions of the Software.
  16683. *
  16684. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16685. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16686. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16687. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16688. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16689. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16690. * THE SOFTWARE.
  16691. */
  16692. var __extends = this && this.__extends || function () {
  16693. var _extendStatics = function extendStatics(d, b) {
  16694. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16695. d.__proto__ = b;
  16696. } || function (d, b) {
  16697. for (var p in b) {
  16698. if (b.hasOwnProperty(p)) d[p] = b[p];
  16699. }
  16700. };
  16701. return _extendStatics(d, b);
  16702. };
  16703. return function (d, b) {
  16704. _extendStatics(d, b);
  16705. function __() {
  16706. this.constructor = d;
  16707. }
  16708. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16709. };
  16710. }();
  16711. Object.defineProperty(exports, "__esModule", { value: true });
  16712. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16713. /* istanbul ignore next: subclass is not a branch statement */
  16714. var MDCSlidingTabIndicatorFoundation = /** @class */function (_super) {
  16715. __extends(MDCSlidingTabIndicatorFoundation, _super);
  16716. function MDCSlidingTabIndicatorFoundation() {
  16717. return _super !== null && _super.apply(this, arguments) || this;
  16718. }
  16719. MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {
  16720. // Early exit if no indicator is present to handle cases where an indicator
  16721. // may be activated without a prior indicator state
  16722. if (!previousIndicatorClientRect) {
  16723. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16724. return;
  16725. }
  16726. // This animation uses the FLIP approach. You can read more about it at the link below:
  16727. // https://aerotwist.com/blog/flip-your-animations/
  16728. // Calculate the dimensions based on the dimensions of the previous indicator
  16729. var currentClientRect = this.computeContentClientRect();
  16730. var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
  16731. var xPosition = previousIndicatorClientRect.left - currentClientRect.left;
  16732. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  16733. this.adapter_.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")");
  16734. // Force repaint before updating classes and transform to ensure the transform properly takes effect
  16735. this.computeContentClientRect();
  16736. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  16737. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16738. this.adapter_.setContentStyleProperty('transform', '');
  16739. };
  16740. MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {
  16741. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16742. };
  16743. return MDCSlidingTabIndicatorFoundation;
  16744. }(foundation_1.MDCTabIndicatorFoundation);
  16745. exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation;
  16746. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16747. exports.default = MDCSlidingTabIndicatorFoundation;
  16748. /***/ }),
  16749. /***/ "./packages/mdc-tab-scroller/component.ts":
  16750. /*!************************************************!*\
  16751. !*** ./packages/mdc-tab-scroller/component.ts ***!
  16752. \************************************************/
  16753. /*! no static exports found */
  16754. /***/ (function(module, exports, __webpack_require__) {
  16755. "use strict";
  16756. /**
  16757. * @license
  16758. * Copyright 2018 Google Inc.
  16759. *
  16760. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16761. * of this software and associated documentation files (the "Software"), to deal
  16762. * in the Software without restriction, including without limitation the rights
  16763. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16764. * copies of the Software, and to permit persons to whom the Software is
  16765. * furnished to do so, subject to the following conditions:
  16766. *
  16767. * The above copyright notice and this permission notice shall be included in
  16768. * all copies or substantial portions of the Software.
  16769. *
  16770. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16771. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16772. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16773. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16774. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16775. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16776. * THE SOFTWARE.
  16777. */
  16778. var __extends = this && this.__extends || function () {
  16779. var _extendStatics = function extendStatics(d, b) {
  16780. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16781. d.__proto__ = b;
  16782. } || function (d, b) {
  16783. for (var p in b) {
  16784. if (b.hasOwnProperty(p)) d[p] = b[p];
  16785. }
  16786. };
  16787. return _extendStatics(d, b);
  16788. };
  16789. return function (d, b) {
  16790. _extendStatics(d, b);
  16791. function __() {
  16792. this.constructor = d;
  16793. }
  16794. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16795. };
  16796. }();
  16797. var __importStar = this && this.__importStar || function (mod) {
  16798. if (mod && mod.__esModule) return mod;
  16799. var result = {};
  16800. if (mod != null) for (var k in mod) {
  16801. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  16802. }result["default"] = mod;
  16803. return result;
  16804. };
  16805. Object.defineProperty(exports, "__esModule", { value: true });
  16806. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16807. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  16808. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  16809. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts");
  16810. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  16811. var MDCTabScroller = /** @class */function (_super) {
  16812. __extends(MDCTabScroller, _super);
  16813. function MDCTabScroller() {
  16814. return _super !== null && _super.apply(this, arguments) || this;
  16815. }
  16816. MDCTabScroller.attachTo = function (root) {
  16817. return new MDCTabScroller(root);
  16818. };
  16819. MDCTabScroller.prototype.initialize = function () {
  16820. this.area_ = this.root_.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR);
  16821. this.content_ = this.root_.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);
  16822. };
  16823. MDCTabScroller.prototype.initialSyncWithDOM = function () {
  16824. var _this = this;
  16825. this.handleInteraction_ = function () {
  16826. return _this.foundation_.handleInteraction();
  16827. };
  16828. this.handleTransitionEnd_ = function (evt) {
  16829. return _this.foundation_.handleTransitionEnd(evt);
  16830. };
  16831. this.area_.addEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  16832. this.area_.addEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  16833. this.area_.addEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  16834. this.area_.addEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  16835. this.area_.addEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  16836. this.content_.addEventListener('transitionend', this.handleTransitionEnd_);
  16837. };
  16838. MDCTabScroller.prototype.destroy = function () {
  16839. _super.prototype.destroy.call(this);
  16840. this.area_.removeEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  16841. this.area_.removeEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  16842. this.area_.removeEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  16843. this.area_.removeEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  16844. this.area_.removeEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  16845. this.content_.removeEventListener('transitionend', this.handleTransitionEnd_);
  16846. };
  16847. MDCTabScroller.prototype.getDefaultFoundation = function () {
  16848. var _this = this;
  16849. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16850. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16851. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16852. var adapter = {
  16853. eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) {
  16854. return ponyfill_1.matches(evtTarget, selector);
  16855. },
  16856. addClass: function addClass(className) {
  16857. return _this.root_.classList.add(className);
  16858. },
  16859. removeClass: function removeClass(className) {
  16860. return _this.root_.classList.remove(className);
  16861. },
  16862. addScrollAreaClass: function addScrollAreaClass(className) {
  16863. return _this.area_.classList.add(className);
  16864. },
  16865. setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) {
  16866. return _this.area_.style.setProperty(prop, value);
  16867. },
  16868. setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) {
  16869. return _this.content_.style.setProperty(prop, value);
  16870. },
  16871. getScrollContentStyleValue: function getScrollContentStyleValue(propName) {
  16872. return window.getComputedStyle(_this.content_).getPropertyValue(propName);
  16873. },
  16874. setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) {
  16875. return _this.area_.scrollLeft = scrollX;
  16876. },
  16877. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  16878. return _this.area_.scrollLeft;
  16879. },
  16880. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  16881. return _this.content_.offsetWidth;
  16882. },
  16883. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  16884. return _this.area_.offsetWidth;
  16885. },
  16886. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  16887. return _this.area_.getBoundingClientRect();
  16888. },
  16889. computeScrollContentClientRect: function computeScrollContentClientRect() {
  16890. return _this.content_.getBoundingClientRect();
  16891. },
  16892. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  16893. return util.computeHorizontalScrollbarHeight(document);
  16894. }
  16895. };
  16896. // tslint:enable:object-literal-sort-keys
  16897. return new foundation_1.MDCTabScrollerFoundation(adapter);
  16898. };
  16899. /**
  16900. * Returns the current visual scroll position
  16901. */
  16902. MDCTabScroller.prototype.getScrollPosition = function () {
  16903. return this.foundation_.getScrollPosition();
  16904. };
  16905. /**
  16906. * Returns the width of the scroll content
  16907. */
  16908. MDCTabScroller.prototype.getScrollContentWidth = function () {
  16909. return this.content_.offsetWidth;
  16910. };
  16911. /**
  16912. * Increments the scroll value by the given amount
  16913. * @param scrollXIncrement The pixel value by which to increment the scroll value
  16914. */
  16915. MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {
  16916. this.foundation_.incrementScroll(scrollXIncrement);
  16917. };
  16918. /**
  16919. * Scrolls to the given pixel position
  16920. * @param scrollX The pixel value to scroll to
  16921. */
  16922. MDCTabScroller.prototype.scrollTo = function (scrollX) {
  16923. this.foundation_.scrollTo(scrollX);
  16924. };
  16925. return MDCTabScroller;
  16926. }(component_1.MDCComponent);
  16927. exports.MDCTabScroller = MDCTabScroller;
  16928. /***/ }),
  16929. /***/ "./packages/mdc-tab-scroller/constants.ts":
  16930. /*!************************************************!*\
  16931. !*** ./packages/mdc-tab-scroller/constants.ts ***!
  16932. \************************************************/
  16933. /*! no static exports found */
  16934. /***/ (function(module, exports, __webpack_require__) {
  16935. "use strict";
  16936. /**
  16937. * @license
  16938. * Copyright 2018 Google Inc.
  16939. *
  16940. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16941. * of this software and associated documentation files (the "Software"), to deal
  16942. * in the Software without restriction, including without limitation the rights
  16943. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16944. * copies of the Software, and to permit persons to whom the Software is
  16945. * furnished to do so, subject to the following conditions:
  16946. *
  16947. * The above copyright notice and this permission notice shall be included in
  16948. * all copies or substantial portions of the Software.
  16949. *
  16950. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16951. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16952. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16953. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16954. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16955. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16956. * THE SOFTWARE.
  16957. */
  16958. Object.defineProperty(exports, "__esModule", { value: true });
  16959. var cssClasses = {
  16960. ANIMATING: 'mdc-tab-scroller--animating',
  16961. SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',
  16962. SCROLL_TEST: 'mdc-tab-scroller__test'
  16963. };
  16964. exports.cssClasses = cssClasses;
  16965. var strings = {
  16966. AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',
  16967. CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content'
  16968. };
  16969. exports.strings = strings;
  16970. /***/ }),
  16971. /***/ "./packages/mdc-tab-scroller/foundation.ts":
  16972. /*!*************************************************!*\
  16973. !*** ./packages/mdc-tab-scroller/foundation.ts ***!
  16974. \*************************************************/
  16975. /*! no static exports found */
  16976. /***/ (function(module, exports, __webpack_require__) {
  16977. "use strict";
  16978. /**
  16979. * @license
  16980. * Copyright 2018 Google Inc.
  16981. *
  16982. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16983. * of this software and associated documentation files (the "Software"), to deal
  16984. * in the Software without restriction, including without limitation the rights
  16985. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16986. * copies of the Software, and to permit persons to whom the Software is
  16987. * furnished to do so, subject to the following conditions:
  16988. *
  16989. * The above copyright notice and this permission notice shall be included in
  16990. * all copies or substantial portions of the Software.
  16991. *
  16992. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16993. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16994. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16995. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16996. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16997. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16998. * THE SOFTWARE.
  16999. */
  17000. var __extends = this && this.__extends || function () {
  17001. var _extendStatics = function extendStatics(d, b) {
  17002. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17003. d.__proto__ = b;
  17004. } || function (d, b) {
  17005. for (var p in b) {
  17006. if (b.hasOwnProperty(p)) d[p] = b[p];
  17007. }
  17008. };
  17009. return _extendStatics(d, b);
  17010. };
  17011. return function (d, b) {
  17012. _extendStatics(d, b);
  17013. function __() {
  17014. this.constructor = d;
  17015. }
  17016. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17017. };
  17018. }();
  17019. var __assign = this && this.__assign || function () {
  17020. __assign = Object.assign || function (t) {
  17021. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17022. s = arguments[i];
  17023. for (var p in s) {
  17024. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17025. }
  17026. }
  17027. return t;
  17028. };
  17029. return __assign.apply(this, arguments);
  17030. };
  17031. var __read = this && this.__read || function (o, n) {
  17032. var m = typeof Symbol === "function" && o[Symbol.iterator];
  17033. if (!m) return o;
  17034. var i = m.call(o),
  17035. r,
  17036. ar = [],
  17037. e;
  17038. try {
  17039. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  17040. ar.push(r.value);
  17041. }
  17042. } catch (error) {
  17043. e = { error: error };
  17044. } finally {
  17045. try {
  17046. if (r && !r.done && (m = i["return"])) m.call(i);
  17047. } finally {
  17048. if (e) throw e.error;
  17049. }
  17050. }
  17051. return ar;
  17052. };
  17053. Object.defineProperty(exports, "__esModule", { value: true });
  17054. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  17055. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  17056. var rtl_default_scroller_1 = __webpack_require__(/*! ./rtl-default-scroller */ "./packages/mdc-tab-scroller/rtl-default-scroller.ts");
  17057. var rtl_negative_scroller_1 = __webpack_require__(/*! ./rtl-negative-scroller */ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts");
  17058. var rtl_reverse_scroller_1 = __webpack_require__(/*! ./rtl-reverse-scroller */ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts");
  17059. var MDCTabScrollerFoundation = /** @class */function (_super) {
  17060. __extends(MDCTabScrollerFoundation, _super);
  17061. function MDCTabScrollerFoundation(adapter) {
  17062. var _this = _super.call(this, __assign({}, MDCTabScrollerFoundation.defaultAdapter, adapter)) || this;
  17063. /**
  17064. * Controls whether we should handle the transitionend and interaction events during the animation.
  17065. */
  17066. _this.isAnimating_ = false;
  17067. return _this;
  17068. }
  17069. Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", {
  17070. get: function get() {
  17071. return constants_1.cssClasses;
  17072. },
  17073. enumerable: true,
  17074. configurable: true
  17075. });
  17076. Object.defineProperty(MDCTabScrollerFoundation, "strings", {
  17077. get: function get() {
  17078. return constants_1.strings;
  17079. },
  17080. enumerable: true,
  17081. configurable: true
  17082. });
  17083. Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", {
  17084. get: function get() {
  17085. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17086. return {
  17087. eventTargetMatchesSelector: function eventTargetMatchesSelector() {
  17088. return false;
  17089. },
  17090. addClass: function addClass() {
  17091. return undefined;
  17092. },
  17093. removeClass: function removeClass() {
  17094. return undefined;
  17095. },
  17096. addScrollAreaClass: function addScrollAreaClass() {
  17097. return undefined;
  17098. },
  17099. setScrollAreaStyleProperty: function setScrollAreaStyleProperty() {
  17100. return undefined;
  17101. },
  17102. setScrollContentStyleProperty: function setScrollContentStyleProperty() {
  17103. return undefined;
  17104. },
  17105. getScrollContentStyleValue: function getScrollContentStyleValue() {
  17106. return '';
  17107. },
  17108. setScrollAreaScrollLeft: function setScrollAreaScrollLeft() {
  17109. return undefined;
  17110. },
  17111. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  17112. return 0;
  17113. },
  17114. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  17115. return 0;
  17116. },
  17117. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  17118. return 0;
  17119. },
  17120. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  17121. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  17122. },
  17123. computeScrollContentClientRect: function computeScrollContentClientRect() {
  17124. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  17125. },
  17126. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  17127. return 0;
  17128. }
  17129. };
  17130. // tslint:enable:object-literal-sort-keys
  17131. },
  17132. enumerable: true,
  17133. configurable: true
  17134. });
  17135. MDCTabScrollerFoundation.prototype.init = function () {
  17136. // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll
  17137. // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs.
  17138. var horizontalScrollbarHeight = this.adapter_.computeHorizontalScrollbarHeight();
  17139. this.adapter_.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');
  17140. this.adapter_.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);
  17141. };
  17142. /**
  17143. * Computes the current visual scroll position
  17144. */
  17145. MDCTabScrollerFoundation.prototype.getScrollPosition = function () {
  17146. if (this.isRTL_()) {
  17147. return this.computeCurrentScrollPositionRTL_();
  17148. }
  17149. var currentTranslateX = this.calculateCurrentTranslateX_();
  17150. var scrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17151. return scrollLeft - currentTranslateX;
  17152. };
  17153. /**
  17154. * Handles interaction events that occur during transition
  17155. */
  17156. MDCTabScrollerFoundation.prototype.handleInteraction = function () {
  17157. // Early exit if we aren't animating
  17158. if (!this.isAnimating_) {
  17159. return;
  17160. }
  17161. // Prevent other event listeners from handling this event
  17162. this.stopScrollAnimation_();
  17163. };
  17164. /**
  17165. * Handles the transitionend event
  17166. */
  17167. MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {
  17168. // Early exit if we aren't animating or the event was triggered by a different element.
  17169. var evtTarget = evt.target;
  17170. if (!this.isAnimating_ || !this.adapter_.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {
  17171. return;
  17172. }
  17173. this.isAnimating_ = false;
  17174. this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  17175. };
  17176. /**
  17177. * Increment the scroll value by the scrollXIncrement
  17178. * @param scrollXIncrement The value by which to increment the scroll position
  17179. */
  17180. MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {
  17181. // Early exit for non-operational increment values
  17182. if (scrollXIncrement === 0) {
  17183. return;
  17184. }
  17185. if (this.isRTL_()) {
  17186. return this.incrementScrollRTL_(scrollXIncrement);
  17187. }
  17188. this.incrementScroll_(scrollXIncrement);
  17189. };
  17190. /**
  17191. * Scrolls to the given scrollX value
  17192. */
  17193. MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {
  17194. if (this.isRTL_()) {
  17195. return this.scrollToRTL_(scrollX);
  17196. }
  17197. this.scrollTo_(scrollX);
  17198. };
  17199. /**
  17200. * @return Browser-specific {@link MDCTabScrollerRTL} instance.
  17201. */
  17202. MDCTabScrollerFoundation.prototype.getRTLScroller = function () {
  17203. if (!this.rtlScrollerInstance_) {
  17204. this.rtlScrollerInstance_ = this.rtlScrollerFactory_();
  17205. }
  17206. return this.rtlScrollerInstance_;
  17207. };
  17208. /**
  17209. * @return translateX value from a CSS matrix transform function string.
  17210. */
  17211. MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () {
  17212. var transformValue = this.adapter_.getScrollContentStyleValue('transform');
  17213. // Early exit if no transform is present
  17214. if (transformValue === 'none') {
  17215. return 0;
  17216. }
  17217. // The transform value comes back as a matrix transformation in the form
  17218. // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so
  17219. // we're going to grab all the parenthesized values, strip out tx, and
  17220. // parse it.
  17221. var match = /\((.+?)\)/.exec(transformValue);
  17222. if (!match) {
  17223. return 0;
  17224. }
  17225. var matrixParams = match[1];
  17226. // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error.
  17227. // @ts-ignore These unused variables should retain their semantic names for clarity.
  17228. var _a = __read(matrixParams.split(','), 6),
  17229. a = _a[0],
  17230. b = _a[1],
  17231. c = _a[2],
  17232. d = _a[3],
  17233. tx = _a[4],
  17234. ty = _a[5];
  17235. return parseFloat(tx); // tslint:disable-line:ban
  17236. };
  17237. /**
  17238. * Calculates a safe scroll value that is > 0 and < the max scroll value
  17239. * @param scrollX The distance to scroll
  17240. */
  17241. MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) {
  17242. var edges = this.calculateScrollEdges_();
  17243. return Math.min(Math.max(edges.left, scrollX), edges.right);
  17244. };
  17245. MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () {
  17246. var translateX = this.calculateCurrentTranslateX_();
  17247. return this.getRTLScroller().getScrollPositionRTL(translateX);
  17248. };
  17249. MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () {
  17250. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17251. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17252. return {
  17253. left: 0,
  17254. right: contentWidth - rootWidth
  17255. };
  17256. };
  17257. /**
  17258. * Internal scroll method
  17259. * @param scrollX The new scroll position
  17260. */
  17261. MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) {
  17262. var currentScrollX = this.getScrollPosition();
  17263. var safeScrollX = this.clampScrollValue_(scrollX);
  17264. var scrollDelta = safeScrollX - currentScrollX;
  17265. this.animate_({
  17266. finalScrollPosition: safeScrollX,
  17267. scrollDelta: scrollDelta
  17268. });
  17269. };
  17270. /**
  17271. * Internal RTL scroll method
  17272. * @param scrollX The new scroll position
  17273. */
  17274. MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) {
  17275. var animation = this.getRTLScroller().scrollToRTL(scrollX);
  17276. this.animate_(animation);
  17277. };
  17278. /**
  17279. * Internal increment scroll method
  17280. * @param scrollX The new scroll position increment
  17281. */
  17282. MDCTabScrollerFoundation.prototype.incrementScroll_ = function (scrollX) {
  17283. var currentScrollX = this.getScrollPosition();
  17284. var targetScrollX = scrollX + currentScrollX;
  17285. var safeScrollX = this.clampScrollValue_(targetScrollX);
  17286. var scrollDelta = safeScrollX - currentScrollX;
  17287. this.animate_({
  17288. finalScrollPosition: safeScrollX,
  17289. scrollDelta: scrollDelta
  17290. });
  17291. };
  17292. /**
  17293. * Internal increment scroll RTL method
  17294. * @param scrollX The new scroll position RTL increment
  17295. */
  17296. MDCTabScrollerFoundation.prototype.incrementScrollRTL_ = function (scrollX) {
  17297. var animation = this.getRTLScroller().incrementScrollRTL(scrollX);
  17298. this.animate_(animation);
  17299. };
  17300. /**
  17301. * Animates the tab scrolling
  17302. * @param animation The animation to apply
  17303. */
  17304. MDCTabScrollerFoundation.prototype.animate_ = function (animation) {
  17305. var _this = this;
  17306. // Early exit if translateX is 0, which means there's no animation to perform
  17307. if (animation.scrollDelta === 0) {
  17308. return;
  17309. }
  17310. this.stopScrollAnimation_();
  17311. // This animation uses the FLIP approach.
  17312. // Read more here: https://aerotwist.com/blog/flip-your-animations/
  17313. this.adapter_.setScrollAreaScrollLeft(animation.finalScrollPosition);
  17314. this.adapter_.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)");
  17315. // Force repaint
  17316. this.adapter_.computeScrollAreaClientRect();
  17317. requestAnimationFrame(function () {
  17318. _this.adapter_.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  17319. _this.adapter_.setScrollContentStyleProperty('transform', 'none');
  17320. });
  17321. this.isAnimating_ = true;
  17322. };
  17323. /**
  17324. * Stops scroll animation
  17325. */
  17326. MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () {
  17327. this.isAnimating_ = false;
  17328. var currentScrollPosition = this.getAnimatingScrollPosition_();
  17329. this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  17330. this.adapter_.setScrollContentStyleProperty('transform', 'translateX(0px)');
  17331. this.adapter_.setScrollAreaScrollLeft(currentScrollPosition);
  17332. };
  17333. /**
  17334. * Gets the current scroll position during animation
  17335. */
  17336. MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () {
  17337. var currentTranslateX = this.calculateCurrentTranslateX_();
  17338. var scrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17339. if (this.isRTL_()) {
  17340. return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);
  17341. }
  17342. return scrollLeft - currentTranslateX;
  17343. };
  17344. /**
  17345. * Determines the RTL Scroller to use
  17346. */
  17347. MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () {
  17348. // Browsers have three different implementations of scrollLeft in RTL mode,
  17349. // dependent on the browser. The behavior is based off the max LTR
  17350. // scrollLeft value and 0.
  17351. //
  17352. // * Default scrolling in RTL *
  17353. // - Left-most value: 0
  17354. // - Right-most value: Max LTR scrollLeft value
  17355. //
  17356. // * Negative scrolling in RTL *
  17357. // - Left-most value: Negated max LTR scrollLeft value
  17358. // - Right-most value: 0
  17359. //
  17360. // * Reverse scrolling in RTL *
  17361. // - Left-most value: Max LTR scrollLeft value
  17362. // - Right-most value: 0
  17363. //
  17364. // We use those principles below to determine which RTL scrollLeft
  17365. // behavior is implemented in the current browser.
  17366. var initialScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17367. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft - 1);
  17368. var newScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17369. // If the newScrollLeft value is negative,then we know that the browser has
  17370. // implemented negative RTL scrolling, since all other implementations have
  17371. // only positive values.
  17372. if (newScrollLeft < 0) {
  17373. // Undo the scrollLeft test check
  17374. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft);
  17375. return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter_);
  17376. }
  17377. var rootClientRect = this.adapter_.computeScrollAreaClientRect();
  17378. var contentClientRect = this.adapter_.computeScrollContentClientRect();
  17379. var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);
  17380. // Undo the scrollLeft test check
  17381. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft);
  17382. // By calculating the clientRect of the root element and the clientRect of
  17383. // the content element, we can determine how much the scroll value changed
  17384. // when we performed the scrollLeft subtraction above.
  17385. if (rightEdgeDelta === newScrollLeft) {
  17386. return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter_);
  17387. }
  17388. return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter_);
  17389. };
  17390. MDCTabScrollerFoundation.prototype.isRTL_ = function () {
  17391. return this.adapter_.getScrollContentStyleValue('direction') === 'rtl';
  17392. };
  17393. return MDCTabScrollerFoundation;
  17394. }(foundation_1.MDCFoundation);
  17395. exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation;
  17396. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17397. exports.default = MDCTabScrollerFoundation;
  17398. /***/ }),
  17399. /***/ "./packages/mdc-tab-scroller/index.ts":
  17400. /*!********************************************!*\
  17401. !*** ./packages/mdc-tab-scroller/index.ts ***!
  17402. \********************************************/
  17403. /*! no static exports found */
  17404. /***/ (function(module, exports, __webpack_require__) {
  17405. "use strict";
  17406. /**
  17407. * @license
  17408. * Copyright 2019 Google Inc.
  17409. *
  17410. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17411. * of this software and associated documentation files (the "Software"), to deal
  17412. * in the Software without restriction, including without limitation the rights
  17413. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17414. * copies of the Software, and to permit persons to whom the Software is
  17415. * furnished to do so, subject to the following conditions:
  17416. *
  17417. * The above copyright notice and this permission notice shall be included in
  17418. * all copies or substantial portions of the Software.
  17419. *
  17420. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17421. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17422. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17423. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17424. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17425. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17426. * THE SOFTWARE.
  17427. */
  17428. function __export(m) {
  17429. for (var p in m) {
  17430. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  17431. }
  17432. }
  17433. var __importStar = this && this.__importStar || function (mod) {
  17434. if (mod && mod.__esModule) return mod;
  17435. var result = {};
  17436. if (mod != null) for (var k in mod) {
  17437. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  17438. }result["default"] = mod;
  17439. return result;
  17440. };
  17441. Object.defineProperty(exports, "__esModule", { value: true });
  17442. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  17443. exports.util = util;
  17444. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-scroller/component.ts"));
  17445. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"));
  17446. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"));
  17447. /***/ }),
  17448. /***/ "./packages/mdc-tab-scroller/rtl-default-scroller.ts":
  17449. /*!***********************************************************!*\
  17450. !*** ./packages/mdc-tab-scroller/rtl-default-scroller.ts ***!
  17451. \***********************************************************/
  17452. /*! no static exports found */
  17453. /***/ (function(module, exports, __webpack_require__) {
  17454. "use strict";
  17455. /**
  17456. * @license
  17457. * Copyright 2018 Google Inc.
  17458. *
  17459. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17460. * of this software and associated documentation files (the "Software"), to deal
  17461. * in the Software without restriction, including without limitation the rights
  17462. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17463. * copies of the Software, and to permit persons to whom the Software is
  17464. * furnished to do so, subject to the following conditions:
  17465. *
  17466. * The above copyright notice and this permission notice shall be included in
  17467. * all copies or substantial portions of the Software.
  17468. *
  17469. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17470. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17471. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17472. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17473. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17474. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17475. * THE SOFTWARE.
  17476. */
  17477. var __extends = this && this.__extends || function () {
  17478. var _extendStatics = function extendStatics(d, b) {
  17479. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17480. d.__proto__ = b;
  17481. } || function (d, b) {
  17482. for (var p in b) {
  17483. if (b.hasOwnProperty(p)) d[p] = b[p];
  17484. }
  17485. };
  17486. return _extendStatics(d, b);
  17487. };
  17488. return function (d, b) {
  17489. _extendStatics(d, b);
  17490. function __() {
  17491. this.constructor = d;
  17492. }
  17493. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17494. };
  17495. }();
  17496. Object.defineProperty(exports, "__esModule", { value: true });
  17497. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17498. var MDCTabScrollerRTLDefault = /** @class */function (_super) {
  17499. __extends(MDCTabScrollerRTLDefault, _super);
  17500. function MDCTabScrollerRTLDefault() {
  17501. return _super !== null && _super.apply(this, arguments) || this;
  17502. }
  17503. MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {
  17504. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17505. var right = this.calculateScrollEdges_().right;
  17506. // Scroll values on most browsers are ints instead of floats so we round
  17507. return Math.round(right - currentScrollLeft);
  17508. };
  17509. MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {
  17510. var edges = this.calculateScrollEdges_();
  17511. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17512. var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX);
  17513. return {
  17514. finalScrollPosition: clampedScrollLeft,
  17515. scrollDelta: clampedScrollLeft - currentScrollLeft
  17516. };
  17517. };
  17518. MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {
  17519. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17520. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  17521. return {
  17522. finalScrollPosition: clampedScrollLeft,
  17523. scrollDelta: clampedScrollLeft - currentScrollLeft
  17524. };
  17525. };
  17526. MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {
  17527. return scrollX;
  17528. };
  17529. MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () {
  17530. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17531. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17532. return {
  17533. left: 0,
  17534. right: contentWidth - rootWidth
  17535. };
  17536. };
  17537. MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) {
  17538. var edges = this.calculateScrollEdges_();
  17539. return Math.min(Math.max(edges.left, scrollX), edges.right);
  17540. };
  17541. return MDCTabScrollerRTLDefault;
  17542. }(rtl_scroller_1.MDCTabScrollerRTL);
  17543. exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault;
  17544. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17545. exports.default = MDCTabScrollerRTLDefault;
  17546. /***/ }),
  17547. /***/ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts":
  17548. /*!************************************************************!*\
  17549. !*** ./packages/mdc-tab-scroller/rtl-negative-scroller.ts ***!
  17550. \************************************************************/
  17551. /*! no static exports found */
  17552. /***/ (function(module, exports, __webpack_require__) {
  17553. "use strict";
  17554. /**
  17555. * @license
  17556. * Copyright 2018 Google Inc.
  17557. *
  17558. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17559. * of this software and associated documentation files (the "Software"), to deal
  17560. * in the Software without restriction, including without limitation the rights
  17561. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17562. * copies of the Software, and to permit persons to whom the Software is
  17563. * furnished to do so, subject to the following conditions:
  17564. *
  17565. * The above copyright notice and this permission notice shall be included in
  17566. * all copies or substantial portions of the Software.
  17567. *
  17568. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17569. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17570. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17571. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17572. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17573. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17574. * THE SOFTWARE.
  17575. */
  17576. var __extends = this && this.__extends || function () {
  17577. var _extendStatics = function extendStatics(d, b) {
  17578. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17579. d.__proto__ = b;
  17580. } || function (d, b) {
  17581. for (var p in b) {
  17582. if (b.hasOwnProperty(p)) d[p] = b[p];
  17583. }
  17584. };
  17585. return _extendStatics(d, b);
  17586. };
  17587. return function (d, b) {
  17588. _extendStatics(d, b);
  17589. function __() {
  17590. this.constructor = d;
  17591. }
  17592. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17593. };
  17594. }();
  17595. Object.defineProperty(exports, "__esModule", { value: true });
  17596. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17597. var MDCTabScrollerRTLNegative = /** @class */function (_super) {
  17598. __extends(MDCTabScrollerRTLNegative, _super);
  17599. function MDCTabScrollerRTLNegative() {
  17600. return _super !== null && _super.apply(this, arguments) || this;
  17601. }
  17602. MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {
  17603. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17604. return Math.round(translateX - currentScrollLeft);
  17605. };
  17606. MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {
  17607. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17608. var clampedScrollLeft = this.clampScrollValue_(-scrollX);
  17609. return {
  17610. finalScrollPosition: clampedScrollLeft,
  17611. scrollDelta: clampedScrollLeft - currentScrollLeft
  17612. };
  17613. };
  17614. MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {
  17615. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17616. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  17617. return {
  17618. finalScrollPosition: clampedScrollLeft,
  17619. scrollDelta: clampedScrollLeft - currentScrollLeft
  17620. };
  17621. };
  17622. MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  17623. return scrollX - translateX;
  17624. };
  17625. MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () {
  17626. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17627. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17628. return {
  17629. left: rootWidth - contentWidth,
  17630. right: 0
  17631. };
  17632. };
  17633. MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) {
  17634. var edges = this.calculateScrollEdges_();
  17635. return Math.max(Math.min(edges.right, scrollX), edges.left);
  17636. };
  17637. return MDCTabScrollerRTLNegative;
  17638. }(rtl_scroller_1.MDCTabScrollerRTL);
  17639. exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative;
  17640. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17641. exports.default = MDCTabScrollerRTLNegative;
  17642. /***/ }),
  17643. /***/ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts":
  17644. /*!***********************************************************!*\
  17645. !*** ./packages/mdc-tab-scroller/rtl-reverse-scroller.ts ***!
  17646. \***********************************************************/
  17647. /*! no static exports found */
  17648. /***/ (function(module, exports, __webpack_require__) {
  17649. "use strict";
  17650. /**
  17651. * @license
  17652. * Copyright 2018 Google Inc.
  17653. *
  17654. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17655. * of this software and associated documentation files (the "Software"), to deal
  17656. * in the Software without restriction, including without limitation the rights
  17657. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17658. * copies of the Software, and to permit persons to whom the Software is
  17659. * furnished to do so, subject to the following conditions:
  17660. *
  17661. * The above copyright notice and this permission notice shall be included in
  17662. * all copies or substantial portions of the Software.
  17663. *
  17664. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17665. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17666. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17667. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17668. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17669. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17670. * THE SOFTWARE.
  17671. */
  17672. var __extends = this && this.__extends || function () {
  17673. var _extendStatics = function extendStatics(d, b) {
  17674. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17675. d.__proto__ = b;
  17676. } || function (d, b) {
  17677. for (var p in b) {
  17678. if (b.hasOwnProperty(p)) d[p] = b[p];
  17679. }
  17680. };
  17681. return _extendStatics(d, b);
  17682. };
  17683. return function (d, b) {
  17684. _extendStatics(d, b);
  17685. function __() {
  17686. this.constructor = d;
  17687. }
  17688. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17689. };
  17690. }();
  17691. Object.defineProperty(exports, "__esModule", { value: true });
  17692. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17693. var MDCTabScrollerRTLReverse = /** @class */function (_super) {
  17694. __extends(MDCTabScrollerRTLReverse, _super);
  17695. function MDCTabScrollerRTLReverse() {
  17696. return _super !== null && _super.apply(this, arguments) || this;
  17697. }
  17698. MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {
  17699. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17700. // Scroll values on most browsers are ints instead of floats so we round
  17701. return Math.round(currentScrollLeft - translateX);
  17702. };
  17703. MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {
  17704. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17705. var clampedScrollLeft = this.clampScrollValue_(scrollX);
  17706. return {
  17707. finalScrollPosition: clampedScrollLeft,
  17708. scrollDelta: currentScrollLeft - clampedScrollLeft
  17709. };
  17710. };
  17711. MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {
  17712. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17713. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX);
  17714. return {
  17715. finalScrollPosition: clampedScrollLeft,
  17716. scrollDelta: currentScrollLeft - clampedScrollLeft
  17717. };
  17718. };
  17719. MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  17720. return scrollX + translateX;
  17721. };
  17722. MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () {
  17723. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17724. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17725. return {
  17726. left: contentWidth - rootWidth,
  17727. right: 0
  17728. };
  17729. };
  17730. MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) {
  17731. var edges = this.calculateScrollEdges_();
  17732. return Math.min(Math.max(edges.right, scrollX), edges.left);
  17733. };
  17734. return MDCTabScrollerRTLReverse;
  17735. }(rtl_scroller_1.MDCTabScrollerRTL);
  17736. exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse;
  17737. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17738. exports.default = MDCTabScrollerRTLReverse;
  17739. /***/ }),
  17740. /***/ "./packages/mdc-tab-scroller/rtl-scroller.ts":
  17741. /*!***************************************************!*\
  17742. !*** ./packages/mdc-tab-scroller/rtl-scroller.ts ***!
  17743. \***************************************************/
  17744. /*! no static exports found */
  17745. /***/ (function(module, exports, __webpack_require__) {
  17746. "use strict";
  17747. /**
  17748. * @license
  17749. * Copyright 2018 Google Inc.
  17750. *
  17751. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17752. * of this software and associated documentation files (the "Software"), to deal
  17753. * in the Software without restriction, including without limitation the rights
  17754. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17755. * copies of the Software, and to permit persons to whom the Software is
  17756. * furnished to do so, subject to the following conditions:
  17757. *
  17758. * The above copyright notice and this permission notice shall be included in
  17759. * all copies or substantial portions of the Software.
  17760. *
  17761. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17762. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17763. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17764. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17765. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17766. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17767. * THE SOFTWARE.
  17768. */
  17769. Object.defineProperty(exports, "__esModule", { value: true });
  17770. var MDCTabScrollerRTL = /** @class */function () {
  17771. function MDCTabScrollerRTL(adapter) {
  17772. this.adapter_ = adapter;
  17773. }
  17774. return MDCTabScrollerRTL;
  17775. }();
  17776. exports.MDCTabScrollerRTL = MDCTabScrollerRTL;
  17777. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17778. exports.default = MDCTabScrollerRTL;
  17779. /***/ }),
  17780. /***/ "./packages/mdc-tab-scroller/util.ts":
  17781. /*!*******************************************!*\
  17782. !*** ./packages/mdc-tab-scroller/util.ts ***!
  17783. \*******************************************/
  17784. /*! no static exports found */
  17785. /***/ (function(module, exports, __webpack_require__) {
  17786. "use strict";
  17787. /**
  17788. * @license
  17789. * Copyright 2018 Google Inc.
  17790. *
  17791. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17792. * of this software and associated documentation files (the "Software"), to deal
  17793. * in the Software without restriction, including without limitation the rights
  17794. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17795. * copies of the Software, and to permit persons to whom the Software is
  17796. * furnished to do so, subject to the following conditions:
  17797. *
  17798. * The above copyright notice and this permission notice shall be included in
  17799. * all copies or substantial portions of the Software.
  17800. *
  17801. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17802. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17803. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17804. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17805. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17806. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17807. * THE SOFTWARE.
  17808. */
  17809. Object.defineProperty(exports, "__esModule", { value: true });
  17810. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  17811. /**
  17812. * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.
  17813. */
  17814. var horizontalScrollbarHeight_;
  17815. /**
  17816. * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.
  17817. * May return 0 (e.g. on OS X browsers under default configuration).
  17818. */
  17819. function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {
  17820. if (shouldCacheResult === void 0) {
  17821. shouldCacheResult = true;
  17822. }
  17823. if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {
  17824. return horizontalScrollbarHeight_;
  17825. }
  17826. var el = documentObj.createElement('div');
  17827. el.classList.add(constants_1.cssClasses.SCROLL_TEST);
  17828. documentObj.body.appendChild(el);
  17829. var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;
  17830. documentObj.body.removeChild(el);
  17831. if (shouldCacheResult) {
  17832. horizontalScrollbarHeight_ = horizontalScrollbarHeight;
  17833. }
  17834. return horizontalScrollbarHeight;
  17835. }
  17836. exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight;
  17837. /***/ }),
  17838. /***/ "./packages/mdc-tab/component.ts":
  17839. /*!***************************************!*\
  17840. !*** ./packages/mdc-tab/component.ts ***!
  17841. \***************************************/
  17842. /*! no static exports found */
  17843. /***/ (function(module, exports, __webpack_require__) {
  17844. "use strict";
  17845. /**
  17846. * @license
  17847. * Copyright 2018 Google Inc.
  17848. *
  17849. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17850. * of this software and associated documentation files (the "Software"), to deal
  17851. * in the Software without restriction, including without limitation the rights
  17852. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17853. * copies of the Software, and to permit persons to whom the Software is
  17854. * furnished to do so, subject to the following conditions:
  17855. *
  17856. * The above copyright notice and this permission notice shall be included in
  17857. * all copies or substantial portions of the Software.
  17858. *
  17859. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17860. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17861. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17862. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17863. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17864. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17865. * THE SOFTWARE.
  17866. */
  17867. var __extends = this && this.__extends || function () {
  17868. var _extendStatics = function extendStatics(d, b) {
  17869. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17870. d.__proto__ = b;
  17871. } || function (d, b) {
  17872. for (var p in b) {
  17873. if (b.hasOwnProperty(p)) d[p] = b[p];
  17874. }
  17875. };
  17876. return _extendStatics(d, b);
  17877. };
  17878. return function (d, b) {
  17879. _extendStatics(d, b);
  17880. function __() {
  17881. this.constructor = d;
  17882. }
  17883. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17884. };
  17885. }();
  17886. var __assign = this && this.__assign || function () {
  17887. __assign = Object.assign || function (t) {
  17888. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17889. s = arguments[i];
  17890. for (var p in s) {
  17891. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17892. }
  17893. }
  17894. return t;
  17895. };
  17896. return __assign.apply(this, arguments);
  17897. };
  17898. Object.defineProperty(exports, "__esModule", { value: true });
  17899. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  17900. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  17901. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  17902. var component_3 = __webpack_require__(/*! @material/tab-indicator/component */ "./packages/mdc-tab-indicator/component.ts");
  17903. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts");
  17904. var MDCTab = /** @class */function (_super) {
  17905. __extends(MDCTab, _super);
  17906. function MDCTab() {
  17907. return _super !== null && _super.apply(this, arguments) || this;
  17908. }
  17909. MDCTab.attachTo = function (root) {
  17910. return new MDCTab(root);
  17911. };
  17912. MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {
  17913. if (rippleFactory === void 0) {
  17914. rippleFactory = function rippleFactory(el, foundation) {
  17915. return new component_2.MDCRipple(el, foundation);
  17916. };
  17917. }
  17918. if (tabIndicatorFactory === void 0) {
  17919. tabIndicatorFactory = function tabIndicatorFactory(el) {
  17920. return new component_3.MDCTabIndicator(el);
  17921. };
  17922. }
  17923. this.id = this.root_.id;
  17924. var rippleSurface = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.RIPPLE_SELECTOR);
  17925. var rippleAdapter = __assign({}, component_2.MDCRipple.createAdapter(this), { addClass: function addClass(className) {
  17926. return rippleSurface.classList.add(className);
  17927. }, removeClass: function removeClass(className) {
  17928. return rippleSurface.classList.remove(className);
  17929. }, updateCssVariable: function updateCssVariable(varName, value) {
  17930. return rippleSurface.style.setProperty(varName, value);
  17931. } });
  17932. var rippleFoundation = new foundation_1.MDCRippleFoundation(rippleAdapter);
  17933. this.ripple_ = rippleFactory(this.root_, rippleFoundation);
  17934. var tabIndicatorElement = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);
  17935. this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement);
  17936. this.content_ = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR);
  17937. };
  17938. MDCTab.prototype.initialSyncWithDOM = function () {
  17939. var _this = this;
  17940. this.handleClick_ = function () {
  17941. return _this.foundation_.handleClick();
  17942. };
  17943. this.listen('click', this.handleClick_);
  17944. };
  17945. MDCTab.prototype.destroy = function () {
  17946. this.unlisten('click', this.handleClick_);
  17947. this.ripple_.destroy();
  17948. _super.prototype.destroy.call(this);
  17949. };
  17950. MDCTab.prototype.getDefaultFoundation = function () {
  17951. var _this = this;
  17952. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  17953. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  17954. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17955. var adapter = {
  17956. setAttr: function setAttr(attr, value) {
  17957. return _this.root_.setAttribute(attr, value);
  17958. },
  17959. addClass: function addClass(className) {
  17960. return _this.root_.classList.add(className);
  17961. },
  17962. removeClass: function removeClass(className) {
  17963. return _this.root_.classList.remove(className);
  17964. },
  17965. hasClass: function hasClass(className) {
  17966. return _this.root_.classList.contains(className);
  17967. },
  17968. activateIndicator: function activateIndicator(previousIndicatorClientRect) {
  17969. return _this.tabIndicator_.activate(previousIndicatorClientRect);
  17970. },
  17971. deactivateIndicator: function deactivateIndicator() {
  17972. return _this.tabIndicator_.deactivate();
  17973. },
  17974. notifyInteracted: function notifyInteracted() {
  17975. return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */);
  17976. },
  17977. getOffsetLeft: function getOffsetLeft() {
  17978. return _this.root_.offsetLeft;
  17979. },
  17980. getOffsetWidth: function getOffsetWidth() {
  17981. return _this.root_.offsetWidth;
  17982. },
  17983. getContentOffsetLeft: function getContentOffsetLeft() {
  17984. return _this.content_.offsetLeft;
  17985. },
  17986. getContentOffsetWidth: function getContentOffsetWidth() {
  17987. return _this.content_.offsetWidth;
  17988. },
  17989. focus: function focus() {
  17990. return _this.root_.focus();
  17991. }
  17992. };
  17993. // tslint:enable:object-literal-sort-keys
  17994. return new foundation_2.MDCTabFoundation(adapter);
  17995. };
  17996. Object.defineProperty(MDCTab.prototype, "active", {
  17997. /**
  17998. * Getter for the active state of the tab
  17999. */
  18000. get: function get() {
  18001. return this.foundation_.isActive();
  18002. },
  18003. enumerable: true,
  18004. configurable: true
  18005. });
  18006. Object.defineProperty(MDCTab.prototype, "focusOnActivate", {
  18007. set: function set(focusOnActivate) {
  18008. this.foundation_.setFocusOnActivate(focusOnActivate);
  18009. },
  18010. enumerable: true,
  18011. configurable: true
  18012. });
  18013. /**
  18014. * Activates the tab
  18015. */
  18016. MDCTab.prototype.activate = function (computeIndicatorClientRect) {
  18017. this.foundation_.activate(computeIndicatorClientRect);
  18018. };
  18019. /**
  18020. * Deactivates the tab
  18021. */
  18022. MDCTab.prototype.deactivate = function () {
  18023. this.foundation_.deactivate();
  18024. };
  18025. /**
  18026. * Returns the indicator's client rect
  18027. */
  18028. MDCTab.prototype.computeIndicatorClientRect = function () {
  18029. return this.tabIndicator_.computeContentClientRect();
  18030. };
  18031. MDCTab.prototype.computeDimensions = function () {
  18032. return this.foundation_.computeDimensions();
  18033. };
  18034. /**
  18035. * Focuses the tab
  18036. */
  18037. MDCTab.prototype.focus = function () {
  18038. this.root_.focus();
  18039. };
  18040. return MDCTab;
  18041. }(component_1.MDCComponent);
  18042. exports.MDCTab = MDCTab;
  18043. /***/ }),
  18044. /***/ "./packages/mdc-tab/constants.ts":
  18045. /*!***************************************!*\
  18046. !*** ./packages/mdc-tab/constants.ts ***!
  18047. \***************************************/
  18048. /*! no static exports found */
  18049. /***/ (function(module, exports, __webpack_require__) {
  18050. "use strict";
  18051. /**
  18052. * @license
  18053. * Copyright 2018 Google Inc.
  18054. *
  18055. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18056. * of this software and associated documentation files (the "Software"), to deal
  18057. * in the Software without restriction, including without limitation the rights
  18058. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18059. * copies of the Software, and to permit persons to whom the Software is
  18060. * furnished to do so, subject to the following conditions:
  18061. *
  18062. * The above copyright notice and this permission notice shall be included in
  18063. * all copies or substantial portions of the Software.
  18064. *
  18065. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18066. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18067. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18068. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18069. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18070. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18071. * THE SOFTWARE.
  18072. */
  18073. Object.defineProperty(exports, "__esModule", { value: true });
  18074. var cssClasses = {
  18075. ACTIVE: 'mdc-tab--active'
  18076. };
  18077. exports.cssClasses = cssClasses;
  18078. var strings = {
  18079. ARIA_SELECTED: 'aria-selected',
  18080. CONTENT_SELECTOR: '.mdc-tab__content',
  18081. INTERACTED_EVENT: 'MDCTab:interacted',
  18082. RIPPLE_SELECTOR: '.mdc-tab__ripple',
  18083. TABINDEX: 'tabIndex',
  18084. TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator'
  18085. };
  18086. exports.strings = strings;
  18087. /***/ }),
  18088. /***/ "./packages/mdc-tab/foundation.ts":
  18089. /*!****************************************!*\
  18090. !*** ./packages/mdc-tab/foundation.ts ***!
  18091. \****************************************/
  18092. /*! no static exports found */
  18093. /***/ (function(module, exports, __webpack_require__) {
  18094. "use strict";
  18095. /**
  18096. * @license
  18097. * Copyright 2018 Google Inc.
  18098. *
  18099. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18100. * of this software and associated documentation files (the "Software"), to deal
  18101. * in the Software without restriction, including without limitation the rights
  18102. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18103. * copies of the Software, and to permit persons to whom the Software is
  18104. * furnished to do so, subject to the following conditions:
  18105. *
  18106. * The above copyright notice and this permission notice shall be included in
  18107. * all copies or substantial portions of the Software.
  18108. *
  18109. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18110. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18111. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18112. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18113. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18114. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18115. * THE SOFTWARE.
  18116. */
  18117. var __extends = this && this.__extends || function () {
  18118. var _extendStatics = function extendStatics(d, b) {
  18119. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18120. d.__proto__ = b;
  18121. } || function (d, b) {
  18122. for (var p in b) {
  18123. if (b.hasOwnProperty(p)) d[p] = b[p];
  18124. }
  18125. };
  18126. return _extendStatics(d, b);
  18127. };
  18128. return function (d, b) {
  18129. _extendStatics(d, b);
  18130. function __() {
  18131. this.constructor = d;
  18132. }
  18133. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18134. };
  18135. }();
  18136. var __assign = this && this.__assign || function () {
  18137. __assign = Object.assign || function (t) {
  18138. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18139. s = arguments[i];
  18140. for (var p in s) {
  18141. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18142. }
  18143. }
  18144. return t;
  18145. };
  18146. return __assign.apply(this, arguments);
  18147. };
  18148. Object.defineProperty(exports, "__esModule", { value: true });
  18149. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18150. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts");
  18151. var MDCTabFoundation = /** @class */function (_super) {
  18152. __extends(MDCTabFoundation, _super);
  18153. function MDCTabFoundation(adapter) {
  18154. var _this = _super.call(this, __assign({}, MDCTabFoundation.defaultAdapter, adapter)) || this;
  18155. _this.focusOnActivate_ = true;
  18156. return _this;
  18157. }
  18158. Object.defineProperty(MDCTabFoundation, "cssClasses", {
  18159. get: function get() {
  18160. return constants_1.cssClasses;
  18161. },
  18162. enumerable: true,
  18163. configurable: true
  18164. });
  18165. Object.defineProperty(MDCTabFoundation, "strings", {
  18166. get: function get() {
  18167. return constants_1.strings;
  18168. },
  18169. enumerable: true,
  18170. configurable: true
  18171. });
  18172. Object.defineProperty(MDCTabFoundation, "defaultAdapter", {
  18173. get: function get() {
  18174. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18175. return {
  18176. addClass: function addClass() {
  18177. return undefined;
  18178. },
  18179. removeClass: function removeClass() {
  18180. return undefined;
  18181. },
  18182. hasClass: function hasClass() {
  18183. return false;
  18184. },
  18185. setAttr: function setAttr() {
  18186. return undefined;
  18187. },
  18188. activateIndicator: function activateIndicator() {
  18189. return undefined;
  18190. },
  18191. deactivateIndicator: function deactivateIndicator() {
  18192. return undefined;
  18193. },
  18194. notifyInteracted: function notifyInteracted() {
  18195. return undefined;
  18196. },
  18197. getOffsetLeft: function getOffsetLeft() {
  18198. return 0;
  18199. },
  18200. getOffsetWidth: function getOffsetWidth() {
  18201. return 0;
  18202. },
  18203. getContentOffsetLeft: function getContentOffsetLeft() {
  18204. return 0;
  18205. },
  18206. getContentOffsetWidth: function getContentOffsetWidth() {
  18207. return 0;
  18208. },
  18209. focus: function focus() {
  18210. return undefined;
  18211. }
  18212. };
  18213. // tslint:enable:object-literal-sort-keys
  18214. },
  18215. enumerable: true,
  18216. configurable: true
  18217. });
  18218. MDCTabFoundation.prototype.handleClick = function () {
  18219. // It's up to the parent component to keep track of the active Tab and
  18220. // ensure we don't activate a Tab that's already active.
  18221. this.adapter_.notifyInteracted();
  18222. };
  18223. MDCTabFoundation.prototype.isActive = function () {
  18224. return this.adapter_.hasClass(constants_1.cssClasses.ACTIVE);
  18225. };
  18226. /**
  18227. * Sets whether the tab should focus itself when activated
  18228. */
  18229. MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {
  18230. this.focusOnActivate_ = focusOnActivate;
  18231. };
  18232. /**
  18233. * Activates the Tab
  18234. */
  18235. MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {
  18236. this.adapter_.addClass(constants_1.cssClasses.ACTIVE);
  18237. this.adapter_.setAttr(constants_1.strings.ARIA_SELECTED, 'true');
  18238. this.adapter_.setAttr(constants_1.strings.TABINDEX, '0');
  18239. this.adapter_.activateIndicator(previousIndicatorClientRect);
  18240. if (this.focusOnActivate_) {
  18241. this.adapter_.focus();
  18242. }
  18243. };
  18244. /**
  18245. * Deactivates the Tab
  18246. */
  18247. MDCTabFoundation.prototype.deactivate = function () {
  18248. // Early exit
  18249. if (!this.isActive()) {
  18250. return;
  18251. }
  18252. this.adapter_.removeClass(constants_1.cssClasses.ACTIVE);
  18253. this.adapter_.setAttr(constants_1.strings.ARIA_SELECTED, 'false');
  18254. this.adapter_.setAttr(constants_1.strings.TABINDEX, '-1');
  18255. this.adapter_.deactivateIndicator();
  18256. };
  18257. /**
  18258. * Returns the dimensions of the Tab
  18259. */
  18260. MDCTabFoundation.prototype.computeDimensions = function () {
  18261. var rootWidth = this.adapter_.getOffsetWidth();
  18262. var rootLeft = this.adapter_.getOffsetLeft();
  18263. var contentWidth = this.adapter_.getContentOffsetWidth();
  18264. var contentLeft = this.adapter_.getContentOffsetLeft();
  18265. return {
  18266. contentLeft: rootLeft + contentLeft,
  18267. contentRight: rootLeft + contentLeft + contentWidth,
  18268. rootLeft: rootLeft,
  18269. rootRight: rootLeft + rootWidth
  18270. };
  18271. };
  18272. return MDCTabFoundation;
  18273. }(foundation_1.MDCFoundation);
  18274. exports.MDCTabFoundation = MDCTabFoundation;
  18275. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18276. exports.default = MDCTabFoundation;
  18277. /***/ }),
  18278. /***/ "./packages/mdc-tab/index.ts":
  18279. /*!***********************************!*\
  18280. !*** ./packages/mdc-tab/index.ts ***!
  18281. \***********************************/
  18282. /*! no static exports found */
  18283. /***/ (function(module, exports, __webpack_require__) {
  18284. "use strict";
  18285. /**
  18286. * @license
  18287. * Copyright 2019 Google Inc.
  18288. *
  18289. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18290. * of this software and associated documentation files (the "Software"), to deal
  18291. * in the Software without restriction, including without limitation the rights
  18292. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18293. * copies of the Software, and to permit persons to whom the Software is
  18294. * furnished to do so, subject to the following conditions:
  18295. *
  18296. * The above copyright notice and this permission notice shall be included in
  18297. * all copies or substantial portions of the Software.
  18298. *
  18299. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18300. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18301. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18302. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18303. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18304. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18305. * THE SOFTWARE.
  18306. */
  18307. function __export(m) {
  18308. for (var p in m) {
  18309. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  18310. }
  18311. }
  18312. Object.defineProperty(exports, "__esModule", { value: true });
  18313. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab/component.ts"));
  18314. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"));
  18315. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"));
  18316. /***/ }),
  18317. /***/ "./packages/mdc-textfield/character-counter/component.ts":
  18318. /*!***************************************************************!*\
  18319. !*** ./packages/mdc-textfield/character-counter/component.ts ***!
  18320. \***************************************************************/
  18321. /*! no static exports found */
  18322. /***/ (function(module, exports, __webpack_require__) {
  18323. "use strict";
  18324. /**
  18325. * @license
  18326. * Copyright 2019 Google Inc.
  18327. *
  18328. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18329. * of this software and associated documentation files (the "Software"), to deal
  18330. * in the Software without restriction, including without limitation the rights
  18331. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18332. * copies of the Software, and to permit persons to whom the Software is
  18333. * furnished to do so, subject to the following conditions:
  18334. *
  18335. * The above copyright notice and this permission notice shall be included in
  18336. * all copies or substantial portions of the Software.
  18337. *
  18338. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18339. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18340. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18341. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18342. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18343. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18344. * THE SOFTWARE.
  18345. */
  18346. var __extends = this && this.__extends || function () {
  18347. var _extendStatics = function extendStatics(d, b) {
  18348. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18349. d.__proto__ = b;
  18350. } || function (d, b) {
  18351. for (var p in b) {
  18352. if (b.hasOwnProperty(p)) d[p] = b[p];
  18353. }
  18354. };
  18355. return _extendStatics(d, b);
  18356. };
  18357. return function (d, b) {
  18358. _extendStatics(d, b);
  18359. function __() {
  18360. this.constructor = d;
  18361. }
  18362. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18363. };
  18364. }();
  18365. Object.defineProperty(exports, "__esModule", { value: true });
  18366. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18367. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  18368. var MDCTextFieldCharacterCounter = /** @class */function (_super) {
  18369. __extends(MDCTextFieldCharacterCounter, _super);
  18370. function MDCTextFieldCharacterCounter() {
  18371. return _super !== null && _super.apply(this, arguments) || this;
  18372. }
  18373. MDCTextFieldCharacterCounter.attachTo = function (root) {
  18374. return new MDCTextFieldCharacterCounter(root);
  18375. };
  18376. Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundation", {
  18377. get: function get() {
  18378. return this.foundation_;
  18379. },
  18380. enumerable: true,
  18381. configurable: true
  18382. });
  18383. MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
  18384. var _this = this;
  18385. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18386. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18387. var adapter = {
  18388. setContent: function setContent(content) {
  18389. _this.root_.textContent = content;
  18390. }
  18391. };
  18392. return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
  18393. };
  18394. return MDCTextFieldCharacterCounter;
  18395. }(component_1.MDCComponent);
  18396. exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
  18397. /***/ }),
  18398. /***/ "./packages/mdc-textfield/character-counter/constants.ts":
  18399. /*!***************************************************************!*\
  18400. !*** ./packages/mdc-textfield/character-counter/constants.ts ***!
  18401. \***************************************************************/
  18402. /*! no static exports found */
  18403. /***/ (function(module, exports, __webpack_require__) {
  18404. "use strict";
  18405. /**
  18406. * @license
  18407. * Copyright 2019 Google Inc.
  18408. *
  18409. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18410. * of this software and associated documentation files (the "Software"), to deal
  18411. * in the Software without restriction, including without limitation the rights
  18412. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18413. * copies of the Software, and to permit persons to whom the Software is
  18414. * furnished to do so, subject to the following conditions:
  18415. *
  18416. * The above copyright notice and this permission notice shall be included in
  18417. * all copies or substantial portions of the Software.
  18418. *
  18419. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18420. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18421. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18422. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18423. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18424. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18425. * THE SOFTWARE.
  18426. */
  18427. Object.defineProperty(exports, "__esModule", { value: true });
  18428. var cssClasses = {
  18429. ROOT: 'mdc-text-field-character-counter'
  18430. };
  18431. exports.cssClasses = cssClasses;
  18432. var strings = {
  18433. ROOT_SELECTOR: "." + cssClasses.ROOT
  18434. };
  18435. exports.strings = strings;
  18436. /***/ }),
  18437. /***/ "./packages/mdc-textfield/character-counter/foundation.ts":
  18438. /*!****************************************************************!*\
  18439. !*** ./packages/mdc-textfield/character-counter/foundation.ts ***!
  18440. \****************************************************************/
  18441. /*! no static exports found */
  18442. /***/ (function(module, exports, __webpack_require__) {
  18443. "use strict";
  18444. /**
  18445. * @license
  18446. * Copyright 2019 Google Inc.
  18447. *
  18448. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18449. * of this software and associated documentation files (the "Software"), to deal
  18450. * in the Software without restriction, including without limitation the rights
  18451. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18452. * copies of the Software, and to permit persons to whom the Software is
  18453. * furnished to do so, subject to the following conditions:
  18454. *
  18455. * The above copyright notice and this permission notice shall be included in
  18456. * all copies or substantial portions of the Software.
  18457. *
  18458. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18459. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18460. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18461. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18462. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18463. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18464. * THE SOFTWARE.
  18465. */
  18466. var __extends = this && this.__extends || function () {
  18467. var _extendStatics = function extendStatics(d, b) {
  18468. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18469. d.__proto__ = b;
  18470. } || function (d, b) {
  18471. for (var p in b) {
  18472. if (b.hasOwnProperty(p)) d[p] = b[p];
  18473. }
  18474. };
  18475. return _extendStatics(d, b);
  18476. };
  18477. return function (d, b) {
  18478. _extendStatics(d, b);
  18479. function __() {
  18480. this.constructor = d;
  18481. }
  18482. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18483. };
  18484. }();
  18485. var __assign = this && this.__assign || function () {
  18486. __assign = Object.assign || function (t) {
  18487. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18488. s = arguments[i];
  18489. for (var p in s) {
  18490. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18491. }
  18492. }
  18493. return t;
  18494. };
  18495. return __assign.apply(this, arguments);
  18496. };
  18497. Object.defineProperty(exports, "__esModule", { value: true });
  18498. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18499. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  18500. var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) {
  18501. __extends(MDCTextFieldCharacterCounterFoundation, _super);
  18502. function MDCTextFieldCharacterCounterFoundation(adapter) {
  18503. return _super.call(this, __assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter, adapter)) || this;
  18504. }
  18505. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
  18506. get: function get() {
  18507. return constants_1.cssClasses;
  18508. },
  18509. enumerable: true,
  18510. configurable: true
  18511. });
  18512. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
  18513. get: function get() {
  18514. return constants_1.strings;
  18515. },
  18516. enumerable: true,
  18517. configurable: true
  18518. });
  18519. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
  18520. /**
  18521. * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
  18522. */
  18523. get: function get() {
  18524. return {
  18525. setContent: function setContent() {
  18526. return undefined;
  18527. }
  18528. };
  18529. },
  18530. enumerable: true,
  18531. configurable: true
  18532. });
  18533. MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
  18534. currentLength = Math.min(currentLength, maxLength);
  18535. this.adapter_.setContent(currentLength + " / " + maxLength);
  18536. };
  18537. return MDCTextFieldCharacterCounterFoundation;
  18538. }(foundation_1.MDCFoundation);
  18539. exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
  18540. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18541. exports.default = MDCTextFieldCharacterCounterFoundation;
  18542. /***/ }),
  18543. /***/ "./packages/mdc-textfield/character-counter/index.ts":
  18544. /*!***********************************************************!*\
  18545. !*** ./packages/mdc-textfield/character-counter/index.ts ***!
  18546. \***********************************************************/
  18547. /*! no static exports found */
  18548. /***/ (function(module, exports, __webpack_require__) {
  18549. "use strict";
  18550. /**
  18551. * @license
  18552. * Copyright 2019 Google Inc.
  18553. *
  18554. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18555. * of this software and associated documentation files (the "Software"), to deal
  18556. * in the Software without restriction, including without limitation the rights
  18557. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18558. * copies of the Software, and to permit persons to whom the Software is
  18559. * furnished to do so, subject to the following conditions:
  18560. *
  18561. * The above copyright notice and this permission notice shall be included in
  18562. * all copies or substantial portions of the Software.
  18563. *
  18564. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18565. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18566. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18567. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18568. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18569. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18570. * THE SOFTWARE.
  18571. */
  18572. function __export(m) {
  18573. for (var p in m) {
  18574. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  18575. }
  18576. }
  18577. Object.defineProperty(exports, "__esModule", { value: true });
  18578. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"));
  18579. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"));
  18580. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  18581. exports.characterCountCssClasses = constants_1.cssClasses;
  18582. exports.characterCountStrings = constants_1.strings;
  18583. /***/ }),
  18584. /***/ "./packages/mdc-textfield/component.ts":
  18585. /*!*********************************************!*\
  18586. !*** ./packages/mdc-textfield/component.ts ***!
  18587. \*********************************************/
  18588. /*! no static exports found */
  18589. /***/ (function(module, exports, __webpack_require__) {
  18590. "use strict";
  18591. /**
  18592. * @license
  18593. * Copyright 2016 Google Inc.
  18594. *
  18595. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18596. * of this software and associated documentation files (the "Software"), to deal
  18597. * in the Software without restriction, including without limitation the rights
  18598. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18599. * copies of the Software, and to permit persons to whom the Software is
  18600. * furnished to do so, subject to the following conditions:
  18601. *
  18602. * The above copyright notice and this permission notice shall be included in
  18603. * all copies or substantial portions of the Software.
  18604. *
  18605. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18606. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18607. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18608. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18609. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18610. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18611. * THE SOFTWARE.
  18612. */
  18613. var __extends = this && this.__extends || function () {
  18614. var _extendStatics = function extendStatics(d, b) {
  18615. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18616. d.__proto__ = b;
  18617. } || function (d, b) {
  18618. for (var p in b) {
  18619. if (b.hasOwnProperty(p)) d[p] = b[p];
  18620. }
  18621. };
  18622. return _extendStatics(d, b);
  18623. };
  18624. return function (d, b) {
  18625. _extendStatics(d, b);
  18626. function __() {
  18627. this.constructor = d;
  18628. }
  18629. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18630. };
  18631. }();
  18632. var __assign = this && this.__assign || function () {
  18633. __assign = Object.assign || function (t) {
  18634. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18635. s = arguments[i];
  18636. for (var p in s) {
  18637. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18638. }
  18639. }
  18640. return t;
  18641. };
  18642. return __assign.apply(this, arguments);
  18643. };
  18644. var __importStar = this && this.__importStar || function (mod) {
  18645. if (mod && mod.__esModule) return mod;
  18646. var result = {};
  18647. if (mod != null) for (var k in mod) {
  18648. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  18649. }result["default"] = mod;
  18650. return result;
  18651. };
  18652. Object.defineProperty(exports, "__esModule", { value: true });
  18653. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18654. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  18655. var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  18656. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  18657. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  18658. var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  18659. var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  18660. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  18661. var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts");
  18662. var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  18663. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  18664. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
  18665. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts");
  18666. var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  18667. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts");
  18668. var MDCTextField = /** @class */function (_super) {
  18669. __extends(MDCTextField, _super);
  18670. function MDCTextField() {
  18671. return _super !== null && _super.apply(this, arguments) || this;
  18672. }
  18673. MDCTextField.attachTo = function (root) {
  18674. return new MDCTextField(root);
  18675. };
  18676. MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
  18677. if (rippleFactory === void 0) {
  18678. rippleFactory = function rippleFactory(el, foundation) {
  18679. return new component_5.MDCRipple(el, foundation);
  18680. };
  18681. }
  18682. if (lineRippleFactory === void 0) {
  18683. lineRippleFactory = function lineRippleFactory(el) {
  18684. return new component_3.MDCLineRipple(el);
  18685. };
  18686. }
  18687. if (helperTextFactory === void 0) {
  18688. helperTextFactory = function helperTextFactory(el) {
  18689. return new component_7.MDCTextFieldHelperText(el);
  18690. };
  18691. }
  18692. if (characterCounterFactory === void 0) {
  18693. characterCounterFactory = function characterCounterFactory(el) {
  18694. return new component_6.MDCTextFieldCharacterCounter(el);
  18695. };
  18696. }
  18697. if (iconFactory === void 0) {
  18698. iconFactory = function iconFactory(el) {
  18699. return new component_8.MDCTextFieldIcon(el);
  18700. };
  18701. }
  18702. if (labelFactory === void 0) {
  18703. labelFactory = function labelFactory(el) {
  18704. return new component_2.MDCFloatingLabel(el);
  18705. };
  18706. }
  18707. if (outlineFactory === void 0) {
  18708. outlineFactory = function outlineFactory(el) {
  18709. return new component_4.MDCNotchedOutline(el);
  18710. };
  18711. }
  18712. this.input_ = this.root_.querySelector(constants_1.strings.INPUT_SELECTOR);
  18713. var labelElement = this.root_.querySelector(constants_1.strings.LABEL_SELECTOR);
  18714. this.label_ = labelElement ? labelFactory(labelElement) : null;
  18715. var lineRippleElement = this.root_.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  18716. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  18717. var outlineElement = this.root_.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  18718. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  18719. // Helper text
  18720. var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
  18721. var nextElementSibling = this.root_.nextElementSibling;
  18722. var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
  18723. var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
  18724. this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null;
  18725. // Character counter
  18726. var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
  18727. var characterCounterEl = this.root_.querySelector(characterCounterStrings.ROOT_SELECTOR);
  18728. // If character counter is not found in root element search in sibling element.
  18729. if (!characterCounterEl && hasHelperLine && nextElementSibling) {
  18730. characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
  18731. }
  18732. this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
  18733. this.leadingIcon_ = null;
  18734. this.trailingIcon_ = null;
  18735. var iconElements = this.root_.querySelectorAll(constants_1.strings.ICON_SELECTOR);
  18736. if (iconElements.length > 0) {
  18737. if (iconElements.length > 1) {
  18738. // Has both icons.
  18739. this.leadingIcon_ = iconFactory(iconElements[0]);
  18740. this.trailingIcon_ = iconFactory(iconElements[1]);
  18741. } else {
  18742. if (this.root_.classList.contains(constants_1.cssClasses.WITH_LEADING_ICON)) {
  18743. this.leadingIcon_ = iconFactory(iconElements[0]);
  18744. } else {
  18745. this.trailingIcon_ = iconFactory(iconElements[0]);
  18746. }
  18747. }
  18748. }
  18749. this.ripple = this.createRipple_(rippleFactory);
  18750. };
  18751. MDCTextField.prototype.destroy = function () {
  18752. if (this.ripple) {
  18753. this.ripple.destroy();
  18754. }
  18755. if (this.lineRipple_) {
  18756. this.lineRipple_.destroy();
  18757. }
  18758. if (this.helperText_) {
  18759. this.helperText_.destroy();
  18760. }
  18761. if (this.characterCounter_) {
  18762. this.characterCounter_.destroy();
  18763. }
  18764. if (this.leadingIcon_) {
  18765. this.leadingIcon_.destroy();
  18766. }
  18767. if (this.trailingIcon_) {
  18768. this.trailingIcon_.destroy();
  18769. }
  18770. if (this.label_) {
  18771. this.label_.destroy();
  18772. }
  18773. if (this.outline_) {
  18774. this.outline_.destroy();
  18775. }
  18776. _super.prototype.destroy.call(this);
  18777. };
  18778. /**
  18779. * Initializes the Text Field's internal state based on the environment's
  18780. * state.
  18781. */
  18782. MDCTextField.prototype.initialSyncWithDOM = function () {
  18783. this.disabled = this.input_.disabled;
  18784. };
  18785. Object.defineProperty(MDCTextField.prototype, "value", {
  18786. get: function get() {
  18787. return this.foundation_.getValue();
  18788. },
  18789. /**
  18790. * @param value The value to set on the input.
  18791. */
  18792. set: function set(value) {
  18793. this.foundation_.setValue(value);
  18794. },
  18795. enumerable: true,
  18796. configurable: true
  18797. });
  18798. Object.defineProperty(MDCTextField.prototype, "disabled", {
  18799. get: function get() {
  18800. return this.foundation_.isDisabled();
  18801. },
  18802. /**
  18803. * @param disabled Sets the Text Field disabled or enabled.
  18804. */
  18805. set: function set(disabled) {
  18806. this.foundation_.setDisabled(disabled);
  18807. },
  18808. enumerable: true,
  18809. configurable: true
  18810. });
  18811. Object.defineProperty(MDCTextField.prototype, "valid", {
  18812. get: function get() {
  18813. return this.foundation_.isValid();
  18814. },
  18815. /**
  18816. * @param valid Sets the Text Field valid or invalid.
  18817. */
  18818. set: function set(valid) {
  18819. this.foundation_.setValid(valid);
  18820. },
  18821. enumerable: true,
  18822. configurable: true
  18823. });
  18824. Object.defineProperty(MDCTextField.prototype, "required", {
  18825. get: function get() {
  18826. return this.input_.required;
  18827. },
  18828. /**
  18829. * @param required Sets the Text Field to required.
  18830. */
  18831. set: function set(required) {
  18832. this.input_.required = required;
  18833. },
  18834. enumerable: true,
  18835. configurable: true
  18836. });
  18837. Object.defineProperty(MDCTextField.prototype, "pattern", {
  18838. get: function get() {
  18839. return this.input_.pattern;
  18840. },
  18841. /**
  18842. * @param pattern Sets the input element's validation pattern.
  18843. */
  18844. set: function set(pattern) {
  18845. this.input_.pattern = pattern;
  18846. },
  18847. enumerable: true,
  18848. configurable: true
  18849. });
  18850. Object.defineProperty(MDCTextField.prototype, "minLength", {
  18851. get: function get() {
  18852. return this.input_.minLength;
  18853. },
  18854. /**
  18855. * @param minLength Sets the input element's minLength.
  18856. */
  18857. set: function set(minLength) {
  18858. this.input_.minLength = minLength;
  18859. },
  18860. enumerable: true,
  18861. configurable: true
  18862. });
  18863. Object.defineProperty(MDCTextField.prototype, "maxLength", {
  18864. get: function get() {
  18865. return this.input_.maxLength;
  18866. },
  18867. /**
  18868. * @param maxLength Sets the input element's maxLength.
  18869. */
  18870. set: function set(maxLength) {
  18871. // Chrome throws exception if maxLength is set to a value less than zero
  18872. if (maxLength < 0) {
  18873. this.input_.removeAttribute('maxLength');
  18874. } else {
  18875. this.input_.maxLength = maxLength;
  18876. }
  18877. },
  18878. enumerable: true,
  18879. configurable: true
  18880. });
  18881. Object.defineProperty(MDCTextField.prototype, "min", {
  18882. get: function get() {
  18883. return this.input_.min;
  18884. },
  18885. /**
  18886. * @param min Sets the input element's min.
  18887. */
  18888. set: function set(min) {
  18889. this.input_.min = min;
  18890. },
  18891. enumerable: true,
  18892. configurable: true
  18893. });
  18894. Object.defineProperty(MDCTextField.prototype, "max", {
  18895. get: function get() {
  18896. return this.input_.max;
  18897. },
  18898. /**
  18899. * @param max Sets the input element's max.
  18900. */
  18901. set: function set(max) {
  18902. this.input_.max = max;
  18903. },
  18904. enumerable: true,
  18905. configurable: true
  18906. });
  18907. Object.defineProperty(MDCTextField.prototype, "step", {
  18908. get: function get() {
  18909. return this.input_.step;
  18910. },
  18911. /**
  18912. * @param step Sets the input element's step.
  18913. */
  18914. set: function set(step) {
  18915. this.input_.step = step;
  18916. },
  18917. enumerable: true,
  18918. configurable: true
  18919. });
  18920. Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
  18921. /**
  18922. * Sets the helper text element content.
  18923. */
  18924. set: function set(content) {
  18925. this.foundation_.setHelperTextContent(content);
  18926. },
  18927. enumerable: true,
  18928. configurable: true
  18929. });
  18930. Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
  18931. /**
  18932. * Sets the aria label of the leading icon.
  18933. */
  18934. set: function set(label) {
  18935. this.foundation_.setLeadingIconAriaLabel(label);
  18936. },
  18937. enumerable: true,
  18938. configurable: true
  18939. });
  18940. Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
  18941. /**
  18942. * Sets the text content of the leading icon.
  18943. */
  18944. set: function set(content) {
  18945. this.foundation_.setLeadingIconContent(content);
  18946. },
  18947. enumerable: true,
  18948. configurable: true
  18949. });
  18950. Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
  18951. /**
  18952. * Sets the aria label of the trailing icon.
  18953. */
  18954. set: function set(label) {
  18955. this.foundation_.setTrailingIconAriaLabel(label);
  18956. },
  18957. enumerable: true,
  18958. configurable: true
  18959. });
  18960. Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
  18961. /**
  18962. * Sets the text content of the trailing icon.
  18963. */
  18964. set: function set(content) {
  18965. this.foundation_.setTrailingIconContent(content);
  18966. },
  18967. enumerable: true,
  18968. configurable: true
  18969. });
  18970. Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
  18971. /**
  18972. * Enables or disables the use of native validation. Use this for custom validation.
  18973. * @param useNativeValidation Set this to false to ignore native input validation.
  18974. */
  18975. set: function set(useNativeValidation) {
  18976. this.foundation_.setUseNativeValidation(useNativeValidation);
  18977. },
  18978. enumerable: true,
  18979. configurable: true
  18980. });
  18981. /**
  18982. * Focuses the input element.
  18983. */
  18984. MDCTextField.prototype.focus = function () {
  18985. this.input_.focus();
  18986. };
  18987. /**
  18988. * Recomputes the outline SVG path for the outline element.
  18989. */
  18990. MDCTextField.prototype.layout = function () {
  18991. var openNotch = this.foundation_.shouldFloat;
  18992. this.foundation_.notchOutline(openNotch);
  18993. };
  18994. MDCTextField.prototype.getDefaultFoundation = function () {
  18995. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18996. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18997. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18998. var adapter = __assign({}, this.getRootAdapterMethods_(), this.getInputAdapterMethods_(), this.getLabelAdapterMethods_(), this.getLineRippleAdapterMethods_(), this.getOutlineAdapterMethods_());
  18999. // tslint:enable:object-literal-sort-keys
  19000. return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap_());
  19001. };
  19002. MDCTextField.prototype.getRootAdapterMethods_ = function () {
  19003. var _this = this;
  19004. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19005. return {
  19006. addClass: function addClass(className) {
  19007. return _this.root_.classList.add(className);
  19008. },
  19009. removeClass: function removeClass(className) {
  19010. return _this.root_.classList.remove(className);
  19011. },
  19012. hasClass: function hasClass(className) {
  19013. return _this.root_.classList.contains(className);
  19014. },
  19015. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
  19016. return _this.listen(evtType, handler);
  19017. },
  19018. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
  19019. return _this.unlisten(evtType, handler);
  19020. },
  19021. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
  19022. var getAttributesList = function getAttributesList(mutationsList) {
  19023. return mutationsList.map(function (mutation) {
  19024. return mutation.attributeName;
  19025. }).filter(function (attributeName) {
  19026. return attributeName;
  19027. });
  19028. };
  19029. var observer = new MutationObserver(function (mutationsList) {
  19030. return handler(getAttributesList(mutationsList));
  19031. });
  19032. var config = { attributes: true };
  19033. observer.observe(_this.input_, config);
  19034. return observer;
  19035. },
  19036. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
  19037. return observer.disconnect();
  19038. }
  19039. };
  19040. // tslint:enable:object-literal-sort-keys
  19041. };
  19042. MDCTextField.prototype.getInputAdapterMethods_ = function () {
  19043. var _this = this;
  19044. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19045. return {
  19046. getNativeInput: function getNativeInput() {
  19047. return _this.input_;
  19048. },
  19049. isFocused: function isFocused() {
  19050. return document.activeElement === _this.input_;
  19051. },
  19052. registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
  19053. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  19054. },
  19055. deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
  19056. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  19057. }
  19058. };
  19059. // tslint:enable:object-literal-sort-keys
  19060. };
  19061. MDCTextField.prototype.getLabelAdapterMethods_ = function () {
  19062. var _this = this;
  19063. return {
  19064. floatLabel: function floatLabel(shouldFloat) {
  19065. return _this.label_ && _this.label_.float(shouldFloat);
  19066. },
  19067. getLabelWidth: function getLabelWidth() {
  19068. return _this.label_ ? _this.label_.getWidth() : 0;
  19069. },
  19070. hasLabel: function hasLabel() {
  19071. return Boolean(_this.label_);
  19072. },
  19073. shakeLabel: function shakeLabel(shouldShake) {
  19074. return _this.label_ && _this.label_.shake(shouldShake);
  19075. }
  19076. };
  19077. };
  19078. MDCTextField.prototype.getLineRippleAdapterMethods_ = function () {
  19079. var _this = this;
  19080. return {
  19081. activateLineRipple: function activateLineRipple() {
  19082. if (_this.lineRipple_) {
  19083. _this.lineRipple_.activate();
  19084. }
  19085. },
  19086. deactivateLineRipple: function deactivateLineRipple() {
  19087. if (_this.lineRipple_) {
  19088. _this.lineRipple_.deactivate();
  19089. }
  19090. },
  19091. setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
  19092. if (_this.lineRipple_) {
  19093. _this.lineRipple_.setRippleCenter(normalizedX);
  19094. }
  19095. }
  19096. };
  19097. };
  19098. MDCTextField.prototype.getOutlineAdapterMethods_ = function () {
  19099. var _this = this;
  19100. return {
  19101. closeOutline: function closeOutline() {
  19102. return _this.outline_ && _this.outline_.closeNotch();
  19103. },
  19104. hasOutline: function hasOutline() {
  19105. return Boolean(_this.outline_);
  19106. },
  19107. notchOutline: function notchOutline(labelWidth) {
  19108. return _this.outline_ && _this.outline_.notch(labelWidth);
  19109. }
  19110. };
  19111. };
  19112. /**
  19113. * @return A map of all subcomponents to subfoundations.
  19114. */
  19115. MDCTextField.prototype.getFoundationMap_ = function () {
  19116. return {
  19117. characterCounter: this.characterCounter_ ? this.characterCounter_.foundation : undefined,
  19118. helperText: this.helperText_ ? this.helperText_.foundation : undefined,
  19119. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined,
  19120. trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundation : undefined
  19121. };
  19122. };
  19123. MDCTextField.prototype.createRipple_ = function (rippleFactory) {
  19124. var _this = this;
  19125. var isTextArea = this.root_.classList.contains(constants_1.cssClasses.TEXTAREA);
  19126. var isOutlined = this.root_.classList.contains(constants_1.cssClasses.OUTLINED);
  19127. if (isTextArea || isOutlined) {
  19128. return null;
  19129. }
  19130. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19131. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19132. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19133. var adapter = __assign({}, component_5.MDCRipple.createAdapter(this), { isSurfaceActive: function isSurfaceActive() {
  19134. return ponyfill.matches(_this.input_, ':active');
  19135. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  19136. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  19137. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  19138. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  19139. } });
  19140. // tslint:enable:object-literal-sort-keys
  19141. return rippleFactory(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  19142. };
  19143. return MDCTextField;
  19144. }(component_1.MDCComponent);
  19145. exports.MDCTextField = MDCTextField;
  19146. /***/ }),
  19147. /***/ "./packages/mdc-textfield/constants.ts":
  19148. /*!*********************************************!*\
  19149. !*** ./packages/mdc-textfield/constants.ts ***!
  19150. \*********************************************/
  19151. /*! no static exports found */
  19152. /***/ (function(module, exports, __webpack_require__) {
  19153. "use strict";
  19154. /**
  19155. * @license
  19156. * Copyright 2016 Google Inc.
  19157. *
  19158. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19159. * of this software and associated documentation files (the "Software"), to deal
  19160. * in the Software without restriction, including without limitation the rights
  19161. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19162. * copies of the Software, and to permit persons to whom the Software is
  19163. * furnished to do so, subject to the following conditions:
  19164. *
  19165. * The above copyright notice and this permission notice shall be included in
  19166. * all copies or substantial portions of the Software.
  19167. *
  19168. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19169. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19170. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19171. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19172. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19173. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19174. * THE SOFTWARE.
  19175. */
  19176. Object.defineProperty(exports, "__esModule", { value: true });
  19177. var strings = {
  19178. ARIA_CONTROLS: 'aria-controls',
  19179. ICON_SELECTOR: '.mdc-text-field__icon',
  19180. INPUT_SELECTOR: '.mdc-text-field__input',
  19181. LABEL_SELECTOR: '.mdc-floating-label',
  19182. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  19183. OUTLINE_SELECTOR: '.mdc-notched-outline'
  19184. };
  19185. exports.strings = strings;
  19186. var cssClasses = {
  19187. DENSE: 'mdc-text-field--dense',
  19188. DISABLED: 'mdc-text-field--disabled',
  19189. FOCUSED: 'mdc-text-field--focused',
  19190. FULLWIDTH: 'mdc-text-field--fullwidth',
  19191. HELPER_LINE: 'mdc-text-field-helper-line',
  19192. INVALID: 'mdc-text-field--invalid',
  19193. NO_LABEL: 'mdc-text-field--no-label',
  19194. OUTLINED: 'mdc-text-field--outlined',
  19195. ROOT: 'mdc-text-field',
  19196. TEXTAREA: 'mdc-text-field--textarea',
  19197. WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
  19198. WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon'
  19199. };
  19200. exports.cssClasses = cssClasses;
  19201. var numbers = {
  19202. DENSE_LABEL_SCALE: 0.923,
  19203. LABEL_SCALE: 0.75
  19204. };
  19205. exports.numbers = numbers;
  19206. /**
  19207. * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
  19208. * under the "Validation-related attributes" section.
  19209. */
  19210. var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
  19211. exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
  19212. /**
  19213. * Label should always float for these types as they show some UI even if value is empty.
  19214. */
  19215. var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
  19216. exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
  19217. /***/ }),
  19218. /***/ "./packages/mdc-textfield/foundation.ts":
  19219. /*!**********************************************!*\
  19220. !*** ./packages/mdc-textfield/foundation.ts ***!
  19221. \**********************************************/
  19222. /*! no static exports found */
  19223. /***/ (function(module, exports, __webpack_require__) {
  19224. "use strict";
  19225. /**
  19226. * @license
  19227. * Copyright 2016 Google Inc.
  19228. *
  19229. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19230. * of this software and associated documentation files (the "Software"), to deal
  19231. * in the Software without restriction, including without limitation the rights
  19232. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19233. * copies of the Software, and to permit persons to whom the Software is
  19234. * furnished to do so, subject to the following conditions:
  19235. *
  19236. * The above copyright notice and this permission notice shall be included in
  19237. * all copies or substantial portions of the Software.
  19238. *
  19239. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19240. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19241. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19242. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19243. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19244. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19245. * THE SOFTWARE.
  19246. */
  19247. var __extends = this && this.__extends || function () {
  19248. var _extendStatics = function extendStatics(d, b) {
  19249. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19250. d.__proto__ = b;
  19251. } || function (d, b) {
  19252. for (var p in b) {
  19253. if (b.hasOwnProperty(p)) d[p] = b[p];
  19254. }
  19255. };
  19256. return _extendStatics(d, b);
  19257. };
  19258. return function (d, b) {
  19259. _extendStatics(d, b);
  19260. function __() {
  19261. this.constructor = d;
  19262. }
  19263. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19264. };
  19265. }();
  19266. var __assign = this && this.__assign || function () {
  19267. __assign = Object.assign || function (t) {
  19268. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19269. s = arguments[i];
  19270. for (var p in s) {
  19271. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19272. }
  19273. }
  19274. return t;
  19275. };
  19276. return __assign.apply(this, arguments);
  19277. };
  19278. Object.defineProperty(exports, "__esModule", { value: true });
  19279. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19280. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  19281. var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
  19282. var INTERACTION_EVENTS = ['click', 'keydown'];
  19283. var MDCTextFieldFoundation = /** @class */function (_super) {
  19284. __extends(MDCTextFieldFoundation, _super);
  19285. /**
  19286. * @param adapter
  19287. * @param foundationMap Map from subcomponent names to their subfoundations.
  19288. */
  19289. function MDCTextFieldFoundation(adapter, foundationMap) {
  19290. if (foundationMap === void 0) {
  19291. foundationMap = {};
  19292. }
  19293. var _this = _super.call(this, __assign({}, MDCTextFieldFoundation.defaultAdapter, adapter)) || this;
  19294. _this.isFocused_ = false;
  19295. _this.receivedUserInput_ = false;
  19296. _this.isValid_ = true;
  19297. _this.useNativeValidation_ = true;
  19298. _this.helperText_ = foundationMap.helperText;
  19299. _this.characterCounter_ = foundationMap.characterCounter;
  19300. _this.leadingIcon_ = foundationMap.leadingIcon;
  19301. _this.trailingIcon_ = foundationMap.trailingIcon;
  19302. _this.inputFocusHandler_ = function () {
  19303. return _this.activateFocus();
  19304. };
  19305. _this.inputBlurHandler_ = function () {
  19306. return _this.deactivateFocus();
  19307. };
  19308. _this.inputInputHandler_ = function () {
  19309. return _this.handleInput();
  19310. };
  19311. _this.setPointerXOffset_ = function (evt) {
  19312. return _this.setTransformOrigin(evt);
  19313. };
  19314. _this.textFieldInteractionHandler_ = function () {
  19315. return _this.handleTextFieldInteraction();
  19316. };
  19317. _this.validationAttributeChangeHandler_ = function (attributesList) {
  19318. return _this.handleValidationAttributeChange(attributesList);
  19319. };
  19320. return _this;
  19321. }
  19322. Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
  19323. get: function get() {
  19324. return constants_1.cssClasses;
  19325. },
  19326. enumerable: true,
  19327. configurable: true
  19328. });
  19329. Object.defineProperty(MDCTextFieldFoundation, "strings", {
  19330. get: function get() {
  19331. return constants_1.strings;
  19332. },
  19333. enumerable: true,
  19334. configurable: true
  19335. });
  19336. Object.defineProperty(MDCTextFieldFoundation, "numbers", {
  19337. get: function get() {
  19338. return constants_1.numbers;
  19339. },
  19340. enumerable: true,
  19341. configurable: true
  19342. });
  19343. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", {
  19344. get: function get() {
  19345. var type = this.getNativeInput_().type;
  19346. return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
  19347. },
  19348. enumerable: true,
  19349. configurable: true
  19350. });
  19351. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
  19352. get: function get() {
  19353. return this.shouldAlwaysFloat_ || this.isFocused_ || Boolean(this.getValue()) || this.isBadInput_();
  19354. },
  19355. enumerable: true,
  19356. configurable: true
  19357. });
  19358. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
  19359. get: function get() {
  19360. return !this.isFocused_ && !this.isValid() && Boolean(this.getValue());
  19361. },
  19362. enumerable: true,
  19363. configurable: true
  19364. });
  19365. Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
  19366. /**
  19367. * See {@link MDCTextFieldAdapter} for typing information on parameters and return types.
  19368. */
  19369. get: function get() {
  19370. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19371. return {
  19372. addClass: function addClass() {
  19373. return undefined;
  19374. },
  19375. removeClass: function removeClass() {
  19376. return undefined;
  19377. },
  19378. hasClass: function hasClass() {
  19379. return true;
  19380. },
  19381. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
  19382. return undefined;
  19383. },
  19384. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
  19385. return undefined;
  19386. },
  19387. registerInputInteractionHandler: function registerInputInteractionHandler() {
  19388. return undefined;
  19389. },
  19390. deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
  19391. return undefined;
  19392. },
  19393. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
  19394. return new MutationObserver(function () {
  19395. return undefined;
  19396. });
  19397. },
  19398. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
  19399. return undefined;
  19400. },
  19401. getNativeInput: function getNativeInput() {
  19402. return null;
  19403. },
  19404. isFocused: function isFocused() {
  19405. return false;
  19406. },
  19407. activateLineRipple: function activateLineRipple() {
  19408. return undefined;
  19409. },
  19410. deactivateLineRipple: function deactivateLineRipple() {
  19411. return undefined;
  19412. },
  19413. setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
  19414. return undefined;
  19415. },
  19416. shakeLabel: function shakeLabel() {
  19417. return undefined;
  19418. },
  19419. floatLabel: function floatLabel() {
  19420. return undefined;
  19421. },
  19422. hasLabel: function hasLabel() {
  19423. return false;
  19424. },
  19425. getLabelWidth: function getLabelWidth() {
  19426. return 0;
  19427. },
  19428. hasOutline: function hasOutline() {
  19429. return false;
  19430. },
  19431. notchOutline: function notchOutline() {
  19432. return undefined;
  19433. },
  19434. closeOutline: function closeOutline() {
  19435. return undefined;
  19436. }
  19437. };
  19438. // tslint:enable:object-literal-sort-keys
  19439. },
  19440. enumerable: true,
  19441. configurable: true
  19442. });
  19443. MDCTextFieldFoundation.prototype.init = function () {
  19444. var _this = this;
  19445. if (this.adapter_.isFocused()) {
  19446. this.inputFocusHandler_();
  19447. } else if (this.adapter_.hasLabel() && this.shouldFloat) {
  19448. this.notchOutline(true);
  19449. this.adapter_.floatLabel(true);
  19450. }
  19451. this.adapter_.registerInputInteractionHandler('focus', this.inputFocusHandler_);
  19452. this.adapter_.registerInputInteractionHandler('blur', this.inputBlurHandler_);
  19453. this.adapter_.registerInputInteractionHandler('input', this.inputInputHandler_);
  19454. POINTERDOWN_EVENTS.forEach(function (evtType) {
  19455. _this.adapter_.registerInputInteractionHandler(evtType, _this.setPointerXOffset_);
  19456. });
  19457. INTERACTION_EVENTS.forEach(function (evtType) {
  19458. _this.adapter_.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  19459. });
  19460. this.validationObserver_ = this.adapter_.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_);
  19461. this.setCharacterCounter_(this.getValue().length);
  19462. };
  19463. MDCTextFieldFoundation.prototype.destroy = function () {
  19464. var _this = this;
  19465. this.adapter_.deregisterInputInteractionHandler('focus', this.inputFocusHandler_);
  19466. this.adapter_.deregisterInputInteractionHandler('blur', this.inputBlurHandler_);
  19467. this.adapter_.deregisterInputInteractionHandler('input', this.inputInputHandler_);
  19468. POINTERDOWN_EVENTS.forEach(function (evtType) {
  19469. _this.adapter_.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_);
  19470. });
  19471. INTERACTION_EVENTS.forEach(function (evtType) {
  19472. _this.adapter_.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  19473. });
  19474. this.adapter_.deregisterValidationAttributeChangeHandler(this.validationObserver_);
  19475. };
  19476. /**
  19477. * Handles user interactions with the Text Field.
  19478. */
  19479. MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
  19480. var nativeInput = this.adapter_.getNativeInput();
  19481. if (nativeInput && nativeInput.disabled) {
  19482. return;
  19483. }
  19484. this.receivedUserInput_ = true;
  19485. };
  19486. /**
  19487. * Handles validation attribute changes
  19488. */
  19489. MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
  19490. var _this = this;
  19491. attributesList.some(function (attributeName) {
  19492. if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
  19493. _this.styleValidity_(true);
  19494. return true;
  19495. }
  19496. return false;
  19497. });
  19498. if (attributesList.indexOf('maxlength') > -1) {
  19499. this.setCharacterCounter_(this.getValue().length);
  19500. }
  19501. };
  19502. /**
  19503. * Opens/closes the notched outline.
  19504. */
  19505. MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
  19506. if (!this.adapter_.hasOutline()) {
  19507. return;
  19508. }
  19509. if (openNotch) {
  19510. var isDense = this.adapter_.hasClass(constants_1.cssClasses.DENSE);
  19511. var labelScale = isDense ? constants_1.numbers.DENSE_LABEL_SCALE : constants_1.numbers.LABEL_SCALE;
  19512. var labelWidth = this.adapter_.getLabelWidth() * labelScale;
  19513. this.adapter_.notchOutline(labelWidth);
  19514. } else {
  19515. this.adapter_.closeOutline();
  19516. }
  19517. };
  19518. /**
  19519. * Activates the text field focus state.
  19520. */
  19521. MDCTextFieldFoundation.prototype.activateFocus = function () {
  19522. this.isFocused_ = true;
  19523. this.styleFocused_(this.isFocused_);
  19524. this.adapter_.activateLineRipple();
  19525. if (this.adapter_.hasLabel()) {
  19526. this.notchOutline(this.shouldFloat);
  19527. this.adapter_.floatLabel(this.shouldFloat);
  19528. this.adapter_.shakeLabel(this.shouldShake);
  19529. }
  19530. if (this.helperText_) {
  19531. this.helperText_.showToScreenReader();
  19532. }
  19533. };
  19534. /**
  19535. * Sets the line ripple's transform origin, so that the line ripple activate
  19536. * animation will animate out from the user's click location.
  19537. */
  19538. MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
  19539. var touches = evt.touches;
  19540. var targetEvent = touches ? touches[0] : evt;
  19541. var targetClientRect = targetEvent.target.getBoundingClientRect();
  19542. var normalizedX = targetEvent.clientX - targetClientRect.left;
  19543. this.adapter_.setLineRippleTransformOrigin(normalizedX);
  19544. };
  19545. /**
  19546. * Handles input change of text input and text area.
  19547. */
  19548. MDCTextFieldFoundation.prototype.handleInput = function () {
  19549. this.autoCompleteFocus();
  19550. this.setCharacterCounter_(this.getValue().length);
  19551. };
  19552. /**
  19553. * Activates the Text Field's focus state in cases when the input value
  19554. * changes without user input (e.g. programmatically).
  19555. */
  19556. MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
  19557. if (!this.receivedUserInput_) {
  19558. this.activateFocus();
  19559. }
  19560. };
  19561. /**
  19562. * Deactivates the Text Field's focus state.
  19563. */
  19564. MDCTextFieldFoundation.prototype.deactivateFocus = function () {
  19565. this.isFocused_ = false;
  19566. this.adapter_.deactivateLineRipple();
  19567. var isValid = this.isValid();
  19568. this.styleValidity_(isValid);
  19569. this.styleFocused_(this.isFocused_);
  19570. if (this.adapter_.hasLabel()) {
  19571. this.notchOutline(this.shouldFloat);
  19572. this.adapter_.floatLabel(this.shouldFloat);
  19573. this.adapter_.shakeLabel(this.shouldShake);
  19574. }
  19575. if (!this.shouldFloat) {
  19576. this.receivedUserInput_ = false;
  19577. }
  19578. };
  19579. MDCTextFieldFoundation.prototype.getValue = function () {
  19580. return this.getNativeInput_().value;
  19581. };
  19582. /**
  19583. * @param value The value to set on the input Element.
  19584. */
  19585. MDCTextFieldFoundation.prototype.setValue = function (value) {
  19586. // Prevent Safari from moving the caret to the end of the input when the value has not changed.
  19587. if (this.getValue() !== value) {
  19588. this.getNativeInput_().value = value;
  19589. }
  19590. this.setCharacterCounter_(value.length);
  19591. var isValid = this.isValid();
  19592. this.styleValidity_(isValid);
  19593. if (this.adapter_.hasLabel()) {
  19594. this.notchOutline(this.shouldFloat);
  19595. this.adapter_.floatLabel(this.shouldFloat);
  19596. this.adapter_.shakeLabel(this.shouldShake);
  19597. }
  19598. };
  19599. /**
  19600. * @return The custom validity state, if set; otherwise, the result of a native validity check.
  19601. */
  19602. MDCTextFieldFoundation.prototype.isValid = function () {
  19603. return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_;
  19604. };
  19605. /**
  19606. * @param isValid Sets the custom validity state of the Text Field.
  19607. */
  19608. MDCTextFieldFoundation.prototype.setValid = function (isValid) {
  19609. this.isValid_ = isValid;
  19610. this.styleValidity_(isValid);
  19611. var shouldShake = !isValid && !this.isFocused_;
  19612. if (this.adapter_.hasLabel()) {
  19613. this.adapter_.shakeLabel(shouldShake);
  19614. }
  19615. };
  19616. /**
  19617. * Enables or disables the use of native validation. Use this for custom validation.
  19618. * @param useNativeValidation Set this to false to ignore native input validation.
  19619. */
  19620. MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
  19621. this.useNativeValidation_ = useNativeValidation;
  19622. };
  19623. MDCTextFieldFoundation.prototype.isDisabled = function () {
  19624. return this.getNativeInput_().disabled;
  19625. };
  19626. /**
  19627. * @param disabled Sets the text-field disabled or enabled.
  19628. */
  19629. MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
  19630. this.getNativeInput_().disabled = disabled;
  19631. this.styleDisabled_(disabled);
  19632. };
  19633. /**
  19634. * @param content Sets the content of the helper text.
  19635. */
  19636. MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
  19637. if (this.helperText_) {
  19638. this.helperText_.setContent(content);
  19639. }
  19640. };
  19641. /**
  19642. * Sets the aria label of the leading icon.
  19643. */
  19644. MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  19645. if (this.leadingIcon_) {
  19646. this.leadingIcon_.setAriaLabel(label);
  19647. }
  19648. };
  19649. /**
  19650. * Sets the text content of the leading icon.
  19651. */
  19652. MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
  19653. if (this.leadingIcon_) {
  19654. this.leadingIcon_.setContent(content);
  19655. }
  19656. };
  19657. /**
  19658. * Sets the aria label of the trailing icon.
  19659. */
  19660. MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
  19661. if (this.trailingIcon_) {
  19662. this.trailingIcon_.setAriaLabel(label);
  19663. }
  19664. };
  19665. /**
  19666. * Sets the text content of the trailing icon.
  19667. */
  19668. MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
  19669. if (this.trailingIcon_) {
  19670. this.trailingIcon_.setContent(content);
  19671. }
  19672. };
  19673. /**
  19674. * Sets character counter values that shows characters used and the total character limit.
  19675. */
  19676. MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) {
  19677. if (!this.characterCounter_) {
  19678. return;
  19679. }
  19680. var maxLength = this.getNativeInput_().maxLength;
  19681. if (maxLength === -1) {
  19682. throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
  19683. }
  19684. this.characterCounter_.setCounterValue(currentLength, maxLength);
  19685. };
  19686. /**
  19687. * @return True if the Text Field input fails in converting the user-supplied value.
  19688. */
  19689. MDCTextFieldFoundation.prototype.isBadInput_ = function () {
  19690. // The badInput property is not supported in IE 11 💩.
  19691. return this.getNativeInput_().validity.badInput || false;
  19692. };
  19693. /**
  19694. * @return The result of native validity checking (ValidityState.valid).
  19695. */
  19696. MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () {
  19697. return this.getNativeInput_().validity.valid;
  19698. };
  19699. /**
  19700. * Styles the component based on the validity state.
  19701. */
  19702. MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) {
  19703. var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
  19704. if (isValid) {
  19705. this.adapter_.removeClass(INVALID);
  19706. } else {
  19707. this.adapter_.addClass(INVALID);
  19708. }
  19709. if (this.helperText_) {
  19710. this.helperText_.setValidity(isValid);
  19711. }
  19712. };
  19713. /**
  19714. * Styles the component based on the focused state.
  19715. */
  19716. MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) {
  19717. var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
  19718. if (isFocused) {
  19719. this.adapter_.addClass(FOCUSED);
  19720. } else {
  19721. this.adapter_.removeClass(FOCUSED);
  19722. }
  19723. };
  19724. /**
  19725. * Styles the component based on the disabled state.
  19726. */
  19727. MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) {
  19728. var _a = MDCTextFieldFoundation.cssClasses,
  19729. DISABLED = _a.DISABLED,
  19730. INVALID = _a.INVALID;
  19731. if (isDisabled) {
  19732. this.adapter_.addClass(DISABLED);
  19733. this.adapter_.removeClass(INVALID);
  19734. } else {
  19735. this.adapter_.removeClass(DISABLED);
  19736. }
  19737. if (this.leadingIcon_) {
  19738. this.leadingIcon_.setDisabled(isDisabled);
  19739. }
  19740. if (this.trailingIcon_) {
  19741. this.trailingIcon_.setDisabled(isDisabled);
  19742. }
  19743. };
  19744. /**
  19745. * @return The native text input element from the host environment, or an object with the same shape for unit tests.
  19746. */
  19747. MDCTextFieldFoundation.prototype.getNativeInput_ = function () {
  19748. // this.adapter_ may be undefined in foundation unit tests. This happens when testdouble is creating a mock object
  19749. // and invokes the shouldShake/shouldFloat getters (which in turn call getValue(), which calls this method) before
  19750. // init() has been called from the MDCTextField constructor. To work around that issue, we return a dummy object.
  19751. var nativeInput = this.adapter_ ? this.adapter_.getNativeInput() : null;
  19752. return nativeInput || {
  19753. disabled: false,
  19754. maxLength: -1,
  19755. type: 'input',
  19756. validity: {
  19757. badInput: false,
  19758. valid: true
  19759. },
  19760. value: ''
  19761. };
  19762. };
  19763. return MDCTextFieldFoundation;
  19764. }(foundation_1.MDCFoundation);
  19765. exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
  19766. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19767. exports.default = MDCTextFieldFoundation;
  19768. /***/ }),
  19769. /***/ "./packages/mdc-textfield/helper-text/component.ts":
  19770. /*!*********************************************************!*\
  19771. !*** ./packages/mdc-textfield/helper-text/component.ts ***!
  19772. \*********************************************************/
  19773. /*! no static exports found */
  19774. /***/ (function(module, exports, __webpack_require__) {
  19775. "use strict";
  19776. /**
  19777. * @license
  19778. * Copyright 2017 Google Inc.
  19779. *
  19780. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19781. * of this software and associated documentation files (the "Software"), to deal
  19782. * in the Software without restriction, including without limitation the rights
  19783. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19784. * copies of the Software, and to permit persons to whom the Software is
  19785. * furnished to do so, subject to the following conditions:
  19786. *
  19787. * The above copyright notice and this permission notice shall be included in
  19788. * all copies or substantial portions of the Software.
  19789. *
  19790. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19791. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19792. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19793. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19794. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19795. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19796. * THE SOFTWARE.
  19797. */
  19798. var __extends = this && this.__extends || function () {
  19799. var _extendStatics = function extendStatics(d, b) {
  19800. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19801. d.__proto__ = b;
  19802. } || function (d, b) {
  19803. for (var p in b) {
  19804. if (b.hasOwnProperty(p)) d[p] = b[p];
  19805. }
  19806. };
  19807. return _extendStatics(d, b);
  19808. };
  19809. return function (d, b) {
  19810. _extendStatics(d, b);
  19811. function __() {
  19812. this.constructor = d;
  19813. }
  19814. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19815. };
  19816. }();
  19817. Object.defineProperty(exports, "__esModule", { value: true });
  19818. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  19819. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  19820. var MDCTextFieldHelperText = /** @class */function (_super) {
  19821. __extends(MDCTextFieldHelperText, _super);
  19822. function MDCTextFieldHelperText() {
  19823. return _super !== null && _super.apply(this, arguments) || this;
  19824. }
  19825. MDCTextFieldHelperText.attachTo = function (root) {
  19826. return new MDCTextFieldHelperText(root);
  19827. };
  19828. Object.defineProperty(MDCTextFieldHelperText.prototype, "foundation", {
  19829. get: function get() {
  19830. return this.foundation_;
  19831. },
  19832. enumerable: true,
  19833. configurable: true
  19834. });
  19835. MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
  19836. var _this = this;
  19837. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19838. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19839. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19840. var adapter = {
  19841. addClass: function addClass(className) {
  19842. return _this.root_.classList.add(className);
  19843. },
  19844. removeClass: function removeClass(className) {
  19845. return _this.root_.classList.remove(className);
  19846. },
  19847. hasClass: function hasClass(className) {
  19848. return _this.root_.classList.contains(className);
  19849. },
  19850. setAttr: function setAttr(attr, value) {
  19851. return _this.root_.setAttribute(attr, value);
  19852. },
  19853. removeAttr: function removeAttr(attr) {
  19854. return _this.root_.removeAttribute(attr);
  19855. },
  19856. setContent: function setContent(content) {
  19857. _this.root_.textContent = content;
  19858. }
  19859. };
  19860. // tslint:enable:object-literal-sort-keys
  19861. return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
  19862. };
  19863. return MDCTextFieldHelperText;
  19864. }(component_1.MDCComponent);
  19865. exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
  19866. /***/ }),
  19867. /***/ "./packages/mdc-textfield/helper-text/constants.ts":
  19868. /*!*********************************************************!*\
  19869. !*** ./packages/mdc-textfield/helper-text/constants.ts ***!
  19870. \*********************************************************/
  19871. /*! no static exports found */
  19872. /***/ (function(module, exports, __webpack_require__) {
  19873. "use strict";
  19874. /**
  19875. * @license
  19876. * Copyright 2016 Google Inc.
  19877. *
  19878. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19879. * of this software and associated documentation files (the "Software"), to deal
  19880. * in the Software without restriction, including without limitation the rights
  19881. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19882. * copies of the Software, and to permit persons to whom the Software is
  19883. * furnished to do so, subject to the following conditions:
  19884. *
  19885. * The above copyright notice and this permission notice shall be included in
  19886. * all copies or substantial portions of the Software.
  19887. *
  19888. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19889. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19890. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19891. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19892. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19893. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19894. * THE SOFTWARE.
  19895. */
  19896. Object.defineProperty(exports, "__esModule", { value: true });
  19897. var cssClasses = {
  19898. HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
  19899. HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
  19900. ROOT: 'mdc-text-field-helper-text'
  19901. };
  19902. exports.cssClasses = cssClasses;
  19903. var strings = {
  19904. ARIA_HIDDEN: 'aria-hidden',
  19905. ROLE: 'role',
  19906. ROOT_SELECTOR: "." + cssClasses.ROOT
  19907. };
  19908. exports.strings = strings;
  19909. /***/ }),
  19910. /***/ "./packages/mdc-textfield/helper-text/foundation.ts":
  19911. /*!**********************************************************!*\
  19912. !*** ./packages/mdc-textfield/helper-text/foundation.ts ***!
  19913. \**********************************************************/
  19914. /*! no static exports found */
  19915. /***/ (function(module, exports, __webpack_require__) {
  19916. "use strict";
  19917. /**
  19918. * @license
  19919. * Copyright 2017 Google Inc.
  19920. *
  19921. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19922. * of this software and associated documentation files (the "Software"), to deal
  19923. * in the Software without restriction, including without limitation the rights
  19924. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19925. * copies of the Software, and to permit persons to whom the Software is
  19926. * furnished to do so, subject to the following conditions:
  19927. *
  19928. * The above copyright notice and this permission notice shall be included in
  19929. * all copies or substantial portions of the Software.
  19930. *
  19931. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19932. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19933. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19934. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19935. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19936. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19937. * THE SOFTWARE.
  19938. */
  19939. var __extends = this && this.__extends || function () {
  19940. var _extendStatics = function extendStatics(d, b) {
  19941. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19942. d.__proto__ = b;
  19943. } || function (d, b) {
  19944. for (var p in b) {
  19945. if (b.hasOwnProperty(p)) d[p] = b[p];
  19946. }
  19947. };
  19948. return _extendStatics(d, b);
  19949. };
  19950. return function (d, b) {
  19951. _extendStatics(d, b);
  19952. function __() {
  19953. this.constructor = d;
  19954. }
  19955. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19956. };
  19957. }();
  19958. var __assign = this && this.__assign || function () {
  19959. __assign = Object.assign || function (t) {
  19960. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19961. s = arguments[i];
  19962. for (var p in s) {
  19963. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19964. }
  19965. }
  19966. return t;
  19967. };
  19968. return __assign.apply(this, arguments);
  19969. };
  19970. Object.defineProperty(exports, "__esModule", { value: true });
  19971. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19972. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  19973. var MDCTextFieldHelperTextFoundation = /** @class */function (_super) {
  19974. __extends(MDCTextFieldHelperTextFoundation, _super);
  19975. function MDCTextFieldHelperTextFoundation(adapter) {
  19976. return _super.call(this, __assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter, adapter)) || this;
  19977. }
  19978. Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
  19979. get: function get() {
  19980. return constants_1.cssClasses;
  19981. },
  19982. enumerable: true,
  19983. configurable: true
  19984. });
  19985. Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
  19986. get: function get() {
  19987. return constants_1.strings;
  19988. },
  19989. enumerable: true,
  19990. configurable: true
  19991. });
  19992. Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
  19993. /**
  19994. * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.
  19995. */
  19996. get: function get() {
  19997. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19998. return {
  19999. addClass: function addClass() {
  20000. return undefined;
  20001. },
  20002. removeClass: function removeClass() {
  20003. return undefined;
  20004. },
  20005. hasClass: function hasClass() {
  20006. return false;
  20007. },
  20008. setAttr: function setAttr() {
  20009. return undefined;
  20010. },
  20011. removeAttr: function removeAttr() {
  20012. return undefined;
  20013. },
  20014. setContent: function setContent() {
  20015. return undefined;
  20016. }
  20017. };
  20018. // tslint:enable:object-literal-sort-keys
  20019. },
  20020. enumerable: true,
  20021. configurable: true
  20022. });
  20023. /**
  20024. * Sets the content of the helper text field.
  20025. */
  20026. MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
  20027. this.adapter_.setContent(content);
  20028. };
  20029. /**
  20030. * @param isPersistent Sets the persistency of the helper text.
  20031. */
  20032. MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  20033. if (isPersistent) {
  20034. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  20035. } else {
  20036. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  20037. }
  20038. };
  20039. /**
  20040. * @param isValidation True to make the helper text act as an error validation message.
  20041. */
  20042. MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
  20043. if (isValidation) {
  20044. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  20045. } else {
  20046. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  20047. }
  20048. };
  20049. /**
  20050. * Makes the helper text visible to the screen reader.
  20051. */
  20052. MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
  20053. this.adapter_.removeAttr(constants_1.strings.ARIA_HIDDEN);
  20054. };
  20055. /**
  20056. * Sets the validity of the helper text based on the input validity.
  20057. */
  20058. MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
  20059. var helperTextIsPersistent = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  20060. var helperTextIsValidationMsg = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  20061. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
  20062. if (validationMsgNeedsDisplay) {
  20063. this.adapter_.setAttr(constants_1.strings.ROLE, 'alert');
  20064. } else {
  20065. this.adapter_.removeAttr(constants_1.strings.ROLE);
  20066. }
  20067. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  20068. this.hide_();
  20069. }
  20070. };
  20071. /**
  20072. * Hides the help text from screen readers.
  20073. */
  20074. MDCTextFieldHelperTextFoundation.prototype.hide_ = function () {
  20075. this.adapter_.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  20076. };
  20077. return MDCTextFieldHelperTextFoundation;
  20078. }(foundation_1.MDCFoundation);
  20079. exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
  20080. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20081. exports.default = MDCTextFieldHelperTextFoundation;
  20082. /***/ }),
  20083. /***/ "./packages/mdc-textfield/helper-text/index.ts":
  20084. /*!*****************************************************!*\
  20085. !*** ./packages/mdc-textfield/helper-text/index.ts ***!
  20086. \*****************************************************/
  20087. /*! no static exports found */
  20088. /***/ (function(module, exports, __webpack_require__) {
  20089. "use strict";
  20090. /**
  20091. * @license
  20092. * Copyright 2019 Google Inc.
  20093. *
  20094. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20095. * of this software and associated documentation files (the "Software"), to deal
  20096. * in the Software without restriction, including without limitation the rights
  20097. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20098. * copies of the Software, and to permit persons to whom the Software is
  20099. * furnished to do so, subject to the following conditions:
  20100. *
  20101. * The above copyright notice and this permission notice shall be included in
  20102. * all copies or substantial portions of the Software.
  20103. *
  20104. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20105. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20106. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20107. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20108. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20109. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20110. * THE SOFTWARE.
  20111. */
  20112. function __export(m) {
  20113. for (var p in m) {
  20114. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20115. }
  20116. }
  20117. Object.defineProperty(exports, "__esModule", { value: true });
  20118. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"));
  20119. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"));
  20120. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  20121. exports.helperTextCssClasses = constants_1.cssClasses;
  20122. exports.helperTextStrings = constants_1.strings;
  20123. /***/ }),
  20124. /***/ "./packages/mdc-textfield/icon/component.ts":
  20125. /*!**************************************************!*\
  20126. !*** ./packages/mdc-textfield/icon/component.ts ***!
  20127. \**************************************************/
  20128. /*! no static exports found */
  20129. /***/ (function(module, exports, __webpack_require__) {
  20130. "use strict";
  20131. /**
  20132. * @license
  20133. * Copyright 2017 Google Inc.
  20134. *
  20135. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20136. * of this software and associated documentation files (the "Software"), to deal
  20137. * in the Software without restriction, including without limitation the rights
  20138. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20139. * copies of the Software, and to permit persons to whom the Software is
  20140. * furnished to do so, subject to the following conditions:
  20141. *
  20142. * The above copyright notice and this permission notice shall be included in
  20143. * all copies or substantial portions of the Software.
  20144. *
  20145. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20146. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20147. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20148. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20149. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20150. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20151. * THE SOFTWARE.
  20152. */
  20153. var __extends = this && this.__extends || function () {
  20154. var _extendStatics = function extendStatics(d, b) {
  20155. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20156. d.__proto__ = b;
  20157. } || function (d, b) {
  20158. for (var p in b) {
  20159. if (b.hasOwnProperty(p)) d[p] = b[p];
  20160. }
  20161. };
  20162. return _extendStatics(d, b);
  20163. };
  20164. return function (d, b) {
  20165. _extendStatics(d, b);
  20166. function __() {
  20167. this.constructor = d;
  20168. }
  20169. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20170. };
  20171. }();
  20172. Object.defineProperty(exports, "__esModule", { value: true });
  20173. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20174. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts");
  20175. var MDCTextFieldIcon = /** @class */function (_super) {
  20176. __extends(MDCTextFieldIcon, _super);
  20177. function MDCTextFieldIcon() {
  20178. return _super !== null && _super.apply(this, arguments) || this;
  20179. }
  20180. MDCTextFieldIcon.attachTo = function (root) {
  20181. return new MDCTextFieldIcon(root);
  20182. };
  20183. Object.defineProperty(MDCTextFieldIcon.prototype, "foundation", {
  20184. get: function get() {
  20185. return this.foundation_;
  20186. },
  20187. enumerable: true,
  20188. configurable: true
  20189. });
  20190. MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
  20191. var _this = this;
  20192. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20193. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20194. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20195. var adapter = {
  20196. getAttr: function getAttr(attr) {
  20197. return _this.root_.getAttribute(attr);
  20198. },
  20199. setAttr: function setAttr(attr, value) {
  20200. return _this.root_.setAttribute(attr, value);
  20201. },
  20202. removeAttr: function removeAttr(attr) {
  20203. return _this.root_.removeAttribute(attr);
  20204. },
  20205. setContent: function setContent(content) {
  20206. _this.root_.textContent = content;
  20207. },
  20208. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  20209. return _this.listen(evtType, handler);
  20210. },
  20211. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  20212. return _this.unlisten(evtType, handler);
  20213. },
  20214. notifyIconAction: function notifyIconAction() {
  20215. return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  20216. }
  20217. };
  20218. // tslint:enable:object-literal-sort-keys
  20219. return new foundation_1.MDCTextFieldIconFoundation(adapter);
  20220. };
  20221. return MDCTextFieldIcon;
  20222. }(component_1.MDCComponent);
  20223. exports.MDCTextFieldIcon = MDCTextFieldIcon;
  20224. /***/ }),
  20225. /***/ "./packages/mdc-textfield/icon/constants.ts":
  20226. /*!**************************************************!*\
  20227. !*** ./packages/mdc-textfield/icon/constants.ts ***!
  20228. \**************************************************/
  20229. /*! no static exports found */
  20230. /***/ (function(module, exports, __webpack_require__) {
  20231. "use strict";
  20232. /**
  20233. * @license
  20234. * Copyright 2016 Google Inc.
  20235. *
  20236. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20237. * of this software and associated documentation files (the "Software"), to deal
  20238. * in the Software without restriction, including without limitation the rights
  20239. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20240. * copies of the Software, and to permit persons to whom the Software is
  20241. * furnished to do so, subject to the following conditions:
  20242. *
  20243. * The above copyright notice and this permission notice shall be included in
  20244. * all copies or substantial portions of the Software.
  20245. *
  20246. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20247. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20248. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20249. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20250. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20251. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20252. * THE SOFTWARE.
  20253. */
  20254. Object.defineProperty(exports, "__esModule", { value: true });
  20255. var strings = {
  20256. ICON_EVENT: 'MDCTextField:icon',
  20257. ICON_ROLE: 'button'
  20258. };
  20259. exports.strings = strings;
  20260. var cssClasses = {
  20261. ROOT: 'mdc-text-field__icon'
  20262. };
  20263. exports.cssClasses = cssClasses;
  20264. /***/ }),
  20265. /***/ "./packages/mdc-textfield/icon/foundation.ts":
  20266. /*!***************************************************!*\
  20267. !*** ./packages/mdc-textfield/icon/foundation.ts ***!
  20268. \***************************************************/
  20269. /*! no static exports found */
  20270. /***/ (function(module, exports, __webpack_require__) {
  20271. "use strict";
  20272. /**
  20273. * @license
  20274. * Copyright 2017 Google Inc.
  20275. *
  20276. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20277. * of this software and associated documentation files (the "Software"), to deal
  20278. * in the Software without restriction, including without limitation the rights
  20279. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20280. * copies of the Software, and to permit persons to whom the Software is
  20281. * furnished to do so, subject to the following conditions:
  20282. *
  20283. * The above copyright notice and this permission notice shall be included in
  20284. * all copies or substantial portions of the Software.
  20285. *
  20286. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20287. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20288. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20289. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20290. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20291. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20292. * THE SOFTWARE.
  20293. */
  20294. var __extends = this && this.__extends || function () {
  20295. var _extendStatics = function extendStatics(d, b) {
  20296. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20297. d.__proto__ = b;
  20298. } || function (d, b) {
  20299. for (var p in b) {
  20300. if (b.hasOwnProperty(p)) d[p] = b[p];
  20301. }
  20302. };
  20303. return _extendStatics(d, b);
  20304. };
  20305. return function (d, b) {
  20306. _extendStatics(d, b);
  20307. function __() {
  20308. this.constructor = d;
  20309. }
  20310. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20311. };
  20312. }();
  20313. var __assign = this && this.__assign || function () {
  20314. __assign = Object.assign || function (t) {
  20315. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20316. s = arguments[i];
  20317. for (var p in s) {
  20318. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20319. }
  20320. }
  20321. return t;
  20322. };
  20323. return __assign.apply(this, arguments);
  20324. };
  20325. Object.defineProperty(exports, "__esModule", { value: true });
  20326. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20327. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  20328. var INTERACTION_EVENTS = ['click', 'keydown'];
  20329. var MDCTextFieldIconFoundation = /** @class */function (_super) {
  20330. __extends(MDCTextFieldIconFoundation, _super);
  20331. function MDCTextFieldIconFoundation(adapter) {
  20332. var _this = _super.call(this, __assign({}, MDCTextFieldIconFoundation.defaultAdapter, adapter)) || this;
  20333. _this.savedTabIndex_ = null;
  20334. _this.interactionHandler_ = function (evt) {
  20335. return _this.handleInteraction(evt);
  20336. };
  20337. return _this;
  20338. }
  20339. Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
  20340. get: function get() {
  20341. return constants_1.strings;
  20342. },
  20343. enumerable: true,
  20344. configurable: true
  20345. });
  20346. Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
  20347. get: function get() {
  20348. return constants_1.cssClasses;
  20349. },
  20350. enumerable: true,
  20351. configurable: true
  20352. });
  20353. Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
  20354. /**
  20355. * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.
  20356. */
  20357. get: function get() {
  20358. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20359. return {
  20360. getAttr: function getAttr() {
  20361. return null;
  20362. },
  20363. setAttr: function setAttr() {
  20364. return undefined;
  20365. },
  20366. removeAttr: function removeAttr() {
  20367. return undefined;
  20368. },
  20369. setContent: function setContent() {
  20370. return undefined;
  20371. },
  20372. registerInteractionHandler: function registerInteractionHandler() {
  20373. return undefined;
  20374. },
  20375. deregisterInteractionHandler: function deregisterInteractionHandler() {
  20376. return undefined;
  20377. },
  20378. notifyIconAction: function notifyIconAction() {
  20379. return undefined;
  20380. }
  20381. };
  20382. // tslint:enable:object-literal-sort-keys
  20383. },
  20384. enumerable: true,
  20385. configurable: true
  20386. });
  20387. MDCTextFieldIconFoundation.prototype.init = function () {
  20388. var _this = this;
  20389. this.savedTabIndex_ = this.adapter_.getAttr('tabindex');
  20390. INTERACTION_EVENTS.forEach(function (evtType) {
  20391. _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_);
  20392. });
  20393. };
  20394. MDCTextFieldIconFoundation.prototype.destroy = function () {
  20395. var _this = this;
  20396. INTERACTION_EVENTS.forEach(function (evtType) {
  20397. _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  20398. });
  20399. };
  20400. MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
  20401. if (!this.savedTabIndex_) {
  20402. return;
  20403. }
  20404. if (disabled) {
  20405. this.adapter_.setAttr('tabindex', '-1');
  20406. this.adapter_.removeAttr('role');
  20407. } else {
  20408. this.adapter_.setAttr('tabindex', this.savedTabIndex_);
  20409. this.adapter_.setAttr('role', constants_1.strings.ICON_ROLE);
  20410. }
  20411. };
  20412. MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
  20413. this.adapter_.setAttr('aria-label', label);
  20414. };
  20415. MDCTextFieldIconFoundation.prototype.setContent = function (content) {
  20416. this.adapter_.setContent(content);
  20417. };
  20418. MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
  20419. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  20420. if (evt.type === 'click' || isEnterKey) {
  20421. this.adapter_.notifyIconAction();
  20422. }
  20423. };
  20424. return MDCTextFieldIconFoundation;
  20425. }(foundation_1.MDCFoundation);
  20426. exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
  20427. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20428. exports.default = MDCTextFieldIconFoundation;
  20429. /***/ }),
  20430. /***/ "./packages/mdc-textfield/icon/index.ts":
  20431. /*!**********************************************!*\
  20432. !*** ./packages/mdc-textfield/icon/index.ts ***!
  20433. \**********************************************/
  20434. /*! no static exports found */
  20435. /***/ (function(module, exports, __webpack_require__) {
  20436. "use strict";
  20437. /**
  20438. * @license
  20439. * Copyright 2019 Google Inc.
  20440. *
  20441. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20442. * of this software and associated documentation files (the "Software"), to deal
  20443. * in the Software without restriction, including without limitation the rights
  20444. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20445. * copies of the Software, and to permit persons to whom the Software is
  20446. * furnished to do so, subject to the following conditions:
  20447. *
  20448. * The above copyright notice and this permission notice shall be included in
  20449. * all copies or substantial portions of the Software.
  20450. *
  20451. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20452. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20453. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20454. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20455. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20456. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20457. * THE SOFTWARE.
  20458. */
  20459. function __export(m) {
  20460. for (var p in m) {
  20461. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20462. }
  20463. }
  20464. Object.defineProperty(exports, "__esModule", { value: true });
  20465. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"));
  20466. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"));
  20467. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  20468. exports.iconCssClasses = constants_1.cssClasses;
  20469. exports.iconStrings = constants_1.strings;
  20470. /***/ }),
  20471. /***/ "./packages/mdc-textfield/index.ts":
  20472. /*!*****************************************!*\
  20473. !*** ./packages/mdc-textfield/index.ts ***!
  20474. \*****************************************/
  20475. /*! no static exports found */
  20476. /***/ (function(module, exports, __webpack_require__) {
  20477. "use strict";
  20478. /**
  20479. * @license
  20480. * Copyright 2019 Google Inc.
  20481. *
  20482. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20483. * of this software and associated documentation files (the "Software"), to deal
  20484. * in the Software without restriction, including without limitation the rights
  20485. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20486. * copies of the Software, and to permit persons to whom the Software is
  20487. * furnished to do so, subject to the following conditions:
  20488. *
  20489. * The above copyright notice and this permission notice shall be included in
  20490. * all copies or substantial portions of the Software.
  20491. *
  20492. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20493. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20494. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20495. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20496. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20497. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20498. * THE SOFTWARE.
  20499. */
  20500. function __export(m) {
  20501. for (var p in m) {
  20502. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20503. }
  20504. }
  20505. Object.defineProperty(exports, "__esModule", { value: true });
  20506. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"));
  20507. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"));
  20508. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"));
  20509. __export(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"));
  20510. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"));
  20511. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"));
  20512. /***/ }),
  20513. /***/ "./packages/mdc-top-app-bar/component.ts":
  20514. /*!***********************************************!*\
  20515. !*** ./packages/mdc-top-app-bar/component.ts ***!
  20516. \***********************************************/
  20517. /*! no static exports found */
  20518. /***/ (function(module, exports, __webpack_require__) {
  20519. "use strict";
  20520. /**
  20521. * @license
  20522. * Copyright 2018 Google Inc.
  20523. *
  20524. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20525. * of this software and associated documentation files (the "Software"), to deal
  20526. * in the Software without restriction, including without limitation the rights
  20527. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20528. * copies of the Software, and to permit persons to whom the Software is
  20529. * furnished to do so, subject to the following conditions:
  20530. *
  20531. * The above copyright notice and this permission notice shall be included in
  20532. * all copies or substantial portions of the Software.
  20533. *
  20534. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20535. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20536. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20537. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20538. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20539. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20540. * THE SOFTWARE.
  20541. */
  20542. var __extends = this && this.__extends || function () {
  20543. var _extendStatics = function extendStatics(d, b) {
  20544. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20545. d.__proto__ = b;
  20546. } || function (d, b) {
  20547. for (var p in b) {
  20548. if (b.hasOwnProperty(p)) d[p] = b[p];
  20549. }
  20550. };
  20551. return _extendStatics(d, b);
  20552. };
  20553. return function (d, b) {
  20554. _extendStatics(d, b);
  20555. function __() {
  20556. this.constructor = d;
  20557. }
  20558. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20559. };
  20560. }();
  20561. Object.defineProperty(exports, "__esModule", { value: true });
  20562. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20563. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  20564. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  20565. var foundation_1 = __webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts");
  20566. var foundation_2 = __webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts");
  20567. var foundation_3 = __webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  20568. var MDCTopAppBar = /** @class */function (_super) {
  20569. __extends(MDCTopAppBar, _super);
  20570. function MDCTopAppBar() {
  20571. return _super !== null && _super.apply(this, arguments) || this;
  20572. }
  20573. MDCTopAppBar.attachTo = function (root) {
  20574. return new MDCTopAppBar(root);
  20575. };
  20576. MDCTopAppBar.prototype.initialize = function (rippleFactory) {
  20577. if (rippleFactory === void 0) {
  20578. rippleFactory = function rippleFactory(el) {
  20579. return component_2.MDCRipple.attachTo(el);
  20580. };
  20581. }
  20582. this.navIcon_ = this.root_.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR);
  20583. // Get all icons in the toolbar and instantiate the ripples
  20584. var icons = [].slice.call(this.root_.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR));
  20585. if (this.navIcon_) {
  20586. icons.push(this.navIcon_);
  20587. }
  20588. this.iconRipples_ = icons.map(function (icon) {
  20589. var ripple = rippleFactory(icon);
  20590. ripple.unbounded = true;
  20591. return ripple;
  20592. });
  20593. this.scrollTarget_ = window;
  20594. };
  20595. MDCTopAppBar.prototype.initialSyncWithDOM = function () {
  20596. this.handleNavigationClick_ = this.foundation_.handleNavigationClick.bind(this.foundation_);
  20597. this.handleWindowResize_ = this.foundation_.handleWindowResize.bind(this.foundation_);
  20598. this.handleTargetScroll_ = this.foundation_.handleTargetScroll.bind(this.foundation_);
  20599. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  20600. if (this.navIcon_) {
  20601. this.navIcon_.addEventListener('click', this.handleNavigationClick_);
  20602. }
  20603. var isFixed = this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  20604. var isShort = this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  20605. if (!isShort && !isFixed) {
  20606. window.addEventListener('resize', this.handleWindowResize_);
  20607. }
  20608. };
  20609. MDCTopAppBar.prototype.destroy = function () {
  20610. this.iconRipples_.forEach(function (iconRipple) {
  20611. return iconRipple.destroy();
  20612. });
  20613. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  20614. if (this.navIcon_) {
  20615. this.navIcon_.removeEventListener('click', this.handleNavigationClick_);
  20616. }
  20617. var isFixed = this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  20618. var isShort = this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  20619. if (!isShort && !isFixed) {
  20620. window.removeEventListener('resize', this.handleWindowResize_);
  20621. }
  20622. _super.prototype.destroy.call(this);
  20623. };
  20624. MDCTopAppBar.prototype.setScrollTarget = function (target) {
  20625. // Remove scroll handler from the previous scroll target
  20626. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  20627. this.scrollTarget_ = target;
  20628. // Initialize scroll handler on the new scroll target
  20629. this.handleTargetScroll_ = this.foundation_.handleTargetScroll.bind(this.foundation_);
  20630. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  20631. };
  20632. MDCTopAppBar.prototype.getDefaultFoundation = function () {
  20633. var _this = this;
  20634. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20635. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20636. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20637. var adapter = {
  20638. hasClass: function hasClass(className) {
  20639. return _this.root_.classList.contains(className);
  20640. },
  20641. addClass: function addClass(className) {
  20642. return _this.root_.classList.add(className);
  20643. },
  20644. removeClass: function removeClass(className) {
  20645. return _this.root_.classList.remove(className);
  20646. },
  20647. setStyle: function setStyle(property, value) {
  20648. return _this.root_.style.setProperty(property, value);
  20649. },
  20650. getTopAppBarHeight: function getTopAppBarHeight() {
  20651. return _this.root_.clientHeight;
  20652. },
  20653. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  20654. return _this.emit(constants_1.strings.NAVIGATION_EVENT, {});
  20655. },
  20656. getViewportScrollY: function getViewportScrollY() {
  20657. var win = _this.scrollTarget_;
  20658. var el = _this.scrollTarget_;
  20659. return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop;
  20660. },
  20661. getTotalActionItems: function getTotalActionItems() {
  20662. return _this.root_.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length;
  20663. }
  20664. };
  20665. // tslint:enable:object-literal-sort-keys
  20666. var foundation;
  20667. if (this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS)) {
  20668. foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter);
  20669. } else if (this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS)) {
  20670. foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter);
  20671. } else {
  20672. foundation = new foundation_3.MDCTopAppBarFoundation(adapter);
  20673. }
  20674. return foundation;
  20675. };
  20676. return MDCTopAppBar;
  20677. }(component_1.MDCComponent);
  20678. exports.MDCTopAppBar = MDCTopAppBar;
  20679. /***/ }),
  20680. /***/ "./packages/mdc-top-app-bar/constants.ts":
  20681. /*!***********************************************!*\
  20682. !*** ./packages/mdc-top-app-bar/constants.ts ***!
  20683. \***********************************************/
  20684. /*! no static exports found */
  20685. /***/ (function(module, exports, __webpack_require__) {
  20686. "use strict";
  20687. /**
  20688. * @license
  20689. * Copyright 2018 Google Inc.
  20690. *
  20691. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20692. * of this software and associated documentation files (the "Software"), to deal
  20693. * in the Software without restriction, including without limitation the rights
  20694. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20695. * copies of the Software, and to permit persons to whom the Software is
  20696. * furnished to do so, subject to the following conditions:
  20697. *
  20698. * The above copyright notice and this permission notice shall be included in
  20699. * all copies or substantial portions of the Software.
  20700. *
  20701. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20702. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20703. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20704. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20705. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20706. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20707. * THE SOFTWARE.
  20708. */
  20709. Object.defineProperty(exports, "__esModule", { value: true });
  20710. var cssClasses = {
  20711. FIXED_CLASS: 'mdc-top-app-bar--fixed',
  20712. FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled',
  20713. SHORT_CLASS: 'mdc-top-app-bar--short',
  20714. SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed',
  20715. SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'
  20716. };
  20717. exports.cssClasses = cssClasses;
  20718. var numbers = {
  20719. DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100,
  20720. MAX_TOP_APP_BAR_HEIGHT: 128
  20721. };
  20722. exports.numbers = numbers;
  20723. var strings = {
  20724. ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item',
  20725. NAVIGATION_EVENT: 'MDCTopAppBar:nav',
  20726. NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon',
  20727. ROOT_SELECTOR: '.mdc-top-app-bar',
  20728. TITLE_SELECTOR: '.mdc-top-app-bar__title'
  20729. };
  20730. exports.strings = strings;
  20731. /***/ }),
  20732. /***/ "./packages/mdc-top-app-bar/fixed/foundation.ts":
  20733. /*!******************************************************!*\
  20734. !*** ./packages/mdc-top-app-bar/fixed/foundation.ts ***!
  20735. \******************************************************/
  20736. /*! no static exports found */
  20737. /***/ (function(module, exports, __webpack_require__) {
  20738. "use strict";
  20739. /**
  20740. * @license
  20741. * Copyright 2018 Google Inc.
  20742. *
  20743. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20744. * of this software and associated documentation files (the "Software"), to deal
  20745. * in the Software without restriction, including without limitation the rights
  20746. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20747. * copies of the Software, and to permit persons to whom the Software is
  20748. * furnished to do so, subject to the following conditions:
  20749. *
  20750. * The above copyright notice and this permission notice shall be included in
  20751. * all copies or substantial portions of the Software.
  20752. *
  20753. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20754. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20755. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20756. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20757. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20758. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20759. * THE SOFTWARE.
  20760. */
  20761. var __extends = this && this.__extends || function () {
  20762. var _extendStatics = function extendStatics(d, b) {
  20763. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20764. d.__proto__ = b;
  20765. } || function (d, b) {
  20766. for (var p in b) {
  20767. if (b.hasOwnProperty(p)) d[p] = b[p];
  20768. }
  20769. };
  20770. return _extendStatics(d, b);
  20771. };
  20772. return function (d, b) {
  20773. _extendStatics(d, b);
  20774. function __() {
  20775. this.constructor = d;
  20776. }
  20777. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20778. };
  20779. }();
  20780. Object.defineProperty(exports, "__esModule", { value: true });
  20781. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  20782. var foundation_1 = __webpack_require__(/*! ../standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  20783. var MDCFixedTopAppBarFoundation = /** @class */function (_super) {
  20784. __extends(MDCFixedTopAppBarFoundation, _super);
  20785. function MDCFixedTopAppBarFoundation() {
  20786. var _this = _super !== null && _super.apply(this, arguments) || this;
  20787. /**
  20788. * State variable for the previous scroll iteration top app bar state
  20789. */
  20790. _this.wasScrolled_ = false;
  20791. return _this;
  20792. }
  20793. /**
  20794. * Scroll handler for applying/removing the modifier class on the fixed top app bar.
  20795. * @override
  20796. */
  20797. MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () {
  20798. var currentScroll = this.adapter_.getViewportScrollY();
  20799. if (currentScroll <= 0) {
  20800. if (this.wasScrolled_) {
  20801. this.adapter_.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  20802. this.wasScrolled_ = false;
  20803. }
  20804. } else {
  20805. if (!this.wasScrolled_) {
  20806. this.adapter_.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  20807. this.wasScrolled_ = true;
  20808. }
  20809. }
  20810. };
  20811. return MDCFixedTopAppBarFoundation;
  20812. }(foundation_1.MDCTopAppBarFoundation);
  20813. exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation;
  20814. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20815. exports.default = MDCFixedTopAppBarFoundation;
  20816. /***/ }),
  20817. /***/ "./packages/mdc-top-app-bar/foundation.ts":
  20818. /*!************************************************!*\
  20819. !*** ./packages/mdc-top-app-bar/foundation.ts ***!
  20820. \************************************************/
  20821. /*! no static exports found */
  20822. /***/ (function(module, exports, __webpack_require__) {
  20823. "use strict";
  20824. /**
  20825. * @license
  20826. * Copyright 2018 Google Inc.
  20827. *
  20828. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20829. * of this software and associated documentation files (the "Software"), to deal
  20830. * in the Software without restriction, including without limitation the rights
  20831. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20832. * copies of the Software, and to permit persons to whom the Software is
  20833. * furnished to do so, subject to the following conditions:
  20834. *
  20835. * The above copyright notice and this permission notice shall be included in
  20836. * all copies or substantial portions of the Software.
  20837. *
  20838. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20839. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20840. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20841. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20842. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20843. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20844. * THE SOFTWARE.
  20845. */
  20846. var __extends = this && this.__extends || function () {
  20847. var _extendStatics = function extendStatics(d, b) {
  20848. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20849. d.__proto__ = b;
  20850. } || function (d, b) {
  20851. for (var p in b) {
  20852. if (b.hasOwnProperty(p)) d[p] = b[p];
  20853. }
  20854. };
  20855. return _extendStatics(d, b);
  20856. };
  20857. return function (d, b) {
  20858. _extendStatics(d, b);
  20859. function __() {
  20860. this.constructor = d;
  20861. }
  20862. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20863. };
  20864. }();
  20865. var __assign = this && this.__assign || function () {
  20866. __assign = Object.assign || function (t) {
  20867. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20868. s = arguments[i];
  20869. for (var p in s) {
  20870. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20871. }
  20872. }
  20873. return t;
  20874. };
  20875. return __assign.apply(this, arguments);
  20876. };
  20877. Object.defineProperty(exports, "__esModule", { value: true });
  20878. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20879. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  20880. var MDCTopAppBarBaseFoundation = /** @class */function (_super) {
  20881. __extends(MDCTopAppBarBaseFoundation, _super);
  20882. /* istanbul ignore next: optional argument is not a branch statement */
  20883. function MDCTopAppBarBaseFoundation(adapter) {
  20884. return _super.call(this, __assign({}, MDCTopAppBarBaseFoundation.defaultAdapter, adapter)) || this;
  20885. }
  20886. Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", {
  20887. get: function get() {
  20888. return constants_1.strings;
  20889. },
  20890. enumerable: true,
  20891. configurable: true
  20892. });
  20893. Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", {
  20894. get: function get() {
  20895. return constants_1.cssClasses;
  20896. },
  20897. enumerable: true,
  20898. configurable: true
  20899. });
  20900. Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", {
  20901. get: function get() {
  20902. return constants_1.numbers;
  20903. },
  20904. enumerable: true,
  20905. configurable: true
  20906. });
  20907. Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", {
  20908. /**
  20909. * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types.
  20910. */
  20911. get: function get() {
  20912. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20913. return {
  20914. addClass: function addClass() {
  20915. return undefined;
  20916. },
  20917. removeClass: function removeClass() {
  20918. return undefined;
  20919. },
  20920. hasClass: function hasClass() {
  20921. return false;
  20922. },
  20923. setStyle: function setStyle() {
  20924. return undefined;
  20925. },
  20926. getTopAppBarHeight: function getTopAppBarHeight() {
  20927. return 0;
  20928. },
  20929. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  20930. return undefined;
  20931. },
  20932. getViewportScrollY: function getViewportScrollY() {
  20933. return 0;
  20934. },
  20935. getTotalActionItems: function getTotalActionItems() {
  20936. return 0;
  20937. }
  20938. };
  20939. // tslint:enable:object-literal-sort-keys
  20940. },
  20941. enumerable: true,
  20942. configurable: true
  20943. });
  20944. /** Other variants of TopAppBar foundation overrides this method */
  20945. MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {}; // tslint:disable-line:no-empty
  20946. /** Other variants of TopAppBar foundation overrides this method */
  20947. MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {}; // tslint:disable-line:no-empty
  20948. MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () {
  20949. this.adapter_.notifyNavigationIconClicked();
  20950. };
  20951. return MDCTopAppBarBaseFoundation;
  20952. }(foundation_1.MDCFoundation);
  20953. exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation;
  20954. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20955. exports.default = MDCTopAppBarBaseFoundation;
  20956. /***/ }),
  20957. /***/ "./packages/mdc-top-app-bar/index.ts":
  20958. /*!*******************************************!*\
  20959. !*** ./packages/mdc-top-app-bar/index.ts ***!
  20960. \*******************************************/
  20961. /*! no static exports found */
  20962. /***/ (function(module, exports, __webpack_require__) {
  20963. "use strict";
  20964. /**
  20965. * @license
  20966. * Copyright 2019 Google Inc.
  20967. *
  20968. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20969. * of this software and associated documentation files (the "Software"), to deal
  20970. * in the Software without restriction, including without limitation the rights
  20971. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20972. * copies of the Software, and to permit persons to whom the Software is
  20973. * furnished to do so, subject to the following conditions:
  20974. *
  20975. * The above copyright notice and this permission notice shall be included in
  20976. * all copies or substantial portions of the Software.
  20977. *
  20978. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20979. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20980. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20981. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20982. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20983. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20984. * THE SOFTWARE.
  20985. */
  20986. function __export(m) {
  20987. for (var p in m) {
  20988. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20989. }
  20990. }
  20991. Object.defineProperty(exports, "__esModule", { value: true });
  20992. __export(__webpack_require__(/*! ./component */ "./packages/mdc-top-app-bar/component.ts"));
  20993. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"));
  20994. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-top-app-bar/foundation.ts"));
  20995. __export(__webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"));
  20996. __export(__webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"));
  20997. __export(__webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"));
  20998. /***/ }),
  20999. /***/ "./packages/mdc-top-app-bar/short/foundation.ts":
  21000. /*!******************************************************!*\
  21001. !*** ./packages/mdc-top-app-bar/short/foundation.ts ***!
  21002. \******************************************************/
  21003. /*! no static exports found */
  21004. /***/ (function(module, exports, __webpack_require__) {
  21005. "use strict";
  21006. /**
  21007. * @license
  21008. * Copyright 2018 Google Inc.
  21009. *
  21010. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21011. * of this software and associated documentation files (the "Software"), to deal
  21012. * in the Software without restriction, including without limitation the rights
  21013. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21014. * copies of the Software, and to permit persons to whom the Software is
  21015. * furnished to do so, subject to the following conditions:
  21016. *
  21017. * The above copyright notice and this permission notice shall be included in
  21018. * all copies or substantial portions of the Software.
  21019. *
  21020. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21021. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21022. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21023. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21024. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21025. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21026. * THE SOFTWARE.
  21027. */
  21028. var __extends = this && this.__extends || function () {
  21029. var _extendStatics = function extendStatics(d, b) {
  21030. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  21031. d.__proto__ = b;
  21032. } || function (d, b) {
  21033. for (var p in b) {
  21034. if (b.hasOwnProperty(p)) d[p] = b[p];
  21035. }
  21036. };
  21037. return _extendStatics(d, b);
  21038. };
  21039. return function (d, b) {
  21040. _extendStatics(d, b);
  21041. function __() {
  21042. this.constructor = d;
  21043. }
  21044. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21045. };
  21046. }();
  21047. Object.defineProperty(exports, "__esModule", { value: true });
  21048. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  21049. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  21050. var MDCShortTopAppBarFoundation = /** @class */function (_super) {
  21051. __extends(MDCShortTopAppBarFoundation, _super);
  21052. /* istanbul ignore next: optional argument is not a branch statement */
  21053. function MDCShortTopAppBarFoundation(adapter) {
  21054. var _this = _super.call(this, adapter) || this;
  21055. _this.isCollapsed_ = false;
  21056. _this.isAlwaysCollapsed_ = false;
  21057. return _this;
  21058. }
  21059. Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", {
  21060. // Public visibility for backward compatibility.
  21061. get: function get() {
  21062. return this.isCollapsed_;
  21063. },
  21064. enumerable: true,
  21065. configurable: true
  21066. });
  21067. MDCShortTopAppBarFoundation.prototype.init = function () {
  21068. _super.prototype.init.call(this);
  21069. if (this.adapter_.getTotalActionItems() > 0) {
  21070. this.adapter_.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS);
  21071. }
  21072. // If initialized with SHORT_COLLAPSED_CLASS, the bar should always be collapsed
  21073. this.setAlwaysCollapsed(this.adapter_.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS));
  21074. };
  21075. /**
  21076. * Set if the short top app bar should always be collapsed.
  21077. *
  21078. * @param value When `true`, bar will always be collapsed. When `false`, bar may collapse or expand based on scroll.
  21079. */
  21080. MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) {
  21081. this.isAlwaysCollapsed_ = !!value;
  21082. if (this.isAlwaysCollapsed_) {
  21083. this.collapse_();
  21084. } else {
  21085. // let maybeCollapseBar_ determine if the bar should be collapsed
  21086. this.maybeCollapseBar_();
  21087. }
  21088. };
  21089. MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () {
  21090. return this.isAlwaysCollapsed_;
  21091. };
  21092. /**
  21093. * Scroll handler for applying/removing the collapsed modifier class on the short top app bar.
  21094. * @override
  21095. */
  21096. MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () {
  21097. this.maybeCollapseBar_();
  21098. };
  21099. MDCShortTopAppBarFoundation.prototype.maybeCollapseBar_ = function () {
  21100. if (this.isAlwaysCollapsed_) {
  21101. return;
  21102. }
  21103. var currentScroll = this.adapter_.getViewportScrollY();
  21104. if (currentScroll <= 0) {
  21105. if (this.isCollapsed_) {
  21106. this.uncollapse_();
  21107. }
  21108. } else {
  21109. if (!this.isCollapsed_) {
  21110. this.collapse_();
  21111. }
  21112. }
  21113. };
  21114. MDCShortTopAppBarFoundation.prototype.uncollapse_ = function () {
  21115. this.adapter_.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  21116. this.isCollapsed_ = false;
  21117. };
  21118. MDCShortTopAppBarFoundation.prototype.collapse_ = function () {
  21119. this.adapter_.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  21120. this.isCollapsed_ = true;
  21121. };
  21122. return MDCShortTopAppBarFoundation;
  21123. }(foundation_1.MDCTopAppBarBaseFoundation);
  21124. exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation;
  21125. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  21126. exports.default = MDCShortTopAppBarFoundation;
  21127. /***/ }),
  21128. /***/ "./packages/mdc-top-app-bar/standard/foundation.ts":
  21129. /*!*********************************************************!*\
  21130. !*** ./packages/mdc-top-app-bar/standard/foundation.ts ***!
  21131. \*********************************************************/
  21132. /*! no static exports found */
  21133. /***/ (function(module, exports, __webpack_require__) {
  21134. "use strict";
  21135. /**
  21136. * @license
  21137. * Copyright 2018 Google Inc.
  21138. *
  21139. * Permission is hereby granted, free of charge, to any person obtaining a copy
  21140. * of this software and associated documentation files (the "Software"), to deal
  21141. * in the Software without restriction, including without limitation the rights
  21142. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21143. * copies of the Software, and to permit persons to whom the Software is
  21144. * furnished to do so, subject to the following conditions:
  21145. *
  21146. * The above copyright notice and this permission notice shall be included in
  21147. * all copies or substantial portions of the Software.
  21148. *
  21149. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21150. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21151. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21152. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21153. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21154. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21155. * THE SOFTWARE.
  21156. */
  21157. var __extends = this && this.__extends || function () {
  21158. var _extendStatics = function extendStatics(d, b) {
  21159. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  21160. d.__proto__ = b;
  21161. } || function (d, b) {
  21162. for (var p in b) {
  21163. if (b.hasOwnProperty(p)) d[p] = b[p];
  21164. }
  21165. };
  21166. return _extendStatics(d, b);
  21167. };
  21168. return function (d, b) {
  21169. _extendStatics(d, b);
  21170. function __() {
  21171. this.constructor = d;
  21172. }
  21173. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21174. };
  21175. }();
  21176. Object.defineProperty(exports, "__esModule", { value: true });
  21177. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  21178. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  21179. var INITIAL_VALUE = 0;
  21180. var MDCTopAppBarFoundation = /** @class */function (_super) {
  21181. __extends(MDCTopAppBarFoundation, _super);
  21182. /* istanbul ignore next: optional argument is not a branch statement */
  21183. function MDCTopAppBarFoundation(adapter) {
  21184. var _this = _super.call(this, adapter) || this;
  21185. /**
  21186. * Indicates if the top app bar was docked in the previous scroll handler iteration.
  21187. */
  21188. _this.wasDocked_ = true;
  21189. /**
  21190. * Indicates if the top app bar is docked in the fully shown position.
  21191. */
  21192. _this.isDockedShowing_ = true;
  21193. /**
  21194. * Variable for current scroll position of the top app bar
  21195. */
  21196. _this.currentAppBarOffsetTop_ = 0;
  21197. /**
  21198. * Used to prevent the top app bar from being scrolled out of view during resize events
  21199. */
  21200. _this.isCurrentlyBeingResized_ = false;
  21201. /**
  21202. * The timeout that's used to throttle the resize events
  21203. */
  21204. _this.resizeThrottleId_ = INITIAL_VALUE;
  21205. /**
  21206. * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize
  21207. */
  21208. _this.resizeDebounceId_ = INITIAL_VALUE;
  21209. _this.lastScrollPosition_ = _this.adapter_.getViewportScrollY();
  21210. _this.topAppBarHeight_ = _this.adapter_.getTopAppBarHeight();
  21211. return _this;
  21212. }
  21213. MDCTopAppBarFoundation.prototype.destroy = function () {
  21214. _super.prototype.destroy.call(this);
  21215. this.adapter_.setStyle('top', '');
  21216. };
  21217. /**
  21218. * Scroll handler for the default scroll behavior of the top app bar.
  21219. * @override
  21220. */
  21221. MDCTopAppBarFoundation.prototype.handleTargetScroll = function () {
  21222. var currentScrollPosition = Math.max(this.adapter_.getViewportScrollY(), 0);
  21223. var diff = currentScrollPosition - this.lastScrollPosition_;
  21224. this.lastScrollPosition_ = currentScrollPosition;
  21225. // If the window is being resized the lastScrollPosition_ needs to be updated but the
  21226. // current scroll of the top app bar should stay in the same position.
  21227. if (!this.isCurrentlyBeingResized_) {
  21228. this.currentAppBarOffsetTop_ -= diff;
  21229. if (this.currentAppBarOffsetTop_ > 0) {
  21230. this.currentAppBarOffsetTop_ = 0;
  21231. } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) {
  21232. this.currentAppBarOffsetTop_ = -this.topAppBarHeight_;
  21233. }
  21234. this.moveTopAppBar_();
  21235. }
  21236. };
  21237. /**
  21238. * Top app bar resize handler that throttle/debounce functions that execute updates.
  21239. * @override
  21240. */
  21241. MDCTopAppBarFoundation.prototype.handleWindowResize = function () {
  21242. var _this = this;
  21243. // Throttle resize events 10 p/s
  21244. if (!this.resizeThrottleId_) {
  21245. this.resizeThrottleId_ = setTimeout(function () {
  21246. _this.resizeThrottleId_ = INITIAL_VALUE;
  21247. _this.throttledResizeHandler_();
  21248. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  21249. }
  21250. this.isCurrentlyBeingResized_ = true;
  21251. if (this.resizeDebounceId_) {
  21252. clearTimeout(this.resizeDebounceId_);
  21253. }
  21254. this.resizeDebounceId_ = setTimeout(function () {
  21255. _this.handleTargetScroll();
  21256. _this.isCurrentlyBeingResized_ = false;
  21257. _this.resizeDebounceId_ = INITIAL_VALUE;
  21258. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  21259. };
  21260. /**
  21261. * Function to determine if the DOM needs to update.
  21262. */
  21263. MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () {
  21264. var offscreenBoundaryTop = -this.topAppBarHeight_;
  21265. var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0;
  21266. var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop;
  21267. var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen;
  21268. // If it's partially showing, it can't be docked.
  21269. if (partiallyShowing) {
  21270. this.wasDocked_ = false;
  21271. } else {
  21272. // Not previously docked and not partially showing, it's now docked.
  21273. if (!this.wasDocked_) {
  21274. this.wasDocked_ = true;
  21275. return true;
  21276. } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) {
  21277. this.isDockedShowing_ = hasAnyPixelsOnscreen;
  21278. return true;
  21279. }
  21280. }
  21281. return partiallyShowing;
  21282. };
  21283. /**
  21284. * Function to move the top app bar if needed.
  21285. */
  21286. MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () {
  21287. if (this.checkForUpdate_()) {
  21288. // Once the top app bar is fully hidden we use the max potential top app bar height as our offset
  21289. // so the top app bar doesn't show if the window resizes and the new height > the old height.
  21290. var offset = this.currentAppBarOffsetTop_;
  21291. if (Math.abs(offset) >= this.topAppBarHeight_) {
  21292. offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT;
  21293. }
  21294. this.adapter_.setStyle('top', offset + 'px');
  21295. }
  21296. };
  21297. /**
  21298. * Throttled function that updates the top app bar scrolled values if the
  21299. * top app bar height changes.
  21300. */
  21301. MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () {
  21302. var currentHeight = this.adapter_.getTopAppBarHeight();
  21303. if (this.topAppBarHeight_ !== currentHeight) {
  21304. this.wasDocked_ = false;
  21305. // Since the top app bar has a different height depending on the screen width, this
  21306. // will ensure that the top app bar remains in the correct location if
  21307. // completely hidden and a resize makes the top app bar a different height.
  21308. this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight;
  21309. this.topAppBarHeight_ = currentHeight;
  21310. }
  21311. this.handleTargetScroll();
  21312. };
  21313. return MDCTopAppBarFoundation;
  21314. }(foundation_1.MDCTopAppBarBaseFoundation);
  21315. exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation;
  21316. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  21317. exports.default = MDCTopAppBarFoundation;
  21318. /***/ })
  21319. /******/ });
  21320. });
  21321. //# sourceMappingURL=material-components-web.js.map