material-components-web.js 901 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567
  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 iconButton = __importStar(__webpack_require__(/*! @material/icon-button/index */ "./packages/mdc-icon-button/index.ts"));
  167. exports.iconButton = iconButton;
  168. var lineRipple = __importStar(__webpack_require__(/*! @material/line-ripple/index */ "./packages/mdc-line-ripple/index.ts"));
  169. exports.lineRipple = lineRipple;
  170. var linearProgress = __importStar(__webpack_require__(/*! @material/linear-progress/index */ "./packages/mdc-linear-progress/index.ts"));
  171. exports.linearProgress = linearProgress;
  172. var list = __importStar(__webpack_require__(/*! @material/list/index */ "./packages/mdc-list/index.ts"));
  173. exports.list = list;
  174. var menuSurface = __importStar(__webpack_require__(/*! @material/menu-surface/index */ "./packages/mdc-menu-surface/index.ts"));
  175. exports.menuSurface = menuSurface;
  176. var menu = __importStar(__webpack_require__(/*! @material/menu/index */ "./packages/mdc-menu/index.ts"));
  177. exports.menu = menu;
  178. var notchedOutline = __importStar(__webpack_require__(/*! @material/notched-outline/index */ "./packages/mdc-notched-outline/index.ts"));
  179. exports.notchedOutline = notchedOutline;
  180. var radio = __importStar(__webpack_require__(/*! @material/radio/index */ "./packages/mdc-radio/index.ts"));
  181. exports.radio = radio;
  182. var ripple = __importStar(__webpack_require__(/*! @material/ripple/index */ "./packages/mdc-ripple/index.ts"));
  183. exports.ripple = ripple;
  184. var select = __importStar(__webpack_require__(/*! @material/select/index */ "./packages/mdc-select/index.ts"));
  185. exports.select = select;
  186. var slider = __importStar(__webpack_require__(/*! @material/slider/index */ "./packages/mdc-slider/index.ts"));
  187. exports.slider = slider;
  188. var snackbar = __importStar(__webpack_require__(/*! @material/snackbar/index */ "./packages/mdc-snackbar/index.ts"));
  189. exports.snackbar = snackbar;
  190. var switchControl = __importStar(__webpack_require__(/*! @material/switch/index */ "./packages/mdc-switch/index.ts"));
  191. exports.switchControl = switchControl;
  192. var tabBar = __importStar(__webpack_require__(/*! @material/tab-bar/index */ "./packages/mdc-tab-bar/index.ts"));
  193. exports.tabBar = tabBar;
  194. var tabIndicator = __importStar(__webpack_require__(/*! @material/tab-indicator/index */ "./packages/mdc-tab-indicator/index.ts"));
  195. exports.tabIndicator = tabIndicator;
  196. var tabScroller = __importStar(__webpack_require__(/*! @material/tab-scroller/index */ "./packages/mdc-tab-scroller/index.ts"));
  197. exports.tabScroller = tabScroller;
  198. var tab = __importStar(__webpack_require__(/*! @material/tab/index */ "./packages/mdc-tab/index.ts"));
  199. exports.tab = tab;
  200. var textField = __importStar(__webpack_require__(/*! @material/textfield/index */ "./packages/mdc-textfield/index.ts"));
  201. exports.textField = textField;
  202. var topAppBar = __importStar(__webpack_require__(/*! @material/top-app-bar/index */ "./packages/mdc-top-app-bar/index.ts"));
  203. exports.topAppBar = topAppBar;
  204. // Register all components
  205. index_1.default.register('MDCCheckbox', checkbox.MDCCheckbox);
  206. index_1.default.register('MDCChip', chips.MDCChip);
  207. index_1.default.register('MDCChipSet', chips.MDCChipSet);
  208. index_1.default.register('MDCDataTable', dataTable.MDCDataTable);
  209. index_1.default.register('MDCDialog', dialog.MDCDialog);
  210. index_1.default.register('MDCDrawer', drawer.MDCDrawer);
  211. index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel);
  212. index_1.default.register('MDCFormField', formField.MDCFormField);
  213. index_1.default.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle);
  214. index_1.default.register('MDCLineRipple', lineRipple.MDCLineRipple);
  215. index_1.default.register('MDCLinearProgress', linearProgress.MDCLinearProgress);
  216. index_1.default.register('MDCList', list.MDCList);
  217. index_1.default.register('MDCMenu', menu.MDCMenu);
  218. index_1.default.register('MDCMenuSurface', menuSurface.MDCMenuSurface);
  219. index_1.default.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline);
  220. index_1.default.register('MDCRadio', radio.MDCRadio);
  221. index_1.default.register('MDCRipple', ripple.MDCRipple);
  222. index_1.default.register('MDCSelect', select.MDCSelect);
  223. index_1.default.register('MDCSlider', slider.MDCSlider);
  224. index_1.default.register('MDCSnackbar', snackbar.MDCSnackbar);
  225. index_1.default.register('MDCSwitch', switchControl.MDCSwitch);
  226. index_1.default.register('MDCTabBar', tabBar.MDCTabBar);
  227. index_1.default.register('MDCTextField', textField.MDCTextField);
  228. index_1.default.register('MDCTopAppBar', topAppBar.MDCTopAppBar);
  229. /***/ }),
  230. /***/ "./packages/mdc-animation/util.ts":
  231. /*!****************************************!*\
  232. !*** ./packages/mdc-animation/util.ts ***!
  233. \****************************************/
  234. /*! no static exports found */
  235. /***/ (function(module, exports, __webpack_require__) {
  236. "use strict";
  237. /**
  238. * @license
  239. * Copyright 2016 Google Inc.
  240. *
  241. * Permission is hereby granted, free of charge, to any person obtaining a copy
  242. * of this software and associated documentation files (the "Software"), to deal
  243. * in the Software without restriction, including without limitation the rights
  244. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  245. * copies of the Software, and to permit persons to whom the Software is
  246. * furnished to do so, subject to the following conditions:
  247. *
  248. * The above copyright notice and this permission notice shall be included in
  249. * all copies or substantial portions of the Software.
  250. *
  251. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  252. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  253. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  254. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  255. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  256. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  257. * THE SOFTWARE.
  258. */
  259. Object.defineProperty(exports, "__esModule", { value: true });
  260. var cssPropertyNameMap = {
  261. animation: {
  262. prefixed: '-webkit-animation',
  263. standard: 'animation'
  264. },
  265. transform: {
  266. prefixed: '-webkit-transform',
  267. standard: 'transform'
  268. },
  269. transition: {
  270. prefixed: '-webkit-transition',
  271. standard: 'transition'
  272. }
  273. };
  274. var jsEventTypeMap = {
  275. animationend: {
  276. cssProperty: 'animation',
  277. prefixed: 'webkitAnimationEnd',
  278. standard: 'animationend'
  279. },
  280. animationiteration: {
  281. cssProperty: 'animation',
  282. prefixed: 'webkitAnimationIteration',
  283. standard: 'animationiteration'
  284. },
  285. animationstart: {
  286. cssProperty: 'animation',
  287. prefixed: 'webkitAnimationStart',
  288. standard: 'animationstart'
  289. },
  290. transitionend: {
  291. cssProperty: 'transition',
  292. prefixed: 'webkitTransitionEnd',
  293. standard: 'transitionend'
  294. }
  295. };
  296. function isWindow(windowObj) {
  297. return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
  298. }
  299. function getCorrectPropertyName(windowObj, cssProperty) {
  300. if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
  301. var el = windowObj.document.createElement('div');
  302. var _a = cssPropertyNameMap[cssProperty],
  303. standard = _a.standard,
  304. prefixed = _a.prefixed;
  305. var isStandard = standard in el.style;
  306. return isStandard ? standard : prefixed;
  307. }
  308. return cssProperty;
  309. }
  310. exports.getCorrectPropertyName = getCorrectPropertyName;
  311. function getCorrectEventName(windowObj, eventType) {
  312. if (isWindow(windowObj) && eventType in jsEventTypeMap) {
  313. var el = windowObj.document.createElement('div');
  314. var _a = jsEventTypeMap[eventType],
  315. standard = _a.standard,
  316. prefixed = _a.prefixed,
  317. cssProperty = _a.cssProperty;
  318. var isStandard = cssProperty in el.style;
  319. return isStandard ? standard : prefixed;
  320. }
  321. return eventType;
  322. }
  323. exports.getCorrectEventName = getCorrectEventName;
  324. /***/ }),
  325. /***/ "./packages/mdc-auto-init/constants.ts":
  326. /*!*********************************************!*\
  327. !*** ./packages/mdc-auto-init/constants.ts ***!
  328. \*********************************************/
  329. /*! no static exports found */
  330. /***/ (function(module, exports, __webpack_require__) {
  331. "use strict";
  332. /**
  333. * @license
  334. * Copyright 2019 Google Inc.
  335. *
  336. * Permission is hereby granted, free of charge, to any person obtaining a copy
  337. * of this software and associated documentation files (the "Software"), to deal
  338. * in the Software without restriction, including without limitation the rights
  339. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  340. * copies of the Software, and to permit persons to whom the Software is
  341. * furnished to do so, subject to the following conditions:
  342. *
  343. * The above copyright notice and this permission notice shall be included in
  344. * all copies or substantial portions of the Software.
  345. *
  346. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  347. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  348. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  349. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  350. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  351. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  352. * THE SOFTWARE.
  353. */
  354. Object.defineProperty(exports, "__esModule", { value: true });
  355. exports.strings = {
  356. AUTO_INIT_ATTR: 'data-mdc-auto-init',
  357. AUTO_INIT_STATE_ATTR: 'data-mdc-auto-init-state',
  358. INITIALIZED_STATE: 'initialized'
  359. };
  360. /***/ }),
  361. /***/ "./packages/mdc-auto-init/index.ts":
  362. /*!*****************************************!*\
  363. !*** ./packages/mdc-auto-init/index.ts ***!
  364. \*****************************************/
  365. /*! no static exports found */
  366. /***/ (function(module, exports, __webpack_require__) {
  367. "use strict";
  368. /**
  369. * @license
  370. * Copyright 2016 Google Inc.
  371. *
  372. * Permission is hereby granted, free of charge, to any person obtaining a copy
  373. * of this software and associated documentation files (the "Software"), to deal
  374. * in the Software without restriction, including without limitation the rights
  375. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  376. * copies of the Software, and to permit persons to whom the Software is
  377. * furnished to do so, subject to the following conditions:
  378. *
  379. * The above copyright notice and this permission notice shall be included in
  380. * all copies or substantial portions of the Software.
  381. *
  382. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  383. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  384. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  385. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  386. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  387. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  388. * THE SOFTWARE.
  389. */
  390. var __values = this && this.__values || function (o) {
  391. var m = typeof Symbol === "function" && o[Symbol.iterator],
  392. i = 0;
  393. if (m) return m.call(o);
  394. return {
  395. next: function next() {
  396. if (o && i >= o.length) o = void 0;
  397. return { value: o && o[i++], done: !o };
  398. }
  399. };
  400. };
  401. Object.defineProperty(exports, "__esModule", { value: true });
  402. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-auto-init/constants.ts");
  403. var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR,
  404. AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR,
  405. INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE;
  406. var registry = {};
  407. var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console
  408. function emit(evtType, evtData, shouldBubble) {
  409. if (shouldBubble === void 0) {
  410. shouldBubble = false;
  411. }
  412. var evt;
  413. if (typeof CustomEvent === 'function') {
  414. evt = new CustomEvent(evtType, {
  415. bubbles: shouldBubble,
  416. detail: evtData
  417. });
  418. } else {
  419. evt = document.createEvent('CustomEvent');
  420. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  421. }
  422. document.dispatchEvent(evt);
  423. }
  424. /* istanbul ignore next: optional argument is not a branch statement */
  425. /**
  426. * Auto-initializes all MDC components on a page.
  427. */
  428. function mdcAutoInit(root) {
  429. var e_1, _a;
  430. if (root === void 0) {
  431. root = document;
  432. }
  433. var components = [];
  434. var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]"));
  435. nodes = nodes.filter(function (node) {
  436. return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE;
  437. });
  438. try {
  439. for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
  440. var node = nodes_1_1.value;
  441. var ctorName = node.getAttribute(AUTO_INIT_ATTR);
  442. if (!ctorName) {
  443. throw new Error('(mdc-auto-init) Constructor name must be given.');
  444. }
  445. var Constructor = registry[ctorName]; // tslint:disable-line:variable-name
  446. if (typeof Constructor !== 'function') {
  447. throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName);
  448. }
  449. // TODO: Should we make an eslint rule for an attachTo() static method?
  450. // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS
  451. var component = Constructor.attachTo(node);
  452. Object.defineProperty(node, ctorName, {
  453. configurable: true,
  454. enumerable: false,
  455. value: component,
  456. writable: false
  457. });
  458. components.push(component);
  459. node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE);
  460. }
  461. } catch (e_1_1) {
  462. e_1 = { error: e_1_1 };
  463. } finally {
  464. try {
  465. if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
  466. } finally {
  467. if (e_1) throw e_1.error;
  468. }
  469. }
  470. emit('MDCAutoInit:End', {});
  471. return components;
  472. }
  473. exports.mdcAutoInit = mdcAutoInit;
  474. // Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class.
  475. // tslint:disable-next-line:variable-name
  476. mdcAutoInit.register = function (componentName, Constructor, warn) {
  477. if (warn === void 0) {
  478. warn = CONSOLE_WARN;
  479. }
  480. if (typeof Constructor !== 'function') {
  481. throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function.");
  482. }
  483. var registryValue = registry[componentName];
  484. if (registryValue) {
  485. warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue);
  486. }
  487. registry[componentName] = Constructor;
  488. };
  489. mdcAutoInit.deregister = function (componentName) {
  490. delete registry[componentName];
  491. };
  492. mdcAutoInit.deregisterAll = function () {
  493. var keys = Object.keys(registry);
  494. keys.forEach(this.deregister, this);
  495. };
  496. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  497. exports.default = mdcAutoInit;
  498. /***/ }),
  499. /***/ "./packages/mdc-base/component.ts":
  500. /*!****************************************!*\
  501. !*** ./packages/mdc-base/component.ts ***!
  502. \****************************************/
  503. /*! no static exports found */
  504. /***/ (function(module, exports, __webpack_require__) {
  505. "use strict";
  506. /**
  507. * @license
  508. * Copyright 2016 Google Inc.
  509. *
  510. * Permission is hereby granted, free of charge, to any person obtaining a copy
  511. * of this software and associated documentation files (the "Software"), to deal
  512. * in the Software without restriction, including without limitation the rights
  513. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  514. * copies of the Software, and to permit persons to whom the Software is
  515. * furnished to do so, subject to the following conditions:
  516. *
  517. * The above copyright notice and this permission notice shall be included in
  518. * all copies or substantial portions of the Software.
  519. *
  520. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  521. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  522. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  523. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  524. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  525. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  526. * THE SOFTWARE.
  527. */
  528. var __read = this && this.__read || function (o, n) {
  529. var m = typeof Symbol === "function" && o[Symbol.iterator];
  530. if (!m) return o;
  531. var i = m.call(o),
  532. r,
  533. ar = [],
  534. e;
  535. try {
  536. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  537. ar.push(r.value);
  538. }
  539. } catch (error) {
  540. e = { error: error };
  541. } finally {
  542. try {
  543. if (r && !r.done && (m = i["return"])) m.call(i);
  544. } finally {
  545. if (e) throw e.error;
  546. }
  547. }
  548. return ar;
  549. };
  550. var __spread = this && this.__spread || function () {
  551. for (var ar = [], i = 0; i < arguments.length; i++) {
  552. ar = ar.concat(__read(arguments[i]));
  553. }return ar;
  554. };
  555. Object.defineProperty(exports, "__esModule", { value: true });
  556. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
  557. var MDCComponent = /** @class */function () {
  558. function MDCComponent(root, foundation) {
  559. var args = [];
  560. for (var _i = 2; _i < arguments.length; _i++) {
  561. args[_i - 2] = arguments[_i];
  562. }
  563. this.root_ = root;
  564. this.initialize.apply(this, __spread(args));
  565. // Note that we initialize foundation here and not within the constructor's default param so that
  566. // this.root_ is defined and can be used within the foundation class.
  567. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
  568. this.foundation_.init();
  569. this.initialSyncWithDOM();
  570. }
  571. MDCComponent.attachTo = function (root) {
  572. // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
  573. // returns an instantiated component with its root set to that element. Also note that in the cases of
  574. // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
  575. // from getDefaultFoundation().
  576. return new MDCComponent(root, new foundation_1.MDCFoundation({}));
  577. };
  578. /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
  579. MDCComponent.prototype.initialize = function () {
  580. var _args = [];
  581. for (var _i = 0; _i < arguments.length; _i++) {
  582. _args[_i] = arguments[_i];
  583. }
  584. // Subclasses can override this to do any additional setup work that would be considered part of a
  585. // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
  586. // initialized. Any additional arguments besides root and foundation will be passed in here.
  587. };
  588. MDCComponent.prototype.getDefaultFoundation = function () {
  589. // Subclasses must override this method to return a properly configured foundation class for the
  590. // component.
  591. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
  592. };
  593. MDCComponent.prototype.initialSyncWithDOM = function () {
  594. // Subclasses should override this method if they need to perform work to synchronize with a host DOM
  595. // object. An example of this would be a form control wrapper that needs to synchronize its internal state
  596. // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
  597. // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
  598. };
  599. MDCComponent.prototype.destroy = function () {
  600. // Subclasses may implement this method to release any resources / deregister any listeners they have
  601. // attached. An example of this might be deregistering a resize event from the window object.
  602. this.foundation_.destroy();
  603. };
  604. MDCComponent.prototype.listen = function (evtType, handler, options) {
  605. this.root_.addEventListener(evtType, handler, options);
  606. };
  607. MDCComponent.prototype.unlisten = function (evtType, handler, options) {
  608. this.root_.removeEventListener(evtType, handler, options);
  609. };
  610. /**
  611. * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
  612. */
  613. MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
  614. if (shouldBubble === void 0) {
  615. shouldBubble = false;
  616. }
  617. var evt;
  618. if (typeof CustomEvent === 'function') {
  619. evt = new CustomEvent(evtType, {
  620. bubbles: shouldBubble,
  621. detail: evtData
  622. });
  623. } else {
  624. evt = document.createEvent('CustomEvent');
  625. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  626. }
  627. this.root_.dispatchEvent(evt);
  628. };
  629. return MDCComponent;
  630. }();
  631. exports.MDCComponent = MDCComponent;
  632. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  633. exports.default = MDCComponent;
  634. /***/ }),
  635. /***/ "./packages/mdc-base/foundation.ts":
  636. /*!*****************************************!*\
  637. !*** ./packages/mdc-base/foundation.ts ***!
  638. \*****************************************/
  639. /*! no static exports found */
  640. /***/ (function(module, exports, __webpack_require__) {
  641. "use strict";
  642. /**
  643. * @license
  644. * Copyright 2016 Google Inc.
  645. *
  646. * Permission is hereby granted, free of charge, to any person obtaining a copy
  647. * of this software and associated documentation files (the "Software"), to deal
  648. * in the Software without restriction, including without limitation the rights
  649. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  650. * copies of the Software, and to permit persons to whom the Software is
  651. * furnished to do so, subject to the following conditions:
  652. *
  653. * The above copyright notice and this permission notice shall be included in
  654. * all copies or substantial portions of the Software.
  655. *
  656. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  657. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  658. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  659. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  660. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  661. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  662. * THE SOFTWARE.
  663. */
  664. Object.defineProperty(exports, "__esModule", { value: true });
  665. var MDCFoundation = /** @class */function () {
  666. function MDCFoundation(adapter) {
  667. if (adapter === void 0) {
  668. adapter = {};
  669. }
  670. this.adapter_ = adapter;
  671. }
  672. Object.defineProperty(MDCFoundation, "cssClasses", {
  673. get: function get() {
  674. // Classes extending MDCFoundation should implement this method to return an object which exports every
  675. // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
  676. return {};
  677. },
  678. enumerable: true,
  679. configurable: true
  680. });
  681. Object.defineProperty(MDCFoundation, "strings", {
  682. get: function get() {
  683. // Classes extending MDCFoundation should implement this method to return an object which exports all
  684. // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
  685. return {};
  686. },
  687. enumerable: true,
  688. configurable: true
  689. });
  690. Object.defineProperty(MDCFoundation, "numbers", {
  691. get: function get() {
  692. // Classes extending MDCFoundation should implement this method to return an object which exports all
  693. // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
  694. return {};
  695. },
  696. enumerable: true,
  697. configurable: true
  698. });
  699. Object.defineProperty(MDCFoundation, "defaultAdapter", {
  700. get: function get() {
  701. // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
  702. // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
  703. // validation.
  704. return {};
  705. },
  706. enumerable: true,
  707. configurable: true
  708. });
  709. MDCFoundation.prototype.init = function () {
  710. // Subclasses should override this method to perform initialization routines (registering events, etc.)
  711. };
  712. MDCFoundation.prototype.destroy = function () {
  713. // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
  714. };
  715. return MDCFoundation;
  716. }();
  717. exports.MDCFoundation = MDCFoundation;
  718. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  719. exports.default = MDCFoundation;
  720. /***/ }),
  721. /***/ "./packages/mdc-base/index.ts":
  722. /*!************************************!*\
  723. !*** ./packages/mdc-base/index.ts ***!
  724. \************************************/
  725. /*! no static exports found */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. "use strict";
  728. /**
  729. * @license
  730. * Copyright 2019 Google Inc.
  731. *
  732. * Permission is hereby granted, free of charge, to any person obtaining a copy
  733. * of this software and associated documentation files (the "Software"), to deal
  734. * in the Software without restriction, including without limitation the rights
  735. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  736. * copies of the Software, and to permit persons to whom the Software is
  737. * furnished to do so, subject to the following conditions:
  738. *
  739. * The above copyright notice and this permission notice shall be included in
  740. * all copies or substantial portions of the Software.
  741. *
  742. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  743. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  744. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  745. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  746. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  747. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  748. * THE SOFTWARE.
  749. */
  750. function __export(m) {
  751. for (var p in m) {
  752. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  753. }
  754. }
  755. Object.defineProperty(exports, "__esModule", { value: true });
  756. __export(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts"));
  757. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"));
  758. /***/ }),
  759. /***/ "./packages/mdc-checkbox/component.ts":
  760. /*!********************************************!*\
  761. !*** ./packages/mdc-checkbox/component.ts ***!
  762. \********************************************/
  763. /*! no static exports found */
  764. /***/ (function(module, exports, __webpack_require__) {
  765. "use strict";
  766. /**
  767. * @license
  768. * Copyright 2016 Google Inc.
  769. *
  770. * Permission is hereby granted, free of charge, to any person obtaining a copy
  771. * of this software and associated documentation files (the "Software"), to deal
  772. * in the Software without restriction, including without limitation the rights
  773. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  774. * copies of the Software, and to permit persons to whom the Software is
  775. * furnished to do so, subject to the following conditions:
  776. *
  777. * The above copyright notice and this permission notice shall be included in
  778. * all copies or substantial portions of the Software.
  779. *
  780. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  781. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  782. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  783. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  784. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  785. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  786. * THE SOFTWARE.
  787. */
  788. var __extends = this && this.__extends || function () {
  789. var _extendStatics = function extendStatics(d, b) {
  790. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  791. d.__proto__ = b;
  792. } || function (d, b) {
  793. for (var p in b) {
  794. if (b.hasOwnProperty(p)) d[p] = b[p];
  795. }
  796. };
  797. return _extendStatics(d, b);
  798. };
  799. return function (d, b) {
  800. _extendStatics(d, b);
  801. function __() {
  802. this.constructor = d;
  803. }
  804. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  805. };
  806. }();
  807. var __assign = this && this.__assign || function () {
  808. __assign = Object.assign || function (t) {
  809. for (var s, i = 1, n = arguments.length; i < n; i++) {
  810. s = arguments[i];
  811. for (var p in s) {
  812. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  813. }
  814. }
  815. return t;
  816. };
  817. return __assign.apply(this, arguments);
  818. };
  819. Object.defineProperty(exports, "__esModule", { value: true });
  820. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  821. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  822. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  823. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  824. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  825. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  826. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts");
  827. var CB_PROTO_PROPS = ['checked', 'indeterminate'];
  828. var MDCCheckbox = /** @class */function (_super) {
  829. __extends(MDCCheckbox, _super);
  830. function MDCCheckbox() {
  831. var _this = _super !== null && _super.apply(this, arguments) || this;
  832. _this.ripple_ = _this.createRipple_();
  833. return _this;
  834. }
  835. MDCCheckbox.attachTo = function (root) {
  836. return new MDCCheckbox(root);
  837. };
  838. Object.defineProperty(MDCCheckbox.prototype, "ripple", {
  839. get: function get() {
  840. return this.ripple_;
  841. },
  842. enumerable: true,
  843. configurable: true
  844. });
  845. Object.defineProperty(MDCCheckbox.prototype, "checked", {
  846. get: function get() {
  847. return this.nativeControl_.checked;
  848. },
  849. set: function set(checked) {
  850. this.nativeControl_.checked = checked;
  851. },
  852. enumerable: true,
  853. configurable: true
  854. });
  855. Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
  856. get: function get() {
  857. return this.nativeControl_.indeterminate;
  858. },
  859. set: function set(indeterminate) {
  860. this.nativeControl_.indeterminate = indeterminate;
  861. },
  862. enumerable: true,
  863. configurable: true
  864. });
  865. Object.defineProperty(MDCCheckbox.prototype, "disabled", {
  866. get: function get() {
  867. return this.nativeControl_.disabled;
  868. },
  869. set: function set(disabled) {
  870. this.foundation_.setDisabled(disabled);
  871. },
  872. enumerable: true,
  873. configurable: true
  874. });
  875. Object.defineProperty(MDCCheckbox.prototype, "value", {
  876. get: function get() {
  877. return this.nativeControl_.value;
  878. },
  879. set: function set(value) {
  880. this.nativeControl_.value = value;
  881. },
  882. enumerable: true,
  883. configurable: true
  884. });
  885. MDCCheckbox.prototype.initialSyncWithDOM = function () {
  886. var _this = this;
  887. this.handleChange_ = function () {
  888. return _this.foundation_.handleChange();
  889. };
  890. this.handleAnimationEnd_ = function () {
  891. return _this.foundation_.handleAnimationEnd();
  892. };
  893. this.nativeControl_.addEventListener('change', this.handleChange_);
  894. this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
  895. this.installPropertyChangeHooks_();
  896. };
  897. MDCCheckbox.prototype.destroy = function () {
  898. this.ripple_.destroy();
  899. this.nativeControl_.removeEventListener('change', this.handleChange_);
  900. this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
  901. this.uninstallPropertyChangeHooks_();
  902. _super.prototype.destroy.call(this);
  903. };
  904. MDCCheckbox.prototype.getDefaultFoundation = function () {
  905. var _this = this;
  906. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  907. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  908. var adapter = {
  909. addClass: function addClass(className) {
  910. return _this.root_.classList.add(className);
  911. },
  912. forceLayout: function forceLayout() {
  913. return _this.root_.offsetWidth;
  914. },
  915. hasNativeControl: function hasNativeControl() {
  916. return !!_this.nativeControl_;
  917. },
  918. isAttachedToDOM: function isAttachedToDOM() {
  919. return Boolean(_this.root_.parentNode);
  920. },
  921. isChecked: function isChecked() {
  922. return _this.checked;
  923. },
  924. isIndeterminate: function isIndeterminate() {
  925. return _this.indeterminate;
  926. },
  927. removeClass: function removeClass(className) {
  928. return _this.root_.classList.remove(className);
  929. },
  930. removeNativeControlAttr: function removeNativeControlAttr(attr) {
  931. return _this.nativeControl_.removeAttribute(attr);
  932. },
  933. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  934. return _this.nativeControl_.setAttribute(attr, value);
  935. },
  936. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  937. return _this.nativeControl_.disabled = disabled;
  938. }
  939. };
  940. return new foundation_2.MDCCheckboxFoundation(adapter);
  941. };
  942. MDCCheckbox.prototype.createRipple_ = function () {
  943. var _this = this;
  944. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  945. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  946. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  947. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  948. }, isSurfaceActive: function isSurfaceActive() {
  949. return ponyfill_1.matches(_this.nativeControl_, ':active');
  950. }, isUnbounded: function isUnbounded() {
  951. return true;
  952. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  953. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  954. } });
  955. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  956. };
  957. MDCCheckbox.prototype.installPropertyChangeHooks_ = function () {
  958. var _this = this;
  959. var nativeCb = this.nativeControl_;
  960. var cbProto = Object.getPrototypeOf(nativeCb);
  961. CB_PROTO_PROPS.forEach(function (controlState) {
  962. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  963. // We have to check for this descriptor, since some browsers (Safari) don't support its return.
  964. // See: https://bugs.webkit.org/show_bug.cgi?id=49739
  965. if (!validDescriptor(desc)) {
  966. return;
  967. }
  968. // Type cast is needed for compatibility with Closure Compiler.
  969. var nativeGetter = desc.get;
  970. var nativeCbDesc = {
  971. configurable: desc.configurable,
  972. enumerable: desc.enumerable,
  973. get: nativeGetter,
  974. set: function set(state) {
  975. desc.set.call(nativeCb, state);
  976. _this.foundation_.handleChange();
  977. }
  978. };
  979. Object.defineProperty(nativeCb, controlState, nativeCbDesc);
  980. });
  981. };
  982. MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () {
  983. var nativeCb = this.nativeControl_;
  984. var cbProto = Object.getPrototypeOf(nativeCb);
  985. CB_PROTO_PROPS.forEach(function (controlState) {
  986. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  987. if (!validDescriptor(desc)) {
  988. return;
  989. }
  990. Object.defineProperty(nativeCb, controlState, desc);
  991. });
  992. };
  993. Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", {
  994. get: function get() {
  995. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCCheckboxFoundation.strings.NATIVE_CONTROL_SELECTOR;
  996. var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  997. if (!el) {
  998. throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  999. }
  1000. return el;
  1001. },
  1002. enumerable: true,
  1003. configurable: true
  1004. });
  1005. return MDCCheckbox;
  1006. }(component_1.MDCComponent);
  1007. exports.MDCCheckbox = MDCCheckbox;
  1008. function validDescriptor(inputPropDesc) {
  1009. return !!inputPropDesc && typeof inputPropDesc.set === 'function';
  1010. }
  1011. /***/ }),
  1012. /***/ "./packages/mdc-checkbox/constants.ts":
  1013. /*!********************************************!*\
  1014. !*** ./packages/mdc-checkbox/constants.ts ***!
  1015. \********************************************/
  1016. /*! no static exports found */
  1017. /***/ (function(module, exports, __webpack_require__) {
  1018. "use strict";
  1019. /**
  1020. * @license
  1021. * Copyright 2016 Google Inc.
  1022. *
  1023. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1024. * of this software and associated documentation files (the "Software"), to deal
  1025. * in the Software without restriction, including without limitation the rights
  1026. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1027. * copies of the Software, and to permit persons to whom the Software is
  1028. * furnished to do so, subject to the following conditions:
  1029. *
  1030. * The above copyright notice and this permission notice shall be included in
  1031. * all copies or substantial portions of the Software.
  1032. *
  1033. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1034. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1035. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1036. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1037. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1038. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1039. * THE SOFTWARE.
  1040. */
  1041. Object.defineProperty(exports, "__esModule", { value: true });
  1042. exports.cssClasses = {
  1043. ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
  1044. ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
  1045. ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
  1046. ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
  1047. ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
  1048. ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
  1049. BACKGROUND: 'mdc-checkbox__background',
  1050. CHECKED: 'mdc-checkbox--checked',
  1051. CHECKMARK: 'mdc-checkbox__checkmark',
  1052. CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
  1053. DISABLED: 'mdc-checkbox--disabled',
  1054. INDETERMINATE: 'mdc-checkbox--indeterminate',
  1055. MIXEDMARK: 'mdc-checkbox__mixedmark',
  1056. NATIVE_CONTROL: 'mdc-checkbox__native-control',
  1057. ROOT: 'mdc-checkbox',
  1058. SELECTED: 'mdc-checkbox--selected',
  1059. UPGRADED: 'mdc-checkbox--upgraded'
  1060. };
  1061. exports.strings = {
  1062. ARIA_CHECKED_ATTR: 'aria-checked',
  1063. ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
  1064. NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
  1065. TRANSITION_STATE_CHECKED: 'checked',
  1066. TRANSITION_STATE_INDETERMINATE: 'indeterminate',
  1067. TRANSITION_STATE_INIT: 'init',
  1068. TRANSITION_STATE_UNCHECKED: 'unchecked'
  1069. };
  1070. exports.numbers = {
  1071. ANIM_END_LATCH_MS: 250
  1072. };
  1073. /***/ }),
  1074. /***/ "./packages/mdc-checkbox/foundation.ts":
  1075. /*!*********************************************!*\
  1076. !*** ./packages/mdc-checkbox/foundation.ts ***!
  1077. \*********************************************/
  1078. /*! no static exports found */
  1079. /***/ (function(module, exports, __webpack_require__) {
  1080. "use strict";
  1081. /**
  1082. * @license
  1083. * Copyright 2016 Google Inc.
  1084. *
  1085. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1086. * of this software and associated documentation files (the "Software"), to deal
  1087. * in the Software without restriction, including without limitation the rights
  1088. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1089. * copies of the Software, and to permit persons to whom the Software is
  1090. * furnished to do so, subject to the following conditions:
  1091. *
  1092. * The above copyright notice and this permission notice shall be included in
  1093. * all copies or substantial portions of the Software.
  1094. *
  1095. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1096. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1097. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1098. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1099. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1100. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1101. * THE SOFTWARE.
  1102. */
  1103. var __extends = this && this.__extends || function () {
  1104. var _extendStatics = function extendStatics(d, b) {
  1105. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1106. d.__proto__ = b;
  1107. } || function (d, b) {
  1108. for (var p in b) {
  1109. if (b.hasOwnProperty(p)) d[p] = b[p];
  1110. }
  1111. };
  1112. return _extendStatics(d, b);
  1113. };
  1114. return function (d, b) {
  1115. _extendStatics(d, b);
  1116. function __() {
  1117. this.constructor = d;
  1118. }
  1119. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1120. };
  1121. }();
  1122. var __assign = this && this.__assign || function () {
  1123. __assign = Object.assign || function (t) {
  1124. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1125. s = arguments[i];
  1126. for (var p in s) {
  1127. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1128. }
  1129. }
  1130. return t;
  1131. };
  1132. return __assign.apply(this, arguments);
  1133. };
  1134. Object.defineProperty(exports, "__esModule", { value: true });
  1135. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  1136. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  1137. var MDCCheckboxFoundation = /** @class */function (_super) {
  1138. __extends(MDCCheckboxFoundation, _super);
  1139. function MDCCheckboxFoundation(adapter) {
  1140. var _this = _super.call(this, __assign({}, MDCCheckboxFoundation.defaultAdapter, adapter)) || this;
  1141. _this.currentCheckState_ = constants_1.strings.TRANSITION_STATE_INIT;
  1142. _this.currentAnimationClass_ = '';
  1143. _this.animEndLatchTimer_ = 0;
  1144. _this.enableAnimationEndHandler_ = false;
  1145. return _this;
  1146. }
  1147. Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
  1148. get: function get() {
  1149. return constants_1.cssClasses;
  1150. },
  1151. enumerable: true,
  1152. configurable: true
  1153. });
  1154. Object.defineProperty(MDCCheckboxFoundation, "strings", {
  1155. get: function get() {
  1156. return constants_1.strings;
  1157. },
  1158. enumerable: true,
  1159. configurable: true
  1160. });
  1161. Object.defineProperty(MDCCheckboxFoundation, "numbers", {
  1162. get: function get() {
  1163. return constants_1.numbers;
  1164. },
  1165. enumerable: true,
  1166. configurable: true
  1167. });
  1168. Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
  1169. get: function get() {
  1170. return {
  1171. addClass: function addClass() {
  1172. return undefined;
  1173. },
  1174. forceLayout: function forceLayout() {
  1175. return undefined;
  1176. },
  1177. hasNativeControl: function hasNativeControl() {
  1178. return false;
  1179. },
  1180. isAttachedToDOM: function isAttachedToDOM() {
  1181. return false;
  1182. },
  1183. isChecked: function isChecked() {
  1184. return false;
  1185. },
  1186. isIndeterminate: function isIndeterminate() {
  1187. return false;
  1188. },
  1189. removeClass: function removeClass() {
  1190. return undefined;
  1191. },
  1192. removeNativeControlAttr: function removeNativeControlAttr() {
  1193. return undefined;
  1194. },
  1195. setNativeControlAttr: function setNativeControlAttr() {
  1196. return undefined;
  1197. },
  1198. setNativeControlDisabled: function setNativeControlDisabled() {
  1199. return undefined;
  1200. }
  1201. };
  1202. },
  1203. enumerable: true,
  1204. configurable: true
  1205. });
  1206. MDCCheckboxFoundation.prototype.init = function () {
  1207. this.currentCheckState_ = this.determineCheckState_();
  1208. this.updateAriaChecked_();
  1209. this.adapter_.addClass(constants_1.cssClasses.UPGRADED);
  1210. };
  1211. MDCCheckboxFoundation.prototype.destroy = function () {
  1212. clearTimeout(this.animEndLatchTimer_);
  1213. };
  1214. MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
  1215. this.adapter_.setNativeControlDisabled(disabled);
  1216. if (disabled) {
  1217. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  1218. } else {
  1219. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  1220. }
  1221. };
  1222. /**
  1223. * Handles the animationend event for the checkbox
  1224. */
  1225. MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
  1226. var _this = this;
  1227. if (!this.enableAnimationEndHandler_) {
  1228. return;
  1229. }
  1230. clearTimeout(this.animEndLatchTimer_);
  1231. this.animEndLatchTimer_ = setTimeout(function () {
  1232. _this.adapter_.removeClass(_this.currentAnimationClass_);
  1233. _this.enableAnimationEndHandler_ = false;
  1234. }, constants_1.numbers.ANIM_END_LATCH_MS);
  1235. };
  1236. /**
  1237. * Handles the change event for the checkbox
  1238. */
  1239. MDCCheckboxFoundation.prototype.handleChange = function () {
  1240. this.transitionCheckState_();
  1241. };
  1242. MDCCheckboxFoundation.prototype.transitionCheckState_ = function () {
  1243. if (!this.adapter_.hasNativeControl()) {
  1244. return;
  1245. }
  1246. var oldState = this.currentCheckState_;
  1247. var newState = this.determineCheckState_();
  1248. if (oldState === newState) {
  1249. return;
  1250. }
  1251. this.updateAriaChecked_();
  1252. var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1253. var SELECTED = constants_1.cssClasses.SELECTED;
  1254. if (newState === TRANSITION_STATE_UNCHECKED) {
  1255. this.adapter_.removeClass(SELECTED);
  1256. } else {
  1257. this.adapter_.addClass(SELECTED);
  1258. }
  1259. // Check to ensure that there isn't a previously existing animation class, in case for example
  1260. // the user interacted with the checkbox before the animation was finished.
  1261. if (this.currentAnimationClass_.length > 0) {
  1262. clearTimeout(this.animEndLatchTimer_);
  1263. this.adapter_.forceLayout();
  1264. this.adapter_.removeClass(this.currentAnimationClass_);
  1265. }
  1266. this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState);
  1267. this.currentCheckState_ = newState;
  1268. // Check for parentNode so that animations are only run when the element is attached
  1269. // to the DOM.
  1270. if (this.adapter_.isAttachedToDOM() && this.currentAnimationClass_.length > 0) {
  1271. this.adapter_.addClass(this.currentAnimationClass_);
  1272. this.enableAnimationEndHandler_ = true;
  1273. }
  1274. };
  1275. MDCCheckboxFoundation.prototype.determineCheckState_ = function () {
  1276. var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
  1277. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  1278. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1279. if (this.adapter_.isIndeterminate()) {
  1280. return TRANSITION_STATE_INDETERMINATE;
  1281. }
  1282. return this.adapter_.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
  1283. };
  1284. MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) {
  1285. var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
  1286. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  1287. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  1288. var _a = MDCCheckboxFoundation.cssClasses,
  1289. ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
  1290. ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
  1291. ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
  1292. ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
  1293. ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
  1294. ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
  1295. switch (oldState) {
  1296. case TRANSITION_STATE_INIT:
  1297. if (newState === TRANSITION_STATE_UNCHECKED) {
  1298. return '';
  1299. }
  1300. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  1301. case TRANSITION_STATE_UNCHECKED:
  1302. return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
  1303. case TRANSITION_STATE_CHECKED:
  1304. return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
  1305. default:
  1306. // TRANSITION_STATE_INDETERMINATE
  1307. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  1308. }
  1309. };
  1310. MDCCheckboxFoundation.prototype.updateAriaChecked_ = function () {
  1311. // Ensure aria-checked is set to mixed if checkbox is in indeterminate state.
  1312. if (this.adapter_.isIndeterminate()) {
  1313. this.adapter_.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
  1314. } else {
  1315. // The on/off state does not need to keep track of aria-checked, since
  1316. // the screenreader uses the checked property on the checkbox element.
  1317. this.adapter_.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
  1318. }
  1319. };
  1320. return MDCCheckboxFoundation;
  1321. }(foundation_1.MDCFoundation);
  1322. exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
  1323. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  1324. exports.default = MDCCheckboxFoundation;
  1325. /***/ }),
  1326. /***/ "./packages/mdc-checkbox/index.ts":
  1327. /*!****************************************!*\
  1328. !*** ./packages/mdc-checkbox/index.ts ***!
  1329. \****************************************/
  1330. /*! no static exports found */
  1331. /***/ (function(module, exports, __webpack_require__) {
  1332. "use strict";
  1333. /**
  1334. * @license
  1335. * Copyright 2019 Google Inc.
  1336. *
  1337. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1338. * of this software and associated documentation files (the "Software"), to deal
  1339. * in the Software without restriction, including without limitation the rights
  1340. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1341. * copies of the Software, and to permit persons to whom the Software is
  1342. * furnished to do so, subject to the following conditions:
  1343. *
  1344. * The above copyright notice and this permission notice shall be included in
  1345. * all copies or substantial portions of the Software.
  1346. *
  1347. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1348. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1349. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1350. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1351. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1352. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1353. * THE SOFTWARE.
  1354. */
  1355. function __export(m) {
  1356. for (var p in m) {
  1357. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  1358. }
  1359. }
  1360. Object.defineProperty(exports, "__esModule", { value: true });
  1361. __export(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts"));
  1362. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"));
  1363. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"));
  1364. /***/ }),
  1365. /***/ "./packages/mdc-chips/chip-set/component.ts":
  1366. /*!**************************************************!*\
  1367. !*** ./packages/mdc-chips/chip-set/component.ts ***!
  1368. \**************************************************/
  1369. /*! no static exports found */
  1370. /***/ (function(module, exports, __webpack_require__) {
  1371. "use strict";
  1372. /**
  1373. * @license
  1374. * Copyright 2016 Google Inc.
  1375. *
  1376. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1377. * of this software and associated documentation files (the "Software"), to deal
  1378. * in the Software without restriction, including without limitation the rights
  1379. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1380. * copies of the Software, and to permit persons to whom the Software is
  1381. * furnished to do so, subject to the following conditions:
  1382. *
  1383. * The above copyright notice and this permission notice shall be included in
  1384. * all copies or substantial portions of the Software.
  1385. *
  1386. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1387. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1388. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1389. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1390. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1391. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1392. * THE SOFTWARE.
  1393. */
  1394. var __extends = this && this.__extends || function () {
  1395. var _extendStatics = function extendStatics(d, b) {
  1396. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1397. d.__proto__ = b;
  1398. } || function (d, b) {
  1399. for (var p in b) {
  1400. if (b.hasOwnProperty(p)) d[p] = b[p];
  1401. }
  1402. };
  1403. return _extendStatics(d, b);
  1404. };
  1405. return function (d, b) {
  1406. _extendStatics(d, b);
  1407. function __() {
  1408. this.constructor = d;
  1409. }
  1410. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1411. };
  1412. }();
  1413. Object.defineProperty(exports, "__esModule", { value: true });
  1414. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  1415. var announce_1 = __webpack_require__(/*! @material/dom/announce */ "./packages/mdc-dom/announce.ts");
  1416. var component_2 = __webpack_require__(/*! ../chip/component */ "./packages/mdc-chips/chip/component.ts");
  1417. var foundation_1 = __webpack_require__(/*! ../chip/foundation */ "./packages/mdc-chips/chip/foundation.ts");
  1418. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts");
  1419. var _a = foundation_1.MDCChipFoundation.strings,
  1420. INTERACTION_EVENT = _a.INTERACTION_EVENT,
  1421. SELECTION_EVENT = _a.SELECTION_EVENT,
  1422. REMOVAL_EVENT = _a.REMOVAL_EVENT,
  1423. NAVIGATION_EVENT = _a.NAVIGATION_EVENT;
  1424. var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR;
  1425. var idCounter = 0;
  1426. var MDCChipSet = /** @class */function (_super) {
  1427. __extends(MDCChipSet, _super);
  1428. function MDCChipSet() {
  1429. return _super !== null && _super.apply(this, arguments) || this;
  1430. }
  1431. MDCChipSet.attachTo = function (root) {
  1432. return new MDCChipSet(root);
  1433. };
  1434. Object.defineProperty(MDCChipSet.prototype, "chips", {
  1435. get: function get() {
  1436. return this.chips_.slice();
  1437. },
  1438. enumerable: true,
  1439. configurable: true
  1440. });
  1441. Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", {
  1442. /**
  1443. * @return An array of the IDs of all selected chips.
  1444. */
  1445. get: function get() {
  1446. return this.foundation_.getSelectedChipIds();
  1447. },
  1448. enumerable: true,
  1449. configurable: true
  1450. });
  1451. /**
  1452. * @param chipFactory A function which creates a new MDCChip.
  1453. */
  1454. MDCChipSet.prototype.initialize = function (chipFactory) {
  1455. if (chipFactory === void 0) {
  1456. chipFactory = function chipFactory(el) {
  1457. return new component_2.MDCChip(el);
  1458. };
  1459. }
  1460. this.chipFactory_ = chipFactory;
  1461. this.chips_ = this.instantiateChips_(this.chipFactory_);
  1462. };
  1463. MDCChipSet.prototype.initialSyncWithDOM = function () {
  1464. var _this = this;
  1465. this.chips_.forEach(function (chip) {
  1466. if (chip.id && chip.selected) {
  1467. _this.foundation_.select(chip.id);
  1468. }
  1469. });
  1470. this.handleChipInteraction_ = function (evt) {
  1471. return _this.foundation_.handleChipInteraction(evt.detail);
  1472. };
  1473. this.handleChipSelection_ = function (evt) {
  1474. return _this.foundation_.handleChipSelection(evt.detail);
  1475. };
  1476. this.handleChipRemoval_ = function (evt) {
  1477. return _this.foundation_.handleChipRemoval(evt.detail);
  1478. };
  1479. this.handleChipNavigation_ = function (evt) {
  1480. return _this.foundation_.handleChipNavigation(evt.detail);
  1481. };
  1482. this.listen(INTERACTION_EVENT, this.handleChipInteraction_);
  1483. this.listen(SELECTION_EVENT, this.handleChipSelection_);
  1484. this.listen(REMOVAL_EVENT, this.handleChipRemoval_);
  1485. this.listen(NAVIGATION_EVENT, this.handleChipNavigation_);
  1486. };
  1487. MDCChipSet.prototype.destroy = function () {
  1488. this.chips_.forEach(function (chip) {
  1489. chip.destroy();
  1490. });
  1491. this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_);
  1492. this.unlisten(SELECTION_EVENT, this.handleChipSelection_);
  1493. this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_);
  1494. this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation_);
  1495. _super.prototype.destroy.call(this);
  1496. };
  1497. /**
  1498. * Adds a new chip object to the chip set from the given chip element.
  1499. */
  1500. MDCChipSet.prototype.addChip = function (chipEl) {
  1501. chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter;
  1502. this.chips_.push(this.chipFactory_(chipEl));
  1503. };
  1504. MDCChipSet.prototype.getDefaultFoundation = function () {
  1505. var _this = this;
  1506. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  1507. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  1508. var adapter = {
  1509. announceMessage: function announceMessage(message) {
  1510. announce_1.announce(message);
  1511. },
  1512. focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex(index) {
  1513. _this.chips_[index].focusPrimaryAction();
  1514. },
  1515. focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex(index) {
  1516. _this.chips_[index].focusTrailingAction();
  1517. },
  1518. getChipListCount: function getChipListCount() {
  1519. return _this.chips_.length;
  1520. },
  1521. getIndexOfChipById: function getIndexOfChipById(chipId) {
  1522. return _this.findChipIndex_(chipId);
  1523. },
  1524. hasClass: function hasClass(className) {
  1525. return _this.root_.classList.contains(className);
  1526. },
  1527. isRTL: function isRTL() {
  1528. return window.getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  1529. },
  1530. removeChipAtIndex: function removeChipAtIndex(index) {
  1531. if (index >= 0 && index < _this.chips_.length) {
  1532. _this.chips_[index].destroy();
  1533. _this.chips_[index].remove();
  1534. _this.chips_.splice(index, 1);
  1535. }
  1536. },
  1537. removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex(index) {
  1538. _this.chips_[index].removeFocus();
  1539. },
  1540. selectChipAtIndex: function selectChipAtIndex(index, selected, shouldNotifyClients) {
  1541. if (index >= 0 && index < _this.chips_.length) {
  1542. _this.chips_[index].setSelectedFromChipSet(selected, shouldNotifyClients);
  1543. }
  1544. }
  1545. };
  1546. return new foundation_2.MDCChipSetFoundation(adapter);
  1547. };
  1548. /**
  1549. * Instantiates chip components on all of the chip set's child chip elements.
  1550. */
  1551. MDCChipSet.prototype.instantiateChips_ = function (chipFactory) {
  1552. var chipElements = [].slice.call(this.root_.querySelectorAll(CHIP_SELECTOR));
  1553. return chipElements.map(function (el) {
  1554. el.id = el.id || "mdc-chip-" + ++idCounter;
  1555. return chipFactory(el);
  1556. });
  1557. };
  1558. /**
  1559. * Returns the index of the chip with the given id, or -1 if the chip does not exist.
  1560. */
  1561. MDCChipSet.prototype.findChipIndex_ = function (chipId) {
  1562. for (var i = 0; i < this.chips_.length; i++) {
  1563. if (this.chips_[i].id === chipId) {
  1564. return i;
  1565. }
  1566. }
  1567. return -1;
  1568. };
  1569. return MDCChipSet;
  1570. }(component_1.MDCComponent);
  1571. exports.MDCChipSet = MDCChipSet;
  1572. /***/ }),
  1573. /***/ "./packages/mdc-chips/chip-set/constants.ts":
  1574. /*!**************************************************!*\
  1575. !*** ./packages/mdc-chips/chip-set/constants.ts ***!
  1576. \**************************************************/
  1577. /*! no static exports found */
  1578. /***/ (function(module, exports, __webpack_require__) {
  1579. "use strict";
  1580. /**
  1581. * @license
  1582. * Copyright 2016 Google Inc.
  1583. *
  1584. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1585. * of this software and associated documentation files (the "Software"), to deal
  1586. * in the Software without restriction, including without limitation the rights
  1587. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1588. * copies of the Software, and to permit persons to whom the Software is
  1589. * furnished to do so, subject to the following conditions:
  1590. *
  1591. * The above copyright notice and this permission notice shall be included in
  1592. * all copies or substantial portions of the Software.
  1593. *
  1594. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1595. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1596. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1597. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1598. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1599. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1600. * THE SOFTWARE.
  1601. */
  1602. Object.defineProperty(exports, "__esModule", { value: true });
  1603. exports.strings = {
  1604. CHIP_SELECTOR: '.mdc-chip'
  1605. };
  1606. exports.cssClasses = {
  1607. CHOICE: 'mdc-chip-set--choice',
  1608. FILTER: 'mdc-chip-set--filter'
  1609. };
  1610. /***/ }),
  1611. /***/ "./packages/mdc-chips/chip-set/foundation.ts":
  1612. /*!***************************************************!*\
  1613. !*** ./packages/mdc-chips/chip-set/foundation.ts ***!
  1614. \***************************************************/
  1615. /*! no static exports found */
  1616. /***/ (function(module, exports, __webpack_require__) {
  1617. "use strict";
  1618. /**
  1619. * @license
  1620. * Copyright 2017 Google Inc.
  1621. *
  1622. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1623. * of this software and associated documentation files (the "Software"), to deal
  1624. * in the Software without restriction, including without limitation the rights
  1625. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1626. * copies of the Software, and to permit persons to whom the Software is
  1627. * furnished to do so, subject to the following conditions:
  1628. *
  1629. * The above copyright notice and this permission notice shall be included in
  1630. * all copies or substantial portions of the Software.
  1631. *
  1632. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1633. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1634. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1635. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1636. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1637. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1638. * THE SOFTWARE.
  1639. */
  1640. var __extends = this && this.__extends || function () {
  1641. var _extendStatics = function extendStatics(d, b) {
  1642. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1643. d.__proto__ = b;
  1644. } || function (d, b) {
  1645. for (var p in b) {
  1646. if (b.hasOwnProperty(p)) d[p] = b[p];
  1647. }
  1648. };
  1649. return _extendStatics(d, b);
  1650. };
  1651. return function (d, b) {
  1652. _extendStatics(d, b);
  1653. function __() {
  1654. this.constructor = d;
  1655. }
  1656. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1657. };
  1658. }();
  1659. var __assign = this && this.__assign || function () {
  1660. __assign = Object.assign || function (t) {
  1661. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1662. s = arguments[i];
  1663. for (var p in s) {
  1664. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1665. }
  1666. }
  1667. return t;
  1668. };
  1669. return __assign.apply(this, arguments);
  1670. };
  1671. Object.defineProperty(exports, "__esModule", { value: true });
  1672. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  1673. var constants_1 = __webpack_require__(/*! ../chip/constants */ "./packages/mdc-chips/chip/constants.ts");
  1674. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
  1675. var MDCChipSetFoundation = /** @class */function (_super) {
  1676. __extends(MDCChipSetFoundation, _super);
  1677. function MDCChipSetFoundation(adapter) {
  1678. var _this = _super.call(this, __assign({}, MDCChipSetFoundation.defaultAdapter, adapter)) || this;
  1679. /**
  1680. * The ids of the selected chips in the set. Only used for choice chip set or filter chip set.
  1681. */
  1682. _this.selectedChipIds_ = [];
  1683. return _this;
  1684. }
  1685. Object.defineProperty(MDCChipSetFoundation, "strings", {
  1686. get: function get() {
  1687. return constants_2.strings;
  1688. },
  1689. enumerable: true,
  1690. configurable: true
  1691. });
  1692. Object.defineProperty(MDCChipSetFoundation, "cssClasses", {
  1693. get: function get() {
  1694. return constants_2.cssClasses;
  1695. },
  1696. enumerable: true,
  1697. configurable: true
  1698. });
  1699. Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", {
  1700. get: function get() {
  1701. return {
  1702. announceMessage: function announceMessage() {
  1703. return undefined;
  1704. },
  1705. focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex() {
  1706. return undefined;
  1707. },
  1708. focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex() {
  1709. return undefined;
  1710. },
  1711. getChipListCount: function getChipListCount() {
  1712. return -1;
  1713. },
  1714. getIndexOfChipById: function getIndexOfChipById() {
  1715. return -1;
  1716. },
  1717. hasClass: function hasClass() {
  1718. return false;
  1719. },
  1720. isRTL: function isRTL() {
  1721. return false;
  1722. },
  1723. removeChipAtIndex: function removeChipAtIndex() {
  1724. return undefined;
  1725. },
  1726. removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex() {
  1727. return undefined;
  1728. },
  1729. selectChipAtIndex: function selectChipAtIndex() {
  1730. return undefined;
  1731. }
  1732. };
  1733. },
  1734. enumerable: true,
  1735. configurable: true
  1736. });
  1737. /**
  1738. * Returns an array of the IDs of all selected chips.
  1739. */
  1740. MDCChipSetFoundation.prototype.getSelectedChipIds = function () {
  1741. return this.selectedChipIds_.slice();
  1742. };
  1743. /**
  1744. * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant.
  1745. * Does not notify clients of the updated selection state.
  1746. */
  1747. MDCChipSetFoundation.prototype.select = function (chipId) {
  1748. this.select_(chipId, false);
  1749. };
  1750. /**
  1751. * Handles a chip interaction event
  1752. */
  1753. MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) {
  1754. var chipId = _a.chipId;
  1755. var index = this.adapter_.getIndexOfChipById(chipId);
  1756. this.removeFocusFromChipsExcept_(index);
  1757. if (this.adapter_.hasClass(constants_2.cssClasses.CHOICE) || this.adapter_.hasClass(constants_2.cssClasses.FILTER)) {
  1758. this.toggleSelect_(chipId);
  1759. }
  1760. };
  1761. /**
  1762. * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip.
  1763. */
  1764. MDCChipSetFoundation.prototype.handleChipSelection = function (_a) {
  1765. var chipId = _a.chipId,
  1766. selected = _a.selected,
  1767. shouldIgnore = _a.shouldIgnore;
  1768. // Early exit if we should ignore the event
  1769. if (shouldIgnore) {
  1770. return;
  1771. }
  1772. var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0;
  1773. if (selected && !chipIsSelected) {
  1774. this.select(chipId);
  1775. } else if (!selected && chipIsSelected) {
  1776. this.deselect_(chipId);
  1777. }
  1778. };
  1779. /**
  1780. * Handles the event when a chip is removed.
  1781. */
  1782. MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) {
  1783. var chipId = _a.chipId,
  1784. removedAnnouncement = _a.removedAnnouncement;
  1785. if (removedAnnouncement) {
  1786. this.adapter_.announceMessage(removedAnnouncement);
  1787. }
  1788. var index = this.adapter_.getIndexOfChipById(chipId);
  1789. this.deselectAndNotifyClients_(chipId);
  1790. this.adapter_.removeChipAtIndex(index);
  1791. var maxIndex = this.adapter_.getChipListCount() - 1;
  1792. var nextIndex = Math.min(index, maxIndex);
  1793. this.removeFocusFromChipsExcept_(nextIndex);
  1794. // After removing a chip, we should focus the trailing action for the next chip.
  1795. this.adapter_.focusChipTrailingActionAtIndex(nextIndex);
  1796. };
  1797. /**
  1798. * Handles a chip navigation event.
  1799. */
  1800. MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) {
  1801. var chipId = _a.chipId,
  1802. key = _a.key,
  1803. source = _a.source;
  1804. var maxIndex = this.adapter_.getChipListCount() - 1;
  1805. var index = this.adapter_.getIndexOfChipById(chipId);
  1806. // Early exit if the index is out of range or the key is unusable
  1807. if (index === -1 || !constants_1.navigationKeys.has(key)) {
  1808. return;
  1809. }
  1810. var isRTL = this.adapter_.isRTL();
  1811. var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL || key === constants_1.strings.ARROW_DOWN_KEY;
  1812. var isHome = key === constants_1.strings.HOME_KEY;
  1813. var isEnd = key === constants_1.strings.END_KEY;
  1814. if (shouldIncrement) {
  1815. index++;
  1816. } else if (isHome) {
  1817. index = 0;
  1818. } else if (isEnd) {
  1819. index = maxIndex;
  1820. } else {
  1821. index--;
  1822. }
  1823. // Early exit if the index is out of bounds
  1824. if (index < 0 || index > maxIndex) {
  1825. return;
  1826. }
  1827. this.removeFocusFromChipsExcept_(index);
  1828. this.focusChipAction_(index, key, source);
  1829. };
  1830. MDCChipSetFoundation.prototype.focusChipAction_ = function (index, key, source) {
  1831. var shouldJumpChips = constants_1.jumpChipKeys.has(key);
  1832. if (shouldJumpChips && source === constants_1.EventSource.PRIMARY) {
  1833. return this.adapter_.focusChipPrimaryActionAtIndex(index);
  1834. }
  1835. if (shouldJumpChips && source === constants_1.EventSource.TRAILING) {
  1836. return this.adapter_.focusChipTrailingActionAtIndex(index);
  1837. }
  1838. var dir = this.getDirection_(key);
  1839. if (dir === constants_1.Direction.LEFT) {
  1840. return this.adapter_.focusChipTrailingActionAtIndex(index);
  1841. }
  1842. if (dir === constants_1.Direction.RIGHT) {
  1843. return this.adapter_.focusChipPrimaryActionAtIndex(index);
  1844. }
  1845. };
  1846. MDCChipSetFoundation.prototype.getDirection_ = function (key) {
  1847. var isRTL = this.adapter_.isRTL();
  1848. if (key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL) {
  1849. return constants_1.Direction.LEFT;
  1850. }
  1851. return constants_1.Direction.RIGHT;
  1852. };
  1853. /**
  1854. * Deselects the chip with the given id and optionally notifies clients.
  1855. */
  1856. MDCChipSetFoundation.prototype.deselect_ = function (chipId, shouldNotifyClients) {
  1857. if (shouldNotifyClients === void 0) {
  1858. shouldNotifyClients = false;
  1859. }
  1860. var index = this.selectedChipIds_.indexOf(chipId);
  1861. if (index >= 0) {
  1862. this.selectedChipIds_.splice(index, 1);
  1863. var chipIndex = this.adapter_.getIndexOfChipById(chipId);
  1864. this.adapter_.selectChipAtIndex(chipIndex, /** isSelected */false, shouldNotifyClients);
  1865. }
  1866. };
  1867. /**
  1868. * Deselects the chip with the given id and notifies clients.
  1869. */
  1870. MDCChipSetFoundation.prototype.deselectAndNotifyClients_ = function (chipId) {
  1871. this.deselect_(chipId, true);
  1872. };
  1873. /**
  1874. * Toggles selection of the chip with the given id.
  1875. */
  1876. MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) {
  1877. if (this.selectedChipIds_.indexOf(chipId) >= 0) {
  1878. this.deselectAndNotifyClients_(chipId);
  1879. } else {
  1880. this.selectAndNotifyClients_(chipId);
  1881. }
  1882. };
  1883. MDCChipSetFoundation.prototype.removeFocusFromChipsExcept_ = function (index) {
  1884. var chipCount = this.adapter_.getChipListCount();
  1885. for (var i = 0; i < chipCount; i++) {
  1886. if (i !== index) {
  1887. this.adapter_.removeFocusFromChipAtIndex(i);
  1888. }
  1889. }
  1890. };
  1891. MDCChipSetFoundation.prototype.selectAndNotifyClients_ = function (chipId) {
  1892. this.select_(chipId, true);
  1893. };
  1894. MDCChipSetFoundation.prototype.select_ = function (chipId, shouldNotifyClients) {
  1895. if (this.selectedChipIds_.indexOf(chipId) >= 0) {
  1896. return;
  1897. }
  1898. if (this.adapter_.hasClass(constants_2.cssClasses.CHOICE) && this.selectedChipIds_.length > 0) {
  1899. var previouslySelectedChip = this.selectedChipIds_[0];
  1900. var previouslySelectedIndex = this.adapter_.getIndexOfChipById(previouslySelectedChip);
  1901. this.selectedChipIds_ = [];
  1902. this.adapter_.selectChipAtIndex(previouslySelectedIndex, /** isSelected */false, shouldNotifyClients);
  1903. }
  1904. this.selectedChipIds_.push(chipId);
  1905. var index = this.adapter_.getIndexOfChipById(chipId);
  1906. this.adapter_.selectChipAtIndex(index, /** isSelected */true, shouldNotifyClients);
  1907. };
  1908. return MDCChipSetFoundation;
  1909. }(foundation_1.MDCFoundation);
  1910. exports.MDCChipSetFoundation = MDCChipSetFoundation;
  1911. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  1912. exports.default = MDCChipSetFoundation;
  1913. /***/ }),
  1914. /***/ "./packages/mdc-chips/chip-set/index.ts":
  1915. /*!**********************************************!*\
  1916. !*** ./packages/mdc-chips/chip-set/index.ts ***!
  1917. \**********************************************/
  1918. /*! no static exports found */
  1919. /***/ (function(module, exports, __webpack_require__) {
  1920. "use strict";
  1921. /**
  1922. * @license
  1923. * Copyright 2019 Google Inc.
  1924. *
  1925. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1926. * of this software and associated documentation files (the "Software"), to deal
  1927. * in the Software without restriction, including without limitation the rights
  1928. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1929. * copies of the Software, and to permit persons to whom the Software is
  1930. * furnished to do so, subject to the following conditions:
  1931. *
  1932. * The above copyright notice and this permission notice shall be included in
  1933. * all copies or substantial portions of the Software.
  1934. *
  1935. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1936. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1937. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1938. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1939. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1940. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1941. * THE SOFTWARE.
  1942. */
  1943. function __export(m) {
  1944. for (var p in m) {
  1945. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  1946. }
  1947. }
  1948. Object.defineProperty(exports, "__esModule", { value: true });
  1949. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip-set/component.ts"));
  1950. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts"));
  1951. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts");
  1952. exports.chipSetCssClasses = constants_1.cssClasses;
  1953. exports.chipSetStrings = constants_1.strings;
  1954. /***/ }),
  1955. /***/ "./packages/mdc-chips/chip/component.ts":
  1956. /*!**********************************************!*\
  1957. !*** ./packages/mdc-chips/chip/component.ts ***!
  1958. \**********************************************/
  1959. /*! no static exports found */
  1960. /***/ (function(module, exports, __webpack_require__) {
  1961. "use strict";
  1962. /**
  1963. * @license
  1964. * Copyright 2016 Google Inc.
  1965. *
  1966. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1967. * of this software and associated documentation files (the "Software"), to deal
  1968. * in the Software without restriction, including without limitation the rights
  1969. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1970. * copies of the Software, and to permit persons to whom the Software is
  1971. * furnished to do so, subject to the following conditions:
  1972. *
  1973. * The above copyright notice and this permission notice shall be included in
  1974. * all copies or substantial portions of the Software.
  1975. *
  1976. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1977. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1978. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1979. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1980. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1981. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1982. * THE SOFTWARE.
  1983. */
  1984. var __extends = this && this.__extends || function () {
  1985. var _extendStatics = function extendStatics(d, b) {
  1986. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  1987. d.__proto__ = b;
  1988. } || function (d, b) {
  1989. for (var p in b) {
  1990. if (b.hasOwnProperty(p)) d[p] = b[p];
  1991. }
  1992. };
  1993. return _extendStatics(d, b);
  1994. };
  1995. return function (d, b) {
  1996. _extendStatics(d, b);
  1997. function __() {
  1998. this.constructor = d;
  1999. }
  2000. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2001. };
  2002. }();
  2003. var __assign = this && this.__assign || function () {
  2004. __assign = Object.assign || function (t) {
  2005. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2006. s = arguments[i];
  2007. for (var p in s) {
  2008. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  2009. }
  2010. }
  2011. return t;
  2012. };
  2013. return __assign.apply(this, arguments);
  2014. };
  2015. Object.defineProperty(exports, "__esModule", { value: true });
  2016. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  2017. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  2018. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  2019. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2020. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts");
  2021. var INTERACTION_EVENTS = ['click', 'keydown'];
  2022. var MDCChip = /** @class */function (_super) {
  2023. __extends(MDCChip, _super);
  2024. function MDCChip() {
  2025. return _super !== null && _super.apply(this, arguments) || this;
  2026. }
  2027. Object.defineProperty(MDCChip.prototype, "selected", {
  2028. /**
  2029. * @return Whether the chip is selected.
  2030. */
  2031. get: function get() {
  2032. return this.foundation_.isSelected();
  2033. },
  2034. /**
  2035. * Sets selected state on the chip.
  2036. */
  2037. set: function set(selected) {
  2038. this.foundation_.setSelected(selected);
  2039. },
  2040. enumerable: true,
  2041. configurable: true
  2042. });
  2043. Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", {
  2044. /**
  2045. * @return Whether a trailing icon click should trigger exit/removal of the chip.
  2046. */
  2047. get: function get() {
  2048. return this.foundation_.getShouldRemoveOnTrailingIconClick();
  2049. },
  2050. /**
  2051. * Sets whether a trailing icon click should trigger exit/removal of the chip.
  2052. */
  2053. set: function set(shouldRemove) {
  2054. this.foundation_.setShouldRemoveOnTrailingIconClick(shouldRemove);
  2055. },
  2056. enumerable: true,
  2057. configurable: true
  2058. });
  2059. Object.defineProperty(MDCChip.prototype, "ripple", {
  2060. get: function get() {
  2061. return this.ripple_;
  2062. },
  2063. enumerable: true,
  2064. configurable: true
  2065. });
  2066. Object.defineProperty(MDCChip.prototype, "id", {
  2067. get: function get() {
  2068. return this.root_.id;
  2069. },
  2070. enumerable: true,
  2071. configurable: true
  2072. });
  2073. MDCChip.attachTo = function (root) {
  2074. return new MDCChip(root);
  2075. };
  2076. MDCChip.prototype.initialize = function (rippleFactory) {
  2077. var _this = this;
  2078. if (rippleFactory === void 0) {
  2079. rippleFactory = function rippleFactory(el, foundation) {
  2080. return new component_2.MDCRipple(el, foundation);
  2081. };
  2082. }
  2083. this.leadingIcon_ = this.root_.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  2084. this.trailingIcon_ = this.root_.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
  2085. this.checkmark_ = this.root_.querySelector(constants_1.strings.CHECKMARK_SELECTOR);
  2086. this.primaryAction_ = this.root_.querySelector(constants_1.strings.PRIMARY_ACTION_SELECTOR);
  2087. this.trailingAction_ = this.root_.querySelector(constants_1.strings.TRAILING_ACTION_SELECTOR);
  2088. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  2089. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  2090. var rippleAdapter = __assign({}, component_2.MDCRipple.createAdapter(this), { computeBoundingRect: function computeBoundingRect() {
  2091. return _this.foundation_.getDimensions();
  2092. } });
  2093. this.ripple_ = rippleFactory(this.root_, new foundation_1.MDCRippleFoundation(rippleAdapter));
  2094. };
  2095. MDCChip.prototype.initialSyncWithDOM = function () {
  2096. var _this = this;
  2097. this.handleInteraction_ = function (evt) {
  2098. return _this.foundation_.handleInteraction(evt);
  2099. };
  2100. this.handleTransitionEnd_ = function (evt) {
  2101. return _this.foundation_.handleTransitionEnd(evt);
  2102. };
  2103. this.handleTrailingIconInteraction_ = function (evt) {
  2104. return _this.foundation_.handleTrailingIconInteraction(evt);
  2105. };
  2106. this.handleKeydown_ = function (evt) {
  2107. return _this.foundation_.handleKeydown(evt);
  2108. };
  2109. INTERACTION_EVENTS.forEach(function (evtType) {
  2110. _this.listen(evtType, _this.handleInteraction_);
  2111. });
  2112. this.listen('transitionend', this.handleTransitionEnd_);
  2113. this.listen('keydown', this.handleKeydown_);
  2114. if (this.trailingIcon_) {
  2115. INTERACTION_EVENTS.forEach(function (evtType) {
  2116. _this.trailingIcon_.addEventListener(evtType, _this.handleTrailingIconInteraction_);
  2117. });
  2118. }
  2119. };
  2120. MDCChip.prototype.destroy = function () {
  2121. var _this = this;
  2122. this.ripple_.destroy();
  2123. INTERACTION_EVENTS.forEach(function (evtType) {
  2124. _this.unlisten(evtType, _this.handleInteraction_);
  2125. });
  2126. this.unlisten('transitionend', this.handleTransitionEnd_);
  2127. this.unlisten('keydown', this.handleKeydown_);
  2128. if (this.trailingIcon_) {
  2129. INTERACTION_EVENTS.forEach(function (evtType) {
  2130. _this.trailingIcon_.removeEventListener(evtType, _this.handleTrailingIconInteraction_);
  2131. });
  2132. }
  2133. _super.prototype.destroy.call(this);
  2134. };
  2135. /**
  2136. * Begins the exit animation which leads to removal of the chip.
  2137. */
  2138. MDCChip.prototype.beginExit = function () {
  2139. this.foundation_.beginExit();
  2140. };
  2141. MDCChip.prototype.getDefaultFoundation = function () {
  2142. var _this = this;
  2143. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  2144. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  2145. var adapter = {
  2146. addClass: function addClass(className) {
  2147. return _this.root_.classList.add(className);
  2148. },
  2149. addClassToLeadingIcon: function addClassToLeadingIcon(className) {
  2150. if (_this.leadingIcon_) {
  2151. _this.leadingIcon_.classList.add(className);
  2152. }
  2153. },
  2154. eventTargetHasClass: function eventTargetHasClass(target, className) {
  2155. return target ? target.classList.contains(className) : false;
  2156. },
  2157. focusPrimaryAction: function focusPrimaryAction() {
  2158. if (_this.primaryAction_) {
  2159. _this.primaryAction_.focus();
  2160. }
  2161. },
  2162. focusTrailingAction: function focusTrailingAction() {
  2163. if (_this.trailingAction_) {
  2164. _this.trailingAction_.focus();
  2165. }
  2166. },
  2167. getAttribute: function getAttribute(attr) {
  2168. return _this.root_.getAttribute(attr);
  2169. },
  2170. getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
  2171. return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null;
  2172. },
  2173. getComputedStyleValue: function getComputedStyleValue(propertyName) {
  2174. return window.getComputedStyle(_this.root_).getPropertyValue(propertyName);
  2175. },
  2176. getRootBoundingClientRect: function getRootBoundingClientRect() {
  2177. return _this.root_.getBoundingClientRect();
  2178. },
  2179. hasClass: function hasClass(className) {
  2180. return _this.root_.classList.contains(className);
  2181. },
  2182. hasLeadingIcon: function hasLeadingIcon() {
  2183. return !!_this.leadingIcon_;
  2184. },
  2185. hasTrailingAction: function hasTrailingAction() {
  2186. return !!_this.trailingAction_;
  2187. },
  2188. isRTL: function isRTL() {
  2189. return window.getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  2190. },
  2191. notifyInteraction: function notifyInteraction() {
  2192. return _this.emit(constants_1.strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
  2193. },
  2194. notifyNavigation: function notifyNavigation(key, source) {
  2195. return _this.emit(constants_1.strings.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true /* shouldBubble */);
  2196. },
  2197. notifyRemoval: function notifyRemoval(removedAnnouncement) {
  2198. _this.emit(constants_1.strings.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true /* shouldBubble */);
  2199. },
  2200. notifySelection: function notifySelection(selected, shouldIgnore) {
  2201. return _this.emit(constants_1.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true /* shouldBubble */);
  2202. },
  2203. notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
  2204. return _this.emit(constants_1.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */);
  2205. },
  2206. removeClass: function removeClass(className) {
  2207. return _this.root_.classList.remove(className);
  2208. },
  2209. removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) {
  2210. if (_this.leadingIcon_) {
  2211. _this.leadingIcon_.classList.remove(className);
  2212. }
  2213. },
  2214. setPrimaryActionAttr: function setPrimaryActionAttr(attr, value) {
  2215. if (_this.primaryAction_) {
  2216. _this.primaryAction_.setAttribute(attr, value);
  2217. }
  2218. },
  2219. setStyleProperty: function setStyleProperty(propertyName, value) {
  2220. return _this.root_.style.setProperty(propertyName, value);
  2221. },
  2222. setTrailingActionAttr: function setTrailingActionAttr(attr, value) {
  2223. if (_this.trailingAction_) {
  2224. _this.trailingAction_.setAttribute(attr, value);
  2225. }
  2226. }
  2227. };
  2228. return new foundation_2.MDCChipFoundation(adapter);
  2229. };
  2230. MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
  2231. this.foundation_.setSelectedFromChipSet(selected, shouldNotifyClients);
  2232. };
  2233. MDCChip.prototype.focusPrimaryAction = function () {
  2234. this.foundation_.focusPrimaryAction();
  2235. };
  2236. MDCChip.prototype.focusTrailingAction = function () {
  2237. this.foundation_.focusTrailingAction();
  2238. };
  2239. MDCChip.prototype.removeFocus = function () {
  2240. this.foundation_.removeFocus();
  2241. };
  2242. MDCChip.prototype.remove = function () {
  2243. var parent = this.root_.parentNode;
  2244. if (parent !== null) {
  2245. parent.removeChild(this.root_);
  2246. }
  2247. };
  2248. return MDCChip;
  2249. }(component_1.MDCComponent);
  2250. exports.MDCChip = MDCChip;
  2251. /***/ }),
  2252. /***/ "./packages/mdc-chips/chip/constants.ts":
  2253. /*!**********************************************!*\
  2254. !*** ./packages/mdc-chips/chip/constants.ts ***!
  2255. \**********************************************/
  2256. /*! no static exports found */
  2257. /***/ (function(module, exports, __webpack_require__) {
  2258. "use strict";
  2259. /**
  2260. * @license
  2261. * Copyright 2016 Google Inc.
  2262. *
  2263. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2264. * of this software and associated documentation files (the "Software"), to deal
  2265. * in the Software without restriction, including without limitation the rights
  2266. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2267. * copies of the Software, and to permit persons to whom the Software is
  2268. * furnished to do so, subject to the following conditions:
  2269. *
  2270. * The above copyright notice and this permission notice shall be included in
  2271. * all copies or substantial portions of the Software.
  2272. *
  2273. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2274. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2275. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2276. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2277. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2278. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2279. * THE SOFTWARE.
  2280. */
  2281. Object.defineProperty(exports, "__esModule", { value: true });
  2282. var Direction;
  2283. (function (Direction) {
  2284. Direction[Direction["RIGHT"] = 0] = "RIGHT";
  2285. Direction[Direction["LEFT"] = 1] = "LEFT";
  2286. })(Direction = exports.Direction || (exports.Direction = {}));
  2287. var EventSource;
  2288. (function (EventSource) {
  2289. EventSource[EventSource["PRIMARY"] = 0] = "PRIMARY";
  2290. EventSource[EventSource["TRAILING"] = 1] = "TRAILING";
  2291. EventSource[EventSource["NONE"] = 2] = "NONE";
  2292. })(EventSource = exports.EventSource || (exports.EventSource = {}));
  2293. exports.strings = {
  2294. ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement',
  2295. ARIA_CHECKED: 'aria-checked',
  2296. ARROW_DOWN_KEY: 'ArrowDown',
  2297. ARROW_LEFT_KEY: 'ArrowLeft',
  2298. ARROW_RIGHT_KEY: 'ArrowRight',
  2299. ARROW_UP_KEY: 'ArrowUp',
  2300. BACKSPACE_KEY: 'Backspace',
  2301. CHECKMARK_SELECTOR: '.mdc-chip__checkmark',
  2302. DELETE_KEY: 'Delete',
  2303. END_KEY: 'End',
  2304. ENTER_KEY: 'Enter',
  2305. ENTRY_ANIMATION_NAME: 'mdc-chip-entry',
  2306. HOME_KEY: 'Home',
  2307. INTERACTION_EVENT: 'MDCChip:interaction',
  2308. LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading',
  2309. NAVIGATION_EVENT: 'MDCChip:navigation',
  2310. PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action',
  2311. REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement',
  2312. REMOVAL_EVENT: 'MDCChip:removal',
  2313. SELECTION_EVENT: 'MDCChip:selection',
  2314. SPACEBAR_KEY: ' ',
  2315. TAB_INDEX: 'tabindex',
  2316. TRAILING_ACTION_SELECTOR: '.mdc-chip__trailing-action',
  2317. TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction',
  2318. TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing'
  2319. };
  2320. exports.cssClasses = {
  2321. CHECKMARK: 'mdc-chip__checkmark',
  2322. CHIP_EXIT: 'mdc-chip--exit',
  2323. DELETABLE: 'mdc-chip--deletable',
  2324. HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden',
  2325. LEADING_ICON: 'mdc-chip__icon--leading',
  2326. PRIMARY_ACTION: 'mdc-chip__primary-action',
  2327. SELECTED: 'mdc-chip--selected',
  2328. TEXT: 'mdc-chip__text',
  2329. TRAILING_ACTION: 'mdc-chip__trailing-action',
  2330. TRAILING_ICON: 'mdc-chip__icon--trailing'
  2331. };
  2332. exports.navigationKeys = new Set();
  2333. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  2334. exports.navigationKeys.add(exports.strings.ARROW_LEFT_KEY);
  2335. exports.navigationKeys.add(exports.strings.ARROW_RIGHT_KEY);
  2336. exports.navigationKeys.add(exports.strings.ARROW_DOWN_KEY);
  2337. exports.navigationKeys.add(exports.strings.ARROW_UP_KEY);
  2338. exports.navigationKeys.add(exports.strings.END_KEY);
  2339. exports.navigationKeys.add(exports.strings.HOME_KEY);
  2340. exports.jumpChipKeys = new Set();
  2341. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  2342. exports.jumpChipKeys.add(exports.strings.ARROW_UP_KEY);
  2343. exports.jumpChipKeys.add(exports.strings.ARROW_DOWN_KEY);
  2344. exports.jumpChipKeys.add(exports.strings.HOME_KEY);
  2345. exports.jumpChipKeys.add(exports.strings.END_KEY);
  2346. /***/ }),
  2347. /***/ "./packages/mdc-chips/chip/foundation.ts":
  2348. /*!***********************************************!*\
  2349. !*** ./packages/mdc-chips/chip/foundation.ts ***!
  2350. \***********************************************/
  2351. /*! no static exports found */
  2352. /***/ (function(module, exports, __webpack_require__) {
  2353. "use strict";
  2354. /**
  2355. * @license
  2356. * Copyright 2016 Google Inc.
  2357. *
  2358. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2359. * of this software and associated documentation files (the "Software"), to deal
  2360. * in the Software without restriction, including without limitation the rights
  2361. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2362. * copies of the Software, and to permit persons to whom the Software is
  2363. * furnished to do so, subject to the following conditions:
  2364. *
  2365. * The above copyright notice and this permission notice shall be included in
  2366. * all copies or substantial portions of the Software.
  2367. *
  2368. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2369. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2370. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2371. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2372. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2373. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2374. * THE SOFTWARE.
  2375. */
  2376. var __extends = this && this.__extends || function () {
  2377. var _extendStatics = function extendStatics(d, b) {
  2378. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2379. d.__proto__ = b;
  2380. } || function (d, b) {
  2381. for (var p in b) {
  2382. if (b.hasOwnProperty(p)) d[p] = b[p];
  2383. }
  2384. };
  2385. return _extendStatics(d, b);
  2386. };
  2387. return function (d, b) {
  2388. _extendStatics(d, b);
  2389. function __() {
  2390. this.constructor = d;
  2391. }
  2392. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2393. };
  2394. }();
  2395. var __assign = this && this.__assign || function () {
  2396. __assign = Object.assign || function (t) {
  2397. for (var s, i = 1, n = arguments.length; i < n; i++) {
  2398. s = arguments[i];
  2399. for (var p in s) {
  2400. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  2401. }
  2402. }
  2403. return t;
  2404. };
  2405. return __assign.apply(this, arguments);
  2406. };
  2407. Object.defineProperty(exports, "__esModule", { value: true });
  2408. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  2409. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2410. var emptyClientRect = {
  2411. bottom: 0,
  2412. height: 0,
  2413. left: 0,
  2414. right: 0,
  2415. top: 0,
  2416. width: 0
  2417. };
  2418. var MDCChipFoundation = /** @class */function (_super) {
  2419. __extends(MDCChipFoundation, _super);
  2420. function MDCChipFoundation(adapter) {
  2421. var _this = _super.call(this, __assign({}, MDCChipFoundation.defaultAdapter, adapter)) || this;
  2422. /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */
  2423. _this.shouldRemoveOnTrailingIconClick_ = true;
  2424. return _this;
  2425. }
  2426. Object.defineProperty(MDCChipFoundation, "strings", {
  2427. get: function get() {
  2428. return constants_1.strings;
  2429. },
  2430. enumerable: true,
  2431. configurable: true
  2432. });
  2433. Object.defineProperty(MDCChipFoundation, "cssClasses", {
  2434. get: function get() {
  2435. return constants_1.cssClasses;
  2436. },
  2437. enumerable: true,
  2438. configurable: true
  2439. });
  2440. Object.defineProperty(MDCChipFoundation, "defaultAdapter", {
  2441. get: function get() {
  2442. return {
  2443. addClass: function addClass() {
  2444. return undefined;
  2445. },
  2446. addClassToLeadingIcon: function addClassToLeadingIcon() {
  2447. return undefined;
  2448. },
  2449. eventTargetHasClass: function eventTargetHasClass() {
  2450. return false;
  2451. },
  2452. focusPrimaryAction: function focusPrimaryAction() {
  2453. return undefined;
  2454. },
  2455. focusTrailingAction: function focusTrailingAction() {
  2456. return undefined;
  2457. },
  2458. getAttribute: function getAttribute() {
  2459. return null;
  2460. },
  2461. getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
  2462. return emptyClientRect;
  2463. },
  2464. getComputedStyleValue: function getComputedStyleValue() {
  2465. return '';
  2466. },
  2467. getRootBoundingClientRect: function getRootBoundingClientRect() {
  2468. return emptyClientRect;
  2469. },
  2470. hasClass: function hasClass() {
  2471. return false;
  2472. },
  2473. hasLeadingIcon: function hasLeadingIcon() {
  2474. return false;
  2475. },
  2476. hasTrailingAction: function hasTrailingAction() {
  2477. return false;
  2478. },
  2479. isRTL: function isRTL() {
  2480. return false;
  2481. },
  2482. notifyInteraction: function notifyInteraction() {
  2483. return undefined;
  2484. },
  2485. notifyNavigation: function notifyNavigation() {
  2486. return undefined;
  2487. },
  2488. notifyRemoval: function notifyRemoval() {
  2489. return undefined;
  2490. },
  2491. notifySelection: function notifySelection() {
  2492. return undefined;
  2493. },
  2494. notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
  2495. return undefined;
  2496. },
  2497. removeClass: function removeClass() {
  2498. return undefined;
  2499. },
  2500. removeClassFromLeadingIcon: function removeClassFromLeadingIcon() {
  2501. return undefined;
  2502. },
  2503. setPrimaryActionAttr: function setPrimaryActionAttr() {
  2504. return undefined;
  2505. },
  2506. setStyleProperty: function setStyleProperty() {
  2507. return undefined;
  2508. },
  2509. setTrailingActionAttr: function setTrailingActionAttr() {
  2510. return undefined;
  2511. }
  2512. };
  2513. },
  2514. enumerable: true,
  2515. configurable: true
  2516. });
  2517. MDCChipFoundation.prototype.isSelected = function () {
  2518. return this.adapter_.hasClass(constants_1.cssClasses.SELECTED);
  2519. };
  2520. MDCChipFoundation.prototype.setSelected = function (selected) {
  2521. this.setSelected_(selected);
  2522. this.notifySelection_(selected);
  2523. };
  2524. MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
  2525. this.setSelected_(selected);
  2526. if (shouldNotifyClients) {
  2527. this.notifyIgnoredSelection_(selected);
  2528. }
  2529. };
  2530. MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () {
  2531. return this.shouldRemoveOnTrailingIconClick_;
  2532. };
  2533. MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) {
  2534. this.shouldRemoveOnTrailingIconClick_ = shouldRemove;
  2535. };
  2536. MDCChipFoundation.prototype.getDimensions = function () {
  2537. var _this = this;
  2538. var getRootRect = function getRootRect() {
  2539. return _this.adapter_.getRootBoundingClientRect();
  2540. };
  2541. var getCheckmarkRect = function getCheckmarkRect() {
  2542. return _this.adapter_.getCheckmarkBoundingClientRect();
  2543. };
  2544. // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current
  2545. // size of the checkmark.
  2546. if (!this.adapter_.hasLeadingIcon()) {
  2547. var checkmarkRect = getCheckmarkRect();
  2548. if (checkmarkRect) {
  2549. var rootRect = getRootRect();
  2550. // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes.
  2551. // However, the checkbox is initially hidden by setting the width to 0.
  2552. // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width)
  2553. // when adding it to the root client rect's width.
  2554. return {
  2555. bottom: rootRect.bottom,
  2556. height: rootRect.height,
  2557. left: rootRect.left,
  2558. right: rootRect.right,
  2559. top: rootRect.top,
  2560. width: rootRect.width + checkmarkRect.height
  2561. };
  2562. }
  2563. }
  2564. return getRootRect();
  2565. };
  2566. /**
  2567. * Begins the exit animation which leads to removal of the chip.
  2568. */
  2569. MDCChipFoundation.prototype.beginExit = function () {
  2570. this.adapter_.addClass(constants_1.cssClasses.CHIP_EXIT);
  2571. };
  2572. /**
  2573. * Handles an interaction event on the root element.
  2574. */
  2575. MDCChipFoundation.prototype.handleInteraction = function (evt) {
  2576. if (this.shouldHandleInteraction_(evt)) {
  2577. this.adapter_.notifyInteraction();
  2578. this.focusPrimaryAction_();
  2579. }
  2580. };
  2581. /**
  2582. * Handles a transition end event on the root element.
  2583. */
  2584. MDCChipFoundation.prototype.handleTransitionEnd = function (evt) {
  2585. var _this = this;
  2586. // Handle transition end event on the chip when it is about to be removed.
  2587. var shouldHandle = this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT);
  2588. var widthIsAnimating = evt.propertyName === 'width';
  2589. var opacityIsAnimating = evt.propertyName === 'opacity';
  2590. if (shouldHandle && opacityIsAnimating) {
  2591. // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5
  2592. var chipWidth_1 = this.adapter_.getComputedStyleValue('width');
  2593. // On the next frame (once we get the computed width), explicitly set the chip's width
  2594. // to its current pixel width, so we aren't transitioning out of 'auto'.
  2595. requestAnimationFrame(function () {
  2596. _this.adapter_.setStyleProperty('width', chipWidth_1);
  2597. // To mitigate jitter, start transitioning padding and margin before width.
  2598. _this.adapter_.setStyleProperty('padding', '0');
  2599. _this.adapter_.setStyleProperty('margin', '0');
  2600. // On the next frame (once width is explicitly set), transition width to 0.
  2601. requestAnimationFrame(function () {
  2602. _this.adapter_.setStyleProperty('width', '0');
  2603. });
  2604. });
  2605. return;
  2606. }
  2607. if (shouldHandle && widthIsAnimating) {
  2608. this.removeFocus_();
  2609. var removedAnnouncement = this.adapter_.getAttribute(constants_1.strings.REMOVED_ANNOUNCEMENT_ATTRIBUTE);
  2610. this.adapter_.notifyRemoval(removedAnnouncement);
  2611. }
  2612. // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles.
  2613. if (!opacityIsAnimating) {
  2614. return;
  2615. }
  2616. var shouldHideLeadingIcon = this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.LEADING_ICON) && this.adapter_.hasClass(constants_1.cssClasses.SELECTED);
  2617. var shouldShowLeadingIcon = this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter_.hasClass(constants_1.cssClasses.SELECTED);
  2618. if (shouldHideLeadingIcon) {
  2619. return this.adapter_.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
  2620. }
  2621. if (shouldShowLeadingIcon) {
  2622. return this.adapter_.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
  2623. }
  2624. };
  2625. /**
  2626. * Handles an interaction event on the trailing icon element. This is used to
  2627. * prevent the ripple from activating on interaction with the trailing icon.
  2628. */
  2629. MDCChipFoundation.prototype.handleTrailingIconInteraction = function (evt) {
  2630. if (this.shouldHandleInteraction_(evt)) {
  2631. this.adapter_.notifyTrailingIconInteraction();
  2632. this.removeChip_(evt);
  2633. }
  2634. };
  2635. /**
  2636. * Handles a keydown event from the root element.
  2637. */
  2638. MDCChipFoundation.prototype.handleKeydown = function (evt) {
  2639. if (this.shouldRemoveChip_(evt)) {
  2640. return this.removeChip_(evt);
  2641. }
  2642. var key = evt.key;
  2643. // Early exit if the key is not usable
  2644. if (!constants_1.navigationKeys.has(key)) {
  2645. return;
  2646. }
  2647. // Prevent default behavior for movement keys which could include scrolling
  2648. evt.preventDefault();
  2649. this.focusNextAction_(evt);
  2650. };
  2651. MDCChipFoundation.prototype.removeFocus = function () {
  2652. this.adapter_.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2653. this.adapter_.setTrailingActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2654. };
  2655. MDCChipFoundation.prototype.focusPrimaryAction = function () {
  2656. this.focusPrimaryAction_();
  2657. };
  2658. MDCChipFoundation.prototype.focusTrailingAction = function () {
  2659. if (!this.adapter_.hasTrailingAction()) {
  2660. return this.focusPrimaryAction_();
  2661. }
  2662. this.focusTrailingAction_();
  2663. };
  2664. MDCChipFoundation.prototype.focusNextAction_ = function (evt) {
  2665. var key = evt.key;
  2666. var hasTrailingAction = this.adapter_.hasTrailingAction();
  2667. var dir = this.getDirection_(key);
  2668. var source = this.getEvtSource_(evt);
  2669. // Early exit if the key should jump keys or the chip only has one action (i.e. no trailing action)
  2670. if (constants_1.jumpChipKeys.has(key) || !hasTrailingAction) {
  2671. this.adapter_.notifyNavigation(key, source);
  2672. return;
  2673. }
  2674. if (source === constants_1.EventSource.PRIMARY && dir === constants_1.Direction.RIGHT) {
  2675. return this.focusTrailingAction_();
  2676. }
  2677. if (source === constants_1.EventSource.TRAILING && dir === constants_1.Direction.LEFT) {
  2678. return this.focusPrimaryAction_();
  2679. }
  2680. this.adapter_.notifyNavigation(key, constants_1.EventSource.NONE);
  2681. };
  2682. MDCChipFoundation.prototype.getEvtSource_ = function (evt) {
  2683. if (this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.PRIMARY_ACTION)) {
  2684. return constants_1.EventSource.PRIMARY;
  2685. }
  2686. if (this.adapter_.eventTargetHasClass(evt.target, constants_1.cssClasses.TRAILING_ACTION)) {
  2687. return constants_1.EventSource.TRAILING;
  2688. }
  2689. return constants_1.EventSource.NONE;
  2690. };
  2691. MDCChipFoundation.prototype.getDirection_ = function (key) {
  2692. var isRTL = this.adapter_.isRTL();
  2693. if (key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL) {
  2694. return constants_1.Direction.LEFT;
  2695. }
  2696. return constants_1.Direction.RIGHT;
  2697. };
  2698. MDCChipFoundation.prototype.focusPrimaryAction_ = function () {
  2699. this.adapter_.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '0');
  2700. this.adapter_.focusPrimaryAction();
  2701. this.adapter_.setTrailingActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2702. };
  2703. MDCChipFoundation.prototype.focusTrailingAction_ = function () {
  2704. this.adapter_.setTrailingActionAttr(constants_1.strings.TAB_INDEX, '0');
  2705. this.adapter_.focusTrailingAction();
  2706. this.adapter_.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2707. };
  2708. MDCChipFoundation.prototype.removeFocus_ = function () {
  2709. this.adapter_.setTrailingActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2710. this.adapter_.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
  2711. };
  2712. MDCChipFoundation.prototype.removeChip_ = function (evt) {
  2713. evt.stopPropagation();
  2714. // Prevent default behavior for backspace on Firefox which causes a page
  2715. // navigation.
  2716. evt.preventDefault();
  2717. if (this.shouldRemoveOnTrailingIconClick_) {
  2718. this.beginExit();
  2719. }
  2720. };
  2721. MDCChipFoundation.prototype.shouldHandleInteraction_ = function (evt) {
  2722. if (evt.type === 'click') {
  2723. return true;
  2724. }
  2725. var keyEvt = evt;
  2726. return keyEvt.key === constants_1.strings.ENTER_KEY || keyEvt.key === constants_1.strings.SPACEBAR_KEY;
  2727. };
  2728. MDCChipFoundation.prototype.shouldRemoveChip_ = function (evt) {
  2729. var isDeletable = this.adapter_.hasClass(constants_1.cssClasses.DELETABLE);
  2730. return isDeletable && (evt.key === constants_1.strings.BACKSPACE_KEY || evt.key === constants_1.strings.DELETE_KEY);
  2731. };
  2732. MDCChipFoundation.prototype.setSelected_ = function (selected) {
  2733. if (selected) {
  2734. this.adapter_.addClass(constants_1.cssClasses.SELECTED);
  2735. this.adapter_.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'true');
  2736. } else {
  2737. this.adapter_.removeClass(constants_1.cssClasses.SELECTED);
  2738. this.adapter_.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'false');
  2739. }
  2740. };
  2741. MDCChipFoundation.prototype.notifySelection_ = function (selected) {
  2742. this.adapter_.notifySelection(selected, false);
  2743. };
  2744. MDCChipFoundation.prototype.notifyIgnoredSelection_ = function (selected) {
  2745. this.adapter_.notifySelection(selected, true);
  2746. };
  2747. return MDCChipFoundation;
  2748. }(foundation_1.MDCFoundation);
  2749. exports.MDCChipFoundation = MDCChipFoundation;
  2750. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  2751. exports.default = MDCChipFoundation;
  2752. /***/ }),
  2753. /***/ "./packages/mdc-chips/chip/index.ts":
  2754. /*!******************************************!*\
  2755. !*** ./packages/mdc-chips/chip/index.ts ***!
  2756. \******************************************/
  2757. /*! no static exports found */
  2758. /***/ (function(module, exports, __webpack_require__) {
  2759. "use strict";
  2760. /**
  2761. * @license
  2762. * Copyright 2019 Google Inc.
  2763. *
  2764. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2765. * of this software and associated documentation files (the "Software"), to deal
  2766. * in the Software without restriction, including without limitation the rights
  2767. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2768. * copies of the Software, and to permit persons to whom the Software is
  2769. * furnished to do so, subject to the following conditions:
  2770. *
  2771. * The above copyright notice and this permission notice shall be included in
  2772. * all copies or substantial portions of the Software.
  2773. *
  2774. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2775. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2776. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2777. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2778. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2779. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2780. * THE SOFTWARE.
  2781. */
  2782. function __export(m) {
  2783. for (var p in m) {
  2784. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  2785. }
  2786. }
  2787. Object.defineProperty(exports, "__esModule", { value: true });
  2788. __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip/component.ts"));
  2789. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts"));
  2790. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts");
  2791. exports.chipCssClasses = constants_1.cssClasses;
  2792. exports.chipStrings = constants_1.strings;
  2793. /***/ }),
  2794. /***/ "./packages/mdc-chips/index.ts":
  2795. /*!*************************************!*\
  2796. !*** ./packages/mdc-chips/index.ts ***!
  2797. \*************************************/
  2798. /*! no static exports found */
  2799. /***/ (function(module, exports, __webpack_require__) {
  2800. "use strict";
  2801. /**
  2802. * @license
  2803. * Copyright 2019 Google Inc.
  2804. *
  2805. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2806. * of this software and associated documentation files (the "Software"), to deal
  2807. * in the Software without restriction, including without limitation the rights
  2808. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2809. * copies of the Software, and to permit persons to whom the Software is
  2810. * furnished to do so, subject to the following conditions:
  2811. *
  2812. * The above copyright notice and this permission notice shall be included in
  2813. * all copies or substantial portions of the Software.
  2814. *
  2815. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2816. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2817. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2818. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2819. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2820. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2821. * THE SOFTWARE.
  2822. */
  2823. function __export(m) {
  2824. for (var p in m) {
  2825. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  2826. }
  2827. }
  2828. Object.defineProperty(exports, "__esModule", { value: true });
  2829. __export(__webpack_require__(/*! ./chip/index */ "./packages/mdc-chips/chip/index.ts"));
  2830. __export(__webpack_require__(/*! ./chip-set/index */ "./packages/mdc-chips/chip-set/index.ts"));
  2831. /***/ }),
  2832. /***/ "./packages/mdc-data-table/component.ts":
  2833. /*!**********************************************!*\
  2834. !*** ./packages/mdc-data-table/component.ts ***!
  2835. \**********************************************/
  2836. /*! no static exports found */
  2837. /***/ (function(module, exports, __webpack_require__) {
  2838. "use strict";
  2839. /**
  2840. * @license
  2841. * Copyright 2019 Google Inc.
  2842. *
  2843. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2844. * of this software and associated documentation files (the "Software"), to deal
  2845. * in the Software without restriction, including without limitation the rights
  2846. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2847. * copies of the Software, and to permit persons to whom the Software is
  2848. * furnished to do so, subject to the following conditions:
  2849. *
  2850. * The above copyright notice and this permission notice shall be included in
  2851. * all copies or substantial portions of the Software.
  2852. *
  2853. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2854. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2855. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2856. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2857. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2858. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2859. * THE SOFTWARE.
  2860. */
  2861. var __extends = this && this.__extends || function () {
  2862. var _extendStatics = function extendStatics(d, b) {
  2863. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  2864. d.__proto__ = b;
  2865. } || function (d, b) {
  2866. for (var p in b) {
  2867. if (b.hasOwnProperty(p)) d[p] = b[p];
  2868. }
  2869. };
  2870. return _extendStatics(d, b);
  2871. };
  2872. return function (d, b) {
  2873. _extendStatics(d, b);
  2874. function __() {
  2875. this.constructor = d;
  2876. }
  2877. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2878. };
  2879. }();
  2880. Object.defineProperty(exports, "__esModule", { value: true });
  2881. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  2882. var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts");
  2883. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  2884. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  2885. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts");
  2886. var MDCDataTable = /** @class */function (_super) {
  2887. __extends(MDCDataTable, _super);
  2888. function MDCDataTable() {
  2889. return _super !== null && _super.apply(this, arguments) || this;
  2890. }
  2891. MDCDataTable.attachTo = function (root) {
  2892. return new MDCDataTable(root);
  2893. };
  2894. MDCDataTable.prototype.initialize = function (checkboxFactory) {
  2895. if (checkboxFactory === void 0) {
  2896. checkboxFactory = function checkboxFactory(el) {
  2897. return new component_2.MDCCheckbox(el);
  2898. };
  2899. }
  2900. this.checkboxFactory_ = checkboxFactory;
  2901. };
  2902. MDCDataTable.prototype.initialSyncWithDOM = function () {
  2903. var _this = this;
  2904. this.headerRow_ = this.root_.querySelector("." + constants_1.cssClasses.HEADER_ROW);
  2905. this.handleHeaderRowCheckboxChange_ = function () {
  2906. return _this.foundation_.handleHeaderRowCheckboxChange();
  2907. };
  2908. this.headerRow_.addEventListener('change', this.handleHeaderRowCheckboxChange_);
  2909. this.content_ = this.root_.querySelector("." + constants_1.cssClasses.CONTENT);
  2910. this.handleRowCheckboxChange_ = function (event) {
  2911. return _this.foundation_.handleRowCheckboxChange(event);
  2912. };
  2913. this.content_.addEventListener('change', this.handleRowCheckboxChange_);
  2914. this.layout();
  2915. };
  2916. /**
  2917. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  2918. */
  2919. MDCDataTable.prototype.layout = function () {
  2920. this.foundation_.layout();
  2921. };
  2922. /**
  2923. * @return Returns array of row elements.
  2924. */
  2925. MDCDataTable.prototype.getRows = function () {
  2926. return this.foundation_.getRows();
  2927. };
  2928. /**
  2929. * @return Returns array of selected row ids.
  2930. */
  2931. MDCDataTable.prototype.getSelectedRowIds = function () {
  2932. return this.foundation_.getSelectedRowIds();
  2933. };
  2934. /**
  2935. * Sets selected row ids. Overwrites previously selected rows.
  2936. * @param rowIds Array of row ids that needs to be selected.
  2937. */
  2938. MDCDataTable.prototype.setSelectedRowIds = function (rowIds) {
  2939. this.foundation_.setSelectedRowIds(rowIds);
  2940. };
  2941. MDCDataTable.prototype.destroy = function () {
  2942. this.headerRow_.removeEventListener('change', this.handleHeaderRowCheckboxChange_);
  2943. this.content_.removeEventListener('change', this.handleRowCheckboxChange_);
  2944. this.headerRowCheckbox_.destroy();
  2945. this.rowCheckboxList_.forEach(function (checkbox) {
  2946. return checkbox.destroy();
  2947. });
  2948. };
  2949. MDCDataTable.prototype.getDefaultFoundation = function () {
  2950. var _this = this;
  2951. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  2952. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  2953. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  2954. var adapter = {
  2955. addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) {
  2956. return _this.getRows()[rowIndex].classList.add(className);
  2957. },
  2958. getRowCount: function getRowCount() {
  2959. return _this.getRows().length;
  2960. },
  2961. getRowElements: function getRowElements() {
  2962. return [].slice.call(_this.root_.querySelectorAll(constants_1.strings.ROW_SELECTOR));
  2963. },
  2964. getRowIdAtIndex: function getRowIdAtIndex(rowIndex) {
  2965. return _this.getRows()[rowIndex].getAttribute(constants_1.strings.DATA_ROW_ID_ATTR);
  2966. },
  2967. getRowIndexByChildElement: function getRowIndexByChildElement(el) {
  2968. return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.strings.ROW_SELECTOR));
  2969. },
  2970. getSelectedRowCount: function getSelectedRowCount() {
  2971. return _this.root_.querySelectorAll(constants_1.strings.ROW_SELECTED_SELECTOR).length;
  2972. },
  2973. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) {
  2974. return _this.rowCheckboxList_[rowIndex].checked;
  2975. },
  2976. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  2977. return _this.headerRowCheckbox_.checked;
  2978. },
  2979. isRowsSelectable: function isRowsSelectable() {
  2980. return !!_this.root_.querySelector(constants_1.strings.ROW_CHECKBOX_SELECTOR);
  2981. },
  2982. notifyRowSelectionChanged: function notifyRowSelectionChanged(data) {
  2983. _this.emit(constants_1.events.ROW_SELECTION_CHANGED, {
  2984. row: _this.getRowByIndex_(data.rowIndex),
  2985. rowId: _this.getRowIdByIndex_(data.rowIndex),
  2986. rowIndex: data.rowIndex,
  2987. selected: data.selected
  2988. },
  2989. /** shouldBubble */true);
  2990. },
  2991. notifySelectedAll: function notifySelectedAll() {
  2992. return _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true);
  2993. },
  2994. notifyUnselectedAll: function notifyUnselectedAll() {
  2995. return _this.emit(constants_1.events.UNSELECTED_ALL, {}, /** shouldBubble */true);
  2996. },
  2997. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  2998. if (_this.headerRowCheckbox_) {
  2999. _this.headerRowCheckbox_.destroy();
  3000. }
  3001. var checkboxEl = _this.root_.querySelector(constants_1.strings.HEADER_ROW_CHECKBOX_SELECTOR);
  3002. _this.headerRowCheckbox_ = _this.checkboxFactory_(checkboxEl);
  3003. },
  3004. registerRowCheckboxes: function registerRowCheckboxes() {
  3005. if (_this.rowCheckboxList_) {
  3006. _this.rowCheckboxList_.forEach(function (checkbox) {
  3007. return checkbox.destroy();
  3008. });
  3009. }
  3010. _this.rowCheckboxList_ = [];
  3011. _this.getRows().forEach(function (rowEl) {
  3012. var checkbox = _this.checkboxFactory_(rowEl.querySelector(constants_1.strings.ROW_CHECKBOX_SELECTOR));
  3013. _this.rowCheckboxList_.push(checkbox);
  3014. });
  3015. },
  3016. removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) {
  3017. _this.getRows()[rowIndex].classList.remove(className);
  3018. },
  3019. setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) {
  3020. _this.getRows()[rowIndex].setAttribute(attr, value);
  3021. },
  3022. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) {
  3023. _this.headerRowCheckbox_.checked = checked;
  3024. },
  3025. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) {
  3026. _this.headerRowCheckbox_.indeterminate = indeterminate;
  3027. },
  3028. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) {
  3029. _this.rowCheckboxList_[rowIndex].checked = checked;
  3030. }
  3031. };
  3032. return new foundation_1.MDCDataTableFoundation(adapter);
  3033. };
  3034. MDCDataTable.prototype.getRowByIndex_ = function (index) {
  3035. return this.getRows()[index];
  3036. };
  3037. MDCDataTable.prototype.getRowIdByIndex_ = function (index) {
  3038. return this.getRowByIndex_(index).getAttribute(constants_1.strings.DATA_ROW_ID_ATTR);
  3039. };
  3040. return MDCDataTable;
  3041. }(component_1.MDCComponent);
  3042. exports.MDCDataTable = MDCDataTable;
  3043. /***/ }),
  3044. /***/ "./packages/mdc-data-table/constants.ts":
  3045. /*!**********************************************!*\
  3046. !*** ./packages/mdc-data-table/constants.ts ***!
  3047. \**********************************************/
  3048. /*! no static exports found */
  3049. /***/ (function(module, exports, __webpack_require__) {
  3050. "use strict";
  3051. /**
  3052. * @license
  3053. * Copyright 2019 Google Inc.
  3054. *
  3055. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3056. * of this software and associated documentation files (the "Software"), to deal
  3057. * in the Software without restriction, including without limitation the rights
  3058. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3059. * copies of the Software, and to permit persons to whom the Software is
  3060. * furnished to do so, subject to the following conditions:
  3061. *
  3062. * The above copyright notice and this permission notice shall be included in
  3063. * all copies or substantial portions of the Software.
  3064. *
  3065. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3066. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3067. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3068. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3069. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3070. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3071. * THE SOFTWARE.
  3072. */
  3073. Object.defineProperty(exports, "__esModule", { value: true });
  3074. exports.cssClasses = {
  3075. CELL: 'mdc-data-table__cell',
  3076. CELL_NUMERIC: 'mdc-data-table__cell--numeric',
  3077. CONTENT: 'mdc-data-table__content',
  3078. HEADER_ROW: 'mdc-data-table__header-row',
  3079. HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',
  3080. ROOT: 'mdc-data-table',
  3081. ROW: 'mdc-data-table__row',
  3082. ROW_CHECKBOX: 'mdc-data-table__row-checkbox',
  3083. ROW_SELECTED: 'mdc-data-table__row--selected'
  3084. };
  3085. exports.strings = {
  3086. ARIA_SELECTED: 'aria-selected',
  3087. DATA_ROW_ID_ATTR: 'data-row-id',
  3088. HEADER_ROW_CHECKBOX_SELECTOR: "." + exports.cssClasses.HEADER_ROW_CHECKBOX,
  3089. ROW_CHECKBOX_SELECTOR: "." + exports.cssClasses.ROW_CHECKBOX,
  3090. ROW_SELECTED_SELECTOR: "." + exports.cssClasses.ROW_SELECTED,
  3091. ROW_SELECTOR: "." + exports.cssClasses.ROW
  3092. };
  3093. exports.events = {
  3094. ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged',
  3095. SELECTED_ALL: 'MDCDataTable:selectedAll',
  3096. UNSELECTED_ALL: 'MDCDataTable:unselectedAll'
  3097. };
  3098. /***/ }),
  3099. /***/ "./packages/mdc-data-table/foundation.ts":
  3100. /*!***********************************************!*\
  3101. !*** ./packages/mdc-data-table/foundation.ts ***!
  3102. \***********************************************/
  3103. /*! no static exports found */
  3104. /***/ (function(module, exports, __webpack_require__) {
  3105. "use strict";
  3106. /**
  3107. * @license
  3108. * Copyright 2019 Google Inc.
  3109. *
  3110. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3111. * of this software and associated documentation files (the "Software"), to deal
  3112. * in the Software without restriction, including without limitation the rights
  3113. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3114. * copies of the Software, and to permit persons to whom the Software is
  3115. * furnished to do so, subject to the following conditions:
  3116. *
  3117. * The above copyright notice and this permission notice shall be included in
  3118. * all copies or substantial portions of the Software.
  3119. *
  3120. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3121. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3122. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3123. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3124. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3125. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3126. * THE SOFTWARE.
  3127. */
  3128. var __extends = this && this.__extends || function () {
  3129. var _extendStatics = function extendStatics(d, b) {
  3130. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3131. d.__proto__ = b;
  3132. } || function (d, b) {
  3133. for (var p in b) {
  3134. if (b.hasOwnProperty(p)) d[p] = b[p];
  3135. }
  3136. };
  3137. return _extendStatics(d, b);
  3138. };
  3139. return function (d, b) {
  3140. _extendStatics(d, b);
  3141. function __() {
  3142. this.constructor = d;
  3143. }
  3144. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3145. };
  3146. }();
  3147. var __assign = this && this.__assign || function () {
  3148. __assign = Object.assign || function (t) {
  3149. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3150. s = arguments[i];
  3151. for (var p in s) {
  3152. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3153. }
  3154. }
  3155. return t;
  3156. };
  3157. return __assign.apply(this, arguments);
  3158. };
  3159. var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
  3160. return new (P || (P = Promise))(function (resolve, reject) {
  3161. function fulfilled(value) {
  3162. try {
  3163. step(generator.next(value));
  3164. } catch (e) {
  3165. reject(e);
  3166. }
  3167. }
  3168. function rejected(value) {
  3169. try {
  3170. step(generator["throw"](value));
  3171. } catch (e) {
  3172. reject(e);
  3173. }
  3174. }
  3175. function step(result) {
  3176. result.done ? resolve(result.value) : new P(function (resolve) {
  3177. resolve(result.value);
  3178. }).then(fulfilled, rejected);
  3179. }
  3180. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3181. });
  3182. };
  3183. var __generator = this && this.__generator || function (thisArg, body) {
  3184. var _ = { label: 0, sent: function sent() {
  3185. if (t[0] & 1) throw t[1];return t[1];
  3186. }, trys: [], ops: [] },
  3187. f,
  3188. y,
  3189. t,
  3190. g;
  3191. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
  3192. return this;
  3193. }), g;
  3194. function verb(n) {
  3195. return function (v) {
  3196. return step([n, v]);
  3197. };
  3198. }
  3199. function step(op) {
  3200. if (f) throw new TypeError("Generator is already executing.");
  3201. while (_) {
  3202. try {
  3203. 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;
  3204. if (y = 0, t) op = [op[0] & 2, t.value];
  3205. switch (op[0]) {
  3206. case 0:case 1:
  3207. t = op;break;
  3208. case 4:
  3209. _.label++;return { value: op[1], done: false };
  3210. case 5:
  3211. _.label++;y = op[1];op = [0];continue;
  3212. case 7:
  3213. op = _.ops.pop();_.trys.pop();continue;
  3214. default:
  3215. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  3216. _ = 0;continue;
  3217. }
  3218. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  3219. _.label = op[1];break;
  3220. }
  3221. if (op[0] === 6 && _.label < t[1]) {
  3222. _.label = t[1];t = op;break;
  3223. }
  3224. if (t && _.label < t[2]) {
  3225. _.label = t[2];_.ops.push(op);break;
  3226. }
  3227. if (t[2]) _.ops.pop();
  3228. _.trys.pop();continue;
  3229. }
  3230. op = body.call(thisArg, _);
  3231. } catch (e) {
  3232. op = [6, e];y = 0;
  3233. } finally {
  3234. f = t = 0;
  3235. }
  3236. }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
  3237. }
  3238. };
  3239. Object.defineProperty(exports, "__esModule", { value: true });
  3240. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  3241. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  3242. var MDCDataTableFoundation = /** @class */function (_super) {
  3243. __extends(MDCDataTableFoundation, _super);
  3244. function MDCDataTableFoundation(adapter) {
  3245. return _super.call(this, __assign({}, MDCDataTableFoundation.defaultAdapter, adapter)) || this;
  3246. }
  3247. Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", {
  3248. get: function get() {
  3249. return {
  3250. addClassAtRowIndex: function addClassAtRowIndex() {
  3251. return undefined;
  3252. },
  3253. getRowCount: function getRowCount() {
  3254. return 0;
  3255. },
  3256. getRowElements: function getRowElements() {
  3257. return [];
  3258. },
  3259. getRowIdAtIndex: function getRowIdAtIndex() {
  3260. return '';
  3261. },
  3262. getRowIndexByChildElement: function getRowIndexByChildElement() {
  3263. return 0;
  3264. },
  3265. getSelectedRowCount: function getSelectedRowCount() {
  3266. return 0;
  3267. },
  3268. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() {
  3269. return false;
  3270. },
  3271. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  3272. return false;
  3273. },
  3274. isRowsSelectable: function isRowsSelectable() {
  3275. return false;
  3276. },
  3277. notifyRowSelectionChanged: function notifyRowSelectionChanged() {
  3278. return undefined;
  3279. },
  3280. notifySelectedAll: function notifySelectedAll() {
  3281. return undefined;
  3282. },
  3283. notifyUnselectedAll: function notifyUnselectedAll() {
  3284. return undefined;
  3285. },
  3286. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  3287. return undefined;
  3288. },
  3289. registerRowCheckboxes: function registerRowCheckboxes() {
  3290. return undefined;
  3291. },
  3292. removeClassAtRowIndex: function removeClassAtRowIndex() {
  3293. return undefined;
  3294. },
  3295. setAttributeAtRowIndex: function setAttributeAtRowIndex() {
  3296. return undefined;
  3297. },
  3298. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() {
  3299. return undefined;
  3300. },
  3301. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() {
  3302. return undefined;
  3303. },
  3304. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() {
  3305. return undefined;
  3306. }
  3307. };
  3308. },
  3309. enumerable: true,
  3310. configurable: true
  3311. });
  3312. /**
  3313. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  3314. * Use this if registering checkbox is synchronous.
  3315. */
  3316. MDCDataTableFoundation.prototype.layout = function () {
  3317. if (this.adapter_.isRowsSelectable()) {
  3318. this.adapter_.registerHeaderRowCheckbox();
  3319. this.adapter_.registerRowCheckboxes();
  3320. this.setHeaderRowCheckboxState_();
  3321. }
  3322. };
  3323. /**
  3324. * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table.
  3325. * Use this if registering checkbox is asynchronous.
  3326. */
  3327. MDCDataTableFoundation.prototype.layoutAsync = function () {
  3328. return __awaiter(this, void 0, void 0, function () {
  3329. return __generator(this, function (_a) {
  3330. switch (_a.label) {
  3331. case 0:
  3332. if (!this.adapter_.isRowsSelectable()) return [3 /*break*/, 3];
  3333. return [4 /*yield*/, this.adapter_.registerHeaderRowCheckbox()];
  3334. case 1:
  3335. _a.sent();
  3336. return [4 /*yield*/, this.adapter_.registerRowCheckboxes()];
  3337. case 2:
  3338. _a.sent();
  3339. this.setHeaderRowCheckboxState_();
  3340. _a.label = 3;
  3341. case 3:
  3342. return [2 /*return*/];
  3343. }
  3344. });
  3345. });
  3346. };
  3347. /**
  3348. * @return Returns array of row elements.
  3349. */
  3350. MDCDataTableFoundation.prototype.getRows = function () {
  3351. return this.adapter_.getRowElements();
  3352. };
  3353. /**
  3354. * Sets selected row ids. Overwrites previously selected rows.
  3355. * @param rowIds Array of row ids that needs to be selected.
  3356. */
  3357. MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {
  3358. for (var rowIndex = 0; rowIndex < this.adapter_.getRowCount(); rowIndex++) {
  3359. var rowId = this.adapter_.getRowIdAtIndex(rowIndex);
  3360. var isSelected = false;
  3361. if (rowId && rowIds.indexOf(rowId) >= 0) {
  3362. isSelected = true;
  3363. }
  3364. this.adapter_.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);
  3365. this.selectRowAtIndex_(rowIndex, isSelected);
  3366. }
  3367. this.setHeaderRowCheckboxState_();
  3368. };
  3369. /**
  3370. * @return Returns array of selected row ids.
  3371. */
  3372. MDCDataTableFoundation.prototype.getSelectedRowIds = function () {
  3373. var selectedRowIds = [];
  3374. for (var rowIndex = 0; rowIndex < this.adapter_.getRowCount(); rowIndex++) {
  3375. if (this.adapter_.isCheckboxAtRowIndexChecked(rowIndex)) {
  3376. selectedRowIds.push(this.adapter_.getRowIdAtIndex(rowIndex));
  3377. }
  3378. }
  3379. return selectedRowIds;
  3380. };
  3381. /**
  3382. * Handles header row checkbox change event.
  3383. */
  3384. MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {
  3385. var isHeaderChecked = this.adapter_.isHeaderRowCheckboxChecked();
  3386. for (var rowIndex = 0; rowIndex < this.adapter_.getRowCount(); rowIndex++) {
  3387. this.adapter_.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);
  3388. this.selectRowAtIndex_(rowIndex, isHeaderChecked);
  3389. }
  3390. if (isHeaderChecked) {
  3391. this.adapter_.notifySelectedAll();
  3392. } else {
  3393. this.adapter_.notifyUnselectedAll();
  3394. }
  3395. };
  3396. /**
  3397. * Handles change event originated from row checkboxes.
  3398. */
  3399. MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {
  3400. var rowIndex = this.adapter_.getRowIndexByChildElement(event.target);
  3401. if (rowIndex === -1) {
  3402. return;
  3403. }
  3404. var selected = this.adapter_.isCheckboxAtRowIndexChecked(rowIndex);
  3405. this.selectRowAtIndex_(rowIndex, selected);
  3406. this.setHeaderRowCheckboxState_();
  3407. var rowId = this.adapter_.getRowIdAtIndex(rowIndex);
  3408. this.adapter_.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });
  3409. };
  3410. /**
  3411. * Updates header row checkbox state based on number of rows selected.
  3412. */
  3413. MDCDataTableFoundation.prototype.setHeaderRowCheckboxState_ = function () {
  3414. if (this.adapter_.getSelectedRowCount() === this.adapter_.getRowCount()) {
  3415. this.adapter_.setHeaderRowCheckboxChecked(true);
  3416. this.adapter_.setHeaderRowCheckboxIndeterminate(false);
  3417. } else if (this.adapter_.getSelectedRowCount() === 0) {
  3418. this.adapter_.setHeaderRowCheckboxIndeterminate(false);
  3419. this.adapter_.setHeaderRowCheckboxChecked(false);
  3420. } else {
  3421. this.adapter_.setHeaderRowCheckboxIndeterminate(true);
  3422. this.adapter_.setHeaderRowCheckboxChecked(false);
  3423. }
  3424. };
  3425. /**
  3426. * Sets the attributes of row element based on selection state.
  3427. */
  3428. MDCDataTableFoundation.prototype.selectRowAtIndex_ = function (rowIndex, selected) {
  3429. if (selected) {
  3430. this.adapter_.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  3431. this.adapter_.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true');
  3432. } else {
  3433. this.adapter_.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  3434. this.adapter_.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false');
  3435. }
  3436. };
  3437. return MDCDataTableFoundation;
  3438. }(foundation_1.MDCFoundation);
  3439. exports.MDCDataTableFoundation = MDCDataTableFoundation;
  3440. /***/ }),
  3441. /***/ "./packages/mdc-data-table/index.ts":
  3442. /*!******************************************!*\
  3443. !*** ./packages/mdc-data-table/index.ts ***!
  3444. \******************************************/
  3445. /*! no static exports found */
  3446. /***/ (function(module, exports, __webpack_require__) {
  3447. "use strict";
  3448. /**
  3449. * @license
  3450. * Copyright 2019 Google Inc.
  3451. *
  3452. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3453. * of this software and associated documentation files (the "Software"), to deal
  3454. * in the Software without restriction, including without limitation the rights
  3455. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3456. * copies of the Software, and to permit persons to whom the Software is
  3457. * furnished to do so, subject to the following conditions:
  3458. *
  3459. * The above copyright notice and this permission notice shall be included in
  3460. * all copies or substantial portions of the Software.
  3461. *
  3462. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3463. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3464. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3465. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3466. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3467. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3468. * THE SOFTWARE.
  3469. */
  3470. function __export(m) {
  3471. for (var p in m) {
  3472. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  3473. }
  3474. }
  3475. Object.defineProperty(exports, "__esModule", { value: true });
  3476. __export(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts"));
  3477. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"));
  3478. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"));
  3479. /***/ }),
  3480. /***/ "./packages/mdc-dialog/component.ts":
  3481. /*!******************************************!*\
  3482. !*** ./packages/mdc-dialog/component.ts ***!
  3483. \******************************************/
  3484. /*! no static exports found */
  3485. /***/ (function(module, exports, __webpack_require__) {
  3486. "use strict";
  3487. /**
  3488. * @license
  3489. * Copyright 2017 Google Inc.
  3490. *
  3491. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3492. * of this software and associated documentation files (the "Software"), to deal
  3493. * in the Software without restriction, including without limitation the rights
  3494. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3495. * copies of the Software, and to permit persons to whom the Software is
  3496. * furnished to do so, subject to the following conditions:
  3497. *
  3498. * The above copyright notice and this permission notice shall be included in
  3499. * all copies or substantial portions of the Software.
  3500. *
  3501. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3502. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3503. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3504. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3505. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3506. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3507. * THE SOFTWARE.
  3508. */
  3509. var __extends = this && this.__extends || function () {
  3510. var _extendStatics = function extendStatics(d, b) {
  3511. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3512. d.__proto__ = b;
  3513. } || function (d, b) {
  3514. for (var p in b) {
  3515. if (b.hasOwnProperty(p)) d[p] = b[p];
  3516. }
  3517. };
  3518. return _extendStatics(d, b);
  3519. };
  3520. return function (d, b) {
  3521. _extendStatics(d, b);
  3522. function __() {
  3523. this.constructor = d;
  3524. }
  3525. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3526. };
  3527. }();
  3528. var __values = this && this.__values || function (o) {
  3529. var m = typeof Symbol === "function" && o[Symbol.iterator],
  3530. i = 0;
  3531. if (m) return m.call(o);
  3532. return {
  3533. next: function next() {
  3534. if (o && i >= o.length) o = void 0;
  3535. return { value: o && o[i++], done: !o };
  3536. }
  3537. };
  3538. };
  3539. var __importStar = this && this.__importStar || function (mod) {
  3540. if (mod && mod.__esModule) return mod;
  3541. var result = {};
  3542. if (mod != null) for (var k in mod) {
  3543. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  3544. }result["default"] = mod;
  3545. return result;
  3546. };
  3547. Object.defineProperty(exports, "__esModule", { value: true });
  3548. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3549. var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts");
  3550. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  3551. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  3552. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts");
  3553. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts"));
  3554. var strings = foundation_1.MDCDialogFoundation.strings;
  3555. var MDCDialog = /** @class */function (_super) {
  3556. __extends(MDCDialog, _super);
  3557. function MDCDialog() {
  3558. return _super !== null && _super.apply(this, arguments) || this;
  3559. }
  3560. Object.defineProperty(MDCDialog.prototype, "isOpen", {
  3561. get: function get() {
  3562. return this.foundation_.isOpen();
  3563. },
  3564. enumerable: true,
  3565. configurable: true
  3566. });
  3567. Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", {
  3568. get: function get() {
  3569. return this.foundation_.getEscapeKeyAction();
  3570. },
  3571. set: function set(action) {
  3572. this.foundation_.setEscapeKeyAction(action);
  3573. },
  3574. enumerable: true,
  3575. configurable: true
  3576. });
  3577. Object.defineProperty(MDCDialog.prototype, "scrimClickAction", {
  3578. get: function get() {
  3579. return this.foundation_.getScrimClickAction();
  3580. },
  3581. set: function set(action) {
  3582. this.foundation_.setScrimClickAction(action);
  3583. },
  3584. enumerable: true,
  3585. configurable: true
  3586. });
  3587. Object.defineProperty(MDCDialog.prototype, "autoStackButtons", {
  3588. get: function get() {
  3589. return this.foundation_.getAutoStackButtons();
  3590. },
  3591. set: function set(autoStack) {
  3592. this.foundation_.setAutoStackButtons(autoStack);
  3593. },
  3594. enumerable: true,
  3595. configurable: true
  3596. });
  3597. MDCDialog.attachTo = function (root) {
  3598. return new MDCDialog(root);
  3599. };
  3600. MDCDialog.prototype.initialize = function (focusTrapFactory) {
  3601. var e_1, _a;
  3602. if (focusTrapFactory === void 0) {
  3603. focusTrapFactory = function focusTrapFactory(el, focusOptions) {
  3604. return new focus_trap_1.FocusTrap(el, focusOptions);
  3605. };
  3606. }
  3607. var container = this.root_.querySelector(strings.CONTAINER_SELECTOR);
  3608. if (!container) {
  3609. throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element");
  3610. }
  3611. this.container_ = container;
  3612. this.content_ = this.root_.querySelector(strings.CONTENT_SELECTOR);
  3613. this.buttons_ = [].slice.call(this.root_.querySelectorAll(strings.BUTTON_SELECTOR));
  3614. this.defaultButton_ = this.root_.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]");
  3615. this.focusTrapFactory_ = focusTrapFactory;
  3616. this.buttonRipples_ = [];
  3617. try {
  3618. for (var _b = __values(this.buttons_), _c = _b.next(); !_c.done; _c = _b.next()) {
  3619. var buttonEl = _c.value;
  3620. this.buttonRipples_.push(new component_2.MDCRipple(buttonEl));
  3621. }
  3622. } catch (e_1_1) {
  3623. e_1 = { error: e_1_1 };
  3624. } finally {
  3625. try {
  3626. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  3627. } finally {
  3628. if (e_1) throw e_1.error;
  3629. }
  3630. }
  3631. };
  3632. MDCDialog.prototype.initialSyncWithDOM = function () {
  3633. var _this = this;
  3634. this.focusTrap_ = util.createFocusTrapInstance(this.container_, this.focusTrapFactory_, this.getInitialFocusEl_() || undefined);
  3635. this.handleClick_ = this.foundation_.handleClick.bind(this.foundation_);
  3636. this.handleKeydown_ = this.foundation_.handleKeydown.bind(this.foundation_);
  3637. this.handleDocumentKeydown_ = this.foundation_.handleDocumentKeydown.bind(this.foundation_);
  3638. this.handleLayout_ = this.layout.bind(this);
  3639. var LAYOUT_EVENTS = ['resize', 'orientationchange'];
  3640. this.handleOpening_ = function () {
  3641. LAYOUT_EVENTS.forEach(function (evtType) {
  3642. return window.addEventListener(evtType, _this.handleLayout_);
  3643. });
  3644. document.addEventListener('keydown', _this.handleDocumentKeydown_);
  3645. };
  3646. this.handleClosing_ = function () {
  3647. LAYOUT_EVENTS.forEach(function (evtType) {
  3648. return window.removeEventListener(evtType, _this.handleLayout_);
  3649. });
  3650. document.removeEventListener('keydown', _this.handleDocumentKeydown_);
  3651. };
  3652. this.listen('click', this.handleClick_);
  3653. this.listen('keydown', this.handleKeydown_);
  3654. this.listen(strings.OPENING_EVENT, this.handleOpening_);
  3655. this.listen(strings.CLOSING_EVENT, this.handleClosing_);
  3656. };
  3657. MDCDialog.prototype.destroy = function () {
  3658. this.unlisten('click', this.handleClick_);
  3659. this.unlisten('keydown', this.handleKeydown_);
  3660. this.unlisten(strings.OPENING_EVENT, this.handleOpening_);
  3661. this.unlisten(strings.CLOSING_EVENT, this.handleClosing_);
  3662. this.handleClosing_();
  3663. this.buttonRipples_.forEach(function (ripple) {
  3664. return ripple.destroy();
  3665. });
  3666. _super.prototype.destroy.call(this);
  3667. };
  3668. MDCDialog.prototype.layout = function () {
  3669. this.foundation_.layout();
  3670. };
  3671. MDCDialog.prototype.open = function () {
  3672. this.foundation_.open();
  3673. };
  3674. MDCDialog.prototype.close = function (action) {
  3675. if (action === void 0) {
  3676. action = '';
  3677. }
  3678. this.foundation_.close(action);
  3679. };
  3680. MDCDialog.prototype.getDefaultFoundation = function () {
  3681. var _this = this;
  3682. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  3683. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  3684. var adapter = {
  3685. addBodyClass: function addBodyClass(className) {
  3686. return document.body.classList.add(className);
  3687. },
  3688. addClass: function addClass(className) {
  3689. return _this.root_.classList.add(className);
  3690. },
  3691. areButtonsStacked: function areButtonsStacked() {
  3692. return util.areTopsMisaligned(_this.buttons_);
  3693. },
  3694. clickDefaultButton: function clickDefaultButton() {
  3695. return _this.defaultButton_ && _this.defaultButton_.click();
  3696. },
  3697. eventTargetMatches: function eventTargetMatches(target, selector) {
  3698. return target ? ponyfill_1.matches(target, selector) : false;
  3699. },
  3700. getActionFromEvent: function getActionFromEvent(evt) {
  3701. if (!evt.target) {
  3702. return '';
  3703. }
  3704. var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]");
  3705. return element && element.getAttribute(strings.ACTION_ATTRIBUTE);
  3706. },
  3707. getInitialFocusEl: function getInitialFocusEl() {
  3708. return _this.getInitialFocusEl_();
  3709. },
  3710. hasClass: function hasClass(className) {
  3711. return _this.root_.classList.contains(className);
  3712. },
  3713. isContentScrollable: function isContentScrollable() {
  3714. return util.isScrollable(_this.content_);
  3715. },
  3716. notifyClosed: function notifyClosed(action) {
  3717. return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {});
  3718. },
  3719. notifyClosing: function notifyClosing(action) {
  3720. return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {});
  3721. },
  3722. notifyOpened: function notifyOpened() {
  3723. return _this.emit(strings.OPENED_EVENT, {});
  3724. },
  3725. notifyOpening: function notifyOpening() {
  3726. return _this.emit(strings.OPENING_EVENT, {});
  3727. },
  3728. releaseFocus: function releaseFocus() {
  3729. return _this.focusTrap_.releaseFocus();
  3730. },
  3731. removeBodyClass: function removeBodyClass(className) {
  3732. return document.body.classList.remove(className);
  3733. },
  3734. removeClass: function removeClass(className) {
  3735. return _this.root_.classList.remove(className);
  3736. },
  3737. reverseButtons: function reverseButtons() {
  3738. _this.buttons_.reverse();
  3739. _this.buttons_.forEach(function (button) {
  3740. button.parentElement.appendChild(button);
  3741. });
  3742. },
  3743. trapFocus: function trapFocus() {
  3744. return _this.focusTrap_.trapFocus();
  3745. }
  3746. };
  3747. return new foundation_1.MDCDialogFoundation(adapter);
  3748. };
  3749. MDCDialog.prototype.getInitialFocusEl_ = function () {
  3750. return document.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]");
  3751. };
  3752. return MDCDialog;
  3753. }(component_1.MDCComponent);
  3754. exports.MDCDialog = MDCDialog;
  3755. /***/ }),
  3756. /***/ "./packages/mdc-dialog/constants.ts":
  3757. /*!******************************************!*\
  3758. !*** ./packages/mdc-dialog/constants.ts ***!
  3759. \******************************************/
  3760. /*! no static exports found */
  3761. /***/ (function(module, exports, __webpack_require__) {
  3762. "use strict";
  3763. /**
  3764. * @license
  3765. * Copyright 2016 Google Inc.
  3766. *
  3767. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3768. * of this software and associated documentation files (the "Software"), to deal
  3769. * in the Software without restriction, including without limitation the rights
  3770. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3771. * copies of the Software, and to permit persons to whom the Software is
  3772. * furnished to do so, subject to the following conditions:
  3773. *
  3774. * The above copyright notice and this permission notice shall be included in
  3775. * all copies or substantial portions of the Software.
  3776. *
  3777. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3778. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3779. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3780. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3781. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3782. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3783. * THE SOFTWARE.
  3784. */
  3785. Object.defineProperty(exports, "__esModule", { value: true });
  3786. exports.cssClasses = {
  3787. CLOSING: 'mdc-dialog--closing',
  3788. OPEN: 'mdc-dialog--open',
  3789. OPENING: 'mdc-dialog--opening',
  3790. SCROLLABLE: 'mdc-dialog--scrollable',
  3791. SCROLL_LOCK: 'mdc-dialog-scroll-lock',
  3792. STACKED: 'mdc-dialog--stacked'
  3793. };
  3794. exports.strings = {
  3795. ACTION_ATTRIBUTE: 'data-mdc-dialog-action',
  3796. BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',
  3797. BUTTON_SELECTOR: '.mdc-dialog__button',
  3798. CLOSED_EVENT: 'MDCDialog:closed',
  3799. CLOSE_ACTION: 'close',
  3800. CLOSING_EVENT: 'MDCDialog:closing',
  3801. CONTAINER_SELECTOR: '.mdc-dialog__container',
  3802. CONTENT_SELECTOR: '.mdc-dialog__content',
  3803. DESTROY_ACTION: 'destroy',
  3804. INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',
  3805. OPENED_EVENT: 'MDCDialog:opened',
  3806. OPENING_EVENT: 'MDCDialog:opening',
  3807. SCRIM_SELECTOR: '.mdc-dialog__scrim',
  3808. SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item'].join(', '),
  3809. SURFACE_SELECTOR: '.mdc-dialog__surface'
  3810. };
  3811. exports.numbers = {
  3812. DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
  3813. DIALOG_ANIMATION_OPEN_TIME_MS: 150
  3814. };
  3815. /***/ }),
  3816. /***/ "./packages/mdc-dialog/foundation.ts":
  3817. /*!*******************************************!*\
  3818. !*** ./packages/mdc-dialog/foundation.ts ***!
  3819. \*******************************************/
  3820. /*! no static exports found */
  3821. /***/ (function(module, exports, __webpack_require__) {
  3822. "use strict";
  3823. /**
  3824. * @license
  3825. * Copyright 2017 Google Inc.
  3826. *
  3827. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3828. * of this software and associated documentation files (the "Software"), to deal
  3829. * in the Software without restriction, including without limitation the rights
  3830. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3831. * copies of the Software, and to permit persons to whom the Software is
  3832. * furnished to do so, subject to the following conditions:
  3833. *
  3834. * The above copyright notice and this permission notice shall be included in
  3835. * all copies or substantial portions of the Software.
  3836. *
  3837. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3838. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3839. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3840. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3841. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3842. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3843. * THE SOFTWARE.
  3844. */
  3845. var __extends = this && this.__extends || function () {
  3846. var _extendStatics = function extendStatics(d, b) {
  3847. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3848. d.__proto__ = b;
  3849. } || function (d, b) {
  3850. for (var p in b) {
  3851. if (b.hasOwnProperty(p)) d[p] = b[p];
  3852. }
  3853. };
  3854. return _extendStatics(d, b);
  3855. };
  3856. return function (d, b) {
  3857. _extendStatics(d, b);
  3858. function __() {
  3859. this.constructor = d;
  3860. }
  3861. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3862. };
  3863. }();
  3864. var __assign = this && this.__assign || function () {
  3865. __assign = Object.assign || function (t) {
  3866. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3867. s = arguments[i];
  3868. for (var p in s) {
  3869. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3870. }
  3871. }
  3872. return t;
  3873. };
  3874. return __assign.apply(this, arguments);
  3875. };
  3876. Object.defineProperty(exports, "__esModule", { value: true });
  3877. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  3878. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts");
  3879. var MDCDialogFoundation = /** @class */function (_super) {
  3880. __extends(MDCDialogFoundation, _super);
  3881. function MDCDialogFoundation(adapter) {
  3882. var _this = _super.call(this, __assign({}, MDCDialogFoundation.defaultAdapter, adapter)) || this;
  3883. _this.isOpen_ = false;
  3884. _this.animationFrame_ = 0;
  3885. _this.animationTimer_ = 0;
  3886. _this.layoutFrame_ = 0;
  3887. _this.escapeKeyAction_ = constants_1.strings.CLOSE_ACTION;
  3888. _this.scrimClickAction_ = constants_1.strings.CLOSE_ACTION;
  3889. _this.autoStackButtons_ = true;
  3890. _this.areButtonsStacked_ = false;
  3891. return _this;
  3892. }
  3893. Object.defineProperty(MDCDialogFoundation, "cssClasses", {
  3894. get: function get() {
  3895. return constants_1.cssClasses;
  3896. },
  3897. enumerable: true,
  3898. configurable: true
  3899. });
  3900. Object.defineProperty(MDCDialogFoundation, "strings", {
  3901. get: function get() {
  3902. return constants_1.strings;
  3903. },
  3904. enumerable: true,
  3905. configurable: true
  3906. });
  3907. Object.defineProperty(MDCDialogFoundation, "numbers", {
  3908. get: function get() {
  3909. return constants_1.numbers;
  3910. },
  3911. enumerable: true,
  3912. configurable: true
  3913. });
  3914. Object.defineProperty(MDCDialogFoundation, "defaultAdapter", {
  3915. get: function get() {
  3916. return {
  3917. addBodyClass: function addBodyClass() {
  3918. return undefined;
  3919. },
  3920. addClass: function addClass() {
  3921. return undefined;
  3922. },
  3923. areButtonsStacked: function areButtonsStacked() {
  3924. return false;
  3925. },
  3926. clickDefaultButton: function clickDefaultButton() {
  3927. return undefined;
  3928. },
  3929. eventTargetMatches: function eventTargetMatches() {
  3930. return false;
  3931. },
  3932. getActionFromEvent: function getActionFromEvent() {
  3933. return '';
  3934. },
  3935. getInitialFocusEl: function getInitialFocusEl() {
  3936. return null;
  3937. },
  3938. hasClass: function hasClass() {
  3939. return false;
  3940. },
  3941. isContentScrollable: function isContentScrollable() {
  3942. return false;
  3943. },
  3944. notifyClosed: function notifyClosed() {
  3945. return undefined;
  3946. },
  3947. notifyClosing: function notifyClosing() {
  3948. return undefined;
  3949. },
  3950. notifyOpened: function notifyOpened() {
  3951. return undefined;
  3952. },
  3953. notifyOpening: function notifyOpening() {
  3954. return undefined;
  3955. },
  3956. releaseFocus: function releaseFocus() {
  3957. return undefined;
  3958. },
  3959. removeBodyClass: function removeBodyClass() {
  3960. return undefined;
  3961. },
  3962. removeClass: function removeClass() {
  3963. return undefined;
  3964. },
  3965. reverseButtons: function reverseButtons() {
  3966. return undefined;
  3967. },
  3968. trapFocus: function trapFocus() {
  3969. return undefined;
  3970. }
  3971. };
  3972. },
  3973. enumerable: true,
  3974. configurable: true
  3975. });
  3976. MDCDialogFoundation.prototype.init = function () {
  3977. if (this.adapter_.hasClass(constants_1.cssClasses.STACKED)) {
  3978. this.setAutoStackButtons(false);
  3979. }
  3980. };
  3981. MDCDialogFoundation.prototype.destroy = function () {
  3982. if (this.isOpen_) {
  3983. this.close(constants_1.strings.DESTROY_ACTION);
  3984. }
  3985. if (this.animationTimer_) {
  3986. clearTimeout(this.animationTimer_);
  3987. this.handleAnimationTimerEnd_();
  3988. }
  3989. if (this.layoutFrame_) {
  3990. cancelAnimationFrame(this.layoutFrame_);
  3991. this.layoutFrame_ = 0;
  3992. }
  3993. };
  3994. MDCDialogFoundation.prototype.open = function () {
  3995. var _this = this;
  3996. this.isOpen_ = true;
  3997. this.adapter_.notifyOpening();
  3998. this.adapter_.addClass(constants_1.cssClasses.OPENING);
  3999. // Wait a frame once display is no longer "none", to establish basis for animation
  4000. this.runNextAnimationFrame_(function () {
  4001. _this.adapter_.addClass(constants_1.cssClasses.OPEN);
  4002. _this.adapter_.addBodyClass(constants_1.cssClasses.SCROLL_LOCK);
  4003. _this.layout();
  4004. _this.animationTimer_ = setTimeout(function () {
  4005. _this.handleAnimationTimerEnd_();
  4006. _this.adapter_.trapFocus(_this.adapter_.getInitialFocusEl());
  4007. _this.adapter_.notifyOpened();
  4008. }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS);
  4009. });
  4010. };
  4011. MDCDialogFoundation.prototype.close = function (action) {
  4012. var _this = this;
  4013. if (action === void 0) {
  4014. action = '';
  4015. }
  4016. if (!this.isOpen_) {
  4017. // Avoid redundant close calls (and events), e.g. from keydown on elements that inherently emit click
  4018. return;
  4019. }
  4020. this.isOpen_ = false;
  4021. this.adapter_.notifyClosing(action);
  4022. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  4023. this.adapter_.removeClass(constants_1.cssClasses.OPEN);
  4024. this.adapter_.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK);
  4025. cancelAnimationFrame(this.animationFrame_);
  4026. this.animationFrame_ = 0;
  4027. clearTimeout(this.animationTimer_);
  4028. this.animationTimer_ = setTimeout(function () {
  4029. _this.adapter_.releaseFocus();
  4030. _this.handleAnimationTimerEnd_();
  4031. _this.adapter_.notifyClosed(action);
  4032. }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);
  4033. };
  4034. MDCDialogFoundation.prototype.isOpen = function () {
  4035. return this.isOpen_;
  4036. };
  4037. MDCDialogFoundation.prototype.getEscapeKeyAction = function () {
  4038. return this.escapeKeyAction_;
  4039. };
  4040. MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {
  4041. this.escapeKeyAction_ = action;
  4042. };
  4043. MDCDialogFoundation.prototype.getScrimClickAction = function () {
  4044. return this.scrimClickAction_;
  4045. };
  4046. MDCDialogFoundation.prototype.setScrimClickAction = function (action) {
  4047. this.scrimClickAction_ = action;
  4048. };
  4049. MDCDialogFoundation.prototype.getAutoStackButtons = function () {
  4050. return this.autoStackButtons_;
  4051. };
  4052. MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {
  4053. this.autoStackButtons_ = autoStack;
  4054. };
  4055. MDCDialogFoundation.prototype.layout = function () {
  4056. var _this = this;
  4057. if (this.layoutFrame_) {
  4058. cancelAnimationFrame(this.layoutFrame_);
  4059. }
  4060. this.layoutFrame_ = requestAnimationFrame(function () {
  4061. _this.layoutInternal_();
  4062. _this.layoutFrame_ = 0;
  4063. });
  4064. };
  4065. /** Handles click on the dialog root element. */
  4066. MDCDialogFoundation.prototype.handleClick = function (evt) {
  4067. var isScrim = this.adapter_.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR);
  4068. // Check for scrim click first since it doesn't require querying ancestors.
  4069. if (isScrim && this.scrimClickAction_ !== '') {
  4070. this.close(this.scrimClickAction_);
  4071. } else {
  4072. var action = this.adapter_.getActionFromEvent(evt);
  4073. if (action) {
  4074. this.close(action);
  4075. }
  4076. }
  4077. };
  4078. /** Handles keydown on the dialog root element. */
  4079. MDCDialogFoundation.prototype.handleKeydown = function (evt) {
  4080. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  4081. if (!isEnter) {
  4082. return;
  4083. }
  4084. var action = this.adapter_.getActionFromEvent(evt);
  4085. if (action) {
  4086. // Action button callback is handled in `handleClick`,
  4087. // since space/enter keydowns on buttons trigger click events.
  4088. return;
  4089. }
  4090. var isDefault = !this.adapter_.eventTargetMatches(evt.target, constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR);
  4091. if (isEnter && isDefault) {
  4092. this.adapter_.clickDefaultButton();
  4093. }
  4094. };
  4095. /** Handles keydown on the document. */
  4096. MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {
  4097. var isEscape = evt.key === 'Escape' || evt.keyCode === 27;
  4098. if (isEscape && this.escapeKeyAction_ !== '') {
  4099. this.close(this.escapeKeyAction_);
  4100. }
  4101. };
  4102. MDCDialogFoundation.prototype.layoutInternal_ = function () {
  4103. if (this.autoStackButtons_) {
  4104. this.detectStackedButtons_();
  4105. }
  4106. this.detectScrollableContent_();
  4107. };
  4108. MDCDialogFoundation.prototype.handleAnimationTimerEnd_ = function () {
  4109. this.animationTimer_ = 0;
  4110. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  4111. this.adapter_.removeClass(constants_1.cssClasses.CLOSING);
  4112. };
  4113. /**
  4114. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  4115. */
  4116. MDCDialogFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  4117. var _this = this;
  4118. cancelAnimationFrame(this.animationFrame_);
  4119. this.animationFrame_ = requestAnimationFrame(function () {
  4120. _this.animationFrame_ = 0;
  4121. clearTimeout(_this.animationTimer_);
  4122. _this.animationTimer_ = setTimeout(callback, 0);
  4123. });
  4124. };
  4125. MDCDialogFoundation.prototype.detectStackedButtons_ = function () {
  4126. // Remove the class first to let us measure the buttons' natural positions.
  4127. this.adapter_.removeClass(constants_1.cssClasses.STACKED);
  4128. var areButtonsStacked = this.adapter_.areButtonsStacked();
  4129. if (areButtonsStacked) {
  4130. this.adapter_.addClass(constants_1.cssClasses.STACKED);
  4131. }
  4132. if (areButtonsStacked !== this.areButtonsStacked_) {
  4133. this.adapter_.reverseButtons();
  4134. this.areButtonsStacked_ = areButtonsStacked;
  4135. }
  4136. };
  4137. MDCDialogFoundation.prototype.detectScrollableContent_ = function () {
  4138. // Remove the class first to let us measure the natural height of the content.
  4139. this.adapter_.removeClass(constants_1.cssClasses.SCROLLABLE);
  4140. if (this.adapter_.isContentScrollable()) {
  4141. this.adapter_.addClass(constants_1.cssClasses.SCROLLABLE);
  4142. }
  4143. };
  4144. return MDCDialogFoundation;
  4145. }(foundation_1.MDCFoundation);
  4146. exports.MDCDialogFoundation = MDCDialogFoundation;
  4147. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4148. exports.default = MDCDialogFoundation;
  4149. /***/ }),
  4150. /***/ "./packages/mdc-dialog/index.ts":
  4151. /*!**************************************!*\
  4152. !*** ./packages/mdc-dialog/index.ts ***!
  4153. \**************************************/
  4154. /*! no static exports found */
  4155. /***/ (function(module, exports, __webpack_require__) {
  4156. "use strict";
  4157. /**
  4158. * @license
  4159. * Copyright 2019 Google Inc.
  4160. *
  4161. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4162. * of this software and associated documentation files (the "Software"), to deal
  4163. * in the Software without restriction, including without limitation the rights
  4164. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4165. * copies of the Software, and to permit persons to whom the Software is
  4166. * furnished to do so, subject to the following conditions:
  4167. *
  4168. * The above copyright notice and this permission notice shall be included in
  4169. * all copies or substantial portions of the Software.
  4170. *
  4171. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4172. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4173. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4174. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4175. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4176. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4177. * THE SOFTWARE.
  4178. */
  4179. function __export(m) {
  4180. for (var p in m) {
  4181. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  4182. }
  4183. }
  4184. var __importStar = this && this.__importStar || function (mod) {
  4185. if (mod && mod.__esModule) return mod;
  4186. var result = {};
  4187. if (mod != null) for (var k in mod) {
  4188. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  4189. }result["default"] = mod;
  4190. return result;
  4191. };
  4192. Object.defineProperty(exports, "__esModule", { value: true });
  4193. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts"));
  4194. exports.util = util;
  4195. __export(__webpack_require__(/*! ./component */ "./packages/mdc-dialog/component.ts"));
  4196. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"));
  4197. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"));
  4198. /***/ }),
  4199. /***/ "./packages/mdc-dialog/util.ts":
  4200. /*!*************************************!*\
  4201. !*** ./packages/mdc-dialog/util.ts ***!
  4202. \*************************************/
  4203. /*! no static exports found */
  4204. /***/ (function(module, exports, __webpack_require__) {
  4205. "use strict";
  4206. /**
  4207. * @license
  4208. * Copyright 2016 Google Inc.
  4209. *
  4210. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4211. * of this software and associated documentation files (the "Software"), to deal
  4212. * in the Software without restriction, including without limitation the rights
  4213. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4214. * copies of the Software, and to permit persons to whom the Software is
  4215. * furnished to do so, subject to the following conditions:
  4216. *
  4217. * The above copyright notice and this permission notice shall be included in
  4218. * all copies or substantial portions of the Software.
  4219. *
  4220. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4221. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4222. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4223. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4224. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4225. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4226. * THE SOFTWARE.
  4227. */
  4228. Object.defineProperty(exports, "__esModule", { value: true });
  4229. function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) {
  4230. return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl });
  4231. }
  4232. exports.createFocusTrapInstance = createFocusTrapInstance;
  4233. function isScrollable(el) {
  4234. return el ? el.scrollHeight > el.offsetHeight : false;
  4235. }
  4236. exports.isScrollable = isScrollable;
  4237. function areTopsMisaligned(els) {
  4238. var tops = new Set();
  4239. [].forEach.call(els, function (el) {
  4240. return tops.add(el.offsetTop);
  4241. });
  4242. return tops.size > 1;
  4243. }
  4244. exports.areTopsMisaligned = areTopsMisaligned;
  4245. /***/ }),
  4246. /***/ "./packages/mdc-dom/announce.ts":
  4247. /*!**************************************!*\
  4248. !*** ./packages/mdc-dom/announce.ts ***!
  4249. \**************************************/
  4250. /*! no static exports found */
  4251. /***/ (function(module, exports, __webpack_require__) {
  4252. "use strict";
  4253. /**
  4254. * @license
  4255. * Copyright 2020 Google Inc.
  4256. *
  4257. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4258. * of this software and associated documentation files (the "Software"), to deal
  4259. * in the Software without restriction, including without limitation the rights
  4260. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4261. * copies of the Software, and to permit persons to whom the Software is
  4262. * furnished to do so, subject to the following conditions:
  4263. *
  4264. * The above copyright notice and this permission notice shall be included in
  4265. * all copies or substantial portions of the Software.
  4266. *
  4267. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4268. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4269. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4270. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4271. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4272. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4273. * THE SOFTWARE.
  4274. */
  4275. Object.defineProperty(exports, "__esModule", { value: true });
  4276. /**
  4277. * Priorities for the announce function
  4278. */
  4279. var AnnouncerPriority;
  4280. (function (AnnouncerPriority) {
  4281. AnnouncerPriority["POLITE"] = "polite";
  4282. AnnouncerPriority["ASSERTIVE"] = "assertive";
  4283. })(AnnouncerPriority = exports.AnnouncerPriority || (exports.AnnouncerPriority = {}));
  4284. /**
  4285. * Announces the given message with optional priority, defaulting to "polite"
  4286. */
  4287. function announce(message, priority) {
  4288. Announcer.getInstance().say(message, priority);
  4289. }
  4290. exports.announce = announce;
  4291. var Announcer = /** @class */function () {
  4292. // Constructor made private to ensure only the singleton is used
  4293. function Announcer() {
  4294. this.liveRegions = new Map();
  4295. }
  4296. Announcer.getInstance = function () {
  4297. if (!Announcer.instance) {
  4298. Announcer.instance = new Announcer();
  4299. }
  4300. return Announcer.instance;
  4301. };
  4302. Announcer.prototype.say = function (message, priority) {
  4303. if (priority === void 0) {
  4304. priority = AnnouncerPriority.POLITE;
  4305. }
  4306. var liveRegion = this.getLiveRegion(priority);
  4307. // Reset the region to pick up the message, even if the message is the
  4308. // exact same as before.
  4309. liveRegion.textContent = '';
  4310. // Timeout is necessary for screen readers like NVDA and VoiceOver.
  4311. setTimeout(function () {
  4312. liveRegion.textContent = message;
  4313. }, 1);
  4314. };
  4315. Announcer.prototype.getLiveRegion = function (priority) {
  4316. var existingLiveRegion = this.liveRegions.get(priority);
  4317. if (existingLiveRegion && document.body.contains(existingLiveRegion)) {
  4318. return existingLiveRegion;
  4319. }
  4320. var liveRegion = this.createLiveRegion(priority);
  4321. this.liveRegions.set(priority, liveRegion);
  4322. return liveRegion;
  4323. };
  4324. Announcer.prototype.createLiveRegion = function (priority) {
  4325. var el = document.createElement('div');
  4326. el.style.position = 'absolute';
  4327. el.style.top = '-9999px';
  4328. el.style.left = '-9999px';
  4329. el.style.height = '1px';
  4330. el.style.overflow = 'hidden';
  4331. el.setAttribute('aria-atomic', 'true');
  4332. el.setAttribute('aria-live', priority);
  4333. document.body.appendChild(el);
  4334. return el;
  4335. };
  4336. return Announcer;
  4337. }();
  4338. /***/ }),
  4339. /***/ "./packages/mdc-dom/events.ts":
  4340. /*!************************************!*\
  4341. !*** ./packages/mdc-dom/events.ts ***!
  4342. \************************************/
  4343. /*! no static exports found */
  4344. /***/ (function(module, exports, __webpack_require__) {
  4345. "use strict";
  4346. /**
  4347. * @license
  4348. * Copyright 2019 Google Inc.
  4349. *
  4350. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4351. * of this software and associated documentation files (the "Software"), to deal
  4352. * in the Software without restriction, including without limitation the rights
  4353. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4354. * copies of the Software, and to permit persons to whom the Software is
  4355. * furnished to do so, subject to the following conditions:
  4356. *
  4357. * The above copyright notice and this permission notice shall be included in
  4358. * all copies or substantial portions of the Software.
  4359. *
  4360. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4361. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4362. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4363. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4364. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4365. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4366. * THE SOFTWARE.
  4367. */
  4368. Object.defineProperty(exports, "__esModule", { value: true });
  4369. /**
  4370. * Determine whether the current browser supports passive event listeners, and
  4371. * if so, use them.
  4372. */
  4373. function applyPassive(globalObj) {
  4374. if (globalObj === void 0) {
  4375. globalObj = window;
  4376. }
  4377. return supportsPassiveOption(globalObj) ? { passive: true } : false;
  4378. }
  4379. exports.applyPassive = applyPassive;
  4380. function supportsPassiveOption(globalObj) {
  4381. if (globalObj === void 0) {
  4382. globalObj = window;
  4383. }
  4384. // See
  4385. // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  4386. var passiveSupported = false;
  4387. try {
  4388. var options = {
  4389. // This function will be called when the browser
  4390. // attempts to access the passive property.
  4391. get passive() {
  4392. passiveSupported = true;
  4393. return false;
  4394. }
  4395. };
  4396. var handler = function handler() {};
  4397. globalObj.document.addEventListener('test', handler, options);
  4398. globalObj.document.removeEventListener('test', handler, options);
  4399. } catch (err) {
  4400. passiveSupported = false;
  4401. }
  4402. return passiveSupported;
  4403. }
  4404. /***/ }),
  4405. /***/ "./packages/mdc-dom/focus-trap.ts":
  4406. /*!****************************************!*\
  4407. !*** ./packages/mdc-dom/focus-trap.ts ***!
  4408. \****************************************/
  4409. /*! no static exports found */
  4410. /***/ (function(module, exports, __webpack_require__) {
  4411. "use strict";
  4412. /**
  4413. * @license
  4414. * Copyright 2020 Google Inc.
  4415. *
  4416. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4417. * of this software and associated documentation files (the "Software"), to deal
  4418. * in the Software without restriction, including without limitation the rights
  4419. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4420. * copies of the Software, and to permit persons to whom the Software is
  4421. * furnished to do so, subject to the following conditions:
  4422. *
  4423. * The above copyright notice and this permission notice shall be included in
  4424. * all copies or substantial portions of the Software.
  4425. *
  4426. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4427. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4428. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4429. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4430. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4431. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4432. * THE SOFTWARE.
  4433. */
  4434. Object.defineProperty(exports, "__esModule", { value: true });
  4435. var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel';
  4436. /**
  4437. * Utility to trap focus in a given root element, e.g. for modal components such
  4438. * as dialogs. The root should have at least one focusable child element,
  4439. * for setting initial focus when trapping focus.
  4440. * Also tracks the previously focused element, and restores focus to that
  4441. * element when releasing focus.
  4442. */
  4443. var FocusTrap = /** @class */function () {
  4444. function FocusTrap(root, options) {
  4445. if (options === void 0) {
  4446. options = {};
  4447. }
  4448. this.root = root;
  4449. this.options = options;
  4450. // Previously focused element before trapping focus.
  4451. this.elFocusedBeforeTrapFocus = null;
  4452. }
  4453. /**
  4454. * Traps focus in `root`. Also focuses on either `initialFocusEl` if set;
  4455. * otherwises sets initial focus to the first focusable child element.
  4456. */
  4457. FocusTrap.prototype.trapFocus = function () {
  4458. var focusableEls = this.getFocusableElements(this.root);
  4459. if (focusableEls.length === 0) {
  4460. throw new Error('FocusTrap: Element must have at least one focusable child.');
  4461. }
  4462. this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
  4463. this.wrapTabFocus(this.root, focusableEls);
  4464. if (!this.options.skipInitialFocus) {
  4465. this.focusInitialElement(focusableEls, this.options.initialFocusEl);
  4466. }
  4467. };
  4468. /**
  4469. * Releases focus from `root`. Also restores focus to the previously focused
  4470. * element.
  4471. */
  4472. FocusTrap.prototype.releaseFocus = function () {
  4473. [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) {
  4474. sentinelEl.parentElement.removeChild(sentinelEl);
  4475. });
  4476. if (this.elFocusedBeforeTrapFocus) {
  4477. this.elFocusedBeforeTrapFocus.focus();
  4478. }
  4479. };
  4480. /**
  4481. * Wraps tab focus within `el` by adding two hidden sentinel divs which are
  4482. * used to mark the beginning and the end of the tabbable region. When
  4483. * focused, these sentinel elements redirect focus to the first/last
  4484. * children elements of the tabbable region, ensuring that focus is trapped
  4485. * within that region.
  4486. */
  4487. FocusTrap.prototype.wrapTabFocus = function (el, focusableEls) {
  4488. var sentinelStart = this.createSentinel();
  4489. var sentinelEnd = this.createSentinel();
  4490. sentinelStart.addEventListener('focus', function () {
  4491. if (focusableEls.length > 0) {
  4492. focusableEls[focusableEls.length - 1].focus();
  4493. }
  4494. });
  4495. sentinelEnd.addEventListener('focus', function () {
  4496. if (focusableEls.length > 0) {
  4497. focusableEls[0].focus();
  4498. }
  4499. });
  4500. el.insertBefore(sentinelStart, el.children[0]);
  4501. el.appendChild(sentinelEnd);
  4502. };
  4503. /**
  4504. * Focuses on `initialFocusEl` if defined and a child of the root element.
  4505. * Otherwise, focuses on the first focusable child element of the root.
  4506. */
  4507. FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) {
  4508. var focusIndex = 0;
  4509. if (initialFocusEl) {
  4510. focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0);
  4511. }
  4512. focusableEls[focusIndex].focus();
  4513. };
  4514. FocusTrap.prototype.getFocusableElements = function (root) {
  4515. var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button'));
  4516. return focusableEls.filter(function (el) {
  4517. var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true';
  4518. var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden;
  4519. var isProgrammaticallyHidden = false;
  4520. if (isTabbableAndVisible) {
  4521. var style = getComputedStyle(el);
  4522. isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden';
  4523. }
  4524. return isTabbableAndVisible && !isProgrammaticallyHidden;
  4525. });
  4526. };
  4527. FocusTrap.prototype.createSentinel = function () {
  4528. var sentinel = document.createElement('div');
  4529. sentinel.setAttribute('tabindex', '0');
  4530. // Don't announce in screen readers.
  4531. sentinel.setAttribute('aria-hidden', 'true');
  4532. sentinel.classList.add(FOCUS_SENTINEL_CLASS);
  4533. return sentinel;
  4534. };
  4535. return FocusTrap;
  4536. }();
  4537. exports.FocusTrap = FocusTrap;
  4538. /***/ }),
  4539. /***/ "./packages/mdc-dom/index.ts":
  4540. /*!***********************************!*\
  4541. !*** ./packages/mdc-dom/index.ts ***!
  4542. \***********************************/
  4543. /*! no static exports found */
  4544. /***/ (function(module, exports, __webpack_require__) {
  4545. "use strict";
  4546. /**
  4547. * @license
  4548. * Copyright 2018 Google Inc.
  4549. *
  4550. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4551. * of this software and associated documentation files (the "Software"), to deal
  4552. * in the Software without restriction, including without limitation the rights
  4553. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4554. * copies of the Software, and to permit persons to whom the Software is
  4555. * furnished to do so, subject to the following conditions:
  4556. *
  4557. * The above copyright notice and this permission notice shall be included in
  4558. * all copies or substantial portions of the Software.
  4559. *
  4560. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4561. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4562. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4563. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4564. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4565. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4566. * THE SOFTWARE.
  4567. */
  4568. var __importStar = this && this.__importStar || function (mod) {
  4569. if (mod && mod.__esModule) return mod;
  4570. var result = {};
  4571. if (mod != null) for (var k in mod) {
  4572. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  4573. }result["default"] = mod;
  4574. return result;
  4575. };
  4576. Object.defineProperty(exports, "__esModule", { value: true });
  4577. var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts"));
  4578. exports.events = events;
  4579. var focusTrap = __importStar(__webpack_require__(/*! ./focus-trap */ "./packages/mdc-dom/focus-trap.ts"));
  4580. exports.focusTrap = focusTrap;
  4581. var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  4582. exports.ponyfill = ponyfill;
  4583. /***/ }),
  4584. /***/ "./packages/mdc-dom/ponyfill.ts":
  4585. /*!**************************************!*\
  4586. !*** ./packages/mdc-dom/ponyfill.ts ***!
  4587. \**************************************/
  4588. /*! no static exports found */
  4589. /***/ (function(module, exports, __webpack_require__) {
  4590. "use strict";
  4591. /**
  4592. * @license
  4593. * Copyright 2018 Google Inc.
  4594. *
  4595. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4596. * of this software and associated documentation files (the "Software"), to deal
  4597. * in the Software without restriction, including without limitation the rights
  4598. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4599. * copies of the Software, and to permit persons to whom the Software is
  4600. * furnished to do so, subject to the following conditions:
  4601. *
  4602. * The above copyright notice and this permission notice shall be included in
  4603. * all copies or substantial portions of the Software.
  4604. *
  4605. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4606. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4607. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4608. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4609. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4610. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4611. * THE SOFTWARE.
  4612. */
  4613. Object.defineProperty(exports, "__esModule", { value: true });
  4614. /**
  4615. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
  4616. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
  4617. */
  4618. function closest(element, selector) {
  4619. if (element.closest) {
  4620. return element.closest(selector);
  4621. }
  4622. var el = element;
  4623. while (el) {
  4624. if (matches(el, selector)) {
  4625. return el;
  4626. }
  4627. el = el.parentElement;
  4628. }
  4629. return null;
  4630. }
  4631. exports.closest = closest;
  4632. function matches(element, selector) {
  4633. var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
  4634. return nativeMatches.call(element, selector);
  4635. }
  4636. exports.matches = matches;
  4637. /**
  4638. * Used to compute the estimated scroll width of elements. When an element is
  4639. * hidden due to display: none; being applied to a parent element, the width is
  4640. * returned as 0. However, the element will have a true width once no longer
  4641. * inside a display: none context. This method computes an estimated width when
  4642. * the element is hidden or returns the true width when the element is visble.
  4643. * @param {Element} element the element whose width to estimate
  4644. */
  4645. function estimateScrollWidth(element) {
  4646. // Check the offsetParent. If the element inherits display: none from any
  4647. // parent, the offsetParent property will be null (see
  4648. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
  4649. // This check ensures we only clone the node when necessary.
  4650. var htmlEl = element;
  4651. if (htmlEl.offsetParent !== null) {
  4652. return htmlEl.scrollWidth;
  4653. }
  4654. var clone = htmlEl.cloneNode(true);
  4655. clone.style.setProperty('position', 'absolute');
  4656. clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
  4657. document.documentElement.appendChild(clone);
  4658. var scrollWidth = clone.scrollWidth;
  4659. document.documentElement.removeChild(clone);
  4660. return scrollWidth;
  4661. }
  4662. exports.estimateScrollWidth = estimateScrollWidth;
  4663. /***/ }),
  4664. /***/ "./packages/mdc-drawer/component.ts":
  4665. /*!******************************************!*\
  4666. !*** ./packages/mdc-drawer/component.ts ***!
  4667. \******************************************/
  4668. /*! no static exports found */
  4669. /***/ (function(module, exports, __webpack_require__) {
  4670. "use strict";
  4671. /**
  4672. * @license
  4673. * Copyright 2016 Google Inc.
  4674. *
  4675. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4676. * of this software and associated documentation files (the "Software"), to deal
  4677. * in the Software without restriction, including without limitation the rights
  4678. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4679. * copies of the Software, and to permit persons to whom the Software is
  4680. * furnished to do so, subject to the following conditions:
  4681. *
  4682. * The above copyright notice and this permission notice shall be included in
  4683. * all copies or substantial portions of the Software.
  4684. *
  4685. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4686. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4687. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4688. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4689. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4690. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4691. * THE SOFTWARE.
  4692. */
  4693. var __extends = this && this.__extends || function () {
  4694. var _extendStatics = function extendStatics(d, b) {
  4695. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4696. d.__proto__ = b;
  4697. } || function (d, b) {
  4698. for (var p in b) {
  4699. if (b.hasOwnProperty(p)) d[p] = b[p];
  4700. }
  4701. };
  4702. return _extendStatics(d, b);
  4703. };
  4704. return function (d, b) {
  4705. _extendStatics(d, b);
  4706. function __() {
  4707. this.constructor = d;
  4708. }
  4709. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4710. };
  4711. }();
  4712. var __importStar = this && this.__importStar || function (mod) {
  4713. if (mod && mod.__esModule) return mod;
  4714. var result = {};
  4715. if (mod != null) for (var k in mod) {
  4716. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  4717. }result["default"] = mod;
  4718. return result;
  4719. };
  4720. Object.defineProperty(exports, "__esModule", { value: true });
  4721. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4722. var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts");
  4723. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  4724. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  4725. var foundation_2 = __webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts");
  4726. var foundation_3 = __webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts");
  4727. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
  4728. var cssClasses = foundation_2.MDCDismissibleDrawerFoundation.cssClasses,
  4729. strings = foundation_2.MDCDismissibleDrawerFoundation.strings;
  4730. /**
  4731. * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed.
  4732. * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened.
  4733. */
  4734. var MDCDrawer = /** @class */function (_super) {
  4735. __extends(MDCDrawer, _super);
  4736. function MDCDrawer() {
  4737. return _super !== null && _super.apply(this, arguments) || this;
  4738. }
  4739. MDCDrawer.attachTo = function (root) {
  4740. return new MDCDrawer(root);
  4741. };
  4742. Object.defineProperty(MDCDrawer.prototype, "open", {
  4743. /**
  4744. * @return boolean Proxies to the foundation's `open`/`close` methods.
  4745. * Also returns true if drawer is in the open position.
  4746. */
  4747. get: function get() {
  4748. return this.foundation_.isOpen();
  4749. },
  4750. /**
  4751. * Toggles the drawer open and closed.
  4752. */
  4753. set: function set(isOpen) {
  4754. if (isOpen) {
  4755. this.foundation_.open();
  4756. } else {
  4757. this.foundation_.close();
  4758. }
  4759. },
  4760. enumerable: true,
  4761. configurable: true
  4762. });
  4763. Object.defineProperty(MDCDrawer.prototype, "list", {
  4764. get: function get() {
  4765. return this.list_;
  4766. },
  4767. enumerable: true,
  4768. configurable: true
  4769. });
  4770. MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) {
  4771. if (focusTrapFactory === void 0) {
  4772. focusTrapFactory = function focusTrapFactory(el) {
  4773. return new focus_trap_1.FocusTrap(el);
  4774. };
  4775. }
  4776. if (listFactory === void 0) {
  4777. listFactory = function listFactory(el) {
  4778. return new component_2.MDCList(el);
  4779. };
  4780. }
  4781. var listEl = this.root_.querySelector("." + foundation_1.MDCListFoundation.cssClasses.ROOT);
  4782. if (listEl) {
  4783. this.list_ = listFactory(listEl);
  4784. this.list_.wrapFocus = true;
  4785. }
  4786. this.focusTrapFactory_ = focusTrapFactory;
  4787. };
  4788. MDCDrawer.prototype.initialSyncWithDOM = function () {
  4789. var _this = this;
  4790. var MODAL = cssClasses.MODAL;
  4791. var SCRIM_SELECTOR = strings.SCRIM_SELECTOR;
  4792. this.scrim_ = this.root_.parentNode.querySelector(SCRIM_SELECTOR);
  4793. if (this.scrim_ && this.root_.classList.contains(MODAL)) {
  4794. this.handleScrimClick_ = function () {
  4795. return _this.foundation_.handleScrimClick();
  4796. };
  4797. this.scrim_.addEventListener('click', this.handleScrimClick_);
  4798. this.focusTrap_ = util.createFocusTrapInstance(this.root_, this.focusTrapFactory_);
  4799. }
  4800. this.handleKeydown_ = function (evt) {
  4801. return _this.foundation_.handleKeydown(evt);
  4802. };
  4803. this.handleTransitionEnd_ = function (evt) {
  4804. return _this.foundation_.handleTransitionEnd(evt);
  4805. };
  4806. this.listen('keydown', this.handleKeydown_);
  4807. this.listen('transitionend', this.handleTransitionEnd_);
  4808. };
  4809. MDCDrawer.prototype.destroy = function () {
  4810. this.unlisten('keydown', this.handleKeydown_);
  4811. this.unlisten('transitionend', this.handleTransitionEnd_);
  4812. if (this.list_) {
  4813. this.list_.destroy();
  4814. }
  4815. var MODAL = cssClasses.MODAL;
  4816. if (this.scrim_ && this.handleScrimClick_ && this.root_.classList.contains(MODAL)) {
  4817. this.scrim_.removeEventListener('click', this.handleScrimClick_);
  4818. // Ensure drawer is closed to hide scrim and release focus
  4819. this.open = false;
  4820. }
  4821. };
  4822. MDCDrawer.prototype.getDefaultFoundation = function () {
  4823. var _this = this;
  4824. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  4825. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  4826. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4827. var adapter = {
  4828. addClass: function addClass(className) {
  4829. return _this.root_.classList.add(className);
  4830. },
  4831. removeClass: function removeClass(className) {
  4832. return _this.root_.classList.remove(className);
  4833. },
  4834. hasClass: function hasClass(className) {
  4835. return _this.root_.classList.contains(className);
  4836. },
  4837. elementHasClass: function elementHasClass(element, className) {
  4838. return element.classList.contains(className);
  4839. },
  4840. saveFocus: function saveFocus() {
  4841. return _this.previousFocus_ = document.activeElement;
  4842. },
  4843. restoreFocus: function restoreFocus() {
  4844. var previousFocus = _this.previousFocus_;
  4845. if (previousFocus && previousFocus.focus && _this.root_.contains(document.activeElement)) {
  4846. previousFocus.focus();
  4847. }
  4848. },
  4849. focusActiveNavigationItem: function focusActiveNavigationItem() {
  4850. var activeNavItemEl = _this.root_.querySelector("." + foundation_1.MDCListFoundation.cssClasses.LIST_ITEM_ACTIVATED_CLASS);
  4851. if (activeNavItemEl) {
  4852. activeNavItemEl.focus();
  4853. }
  4854. },
  4855. notifyClose: function notifyClose() {
  4856. return _this.emit(strings.CLOSE_EVENT, {}, true /* shouldBubble */);
  4857. },
  4858. notifyOpen: function notifyOpen() {
  4859. return _this.emit(strings.OPEN_EVENT, {}, true /* shouldBubble */);
  4860. },
  4861. trapFocus: function trapFocus() {
  4862. return _this.focusTrap_.trapFocus();
  4863. },
  4864. releaseFocus: function releaseFocus() {
  4865. return _this.focusTrap_.releaseFocus();
  4866. }
  4867. };
  4868. // tslint:enable:object-literal-sort-keys
  4869. var DISMISSIBLE = cssClasses.DISMISSIBLE,
  4870. MODAL = cssClasses.MODAL;
  4871. if (this.root_.classList.contains(DISMISSIBLE)) {
  4872. return new foundation_2.MDCDismissibleDrawerFoundation(adapter);
  4873. } else if (this.root_.classList.contains(MODAL)) {
  4874. return new foundation_3.MDCModalDrawerFoundation(adapter);
  4875. } else {
  4876. throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + ".");
  4877. }
  4878. };
  4879. return MDCDrawer;
  4880. }(component_1.MDCComponent);
  4881. exports.MDCDrawer = MDCDrawer;
  4882. /***/ }),
  4883. /***/ "./packages/mdc-drawer/constants.ts":
  4884. /*!******************************************!*\
  4885. !*** ./packages/mdc-drawer/constants.ts ***!
  4886. \******************************************/
  4887. /*! no static exports found */
  4888. /***/ (function(module, exports, __webpack_require__) {
  4889. "use strict";
  4890. /**
  4891. * @license
  4892. * Copyright 2016 Google Inc.
  4893. *
  4894. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4895. * of this software and associated documentation files (the "Software"), to deal
  4896. * in the Software without restriction, including without limitation the rights
  4897. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4898. * copies of the Software, and to permit persons to whom the Software is
  4899. * furnished to do so, subject to the following conditions:
  4900. *
  4901. * The above copyright notice and this permission notice shall be included in
  4902. * all copies or substantial portions of the Software.
  4903. *
  4904. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4905. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4906. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4907. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4908. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4909. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4910. * THE SOFTWARE.
  4911. */
  4912. Object.defineProperty(exports, "__esModule", { value: true });
  4913. var cssClasses = {
  4914. ANIMATE: 'mdc-drawer--animate',
  4915. CLOSING: 'mdc-drawer--closing',
  4916. DISMISSIBLE: 'mdc-drawer--dismissible',
  4917. MODAL: 'mdc-drawer--modal',
  4918. OPEN: 'mdc-drawer--open',
  4919. OPENING: 'mdc-drawer--opening',
  4920. ROOT: 'mdc-drawer'
  4921. };
  4922. exports.cssClasses = cssClasses;
  4923. var strings = {
  4924. APP_CONTENT_SELECTOR: '.mdc-drawer-app-content',
  4925. CLOSE_EVENT: 'MDCDrawer:closed',
  4926. OPEN_EVENT: 'MDCDrawer:opened',
  4927. SCRIM_SELECTOR: '.mdc-drawer-scrim'
  4928. };
  4929. exports.strings = strings;
  4930. /***/ }),
  4931. /***/ "./packages/mdc-drawer/dismissible/foundation.ts":
  4932. /*!*******************************************************!*\
  4933. !*** ./packages/mdc-drawer/dismissible/foundation.ts ***!
  4934. \*******************************************************/
  4935. /*! no static exports found */
  4936. /***/ (function(module, exports, __webpack_require__) {
  4937. "use strict";
  4938. /**
  4939. * @license
  4940. * Copyright 2018 Google Inc.
  4941. *
  4942. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4943. * of this software and associated documentation files (the "Software"), to deal
  4944. * in the Software without restriction, including without limitation the rights
  4945. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4946. * copies of the Software, and to permit persons to whom the Software is
  4947. * furnished to do so, subject to the following conditions:
  4948. *
  4949. * The above copyright notice and this permission notice shall be included in
  4950. * all copies or substantial portions of the Software.
  4951. *
  4952. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4953. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4954. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4955. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4956. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4957. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4958. * THE SOFTWARE.
  4959. */
  4960. var __extends = this && this.__extends || function () {
  4961. var _extendStatics = function extendStatics(d, b) {
  4962. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4963. d.__proto__ = b;
  4964. } || function (d, b) {
  4965. for (var p in b) {
  4966. if (b.hasOwnProperty(p)) d[p] = b[p];
  4967. }
  4968. };
  4969. return _extendStatics(d, b);
  4970. };
  4971. return function (d, b) {
  4972. _extendStatics(d, b);
  4973. function __() {
  4974. this.constructor = d;
  4975. }
  4976. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4977. };
  4978. }();
  4979. var __assign = this && this.__assign || function () {
  4980. __assign = Object.assign || function (t) {
  4981. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4982. s = arguments[i];
  4983. for (var p in s) {
  4984. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4985. }
  4986. }
  4987. return t;
  4988. };
  4989. return __assign.apply(this, arguments);
  4990. };
  4991. Object.defineProperty(exports, "__esModule", { value: true });
  4992. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4993. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-drawer/constants.ts");
  4994. var MDCDismissibleDrawerFoundation = /** @class */function (_super) {
  4995. __extends(MDCDismissibleDrawerFoundation, _super);
  4996. function MDCDismissibleDrawerFoundation(adapter) {
  4997. var _this = _super.call(this, __assign({}, MDCDismissibleDrawerFoundation.defaultAdapter, adapter)) || this;
  4998. _this.animationFrame_ = 0;
  4999. _this.animationTimer_ = 0;
  5000. return _this;
  5001. }
  5002. Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", {
  5003. get: function get() {
  5004. return constants_1.strings;
  5005. },
  5006. enumerable: true,
  5007. configurable: true
  5008. });
  5009. Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", {
  5010. get: function get() {
  5011. return constants_1.cssClasses;
  5012. },
  5013. enumerable: true,
  5014. configurable: true
  5015. });
  5016. Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", {
  5017. get: function get() {
  5018. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  5019. return {
  5020. addClass: function addClass() {
  5021. return undefined;
  5022. },
  5023. removeClass: function removeClass() {
  5024. return undefined;
  5025. },
  5026. hasClass: function hasClass() {
  5027. return false;
  5028. },
  5029. elementHasClass: function elementHasClass() {
  5030. return false;
  5031. },
  5032. notifyClose: function notifyClose() {
  5033. return undefined;
  5034. },
  5035. notifyOpen: function notifyOpen() {
  5036. return undefined;
  5037. },
  5038. saveFocus: function saveFocus() {
  5039. return undefined;
  5040. },
  5041. restoreFocus: function restoreFocus() {
  5042. return undefined;
  5043. },
  5044. focusActiveNavigationItem: function focusActiveNavigationItem() {
  5045. return undefined;
  5046. },
  5047. trapFocus: function trapFocus() {
  5048. return undefined;
  5049. },
  5050. releaseFocus: function releaseFocus() {
  5051. return undefined;
  5052. }
  5053. };
  5054. // tslint:enable:object-literal-sort-keys
  5055. },
  5056. enumerable: true,
  5057. configurable: true
  5058. });
  5059. MDCDismissibleDrawerFoundation.prototype.destroy = function () {
  5060. if (this.animationFrame_) {
  5061. cancelAnimationFrame(this.animationFrame_);
  5062. }
  5063. if (this.animationTimer_) {
  5064. clearTimeout(this.animationTimer_);
  5065. }
  5066. };
  5067. /**
  5068. * Opens the drawer from the closed state.
  5069. */
  5070. MDCDismissibleDrawerFoundation.prototype.open = function () {
  5071. var _this = this;
  5072. if (this.isOpen() || this.isOpening() || this.isClosing()) {
  5073. return;
  5074. }
  5075. this.adapter_.addClass(constants_1.cssClasses.OPEN);
  5076. this.adapter_.addClass(constants_1.cssClasses.ANIMATE);
  5077. // Wait a frame once display is no longer "none", to establish basis for animation
  5078. this.runNextAnimationFrame_(function () {
  5079. _this.adapter_.addClass(constants_1.cssClasses.OPENING);
  5080. });
  5081. this.adapter_.saveFocus();
  5082. };
  5083. /**
  5084. * Closes the drawer from the open state.
  5085. */
  5086. MDCDismissibleDrawerFoundation.prototype.close = function () {
  5087. if (!this.isOpen() || this.isOpening() || this.isClosing()) {
  5088. return;
  5089. }
  5090. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  5091. };
  5092. /**
  5093. * Returns true if the drawer is in the open position.
  5094. * @return true if drawer is in open state.
  5095. */
  5096. MDCDismissibleDrawerFoundation.prototype.isOpen = function () {
  5097. return this.adapter_.hasClass(constants_1.cssClasses.OPEN);
  5098. };
  5099. /**
  5100. * Returns true if the drawer is animating open.
  5101. * @return true if drawer is animating open.
  5102. */
  5103. MDCDismissibleDrawerFoundation.prototype.isOpening = function () {
  5104. return this.adapter_.hasClass(constants_1.cssClasses.OPENING) || this.adapter_.hasClass(constants_1.cssClasses.ANIMATE);
  5105. };
  5106. /**
  5107. * Returns true if the drawer is animating closed.
  5108. * @return true if drawer is animating closed.
  5109. */
  5110. MDCDismissibleDrawerFoundation.prototype.isClosing = function () {
  5111. return this.adapter_.hasClass(constants_1.cssClasses.CLOSING);
  5112. };
  5113. /**
  5114. * Keydown handler to close drawer when key is escape.
  5115. */
  5116. MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) {
  5117. var keyCode = evt.keyCode,
  5118. key = evt.key;
  5119. var isEscape = key === 'Escape' || keyCode === 27;
  5120. if (isEscape) {
  5121. this.close();
  5122. }
  5123. };
  5124. /**
  5125. * Handles the `transitionend` event when the drawer finishes opening/closing.
  5126. */
  5127. MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) {
  5128. var OPENING = constants_1.cssClasses.OPENING,
  5129. CLOSING = constants_1.cssClasses.CLOSING,
  5130. OPEN = constants_1.cssClasses.OPEN,
  5131. ANIMATE = constants_1.cssClasses.ANIMATE,
  5132. ROOT = constants_1.cssClasses.ROOT;
  5133. // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first.
  5134. var isRootElement = this.isElement_(evt.target) && this.adapter_.elementHasClass(evt.target, ROOT);
  5135. if (!isRootElement) {
  5136. return;
  5137. }
  5138. if (this.isClosing()) {
  5139. this.adapter_.removeClass(OPEN);
  5140. this.closed_();
  5141. this.adapter_.restoreFocus();
  5142. this.adapter_.notifyClose();
  5143. } else {
  5144. this.adapter_.focusActiveNavigationItem();
  5145. this.opened_();
  5146. this.adapter_.notifyOpen();
  5147. }
  5148. this.adapter_.removeClass(ANIMATE);
  5149. this.adapter_.removeClass(OPENING);
  5150. this.adapter_.removeClass(CLOSING);
  5151. };
  5152. /**
  5153. * Extension point for when drawer finishes open animation.
  5154. */
  5155. MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty
  5156. /**
  5157. * Extension point for when drawer finishes close animation.
  5158. */
  5159. MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty
  5160. /**
  5161. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  5162. */
  5163. MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  5164. var _this = this;
  5165. cancelAnimationFrame(this.animationFrame_);
  5166. this.animationFrame_ = requestAnimationFrame(function () {
  5167. _this.animationFrame_ = 0;
  5168. clearTimeout(_this.animationTimer_);
  5169. _this.animationTimer_ = setTimeout(callback, 0);
  5170. });
  5171. };
  5172. MDCDismissibleDrawerFoundation.prototype.isElement_ = function (element) {
  5173. // In Edge, transitionend on ripple pseudo-elements yields a target without classList.
  5174. return Boolean(element.classList);
  5175. };
  5176. return MDCDismissibleDrawerFoundation;
  5177. }(foundation_1.MDCFoundation);
  5178. exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation;
  5179. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5180. exports.default = MDCDismissibleDrawerFoundation;
  5181. /***/ }),
  5182. /***/ "./packages/mdc-drawer/index.ts":
  5183. /*!**************************************!*\
  5184. !*** ./packages/mdc-drawer/index.ts ***!
  5185. \**************************************/
  5186. /*! no static exports found */
  5187. /***/ (function(module, exports, __webpack_require__) {
  5188. "use strict";
  5189. /**
  5190. * @license
  5191. * Copyright 2019 Google Inc.
  5192. *
  5193. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5194. * of this software and associated documentation files (the "Software"), to deal
  5195. * in the Software without restriction, including without limitation the rights
  5196. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5197. * copies of the Software, and to permit persons to whom the Software is
  5198. * furnished to do so, subject to the following conditions:
  5199. *
  5200. * The above copyright notice and this permission notice shall be included in
  5201. * all copies or substantial portions of the Software.
  5202. *
  5203. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5204. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5205. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5206. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5207. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5208. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5209. * THE SOFTWARE.
  5210. */
  5211. function __export(m) {
  5212. for (var p in m) {
  5213. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  5214. }
  5215. }
  5216. var __importStar = this && this.__importStar || function (mod) {
  5217. if (mod && mod.__esModule) return mod;
  5218. var result = {};
  5219. if (mod != null) for (var k in mod) {
  5220. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5221. }result["default"] = mod;
  5222. return result;
  5223. };
  5224. Object.defineProperty(exports, "__esModule", { value: true });
  5225. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts"));
  5226. exports.util = util;
  5227. __export(__webpack_require__(/*! ./component */ "./packages/mdc-drawer/component.ts"));
  5228. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-drawer/constants.ts"));
  5229. __export(__webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"));
  5230. __export(__webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"));
  5231. /***/ }),
  5232. /***/ "./packages/mdc-drawer/modal/foundation.ts":
  5233. /*!*************************************************!*\
  5234. !*** ./packages/mdc-drawer/modal/foundation.ts ***!
  5235. \*************************************************/
  5236. /*! no static exports found */
  5237. /***/ (function(module, exports, __webpack_require__) {
  5238. "use strict";
  5239. /**
  5240. * @license
  5241. * Copyright 2018 Google Inc.
  5242. *
  5243. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5244. * of this software and associated documentation files (the "Software"), to deal
  5245. * in the Software without restriction, including without limitation the rights
  5246. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5247. * copies of the Software, and to permit persons to whom the Software is
  5248. * furnished to do so, subject to the following conditions:
  5249. *
  5250. * The above copyright notice and this permission notice shall be included in
  5251. * all copies or substantial portions of the Software.
  5252. *
  5253. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5254. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5255. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5256. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5257. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5258. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5259. * THE SOFTWARE.
  5260. */
  5261. var __extends = this && this.__extends || function () {
  5262. var _extendStatics = function extendStatics(d, b) {
  5263. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5264. d.__proto__ = b;
  5265. } || function (d, b) {
  5266. for (var p in b) {
  5267. if (b.hasOwnProperty(p)) d[p] = b[p];
  5268. }
  5269. };
  5270. return _extendStatics(d, b);
  5271. };
  5272. return function (d, b) {
  5273. _extendStatics(d, b);
  5274. function __() {
  5275. this.constructor = d;
  5276. }
  5277. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5278. };
  5279. }();
  5280. Object.defineProperty(exports, "__esModule", { value: true });
  5281. var foundation_1 = __webpack_require__(/*! ../dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts");
  5282. /* istanbul ignore next: subclass is not a branch statement */
  5283. var MDCModalDrawerFoundation = /** @class */function (_super) {
  5284. __extends(MDCModalDrawerFoundation, _super);
  5285. function MDCModalDrawerFoundation() {
  5286. return _super !== null && _super.apply(this, arguments) || this;
  5287. }
  5288. /**
  5289. * Handles click event on scrim.
  5290. */
  5291. MDCModalDrawerFoundation.prototype.handleScrimClick = function () {
  5292. this.close();
  5293. };
  5294. /**
  5295. * Called when drawer finishes open animation.
  5296. */
  5297. MDCModalDrawerFoundation.prototype.opened_ = function () {
  5298. this.adapter_.trapFocus();
  5299. };
  5300. /**
  5301. * Called when drawer finishes close animation.
  5302. */
  5303. MDCModalDrawerFoundation.prototype.closed_ = function () {
  5304. this.adapter_.releaseFocus();
  5305. };
  5306. return MDCModalDrawerFoundation;
  5307. }(foundation_1.MDCDismissibleDrawerFoundation);
  5308. exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation;
  5309. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5310. exports.default = MDCModalDrawerFoundation;
  5311. /***/ }),
  5312. /***/ "./packages/mdc-drawer/util.ts":
  5313. /*!*************************************!*\
  5314. !*** ./packages/mdc-drawer/util.ts ***!
  5315. \*************************************/
  5316. /*! no static exports found */
  5317. /***/ (function(module, exports, __webpack_require__) {
  5318. "use strict";
  5319. /**
  5320. * @license
  5321. * Copyright 2016 Google Inc.
  5322. *
  5323. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5324. * of this software and associated documentation files (the "Software"), to deal
  5325. * in the Software without restriction, including without limitation the rights
  5326. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5327. * copies of the Software, and to permit persons to whom the Software is
  5328. * furnished to do so, subject to the following conditions:
  5329. *
  5330. * The above copyright notice and this permission notice shall be included in
  5331. * all copies or substantial portions of the Software.
  5332. *
  5333. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5334. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5335. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5336. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5337. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5338. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5339. * THE SOFTWARE.
  5340. */
  5341. Object.defineProperty(exports, "__esModule", { value: true });
  5342. function createFocusTrapInstance(surfaceEl, focusTrapFactory) {
  5343. return focusTrapFactory(surfaceEl, {
  5344. // Component handles focusing on active nav item.
  5345. skipInitialFocus: true
  5346. });
  5347. }
  5348. exports.createFocusTrapInstance = createFocusTrapInstance;
  5349. /***/ }),
  5350. /***/ "./packages/mdc-floating-label/component.ts":
  5351. /*!**************************************************!*\
  5352. !*** ./packages/mdc-floating-label/component.ts ***!
  5353. \**************************************************/
  5354. /*! no static exports found */
  5355. /***/ (function(module, exports, __webpack_require__) {
  5356. "use strict";
  5357. /**
  5358. * @license
  5359. * Copyright 2016 Google Inc.
  5360. *
  5361. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5362. * of this software and associated documentation files (the "Software"), to deal
  5363. * in the Software without restriction, including without limitation the rights
  5364. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5365. * copies of the Software, and to permit persons to whom the Software is
  5366. * furnished to do so, subject to the following conditions:
  5367. *
  5368. * The above copyright notice and this permission notice shall be included in
  5369. * all copies or substantial portions of the Software.
  5370. *
  5371. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5372. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5373. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5374. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5375. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5376. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5377. * THE SOFTWARE.
  5378. */
  5379. var __extends = this && this.__extends || function () {
  5380. var _extendStatics = function extendStatics(d, b) {
  5381. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5382. d.__proto__ = b;
  5383. } || function (d, b) {
  5384. for (var p in b) {
  5385. if (b.hasOwnProperty(p)) d[p] = b[p];
  5386. }
  5387. };
  5388. return _extendStatics(d, b);
  5389. };
  5390. return function (d, b) {
  5391. _extendStatics(d, b);
  5392. function __() {
  5393. this.constructor = d;
  5394. }
  5395. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5396. };
  5397. }();
  5398. Object.defineProperty(exports, "__esModule", { value: true });
  5399. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  5400. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  5401. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts");
  5402. var MDCFloatingLabel = /** @class */function (_super) {
  5403. __extends(MDCFloatingLabel, _super);
  5404. function MDCFloatingLabel() {
  5405. return _super !== null && _super.apply(this, arguments) || this;
  5406. }
  5407. MDCFloatingLabel.attachTo = function (root) {
  5408. return new MDCFloatingLabel(root);
  5409. };
  5410. /**
  5411. * Styles the label to produce the label shake for errors.
  5412. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
  5413. */
  5414. MDCFloatingLabel.prototype.shake = function (shouldShake) {
  5415. this.foundation_.shake(shouldShake);
  5416. };
  5417. /**
  5418. * Styles the label to float/dock.
  5419. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
  5420. */
  5421. MDCFloatingLabel.prototype.float = function (shouldFloat) {
  5422. this.foundation_.float(shouldFloat);
  5423. };
  5424. MDCFloatingLabel.prototype.getWidth = function () {
  5425. return this.foundation_.getWidth();
  5426. };
  5427. MDCFloatingLabel.prototype.getDefaultFoundation = function () {
  5428. var _this = this;
  5429. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  5430. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  5431. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  5432. var adapter = {
  5433. addClass: function addClass(className) {
  5434. return _this.root_.classList.add(className);
  5435. },
  5436. removeClass: function removeClass(className) {
  5437. return _this.root_.classList.remove(className);
  5438. },
  5439. getWidth: function getWidth() {
  5440. return ponyfill_1.estimateScrollWidth(_this.root_);
  5441. },
  5442. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  5443. return _this.listen(evtType, handler);
  5444. },
  5445. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  5446. return _this.unlisten(evtType, handler);
  5447. }
  5448. };
  5449. // tslint:enable:object-literal-sort-keys
  5450. return new foundation_1.MDCFloatingLabelFoundation(adapter);
  5451. };
  5452. return MDCFloatingLabel;
  5453. }(component_1.MDCComponent);
  5454. exports.MDCFloatingLabel = MDCFloatingLabel;
  5455. /***/ }),
  5456. /***/ "./packages/mdc-floating-label/constants.ts":
  5457. /*!**************************************************!*\
  5458. !*** ./packages/mdc-floating-label/constants.ts ***!
  5459. \**************************************************/
  5460. /*! no static exports found */
  5461. /***/ (function(module, exports, __webpack_require__) {
  5462. "use strict";
  5463. /**
  5464. * @license
  5465. * Copyright 2016 Google Inc.
  5466. *
  5467. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5468. * of this software and associated documentation files (the "Software"), to deal
  5469. * in the Software without restriction, including without limitation the rights
  5470. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5471. * copies of the Software, and to permit persons to whom the Software is
  5472. * furnished to do so, subject to the following conditions:
  5473. *
  5474. * The above copyright notice and this permission notice shall be included in
  5475. * all copies or substantial portions of the Software.
  5476. *
  5477. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5478. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5479. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5480. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5481. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5482. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5483. * THE SOFTWARE.
  5484. */
  5485. Object.defineProperty(exports, "__esModule", { value: true });
  5486. exports.cssClasses = {
  5487. LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
  5488. LABEL_SHAKE: 'mdc-floating-label--shake',
  5489. ROOT: 'mdc-floating-label'
  5490. };
  5491. /***/ }),
  5492. /***/ "./packages/mdc-floating-label/foundation.ts":
  5493. /*!***************************************************!*\
  5494. !*** ./packages/mdc-floating-label/foundation.ts ***!
  5495. \***************************************************/
  5496. /*! no static exports found */
  5497. /***/ (function(module, exports, __webpack_require__) {
  5498. "use strict";
  5499. /**
  5500. * @license
  5501. * Copyright 2016 Google Inc.
  5502. *
  5503. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5504. * of this software and associated documentation files (the "Software"), to deal
  5505. * in the Software without restriction, including without limitation the rights
  5506. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5507. * copies of the Software, and to permit persons to whom the Software is
  5508. * furnished to do so, subject to the following conditions:
  5509. *
  5510. * The above copyright notice and this permission notice shall be included in
  5511. * all copies or substantial portions of the Software.
  5512. *
  5513. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5514. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5515. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5516. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5517. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5518. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5519. * THE SOFTWARE.
  5520. */
  5521. var __extends = this && this.__extends || function () {
  5522. var _extendStatics = function extendStatics(d, b) {
  5523. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5524. d.__proto__ = b;
  5525. } || function (d, b) {
  5526. for (var p in b) {
  5527. if (b.hasOwnProperty(p)) d[p] = b[p];
  5528. }
  5529. };
  5530. return _extendStatics(d, b);
  5531. };
  5532. return function (d, b) {
  5533. _extendStatics(d, b);
  5534. function __() {
  5535. this.constructor = d;
  5536. }
  5537. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5538. };
  5539. }();
  5540. var __assign = this && this.__assign || function () {
  5541. __assign = Object.assign || function (t) {
  5542. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5543. s = arguments[i];
  5544. for (var p in s) {
  5545. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5546. }
  5547. }
  5548. return t;
  5549. };
  5550. return __assign.apply(this, arguments);
  5551. };
  5552. Object.defineProperty(exports, "__esModule", { value: true });
  5553. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5554. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts");
  5555. var MDCFloatingLabelFoundation = /** @class */function (_super) {
  5556. __extends(MDCFloatingLabelFoundation, _super);
  5557. function MDCFloatingLabelFoundation(adapter) {
  5558. var _this = _super.call(this, __assign({}, MDCFloatingLabelFoundation.defaultAdapter, adapter)) || this;
  5559. _this.shakeAnimationEndHandler_ = function () {
  5560. return _this.handleShakeAnimationEnd_();
  5561. };
  5562. return _this;
  5563. }
  5564. Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
  5565. get: function get() {
  5566. return constants_1.cssClasses;
  5567. },
  5568. enumerable: true,
  5569. configurable: true
  5570. });
  5571. Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
  5572. /**
  5573. * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
  5574. */
  5575. get: function get() {
  5576. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  5577. return {
  5578. addClass: function addClass() {
  5579. return undefined;
  5580. },
  5581. removeClass: function removeClass() {
  5582. return undefined;
  5583. },
  5584. getWidth: function getWidth() {
  5585. return 0;
  5586. },
  5587. registerInteractionHandler: function registerInteractionHandler() {
  5588. return undefined;
  5589. },
  5590. deregisterInteractionHandler: function deregisterInteractionHandler() {
  5591. return undefined;
  5592. }
  5593. };
  5594. // tslint:enable:object-literal-sort-keys
  5595. },
  5596. enumerable: true,
  5597. configurable: true
  5598. });
  5599. MDCFloatingLabelFoundation.prototype.init = function () {
  5600. this.adapter_.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_);
  5601. };
  5602. MDCFloatingLabelFoundation.prototype.destroy = function () {
  5603. this.adapter_.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_);
  5604. };
  5605. /**
  5606. * Returns the width of the label element.
  5607. */
  5608. MDCFloatingLabelFoundation.prototype.getWidth = function () {
  5609. return this.adapter_.getWidth();
  5610. };
  5611. /**
  5612. * Styles the label to produce a shake animation to indicate an error.
  5613. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
  5614. */
  5615. MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
  5616. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  5617. if (shouldShake) {
  5618. this.adapter_.addClass(LABEL_SHAKE);
  5619. } else {
  5620. this.adapter_.removeClass(LABEL_SHAKE);
  5621. }
  5622. };
  5623. /**
  5624. * Styles the label to float or dock.
  5625. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
  5626. */
  5627. MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
  5628. var _a = MDCFloatingLabelFoundation.cssClasses,
  5629. LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
  5630. LABEL_SHAKE = _a.LABEL_SHAKE;
  5631. if (shouldFloat) {
  5632. this.adapter_.addClass(LABEL_FLOAT_ABOVE);
  5633. } else {
  5634. this.adapter_.removeClass(LABEL_FLOAT_ABOVE);
  5635. this.adapter_.removeClass(LABEL_SHAKE);
  5636. }
  5637. };
  5638. MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () {
  5639. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  5640. this.adapter_.removeClass(LABEL_SHAKE);
  5641. };
  5642. return MDCFloatingLabelFoundation;
  5643. }(foundation_1.MDCFoundation);
  5644. exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
  5645. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5646. exports.default = MDCFloatingLabelFoundation;
  5647. /***/ }),
  5648. /***/ "./packages/mdc-floating-label/index.ts":
  5649. /*!**********************************************!*\
  5650. !*** ./packages/mdc-floating-label/index.ts ***!
  5651. \**********************************************/
  5652. /*! no static exports found */
  5653. /***/ (function(module, exports, __webpack_require__) {
  5654. "use strict";
  5655. /**
  5656. * @license
  5657. * Copyright 2019 Google Inc.
  5658. *
  5659. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5660. * of this software and associated documentation files (the "Software"), to deal
  5661. * in the Software without restriction, including without limitation the rights
  5662. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5663. * copies of the Software, and to permit persons to whom the Software is
  5664. * furnished to do so, subject to the following conditions:
  5665. *
  5666. * The above copyright notice and this permission notice shall be included in
  5667. * all copies or substantial portions of the Software.
  5668. *
  5669. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5670. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5671. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5672. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5673. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5674. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5675. * THE SOFTWARE.
  5676. */
  5677. function __export(m) {
  5678. for (var p in m) {
  5679. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  5680. }
  5681. }
  5682. Object.defineProperty(exports, "__esModule", { value: true });
  5683. __export(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts"));
  5684. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"));
  5685. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"));
  5686. /***/ }),
  5687. /***/ "./packages/mdc-form-field/component.ts":
  5688. /*!**********************************************!*\
  5689. !*** ./packages/mdc-form-field/component.ts ***!
  5690. \**********************************************/
  5691. /*! no static exports found */
  5692. /***/ (function(module, exports, __webpack_require__) {
  5693. "use strict";
  5694. /**
  5695. * @license
  5696. * Copyright 2017 Google Inc.
  5697. *
  5698. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5699. * of this software and associated documentation files (the "Software"), to deal
  5700. * in the Software without restriction, including without limitation the rights
  5701. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5702. * copies of the Software, and to permit persons to whom the Software is
  5703. * furnished to do so, subject to the following conditions:
  5704. *
  5705. * The above copyright notice and this permission notice shall be included in
  5706. * all copies or substantial portions of the Software.
  5707. *
  5708. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5709. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5710. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5711. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5712. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5713. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5714. * THE SOFTWARE.
  5715. */
  5716. var __extends = this && this.__extends || function () {
  5717. var _extendStatics = function extendStatics(d, b) {
  5718. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5719. d.__proto__ = b;
  5720. } || function (d, b) {
  5721. for (var p in b) {
  5722. if (b.hasOwnProperty(p)) d[p] = b[p];
  5723. }
  5724. };
  5725. return _extendStatics(d, b);
  5726. };
  5727. return function (d, b) {
  5728. _extendStatics(d, b);
  5729. function __() {
  5730. this.constructor = d;
  5731. }
  5732. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5733. };
  5734. }();
  5735. Object.defineProperty(exports, "__esModule", { value: true });
  5736. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  5737. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts");
  5738. var MDCFormField = /** @class */function (_super) {
  5739. __extends(MDCFormField, _super);
  5740. function MDCFormField() {
  5741. return _super !== null && _super.apply(this, arguments) || this;
  5742. }
  5743. MDCFormField.attachTo = function (root) {
  5744. return new MDCFormField(root);
  5745. };
  5746. Object.defineProperty(MDCFormField.prototype, "input", {
  5747. get: function get() {
  5748. return this.input_;
  5749. },
  5750. set: function set(input) {
  5751. this.input_ = input;
  5752. },
  5753. enumerable: true,
  5754. configurable: true
  5755. });
  5756. Object.defineProperty(MDCFormField.prototype, "label_", {
  5757. get: function get() {
  5758. var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR;
  5759. return this.root_.querySelector(LABEL_SELECTOR);
  5760. },
  5761. enumerable: true,
  5762. configurable: true
  5763. });
  5764. MDCFormField.prototype.getDefaultFoundation = function () {
  5765. var _this = this;
  5766. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  5767. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  5768. var adapter = {
  5769. activateInputRipple: function activateInputRipple() {
  5770. if (_this.input_ && _this.input_.ripple) {
  5771. _this.input_.ripple.activate();
  5772. }
  5773. },
  5774. deactivateInputRipple: function deactivateInputRipple() {
  5775. if (_this.input_ && _this.input_.ripple) {
  5776. _this.input_.ripple.deactivate();
  5777. }
  5778. },
  5779. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  5780. if (_this.label_) {
  5781. _this.label_.removeEventListener(evtType, handler);
  5782. }
  5783. },
  5784. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  5785. if (_this.label_) {
  5786. _this.label_.addEventListener(evtType, handler);
  5787. }
  5788. }
  5789. };
  5790. return new foundation_1.MDCFormFieldFoundation(adapter);
  5791. };
  5792. return MDCFormField;
  5793. }(component_1.MDCComponent);
  5794. exports.MDCFormField = MDCFormField;
  5795. /***/ }),
  5796. /***/ "./packages/mdc-form-field/constants.ts":
  5797. /*!**********************************************!*\
  5798. !*** ./packages/mdc-form-field/constants.ts ***!
  5799. \**********************************************/
  5800. /*! no static exports found */
  5801. /***/ (function(module, exports, __webpack_require__) {
  5802. "use strict";
  5803. /**
  5804. * @license
  5805. * Copyright 2017 Google Inc.
  5806. *
  5807. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5808. * of this software and associated documentation files (the "Software"), to deal
  5809. * in the Software without restriction, including without limitation the rights
  5810. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5811. * copies of the Software, and to permit persons to whom the Software is
  5812. * furnished to do so, subject to the following conditions:
  5813. *
  5814. * The above copyright notice and this permission notice shall be included in
  5815. * all copies or substantial portions of the Software.
  5816. *
  5817. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5818. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5819. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5820. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5821. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5822. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5823. * THE SOFTWARE.
  5824. */
  5825. Object.defineProperty(exports, "__esModule", { value: true });
  5826. exports.cssClasses = {
  5827. ROOT: 'mdc-form-field'
  5828. };
  5829. exports.strings = {
  5830. LABEL_SELECTOR: '.mdc-form-field > label'
  5831. };
  5832. /***/ }),
  5833. /***/ "./packages/mdc-form-field/foundation.ts":
  5834. /*!***********************************************!*\
  5835. !*** ./packages/mdc-form-field/foundation.ts ***!
  5836. \***********************************************/
  5837. /*! no static exports found */
  5838. /***/ (function(module, exports, __webpack_require__) {
  5839. "use strict";
  5840. /**
  5841. * @license
  5842. * Copyright 2017 Google Inc.
  5843. *
  5844. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5845. * of this software and associated documentation files (the "Software"), to deal
  5846. * in the Software without restriction, including without limitation the rights
  5847. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5848. * copies of the Software, and to permit persons to whom the Software is
  5849. * furnished to do so, subject to the following conditions:
  5850. *
  5851. * The above copyright notice and this permission notice shall be included in
  5852. * all copies or substantial portions of the Software.
  5853. *
  5854. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5855. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5856. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5857. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5858. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5859. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5860. * THE SOFTWARE.
  5861. */
  5862. var __extends = this && this.__extends || function () {
  5863. var _extendStatics = function extendStatics(d, b) {
  5864. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5865. d.__proto__ = b;
  5866. } || function (d, b) {
  5867. for (var p in b) {
  5868. if (b.hasOwnProperty(p)) d[p] = b[p];
  5869. }
  5870. };
  5871. return _extendStatics(d, b);
  5872. };
  5873. return function (d, b) {
  5874. _extendStatics(d, b);
  5875. function __() {
  5876. this.constructor = d;
  5877. }
  5878. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5879. };
  5880. }();
  5881. var __assign = this && this.__assign || function () {
  5882. __assign = Object.assign || function (t) {
  5883. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5884. s = arguments[i];
  5885. for (var p in s) {
  5886. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5887. }
  5888. }
  5889. return t;
  5890. };
  5891. return __assign.apply(this, arguments);
  5892. };
  5893. Object.defineProperty(exports, "__esModule", { value: true });
  5894. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5895. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts");
  5896. var MDCFormFieldFoundation = /** @class */function (_super) {
  5897. __extends(MDCFormFieldFoundation, _super);
  5898. function MDCFormFieldFoundation(adapter) {
  5899. var _this = _super.call(this, __assign({}, MDCFormFieldFoundation.defaultAdapter, adapter)) || this;
  5900. _this.clickHandler_ = function () {
  5901. return _this.handleClick_();
  5902. };
  5903. return _this;
  5904. }
  5905. Object.defineProperty(MDCFormFieldFoundation, "cssClasses", {
  5906. get: function get() {
  5907. return constants_1.cssClasses;
  5908. },
  5909. enumerable: true,
  5910. configurable: true
  5911. });
  5912. Object.defineProperty(MDCFormFieldFoundation, "strings", {
  5913. get: function get() {
  5914. return constants_1.strings;
  5915. },
  5916. enumerable: true,
  5917. configurable: true
  5918. });
  5919. Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", {
  5920. get: function get() {
  5921. return {
  5922. activateInputRipple: function activateInputRipple() {
  5923. return undefined;
  5924. },
  5925. deactivateInputRipple: function deactivateInputRipple() {
  5926. return undefined;
  5927. },
  5928. deregisterInteractionHandler: function deregisterInteractionHandler() {
  5929. return undefined;
  5930. },
  5931. registerInteractionHandler: function registerInteractionHandler() {
  5932. return undefined;
  5933. }
  5934. };
  5935. },
  5936. enumerable: true,
  5937. configurable: true
  5938. });
  5939. MDCFormFieldFoundation.prototype.init = function () {
  5940. this.adapter_.registerInteractionHandler('click', this.clickHandler_);
  5941. };
  5942. MDCFormFieldFoundation.prototype.destroy = function () {
  5943. this.adapter_.deregisterInteractionHandler('click', this.clickHandler_);
  5944. };
  5945. MDCFormFieldFoundation.prototype.handleClick_ = function () {
  5946. var _this = this;
  5947. this.adapter_.activateInputRipple();
  5948. requestAnimationFrame(function () {
  5949. return _this.adapter_.deactivateInputRipple();
  5950. });
  5951. };
  5952. return MDCFormFieldFoundation;
  5953. }(foundation_1.MDCFoundation);
  5954. exports.MDCFormFieldFoundation = MDCFormFieldFoundation;
  5955. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5956. exports.default = MDCFormFieldFoundation;
  5957. /***/ }),
  5958. /***/ "./packages/mdc-form-field/index.ts":
  5959. /*!******************************************!*\
  5960. !*** ./packages/mdc-form-field/index.ts ***!
  5961. \******************************************/
  5962. /*! no static exports found */
  5963. /***/ (function(module, exports, __webpack_require__) {
  5964. "use strict";
  5965. /**
  5966. * @license
  5967. * Copyright 2019 Google Inc.
  5968. *
  5969. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5970. * of this software and associated documentation files (the "Software"), to deal
  5971. * in the Software without restriction, including without limitation the rights
  5972. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5973. * copies of the Software, and to permit persons to whom the Software is
  5974. * furnished to do so, subject to the following conditions:
  5975. *
  5976. * The above copyright notice and this permission notice shall be included in
  5977. * all copies or substantial portions of the Software.
  5978. *
  5979. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5980. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5981. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5982. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5983. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5984. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5985. * THE SOFTWARE.
  5986. */
  5987. function __export(m) {
  5988. for (var p in m) {
  5989. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  5990. }
  5991. }
  5992. Object.defineProperty(exports, "__esModule", { value: true });
  5993. __export(__webpack_require__(/*! ./component */ "./packages/mdc-form-field/component.ts"));
  5994. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"));
  5995. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"));
  5996. /***/ }),
  5997. /***/ "./packages/mdc-icon-button/component.ts":
  5998. /*!***********************************************!*\
  5999. !*** ./packages/mdc-icon-button/component.ts ***!
  6000. \***********************************************/
  6001. /*! no static exports found */
  6002. /***/ (function(module, exports, __webpack_require__) {
  6003. "use strict";
  6004. /**
  6005. * @license
  6006. * Copyright 2018 Google Inc.
  6007. *
  6008. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6009. * of this software and associated documentation files (the "Software"), to deal
  6010. * in the Software without restriction, including without limitation the rights
  6011. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6012. * copies of the Software, and to permit persons to whom the Software is
  6013. * furnished to do so, subject to the following conditions:
  6014. *
  6015. * The above copyright notice and this permission notice shall be included in
  6016. * all copies or substantial portions of the Software.
  6017. *
  6018. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6019. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6020. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6021. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6022. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6023. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6024. * THE SOFTWARE.
  6025. */
  6026. var __extends = this && this.__extends || function () {
  6027. var _extendStatics = function extendStatics(d, b) {
  6028. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6029. d.__proto__ = b;
  6030. } || function (d, b) {
  6031. for (var p in b) {
  6032. if (b.hasOwnProperty(p)) d[p] = b[p];
  6033. }
  6034. };
  6035. return _extendStatics(d, b);
  6036. };
  6037. return function (d, b) {
  6038. _extendStatics(d, b);
  6039. function __() {
  6040. this.constructor = d;
  6041. }
  6042. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6043. };
  6044. }();
  6045. Object.defineProperty(exports, "__esModule", { value: true });
  6046. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6047. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  6048. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts");
  6049. var strings = foundation_1.MDCIconButtonToggleFoundation.strings;
  6050. var MDCIconButtonToggle = /** @class */function (_super) {
  6051. __extends(MDCIconButtonToggle, _super);
  6052. function MDCIconButtonToggle() {
  6053. var _this = _super !== null && _super.apply(this, arguments) || this;
  6054. _this.ripple_ = _this.createRipple_();
  6055. return _this;
  6056. }
  6057. MDCIconButtonToggle.attachTo = function (root) {
  6058. return new MDCIconButtonToggle(root);
  6059. };
  6060. MDCIconButtonToggle.prototype.initialSyncWithDOM = function () {
  6061. var _this = this;
  6062. this.handleClick_ = function () {
  6063. return _this.foundation_.handleClick();
  6064. };
  6065. this.listen('click', this.handleClick_);
  6066. };
  6067. MDCIconButtonToggle.prototype.destroy = function () {
  6068. this.unlisten('click', this.handleClick_);
  6069. this.ripple_.destroy();
  6070. _super.prototype.destroy.call(this);
  6071. };
  6072. MDCIconButtonToggle.prototype.getDefaultFoundation = function () {
  6073. var _this = this;
  6074. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6075. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6076. var adapter = {
  6077. addClass: function addClass(className) {
  6078. return _this.root_.classList.add(className);
  6079. },
  6080. hasClass: function hasClass(className) {
  6081. return _this.root_.classList.contains(className);
  6082. },
  6083. notifyChange: function notifyChange(evtData) {
  6084. return _this.emit(strings.CHANGE_EVENT, evtData);
  6085. },
  6086. removeClass: function removeClass(className) {
  6087. return _this.root_.classList.remove(className);
  6088. },
  6089. setAttr: function setAttr(attrName, attrValue) {
  6090. return _this.root_.setAttribute(attrName, attrValue);
  6091. }
  6092. };
  6093. return new foundation_1.MDCIconButtonToggleFoundation(adapter);
  6094. };
  6095. Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", {
  6096. get: function get() {
  6097. return this.ripple_;
  6098. },
  6099. enumerable: true,
  6100. configurable: true
  6101. });
  6102. Object.defineProperty(MDCIconButtonToggle.prototype, "on", {
  6103. get: function get() {
  6104. return this.foundation_.isOn();
  6105. },
  6106. set: function set(isOn) {
  6107. this.foundation_.toggle(isOn);
  6108. },
  6109. enumerable: true,
  6110. configurable: true
  6111. });
  6112. MDCIconButtonToggle.prototype.createRipple_ = function () {
  6113. var ripple = new component_2.MDCRipple(this.root_);
  6114. ripple.unbounded = true;
  6115. return ripple;
  6116. };
  6117. return MDCIconButtonToggle;
  6118. }(component_1.MDCComponent);
  6119. exports.MDCIconButtonToggle = MDCIconButtonToggle;
  6120. /***/ }),
  6121. /***/ "./packages/mdc-icon-button/constants.ts":
  6122. /*!***********************************************!*\
  6123. !*** ./packages/mdc-icon-button/constants.ts ***!
  6124. \***********************************************/
  6125. /*! no static exports found */
  6126. /***/ (function(module, exports, __webpack_require__) {
  6127. "use strict";
  6128. /**
  6129. * @license
  6130. * Copyright 2018 Google Inc.
  6131. *
  6132. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6133. * of this software and associated documentation files (the "Software"), to deal
  6134. * in the Software without restriction, including without limitation the rights
  6135. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6136. * copies of the Software, and to permit persons to whom the Software is
  6137. * furnished to do so, subject to the following conditions:
  6138. *
  6139. * The above copyright notice and this permission notice shall be included in
  6140. * all copies or substantial portions of the Software.
  6141. *
  6142. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6143. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6144. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6145. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6146. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6147. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6148. * THE SOFTWARE.
  6149. */
  6150. Object.defineProperty(exports, "__esModule", { value: true });
  6151. exports.cssClasses = {
  6152. ICON_BUTTON_ON: 'mdc-icon-button--on',
  6153. ROOT: 'mdc-icon-button'
  6154. };
  6155. exports.strings = {
  6156. ARIA_PRESSED: 'aria-pressed',
  6157. CHANGE_EVENT: 'MDCIconButtonToggle:change'
  6158. };
  6159. /***/ }),
  6160. /***/ "./packages/mdc-icon-button/foundation.ts":
  6161. /*!************************************************!*\
  6162. !*** ./packages/mdc-icon-button/foundation.ts ***!
  6163. \************************************************/
  6164. /*! no static exports found */
  6165. /***/ (function(module, exports, __webpack_require__) {
  6166. "use strict";
  6167. /**
  6168. * @license
  6169. * Copyright 2018 Google Inc.
  6170. *
  6171. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6172. * of this software and associated documentation files (the "Software"), to deal
  6173. * in the Software without restriction, including without limitation the rights
  6174. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6175. * copies of the Software, and to permit persons to whom the Software is
  6176. * furnished to do so, subject to the following conditions:
  6177. *
  6178. * The above copyright notice and this permission notice shall be included in
  6179. * all copies or substantial portions of the Software.
  6180. *
  6181. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6182. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6183. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6184. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6185. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6186. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6187. * THE SOFTWARE.
  6188. */
  6189. var __extends = this && this.__extends || function () {
  6190. var _extendStatics = function extendStatics(d, b) {
  6191. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6192. d.__proto__ = b;
  6193. } || function (d, b) {
  6194. for (var p in b) {
  6195. if (b.hasOwnProperty(p)) d[p] = b[p];
  6196. }
  6197. };
  6198. return _extendStatics(d, b);
  6199. };
  6200. return function (d, b) {
  6201. _extendStatics(d, b);
  6202. function __() {
  6203. this.constructor = d;
  6204. }
  6205. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6206. };
  6207. }();
  6208. var __assign = this && this.__assign || function () {
  6209. __assign = Object.assign || function (t) {
  6210. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6211. s = arguments[i];
  6212. for (var p in s) {
  6213. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6214. }
  6215. }
  6216. return t;
  6217. };
  6218. return __assign.apply(this, arguments);
  6219. };
  6220. Object.defineProperty(exports, "__esModule", { value: true });
  6221. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6222. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts");
  6223. var MDCIconButtonToggleFoundation = /** @class */function (_super) {
  6224. __extends(MDCIconButtonToggleFoundation, _super);
  6225. function MDCIconButtonToggleFoundation(adapter) {
  6226. return _super.call(this, __assign({}, MDCIconButtonToggleFoundation.defaultAdapter, adapter)) || this;
  6227. }
  6228. Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", {
  6229. get: function get() {
  6230. return constants_1.cssClasses;
  6231. },
  6232. enumerable: true,
  6233. configurable: true
  6234. });
  6235. Object.defineProperty(MDCIconButtonToggleFoundation, "strings", {
  6236. get: function get() {
  6237. return constants_1.strings;
  6238. },
  6239. enumerable: true,
  6240. configurable: true
  6241. });
  6242. Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", {
  6243. get: function get() {
  6244. return {
  6245. addClass: function addClass() {
  6246. return undefined;
  6247. },
  6248. hasClass: function hasClass() {
  6249. return false;
  6250. },
  6251. notifyChange: function notifyChange() {
  6252. return undefined;
  6253. },
  6254. removeClass: function removeClass() {
  6255. return undefined;
  6256. },
  6257. setAttr: function setAttr() {
  6258. return undefined;
  6259. }
  6260. };
  6261. },
  6262. enumerable: true,
  6263. configurable: true
  6264. });
  6265. MDCIconButtonToggleFoundation.prototype.init = function () {
  6266. this.adapter_.setAttr(constants_1.strings.ARIA_PRESSED, "" + this.isOn());
  6267. };
  6268. MDCIconButtonToggleFoundation.prototype.handleClick = function () {
  6269. this.toggle();
  6270. this.adapter_.notifyChange({ isOn: this.isOn() });
  6271. };
  6272. MDCIconButtonToggleFoundation.prototype.isOn = function () {
  6273. return this.adapter_.hasClass(constants_1.cssClasses.ICON_BUTTON_ON);
  6274. };
  6275. MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) {
  6276. if (isOn === void 0) {
  6277. isOn = !this.isOn();
  6278. }
  6279. if (isOn) {
  6280. this.adapter_.addClass(constants_1.cssClasses.ICON_BUTTON_ON);
  6281. } else {
  6282. this.adapter_.removeClass(constants_1.cssClasses.ICON_BUTTON_ON);
  6283. }
  6284. this.adapter_.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn);
  6285. };
  6286. return MDCIconButtonToggleFoundation;
  6287. }(foundation_1.MDCFoundation);
  6288. exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation;
  6289. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6290. exports.default = MDCIconButtonToggleFoundation;
  6291. /***/ }),
  6292. /***/ "./packages/mdc-icon-button/index.ts":
  6293. /*!*******************************************!*\
  6294. !*** ./packages/mdc-icon-button/index.ts ***!
  6295. \*******************************************/
  6296. /*! no static exports found */
  6297. /***/ (function(module, exports, __webpack_require__) {
  6298. "use strict";
  6299. /**
  6300. * @license
  6301. * Copyright 2019 Google Inc.
  6302. *
  6303. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6304. * of this software and associated documentation files (the "Software"), to deal
  6305. * in the Software without restriction, including without limitation the rights
  6306. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6307. * copies of the Software, and to permit persons to whom the Software is
  6308. * furnished to do so, subject to the following conditions:
  6309. *
  6310. * The above copyright notice and this permission notice shall be included in
  6311. * all copies or substantial portions of the Software.
  6312. *
  6313. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6314. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6315. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6316. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6317. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6318. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6319. * THE SOFTWARE.
  6320. */
  6321. function __export(m) {
  6322. for (var p in m) {
  6323. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  6324. }
  6325. }
  6326. Object.defineProperty(exports, "__esModule", { value: true });
  6327. __export(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts"));
  6328. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"));
  6329. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"));
  6330. /***/ }),
  6331. /***/ "./packages/mdc-line-ripple/component.ts":
  6332. /*!***********************************************!*\
  6333. !*** ./packages/mdc-line-ripple/component.ts ***!
  6334. \***********************************************/
  6335. /*! no static exports found */
  6336. /***/ (function(module, exports, __webpack_require__) {
  6337. "use strict";
  6338. /**
  6339. * @license
  6340. * Copyright 2018 Google Inc.
  6341. *
  6342. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6343. * of this software and associated documentation files (the "Software"), to deal
  6344. * in the Software without restriction, including without limitation the rights
  6345. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6346. * copies of the Software, and to permit persons to whom the Software is
  6347. * furnished to do so, subject to the following conditions:
  6348. *
  6349. * The above copyright notice and this permission notice shall be included in
  6350. * all copies or substantial portions of the Software.
  6351. *
  6352. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6353. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6354. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6355. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6356. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6357. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6358. * THE SOFTWARE.
  6359. */
  6360. var __extends = this && this.__extends || function () {
  6361. var _extendStatics = function extendStatics(d, b) {
  6362. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6363. d.__proto__ = b;
  6364. } || function (d, b) {
  6365. for (var p in b) {
  6366. if (b.hasOwnProperty(p)) d[p] = b[p];
  6367. }
  6368. };
  6369. return _extendStatics(d, b);
  6370. };
  6371. return function (d, b) {
  6372. _extendStatics(d, b);
  6373. function __() {
  6374. this.constructor = d;
  6375. }
  6376. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6377. };
  6378. }();
  6379. Object.defineProperty(exports, "__esModule", { value: true });
  6380. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6381. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts");
  6382. var MDCLineRipple = /** @class */function (_super) {
  6383. __extends(MDCLineRipple, _super);
  6384. function MDCLineRipple() {
  6385. return _super !== null && _super.apply(this, arguments) || this;
  6386. }
  6387. MDCLineRipple.attachTo = function (root) {
  6388. return new MDCLineRipple(root);
  6389. };
  6390. /**
  6391. * Activates the line ripple
  6392. */
  6393. MDCLineRipple.prototype.activate = function () {
  6394. this.foundation_.activate();
  6395. };
  6396. /**
  6397. * Deactivates the line ripple
  6398. */
  6399. MDCLineRipple.prototype.deactivate = function () {
  6400. this.foundation_.deactivate();
  6401. };
  6402. /**
  6403. * Sets the transform origin given a user's click location.
  6404. * The `rippleCenter` is the x-coordinate of the middle of the ripple.
  6405. */
  6406. MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
  6407. this.foundation_.setRippleCenter(xCoordinate);
  6408. };
  6409. MDCLineRipple.prototype.getDefaultFoundation = function () {
  6410. var _this = this;
  6411. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6412. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6413. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6414. var adapter = {
  6415. addClass: function addClass(className) {
  6416. return _this.root_.classList.add(className);
  6417. },
  6418. removeClass: function removeClass(className) {
  6419. return _this.root_.classList.remove(className);
  6420. },
  6421. hasClass: function hasClass(className) {
  6422. return _this.root_.classList.contains(className);
  6423. },
  6424. setStyle: function setStyle(propertyName, value) {
  6425. return _this.root_.style.setProperty(propertyName, value);
  6426. },
  6427. registerEventHandler: function registerEventHandler(evtType, handler) {
  6428. return _this.listen(evtType, handler);
  6429. },
  6430. deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
  6431. return _this.unlisten(evtType, handler);
  6432. }
  6433. };
  6434. // tslint:enable:object-literal-sort-keys
  6435. return new foundation_1.MDCLineRippleFoundation(adapter);
  6436. };
  6437. return MDCLineRipple;
  6438. }(component_1.MDCComponent);
  6439. exports.MDCLineRipple = MDCLineRipple;
  6440. /***/ }),
  6441. /***/ "./packages/mdc-line-ripple/constants.ts":
  6442. /*!***********************************************!*\
  6443. !*** ./packages/mdc-line-ripple/constants.ts ***!
  6444. \***********************************************/
  6445. /*! no static exports found */
  6446. /***/ (function(module, exports, __webpack_require__) {
  6447. "use strict";
  6448. /**
  6449. * @license
  6450. * Copyright 2018 Google Inc.
  6451. *
  6452. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6453. * of this software and associated documentation files (the "Software"), to deal
  6454. * in the Software without restriction, including without limitation the rights
  6455. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6456. * copies of the Software, and to permit persons to whom the Software is
  6457. * furnished to do so, subject to the following conditions:
  6458. *
  6459. * The above copyright notice and this permission notice shall be included in
  6460. * all copies or substantial portions of the Software.
  6461. *
  6462. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6463. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6464. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6465. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6466. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6467. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6468. * THE SOFTWARE.
  6469. */
  6470. Object.defineProperty(exports, "__esModule", { value: true });
  6471. var cssClasses = {
  6472. LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
  6473. LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'
  6474. };
  6475. exports.cssClasses = cssClasses;
  6476. /***/ }),
  6477. /***/ "./packages/mdc-line-ripple/foundation.ts":
  6478. /*!************************************************!*\
  6479. !*** ./packages/mdc-line-ripple/foundation.ts ***!
  6480. \************************************************/
  6481. /*! no static exports found */
  6482. /***/ (function(module, exports, __webpack_require__) {
  6483. "use strict";
  6484. /**
  6485. * @license
  6486. * Copyright 2018 Google Inc.
  6487. *
  6488. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6489. * of this software and associated documentation files (the "Software"), to deal
  6490. * in the Software without restriction, including without limitation the rights
  6491. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6492. * copies of the Software, and to permit persons to whom the Software is
  6493. * furnished to do so, subject to the following conditions:
  6494. *
  6495. * The above copyright notice and this permission notice shall be included in
  6496. * all copies or substantial portions of the Software.
  6497. *
  6498. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6499. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6500. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6501. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6502. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6503. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6504. * THE SOFTWARE.
  6505. */
  6506. var __extends = this && this.__extends || function () {
  6507. var _extendStatics = function extendStatics(d, b) {
  6508. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6509. d.__proto__ = b;
  6510. } || function (d, b) {
  6511. for (var p in b) {
  6512. if (b.hasOwnProperty(p)) d[p] = b[p];
  6513. }
  6514. };
  6515. return _extendStatics(d, b);
  6516. };
  6517. return function (d, b) {
  6518. _extendStatics(d, b);
  6519. function __() {
  6520. this.constructor = d;
  6521. }
  6522. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6523. };
  6524. }();
  6525. var __assign = this && this.__assign || function () {
  6526. __assign = Object.assign || function (t) {
  6527. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6528. s = arguments[i];
  6529. for (var p in s) {
  6530. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6531. }
  6532. }
  6533. return t;
  6534. };
  6535. return __assign.apply(this, arguments);
  6536. };
  6537. Object.defineProperty(exports, "__esModule", { value: true });
  6538. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6539. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts");
  6540. var MDCLineRippleFoundation = /** @class */function (_super) {
  6541. __extends(MDCLineRippleFoundation, _super);
  6542. function MDCLineRippleFoundation(adapter) {
  6543. var _this = _super.call(this, __assign({}, MDCLineRippleFoundation.defaultAdapter, adapter)) || this;
  6544. _this.transitionEndHandler_ = function (evt) {
  6545. return _this.handleTransitionEnd(evt);
  6546. };
  6547. return _this;
  6548. }
  6549. Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
  6550. get: function get() {
  6551. return constants_1.cssClasses;
  6552. },
  6553. enumerable: true,
  6554. configurable: true
  6555. });
  6556. Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
  6557. /**
  6558. * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
  6559. */
  6560. get: function get() {
  6561. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6562. return {
  6563. addClass: function addClass() {
  6564. return undefined;
  6565. },
  6566. removeClass: function removeClass() {
  6567. return undefined;
  6568. },
  6569. hasClass: function hasClass() {
  6570. return false;
  6571. },
  6572. setStyle: function setStyle() {
  6573. return undefined;
  6574. },
  6575. registerEventHandler: function registerEventHandler() {
  6576. return undefined;
  6577. },
  6578. deregisterEventHandler: function deregisterEventHandler() {
  6579. return undefined;
  6580. }
  6581. };
  6582. // tslint:enable:object-literal-sort-keys
  6583. },
  6584. enumerable: true,
  6585. configurable: true
  6586. });
  6587. MDCLineRippleFoundation.prototype.init = function () {
  6588. this.adapter_.registerEventHandler('transitionend', this.transitionEndHandler_);
  6589. };
  6590. MDCLineRippleFoundation.prototype.destroy = function () {
  6591. this.adapter_.deregisterEventHandler('transitionend', this.transitionEndHandler_);
  6592. };
  6593. MDCLineRippleFoundation.prototype.activate = function () {
  6594. this.adapter_.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  6595. this.adapter_.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  6596. };
  6597. MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
  6598. this.adapter_.setStyle('transform-origin', xCoordinate + "px center");
  6599. };
  6600. MDCLineRippleFoundation.prototype.deactivate = function () {
  6601. this.adapter_.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  6602. };
  6603. MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
  6604. // Wait for the line ripple to be either transparent or opaque
  6605. // before emitting the animation end event
  6606. var isDeactivating = this.adapter_.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  6607. if (evt.propertyName === 'opacity') {
  6608. if (isDeactivating) {
  6609. this.adapter_.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  6610. this.adapter_.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  6611. }
  6612. }
  6613. };
  6614. return MDCLineRippleFoundation;
  6615. }(foundation_1.MDCFoundation);
  6616. exports.MDCLineRippleFoundation = MDCLineRippleFoundation;
  6617. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6618. exports.default = MDCLineRippleFoundation;
  6619. /***/ }),
  6620. /***/ "./packages/mdc-line-ripple/index.ts":
  6621. /*!*******************************************!*\
  6622. !*** ./packages/mdc-line-ripple/index.ts ***!
  6623. \*******************************************/
  6624. /*! no static exports found */
  6625. /***/ (function(module, exports, __webpack_require__) {
  6626. "use strict";
  6627. /**
  6628. * @license
  6629. * Copyright 2019 Google Inc.
  6630. *
  6631. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6632. * of this software and associated documentation files (the "Software"), to deal
  6633. * in the Software without restriction, including without limitation the rights
  6634. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6635. * copies of the Software, and to permit persons to whom the Software is
  6636. * furnished to do so, subject to the following conditions:
  6637. *
  6638. * The above copyright notice and this permission notice shall be included in
  6639. * all copies or substantial portions of the Software.
  6640. *
  6641. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6642. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6643. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6644. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6645. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6646. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6647. * THE SOFTWARE.
  6648. */
  6649. function __export(m) {
  6650. for (var p in m) {
  6651. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  6652. }
  6653. }
  6654. Object.defineProperty(exports, "__esModule", { value: true });
  6655. __export(__webpack_require__(/*! ./component */ "./packages/mdc-line-ripple/component.ts"));
  6656. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"));
  6657. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"));
  6658. /***/ }),
  6659. /***/ "./packages/mdc-linear-progress/component.ts":
  6660. /*!***************************************************!*\
  6661. !*** ./packages/mdc-linear-progress/component.ts ***!
  6662. \***************************************************/
  6663. /*! no static exports found */
  6664. /***/ (function(module, exports, __webpack_require__) {
  6665. "use strict";
  6666. /**
  6667. * @license
  6668. * Copyright 2017 Google Inc.
  6669. *
  6670. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6671. * of this software and associated documentation files (the "Software"), to deal
  6672. * in the Software without restriction, including without limitation the rights
  6673. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6674. * copies of the Software, and to permit persons to whom the Software is
  6675. * furnished to do so, subject to the following conditions:
  6676. *
  6677. * The above copyright notice and this permission notice shall be included in
  6678. * all copies or substantial portions of the Software.
  6679. *
  6680. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6681. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6682. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6683. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6684. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6685. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6686. * THE SOFTWARE.
  6687. */
  6688. var __extends = this && this.__extends || function () {
  6689. var _extendStatics = function extendStatics(d, b) {
  6690. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6691. d.__proto__ = b;
  6692. } || function (d, b) {
  6693. for (var p in b) {
  6694. if (b.hasOwnProperty(p)) d[p] = b[p];
  6695. }
  6696. };
  6697. return _extendStatics(d, b);
  6698. };
  6699. return function (d, b) {
  6700. _extendStatics(d, b);
  6701. function __() {
  6702. this.constructor = d;
  6703. }
  6704. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6705. };
  6706. }();
  6707. Object.defineProperty(exports, "__esModule", { value: true });
  6708. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6709. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts");
  6710. var MDCLinearProgress = /** @class */function (_super) {
  6711. __extends(MDCLinearProgress, _super);
  6712. function MDCLinearProgress() {
  6713. return _super !== null && _super.apply(this, arguments) || this;
  6714. }
  6715. MDCLinearProgress.attachTo = function (root) {
  6716. return new MDCLinearProgress(root);
  6717. };
  6718. Object.defineProperty(MDCLinearProgress.prototype, "determinate", {
  6719. set: function set(value) {
  6720. this.foundation_.setDeterminate(value);
  6721. },
  6722. enumerable: true,
  6723. configurable: true
  6724. });
  6725. Object.defineProperty(MDCLinearProgress.prototype, "progress", {
  6726. set: function set(value) {
  6727. this.foundation_.setProgress(value);
  6728. },
  6729. enumerable: true,
  6730. configurable: true
  6731. });
  6732. Object.defineProperty(MDCLinearProgress.prototype, "buffer", {
  6733. set: function set(value) {
  6734. this.foundation_.setBuffer(value);
  6735. },
  6736. enumerable: true,
  6737. configurable: true
  6738. });
  6739. Object.defineProperty(MDCLinearProgress.prototype, "reverse", {
  6740. set: function set(value) {
  6741. this.foundation_.setReverse(value);
  6742. },
  6743. enumerable: true,
  6744. configurable: true
  6745. });
  6746. MDCLinearProgress.prototype.open = function () {
  6747. this.foundation_.open();
  6748. };
  6749. MDCLinearProgress.prototype.close = function () {
  6750. this.foundation_.close();
  6751. };
  6752. MDCLinearProgress.prototype.getDefaultFoundation = function () {
  6753. var _this = this;
  6754. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  6755. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  6756. var adapter = {
  6757. addClass: function addClass(className) {
  6758. return _this.root_.classList.add(className);
  6759. },
  6760. forceLayout: function forceLayout() {
  6761. return _this.root_.offsetWidth;
  6762. },
  6763. getBuffer: function getBuffer() {
  6764. return _this.root_.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_SELECTOR);
  6765. },
  6766. getPrimaryBar: function getPrimaryBar() {
  6767. return _this.root_.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);
  6768. },
  6769. hasClass: function hasClass(className) {
  6770. return _this.root_.classList.contains(className);
  6771. },
  6772. removeAttribute: function removeAttribute(attributeName) {
  6773. _this.root_.removeAttribute(attributeName);
  6774. },
  6775. removeClass: function removeClass(className) {
  6776. return _this.root_.classList.remove(className);
  6777. },
  6778. setAttribute: function setAttribute(attributeName, value) {
  6779. _this.root_.setAttribute(attributeName, value);
  6780. },
  6781. setStyle: function setStyle(el, styleProperty, value) {
  6782. return el.style.setProperty(styleProperty, value);
  6783. }
  6784. };
  6785. return new foundation_1.MDCLinearProgressFoundation(adapter);
  6786. };
  6787. return MDCLinearProgress;
  6788. }(component_1.MDCComponent);
  6789. exports.MDCLinearProgress = MDCLinearProgress;
  6790. /***/ }),
  6791. /***/ "./packages/mdc-linear-progress/constants.ts":
  6792. /*!***************************************************!*\
  6793. !*** ./packages/mdc-linear-progress/constants.ts ***!
  6794. \***************************************************/
  6795. /*! no static exports found */
  6796. /***/ (function(module, exports, __webpack_require__) {
  6797. "use strict";
  6798. /**
  6799. * @license
  6800. * Copyright 2017 Google Inc.
  6801. *
  6802. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6803. * of this software and associated documentation files (the "Software"), to deal
  6804. * in the Software without restriction, including without limitation the rights
  6805. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6806. * copies of the Software, and to permit persons to whom the Software is
  6807. * furnished to do so, subject to the following conditions:
  6808. *
  6809. * The above copyright notice and this permission notice shall be included in
  6810. * all copies or substantial portions of the Software.
  6811. *
  6812. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6813. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6814. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6815. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6816. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6817. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6818. * THE SOFTWARE.
  6819. */
  6820. Object.defineProperty(exports, "__esModule", { value: true });
  6821. exports.cssClasses = {
  6822. CLOSED_CLASS: 'mdc-linear-progress--closed',
  6823. INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
  6824. REVERSED_CLASS: 'mdc-linear-progress--reversed'
  6825. };
  6826. exports.strings = {
  6827. ARIA_VALUENOW: 'aria-valuenow',
  6828. BUFFER_SELECTOR: '.mdc-linear-progress__buffer',
  6829. PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar'
  6830. };
  6831. /***/ }),
  6832. /***/ "./packages/mdc-linear-progress/foundation.ts":
  6833. /*!****************************************************!*\
  6834. !*** ./packages/mdc-linear-progress/foundation.ts ***!
  6835. \****************************************************/
  6836. /*! no static exports found */
  6837. /***/ (function(module, exports, __webpack_require__) {
  6838. "use strict";
  6839. /**
  6840. * @license
  6841. * Copyright 2017 Google Inc.
  6842. *
  6843. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6844. * of this software and associated documentation files (the "Software"), to deal
  6845. * in the Software without restriction, including without limitation the rights
  6846. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6847. * copies of the Software, and to permit persons to whom the Software is
  6848. * furnished to do so, subject to the following conditions:
  6849. *
  6850. * The above copyright notice and this permission notice shall be included in
  6851. * all copies or substantial portions of the Software.
  6852. *
  6853. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6854. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6855. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6856. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6857. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6858. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6859. * THE SOFTWARE.
  6860. */
  6861. var __extends = this && this.__extends || function () {
  6862. var _extendStatics = function extendStatics(d, b) {
  6863. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6864. d.__proto__ = b;
  6865. } || function (d, b) {
  6866. for (var p in b) {
  6867. if (b.hasOwnProperty(p)) d[p] = b[p];
  6868. }
  6869. };
  6870. return _extendStatics(d, b);
  6871. };
  6872. return function (d, b) {
  6873. _extendStatics(d, b);
  6874. function __() {
  6875. this.constructor = d;
  6876. }
  6877. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6878. };
  6879. }();
  6880. var __assign = this && this.__assign || function () {
  6881. __assign = Object.assign || function (t) {
  6882. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6883. s = arguments[i];
  6884. for (var p in s) {
  6885. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6886. }
  6887. }
  6888. return t;
  6889. };
  6890. return __assign.apply(this, arguments);
  6891. };
  6892. Object.defineProperty(exports, "__esModule", { value: true });
  6893. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  6894. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6895. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts");
  6896. var MDCLinearProgressFoundation = /** @class */function (_super) {
  6897. __extends(MDCLinearProgressFoundation, _super);
  6898. function MDCLinearProgressFoundation(adapter) {
  6899. return _super.call(this, __assign({}, MDCLinearProgressFoundation.defaultAdapter, adapter)) || this;
  6900. }
  6901. Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", {
  6902. get: function get() {
  6903. return constants_1.cssClasses;
  6904. },
  6905. enumerable: true,
  6906. configurable: true
  6907. });
  6908. Object.defineProperty(MDCLinearProgressFoundation, "strings", {
  6909. get: function get() {
  6910. return constants_1.strings;
  6911. },
  6912. enumerable: true,
  6913. configurable: true
  6914. });
  6915. Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", {
  6916. get: function get() {
  6917. return {
  6918. addClass: function addClass() {
  6919. return undefined;
  6920. },
  6921. forceLayout: function forceLayout() {
  6922. return undefined;
  6923. },
  6924. getBuffer: function getBuffer() {
  6925. return null;
  6926. },
  6927. getPrimaryBar: function getPrimaryBar() {
  6928. return null;
  6929. },
  6930. hasClass: function hasClass() {
  6931. return false;
  6932. },
  6933. removeAttribute: function removeAttribute() {
  6934. return undefined;
  6935. },
  6936. removeClass: function removeClass() {
  6937. return undefined;
  6938. },
  6939. setAttribute: function setAttribute() {
  6940. return undefined;
  6941. },
  6942. setStyle: function setStyle() {
  6943. return undefined;
  6944. }
  6945. };
  6946. },
  6947. enumerable: true,
  6948. configurable: true
  6949. });
  6950. MDCLinearProgressFoundation.prototype.init = function () {
  6951. this.isDeterminate_ = !this.adapter_.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  6952. this.isReversed_ = this.adapter_.hasClass(constants_1.cssClasses.REVERSED_CLASS);
  6953. this.progress_ = 0;
  6954. this.buffer_ = 1;
  6955. };
  6956. MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) {
  6957. this.isDeterminate_ = isDeterminate;
  6958. if (this.isDeterminate_) {
  6959. this.adapter_.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  6960. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString());
  6961. this.setScale_(this.adapter_.getPrimaryBar(), this.progress_);
  6962. this.setScale_(this.adapter_.getBuffer(), this.buffer_);
  6963. } else {
  6964. if (this.isReversed_) {
  6965. // Adding/removing REVERSED_CLASS starts a translate animation, while
  6966. // adding INDETERMINATE_CLASS starts a scale animation. Here, we reset
  6967. // the translate animation in order to keep it in sync with the new
  6968. // scale animation that will start from adding INDETERMINATE_CLASS
  6969. // below.
  6970. this.adapter_.removeClass(constants_1.cssClasses.REVERSED_CLASS);
  6971. this.adapter_.forceLayout();
  6972. this.adapter_.addClass(constants_1.cssClasses.REVERSED_CLASS);
  6973. }
  6974. this.adapter_.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  6975. this.adapter_.removeAttribute(constants_1.strings.ARIA_VALUENOW);
  6976. this.setScale_(this.adapter_.getPrimaryBar(), 1);
  6977. this.setScale_(this.adapter_.getBuffer(), 1);
  6978. }
  6979. };
  6980. MDCLinearProgressFoundation.prototype.setProgress = function (value) {
  6981. this.progress_ = value;
  6982. if (this.isDeterminate_) {
  6983. this.setScale_(this.adapter_.getPrimaryBar(), value);
  6984. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString());
  6985. }
  6986. };
  6987. MDCLinearProgressFoundation.prototype.setBuffer = function (value) {
  6988. this.buffer_ = value;
  6989. if (this.isDeterminate_) {
  6990. this.setScale_(this.adapter_.getBuffer(), value);
  6991. }
  6992. };
  6993. MDCLinearProgressFoundation.prototype.setReverse = function (isReversed) {
  6994. this.isReversed_ = isReversed;
  6995. if (!this.isDeterminate_) {
  6996. // Adding INDETERMINATE_CLASS starts a scale animation, while
  6997. // adding/removing REVERSED_CLASS starts a translate animation. Here, we
  6998. // reset the scale animation in order to keep it in sync with the new
  6999. // translate animation that will start from adding/removing REVERSED_CLASS
  7000. // below.
  7001. this.adapter_.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  7002. this.adapter_.forceLayout();
  7003. this.adapter_.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  7004. }
  7005. if (this.isReversed_) {
  7006. this.adapter_.addClass(constants_1.cssClasses.REVERSED_CLASS);
  7007. } else {
  7008. this.adapter_.removeClass(constants_1.cssClasses.REVERSED_CLASS);
  7009. }
  7010. };
  7011. MDCLinearProgressFoundation.prototype.open = function () {
  7012. this.adapter_.removeClass(constants_1.cssClasses.CLOSED_CLASS);
  7013. };
  7014. MDCLinearProgressFoundation.prototype.close = function () {
  7015. this.adapter_.addClass(constants_1.cssClasses.CLOSED_CLASS);
  7016. };
  7017. MDCLinearProgressFoundation.prototype.setScale_ = function (el, scaleValue) {
  7018. if (!el) {
  7019. return;
  7020. }
  7021. var value = "scaleX(" + scaleValue + ")";
  7022. this.adapter_.setStyle(el, util_1.getCorrectPropertyName(window, 'transform'), value);
  7023. };
  7024. return MDCLinearProgressFoundation;
  7025. }(foundation_1.MDCFoundation);
  7026. exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation;
  7027. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7028. exports.default = MDCLinearProgressFoundation;
  7029. /***/ }),
  7030. /***/ "./packages/mdc-linear-progress/index.ts":
  7031. /*!***********************************************!*\
  7032. !*** ./packages/mdc-linear-progress/index.ts ***!
  7033. \***********************************************/
  7034. /*! no static exports found */
  7035. /***/ (function(module, exports, __webpack_require__) {
  7036. "use strict";
  7037. /**
  7038. * @license
  7039. * Copyright 2019 Google Inc.
  7040. *
  7041. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7042. * of this software and associated documentation files (the "Software"), to deal
  7043. * in the Software without restriction, including without limitation the rights
  7044. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7045. * copies of the Software, and to permit persons to whom the Software is
  7046. * furnished to do so, subject to the following conditions:
  7047. *
  7048. * The above copyright notice and this permission notice shall be included in
  7049. * all copies or substantial portions of the Software.
  7050. *
  7051. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7052. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7053. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7054. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7055. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7056. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7057. * THE SOFTWARE.
  7058. */
  7059. function __export(m) {
  7060. for (var p in m) {
  7061. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7062. }
  7063. }
  7064. Object.defineProperty(exports, "__esModule", { value: true });
  7065. __export(__webpack_require__(/*! ./component */ "./packages/mdc-linear-progress/component.ts"));
  7066. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"));
  7067. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"));
  7068. /***/ }),
  7069. /***/ "./packages/mdc-list/component.ts":
  7070. /*!****************************************!*\
  7071. !*** ./packages/mdc-list/component.ts ***!
  7072. \****************************************/
  7073. /*! no static exports found */
  7074. /***/ (function(module, exports, __webpack_require__) {
  7075. "use strict";
  7076. /**
  7077. * @license
  7078. * Copyright 2018 Google Inc.
  7079. *
  7080. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7081. * of this software and associated documentation files (the "Software"), to deal
  7082. * in the Software without restriction, including without limitation the rights
  7083. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7084. * copies of the Software, and to permit persons to whom the Software is
  7085. * furnished to do so, subject to the following conditions:
  7086. *
  7087. * The above copyright notice and this permission notice shall be included in
  7088. * all copies or substantial portions of the Software.
  7089. *
  7090. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7091. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7092. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7093. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7094. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7095. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7096. * THE SOFTWARE.
  7097. */
  7098. var __extends = this && this.__extends || function () {
  7099. var _extendStatics = function extendStatics(d, b) {
  7100. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7101. d.__proto__ = b;
  7102. } || function (d, b) {
  7103. for (var p in b) {
  7104. if (b.hasOwnProperty(p)) d[p] = b[p];
  7105. }
  7106. };
  7107. return _extendStatics(d, b);
  7108. };
  7109. return function (d, b) {
  7110. _extendStatics(d, b);
  7111. function __() {
  7112. this.constructor = d;
  7113. }
  7114. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7115. };
  7116. }();
  7117. Object.defineProperty(exports, "__esModule", { value: true });
  7118. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7119. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  7120. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  7121. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts");
  7122. var MDCList = /** @class */function (_super) {
  7123. __extends(MDCList, _super);
  7124. function MDCList() {
  7125. return _super !== null && _super.apply(this, arguments) || this;
  7126. }
  7127. Object.defineProperty(MDCList.prototype, "vertical", {
  7128. set: function set(value) {
  7129. this.foundation_.setVerticalOrientation(value);
  7130. },
  7131. enumerable: true,
  7132. configurable: true
  7133. });
  7134. Object.defineProperty(MDCList.prototype, "listElements", {
  7135. get: function get() {
  7136. return [].slice.call(this.root_.querySelectorAll("." + constants_1.cssClasses.LIST_ITEM_CLASS));
  7137. },
  7138. enumerable: true,
  7139. configurable: true
  7140. });
  7141. Object.defineProperty(MDCList.prototype, "wrapFocus", {
  7142. set: function set(value) {
  7143. this.foundation_.setWrapFocus(value);
  7144. },
  7145. enumerable: true,
  7146. configurable: true
  7147. });
  7148. Object.defineProperty(MDCList.prototype, "singleSelection", {
  7149. set: function set(isSingleSelectionList) {
  7150. this.foundation_.setSingleSelection(isSingleSelectionList);
  7151. },
  7152. enumerable: true,
  7153. configurable: true
  7154. });
  7155. Object.defineProperty(MDCList.prototype, "selectedIndex", {
  7156. get: function get() {
  7157. return this.foundation_.getSelectedIndex();
  7158. },
  7159. set: function set(index) {
  7160. this.foundation_.setSelectedIndex(index);
  7161. },
  7162. enumerable: true,
  7163. configurable: true
  7164. });
  7165. MDCList.attachTo = function (root) {
  7166. return new MDCList(root);
  7167. };
  7168. MDCList.prototype.initialSyncWithDOM = function () {
  7169. this.handleClick_ = this.handleClickEvent_.bind(this);
  7170. this.handleKeydown_ = this.handleKeydownEvent_.bind(this);
  7171. this.focusInEventListener_ = this.handleFocusInEvent_.bind(this);
  7172. this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this);
  7173. this.listen('keydown', this.handleKeydown_);
  7174. this.listen('click', this.handleClick_);
  7175. this.listen('focusin', this.focusInEventListener_);
  7176. this.listen('focusout', this.focusOutEventListener_);
  7177. this.layout();
  7178. this.initializeListType();
  7179. };
  7180. MDCList.prototype.destroy = function () {
  7181. this.unlisten('keydown', this.handleKeydown_);
  7182. this.unlisten('click', this.handleClick_);
  7183. this.unlisten('focusin', this.focusInEventListener_);
  7184. this.unlisten('focusout', this.focusOutEventListener_);
  7185. };
  7186. MDCList.prototype.layout = function () {
  7187. var direction = this.root_.getAttribute(constants_1.strings.ARIA_ORIENTATION);
  7188. this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL;
  7189. // List items need to have at least tabindex=-1 to be focusable.
  7190. [].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) {
  7191. el.setAttribute('tabindex', '-1');
  7192. });
  7193. // Child button/a elements are not tabbable until the list item is focused.
  7194. [].slice.call(this.root_.querySelectorAll(constants_1.strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) {
  7195. return el.setAttribute('tabindex', '-1');
  7196. });
  7197. this.foundation_.layout();
  7198. };
  7199. /**
  7200. * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio.
  7201. */
  7202. MDCList.prototype.initializeListType = function () {
  7203. var _this = this;
  7204. var checkboxListItems = this.root_.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR);
  7205. var singleSelectedListItem = this.root_.querySelector("\n ." + constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS + "\n ");
  7206. var radioSelectedListItem = this.root_.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR);
  7207. if (checkboxListItems.length) {
  7208. var preselectedItems = this.root_.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR);
  7209. this.selectedIndex = [].map.call(preselectedItems, function (listItem) {
  7210. return _this.listElements.indexOf(listItem);
  7211. });
  7212. } else if (singleSelectedListItem) {
  7213. if (singleSelectedListItem.classList.contains(constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS)) {
  7214. this.foundation_.setUseActivatedClass(true);
  7215. }
  7216. this.singleSelection = true;
  7217. this.selectedIndex = this.listElements.indexOf(singleSelectedListItem);
  7218. } else if (radioSelectedListItem) {
  7219. this.selectedIndex = this.listElements.indexOf(radioSelectedListItem);
  7220. }
  7221. };
  7222. /**
  7223. * Updates the list item at itemIndex to the desired isEnabled state.
  7224. * @param itemIndex Index of the list item
  7225. * @param isEnabled Sets the list item to enabled or disabled.
  7226. */
  7227. MDCList.prototype.setEnabled = function (itemIndex, isEnabled) {
  7228. this.foundation_.setEnabled(itemIndex, isEnabled);
  7229. };
  7230. MDCList.prototype.getDefaultFoundation = function () {
  7231. var _this = this;
  7232. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  7233. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  7234. var adapter = {
  7235. addClassForElementIndex: function addClassForElementIndex(index, className) {
  7236. var element = _this.listElements[index];
  7237. if (element) {
  7238. element.classList.add(className);
  7239. }
  7240. },
  7241. focusItemAtIndex: function focusItemAtIndex(index) {
  7242. var element = _this.listElements[index];
  7243. if (element) {
  7244. element.focus();
  7245. }
  7246. },
  7247. getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) {
  7248. return _this.listElements[index].getAttribute(attr);
  7249. },
  7250. getFocusedElementIndex: function getFocusedElementIndex() {
  7251. return _this.listElements.indexOf(document.activeElement);
  7252. },
  7253. getListItemCount: function getListItemCount() {
  7254. return _this.listElements.length;
  7255. },
  7256. hasCheckboxAtIndex: function hasCheckboxAtIndex(index) {
  7257. var listItem = _this.listElements[index];
  7258. return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  7259. },
  7260. hasRadioAtIndex: function hasRadioAtIndex(index) {
  7261. var listItem = _this.listElements[index];
  7262. return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR);
  7263. },
  7264. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) {
  7265. var listItem = _this.listElements[index];
  7266. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
  7267. return toggleEl.checked;
  7268. },
  7269. isFocusInsideList: function isFocusInsideList() {
  7270. return _this.root_.contains(document.activeElement);
  7271. },
  7272. isRootFocused: function isRootFocused() {
  7273. return document.activeElement === _this.root_;
  7274. },
  7275. listItemAtIndexHasClass: function listItemAtIndexHasClass(index, className) {
  7276. return _this.listElements[index].classList.contains(className);
  7277. },
  7278. notifyAction: function notifyAction(index) {
  7279. _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true);
  7280. },
  7281. removeClassForElementIndex: function removeClassForElementIndex(index, className) {
  7282. var element = _this.listElements[index];
  7283. if (element) {
  7284. element.classList.remove(className);
  7285. }
  7286. },
  7287. setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) {
  7288. var element = _this.listElements[index];
  7289. if (element) {
  7290. element.setAttribute(attr, value);
  7291. }
  7292. },
  7293. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) {
  7294. var listItem = _this.listElements[index];
  7295. var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  7296. toggleEl.checked = isChecked;
  7297. var event = document.createEvent('Event');
  7298. event.initEvent('change', true, true);
  7299. toggleEl.dispatchEvent(event);
  7300. },
  7301. setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {
  7302. var element = _this.listElements[listItemIndex];
  7303. var listItemChildren = [].slice.call(element.querySelectorAll(constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX));
  7304. listItemChildren.forEach(function (el) {
  7305. return el.setAttribute('tabindex', tabIndexValue);
  7306. });
  7307. }
  7308. };
  7309. return new foundation_1.MDCListFoundation(adapter);
  7310. };
  7311. /**
  7312. * Used to figure out which list item this event is targetting. Or returns -1 if
  7313. * there is no list item
  7314. */
  7315. MDCList.prototype.getListItemIndex_ = function (evt) {
  7316. var eventTarget = evt.target;
  7317. var nearestParent = ponyfill_1.closest(eventTarget, "." + constants_1.cssClasses.LIST_ITEM_CLASS + ", ." + constants_1.cssClasses.ROOT);
  7318. // Get the index of the element if it is a list item.
  7319. if (nearestParent && ponyfill_1.matches(nearestParent, "." + constants_1.cssClasses.LIST_ITEM_CLASS)) {
  7320. return this.listElements.indexOf(nearestParent);
  7321. }
  7322. return -1;
  7323. };
  7324. /**
  7325. * Used to figure out which element was clicked before sending the event to the foundation.
  7326. */
  7327. MDCList.prototype.handleFocusInEvent_ = function (evt) {
  7328. var index = this.getListItemIndex_(evt);
  7329. this.foundation_.handleFocusIn(evt, index);
  7330. };
  7331. /**
  7332. * Used to figure out which element was clicked before sending the event to the foundation.
  7333. */
  7334. MDCList.prototype.handleFocusOutEvent_ = function (evt) {
  7335. var index = this.getListItemIndex_(evt);
  7336. this.foundation_.handleFocusOut(evt, index);
  7337. };
  7338. /**
  7339. * Used to figure out which element was focused when keydown event occurred before sending the event to the
  7340. * foundation.
  7341. */
  7342. MDCList.prototype.handleKeydownEvent_ = function (evt) {
  7343. var index = this.getListItemIndex_(evt);
  7344. var target = evt.target;
  7345. this.foundation_.handleKeydown(evt, target.classList.contains(constants_1.cssClasses.LIST_ITEM_CLASS), index);
  7346. };
  7347. /**
  7348. * Used to figure out which element was clicked before sending the event to the foundation.
  7349. */
  7350. MDCList.prototype.handleClickEvent_ = function (evt) {
  7351. var index = this.getListItemIndex_(evt);
  7352. var target = evt.target;
  7353. // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events.
  7354. var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR);
  7355. this.foundation_.handleClick(index, toggleCheckbox);
  7356. };
  7357. return MDCList;
  7358. }(component_1.MDCComponent);
  7359. exports.MDCList = MDCList;
  7360. /***/ }),
  7361. /***/ "./packages/mdc-list/constants.ts":
  7362. /*!****************************************!*\
  7363. !*** ./packages/mdc-list/constants.ts ***!
  7364. \****************************************/
  7365. /*! no static exports found */
  7366. /***/ (function(module, exports, __webpack_require__) {
  7367. "use strict";
  7368. /**
  7369. * @license
  7370. * Copyright 2018 Google Inc.
  7371. *
  7372. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7373. * of this software and associated documentation files (the "Software"), to deal
  7374. * in the Software without restriction, including without limitation the rights
  7375. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7376. * copies of the Software, and to permit persons to whom the Software is
  7377. * furnished to do so, subject to the following conditions:
  7378. *
  7379. * The above copyright notice and this permission notice shall be included in
  7380. * all copies or substantial portions of the Software.
  7381. *
  7382. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7383. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7384. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7385. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7386. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7387. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7388. * THE SOFTWARE.
  7389. */
  7390. Object.defineProperty(exports, "__esModule", { value: true });
  7391. var cssClasses = {
  7392. LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
  7393. LIST_ITEM_CLASS: 'mdc-list-item',
  7394. LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
  7395. LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
  7396. ROOT: 'mdc-list'
  7397. };
  7398. exports.cssClasses = cssClasses;
  7399. var strings = {
  7400. ACTION_EVENT: 'MDCList:action',
  7401. ARIA_CHECKED: 'aria-checked',
  7402. ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
  7403. ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
  7404. ARIA_CURRENT: 'aria-current',
  7405. ARIA_DISABLED: 'aria-disabled',
  7406. ARIA_ORIENTATION: 'aria-orientation',
  7407. ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
  7408. ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
  7409. ARIA_SELECTED: 'aria-selected',
  7410. CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
  7411. CHECKBOX_SELECTOR: 'input[type="checkbox"]',
  7412. CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ",
  7413. 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 ",
  7414. RADIO_SELECTOR: 'input[type="radio"]'
  7415. };
  7416. exports.strings = strings;
  7417. var numbers = {
  7418. UNSET_INDEX: -1
  7419. };
  7420. exports.numbers = numbers;
  7421. /***/ }),
  7422. /***/ "./packages/mdc-list/foundation.ts":
  7423. /*!*****************************************!*\
  7424. !*** ./packages/mdc-list/foundation.ts ***!
  7425. \*****************************************/
  7426. /*! no static exports found */
  7427. /***/ (function(module, exports, __webpack_require__) {
  7428. "use strict";
  7429. /**
  7430. * @license
  7431. * Copyright 2018 Google Inc.
  7432. *
  7433. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7434. * of this software and associated documentation files (the "Software"), to deal
  7435. * in the Software without restriction, including without limitation the rights
  7436. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7437. * copies of the Software, and to permit persons to whom the Software is
  7438. * furnished to do so, subject to the following conditions:
  7439. *
  7440. * The above copyright notice and this permission notice shall be included in
  7441. * all copies or substantial portions of the Software.
  7442. *
  7443. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7444. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7445. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7446. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7447. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7448. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7449. * THE SOFTWARE.
  7450. */
  7451. var __extends = this && this.__extends || function () {
  7452. var _extendStatics = function extendStatics(d, b) {
  7453. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7454. d.__proto__ = b;
  7455. } || function (d, b) {
  7456. for (var p in b) {
  7457. if (b.hasOwnProperty(p)) d[p] = b[p];
  7458. }
  7459. };
  7460. return _extendStatics(d, b);
  7461. };
  7462. return function (d, b) {
  7463. _extendStatics(d, b);
  7464. function __() {
  7465. this.constructor = d;
  7466. }
  7467. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7468. };
  7469. }();
  7470. var __assign = this && this.__assign || function () {
  7471. __assign = Object.assign || function (t) {
  7472. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7473. s = arguments[i];
  7474. for (var p in s) {
  7475. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7476. }
  7477. }
  7478. return t;
  7479. };
  7480. return __assign.apply(this, arguments);
  7481. };
  7482. Object.defineProperty(exports, "__esModule", { value: true });
  7483. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7484. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts");
  7485. var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
  7486. function isNumberArray(selectedIndex) {
  7487. return selectedIndex instanceof Array;
  7488. }
  7489. var MDCListFoundation = /** @class */function (_super) {
  7490. __extends(MDCListFoundation, _super);
  7491. function MDCListFoundation(adapter) {
  7492. var _this = _super.call(this, __assign({}, MDCListFoundation.defaultAdapter, adapter)) || this;
  7493. _this.wrapFocus_ = false;
  7494. _this.isVertical_ = true;
  7495. _this.isSingleSelectionList_ = false;
  7496. _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX;
  7497. _this.focusedItemIndex_ = constants_1.numbers.UNSET_INDEX;
  7498. _this.useActivatedClass_ = false;
  7499. _this.ariaCurrentAttrValue_ = null;
  7500. _this.isCheckboxList_ = false;
  7501. _this.isRadioList_ = false;
  7502. return _this;
  7503. }
  7504. Object.defineProperty(MDCListFoundation, "strings", {
  7505. get: function get() {
  7506. return constants_1.strings;
  7507. },
  7508. enumerable: true,
  7509. configurable: true
  7510. });
  7511. Object.defineProperty(MDCListFoundation, "cssClasses", {
  7512. get: function get() {
  7513. return constants_1.cssClasses;
  7514. },
  7515. enumerable: true,
  7516. configurable: true
  7517. });
  7518. Object.defineProperty(MDCListFoundation, "numbers", {
  7519. get: function get() {
  7520. return constants_1.numbers;
  7521. },
  7522. enumerable: true,
  7523. configurable: true
  7524. });
  7525. Object.defineProperty(MDCListFoundation, "defaultAdapter", {
  7526. get: function get() {
  7527. return {
  7528. addClassForElementIndex: function addClassForElementIndex() {
  7529. return undefined;
  7530. },
  7531. focusItemAtIndex: function focusItemAtIndex() {
  7532. return undefined;
  7533. },
  7534. getAttributeForElementIndex: function getAttributeForElementIndex() {
  7535. return null;
  7536. },
  7537. getFocusedElementIndex: function getFocusedElementIndex() {
  7538. return 0;
  7539. },
  7540. getListItemCount: function getListItemCount() {
  7541. return 0;
  7542. },
  7543. hasCheckboxAtIndex: function hasCheckboxAtIndex() {
  7544. return false;
  7545. },
  7546. hasRadioAtIndex: function hasRadioAtIndex() {
  7547. return false;
  7548. },
  7549. isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() {
  7550. return false;
  7551. },
  7552. isFocusInsideList: function isFocusInsideList() {
  7553. return false;
  7554. },
  7555. isRootFocused: function isRootFocused() {
  7556. return false;
  7557. },
  7558. listItemAtIndexHasClass: function listItemAtIndexHasClass() {
  7559. return false;
  7560. },
  7561. notifyAction: function notifyAction() {
  7562. return undefined;
  7563. },
  7564. removeClassForElementIndex: function removeClassForElementIndex() {
  7565. return undefined;
  7566. },
  7567. setAttributeForElementIndex: function setAttributeForElementIndex() {
  7568. return undefined;
  7569. },
  7570. setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() {
  7571. return undefined;
  7572. },
  7573. setTabIndexForListItemChildren: function setTabIndexForListItemChildren() {
  7574. return undefined;
  7575. }
  7576. };
  7577. },
  7578. enumerable: true,
  7579. configurable: true
  7580. });
  7581. MDCListFoundation.prototype.layout = function () {
  7582. if (this.adapter_.getListItemCount() === 0) {
  7583. return;
  7584. }
  7585. if (this.adapter_.hasCheckboxAtIndex(0)) {
  7586. this.isCheckboxList_ = true;
  7587. } else if (this.adapter_.hasRadioAtIndex(0)) {
  7588. this.isRadioList_ = true;
  7589. }
  7590. };
  7591. /**
  7592. * Sets the private wrapFocus_ variable.
  7593. */
  7594. MDCListFoundation.prototype.setWrapFocus = function (value) {
  7595. this.wrapFocus_ = value;
  7596. };
  7597. /**
  7598. * Sets the isVertical_ private variable.
  7599. */
  7600. MDCListFoundation.prototype.setVerticalOrientation = function (value) {
  7601. this.isVertical_ = value;
  7602. };
  7603. /**
  7604. * Sets the isSingleSelectionList_ private variable.
  7605. */
  7606. MDCListFoundation.prototype.setSingleSelection = function (value) {
  7607. this.isSingleSelectionList_ = value;
  7608. };
  7609. /**
  7610. * Sets the useActivatedClass_ private variable.
  7611. */
  7612. MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
  7613. this.useActivatedClass_ = useActivated;
  7614. };
  7615. MDCListFoundation.prototype.getSelectedIndex = function () {
  7616. return this.selectedIndex_;
  7617. };
  7618. MDCListFoundation.prototype.setSelectedIndex = function (index) {
  7619. if (!this.isIndexValid_(index)) {
  7620. return;
  7621. }
  7622. if (this.isCheckboxList_) {
  7623. this.setCheckboxAtIndex_(index);
  7624. } else if (this.isRadioList_) {
  7625. this.setRadioAtIndex_(index);
  7626. } else {
  7627. this.setSingleSelectionAtIndex_(index);
  7628. }
  7629. };
  7630. /**
  7631. * Focus in handler for the list items.
  7632. */
  7633. MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) {
  7634. if (listItemIndex >= 0) {
  7635. this.adapter_.setTabIndexForListItemChildren(listItemIndex, '0');
  7636. }
  7637. };
  7638. /**
  7639. * Focus out handler for the list items.
  7640. */
  7641. MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) {
  7642. var _this = this;
  7643. if (listItemIndex >= 0) {
  7644. this.adapter_.setTabIndexForListItemChildren(listItemIndex, '-1');
  7645. }
  7646. /**
  7647. * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus
  7648. * is moved to next element.
  7649. */
  7650. setTimeout(function () {
  7651. if (!_this.adapter_.isFocusInsideList()) {
  7652. _this.setTabindexToFirstSelectedItem_();
  7653. }
  7654. }, 0);
  7655. };
  7656. /**
  7657. * Key handler for the list.
  7658. */
  7659. MDCListFoundation.prototype.handleKeydown = function (evt, isRootListItem, listItemIndex) {
  7660. var isArrowLeft = evt.key === 'ArrowLeft' || evt.keyCode === 37;
  7661. var isArrowUp = evt.key === 'ArrowUp' || evt.keyCode === 38;
  7662. var isArrowRight = evt.key === 'ArrowRight' || evt.keyCode === 39;
  7663. var isArrowDown = evt.key === 'ArrowDown' || evt.keyCode === 40;
  7664. var isHome = evt.key === 'Home' || evt.keyCode === 36;
  7665. var isEnd = evt.key === 'End' || evt.keyCode === 35;
  7666. var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
  7667. var isSpace = evt.key === 'Space' || evt.keyCode === 32;
  7668. if (this.adapter_.isRootFocused()) {
  7669. if (isArrowUp || isEnd) {
  7670. evt.preventDefault();
  7671. this.focusLastElement();
  7672. } else if (isArrowDown || isHome) {
  7673. evt.preventDefault();
  7674. this.focusFirstElement();
  7675. }
  7676. return;
  7677. }
  7678. var currentIndex = this.adapter_.getFocusedElementIndex();
  7679. if (currentIndex === -1) {
  7680. currentIndex = listItemIndex;
  7681. if (currentIndex < 0) {
  7682. // If this event doesn't have a mdc-list-item ancestor from the
  7683. // current list (not from a sublist), return early.
  7684. return;
  7685. }
  7686. }
  7687. var nextIndex;
  7688. if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) {
  7689. this.preventDefaultEvent_(evt);
  7690. nextIndex = this.focusNextElement(currentIndex);
  7691. } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) {
  7692. this.preventDefaultEvent_(evt);
  7693. nextIndex = this.focusPrevElement(currentIndex);
  7694. } else if (isHome) {
  7695. this.preventDefaultEvent_(evt);
  7696. nextIndex = this.focusFirstElement();
  7697. } else if (isEnd) {
  7698. this.preventDefaultEvent_(evt);
  7699. nextIndex = this.focusLastElement();
  7700. } else if (isEnter || isSpace) {
  7701. if (isRootListItem) {
  7702. // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event.
  7703. var target = evt.target;
  7704. if (target && target.tagName === 'A' && isEnter) {
  7705. return;
  7706. }
  7707. this.preventDefaultEvent_(evt);
  7708. if (this.isSelectableList_()) {
  7709. this.setSelectedIndexOnAction_(currentIndex);
  7710. }
  7711. this.adapter_.notifyAction(currentIndex);
  7712. }
  7713. }
  7714. this.focusedItemIndex_ = currentIndex;
  7715. if (nextIndex !== undefined) {
  7716. this.setTabindexAtIndex_(nextIndex);
  7717. this.focusedItemIndex_ = nextIndex;
  7718. }
  7719. };
  7720. /**
  7721. * Click handler for the list.
  7722. */
  7723. MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) {
  7724. if (index === constants_1.numbers.UNSET_INDEX) {
  7725. return;
  7726. }
  7727. if (this.isSelectableList_()) {
  7728. this.setSelectedIndexOnAction_(index, toggleCheckbox);
  7729. }
  7730. this.adapter_.notifyAction(index);
  7731. this.setTabindexAtIndex_(index);
  7732. this.focusedItemIndex_ = index;
  7733. };
  7734. /**
  7735. * Focuses the next element on the list.
  7736. */
  7737. MDCListFoundation.prototype.focusNextElement = function (index) {
  7738. var count = this.adapter_.getListItemCount();
  7739. var nextIndex = index + 1;
  7740. if (nextIndex >= count) {
  7741. if (this.wrapFocus_) {
  7742. nextIndex = 0;
  7743. } else {
  7744. // Return early because last item is already focused.
  7745. return index;
  7746. }
  7747. }
  7748. this.adapter_.focusItemAtIndex(nextIndex);
  7749. return nextIndex;
  7750. };
  7751. /**
  7752. * Focuses the previous element on the list.
  7753. */
  7754. MDCListFoundation.prototype.focusPrevElement = function (index) {
  7755. var prevIndex = index - 1;
  7756. if (prevIndex < 0) {
  7757. if (this.wrapFocus_) {
  7758. prevIndex = this.adapter_.getListItemCount() - 1;
  7759. } else {
  7760. // Return early because first item is already focused.
  7761. return index;
  7762. }
  7763. }
  7764. this.adapter_.focusItemAtIndex(prevIndex);
  7765. return prevIndex;
  7766. };
  7767. MDCListFoundation.prototype.focusFirstElement = function () {
  7768. this.adapter_.focusItemAtIndex(0);
  7769. return 0;
  7770. };
  7771. MDCListFoundation.prototype.focusLastElement = function () {
  7772. var lastIndex = this.adapter_.getListItemCount() - 1;
  7773. this.adapter_.focusItemAtIndex(lastIndex);
  7774. return lastIndex;
  7775. };
  7776. /**
  7777. * @param itemIndex Index of the list item
  7778. * @param isEnabled Sets the list item to enabled or disabled.
  7779. */
  7780. MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
  7781. if (!this.isIndexValid_(itemIndex)) {
  7782. return;
  7783. }
  7784. if (isEnabled) {
  7785. this.adapter_.removeClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  7786. this.adapter_.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false');
  7787. } else {
  7788. this.adapter_.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  7789. this.adapter_.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true');
  7790. }
  7791. };
  7792. /**
  7793. * Ensures that preventDefault is only called if the containing element doesn't
  7794. * consume the event, and it will cause an unintended scroll.
  7795. */
  7796. MDCListFoundation.prototype.preventDefaultEvent_ = function (evt) {
  7797. var target = evt.target;
  7798. var tagName = ("" + target.tagName).toLowerCase();
  7799. if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
  7800. evt.preventDefault();
  7801. }
  7802. };
  7803. MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) {
  7804. if (this.selectedIndex_ === index) {
  7805. return;
  7806. }
  7807. var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS;
  7808. if (this.useActivatedClass_) {
  7809. selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS;
  7810. }
  7811. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  7812. this.adapter_.removeClassForElementIndex(this.selectedIndex_, selectedClassName);
  7813. }
  7814. this.adapter_.addClassForElementIndex(index, selectedClassName);
  7815. this.setAriaForSingleSelectionAtIndex_(index);
  7816. this.selectedIndex_ = index;
  7817. };
  7818. /**
  7819. * Sets aria attribute for single selection at given index.
  7820. */
  7821. MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) {
  7822. // Detect the presence of aria-current and get the value only during list initialization when it is in unset state.
  7823. if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) {
  7824. this.ariaCurrentAttrValue_ = this.adapter_.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT);
  7825. }
  7826. var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
  7827. var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED;
  7828. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  7829. this.adapter_.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
  7830. }
  7831. var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
  7832. this.adapter_.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
  7833. };
  7834. /**
  7835. * Toggles radio at give index. Radio doesn't change the checked state if it is already checked.
  7836. */
  7837. MDCListFoundation.prototype.setRadioAtIndex_ = function (index) {
  7838. this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, true);
  7839. if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  7840. this.adapter_.setAttributeForElementIndex(this.selectedIndex_, constants_1.strings.ARIA_CHECKED, 'false');
  7841. }
  7842. this.adapter_.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, 'true');
  7843. this.selectedIndex_ = index;
  7844. };
  7845. MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) {
  7846. for (var i = 0; i < this.adapter_.getListItemCount(); i++) {
  7847. var isChecked = false;
  7848. if (index.indexOf(i) >= 0) {
  7849. isChecked = true;
  7850. }
  7851. this.adapter_.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
  7852. this.adapter_.setAttributeForElementIndex(i, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  7853. }
  7854. this.selectedIndex_ = index;
  7855. };
  7856. MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) {
  7857. if (this.focusedItemIndex_ === constants_1.numbers.UNSET_INDEX && index !== 0) {
  7858. // If no list item was selected set first list item's tabindex to -1.
  7859. // Generally, tabindex is set to 0 on first list item of list that has no preselected items.
  7860. this.adapter_.setAttributeForElementIndex(0, 'tabindex', '-1');
  7861. } else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) {
  7862. this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_, 'tabindex', '-1');
  7863. }
  7864. this.adapter_.setAttributeForElementIndex(index, 'tabindex', '0');
  7865. };
  7866. /**
  7867. * @return Return true if it is single selectin list, checkbox list or radio list.
  7868. */
  7869. MDCListFoundation.prototype.isSelectableList_ = function () {
  7870. return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_;
  7871. };
  7872. MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () {
  7873. var targetIndex = 0;
  7874. if (this.isSelectableList_()) {
  7875. if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) {
  7876. targetIndex = this.selectedIndex_;
  7877. } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) {
  7878. targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) {
  7879. return Math.min(currentIndex, minIndex);
  7880. });
  7881. }
  7882. }
  7883. this.setTabindexAtIndex_(targetIndex);
  7884. };
  7885. MDCListFoundation.prototype.isIndexValid_ = function (index) {
  7886. var _this = this;
  7887. if (index instanceof Array) {
  7888. if (!this.isCheckboxList_) {
  7889. throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
  7890. }
  7891. if (index.length === 0) {
  7892. return true;
  7893. } else {
  7894. return index.some(function (i) {
  7895. return _this.isIndexInRange_(i);
  7896. });
  7897. }
  7898. } else if (typeof index === 'number') {
  7899. if (this.isCheckboxList_) {
  7900. throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index);
  7901. }
  7902. return this.isIndexInRange_(index);
  7903. } else {
  7904. return false;
  7905. }
  7906. };
  7907. MDCListFoundation.prototype.isIndexInRange_ = function (index) {
  7908. var listSize = this.adapter_.getListItemCount();
  7909. return index >= 0 && index < listSize;
  7910. };
  7911. /**
  7912. * Sets selected index on user action, toggles checkbox / radio based on toggleCheckbox value.
  7913. * User interaction should not toggle list item(s) when disabled.
  7914. */
  7915. MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) {
  7916. if (toggleCheckbox === void 0) {
  7917. toggleCheckbox = true;
  7918. }
  7919. if (this.adapter_.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) {
  7920. return;
  7921. }
  7922. if (this.isCheckboxList_) {
  7923. this.toggleCheckboxAtIndex_(index, toggleCheckbox);
  7924. } else {
  7925. this.setSelectedIndex(index);
  7926. }
  7927. };
  7928. MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) {
  7929. var isChecked = this.adapter_.isCheckboxCheckedAtIndex(index);
  7930. if (toggleCheckbox) {
  7931. isChecked = !isChecked;
  7932. this.adapter_.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
  7933. }
  7934. this.adapter_.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false');
  7935. // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value.
  7936. var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice();
  7937. if (isChecked) {
  7938. selectedIndexes.push(index);
  7939. } else {
  7940. selectedIndexes = selectedIndexes.filter(function (i) {
  7941. return i !== index;
  7942. });
  7943. }
  7944. this.selectedIndex_ = selectedIndexes;
  7945. };
  7946. return MDCListFoundation;
  7947. }(foundation_1.MDCFoundation);
  7948. exports.MDCListFoundation = MDCListFoundation;
  7949. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7950. exports.default = MDCListFoundation;
  7951. /***/ }),
  7952. /***/ "./packages/mdc-list/index.ts":
  7953. /*!************************************!*\
  7954. !*** ./packages/mdc-list/index.ts ***!
  7955. \************************************/
  7956. /*! no static exports found */
  7957. /***/ (function(module, exports, __webpack_require__) {
  7958. "use strict";
  7959. /**
  7960. * @license
  7961. * Copyright 2019 Google Inc.
  7962. *
  7963. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7964. * of this software and associated documentation files (the "Software"), to deal
  7965. * in the Software without restriction, including without limitation the rights
  7966. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7967. * copies of the Software, and to permit persons to whom the Software is
  7968. * furnished to do so, subject to the following conditions:
  7969. *
  7970. * The above copyright notice and this permission notice shall be included in
  7971. * all copies or substantial portions of the Software.
  7972. *
  7973. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7974. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7975. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7976. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7977. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7978. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7979. * THE SOFTWARE.
  7980. */
  7981. function __export(m) {
  7982. for (var p in m) {
  7983. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  7984. }
  7985. }
  7986. Object.defineProperty(exports, "__esModule", { value: true });
  7987. __export(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts"));
  7988. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"));
  7989. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"));
  7990. /***/ }),
  7991. /***/ "./packages/mdc-menu-surface/component.ts":
  7992. /*!************************************************!*\
  7993. !*** ./packages/mdc-menu-surface/component.ts ***!
  7994. \************************************************/
  7995. /*! no static exports found */
  7996. /***/ (function(module, exports, __webpack_require__) {
  7997. "use strict";
  7998. /**
  7999. * @license
  8000. * Copyright 2018 Google Inc.
  8001. *
  8002. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8003. * of this software and associated documentation files (the "Software"), to deal
  8004. * in the Software without restriction, including without limitation the rights
  8005. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8006. * copies of the Software, and to permit persons to whom the Software is
  8007. * furnished to do so, subject to the following conditions:
  8008. *
  8009. * The above copyright notice and this permission notice shall be included in
  8010. * all copies or substantial portions of the Software.
  8011. *
  8012. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8013. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8014. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8015. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8016. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8017. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8018. * THE SOFTWARE.
  8019. */
  8020. var __extends = this && this.__extends || function () {
  8021. var _extendStatics = function extendStatics(d, b) {
  8022. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8023. d.__proto__ = b;
  8024. } || function (d, b) {
  8025. for (var p in b) {
  8026. if (b.hasOwnProperty(p)) d[p] = b[p];
  8027. }
  8028. };
  8029. return _extendStatics(d, b);
  8030. };
  8031. return function (d, b) {
  8032. _extendStatics(d, b);
  8033. function __() {
  8034. this.constructor = d;
  8035. }
  8036. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8037. };
  8038. }();
  8039. var __importStar = this && this.__importStar || function (mod) {
  8040. if (mod && mod.__esModule) return mod;
  8041. var result = {};
  8042. if (mod != null) for (var k in mod) {
  8043. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8044. }result["default"] = mod;
  8045. return result;
  8046. };
  8047. Object.defineProperty(exports, "__esModule", { value: true });
  8048. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8049. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  8050. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts");
  8051. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  8052. var MDCMenuSurface = /** @class */function (_super) {
  8053. __extends(MDCMenuSurface, _super);
  8054. function MDCMenuSurface() {
  8055. return _super !== null && _super.apply(this, arguments) || this;
  8056. }
  8057. MDCMenuSurface.attachTo = function (root) {
  8058. return new MDCMenuSurface(root);
  8059. };
  8060. MDCMenuSurface.prototype.initialSyncWithDOM = function () {
  8061. var _this = this;
  8062. var parentEl = this.root_.parentElement;
  8063. this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
  8064. if (this.root_.classList.contains(constants_1.cssClasses.FIXED)) {
  8065. this.setFixedPosition(true);
  8066. }
  8067. this.handleKeydown_ = function (evt) {
  8068. return _this.foundation_.handleKeydown(evt);
  8069. };
  8070. this.handleBodyClick_ = function (evt) {
  8071. return _this.foundation_.handleBodyClick(evt);
  8072. };
  8073. this.registerBodyClickListener_ = function () {
  8074. return document.body.addEventListener('click', _this.handleBodyClick_);
  8075. };
  8076. this.deregisterBodyClickListener_ = function () {
  8077. return document.body.removeEventListener('click', _this.handleBodyClick_);
  8078. };
  8079. this.listen('keydown', this.handleKeydown_);
  8080. this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
  8081. this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
  8082. };
  8083. MDCMenuSurface.prototype.destroy = function () {
  8084. this.unlisten('keydown', this.handleKeydown_);
  8085. this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
  8086. this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
  8087. _super.prototype.destroy.call(this);
  8088. };
  8089. MDCMenuSurface.prototype.isOpen = function () {
  8090. return this.foundation_.isOpen();
  8091. };
  8092. MDCMenuSurface.prototype.open = function () {
  8093. this.foundation_.open();
  8094. };
  8095. MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
  8096. if (skipRestoreFocus === void 0) {
  8097. skipRestoreFocus = false;
  8098. }
  8099. this.foundation_.close(skipRestoreFocus);
  8100. };
  8101. Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
  8102. set: function set(quickOpen) {
  8103. this.foundation_.setQuickOpen(quickOpen);
  8104. },
  8105. enumerable: true,
  8106. configurable: true
  8107. });
  8108. /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */
  8109. MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
  8110. this.foundation_.setIsHoisted(isHoisted);
  8111. };
  8112. /** Sets the element that the menu-surface is anchored to. */
  8113. MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
  8114. this.anchorElement = element;
  8115. };
  8116. /** Sets the menu-surface to position: fixed. */
  8117. MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
  8118. if (isFixed) {
  8119. this.root_.classList.add(constants_1.cssClasses.FIXED);
  8120. } else {
  8121. this.root_.classList.remove(constants_1.cssClasses.FIXED);
  8122. }
  8123. this.foundation_.setFixedPosition(isFixed);
  8124. };
  8125. /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */
  8126. MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
  8127. this.foundation_.setAbsolutePosition(x, y);
  8128. this.setIsHoisted(true);
  8129. };
  8130. /**
  8131. * @param corner Default anchor corner alignment of top-left surface corner.
  8132. */
  8133. MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
  8134. this.foundation_.setAnchorCorner(corner);
  8135. };
  8136. MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
  8137. this.foundation_.setAnchorMargin(margin);
  8138. };
  8139. MDCMenuSurface.prototype.getDefaultFoundation = function () {
  8140. var _this = this;
  8141. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  8142. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  8143. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8144. var adapter = {
  8145. addClass: function addClass(className) {
  8146. return _this.root_.classList.add(className);
  8147. },
  8148. removeClass: function removeClass(className) {
  8149. return _this.root_.classList.remove(className);
  8150. },
  8151. hasClass: function hasClass(className) {
  8152. return _this.root_.classList.contains(className);
  8153. },
  8154. hasAnchor: function hasAnchor() {
  8155. return !!_this.anchorElement;
  8156. },
  8157. notifyClose: function notifyClose() {
  8158. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
  8159. },
  8160. notifyOpen: function notifyOpen() {
  8161. return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
  8162. },
  8163. isElementInContainer: function isElementInContainer(el) {
  8164. return _this.root_.contains(el);
  8165. },
  8166. isRtl: function isRtl() {
  8167. return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  8168. },
  8169. setTransformOrigin: function setTransformOrigin(origin) {
  8170. var propertyName = util.getTransformPropertyName(window) + "-origin";
  8171. _this.root_.style.setProperty(propertyName, origin);
  8172. },
  8173. isFocused: function isFocused() {
  8174. return document.activeElement === _this.root_;
  8175. },
  8176. saveFocus: function saveFocus() {
  8177. _this.previousFocus_ = document.activeElement;
  8178. },
  8179. restoreFocus: function restoreFocus() {
  8180. if (_this.root_.contains(document.activeElement)) {
  8181. if (_this.previousFocus_ && _this.previousFocus_.focus) {
  8182. _this.previousFocus_.focus();
  8183. }
  8184. }
  8185. },
  8186. getInnerDimensions: function getInnerDimensions() {
  8187. return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight };
  8188. },
  8189. getAnchorDimensions: function getAnchorDimensions() {
  8190. return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
  8191. },
  8192. getWindowDimensions: function getWindowDimensions() {
  8193. return { width: window.innerWidth, height: window.innerHeight };
  8194. },
  8195. getBodyDimensions: function getBodyDimensions() {
  8196. return { width: document.body.clientWidth, height: document.body.clientHeight };
  8197. },
  8198. getWindowScroll: function getWindowScroll() {
  8199. return { x: window.pageXOffset, y: window.pageYOffset };
  8200. },
  8201. setPosition: function setPosition(position) {
  8202. _this.root_.style.left = 'left' in position ? position.left + "px" : '';
  8203. _this.root_.style.right = 'right' in position ? position.right + "px" : '';
  8204. _this.root_.style.top = 'top' in position ? position.top + "px" : '';
  8205. _this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : '';
  8206. },
  8207. setMaxHeight: function setMaxHeight(height) {
  8208. _this.root_.style.maxHeight = height;
  8209. }
  8210. };
  8211. // tslint:enable:object-literal-sort-keys
  8212. return new foundation_1.MDCMenuSurfaceFoundation(adapter);
  8213. };
  8214. return MDCMenuSurface;
  8215. }(component_1.MDCComponent);
  8216. exports.MDCMenuSurface = MDCMenuSurface;
  8217. /***/ }),
  8218. /***/ "./packages/mdc-menu-surface/constants.ts":
  8219. /*!************************************************!*\
  8220. !*** ./packages/mdc-menu-surface/constants.ts ***!
  8221. \************************************************/
  8222. /*! no static exports found */
  8223. /***/ (function(module, exports, __webpack_require__) {
  8224. "use strict";
  8225. /**
  8226. * @license
  8227. * Copyright 2018 Google Inc.
  8228. *
  8229. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8230. * of this software and associated documentation files (the "Software"), to deal
  8231. * in the Software without restriction, including without limitation the rights
  8232. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8233. * copies of the Software, and to permit persons to whom the Software is
  8234. * furnished to do so, subject to the following conditions:
  8235. *
  8236. * The above copyright notice and this permission notice shall be included in
  8237. * all copies or substantial portions of the Software.
  8238. *
  8239. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8240. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8241. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8242. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8243. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8244. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8245. * THE SOFTWARE.
  8246. */
  8247. Object.defineProperty(exports, "__esModule", { value: true });
  8248. var cssClasses = {
  8249. ANCHOR: 'mdc-menu-surface--anchor',
  8250. ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
  8251. ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
  8252. FIXED: 'mdc-menu-surface--fixed',
  8253. OPEN: 'mdc-menu-surface--open',
  8254. ROOT: 'mdc-menu-surface'
  8255. };
  8256. exports.cssClasses = cssClasses;
  8257. // tslint:disable:object-literal-sort-keys
  8258. var strings = {
  8259. CLOSED_EVENT: 'MDCMenuSurface:closed',
  8260. OPENED_EVENT: 'MDCMenuSurface:opened',
  8261. 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(', ')
  8262. };
  8263. exports.strings = strings;
  8264. // tslint:enable:object-literal-sort-keys
  8265. var numbers = {
  8266. /** Total duration of menu-surface open animation. */
  8267. TRANSITION_OPEN_DURATION: 120,
  8268. /** Total duration of menu-surface close animation. */
  8269. TRANSITION_CLOSE_DURATION: 75,
  8270. /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */
  8271. MARGIN_TO_EDGE: 32,
  8272. /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */
  8273. ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67
  8274. };
  8275. exports.numbers = numbers;
  8276. /**
  8277. * Enum for bits in the {@see Corner) bitmap.
  8278. */
  8279. var CornerBit;
  8280. (function (CornerBit) {
  8281. CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
  8282. CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
  8283. CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
  8284. CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
  8285. })(CornerBit || (CornerBit = {}));
  8286. exports.CornerBit = CornerBit;
  8287. /**
  8288. * Enum for representing an element corner for positioning the menu-surface.
  8289. *
  8290. * The START constants map to LEFT if element directionality is left
  8291. * to right and RIGHT if the directionality is right to left.
  8292. * Likewise END maps to RIGHT or LEFT depending on the directionality.
  8293. */
  8294. var Corner;
  8295. (function (Corner) {
  8296. Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
  8297. Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
  8298. Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
  8299. Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
  8300. Corner[Corner["TOP_START"] = 8] = "TOP_START";
  8301. Corner[Corner["TOP_END"] = 12] = "TOP_END";
  8302. Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
  8303. Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
  8304. })(Corner || (Corner = {}));
  8305. exports.Corner = Corner;
  8306. /***/ }),
  8307. /***/ "./packages/mdc-menu-surface/foundation.ts":
  8308. /*!*************************************************!*\
  8309. !*** ./packages/mdc-menu-surface/foundation.ts ***!
  8310. \*************************************************/
  8311. /*! no static exports found */
  8312. /***/ (function(module, exports, __webpack_require__) {
  8313. "use strict";
  8314. /**
  8315. * @license
  8316. * Copyright 2018 Google Inc.
  8317. *
  8318. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8319. * of this software and associated documentation files (the "Software"), to deal
  8320. * in the Software without restriction, including without limitation the rights
  8321. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8322. * copies of the Software, and to permit persons to whom the Software is
  8323. * furnished to do so, subject to the following conditions:
  8324. *
  8325. * The above copyright notice and this permission notice shall be included in
  8326. * all copies or substantial portions of the Software.
  8327. *
  8328. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8329. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8330. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8331. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8332. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8333. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8334. * THE SOFTWARE.
  8335. */
  8336. var __extends = this && this.__extends || function () {
  8337. var _extendStatics = function extendStatics(d, b) {
  8338. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8339. d.__proto__ = b;
  8340. } || function (d, b) {
  8341. for (var p in b) {
  8342. if (b.hasOwnProperty(p)) d[p] = b[p];
  8343. }
  8344. };
  8345. return _extendStatics(d, b);
  8346. };
  8347. return function (d, b) {
  8348. _extendStatics(d, b);
  8349. function __() {
  8350. this.constructor = d;
  8351. }
  8352. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8353. };
  8354. }();
  8355. var __assign = this && this.__assign || function () {
  8356. __assign = Object.assign || function (t) {
  8357. for (var s, i = 1, n = arguments.length; i < n; i++) {
  8358. s = arguments[i];
  8359. for (var p in s) {
  8360. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  8361. }
  8362. }
  8363. return t;
  8364. };
  8365. return __assign.apply(this, arguments);
  8366. };
  8367. var __values = this && this.__values || function (o) {
  8368. var m = typeof Symbol === "function" && o[Symbol.iterator],
  8369. i = 0;
  8370. if (m) return m.call(o);
  8371. return {
  8372. next: function next() {
  8373. if (o && i >= o.length) o = void 0;
  8374. return { value: o && o[i++], done: !o };
  8375. }
  8376. };
  8377. };
  8378. Object.defineProperty(exports, "__esModule", { value: true });
  8379. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  8380. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
  8381. var MDCMenuSurfaceFoundation = /** @class */function (_super) {
  8382. __extends(MDCMenuSurfaceFoundation, _super);
  8383. function MDCMenuSurfaceFoundation(adapter) {
  8384. var _this = _super.call(this, __assign({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this;
  8385. _this.isOpen_ = false;
  8386. _this.isQuickOpen_ = false;
  8387. _this.isHoistedElement_ = false;
  8388. _this.isFixedPosition_ = false;
  8389. _this.openAnimationEndTimerId_ = 0;
  8390. _this.closeAnimationEndTimerId_ = 0;
  8391. _this.animationRequestId_ = 0;
  8392. _this.anchorCorner_ = constants_1.Corner.TOP_START;
  8393. _this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 };
  8394. _this.position_ = { x: 0, y: 0 };
  8395. return _this;
  8396. }
  8397. Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
  8398. get: function get() {
  8399. return constants_1.cssClasses;
  8400. },
  8401. enumerable: true,
  8402. configurable: true
  8403. });
  8404. Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
  8405. get: function get() {
  8406. return constants_1.strings;
  8407. },
  8408. enumerable: true,
  8409. configurable: true
  8410. });
  8411. Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
  8412. get: function get() {
  8413. return constants_1.numbers;
  8414. },
  8415. enumerable: true,
  8416. configurable: true
  8417. });
  8418. Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
  8419. get: function get() {
  8420. return constants_1.Corner;
  8421. },
  8422. enumerable: true,
  8423. configurable: true
  8424. });
  8425. Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
  8426. /**
  8427. * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
  8428. */
  8429. get: function get() {
  8430. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8431. return {
  8432. addClass: function addClass() {
  8433. return undefined;
  8434. },
  8435. removeClass: function removeClass() {
  8436. return undefined;
  8437. },
  8438. hasClass: function hasClass() {
  8439. return false;
  8440. },
  8441. hasAnchor: function hasAnchor() {
  8442. return false;
  8443. },
  8444. isElementInContainer: function isElementInContainer() {
  8445. return false;
  8446. },
  8447. isFocused: function isFocused() {
  8448. return false;
  8449. },
  8450. isRtl: function isRtl() {
  8451. return false;
  8452. },
  8453. getInnerDimensions: function getInnerDimensions() {
  8454. return { height: 0, width: 0 };
  8455. },
  8456. getAnchorDimensions: function getAnchorDimensions() {
  8457. return null;
  8458. },
  8459. getWindowDimensions: function getWindowDimensions() {
  8460. return { height: 0, width: 0 };
  8461. },
  8462. getBodyDimensions: function getBodyDimensions() {
  8463. return { height: 0, width: 0 };
  8464. },
  8465. getWindowScroll: function getWindowScroll() {
  8466. return { x: 0, y: 0 };
  8467. },
  8468. setPosition: function setPosition() {
  8469. return undefined;
  8470. },
  8471. setMaxHeight: function setMaxHeight() {
  8472. return undefined;
  8473. },
  8474. setTransformOrigin: function setTransformOrigin() {
  8475. return undefined;
  8476. },
  8477. saveFocus: function saveFocus() {
  8478. return undefined;
  8479. },
  8480. restoreFocus: function restoreFocus() {
  8481. return undefined;
  8482. },
  8483. notifyClose: function notifyClose() {
  8484. return undefined;
  8485. },
  8486. notifyOpen: function notifyOpen() {
  8487. return undefined;
  8488. }
  8489. };
  8490. // tslint:enable:object-literal-sort-keys
  8491. },
  8492. enumerable: true,
  8493. configurable: true
  8494. });
  8495. MDCMenuSurfaceFoundation.prototype.init = function () {
  8496. var _a = MDCMenuSurfaceFoundation.cssClasses,
  8497. ROOT = _a.ROOT,
  8498. OPEN = _a.OPEN;
  8499. if (!this.adapter_.hasClass(ROOT)) {
  8500. throw new Error(ROOT + " class required in root element.");
  8501. }
  8502. if (this.adapter_.hasClass(OPEN)) {
  8503. this.isOpen_ = true;
  8504. }
  8505. };
  8506. MDCMenuSurfaceFoundation.prototype.destroy = function () {
  8507. clearTimeout(this.openAnimationEndTimerId_);
  8508. clearTimeout(this.closeAnimationEndTimerId_);
  8509. // Cancel any currently running animations.
  8510. cancelAnimationFrame(this.animationRequestId_);
  8511. };
  8512. /**
  8513. * @param corner Default anchor corner alignment of top-left menu surface corner.
  8514. */
  8515. MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
  8516. this.anchorCorner_ = corner;
  8517. };
  8518. /**
  8519. * @param margin Set of margin values from anchor.
  8520. */
  8521. MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
  8522. this.anchorMargin_.top = margin.top || 0;
  8523. this.anchorMargin_.right = margin.right || 0;
  8524. this.anchorMargin_.bottom = margin.bottom || 0;
  8525. this.anchorMargin_.left = margin.left || 0;
  8526. };
  8527. /** Used to indicate if the menu-surface is hoisted to the body. */
  8528. MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
  8529. this.isHoistedElement_ = isHoisted;
  8530. };
  8531. /** Used to set the menu-surface calculations based on a fixed position menu. */
  8532. MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
  8533. this.isFixedPosition_ = isFixedPosition;
  8534. };
  8535. /** Sets the menu-surface position on the page. */
  8536. MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
  8537. this.position_.x = this.isFinite_(x) ? x : 0;
  8538. this.position_.y = this.isFinite_(y) ? y : 0;
  8539. };
  8540. MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
  8541. this.isQuickOpen_ = quickOpen;
  8542. };
  8543. MDCMenuSurfaceFoundation.prototype.isOpen = function () {
  8544. return this.isOpen_;
  8545. };
  8546. /**
  8547. * Open the menu surface.
  8548. */
  8549. MDCMenuSurfaceFoundation.prototype.open = function () {
  8550. var _this = this;
  8551. this.adapter_.saveFocus();
  8552. if (!this.isQuickOpen_) {
  8553. this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  8554. }
  8555. this.animationRequestId_ = requestAnimationFrame(function () {
  8556. _this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  8557. _this.dimensions_ = _this.adapter_.getInnerDimensions();
  8558. _this.autoPosition_();
  8559. if (_this.isQuickOpen_) {
  8560. _this.adapter_.notifyOpen();
  8561. } else {
  8562. _this.openAnimationEndTimerId_ = setTimeout(function () {
  8563. _this.openAnimationEndTimerId_ = 0;
  8564. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
  8565. _this.adapter_.notifyOpen();
  8566. }, constants_1.numbers.TRANSITION_OPEN_DURATION);
  8567. }
  8568. });
  8569. this.isOpen_ = true;
  8570. };
  8571. /**
  8572. * Closes the menu surface.
  8573. */
  8574. MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
  8575. var _this = this;
  8576. if (skipRestoreFocus === void 0) {
  8577. skipRestoreFocus = false;
  8578. }
  8579. if (!this.isQuickOpen_) {
  8580. this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  8581. }
  8582. requestAnimationFrame(function () {
  8583. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
  8584. if (_this.isQuickOpen_) {
  8585. _this.adapter_.notifyClose();
  8586. } else {
  8587. _this.closeAnimationEndTimerId_ = setTimeout(function () {
  8588. _this.closeAnimationEndTimerId_ = 0;
  8589. _this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
  8590. _this.adapter_.notifyClose();
  8591. }, constants_1.numbers.TRANSITION_CLOSE_DURATION);
  8592. }
  8593. });
  8594. this.isOpen_ = false;
  8595. if (!skipRestoreFocus) {
  8596. this.maybeRestoreFocus_();
  8597. }
  8598. };
  8599. /** Handle clicks and close if not within menu-surface element. */
  8600. MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
  8601. var el = evt.target;
  8602. if (this.adapter_.isElementInContainer(el)) {
  8603. return;
  8604. }
  8605. this.close();
  8606. };
  8607. /** Handle keys that close the surface. */
  8608. MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
  8609. var keyCode = evt.keyCode,
  8610. key = evt.key;
  8611. var isEscape = key === 'Escape' || keyCode === 27;
  8612. if (isEscape) {
  8613. this.close();
  8614. }
  8615. };
  8616. MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () {
  8617. var _a;
  8618. // Compute measurements for autoposition methods reuse.
  8619. this.measurements_ = this.getAutoLayoutMeasurements_();
  8620. var corner = this.getOriginCorner_();
  8621. var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner);
  8622. var verticalAlignment = this.hasBit_(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top';
  8623. var horizontalAlignment = this.hasBit_(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left';
  8624. var horizontalOffset = this.getHorizontalOriginOffset_(corner);
  8625. var verticalOffset = this.getVerticalOriginOffset_(corner);
  8626. var _b = this.measurements_,
  8627. anchorSize = _b.anchorSize,
  8628. surfaceSize = _b.surfaceSize;
  8629. var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
  8630. // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner.
  8631. if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
  8632. horizontalAlignment = 'center';
  8633. }
  8634. // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element
  8635. if (this.isHoistedElement_ || this.isFixedPosition_) {
  8636. this.adjustPositionForHoistedElement_(position);
  8637. }
  8638. this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
  8639. this.adapter_.setPosition(position);
  8640. this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
  8641. };
  8642. /**
  8643. * @return Measurements used to position menu surface popup.
  8644. */
  8645. MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () {
  8646. var anchorRect = this.adapter_.getAnchorDimensions();
  8647. var bodySize = this.adapter_.getBodyDimensions();
  8648. var viewportSize = this.adapter_.getWindowDimensions();
  8649. var windowScroll = this.adapter_.getWindowScroll();
  8650. if (!anchorRect) {
  8651. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  8652. anchorRect = {
  8653. top: this.position_.y,
  8654. right: this.position_.x,
  8655. bottom: this.position_.y,
  8656. left: this.position_.x,
  8657. width: 0,
  8658. height: 0
  8659. };
  8660. // tslint:enable:object-literal-sort-keys
  8661. }
  8662. return {
  8663. anchorSize: anchorRect,
  8664. bodySize: bodySize,
  8665. surfaceSize: this.dimensions_,
  8666. viewportDistance: {
  8667. // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
  8668. top: anchorRect.top,
  8669. right: viewportSize.width - anchorRect.right,
  8670. bottom: viewportSize.height - anchorRect.bottom,
  8671. left: anchorRect.left
  8672. },
  8673. viewportSize: viewportSize,
  8674. windowScroll: windowScroll
  8675. };
  8676. };
  8677. /**
  8678. * Computes the corner of the anchor from which to animate and position the menu surface.
  8679. */
  8680. MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () {
  8681. // Defaults: open from the top left.
  8682. var corner = constants_1.Corner.TOP_LEFT;
  8683. var _a = this.measurements_,
  8684. viewportDistance = _a.viewportDistance,
  8685. anchorSize = _a.anchorSize,
  8686. surfaceSize = _a.surfaceSize;
  8687. var isBottomAligned = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  8688. var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top;
  8689. var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top;
  8690. var topOverflow = surfaceSize.height - availableTop;
  8691. var bottomOverflow = surfaceSize.height - availableBottom;
  8692. if (bottomOverflow > 0 && topOverflow < bottomOverflow) {
  8693. corner = this.setBit_(corner, constants_1.CornerBit.BOTTOM);
  8694. }
  8695. var isRtl = this.adapter_.isRtl();
  8696. var isFlipRtl = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.FLIP_RTL);
  8697. var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
  8698. var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl;
  8699. var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left;
  8700. var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left;
  8701. var leftOverflow = surfaceSize.width - availableLeft;
  8702. var rightOverflow = surfaceSize.width - availableRight;
  8703. if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) {
  8704. corner = this.setBit_(corner, constants_1.CornerBit.RIGHT);
  8705. }
  8706. return corner;
  8707. };
  8708. /**
  8709. * @param corner Origin corner of the menu surface.
  8710. * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set.
  8711. */
  8712. MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) {
  8713. var viewportDistance = this.measurements_.viewportDistance;
  8714. var maxHeight = 0;
  8715. var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
  8716. var isBottomAnchored = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  8717. var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
  8718. // When maximum height is not specified, it is handled from CSS.
  8719. if (isBottomAligned) {
  8720. maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE;
  8721. if (!isBottomAnchored) {
  8722. maxHeight += this.measurements_.anchorSize.height;
  8723. }
  8724. } else {
  8725. maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE;
  8726. if (isBottomAnchored) {
  8727. maxHeight -= this.measurements_.anchorSize.height;
  8728. }
  8729. }
  8730. return maxHeight;
  8731. };
  8732. /**
  8733. * @param corner Origin corner of the menu surface.
  8734. * @return Horizontal offset of menu surface origin corner from corresponding anchor corner.
  8735. */
  8736. MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) {
  8737. var anchorSize = this.measurements_.anchorSize;
  8738. // isRightAligned corresponds to using the 'right' property on the surface.
  8739. var isRightAligned = this.hasBit_(corner, constants_1.CornerBit.RIGHT);
  8740. var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
  8741. if (isRightAligned) {
  8742. var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right;
  8743. // For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so
  8744. // when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position,
  8745. // the right property is correct.
  8746. if (this.isHoistedElement_ || this.isFixedPosition_) {
  8747. return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width);
  8748. }
  8749. return rightOffset;
  8750. }
  8751. return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left;
  8752. };
  8753. /**
  8754. * @param corner Origin corner of the menu surface.
  8755. * @return Vertical offset of menu surface origin corner from corresponding anchor corner.
  8756. */
  8757. MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) {
  8758. var anchorSize = this.measurements_.anchorSize;
  8759. var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
  8760. var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
  8761. var y = 0;
  8762. if (isBottomAligned) {
  8763. y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom;
  8764. } else {
  8765. y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top;
  8766. }
  8767. return y;
  8768. };
  8769. /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */
  8770. MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) {
  8771. var e_1, _a;
  8772. var _b = this.measurements_,
  8773. windowScroll = _b.windowScroll,
  8774. viewportDistance = _b.viewportDistance;
  8775. var props = Object.keys(position);
  8776. try {
  8777. for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
  8778. var prop = props_1_1.value;
  8779. var value = position[prop] || 0;
  8780. // Hoisted surfaces need to have the anchor elements location on the page added to the
  8781. // position properties for proper alignment on the body.
  8782. value += viewportDistance[prop];
  8783. // Surfaces that are absolutely positioned need to have additional calculations for scroll
  8784. // and bottom positioning.
  8785. if (!this.isFixedPosition_) {
  8786. if (prop === 'top') {
  8787. value += windowScroll.y;
  8788. } else if (prop === 'bottom') {
  8789. value -= windowScroll.y;
  8790. } else if (prop === 'left') {
  8791. value += windowScroll.x;
  8792. } else {
  8793. // prop === 'right'
  8794. value -= windowScroll.x;
  8795. }
  8796. }
  8797. position[prop] = value;
  8798. }
  8799. } catch (e_1_1) {
  8800. e_1 = { error: e_1_1 };
  8801. } finally {
  8802. try {
  8803. if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
  8804. } finally {
  8805. if (e_1) throw e_1.error;
  8806. }
  8807. }
  8808. };
  8809. /**
  8810. * The last focused element when the menu surface was opened should regain focus, if the user is
  8811. * focused on or within the menu surface when it is closed.
  8812. */
  8813. MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () {
  8814. var isRootFocused = this.adapter_.isFocused();
  8815. var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement);
  8816. if (isRootFocused || childHasFocus) {
  8817. this.adapter_.restoreFocus();
  8818. }
  8819. };
  8820. MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) {
  8821. return Boolean(corner & bit); // tslint:disable-line:no-bitwise
  8822. };
  8823. MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) {
  8824. return corner | bit; // tslint:disable-line:no-bitwise
  8825. };
  8826. /**
  8827. * isFinite that doesn't force conversion to number type.
  8828. * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
  8829. */
  8830. MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) {
  8831. return typeof num === 'number' && isFinite(num);
  8832. };
  8833. return MDCMenuSurfaceFoundation;
  8834. }(foundation_1.MDCFoundation);
  8835. exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
  8836. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  8837. exports.default = MDCMenuSurfaceFoundation;
  8838. /***/ }),
  8839. /***/ "./packages/mdc-menu-surface/index.ts":
  8840. /*!********************************************!*\
  8841. !*** ./packages/mdc-menu-surface/index.ts ***!
  8842. \********************************************/
  8843. /*! no static exports found */
  8844. /***/ (function(module, exports, __webpack_require__) {
  8845. "use strict";
  8846. /**
  8847. * @license
  8848. * Copyright 2019 Google Inc.
  8849. *
  8850. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8851. * of this software and associated documentation files (the "Software"), to deal
  8852. * in the Software without restriction, including without limitation the rights
  8853. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8854. * copies of the Software, and to permit persons to whom the Software is
  8855. * furnished to do so, subject to the following conditions:
  8856. *
  8857. * The above copyright notice and this permission notice shall be included in
  8858. * all copies or substantial portions of the Software.
  8859. *
  8860. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8861. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8862. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8863. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8864. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8865. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8866. * THE SOFTWARE.
  8867. */
  8868. function __export(m) {
  8869. for (var p in m) {
  8870. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  8871. }
  8872. }
  8873. var __importStar = this && this.__importStar || function (mod) {
  8874. if (mod && mod.__esModule) return mod;
  8875. var result = {};
  8876. if (mod != null) for (var k in mod) {
  8877. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8878. }result["default"] = mod;
  8879. return result;
  8880. };
  8881. Object.defineProperty(exports, "__esModule", { value: true });
  8882. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
  8883. exports.util = util;
  8884. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts"));
  8885. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"));
  8886. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"));
  8887. /***/ }),
  8888. /***/ "./packages/mdc-menu-surface/util.ts":
  8889. /*!*******************************************!*\
  8890. !*** ./packages/mdc-menu-surface/util.ts ***!
  8891. \*******************************************/
  8892. /*! no static exports found */
  8893. /***/ (function(module, exports, __webpack_require__) {
  8894. "use strict";
  8895. /**
  8896. * @license
  8897. * Copyright 2018 Google Inc.
  8898. *
  8899. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8900. * of this software and associated documentation files (the "Software"), to deal
  8901. * in the Software without restriction, including without limitation the rights
  8902. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8903. * copies of the Software, and to permit persons to whom the Software is
  8904. * furnished to do so, subject to the following conditions:
  8905. *
  8906. * The above copyright notice and this permission notice shall be included in
  8907. * all copies or substantial portions of the Software.
  8908. *
  8909. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8910. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8911. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8912. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8913. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8914. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8915. * THE SOFTWARE.
  8916. */
  8917. Object.defineProperty(exports, "__esModule", { value: true });
  8918. var cachedCssTransformPropertyName_;
  8919. /**
  8920. * Returns the name of the correct transform property to use on the current browser.
  8921. */
  8922. function getTransformPropertyName(globalObj, forceRefresh) {
  8923. if (forceRefresh === void 0) {
  8924. forceRefresh = false;
  8925. }
  8926. if (cachedCssTransformPropertyName_ === undefined || forceRefresh) {
  8927. var el = globalObj.document.createElement('div');
  8928. cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform';
  8929. }
  8930. return cachedCssTransformPropertyName_;
  8931. }
  8932. exports.getTransformPropertyName = getTransformPropertyName;
  8933. /***/ }),
  8934. /***/ "./packages/mdc-menu/component.ts":
  8935. /*!****************************************!*\
  8936. !*** ./packages/mdc-menu/component.ts ***!
  8937. \****************************************/
  8938. /*! no static exports found */
  8939. /***/ (function(module, exports, __webpack_require__) {
  8940. "use strict";
  8941. /**
  8942. * @license
  8943. * Copyright 2018 Google Inc.
  8944. *
  8945. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8946. * of this software and associated documentation files (the "Software"), to deal
  8947. * in the Software without restriction, including without limitation the rights
  8948. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8949. * copies of the Software, and to permit persons to whom the Software is
  8950. * furnished to do so, subject to the following conditions:
  8951. *
  8952. * The above copyright notice and this permission notice shall be included in
  8953. * all copies or substantial portions of the Software.
  8954. *
  8955. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8956. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8957. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8958. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8959. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8960. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8961. * THE SOFTWARE.
  8962. */
  8963. var __extends = this && this.__extends || function () {
  8964. var _extendStatics = function extendStatics(d, b) {
  8965. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8966. d.__proto__ = b;
  8967. } || function (d, b) {
  8968. for (var p in b) {
  8969. if (b.hasOwnProperty(p)) d[p] = b[p];
  8970. }
  8971. };
  8972. return _extendStatics(d, b);
  8973. };
  8974. return function (d, b) {
  8975. _extendStatics(d, b);
  8976. function __() {
  8977. this.constructor = d;
  8978. }
  8979. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8980. };
  8981. }();
  8982. Object.defineProperty(exports, "__esModule", { value: true });
  8983. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8984. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  8985. var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts");
  8986. var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts");
  8987. var component_3 = __webpack_require__(/*! @material/menu-surface/component */ "./packages/mdc-menu-surface/component.ts");
  8988. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  8989. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  8990. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts");
  8991. var MDCMenu = /** @class */function (_super) {
  8992. __extends(MDCMenu, _super);
  8993. function MDCMenu() {
  8994. return _super !== null && _super.apply(this, arguments) || this;
  8995. }
  8996. MDCMenu.attachTo = function (root) {
  8997. return new MDCMenu(root);
  8998. };
  8999. MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
  9000. if (menuSurfaceFactory === void 0) {
  9001. menuSurfaceFactory = function menuSurfaceFactory(el) {
  9002. return new component_3.MDCMenuSurface(el);
  9003. };
  9004. }
  9005. if (listFactory === void 0) {
  9006. listFactory = function listFactory(el) {
  9007. return new component_2.MDCList(el);
  9008. };
  9009. }
  9010. this.menuSurfaceFactory_ = menuSurfaceFactory;
  9011. this.listFactory_ = listFactory;
  9012. };
  9013. MDCMenu.prototype.initialSyncWithDOM = function () {
  9014. var _this = this;
  9015. this.menuSurface_ = this.menuSurfaceFactory_(this.root_);
  9016. var list = this.root_.querySelector(constants_1.strings.LIST_SELECTOR);
  9017. if (list) {
  9018. this.list_ = this.listFactory_(list);
  9019. this.list_.wrapFocus = true;
  9020. } else {
  9021. this.list_ = null;
  9022. }
  9023. this.handleKeydown_ = function (evt) {
  9024. return _this.foundation_.handleKeydown(evt);
  9025. };
  9026. this.handleItemAction_ = function (evt) {
  9027. return _this.foundation_.handleItemAction(_this.items[evt.detail.index]);
  9028. };
  9029. this.handleMenuSurfaceOpened_ = function () {
  9030. return _this.foundation_.handleMenuSurfaceOpened();
  9031. };
  9032. this.menuSurface_.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  9033. this.listen('keydown', this.handleKeydown_);
  9034. this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  9035. };
  9036. MDCMenu.prototype.destroy = function () {
  9037. if (this.list_) {
  9038. this.list_.destroy();
  9039. }
  9040. this.menuSurface_.destroy();
  9041. this.menuSurface_.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened_);
  9042. this.unlisten('keydown', this.handleKeydown_);
  9043. this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction_);
  9044. _super.prototype.destroy.call(this);
  9045. };
  9046. Object.defineProperty(MDCMenu.prototype, "open", {
  9047. get: function get() {
  9048. return this.menuSurface_.isOpen();
  9049. },
  9050. set: function set(value) {
  9051. if (value) {
  9052. this.menuSurface_.open();
  9053. } else {
  9054. this.menuSurface_.close();
  9055. }
  9056. },
  9057. enumerable: true,
  9058. configurable: true
  9059. });
  9060. Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
  9061. get: function get() {
  9062. return this.list_ ? this.list_.wrapFocus : false;
  9063. },
  9064. set: function set(value) {
  9065. if (this.list_) {
  9066. this.list_.wrapFocus = value;
  9067. }
  9068. },
  9069. enumerable: true,
  9070. configurable: true
  9071. });
  9072. Object.defineProperty(MDCMenu.prototype, "items", {
  9073. /**
  9074. * Return the items within the menu. Note that this only contains the set of elements within
  9075. * the items container that are proper list items, and not supplemental / presentational DOM
  9076. * elements.
  9077. */
  9078. get: function get() {
  9079. return this.list_ ? this.list_.listElements : [];
  9080. },
  9081. enumerable: true,
  9082. configurable: true
  9083. });
  9084. Object.defineProperty(MDCMenu.prototype, "quickOpen", {
  9085. set: function set(quickOpen) {
  9086. this.menuSurface_.quickOpen = quickOpen;
  9087. },
  9088. enumerable: true,
  9089. configurable: true
  9090. });
  9091. /**
  9092. * Sets default focus state where the menu should focus every time when menu
  9093. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  9094. * default.
  9095. * @param focusState Default focus state.
  9096. */
  9097. MDCMenu.prototype.setDefaultFocusState = function (focusState) {
  9098. this.foundation_.setDefaultFocusState(focusState);
  9099. };
  9100. /**
  9101. * @param corner Default anchor corner alignment of top-left menu corner.
  9102. */
  9103. MDCMenu.prototype.setAnchorCorner = function (corner) {
  9104. this.menuSurface_.setAnchorCorner(corner);
  9105. };
  9106. MDCMenu.prototype.setAnchorMargin = function (margin) {
  9107. this.menuSurface_.setAnchorMargin(margin);
  9108. };
  9109. /**
  9110. * Sets the list item as the selected row at the specified index.
  9111. * @param index Index of list item within menu.
  9112. */
  9113. MDCMenu.prototype.setSelectedIndex = function (index) {
  9114. this.foundation_.setSelectedIndex(index);
  9115. };
  9116. /**
  9117. * Sets the enabled state to isEnabled for the menu item at the given index.
  9118. * @param index Index of the menu item
  9119. * @param isEnabled The desired enabled state of the menu item.
  9120. */
  9121. MDCMenu.prototype.setEnabled = function (index, isEnabled) {
  9122. this.foundation_.setEnabled(index, isEnabled);
  9123. };
  9124. /**
  9125. * @return The item within the menu at the index specified.
  9126. */
  9127. MDCMenu.prototype.getOptionByIndex = function (index) {
  9128. var items = this.items;
  9129. if (index < items.length) {
  9130. return this.items[index];
  9131. } else {
  9132. return null;
  9133. }
  9134. };
  9135. MDCMenu.prototype.setFixedPosition = function (isFixed) {
  9136. this.menuSurface_.setFixedPosition(isFixed);
  9137. };
  9138. MDCMenu.prototype.setIsHoisted = function (isHoisted) {
  9139. this.menuSurface_.setIsHoisted(isHoisted);
  9140. };
  9141. MDCMenu.prototype.setAbsolutePosition = function (x, y) {
  9142. this.menuSurface_.setAbsolutePosition(x, y);
  9143. };
  9144. /**
  9145. * Sets the element that the menu-surface is anchored to.
  9146. */
  9147. MDCMenu.prototype.setAnchorElement = function (element) {
  9148. this.menuSurface_.anchorElement = element;
  9149. };
  9150. MDCMenu.prototype.getDefaultFoundation = function () {
  9151. var _this = this;
  9152. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  9153. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  9154. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9155. var adapter = {
  9156. addClassToElementAtIndex: function addClassToElementAtIndex(index, className) {
  9157. var list = _this.items;
  9158. list[index].classList.add(className);
  9159. },
  9160. removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) {
  9161. var list = _this.items;
  9162. list[index].classList.remove(className);
  9163. },
  9164. addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) {
  9165. var list = _this.items;
  9166. list[index].setAttribute(attr, value);
  9167. },
  9168. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) {
  9169. var list = _this.items;
  9170. list[index].removeAttribute(attr);
  9171. },
  9172. elementContainsClass: function elementContainsClass(element, className) {
  9173. return element.classList.contains(className);
  9174. },
  9175. closeSurface: function closeSurface(skipRestoreFocus) {
  9176. return _this.menuSurface_.close(skipRestoreFocus);
  9177. },
  9178. getElementIndex: function getElementIndex(element) {
  9179. return _this.items.indexOf(element);
  9180. },
  9181. notifySelected: function notifySelected(evtData) {
  9182. return _this.emit(constants_1.strings.SELECTED_EVENT, {
  9183. index: evtData.index,
  9184. item: _this.items[evtData.index]
  9185. });
  9186. },
  9187. getMenuItemCount: function getMenuItemCount() {
  9188. return _this.items.length;
  9189. },
  9190. focusItemAtIndex: function focusItemAtIndex(index) {
  9191. return _this.items[index].focus();
  9192. },
  9193. focusListRoot: function focusListRoot() {
  9194. return _this.root_.querySelector(constants_1.strings.LIST_SELECTOR).focus();
  9195. },
  9196. isSelectableItemAtIndex: function isSelectableItemAtIndex(index) {
  9197. return !!ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  9198. },
  9199. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) {
  9200. var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_1.cssClasses.MENU_SELECTION_GROUP);
  9201. var selectedItemEl = selectionGroupEl.querySelector("." + constants_1.cssClasses.MENU_SELECTED_LIST_ITEM);
  9202. return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
  9203. }
  9204. };
  9205. // tslint:enable:object-literal-sort-keys
  9206. return new foundation_3.MDCMenuFoundation(adapter);
  9207. };
  9208. return MDCMenu;
  9209. }(component_1.MDCComponent);
  9210. exports.MDCMenu = MDCMenu;
  9211. /***/ }),
  9212. /***/ "./packages/mdc-menu/constants.ts":
  9213. /*!****************************************!*\
  9214. !*** ./packages/mdc-menu/constants.ts ***!
  9215. \****************************************/
  9216. /*! no static exports found */
  9217. /***/ (function(module, exports, __webpack_require__) {
  9218. "use strict";
  9219. /**
  9220. * @license
  9221. * Copyright 2018 Google Inc.
  9222. *
  9223. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9224. * of this software and associated documentation files (the "Software"), to deal
  9225. * in the Software without restriction, including without limitation the rights
  9226. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9227. * copies of the Software, and to permit persons to whom the Software is
  9228. * furnished to do so, subject to the following conditions:
  9229. *
  9230. * The above copyright notice and this permission notice shall be included in
  9231. * all copies or substantial portions of the Software.
  9232. *
  9233. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9234. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9235. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9236. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9237. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9238. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9239. * THE SOFTWARE.
  9240. */
  9241. Object.defineProperty(exports, "__esModule", { value: true });
  9242. var cssClasses = {
  9243. MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
  9244. MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
  9245. ROOT: 'mdc-menu'
  9246. };
  9247. exports.cssClasses = cssClasses;
  9248. var strings = {
  9249. ARIA_CHECKED_ATTR: 'aria-checked',
  9250. ARIA_DISABLED_ATTR: 'aria-disabled',
  9251. CHECKBOX_SELECTOR: 'input[type="checkbox"]',
  9252. LIST_SELECTOR: '.mdc-list',
  9253. SELECTED_EVENT: 'MDCMenu:selected'
  9254. };
  9255. exports.strings = strings;
  9256. var numbers = {
  9257. FOCUS_ROOT_INDEX: -1
  9258. };
  9259. exports.numbers = numbers;
  9260. var DefaultFocusState;
  9261. (function (DefaultFocusState) {
  9262. DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
  9263. DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
  9264. DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
  9265. DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
  9266. })(DefaultFocusState || (DefaultFocusState = {}));
  9267. exports.DefaultFocusState = DefaultFocusState;
  9268. /***/ }),
  9269. /***/ "./packages/mdc-menu/foundation.ts":
  9270. /*!*****************************************!*\
  9271. !*** ./packages/mdc-menu/foundation.ts ***!
  9272. \*****************************************/
  9273. /*! no static exports found */
  9274. /***/ (function(module, exports, __webpack_require__) {
  9275. "use strict";
  9276. /**
  9277. * @license
  9278. * Copyright 2018 Google Inc.
  9279. *
  9280. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9281. * of this software and associated documentation files (the "Software"), to deal
  9282. * in the Software without restriction, including without limitation the rights
  9283. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9284. * copies of the Software, and to permit persons to whom the Software is
  9285. * furnished to do so, subject to the following conditions:
  9286. *
  9287. * The above copyright notice and this permission notice shall be included in
  9288. * all copies or substantial portions of the Software.
  9289. *
  9290. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9291. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9292. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9293. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9294. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9295. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9296. * THE SOFTWARE.
  9297. */
  9298. var __extends = this && this.__extends || function () {
  9299. var _extendStatics = function extendStatics(d, b) {
  9300. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9301. d.__proto__ = b;
  9302. } || function (d, b) {
  9303. for (var p in b) {
  9304. if (b.hasOwnProperty(p)) d[p] = b[p];
  9305. }
  9306. };
  9307. return _extendStatics(d, b);
  9308. };
  9309. return function (d, b) {
  9310. _extendStatics(d, b);
  9311. function __() {
  9312. this.constructor = d;
  9313. }
  9314. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9315. };
  9316. }();
  9317. var __assign = this && this.__assign || function () {
  9318. __assign = Object.assign || function (t) {
  9319. for (var s, i = 1, n = arguments.length; i < n; i++) {
  9320. s = arguments[i];
  9321. for (var p in s) {
  9322. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  9323. }
  9324. }
  9325. return t;
  9326. };
  9327. return __assign.apply(this, arguments);
  9328. };
  9329. Object.defineProperty(exports, "__esModule", { value: true });
  9330. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  9331. var constants_1 = __webpack_require__(/*! @material/list/constants */ "./packages/mdc-list/constants.ts");
  9332. var foundation_2 = __webpack_require__(/*! @material/menu-surface/foundation */ "./packages/mdc-menu-surface/foundation.ts");
  9333. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts");
  9334. var MDCMenuFoundation = /** @class */function (_super) {
  9335. __extends(MDCMenuFoundation, _super);
  9336. function MDCMenuFoundation(adapter) {
  9337. var _this = _super.call(this, __assign({}, MDCMenuFoundation.defaultAdapter, adapter)) || this;
  9338. _this.closeAnimationEndTimerId_ = 0;
  9339. _this.defaultFocusState_ = constants_2.DefaultFocusState.LIST_ROOT;
  9340. return _this;
  9341. }
  9342. Object.defineProperty(MDCMenuFoundation, "cssClasses", {
  9343. get: function get() {
  9344. return constants_2.cssClasses;
  9345. },
  9346. enumerable: true,
  9347. configurable: true
  9348. });
  9349. Object.defineProperty(MDCMenuFoundation, "strings", {
  9350. get: function get() {
  9351. return constants_2.strings;
  9352. },
  9353. enumerable: true,
  9354. configurable: true
  9355. });
  9356. Object.defineProperty(MDCMenuFoundation, "numbers", {
  9357. get: function get() {
  9358. return constants_2.numbers;
  9359. },
  9360. enumerable: true,
  9361. configurable: true
  9362. });
  9363. Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
  9364. /**
  9365. * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
  9366. */
  9367. get: function get() {
  9368. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9369. return {
  9370. addClassToElementAtIndex: function addClassToElementAtIndex() {
  9371. return undefined;
  9372. },
  9373. removeClassFromElementAtIndex: function removeClassFromElementAtIndex() {
  9374. return undefined;
  9375. },
  9376. addAttributeToElementAtIndex: function addAttributeToElementAtIndex() {
  9377. return undefined;
  9378. },
  9379. removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() {
  9380. return undefined;
  9381. },
  9382. elementContainsClass: function elementContainsClass() {
  9383. return false;
  9384. },
  9385. closeSurface: function closeSurface() {
  9386. return undefined;
  9387. },
  9388. getElementIndex: function getElementIndex() {
  9389. return -1;
  9390. },
  9391. notifySelected: function notifySelected() {
  9392. return undefined;
  9393. },
  9394. getMenuItemCount: function getMenuItemCount() {
  9395. return 0;
  9396. },
  9397. focusItemAtIndex: function focusItemAtIndex() {
  9398. return undefined;
  9399. },
  9400. focusListRoot: function focusListRoot() {
  9401. return undefined;
  9402. },
  9403. getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() {
  9404. return -1;
  9405. },
  9406. isSelectableItemAtIndex: function isSelectableItemAtIndex() {
  9407. return false;
  9408. }
  9409. };
  9410. // tslint:enable:object-literal-sort-keys
  9411. },
  9412. enumerable: true,
  9413. configurable: true
  9414. });
  9415. MDCMenuFoundation.prototype.destroy = function () {
  9416. if (this.closeAnimationEndTimerId_) {
  9417. clearTimeout(this.closeAnimationEndTimerId_);
  9418. }
  9419. this.adapter_.closeSurface();
  9420. };
  9421. MDCMenuFoundation.prototype.handleKeydown = function (evt) {
  9422. var key = evt.key,
  9423. keyCode = evt.keyCode;
  9424. var isTab = key === 'Tab' || keyCode === 9;
  9425. if (isTab) {
  9426. this.adapter_.closeSurface( /** skipRestoreFocus */true);
  9427. }
  9428. };
  9429. MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
  9430. var _this = this;
  9431. var index = this.adapter_.getElementIndex(listItem);
  9432. if (index < 0) {
  9433. return;
  9434. }
  9435. this.adapter_.notifySelected({ index: index });
  9436. this.adapter_.closeSurface();
  9437. // Wait for the menu to close before adding/removing classes that affect styles.
  9438. this.closeAnimationEndTimerId_ = setTimeout(function () {
  9439. // Recompute the index in case the menu contents have changed.
  9440. var recomputedIndex = _this.adapter_.getElementIndex(listItem);
  9441. if (_this.adapter_.isSelectableItemAtIndex(recomputedIndex)) {
  9442. _this.setSelectedIndex(recomputedIndex);
  9443. }
  9444. }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
  9445. };
  9446. MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
  9447. switch (this.defaultFocusState_) {
  9448. case constants_2.DefaultFocusState.FIRST_ITEM:
  9449. this.adapter_.focusItemAtIndex(0);
  9450. break;
  9451. case constants_2.DefaultFocusState.LAST_ITEM:
  9452. this.adapter_.focusItemAtIndex(this.adapter_.getMenuItemCount() - 1);
  9453. break;
  9454. case constants_2.DefaultFocusState.NONE:
  9455. // Do nothing.
  9456. break;
  9457. default:
  9458. this.adapter_.focusListRoot();
  9459. break;
  9460. }
  9461. };
  9462. /**
  9463. * Sets default focus state where the menu should focus every time when menu
  9464. * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
  9465. * default.
  9466. */
  9467. MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
  9468. this.defaultFocusState_ = focusState;
  9469. };
  9470. /**
  9471. * Selects the list item at `index` within the menu.
  9472. * @param index Index of list item within the menu.
  9473. */
  9474. MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
  9475. this.validatedIndex_(index);
  9476. if (!this.adapter_.isSelectableItemAtIndex(index)) {
  9477. throw new Error('MDCMenuFoundation: No selection group at specified index.');
  9478. }
  9479. var prevSelectedIndex = this.adapter_.getSelectedSiblingOfItemAtIndex(index);
  9480. if (prevSelectedIndex >= 0) {
  9481. this.adapter_.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_2.strings.ARIA_CHECKED_ATTR);
  9482. this.adapter_.removeClassFromElementAtIndex(prevSelectedIndex, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
  9483. }
  9484. this.adapter_.addClassToElementAtIndex(index, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
  9485. this.adapter_.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_CHECKED_ATTR, 'true');
  9486. };
  9487. /**
  9488. * Sets the enabled state to isEnabled for the menu item at the given index.
  9489. * @param index Index of the menu item
  9490. * @param isEnabled The desired enabled state of the menu item.
  9491. */
  9492. MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
  9493. this.validatedIndex_(index);
  9494. if (isEnabled) {
  9495. this.adapter_.removeClassFromElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9496. this.adapter_.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'false');
  9497. } else {
  9498. this.adapter_.addClassToElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
  9499. this.adapter_.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'true');
  9500. }
  9501. };
  9502. MDCMenuFoundation.prototype.validatedIndex_ = function (index) {
  9503. var menuSize = this.adapter_.getMenuItemCount();
  9504. var isIndexInRange = index >= 0 && index < menuSize;
  9505. if (!isIndexInRange) {
  9506. throw new Error('MDCMenuFoundation: No list item at specified index.');
  9507. }
  9508. };
  9509. return MDCMenuFoundation;
  9510. }(foundation_1.MDCFoundation);
  9511. exports.MDCMenuFoundation = MDCMenuFoundation;
  9512. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  9513. exports.default = MDCMenuFoundation;
  9514. /***/ }),
  9515. /***/ "./packages/mdc-menu/index.ts":
  9516. /*!************************************!*\
  9517. !*** ./packages/mdc-menu/index.ts ***!
  9518. \************************************/
  9519. /*! no static exports found */
  9520. /***/ (function(module, exports, __webpack_require__) {
  9521. "use strict";
  9522. /**
  9523. * @license
  9524. * Copyright 2019 Google Inc.
  9525. *
  9526. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9527. * of this software and associated documentation files (the "Software"), to deal
  9528. * in the Software without restriction, including without limitation the rights
  9529. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9530. * copies of the Software, and to permit persons to whom the Software is
  9531. * furnished to do so, subject to the following conditions:
  9532. *
  9533. * The above copyright notice and this permission notice shall be included in
  9534. * all copies or substantial portions of the Software.
  9535. *
  9536. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9537. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9538. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9539. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9540. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9541. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9542. * THE SOFTWARE.
  9543. */
  9544. function __export(m) {
  9545. for (var p in m) {
  9546. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  9547. }
  9548. }
  9549. Object.defineProperty(exports, "__esModule", { value: true });
  9550. var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"); // for backward compatibility
  9551. exports.Corner = constants_1.Corner;
  9552. __export(__webpack_require__(/*! ./component */ "./packages/mdc-menu/component.ts"));
  9553. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu/constants.ts"));
  9554. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu/foundation.ts"));
  9555. /***/ }),
  9556. /***/ "./packages/mdc-notched-outline/component.ts":
  9557. /*!***************************************************!*\
  9558. !*** ./packages/mdc-notched-outline/component.ts ***!
  9559. \***************************************************/
  9560. /*! no static exports found */
  9561. /***/ (function(module, exports, __webpack_require__) {
  9562. "use strict";
  9563. /**
  9564. * @license
  9565. * Copyright 2017 Google Inc.
  9566. *
  9567. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9568. * of this software and associated documentation files (the "Software"), to deal
  9569. * in the Software without restriction, including without limitation the rights
  9570. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9571. * copies of the Software, and to permit persons to whom the Software is
  9572. * furnished to do so, subject to the following conditions:
  9573. *
  9574. * The above copyright notice and this permission notice shall be included in
  9575. * all copies or substantial portions of the Software.
  9576. *
  9577. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9578. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9579. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9580. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9581. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9582. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9583. * THE SOFTWARE.
  9584. */
  9585. var __extends = this && this.__extends || function () {
  9586. var _extendStatics = function extendStatics(d, b) {
  9587. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9588. d.__proto__ = b;
  9589. } || function (d, b) {
  9590. for (var p in b) {
  9591. if (b.hasOwnProperty(p)) d[p] = b[p];
  9592. }
  9593. };
  9594. return _extendStatics(d, b);
  9595. };
  9596. return function (d, b) {
  9597. _extendStatics(d, b);
  9598. function __() {
  9599. this.constructor = d;
  9600. }
  9601. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9602. };
  9603. }();
  9604. Object.defineProperty(exports, "__esModule", { value: true });
  9605. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  9606. var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts");
  9607. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  9608. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts");
  9609. var MDCNotchedOutline = /** @class */function (_super) {
  9610. __extends(MDCNotchedOutline, _super);
  9611. function MDCNotchedOutline() {
  9612. return _super !== null && _super.apply(this, arguments) || this;
  9613. }
  9614. MDCNotchedOutline.attachTo = function (root) {
  9615. return new MDCNotchedOutline(root);
  9616. };
  9617. MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
  9618. this.notchElement_ = this.root_.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
  9619. var label = this.root_.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
  9620. if (label) {
  9621. label.style.transitionDuration = '0s';
  9622. this.root_.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
  9623. requestAnimationFrame(function () {
  9624. label.style.transitionDuration = '';
  9625. });
  9626. } else {
  9627. this.root_.classList.add(constants_1.cssClasses.NO_LABEL);
  9628. }
  9629. };
  9630. /**
  9631. * Updates classes and styles to open the notch to the specified width.
  9632. * @param notchWidth The notch width in the outline.
  9633. */
  9634. MDCNotchedOutline.prototype.notch = function (notchWidth) {
  9635. this.foundation_.notch(notchWidth);
  9636. };
  9637. /**
  9638. * Updates classes and styles to close the notch.
  9639. */
  9640. MDCNotchedOutline.prototype.closeNotch = function () {
  9641. this.foundation_.closeNotch();
  9642. };
  9643. MDCNotchedOutline.prototype.getDefaultFoundation = function () {
  9644. var _this = this;
  9645. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  9646. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  9647. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9648. var adapter = {
  9649. addClass: function addClass(className) {
  9650. return _this.root_.classList.add(className);
  9651. },
  9652. removeClass: function removeClass(className) {
  9653. return _this.root_.classList.remove(className);
  9654. },
  9655. setNotchWidthProperty: function setNotchWidthProperty(width) {
  9656. return _this.notchElement_.style.setProperty('width', width + 'px');
  9657. },
  9658. removeNotchWidthProperty: function removeNotchWidthProperty() {
  9659. return _this.notchElement_.style.removeProperty('width');
  9660. }
  9661. };
  9662. // tslint:enable:object-literal-sort-keys
  9663. return new foundation_2.MDCNotchedOutlineFoundation(adapter);
  9664. };
  9665. return MDCNotchedOutline;
  9666. }(component_1.MDCComponent);
  9667. exports.MDCNotchedOutline = MDCNotchedOutline;
  9668. /***/ }),
  9669. /***/ "./packages/mdc-notched-outline/constants.ts":
  9670. /*!***************************************************!*\
  9671. !*** ./packages/mdc-notched-outline/constants.ts ***!
  9672. \***************************************************/
  9673. /*! no static exports found */
  9674. /***/ (function(module, exports, __webpack_require__) {
  9675. "use strict";
  9676. /**
  9677. * @license
  9678. * Copyright 2018 Google Inc.
  9679. *
  9680. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9681. * of this software and associated documentation files (the "Software"), to deal
  9682. * in the Software without restriction, including without limitation the rights
  9683. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9684. * copies of the Software, and to permit persons to whom the Software is
  9685. * furnished to do so, subject to the following conditions:
  9686. *
  9687. * The above copyright notice and this permission notice shall be included in
  9688. * all copies or substantial portions of the Software.
  9689. *
  9690. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9691. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9692. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9693. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9694. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9695. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9696. * THE SOFTWARE.
  9697. */
  9698. Object.defineProperty(exports, "__esModule", { value: true });
  9699. var strings = {
  9700. NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
  9701. };
  9702. exports.strings = strings;
  9703. var numbers = {
  9704. // This should stay in sync with $mdc-notched-outline-padding * 2.
  9705. NOTCH_ELEMENT_PADDING: 8
  9706. };
  9707. exports.numbers = numbers;
  9708. var cssClasses = {
  9709. NO_LABEL: 'mdc-notched-outline--no-label',
  9710. OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
  9711. OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
  9712. };
  9713. exports.cssClasses = cssClasses;
  9714. /***/ }),
  9715. /***/ "./packages/mdc-notched-outline/foundation.ts":
  9716. /*!****************************************************!*\
  9717. !*** ./packages/mdc-notched-outline/foundation.ts ***!
  9718. \****************************************************/
  9719. /*! no static exports found */
  9720. /***/ (function(module, exports, __webpack_require__) {
  9721. "use strict";
  9722. /**
  9723. * @license
  9724. * Copyright 2017 Google Inc.
  9725. *
  9726. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9727. * of this software and associated documentation files (the "Software"), to deal
  9728. * in the Software without restriction, including without limitation the rights
  9729. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9730. * copies of the Software, and to permit persons to whom the Software is
  9731. * furnished to do so, subject to the following conditions:
  9732. *
  9733. * The above copyright notice and this permission notice shall be included in
  9734. * all copies or substantial portions of the Software.
  9735. *
  9736. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9737. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9738. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9739. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9740. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9741. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9742. * THE SOFTWARE.
  9743. */
  9744. var __extends = this && this.__extends || function () {
  9745. var _extendStatics = function extendStatics(d, b) {
  9746. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9747. d.__proto__ = b;
  9748. } || function (d, b) {
  9749. for (var p in b) {
  9750. if (b.hasOwnProperty(p)) d[p] = b[p];
  9751. }
  9752. };
  9753. return _extendStatics(d, b);
  9754. };
  9755. return function (d, b) {
  9756. _extendStatics(d, b);
  9757. function __() {
  9758. this.constructor = d;
  9759. }
  9760. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9761. };
  9762. }();
  9763. var __assign = this && this.__assign || function () {
  9764. __assign = Object.assign || function (t) {
  9765. for (var s, i = 1, n = arguments.length; i < n; i++) {
  9766. s = arguments[i];
  9767. for (var p in s) {
  9768. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  9769. }
  9770. }
  9771. return t;
  9772. };
  9773. return __assign.apply(this, arguments);
  9774. };
  9775. Object.defineProperty(exports, "__esModule", { value: true });
  9776. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  9777. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  9778. var MDCNotchedOutlineFoundation = /** @class */function (_super) {
  9779. __extends(MDCNotchedOutlineFoundation, _super);
  9780. function MDCNotchedOutlineFoundation(adapter) {
  9781. return _super.call(this, __assign({}, MDCNotchedOutlineFoundation.defaultAdapter, adapter)) || this;
  9782. }
  9783. Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
  9784. get: function get() {
  9785. return constants_1.strings;
  9786. },
  9787. enumerable: true,
  9788. configurable: true
  9789. });
  9790. Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
  9791. get: function get() {
  9792. return constants_1.cssClasses;
  9793. },
  9794. enumerable: true,
  9795. configurable: true
  9796. });
  9797. Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
  9798. get: function get() {
  9799. return constants_1.numbers;
  9800. },
  9801. enumerable: true,
  9802. configurable: true
  9803. });
  9804. Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
  9805. /**
  9806. * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
  9807. */
  9808. get: function get() {
  9809. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  9810. return {
  9811. addClass: function addClass() {
  9812. return undefined;
  9813. },
  9814. removeClass: function removeClass() {
  9815. return undefined;
  9816. },
  9817. setNotchWidthProperty: function setNotchWidthProperty() {
  9818. return undefined;
  9819. },
  9820. removeNotchWidthProperty: function removeNotchWidthProperty() {
  9821. return undefined;
  9822. }
  9823. };
  9824. // tslint:enable:object-literal-sort-keys
  9825. },
  9826. enumerable: true,
  9827. configurable: true
  9828. });
  9829. /**
  9830. * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
  9831. */
  9832. MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
  9833. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  9834. if (notchWidth > 0) {
  9835. notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
  9836. }
  9837. this.adapter_.setNotchWidthProperty(notchWidth);
  9838. this.adapter_.addClass(OUTLINE_NOTCHED);
  9839. };
  9840. /**
  9841. * Removes notched outline selector to close the notch in the outline.
  9842. */
  9843. MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
  9844. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  9845. this.adapter_.removeClass(OUTLINE_NOTCHED);
  9846. this.adapter_.removeNotchWidthProperty();
  9847. };
  9848. return MDCNotchedOutlineFoundation;
  9849. }(foundation_1.MDCFoundation);
  9850. exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
  9851. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  9852. exports.default = MDCNotchedOutlineFoundation;
  9853. /***/ }),
  9854. /***/ "./packages/mdc-notched-outline/index.ts":
  9855. /*!***********************************************!*\
  9856. !*** ./packages/mdc-notched-outline/index.ts ***!
  9857. \***********************************************/
  9858. /*! no static exports found */
  9859. /***/ (function(module, exports, __webpack_require__) {
  9860. "use strict";
  9861. /**
  9862. * @license
  9863. * Copyright 2019 Google Inc.
  9864. *
  9865. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9866. * of this software and associated documentation files (the "Software"), to deal
  9867. * in the Software without restriction, including without limitation the rights
  9868. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9869. * copies of the Software, and to permit persons to whom the Software is
  9870. * furnished to do so, subject to the following conditions:
  9871. *
  9872. * The above copyright notice and this permission notice shall be included in
  9873. * all copies or substantial portions of the Software.
  9874. *
  9875. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9876. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9877. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9878. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9879. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9880. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9881. * THE SOFTWARE.
  9882. */
  9883. function __export(m) {
  9884. for (var p in m) {
  9885. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  9886. }
  9887. }
  9888. Object.defineProperty(exports, "__esModule", { value: true });
  9889. __export(__webpack_require__(/*! ./component */ "./packages/mdc-notched-outline/component.ts"));
  9890. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts"));
  9891. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts"));
  9892. /***/ }),
  9893. /***/ "./packages/mdc-radio/component.ts":
  9894. /*!*****************************************!*\
  9895. !*** ./packages/mdc-radio/component.ts ***!
  9896. \*****************************************/
  9897. /*! no static exports found */
  9898. /***/ (function(module, exports, __webpack_require__) {
  9899. "use strict";
  9900. /**
  9901. * @license
  9902. * Copyright 2016 Google Inc.
  9903. *
  9904. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9905. * of this software and associated documentation files (the "Software"), to deal
  9906. * in the Software without restriction, including without limitation the rights
  9907. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9908. * copies of the Software, and to permit persons to whom the Software is
  9909. * furnished to do so, subject to the following conditions:
  9910. *
  9911. * The above copyright notice and this permission notice shall be included in
  9912. * all copies or substantial portions of the Software.
  9913. *
  9914. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  9915. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9916. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  9917. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  9918. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  9919. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  9920. * THE SOFTWARE.
  9921. */
  9922. var __extends = this && this.__extends || function () {
  9923. var _extendStatics = function extendStatics(d, b) {
  9924. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  9925. d.__proto__ = b;
  9926. } || function (d, b) {
  9927. for (var p in b) {
  9928. if (b.hasOwnProperty(p)) d[p] = b[p];
  9929. }
  9930. };
  9931. return _extendStatics(d, b);
  9932. };
  9933. return function (d, b) {
  9934. _extendStatics(d, b);
  9935. function __() {
  9936. this.constructor = d;
  9937. }
  9938. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9939. };
  9940. }();
  9941. var __assign = this && this.__assign || function () {
  9942. __assign = Object.assign || function (t) {
  9943. for (var s, i = 1, n = arguments.length; i < n; i++) {
  9944. s = arguments[i];
  9945. for (var p in s) {
  9946. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  9947. }
  9948. }
  9949. return t;
  9950. };
  9951. return __assign.apply(this, arguments);
  9952. };
  9953. Object.defineProperty(exports, "__esModule", { value: true });
  9954. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  9955. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  9956. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  9957. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  9958. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts");
  9959. var MDCRadio = /** @class */function (_super) {
  9960. __extends(MDCRadio, _super);
  9961. function MDCRadio() {
  9962. var _this = _super !== null && _super.apply(this, arguments) || this;
  9963. _this.ripple_ = _this.createRipple_();
  9964. return _this;
  9965. }
  9966. MDCRadio.attachTo = function (root) {
  9967. return new MDCRadio(root);
  9968. };
  9969. Object.defineProperty(MDCRadio.prototype, "checked", {
  9970. get: function get() {
  9971. return this.nativeControl_.checked;
  9972. },
  9973. set: function set(checked) {
  9974. this.nativeControl_.checked = checked;
  9975. },
  9976. enumerable: true,
  9977. configurable: true
  9978. });
  9979. Object.defineProperty(MDCRadio.prototype, "disabled", {
  9980. get: function get() {
  9981. return this.nativeControl_.disabled;
  9982. },
  9983. set: function set(disabled) {
  9984. this.foundation_.setDisabled(disabled);
  9985. },
  9986. enumerable: true,
  9987. configurable: true
  9988. });
  9989. Object.defineProperty(MDCRadio.prototype, "value", {
  9990. get: function get() {
  9991. return this.nativeControl_.value;
  9992. },
  9993. set: function set(value) {
  9994. this.nativeControl_.value = value;
  9995. },
  9996. enumerable: true,
  9997. configurable: true
  9998. });
  9999. Object.defineProperty(MDCRadio.prototype, "ripple", {
  10000. get: function get() {
  10001. return this.ripple_;
  10002. },
  10003. enumerable: true,
  10004. configurable: true
  10005. });
  10006. MDCRadio.prototype.destroy = function () {
  10007. this.ripple_.destroy();
  10008. _super.prototype.destroy.call(this);
  10009. };
  10010. MDCRadio.prototype.getDefaultFoundation = function () {
  10011. var _this = this;
  10012. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10013. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10014. var adapter = {
  10015. addClass: function addClass(className) {
  10016. return _this.root_.classList.add(className);
  10017. },
  10018. removeClass: function removeClass(className) {
  10019. return _this.root_.classList.remove(className);
  10020. },
  10021. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  10022. return _this.nativeControl_.disabled = disabled;
  10023. }
  10024. };
  10025. return new foundation_2.MDCRadioFoundation(adapter);
  10026. };
  10027. MDCRadio.prototype.createRipple_ = function () {
  10028. var _this = this;
  10029. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  10030. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  10031. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  10032. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  10033. return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  10034. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  10035. return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  10036. },
  10037. // Radio buttons technically go "active" whenever there is *any* keyboard interaction.
  10038. // This is not the UI we desire.
  10039. isSurfaceActive: function isSurfaceActive() {
  10040. return false;
  10041. }, isUnbounded: function isUnbounded() {
  10042. return true;
  10043. } });
  10044. // tslint:enable:object-literal-sort-keys
  10045. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  10046. };
  10047. Object.defineProperty(MDCRadio.prototype, "nativeControl_", {
  10048. get: function get() {
  10049. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR;
  10050. var el = this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  10051. if (!el) {
  10052. throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  10053. }
  10054. return el;
  10055. },
  10056. enumerable: true,
  10057. configurable: true
  10058. });
  10059. return MDCRadio;
  10060. }(component_1.MDCComponent);
  10061. exports.MDCRadio = MDCRadio;
  10062. /***/ }),
  10063. /***/ "./packages/mdc-radio/constants.ts":
  10064. /*!*****************************************!*\
  10065. !*** ./packages/mdc-radio/constants.ts ***!
  10066. \*****************************************/
  10067. /*! no static exports found */
  10068. /***/ (function(module, exports, __webpack_require__) {
  10069. "use strict";
  10070. /**
  10071. * @license
  10072. * Copyright 2016 Google Inc.
  10073. *
  10074. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10075. * of this software and associated documentation files (the "Software"), to deal
  10076. * in the Software without restriction, including without limitation the rights
  10077. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10078. * copies of the Software, and to permit persons to whom the Software is
  10079. * furnished to do so, subject to the following conditions:
  10080. *
  10081. * The above copyright notice and this permission notice shall be included in
  10082. * all copies or substantial portions of the Software.
  10083. *
  10084. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10085. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10086. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10087. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10088. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10089. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10090. * THE SOFTWARE.
  10091. */
  10092. Object.defineProperty(exports, "__esModule", { value: true });
  10093. var strings = {
  10094. NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control'
  10095. };
  10096. exports.strings = strings;
  10097. var cssClasses = {
  10098. DISABLED: 'mdc-radio--disabled',
  10099. ROOT: 'mdc-radio'
  10100. };
  10101. exports.cssClasses = cssClasses;
  10102. /***/ }),
  10103. /***/ "./packages/mdc-radio/foundation.ts":
  10104. /*!******************************************!*\
  10105. !*** ./packages/mdc-radio/foundation.ts ***!
  10106. \******************************************/
  10107. /*! no static exports found */
  10108. /***/ (function(module, exports, __webpack_require__) {
  10109. "use strict";
  10110. /**
  10111. * @license
  10112. * Copyright 2016 Google Inc.
  10113. *
  10114. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10115. * of this software and associated documentation files (the "Software"), to deal
  10116. * in the Software without restriction, including without limitation the rights
  10117. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10118. * copies of the Software, and to permit persons to whom the Software is
  10119. * furnished to do so, subject to the following conditions:
  10120. *
  10121. * The above copyright notice and this permission notice shall be included in
  10122. * all copies or substantial portions of the Software.
  10123. *
  10124. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10125. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10126. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10127. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10128. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10129. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10130. * THE SOFTWARE.
  10131. */
  10132. var __extends = this && this.__extends || function () {
  10133. var _extendStatics = function extendStatics(d, b) {
  10134. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10135. d.__proto__ = b;
  10136. } || function (d, b) {
  10137. for (var p in b) {
  10138. if (b.hasOwnProperty(p)) d[p] = b[p];
  10139. }
  10140. };
  10141. return _extendStatics(d, b);
  10142. };
  10143. return function (d, b) {
  10144. _extendStatics(d, b);
  10145. function __() {
  10146. this.constructor = d;
  10147. }
  10148. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10149. };
  10150. }();
  10151. var __assign = this && this.__assign || function () {
  10152. __assign = Object.assign || function (t) {
  10153. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10154. s = arguments[i];
  10155. for (var p in s) {
  10156. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10157. }
  10158. }
  10159. return t;
  10160. };
  10161. return __assign.apply(this, arguments);
  10162. };
  10163. Object.defineProperty(exports, "__esModule", { value: true });
  10164. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10165. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts");
  10166. var MDCRadioFoundation = /** @class */function (_super) {
  10167. __extends(MDCRadioFoundation, _super);
  10168. function MDCRadioFoundation(adapter) {
  10169. return _super.call(this, __assign({}, MDCRadioFoundation.defaultAdapter, adapter)) || this;
  10170. }
  10171. Object.defineProperty(MDCRadioFoundation, "cssClasses", {
  10172. get: function get() {
  10173. return constants_1.cssClasses;
  10174. },
  10175. enumerable: true,
  10176. configurable: true
  10177. });
  10178. Object.defineProperty(MDCRadioFoundation, "strings", {
  10179. get: function get() {
  10180. return constants_1.strings;
  10181. },
  10182. enumerable: true,
  10183. configurable: true
  10184. });
  10185. Object.defineProperty(MDCRadioFoundation, "defaultAdapter", {
  10186. get: function get() {
  10187. return {
  10188. addClass: function addClass() {
  10189. return undefined;
  10190. },
  10191. removeClass: function removeClass() {
  10192. return undefined;
  10193. },
  10194. setNativeControlDisabled: function setNativeControlDisabled() {
  10195. return undefined;
  10196. }
  10197. };
  10198. },
  10199. enumerable: true,
  10200. configurable: true
  10201. });
  10202. MDCRadioFoundation.prototype.setDisabled = function (disabled) {
  10203. var DISABLED = MDCRadioFoundation.cssClasses.DISABLED;
  10204. this.adapter_.setNativeControlDisabled(disabled);
  10205. if (disabled) {
  10206. this.adapter_.addClass(DISABLED);
  10207. } else {
  10208. this.adapter_.removeClass(DISABLED);
  10209. }
  10210. };
  10211. return MDCRadioFoundation;
  10212. }(foundation_1.MDCFoundation);
  10213. exports.MDCRadioFoundation = MDCRadioFoundation;
  10214. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  10215. exports.default = MDCRadioFoundation;
  10216. /***/ }),
  10217. /***/ "./packages/mdc-radio/index.ts":
  10218. /*!*************************************!*\
  10219. !*** ./packages/mdc-radio/index.ts ***!
  10220. \*************************************/
  10221. /*! no static exports found */
  10222. /***/ (function(module, exports, __webpack_require__) {
  10223. "use strict";
  10224. /**
  10225. * @license
  10226. * Copyright 2019 Google Inc.
  10227. *
  10228. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10229. * of this software and associated documentation files (the "Software"), to deal
  10230. * in the Software without restriction, including without limitation the rights
  10231. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10232. * copies of the Software, and to permit persons to whom the Software is
  10233. * furnished to do so, subject to the following conditions:
  10234. *
  10235. * The above copyright notice and this permission notice shall be included in
  10236. * all copies or substantial portions of the Software.
  10237. *
  10238. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10239. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10240. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10241. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10242. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10243. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10244. * THE SOFTWARE.
  10245. */
  10246. function __export(m) {
  10247. for (var p in m) {
  10248. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  10249. }
  10250. }
  10251. Object.defineProperty(exports, "__esModule", { value: true });
  10252. __export(__webpack_require__(/*! ./component */ "./packages/mdc-radio/component.ts"));
  10253. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-radio/constants.ts"));
  10254. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-radio/foundation.ts"));
  10255. /***/ }),
  10256. /***/ "./packages/mdc-ripple/component.ts":
  10257. /*!******************************************!*\
  10258. !*** ./packages/mdc-ripple/component.ts ***!
  10259. \******************************************/
  10260. /*! no static exports found */
  10261. /***/ (function(module, exports, __webpack_require__) {
  10262. "use strict";
  10263. /**
  10264. * @license
  10265. * Copyright 2016 Google Inc.
  10266. *
  10267. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10268. * of this software and associated documentation files (the "Software"), to deal
  10269. * in the Software without restriction, including without limitation the rights
  10270. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10271. * copies of the Software, and to permit persons to whom the Software is
  10272. * furnished to do so, subject to the following conditions:
  10273. *
  10274. * The above copyright notice and this permission notice shall be included in
  10275. * all copies or substantial portions of the Software.
  10276. *
  10277. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10278. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10279. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10280. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10281. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10282. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10283. * THE SOFTWARE.
  10284. */
  10285. var __extends = this && this.__extends || function () {
  10286. var _extendStatics = function extendStatics(d, b) {
  10287. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10288. d.__proto__ = b;
  10289. } || function (d, b) {
  10290. for (var p in b) {
  10291. if (b.hasOwnProperty(p)) d[p] = b[p];
  10292. }
  10293. };
  10294. return _extendStatics(d, b);
  10295. };
  10296. return function (d, b) {
  10297. _extendStatics(d, b);
  10298. function __() {
  10299. this.constructor = d;
  10300. }
  10301. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10302. };
  10303. }();
  10304. var __importStar = this && this.__importStar || function (mod) {
  10305. if (mod && mod.__esModule) return mod;
  10306. var result = {};
  10307. if (mod != null) for (var k in mod) {
  10308. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  10309. }result["default"] = mod;
  10310. return result;
  10311. };
  10312. Object.defineProperty(exports, "__esModule", { value: true });
  10313. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  10314. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  10315. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  10316. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  10317. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  10318. var MDCRipple = /** @class */function (_super) {
  10319. __extends(MDCRipple, _super);
  10320. function MDCRipple() {
  10321. var _this = _super !== null && _super.apply(this, arguments) || this;
  10322. _this.disabled = false;
  10323. return _this;
  10324. }
  10325. MDCRipple.attachTo = function (root, opts) {
  10326. if (opts === void 0) {
  10327. opts = { isUnbounded: undefined };
  10328. }
  10329. var ripple = new MDCRipple(root);
  10330. // Only override unbounded behavior if option is explicitly specified
  10331. if (opts.isUnbounded !== undefined) {
  10332. ripple.unbounded = opts.isUnbounded;
  10333. }
  10334. return ripple;
  10335. };
  10336. MDCRipple.createAdapter = function (instance) {
  10337. return {
  10338. addClass: function addClass(className) {
  10339. return instance.root_.classList.add(className);
  10340. },
  10341. browserSupportsCssVars: function browserSupportsCssVars() {
  10342. return util.supportsCssVariables(window);
  10343. },
  10344. computeBoundingRect: function computeBoundingRect() {
  10345. return instance.root_.getBoundingClientRect();
  10346. },
  10347. containsEventTarget: function containsEventTarget(target) {
  10348. return instance.root_.contains(target);
  10349. },
  10350. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  10351. return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  10352. },
  10353. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  10354. return instance.root_.removeEventListener(evtType, handler, events_1.applyPassive());
  10355. },
  10356. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  10357. return window.removeEventListener('resize', handler);
  10358. },
  10359. getWindowPageOffset: function getWindowPageOffset() {
  10360. return { x: window.pageXOffset, y: window.pageYOffset };
  10361. },
  10362. isSurfaceActive: function isSurfaceActive() {
  10363. return ponyfill_1.matches(instance.root_, ':active');
  10364. },
  10365. isSurfaceDisabled: function isSurfaceDisabled() {
  10366. return Boolean(instance.disabled);
  10367. },
  10368. isUnbounded: function isUnbounded() {
  10369. return Boolean(instance.unbounded);
  10370. },
  10371. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  10372. return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  10373. },
  10374. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  10375. return instance.root_.addEventListener(evtType, handler, events_1.applyPassive());
  10376. },
  10377. registerResizeHandler: function registerResizeHandler(handler) {
  10378. return window.addEventListener('resize', handler);
  10379. },
  10380. removeClass: function removeClass(className) {
  10381. return instance.root_.classList.remove(className);
  10382. },
  10383. updateCssVariable: function updateCssVariable(varName, value) {
  10384. return instance.root_.style.setProperty(varName, value);
  10385. }
  10386. };
  10387. };
  10388. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  10389. get: function get() {
  10390. return Boolean(this.unbounded_);
  10391. },
  10392. set: function set(unbounded) {
  10393. this.unbounded_ = Boolean(unbounded);
  10394. this.setUnbounded_();
  10395. },
  10396. enumerable: true,
  10397. configurable: true
  10398. });
  10399. MDCRipple.prototype.activate = function () {
  10400. this.foundation_.activate();
  10401. };
  10402. MDCRipple.prototype.deactivate = function () {
  10403. this.foundation_.deactivate();
  10404. };
  10405. MDCRipple.prototype.layout = function () {
  10406. this.foundation_.layout();
  10407. };
  10408. MDCRipple.prototype.getDefaultFoundation = function () {
  10409. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  10410. };
  10411. MDCRipple.prototype.initialSyncWithDOM = function () {
  10412. var root = this.root_;
  10413. this.unbounded = 'mdcRippleIsUnbounded' in root.dataset;
  10414. };
  10415. /**
  10416. * Closure Compiler throws an access control error when directly accessing a
  10417. * protected or private property inside a getter/setter, like unbounded above.
  10418. * By accessing the protected property inside a method, we solve that problem.
  10419. * That's why this function exists.
  10420. */
  10421. MDCRipple.prototype.setUnbounded_ = function () {
  10422. this.foundation_.setUnbounded(Boolean(this.unbounded_));
  10423. };
  10424. return MDCRipple;
  10425. }(component_1.MDCComponent);
  10426. exports.MDCRipple = MDCRipple;
  10427. /***/ }),
  10428. /***/ "./packages/mdc-ripple/constants.ts":
  10429. /*!******************************************!*\
  10430. !*** ./packages/mdc-ripple/constants.ts ***!
  10431. \******************************************/
  10432. /*! no static exports found */
  10433. /***/ (function(module, exports, __webpack_require__) {
  10434. "use strict";
  10435. /**
  10436. * @license
  10437. * Copyright 2016 Google Inc.
  10438. *
  10439. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10440. * of this software and associated documentation files (the "Software"), to deal
  10441. * in the Software without restriction, including without limitation the rights
  10442. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10443. * copies of the Software, and to permit persons to whom the Software is
  10444. * furnished to do so, subject to the following conditions:
  10445. *
  10446. * The above copyright notice and this permission notice shall be included in
  10447. * all copies or substantial portions of the Software.
  10448. *
  10449. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10450. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10451. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10452. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10453. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10454. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10455. * THE SOFTWARE.
  10456. */
  10457. Object.defineProperty(exports, "__esModule", { value: true });
  10458. exports.cssClasses = {
  10459. // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  10460. // given that it's an 'upgrade' to an existing component. That being said it is the root
  10461. // CSS class that all other CSS classes derive from.
  10462. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  10463. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  10464. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  10465. ROOT: 'mdc-ripple-upgraded',
  10466. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  10467. };
  10468. exports.strings = {
  10469. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  10470. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  10471. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  10472. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  10473. VAR_LEFT: '--mdc-ripple-left',
  10474. VAR_TOP: '--mdc-ripple-top'
  10475. };
  10476. exports.numbers = {
  10477. DEACTIVATION_TIMEOUT_MS: 225,
  10478. FG_DEACTIVATION_MS: 150,
  10479. INITIAL_ORIGIN_SCALE: 0.6,
  10480. PADDING: 10,
  10481. TAP_DELAY_MS: 300
  10482. };
  10483. /***/ }),
  10484. /***/ "./packages/mdc-ripple/foundation.ts":
  10485. /*!*******************************************!*\
  10486. !*** ./packages/mdc-ripple/foundation.ts ***!
  10487. \*******************************************/
  10488. /*! no static exports found */
  10489. /***/ (function(module, exports, __webpack_require__) {
  10490. "use strict";
  10491. /**
  10492. * @license
  10493. * Copyright 2016 Google Inc.
  10494. *
  10495. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10496. * of this software and associated documentation files (the "Software"), to deal
  10497. * in the Software without restriction, including without limitation the rights
  10498. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10499. * copies of the Software, and to permit persons to whom the Software is
  10500. * furnished to do so, subject to the following conditions:
  10501. *
  10502. * The above copyright notice and this permission notice shall be included in
  10503. * all copies or substantial portions of the Software.
  10504. *
  10505. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  10506. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10507. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10508. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  10509. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  10510. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  10511. * THE SOFTWARE.
  10512. */
  10513. var __extends = this && this.__extends || function () {
  10514. var _extendStatics = function extendStatics(d, b) {
  10515. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  10516. d.__proto__ = b;
  10517. } || function (d, b) {
  10518. for (var p in b) {
  10519. if (b.hasOwnProperty(p)) d[p] = b[p];
  10520. }
  10521. };
  10522. return _extendStatics(d, b);
  10523. };
  10524. return function (d, b) {
  10525. _extendStatics(d, b);
  10526. function __() {
  10527. this.constructor = d;
  10528. }
  10529. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10530. };
  10531. }();
  10532. var __assign = this && this.__assign || function () {
  10533. __assign = Object.assign || function (t) {
  10534. for (var s, i = 1, n = arguments.length; i < n; i++) {
  10535. s = arguments[i];
  10536. for (var p in s) {
  10537. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  10538. }
  10539. }
  10540. return t;
  10541. };
  10542. return __assign.apply(this, arguments);
  10543. };
  10544. Object.defineProperty(exports, "__esModule", { value: true });
  10545. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  10546. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  10547. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  10548. // Activation events registered on the root element of each instance for activation
  10549. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  10550. // Deactivation events registered on documentElement when a pointer-related down event occurs
  10551. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  10552. // simultaneous nested activations
  10553. var activatedTargets = [];
  10554. var MDCRippleFoundation = /** @class */function (_super) {
  10555. __extends(MDCRippleFoundation, _super);
  10556. function MDCRippleFoundation(adapter) {
  10557. var _this = _super.call(this, __assign({}, MDCRippleFoundation.defaultAdapter, adapter)) || this;
  10558. _this.activationAnimationHasEnded_ = false;
  10559. _this.activationTimer_ = 0;
  10560. _this.fgDeactivationRemovalTimer_ = 0;
  10561. _this.fgScale_ = '0';
  10562. _this.frame_ = { width: 0, height: 0 };
  10563. _this.initialSize_ = 0;
  10564. _this.layoutFrame_ = 0;
  10565. _this.maxRadius_ = 0;
  10566. _this.unboundedCoords_ = { left: 0, top: 0 };
  10567. _this.activationState_ = _this.defaultActivationState_();
  10568. _this.activationTimerCallback_ = function () {
  10569. _this.activationAnimationHasEnded_ = true;
  10570. _this.runDeactivationUXLogicIfReady_();
  10571. };
  10572. _this.activateHandler_ = function (e) {
  10573. return _this.activate_(e);
  10574. };
  10575. _this.deactivateHandler_ = function () {
  10576. return _this.deactivate_();
  10577. };
  10578. _this.focusHandler_ = function () {
  10579. return _this.handleFocus();
  10580. };
  10581. _this.blurHandler_ = function () {
  10582. return _this.handleBlur();
  10583. };
  10584. _this.resizeHandler_ = function () {
  10585. return _this.layout();
  10586. };
  10587. return _this;
  10588. }
  10589. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  10590. get: function get() {
  10591. return constants_1.cssClasses;
  10592. },
  10593. enumerable: true,
  10594. configurable: true
  10595. });
  10596. Object.defineProperty(MDCRippleFoundation, "strings", {
  10597. get: function get() {
  10598. return constants_1.strings;
  10599. },
  10600. enumerable: true,
  10601. configurable: true
  10602. });
  10603. Object.defineProperty(MDCRippleFoundation, "numbers", {
  10604. get: function get() {
  10605. return constants_1.numbers;
  10606. },
  10607. enumerable: true,
  10608. configurable: true
  10609. });
  10610. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  10611. get: function get() {
  10612. return {
  10613. addClass: function addClass() {
  10614. return undefined;
  10615. },
  10616. browserSupportsCssVars: function browserSupportsCssVars() {
  10617. return true;
  10618. },
  10619. computeBoundingRect: function computeBoundingRect() {
  10620. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  10621. },
  10622. containsEventTarget: function containsEventTarget() {
  10623. return true;
  10624. },
  10625. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  10626. return undefined;
  10627. },
  10628. deregisterInteractionHandler: function deregisterInteractionHandler() {
  10629. return undefined;
  10630. },
  10631. deregisterResizeHandler: function deregisterResizeHandler() {
  10632. return undefined;
  10633. },
  10634. getWindowPageOffset: function getWindowPageOffset() {
  10635. return { x: 0, y: 0 };
  10636. },
  10637. isSurfaceActive: function isSurfaceActive() {
  10638. return true;
  10639. },
  10640. isSurfaceDisabled: function isSurfaceDisabled() {
  10641. return true;
  10642. },
  10643. isUnbounded: function isUnbounded() {
  10644. return true;
  10645. },
  10646. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  10647. return undefined;
  10648. },
  10649. registerInteractionHandler: function registerInteractionHandler() {
  10650. return undefined;
  10651. },
  10652. registerResizeHandler: function registerResizeHandler() {
  10653. return undefined;
  10654. },
  10655. removeClass: function removeClass() {
  10656. return undefined;
  10657. },
  10658. updateCssVariable: function updateCssVariable() {
  10659. return undefined;
  10660. }
  10661. };
  10662. },
  10663. enumerable: true,
  10664. configurable: true
  10665. });
  10666. MDCRippleFoundation.prototype.init = function () {
  10667. var _this = this;
  10668. var supportsPressRipple = this.supportsPressRipple_();
  10669. this.registerRootHandlers_(supportsPressRipple);
  10670. if (supportsPressRipple) {
  10671. var _a = MDCRippleFoundation.cssClasses,
  10672. ROOT_1 = _a.ROOT,
  10673. UNBOUNDED_1 = _a.UNBOUNDED;
  10674. requestAnimationFrame(function () {
  10675. _this.adapter_.addClass(ROOT_1);
  10676. if (_this.adapter_.isUnbounded()) {
  10677. _this.adapter_.addClass(UNBOUNDED_1);
  10678. // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
  10679. _this.layoutInternal_();
  10680. }
  10681. });
  10682. }
  10683. };
  10684. MDCRippleFoundation.prototype.destroy = function () {
  10685. var _this = this;
  10686. if (this.supportsPressRipple_()) {
  10687. if (this.activationTimer_) {
  10688. clearTimeout(this.activationTimer_);
  10689. this.activationTimer_ = 0;
  10690. this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  10691. }
  10692. if (this.fgDeactivationRemovalTimer_) {
  10693. clearTimeout(this.fgDeactivationRemovalTimer_);
  10694. this.fgDeactivationRemovalTimer_ = 0;
  10695. this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  10696. }
  10697. var _a = MDCRippleFoundation.cssClasses,
  10698. ROOT_2 = _a.ROOT,
  10699. UNBOUNDED_2 = _a.UNBOUNDED;
  10700. requestAnimationFrame(function () {
  10701. _this.adapter_.removeClass(ROOT_2);
  10702. _this.adapter_.removeClass(UNBOUNDED_2);
  10703. _this.removeCssVars_();
  10704. });
  10705. }
  10706. this.deregisterRootHandlers_();
  10707. this.deregisterDeactivationHandlers_();
  10708. };
  10709. /**
  10710. * @param evt Optional event containing position information.
  10711. */
  10712. MDCRippleFoundation.prototype.activate = function (evt) {
  10713. this.activate_(evt);
  10714. };
  10715. MDCRippleFoundation.prototype.deactivate = function () {
  10716. this.deactivate_();
  10717. };
  10718. MDCRippleFoundation.prototype.layout = function () {
  10719. var _this = this;
  10720. if (this.layoutFrame_) {
  10721. cancelAnimationFrame(this.layoutFrame_);
  10722. }
  10723. this.layoutFrame_ = requestAnimationFrame(function () {
  10724. _this.layoutInternal_();
  10725. _this.layoutFrame_ = 0;
  10726. });
  10727. };
  10728. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  10729. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  10730. if (unbounded) {
  10731. this.adapter_.addClass(UNBOUNDED);
  10732. } else {
  10733. this.adapter_.removeClass(UNBOUNDED);
  10734. }
  10735. };
  10736. MDCRippleFoundation.prototype.handleFocus = function () {
  10737. var _this = this;
  10738. requestAnimationFrame(function () {
  10739. return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  10740. });
  10741. };
  10742. MDCRippleFoundation.prototype.handleBlur = function () {
  10743. var _this = this;
  10744. requestAnimationFrame(function () {
  10745. return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  10746. });
  10747. };
  10748. /**
  10749. * We compute this property so that we are not querying information about the client
  10750. * until the point in time where the foundation requests it. This prevents scenarios where
  10751. * client-side feature-detection may happen too early, such as when components are rendered on the server
  10752. * and then initialized at mount time on the client.
  10753. */
  10754. MDCRippleFoundation.prototype.supportsPressRipple_ = function () {
  10755. return this.adapter_.browserSupportsCssVars();
  10756. };
  10757. MDCRippleFoundation.prototype.defaultActivationState_ = function () {
  10758. return {
  10759. activationEvent: undefined,
  10760. hasDeactivationUXRun: false,
  10761. isActivated: false,
  10762. isProgrammatic: false,
  10763. wasActivatedByPointer: false,
  10764. wasElementMadeActive: false
  10765. };
  10766. };
  10767. /**
  10768. * supportsPressRipple Passed from init to save a redundant function call
  10769. */
  10770. MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) {
  10771. var _this = this;
  10772. if (supportsPressRipple) {
  10773. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  10774. _this.adapter_.registerInteractionHandler(evtType, _this.activateHandler_);
  10775. });
  10776. if (this.adapter_.isUnbounded()) {
  10777. this.adapter_.registerResizeHandler(this.resizeHandler_);
  10778. }
  10779. }
  10780. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  10781. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  10782. };
  10783. MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) {
  10784. var _this = this;
  10785. if (evt.type === 'keydown') {
  10786. this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
  10787. } else {
  10788. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  10789. _this.adapter_.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  10790. });
  10791. }
  10792. };
  10793. MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () {
  10794. var _this = this;
  10795. ACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  10796. _this.adapter_.deregisterInteractionHandler(evtType, _this.activateHandler_);
  10797. });
  10798. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  10799. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  10800. if (this.adapter_.isUnbounded()) {
  10801. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  10802. }
  10803. };
  10804. MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () {
  10805. var _this = this;
  10806. this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
  10807. POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) {
  10808. _this.adapter_.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_);
  10809. });
  10810. };
  10811. MDCRippleFoundation.prototype.removeCssVars_ = function () {
  10812. var _this = this;
  10813. var rippleStrings = MDCRippleFoundation.strings;
  10814. var keys = Object.keys(rippleStrings);
  10815. keys.forEach(function (key) {
  10816. if (key.indexOf('VAR_') === 0) {
  10817. _this.adapter_.updateCssVariable(rippleStrings[key], null);
  10818. }
  10819. });
  10820. };
  10821. MDCRippleFoundation.prototype.activate_ = function (evt) {
  10822. var _this = this;
  10823. if (this.adapter_.isSurfaceDisabled()) {
  10824. return;
  10825. }
  10826. var activationState = this.activationState_;
  10827. if (activationState.isActivated) {
  10828. return;
  10829. }
  10830. // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
  10831. var previousActivationEvent = this.previousActivationEvent_;
  10832. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  10833. if (isSameInteraction) {
  10834. return;
  10835. }
  10836. activationState.isActivated = true;
  10837. activationState.isProgrammatic = evt === undefined;
  10838. activationState.activationEvent = evt;
  10839. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  10840. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  10841. return _this.adapter_.containsEventTarget(target);
  10842. });
  10843. if (hasActivatedChild) {
  10844. // Immediately reset activation state, while preserving logic that prevents touch follow-on events
  10845. this.resetActivationState_();
  10846. return;
  10847. }
  10848. if (evt !== undefined) {
  10849. activatedTargets.push(evt.target);
  10850. this.registerDeactivationHandlers_(evt);
  10851. }
  10852. activationState.wasElementMadeActive = this.checkElementMadeActive_(evt);
  10853. if (activationState.wasElementMadeActive) {
  10854. this.animateActivation_();
  10855. }
  10856. requestAnimationFrame(function () {
  10857. // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
  10858. activatedTargets = [];
  10859. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  10860. // If space was pressed, try again within an rAF call to detect :active, because different UAs report
  10861. // active states inconsistently when they're called within event handling code:
  10862. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  10863. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  10864. // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
  10865. // variable is set within a rAF callback for a submit button interaction (#2241).
  10866. activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt);
  10867. if (activationState.wasElementMadeActive) {
  10868. _this.animateActivation_();
  10869. }
  10870. }
  10871. if (!activationState.wasElementMadeActive) {
  10872. // Reset activation state immediately if element was not made active.
  10873. _this.activationState_ = _this.defaultActivationState_();
  10874. }
  10875. });
  10876. };
  10877. MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) {
  10878. return evt !== undefined && evt.type === 'keydown' ? this.adapter_.isSurfaceActive() : true;
  10879. };
  10880. MDCRippleFoundation.prototype.animateActivation_ = function () {
  10881. var _this = this;
  10882. var _a = MDCRippleFoundation.strings,
  10883. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  10884. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  10885. var _b = MDCRippleFoundation.cssClasses,
  10886. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  10887. FG_ACTIVATION = _b.FG_ACTIVATION;
  10888. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  10889. this.layoutInternal_();
  10890. var translateStart = '';
  10891. var translateEnd = '';
  10892. if (!this.adapter_.isUnbounded()) {
  10893. var _c = this.getFgTranslationCoordinates_(),
  10894. startPoint = _c.startPoint,
  10895. endPoint = _c.endPoint;
  10896. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  10897. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  10898. }
  10899. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  10900. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  10901. // Cancel any ongoing activation/deactivation animations
  10902. clearTimeout(this.activationTimer_);
  10903. clearTimeout(this.fgDeactivationRemovalTimer_);
  10904. this.rmBoundedActivationClasses_();
  10905. this.adapter_.removeClass(FG_DEACTIVATION);
  10906. // Force layout in order to re-trigger the animation.
  10907. this.adapter_.computeBoundingRect();
  10908. this.adapter_.addClass(FG_ACTIVATION);
  10909. this.activationTimer_ = setTimeout(function () {
  10910. return _this.activationTimerCallback_();
  10911. }, DEACTIVATION_TIMEOUT_MS);
  10912. };
  10913. MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () {
  10914. var _a = this.activationState_,
  10915. activationEvent = _a.activationEvent,
  10916. wasActivatedByPointer = _a.wasActivatedByPointer;
  10917. var startPoint;
  10918. if (wasActivatedByPointer) {
  10919. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
  10920. } else {
  10921. startPoint = {
  10922. x: this.frame_.width / 2,
  10923. y: this.frame_.height / 2
  10924. };
  10925. }
  10926. // Center the element around the start point.
  10927. startPoint = {
  10928. x: startPoint.x - this.initialSize_ / 2,
  10929. y: startPoint.y - this.initialSize_ / 2
  10930. };
  10931. var endPoint = {
  10932. x: this.frame_.width / 2 - this.initialSize_ / 2,
  10933. y: this.frame_.height / 2 - this.initialSize_ / 2
  10934. };
  10935. return { startPoint: startPoint, endPoint: endPoint };
  10936. };
  10937. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () {
  10938. var _this = this;
  10939. // This method is called both when a pointing device is released, and when the activation animation ends.
  10940. // The deactivation animation should only run after both of those occur.
  10941. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  10942. var _a = this.activationState_,
  10943. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  10944. isActivated = _a.isActivated;
  10945. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  10946. if (activationHasEnded && this.activationAnimationHasEnded_) {
  10947. this.rmBoundedActivationClasses_();
  10948. this.adapter_.addClass(FG_DEACTIVATION);
  10949. this.fgDeactivationRemovalTimer_ = setTimeout(function () {
  10950. _this.adapter_.removeClass(FG_DEACTIVATION);
  10951. }, constants_1.numbers.FG_DEACTIVATION_MS);
  10952. }
  10953. };
  10954. MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () {
  10955. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  10956. this.adapter_.removeClass(FG_ACTIVATION);
  10957. this.activationAnimationHasEnded_ = false;
  10958. this.adapter_.computeBoundingRect();
  10959. };
  10960. MDCRippleFoundation.prototype.resetActivationState_ = function () {
  10961. var _this = this;
  10962. this.previousActivationEvent_ = this.activationState_.activationEvent;
  10963. this.activationState_ = this.defaultActivationState_();
  10964. // Touch devices may fire additional events for the same interaction within a short time.
  10965. // Store the previous event until it's safe to assume that subsequent events are for new interactions.
  10966. setTimeout(function () {
  10967. return _this.previousActivationEvent_ = undefined;
  10968. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  10969. };
  10970. MDCRippleFoundation.prototype.deactivate_ = function () {
  10971. var _this = this;
  10972. var activationState = this.activationState_;
  10973. // This can happen in scenarios such as when you have a keyup event that blurs the element.
  10974. if (!activationState.isActivated) {
  10975. return;
  10976. }
  10977. var state = __assign({}, activationState);
  10978. if (activationState.isProgrammatic) {
  10979. requestAnimationFrame(function () {
  10980. return _this.animateDeactivation_(state);
  10981. });
  10982. this.resetActivationState_();
  10983. } else {
  10984. this.deregisterDeactivationHandlers_();
  10985. requestAnimationFrame(function () {
  10986. _this.activationState_.hasDeactivationUXRun = true;
  10987. _this.animateDeactivation_(state);
  10988. _this.resetActivationState_();
  10989. });
  10990. }
  10991. };
  10992. MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) {
  10993. var wasActivatedByPointer = _a.wasActivatedByPointer,
  10994. wasElementMadeActive = _a.wasElementMadeActive;
  10995. if (wasActivatedByPointer || wasElementMadeActive) {
  10996. this.runDeactivationUXLogicIfReady_();
  10997. }
  10998. };
  10999. MDCRippleFoundation.prototype.layoutInternal_ = function () {
  11000. var _this = this;
  11001. this.frame_ = this.adapter_.computeBoundingRect();
  11002. var maxDim = Math.max(this.frame_.height, this.frame_.width);
  11003. // Surface diameter is treated differently for unbounded vs. bounded ripples.
  11004. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
  11005. // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
  11006. // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
  11007. // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
  11008. // `overflow: hidden`.
  11009. var getBoundedRadius = function getBoundedRadius() {
  11010. var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2));
  11011. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  11012. };
  11013. this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
  11014. // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
  11015. var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  11016. // Unbounded ripple size should always be even number to equally center align.
  11017. if (this.adapter_.isUnbounded() && initialSize % 2 !== 0) {
  11018. this.initialSize_ = initialSize - 1;
  11019. } else {
  11020. this.initialSize_ = initialSize;
  11021. }
  11022. this.fgScale_ = "" + this.maxRadius_ / this.initialSize_;
  11023. this.updateLayoutCssVars_();
  11024. };
  11025. MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () {
  11026. var _a = MDCRippleFoundation.strings,
  11027. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  11028. VAR_LEFT = _a.VAR_LEFT,
  11029. VAR_TOP = _a.VAR_TOP,
  11030. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  11031. this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px");
  11032. this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
  11033. if (this.adapter_.isUnbounded()) {
  11034. this.unboundedCoords_ = {
  11035. left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
  11036. top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
  11037. };
  11038. this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px");
  11039. this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px");
  11040. }
  11041. };
  11042. return MDCRippleFoundation;
  11043. }(foundation_1.MDCFoundation);
  11044. exports.MDCRippleFoundation = MDCRippleFoundation;
  11045. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  11046. exports.default = MDCRippleFoundation;
  11047. /***/ }),
  11048. /***/ "./packages/mdc-ripple/index.ts":
  11049. /*!**************************************!*\
  11050. !*** ./packages/mdc-ripple/index.ts ***!
  11051. \**************************************/
  11052. /*! no static exports found */
  11053. /***/ (function(module, exports, __webpack_require__) {
  11054. "use strict";
  11055. /**
  11056. * @license
  11057. * Copyright 2019 Google Inc.
  11058. *
  11059. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11060. * of this software and associated documentation files (the "Software"), to deal
  11061. * in the Software without restriction, including without limitation the rights
  11062. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11063. * copies of the Software, and to permit persons to whom the Software is
  11064. * furnished to do so, subject to the following conditions:
  11065. *
  11066. * The above copyright notice and this permission notice shall be included in
  11067. * all copies or substantial portions of the Software.
  11068. *
  11069. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11070. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11071. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11072. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11073. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11074. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11075. * THE SOFTWARE.
  11076. */
  11077. function __export(m) {
  11078. for (var p in m) {
  11079. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  11080. }
  11081. }
  11082. var __importStar = this && this.__importStar || function (mod) {
  11083. if (mod && mod.__esModule) return mod;
  11084. var result = {};
  11085. if (mod != null) for (var k in mod) {
  11086. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  11087. }result["default"] = mod;
  11088. return result;
  11089. };
  11090. Object.defineProperty(exports, "__esModule", { value: true });
  11091. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  11092. exports.util = util;
  11093. __export(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts"));
  11094. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"));
  11095. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"));
  11096. /***/ }),
  11097. /***/ "./packages/mdc-ripple/util.ts":
  11098. /*!*************************************!*\
  11099. !*** ./packages/mdc-ripple/util.ts ***!
  11100. \*************************************/
  11101. /*! no static exports found */
  11102. /***/ (function(module, exports, __webpack_require__) {
  11103. "use strict";
  11104. Object.defineProperty(exports, "__esModule", { value: true });
  11105. /**
  11106. * Stores result from supportsCssVariables to avoid redundant processing to
  11107. * detect CSS custom variable support.
  11108. */
  11109. var supportsCssVariables_;
  11110. function supportsCssVariables(windowObj, forceRefresh) {
  11111. if (forceRefresh === void 0) {
  11112. forceRefresh = false;
  11113. }
  11114. var CSS = windowObj.CSS;
  11115. var supportsCssVars = supportsCssVariables_;
  11116. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  11117. return supportsCssVariables_;
  11118. }
  11119. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  11120. if (!supportsFunctionPresent) {
  11121. return false;
  11122. }
  11123. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  11124. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  11125. // See: README section on Safari
  11126. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  11127. supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
  11128. if (!forceRefresh) {
  11129. supportsCssVariables_ = supportsCssVars;
  11130. }
  11131. return supportsCssVars;
  11132. }
  11133. exports.supportsCssVariables = supportsCssVariables;
  11134. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  11135. if (!evt) {
  11136. return { x: 0, y: 0 };
  11137. }
  11138. var x = pageOffset.x,
  11139. y = pageOffset.y;
  11140. var documentX = x + clientRect.left;
  11141. var documentY = y + clientRect.top;
  11142. var normalizedX;
  11143. var normalizedY;
  11144. // Determine touch point relative to the ripple container.
  11145. if (evt.type === 'touchstart') {
  11146. var touchEvent = evt;
  11147. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  11148. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  11149. } else {
  11150. var mouseEvent = evt;
  11151. normalizedX = mouseEvent.pageX - documentX;
  11152. normalizedY = mouseEvent.pageY - documentY;
  11153. }
  11154. return { x: normalizedX, y: normalizedY };
  11155. }
  11156. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  11157. /***/ }),
  11158. /***/ "./packages/mdc-select/component.ts":
  11159. /*!******************************************!*\
  11160. !*** ./packages/mdc-select/component.ts ***!
  11161. \******************************************/
  11162. /*! no static exports found */
  11163. /***/ (function(module, exports, __webpack_require__) {
  11164. "use strict";
  11165. /**
  11166. * @license
  11167. * Copyright 2016 Google Inc.
  11168. *
  11169. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11170. * of this software and associated documentation files (the "Software"), to deal
  11171. * in the Software without restriction, including without limitation the rights
  11172. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11173. * copies of the Software, and to permit persons to whom the Software is
  11174. * furnished to do so, subject to the following conditions:
  11175. *
  11176. * The above copyright notice and this permission notice shall be included in
  11177. * all copies or substantial portions of the Software.
  11178. *
  11179. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11180. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11181. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11182. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11183. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11184. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11185. * THE SOFTWARE.
  11186. */
  11187. var __extends = this && this.__extends || function () {
  11188. var _extendStatics = function extendStatics(d, b) {
  11189. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11190. d.__proto__ = b;
  11191. } || function (d, b) {
  11192. for (var p in b) {
  11193. if (b.hasOwnProperty(p)) d[p] = b[p];
  11194. }
  11195. };
  11196. return _extendStatics(d, b);
  11197. };
  11198. return function (d, b) {
  11199. _extendStatics(d, b);
  11200. function __() {
  11201. this.constructor = d;
  11202. }
  11203. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11204. };
  11205. }();
  11206. var __assign = this && this.__assign || function () {
  11207. __assign = Object.assign || function (t) {
  11208. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11209. s = arguments[i];
  11210. for (var p in s) {
  11211. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11212. }
  11213. }
  11214. return t;
  11215. };
  11216. return __assign.apply(this, arguments);
  11217. };
  11218. var __importStar = this && this.__importStar || function (mod) {
  11219. if (mod && mod.__esModule) return mod;
  11220. var result = {};
  11221. if (mod != null) for (var k in mod) {
  11222. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  11223. }result["default"] = mod;
  11224. return result;
  11225. };
  11226. Object.defineProperty(exports, "__esModule", { value: true });
  11227. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  11228. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  11229. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  11230. var menuSurfaceConstants = __importStar(__webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts"));
  11231. var component_4 = __webpack_require__(/*! @material/menu/component */ "./packages/mdc-menu/component.ts");
  11232. var menuConstants = __importStar(__webpack_require__(/*! @material/menu/constants */ "./packages/mdc-menu/constants.ts"));
  11233. var component_5 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  11234. var component_6 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  11235. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  11236. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  11237. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts");
  11238. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-select/helper-text/component.ts");
  11239. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-select/icon/component.ts");
  11240. var MDCSelect = /** @class */function (_super) {
  11241. __extends(MDCSelect, _super);
  11242. function MDCSelect() {
  11243. return _super !== null && _super.apply(this, arguments) || this;
  11244. }
  11245. MDCSelect.attachTo = function (root) {
  11246. return new MDCSelect(root);
  11247. };
  11248. MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) {
  11249. if (labelFactory === void 0) {
  11250. labelFactory = function labelFactory(el) {
  11251. return new component_2.MDCFloatingLabel(el);
  11252. };
  11253. }
  11254. if (lineRippleFactory === void 0) {
  11255. lineRippleFactory = function lineRippleFactory(el) {
  11256. return new component_3.MDCLineRipple(el);
  11257. };
  11258. }
  11259. if (outlineFactory === void 0) {
  11260. outlineFactory = function outlineFactory(el) {
  11261. return new component_5.MDCNotchedOutline(el);
  11262. };
  11263. }
  11264. if (menuFactory === void 0) {
  11265. menuFactory = function menuFactory(el) {
  11266. return new component_4.MDCMenu(el);
  11267. };
  11268. }
  11269. if (iconFactory === void 0) {
  11270. iconFactory = function iconFactory(el) {
  11271. return new component_8.MDCSelectIcon(el);
  11272. };
  11273. }
  11274. if (helperTextFactory === void 0) {
  11275. helperTextFactory = function helperTextFactory(el) {
  11276. return new component_7.MDCSelectHelperText(el);
  11277. };
  11278. }
  11279. this.selectAnchor_ = this.root_.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR);
  11280. this.selectedText_ = this.root_.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR);
  11281. if (!this.selectedText_) {
  11282. throw new Error('MDCSelect: Missing required element: The following selector must be present: ' + ("'" + constants_1.strings.SELECTED_TEXT_SELECTOR + "'"));
  11283. }
  11284. if (this.selectedText_.hasAttribute(constants_1.strings.ARIA_CONTROLS)) {
  11285. var helperTextElement = document.getElementById(this.selectedText_.getAttribute(constants_1.strings.ARIA_CONTROLS));
  11286. if (helperTextElement) {
  11287. this.helperText_ = helperTextFactory(helperTextElement);
  11288. }
  11289. }
  11290. this.menuSetup_(menuFactory);
  11291. var labelElement = this.root_.querySelector(constants_1.strings.LABEL_SELECTOR);
  11292. this.label_ = labelElement ? labelFactory(labelElement) : null;
  11293. var lineRippleElement = this.root_.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  11294. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  11295. var outlineElement = this.root_.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  11296. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  11297. var leadingIcon = this.root_.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  11298. if (leadingIcon) {
  11299. this.leadingIcon_ = iconFactory(leadingIcon);
  11300. }
  11301. if (!this.root_.classList.contains(constants_1.cssClasses.OUTLINED)) {
  11302. this.ripple_ = this.createRipple_();
  11303. }
  11304. };
  11305. /**
  11306. * Initializes the select's event listeners and internal state based
  11307. * on the environment's state.
  11308. */
  11309. MDCSelect.prototype.initialSyncWithDOM = function () {
  11310. var _this = this;
  11311. this.handleChange_ = function () {
  11312. return _this.foundation_.handleChange();
  11313. };
  11314. this.handleFocus_ = function () {
  11315. return _this.foundation_.handleFocus();
  11316. };
  11317. this.handleBlur_ = function () {
  11318. return _this.foundation_.handleBlur();
  11319. };
  11320. this.handleClick_ = function (evt) {
  11321. _this.selectedText_.focus();
  11322. _this.foundation_.handleClick(_this.getNormalizedXCoordinate_(evt));
  11323. };
  11324. this.handleKeydown_ = function (evt) {
  11325. return _this.foundation_.handleKeydown(evt);
  11326. };
  11327. this.handleMenuItemAction_ = function (evt) {
  11328. return _this.foundation_.handleMenuItemAction(evt.detail.index);
  11329. };
  11330. this.handleMenuOpened_ = function () {
  11331. return _this.foundation_.handleMenuOpened();
  11332. };
  11333. this.handleMenuClosed_ = function () {
  11334. return _this.foundation_.handleMenuClosed();
  11335. };
  11336. this.selectedText_.addEventListener('focus', this.handleFocus_);
  11337. this.selectedText_.addEventListener('blur', this.handleBlur_);
  11338. this.selectedText_.addEventListener('click', this.handleClick_);
  11339. this.selectedText_.addEventListener('keydown', this.handleKeydown_);
  11340. this.menu_.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed_);
  11341. this.menu_.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened_);
  11342. this.menu_.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction_);
  11343. this.foundation_.init();
  11344. // Sets disabled state in foundation
  11345. this.disabled = this.root_.classList.contains(constants_1.cssClasses.DISABLED);
  11346. };
  11347. MDCSelect.prototype.destroy = function () {
  11348. this.selectedText_.removeEventListener('change', this.handleChange_);
  11349. this.selectedText_.removeEventListener('focus', this.handleFocus_);
  11350. this.selectedText_.removeEventListener('blur', this.handleBlur_);
  11351. this.selectedText_.removeEventListener('keydown', this.handleKeydown_);
  11352. this.selectedText_.removeEventListener('click', this.handleClick_);
  11353. this.menu_.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed_);
  11354. this.menu_.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened_);
  11355. this.menu_.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction_);
  11356. this.menu_.destroy();
  11357. if (this.ripple_) {
  11358. this.ripple_.destroy();
  11359. }
  11360. if (this.outline_) {
  11361. this.outline_.destroy();
  11362. }
  11363. if (this.leadingIcon_) {
  11364. this.leadingIcon_.destroy();
  11365. }
  11366. if (this.helperText_) {
  11367. this.helperText_.destroy();
  11368. }
  11369. _super.prototype.destroy.call(this);
  11370. };
  11371. Object.defineProperty(MDCSelect.prototype, "value", {
  11372. get: function get() {
  11373. return this.foundation_.getValue();
  11374. },
  11375. set: function set(value) {
  11376. this.foundation_.setValue(value);
  11377. },
  11378. enumerable: true,
  11379. configurable: true
  11380. });
  11381. Object.defineProperty(MDCSelect.prototype, "selectedIndex", {
  11382. get: function get() {
  11383. return this.foundation_.getSelectedIndex();
  11384. },
  11385. set: function set(selectedIndex) {
  11386. this.foundation_.setSelectedIndex(selectedIndex, /** closeMenu */true);
  11387. },
  11388. enumerable: true,
  11389. configurable: true
  11390. });
  11391. Object.defineProperty(MDCSelect.prototype, "disabled", {
  11392. get: function get() {
  11393. return this.foundation_.getDisabled();
  11394. },
  11395. set: function set(disabled) {
  11396. this.foundation_.setDisabled(disabled);
  11397. },
  11398. enumerable: true,
  11399. configurable: true
  11400. });
  11401. Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", {
  11402. set: function set(label) {
  11403. this.foundation_.setLeadingIconAriaLabel(label);
  11404. },
  11405. enumerable: true,
  11406. configurable: true
  11407. });
  11408. Object.defineProperty(MDCSelect.prototype, "leadingIconContent", {
  11409. /**
  11410. * Sets the text content of the leading icon.
  11411. */
  11412. set: function set(content) {
  11413. this.foundation_.setLeadingIconContent(content);
  11414. },
  11415. enumerable: true,
  11416. configurable: true
  11417. });
  11418. Object.defineProperty(MDCSelect.prototype, "helperTextContent", {
  11419. /**
  11420. * Sets the text content of the helper text.
  11421. */
  11422. set: function set(content) {
  11423. this.foundation_.setHelperTextContent(content);
  11424. },
  11425. enumerable: true,
  11426. configurable: true
  11427. });
  11428. Object.defineProperty(MDCSelect.prototype, "valid", {
  11429. /**
  11430. * Checks if the select is in a valid state.
  11431. */
  11432. get: function get() {
  11433. return this.foundation_.isValid();
  11434. },
  11435. /**
  11436. * Sets the current invalid state of the select.
  11437. */
  11438. set: function set(isValid) {
  11439. this.foundation_.setValid(isValid);
  11440. },
  11441. enumerable: true,
  11442. configurable: true
  11443. });
  11444. Object.defineProperty(MDCSelect.prototype, "required", {
  11445. /**
  11446. * Returns whether the select is required.
  11447. */
  11448. get: function get() {
  11449. return this.foundation_.getRequired();
  11450. },
  11451. /**
  11452. * Sets the control to the required state.
  11453. */
  11454. set: function set(isRequired) {
  11455. this.foundation_.setRequired(isRequired);
  11456. },
  11457. enumerable: true,
  11458. configurable: true
  11459. });
  11460. /**
  11461. * Recomputes the outline SVG path for the outline element.
  11462. */
  11463. MDCSelect.prototype.layout = function () {
  11464. this.foundation_.layout();
  11465. };
  11466. MDCSelect.prototype.getDefaultFoundation = function () {
  11467. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  11468. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  11469. var adapter = __assign({}, this.getSelectAdapterMethods_(), this.getCommonAdapterMethods_(), this.getOutlineAdapterMethods_(), this.getLabelAdapterMethods_());
  11470. return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap_());
  11471. };
  11472. /**
  11473. * Handles setup for the menu.
  11474. */
  11475. MDCSelect.prototype.menuSetup_ = function (menuFactory) {
  11476. this.menuElement_ = this.root_.querySelector(constants_1.strings.MENU_SELECTOR);
  11477. this.menu_ = menuFactory(this.menuElement_);
  11478. };
  11479. MDCSelect.prototype.createRipple_ = function () {
  11480. var _this = this;
  11481. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  11482. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  11483. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11484. var adapter = __assign({}, component_6.MDCRipple.createAdapter({ root_: this.selectAnchor_ }), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  11485. return _this.selectedText_.addEventListener(evtType, handler);
  11486. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  11487. return _this.selectedText_.removeEventListener(evtType, handler);
  11488. } });
  11489. // tslint:enable:object-literal-sort-keys
  11490. return new component_6.MDCRipple(this.selectAnchor_, new foundation_1.MDCRippleFoundation(adapter));
  11491. };
  11492. MDCSelect.prototype.getSelectAdapterMethods_ = function () {
  11493. var _this = this;
  11494. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11495. return {
  11496. getSelectedMenuItem: function getSelectedMenuItem() {
  11497. return _this.menuElement_.querySelector(constants_1.strings.SELECTED_ITEM_SELECTOR);
  11498. },
  11499. getMenuItemAttr: function getMenuItemAttr(menuItem, attr) {
  11500. return menuItem.getAttribute(attr);
  11501. },
  11502. setSelectedText: function setSelectedText(text) {
  11503. return _this.selectedText_.textContent = text;
  11504. },
  11505. isSelectedTextFocused: function isSelectedTextFocused() {
  11506. return document.activeElement === _this.selectedText_;
  11507. },
  11508. getSelectedTextAttr: function getSelectedTextAttr(attr) {
  11509. return _this.selectedText_.getAttribute(attr);
  11510. },
  11511. setSelectedTextAttr: function setSelectedTextAttr(attr, value) {
  11512. return _this.selectedText_.setAttribute(attr, value);
  11513. },
  11514. openMenu: function openMenu() {
  11515. return _this.menu_.open = true;
  11516. },
  11517. closeMenu: function closeMenu() {
  11518. return _this.menu_.open = false;
  11519. },
  11520. getAnchorElement: function getAnchorElement() {
  11521. return _this.root_.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR);
  11522. },
  11523. setMenuAnchorElement: function setMenuAnchorElement(anchorEl) {
  11524. return _this.menu_.setAnchorElement(anchorEl);
  11525. },
  11526. setMenuAnchorCorner: function setMenuAnchorCorner(anchorCorner) {
  11527. return _this.menu_.setAnchorCorner(anchorCorner);
  11528. },
  11529. setMenuWrapFocus: function setMenuWrapFocus(wrapFocus) {
  11530. return _this.menu_.wrapFocus = wrapFocus;
  11531. },
  11532. setAttributeAtIndex: function setAttributeAtIndex(index, attributeName, attributeValue) {
  11533. return _this.menu_.items[index].setAttribute(attributeName, attributeValue);
  11534. },
  11535. removeAttributeAtIndex: function removeAttributeAtIndex(index, attributeName) {
  11536. return _this.menu_.items[index].removeAttribute(attributeName);
  11537. },
  11538. focusMenuItemAtIndex: function focusMenuItemAtIndex(index) {
  11539. return _this.menu_.items[index].focus();
  11540. },
  11541. getMenuItemCount: function getMenuItemCount() {
  11542. return _this.menu_.items.length;
  11543. },
  11544. getMenuItemValues: function getMenuItemValues() {
  11545. return _this.menu_.items.map(function (el) {
  11546. return el.getAttribute(constants_1.strings.VALUE_ATTR) || '';
  11547. });
  11548. },
  11549. getMenuItemTextAtIndex: function getMenuItemTextAtIndex(index) {
  11550. return _this.menu_.items[index].textContent;
  11551. },
  11552. addClassAtIndex: function addClassAtIndex(index, className) {
  11553. return _this.menu_.items[index].classList.add(className);
  11554. },
  11555. removeClassAtIndex: function removeClassAtIndex(index, className) {
  11556. return _this.menu_.items[index].classList.remove(className);
  11557. }
  11558. };
  11559. // tslint:enable:object-literal-sort-keys
  11560. };
  11561. MDCSelect.prototype.getCommonAdapterMethods_ = function () {
  11562. var _this = this;
  11563. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11564. return {
  11565. addClass: function addClass(className) {
  11566. return _this.root_.classList.add(className);
  11567. },
  11568. removeClass: function removeClass(className) {
  11569. return _this.root_.classList.remove(className);
  11570. },
  11571. hasClass: function hasClass(className) {
  11572. return _this.root_.classList.contains(className);
  11573. },
  11574. setRippleCenter: function setRippleCenter(normalizedX) {
  11575. return _this.lineRipple_ && _this.lineRipple_.setRippleCenter(normalizedX);
  11576. },
  11577. activateBottomLine: function activateBottomLine() {
  11578. return _this.lineRipple_ && _this.lineRipple_.activate();
  11579. },
  11580. deactivateBottomLine: function deactivateBottomLine() {
  11581. return _this.lineRipple_ && _this.lineRipple_.deactivate();
  11582. },
  11583. notifyChange: function notifyChange(value) {
  11584. var index = _this.selectedIndex;
  11585. _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true /* shouldBubble */);
  11586. }
  11587. };
  11588. // tslint:enable:object-literal-sort-keys
  11589. };
  11590. MDCSelect.prototype.getOutlineAdapterMethods_ = function () {
  11591. var _this = this;
  11592. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11593. return {
  11594. hasOutline: function hasOutline() {
  11595. return Boolean(_this.outline_);
  11596. },
  11597. notchOutline: function notchOutline(labelWidth) {
  11598. return _this.outline_ && _this.outline_.notch(labelWidth);
  11599. },
  11600. closeOutline: function closeOutline() {
  11601. return _this.outline_ && _this.outline_.closeNotch();
  11602. }
  11603. };
  11604. // tslint:enable:object-literal-sort-keys
  11605. };
  11606. MDCSelect.prototype.getLabelAdapterMethods_ = function () {
  11607. var _this = this;
  11608. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11609. return {
  11610. hasLabel: function hasLabel() {
  11611. return !!_this.label_;
  11612. },
  11613. floatLabel: function floatLabel(shouldFloat) {
  11614. return _this.label_ && _this.label_.float(shouldFloat);
  11615. },
  11616. getLabelWidth: function getLabelWidth() {
  11617. return _this.label_ ? _this.label_.getWidth() : 0;
  11618. }
  11619. };
  11620. // tslint:enable:object-literal-sort-keys
  11621. };
  11622. /**
  11623. * Calculates where the line ripple should start based on the x coordinate within the component.
  11624. */
  11625. MDCSelect.prototype.getNormalizedXCoordinate_ = function (evt) {
  11626. var targetClientRect = evt.target.getBoundingClientRect();
  11627. var xCoordinate = this.isTouchEvent_(evt) ? evt.touches[0].clientX : evt.clientX;
  11628. return xCoordinate - targetClientRect.left;
  11629. };
  11630. MDCSelect.prototype.isTouchEvent_ = function (evt) {
  11631. return Boolean(evt.touches);
  11632. };
  11633. /**
  11634. * Returns a map of all subcomponents to subfoundations.
  11635. */
  11636. MDCSelect.prototype.getFoundationMap_ = function () {
  11637. return {
  11638. helperText: this.helperText_ ? this.helperText_.foundation : undefined,
  11639. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined
  11640. };
  11641. };
  11642. return MDCSelect;
  11643. }(component_1.MDCComponent);
  11644. exports.MDCSelect = MDCSelect;
  11645. /***/ }),
  11646. /***/ "./packages/mdc-select/constants.ts":
  11647. /*!******************************************!*\
  11648. !*** ./packages/mdc-select/constants.ts ***!
  11649. \******************************************/
  11650. /*! no static exports found */
  11651. /***/ (function(module, exports, __webpack_require__) {
  11652. "use strict";
  11653. /**
  11654. * @license
  11655. * Copyright 2016 Google Inc.
  11656. *
  11657. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11658. * of this software and associated documentation files (the "Software"), to deal
  11659. * in the Software without restriction, including without limitation the rights
  11660. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11661. * copies of the Software, and to permit persons to whom the Software is
  11662. * furnished to do so, subject to the following conditions:
  11663. *
  11664. * The above copyright notice and this permission notice shall be included in
  11665. * all copies or substantial portions of the Software.
  11666. *
  11667. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11668. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11669. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11670. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11671. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11672. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11673. * THE SOFTWARE.
  11674. */
  11675. Object.defineProperty(exports, "__esModule", { value: true });
  11676. var cssClasses = {
  11677. ACTIVATED: 'mdc-select--activated',
  11678. DISABLED: 'mdc-select--disabled',
  11679. FOCUSED: 'mdc-select--focused',
  11680. INVALID: 'mdc-select--invalid',
  11681. OUTLINED: 'mdc-select--outlined',
  11682. REQUIRED: 'mdc-select--required',
  11683. ROOT: 'mdc-select',
  11684. SELECTED_ITEM_CLASS: 'mdc-list-item--selected',
  11685. WITH_LEADING_ICON: 'mdc-select--with-leading-icon'
  11686. };
  11687. exports.cssClasses = cssClasses;
  11688. var strings = {
  11689. ARIA_CONTROLS: 'aria-controls',
  11690. ARIA_SELECTED_ATTR: 'aria-selected',
  11691. CHANGE_EVENT: 'MDCSelect:change',
  11692. LABEL_SELECTOR: '.mdc-floating-label',
  11693. LEADING_ICON_SELECTOR: '.mdc-select__icon',
  11694. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  11695. MENU_SELECTOR: '.mdc-select__menu',
  11696. OUTLINE_SELECTOR: '.mdc-notched-outline',
  11697. SELECTED_ITEM_SELECTOR: "." + cssClasses.SELECTED_ITEM_CLASS,
  11698. SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text',
  11699. SELECT_ANCHOR_SELECTOR: '.mdc-select__anchor',
  11700. VALUE_ATTR: 'data-value'
  11701. };
  11702. exports.strings = strings;
  11703. var numbers = {
  11704. LABEL_SCALE: 0.75,
  11705. UNSET_INDEX: -1
  11706. };
  11707. exports.numbers = numbers;
  11708. /***/ }),
  11709. /***/ "./packages/mdc-select/foundation.ts":
  11710. /*!*******************************************!*\
  11711. !*** ./packages/mdc-select/foundation.ts ***!
  11712. \*******************************************/
  11713. /*! no static exports found */
  11714. /***/ (function(module, exports, __webpack_require__) {
  11715. "use strict";
  11716. /**
  11717. * @license
  11718. * Copyright 2016 Google Inc.
  11719. *
  11720. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11721. * of this software and associated documentation files (the "Software"), to deal
  11722. * in the Software without restriction, including without limitation the rights
  11723. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11724. * copies of the Software, and to permit persons to whom the Software is
  11725. * furnished to do so, subject to the following conditions:
  11726. *
  11727. * The above copyright notice and this permission notice shall be included in
  11728. * all copies or substantial portions of the Software.
  11729. *
  11730. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11731. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  11732. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  11733. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11734. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  11735. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  11736. * THE SOFTWARE.
  11737. */
  11738. var __extends = this && this.__extends || function () {
  11739. var _extendStatics = function extendStatics(d, b) {
  11740. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  11741. d.__proto__ = b;
  11742. } || function (d, b) {
  11743. for (var p in b) {
  11744. if (b.hasOwnProperty(p)) d[p] = b[p];
  11745. }
  11746. };
  11747. return _extendStatics(d, b);
  11748. };
  11749. return function (d, b) {
  11750. _extendStatics(d, b);
  11751. function __() {
  11752. this.constructor = d;
  11753. }
  11754. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11755. };
  11756. }();
  11757. var __assign = this && this.__assign || function () {
  11758. __assign = Object.assign || function (t) {
  11759. for (var s, i = 1, n = arguments.length; i < n; i++) {
  11760. s = arguments[i];
  11761. for (var p in s) {
  11762. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  11763. }
  11764. }
  11765. return t;
  11766. };
  11767. return __assign.apply(this, arguments);
  11768. };
  11769. Object.defineProperty(exports, "__esModule", { value: true });
  11770. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  11771. var constants_1 = __webpack_require__(/*! @material/menu-surface/constants */ "./packages/mdc-menu-surface/constants.ts");
  11772. var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts");
  11773. var MDCSelectFoundation = /** @class */function (_super) {
  11774. __extends(MDCSelectFoundation, _super);
  11775. /* istanbul ignore next: optional argument is not a branch statement */
  11776. /**
  11777. * @param adapter
  11778. * @param foundationMap Map from subcomponent names to their subfoundations.
  11779. */
  11780. function MDCSelectFoundation(adapter, foundationMap) {
  11781. if (foundationMap === void 0) {
  11782. foundationMap = {};
  11783. }
  11784. var _this = _super.call(this, __assign({}, MDCSelectFoundation.defaultAdapter, adapter)) || this;
  11785. // Index of the currently selected menu item.
  11786. _this.selectedIndex_ = constants_2.numbers.UNSET_INDEX;
  11787. // Disabled state
  11788. _this.disabled_ = false;
  11789. // isMenuOpen_ is used to track the state of the menu by listening to the MDCMenuSurface:closed event
  11790. // For reference, menu.open will return false if the menu is still closing, but isMenuOpen_ returns false only after
  11791. // the menu has closed
  11792. _this.isMenuOpen_ = false;
  11793. _this.leadingIcon_ = foundationMap.leadingIcon;
  11794. _this.helperText_ = foundationMap.helperText;
  11795. _this.menuItemValues_ = _this.adapter_.getMenuItemValues();
  11796. return _this;
  11797. }
  11798. Object.defineProperty(MDCSelectFoundation, "cssClasses", {
  11799. get: function get() {
  11800. return constants_2.cssClasses;
  11801. },
  11802. enumerable: true,
  11803. configurable: true
  11804. });
  11805. Object.defineProperty(MDCSelectFoundation, "numbers", {
  11806. get: function get() {
  11807. return constants_2.numbers;
  11808. },
  11809. enumerable: true,
  11810. configurable: true
  11811. });
  11812. Object.defineProperty(MDCSelectFoundation, "strings", {
  11813. get: function get() {
  11814. return constants_2.strings;
  11815. },
  11816. enumerable: true,
  11817. configurable: true
  11818. });
  11819. Object.defineProperty(MDCSelectFoundation, "defaultAdapter", {
  11820. /**
  11821. * See {@link MDCSelectAdapter} for typing information on parameters and return types.
  11822. */
  11823. get: function get() {
  11824. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  11825. return {
  11826. addClass: function addClass() {
  11827. return undefined;
  11828. },
  11829. removeClass: function removeClass() {
  11830. return undefined;
  11831. },
  11832. hasClass: function hasClass() {
  11833. return false;
  11834. },
  11835. activateBottomLine: function activateBottomLine() {
  11836. return undefined;
  11837. },
  11838. deactivateBottomLine: function deactivateBottomLine() {
  11839. return undefined;
  11840. },
  11841. getSelectedMenuItem: function getSelectedMenuItem() {
  11842. return null;
  11843. },
  11844. hasLabel: function hasLabel() {
  11845. return false;
  11846. },
  11847. floatLabel: function floatLabel() {
  11848. return undefined;
  11849. },
  11850. getLabelWidth: function getLabelWidth() {
  11851. return 0;
  11852. },
  11853. hasOutline: function hasOutline() {
  11854. return false;
  11855. },
  11856. notchOutline: function notchOutline() {
  11857. return undefined;
  11858. },
  11859. closeOutline: function closeOutline() {
  11860. return undefined;
  11861. },
  11862. setRippleCenter: function setRippleCenter() {
  11863. return undefined;
  11864. },
  11865. notifyChange: function notifyChange() {
  11866. return undefined;
  11867. },
  11868. setSelectedText: function setSelectedText() {
  11869. return undefined;
  11870. },
  11871. isSelectedTextFocused: function isSelectedTextFocused() {
  11872. return false;
  11873. },
  11874. getSelectedTextAttr: function getSelectedTextAttr() {
  11875. return '';
  11876. },
  11877. setSelectedTextAttr: function setSelectedTextAttr() {
  11878. return undefined;
  11879. },
  11880. openMenu: function openMenu() {
  11881. return undefined;
  11882. },
  11883. closeMenu: function closeMenu() {
  11884. return undefined;
  11885. },
  11886. getAnchorElement: function getAnchorElement() {
  11887. return null;
  11888. },
  11889. setMenuAnchorElement: function setMenuAnchorElement() {
  11890. return undefined;
  11891. },
  11892. setMenuAnchorCorner: function setMenuAnchorCorner() {
  11893. return undefined;
  11894. },
  11895. setMenuWrapFocus: function setMenuWrapFocus() {
  11896. return undefined;
  11897. },
  11898. setAttributeAtIndex: function setAttributeAtIndex() {
  11899. return undefined;
  11900. },
  11901. removeAttributeAtIndex: function removeAttributeAtIndex() {
  11902. return undefined;
  11903. },
  11904. focusMenuItemAtIndex: function focusMenuItemAtIndex() {
  11905. return undefined;
  11906. },
  11907. getMenuItemCount: function getMenuItemCount() {
  11908. return 0;
  11909. },
  11910. getMenuItemValues: function getMenuItemValues() {
  11911. return [];
  11912. },
  11913. getMenuItemTextAtIndex: function getMenuItemTextAtIndex() {
  11914. return '';
  11915. },
  11916. getMenuItemAttr: function getMenuItemAttr() {
  11917. return '';
  11918. },
  11919. addClassAtIndex: function addClassAtIndex() {
  11920. return undefined;
  11921. },
  11922. removeClassAtIndex: function removeClassAtIndex() {
  11923. return undefined;
  11924. }
  11925. };
  11926. // tslint:enable:object-literal-sort-keys
  11927. },
  11928. enumerable: true,
  11929. configurable: true
  11930. });
  11931. /** Returns the index of the currently selected menu item, or -1 if none. */
  11932. MDCSelectFoundation.prototype.getSelectedIndex = function () {
  11933. return this.selectedIndex_;
  11934. };
  11935. MDCSelectFoundation.prototype.setSelectedIndex = function (index, closeMenu) {
  11936. if (closeMenu === void 0) {
  11937. closeMenu = false;
  11938. }
  11939. if (index >= this.adapter_.getMenuItemCount()) {
  11940. return;
  11941. }
  11942. var previouslySelectedIndex = this.selectedIndex_;
  11943. this.selectedIndex_ = index;
  11944. if (this.selectedIndex_ === constants_2.numbers.UNSET_INDEX) {
  11945. this.adapter_.setSelectedText('');
  11946. } else {
  11947. this.adapter_.setSelectedText(this.adapter_.getMenuItemTextAtIndex(this.selectedIndex_).trim());
  11948. }
  11949. if (previouslySelectedIndex !== constants_2.numbers.UNSET_INDEX) {
  11950. this.adapter_.removeClassAtIndex(previouslySelectedIndex, constants_2.cssClasses.SELECTED_ITEM_CLASS);
  11951. this.adapter_.removeAttributeAtIndex(previouslySelectedIndex, constants_2.strings.ARIA_SELECTED_ATTR);
  11952. }
  11953. if (this.selectedIndex_ !== constants_2.numbers.UNSET_INDEX) {
  11954. this.adapter_.addClassAtIndex(this.selectedIndex_, constants_2.cssClasses.SELECTED_ITEM_CLASS);
  11955. this.adapter_.setAttributeAtIndex(this.selectedIndex_, constants_2.strings.ARIA_SELECTED_ATTR, 'true');
  11956. }
  11957. this.layout();
  11958. if (closeMenu) {
  11959. this.adapter_.closeMenu();
  11960. }
  11961. this.handleChange();
  11962. };
  11963. MDCSelectFoundation.prototype.setValue = function (value) {
  11964. var index = this.menuItemValues_.indexOf(value);
  11965. this.setSelectedIndex(index);
  11966. this.handleChange();
  11967. };
  11968. MDCSelectFoundation.prototype.getValue = function () {
  11969. var listItem = this.adapter_.getSelectedMenuItem();
  11970. if (listItem) {
  11971. return this.adapter_.getMenuItemAttr(listItem, constants_2.strings.VALUE_ATTR) || '';
  11972. }
  11973. return '';
  11974. };
  11975. MDCSelectFoundation.prototype.getDisabled = function () {
  11976. return this.disabled_;
  11977. };
  11978. MDCSelectFoundation.prototype.setDisabled = function (isDisabled) {
  11979. this.disabled_ = isDisabled;
  11980. if (this.disabled_) {
  11981. this.adapter_.addClass(constants_2.cssClasses.DISABLED);
  11982. this.adapter_.closeMenu();
  11983. } else {
  11984. this.adapter_.removeClass(constants_2.cssClasses.DISABLED);
  11985. }
  11986. if (this.leadingIcon_) {
  11987. this.leadingIcon_.setDisabled(this.disabled_);
  11988. }
  11989. this.adapter_.setSelectedTextAttr('tabindex', this.disabled_ ? '-1' : '0');
  11990. this.adapter_.setSelectedTextAttr('aria-disabled', this.disabled_.toString());
  11991. };
  11992. /**
  11993. * @param content Sets the content of the helper text.
  11994. */
  11995. MDCSelectFoundation.prototype.setHelperTextContent = function (content) {
  11996. if (this.helperText_) {
  11997. this.helperText_.setContent(content);
  11998. }
  11999. };
  12000. MDCSelectFoundation.prototype.layout = function () {
  12001. if (this.adapter_.hasLabel()) {
  12002. var openNotch = this.getValue().length > 0;
  12003. this.notchOutline(openNotch);
  12004. }
  12005. };
  12006. MDCSelectFoundation.prototype.handleMenuOpened = function () {
  12007. if (this.adapter_.getMenuItemValues().length === 0) {
  12008. return;
  12009. }
  12010. this.adapter_.addClass(constants_2.cssClasses.ACTIVATED);
  12011. // Menu should open to the last selected element, should open to first menu item otherwise.
  12012. var focusItemIndex = this.selectedIndex_ >= 0 ? this.selectedIndex_ : 0;
  12013. this.adapter_.focusMenuItemAtIndex(focusItemIndex);
  12014. };
  12015. MDCSelectFoundation.prototype.handleMenuClosed = function () {
  12016. this.adapter_.removeClass(constants_2.cssClasses.ACTIVATED);
  12017. this.isMenuOpen_ = false;
  12018. this.adapter_.setSelectedTextAttr('aria-expanded', 'false');
  12019. // Unfocus the select if menu is closed without a selection
  12020. if (!this.adapter_.isSelectedTextFocused()) {
  12021. this.blur_();
  12022. }
  12023. };
  12024. /**
  12025. * Handles value changes, via change event or programmatic updates.
  12026. */
  12027. MDCSelectFoundation.prototype.handleChange = function () {
  12028. this.updateLabel_();
  12029. this.adapter_.notifyChange(this.getValue());
  12030. var isRequired = this.adapter_.hasClass(constants_2.cssClasses.REQUIRED);
  12031. if (isRequired) {
  12032. this.setValid(this.isValid());
  12033. if (this.helperText_) {
  12034. this.helperText_.setValidity(this.isValid());
  12035. }
  12036. }
  12037. };
  12038. MDCSelectFoundation.prototype.handleMenuItemAction = function (index) {
  12039. this.setSelectedIndex(index, /** closeMenu */true);
  12040. };
  12041. /**
  12042. * Handles focus events from select element.
  12043. */
  12044. MDCSelectFoundation.prototype.handleFocus = function () {
  12045. this.adapter_.addClass(constants_2.cssClasses.FOCUSED);
  12046. if (this.adapter_.hasLabel()) {
  12047. this.notchOutline(true);
  12048. this.adapter_.floatLabel(true);
  12049. }
  12050. this.adapter_.activateBottomLine();
  12051. if (this.helperText_) {
  12052. this.helperText_.showToScreenReader();
  12053. }
  12054. };
  12055. /**
  12056. * Handles blur events from select element.
  12057. */
  12058. MDCSelectFoundation.prototype.handleBlur = function () {
  12059. if (this.isMenuOpen_) {
  12060. return;
  12061. }
  12062. this.blur_();
  12063. };
  12064. MDCSelectFoundation.prototype.handleClick = function (normalizedX) {
  12065. if (this.isMenuOpen_) {
  12066. return;
  12067. }
  12068. this.adapter_.setRippleCenter(normalizedX);
  12069. this.adapter_.openMenu();
  12070. this.isMenuOpen_ = true;
  12071. this.adapter_.setSelectedTextAttr('aria-expanded', 'true');
  12072. };
  12073. MDCSelectFoundation.prototype.handleKeydown = function (event) {
  12074. if (this.isMenuOpen_) {
  12075. return;
  12076. }
  12077. var isEnter = event.key === 'Enter' || event.keyCode === 13;
  12078. var isSpace = event.key === 'Space' || event.keyCode === 32;
  12079. var arrowUp = event.key === 'ArrowUp' || event.keyCode === 38;
  12080. var arrowDown = event.key === 'ArrowDown' || event.keyCode === 40;
  12081. if (this.adapter_.hasClass(constants_2.cssClasses.FOCUSED) && (isEnter || isSpace || arrowUp || arrowDown)) {
  12082. this.adapter_.openMenu();
  12083. this.isMenuOpen_ = true;
  12084. this.adapter_.setSelectedTextAttr('aria-expanded', 'true');
  12085. event.preventDefault();
  12086. }
  12087. };
  12088. /**
  12089. * Opens/closes the notched outline.
  12090. */
  12091. MDCSelectFoundation.prototype.notchOutline = function (openNotch) {
  12092. if (!this.adapter_.hasOutline()) {
  12093. return;
  12094. }
  12095. var isFocused = this.adapter_.hasClass(constants_2.cssClasses.FOCUSED);
  12096. if (openNotch) {
  12097. var labelScale = constants_2.numbers.LABEL_SCALE;
  12098. var labelWidth = this.adapter_.getLabelWidth() * labelScale;
  12099. this.adapter_.notchOutline(labelWidth);
  12100. } else if (!isFocused) {
  12101. this.adapter_.closeOutline();
  12102. }
  12103. };
  12104. /**
  12105. * Sets the aria label of the leading icon.
  12106. */
  12107. MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  12108. if (this.leadingIcon_) {
  12109. this.leadingIcon_.setAriaLabel(label);
  12110. }
  12111. };
  12112. /**
  12113. * Sets the text content of the leading icon.
  12114. */
  12115. MDCSelectFoundation.prototype.setLeadingIconContent = function (content) {
  12116. if (this.leadingIcon_) {
  12117. this.leadingIcon_.setContent(content);
  12118. }
  12119. };
  12120. MDCSelectFoundation.prototype.setValid = function (isValid) {
  12121. this.adapter_.setSelectedTextAttr('aria-invalid', (!isValid).toString());
  12122. if (isValid) {
  12123. this.adapter_.removeClass(constants_2.cssClasses.INVALID);
  12124. } else {
  12125. this.adapter_.addClass(constants_2.cssClasses.INVALID);
  12126. }
  12127. };
  12128. MDCSelectFoundation.prototype.isValid = function () {
  12129. if (this.adapter_.hasClass(constants_2.cssClasses.REQUIRED) && !this.adapter_.hasClass(constants_2.cssClasses.DISABLED)) {
  12130. // See notes for required attribute under https://www.w3.org/TR/html52/sec-forms.html#the-select-element
  12131. // TL;DR: Invalid if no index is selected, or if the first index is selected and has an empty value.
  12132. return this.selectedIndex_ !== constants_2.numbers.UNSET_INDEX && (this.selectedIndex_ !== 0 || Boolean(this.getValue()));
  12133. }
  12134. return true;
  12135. };
  12136. MDCSelectFoundation.prototype.setRequired = function (isRequired) {
  12137. if (isRequired) {
  12138. this.adapter_.addClass(constants_2.cssClasses.REQUIRED);
  12139. } else {
  12140. this.adapter_.removeClass(constants_2.cssClasses.REQUIRED);
  12141. }
  12142. this.adapter_.setSelectedTextAttr('aria-required', isRequired.toString());
  12143. };
  12144. MDCSelectFoundation.prototype.getRequired = function () {
  12145. return this.adapter_.getSelectedTextAttr('aria-required') === 'true';
  12146. };
  12147. MDCSelectFoundation.prototype.init = function () {
  12148. var anchorEl = this.adapter_.getAnchorElement();
  12149. if (anchorEl) {
  12150. this.adapter_.setMenuAnchorElement(anchorEl);
  12151. this.adapter_.setMenuAnchorCorner(constants_1.Corner.BOTTOM_START);
  12152. }
  12153. this.adapter_.setMenuWrapFocus(false);
  12154. var value = this.getValue();
  12155. if (value) {
  12156. this.setValue(value);
  12157. }
  12158. // Initially sync floating label
  12159. this.updateLabel_();
  12160. };
  12161. /**
  12162. * Notches the outline and floats the label when appropriate.
  12163. */
  12164. MDCSelectFoundation.prototype.updateLabel_ = function () {
  12165. var value = this.getValue();
  12166. var optionHasValue = value.length > 0;
  12167. if (this.adapter_.hasLabel()) {
  12168. this.notchOutline(optionHasValue);
  12169. if (!this.adapter_.hasClass(constants_2.cssClasses.FOCUSED)) {
  12170. this.adapter_.floatLabel(optionHasValue);
  12171. }
  12172. }
  12173. };
  12174. /**
  12175. * Unfocuses the select component.
  12176. */
  12177. MDCSelectFoundation.prototype.blur_ = function () {
  12178. this.adapter_.removeClass(constants_2.cssClasses.FOCUSED);
  12179. this.updateLabel_();
  12180. this.adapter_.deactivateBottomLine();
  12181. var isRequired = this.adapter_.hasClass(constants_2.cssClasses.REQUIRED);
  12182. if (isRequired) {
  12183. this.setValid(this.isValid());
  12184. if (this.helperText_) {
  12185. this.helperText_.setValidity(this.isValid());
  12186. }
  12187. }
  12188. };
  12189. return MDCSelectFoundation;
  12190. }(foundation_1.MDCFoundation);
  12191. exports.MDCSelectFoundation = MDCSelectFoundation;
  12192. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12193. exports.default = MDCSelectFoundation;
  12194. /***/ }),
  12195. /***/ "./packages/mdc-select/helper-text/component.ts":
  12196. /*!******************************************************!*\
  12197. !*** ./packages/mdc-select/helper-text/component.ts ***!
  12198. \******************************************************/
  12199. /*! no static exports found */
  12200. /***/ (function(module, exports, __webpack_require__) {
  12201. "use strict";
  12202. /**
  12203. * @license
  12204. * Copyright 2018 Google Inc.
  12205. *
  12206. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12207. * of this software and associated documentation files (the "Software"), to deal
  12208. * in the Software without restriction, including without limitation the rights
  12209. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12210. * copies of the Software, and to permit persons to whom the Software is
  12211. * furnished to do so, subject to the following conditions:
  12212. *
  12213. * The above copyright notice and this permission notice shall be included in
  12214. * all copies or substantial portions of the Software.
  12215. *
  12216. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12217. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12218. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12219. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12220. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12221. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12222. * THE SOFTWARE.
  12223. */
  12224. var __extends = this && this.__extends || function () {
  12225. var _extendStatics = function extendStatics(d, b) {
  12226. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12227. d.__proto__ = b;
  12228. } || function (d, b) {
  12229. for (var p in b) {
  12230. if (b.hasOwnProperty(p)) d[p] = b[p];
  12231. }
  12232. };
  12233. return _extendStatics(d, b);
  12234. };
  12235. return function (d, b) {
  12236. _extendStatics(d, b);
  12237. function __() {
  12238. this.constructor = d;
  12239. }
  12240. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12241. };
  12242. }();
  12243. Object.defineProperty(exports, "__esModule", { value: true });
  12244. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12245. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts");
  12246. var MDCSelectHelperText = /** @class */function (_super) {
  12247. __extends(MDCSelectHelperText, _super);
  12248. function MDCSelectHelperText() {
  12249. return _super !== null && _super.apply(this, arguments) || this;
  12250. }
  12251. MDCSelectHelperText.attachTo = function (root) {
  12252. return new MDCSelectHelperText(root);
  12253. };
  12254. Object.defineProperty(MDCSelectHelperText.prototype, "foundation", {
  12255. get: function get() {
  12256. return this.foundation_;
  12257. },
  12258. enumerable: true,
  12259. configurable: true
  12260. });
  12261. MDCSelectHelperText.prototype.getDefaultFoundation = function () {
  12262. var _this = this;
  12263. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12264. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12265. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12266. var adapter = {
  12267. addClass: function addClass(className) {
  12268. return _this.root_.classList.add(className);
  12269. },
  12270. removeClass: function removeClass(className) {
  12271. return _this.root_.classList.remove(className);
  12272. },
  12273. hasClass: function hasClass(className) {
  12274. return _this.root_.classList.contains(className);
  12275. },
  12276. setAttr: function setAttr(attr, value) {
  12277. return _this.root_.setAttribute(attr, value);
  12278. },
  12279. removeAttr: function removeAttr(attr) {
  12280. return _this.root_.removeAttribute(attr);
  12281. },
  12282. setContent: function setContent(content) {
  12283. _this.root_.textContent = content;
  12284. }
  12285. };
  12286. // tslint:enable:object-literal-sort-keys
  12287. return new foundation_1.MDCSelectHelperTextFoundation(adapter);
  12288. };
  12289. return MDCSelectHelperText;
  12290. }(component_1.MDCComponent);
  12291. exports.MDCSelectHelperText = MDCSelectHelperText;
  12292. /***/ }),
  12293. /***/ "./packages/mdc-select/helper-text/constants.ts":
  12294. /*!******************************************************!*\
  12295. !*** ./packages/mdc-select/helper-text/constants.ts ***!
  12296. \******************************************************/
  12297. /*! no static exports found */
  12298. /***/ (function(module, exports, __webpack_require__) {
  12299. "use strict";
  12300. /**
  12301. * @license
  12302. * Copyright 2018 Google Inc.
  12303. *
  12304. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12305. * of this software and associated documentation files (the "Software"), to deal
  12306. * in the Software without restriction, including without limitation the rights
  12307. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12308. * copies of the Software, and to permit persons to whom the Software is
  12309. * furnished to do so, subject to the following conditions:
  12310. *
  12311. * The above copyright notice and this permission notice shall be included in
  12312. * all copies or substantial portions of the Software.
  12313. *
  12314. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12315. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12316. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12317. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12318. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12319. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12320. * THE SOFTWARE.
  12321. */
  12322. Object.defineProperty(exports, "__esModule", { value: true });
  12323. var strings = {
  12324. ARIA_HIDDEN: 'aria-hidden',
  12325. ROLE: 'role'
  12326. };
  12327. exports.strings = strings;
  12328. var cssClasses = {
  12329. HELPER_TEXT_PERSISTENT: 'mdc-select-helper-text--persistent',
  12330. HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg'
  12331. };
  12332. exports.cssClasses = cssClasses;
  12333. /***/ }),
  12334. /***/ "./packages/mdc-select/helper-text/foundation.ts":
  12335. /*!*******************************************************!*\
  12336. !*** ./packages/mdc-select/helper-text/foundation.ts ***!
  12337. \*******************************************************/
  12338. /*! no static exports found */
  12339. /***/ (function(module, exports, __webpack_require__) {
  12340. "use strict";
  12341. /**
  12342. * @license
  12343. * Copyright 2018 Google Inc.
  12344. *
  12345. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12346. * of this software and associated documentation files (the "Software"), to deal
  12347. * in the Software without restriction, including without limitation the rights
  12348. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12349. * copies of the Software, and to permit persons to whom the Software is
  12350. * furnished to do so, subject to the following conditions:
  12351. *
  12352. * The above copyright notice and this permission notice shall be included in
  12353. * all copies or substantial portions of the Software.
  12354. *
  12355. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12356. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12357. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12358. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12359. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12360. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12361. * THE SOFTWARE.
  12362. */
  12363. var __extends = this && this.__extends || function () {
  12364. var _extendStatics = function extendStatics(d, b) {
  12365. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12366. d.__proto__ = b;
  12367. } || function (d, b) {
  12368. for (var p in b) {
  12369. if (b.hasOwnProperty(p)) d[p] = b[p];
  12370. }
  12371. };
  12372. return _extendStatics(d, b);
  12373. };
  12374. return function (d, b) {
  12375. _extendStatics(d, b);
  12376. function __() {
  12377. this.constructor = d;
  12378. }
  12379. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12380. };
  12381. }();
  12382. var __assign = this && this.__assign || function () {
  12383. __assign = Object.assign || function (t) {
  12384. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12385. s = arguments[i];
  12386. for (var p in s) {
  12387. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12388. }
  12389. }
  12390. return t;
  12391. };
  12392. return __assign.apply(this, arguments);
  12393. };
  12394. Object.defineProperty(exports, "__esModule", { value: true });
  12395. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12396. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  12397. var MDCSelectHelperTextFoundation = /** @class */function (_super) {
  12398. __extends(MDCSelectHelperTextFoundation, _super);
  12399. function MDCSelectHelperTextFoundation(adapter) {
  12400. return _super.call(this, __assign({}, MDCSelectHelperTextFoundation.defaultAdapter, adapter)) || this;
  12401. }
  12402. Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
  12403. get: function get() {
  12404. return constants_1.cssClasses;
  12405. },
  12406. enumerable: true,
  12407. configurable: true
  12408. });
  12409. Object.defineProperty(MDCSelectHelperTextFoundation, "strings", {
  12410. get: function get() {
  12411. return constants_1.strings;
  12412. },
  12413. enumerable: true,
  12414. configurable: true
  12415. });
  12416. Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", {
  12417. /**
  12418. * See {@link MDCSelectHelperTextAdapter} for typing information on parameters and return types.
  12419. */
  12420. get: function get() {
  12421. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12422. return {
  12423. addClass: function addClass() {
  12424. return undefined;
  12425. },
  12426. removeClass: function removeClass() {
  12427. return undefined;
  12428. },
  12429. hasClass: function hasClass() {
  12430. return false;
  12431. },
  12432. setAttr: function setAttr() {
  12433. return undefined;
  12434. },
  12435. removeAttr: function removeAttr() {
  12436. return undefined;
  12437. },
  12438. setContent: function setContent() {
  12439. return undefined;
  12440. }
  12441. };
  12442. // tslint:enable:object-literal-sort-keys
  12443. },
  12444. enumerable: true,
  12445. configurable: true
  12446. });
  12447. /**
  12448. * Sets the content of the helper text field.
  12449. */
  12450. MDCSelectHelperTextFoundation.prototype.setContent = function (content) {
  12451. this.adapter_.setContent(content);
  12452. };
  12453. /**
  12454. * Sets the persistency of the helper text.
  12455. */
  12456. MDCSelectHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  12457. if (isPersistent) {
  12458. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12459. } else {
  12460. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12461. }
  12462. };
  12463. /**
  12464. * @param isValidation True to make the helper text act as an error validation message.
  12465. */
  12466. MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {
  12467. if (isValidation) {
  12468. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  12469. } else {
  12470. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  12471. }
  12472. };
  12473. /**
  12474. * Makes the helper text visible to screen readers.
  12475. */
  12476. MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {
  12477. this.adapter_.removeAttr(constants_1.strings.ARIA_HIDDEN);
  12478. };
  12479. /**
  12480. * Sets the validity of the helper text based on the select validity.
  12481. */
  12482. MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {
  12483. var helperTextIsPersistent = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  12484. var helperTextIsValidationMsg = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  12485. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !selectIsValid;
  12486. if (validationMsgNeedsDisplay) {
  12487. this.adapter_.setAttr(constants_1.strings.ROLE, 'alert');
  12488. } else {
  12489. this.adapter_.removeAttr(constants_1.strings.ROLE);
  12490. }
  12491. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  12492. this.hide_();
  12493. }
  12494. };
  12495. /**
  12496. * Hides the help text from screen readers.
  12497. */
  12498. MDCSelectHelperTextFoundation.prototype.hide_ = function () {
  12499. this.adapter_.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  12500. };
  12501. return MDCSelectHelperTextFoundation;
  12502. }(foundation_1.MDCFoundation);
  12503. exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation;
  12504. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12505. exports.default = MDCSelectHelperTextFoundation;
  12506. /***/ }),
  12507. /***/ "./packages/mdc-select/helper-text/index.ts":
  12508. /*!**************************************************!*\
  12509. !*** ./packages/mdc-select/helper-text/index.ts ***!
  12510. \**************************************************/
  12511. /*! no static exports found */
  12512. /***/ (function(module, exports, __webpack_require__) {
  12513. "use strict";
  12514. /**
  12515. * @license
  12516. * Copyright 2019 Google Inc.
  12517. *
  12518. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12519. * of this software and associated documentation files (the "Software"), to deal
  12520. * in the Software without restriction, including without limitation the rights
  12521. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12522. * copies of the Software, and to permit persons to whom the Software is
  12523. * furnished to do so, subject to the following conditions:
  12524. *
  12525. * The above copyright notice and this permission notice shall be included in
  12526. * all copies or substantial portions of the Software.
  12527. *
  12528. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12529. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12530. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12531. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12532. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12533. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12534. * THE SOFTWARE.
  12535. */
  12536. function __export(m) {
  12537. for (var p in m) {
  12538. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  12539. }
  12540. }
  12541. Object.defineProperty(exports, "__esModule", { value: true });
  12542. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/helper-text/component.ts"));
  12543. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/helper-text/foundation.ts"));
  12544. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/helper-text/constants.ts");
  12545. exports.helperTextCssClasses = constants_1.cssClasses;
  12546. exports.helperTextStrings = constants_1.strings;
  12547. /***/ }),
  12548. /***/ "./packages/mdc-select/icon/component.ts":
  12549. /*!***********************************************!*\
  12550. !*** ./packages/mdc-select/icon/component.ts ***!
  12551. \***********************************************/
  12552. /*! no static exports found */
  12553. /***/ (function(module, exports, __webpack_require__) {
  12554. "use strict";
  12555. /**
  12556. * @license
  12557. * Copyright 2018 Google Inc.
  12558. *
  12559. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12560. * of this software and associated documentation files (the "Software"), to deal
  12561. * in the Software without restriction, including without limitation the rights
  12562. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12563. * copies of the Software, and to permit persons to whom the Software is
  12564. * furnished to do so, subject to the following conditions:
  12565. *
  12566. * The above copyright notice and this permission notice shall be included in
  12567. * all copies or substantial portions of the Software.
  12568. *
  12569. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12570. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12571. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12572. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12573. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12574. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12575. * THE SOFTWARE.
  12576. */
  12577. var __extends = this && this.__extends || function () {
  12578. var _extendStatics = function extendStatics(d, b) {
  12579. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12580. d.__proto__ = b;
  12581. } || function (d, b) {
  12582. for (var p in b) {
  12583. if (b.hasOwnProperty(p)) d[p] = b[p];
  12584. }
  12585. };
  12586. return _extendStatics(d, b);
  12587. };
  12588. return function (d, b) {
  12589. _extendStatics(d, b);
  12590. function __() {
  12591. this.constructor = d;
  12592. }
  12593. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12594. };
  12595. }();
  12596. Object.defineProperty(exports, "__esModule", { value: true });
  12597. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12598. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts");
  12599. var MDCSelectIcon = /** @class */function (_super) {
  12600. __extends(MDCSelectIcon, _super);
  12601. function MDCSelectIcon() {
  12602. return _super !== null && _super.apply(this, arguments) || this;
  12603. }
  12604. MDCSelectIcon.attachTo = function (root) {
  12605. return new MDCSelectIcon(root);
  12606. };
  12607. Object.defineProperty(MDCSelectIcon.prototype, "foundation", {
  12608. get: function get() {
  12609. return this.foundation_;
  12610. },
  12611. enumerable: true,
  12612. configurable: true
  12613. });
  12614. MDCSelectIcon.prototype.getDefaultFoundation = function () {
  12615. var _this = this;
  12616. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  12617. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  12618. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12619. var adapter = {
  12620. getAttr: function getAttr(attr) {
  12621. return _this.root_.getAttribute(attr);
  12622. },
  12623. setAttr: function setAttr(attr, value) {
  12624. return _this.root_.setAttribute(attr, value);
  12625. },
  12626. removeAttr: function removeAttr(attr) {
  12627. return _this.root_.removeAttribute(attr);
  12628. },
  12629. setContent: function setContent(content) {
  12630. _this.root_.textContent = content;
  12631. },
  12632. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  12633. return _this.listen(evtType, handler);
  12634. },
  12635. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  12636. return _this.unlisten(evtType, handler);
  12637. },
  12638. notifyIconAction: function notifyIconAction() {
  12639. return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  12640. }
  12641. };
  12642. // tslint:enable:object-literal-sort-keys
  12643. return new foundation_1.MDCSelectIconFoundation(adapter);
  12644. };
  12645. return MDCSelectIcon;
  12646. }(component_1.MDCComponent);
  12647. exports.MDCSelectIcon = MDCSelectIcon;
  12648. /***/ }),
  12649. /***/ "./packages/mdc-select/icon/constants.ts":
  12650. /*!***********************************************!*\
  12651. !*** ./packages/mdc-select/icon/constants.ts ***!
  12652. \***********************************************/
  12653. /*! no static exports found */
  12654. /***/ (function(module, exports, __webpack_require__) {
  12655. "use strict";
  12656. /**
  12657. * @license
  12658. * Copyright 2018 Google Inc.
  12659. *
  12660. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12661. * of this software and associated documentation files (the "Software"), to deal
  12662. * in the Software without restriction, including without limitation the rights
  12663. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12664. * copies of the Software, and to permit persons to whom the Software is
  12665. * furnished to do so, subject to the following conditions:
  12666. *
  12667. * The above copyright notice and this permission notice shall be included in
  12668. * all copies or substantial portions of the Software.
  12669. *
  12670. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12671. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12672. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12673. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12674. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12675. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12676. * THE SOFTWARE.
  12677. */
  12678. Object.defineProperty(exports, "__esModule", { value: true });
  12679. var strings = {
  12680. ICON_EVENT: 'MDCSelect:icon',
  12681. ICON_ROLE: 'button'
  12682. };
  12683. exports.strings = strings;
  12684. /***/ }),
  12685. /***/ "./packages/mdc-select/icon/foundation.ts":
  12686. /*!************************************************!*\
  12687. !*** ./packages/mdc-select/icon/foundation.ts ***!
  12688. \************************************************/
  12689. /*! no static exports found */
  12690. /***/ (function(module, exports, __webpack_require__) {
  12691. "use strict";
  12692. /**
  12693. * @license
  12694. * Copyright 2018 Google Inc.
  12695. *
  12696. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12697. * of this software and associated documentation files (the "Software"), to deal
  12698. * in the Software without restriction, including without limitation the rights
  12699. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12700. * copies of the Software, and to permit persons to whom the Software is
  12701. * furnished to do so, subject to the following conditions:
  12702. *
  12703. * The above copyright notice and this permission notice shall be included in
  12704. * all copies or substantial portions of the Software.
  12705. *
  12706. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12707. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12708. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12709. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12710. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12711. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12712. * THE SOFTWARE.
  12713. */
  12714. var __extends = this && this.__extends || function () {
  12715. var _extendStatics = function extendStatics(d, b) {
  12716. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12717. d.__proto__ = b;
  12718. } || function (d, b) {
  12719. for (var p in b) {
  12720. if (b.hasOwnProperty(p)) d[p] = b[p];
  12721. }
  12722. };
  12723. return _extendStatics(d, b);
  12724. };
  12725. return function (d, b) {
  12726. _extendStatics(d, b);
  12727. function __() {
  12728. this.constructor = d;
  12729. }
  12730. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12731. };
  12732. }();
  12733. var __assign = this && this.__assign || function () {
  12734. __assign = Object.assign || function (t) {
  12735. for (var s, i = 1, n = arguments.length; i < n; i++) {
  12736. s = arguments[i];
  12737. for (var p in s) {
  12738. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12739. }
  12740. }
  12741. return t;
  12742. };
  12743. return __assign.apply(this, arguments);
  12744. };
  12745. Object.defineProperty(exports, "__esModule", { value: true });
  12746. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  12747. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  12748. var INTERACTION_EVENTS = ['click', 'keydown'];
  12749. var MDCSelectIconFoundation = /** @class */function (_super) {
  12750. __extends(MDCSelectIconFoundation, _super);
  12751. function MDCSelectIconFoundation(adapter) {
  12752. var _this = _super.call(this, __assign({}, MDCSelectIconFoundation.defaultAdapter, adapter)) || this;
  12753. _this.savedTabIndex_ = null;
  12754. _this.interactionHandler_ = function (evt) {
  12755. return _this.handleInteraction(evt);
  12756. };
  12757. return _this;
  12758. }
  12759. Object.defineProperty(MDCSelectIconFoundation, "strings", {
  12760. get: function get() {
  12761. return constants_1.strings;
  12762. },
  12763. enumerable: true,
  12764. configurable: true
  12765. });
  12766. Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", {
  12767. /**
  12768. * See {@link MDCSelectIconAdapter} for typing information on parameters and return types.
  12769. */
  12770. get: function get() {
  12771. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  12772. return {
  12773. getAttr: function getAttr() {
  12774. return null;
  12775. },
  12776. setAttr: function setAttr() {
  12777. return undefined;
  12778. },
  12779. removeAttr: function removeAttr() {
  12780. return undefined;
  12781. },
  12782. setContent: function setContent() {
  12783. return undefined;
  12784. },
  12785. registerInteractionHandler: function registerInteractionHandler() {
  12786. return undefined;
  12787. },
  12788. deregisterInteractionHandler: function deregisterInteractionHandler() {
  12789. return undefined;
  12790. },
  12791. notifyIconAction: function notifyIconAction() {
  12792. return undefined;
  12793. }
  12794. };
  12795. // tslint:enable:object-literal-sort-keys
  12796. },
  12797. enumerable: true,
  12798. configurable: true
  12799. });
  12800. MDCSelectIconFoundation.prototype.init = function () {
  12801. var _this = this;
  12802. this.savedTabIndex_ = this.adapter_.getAttr('tabindex');
  12803. INTERACTION_EVENTS.forEach(function (evtType) {
  12804. _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_);
  12805. });
  12806. };
  12807. MDCSelectIconFoundation.prototype.destroy = function () {
  12808. var _this = this;
  12809. INTERACTION_EVENTS.forEach(function (evtType) {
  12810. _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  12811. });
  12812. };
  12813. MDCSelectIconFoundation.prototype.setDisabled = function (disabled) {
  12814. if (!this.savedTabIndex_) {
  12815. return;
  12816. }
  12817. if (disabled) {
  12818. this.adapter_.setAttr('tabindex', '-1');
  12819. this.adapter_.removeAttr('role');
  12820. } else {
  12821. this.adapter_.setAttr('tabindex', this.savedTabIndex_);
  12822. this.adapter_.setAttr('role', constants_1.strings.ICON_ROLE);
  12823. }
  12824. };
  12825. MDCSelectIconFoundation.prototype.setAriaLabel = function (label) {
  12826. this.adapter_.setAttr('aria-label', label);
  12827. };
  12828. MDCSelectIconFoundation.prototype.setContent = function (content) {
  12829. this.adapter_.setContent(content);
  12830. };
  12831. MDCSelectIconFoundation.prototype.handleInteraction = function (evt) {
  12832. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  12833. if (evt.type === 'click' || isEnterKey) {
  12834. this.adapter_.notifyIconAction();
  12835. }
  12836. };
  12837. return MDCSelectIconFoundation;
  12838. }(foundation_1.MDCFoundation);
  12839. exports.MDCSelectIconFoundation = MDCSelectIconFoundation;
  12840. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  12841. exports.default = MDCSelectIconFoundation;
  12842. /***/ }),
  12843. /***/ "./packages/mdc-select/icon/index.ts":
  12844. /*!*******************************************!*\
  12845. !*** ./packages/mdc-select/icon/index.ts ***!
  12846. \*******************************************/
  12847. /*! no static exports found */
  12848. /***/ (function(module, exports, __webpack_require__) {
  12849. "use strict";
  12850. /**
  12851. * @license
  12852. * Copyright 2019 Google Inc.
  12853. *
  12854. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12855. * of this software and associated documentation files (the "Software"), to deal
  12856. * in the Software without restriction, including without limitation the rights
  12857. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12858. * copies of the Software, and to permit persons to whom the Software is
  12859. * furnished to do so, subject to the following conditions:
  12860. *
  12861. * The above copyright notice and this permission notice shall be included in
  12862. * all copies or substantial portions of the Software.
  12863. *
  12864. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12865. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12866. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12867. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12868. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12869. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12870. * THE SOFTWARE.
  12871. */
  12872. function __export(m) {
  12873. for (var p in m) {
  12874. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  12875. }
  12876. }
  12877. Object.defineProperty(exports, "__esModule", { value: true });
  12878. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/icon/component.ts"));
  12879. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/icon/foundation.ts"));
  12880. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-select/icon/constants.ts");
  12881. exports.iconStrings = constants_1.strings;
  12882. /***/ }),
  12883. /***/ "./packages/mdc-select/index.ts":
  12884. /*!**************************************!*\
  12885. !*** ./packages/mdc-select/index.ts ***!
  12886. \**************************************/
  12887. /*! no static exports found */
  12888. /***/ (function(module, exports, __webpack_require__) {
  12889. "use strict";
  12890. /**
  12891. * @license
  12892. * Copyright 2019 Google Inc.
  12893. *
  12894. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12895. * of this software and associated documentation files (the "Software"), to deal
  12896. * in the Software without restriction, including without limitation the rights
  12897. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12898. * copies of the Software, and to permit persons to whom the Software is
  12899. * furnished to do so, subject to the following conditions:
  12900. *
  12901. * The above copyright notice and this permission notice shall be included in
  12902. * all copies or substantial portions of the Software.
  12903. *
  12904. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12905. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12906. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12907. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12908. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12909. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12910. * THE SOFTWARE.
  12911. */
  12912. function __export(m) {
  12913. for (var p in m) {
  12914. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  12915. }
  12916. }
  12917. Object.defineProperty(exports, "__esModule", { value: true });
  12918. __export(__webpack_require__(/*! ./component */ "./packages/mdc-select/component.ts"));
  12919. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-select/constants.ts"));
  12920. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-select/foundation.ts"));
  12921. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-select/helper-text/index.ts"));
  12922. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-select/icon/index.ts"));
  12923. /***/ }),
  12924. /***/ "./packages/mdc-slider/component.ts":
  12925. /*!******************************************!*\
  12926. !*** ./packages/mdc-slider/component.ts ***!
  12927. \******************************************/
  12928. /*! no static exports found */
  12929. /***/ (function(module, exports, __webpack_require__) {
  12930. "use strict";
  12931. /**
  12932. * @license
  12933. * Copyright 2017 Google Inc.
  12934. *
  12935. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12936. * of this software and associated documentation files (the "Software"), to deal
  12937. * in the Software without restriction, including without limitation the rights
  12938. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12939. * copies of the Software, and to permit persons to whom the Software is
  12940. * furnished to do so, subject to the following conditions:
  12941. *
  12942. * The above copyright notice and this permission notice shall be included in
  12943. * all copies or substantial portions of the Software.
  12944. *
  12945. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12946. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12947. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  12948. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  12949. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12950. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  12951. * THE SOFTWARE.
  12952. */
  12953. var __extends = this && this.__extends || function () {
  12954. var _extendStatics = function extendStatics(d, b) {
  12955. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  12956. d.__proto__ = b;
  12957. } || function (d, b) {
  12958. for (var p in b) {
  12959. if (b.hasOwnProperty(p)) d[p] = b[p];
  12960. }
  12961. };
  12962. return _extendStatics(d, b);
  12963. };
  12964. return function (d, b) {
  12965. _extendStatics(d, b);
  12966. function __() {
  12967. this.constructor = d;
  12968. }
  12969. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12970. };
  12971. }();
  12972. Object.defineProperty(exports, "__esModule", { value: true });
  12973. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  12974. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  12975. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  12976. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts");
  12977. var MDCSlider = /** @class */function (_super) {
  12978. __extends(MDCSlider, _super);
  12979. function MDCSlider() {
  12980. return _super !== null && _super.apply(this, arguments) || this;
  12981. }
  12982. MDCSlider.attachTo = function (root) {
  12983. return new MDCSlider(root);
  12984. };
  12985. Object.defineProperty(MDCSlider.prototype, "value", {
  12986. get: function get() {
  12987. return this.foundation_.getValue();
  12988. },
  12989. set: function set(value) {
  12990. this.foundation_.setValue(value);
  12991. },
  12992. enumerable: true,
  12993. configurable: true
  12994. });
  12995. Object.defineProperty(MDCSlider.prototype, "min", {
  12996. get: function get() {
  12997. return this.foundation_.getMin();
  12998. },
  12999. set: function set(min) {
  13000. this.foundation_.setMin(min);
  13001. },
  13002. enumerable: true,
  13003. configurable: true
  13004. });
  13005. Object.defineProperty(MDCSlider.prototype, "max", {
  13006. get: function get() {
  13007. return this.foundation_.getMax();
  13008. },
  13009. set: function set(max) {
  13010. this.foundation_.setMax(max);
  13011. },
  13012. enumerable: true,
  13013. configurable: true
  13014. });
  13015. Object.defineProperty(MDCSlider.prototype, "step", {
  13016. get: function get() {
  13017. return this.foundation_.getStep();
  13018. },
  13019. set: function set(step) {
  13020. this.foundation_.setStep(step);
  13021. },
  13022. enumerable: true,
  13023. configurable: true
  13024. });
  13025. Object.defineProperty(MDCSlider.prototype, "disabled", {
  13026. get: function get() {
  13027. return this.foundation_.isDisabled();
  13028. },
  13029. set: function set(disabled) {
  13030. this.foundation_.setDisabled(disabled);
  13031. },
  13032. enumerable: true,
  13033. configurable: true
  13034. });
  13035. MDCSlider.prototype.initialize = function () {
  13036. this.thumbContainer_ = this.root_.querySelector(constants_1.strings.THUMB_CONTAINER_SELECTOR);
  13037. this.track_ = this.root_.querySelector(constants_1.strings.TRACK_SELECTOR);
  13038. this.pinValueMarker_ = this.root_.querySelector(constants_1.strings.PIN_VALUE_MARKER_SELECTOR);
  13039. this.trackMarkerContainer_ = this.root_.querySelector(constants_1.strings.TRACK_MARKER_CONTAINER_SELECTOR);
  13040. };
  13041. MDCSlider.prototype.getDefaultFoundation = function () {
  13042. var _this = this;
  13043. // DO NOT INLINE this variable. For backward compatibility, foundations take
  13044. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  13045. // methods, we need a separate, strongly typed adapter variable.
  13046. // tslint:disable:object-literal-sort-keys Methods should be in the same
  13047. // order as the adapter interface.
  13048. var adapter = {
  13049. hasClass: function hasClass(className) {
  13050. return _this.root_.classList.contains(className);
  13051. },
  13052. addClass: function addClass(className) {
  13053. return _this.root_.classList.add(className);
  13054. },
  13055. removeClass: function removeClass(className) {
  13056. return _this.root_.classList.remove(className);
  13057. },
  13058. getAttribute: function getAttribute(name) {
  13059. return _this.root_.getAttribute(name);
  13060. },
  13061. setAttribute: function setAttribute(name, value) {
  13062. return _this.root_.setAttribute(name, value);
  13063. },
  13064. removeAttribute: function removeAttribute(name) {
  13065. return _this.root_.removeAttribute(name);
  13066. },
  13067. computeBoundingRect: function computeBoundingRect() {
  13068. return _this.root_.getBoundingClientRect();
  13069. },
  13070. getTabIndex: function getTabIndex() {
  13071. return _this.root_.tabIndex;
  13072. },
  13073. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  13074. return _this.listen(evtType, handler, events_1.applyPassive());
  13075. },
  13076. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  13077. return _this.unlisten(evtType, handler, events_1.applyPassive());
  13078. },
  13079. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler(evtType, handler) {
  13080. _this.thumbContainer_.addEventListener(evtType, handler, events_1.applyPassive());
  13081. },
  13082. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler(evtType, handler) {
  13083. _this.thumbContainer_.removeEventListener(evtType, handler, events_1.applyPassive());
  13084. },
  13085. registerBodyInteractionHandler: function registerBodyInteractionHandler(evtType, handler) {
  13086. return document.body.addEventListener(evtType, handler);
  13087. },
  13088. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler(evtType, handler) {
  13089. return document.body.removeEventListener(evtType, handler);
  13090. },
  13091. registerResizeHandler: function registerResizeHandler(handler) {
  13092. return window.addEventListener('resize', handler);
  13093. },
  13094. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  13095. return window.removeEventListener('resize', handler);
  13096. },
  13097. notifyInput: function notifyInput() {
  13098. return _this.emit(constants_1.strings.INPUT_EVENT, _this);
  13099. },
  13100. notifyChange: function notifyChange() {
  13101. return _this.emit(constants_1.strings.CHANGE_EVENT, _this);
  13102. },
  13103. setThumbContainerStyleProperty: function setThumbContainerStyleProperty(propertyName, value) {
  13104. _this.thumbContainer_.style.setProperty(propertyName, value);
  13105. },
  13106. setTrackStyleProperty: function setTrackStyleProperty(propertyName, value) {
  13107. return _this.track_.style.setProperty(propertyName, value);
  13108. },
  13109. setMarkerValue: function setMarkerValue(value) {
  13110. return _this.pinValueMarker_.innerText = value.toLocaleString();
  13111. },
  13112. setTrackMarkers: function setTrackMarkers(step, max, min) {
  13113. var stepStr = step.toLocaleString();
  13114. var maxStr = max.toLocaleString();
  13115. var minStr = min.toLocaleString();
  13116. // keep calculation in css for better rounding/subpixel behavior
  13117. var markerAmount = "((" + maxStr + " - " + minStr + ") / " + stepStr + ")";
  13118. var markerWidth = "2px";
  13119. var markerBkgdImage = "linear-gradient(to right, currentColor " + markerWidth + ", transparent 0)";
  13120. var markerBkgdLayout = "0 center / calc((100% - " + markerWidth + ") / " + markerAmount + ") 100% repeat-x";
  13121. var markerBkgdShorthand = markerBkgdImage + " " + markerBkgdLayout;
  13122. _this.trackMarkerContainer_.style.setProperty('background', markerBkgdShorthand);
  13123. },
  13124. isRTL: function isRTL() {
  13125. return getComputedStyle(_this.root_).direction === 'rtl';
  13126. }
  13127. };
  13128. // tslint:enable:object-literal-sort-keys
  13129. return new foundation_1.MDCSliderFoundation(adapter);
  13130. };
  13131. MDCSlider.prototype.initialSyncWithDOM = function () {
  13132. var origValueNow = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUENOW), this.value);
  13133. var min = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMIN), this.min);
  13134. var max = this.parseFloat_(this.root_.getAttribute(constants_1.strings.ARIA_VALUEMAX), this.max);
  13135. // min and max need to be set in the right order to avoid throwing an error
  13136. // when the new min is greater than the default max.
  13137. if (min >= this.max) {
  13138. this.max = max;
  13139. this.min = min;
  13140. } else {
  13141. this.min = min;
  13142. this.max = max;
  13143. }
  13144. this.step = this.parseFloat_(this.root_.getAttribute(constants_1.strings.STEP_DATA_ATTR), this.step);
  13145. this.value = origValueNow;
  13146. this.disabled = this.root_.hasAttribute(constants_1.strings.ARIA_DISABLED) && this.root_.getAttribute(constants_1.strings.ARIA_DISABLED) !== 'false';
  13147. this.foundation_.setupTrackMarker();
  13148. };
  13149. MDCSlider.prototype.layout = function () {
  13150. this.foundation_.layout();
  13151. };
  13152. MDCSlider.prototype.stepUp = function (amount) {
  13153. if (amount === void 0) {
  13154. amount = this.step || 1;
  13155. }
  13156. this.value += amount;
  13157. };
  13158. MDCSlider.prototype.stepDown = function (amount) {
  13159. if (amount === void 0) {
  13160. amount = this.step || 1;
  13161. }
  13162. this.value -= amount;
  13163. };
  13164. MDCSlider.prototype.parseFloat_ = function (str, defaultValue) {
  13165. var num = parseFloat(str); // tslint:disable-line:ban
  13166. var isNumeric = typeof num === 'number' && isFinite(num);
  13167. return isNumeric ? num : defaultValue;
  13168. };
  13169. return MDCSlider;
  13170. }(component_1.MDCComponent);
  13171. exports.MDCSlider = MDCSlider;
  13172. /***/ }),
  13173. /***/ "./packages/mdc-slider/constants.ts":
  13174. /*!******************************************!*\
  13175. !*** ./packages/mdc-slider/constants.ts ***!
  13176. \******************************************/
  13177. /*! no static exports found */
  13178. /***/ (function(module, exports, __webpack_require__) {
  13179. "use strict";
  13180. /**
  13181. * @license
  13182. * Copyright 2017 Google Inc.
  13183. *
  13184. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13185. * of this software and associated documentation files (the "Software"), to deal
  13186. * in the Software without restriction, including without limitation the rights
  13187. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13188. * copies of the Software, and to permit persons to whom the Software is
  13189. * furnished to do so, subject to the following conditions:
  13190. *
  13191. * The above copyright notice and this permission notice shall be included in
  13192. * all copies or substantial portions of the Software.
  13193. *
  13194. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13195. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13196. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13197. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13198. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13199. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13200. * THE SOFTWARE.
  13201. */
  13202. Object.defineProperty(exports, "__esModule", { value: true });
  13203. var cssClasses = {
  13204. ACTIVE: 'mdc-slider--active',
  13205. DISABLED: 'mdc-slider--disabled',
  13206. DISCRETE: 'mdc-slider--discrete',
  13207. FOCUS: 'mdc-slider--focus',
  13208. HAS_TRACK_MARKER: 'mdc-slider--display-markers',
  13209. IN_TRANSIT: 'mdc-slider--in-transit',
  13210. IS_DISCRETE: 'mdc-slider--discrete'
  13211. };
  13212. exports.cssClasses = cssClasses;
  13213. var strings = {
  13214. ARIA_DISABLED: 'aria-disabled',
  13215. ARIA_VALUEMAX: 'aria-valuemax',
  13216. ARIA_VALUEMIN: 'aria-valuemin',
  13217. ARIA_VALUENOW: 'aria-valuenow',
  13218. CHANGE_EVENT: 'MDCSlider:change',
  13219. INPUT_EVENT: 'MDCSlider:input',
  13220. PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker',
  13221. STEP_DATA_ATTR: 'data-step',
  13222. THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container',
  13223. TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container',
  13224. TRACK_SELECTOR: '.mdc-slider__track'
  13225. };
  13226. exports.strings = strings;
  13227. var numbers = {
  13228. PAGE_FACTOR: 4
  13229. };
  13230. exports.numbers = numbers;
  13231. /***/ }),
  13232. /***/ "./packages/mdc-slider/foundation.ts":
  13233. /*!*******************************************!*\
  13234. !*** ./packages/mdc-slider/foundation.ts ***!
  13235. \*******************************************/
  13236. /*! no static exports found */
  13237. /***/ (function(module, exports, __webpack_require__) {
  13238. "use strict";
  13239. /**
  13240. * @license
  13241. * Copyright 2017 Google Inc.
  13242. *
  13243. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13244. * of this software and associated documentation files (the "Software"), to deal
  13245. * in the Software without restriction, including without limitation the rights
  13246. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13247. * copies of the Software, and to permit persons to whom the Software is
  13248. * furnished to do so, subject to the following conditions:
  13249. *
  13250. * The above copyright notice and this permission notice shall be included in
  13251. * all copies or substantial portions of the Software.
  13252. *
  13253. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13254. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13255. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13256. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13257. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13258. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13259. * THE SOFTWARE.
  13260. */
  13261. var __extends = this && this.__extends || function () {
  13262. var _extendStatics = function extendStatics(d, b) {
  13263. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13264. d.__proto__ = b;
  13265. } || function (d, b) {
  13266. for (var p in b) {
  13267. if (b.hasOwnProperty(p)) d[p] = b[p];
  13268. }
  13269. };
  13270. return _extendStatics(d, b);
  13271. };
  13272. return function (d, b) {
  13273. _extendStatics(d, b);
  13274. function __() {
  13275. this.constructor = d;
  13276. }
  13277. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13278. };
  13279. }();
  13280. var __assign = this && this.__assign || function () {
  13281. __assign = Object.assign || function (t) {
  13282. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13283. s = arguments[i];
  13284. for (var p in s) {
  13285. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  13286. }
  13287. }
  13288. return t;
  13289. };
  13290. return __assign.apply(this, arguments);
  13291. };
  13292. Object.defineProperty(exports, "__esModule", { value: true });
  13293. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  13294. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  13295. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts");
  13296. var DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart'];
  13297. var UP_EVENTS = ['mouseup', 'pointerup', 'touchend'];
  13298. var MOVE_EVENT_MAP = {
  13299. mousedown: 'mousemove',
  13300. pointerdown: 'pointermove',
  13301. touchstart: 'touchmove'
  13302. };
  13303. var KEY_IDS = {
  13304. ARROW_DOWN: 'ArrowDown',
  13305. ARROW_LEFT: 'ArrowLeft',
  13306. ARROW_RIGHT: 'ArrowRight',
  13307. ARROW_UP: 'ArrowUp',
  13308. END: 'End',
  13309. HOME: 'Home',
  13310. PAGE_DOWN: 'PageDown',
  13311. PAGE_UP: 'PageUp'
  13312. };
  13313. var MDCSliderFoundation = /** @class */function (_super) {
  13314. __extends(MDCSliderFoundation, _super);
  13315. function MDCSliderFoundation(adapter) {
  13316. var _this = _super.call(this, __assign({}, MDCSliderFoundation.defaultAdapter, adapter)) || this;
  13317. /**
  13318. * We set this to NaN since we want it to be a number, but we can't use '0' or
  13319. * '-1' because those could be valid tabindices set by the client code.
  13320. */
  13321. _this.savedTabIndex_ = NaN;
  13322. _this.active_ = false;
  13323. _this.inTransit_ = false;
  13324. _this.isDiscrete_ = false;
  13325. _this.hasTrackMarker_ = false;
  13326. _this.handlingThumbTargetEvt_ = false;
  13327. _this.min_ = 0;
  13328. _this.max_ = 100;
  13329. _this.step_ = 0;
  13330. _this.value_ = 0;
  13331. _this.disabled_ = false;
  13332. _this.preventFocusState_ = false;
  13333. _this.thumbContainerPointerHandler_ = function () {
  13334. return _this.handlingThumbTargetEvt_ = true;
  13335. };
  13336. _this.interactionStartHandler_ = function (evt) {
  13337. return _this.handleDown_(evt);
  13338. };
  13339. _this.keydownHandler_ = function (evt) {
  13340. return _this.handleKeydown_(evt);
  13341. };
  13342. _this.focusHandler_ = function () {
  13343. return _this.handleFocus_();
  13344. };
  13345. _this.blurHandler_ = function () {
  13346. return _this.handleBlur_();
  13347. };
  13348. _this.resizeHandler_ = function () {
  13349. return _this.layout();
  13350. };
  13351. return _this;
  13352. }
  13353. Object.defineProperty(MDCSliderFoundation, "cssClasses", {
  13354. get: function get() {
  13355. return constants_1.cssClasses;
  13356. },
  13357. enumerable: true,
  13358. configurable: true
  13359. });
  13360. Object.defineProperty(MDCSliderFoundation, "strings", {
  13361. get: function get() {
  13362. return constants_1.strings;
  13363. },
  13364. enumerable: true,
  13365. configurable: true
  13366. });
  13367. Object.defineProperty(MDCSliderFoundation, "numbers", {
  13368. get: function get() {
  13369. return constants_1.numbers;
  13370. },
  13371. enumerable: true,
  13372. configurable: true
  13373. });
  13374. Object.defineProperty(MDCSliderFoundation, "defaultAdapter", {
  13375. get: function get() {
  13376. // tslint:disable:object-literal-sort-keys Methods should be in the same
  13377. // order as the adapter interface.
  13378. return {
  13379. hasClass: function hasClass() {
  13380. return false;
  13381. },
  13382. addClass: function addClass() {
  13383. return undefined;
  13384. },
  13385. removeClass: function removeClass() {
  13386. return undefined;
  13387. },
  13388. getAttribute: function getAttribute() {
  13389. return null;
  13390. },
  13391. setAttribute: function setAttribute() {
  13392. return undefined;
  13393. },
  13394. removeAttribute: function removeAttribute() {
  13395. return undefined;
  13396. },
  13397. computeBoundingRect: function computeBoundingRect() {
  13398. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  13399. },
  13400. getTabIndex: function getTabIndex() {
  13401. return 0;
  13402. },
  13403. registerInteractionHandler: function registerInteractionHandler() {
  13404. return undefined;
  13405. },
  13406. deregisterInteractionHandler: function deregisterInteractionHandler() {
  13407. return undefined;
  13408. },
  13409. registerThumbContainerInteractionHandler: function registerThumbContainerInteractionHandler() {
  13410. return undefined;
  13411. },
  13412. deregisterThumbContainerInteractionHandler: function deregisterThumbContainerInteractionHandler() {
  13413. return undefined;
  13414. },
  13415. registerBodyInteractionHandler: function registerBodyInteractionHandler() {
  13416. return undefined;
  13417. },
  13418. deregisterBodyInteractionHandler: function deregisterBodyInteractionHandler() {
  13419. return undefined;
  13420. },
  13421. registerResizeHandler: function registerResizeHandler() {
  13422. return undefined;
  13423. },
  13424. deregisterResizeHandler: function deregisterResizeHandler() {
  13425. return undefined;
  13426. },
  13427. notifyInput: function notifyInput() {
  13428. return undefined;
  13429. },
  13430. notifyChange: function notifyChange() {
  13431. return undefined;
  13432. },
  13433. setThumbContainerStyleProperty: function setThumbContainerStyleProperty() {
  13434. return undefined;
  13435. },
  13436. setTrackStyleProperty: function setTrackStyleProperty() {
  13437. return undefined;
  13438. },
  13439. setMarkerValue: function setMarkerValue() {
  13440. return undefined;
  13441. },
  13442. setTrackMarkers: function setTrackMarkers() {
  13443. return undefined;
  13444. },
  13445. isRTL: function isRTL() {
  13446. return false;
  13447. }
  13448. };
  13449. // tslint:enable:object-literal-sort-keys
  13450. },
  13451. enumerable: true,
  13452. configurable: true
  13453. });
  13454. MDCSliderFoundation.prototype.init = function () {
  13455. var _this = this;
  13456. this.isDiscrete_ = this.adapter_.hasClass(constants_1.cssClasses.IS_DISCRETE);
  13457. this.hasTrackMarker_ = this.adapter_.hasClass(constants_1.cssClasses.HAS_TRACK_MARKER);
  13458. DOWN_EVENTS.forEach(function (evtName) {
  13459. _this.adapter_.registerInteractionHandler(evtName, _this.interactionStartHandler_);
  13460. _this.adapter_.registerThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  13461. });
  13462. this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_);
  13463. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  13464. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  13465. this.adapter_.registerResizeHandler(this.resizeHandler_);
  13466. this.layout();
  13467. // At last step, provide a reasonable default value to discrete slider
  13468. if (this.isDiscrete_ && this.getStep() === 0) {
  13469. this.step_ = 1;
  13470. }
  13471. };
  13472. MDCSliderFoundation.prototype.destroy = function () {
  13473. var _this = this;
  13474. DOWN_EVENTS.forEach(function (evtName) {
  13475. _this.adapter_.deregisterInteractionHandler(evtName, _this.interactionStartHandler_);
  13476. _this.adapter_.deregisterThumbContainerInteractionHandler(evtName, _this.thumbContainerPointerHandler_);
  13477. });
  13478. this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_);
  13479. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  13480. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  13481. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  13482. };
  13483. MDCSliderFoundation.prototype.setupTrackMarker = function () {
  13484. if (this.isDiscrete_ && this.hasTrackMarker_ && this.getStep() !== 0) {
  13485. this.adapter_.setTrackMarkers(this.getStep(), this.getMax(), this.getMin());
  13486. }
  13487. };
  13488. MDCSliderFoundation.prototype.layout = function () {
  13489. this.rect_ = this.adapter_.computeBoundingRect();
  13490. this.updateUIForCurrentValue_();
  13491. };
  13492. MDCSliderFoundation.prototype.getValue = function () {
  13493. return this.value_;
  13494. };
  13495. MDCSliderFoundation.prototype.setValue = function (value) {
  13496. this.setValue_(value, false);
  13497. };
  13498. MDCSliderFoundation.prototype.getMax = function () {
  13499. return this.max_;
  13500. };
  13501. MDCSliderFoundation.prototype.setMax = function (max) {
  13502. if (max < this.min_) {
  13503. throw new Error('Cannot set max to be less than the slider\'s minimum value');
  13504. }
  13505. this.max_ = max;
  13506. this.setValue_(this.value_, false, true);
  13507. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMAX, String(this.max_));
  13508. this.setupTrackMarker();
  13509. };
  13510. MDCSliderFoundation.prototype.getMin = function () {
  13511. return this.min_;
  13512. };
  13513. MDCSliderFoundation.prototype.setMin = function (min) {
  13514. if (min > this.max_) {
  13515. throw new Error('Cannot set min to be greater than the slider\'s maximum value');
  13516. }
  13517. this.min_ = min;
  13518. this.setValue_(this.value_, false, true);
  13519. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUEMIN, String(this.min_));
  13520. this.setupTrackMarker();
  13521. };
  13522. MDCSliderFoundation.prototype.getStep = function () {
  13523. return this.step_;
  13524. };
  13525. MDCSliderFoundation.prototype.setStep = function (step) {
  13526. if (step < 0) {
  13527. throw new Error('Step cannot be set to a negative number');
  13528. }
  13529. if (this.isDiscrete_ && (typeof step !== 'number' || step < 1)) {
  13530. step = 1;
  13531. }
  13532. this.step_ = step;
  13533. this.setValue_(this.value_, false, true);
  13534. this.setupTrackMarker();
  13535. };
  13536. MDCSliderFoundation.prototype.isDisabled = function () {
  13537. return this.disabled_;
  13538. };
  13539. MDCSliderFoundation.prototype.setDisabled = function (disabled) {
  13540. this.disabled_ = disabled;
  13541. this.toggleClass_(constants_1.cssClasses.DISABLED, this.disabled_);
  13542. if (this.disabled_) {
  13543. this.savedTabIndex_ = this.adapter_.getTabIndex();
  13544. this.adapter_.setAttribute(constants_1.strings.ARIA_DISABLED, 'true');
  13545. this.adapter_.removeAttribute('tabindex');
  13546. } else {
  13547. this.adapter_.removeAttribute(constants_1.strings.ARIA_DISABLED);
  13548. if (!isNaN(this.savedTabIndex_)) {
  13549. this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_));
  13550. }
  13551. }
  13552. };
  13553. /**
  13554. * Called when the user starts interacting with the slider
  13555. */
  13556. MDCSliderFoundation.prototype.handleDown_ = function (downEvent) {
  13557. var _this = this;
  13558. if (this.disabled_) {
  13559. return;
  13560. }
  13561. this.preventFocusState_ = true;
  13562. this.setInTransit_(!this.handlingThumbTargetEvt_);
  13563. this.handlingThumbTargetEvt_ = false;
  13564. this.setActive_(true);
  13565. var moveHandler = function moveHandler(moveEvent) {
  13566. _this.handleMove_(moveEvent);
  13567. };
  13568. var moveEventType = MOVE_EVENT_MAP[downEvent.type];
  13569. // Note: upHandler is [de]registered on ALL potential pointer-related
  13570. // release event types, since some browsers do not always fire these
  13571. // consistently in pairs. (See
  13572. // https://github.com/material-components/material-components-web/issues/1192)
  13573. var upHandler = function upHandler() {
  13574. _this.handleUp_();
  13575. _this.adapter_.deregisterBodyInteractionHandler(moveEventType, moveHandler);
  13576. UP_EVENTS.forEach(function (evtName) {
  13577. return _this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler);
  13578. });
  13579. };
  13580. this.adapter_.registerBodyInteractionHandler(moveEventType, moveHandler);
  13581. UP_EVENTS.forEach(function (evtName) {
  13582. return _this.adapter_.registerBodyInteractionHandler(evtName, upHandler);
  13583. });
  13584. this.setValueFromEvt_(downEvent);
  13585. };
  13586. /**
  13587. * Called when the user moves the slider
  13588. */
  13589. MDCSliderFoundation.prototype.handleMove_ = function (evt) {
  13590. evt.preventDefault();
  13591. this.setValueFromEvt_(evt);
  13592. };
  13593. /**
  13594. * Called when the user's interaction with the slider ends
  13595. */
  13596. MDCSliderFoundation.prototype.handleUp_ = function () {
  13597. this.setActive_(false);
  13598. this.adapter_.notifyChange();
  13599. };
  13600. /**
  13601. * Returns the clientX of the event
  13602. */
  13603. MDCSliderFoundation.prototype.getClientX_ = function (evt) {
  13604. if (evt.targetTouches && evt.targetTouches.length > 0) {
  13605. return evt.targetTouches[0].clientX;
  13606. }
  13607. return evt.clientX;
  13608. };
  13609. /**
  13610. * Sets the slider value from an event
  13611. */
  13612. MDCSliderFoundation.prototype.setValueFromEvt_ = function (evt) {
  13613. var clientX = this.getClientX_(evt);
  13614. var value = this.computeValueFromClientX_(clientX);
  13615. this.setValue_(value, true);
  13616. };
  13617. /**
  13618. * Computes the new value from the clientX position
  13619. */
  13620. MDCSliderFoundation.prototype.computeValueFromClientX_ = function (clientX) {
  13621. var _a = this,
  13622. max = _a.max_,
  13623. min = _a.min_;
  13624. var xPos = clientX - this.rect_.left;
  13625. var pctComplete = xPos / this.rect_.width;
  13626. if (this.adapter_.isRTL()) {
  13627. pctComplete = 1 - pctComplete;
  13628. }
  13629. // Fit the percentage complete between the range [min,max]
  13630. // by remapping from [0, 1] to [min, min+(max-min)].
  13631. return min + pctComplete * (max - min);
  13632. };
  13633. /**
  13634. * Handles keydown events
  13635. */
  13636. MDCSliderFoundation.prototype.handleKeydown_ = function (evt) {
  13637. var keyId = this.getKeyId_(evt);
  13638. var value = this.getValueForKeyId_(keyId);
  13639. if (isNaN(value)) {
  13640. return;
  13641. }
  13642. // Prevent page from scrolling due to key presses that would normally scroll
  13643. // the page
  13644. evt.preventDefault();
  13645. this.adapter_.addClass(constants_1.cssClasses.FOCUS);
  13646. this.setValue_(value, true);
  13647. this.adapter_.notifyChange();
  13648. };
  13649. /**
  13650. * Returns the computed name of the event
  13651. */
  13652. MDCSliderFoundation.prototype.getKeyId_ = function (kbdEvt) {
  13653. if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) {
  13654. return KEY_IDS.ARROW_LEFT;
  13655. }
  13656. if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) {
  13657. return KEY_IDS.ARROW_RIGHT;
  13658. }
  13659. if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) {
  13660. return KEY_IDS.ARROW_UP;
  13661. }
  13662. if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) {
  13663. return KEY_IDS.ARROW_DOWN;
  13664. }
  13665. if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) {
  13666. return KEY_IDS.HOME;
  13667. }
  13668. if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) {
  13669. return KEY_IDS.END;
  13670. }
  13671. if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) {
  13672. return KEY_IDS.PAGE_UP;
  13673. }
  13674. if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) {
  13675. return KEY_IDS.PAGE_DOWN;
  13676. }
  13677. return '';
  13678. };
  13679. /**
  13680. * Computes the value given a keyboard key ID
  13681. */
  13682. MDCSliderFoundation.prototype.getValueForKeyId_ = function (keyId) {
  13683. var _a = this,
  13684. max = _a.max_,
  13685. min = _a.min_,
  13686. step = _a.step_;
  13687. var delta = step || (max - min) / 100;
  13688. var valueNeedsToBeFlipped = this.adapter_.isRTL() && (keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT);
  13689. if (valueNeedsToBeFlipped) {
  13690. delta = -delta;
  13691. }
  13692. switch (keyId) {
  13693. case KEY_IDS.ARROW_LEFT:
  13694. case KEY_IDS.ARROW_DOWN:
  13695. return this.value_ - delta;
  13696. case KEY_IDS.ARROW_RIGHT:
  13697. case KEY_IDS.ARROW_UP:
  13698. return this.value_ + delta;
  13699. case KEY_IDS.HOME:
  13700. return this.min_;
  13701. case KEY_IDS.END:
  13702. return this.max_;
  13703. case KEY_IDS.PAGE_UP:
  13704. return this.value_ + delta * constants_1.numbers.PAGE_FACTOR;
  13705. case KEY_IDS.PAGE_DOWN:
  13706. return this.value_ - delta * constants_1.numbers.PAGE_FACTOR;
  13707. default:
  13708. return NaN;
  13709. }
  13710. };
  13711. MDCSliderFoundation.prototype.handleFocus_ = function () {
  13712. if (this.preventFocusState_) {
  13713. return;
  13714. }
  13715. this.adapter_.addClass(constants_1.cssClasses.FOCUS);
  13716. };
  13717. MDCSliderFoundation.prototype.handleBlur_ = function () {
  13718. this.preventFocusState_ = false;
  13719. this.adapter_.removeClass(constants_1.cssClasses.FOCUS);
  13720. };
  13721. /**
  13722. * Sets the value of the slider
  13723. */
  13724. MDCSliderFoundation.prototype.setValue_ = function (value, shouldFireInput, force) {
  13725. if (force === void 0) {
  13726. force = false;
  13727. }
  13728. if (value === this.value_ && !force) {
  13729. return;
  13730. }
  13731. var _a = this,
  13732. min = _a.min_,
  13733. max = _a.max_;
  13734. var valueSetToBoundary = value === min || value === max;
  13735. if (this.step_ && !valueSetToBoundary) {
  13736. value = this.quantize_(value);
  13737. }
  13738. if (value < min) {
  13739. value = min;
  13740. } else if (value > max) {
  13741. value = max;
  13742. }
  13743. value = value || 0; // coerce -0 to 0
  13744. this.value_ = value;
  13745. this.adapter_.setAttribute(constants_1.strings.ARIA_VALUENOW, String(this.value_));
  13746. this.updateUIForCurrentValue_();
  13747. if (shouldFireInput) {
  13748. this.adapter_.notifyInput();
  13749. if (this.isDiscrete_) {
  13750. this.adapter_.setMarkerValue(value);
  13751. }
  13752. }
  13753. };
  13754. /**
  13755. * Calculates the quantized value
  13756. */
  13757. MDCSliderFoundation.prototype.quantize_ = function (value) {
  13758. var numSteps = Math.round(value / this.step_);
  13759. return numSteps * this.step_;
  13760. };
  13761. MDCSliderFoundation.prototype.updateUIForCurrentValue_ = function () {
  13762. var _this = this;
  13763. var _a = this,
  13764. max = _a.max_,
  13765. min = _a.min_,
  13766. value = _a.value_;
  13767. var pctComplete = (value - min) / (max - min);
  13768. var translatePx = pctComplete * this.rect_.width;
  13769. if (this.adapter_.isRTL()) {
  13770. translatePx = this.rect_.width - translatePx;
  13771. }
  13772. var transformProp = util_1.getCorrectPropertyName(window, 'transform');
  13773. var transitionendEvtName = util_1.getCorrectEventName(window, 'transitionend');
  13774. if (this.inTransit_) {
  13775. var onTransitionEnd_1 = function onTransitionEnd_1() {
  13776. _this.setInTransit_(false);
  13777. _this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  13778. };
  13779. this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd_1);
  13780. }
  13781. requestAnimationFrame(function () {
  13782. // NOTE(traviskaufman): It would be nice to use calc() here,
  13783. // but IE cannot handle calcs in transforms correctly.
  13784. // See: https://goo.gl/NC2itk
  13785. // Also note that the -50% offset is used to center the slider thumb.
  13786. _this.adapter_.setThumbContainerStyleProperty(transformProp, "translateX(" + translatePx + "px) translateX(-50%)");
  13787. _this.adapter_.setTrackStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
  13788. });
  13789. };
  13790. /**
  13791. * Toggles the active state of the slider
  13792. */
  13793. MDCSliderFoundation.prototype.setActive_ = function (active) {
  13794. this.active_ = active;
  13795. this.toggleClass_(constants_1.cssClasses.ACTIVE, this.active_);
  13796. };
  13797. /**
  13798. * Toggles the inTransit state of the slider
  13799. */
  13800. MDCSliderFoundation.prototype.setInTransit_ = function (inTransit) {
  13801. this.inTransit_ = inTransit;
  13802. this.toggleClass_(constants_1.cssClasses.IN_TRANSIT, this.inTransit_);
  13803. };
  13804. /**
  13805. * Conditionally adds or removes a class based on shouldBePresent
  13806. */
  13807. MDCSliderFoundation.prototype.toggleClass_ = function (className, shouldBePresent) {
  13808. if (shouldBePresent) {
  13809. this.adapter_.addClass(className);
  13810. } else {
  13811. this.adapter_.removeClass(className);
  13812. }
  13813. };
  13814. return MDCSliderFoundation;
  13815. }(foundation_1.MDCFoundation);
  13816. exports.MDCSliderFoundation = MDCSliderFoundation;
  13817. // tslint:disable-next-line:no-default-export Needed for backward compatibility
  13818. // with MDC Web v0.44.0 and earlier.
  13819. exports.default = MDCSliderFoundation;
  13820. /***/ }),
  13821. /***/ "./packages/mdc-slider/index.ts":
  13822. /*!**************************************!*\
  13823. !*** ./packages/mdc-slider/index.ts ***!
  13824. \**************************************/
  13825. /*! no static exports found */
  13826. /***/ (function(module, exports, __webpack_require__) {
  13827. "use strict";
  13828. /**
  13829. * @license
  13830. * Copyright 2019 Google Inc.
  13831. *
  13832. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13833. * of this software and associated documentation files (the "Software"), to deal
  13834. * in the Software without restriction, including without limitation the rights
  13835. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13836. * copies of the Software, and to permit persons to whom the Software is
  13837. * furnished to do so, subject to the following conditions:
  13838. *
  13839. * The above copyright notice and this permission notice shall be included in
  13840. * all copies or substantial portions of the Software.
  13841. *
  13842. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13843. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13844. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13845. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13846. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13847. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13848. * THE SOFTWARE.
  13849. */
  13850. function __export(m) {
  13851. for (var p in m) {
  13852. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  13853. }
  13854. }
  13855. Object.defineProperty(exports, "__esModule", { value: true });
  13856. __export(__webpack_require__(/*! ./component */ "./packages/mdc-slider/component.ts"));
  13857. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-slider/constants.ts"));
  13858. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-slider/foundation.ts"));
  13859. /***/ }),
  13860. /***/ "./packages/mdc-snackbar/component.ts":
  13861. /*!********************************************!*\
  13862. !*** ./packages/mdc-snackbar/component.ts ***!
  13863. \********************************************/
  13864. /*! no static exports found */
  13865. /***/ (function(module, exports, __webpack_require__) {
  13866. "use strict";
  13867. /**
  13868. * @license
  13869. * Copyright 2018 Google Inc.
  13870. *
  13871. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13872. * of this software and associated documentation files (the "Software"), to deal
  13873. * in the Software without restriction, including without limitation the rights
  13874. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13875. * copies of the Software, and to permit persons to whom the Software is
  13876. * furnished to do so, subject to the following conditions:
  13877. *
  13878. * The above copyright notice and this permission notice shall be included in
  13879. * all copies or substantial portions of the Software.
  13880. *
  13881. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13882. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13883. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13884. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13885. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13886. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13887. * THE SOFTWARE.
  13888. */
  13889. var __extends = this && this.__extends || function () {
  13890. var _extendStatics = function extendStatics(d, b) {
  13891. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13892. d.__proto__ = b;
  13893. } || function (d, b) {
  13894. for (var p in b) {
  13895. if (b.hasOwnProperty(p)) d[p] = b[p];
  13896. }
  13897. };
  13898. return _extendStatics(d, b);
  13899. };
  13900. return function (d, b) {
  13901. _extendStatics(d, b);
  13902. function __() {
  13903. this.constructor = d;
  13904. }
  13905. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13906. };
  13907. }();
  13908. var __importStar = this && this.__importStar || function (mod) {
  13909. if (mod && mod.__esModule) return mod;
  13910. var result = {};
  13911. if (mod != null) for (var k in mod) {
  13912. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  13913. }result["default"] = mod;
  13914. return result;
  13915. };
  13916. Object.defineProperty(exports, "__esModule", { value: true });
  13917. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  13918. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  13919. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  13920. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts");
  13921. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  13922. var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR,
  13923. LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR,
  13924. ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR,
  13925. DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR,
  13926. OPENING_EVENT = constants_1.strings.OPENING_EVENT,
  13927. OPENED_EVENT = constants_1.strings.OPENED_EVENT,
  13928. CLOSING_EVENT = constants_1.strings.CLOSING_EVENT,
  13929. CLOSED_EVENT = constants_1.strings.CLOSED_EVENT;
  13930. var MDCSnackbar = /** @class */function (_super) {
  13931. __extends(MDCSnackbar, _super);
  13932. function MDCSnackbar() {
  13933. return _super !== null && _super.apply(this, arguments) || this;
  13934. }
  13935. MDCSnackbar.attachTo = function (root) {
  13936. return new MDCSnackbar(root);
  13937. };
  13938. MDCSnackbar.prototype.initialize = function (announcerFactory) {
  13939. if (announcerFactory === void 0) {
  13940. announcerFactory = function announcerFactory() {
  13941. return util.announce;
  13942. };
  13943. }
  13944. this.announce_ = announcerFactory();
  13945. };
  13946. MDCSnackbar.prototype.initialSyncWithDOM = function () {
  13947. var _this = this;
  13948. this.surfaceEl_ = this.root_.querySelector(SURFACE_SELECTOR);
  13949. this.labelEl_ = this.root_.querySelector(LABEL_SELECTOR);
  13950. this.actionEl_ = this.root_.querySelector(ACTION_SELECTOR);
  13951. this.handleKeyDown_ = function (evt) {
  13952. return _this.foundation_.handleKeyDown(evt);
  13953. };
  13954. this.handleSurfaceClick_ = function (evt) {
  13955. var target = evt.target;
  13956. if (_this.isActionButton_(target)) {
  13957. _this.foundation_.handleActionButtonClick(evt);
  13958. } else if (_this.isActionIcon_(target)) {
  13959. _this.foundation_.handleActionIconClick(evt);
  13960. }
  13961. };
  13962. this.registerKeyDownHandler_(this.handleKeyDown_);
  13963. this.registerSurfaceClickHandler_(this.handleSurfaceClick_);
  13964. };
  13965. MDCSnackbar.prototype.destroy = function () {
  13966. _super.prototype.destroy.call(this);
  13967. this.deregisterKeyDownHandler_(this.handleKeyDown_);
  13968. this.deregisterSurfaceClickHandler_(this.handleSurfaceClick_);
  13969. };
  13970. MDCSnackbar.prototype.open = function () {
  13971. this.foundation_.open();
  13972. };
  13973. /**
  13974. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  13975. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  13976. * client-specific values may also be used if desired.
  13977. */
  13978. MDCSnackbar.prototype.close = function (reason) {
  13979. if (reason === void 0) {
  13980. reason = '';
  13981. }
  13982. this.foundation_.close(reason);
  13983. };
  13984. MDCSnackbar.prototype.getDefaultFoundation = function () {
  13985. var _this = this;
  13986. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  13987. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  13988. var adapter = {
  13989. addClass: function addClass(className) {
  13990. return _this.root_.classList.add(className);
  13991. },
  13992. announce: function announce() {
  13993. return _this.announce_(_this.labelEl_);
  13994. },
  13995. notifyClosed: function notifyClosed(reason) {
  13996. return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {});
  13997. },
  13998. notifyClosing: function notifyClosing(reason) {
  13999. return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {});
  14000. },
  14001. notifyOpened: function notifyOpened() {
  14002. return _this.emit(OPENED_EVENT, {});
  14003. },
  14004. notifyOpening: function notifyOpening() {
  14005. return _this.emit(OPENING_EVENT, {});
  14006. },
  14007. removeClass: function removeClass(className) {
  14008. return _this.root_.classList.remove(className);
  14009. }
  14010. };
  14011. return new foundation_1.MDCSnackbarFoundation(adapter);
  14012. };
  14013. Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
  14014. get: function get() {
  14015. return this.foundation_.getTimeoutMs();
  14016. },
  14017. set: function set(timeoutMs) {
  14018. this.foundation_.setTimeoutMs(timeoutMs);
  14019. },
  14020. enumerable: true,
  14021. configurable: true
  14022. });
  14023. Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
  14024. get: function get() {
  14025. return this.foundation_.getCloseOnEscape();
  14026. },
  14027. set: function set(closeOnEscape) {
  14028. this.foundation_.setCloseOnEscape(closeOnEscape);
  14029. },
  14030. enumerable: true,
  14031. configurable: true
  14032. });
  14033. Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
  14034. get: function get() {
  14035. return this.foundation_.isOpen();
  14036. },
  14037. enumerable: true,
  14038. configurable: true
  14039. });
  14040. Object.defineProperty(MDCSnackbar.prototype, "labelText", {
  14041. get: function get() {
  14042. // This property only returns null if the node is a document, DOCTYPE, or notation.
  14043. // On Element nodes, it always returns a string.
  14044. return this.labelEl_.textContent;
  14045. },
  14046. set: function set(labelText) {
  14047. this.labelEl_.textContent = labelText;
  14048. },
  14049. enumerable: true,
  14050. configurable: true
  14051. });
  14052. Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
  14053. get: function get() {
  14054. return this.actionEl_.textContent;
  14055. },
  14056. set: function set(actionButtonText) {
  14057. this.actionEl_.textContent = actionButtonText;
  14058. },
  14059. enumerable: true,
  14060. configurable: true
  14061. });
  14062. MDCSnackbar.prototype.registerKeyDownHandler_ = function (handler) {
  14063. this.listen('keydown', handler);
  14064. };
  14065. MDCSnackbar.prototype.deregisterKeyDownHandler_ = function (handler) {
  14066. this.unlisten('keydown', handler);
  14067. };
  14068. MDCSnackbar.prototype.registerSurfaceClickHandler_ = function (handler) {
  14069. this.surfaceEl_.addEventListener('click', handler);
  14070. };
  14071. MDCSnackbar.prototype.deregisterSurfaceClickHandler_ = function (handler) {
  14072. this.surfaceEl_.removeEventListener('click', handler);
  14073. };
  14074. MDCSnackbar.prototype.isActionButton_ = function (target) {
  14075. return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR));
  14076. };
  14077. MDCSnackbar.prototype.isActionIcon_ = function (target) {
  14078. return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR));
  14079. };
  14080. return MDCSnackbar;
  14081. }(component_1.MDCComponent);
  14082. exports.MDCSnackbar = MDCSnackbar;
  14083. /***/ }),
  14084. /***/ "./packages/mdc-snackbar/constants.ts":
  14085. /*!********************************************!*\
  14086. !*** ./packages/mdc-snackbar/constants.ts ***!
  14087. \********************************************/
  14088. /*! no static exports found */
  14089. /***/ (function(module, exports, __webpack_require__) {
  14090. "use strict";
  14091. /**
  14092. * @license
  14093. * Copyright 2018 Google Inc.
  14094. *
  14095. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14096. * of this software and associated documentation files (the "Software"), to deal
  14097. * in the Software without restriction, including without limitation the rights
  14098. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14099. * copies of the Software, and to permit persons to whom the Software is
  14100. * furnished to do so, subject to the following conditions:
  14101. *
  14102. * The above copyright notice and this permission notice shall be included in
  14103. * all copies or substantial portions of the Software.
  14104. *
  14105. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14106. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14107. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14108. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14109. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14110. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14111. * THE SOFTWARE.
  14112. */
  14113. Object.defineProperty(exports, "__esModule", { value: true });
  14114. var cssClasses = {
  14115. CLOSING: 'mdc-snackbar--closing',
  14116. OPEN: 'mdc-snackbar--open',
  14117. OPENING: 'mdc-snackbar--opening'
  14118. };
  14119. exports.cssClasses = cssClasses;
  14120. var strings = {
  14121. ACTION_SELECTOR: '.mdc-snackbar__action',
  14122. ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',
  14123. CLOSED_EVENT: 'MDCSnackbar:closed',
  14124. CLOSING_EVENT: 'MDCSnackbar:closing',
  14125. DISMISS_SELECTOR: '.mdc-snackbar__dismiss',
  14126. LABEL_SELECTOR: '.mdc-snackbar__label',
  14127. OPENED_EVENT: 'MDCSnackbar:opened',
  14128. OPENING_EVENT: 'MDCSnackbar:opening',
  14129. REASON_ACTION: 'action',
  14130. REASON_DISMISS: 'dismiss',
  14131. SURFACE_SELECTOR: '.mdc-snackbar__surface'
  14132. };
  14133. exports.strings = strings;
  14134. var numbers = {
  14135. DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,
  14136. INDETERMINATE: -1,
  14137. MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,
  14138. MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,
  14139. // These variables need to be kept in sync with the values in _variables.scss.
  14140. SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,
  14141. SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,
  14142. /**
  14143. * Number of milliseconds to wait between temporarily clearing the label text
  14144. * in the DOM and subsequently restoring it. This is necessary to force IE 11
  14145. * to pick up the `aria-live` content change and announce it to the user.
  14146. */
  14147. ARIA_LIVE_DELAY_MS: 1000
  14148. };
  14149. exports.numbers = numbers;
  14150. /***/ }),
  14151. /***/ "./packages/mdc-snackbar/foundation.ts":
  14152. /*!*********************************************!*\
  14153. !*** ./packages/mdc-snackbar/foundation.ts ***!
  14154. \*********************************************/
  14155. /*! no static exports found */
  14156. /***/ (function(module, exports, __webpack_require__) {
  14157. "use strict";
  14158. /**
  14159. * @license
  14160. * Copyright 2018 Google Inc.
  14161. *
  14162. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14163. * of this software and associated documentation files (the "Software"), to deal
  14164. * in the Software without restriction, including without limitation the rights
  14165. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14166. * copies of the Software, and to permit persons to whom the Software is
  14167. * furnished to do so, subject to the following conditions:
  14168. *
  14169. * The above copyright notice and this permission notice shall be included in
  14170. * all copies or substantial portions of the Software.
  14171. *
  14172. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14173. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14174. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14175. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14176. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14177. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14178. * THE SOFTWARE.
  14179. */
  14180. var __extends = this && this.__extends || function () {
  14181. var _extendStatics = function extendStatics(d, b) {
  14182. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14183. d.__proto__ = b;
  14184. } || function (d, b) {
  14185. for (var p in b) {
  14186. if (b.hasOwnProperty(p)) d[p] = b[p];
  14187. }
  14188. };
  14189. return _extendStatics(d, b);
  14190. };
  14191. return function (d, b) {
  14192. _extendStatics(d, b);
  14193. function __() {
  14194. this.constructor = d;
  14195. }
  14196. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14197. };
  14198. }();
  14199. var __assign = this && this.__assign || function () {
  14200. __assign = Object.assign || function (t) {
  14201. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14202. s = arguments[i];
  14203. for (var p in s) {
  14204. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14205. }
  14206. }
  14207. return t;
  14208. };
  14209. return __assign.apply(this, arguments);
  14210. };
  14211. Object.defineProperty(exports, "__esModule", { value: true });
  14212. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  14213. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14214. var OPENING = constants_1.cssClasses.OPENING,
  14215. OPEN = constants_1.cssClasses.OPEN,
  14216. CLOSING = constants_1.cssClasses.CLOSING;
  14217. var REASON_ACTION = constants_1.strings.REASON_ACTION,
  14218. REASON_DISMISS = constants_1.strings.REASON_DISMISS;
  14219. var MDCSnackbarFoundation = /** @class */function (_super) {
  14220. __extends(MDCSnackbarFoundation, _super);
  14221. function MDCSnackbarFoundation(adapter) {
  14222. var _this = _super.call(this, __assign({}, MDCSnackbarFoundation.defaultAdapter, adapter)) || this;
  14223. _this.isOpen_ = false;
  14224. _this.animationFrame_ = 0;
  14225. _this.animationTimer_ = 0;
  14226. _this.autoDismissTimer_ = 0;
  14227. _this.autoDismissTimeoutMs_ = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
  14228. _this.closeOnEscape_ = true;
  14229. return _this;
  14230. }
  14231. Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
  14232. get: function get() {
  14233. return constants_1.cssClasses;
  14234. },
  14235. enumerable: true,
  14236. configurable: true
  14237. });
  14238. Object.defineProperty(MDCSnackbarFoundation, "strings", {
  14239. get: function get() {
  14240. return constants_1.strings;
  14241. },
  14242. enumerable: true,
  14243. configurable: true
  14244. });
  14245. Object.defineProperty(MDCSnackbarFoundation, "numbers", {
  14246. get: function get() {
  14247. return constants_1.numbers;
  14248. },
  14249. enumerable: true,
  14250. configurable: true
  14251. });
  14252. Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
  14253. get: function get() {
  14254. return {
  14255. addClass: function addClass() {
  14256. return undefined;
  14257. },
  14258. announce: function announce() {
  14259. return undefined;
  14260. },
  14261. notifyClosed: function notifyClosed() {
  14262. return undefined;
  14263. },
  14264. notifyClosing: function notifyClosing() {
  14265. return undefined;
  14266. },
  14267. notifyOpened: function notifyOpened() {
  14268. return undefined;
  14269. },
  14270. notifyOpening: function notifyOpening() {
  14271. return undefined;
  14272. },
  14273. removeClass: function removeClass() {
  14274. return undefined;
  14275. }
  14276. };
  14277. },
  14278. enumerable: true,
  14279. configurable: true
  14280. });
  14281. MDCSnackbarFoundation.prototype.destroy = function () {
  14282. this.clearAutoDismissTimer_();
  14283. cancelAnimationFrame(this.animationFrame_);
  14284. this.animationFrame_ = 0;
  14285. clearTimeout(this.animationTimer_);
  14286. this.animationTimer_ = 0;
  14287. this.adapter_.removeClass(OPENING);
  14288. this.adapter_.removeClass(OPEN);
  14289. this.adapter_.removeClass(CLOSING);
  14290. };
  14291. MDCSnackbarFoundation.prototype.open = function () {
  14292. var _this = this;
  14293. this.clearAutoDismissTimer_();
  14294. this.isOpen_ = true;
  14295. this.adapter_.notifyOpening();
  14296. this.adapter_.removeClass(CLOSING);
  14297. this.adapter_.addClass(OPENING);
  14298. this.adapter_.announce();
  14299. // Wait a frame once display is no longer "none", to establish basis for animation
  14300. this.runNextAnimationFrame_(function () {
  14301. _this.adapter_.addClass(OPEN);
  14302. _this.animationTimer_ = setTimeout(function () {
  14303. var timeoutMs = _this.getTimeoutMs();
  14304. _this.handleAnimationTimerEnd_();
  14305. _this.adapter_.notifyOpened();
  14306. if (timeoutMs !== constants_1.numbers.INDETERMINATE) {
  14307. _this.autoDismissTimer_ = setTimeout(function () {
  14308. _this.close(REASON_DISMISS);
  14309. }, timeoutMs);
  14310. }
  14311. }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
  14312. });
  14313. };
  14314. /**
  14315. * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
  14316. * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
  14317. * client-specific values may also be used if desired.
  14318. */
  14319. MDCSnackbarFoundation.prototype.close = function (reason) {
  14320. var _this = this;
  14321. if (reason === void 0) {
  14322. reason = '';
  14323. }
  14324. if (!this.isOpen_) {
  14325. // Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed
  14326. return;
  14327. }
  14328. cancelAnimationFrame(this.animationFrame_);
  14329. this.animationFrame_ = 0;
  14330. this.clearAutoDismissTimer_();
  14331. this.isOpen_ = false;
  14332. this.adapter_.notifyClosing(reason);
  14333. this.adapter_.addClass(constants_1.cssClasses.CLOSING);
  14334. this.adapter_.removeClass(constants_1.cssClasses.OPEN);
  14335. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  14336. clearTimeout(this.animationTimer_);
  14337. this.animationTimer_ = setTimeout(function () {
  14338. _this.handleAnimationTimerEnd_();
  14339. _this.adapter_.notifyClosed(reason);
  14340. }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
  14341. };
  14342. MDCSnackbarFoundation.prototype.isOpen = function () {
  14343. return this.isOpen_;
  14344. };
  14345. MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
  14346. return this.autoDismissTimeoutMs_;
  14347. };
  14348. MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
  14349. // Use shorter variable names to make the code more readable
  14350. var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
  14351. var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
  14352. var indeterminateValue = constants_1.numbers.INDETERMINATE;
  14353. if (timeoutMs === constants_1.numbers.INDETERMINATE || timeoutMs <= maxValue && timeoutMs >= minValue) {
  14354. this.autoDismissTimeoutMs_ = timeoutMs;
  14355. } else {
  14356. throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'");
  14357. }
  14358. };
  14359. MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
  14360. return this.closeOnEscape_;
  14361. };
  14362. MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
  14363. this.closeOnEscape_ = closeOnEscape;
  14364. };
  14365. MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
  14366. var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
  14367. if (isEscapeKey && this.getCloseOnEscape()) {
  14368. this.close(REASON_DISMISS);
  14369. }
  14370. };
  14371. MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
  14372. this.close(REASON_ACTION);
  14373. };
  14374. MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
  14375. this.close(REASON_DISMISS);
  14376. };
  14377. MDCSnackbarFoundation.prototype.clearAutoDismissTimer_ = function () {
  14378. clearTimeout(this.autoDismissTimer_);
  14379. this.autoDismissTimer_ = 0;
  14380. };
  14381. MDCSnackbarFoundation.prototype.handleAnimationTimerEnd_ = function () {
  14382. this.animationTimer_ = 0;
  14383. this.adapter_.removeClass(constants_1.cssClasses.OPENING);
  14384. this.adapter_.removeClass(constants_1.cssClasses.CLOSING);
  14385. };
  14386. /**
  14387. * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
  14388. */
  14389. MDCSnackbarFoundation.prototype.runNextAnimationFrame_ = function (callback) {
  14390. var _this = this;
  14391. cancelAnimationFrame(this.animationFrame_);
  14392. this.animationFrame_ = requestAnimationFrame(function () {
  14393. _this.animationFrame_ = 0;
  14394. clearTimeout(_this.animationTimer_);
  14395. _this.animationTimer_ = setTimeout(callback, 0);
  14396. });
  14397. };
  14398. return MDCSnackbarFoundation;
  14399. }(foundation_1.MDCFoundation);
  14400. exports.MDCSnackbarFoundation = MDCSnackbarFoundation;
  14401. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14402. exports.default = MDCSnackbarFoundation;
  14403. /***/ }),
  14404. /***/ "./packages/mdc-snackbar/index.ts":
  14405. /*!****************************************!*\
  14406. !*** ./packages/mdc-snackbar/index.ts ***!
  14407. \****************************************/
  14408. /*! no static exports found */
  14409. /***/ (function(module, exports, __webpack_require__) {
  14410. "use strict";
  14411. /**
  14412. * @license
  14413. * Copyright 2019 Google Inc.
  14414. *
  14415. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14416. * of this software and associated documentation files (the "Software"), to deal
  14417. * in the Software without restriction, including without limitation the rights
  14418. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14419. * copies of the Software, and to permit persons to whom the Software is
  14420. * furnished to do so, subject to the following conditions:
  14421. *
  14422. * The above copyright notice and this permission notice shall be included in
  14423. * all copies or substantial portions of the Software.
  14424. *
  14425. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14426. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14427. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14428. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14429. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14430. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14431. * THE SOFTWARE.
  14432. */
  14433. function __export(m) {
  14434. for (var p in m) {
  14435. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14436. }
  14437. }
  14438. var __importStar = this && this.__importStar || function (mod) {
  14439. if (mod && mod.__esModule) return mod;
  14440. var result = {};
  14441. if (mod != null) for (var k in mod) {
  14442. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  14443. }result["default"] = mod;
  14444. return result;
  14445. };
  14446. Object.defineProperty(exports, "__esModule", { value: true });
  14447. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-snackbar/util.ts"));
  14448. exports.util = util;
  14449. __export(__webpack_require__(/*! ./component */ "./packages/mdc-snackbar/component.ts"));
  14450. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts"));
  14451. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-snackbar/foundation.ts"));
  14452. /***/ }),
  14453. /***/ "./packages/mdc-snackbar/util.ts":
  14454. /*!***************************************!*\
  14455. !*** ./packages/mdc-snackbar/util.ts ***!
  14456. \***************************************/
  14457. /*! no static exports found */
  14458. /***/ (function(module, exports, __webpack_require__) {
  14459. "use strict";
  14460. /**
  14461. * @license
  14462. * Copyright 2018 Google Inc.
  14463. *
  14464. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14465. * of this software and associated documentation files (the "Software"), to deal
  14466. * in the Software without restriction, including without limitation the rights
  14467. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14468. * copies of the Software, and to permit persons to whom the Software is
  14469. * furnished to do so, subject to the following conditions:
  14470. *
  14471. * The above copyright notice and this permission notice shall be included in
  14472. * all copies or substantial portions of the Software.
  14473. *
  14474. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14475. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14476. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14477. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14478. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14479. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14480. * THE SOFTWARE.
  14481. */
  14482. Object.defineProperty(exports, "__esModule", { value: true });
  14483. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-snackbar/constants.ts");
  14484. var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS;
  14485. var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR;
  14486. function announce(ariaEl, labelEl) {
  14487. if (labelEl === void 0) {
  14488. labelEl = ariaEl;
  14489. }
  14490. var priority = ariaEl.getAttribute('aria-live');
  14491. // Trim text to ignore `&nbsp;` (see below).
  14492. // textContent is only null if the node is a document, DOCTYPE, or notation.
  14493. var labelText = labelEl.textContent.trim();
  14494. if (!labelText || !priority) {
  14495. return;
  14496. }
  14497. // Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice.
  14498. ariaEl.setAttribute('aria-live', 'off');
  14499. // Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers.
  14500. // `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars
  14501. // sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first.
  14502. // Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event,
  14503. // so screen readers won't announce the second message unless we first clear `textContent`.
  14504. //
  14505. // We have to clear the label text two different ways to make it work in all browsers and screen readers:
  14506. //
  14507. // 1. `textContent = ''` is required for IE11 + JAWS
  14508. // 2. `innerHTML = '&nbsp;'` is required for Chrome + JAWS and NVDA
  14509. //
  14510. // All other browser/screen reader combinations support both methods.
  14511. //
  14512. // The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed.
  14513. // N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change.
  14514. //
  14515. // This technique has been tested in:
  14516. //
  14517. // * JAWS 2019:
  14518. // - Chrome 70
  14519. // - Firefox 60 (ESR)
  14520. // - IE 11
  14521. // * NVDA 2018:
  14522. // - Chrome 70
  14523. // - Firefox 60 (ESR)
  14524. // - IE 11
  14525. // * ChromeVox 53
  14526. labelEl.textContent = '';
  14527. labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;">&nbsp;</span>';
  14528. // Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element.
  14529. // CSS generated content is normally announced by screen readers
  14530. // (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/);
  14531. // however, `aria-live` is turned off, so this DOM update will be ignored by screen readers.
  14532. labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
  14533. setTimeout(function () {
  14534. // Allow screen readers to announce changes to the DOM again.
  14535. ariaEl.setAttribute('aria-live', priority);
  14536. // Remove the message from the ::before pseudo-element.
  14537. labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
  14538. // Restore the original label text, which will be announced by screen readers.
  14539. labelEl.textContent = labelText;
  14540. }, ARIA_LIVE_DELAY_MS);
  14541. }
  14542. exports.announce = announce;
  14543. /***/ }),
  14544. /***/ "./packages/mdc-switch/component.ts":
  14545. /*!******************************************!*\
  14546. !*** ./packages/mdc-switch/component.ts ***!
  14547. \******************************************/
  14548. /*! no static exports found */
  14549. /***/ (function(module, exports, __webpack_require__) {
  14550. "use strict";
  14551. /**
  14552. * @license
  14553. * Copyright 2018 Google Inc.
  14554. *
  14555. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14556. * of this software and associated documentation files (the "Software"), to deal
  14557. * in the Software without restriction, including without limitation the rights
  14558. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14559. * copies of the Software, and to permit persons to whom the Software is
  14560. * furnished to do so, subject to the following conditions:
  14561. *
  14562. * The above copyright notice and this permission notice shall be included in
  14563. * all copies or substantial portions of the Software.
  14564. *
  14565. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14566. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14567. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14568. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14569. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14570. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14571. * THE SOFTWARE.
  14572. */
  14573. var __extends = this && this.__extends || function () {
  14574. var _extendStatics = function extendStatics(d, b) {
  14575. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14576. d.__proto__ = b;
  14577. } || function (d, b) {
  14578. for (var p in b) {
  14579. if (b.hasOwnProperty(p)) d[p] = b[p];
  14580. }
  14581. };
  14582. return _extendStatics(d, b);
  14583. };
  14584. return function (d, b) {
  14585. _extendStatics(d, b);
  14586. function __() {
  14587. this.constructor = d;
  14588. }
  14589. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14590. };
  14591. }();
  14592. var __assign = this && this.__assign || function () {
  14593. __assign = Object.assign || function (t) {
  14594. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14595. s = arguments[i];
  14596. for (var p in s) {
  14597. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14598. }
  14599. }
  14600. return t;
  14601. };
  14602. return __assign.apply(this, arguments);
  14603. };
  14604. var __read = this && this.__read || function (o, n) {
  14605. var m = typeof Symbol === "function" && o[Symbol.iterator];
  14606. if (!m) return o;
  14607. var i = m.call(o),
  14608. r,
  14609. ar = [],
  14610. e;
  14611. try {
  14612. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  14613. ar.push(r.value);
  14614. }
  14615. } catch (error) {
  14616. e = { error: error };
  14617. } finally {
  14618. try {
  14619. if (r && !r.done && (m = i["return"])) m.call(i);
  14620. } finally {
  14621. if (e) throw e.error;
  14622. }
  14623. }
  14624. return ar;
  14625. };
  14626. var __spread = this && this.__spread || function () {
  14627. for (var ar = [], i = 0; i < arguments.length; i++) {
  14628. ar = ar.concat(__read(arguments[i]));
  14629. }return ar;
  14630. };
  14631. Object.defineProperty(exports, "__esModule", { value: true });
  14632. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  14633. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  14634. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  14635. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  14636. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  14637. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts");
  14638. var MDCSwitch = /** @class */function (_super) {
  14639. __extends(MDCSwitch, _super);
  14640. function MDCSwitch() {
  14641. var _this = _super !== null && _super.apply(this, arguments) || this;
  14642. _this.ripple_ = _this.createRipple_();
  14643. return _this;
  14644. }
  14645. MDCSwitch.attachTo = function (root) {
  14646. return new MDCSwitch(root);
  14647. };
  14648. MDCSwitch.prototype.destroy = function () {
  14649. _super.prototype.destroy.call(this);
  14650. this.ripple_.destroy();
  14651. this.nativeControl_.removeEventListener('change', this.changeHandler_);
  14652. };
  14653. MDCSwitch.prototype.initialSyncWithDOM = function () {
  14654. var _this = this;
  14655. this.changeHandler_ = function () {
  14656. var _a;
  14657. var args = [];
  14658. for (var _i = 0; _i < arguments.length; _i++) {
  14659. args[_i] = arguments[_i];
  14660. }
  14661. return (_a = _this.foundation_).handleChange.apply(_a, __spread(args));
  14662. };
  14663. this.nativeControl_.addEventListener('change', this.changeHandler_);
  14664. // Sometimes the checked state of the input element is saved in the history.
  14665. // The switch styling should match the checked state of the input element.
  14666. // Do an initial sync between the native control and the foundation.
  14667. this.checked = this.checked;
  14668. };
  14669. MDCSwitch.prototype.getDefaultFoundation = function () {
  14670. var _this = this;
  14671. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  14672. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  14673. var adapter = {
  14674. addClass: function addClass(className) {
  14675. return _this.root_.classList.add(className);
  14676. },
  14677. removeClass: function removeClass(className) {
  14678. return _this.root_.classList.remove(className);
  14679. },
  14680. setNativeControlChecked: function setNativeControlChecked(checked) {
  14681. return _this.nativeControl_.checked = checked;
  14682. },
  14683. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  14684. return _this.nativeControl_.disabled = disabled;
  14685. },
  14686. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  14687. return _this.nativeControl_.setAttribute(attr, value);
  14688. }
  14689. };
  14690. return new foundation_2.MDCSwitchFoundation(adapter);
  14691. };
  14692. Object.defineProperty(MDCSwitch.prototype, "ripple", {
  14693. get: function get() {
  14694. return this.ripple_;
  14695. },
  14696. enumerable: true,
  14697. configurable: true
  14698. });
  14699. Object.defineProperty(MDCSwitch.prototype, "checked", {
  14700. get: function get() {
  14701. return this.nativeControl_.checked;
  14702. },
  14703. set: function set(checked) {
  14704. this.foundation_.setChecked(checked);
  14705. },
  14706. enumerable: true,
  14707. configurable: true
  14708. });
  14709. Object.defineProperty(MDCSwitch.prototype, "disabled", {
  14710. get: function get() {
  14711. return this.nativeControl_.disabled;
  14712. },
  14713. set: function set(disabled) {
  14714. this.foundation_.setDisabled(disabled);
  14715. },
  14716. enumerable: true,
  14717. configurable: true
  14718. });
  14719. MDCSwitch.prototype.createRipple_ = function () {
  14720. var _this = this;
  14721. var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
  14722. var rippleSurface = this.root_.querySelector(RIPPLE_SURFACE_SELECTOR);
  14723. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  14724. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  14725. var adapter = __assign({}, component_2.MDCRipple.createAdapter(this), { addClass: function addClass(className) {
  14726. return rippleSurface.classList.add(className);
  14727. }, computeBoundingRect: function computeBoundingRect() {
  14728. return rippleSurface.getBoundingClientRect();
  14729. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  14730. _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive());
  14731. }, isSurfaceActive: function isSurfaceActive() {
  14732. return ponyfill_1.matches(_this.nativeControl_, ':active');
  14733. }, isUnbounded: function isUnbounded() {
  14734. return true;
  14735. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  14736. _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive());
  14737. }, removeClass: function removeClass(className) {
  14738. rippleSurface.classList.remove(className);
  14739. }, updateCssVariable: function updateCssVariable(varName, value) {
  14740. rippleSurface.style.setProperty(varName, value);
  14741. } });
  14742. return new component_2.MDCRipple(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  14743. };
  14744. Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
  14745. get: function get() {
  14746. var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
  14747. return this.root_.querySelector(NATIVE_CONTROL_SELECTOR);
  14748. },
  14749. enumerable: true,
  14750. configurable: true
  14751. });
  14752. return MDCSwitch;
  14753. }(component_1.MDCComponent);
  14754. exports.MDCSwitch = MDCSwitch;
  14755. /***/ }),
  14756. /***/ "./packages/mdc-switch/constants.ts":
  14757. /*!******************************************!*\
  14758. !*** ./packages/mdc-switch/constants.ts ***!
  14759. \******************************************/
  14760. /*! no static exports found */
  14761. /***/ (function(module, exports, __webpack_require__) {
  14762. "use strict";
  14763. /**
  14764. * @license
  14765. * Copyright 2018 Google Inc.
  14766. *
  14767. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14768. * of this software and associated documentation files (the "Software"), to deal
  14769. * in the Software without restriction, including without limitation the rights
  14770. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14771. * copies of the Software, and to permit persons to whom the Software is
  14772. * furnished to do so, subject to the following conditions:
  14773. *
  14774. * The above copyright notice and this permission notice shall be included in
  14775. * all copies or substantial portions of the Software.
  14776. *
  14777. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14778. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14779. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14780. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14781. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14782. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14783. * THE SOFTWARE.
  14784. */
  14785. Object.defineProperty(exports, "__esModule", { value: true });
  14786. /** CSS classes used by the switch. */
  14787. var cssClasses = {
  14788. /** Class used for a switch that is in the "checked" (on) position. */
  14789. CHECKED: 'mdc-switch--checked',
  14790. /** Class used for a switch that is disabled. */
  14791. DISABLED: 'mdc-switch--disabled'
  14792. };
  14793. exports.cssClasses = cssClasses;
  14794. /** String constants used by the switch. */
  14795. var strings = {
  14796. /** Aria attribute for checked or unchecked state of switch */
  14797. ARIA_CHECKED_ATTR: 'aria-checked',
  14798. /** A CSS selector used to locate the native HTML control for the switch. */
  14799. NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control',
  14800. /** A CSS selector used to locate the ripple surface element for the switch. */
  14801. RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay'
  14802. };
  14803. exports.strings = strings;
  14804. /***/ }),
  14805. /***/ "./packages/mdc-switch/foundation.ts":
  14806. /*!*******************************************!*\
  14807. !*** ./packages/mdc-switch/foundation.ts ***!
  14808. \*******************************************/
  14809. /*! no static exports found */
  14810. /***/ (function(module, exports, __webpack_require__) {
  14811. "use strict";
  14812. /**
  14813. * @license
  14814. * Copyright 2018 Google Inc.
  14815. *
  14816. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14817. * of this software and associated documentation files (the "Software"), to deal
  14818. * in the Software without restriction, including without limitation the rights
  14819. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14820. * copies of the Software, and to permit persons to whom the Software is
  14821. * furnished to do so, subject to the following conditions:
  14822. *
  14823. * The above copyright notice and this permission notice shall be included in
  14824. * all copies or substantial portions of the Software.
  14825. *
  14826. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14827. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14828. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14829. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14830. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14831. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14832. * THE SOFTWARE.
  14833. */
  14834. var __extends = this && this.__extends || function () {
  14835. var _extendStatics = function extendStatics(d, b) {
  14836. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14837. d.__proto__ = b;
  14838. } || function (d, b) {
  14839. for (var p in b) {
  14840. if (b.hasOwnProperty(p)) d[p] = b[p];
  14841. }
  14842. };
  14843. return _extendStatics(d, b);
  14844. };
  14845. return function (d, b) {
  14846. _extendStatics(d, b);
  14847. function __() {
  14848. this.constructor = d;
  14849. }
  14850. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14851. };
  14852. }();
  14853. var __assign = this && this.__assign || function () {
  14854. __assign = Object.assign || function (t) {
  14855. for (var s, i = 1, n = arguments.length; i < n; i++) {
  14856. s = arguments[i];
  14857. for (var p in s) {
  14858. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  14859. }
  14860. }
  14861. return t;
  14862. };
  14863. return __assign.apply(this, arguments);
  14864. };
  14865. Object.defineProperty(exports, "__esModule", { value: true });
  14866. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  14867. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts");
  14868. var MDCSwitchFoundation = /** @class */function (_super) {
  14869. __extends(MDCSwitchFoundation, _super);
  14870. function MDCSwitchFoundation(adapter) {
  14871. return _super.call(this, __assign({}, MDCSwitchFoundation.defaultAdapter, adapter)) || this;
  14872. }
  14873. Object.defineProperty(MDCSwitchFoundation, "strings", {
  14874. /** The string constants used by the switch. */
  14875. get: function get() {
  14876. return constants_1.strings;
  14877. },
  14878. enumerable: true,
  14879. configurable: true
  14880. });
  14881. Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
  14882. /** The CSS classes used by the switch. */
  14883. get: function get() {
  14884. return constants_1.cssClasses;
  14885. },
  14886. enumerable: true,
  14887. configurable: true
  14888. });
  14889. Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
  14890. /** The default Adapter for the switch. */
  14891. get: function get() {
  14892. return {
  14893. addClass: function addClass() {
  14894. return undefined;
  14895. },
  14896. removeClass: function removeClass() {
  14897. return undefined;
  14898. },
  14899. setNativeControlChecked: function setNativeControlChecked() {
  14900. return undefined;
  14901. },
  14902. setNativeControlDisabled: function setNativeControlDisabled() {
  14903. return undefined;
  14904. },
  14905. setNativeControlAttr: function setNativeControlAttr() {
  14906. return undefined;
  14907. }
  14908. };
  14909. },
  14910. enumerable: true,
  14911. configurable: true
  14912. });
  14913. /** Sets the checked state of the switch. */
  14914. MDCSwitchFoundation.prototype.setChecked = function (checked) {
  14915. this.adapter_.setNativeControlChecked(checked);
  14916. this.updateAriaChecked_(checked);
  14917. this.updateCheckedStyling_(checked);
  14918. };
  14919. /** Sets the disabled state of the switch. */
  14920. MDCSwitchFoundation.prototype.setDisabled = function (disabled) {
  14921. this.adapter_.setNativeControlDisabled(disabled);
  14922. if (disabled) {
  14923. this.adapter_.addClass(constants_1.cssClasses.DISABLED);
  14924. } else {
  14925. this.adapter_.removeClass(constants_1.cssClasses.DISABLED);
  14926. }
  14927. };
  14928. /** Handles the change event for the switch native control. */
  14929. MDCSwitchFoundation.prototype.handleChange = function (evt) {
  14930. var nativeControl = evt.target;
  14931. this.updateAriaChecked_(nativeControl.checked);
  14932. this.updateCheckedStyling_(nativeControl.checked);
  14933. };
  14934. /** Updates the styling of the switch based on its checked state. */
  14935. MDCSwitchFoundation.prototype.updateCheckedStyling_ = function (checked) {
  14936. if (checked) {
  14937. this.adapter_.addClass(constants_1.cssClasses.CHECKED);
  14938. } else {
  14939. this.adapter_.removeClass(constants_1.cssClasses.CHECKED);
  14940. }
  14941. };
  14942. MDCSwitchFoundation.prototype.updateAriaChecked_ = function (checked) {
  14943. this.adapter_.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, "" + !!checked);
  14944. };
  14945. return MDCSwitchFoundation;
  14946. }(foundation_1.MDCFoundation);
  14947. exports.MDCSwitchFoundation = MDCSwitchFoundation;
  14948. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  14949. exports.default = MDCSwitchFoundation;
  14950. /***/ }),
  14951. /***/ "./packages/mdc-switch/index.ts":
  14952. /*!**************************************!*\
  14953. !*** ./packages/mdc-switch/index.ts ***!
  14954. \**************************************/
  14955. /*! no static exports found */
  14956. /***/ (function(module, exports, __webpack_require__) {
  14957. "use strict";
  14958. /**
  14959. * @license
  14960. * Copyright 2019 Google Inc.
  14961. *
  14962. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14963. * of this software and associated documentation files (the "Software"), to deal
  14964. * in the Software without restriction, including without limitation the rights
  14965. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14966. * copies of the Software, and to permit persons to whom the Software is
  14967. * furnished to do so, subject to the following conditions:
  14968. *
  14969. * The above copyright notice and this permission notice shall be included in
  14970. * all copies or substantial portions of the Software.
  14971. *
  14972. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14973. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14974. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14975. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14976. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  14977. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  14978. * THE SOFTWARE.
  14979. */
  14980. function __export(m) {
  14981. for (var p in m) {
  14982. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  14983. }
  14984. }
  14985. Object.defineProperty(exports, "__esModule", { value: true });
  14986. __export(__webpack_require__(/*! ./component */ "./packages/mdc-switch/component.ts"));
  14987. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-switch/constants.ts"));
  14988. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-switch/foundation.ts"));
  14989. /***/ }),
  14990. /***/ "./packages/mdc-tab-bar/component.ts":
  14991. /*!*******************************************!*\
  14992. !*** ./packages/mdc-tab-bar/component.ts ***!
  14993. \*******************************************/
  14994. /*! no static exports found */
  14995. /***/ (function(module, exports, __webpack_require__) {
  14996. "use strict";
  14997. /**
  14998. * @license
  14999. * Copyright 2018 Google Inc.
  15000. *
  15001. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15002. * of this software and associated documentation files (the "Software"), to deal
  15003. * in the Software without restriction, including without limitation the rights
  15004. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15005. * copies of the Software, and to permit persons to whom the Software is
  15006. * furnished to do so, subject to the following conditions:
  15007. *
  15008. * The above copyright notice and this permission notice shall be included in
  15009. * all copies or substantial portions of the Software.
  15010. *
  15011. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15012. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15013. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15014. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15015. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15016. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15017. * THE SOFTWARE.
  15018. */
  15019. var __extends = this && this.__extends || function () {
  15020. var _extendStatics = function extendStatics(d, b) {
  15021. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15022. d.__proto__ = b;
  15023. } || function (d, b) {
  15024. for (var p in b) {
  15025. if (b.hasOwnProperty(p)) d[p] = b[p];
  15026. }
  15027. };
  15028. return _extendStatics(d, b);
  15029. };
  15030. return function (d, b) {
  15031. _extendStatics(d, b);
  15032. function __() {
  15033. this.constructor = d;
  15034. }
  15035. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15036. };
  15037. }();
  15038. Object.defineProperty(exports, "__esModule", { value: true });
  15039. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15040. var component_2 = __webpack_require__(/*! @material/tab-scroller/component */ "./packages/mdc-tab-scroller/component.ts");
  15041. var component_3 = __webpack_require__(/*! @material/tab/component */ "./packages/mdc-tab/component.ts");
  15042. var foundation_1 = __webpack_require__(/*! @material/tab/foundation */ "./packages/mdc-tab/foundation.ts");
  15043. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts");
  15044. var strings = foundation_2.MDCTabBarFoundation.strings;
  15045. var tabIdCounter = 0;
  15046. var MDCTabBar = /** @class */function (_super) {
  15047. __extends(MDCTabBar, _super);
  15048. function MDCTabBar() {
  15049. return _super !== null && _super.apply(this, arguments) || this;
  15050. }
  15051. MDCTabBar.attachTo = function (root) {
  15052. return new MDCTabBar(root);
  15053. };
  15054. Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", {
  15055. set: function set(focusOnActivate) {
  15056. this.tabList_.forEach(function (tab) {
  15057. return tab.focusOnActivate = focusOnActivate;
  15058. });
  15059. },
  15060. enumerable: true,
  15061. configurable: true
  15062. });
  15063. Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", {
  15064. set: function set(useAutomaticActivation) {
  15065. this.foundation_.setUseAutomaticActivation(useAutomaticActivation);
  15066. },
  15067. enumerable: true,
  15068. configurable: true
  15069. });
  15070. MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {
  15071. if (tabFactory === void 0) {
  15072. tabFactory = function tabFactory(el) {
  15073. return new component_3.MDCTab(el);
  15074. };
  15075. }
  15076. if (tabScrollerFactory === void 0) {
  15077. tabScrollerFactory = function tabScrollerFactory(el) {
  15078. return new component_2.MDCTabScroller(el);
  15079. };
  15080. }
  15081. this.tabList_ = this.instantiateTabs_(tabFactory);
  15082. this.tabScroller_ = this.instantiateTabScroller_(tabScrollerFactory);
  15083. };
  15084. MDCTabBar.prototype.initialSyncWithDOM = function () {
  15085. var _this = this;
  15086. this.handleTabInteraction_ = function (evt) {
  15087. return _this.foundation_.handleTabInteraction(evt);
  15088. };
  15089. this.handleKeyDown_ = function (evt) {
  15090. return _this.foundation_.handleKeyDown(evt);
  15091. };
  15092. this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  15093. this.listen('keydown', this.handleKeyDown_);
  15094. for (var i = 0; i < this.tabList_.length; i++) {
  15095. if (this.tabList_[i].active) {
  15096. this.scrollIntoView(i);
  15097. break;
  15098. }
  15099. }
  15100. };
  15101. MDCTabBar.prototype.destroy = function () {
  15102. _super.prototype.destroy.call(this);
  15103. this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction_);
  15104. this.unlisten('keydown', this.handleKeyDown_);
  15105. this.tabList_.forEach(function (tab) {
  15106. return tab.destroy();
  15107. });
  15108. if (this.tabScroller_) {
  15109. this.tabScroller_.destroy();
  15110. }
  15111. };
  15112. MDCTabBar.prototype.getDefaultFoundation = function () {
  15113. var _this = this;
  15114. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15115. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15116. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15117. var adapter = {
  15118. scrollTo: function scrollTo(scrollX) {
  15119. return _this.tabScroller_.scrollTo(scrollX);
  15120. },
  15121. incrementScroll: function incrementScroll(scrollXIncrement) {
  15122. return _this.tabScroller_.incrementScroll(scrollXIncrement);
  15123. },
  15124. getScrollPosition: function getScrollPosition() {
  15125. return _this.tabScroller_.getScrollPosition();
  15126. },
  15127. getScrollContentWidth: function getScrollContentWidth() {
  15128. return _this.tabScroller_.getScrollContentWidth();
  15129. },
  15130. getOffsetWidth: function getOffsetWidth() {
  15131. return _this.root_.offsetWidth;
  15132. },
  15133. isRTL: function isRTL() {
  15134. return window.getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
  15135. },
  15136. setActiveTab: function setActiveTab(index) {
  15137. return _this.foundation_.activateTab(index);
  15138. },
  15139. activateTabAtIndex: function activateTabAtIndex(index, clientRect) {
  15140. return _this.tabList_[index].activate(clientRect);
  15141. },
  15142. deactivateTabAtIndex: function deactivateTabAtIndex(index) {
  15143. return _this.tabList_[index].deactivate();
  15144. },
  15145. focusTabAtIndex: function focusTabAtIndex(index) {
  15146. return _this.tabList_[index].focus();
  15147. },
  15148. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) {
  15149. return _this.tabList_[index].computeIndicatorClientRect();
  15150. },
  15151. getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) {
  15152. return _this.tabList_[index].computeDimensions();
  15153. },
  15154. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  15155. for (var i = 0; i < _this.tabList_.length; i++) {
  15156. if (_this.tabList_[i].active) {
  15157. return i;
  15158. }
  15159. }
  15160. return -1;
  15161. },
  15162. getFocusedTabIndex: function getFocusedTabIndex() {
  15163. var tabElements = _this.getTabElements_();
  15164. var activeElement = document.activeElement;
  15165. return tabElements.indexOf(activeElement);
  15166. },
  15167. getIndexOfTabById: function getIndexOfTabById(id) {
  15168. for (var i = 0; i < _this.tabList_.length; i++) {
  15169. if (_this.tabList_[i].id === id) {
  15170. return i;
  15171. }
  15172. }
  15173. return -1;
  15174. },
  15175. getTabListLength: function getTabListLength() {
  15176. return _this.tabList_.length;
  15177. },
  15178. notifyTabActivated: function notifyTabActivated(index) {
  15179. return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true);
  15180. }
  15181. };
  15182. // tslint:enable:object-literal-sort-keys
  15183. return new foundation_2.MDCTabBarFoundation(adapter);
  15184. };
  15185. /**
  15186. * Activates the tab at the given index
  15187. * @param index The index of the tab
  15188. */
  15189. MDCTabBar.prototype.activateTab = function (index) {
  15190. this.foundation_.activateTab(index);
  15191. };
  15192. /**
  15193. * Scrolls the tab at the given index into view
  15194. * @param index THe index of the tab
  15195. */
  15196. MDCTabBar.prototype.scrollIntoView = function (index) {
  15197. this.foundation_.scrollIntoView(index);
  15198. };
  15199. /**
  15200. * Returns all the tab elements in a nice clean array
  15201. */
  15202. MDCTabBar.prototype.getTabElements_ = function () {
  15203. return [].slice.call(this.root_.querySelectorAll(strings.TAB_SELECTOR));
  15204. };
  15205. /**
  15206. * Instantiates tab components on all child tab elements
  15207. */
  15208. MDCTabBar.prototype.instantiateTabs_ = function (tabFactory) {
  15209. return this.getTabElements_().map(function (el) {
  15210. el.id = el.id || "mdc-tab-" + ++tabIdCounter;
  15211. return tabFactory(el);
  15212. });
  15213. };
  15214. /**
  15215. * Instantiates tab scroller component on the child tab scroller element
  15216. */
  15217. MDCTabBar.prototype.instantiateTabScroller_ = function (tabScrollerFactory) {
  15218. var tabScrollerElement = this.root_.querySelector(strings.TAB_SCROLLER_SELECTOR);
  15219. if (tabScrollerElement) {
  15220. return tabScrollerFactory(tabScrollerElement);
  15221. }
  15222. return null;
  15223. };
  15224. return MDCTabBar;
  15225. }(component_1.MDCComponent);
  15226. exports.MDCTabBar = MDCTabBar;
  15227. /***/ }),
  15228. /***/ "./packages/mdc-tab-bar/constants.ts":
  15229. /*!*******************************************!*\
  15230. !*** ./packages/mdc-tab-bar/constants.ts ***!
  15231. \*******************************************/
  15232. /*! no static exports found */
  15233. /***/ (function(module, exports, __webpack_require__) {
  15234. "use strict";
  15235. /**
  15236. * @license
  15237. * Copyright 2018 Google Inc.
  15238. *
  15239. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15240. * of this software and associated documentation files (the "Software"), to deal
  15241. * in the Software without restriction, including without limitation the rights
  15242. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15243. * copies of the Software, and to permit persons to whom the Software is
  15244. * furnished to do so, subject to the following conditions:
  15245. *
  15246. * The above copyright notice and this permission notice shall be included in
  15247. * all copies or substantial portions of the Software.
  15248. *
  15249. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15250. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15251. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15252. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15253. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15254. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15255. * THE SOFTWARE.
  15256. */
  15257. Object.defineProperty(exports, "__esModule", { value: true });
  15258. var strings = {
  15259. ARROW_LEFT_KEY: 'ArrowLeft',
  15260. ARROW_RIGHT_KEY: 'ArrowRight',
  15261. END_KEY: 'End',
  15262. ENTER_KEY: 'Enter',
  15263. HOME_KEY: 'Home',
  15264. SPACE_KEY: 'Space',
  15265. TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
  15266. TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
  15267. TAB_SELECTOR: '.mdc-tab'
  15268. };
  15269. exports.strings = strings;
  15270. var numbers = {
  15271. ARROW_LEFT_KEYCODE: 37,
  15272. ARROW_RIGHT_KEYCODE: 39,
  15273. END_KEYCODE: 35,
  15274. ENTER_KEYCODE: 13,
  15275. EXTRA_SCROLL_AMOUNT: 20,
  15276. HOME_KEYCODE: 36,
  15277. SPACE_KEYCODE: 32
  15278. };
  15279. exports.numbers = numbers;
  15280. /***/ }),
  15281. /***/ "./packages/mdc-tab-bar/foundation.ts":
  15282. /*!********************************************!*\
  15283. !*** ./packages/mdc-tab-bar/foundation.ts ***!
  15284. \********************************************/
  15285. /*! no static exports found */
  15286. /***/ (function(module, exports, __webpack_require__) {
  15287. "use strict";
  15288. /**
  15289. * @license
  15290. * Copyright 2018 Google Inc.
  15291. *
  15292. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15293. * of this software and associated documentation files (the "Software"), to deal
  15294. * in the Software without restriction, including without limitation the rights
  15295. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15296. * copies of the Software, and to permit persons to whom the Software is
  15297. * furnished to do so, subject to the following conditions:
  15298. *
  15299. * The above copyright notice and this permission notice shall be included in
  15300. * all copies or substantial portions of the Software.
  15301. *
  15302. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15303. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15304. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15305. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15306. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15307. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15308. * THE SOFTWARE.
  15309. */
  15310. var __extends = this && this.__extends || function () {
  15311. var _extendStatics = function extendStatics(d, b) {
  15312. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15313. d.__proto__ = b;
  15314. } || function (d, b) {
  15315. for (var p in b) {
  15316. if (b.hasOwnProperty(p)) d[p] = b[p];
  15317. }
  15318. };
  15319. return _extendStatics(d, b);
  15320. };
  15321. return function (d, b) {
  15322. _extendStatics(d, b);
  15323. function __() {
  15324. this.constructor = d;
  15325. }
  15326. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15327. };
  15328. }();
  15329. var __assign = this && this.__assign || function () {
  15330. __assign = Object.assign || function (t) {
  15331. for (var s, i = 1, n = arguments.length; i < n; i++) {
  15332. s = arguments[i];
  15333. for (var p in s) {
  15334. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  15335. }
  15336. }
  15337. return t;
  15338. };
  15339. return __assign.apply(this, arguments);
  15340. };
  15341. Object.defineProperty(exports, "__esModule", { value: true });
  15342. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  15343. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts");
  15344. var ACCEPTABLE_KEYS = new Set();
  15345. // IE11 has no support for new Set with iterable so we need to initialize this by hand
  15346. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY);
  15347. ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY);
  15348. ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY);
  15349. ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY);
  15350. ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY);
  15351. ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY);
  15352. var KEYCODE_MAP = new Map();
  15353. // IE11 has no support for new Map with iterable so we need to initialize this by hand
  15354. KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY);
  15355. KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY);
  15356. KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY);
  15357. KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY);
  15358. KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY);
  15359. KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY);
  15360. var MDCTabBarFoundation = /** @class */function (_super) {
  15361. __extends(MDCTabBarFoundation, _super);
  15362. function MDCTabBarFoundation(adapter) {
  15363. var _this = _super.call(this, __assign({}, MDCTabBarFoundation.defaultAdapter, adapter)) || this;
  15364. _this.useAutomaticActivation_ = false;
  15365. return _this;
  15366. }
  15367. Object.defineProperty(MDCTabBarFoundation, "strings", {
  15368. get: function get() {
  15369. return constants_1.strings;
  15370. },
  15371. enumerable: true,
  15372. configurable: true
  15373. });
  15374. Object.defineProperty(MDCTabBarFoundation, "numbers", {
  15375. get: function get() {
  15376. return constants_1.numbers;
  15377. },
  15378. enumerable: true,
  15379. configurable: true
  15380. });
  15381. Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", {
  15382. get: function get() {
  15383. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15384. return {
  15385. scrollTo: function scrollTo() {
  15386. return undefined;
  15387. },
  15388. incrementScroll: function incrementScroll() {
  15389. return undefined;
  15390. },
  15391. getScrollPosition: function getScrollPosition() {
  15392. return 0;
  15393. },
  15394. getScrollContentWidth: function getScrollContentWidth() {
  15395. return 0;
  15396. },
  15397. getOffsetWidth: function getOffsetWidth() {
  15398. return 0;
  15399. },
  15400. isRTL: function isRTL() {
  15401. return false;
  15402. },
  15403. setActiveTab: function setActiveTab() {
  15404. return undefined;
  15405. },
  15406. activateTabAtIndex: function activateTabAtIndex() {
  15407. return undefined;
  15408. },
  15409. deactivateTabAtIndex: function deactivateTabAtIndex() {
  15410. return undefined;
  15411. },
  15412. focusTabAtIndex: function focusTabAtIndex() {
  15413. return undefined;
  15414. },
  15415. getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() {
  15416. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  15417. },
  15418. getTabDimensionsAtIndex: function getTabDimensionsAtIndex() {
  15419. return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
  15420. },
  15421. getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
  15422. return -1;
  15423. },
  15424. getFocusedTabIndex: function getFocusedTabIndex() {
  15425. return -1;
  15426. },
  15427. getIndexOfTabById: function getIndexOfTabById() {
  15428. return -1;
  15429. },
  15430. getTabListLength: function getTabListLength() {
  15431. return 0;
  15432. },
  15433. notifyTabActivated: function notifyTabActivated() {
  15434. return undefined;
  15435. }
  15436. };
  15437. // tslint:enable:object-literal-sort-keys
  15438. },
  15439. enumerable: true,
  15440. configurable: true
  15441. });
  15442. /**
  15443. * Switches between automatic and manual activation modes.
  15444. * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples.
  15445. */
  15446. MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {
  15447. this.useAutomaticActivation_ = useAutomaticActivation;
  15448. };
  15449. MDCTabBarFoundation.prototype.activateTab = function (index) {
  15450. var previousActiveIndex = this.adapter_.getPreviousActiveTabIndex();
  15451. if (!this.indexIsInRange_(index) || index === previousActiveIndex) {
  15452. return;
  15453. }
  15454. var previousClientRect;
  15455. if (previousActiveIndex !== -1) {
  15456. this.adapter_.deactivateTabAtIndex(previousActiveIndex);
  15457. previousClientRect = this.adapter_.getTabIndicatorClientRectAtIndex(previousActiveIndex);
  15458. }
  15459. this.adapter_.activateTabAtIndex(index, previousClientRect);
  15460. this.scrollIntoView(index);
  15461. this.adapter_.notifyTabActivated(index);
  15462. };
  15463. MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {
  15464. // Get the key from the event
  15465. var key = this.getKeyFromEvent_(evt);
  15466. // Early exit if the event key isn't one of the keyboard navigation keys
  15467. if (key === undefined) {
  15468. return;
  15469. }
  15470. // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple
  15471. if (!this.isActivationKey_(key)) {
  15472. evt.preventDefault();
  15473. }
  15474. if (this.useAutomaticActivation_) {
  15475. if (this.isActivationKey_(key)) {
  15476. return;
  15477. }
  15478. var index = this.determineTargetFromKey_(this.adapter_.getPreviousActiveTabIndex(), key);
  15479. this.adapter_.setActiveTab(index);
  15480. this.scrollIntoView(index);
  15481. } else {
  15482. var focusedTabIndex = this.adapter_.getFocusedTabIndex();
  15483. if (this.isActivationKey_(key)) {
  15484. this.adapter_.setActiveTab(focusedTabIndex);
  15485. } else {
  15486. var index = this.determineTargetFromKey_(focusedTabIndex, key);
  15487. this.adapter_.focusTabAtIndex(index);
  15488. this.scrollIntoView(index);
  15489. }
  15490. }
  15491. };
  15492. /**
  15493. * Handles the MDCTab:interacted event
  15494. */
  15495. MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {
  15496. this.adapter_.setActiveTab(this.adapter_.getIndexOfTabById(evt.detail.tabId));
  15497. };
  15498. /**
  15499. * Scrolls the tab at the given index into view
  15500. * @param index The tab index to make visible
  15501. */
  15502. MDCTabBarFoundation.prototype.scrollIntoView = function (index) {
  15503. // Early exit if the index is out of range
  15504. if (!this.indexIsInRange_(index)) {
  15505. return;
  15506. }
  15507. // Always scroll to 0 if scrolling to the 0th index
  15508. if (index === 0) {
  15509. return this.adapter_.scrollTo(0);
  15510. }
  15511. // Always scroll to the max value if scrolling to the Nth index
  15512. // MDCTabScroller.scrollTo() will never scroll past the max possible value
  15513. if (index === this.adapter_.getTabListLength() - 1) {
  15514. return this.adapter_.scrollTo(this.adapter_.getScrollContentWidth());
  15515. }
  15516. if (this.isRTL_()) {
  15517. return this.scrollIntoViewRTL_(index);
  15518. }
  15519. this.scrollIntoView_(index);
  15520. };
  15521. /**
  15522. * Private method for determining the index of the destination tab based on what key was pressed
  15523. * @param origin The original index from which to determine the destination
  15524. * @param key The name of the key
  15525. */
  15526. MDCTabBarFoundation.prototype.determineTargetFromKey_ = function (origin, key) {
  15527. var isRTL = this.isRTL_();
  15528. var maxIndex = this.adapter_.getTabListLength() - 1;
  15529. var shouldGoToEnd = key === constants_1.strings.END_KEY;
  15530. var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL;
  15531. var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL;
  15532. var index = origin;
  15533. if (shouldGoToEnd) {
  15534. index = maxIndex;
  15535. } else if (shouldDecrement) {
  15536. index -= 1;
  15537. } else if (shouldIncrement) {
  15538. index += 1;
  15539. } else {
  15540. index = 0;
  15541. }
  15542. if (index < 0) {
  15543. index = maxIndex;
  15544. } else if (index > maxIndex) {
  15545. index = 0;
  15546. }
  15547. return index;
  15548. };
  15549. /**
  15550. * Calculates the scroll increment that will make the tab at the given index visible
  15551. * @param index The index of the tab
  15552. * @param nextIndex The index of the next tab
  15553. * @param scrollPosition The current scroll position
  15554. * @param barWidth The width of the Tab Bar
  15555. */
  15556. MDCTabBarFoundation.prototype.calculateScrollIncrement_ = function (index, nextIndex, scrollPosition, barWidth) {
  15557. var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex);
  15558. var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
  15559. var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
  15560. var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  15561. var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  15562. if (nextIndex < index) {
  15563. return Math.min(leftIncrement, 0);
  15564. }
  15565. return Math.max(rightIncrement, 0);
  15566. };
  15567. /**
  15568. * Calculates the scroll increment that will make the tab at the given index visible in RTL
  15569. * @param index The index of the tab
  15570. * @param nextIndex The index of the next tab
  15571. * @param scrollPosition The current scroll position
  15572. * @param barWidth The width of the Tab Bar
  15573. * @param scrollContentWidth The width of the scroll content
  15574. */
  15575. MDCTabBarFoundation.prototype.calculateScrollIncrementRTL_ = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {
  15576. var nextTabDimensions = this.adapter_.getTabDimensionsAtIndex(nextIndex);
  15577. var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;
  15578. var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;
  15579. var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  15580. var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
  15581. if (nextIndex > index) {
  15582. return Math.max(leftIncrement, 0);
  15583. }
  15584. return Math.min(rightIncrement, 0);
  15585. };
  15586. /**
  15587. * Determines the index of the adjacent tab closest to either edge of the Tab Bar
  15588. * @param index The index of the tab
  15589. * @param tabDimensions The dimensions of the tab
  15590. * @param scrollPosition The current scroll position
  15591. * @param barWidth The width of the tab bar
  15592. */
  15593. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge_ = function (index, tabDimensions, scrollPosition, barWidth) {
  15594. /**
  15595. * Tabs are laid out in the Tab Scroller like this:
  15596. *
  15597. * Scroll Position
  15598. * +---+
  15599. * | | Bar Width
  15600. * | +-----------------------------------+
  15601. * | | |
  15602. * | V V
  15603. * | +-----------------------------------+
  15604. * V | Tab Scroller |
  15605. * +------------+--------------+-------------------+
  15606. * | Tab | Tab | Tab |
  15607. * +------------+--------------+-------------------+
  15608. * | |
  15609. * +-----------------------------------+
  15610. *
  15611. * To determine the next adjacent index, we look at the Tab root left and
  15612. * Tab root right, both relative to the scroll position. If the Tab root
  15613. * left is less than 0, then we know it's out of view to the left. If the
  15614. * Tab root right minus the bar width is greater than 0, we know the Tab is
  15615. * out of view to the right. From there, we either increment or decrement
  15616. * the index.
  15617. */
  15618. var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
  15619. var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
  15620. var relativeRootDelta = relativeRootLeft + relativeRootRight;
  15621. var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
  15622. var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
  15623. if (leftEdgeIsCloser) {
  15624. return index - 1;
  15625. }
  15626. if (rightEdgeIsCloser) {
  15627. return index + 1;
  15628. }
  15629. return -1;
  15630. };
  15631. /**
  15632. * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL
  15633. * @param index The index of the tab
  15634. * @param tabDimensions The dimensions of the tab
  15635. * @param scrollPosition The current scroll position
  15636. * @param barWidth The width of the tab bar
  15637. * @param scrollContentWidth The width of the scroller content
  15638. */
  15639. MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL_ = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {
  15640. var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;
  15641. var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;
  15642. var rootDelta = rootLeft + rootRight;
  15643. var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;
  15644. var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;
  15645. if (leftEdgeIsCloser) {
  15646. return index + 1;
  15647. }
  15648. if (rightEdgeIsCloser) {
  15649. return index - 1;
  15650. }
  15651. return -1;
  15652. };
  15653. /**
  15654. * Returns the key associated with a keydown event
  15655. * @param evt The keydown event
  15656. */
  15657. MDCTabBarFoundation.prototype.getKeyFromEvent_ = function (evt) {
  15658. if (ACCEPTABLE_KEYS.has(evt.key)) {
  15659. return evt.key;
  15660. }
  15661. return KEYCODE_MAP.get(evt.keyCode);
  15662. };
  15663. MDCTabBarFoundation.prototype.isActivationKey_ = function (key) {
  15664. return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY;
  15665. };
  15666. /**
  15667. * Returns whether a given index is inclusively between the ends
  15668. * @param index The index to test
  15669. */
  15670. MDCTabBarFoundation.prototype.indexIsInRange_ = function (index) {
  15671. return index >= 0 && index < this.adapter_.getTabListLength();
  15672. };
  15673. /**
  15674. * Returns the view's RTL property
  15675. */
  15676. MDCTabBarFoundation.prototype.isRTL_ = function () {
  15677. return this.adapter_.isRTL();
  15678. };
  15679. /**
  15680. * Scrolls the tab at the given index into view for left-to-right user agents.
  15681. * @param index The index of the tab to scroll into view
  15682. */
  15683. MDCTabBarFoundation.prototype.scrollIntoView_ = function (index) {
  15684. var scrollPosition = this.adapter_.getScrollPosition();
  15685. var barWidth = this.adapter_.getOffsetWidth();
  15686. var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index);
  15687. var nextIndex = this.findAdjacentTabIndexClosestToEdge_(index, tabDimensions, scrollPosition, barWidth);
  15688. if (!this.indexIsInRange_(nextIndex)) {
  15689. return;
  15690. }
  15691. var scrollIncrement = this.calculateScrollIncrement_(index, nextIndex, scrollPosition, barWidth);
  15692. this.adapter_.incrementScroll(scrollIncrement);
  15693. };
  15694. /**
  15695. * Scrolls the tab at the given index into view in RTL
  15696. * @param index The tab index to make visible
  15697. */
  15698. MDCTabBarFoundation.prototype.scrollIntoViewRTL_ = function (index) {
  15699. var scrollPosition = this.adapter_.getScrollPosition();
  15700. var barWidth = this.adapter_.getOffsetWidth();
  15701. var tabDimensions = this.adapter_.getTabDimensionsAtIndex(index);
  15702. var scrollWidth = this.adapter_.getScrollContentWidth();
  15703. var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL_(index, tabDimensions, scrollPosition, barWidth, scrollWidth);
  15704. if (!this.indexIsInRange_(nextIndex)) {
  15705. return;
  15706. }
  15707. var scrollIncrement = this.calculateScrollIncrementRTL_(index, nextIndex, scrollPosition, barWidth, scrollWidth);
  15708. this.adapter_.incrementScroll(scrollIncrement);
  15709. };
  15710. return MDCTabBarFoundation;
  15711. }(foundation_1.MDCFoundation);
  15712. exports.MDCTabBarFoundation = MDCTabBarFoundation;
  15713. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  15714. exports.default = MDCTabBarFoundation;
  15715. /***/ }),
  15716. /***/ "./packages/mdc-tab-bar/index.ts":
  15717. /*!***************************************!*\
  15718. !*** ./packages/mdc-tab-bar/index.ts ***!
  15719. \***************************************/
  15720. /*! no static exports found */
  15721. /***/ (function(module, exports, __webpack_require__) {
  15722. "use strict";
  15723. /**
  15724. * @license
  15725. * Copyright 2019 Google Inc.
  15726. *
  15727. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15728. * of this software and associated documentation files (the "Software"), to deal
  15729. * in the Software without restriction, including without limitation the rights
  15730. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15731. * copies of the Software, and to permit persons to whom the Software is
  15732. * furnished to do so, subject to the following conditions:
  15733. *
  15734. * The above copyright notice and this permission notice shall be included in
  15735. * all copies or substantial portions of the Software.
  15736. *
  15737. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15738. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15739. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15740. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15741. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15742. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15743. * THE SOFTWARE.
  15744. */
  15745. function __export(m) {
  15746. for (var p in m) {
  15747. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  15748. }
  15749. }
  15750. Object.defineProperty(exports, "__esModule", { value: true });
  15751. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-bar/component.ts"));
  15752. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-bar/constants.ts"));
  15753. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-bar/foundation.ts"));
  15754. /***/ }),
  15755. /***/ "./packages/mdc-tab-indicator/component.ts":
  15756. /*!*************************************************!*\
  15757. !*** ./packages/mdc-tab-indicator/component.ts ***!
  15758. \*************************************************/
  15759. /*! no static exports found */
  15760. /***/ (function(module, exports, __webpack_require__) {
  15761. "use strict";
  15762. /**
  15763. * @license
  15764. * Copyright 2018 Google Inc.
  15765. *
  15766. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15767. * of this software and associated documentation files (the "Software"), to deal
  15768. * in the Software without restriction, including without limitation the rights
  15769. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15770. * copies of the Software, and to permit persons to whom the Software is
  15771. * furnished to do so, subject to the following conditions:
  15772. *
  15773. * The above copyright notice and this permission notice shall be included in
  15774. * all copies or substantial portions of the Software.
  15775. *
  15776. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15777. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15778. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15779. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15780. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15781. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15782. * THE SOFTWARE.
  15783. */
  15784. var __extends = this && this.__extends || function () {
  15785. var _extendStatics = function extendStatics(d, b) {
  15786. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15787. d.__proto__ = b;
  15788. } || function (d, b) {
  15789. for (var p in b) {
  15790. if (b.hasOwnProperty(p)) d[p] = b[p];
  15791. }
  15792. };
  15793. return _extendStatics(d, b);
  15794. };
  15795. return function (d, b) {
  15796. _extendStatics(d, b);
  15797. function __() {
  15798. this.constructor = d;
  15799. }
  15800. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15801. };
  15802. }();
  15803. Object.defineProperty(exports, "__esModule", { value: true });
  15804. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  15805. var fading_foundation_1 = __webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts");
  15806. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  15807. var sliding_foundation_1 = __webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts");
  15808. var MDCTabIndicator = /** @class */function (_super) {
  15809. __extends(MDCTabIndicator, _super);
  15810. function MDCTabIndicator() {
  15811. return _super !== null && _super.apply(this, arguments) || this;
  15812. }
  15813. MDCTabIndicator.attachTo = function (root) {
  15814. return new MDCTabIndicator(root);
  15815. };
  15816. MDCTabIndicator.prototype.initialize = function () {
  15817. this.content_ = this.root_.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);
  15818. };
  15819. MDCTabIndicator.prototype.computeContentClientRect = function () {
  15820. return this.foundation_.computeContentClientRect();
  15821. };
  15822. MDCTabIndicator.prototype.getDefaultFoundation = function () {
  15823. var _this = this;
  15824. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  15825. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  15826. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  15827. var adapter = {
  15828. addClass: function addClass(className) {
  15829. return _this.root_.classList.add(className);
  15830. },
  15831. removeClass: function removeClass(className) {
  15832. return _this.root_.classList.remove(className);
  15833. },
  15834. computeContentClientRect: function computeContentClientRect() {
  15835. return _this.content_.getBoundingClientRect();
  15836. },
  15837. setContentStyleProperty: function setContentStyleProperty(prop, value) {
  15838. return _this.content_.style.setProperty(prop, value);
  15839. }
  15840. };
  15841. // tslint:enable:object-literal-sort-keys
  15842. if (this.root_.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasses.FADE)) {
  15843. return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter);
  15844. }
  15845. // Default to the sliding indicator
  15846. return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter);
  15847. };
  15848. MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {
  15849. this.foundation_.activate(previousIndicatorClientRect);
  15850. };
  15851. MDCTabIndicator.prototype.deactivate = function () {
  15852. this.foundation_.deactivate();
  15853. };
  15854. return MDCTabIndicator;
  15855. }(component_1.MDCComponent);
  15856. exports.MDCTabIndicator = MDCTabIndicator;
  15857. /***/ }),
  15858. /***/ "./packages/mdc-tab-indicator/constants.ts":
  15859. /*!*************************************************!*\
  15860. !*** ./packages/mdc-tab-indicator/constants.ts ***!
  15861. \*************************************************/
  15862. /*! no static exports found */
  15863. /***/ (function(module, exports, __webpack_require__) {
  15864. "use strict";
  15865. /**
  15866. * @license
  15867. * Copyright 2018 Google Inc.
  15868. *
  15869. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15870. * of this software and associated documentation files (the "Software"), to deal
  15871. * in the Software without restriction, including without limitation the rights
  15872. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15873. * copies of the Software, and to permit persons to whom the Software is
  15874. * furnished to do so, subject to the following conditions:
  15875. *
  15876. * The above copyright notice and this permission notice shall be included in
  15877. * all copies or substantial portions of the Software.
  15878. *
  15879. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15880. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15881. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15882. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15883. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15884. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15885. * THE SOFTWARE.
  15886. */
  15887. Object.defineProperty(exports, "__esModule", { value: true });
  15888. var cssClasses = {
  15889. ACTIVE: 'mdc-tab-indicator--active',
  15890. FADE: 'mdc-tab-indicator--fade',
  15891. NO_TRANSITION: 'mdc-tab-indicator--no-transition'
  15892. };
  15893. exports.cssClasses = cssClasses;
  15894. var strings = {
  15895. CONTENT_SELECTOR: '.mdc-tab-indicator__content'
  15896. };
  15897. exports.strings = strings;
  15898. /***/ }),
  15899. /***/ "./packages/mdc-tab-indicator/fading-foundation.ts":
  15900. /*!*********************************************************!*\
  15901. !*** ./packages/mdc-tab-indicator/fading-foundation.ts ***!
  15902. \*********************************************************/
  15903. /*! no static exports found */
  15904. /***/ (function(module, exports, __webpack_require__) {
  15905. "use strict";
  15906. /**
  15907. * @license
  15908. * Copyright 2018 Google Inc.
  15909. *
  15910. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15911. * of this software and associated documentation files (the "Software"), to deal
  15912. * in the Software without restriction, including without limitation the rights
  15913. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15914. * copies of the Software, and to permit persons to whom the Software is
  15915. * furnished to do so, subject to the following conditions:
  15916. *
  15917. * The above copyright notice and this permission notice shall be included in
  15918. * all copies or substantial portions of the Software.
  15919. *
  15920. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15921. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15922. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15923. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15924. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15925. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15926. * THE SOFTWARE.
  15927. */
  15928. var __extends = this && this.__extends || function () {
  15929. var _extendStatics = function extendStatics(d, b) {
  15930. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15931. d.__proto__ = b;
  15932. } || function (d, b) {
  15933. for (var p in b) {
  15934. if (b.hasOwnProperty(p)) d[p] = b[p];
  15935. }
  15936. };
  15937. return _extendStatics(d, b);
  15938. };
  15939. return function (d, b) {
  15940. _extendStatics(d, b);
  15941. function __() {
  15942. this.constructor = d;
  15943. }
  15944. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15945. };
  15946. }();
  15947. Object.defineProperty(exports, "__esModule", { value: true });
  15948. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  15949. /* istanbul ignore next: subclass is not a branch statement */
  15950. var MDCFadingTabIndicatorFoundation = /** @class */function (_super) {
  15951. __extends(MDCFadingTabIndicatorFoundation, _super);
  15952. function MDCFadingTabIndicatorFoundation() {
  15953. return _super !== null && _super.apply(this, arguments) || this;
  15954. }
  15955. MDCFadingTabIndicatorFoundation.prototype.activate = function () {
  15956. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  15957. };
  15958. MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {
  15959. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  15960. };
  15961. return MDCFadingTabIndicatorFoundation;
  15962. }(foundation_1.MDCTabIndicatorFoundation);
  15963. exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation;
  15964. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  15965. exports.default = MDCFadingTabIndicatorFoundation;
  15966. /***/ }),
  15967. /***/ "./packages/mdc-tab-indicator/foundation.ts":
  15968. /*!**************************************************!*\
  15969. !*** ./packages/mdc-tab-indicator/foundation.ts ***!
  15970. \**************************************************/
  15971. /*! no static exports found */
  15972. /***/ (function(module, exports, __webpack_require__) {
  15973. "use strict";
  15974. /**
  15975. * @license
  15976. * Copyright 2018 Google Inc.
  15977. *
  15978. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15979. * of this software and associated documentation files (the "Software"), to deal
  15980. * in the Software without restriction, including without limitation the rights
  15981. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15982. * copies of the Software, and to permit persons to whom the Software is
  15983. * furnished to do so, subject to the following conditions:
  15984. *
  15985. * The above copyright notice and this permission notice shall be included in
  15986. * all copies or substantial portions of the Software.
  15987. *
  15988. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15989. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15990. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15991. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15992. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15993. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  15994. * THE SOFTWARE.
  15995. */
  15996. var __extends = this && this.__extends || function () {
  15997. var _extendStatics = function extendStatics(d, b) {
  15998. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15999. d.__proto__ = b;
  16000. } || function (d, b) {
  16001. for (var p in b) {
  16002. if (b.hasOwnProperty(p)) d[p] = b[p];
  16003. }
  16004. };
  16005. return _extendStatics(d, b);
  16006. };
  16007. return function (d, b) {
  16008. _extendStatics(d, b);
  16009. function __() {
  16010. this.constructor = d;
  16011. }
  16012. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16013. };
  16014. }();
  16015. var __assign = this && this.__assign || function () {
  16016. __assign = Object.assign || function (t) {
  16017. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16018. s = arguments[i];
  16019. for (var p in s) {
  16020. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16021. }
  16022. }
  16023. return t;
  16024. };
  16025. return __assign.apply(this, arguments);
  16026. };
  16027. Object.defineProperty(exports, "__esModule", { value: true });
  16028. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  16029. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts");
  16030. var MDCTabIndicatorFoundation = /** @class */function (_super) {
  16031. __extends(MDCTabIndicatorFoundation, _super);
  16032. function MDCTabIndicatorFoundation(adapter) {
  16033. return _super.call(this, __assign({}, MDCTabIndicatorFoundation.defaultAdapter, adapter)) || this;
  16034. }
  16035. Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", {
  16036. get: function get() {
  16037. return constants_1.cssClasses;
  16038. },
  16039. enumerable: true,
  16040. configurable: true
  16041. });
  16042. Object.defineProperty(MDCTabIndicatorFoundation, "strings", {
  16043. get: function get() {
  16044. return constants_1.strings;
  16045. },
  16046. enumerable: true,
  16047. configurable: true
  16048. });
  16049. Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", {
  16050. get: function get() {
  16051. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16052. return {
  16053. addClass: function addClass() {
  16054. return undefined;
  16055. },
  16056. removeClass: function removeClass() {
  16057. return undefined;
  16058. },
  16059. computeContentClientRect: function computeContentClientRect() {
  16060. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  16061. },
  16062. setContentStyleProperty: function setContentStyleProperty() {
  16063. return undefined;
  16064. }
  16065. };
  16066. // tslint:enable:object-literal-sort-keys
  16067. },
  16068. enumerable: true,
  16069. configurable: true
  16070. });
  16071. MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {
  16072. return this.adapter_.computeContentClientRect();
  16073. };
  16074. return MDCTabIndicatorFoundation;
  16075. }(foundation_1.MDCFoundation);
  16076. exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation;
  16077. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16078. exports.default = MDCTabIndicatorFoundation;
  16079. /***/ }),
  16080. /***/ "./packages/mdc-tab-indicator/index.ts":
  16081. /*!*********************************************!*\
  16082. !*** ./packages/mdc-tab-indicator/index.ts ***!
  16083. \*********************************************/
  16084. /*! no static exports found */
  16085. /***/ (function(module, exports, __webpack_require__) {
  16086. "use strict";
  16087. /**
  16088. * @license
  16089. * Copyright 2019 Google Inc.
  16090. *
  16091. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16092. * of this software and associated documentation files (the "Software"), to deal
  16093. * in the Software without restriction, including without limitation the rights
  16094. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16095. * copies of the Software, and to permit persons to whom the Software is
  16096. * furnished to do so, subject to the following conditions:
  16097. *
  16098. * The above copyright notice and this permission notice shall be included in
  16099. * all copies or substantial portions of the Software.
  16100. *
  16101. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16102. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16103. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16104. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16105. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16106. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16107. * THE SOFTWARE.
  16108. */
  16109. function __export(m) {
  16110. for (var p in m) {
  16111. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16112. }
  16113. }
  16114. Object.defineProperty(exports, "__esModule", { value: true });
  16115. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-indicator/component.ts"));
  16116. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-indicator/constants.ts"));
  16117. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts"));
  16118. __export(__webpack_require__(/*! ./fading-foundation */ "./packages/mdc-tab-indicator/fading-foundation.ts"));
  16119. __export(__webpack_require__(/*! ./sliding-foundation */ "./packages/mdc-tab-indicator/sliding-foundation.ts"));
  16120. /***/ }),
  16121. /***/ "./packages/mdc-tab-indicator/sliding-foundation.ts":
  16122. /*!**********************************************************!*\
  16123. !*** ./packages/mdc-tab-indicator/sliding-foundation.ts ***!
  16124. \**********************************************************/
  16125. /*! no static exports found */
  16126. /***/ (function(module, exports, __webpack_require__) {
  16127. "use strict";
  16128. /**
  16129. * @license
  16130. * Copyright 2018 Google Inc.
  16131. *
  16132. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16133. * of this software and associated documentation files (the "Software"), to deal
  16134. * in the Software without restriction, including without limitation the rights
  16135. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16136. * copies of the Software, and to permit persons to whom the Software is
  16137. * furnished to do so, subject to the following conditions:
  16138. *
  16139. * The above copyright notice and this permission notice shall be included in
  16140. * all copies or substantial portions of the Software.
  16141. *
  16142. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16143. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16144. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16145. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16146. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16147. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16148. * THE SOFTWARE.
  16149. */
  16150. var __extends = this && this.__extends || function () {
  16151. var _extendStatics = function extendStatics(d, b) {
  16152. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16153. d.__proto__ = b;
  16154. } || function (d, b) {
  16155. for (var p in b) {
  16156. if (b.hasOwnProperty(p)) d[p] = b[p];
  16157. }
  16158. };
  16159. return _extendStatics(d, b);
  16160. };
  16161. return function (d, b) {
  16162. _extendStatics(d, b);
  16163. function __() {
  16164. this.constructor = d;
  16165. }
  16166. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16167. };
  16168. }();
  16169. Object.defineProperty(exports, "__esModule", { value: true });
  16170. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-indicator/foundation.ts");
  16171. /* istanbul ignore next: subclass is not a branch statement */
  16172. var MDCSlidingTabIndicatorFoundation = /** @class */function (_super) {
  16173. __extends(MDCSlidingTabIndicatorFoundation, _super);
  16174. function MDCSlidingTabIndicatorFoundation() {
  16175. return _super !== null && _super.apply(this, arguments) || this;
  16176. }
  16177. MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {
  16178. // Early exit if no indicator is present to handle cases where an indicator
  16179. // may be activated without a prior indicator state
  16180. if (!previousIndicatorClientRect) {
  16181. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16182. return;
  16183. }
  16184. // This animation uses the FLIP approach. You can read more about it at the link below:
  16185. // https://aerotwist.com/blog/flip-your-animations/
  16186. // Calculate the dimensions based on the dimensions of the previous indicator
  16187. var currentClientRect = this.computeContentClientRect();
  16188. var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
  16189. var xPosition = previousIndicatorClientRect.left - currentClientRect.left;
  16190. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  16191. this.adapter_.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")");
  16192. // Force repaint before updating classes and transform to ensure the transform properly takes effect
  16193. this.computeContentClientRect();
  16194. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
  16195. this.adapter_.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16196. this.adapter_.setContentStyleProperty('transform', '');
  16197. };
  16198. MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {
  16199. this.adapter_.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
  16200. };
  16201. return MDCSlidingTabIndicatorFoundation;
  16202. }(foundation_1.MDCTabIndicatorFoundation);
  16203. exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation;
  16204. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16205. exports.default = MDCSlidingTabIndicatorFoundation;
  16206. /***/ }),
  16207. /***/ "./packages/mdc-tab-scroller/component.ts":
  16208. /*!************************************************!*\
  16209. !*** ./packages/mdc-tab-scroller/component.ts ***!
  16210. \************************************************/
  16211. /*! no static exports found */
  16212. /***/ (function(module, exports, __webpack_require__) {
  16213. "use strict";
  16214. /**
  16215. * @license
  16216. * Copyright 2018 Google Inc.
  16217. *
  16218. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16219. * of this software and associated documentation files (the "Software"), to deal
  16220. * in the Software without restriction, including without limitation the rights
  16221. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16222. * copies of the Software, and to permit persons to whom the Software is
  16223. * furnished to do so, subject to the following conditions:
  16224. *
  16225. * The above copyright notice and this permission notice shall be included in
  16226. * all copies or substantial portions of the Software.
  16227. *
  16228. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16229. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16230. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16231. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16232. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16233. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16234. * THE SOFTWARE.
  16235. */
  16236. var __extends = this && this.__extends || function () {
  16237. var _extendStatics = function extendStatics(d, b) {
  16238. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16239. d.__proto__ = b;
  16240. } || function (d, b) {
  16241. for (var p in b) {
  16242. if (b.hasOwnProperty(p)) d[p] = b[p];
  16243. }
  16244. };
  16245. return _extendStatics(d, b);
  16246. };
  16247. return function (d, b) {
  16248. _extendStatics(d, b);
  16249. function __() {
  16250. this.constructor = d;
  16251. }
  16252. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16253. };
  16254. }();
  16255. var __importStar = this && this.__importStar || function (mod) {
  16256. if (mod && mod.__esModule) return mod;
  16257. var result = {};
  16258. if (mod != null) for (var k in mod) {
  16259. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  16260. }result["default"] = mod;
  16261. return result;
  16262. };
  16263. Object.defineProperty(exports, "__esModule", { value: true });
  16264. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  16265. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  16266. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  16267. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts");
  16268. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  16269. var MDCTabScroller = /** @class */function (_super) {
  16270. __extends(MDCTabScroller, _super);
  16271. function MDCTabScroller() {
  16272. return _super !== null && _super.apply(this, arguments) || this;
  16273. }
  16274. MDCTabScroller.attachTo = function (root) {
  16275. return new MDCTabScroller(root);
  16276. };
  16277. MDCTabScroller.prototype.initialize = function () {
  16278. this.area_ = this.root_.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR);
  16279. this.content_ = this.root_.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);
  16280. };
  16281. MDCTabScroller.prototype.initialSyncWithDOM = function () {
  16282. var _this = this;
  16283. this.handleInteraction_ = function () {
  16284. return _this.foundation_.handleInteraction();
  16285. };
  16286. this.handleTransitionEnd_ = function (evt) {
  16287. return _this.foundation_.handleTransitionEnd(evt);
  16288. };
  16289. this.area_.addEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  16290. this.area_.addEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  16291. this.area_.addEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  16292. this.area_.addEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  16293. this.area_.addEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  16294. this.content_.addEventListener('transitionend', this.handleTransitionEnd_);
  16295. };
  16296. MDCTabScroller.prototype.destroy = function () {
  16297. _super.prototype.destroy.call(this);
  16298. this.area_.removeEventListener('wheel', this.handleInteraction_, events_1.applyPassive());
  16299. this.area_.removeEventListener('touchstart', this.handleInteraction_, events_1.applyPassive());
  16300. this.area_.removeEventListener('pointerdown', this.handleInteraction_, events_1.applyPassive());
  16301. this.area_.removeEventListener('mousedown', this.handleInteraction_, events_1.applyPassive());
  16302. this.area_.removeEventListener('keydown', this.handleInteraction_, events_1.applyPassive());
  16303. this.content_.removeEventListener('transitionend', this.handleTransitionEnd_);
  16304. };
  16305. MDCTabScroller.prototype.getDefaultFoundation = function () {
  16306. var _this = this;
  16307. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  16308. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  16309. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16310. var adapter = {
  16311. eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) {
  16312. return ponyfill_1.matches(evtTarget, selector);
  16313. },
  16314. addClass: function addClass(className) {
  16315. return _this.root_.classList.add(className);
  16316. },
  16317. removeClass: function removeClass(className) {
  16318. return _this.root_.classList.remove(className);
  16319. },
  16320. addScrollAreaClass: function addScrollAreaClass(className) {
  16321. return _this.area_.classList.add(className);
  16322. },
  16323. setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) {
  16324. return _this.area_.style.setProperty(prop, value);
  16325. },
  16326. setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) {
  16327. return _this.content_.style.setProperty(prop, value);
  16328. },
  16329. getScrollContentStyleValue: function getScrollContentStyleValue(propName) {
  16330. return window.getComputedStyle(_this.content_).getPropertyValue(propName);
  16331. },
  16332. setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) {
  16333. return _this.area_.scrollLeft = scrollX;
  16334. },
  16335. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  16336. return _this.area_.scrollLeft;
  16337. },
  16338. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  16339. return _this.content_.offsetWidth;
  16340. },
  16341. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  16342. return _this.area_.offsetWidth;
  16343. },
  16344. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  16345. return _this.area_.getBoundingClientRect();
  16346. },
  16347. computeScrollContentClientRect: function computeScrollContentClientRect() {
  16348. return _this.content_.getBoundingClientRect();
  16349. },
  16350. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  16351. return util.computeHorizontalScrollbarHeight(document);
  16352. }
  16353. };
  16354. // tslint:enable:object-literal-sort-keys
  16355. return new foundation_1.MDCTabScrollerFoundation(adapter);
  16356. };
  16357. /**
  16358. * Returns the current visual scroll position
  16359. */
  16360. MDCTabScroller.prototype.getScrollPosition = function () {
  16361. return this.foundation_.getScrollPosition();
  16362. };
  16363. /**
  16364. * Returns the width of the scroll content
  16365. */
  16366. MDCTabScroller.prototype.getScrollContentWidth = function () {
  16367. return this.content_.offsetWidth;
  16368. };
  16369. /**
  16370. * Increments the scroll value by the given amount
  16371. * @param scrollXIncrement The pixel value by which to increment the scroll value
  16372. */
  16373. MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {
  16374. this.foundation_.incrementScroll(scrollXIncrement);
  16375. };
  16376. /**
  16377. * Scrolls to the given pixel position
  16378. * @param scrollX The pixel value to scroll to
  16379. */
  16380. MDCTabScroller.prototype.scrollTo = function (scrollX) {
  16381. this.foundation_.scrollTo(scrollX);
  16382. };
  16383. return MDCTabScroller;
  16384. }(component_1.MDCComponent);
  16385. exports.MDCTabScroller = MDCTabScroller;
  16386. /***/ }),
  16387. /***/ "./packages/mdc-tab-scroller/constants.ts":
  16388. /*!************************************************!*\
  16389. !*** ./packages/mdc-tab-scroller/constants.ts ***!
  16390. \************************************************/
  16391. /*! no static exports found */
  16392. /***/ (function(module, exports, __webpack_require__) {
  16393. "use strict";
  16394. /**
  16395. * @license
  16396. * Copyright 2018 Google Inc.
  16397. *
  16398. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16399. * of this software and associated documentation files (the "Software"), to deal
  16400. * in the Software without restriction, including without limitation the rights
  16401. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16402. * copies of the Software, and to permit persons to whom the Software is
  16403. * furnished to do so, subject to the following conditions:
  16404. *
  16405. * The above copyright notice and this permission notice shall be included in
  16406. * all copies or substantial portions of the Software.
  16407. *
  16408. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16409. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16410. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16411. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16412. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16413. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16414. * THE SOFTWARE.
  16415. */
  16416. Object.defineProperty(exports, "__esModule", { value: true });
  16417. var cssClasses = {
  16418. ANIMATING: 'mdc-tab-scroller--animating',
  16419. SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',
  16420. SCROLL_TEST: 'mdc-tab-scroller__test'
  16421. };
  16422. exports.cssClasses = cssClasses;
  16423. var strings = {
  16424. AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',
  16425. CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content'
  16426. };
  16427. exports.strings = strings;
  16428. /***/ }),
  16429. /***/ "./packages/mdc-tab-scroller/foundation.ts":
  16430. /*!*************************************************!*\
  16431. !*** ./packages/mdc-tab-scroller/foundation.ts ***!
  16432. \*************************************************/
  16433. /*! no static exports found */
  16434. /***/ (function(module, exports, __webpack_require__) {
  16435. "use strict";
  16436. /**
  16437. * @license
  16438. * Copyright 2018 Google Inc.
  16439. *
  16440. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16441. * of this software and associated documentation files (the "Software"), to deal
  16442. * in the Software without restriction, including without limitation the rights
  16443. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16444. * copies of the Software, and to permit persons to whom the Software is
  16445. * furnished to do so, subject to the following conditions:
  16446. *
  16447. * The above copyright notice and this permission notice shall be included in
  16448. * all copies or substantial portions of the Software.
  16449. *
  16450. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16451. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16452. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16453. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16454. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16455. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16456. * THE SOFTWARE.
  16457. */
  16458. var __extends = this && this.__extends || function () {
  16459. var _extendStatics = function extendStatics(d, b) {
  16460. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16461. d.__proto__ = b;
  16462. } || function (d, b) {
  16463. for (var p in b) {
  16464. if (b.hasOwnProperty(p)) d[p] = b[p];
  16465. }
  16466. };
  16467. return _extendStatics(d, b);
  16468. };
  16469. return function (d, b) {
  16470. _extendStatics(d, b);
  16471. function __() {
  16472. this.constructor = d;
  16473. }
  16474. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16475. };
  16476. }();
  16477. var __assign = this && this.__assign || function () {
  16478. __assign = Object.assign || function (t) {
  16479. for (var s, i = 1, n = arguments.length; i < n; i++) {
  16480. s = arguments[i];
  16481. for (var p in s) {
  16482. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  16483. }
  16484. }
  16485. return t;
  16486. };
  16487. return __assign.apply(this, arguments);
  16488. };
  16489. var __read = this && this.__read || function (o, n) {
  16490. var m = typeof Symbol === "function" && o[Symbol.iterator];
  16491. if (!m) return o;
  16492. var i = m.call(o),
  16493. r,
  16494. ar = [],
  16495. e;
  16496. try {
  16497. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  16498. ar.push(r.value);
  16499. }
  16500. } catch (error) {
  16501. e = { error: error };
  16502. } finally {
  16503. try {
  16504. if (r && !r.done && (m = i["return"])) m.call(i);
  16505. } finally {
  16506. if (e) throw e.error;
  16507. }
  16508. }
  16509. return ar;
  16510. };
  16511. Object.defineProperty(exports, "__esModule", { value: true });
  16512. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  16513. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  16514. var rtl_default_scroller_1 = __webpack_require__(/*! ./rtl-default-scroller */ "./packages/mdc-tab-scroller/rtl-default-scroller.ts");
  16515. var rtl_negative_scroller_1 = __webpack_require__(/*! ./rtl-negative-scroller */ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts");
  16516. var rtl_reverse_scroller_1 = __webpack_require__(/*! ./rtl-reverse-scroller */ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts");
  16517. var MDCTabScrollerFoundation = /** @class */function (_super) {
  16518. __extends(MDCTabScrollerFoundation, _super);
  16519. function MDCTabScrollerFoundation(adapter) {
  16520. var _this = _super.call(this, __assign({}, MDCTabScrollerFoundation.defaultAdapter, adapter)) || this;
  16521. /**
  16522. * Controls whether we should handle the transitionend and interaction events during the animation.
  16523. */
  16524. _this.isAnimating_ = false;
  16525. return _this;
  16526. }
  16527. Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", {
  16528. get: function get() {
  16529. return constants_1.cssClasses;
  16530. },
  16531. enumerable: true,
  16532. configurable: true
  16533. });
  16534. Object.defineProperty(MDCTabScrollerFoundation, "strings", {
  16535. get: function get() {
  16536. return constants_1.strings;
  16537. },
  16538. enumerable: true,
  16539. configurable: true
  16540. });
  16541. Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", {
  16542. get: function get() {
  16543. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  16544. return {
  16545. eventTargetMatchesSelector: function eventTargetMatchesSelector() {
  16546. return false;
  16547. },
  16548. addClass: function addClass() {
  16549. return undefined;
  16550. },
  16551. removeClass: function removeClass() {
  16552. return undefined;
  16553. },
  16554. addScrollAreaClass: function addScrollAreaClass() {
  16555. return undefined;
  16556. },
  16557. setScrollAreaStyleProperty: function setScrollAreaStyleProperty() {
  16558. return undefined;
  16559. },
  16560. setScrollContentStyleProperty: function setScrollContentStyleProperty() {
  16561. return undefined;
  16562. },
  16563. getScrollContentStyleValue: function getScrollContentStyleValue() {
  16564. return '';
  16565. },
  16566. setScrollAreaScrollLeft: function setScrollAreaScrollLeft() {
  16567. return undefined;
  16568. },
  16569. getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
  16570. return 0;
  16571. },
  16572. getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
  16573. return 0;
  16574. },
  16575. getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
  16576. return 0;
  16577. },
  16578. computeScrollAreaClientRect: function computeScrollAreaClientRect() {
  16579. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  16580. },
  16581. computeScrollContentClientRect: function computeScrollContentClientRect() {
  16582. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  16583. },
  16584. computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
  16585. return 0;
  16586. }
  16587. };
  16588. // tslint:enable:object-literal-sort-keys
  16589. },
  16590. enumerable: true,
  16591. configurable: true
  16592. });
  16593. MDCTabScrollerFoundation.prototype.init = function () {
  16594. // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll
  16595. // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs.
  16596. var horizontalScrollbarHeight = this.adapter_.computeHorizontalScrollbarHeight();
  16597. this.adapter_.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');
  16598. this.adapter_.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);
  16599. };
  16600. /**
  16601. * Computes the current visual scroll position
  16602. */
  16603. MDCTabScrollerFoundation.prototype.getScrollPosition = function () {
  16604. if (this.isRTL_()) {
  16605. return this.computeCurrentScrollPositionRTL_();
  16606. }
  16607. var currentTranslateX = this.calculateCurrentTranslateX_();
  16608. var scrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16609. return scrollLeft - currentTranslateX;
  16610. };
  16611. /**
  16612. * Handles interaction events that occur during transition
  16613. */
  16614. MDCTabScrollerFoundation.prototype.handleInteraction = function () {
  16615. // Early exit if we aren't animating
  16616. if (!this.isAnimating_) {
  16617. return;
  16618. }
  16619. // Prevent other event listeners from handling this event
  16620. this.stopScrollAnimation_();
  16621. };
  16622. /**
  16623. * Handles the transitionend event
  16624. */
  16625. MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {
  16626. // Early exit if we aren't animating or the event was triggered by a different element.
  16627. var evtTarget = evt.target;
  16628. if (!this.isAnimating_ || !this.adapter_.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {
  16629. return;
  16630. }
  16631. this.isAnimating_ = false;
  16632. this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  16633. };
  16634. /**
  16635. * Increment the scroll value by the scrollXIncrement using animation.
  16636. * @param scrollXIncrement The value by which to increment the scroll position
  16637. */
  16638. MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {
  16639. // Early exit for non-operational increment values
  16640. if (scrollXIncrement === 0) {
  16641. return;
  16642. }
  16643. this.animate_(this.getIncrementScrollOperation_(scrollXIncrement));
  16644. };
  16645. /**
  16646. * Increment the scroll value by the scrollXIncrement without animation.
  16647. * @param scrollXIncrement The value by which to increment the scroll position
  16648. */
  16649. MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) {
  16650. // Early exit for non-operational increment values
  16651. if (scrollXIncrement === 0) {
  16652. return;
  16653. }
  16654. var operation = this.getIncrementScrollOperation_(scrollXIncrement);
  16655. if (operation.scrollDelta === 0) {
  16656. return;
  16657. }
  16658. this.stopScrollAnimation_();
  16659. this.adapter_.setScrollAreaScrollLeft(operation.finalScrollPosition);
  16660. };
  16661. /**
  16662. * Scrolls to the given scrollX value
  16663. */
  16664. MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {
  16665. if (this.isRTL_()) {
  16666. return this.scrollToRTL_(scrollX);
  16667. }
  16668. this.scrollTo_(scrollX);
  16669. };
  16670. /**
  16671. * @return Browser-specific {@link MDCTabScrollerRTL} instance.
  16672. */
  16673. MDCTabScrollerFoundation.prototype.getRTLScroller = function () {
  16674. if (!this.rtlScrollerInstance_) {
  16675. this.rtlScrollerInstance_ = this.rtlScrollerFactory_();
  16676. }
  16677. return this.rtlScrollerInstance_;
  16678. };
  16679. /**
  16680. * @return translateX value from a CSS matrix transform function string.
  16681. */
  16682. MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX_ = function () {
  16683. var transformValue = this.adapter_.getScrollContentStyleValue('transform');
  16684. // Early exit if no transform is present
  16685. if (transformValue === 'none') {
  16686. return 0;
  16687. }
  16688. // The transform value comes back as a matrix transformation in the form
  16689. // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so
  16690. // we're going to grab all the parenthesized values, strip out tx, and
  16691. // parse it.
  16692. var match = /\((.+?)\)/.exec(transformValue);
  16693. if (!match) {
  16694. return 0;
  16695. }
  16696. var matrixParams = match[1];
  16697. // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error.
  16698. // @ts-ignore These unused variables should retain their semantic names for clarity.
  16699. var _a = __read(matrixParams.split(','), 6),
  16700. a = _a[0],
  16701. b = _a[1],
  16702. c = _a[2],
  16703. d = _a[3],
  16704. tx = _a[4],
  16705. ty = _a[5];
  16706. return parseFloat(tx); // tslint:disable-line:ban
  16707. };
  16708. /**
  16709. * Calculates a safe scroll value that is > 0 and < the max scroll value
  16710. * @param scrollX The distance to scroll
  16711. */
  16712. MDCTabScrollerFoundation.prototype.clampScrollValue_ = function (scrollX) {
  16713. var edges = this.calculateScrollEdges_();
  16714. return Math.min(Math.max(edges.left, scrollX), edges.right);
  16715. };
  16716. MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL_ = function () {
  16717. var translateX = this.calculateCurrentTranslateX_();
  16718. return this.getRTLScroller().getScrollPositionRTL(translateX);
  16719. };
  16720. MDCTabScrollerFoundation.prototype.calculateScrollEdges_ = function () {
  16721. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  16722. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  16723. return {
  16724. left: 0,
  16725. right: contentWidth - rootWidth
  16726. };
  16727. };
  16728. /**
  16729. * Internal scroll method
  16730. * @param scrollX The new scroll position
  16731. */
  16732. MDCTabScrollerFoundation.prototype.scrollTo_ = function (scrollX) {
  16733. var currentScrollX = this.getScrollPosition();
  16734. var safeScrollX = this.clampScrollValue_(scrollX);
  16735. var scrollDelta = safeScrollX - currentScrollX;
  16736. this.animate_({
  16737. finalScrollPosition: safeScrollX,
  16738. scrollDelta: scrollDelta
  16739. });
  16740. };
  16741. /**
  16742. * Internal RTL scroll method
  16743. * @param scrollX The new scroll position
  16744. */
  16745. MDCTabScrollerFoundation.prototype.scrollToRTL_ = function (scrollX) {
  16746. var animation = this.getRTLScroller().scrollToRTL(scrollX);
  16747. this.animate_(animation);
  16748. };
  16749. /**
  16750. * Internal method to compute the increment scroll operation values.
  16751. * @param scrollX The desired scroll position increment
  16752. * @return MDCTabScrollerAnimation with the sanitized values for performing the scroll operation.
  16753. */
  16754. MDCTabScrollerFoundation.prototype.getIncrementScrollOperation_ = function (scrollX) {
  16755. if (this.isRTL_()) {
  16756. return this.getRTLScroller().incrementScrollRTL(scrollX);
  16757. }
  16758. var currentScrollX = this.getScrollPosition();
  16759. var targetScrollX = scrollX + currentScrollX;
  16760. var safeScrollX = this.clampScrollValue_(targetScrollX);
  16761. var scrollDelta = safeScrollX - currentScrollX;
  16762. return {
  16763. finalScrollPosition: safeScrollX,
  16764. scrollDelta: scrollDelta
  16765. };
  16766. };
  16767. /**
  16768. * Animates the tab scrolling
  16769. * @param animation The animation to apply
  16770. */
  16771. MDCTabScrollerFoundation.prototype.animate_ = function (animation) {
  16772. var _this = this;
  16773. // Early exit if translateX is 0, which means there's no animation to perform
  16774. if (animation.scrollDelta === 0) {
  16775. return;
  16776. }
  16777. this.stopScrollAnimation_();
  16778. // This animation uses the FLIP approach.
  16779. // Read more here: https://aerotwist.com/blog/flip-your-animations/
  16780. this.adapter_.setScrollAreaScrollLeft(animation.finalScrollPosition);
  16781. this.adapter_.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)");
  16782. // Force repaint
  16783. this.adapter_.computeScrollAreaClientRect();
  16784. requestAnimationFrame(function () {
  16785. _this.adapter_.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  16786. _this.adapter_.setScrollContentStyleProperty('transform', 'none');
  16787. });
  16788. this.isAnimating_ = true;
  16789. };
  16790. /**
  16791. * Stops scroll animation
  16792. */
  16793. MDCTabScrollerFoundation.prototype.stopScrollAnimation_ = function () {
  16794. this.isAnimating_ = false;
  16795. var currentScrollPosition = this.getAnimatingScrollPosition_();
  16796. this.adapter_.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
  16797. this.adapter_.setScrollContentStyleProperty('transform', 'translateX(0px)');
  16798. this.adapter_.setScrollAreaScrollLeft(currentScrollPosition);
  16799. };
  16800. /**
  16801. * Gets the current scroll position during animation
  16802. */
  16803. MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition_ = function () {
  16804. var currentTranslateX = this.calculateCurrentTranslateX_();
  16805. var scrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16806. if (this.isRTL_()) {
  16807. return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);
  16808. }
  16809. return scrollLeft - currentTranslateX;
  16810. };
  16811. /**
  16812. * Determines the RTL Scroller to use
  16813. */
  16814. MDCTabScrollerFoundation.prototype.rtlScrollerFactory_ = function () {
  16815. // Browsers have three different implementations of scrollLeft in RTL mode,
  16816. // dependent on the browser. The behavior is based off the max LTR
  16817. // scrollLeft value and 0.
  16818. //
  16819. // * Default scrolling in RTL *
  16820. // - Left-most value: 0
  16821. // - Right-most value: Max LTR scrollLeft value
  16822. //
  16823. // * Negative scrolling in RTL *
  16824. // - Left-most value: Negated max LTR scrollLeft value
  16825. // - Right-most value: 0
  16826. //
  16827. // * Reverse scrolling in RTL *
  16828. // - Left-most value: Max LTR scrollLeft value
  16829. // - Right-most value: 0
  16830. //
  16831. // We use those principles below to determine which RTL scrollLeft
  16832. // behavior is implemented in the current browser.
  16833. var initialScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16834. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft - 1);
  16835. var newScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16836. // If the newScrollLeft value is negative,then we know that the browser has
  16837. // implemented negative RTL scrolling, since all other implementations have
  16838. // only positive values.
  16839. if (newScrollLeft < 0) {
  16840. // Undo the scrollLeft test check
  16841. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft);
  16842. return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter_);
  16843. }
  16844. var rootClientRect = this.adapter_.computeScrollAreaClientRect();
  16845. var contentClientRect = this.adapter_.computeScrollContentClientRect();
  16846. var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);
  16847. // Undo the scrollLeft test check
  16848. this.adapter_.setScrollAreaScrollLeft(initialScrollLeft);
  16849. // By calculating the clientRect of the root element and the clientRect of
  16850. // the content element, we can determine how much the scroll value changed
  16851. // when we performed the scrollLeft subtraction above.
  16852. if (rightEdgeDelta === newScrollLeft) {
  16853. return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter_);
  16854. }
  16855. return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter_);
  16856. };
  16857. MDCTabScrollerFoundation.prototype.isRTL_ = function () {
  16858. return this.adapter_.getScrollContentStyleValue('direction') === 'rtl';
  16859. };
  16860. return MDCTabScrollerFoundation;
  16861. }(foundation_1.MDCFoundation);
  16862. exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation;
  16863. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  16864. exports.default = MDCTabScrollerFoundation;
  16865. /***/ }),
  16866. /***/ "./packages/mdc-tab-scroller/index.ts":
  16867. /*!********************************************!*\
  16868. !*** ./packages/mdc-tab-scroller/index.ts ***!
  16869. \********************************************/
  16870. /*! no static exports found */
  16871. /***/ (function(module, exports, __webpack_require__) {
  16872. "use strict";
  16873. /**
  16874. * @license
  16875. * Copyright 2019 Google Inc.
  16876. *
  16877. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16878. * of this software and associated documentation files (the "Software"), to deal
  16879. * in the Software without restriction, including without limitation the rights
  16880. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16881. * copies of the Software, and to permit persons to whom the Software is
  16882. * furnished to do so, subject to the following conditions:
  16883. *
  16884. * The above copyright notice and this permission notice shall be included in
  16885. * all copies or substantial portions of the Software.
  16886. *
  16887. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16888. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16889. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16890. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16891. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16892. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16893. * THE SOFTWARE.
  16894. */
  16895. function __export(m) {
  16896. for (var p in m) {
  16897. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  16898. }
  16899. }
  16900. var __importStar = this && this.__importStar || function (mod) {
  16901. if (mod && mod.__esModule) return mod;
  16902. var result = {};
  16903. if (mod != null) for (var k in mod) {
  16904. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  16905. }result["default"] = mod;
  16906. return result;
  16907. };
  16908. Object.defineProperty(exports, "__esModule", { value: true });
  16909. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-tab-scroller/util.ts"));
  16910. exports.util = util;
  16911. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab-scroller/component.ts"));
  16912. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts"));
  16913. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab-scroller/foundation.ts"));
  16914. /***/ }),
  16915. /***/ "./packages/mdc-tab-scroller/rtl-default-scroller.ts":
  16916. /*!***********************************************************!*\
  16917. !*** ./packages/mdc-tab-scroller/rtl-default-scroller.ts ***!
  16918. \***********************************************************/
  16919. /*! no static exports found */
  16920. /***/ (function(module, exports, __webpack_require__) {
  16921. "use strict";
  16922. /**
  16923. * @license
  16924. * Copyright 2018 Google Inc.
  16925. *
  16926. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16927. * of this software and associated documentation files (the "Software"), to deal
  16928. * in the Software without restriction, including without limitation the rights
  16929. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16930. * copies of the Software, and to permit persons to whom the Software is
  16931. * furnished to do so, subject to the following conditions:
  16932. *
  16933. * The above copyright notice and this permission notice shall be included in
  16934. * all copies or substantial portions of the Software.
  16935. *
  16936. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16937. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16938. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16939. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16940. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16941. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  16942. * THE SOFTWARE.
  16943. */
  16944. var __extends = this && this.__extends || function () {
  16945. var _extendStatics = function extendStatics(d, b) {
  16946. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16947. d.__proto__ = b;
  16948. } || function (d, b) {
  16949. for (var p in b) {
  16950. if (b.hasOwnProperty(p)) d[p] = b[p];
  16951. }
  16952. };
  16953. return _extendStatics(d, b);
  16954. };
  16955. return function (d, b) {
  16956. _extendStatics(d, b);
  16957. function __() {
  16958. this.constructor = d;
  16959. }
  16960. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16961. };
  16962. }();
  16963. Object.defineProperty(exports, "__esModule", { value: true });
  16964. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  16965. var MDCTabScrollerRTLDefault = /** @class */function (_super) {
  16966. __extends(MDCTabScrollerRTLDefault, _super);
  16967. function MDCTabScrollerRTLDefault() {
  16968. return _super !== null && _super.apply(this, arguments) || this;
  16969. }
  16970. MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {
  16971. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16972. var right = this.calculateScrollEdges_().right;
  16973. // Scroll values on most browsers are ints instead of floats so we round
  16974. return Math.round(right - currentScrollLeft);
  16975. };
  16976. MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {
  16977. var edges = this.calculateScrollEdges_();
  16978. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16979. var clampedScrollLeft = this.clampScrollValue_(edges.right - scrollX);
  16980. return {
  16981. finalScrollPosition: clampedScrollLeft,
  16982. scrollDelta: clampedScrollLeft - currentScrollLeft
  16983. };
  16984. };
  16985. MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {
  16986. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  16987. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  16988. return {
  16989. finalScrollPosition: clampedScrollLeft,
  16990. scrollDelta: clampedScrollLeft - currentScrollLeft
  16991. };
  16992. };
  16993. MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {
  16994. return scrollX;
  16995. };
  16996. MDCTabScrollerRTLDefault.prototype.calculateScrollEdges_ = function () {
  16997. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  16998. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  16999. return {
  17000. left: 0,
  17001. right: contentWidth - rootWidth
  17002. };
  17003. };
  17004. MDCTabScrollerRTLDefault.prototype.clampScrollValue_ = function (scrollX) {
  17005. var edges = this.calculateScrollEdges_();
  17006. return Math.min(Math.max(edges.left, scrollX), edges.right);
  17007. };
  17008. return MDCTabScrollerRTLDefault;
  17009. }(rtl_scroller_1.MDCTabScrollerRTL);
  17010. exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault;
  17011. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17012. exports.default = MDCTabScrollerRTLDefault;
  17013. /***/ }),
  17014. /***/ "./packages/mdc-tab-scroller/rtl-negative-scroller.ts":
  17015. /*!************************************************************!*\
  17016. !*** ./packages/mdc-tab-scroller/rtl-negative-scroller.ts ***!
  17017. \************************************************************/
  17018. /*! no static exports found */
  17019. /***/ (function(module, exports, __webpack_require__) {
  17020. "use strict";
  17021. /**
  17022. * @license
  17023. * Copyright 2018 Google Inc.
  17024. *
  17025. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17026. * of this software and associated documentation files (the "Software"), to deal
  17027. * in the Software without restriction, including without limitation the rights
  17028. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17029. * copies of the Software, and to permit persons to whom the Software is
  17030. * furnished to do so, subject to the following conditions:
  17031. *
  17032. * The above copyright notice and this permission notice shall be included in
  17033. * all copies or substantial portions of the Software.
  17034. *
  17035. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17036. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17037. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17038. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17039. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17040. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17041. * THE SOFTWARE.
  17042. */
  17043. var __extends = this && this.__extends || function () {
  17044. var _extendStatics = function extendStatics(d, b) {
  17045. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17046. d.__proto__ = b;
  17047. } || function (d, b) {
  17048. for (var p in b) {
  17049. if (b.hasOwnProperty(p)) d[p] = b[p];
  17050. }
  17051. };
  17052. return _extendStatics(d, b);
  17053. };
  17054. return function (d, b) {
  17055. _extendStatics(d, b);
  17056. function __() {
  17057. this.constructor = d;
  17058. }
  17059. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17060. };
  17061. }();
  17062. Object.defineProperty(exports, "__esModule", { value: true });
  17063. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17064. var MDCTabScrollerRTLNegative = /** @class */function (_super) {
  17065. __extends(MDCTabScrollerRTLNegative, _super);
  17066. function MDCTabScrollerRTLNegative() {
  17067. return _super !== null && _super.apply(this, arguments) || this;
  17068. }
  17069. MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {
  17070. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17071. return Math.round(translateX - currentScrollLeft);
  17072. };
  17073. MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {
  17074. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17075. var clampedScrollLeft = this.clampScrollValue_(-scrollX);
  17076. return {
  17077. finalScrollPosition: clampedScrollLeft,
  17078. scrollDelta: clampedScrollLeft - currentScrollLeft
  17079. };
  17080. };
  17081. MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {
  17082. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17083. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft - scrollX);
  17084. return {
  17085. finalScrollPosition: clampedScrollLeft,
  17086. scrollDelta: clampedScrollLeft - currentScrollLeft
  17087. };
  17088. };
  17089. MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  17090. return scrollX - translateX;
  17091. };
  17092. MDCTabScrollerRTLNegative.prototype.calculateScrollEdges_ = function () {
  17093. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17094. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17095. return {
  17096. left: rootWidth - contentWidth,
  17097. right: 0
  17098. };
  17099. };
  17100. MDCTabScrollerRTLNegative.prototype.clampScrollValue_ = function (scrollX) {
  17101. var edges = this.calculateScrollEdges_();
  17102. return Math.max(Math.min(edges.right, scrollX), edges.left);
  17103. };
  17104. return MDCTabScrollerRTLNegative;
  17105. }(rtl_scroller_1.MDCTabScrollerRTL);
  17106. exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative;
  17107. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17108. exports.default = MDCTabScrollerRTLNegative;
  17109. /***/ }),
  17110. /***/ "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts":
  17111. /*!***********************************************************!*\
  17112. !*** ./packages/mdc-tab-scroller/rtl-reverse-scroller.ts ***!
  17113. \***********************************************************/
  17114. /*! no static exports found */
  17115. /***/ (function(module, exports, __webpack_require__) {
  17116. "use strict";
  17117. /**
  17118. * @license
  17119. * Copyright 2018 Google Inc.
  17120. *
  17121. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17122. * of this software and associated documentation files (the "Software"), to deal
  17123. * in the Software without restriction, including without limitation the rights
  17124. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17125. * copies of the Software, and to permit persons to whom the Software is
  17126. * furnished to do so, subject to the following conditions:
  17127. *
  17128. * The above copyright notice and this permission notice shall be included in
  17129. * all copies or substantial portions of the Software.
  17130. *
  17131. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17132. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17133. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17134. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17135. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17136. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17137. * THE SOFTWARE.
  17138. */
  17139. var __extends = this && this.__extends || function () {
  17140. var _extendStatics = function extendStatics(d, b) {
  17141. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17142. d.__proto__ = b;
  17143. } || function (d, b) {
  17144. for (var p in b) {
  17145. if (b.hasOwnProperty(p)) d[p] = b[p];
  17146. }
  17147. };
  17148. return _extendStatics(d, b);
  17149. };
  17150. return function (d, b) {
  17151. _extendStatics(d, b);
  17152. function __() {
  17153. this.constructor = d;
  17154. }
  17155. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17156. };
  17157. }();
  17158. Object.defineProperty(exports, "__esModule", { value: true });
  17159. var rtl_scroller_1 = __webpack_require__(/*! ./rtl-scroller */ "./packages/mdc-tab-scroller/rtl-scroller.ts");
  17160. var MDCTabScrollerRTLReverse = /** @class */function (_super) {
  17161. __extends(MDCTabScrollerRTLReverse, _super);
  17162. function MDCTabScrollerRTLReverse() {
  17163. return _super !== null && _super.apply(this, arguments) || this;
  17164. }
  17165. MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {
  17166. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17167. // Scroll values on most browsers are ints instead of floats so we round
  17168. return Math.round(currentScrollLeft - translateX);
  17169. };
  17170. MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {
  17171. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17172. var clampedScrollLeft = this.clampScrollValue_(scrollX);
  17173. return {
  17174. finalScrollPosition: clampedScrollLeft,
  17175. scrollDelta: currentScrollLeft - clampedScrollLeft
  17176. };
  17177. };
  17178. MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {
  17179. var currentScrollLeft = this.adapter_.getScrollAreaScrollLeft();
  17180. var clampedScrollLeft = this.clampScrollValue_(currentScrollLeft + scrollX);
  17181. return {
  17182. finalScrollPosition: clampedScrollLeft,
  17183. scrollDelta: currentScrollLeft - clampedScrollLeft
  17184. };
  17185. };
  17186. MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
  17187. return scrollX + translateX;
  17188. };
  17189. MDCTabScrollerRTLReverse.prototype.calculateScrollEdges_ = function () {
  17190. var contentWidth = this.adapter_.getScrollContentOffsetWidth();
  17191. var rootWidth = this.adapter_.getScrollAreaOffsetWidth();
  17192. return {
  17193. left: contentWidth - rootWidth,
  17194. right: 0
  17195. };
  17196. };
  17197. MDCTabScrollerRTLReverse.prototype.clampScrollValue_ = function (scrollX) {
  17198. var edges = this.calculateScrollEdges_();
  17199. return Math.min(Math.max(edges.right, scrollX), edges.left);
  17200. };
  17201. return MDCTabScrollerRTLReverse;
  17202. }(rtl_scroller_1.MDCTabScrollerRTL);
  17203. exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse;
  17204. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17205. exports.default = MDCTabScrollerRTLReverse;
  17206. /***/ }),
  17207. /***/ "./packages/mdc-tab-scroller/rtl-scroller.ts":
  17208. /*!***************************************************!*\
  17209. !*** ./packages/mdc-tab-scroller/rtl-scroller.ts ***!
  17210. \***************************************************/
  17211. /*! no static exports found */
  17212. /***/ (function(module, exports, __webpack_require__) {
  17213. "use strict";
  17214. /**
  17215. * @license
  17216. * Copyright 2018 Google Inc.
  17217. *
  17218. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17219. * of this software and associated documentation files (the "Software"), to deal
  17220. * in the Software without restriction, including without limitation the rights
  17221. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17222. * copies of the Software, and to permit persons to whom the Software is
  17223. * furnished to do so, subject to the following conditions:
  17224. *
  17225. * The above copyright notice and this permission notice shall be included in
  17226. * all copies or substantial portions of the Software.
  17227. *
  17228. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17229. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17230. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17231. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17232. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17233. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17234. * THE SOFTWARE.
  17235. */
  17236. Object.defineProperty(exports, "__esModule", { value: true });
  17237. var MDCTabScrollerRTL = /** @class */function () {
  17238. function MDCTabScrollerRTL(adapter) {
  17239. this.adapter_ = adapter;
  17240. }
  17241. return MDCTabScrollerRTL;
  17242. }();
  17243. exports.MDCTabScrollerRTL = MDCTabScrollerRTL;
  17244. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17245. exports.default = MDCTabScrollerRTL;
  17246. /***/ }),
  17247. /***/ "./packages/mdc-tab-scroller/util.ts":
  17248. /*!*******************************************!*\
  17249. !*** ./packages/mdc-tab-scroller/util.ts ***!
  17250. \*******************************************/
  17251. /*! no static exports found */
  17252. /***/ (function(module, exports, __webpack_require__) {
  17253. "use strict";
  17254. /**
  17255. * @license
  17256. * Copyright 2018 Google Inc.
  17257. *
  17258. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17259. * of this software and associated documentation files (the "Software"), to deal
  17260. * in the Software without restriction, including without limitation the rights
  17261. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17262. * copies of the Software, and to permit persons to whom the Software is
  17263. * furnished to do so, subject to the following conditions:
  17264. *
  17265. * The above copyright notice and this permission notice shall be included in
  17266. * all copies or substantial portions of the Software.
  17267. *
  17268. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17269. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17270. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17271. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17272. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17273. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17274. * THE SOFTWARE.
  17275. */
  17276. Object.defineProperty(exports, "__esModule", { value: true });
  17277. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab-scroller/constants.ts");
  17278. /**
  17279. * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.
  17280. */
  17281. var horizontalScrollbarHeight_;
  17282. /**
  17283. * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.
  17284. * May return 0 (e.g. on OS X browsers under default configuration).
  17285. */
  17286. function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {
  17287. if (shouldCacheResult === void 0) {
  17288. shouldCacheResult = true;
  17289. }
  17290. if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {
  17291. return horizontalScrollbarHeight_;
  17292. }
  17293. var el = documentObj.createElement('div');
  17294. el.classList.add(constants_1.cssClasses.SCROLL_TEST);
  17295. documentObj.body.appendChild(el);
  17296. var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;
  17297. documentObj.body.removeChild(el);
  17298. if (shouldCacheResult) {
  17299. horizontalScrollbarHeight_ = horizontalScrollbarHeight;
  17300. }
  17301. return horizontalScrollbarHeight;
  17302. }
  17303. exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight;
  17304. /***/ }),
  17305. /***/ "./packages/mdc-tab/component.ts":
  17306. /*!***************************************!*\
  17307. !*** ./packages/mdc-tab/component.ts ***!
  17308. \***************************************/
  17309. /*! no static exports found */
  17310. /***/ (function(module, exports, __webpack_require__) {
  17311. "use strict";
  17312. /**
  17313. * @license
  17314. * Copyright 2018 Google Inc.
  17315. *
  17316. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17317. * of this software and associated documentation files (the "Software"), to deal
  17318. * in the Software without restriction, including without limitation the rights
  17319. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17320. * copies of the Software, and to permit persons to whom the Software is
  17321. * furnished to do so, subject to the following conditions:
  17322. *
  17323. * The above copyright notice and this permission notice shall be included in
  17324. * all copies or substantial portions of the Software.
  17325. *
  17326. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17327. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17328. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17329. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17330. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17331. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17332. * THE SOFTWARE.
  17333. */
  17334. var __extends = this && this.__extends || function () {
  17335. var _extendStatics = function extendStatics(d, b) {
  17336. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17337. d.__proto__ = b;
  17338. } || function (d, b) {
  17339. for (var p in b) {
  17340. if (b.hasOwnProperty(p)) d[p] = b[p];
  17341. }
  17342. };
  17343. return _extendStatics(d, b);
  17344. };
  17345. return function (d, b) {
  17346. _extendStatics(d, b);
  17347. function __() {
  17348. this.constructor = d;
  17349. }
  17350. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17351. };
  17352. }();
  17353. var __assign = this && this.__assign || function () {
  17354. __assign = Object.assign || function (t) {
  17355. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17356. s = arguments[i];
  17357. for (var p in s) {
  17358. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17359. }
  17360. }
  17361. return t;
  17362. };
  17363. return __assign.apply(this, arguments);
  17364. };
  17365. Object.defineProperty(exports, "__esModule", { value: true });
  17366. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  17367. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  17368. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  17369. var component_3 = __webpack_require__(/*! @material/tab-indicator/component */ "./packages/mdc-tab-indicator/component.ts");
  17370. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts");
  17371. var MDCTab = /** @class */function (_super) {
  17372. __extends(MDCTab, _super);
  17373. function MDCTab() {
  17374. return _super !== null && _super.apply(this, arguments) || this;
  17375. }
  17376. MDCTab.attachTo = function (root) {
  17377. return new MDCTab(root);
  17378. };
  17379. MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {
  17380. if (rippleFactory === void 0) {
  17381. rippleFactory = function rippleFactory(el, foundation) {
  17382. return new component_2.MDCRipple(el, foundation);
  17383. };
  17384. }
  17385. if (tabIndicatorFactory === void 0) {
  17386. tabIndicatorFactory = function tabIndicatorFactory(el) {
  17387. return new component_3.MDCTabIndicator(el);
  17388. };
  17389. }
  17390. this.id = this.root_.id;
  17391. var rippleSurface = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.RIPPLE_SELECTOR);
  17392. var rippleAdapter = __assign({}, component_2.MDCRipple.createAdapter(this), { addClass: function addClass(className) {
  17393. return rippleSurface.classList.add(className);
  17394. }, removeClass: function removeClass(className) {
  17395. return rippleSurface.classList.remove(className);
  17396. }, updateCssVariable: function updateCssVariable(varName, value) {
  17397. return rippleSurface.style.setProperty(varName, value);
  17398. } });
  17399. var rippleFoundation = new foundation_1.MDCRippleFoundation(rippleAdapter);
  17400. this.ripple_ = rippleFactory(this.root_, rippleFoundation);
  17401. var tabIndicatorElement = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);
  17402. this.tabIndicator_ = tabIndicatorFactory(tabIndicatorElement);
  17403. this.content_ = this.root_.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR);
  17404. };
  17405. MDCTab.prototype.initialSyncWithDOM = function () {
  17406. var _this = this;
  17407. this.handleClick_ = function () {
  17408. return _this.foundation_.handleClick();
  17409. };
  17410. this.listen('click', this.handleClick_);
  17411. };
  17412. MDCTab.prototype.destroy = function () {
  17413. this.unlisten('click', this.handleClick_);
  17414. this.ripple_.destroy();
  17415. _super.prototype.destroy.call(this);
  17416. };
  17417. MDCTab.prototype.getDefaultFoundation = function () {
  17418. var _this = this;
  17419. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  17420. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  17421. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17422. var adapter = {
  17423. setAttr: function setAttr(attr, value) {
  17424. return _this.root_.setAttribute(attr, value);
  17425. },
  17426. addClass: function addClass(className) {
  17427. return _this.root_.classList.add(className);
  17428. },
  17429. removeClass: function removeClass(className) {
  17430. return _this.root_.classList.remove(className);
  17431. },
  17432. hasClass: function hasClass(className) {
  17433. return _this.root_.classList.contains(className);
  17434. },
  17435. activateIndicator: function activateIndicator(previousIndicatorClientRect) {
  17436. return _this.tabIndicator_.activate(previousIndicatorClientRect);
  17437. },
  17438. deactivateIndicator: function deactivateIndicator() {
  17439. return _this.tabIndicator_.deactivate();
  17440. },
  17441. notifyInteracted: function notifyInteracted() {
  17442. return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */);
  17443. },
  17444. getOffsetLeft: function getOffsetLeft() {
  17445. return _this.root_.offsetLeft;
  17446. },
  17447. getOffsetWidth: function getOffsetWidth() {
  17448. return _this.root_.offsetWidth;
  17449. },
  17450. getContentOffsetLeft: function getContentOffsetLeft() {
  17451. return _this.content_.offsetLeft;
  17452. },
  17453. getContentOffsetWidth: function getContentOffsetWidth() {
  17454. return _this.content_.offsetWidth;
  17455. },
  17456. focus: function focus() {
  17457. return _this.root_.focus();
  17458. }
  17459. };
  17460. // tslint:enable:object-literal-sort-keys
  17461. return new foundation_2.MDCTabFoundation(adapter);
  17462. };
  17463. Object.defineProperty(MDCTab.prototype, "active", {
  17464. /**
  17465. * Getter for the active state of the tab
  17466. */
  17467. get: function get() {
  17468. return this.foundation_.isActive();
  17469. },
  17470. enumerable: true,
  17471. configurable: true
  17472. });
  17473. Object.defineProperty(MDCTab.prototype, "focusOnActivate", {
  17474. set: function set(focusOnActivate) {
  17475. this.foundation_.setFocusOnActivate(focusOnActivate);
  17476. },
  17477. enumerable: true,
  17478. configurable: true
  17479. });
  17480. /**
  17481. * Activates the tab
  17482. */
  17483. MDCTab.prototype.activate = function (computeIndicatorClientRect) {
  17484. this.foundation_.activate(computeIndicatorClientRect);
  17485. };
  17486. /**
  17487. * Deactivates the tab
  17488. */
  17489. MDCTab.prototype.deactivate = function () {
  17490. this.foundation_.deactivate();
  17491. };
  17492. /**
  17493. * Returns the indicator's client rect
  17494. */
  17495. MDCTab.prototype.computeIndicatorClientRect = function () {
  17496. return this.tabIndicator_.computeContentClientRect();
  17497. };
  17498. MDCTab.prototype.computeDimensions = function () {
  17499. return this.foundation_.computeDimensions();
  17500. };
  17501. /**
  17502. * Focuses the tab
  17503. */
  17504. MDCTab.prototype.focus = function () {
  17505. this.root_.focus();
  17506. };
  17507. return MDCTab;
  17508. }(component_1.MDCComponent);
  17509. exports.MDCTab = MDCTab;
  17510. /***/ }),
  17511. /***/ "./packages/mdc-tab/constants.ts":
  17512. /*!***************************************!*\
  17513. !*** ./packages/mdc-tab/constants.ts ***!
  17514. \***************************************/
  17515. /*! no static exports found */
  17516. /***/ (function(module, exports, __webpack_require__) {
  17517. "use strict";
  17518. /**
  17519. * @license
  17520. * Copyright 2018 Google Inc.
  17521. *
  17522. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17523. * of this software and associated documentation files (the "Software"), to deal
  17524. * in the Software without restriction, including without limitation the rights
  17525. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17526. * copies of the Software, and to permit persons to whom the Software is
  17527. * furnished to do so, subject to the following conditions:
  17528. *
  17529. * The above copyright notice and this permission notice shall be included in
  17530. * all copies or substantial portions of the Software.
  17531. *
  17532. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17533. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17534. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17535. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17536. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17537. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17538. * THE SOFTWARE.
  17539. */
  17540. Object.defineProperty(exports, "__esModule", { value: true });
  17541. var cssClasses = {
  17542. ACTIVE: 'mdc-tab--active'
  17543. };
  17544. exports.cssClasses = cssClasses;
  17545. var strings = {
  17546. ARIA_SELECTED: 'aria-selected',
  17547. CONTENT_SELECTOR: '.mdc-tab__content',
  17548. INTERACTED_EVENT: 'MDCTab:interacted',
  17549. RIPPLE_SELECTOR: '.mdc-tab__ripple',
  17550. TABINDEX: 'tabIndex',
  17551. TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator'
  17552. };
  17553. exports.strings = strings;
  17554. /***/ }),
  17555. /***/ "./packages/mdc-tab/foundation.ts":
  17556. /*!****************************************!*\
  17557. !*** ./packages/mdc-tab/foundation.ts ***!
  17558. \****************************************/
  17559. /*! no static exports found */
  17560. /***/ (function(module, exports, __webpack_require__) {
  17561. "use strict";
  17562. /**
  17563. * @license
  17564. * Copyright 2018 Google Inc.
  17565. *
  17566. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17567. * of this software and associated documentation files (the "Software"), to deal
  17568. * in the Software without restriction, including without limitation the rights
  17569. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17570. * copies of the Software, and to permit persons to whom the Software is
  17571. * furnished to do so, subject to the following conditions:
  17572. *
  17573. * The above copyright notice and this permission notice shall be included in
  17574. * all copies or substantial portions of the Software.
  17575. *
  17576. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17577. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17578. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17579. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17580. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17581. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17582. * THE SOFTWARE.
  17583. */
  17584. var __extends = this && this.__extends || function () {
  17585. var _extendStatics = function extendStatics(d, b) {
  17586. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17587. d.__proto__ = b;
  17588. } || function (d, b) {
  17589. for (var p in b) {
  17590. if (b.hasOwnProperty(p)) d[p] = b[p];
  17591. }
  17592. };
  17593. return _extendStatics(d, b);
  17594. };
  17595. return function (d, b) {
  17596. _extendStatics(d, b);
  17597. function __() {
  17598. this.constructor = d;
  17599. }
  17600. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17601. };
  17602. }();
  17603. var __assign = this && this.__assign || function () {
  17604. __assign = Object.assign || function (t) {
  17605. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17606. s = arguments[i];
  17607. for (var p in s) {
  17608. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17609. }
  17610. }
  17611. return t;
  17612. };
  17613. return __assign.apply(this, arguments);
  17614. };
  17615. Object.defineProperty(exports, "__esModule", { value: true });
  17616. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  17617. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts");
  17618. var MDCTabFoundation = /** @class */function (_super) {
  17619. __extends(MDCTabFoundation, _super);
  17620. function MDCTabFoundation(adapter) {
  17621. var _this = _super.call(this, __assign({}, MDCTabFoundation.defaultAdapter, adapter)) || this;
  17622. _this.focusOnActivate_ = true;
  17623. return _this;
  17624. }
  17625. Object.defineProperty(MDCTabFoundation, "cssClasses", {
  17626. get: function get() {
  17627. return constants_1.cssClasses;
  17628. },
  17629. enumerable: true,
  17630. configurable: true
  17631. });
  17632. Object.defineProperty(MDCTabFoundation, "strings", {
  17633. get: function get() {
  17634. return constants_1.strings;
  17635. },
  17636. enumerable: true,
  17637. configurable: true
  17638. });
  17639. Object.defineProperty(MDCTabFoundation, "defaultAdapter", {
  17640. get: function get() {
  17641. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  17642. return {
  17643. addClass: function addClass() {
  17644. return undefined;
  17645. },
  17646. removeClass: function removeClass() {
  17647. return undefined;
  17648. },
  17649. hasClass: function hasClass() {
  17650. return false;
  17651. },
  17652. setAttr: function setAttr() {
  17653. return undefined;
  17654. },
  17655. activateIndicator: function activateIndicator() {
  17656. return undefined;
  17657. },
  17658. deactivateIndicator: function deactivateIndicator() {
  17659. return undefined;
  17660. },
  17661. notifyInteracted: function notifyInteracted() {
  17662. return undefined;
  17663. },
  17664. getOffsetLeft: function getOffsetLeft() {
  17665. return 0;
  17666. },
  17667. getOffsetWidth: function getOffsetWidth() {
  17668. return 0;
  17669. },
  17670. getContentOffsetLeft: function getContentOffsetLeft() {
  17671. return 0;
  17672. },
  17673. getContentOffsetWidth: function getContentOffsetWidth() {
  17674. return 0;
  17675. },
  17676. focus: function focus() {
  17677. return undefined;
  17678. }
  17679. };
  17680. // tslint:enable:object-literal-sort-keys
  17681. },
  17682. enumerable: true,
  17683. configurable: true
  17684. });
  17685. MDCTabFoundation.prototype.handleClick = function () {
  17686. // It's up to the parent component to keep track of the active Tab and
  17687. // ensure we don't activate a Tab that's already active.
  17688. this.adapter_.notifyInteracted();
  17689. };
  17690. MDCTabFoundation.prototype.isActive = function () {
  17691. return this.adapter_.hasClass(constants_1.cssClasses.ACTIVE);
  17692. };
  17693. /**
  17694. * Sets whether the tab should focus itself when activated
  17695. */
  17696. MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {
  17697. this.focusOnActivate_ = focusOnActivate;
  17698. };
  17699. /**
  17700. * Activates the Tab
  17701. */
  17702. MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {
  17703. this.adapter_.addClass(constants_1.cssClasses.ACTIVE);
  17704. this.adapter_.setAttr(constants_1.strings.ARIA_SELECTED, 'true');
  17705. this.adapter_.setAttr(constants_1.strings.TABINDEX, '0');
  17706. this.adapter_.activateIndicator(previousIndicatorClientRect);
  17707. if (this.focusOnActivate_) {
  17708. this.adapter_.focus();
  17709. }
  17710. };
  17711. /**
  17712. * Deactivates the Tab
  17713. */
  17714. MDCTabFoundation.prototype.deactivate = function () {
  17715. // Early exit
  17716. if (!this.isActive()) {
  17717. return;
  17718. }
  17719. this.adapter_.removeClass(constants_1.cssClasses.ACTIVE);
  17720. this.adapter_.setAttr(constants_1.strings.ARIA_SELECTED, 'false');
  17721. this.adapter_.setAttr(constants_1.strings.TABINDEX, '-1');
  17722. this.adapter_.deactivateIndicator();
  17723. };
  17724. /**
  17725. * Returns the dimensions of the Tab
  17726. */
  17727. MDCTabFoundation.prototype.computeDimensions = function () {
  17728. var rootWidth = this.adapter_.getOffsetWidth();
  17729. var rootLeft = this.adapter_.getOffsetLeft();
  17730. var contentWidth = this.adapter_.getContentOffsetWidth();
  17731. var contentLeft = this.adapter_.getContentOffsetLeft();
  17732. return {
  17733. contentLeft: rootLeft + contentLeft,
  17734. contentRight: rootLeft + contentLeft + contentWidth,
  17735. rootLeft: rootLeft,
  17736. rootRight: rootLeft + rootWidth
  17737. };
  17738. };
  17739. return MDCTabFoundation;
  17740. }(foundation_1.MDCFoundation);
  17741. exports.MDCTabFoundation = MDCTabFoundation;
  17742. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  17743. exports.default = MDCTabFoundation;
  17744. /***/ }),
  17745. /***/ "./packages/mdc-tab/index.ts":
  17746. /*!***********************************!*\
  17747. !*** ./packages/mdc-tab/index.ts ***!
  17748. \***********************************/
  17749. /*! no static exports found */
  17750. /***/ (function(module, exports, __webpack_require__) {
  17751. "use strict";
  17752. /**
  17753. * @license
  17754. * Copyright 2019 Google Inc.
  17755. *
  17756. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17757. * of this software and associated documentation files (the "Software"), to deal
  17758. * in the Software without restriction, including without limitation the rights
  17759. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17760. * copies of the Software, and to permit persons to whom the Software is
  17761. * furnished to do so, subject to the following conditions:
  17762. *
  17763. * The above copyright notice and this permission notice shall be included in
  17764. * all copies or substantial portions of the Software.
  17765. *
  17766. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17767. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17768. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17769. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17770. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17771. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17772. * THE SOFTWARE.
  17773. */
  17774. function __export(m) {
  17775. for (var p in m) {
  17776. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  17777. }
  17778. }
  17779. Object.defineProperty(exports, "__esModule", { value: true });
  17780. __export(__webpack_require__(/*! ./component */ "./packages/mdc-tab/component.ts"));
  17781. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-tab/constants.ts"));
  17782. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-tab/foundation.ts"));
  17783. /***/ }),
  17784. /***/ "./packages/mdc-textfield/character-counter/component.ts":
  17785. /*!***************************************************************!*\
  17786. !*** ./packages/mdc-textfield/character-counter/component.ts ***!
  17787. \***************************************************************/
  17788. /*! no static exports found */
  17789. /***/ (function(module, exports, __webpack_require__) {
  17790. "use strict";
  17791. /**
  17792. * @license
  17793. * Copyright 2019 Google Inc.
  17794. *
  17795. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17796. * of this software and associated documentation files (the "Software"), to deal
  17797. * in the Software without restriction, including without limitation the rights
  17798. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17799. * copies of the Software, and to permit persons to whom the Software is
  17800. * furnished to do so, subject to the following conditions:
  17801. *
  17802. * The above copyright notice and this permission notice shall be included in
  17803. * all copies or substantial portions of the Software.
  17804. *
  17805. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17806. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17807. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17808. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17809. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17810. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17811. * THE SOFTWARE.
  17812. */
  17813. var __extends = this && this.__extends || function () {
  17814. var _extendStatics = function extendStatics(d, b) {
  17815. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17816. d.__proto__ = b;
  17817. } || function (d, b) {
  17818. for (var p in b) {
  17819. if (b.hasOwnProperty(p)) d[p] = b[p];
  17820. }
  17821. };
  17822. return _extendStatics(d, b);
  17823. };
  17824. return function (d, b) {
  17825. _extendStatics(d, b);
  17826. function __() {
  17827. this.constructor = d;
  17828. }
  17829. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17830. };
  17831. }();
  17832. Object.defineProperty(exports, "__esModule", { value: true });
  17833. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  17834. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  17835. var MDCTextFieldCharacterCounter = /** @class */function (_super) {
  17836. __extends(MDCTextFieldCharacterCounter, _super);
  17837. function MDCTextFieldCharacterCounter() {
  17838. return _super !== null && _super.apply(this, arguments) || this;
  17839. }
  17840. MDCTextFieldCharacterCounter.attachTo = function (root) {
  17841. return new MDCTextFieldCharacterCounter(root);
  17842. };
  17843. Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundation", {
  17844. get: function get() {
  17845. return this.foundation_;
  17846. },
  17847. enumerable: true,
  17848. configurable: true
  17849. });
  17850. MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
  17851. var _this = this;
  17852. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  17853. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  17854. var adapter = {
  17855. setContent: function setContent(content) {
  17856. _this.root_.textContent = content;
  17857. }
  17858. };
  17859. return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
  17860. };
  17861. return MDCTextFieldCharacterCounter;
  17862. }(component_1.MDCComponent);
  17863. exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
  17864. /***/ }),
  17865. /***/ "./packages/mdc-textfield/character-counter/constants.ts":
  17866. /*!***************************************************************!*\
  17867. !*** ./packages/mdc-textfield/character-counter/constants.ts ***!
  17868. \***************************************************************/
  17869. /*! no static exports found */
  17870. /***/ (function(module, exports, __webpack_require__) {
  17871. "use strict";
  17872. /**
  17873. * @license
  17874. * Copyright 2019 Google Inc.
  17875. *
  17876. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17877. * of this software and associated documentation files (the "Software"), to deal
  17878. * in the Software without restriction, including without limitation the rights
  17879. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17880. * copies of the Software, and to permit persons to whom the Software is
  17881. * furnished to do so, subject to the following conditions:
  17882. *
  17883. * The above copyright notice and this permission notice shall be included in
  17884. * all copies or substantial portions of the Software.
  17885. *
  17886. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17887. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17888. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17889. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17890. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17891. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17892. * THE SOFTWARE.
  17893. */
  17894. Object.defineProperty(exports, "__esModule", { value: true });
  17895. var cssClasses = {
  17896. ROOT: 'mdc-text-field-character-counter'
  17897. };
  17898. exports.cssClasses = cssClasses;
  17899. var strings = {
  17900. ROOT_SELECTOR: "." + cssClasses.ROOT
  17901. };
  17902. exports.strings = strings;
  17903. /***/ }),
  17904. /***/ "./packages/mdc-textfield/character-counter/foundation.ts":
  17905. /*!****************************************************************!*\
  17906. !*** ./packages/mdc-textfield/character-counter/foundation.ts ***!
  17907. \****************************************************************/
  17908. /*! no static exports found */
  17909. /***/ (function(module, exports, __webpack_require__) {
  17910. "use strict";
  17911. /**
  17912. * @license
  17913. * Copyright 2019 Google Inc.
  17914. *
  17915. * Permission is hereby granted, free of charge, to any person obtaining a copy
  17916. * of this software and associated documentation files (the "Software"), to deal
  17917. * in the Software without restriction, including without limitation the rights
  17918. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17919. * copies of the Software, and to permit persons to whom the Software is
  17920. * furnished to do so, subject to the following conditions:
  17921. *
  17922. * The above copyright notice and this permission notice shall be included in
  17923. * all copies or substantial portions of the Software.
  17924. *
  17925. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17926. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17927. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17928. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17929. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17930. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17931. * THE SOFTWARE.
  17932. */
  17933. var __extends = this && this.__extends || function () {
  17934. var _extendStatics = function extendStatics(d, b) {
  17935. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  17936. d.__proto__ = b;
  17937. } || function (d, b) {
  17938. for (var p in b) {
  17939. if (b.hasOwnProperty(p)) d[p] = b[p];
  17940. }
  17941. };
  17942. return _extendStatics(d, b);
  17943. };
  17944. return function (d, b) {
  17945. _extendStatics(d, b);
  17946. function __() {
  17947. this.constructor = d;
  17948. }
  17949. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17950. };
  17951. }();
  17952. var __assign = this && this.__assign || function () {
  17953. __assign = Object.assign || function (t) {
  17954. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17955. s = arguments[i];
  17956. for (var p in s) {
  17957. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  17958. }
  17959. }
  17960. return t;
  17961. };
  17962. return __assign.apply(this, arguments);
  17963. };
  17964. Object.defineProperty(exports, "__esModule", { value: true });
  17965. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  17966. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  17967. var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) {
  17968. __extends(MDCTextFieldCharacterCounterFoundation, _super);
  17969. function MDCTextFieldCharacterCounterFoundation(adapter) {
  17970. return _super.call(this, __assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter, adapter)) || this;
  17971. }
  17972. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
  17973. get: function get() {
  17974. return constants_1.cssClasses;
  17975. },
  17976. enumerable: true,
  17977. configurable: true
  17978. });
  17979. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
  17980. get: function get() {
  17981. return constants_1.strings;
  17982. },
  17983. enumerable: true,
  17984. configurable: true
  17985. });
  17986. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
  17987. /**
  17988. * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
  17989. */
  17990. get: function get() {
  17991. return {
  17992. setContent: function setContent() {
  17993. return undefined;
  17994. }
  17995. };
  17996. },
  17997. enumerable: true,
  17998. configurable: true
  17999. });
  18000. MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
  18001. currentLength = Math.min(currentLength, maxLength);
  18002. this.adapter_.setContent(currentLength + " / " + maxLength);
  18003. };
  18004. return MDCTextFieldCharacterCounterFoundation;
  18005. }(foundation_1.MDCFoundation);
  18006. exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
  18007. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  18008. exports.default = MDCTextFieldCharacterCounterFoundation;
  18009. /***/ }),
  18010. /***/ "./packages/mdc-textfield/character-counter/index.ts":
  18011. /*!***********************************************************!*\
  18012. !*** ./packages/mdc-textfield/character-counter/index.ts ***!
  18013. \***********************************************************/
  18014. /*! no static exports found */
  18015. /***/ (function(module, exports, __webpack_require__) {
  18016. "use strict";
  18017. /**
  18018. * @license
  18019. * Copyright 2019 Google Inc.
  18020. *
  18021. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18022. * of this software and associated documentation files (the "Software"), to deal
  18023. * in the Software without restriction, including without limitation the rights
  18024. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18025. * copies of the Software, and to permit persons to whom the Software is
  18026. * furnished to do so, subject to the following conditions:
  18027. *
  18028. * The above copyright notice and this permission notice shall be included in
  18029. * all copies or substantial portions of the Software.
  18030. *
  18031. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18032. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18033. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18034. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18035. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18036. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18037. * THE SOFTWARE.
  18038. */
  18039. function __export(m) {
  18040. for (var p in m) {
  18041. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  18042. }
  18043. }
  18044. Object.defineProperty(exports, "__esModule", { value: true });
  18045. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"));
  18046. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"));
  18047. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  18048. exports.characterCountCssClasses = constants_1.cssClasses;
  18049. exports.characterCountStrings = constants_1.strings;
  18050. /***/ }),
  18051. /***/ "./packages/mdc-textfield/component.ts":
  18052. /*!*********************************************!*\
  18053. !*** ./packages/mdc-textfield/component.ts ***!
  18054. \*********************************************/
  18055. /*! no static exports found */
  18056. /***/ (function(module, exports, __webpack_require__) {
  18057. "use strict";
  18058. /**
  18059. * @license
  18060. * Copyright 2016 Google Inc.
  18061. *
  18062. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18063. * of this software and associated documentation files (the "Software"), to deal
  18064. * in the Software without restriction, including without limitation the rights
  18065. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18066. * copies of the Software, and to permit persons to whom the Software is
  18067. * furnished to do so, subject to the following conditions:
  18068. *
  18069. * The above copyright notice and this permission notice shall be included in
  18070. * all copies or substantial portions of the Software.
  18071. *
  18072. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18073. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18074. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18075. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18076. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18077. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18078. * THE SOFTWARE.
  18079. */
  18080. var __extends = this && this.__extends || function () {
  18081. var _extendStatics = function extendStatics(d, b) {
  18082. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18083. d.__proto__ = b;
  18084. } || function (d, b) {
  18085. for (var p in b) {
  18086. if (b.hasOwnProperty(p)) d[p] = b[p];
  18087. }
  18088. };
  18089. return _extendStatics(d, b);
  18090. };
  18091. return function (d, b) {
  18092. _extendStatics(d, b);
  18093. function __() {
  18094. this.constructor = d;
  18095. }
  18096. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18097. };
  18098. }();
  18099. var __assign = this && this.__assign || function () {
  18100. __assign = Object.assign || function (t) {
  18101. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18102. s = arguments[i];
  18103. for (var p in s) {
  18104. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18105. }
  18106. }
  18107. return t;
  18108. };
  18109. return __assign.apply(this, arguments);
  18110. };
  18111. var __importStar = this && this.__importStar || function (mod) {
  18112. if (mod && mod.__esModule) return mod;
  18113. var result = {};
  18114. if (mod != null) for (var k in mod) {
  18115. if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  18116. }result["default"] = mod;
  18117. return result;
  18118. };
  18119. Object.defineProperty(exports, "__esModule", { value: true });
  18120. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  18121. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  18122. var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  18123. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  18124. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  18125. var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  18126. var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  18127. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  18128. var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts");
  18129. var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  18130. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  18131. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
  18132. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts");
  18133. var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  18134. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts");
  18135. var MDCTextField = /** @class */function (_super) {
  18136. __extends(MDCTextField, _super);
  18137. function MDCTextField() {
  18138. return _super !== null && _super.apply(this, arguments) || this;
  18139. }
  18140. MDCTextField.attachTo = function (root) {
  18141. return new MDCTextField(root);
  18142. };
  18143. MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
  18144. if (rippleFactory === void 0) {
  18145. rippleFactory = function rippleFactory(el, foundation) {
  18146. return new component_5.MDCRipple(el, foundation);
  18147. };
  18148. }
  18149. if (lineRippleFactory === void 0) {
  18150. lineRippleFactory = function lineRippleFactory(el) {
  18151. return new component_3.MDCLineRipple(el);
  18152. };
  18153. }
  18154. if (helperTextFactory === void 0) {
  18155. helperTextFactory = function helperTextFactory(el) {
  18156. return new component_7.MDCTextFieldHelperText(el);
  18157. };
  18158. }
  18159. if (characterCounterFactory === void 0) {
  18160. characterCounterFactory = function characterCounterFactory(el) {
  18161. return new component_6.MDCTextFieldCharacterCounter(el);
  18162. };
  18163. }
  18164. if (iconFactory === void 0) {
  18165. iconFactory = function iconFactory(el) {
  18166. return new component_8.MDCTextFieldIcon(el);
  18167. };
  18168. }
  18169. if (labelFactory === void 0) {
  18170. labelFactory = function labelFactory(el) {
  18171. return new component_2.MDCFloatingLabel(el);
  18172. };
  18173. }
  18174. if (outlineFactory === void 0) {
  18175. outlineFactory = function outlineFactory(el) {
  18176. return new component_4.MDCNotchedOutline(el);
  18177. };
  18178. }
  18179. this.input_ = this.root_.querySelector(constants_1.strings.INPUT_SELECTOR);
  18180. var labelElement = this.root_.querySelector(constants_1.strings.LABEL_SELECTOR);
  18181. this.label_ = labelElement ? labelFactory(labelElement) : null;
  18182. var lineRippleElement = this.root_.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  18183. this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  18184. var outlineElement = this.root_.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  18185. this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
  18186. // Helper text
  18187. var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
  18188. var nextElementSibling = this.root_.nextElementSibling;
  18189. var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
  18190. var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
  18191. this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null;
  18192. // Character counter
  18193. var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
  18194. var characterCounterEl = this.root_.querySelector(characterCounterStrings.ROOT_SELECTOR);
  18195. // If character counter is not found in root element search in sibling element.
  18196. if (!characterCounterEl && hasHelperLine && nextElementSibling) {
  18197. characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
  18198. }
  18199. this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
  18200. // Leading icon
  18201. var leadingIconEl = this.root_.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  18202. this.leadingIcon_ = leadingIconEl ? iconFactory(leadingIconEl) : null;
  18203. // Trailing icon
  18204. var trailingIconEl = this.root_.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
  18205. this.trailingIcon_ = trailingIconEl ? iconFactory(trailingIconEl) : null;
  18206. this.ripple = this.createRipple_(rippleFactory);
  18207. };
  18208. MDCTextField.prototype.destroy = function () {
  18209. if (this.ripple) {
  18210. this.ripple.destroy();
  18211. }
  18212. if (this.lineRipple_) {
  18213. this.lineRipple_.destroy();
  18214. }
  18215. if (this.helperText_) {
  18216. this.helperText_.destroy();
  18217. }
  18218. if (this.characterCounter_) {
  18219. this.characterCounter_.destroy();
  18220. }
  18221. if (this.leadingIcon_) {
  18222. this.leadingIcon_.destroy();
  18223. }
  18224. if (this.trailingIcon_) {
  18225. this.trailingIcon_.destroy();
  18226. }
  18227. if (this.label_) {
  18228. this.label_.destroy();
  18229. }
  18230. if (this.outline_) {
  18231. this.outline_.destroy();
  18232. }
  18233. _super.prototype.destroy.call(this);
  18234. };
  18235. /**
  18236. * Initializes the Text Field's internal state based on the environment's
  18237. * state.
  18238. */
  18239. MDCTextField.prototype.initialSyncWithDOM = function () {
  18240. this.disabled = this.input_.disabled;
  18241. };
  18242. Object.defineProperty(MDCTextField.prototype, "value", {
  18243. get: function get() {
  18244. return this.foundation_.getValue();
  18245. },
  18246. /**
  18247. * @param value The value to set on the input.
  18248. */
  18249. set: function set(value) {
  18250. this.foundation_.setValue(value);
  18251. },
  18252. enumerable: true,
  18253. configurable: true
  18254. });
  18255. Object.defineProperty(MDCTextField.prototype, "disabled", {
  18256. get: function get() {
  18257. return this.foundation_.isDisabled();
  18258. },
  18259. /**
  18260. * @param disabled Sets the Text Field disabled or enabled.
  18261. */
  18262. set: function set(disabled) {
  18263. this.foundation_.setDisabled(disabled);
  18264. },
  18265. enumerable: true,
  18266. configurable: true
  18267. });
  18268. Object.defineProperty(MDCTextField.prototype, "valid", {
  18269. get: function get() {
  18270. return this.foundation_.isValid();
  18271. },
  18272. /**
  18273. * @param valid Sets the Text Field valid or invalid.
  18274. */
  18275. set: function set(valid) {
  18276. this.foundation_.setValid(valid);
  18277. },
  18278. enumerable: true,
  18279. configurable: true
  18280. });
  18281. Object.defineProperty(MDCTextField.prototype, "required", {
  18282. get: function get() {
  18283. return this.input_.required;
  18284. },
  18285. /**
  18286. * @param required Sets the Text Field to required.
  18287. */
  18288. set: function set(required) {
  18289. this.input_.required = required;
  18290. },
  18291. enumerable: true,
  18292. configurable: true
  18293. });
  18294. Object.defineProperty(MDCTextField.prototype, "pattern", {
  18295. get: function get() {
  18296. return this.input_.pattern;
  18297. },
  18298. /**
  18299. * @param pattern Sets the input element's validation pattern.
  18300. */
  18301. set: function set(pattern) {
  18302. this.input_.pattern = pattern;
  18303. },
  18304. enumerable: true,
  18305. configurable: true
  18306. });
  18307. Object.defineProperty(MDCTextField.prototype, "minLength", {
  18308. get: function get() {
  18309. return this.input_.minLength;
  18310. },
  18311. /**
  18312. * @param minLength Sets the input element's minLength.
  18313. */
  18314. set: function set(minLength) {
  18315. this.input_.minLength = minLength;
  18316. },
  18317. enumerable: true,
  18318. configurable: true
  18319. });
  18320. Object.defineProperty(MDCTextField.prototype, "maxLength", {
  18321. get: function get() {
  18322. return this.input_.maxLength;
  18323. },
  18324. /**
  18325. * @param maxLength Sets the input element's maxLength.
  18326. */
  18327. set: function set(maxLength) {
  18328. // Chrome throws exception if maxLength is set to a value less than zero
  18329. if (maxLength < 0) {
  18330. this.input_.removeAttribute('maxLength');
  18331. } else {
  18332. this.input_.maxLength = maxLength;
  18333. }
  18334. },
  18335. enumerable: true,
  18336. configurable: true
  18337. });
  18338. Object.defineProperty(MDCTextField.prototype, "min", {
  18339. get: function get() {
  18340. return this.input_.min;
  18341. },
  18342. /**
  18343. * @param min Sets the input element's min.
  18344. */
  18345. set: function set(min) {
  18346. this.input_.min = min;
  18347. },
  18348. enumerable: true,
  18349. configurable: true
  18350. });
  18351. Object.defineProperty(MDCTextField.prototype, "max", {
  18352. get: function get() {
  18353. return this.input_.max;
  18354. },
  18355. /**
  18356. * @param max Sets the input element's max.
  18357. */
  18358. set: function set(max) {
  18359. this.input_.max = max;
  18360. },
  18361. enumerable: true,
  18362. configurable: true
  18363. });
  18364. Object.defineProperty(MDCTextField.prototype, "step", {
  18365. get: function get() {
  18366. return this.input_.step;
  18367. },
  18368. /**
  18369. * @param step Sets the input element's step.
  18370. */
  18371. set: function set(step) {
  18372. this.input_.step = step;
  18373. },
  18374. enumerable: true,
  18375. configurable: true
  18376. });
  18377. Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
  18378. /**
  18379. * Sets the helper text element content.
  18380. */
  18381. set: function set(content) {
  18382. this.foundation_.setHelperTextContent(content);
  18383. },
  18384. enumerable: true,
  18385. configurable: true
  18386. });
  18387. Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
  18388. /**
  18389. * Sets the aria label of the leading icon.
  18390. */
  18391. set: function set(label) {
  18392. this.foundation_.setLeadingIconAriaLabel(label);
  18393. },
  18394. enumerable: true,
  18395. configurable: true
  18396. });
  18397. Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
  18398. /**
  18399. * Sets the text content of the leading icon.
  18400. */
  18401. set: function set(content) {
  18402. this.foundation_.setLeadingIconContent(content);
  18403. },
  18404. enumerable: true,
  18405. configurable: true
  18406. });
  18407. Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
  18408. /**
  18409. * Sets the aria label of the trailing icon.
  18410. */
  18411. set: function set(label) {
  18412. this.foundation_.setTrailingIconAriaLabel(label);
  18413. },
  18414. enumerable: true,
  18415. configurable: true
  18416. });
  18417. Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
  18418. /**
  18419. * Sets the text content of the trailing icon.
  18420. */
  18421. set: function set(content) {
  18422. this.foundation_.setTrailingIconContent(content);
  18423. },
  18424. enumerable: true,
  18425. configurable: true
  18426. });
  18427. Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
  18428. /**
  18429. * Enables or disables the use of native validation. Use this for custom validation.
  18430. * @param useNativeValidation Set this to false to ignore native input validation.
  18431. */
  18432. set: function set(useNativeValidation) {
  18433. this.foundation_.setUseNativeValidation(useNativeValidation);
  18434. },
  18435. enumerable: true,
  18436. configurable: true
  18437. });
  18438. /**
  18439. * Focuses the input element.
  18440. */
  18441. MDCTextField.prototype.focus = function () {
  18442. this.input_.focus();
  18443. };
  18444. /**
  18445. * Recomputes the outline SVG path for the outline element.
  18446. */
  18447. MDCTextField.prototype.layout = function () {
  18448. var openNotch = this.foundation_.shouldFloat;
  18449. this.foundation_.notchOutline(openNotch);
  18450. };
  18451. MDCTextField.prototype.getDefaultFoundation = function () {
  18452. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18453. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18454. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18455. var adapter = __assign({}, this.getRootAdapterMethods_(), this.getInputAdapterMethods_(), this.getLabelAdapterMethods_(), this.getLineRippleAdapterMethods_(), this.getOutlineAdapterMethods_());
  18456. // tslint:enable:object-literal-sort-keys
  18457. return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap_());
  18458. };
  18459. MDCTextField.prototype.getRootAdapterMethods_ = function () {
  18460. var _this = this;
  18461. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18462. return {
  18463. addClass: function addClass(className) {
  18464. return _this.root_.classList.add(className);
  18465. },
  18466. removeClass: function removeClass(className) {
  18467. return _this.root_.classList.remove(className);
  18468. },
  18469. hasClass: function hasClass(className) {
  18470. return _this.root_.classList.contains(className);
  18471. },
  18472. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
  18473. return _this.listen(evtType, handler);
  18474. },
  18475. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
  18476. return _this.unlisten(evtType, handler);
  18477. },
  18478. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
  18479. var getAttributesList = function getAttributesList(mutationsList) {
  18480. return mutationsList.map(function (mutation) {
  18481. return mutation.attributeName;
  18482. }).filter(function (attributeName) {
  18483. return attributeName;
  18484. });
  18485. };
  18486. var observer = new MutationObserver(function (mutationsList) {
  18487. return handler(getAttributesList(mutationsList));
  18488. });
  18489. var config = { attributes: true };
  18490. observer.observe(_this.input_, config);
  18491. return observer;
  18492. },
  18493. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
  18494. return observer.disconnect();
  18495. }
  18496. };
  18497. // tslint:enable:object-literal-sort-keys
  18498. };
  18499. MDCTextField.prototype.getInputAdapterMethods_ = function () {
  18500. var _this = this;
  18501. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18502. return {
  18503. getNativeInput: function getNativeInput() {
  18504. return _this.input_;
  18505. },
  18506. isFocused: function isFocused() {
  18507. return document.activeElement === _this.input_;
  18508. },
  18509. registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
  18510. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  18511. },
  18512. deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
  18513. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  18514. }
  18515. };
  18516. // tslint:enable:object-literal-sort-keys
  18517. };
  18518. MDCTextField.prototype.getLabelAdapterMethods_ = function () {
  18519. var _this = this;
  18520. return {
  18521. floatLabel: function floatLabel(shouldFloat) {
  18522. return _this.label_ && _this.label_.float(shouldFloat);
  18523. },
  18524. getLabelWidth: function getLabelWidth() {
  18525. return _this.label_ ? _this.label_.getWidth() : 0;
  18526. },
  18527. hasLabel: function hasLabel() {
  18528. return Boolean(_this.label_);
  18529. },
  18530. shakeLabel: function shakeLabel(shouldShake) {
  18531. return _this.label_ && _this.label_.shake(shouldShake);
  18532. }
  18533. };
  18534. };
  18535. MDCTextField.prototype.getLineRippleAdapterMethods_ = function () {
  18536. var _this = this;
  18537. return {
  18538. activateLineRipple: function activateLineRipple() {
  18539. if (_this.lineRipple_) {
  18540. _this.lineRipple_.activate();
  18541. }
  18542. },
  18543. deactivateLineRipple: function deactivateLineRipple() {
  18544. if (_this.lineRipple_) {
  18545. _this.lineRipple_.deactivate();
  18546. }
  18547. },
  18548. setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
  18549. if (_this.lineRipple_) {
  18550. _this.lineRipple_.setRippleCenter(normalizedX);
  18551. }
  18552. }
  18553. };
  18554. };
  18555. MDCTextField.prototype.getOutlineAdapterMethods_ = function () {
  18556. var _this = this;
  18557. return {
  18558. closeOutline: function closeOutline() {
  18559. return _this.outline_ && _this.outline_.closeNotch();
  18560. },
  18561. hasOutline: function hasOutline() {
  18562. return Boolean(_this.outline_);
  18563. },
  18564. notchOutline: function notchOutline(labelWidth) {
  18565. return _this.outline_ && _this.outline_.notch(labelWidth);
  18566. }
  18567. };
  18568. };
  18569. /**
  18570. * @return A map of all subcomponents to subfoundations.
  18571. */
  18572. MDCTextField.prototype.getFoundationMap_ = function () {
  18573. return {
  18574. characterCounter: this.characterCounter_ ? this.characterCounter_.foundation : undefined,
  18575. helperText: this.helperText_ ? this.helperText_.foundation : undefined,
  18576. leadingIcon: this.leadingIcon_ ? this.leadingIcon_.foundation : undefined,
  18577. trailingIcon: this.trailingIcon_ ? this.trailingIcon_.foundation : undefined
  18578. };
  18579. };
  18580. MDCTextField.prototype.createRipple_ = function (rippleFactory) {
  18581. var _this = this;
  18582. var isTextArea = this.root_.classList.contains(constants_1.cssClasses.TEXTAREA);
  18583. var isOutlined = this.root_.classList.contains(constants_1.cssClasses.OUTLINED);
  18584. if (isTextArea || isOutlined) {
  18585. return null;
  18586. }
  18587. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  18588. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  18589. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18590. var adapter = __assign({}, component_5.MDCRipple.createAdapter(this), { isSurfaceActive: function isSurfaceActive() {
  18591. return ponyfill.matches(_this.input_, ':active');
  18592. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  18593. return _this.input_.addEventListener(evtType, handler, events_1.applyPassive());
  18594. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  18595. return _this.input_.removeEventListener(evtType, handler, events_1.applyPassive());
  18596. } });
  18597. // tslint:enable:object-literal-sort-keys
  18598. return rippleFactory(this.root_, new foundation_1.MDCRippleFoundation(adapter));
  18599. };
  18600. return MDCTextField;
  18601. }(component_1.MDCComponent);
  18602. exports.MDCTextField = MDCTextField;
  18603. /***/ }),
  18604. /***/ "./packages/mdc-textfield/constants.ts":
  18605. /*!*********************************************!*\
  18606. !*** ./packages/mdc-textfield/constants.ts ***!
  18607. \*********************************************/
  18608. /*! no static exports found */
  18609. /***/ (function(module, exports, __webpack_require__) {
  18610. "use strict";
  18611. /**
  18612. * @license
  18613. * Copyright 2016 Google Inc.
  18614. *
  18615. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18616. * of this software and associated documentation files (the "Software"), to deal
  18617. * in the Software without restriction, including without limitation the rights
  18618. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18619. * copies of the Software, and to permit persons to whom the Software is
  18620. * furnished to do so, subject to the following conditions:
  18621. *
  18622. * The above copyright notice and this permission notice shall be included in
  18623. * all copies or substantial portions of the Software.
  18624. *
  18625. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18626. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18627. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18628. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18629. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18630. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18631. * THE SOFTWARE.
  18632. */
  18633. Object.defineProperty(exports, "__esModule", { value: true });
  18634. var strings = {
  18635. ARIA_CONTROLS: 'aria-controls',
  18636. INPUT_SELECTOR: '.mdc-text-field__input',
  18637. LABEL_SELECTOR: '.mdc-floating-label',
  18638. LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
  18639. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  18640. OUTLINE_SELECTOR: '.mdc-notched-outline',
  18641. TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
  18642. };
  18643. exports.strings = strings;
  18644. var cssClasses = {
  18645. DENSE: 'mdc-text-field--dense',
  18646. DISABLED: 'mdc-text-field--disabled',
  18647. FOCUSED: 'mdc-text-field--focused',
  18648. FULLWIDTH: 'mdc-text-field--fullwidth',
  18649. HELPER_LINE: 'mdc-text-field-helper-line',
  18650. INVALID: 'mdc-text-field--invalid',
  18651. NO_LABEL: 'mdc-text-field--no-label',
  18652. OUTLINED: 'mdc-text-field--outlined',
  18653. ROOT: 'mdc-text-field',
  18654. TEXTAREA: 'mdc-text-field--textarea',
  18655. WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
  18656. WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon'
  18657. };
  18658. exports.cssClasses = cssClasses;
  18659. var numbers = {
  18660. DENSE_LABEL_SCALE: 0.923,
  18661. LABEL_SCALE: 0.75
  18662. };
  18663. exports.numbers = numbers;
  18664. /**
  18665. * Whitelist based off of https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
  18666. * under the "Validation-related attributes" section.
  18667. */
  18668. var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
  18669. exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
  18670. /**
  18671. * Label should always float for these types as they show some UI even if value is empty.
  18672. */
  18673. var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
  18674. exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
  18675. /***/ }),
  18676. /***/ "./packages/mdc-textfield/foundation.ts":
  18677. /*!**********************************************!*\
  18678. !*** ./packages/mdc-textfield/foundation.ts ***!
  18679. \**********************************************/
  18680. /*! no static exports found */
  18681. /***/ (function(module, exports, __webpack_require__) {
  18682. "use strict";
  18683. /**
  18684. * @license
  18685. * Copyright 2016 Google Inc.
  18686. *
  18687. * Permission is hereby granted, free of charge, to any person obtaining a copy
  18688. * of this software and associated documentation files (the "Software"), to deal
  18689. * in the Software without restriction, including without limitation the rights
  18690. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18691. * copies of the Software, and to permit persons to whom the Software is
  18692. * furnished to do so, subject to the following conditions:
  18693. *
  18694. * The above copyright notice and this permission notice shall be included in
  18695. * all copies or substantial portions of the Software.
  18696. *
  18697. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18698. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18699. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18700. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18701. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18702. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18703. * THE SOFTWARE.
  18704. */
  18705. var __extends = this && this.__extends || function () {
  18706. var _extendStatics = function extendStatics(d, b) {
  18707. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  18708. d.__proto__ = b;
  18709. } || function (d, b) {
  18710. for (var p in b) {
  18711. if (b.hasOwnProperty(p)) d[p] = b[p];
  18712. }
  18713. };
  18714. return _extendStatics(d, b);
  18715. };
  18716. return function (d, b) {
  18717. _extendStatics(d, b);
  18718. function __() {
  18719. this.constructor = d;
  18720. }
  18721. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18722. };
  18723. }();
  18724. var __assign = this && this.__assign || function () {
  18725. __assign = Object.assign || function (t) {
  18726. for (var s, i = 1, n = arguments.length; i < n; i++) {
  18727. s = arguments[i];
  18728. for (var p in s) {
  18729. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  18730. }
  18731. }
  18732. return t;
  18733. };
  18734. return __assign.apply(this, arguments);
  18735. };
  18736. Object.defineProperty(exports, "__esModule", { value: true });
  18737. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  18738. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  18739. var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
  18740. var INTERACTION_EVENTS = ['click', 'keydown'];
  18741. var MDCTextFieldFoundation = /** @class */function (_super) {
  18742. __extends(MDCTextFieldFoundation, _super);
  18743. /**
  18744. * @param adapter
  18745. * @param foundationMap Map from subcomponent names to their subfoundations.
  18746. */
  18747. function MDCTextFieldFoundation(adapter, foundationMap) {
  18748. if (foundationMap === void 0) {
  18749. foundationMap = {};
  18750. }
  18751. var _this = _super.call(this, __assign({}, MDCTextFieldFoundation.defaultAdapter, adapter)) || this;
  18752. _this.isFocused_ = false;
  18753. _this.receivedUserInput_ = false;
  18754. _this.isValid_ = true;
  18755. _this.useNativeValidation_ = true;
  18756. _this.helperText_ = foundationMap.helperText;
  18757. _this.characterCounter_ = foundationMap.characterCounter;
  18758. _this.leadingIcon_ = foundationMap.leadingIcon;
  18759. _this.trailingIcon_ = foundationMap.trailingIcon;
  18760. _this.inputFocusHandler_ = function () {
  18761. return _this.activateFocus();
  18762. };
  18763. _this.inputBlurHandler_ = function () {
  18764. return _this.deactivateFocus();
  18765. };
  18766. _this.inputInputHandler_ = function () {
  18767. return _this.handleInput();
  18768. };
  18769. _this.setPointerXOffset_ = function (evt) {
  18770. return _this.setTransformOrigin(evt);
  18771. };
  18772. _this.textFieldInteractionHandler_ = function () {
  18773. return _this.handleTextFieldInteraction();
  18774. };
  18775. _this.validationAttributeChangeHandler_ = function (attributesList) {
  18776. return _this.handleValidationAttributeChange(attributesList);
  18777. };
  18778. return _this;
  18779. }
  18780. Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
  18781. get: function get() {
  18782. return constants_1.cssClasses;
  18783. },
  18784. enumerable: true,
  18785. configurable: true
  18786. });
  18787. Object.defineProperty(MDCTextFieldFoundation, "strings", {
  18788. get: function get() {
  18789. return constants_1.strings;
  18790. },
  18791. enumerable: true,
  18792. configurable: true
  18793. });
  18794. Object.defineProperty(MDCTextFieldFoundation, "numbers", {
  18795. get: function get() {
  18796. return constants_1.numbers;
  18797. },
  18798. enumerable: true,
  18799. configurable: true
  18800. });
  18801. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat_", {
  18802. get: function get() {
  18803. var type = this.getNativeInput_().type;
  18804. return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
  18805. },
  18806. enumerable: true,
  18807. configurable: true
  18808. });
  18809. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
  18810. get: function get() {
  18811. return this.shouldAlwaysFloat_ || this.isFocused_ || !!this.getValue() || this.isBadInput_();
  18812. },
  18813. enumerable: true,
  18814. configurable: true
  18815. });
  18816. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
  18817. get: function get() {
  18818. return !this.isFocused_ && !this.isValid() && !!this.getValue();
  18819. },
  18820. enumerable: true,
  18821. configurable: true
  18822. });
  18823. Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
  18824. /**
  18825. * See {@link MDCTextFieldAdapter} for typing information on parameters and return types.
  18826. */
  18827. get: function get() {
  18828. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  18829. return {
  18830. addClass: function addClass() {
  18831. return undefined;
  18832. },
  18833. removeClass: function removeClass() {
  18834. return undefined;
  18835. },
  18836. hasClass: function hasClass() {
  18837. return true;
  18838. },
  18839. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
  18840. return undefined;
  18841. },
  18842. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
  18843. return undefined;
  18844. },
  18845. registerInputInteractionHandler: function registerInputInteractionHandler() {
  18846. return undefined;
  18847. },
  18848. deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
  18849. return undefined;
  18850. },
  18851. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
  18852. return new MutationObserver(function () {
  18853. return undefined;
  18854. });
  18855. },
  18856. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
  18857. return undefined;
  18858. },
  18859. getNativeInput: function getNativeInput() {
  18860. return null;
  18861. },
  18862. isFocused: function isFocused() {
  18863. return false;
  18864. },
  18865. activateLineRipple: function activateLineRipple() {
  18866. return undefined;
  18867. },
  18868. deactivateLineRipple: function deactivateLineRipple() {
  18869. return undefined;
  18870. },
  18871. setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
  18872. return undefined;
  18873. },
  18874. shakeLabel: function shakeLabel() {
  18875. return undefined;
  18876. },
  18877. floatLabel: function floatLabel() {
  18878. return undefined;
  18879. },
  18880. hasLabel: function hasLabel() {
  18881. return false;
  18882. },
  18883. getLabelWidth: function getLabelWidth() {
  18884. return 0;
  18885. },
  18886. hasOutline: function hasOutline() {
  18887. return false;
  18888. },
  18889. notchOutline: function notchOutline() {
  18890. return undefined;
  18891. },
  18892. closeOutline: function closeOutline() {
  18893. return undefined;
  18894. }
  18895. };
  18896. // tslint:enable:object-literal-sort-keys
  18897. },
  18898. enumerable: true,
  18899. configurable: true
  18900. });
  18901. MDCTextFieldFoundation.prototype.init = function () {
  18902. var _this = this;
  18903. if (this.adapter_.isFocused()) {
  18904. this.inputFocusHandler_();
  18905. } else if (this.adapter_.hasLabel() && this.shouldFloat) {
  18906. this.notchOutline(true);
  18907. this.adapter_.floatLabel(true);
  18908. }
  18909. this.adapter_.registerInputInteractionHandler('focus', this.inputFocusHandler_);
  18910. this.adapter_.registerInputInteractionHandler('blur', this.inputBlurHandler_);
  18911. this.adapter_.registerInputInteractionHandler('input', this.inputInputHandler_);
  18912. POINTERDOWN_EVENTS.forEach(function (evtType) {
  18913. _this.adapter_.registerInputInteractionHandler(evtType, _this.setPointerXOffset_);
  18914. });
  18915. INTERACTION_EVENTS.forEach(function (evtType) {
  18916. _this.adapter_.registerTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  18917. });
  18918. this.validationObserver_ = this.adapter_.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler_);
  18919. this.setCharacterCounter_(this.getValue().length);
  18920. };
  18921. MDCTextFieldFoundation.prototype.destroy = function () {
  18922. var _this = this;
  18923. this.adapter_.deregisterInputInteractionHandler('focus', this.inputFocusHandler_);
  18924. this.adapter_.deregisterInputInteractionHandler('blur', this.inputBlurHandler_);
  18925. this.adapter_.deregisterInputInteractionHandler('input', this.inputInputHandler_);
  18926. POINTERDOWN_EVENTS.forEach(function (evtType) {
  18927. _this.adapter_.deregisterInputInteractionHandler(evtType, _this.setPointerXOffset_);
  18928. });
  18929. INTERACTION_EVENTS.forEach(function (evtType) {
  18930. _this.adapter_.deregisterTextFieldInteractionHandler(evtType, _this.textFieldInteractionHandler_);
  18931. });
  18932. this.adapter_.deregisterValidationAttributeChangeHandler(this.validationObserver_);
  18933. };
  18934. /**
  18935. * Handles user interactions with the Text Field.
  18936. */
  18937. MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
  18938. var nativeInput = this.adapter_.getNativeInput();
  18939. if (nativeInput && nativeInput.disabled) {
  18940. return;
  18941. }
  18942. this.receivedUserInput_ = true;
  18943. };
  18944. /**
  18945. * Handles validation attribute changes
  18946. */
  18947. MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
  18948. var _this = this;
  18949. attributesList.some(function (attributeName) {
  18950. if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
  18951. _this.styleValidity_(true);
  18952. return true;
  18953. }
  18954. return false;
  18955. });
  18956. if (attributesList.indexOf('maxlength') > -1) {
  18957. this.setCharacterCounter_(this.getValue().length);
  18958. }
  18959. };
  18960. /**
  18961. * Opens/closes the notched outline.
  18962. */
  18963. MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
  18964. if (!this.adapter_.hasOutline()) {
  18965. return;
  18966. }
  18967. if (openNotch) {
  18968. var isDense = this.adapter_.hasClass(constants_1.cssClasses.DENSE);
  18969. var labelScale = isDense ? constants_1.numbers.DENSE_LABEL_SCALE : constants_1.numbers.LABEL_SCALE;
  18970. var labelWidth = this.adapter_.getLabelWidth() * labelScale;
  18971. this.adapter_.notchOutline(labelWidth);
  18972. } else {
  18973. this.adapter_.closeOutline();
  18974. }
  18975. };
  18976. /**
  18977. * Activates the text field focus state.
  18978. */
  18979. MDCTextFieldFoundation.prototype.activateFocus = function () {
  18980. this.isFocused_ = true;
  18981. this.styleFocused_(this.isFocused_);
  18982. this.adapter_.activateLineRipple();
  18983. if (this.adapter_.hasLabel()) {
  18984. this.notchOutline(this.shouldFloat);
  18985. this.adapter_.floatLabel(this.shouldFloat);
  18986. this.adapter_.shakeLabel(this.shouldShake);
  18987. }
  18988. if (this.helperText_) {
  18989. this.helperText_.showToScreenReader();
  18990. }
  18991. };
  18992. /**
  18993. * Sets the line ripple's transform origin, so that the line ripple activate
  18994. * animation will animate out from the user's click location.
  18995. */
  18996. MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
  18997. var touches = evt.touches;
  18998. var targetEvent = touches ? touches[0] : evt;
  18999. var targetClientRect = targetEvent.target.getBoundingClientRect();
  19000. var normalizedX = targetEvent.clientX - targetClientRect.left;
  19001. this.adapter_.setLineRippleTransformOrigin(normalizedX);
  19002. };
  19003. /**
  19004. * Handles input change of text input and text area.
  19005. */
  19006. MDCTextFieldFoundation.prototype.handleInput = function () {
  19007. this.autoCompleteFocus();
  19008. this.setCharacterCounter_(this.getValue().length);
  19009. };
  19010. /**
  19011. * Activates the Text Field's focus state in cases when the input value
  19012. * changes without user input (e.g. programmatically).
  19013. */
  19014. MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
  19015. if (!this.receivedUserInput_) {
  19016. this.activateFocus();
  19017. }
  19018. };
  19019. /**
  19020. * Deactivates the Text Field's focus state.
  19021. */
  19022. MDCTextFieldFoundation.prototype.deactivateFocus = function () {
  19023. this.isFocused_ = false;
  19024. this.adapter_.deactivateLineRipple();
  19025. var isValid = this.isValid();
  19026. this.styleValidity_(isValid);
  19027. this.styleFocused_(this.isFocused_);
  19028. if (this.adapter_.hasLabel()) {
  19029. this.notchOutline(this.shouldFloat);
  19030. this.adapter_.floatLabel(this.shouldFloat);
  19031. this.adapter_.shakeLabel(this.shouldShake);
  19032. }
  19033. if (!this.shouldFloat) {
  19034. this.receivedUserInput_ = false;
  19035. }
  19036. };
  19037. MDCTextFieldFoundation.prototype.getValue = function () {
  19038. return this.getNativeInput_().value;
  19039. };
  19040. /**
  19041. * @param value The value to set on the input Element.
  19042. */
  19043. MDCTextFieldFoundation.prototype.setValue = function (value) {
  19044. // Prevent Safari from moving the caret to the end of the input when the value has not changed.
  19045. if (this.getValue() !== value) {
  19046. this.getNativeInput_().value = value;
  19047. }
  19048. this.setCharacterCounter_(value.length);
  19049. var isValid = this.isValid();
  19050. this.styleValidity_(isValid);
  19051. if (this.adapter_.hasLabel()) {
  19052. this.notchOutline(this.shouldFloat);
  19053. this.adapter_.floatLabel(this.shouldFloat);
  19054. this.adapter_.shakeLabel(this.shouldShake);
  19055. }
  19056. };
  19057. /**
  19058. * @return The custom validity state, if set; otherwise, the result of a native validity check.
  19059. */
  19060. MDCTextFieldFoundation.prototype.isValid = function () {
  19061. return this.useNativeValidation_ ? this.isNativeInputValid_() : this.isValid_;
  19062. };
  19063. /**
  19064. * @param isValid Sets the custom validity state of the Text Field.
  19065. */
  19066. MDCTextFieldFoundation.prototype.setValid = function (isValid) {
  19067. this.isValid_ = isValid;
  19068. this.styleValidity_(isValid);
  19069. var shouldShake = !isValid && !this.isFocused_ && !!this.getValue();
  19070. if (this.adapter_.hasLabel()) {
  19071. this.adapter_.shakeLabel(shouldShake);
  19072. }
  19073. };
  19074. /**
  19075. * Enables or disables the use of native validation. Use this for custom validation.
  19076. * @param useNativeValidation Set this to false to ignore native input validation.
  19077. */
  19078. MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
  19079. this.useNativeValidation_ = useNativeValidation;
  19080. };
  19081. MDCTextFieldFoundation.prototype.isDisabled = function () {
  19082. return this.getNativeInput_().disabled;
  19083. };
  19084. /**
  19085. * @param disabled Sets the text-field disabled or enabled.
  19086. */
  19087. MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
  19088. this.getNativeInput_().disabled = disabled;
  19089. this.styleDisabled_(disabled);
  19090. };
  19091. /**
  19092. * @param content Sets the content of the helper text.
  19093. */
  19094. MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
  19095. if (this.helperText_) {
  19096. this.helperText_.setContent(content);
  19097. }
  19098. };
  19099. /**
  19100. * Sets the aria label of the leading icon.
  19101. */
  19102. MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  19103. if (this.leadingIcon_) {
  19104. this.leadingIcon_.setAriaLabel(label);
  19105. }
  19106. };
  19107. /**
  19108. * Sets the text content of the leading icon.
  19109. */
  19110. MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
  19111. if (this.leadingIcon_) {
  19112. this.leadingIcon_.setContent(content);
  19113. }
  19114. };
  19115. /**
  19116. * Sets the aria label of the trailing icon.
  19117. */
  19118. MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
  19119. if (this.trailingIcon_) {
  19120. this.trailingIcon_.setAriaLabel(label);
  19121. }
  19122. };
  19123. /**
  19124. * Sets the text content of the trailing icon.
  19125. */
  19126. MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
  19127. if (this.trailingIcon_) {
  19128. this.trailingIcon_.setContent(content);
  19129. }
  19130. };
  19131. /**
  19132. * Sets character counter values that shows characters used and the total character limit.
  19133. */
  19134. MDCTextFieldFoundation.prototype.setCharacterCounter_ = function (currentLength) {
  19135. if (!this.characterCounter_) {
  19136. return;
  19137. }
  19138. var maxLength = this.getNativeInput_().maxLength;
  19139. if (maxLength === -1) {
  19140. throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
  19141. }
  19142. this.characterCounter_.setCounterValue(currentLength, maxLength);
  19143. };
  19144. /**
  19145. * @return True if the Text Field input fails in converting the user-supplied value.
  19146. */
  19147. MDCTextFieldFoundation.prototype.isBadInput_ = function () {
  19148. // The badInput property is not supported in IE 11 💩.
  19149. return this.getNativeInput_().validity.badInput || false;
  19150. };
  19151. /**
  19152. * @return The result of native validity checking (ValidityState.valid).
  19153. */
  19154. MDCTextFieldFoundation.prototype.isNativeInputValid_ = function () {
  19155. return this.getNativeInput_().validity.valid;
  19156. };
  19157. /**
  19158. * Styles the component based on the validity state.
  19159. */
  19160. MDCTextFieldFoundation.prototype.styleValidity_ = function (isValid) {
  19161. var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
  19162. if (isValid) {
  19163. this.adapter_.removeClass(INVALID);
  19164. } else {
  19165. this.adapter_.addClass(INVALID);
  19166. }
  19167. if (this.helperText_) {
  19168. this.helperText_.setValidity(isValid);
  19169. }
  19170. };
  19171. /**
  19172. * Styles the component based on the focused state.
  19173. */
  19174. MDCTextFieldFoundation.prototype.styleFocused_ = function (isFocused) {
  19175. var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
  19176. if (isFocused) {
  19177. this.adapter_.addClass(FOCUSED);
  19178. } else {
  19179. this.adapter_.removeClass(FOCUSED);
  19180. }
  19181. };
  19182. /**
  19183. * Styles the component based on the disabled state.
  19184. */
  19185. MDCTextFieldFoundation.prototype.styleDisabled_ = function (isDisabled) {
  19186. var _a = MDCTextFieldFoundation.cssClasses,
  19187. DISABLED = _a.DISABLED,
  19188. INVALID = _a.INVALID;
  19189. if (isDisabled) {
  19190. this.adapter_.addClass(DISABLED);
  19191. this.adapter_.removeClass(INVALID);
  19192. } else {
  19193. this.adapter_.removeClass(DISABLED);
  19194. }
  19195. if (this.leadingIcon_) {
  19196. this.leadingIcon_.setDisabled(isDisabled);
  19197. }
  19198. if (this.trailingIcon_) {
  19199. this.trailingIcon_.setDisabled(isDisabled);
  19200. }
  19201. };
  19202. /**
  19203. * @return The native text input element from the host environment, or an object with the same shape for unit tests.
  19204. */
  19205. MDCTextFieldFoundation.prototype.getNativeInput_ = function () {
  19206. // this.adapter_ may be undefined in foundation unit tests. This happens when testdouble is creating a mock object
  19207. // and invokes the shouldShake/shouldFloat getters (which in turn call getValue(), which calls this method) before
  19208. // init() has been called from the MDCTextField constructor. To work around that issue, we return a dummy object.
  19209. var nativeInput = this.adapter_ ? this.adapter_.getNativeInput() : null;
  19210. return nativeInput || {
  19211. disabled: false,
  19212. maxLength: -1,
  19213. type: 'input',
  19214. validity: {
  19215. badInput: false,
  19216. valid: true
  19217. },
  19218. value: ''
  19219. };
  19220. };
  19221. return MDCTextFieldFoundation;
  19222. }(foundation_1.MDCFoundation);
  19223. exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
  19224. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19225. exports.default = MDCTextFieldFoundation;
  19226. /***/ }),
  19227. /***/ "./packages/mdc-textfield/helper-text/component.ts":
  19228. /*!*********************************************************!*\
  19229. !*** ./packages/mdc-textfield/helper-text/component.ts ***!
  19230. \*********************************************************/
  19231. /*! no static exports found */
  19232. /***/ (function(module, exports, __webpack_require__) {
  19233. "use strict";
  19234. /**
  19235. * @license
  19236. * Copyright 2017 Google Inc.
  19237. *
  19238. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19239. * of this software and associated documentation files (the "Software"), to deal
  19240. * in the Software without restriction, including without limitation the rights
  19241. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19242. * copies of the Software, and to permit persons to whom the Software is
  19243. * furnished to do so, subject to the following conditions:
  19244. *
  19245. * The above copyright notice and this permission notice shall be included in
  19246. * all copies or substantial portions of the Software.
  19247. *
  19248. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19249. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19250. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19251. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19252. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19253. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19254. * THE SOFTWARE.
  19255. */
  19256. var __extends = this && this.__extends || function () {
  19257. var _extendStatics = function extendStatics(d, b) {
  19258. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19259. d.__proto__ = b;
  19260. } || function (d, b) {
  19261. for (var p in b) {
  19262. if (b.hasOwnProperty(p)) d[p] = b[p];
  19263. }
  19264. };
  19265. return _extendStatics(d, b);
  19266. };
  19267. return function (d, b) {
  19268. _extendStatics(d, b);
  19269. function __() {
  19270. this.constructor = d;
  19271. }
  19272. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19273. };
  19274. }();
  19275. Object.defineProperty(exports, "__esModule", { value: true });
  19276. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  19277. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  19278. var MDCTextFieldHelperText = /** @class */function (_super) {
  19279. __extends(MDCTextFieldHelperText, _super);
  19280. function MDCTextFieldHelperText() {
  19281. return _super !== null && _super.apply(this, arguments) || this;
  19282. }
  19283. MDCTextFieldHelperText.attachTo = function (root) {
  19284. return new MDCTextFieldHelperText(root);
  19285. };
  19286. Object.defineProperty(MDCTextFieldHelperText.prototype, "foundation", {
  19287. get: function get() {
  19288. return this.foundation_;
  19289. },
  19290. enumerable: true,
  19291. configurable: true
  19292. });
  19293. MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
  19294. var _this = this;
  19295. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19296. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19297. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19298. var adapter = {
  19299. addClass: function addClass(className) {
  19300. return _this.root_.classList.add(className);
  19301. },
  19302. removeClass: function removeClass(className) {
  19303. return _this.root_.classList.remove(className);
  19304. },
  19305. hasClass: function hasClass(className) {
  19306. return _this.root_.classList.contains(className);
  19307. },
  19308. setAttr: function setAttr(attr, value) {
  19309. return _this.root_.setAttribute(attr, value);
  19310. },
  19311. removeAttr: function removeAttr(attr) {
  19312. return _this.root_.removeAttribute(attr);
  19313. },
  19314. setContent: function setContent(content) {
  19315. _this.root_.textContent = content;
  19316. }
  19317. };
  19318. // tslint:enable:object-literal-sort-keys
  19319. return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
  19320. };
  19321. return MDCTextFieldHelperText;
  19322. }(component_1.MDCComponent);
  19323. exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
  19324. /***/ }),
  19325. /***/ "./packages/mdc-textfield/helper-text/constants.ts":
  19326. /*!*********************************************************!*\
  19327. !*** ./packages/mdc-textfield/helper-text/constants.ts ***!
  19328. \*********************************************************/
  19329. /*! no static exports found */
  19330. /***/ (function(module, exports, __webpack_require__) {
  19331. "use strict";
  19332. /**
  19333. * @license
  19334. * Copyright 2016 Google Inc.
  19335. *
  19336. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19337. * of this software and associated documentation files (the "Software"), to deal
  19338. * in the Software without restriction, including without limitation the rights
  19339. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19340. * copies of the Software, and to permit persons to whom the Software is
  19341. * furnished to do so, subject to the following conditions:
  19342. *
  19343. * The above copyright notice and this permission notice shall be included in
  19344. * all copies or substantial portions of the Software.
  19345. *
  19346. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19347. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19348. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19349. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19350. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19351. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19352. * THE SOFTWARE.
  19353. */
  19354. Object.defineProperty(exports, "__esModule", { value: true });
  19355. var cssClasses = {
  19356. HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
  19357. HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
  19358. ROOT: 'mdc-text-field-helper-text'
  19359. };
  19360. exports.cssClasses = cssClasses;
  19361. var strings = {
  19362. ARIA_HIDDEN: 'aria-hidden',
  19363. ROLE: 'role',
  19364. ROOT_SELECTOR: "." + cssClasses.ROOT
  19365. };
  19366. exports.strings = strings;
  19367. /***/ }),
  19368. /***/ "./packages/mdc-textfield/helper-text/foundation.ts":
  19369. /*!**********************************************************!*\
  19370. !*** ./packages/mdc-textfield/helper-text/foundation.ts ***!
  19371. \**********************************************************/
  19372. /*! no static exports found */
  19373. /***/ (function(module, exports, __webpack_require__) {
  19374. "use strict";
  19375. /**
  19376. * @license
  19377. * Copyright 2017 Google Inc.
  19378. *
  19379. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19380. * of this software and associated documentation files (the "Software"), to deal
  19381. * in the Software without restriction, including without limitation the rights
  19382. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19383. * copies of the Software, and to permit persons to whom the Software is
  19384. * furnished to do so, subject to the following conditions:
  19385. *
  19386. * The above copyright notice and this permission notice shall be included in
  19387. * all copies or substantial portions of the Software.
  19388. *
  19389. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19390. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19391. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19392. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19393. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19394. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19395. * THE SOFTWARE.
  19396. */
  19397. var __extends = this && this.__extends || function () {
  19398. var _extendStatics = function extendStatics(d, b) {
  19399. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19400. d.__proto__ = b;
  19401. } || function (d, b) {
  19402. for (var p in b) {
  19403. if (b.hasOwnProperty(p)) d[p] = b[p];
  19404. }
  19405. };
  19406. return _extendStatics(d, b);
  19407. };
  19408. return function (d, b) {
  19409. _extendStatics(d, b);
  19410. function __() {
  19411. this.constructor = d;
  19412. }
  19413. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19414. };
  19415. }();
  19416. var __assign = this && this.__assign || function () {
  19417. __assign = Object.assign || function (t) {
  19418. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19419. s = arguments[i];
  19420. for (var p in s) {
  19421. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19422. }
  19423. }
  19424. return t;
  19425. };
  19426. return __assign.apply(this, arguments);
  19427. };
  19428. Object.defineProperty(exports, "__esModule", { value: true });
  19429. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19430. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  19431. var MDCTextFieldHelperTextFoundation = /** @class */function (_super) {
  19432. __extends(MDCTextFieldHelperTextFoundation, _super);
  19433. function MDCTextFieldHelperTextFoundation(adapter) {
  19434. return _super.call(this, __assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter, adapter)) || this;
  19435. }
  19436. Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
  19437. get: function get() {
  19438. return constants_1.cssClasses;
  19439. },
  19440. enumerable: true,
  19441. configurable: true
  19442. });
  19443. Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
  19444. get: function get() {
  19445. return constants_1.strings;
  19446. },
  19447. enumerable: true,
  19448. configurable: true
  19449. });
  19450. Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
  19451. /**
  19452. * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.
  19453. */
  19454. get: function get() {
  19455. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19456. return {
  19457. addClass: function addClass() {
  19458. return undefined;
  19459. },
  19460. removeClass: function removeClass() {
  19461. return undefined;
  19462. },
  19463. hasClass: function hasClass() {
  19464. return false;
  19465. },
  19466. setAttr: function setAttr() {
  19467. return undefined;
  19468. },
  19469. removeAttr: function removeAttr() {
  19470. return undefined;
  19471. },
  19472. setContent: function setContent() {
  19473. return undefined;
  19474. }
  19475. };
  19476. // tslint:enable:object-literal-sort-keys
  19477. },
  19478. enumerable: true,
  19479. configurable: true
  19480. });
  19481. /**
  19482. * Sets the content of the helper text field.
  19483. */
  19484. MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
  19485. this.adapter_.setContent(content);
  19486. };
  19487. /**
  19488. * @param isPersistent Sets the persistency of the helper text.
  19489. */
  19490. MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  19491. if (isPersistent) {
  19492. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  19493. } else {
  19494. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  19495. }
  19496. };
  19497. /**
  19498. * @param isValidation True to make the helper text act as an error validation message.
  19499. */
  19500. MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
  19501. if (isValidation) {
  19502. this.adapter_.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  19503. } else {
  19504. this.adapter_.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  19505. }
  19506. };
  19507. /**
  19508. * Makes the helper text visible to the screen reader.
  19509. */
  19510. MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
  19511. this.adapter_.removeAttr(constants_1.strings.ARIA_HIDDEN);
  19512. };
  19513. /**
  19514. * Sets the validity of the helper text based on the input validity.
  19515. */
  19516. MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
  19517. var helperTextIsPersistent = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  19518. var helperTextIsValidationMsg = this.adapter_.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  19519. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
  19520. if (validationMsgNeedsDisplay) {
  19521. this.adapter_.setAttr(constants_1.strings.ROLE, 'alert');
  19522. } else {
  19523. this.adapter_.removeAttr(constants_1.strings.ROLE);
  19524. }
  19525. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  19526. this.hide_();
  19527. }
  19528. };
  19529. /**
  19530. * Hides the help text from screen readers.
  19531. */
  19532. MDCTextFieldHelperTextFoundation.prototype.hide_ = function () {
  19533. this.adapter_.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  19534. };
  19535. return MDCTextFieldHelperTextFoundation;
  19536. }(foundation_1.MDCFoundation);
  19537. exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
  19538. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19539. exports.default = MDCTextFieldHelperTextFoundation;
  19540. /***/ }),
  19541. /***/ "./packages/mdc-textfield/helper-text/index.ts":
  19542. /*!*****************************************************!*\
  19543. !*** ./packages/mdc-textfield/helper-text/index.ts ***!
  19544. \*****************************************************/
  19545. /*! no static exports found */
  19546. /***/ (function(module, exports, __webpack_require__) {
  19547. "use strict";
  19548. /**
  19549. * @license
  19550. * Copyright 2019 Google Inc.
  19551. *
  19552. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19553. * of this software and associated documentation files (the "Software"), to deal
  19554. * in the Software without restriction, including without limitation the rights
  19555. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19556. * copies of the Software, and to permit persons to whom the Software is
  19557. * furnished to do so, subject to the following conditions:
  19558. *
  19559. * The above copyright notice and this permission notice shall be included in
  19560. * all copies or substantial portions of the Software.
  19561. *
  19562. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19563. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19564. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19565. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19566. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19567. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19568. * THE SOFTWARE.
  19569. */
  19570. function __export(m) {
  19571. for (var p in m) {
  19572. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  19573. }
  19574. }
  19575. Object.defineProperty(exports, "__esModule", { value: true });
  19576. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"));
  19577. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"));
  19578. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  19579. exports.helperTextCssClasses = constants_1.cssClasses;
  19580. exports.helperTextStrings = constants_1.strings;
  19581. /***/ }),
  19582. /***/ "./packages/mdc-textfield/icon/component.ts":
  19583. /*!**************************************************!*\
  19584. !*** ./packages/mdc-textfield/icon/component.ts ***!
  19585. \**************************************************/
  19586. /*! no static exports found */
  19587. /***/ (function(module, exports, __webpack_require__) {
  19588. "use strict";
  19589. /**
  19590. * @license
  19591. * Copyright 2017 Google Inc.
  19592. *
  19593. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19594. * of this software and associated documentation files (the "Software"), to deal
  19595. * in the Software without restriction, including without limitation the rights
  19596. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19597. * copies of the Software, and to permit persons to whom the Software is
  19598. * furnished to do so, subject to the following conditions:
  19599. *
  19600. * The above copyright notice and this permission notice shall be included in
  19601. * all copies or substantial portions of the Software.
  19602. *
  19603. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19604. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19605. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19606. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19607. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19608. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19609. * THE SOFTWARE.
  19610. */
  19611. var __extends = this && this.__extends || function () {
  19612. var _extendStatics = function extendStatics(d, b) {
  19613. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19614. d.__proto__ = b;
  19615. } || function (d, b) {
  19616. for (var p in b) {
  19617. if (b.hasOwnProperty(p)) d[p] = b[p];
  19618. }
  19619. };
  19620. return _extendStatics(d, b);
  19621. };
  19622. return function (d, b) {
  19623. _extendStatics(d, b);
  19624. function __() {
  19625. this.constructor = d;
  19626. }
  19627. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19628. };
  19629. }();
  19630. Object.defineProperty(exports, "__esModule", { value: true });
  19631. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  19632. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts");
  19633. var MDCTextFieldIcon = /** @class */function (_super) {
  19634. __extends(MDCTextFieldIcon, _super);
  19635. function MDCTextFieldIcon() {
  19636. return _super !== null && _super.apply(this, arguments) || this;
  19637. }
  19638. MDCTextFieldIcon.attachTo = function (root) {
  19639. return new MDCTextFieldIcon(root);
  19640. };
  19641. Object.defineProperty(MDCTextFieldIcon.prototype, "foundation", {
  19642. get: function get() {
  19643. return this.foundation_;
  19644. },
  19645. enumerable: true,
  19646. configurable: true
  19647. });
  19648. MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
  19649. var _this = this;
  19650. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  19651. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  19652. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19653. var adapter = {
  19654. getAttr: function getAttr(attr) {
  19655. return _this.root_.getAttribute(attr);
  19656. },
  19657. setAttr: function setAttr(attr, value) {
  19658. return _this.root_.setAttribute(attr, value);
  19659. },
  19660. removeAttr: function removeAttr(attr) {
  19661. return _this.root_.removeAttribute(attr);
  19662. },
  19663. setContent: function setContent(content) {
  19664. _this.root_.textContent = content;
  19665. },
  19666. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  19667. return _this.listen(evtType, handler);
  19668. },
  19669. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  19670. return _this.unlisten(evtType, handler);
  19671. },
  19672. notifyIconAction: function notifyIconAction() {
  19673. return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  19674. }
  19675. };
  19676. // tslint:enable:object-literal-sort-keys
  19677. return new foundation_1.MDCTextFieldIconFoundation(adapter);
  19678. };
  19679. return MDCTextFieldIcon;
  19680. }(component_1.MDCComponent);
  19681. exports.MDCTextFieldIcon = MDCTextFieldIcon;
  19682. /***/ }),
  19683. /***/ "./packages/mdc-textfield/icon/constants.ts":
  19684. /*!**************************************************!*\
  19685. !*** ./packages/mdc-textfield/icon/constants.ts ***!
  19686. \**************************************************/
  19687. /*! no static exports found */
  19688. /***/ (function(module, exports, __webpack_require__) {
  19689. "use strict";
  19690. /**
  19691. * @license
  19692. * Copyright 2016 Google Inc.
  19693. *
  19694. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19695. * of this software and associated documentation files (the "Software"), to deal
  19696. * in the Software without restriction, including without limitation the rights
  19697. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19698. * copies of the Software, and to permit persons to whom the Software is
  19699. * furnished to do so, subject to the following conditions:
  19700. *
  19701. * The above copyright notice and this permission notice shall be included in
  19702. * all copies or substantial portions of the Software.
  19703. *
  19704. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19705. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19706. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19707. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19708. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19709. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19710. * THE SOFTWARE.
  19711. */
  19712. Object.defineProperty(exports, "__esModule", { value: true });
  19713. var strings = {
  19714. ICON_EVENT: 'MDCTextField:icon',
  19715. ICON_ROLE: 'button'
  19716. };
  19717. exports.strings = strings;
  19718. var cssClasses = {
  19719. ROOT: 'mdc-text-field__icon'
  19720. };
  19721. exports.cssClasses = cssClasses;
  19722. /***/ }),
  19723. /***/ "./packages/mdc-textfield/icon/foundation.ts":
  19724. /*!***************************************************!*\
  19725. !*** ./packages/mdc-textfield/icon/foundation.ts ***!
  19726. \***************************************************/
  19727. /*! no static exports found */
  19728. /***/ (function(module, exports, __webpack_require__) {
  19729. "use strict";
  19730. /**
  19731. * @license
  19732. * Copyright 2017 Google Inc.
  19733. *
  19734. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19735. * of this software and associated documentation files (the "Software"), to deal
  19736. * in the Software without restriction, including without limitation the rights
  19737. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19738. * copies of the Software, and to permit persons to whom the Software is
  19739. * furnished to do so, subject to the following conditions:
  19740. *
  19741. * The above copyright notice and this permission notice shall be included in
  19742. * all copies or substantial portions of the Software.
  19743. *
  19744. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19745. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19746. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19747. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19748. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19749. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19750. * THE SOFTWARE.
  19751. */
  19752. var __extends = this && this.__extends || function () {
  19753. var _extendStatics = function extendStatics(d, b) {
  19754. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  19755. d.__proto__ = b;
  19756. } || function (d, b) {
  19757. for (var p in b) {
  19758. if (b.hasOwnProperty(p)) d[p] = b[p];
  19759. }
  19760. };
  19761. return _extendStatics(d, b);
  19762. };
  19763. return function (d, b) {
  19764. _extendStatics(d, b);
  19765. function __() {
  19766. this.constructor = d;
  19767. }
  19768. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19769. };
  19770. }();
  19771. var __assign = this && this.__assign || function () {
  19772. __assign = Object.assign || function (t) {
  19773. for (var s, i = 1, n = arguments.length; i < n; i++) {
  19774. s = arguments[i];
  19775. for (var p in s) {
  19776. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  19777. }
  19778. }
  19779. return t;
  19780. };
  19781. return __assign.apply(this, arguments);
  19782. };
  19783. Object.defineProperty(exports, "__esModule", { value: true });
  19784. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  19785. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  19786. var INTERACTION_EVENTS = ['click', 'keydown'];
  19787. var MDCTextFieldIconFoundation = /** @class */function (_super) {
  19788. __extends(MDCTextFieldIconFoundation, _super);
  19789. function MDCTextFieldIconFoundation(adapter) {
  19790. var _this = _super.call(this, __assign({}, MDCTextFieldIconFoundation.defaultAdapter, adapter)) || this;
  19791. _this.savedTabIndex_ = null;
  19792. _this.interactionHandler_ = function (evt) {
  19793. return _this.handleInteraction(evt);
  19794. };
  19795. return _this;
  19796. }
  19797. Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
  19798. get: function get() {
  19799. return constants_1.strings;
  19800. },
  19801. enumerable: true,
  19802. configurable: true
  19803. });
  19804. Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
  19805. get: function get() {
  19806. return constants_1.cssClasses;
  19807. },
  19808. enumerable: true,
  19809. configurable: true
  19810. });
  19811. Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
  19812. /**
  19813. * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.
  19814. */
  19815. get: function get() {
  19816. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  19817. return {
  19818. getAttr: function getAttr() {
  19819. return null;
  19820. },
  19821. setAttr: function setAttr() {
  19822. return undefined;
  19823. },
  19824. removeAttr: function removeAttr() {
  19825. return undefined;
  19826. },
  19827. setContent: function setContent() {
  19828. return undefined;
  19829. },
  19830. registerInteractionHandler: function registerInteractionHandler() {
  19831. return undefined;
  19832. },
  19833. deregisterInteractionHandler: function deregisterInteractionHandler() {
  19834. return undefined;
  19835. },
  19836. notifyIconAction: function notifyIconAction() {
  19837. return undefined;
  19838. }
  19839. };
  19840. // tslint:enable:object-literal-sort-keys
  19841. },
  19842. enumerable: true,
  19843. configurable: true
  19844. });
  19845. MDCTextFieldIconFoundation.prototype.init = function () {
  19846. var _this = this;
  19847. this.savedTabIndex_ = this.adapter_.getAttr('tabindex');
  19848. INTERACTION_EVENTS.forEach(function (evtType) {
  19849. _this.adapter_.registerInteractionHandler(evtType, _this.interactionHandler_);
  19850. });
  19851. };
  19852. MDCTextFieldIconFoundation.prototype.destroy = function () {
  19853. var _this = this;
  19854. INTERACTION_EVENTS.forEach(function (evtType) {
  19855. _this.adapter_.deregisterInteractionHandler(evtType, _this.interactionHandler_);
  19856. });
  19857. };
  19858. MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
  19859. if (!this.savedTabIndex_) {
  19860. return;
  19861. }
  19862. if (disabled) {
  19863. this.adapter_.setAttr('tabindex', '-1');
  19864. this.adapter_.removeAttr('role');
  19865. } else {
  19866. this.adapter_.setAttr('tabindex', this.savedTabIndex_);
  19867. this.adapter_.setAttr('role', constants_1.strings.ICON_ROLE);
  19868. }
  19869. };
  19870. MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
  19871. this.adapter_.setAttr('aria-label', label);
  19872. };
  19873. MDCTextFieldIconFoundation.prototype.setContent = function (content) {
  19874. this.adapter_.setContent(content);
  19875. };
  19876. MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
  19877. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  19878. if (evt.type === 'click' || isEnterKey) {
  19879. evt.preventDefault(); // stop click from causing host label to focus
  19880. // input
  19881. this.adapter_.notifyIconAction();
  19882. }
  19883. };
  19884. return MDCTextFieldIconFoundation;
  19885. }(foundation_1.MDCFoundation);
  19886. exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
  19887. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  19888. exports.default = MDCTextFieldIconFoundation;
  19889. /***/ }),
  19890. /***/ "./packages/mdc-textfield/icon/index.ts":
  19891. /*!**********************************************!*\
  19892. !*** ./packages/mdc-textfield/icon/index.ts ***!
  19893. \**********************************************/
  19894. /*! no static exports found */
  19895. /***/ (function(module, exports, __webpack_require__) {
  19896. "use strict";
  19897. /**
  19898. * @license
  19899. * Copyright 2019 Google Inc.
  19900. *
  19901. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19902. * of this software and associated documentation files (the "Software"), to deal
  19903. * in the Software without restriction, including without limitation the rights
  19904. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19905. * copies of the Software, and to permit persons to whom the Software is
  19906. * furnished to do so, subject to the following conditions:
  19907. *
  19908. * The above copyright notice and this permission notice shall be included in
  19909. * all copies or substantial portions of the Software.
  19910. *
  19911. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19912. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19913. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19914. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19915. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19916. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19917. * THE SOFTWARE.
  19918. */
  19919. function __export(m) {
  19920. for (var p in m) {
  19921. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  19922. }
  19923. }
  19924. Object.defineProperty(exports, "__esModule", { value: true });
  19925. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"));
  19926. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"));
  19927. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  19928. exports.iconCssClasses = constants_1.cssClasses;
  19929. exports.iconStrings = constants_1.strings;
  19930. /***/ }),
  19931. /***/ "./packages/mdc-textfield/index.ts":
  19932. /*!*****************************************!*\
  19933. !*** ./packages/mdc-textfield/index.ts ***!
  19934. \*****************************************/
  19935. /*! no static exports found */
  19936. /***/ (function(module, exports, __webpack_require__) {
  19937. "use strict";
  19938. /**
  19939. * @license
  19940. * Copyright 2019 Google Inc.
  19941. *
  19942. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19943. * of this software and associated documentation files (the "Software"), to deal
  19944. * in the Software without restriction, including without limitation the rights
  19945. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19946. * copies of the Software, and to permit persons to whom the Software is
  19947. * furnished to do so, subject to the following conditions:
  19948. *
  19949. * The above copyright notice and this permission notice shall be included in
  19950. * all copies or substantial portions of the Software.
  19951. *
  19952. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19953. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19954. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19955. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19956. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19957. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19958. * THE SOFTWARE.
  19959. */
  19960. function __export(m) {
  19961. for (var p in m) {
  19962. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  19963. }
  19964. }
  19965. Object.defineProperty(exports, "__esModule", { value: true });
  19966. __export(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"));
  19967. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"));
  19968. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"));
  19969. __export(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"));
  19970. __export(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"));
  19971. __export(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"));
  19972. /***/ }),
  19973. /***/ "./packages/mdc-top-app-bar/component.ts":
  19974. /*!***********************************************!*\
  19975. !*** ./packages/mdc-top-app-bar/component.ts ***!
  19976. \***********************************************/
  19977. /*! no static exports found */
  19978. /***/ (function(module, exports, __webpack_require__) {
  19979. "use strict";
  19980. /**
  19981. * @license
  19982. * Copyright 2018 Google Inc.
  19983. *
  19984. * Permission is hereby granted, free of charge, to any person obtaining a copy
  19985. * of this software and associated documentation files (the "Software"), to deal
  19986. * in the Software without restriction, including without limitation the rights
  19987. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  19988. * copies of the Software, and to permit persons to whom the Software is
  19989. * furnished to do so, subject to the following conditions:
  19990. *
  19991. * The above copyright notice and this permission notice shall be included in
  19992. * all copies or substantial portions of the Software.
  19993. *
  19994. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19995. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19996. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19997. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19998. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19999. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20000. * THE SOFTWARE.
  20001. */
  20002. var __extends = this && this.__extends || function () {
  20003. var _extendStatics = function extendStatics(d, b) {
  20004. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20005. d.__proto__ = b;
  20006. } || function (d, b) {
  20007. for (var p in b) {
  20008. if (b.hasOwnProperty(p)) d[p] = b[p];
  20009. }
  20010. };
  20011. return _extendStatics(d, b);
  20012. };
  20013. return function (d, b) {
  20014. _extendStatics(d, b);
  20015. function __() {
  20016. this.constructor = d;
  20017. }
  20018. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20019. };
  20020. }();
  20021. Object.defineProperty(exports, "__esModule", { value: true });
  20022. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  20023. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  20024. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  20025. var foundation_1 = __webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts");
  20026. var foundation_2 = __webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts");
  20027. var foundation_3 = __webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  20028. var MDCTopAppBar = /** @class */function (_super) {
  20029. __extends(MDCTopAppBar, _super);
  20030. function MDCTopAppBar() {
  20031. return _super !== null && _super.apply(this, arguments) || this;
  20032. }
  20033. MDCTopAppBar.attachTo = function (root) {
  20034. return new MDCTopAppBar(root);
  20035. };
  20036. MDCTopAppBar.prototype.initialize = function (rippleFactory) {
  20037. if (rippleFactory === void 0) {
  20038. rippleFactory = function rippleFactory(el) {
  20039. return component_2.MDCRipple.attachTo(el);
  20040. };
  20041. }
  20042. this.navIcon_ = this.root_.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR);
  20043. // Get all icons in the toolbar and instantiate the ripples
  20044. var icons = [].slice.call(this.root_.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR));
  20045. if (this.navIcon_) {
  20046. icons.push(this.navIcon_);
  20047. }
  20048. this.iconRipples_ = icons.map(function (icon) {
  20049. var ripple = rippleFactory(icon);
  20050. ripple.unbounded = true;
  20051. return ripple;
  20052. });
  20053. this.scrollTarget_ = window;
  20054. };
  20055. MDCTopAppBar.prototype.initialSyncWithDOM = function () {
  20056. this.handleNavigationClick_ = this.foundation_.handleNavigationClick.bind(this.foundation_);
  20057. this.handleWindowResize_ = this.foundation_.handleWindowResize.bind(this.foundation_);
  20058. this.handleTargetScroll_ = this.foundation_.handleTargetScroll.bind(this.foundation_);
  20059. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  20060. if (this.navIcon_) {
  20061. this.navIcon_.addEventListener('click', this.handleNavigationClick_);
  20062. }
  20063. var isFixed = this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  20064. var isShort = this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  20065. if (!isShort && !isFixed) {
  20066. window.addEventListener('resize', this.handleWindowResize_);
  20067. }
  20068. };
  20069. MDCTopAppBar.prototype.destroy = function () {
  20070. this.iconRipples_.forEach(function (iconRipple) {
  20071. return iconRipple.destroy();
  20072. });
  20073. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  20074. if (this.navIcon_) {
  20075. this.navIcon_.removeEventListener('click', this.handleNavigationClick_);
  20076. }
  20077. var isFixed = this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS);
  20078. var isShort = this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS);
  20079. if (!isShort && !isFixed) {
  20080. window.removeEventListener('resize', this.handleWindowResize_);
  20081. }
  20082. _super.prototype.destroy.call(this);
  20083. };
  20084. MDCTopAppBar.prototype.setScrollTarget = function (target) {
  20085. // Remove scroll handler from the previous scroll target
  20086. this.scrollTarget_.removeEventListener('scroll', this.handleTargetScroll_);
  20087. this.scrollTarget_ = target;
  20088. // Initialize scroll handler on the new scroll target
  20089. this.handleTargetScroll_ = this.foundation_.handleTargetScroll.bind(this.foundation_);
  20090. this.scrollTarget_.addEventListener('scroll', this.handleTargetScroll_);
  20091. };
  20092. MDCTopAppBar.prototype.getDefaultFoundation = function () {
  20093. var _this = this;
  20094. // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
  20095. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
  20096. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20097. var adapter = {
  20098. hasClass: function hasClass(className) {
  20099. return _this.root_.classList.contains(className);
  20100. },
  20101. addClass: function addClass(className) {
  20102. return _this.root_.classList.add(className);
  20103. },
  20104. removeClass: function removeClass(className) {
  20105. return _this.root_.classList.remove(className);
  20106. },
  20107. setStyle: function setStyle(property, value) {
  20108. return _this.root_.style.setProperty(property, value);
  20109. },
  20110. getTopAppBarHeight: function getTopAppBarHeight() {
  20111. return _this.root_.clientHeight;
  20112. },
  20113. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  20114. return _this.emit(constants_1.strings.NAVIGATION_EVENT, {});
  20115. },
  20116. getViewportScrollY: function getViewportScrollY() {
  20117. var win = _this.scrollTarget_;
  20118. var el = _this.scrollTarget_;
  20119. return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop;
  20120. },
  20121. getTotalActionItems: function getTotalActionItems() {
  20122. return _this.root_.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length;
  20123. }
  20124. };
  20125. // tslint:enable:object-literal-sort-keys
  20126. var foundation;
  20127. if (this.root_.classList.contains(constants_1.cssClasses.SHORT_CLASS)) {
  20128. foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter);
  20129. } else if (this.root_.classList.contains(constants_1.cssClasses.FIXED_CLASS)) {
  20130. foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter);
  20131. } else {
  20132. foundation = new foundation_3.MDCTopAppBarFoundation(adapter);
  20133. }
  20134. return foundation;
  20135. };
  20136. return MDCTopAppBar;
  20137. }(component_1.MDCComponent);
  20138. exports.MDCTopAppBar = MDCTopAppBar;
  20139. /***/ }),
  20140. /***/ "./packages/mdc-top-app-bar/constants.ts":
  20141. /*!***********************************************!*\
  20142. !*** ./packages/mdc-top-app-bar/constants.ts ***!
  20143. \***********************************************/
  20144. /*! no static exports found */
  20145. /***/ (function(module, exports, __webpack_require__) {
  20146. "use strict";
  20147. /**
  20148. * @license
  20149. * Copyright 2018 Google Inc.
  20150. *
  20151. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20152. * of this software and associated documentation files (the "Software"), to deal
  20153. * in the Software without restriction, including without limitation the rights
  20154. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20155. * copies of the Software, and to permit persons to whom the Software is
  20156. * furnished to do so, subject to the following conditions:
  20157. *
  20158. * The above copyright notice and this permission notice shall be included in
  20159. * all copies or substantial portions of the Software.
  20160. *
  20161. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20162. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20163. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20164. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20165. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20166. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20167. * THE SOFTWARE.
  20168. */
  20169. Object.defineProperty(exports, "__esModule", { value: true });
  20170. var cssClasses = {
  20171. FIXED_CLASS: 'mdc-top-app-bar--fixed',
  20172. FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled',
  20173. SHORT_CLASS: 'mdc-top-app-bar--short',
  20174. SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed',
  20175. SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'
  20176. };
  20177. exports.cssClasses = cssClasses;
  20178. var numbers = {
  20179. DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100,
  20180. MAX_TOP_APP_BAR_HEIGHT: 128
  20181. };
  20182. exports.numbers = numbers;
  20183. var strings = {
  20184. ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item',
  20185. NAVIGATION_EVENT: 'MDCTopAppBar:nav',
  20186. NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon',
  20187. ROOT_SELECTOR: '.mdc-top-app-bar',
  20188. TITLE_SELECTOR: '.mdc-top-app-bar__title'
  20189. };
  20190. exports.strings = strings;
  20191. /***/ }),
  20192. /***/ "./packages/mdc-top-app-bar/fixed/foundation.ts":
  20193. /*!******************************************************!*\
  20194. !*** ./packages/mdc-top-app-bar/fixed/foundation.ts ***!
  20195. \******************************************************/
  20196. /*! no static exports found */
  20197. /***/ (function(module, exports, __webpack_require__) {
  20198. "use strict";
  20199. /**
  20200. * @license
  20201. * Copyright 2018 Google Inc.
  20202. *
  20203. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20204. * of this software and associated documentation files (the "Software"), to deal
  20205. * in the Software without restriction, including without limitation the rights
  20206. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20207. * copies of the Software, and to permit persons to whom the Software is
  20208. * furnished to do so, subject to the following conditions:
  20209. *
  20210. * The above copyright notice and this permission notice shall be included in
  20211. * all copies or substantial portions of the Software.
  20212. *
  20213. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20214. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20215. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20216. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20217. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20218. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20219. * THE SOFTWARE.
  20220. */
  20221. var __extends = this && this.__extends || function () {
  20222. var _extendStatics = function extendStatics(d, b) {
  20223. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20224. d.__proto__ = b;
  20225. } || function (d, b) {
  20226. for (var p in b) {
  20227. if (b.hasOwnProperty(p)) d[p] = b[p];
  20228. }
  20229. };
  20230. return _extendStatics(d, b);
  20231. };
  20232. return function (d, b) {
  20233. _extendStatics(d, b);
  20234. function __() {
  20235. this.constructor = d;
  20236. }
  20237. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20238. };
  20239. }();
  20240. Object.defineProperty(exports, "__esModule", { value: true });
  20241. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  20242. var foundation_1 = __webpack_require__(/*! ../standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts");
  20243. var MDCFixedTopAppBarFoundation = /** @class */function (_super) {
  20244. __extends(MDCFixedTopAppBarFoundation, _super);
  20245. function MDCFixedTopAppBarFoundation() {
  20246. var _this = _super !== null && _super.apply(this, arguments) || this;
  20247. /**
  20248. * State variable for the previous scroll iteration top app bar state
  20249. */
  20250. _this.wasScrolled_ = false;
  20251. return _this;
  20252. }
  20253. /**
  20254. * Scroll handler for applying/removing the modifier class on the fixed top app bar.
  20255. * @override
  20256. */
  20257. MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () {
  20258. var currentScroll = this.adapter_.getViewportScrollY();
  20259. if (currentScroll <= 0) {
  20260. if (this.wasScrolled_) {
  20261. this.adapter_.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  20262. this.wasScrolled_ = false;
  20263. }
  20264. } else {
  20265. if (!this.wasScrolled_) {
  20266. this.adapter_.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
  20267. this.wasScrolled_ = true;
  20268. }
  20269. }
  20270. };
  20271. return MDCFixedTopAppBarFoundation;
  20272. }(foundation_1.MDCTopAppBarFoundation);
  20273. exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation;
  20274. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20275. exports.default = MDCFixedTopAppBarFoundation;
  20276. /***/ }),
  20277. /***/ "./packages/mdc-top-app-bar/foundation.ts":
  20278. /*!************************************************!*\
  20279. !*** ./packages/mdc-top-app-bar/foundation.ts ***!
  20280. \************************************************/
  20281. /*! no static exports found */
  20282. /***/ (function(module, exports, __webpack_require__) {
  20283. "use strict";
  20284. /**
  20285. * @license
  20286. * Copyright 2018 Google Inc.
  20287. *
  20288. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20289. * of this software and associated documentation files (the "Software"), to deal
  20290. * in the Software without restriction, including without limitation the rights
  20291. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20292. * copies of the Software, and to permit persons to whom the Software is
  20293. * furnished to do so, subject to the following conditions:
  20294. *
  20295. * The above copyright notice and this permission notice shall be included in
  20296. * all copies or substantial portions of the Software.
  20297. *
  20298. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20299. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20300. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20301. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20302. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20303. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20304. * THE SOFTWARE.
  20305. */
  20306. var __extends = this && this.__extends || function () {
  20307. var _extendStatics = function extendStatics(d, b) {
  20308. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20309. d.__proto__ = b;
  20310. } || function (d, b) {
  20311. for (var p in b) {
  20312. if (b.hasOwnProperty(p)) d[p] = b[p];
  20313. }
  20314. };
  20315. return _extendStatics(d, b);
  20316. };
  20317. return function (d, b) {
  20318. _extendStatics(d, b);
  20319. function __() {
  20320. this.constructor = d;
  20321. }
  20322. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20323. };
  20324. }();
  20325. var __assign = this && this.__assign || function () {
  20326. __assign = Object.assign || function (t) {
  20327. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20328. s = arguments[i];
  20329. for (var p in s) {
  20330. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20331. }
  20332. }
  20333. return t;
  20334. };
  20335. return __assign.apply(this, arguments);
  20336. };
  20337. Object.defineProperty(exports, "__esModule", { value: true });
  20338. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  20339. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts");
  20340. var MDCTopAppBarBaseFoundation = /** @class */function (_super) {
  20341. __extends(MDCTopAppBarBaseFoundation, _super);
  20342. /* istanbul ignore next: optional argument is not a branch statement */
  20343. function MDCTopAppBarBaseFoundation(adapter) {
  20344. return _super.call(this, __assign({}, MDCTopAppBarBaseFoundation.defaultAdapter, adapter)) || this;
  20345. }
  20346. Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", {
  20347. get: function get() {
  20348. return constants_1.strings;
  20349. },
  20350. enumerable: true,
  20351. configurable: true
  20352. });
  20353. Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", {
  20354. get: function get() {
  20355. return constants_1.cssClasses;
  20356. },
  20357. enumerable: true,
  20358. configurable: true
  20359. });
  20360. Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", {
  20361. get: function get() {
  20362. return constants_1.numbers;
  20363. },
  20364. enumerable: true,
  20365. configurable: true
  20366. });
  20367. Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", {
  20368. /**
  20369. * See {@link MDCTopAppBarAdapter} for typing information on parameters and return types.
  20370. */
  20371. get: function get() {
  20372. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  20373. return {
  20374. addClass: function addClass() {
  20375. return undefined;
  20376. },
  20377. removeClass: function removeClass() {
  20378. return undefined;
  20379. },
  20380. hasClass: function hasClass() {
  20381. return false;
  20382. },
  20383. setStyle: function setStyle() {
  20384. return undefined;
  20385. },
  20386. getTopAppBarHeight: function getTopAppBarHeight() {
  20387. return 0;
  20388. },
  20389. notifyNavigationIconClicked: function notifyNavigationIconClicked() {
  20390. return undefined;
  20391. },
  20392. getViewportScrollY: function getViewportScrollY() {
  20393. return 0;
  20394. },
  20395. getTotalActionItems: function getTotalActionItems() {
  20396. return 0;
  20397. }
  20398. };
  20399. // tslint:enable:object-literal-sort-keys
  20400. },
  20401. enumerable: true,
  20402. configurable: true
  20403. });
  20404. /** Other variants of TopAppBar foundation overrides this method */
  20405. MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {}; // tslint:disable-line:no-empty
  20406. /** Other variants of TopAppBar foundation overrides this method */
  20407. MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {}; // tslint:disable-line:no-empty
  20408. MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () {
  20409. this.adapter_.notifyNavigationIconClicked();
  20410. };
  20411. return MDCTopAppBarBaseFoundation;
  20412. }(foundation_1.MDCFoundation);
  20413. exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation;
  20414. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20415. exports.default = MDCTopAppBarBaseFoundation;
  20416. /***/ }),
  20417. /***/ "./packages/mdc-top-app-bar/index.ts":
  20418. /*!*******************************************!*\
  20419. !*** ./packages/mdc-top-app-bar/index.ts ***!
  20420. \*******************************************/
  20421. /*! no static exports found */
  20422. /***/ (function(module, exports, __webpack_require__) {
  20423. "use strict";
  20424. /**
  20425. * @license
  20426. * Copyright 2019 Google Inc.
  20427. *
  20428. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20429. * of this software and associated documentation files (the "Software"), to deal
  20430. * in the Software without restriction, including without limitation the rights
  20431. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20432. * copies of the Software, and to permit persons to whom the Software is
  20433. * furnished to do so, subject to the following conditions:
  20434. *
  20435. * The above copyright notice and this permission notice shall be included in
  20436. * all copies or substantial portions of the Software.
  20437. *
  20438. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20439. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20440. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20441. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20442. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20443. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20444. * THE SOFTWARE.
  20445. */
  20446. function __export(m) {
  20447. for (var p in m) {
  20448. if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  20449. }
  20450. }
  20451. Object.defineProperty(exports, "__esModule", { value: true });
  20452. __export(__webpack_require__(/*! ./component */ "./packages/mdc-top-app-bar/component.ts"));
  20453. __export(__webpack_require__(/*! ./constants */ "./packages/mdc-top-app-bar/constants.ts"));
  20454. __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-top-app-bar/foundation.ts"));
  20455. __export(__webpack_require__(/*! ./fixed/foundation */ "./packages/mdc-top-app-bar/fixed/foundation.ts"));
  20456. __export(__webpack_require__(/*! ./short/foundation */ "./packages/mdc-top-app-bar/short/foundation.ts"));
  20457. __export(__webpack_require__(/*! ./standard/foundation */ "./packages/mdc-top-app-bar/standard/foundation.ts"));
  20458. /***/ }),
  20459. /***/ "./packages/mdc-top-app-bar/short/foundation.ts":
  20460. /*!******************************************************!*\
  20461. !*** ./packages/mdc-top-app-bar/short/foundation.ts ***!
  20462. \******************************************************/
  20463. /*! no static exports found */
  20464. /***/ (function(module, exports, __webpack_require__) {
  20465. "use strict";
  20466. /**
  20467. * @license
  20468. * Copyright 2018 Google Inc.
  20469. *
  20470. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20471. * of this software and associated documentation files (the "Software"), to deal
  20472. * in the Software without restriction, including without limitation the rights
  20473. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20474. * copies of the Software, and to permit persons to whom the Software is
  20475. * furnished to do so, subject to the following conditions:
  20476. *
  20477. * The above copyright notice and this permission notice shall be included in
  20478. * all copies or substantial portions of the Software.
  20479. *
  20480. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20481. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20482. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20483. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20484. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20485. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20486. * THE SOFTWARE.
  20487. */
  20488. var __extends = this && this.__extends || function () {
  20489. var _extendStatics = function extendStatics(d, b) {
  20490. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20491. d.__proto__ = b;
  20492. } || function (d, b) {
  20493. for (var p in b) {
  20494. if (b.hasOwnProperty(p)) d[p] = b[p];
  20495. }
  20496. };
  20497. return _extendStatics(d, b);
  20498. };
  20499. return function (d, b) {
  20500. _extendStatics(d, b);
  20501. function __() {
  20502. this.constructor = d;
  20503. }
  20504. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20505. };
  20506. }();
  20507. Object.defineProperty(exports, "__esModule", { value: true });
  20508. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  20509. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  20510. var MDCShortTopAppBarFoundation = /** @class */function (_super) {
  20511. __extends(MDCShortTopAppBarFoundation, _super);
  20512. /* istanbul ignore next: optional argument is not a branch statement */
  20513. function MDCShortTopAppBarFoundation(adapter) {
  20514. var _this = _super.call(this, adapter) || this;
  20515. _this.isCollapsed_ = false;
  20516. _this.isAlwaysCollapsed_ = false;
  20517. return _this;
  20518. }
  20519. Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", {
  20520. // Public visibility for backward compatibility.
  20521. get: function get() {
  20522. return this.isCollapsed_;
  20523. },
  20524. enumerable: true,
  20525. configurable: true
  20526. });
  20527. MDCShortTopAppBarFoundation.prototype.init = function () {
  20528. _super.prototype.init.call(this);
  20529. if (this.adapter_.getTotalActionItems() > 0) {
  20530. this.adapter_.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS);
  20531. }
  20532. // If initialized with SHORT_COLLAPSED_CLASS, the bar should always be collapsed
  20533. this.setAlwaysCollapsed(this.adapter_.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS));
  20534. };
  20535. /**
  20536. * Set if the short top app bar should always be collapsed.
  20537. *
  20538. * @param value When `true`, bar will always be collapsed. When `false`, bar may collapse or expand based on scroll.
  20539. */
  20540. MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) {
  20541. this.isAlwaysCollapsed_ = !!value;
  20542. if (this.isAlwaysCollapsed_) {
  20543. this.collapse_();
  20544. } else {
  20545. // let maybeCollapseBar_ determine if the bar should be collapsed
  20546. this.maybeCollapseBar_();
  20547. }
  20548. };
  20549. MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () {
  20550. return this.isAlwaysCollapsed_;
  20551. };
  20552. /**
  20553. * Scroll handler for applying/removing the collapsed modifier class on the short top app bar.
  20554. * @override
  20555. */
  20556. MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () {
  20557. this.maybeCollapseBar_();
  20558. };
  20559. MDCShortTopAppBarFoundation.prototype.maybeCollapseBar_ = function () {
  20560. if (this.isAlwaysCollapsed_) {
  20561. return;
  20562. }
  20563. var currentScroll = this.adapter_.getViewportScrollY();
  20564. if (currentScroll <= 0) {
  20565. if (this.isCollapsed_) {
  20566. this.uncollapse_();
  20567. }
  20568. } else {
  20569. if (!this.isCollapsed_) {
  20570. this.collapse_();
  20571. }
  20572. }
  20573. };
  20574. MDCShortTopAppBarFoundation.prototype.uncollapse_ = function () {
  20575. this.adapter_.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  20576. this.isCollapsed_ = false;
  20577. };
  20578. MDCShortTopAppBarFoundation.prototype.collapse_ = function () {
  20579. this.adapter_.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
  20580. this.isCollapsed_ = true;
  20581. };
  20582. return MDCShortTopAppBarFoundation;
  20583. }(foundation_1.MDCTopAppBarBaseFoundation);
  20584. exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation;
  20585. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20586. exports.default = MDCShortTopAppBarFoundation;
  20587. /***/ }),
  20588. /***/ "./packages/mdc-top-app-bar/standard/foundation.ts":
  20589. /*!*********************************************************!*\
  20590. !*** ./packages/mdc-top-app-bar/standard/foundation.ts ***!
  20591. \*********************************************************/
  20592. /*! no static exports found */
  20593. /***/ (function(module, exports, __webpack_require__) {
  20594. "use strict";
  20595. /**
  20596. * @license
  20597. * Copyright 2018 Google Inc.
  20598. *
  20599. * Permission is hereby granted, free of charge, to any person obtaining a copy
  20600. * of this software and associated documentation files (the "Software"), to deal
  20601. * in the Software without restriction, including without limitation the rights
  20602. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20603. * copies of the Software, and to permit persons to whom the Software is
  20604. * furnished to do so, subject to the following conditions:
  20605. *
  20606. * The above copyright notice and this permission notice shall be included in
  20607. * all copies or substantial portions of the Software.
  20608. *
  20609. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20610. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20611. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20612. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20613. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20614. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20615. * THE SOFTWARE.
  20616. */
  20617. var __extends = this && this.__extends || function () {
  20618. var _extendStatics = function extendStatics(d, b) {
  20619. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  20620. d.__proto__ = b;
  20621. } || function (d, b) {
  20622. for (var p in b) {
  20623. if (b.hasOwnProperty(p)) d[p] = b[p];
  20624. }
  20625. };
  20626. return _extendStatics(d, b);
  20627. };
  20628. return function (d, b) {
  20629. _extendStatics(d, b);
  20630. function __() {
  20631. this.constructor = d;
  20632. }
  20633. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20634. };
  20635. }();
  20636. Object.defineProperty(exports, "__esModule", { value: true });
  20637. var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-top-app-bar/constants.ts");
  20638. var foundation_1 = __webpack_require__(/*! ../foundation */ "./packages/mdc-top-app-bar/foundation.ts");
  20639. var INITIAL_VALUE = 0;
  20640. var MDCTopAppBarFoundation = /** @class */function (_super) {
  20641. __extends(MDCTopAppBarFoundation, _super);
  20642. /* istanbul ignore next: optional argument is not a branch statement */
  20643. function MDCTopAppBarFoundation(adapter) {
  20644. var _this = _super.call(this, adapter) || this;
  20645. /**
  20646. * Indicates if the top app bar was docked in the previous scroll handler iteration.
  20647. */
  20648. _this.wasDocked_ = true;
  20649. /**
  20650. * Indicates if the top app bar is docked in the fully shown position.
  20651. */
  20652. _this.isDockedShowing_ = true;
  20653. /**
  20654. * Variable for current scroll position of the top app bar
  20655. */
  20656. _this.currentAppBarOffsetTop_ = 0;
  20657. /**
  20658. * Used to prevent the top app bar from being scrolled out of view during resize events
  20659. */
  20660. _this.isCurrentlyBeingResized_ = false;
  20661. /**
  20662. * The timeout that's used to throttle the resize events
  20663. */
  20664. _this.resizeThrottleId_ = INITIAL_VALUE;
  20665. /**
  20666. * The timeout that's used to debounce toggling the isCurrentlyBeingResized_ variable after a resize
  20667. */
  20668. _this.resizeDebounceId_ = INITIAL_VALUE;
  20669. _this.lastScrollPosition_ = _this.adapter_.getViewportScrollY();
  20670. _this.topAppBarHeight_ = _this.adapter_.getTopAppBarHeight();
  20671. return _this;
  20672. }
  20673. MDCTopAppBarFoundation.prototype.destroy = function () {
  20674. _super.prototype.destroy.call(this);
  20675. this.adapter_.setStyle('top', '');
  20676. };
  20677. /**
  20678. * Scroll handler for the default scroll behavior of the top app bar.
  20679. * @override
  20680. */
  20681. MDCTopAppBarFoundation.prototype.handleTargetScroll = function () {
  20682. var currentScrollPosition = Math.max(this.adapter_.getViewportScrollY(), 0);
  20683. var diff = currentScrollPosition - this.lastScrollPosition_;
  20684. this.lastScrollPosition_ = currentScrollPosition;
  20685. // If the window is being resized the lastScrollPosition_ needs to be updated but the
  20686. // current scroll of the top app bar should stay in the same position.
  20687. if (!this.isCurrentlyBeingResized_) {
  20688. this.currentAppBarOffsetTop_ -= diff;
  20689. if (this.currentAppBarOffsetTop_ > 0) {
  20690. this.currentAppBarOffsetTop_ = 0;
  20691. } else if (Math.abs(this.currentAppBarOffsetTop_) > this.topAppBarHeight_) {
  20692. this.currentAppBarOffsetTop_ = -this.topAppBarHeight_;
  20693. }
  20694. this.moveTopAppBar_();
  20695. }
  20696. };
  20697. /**
  20698. * Top app bar resize handler that throttle/debounce functions that execute updates.
  20699. * @override
  20700. */
  20701. MDCTopAppBarFoundation.prototype.handleWindowResize = function () {
  20702. var _this = this;
  20703. // Throttle resize events 10 p/s
  20704. if (!this.resizeThrottleId_) {
  20705. this.resizeThrottleId_ = setTimeout(function () {
  20706. _this.resizeThrottleId_ = INITIAL_VALUE;
  20707. _this.throttledResizeHandler_();
  20708. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  20709. }
  20710. this.isCurrentlyBeingResized_ = true;
  20711. if (this.resizeDebounceId_) {
  20712. clearTimeout(this.resizeDebounceId_);
  20713. }
  20714. this.resizeDebounceId_ = setTimeout(function () {
  20715. _this.handleTargetScroll();
  20716. _this.isCurrentlyBeingResized_ = false;
  20717. _this.resizeDebounceId_ = INITIAL_VALUE;
  20718. }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
  20719. };
  20720. /**
  20721. * Function to determine if the DOM needs to update.
  20722. */
  20723. MDCTopAppBarFoundation.prototype.checkForUpdate_ = function () {
  20724. var offscreenBoundaryTop = -this.topAppBarHeight_;
  20725. var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop_ < 0;
  20726. var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop_ > offscreenBoundaryTop;
  20727. var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen;
  20728. // If it's partially showing, it can't be docked.
  20729. if (partiallyShowing) {
  20730. this.wasDocked_ = false;
  20731. } else {
  20732. // Not previously docked and not partially showing, it's now docked.
  20733. if (!this.wasDocked_) {
  20734. this.wasDocked_ = true;
  20735. return true;
  20736. } else if (this.isDockedShowing_ !== hasAnyPixelsOnscreen) {
  20737. this.isDockedShowing_ = hasAnyPixelsOnscreen;
  20738. return true;
  20739. }
  20740. }
  20741. return partiallyShowing;
  20742. };
  20743. /**
  20744. * Function to move the top app bar if needed.
  20745. */
  20746. MDCTopAppBarFoundation.prototype.moveTopAppBar_ = function () {
  20747. if (this.checkForUpdate_()) {
  20748. // Once the top app bar is fully hidden we use the max potential top app bar height as our offset
  20749. // so the top app bar doesn't show if the window resizes and the new height > the old height.
  20750. var offset = this.currentAppBarOffsetTop_;
  20751. if (Math.abs(offset) >= this.topAppBarHeight_) {
  20752. offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT;
  20753. }
  20754. this.adapter_.setStyle('top', offset + 'px');
  20755. }
  20756. };
  20757. /**
  20758. * Throttled function that updates the top app bar scrolled values if the
  20759. * top app bar height changes.
  20760. */
  20761. MDCTopAppBarFoundation.prototype.throttledResizeHandler_ = function () {
  20762. var currentHeight = this.adapter_.getTopAppBarHeight();
  20763. if (this.topAppBarHeight_ !== currentHeight) {
  20764. this.wasDocked_ = false;
  20765. // Since the top app bar has a different height depending on the screen width, this
  20766. // will ensure that the top app bar remains in the correct location if
  20767. // completely hidden and a resize makes the top app bar a different height.
  20768. this.currentAppBarOffsetTop_ -= this.topAppBarHeight_ - currentHeight;
  20769. this.topAppBarHeight_ = currentHeight;
  20770. }
  20771. this.handleTargetScroll();
  20772. };
  20773. return MDCTopAppBarFoundation;
  20774. }(foundation_1.MDCTopAppBarBaseFoundation);
  20775. exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation;
  20776. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  20777. exports.default = MDCTopAppBarFoundation;
  20778. /***/ })
  20779. /******/ });
  20780. });
  20781. //# sourceMappingURL=material-components-web.js.map