@cloudflare/kumo 2.13.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +2 -2
- package/ai/component-registry.json +548 -8
- package/ai/component-registry.md +853 -19
- package/ai/schemas.ts +90 -2
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +311 -69
- package/dist/ai/schemas.js +185 -23
- package/dist/catalog.d.ts +11 -11
- package/dist/chunks/{AlertDialogTrigger-k3f8nevrda6awa4s.js → AlertDialogTrigger-dkihgpvj12si73w3.js} +5 -5
- package/dist/chunks/{AutocompleteItem-ksckpihly1c23f3j.js → AutocompleteItem-drxau0wm3735nihq.js} +17 -29
- package/dist/chunks/AutocompleteSeparator-hqtaxxxye1rfezfg.js +12 -0
- package/dist/chunks/{Button-oczevl8g75m85ew9.js → Button-ccl5r1xlbe3gh998.js} +3 -3
- package/dist/chunks/{CSPContext-guqghj8kxoukvlky.js → CSPContext-ctyrgg64girv38ls.js} +1 -7
- package/dist/chunks/{CSPProvider-f3it239kgztzgryk.js → CSPProvider-p9ensukmowjpkgc0.js} +2 -2
- package/dist/chunks/{CheckboxGroup-g5xn5gnq8ocqyoum.js → CheckboxGroup-knvypu2d1s0iz86k.js} +63 -45
- package/dist/chunks/{CheckboxGroupContext-f9wox07n2u5moq4h.js → CheckboxGroupContext-lgc9dwxou662i6zo.js} +3 -5
- package/dist/chunks/{CheckboxRoot-o5bfpje6e4p6pdgm.js → CheckboxIndicator-n982pbktfkxsa5zz.js} +128 -132
- package/dist/chunks/{CollapsiblePanel-e80n35tnsb2cskt9.js → CollapsiblePanel-jm0ni90g7wz7ppkc.js} +33 -36
- package/dist/chunks/{ComboboxClear-glm805v81uaaf3su.js → ComboboxClear-c2kvjkh9yc6xfl38.js} +83 -98
- package/dist/chunks/{ComboboxEmpty-hwv2kjxnf9un635e.js → ComboboxEmpty-o0q20j2l2syar9kx.js} +662 -586
- package/dist/chunks/{ComboboxPopup-fx7xex6g75t9u0gm.js → ComboboxPopup-oxgggc2wxy6bfmru.js} +57 -57
- package/dist/chunks/{CompositeItem-l7zee38lq5m224d5.js → CompositeItem-hzuk5x3e5zsfgnyj.js} +4 -7
- package/dist/chunks/CompositeList-lbr4enu6yzek7oa9.js +180 -0
- package/dist/chunks/{CompositeListContext-oetjj2x8li8678as.js → CompositeListContext-m9frxn53kkmr23d0.js} +2 -5
- package/dist/chunks/{CompositeRoot-l6ot8jo0umdics5m.js → CompositeRoot-g72lchaerolf5dc9.js} +61 -63
- package/dist/chunks/{CompositeRootContext-ofhzmevv7hadjhyy.js → CompositeRootContext-ixz4myr7uwvavx6w.js} +1 -1
- package/dist/chunks/DialogHandle-klk7uo1q1y8ghyx5.js +68 -0
- package/dist/chunks/{DialogPopup-mp89aob2nown2akq.js → DialogPopup-olsvyf7ulia6ekb1.js} +28 -71
- package/dist/chunks/DialogRoot-hl3genvzl9h8ridm.js +16 -0
- package/dist/chunks/{DialogTrigger-cmok07cf3ks0kzug.js → DialogTrigger-g44cuem7n4wez533.js} +23 -20
- package/dist/chunks/DialogViewport-e1tqfisqexc7o9z8.js +42 -0
- package/dist/chunks/{DirectionContext-jc1g0w645603sd6p.js → DirectionContext-opvqcb794uxicri4.js} +1 -4
- package/dist/chunks/{DirectionProvider-ihtfgxd5qpm6oth1.js → DirectionProvider-er2gibtc9a1f0kep.js} +2 -2
- package/dist/chunks/DrawerViewport-eqzib92gukr4qap3.js +1483 -0
- package/dist/chunks/{FieldControl-oz007qbkl6ejp7di.js → FieldControl-c5sahhd5xg3nr2x7.js} +58 -31
- package/dist/chunks/{FieldDescription-ju607ea6gwgzga8p.js → FieldDescription-ldfiii5bvssfib3d.js} +13 -12
- package/dist/chunks/{FieldItemContext-j85dc0ihramj5ezs.js → FieldItemContext-kpsmvqm5a98m8zpx.js} +1 -1
- package/dist/chunks/FieldLabel-j9teqs9f1exqv346.js +351 -0
- package/dist/chunks/{FieldsetLegend-j5piwq1giyhrr8s4.js → FieldsetLegend-jyy40ylt2ynkvgob.js} +7 -14
- package/dist/chunks/{FieldsetRootContext-b633e9uzilttuyfi.js → FieldsetRootContext-7nlstw7wronafxhw.js} +1 -1
- package/dist/chunks/{FloatingPortalLite-mlt7ztrvhzepwi5y.js → FloatingPortalLite-da0wdcmem7ahkle6.js} +3 -3
- package/dist/chunks/{FloatingTree-oosjswl1s9q4obvg.js → FloatingTree-lhdqtlu8s6m66n7l.js} +6 -6
- package/dist/chunks/Form-fjfbann47c7ws316.js +113 -0
- package/dist/chunks/{FormContext-xz0b4h7ue30fkkn1.js → FormContext-bsu99v8i8pwu1yxc.js} +4 -3
- package/dist/chunks/{Input-ovqfhsmpfcrg5czm.js → Input-irwtufp5t73pwnoj.js} +2 -2
- package/dist/chunks/{LabelableContext-hetas2e4y0kywfas.js → LabelableContext-ccxbhu73vrk089m1.js} +18 -45
- package/dist/chunks/ListboxSeparator-nfyv54r2v5qtmosj.js +21 -0
- package/dist/chunks/{MenuBackdrop-dlntmavtopj7wv0l.js → MenuBackdrop-ouznwyglg27bosoj.js} +7 -12
- package/dist/chunks/{MenuSubmenuTrigger-fzubf5xr7ohsgsi7.js → MenuSubmenuTrigger-mbbda6ucik6nphbq.js} +378 -292
- package/dist/chunks/{MenuTrigger-ntugq34yppc8ouwe.js → MenuTrigger-disngqnt74owi30p.js} +32 -41
- package/dist/chunks/{Menubar-d57cyjuztbge4dvv.js → Menubar-fluuxyn8c2zuz5pr.js} +12 -23
- package/dist/chunks/{MenubarContext-ei2r6vu6lmsspozo.js → MenubarContext-blatefsj42br7jh8.js} +1 -1
- package/dist/chunks/{MeterLabel-c40b0q8r81cftkjj.js → MeterLabel-k6no448jvaidaptf.js} +15 -18
- package/dist/chunks/NullStore-jwgpmovsgl47g9bv.js +109 -0
- package/dist/chunks/{PopoverClose-e91n3nkw16qnyese.js → PopoverClose-kpyt8hbqc52lnjb8.js} +183 -190
- package/dist/chunks/PrehydrationScript-j6zlrxmojrqni6b9.js +63 -0
- package/dist/chunks/{RadioGroup-lsix4haqxfigpuv8.js → RadioGroup-pok1e5qbnbujrz1e.js} +38 -35
- package/dist/chunks/{RadioGroupContext-ft0nndmzqynjz8a2.js → RadioGroupContext-galfnl2el7y2krov.js} +1 -1
- package/dist/chunks/{RadioIndicator-mwkahpwyqfc6yk1i.js → RadioIndicator-jd511oajbwmyjxbg.js} +49 -102
- package/dist/chunks/{ScrollAreaThumb-kmhan411yxfo0362.js → ScrollAreaThumb-eed3hf0pmrblshfw.js} +298 -385
- package/dist/chunks/{SelectGroupLabel-m4h5hrft9043nsd1.js → SelectSeparator-mrjooj7vmjez6fua.js} +447 -502
- package/dist/chunks/{Separator-b8wf5rea6m1cei8k.js → Separator-bcm4ezllqxvtpvuj.js} +2 -2
- package/dist/chunks/{SwitchRoot-e3hnyh3mf8qd30hj.js → SwitchRoot-gahuqddsq1s55p8m.js} +40 -85
- package/dist/chunks/{TabsList-c0inft3sf8gi2o4v.js → TabsList-ebl0v8gu8wn28zss.js} +204 -175
- package/dist/chunks/{Toggle-c8p9m3puz8l4mav7.js → Toggle-mbshs50266z9hgxp.js} +12 -13
- package/dist/chunks/{ToggleGroup-xz9zrh7t1htn6ht4.js → ToggleGroup-k2caz2ghv6zbzp5l.js} +13 -38
- package/dist/chunks/{ToggleGroupContext-cdk2zo6ciddpockn.js → ToggleGroupContext-h4v7jaf77rp2xng9.js} +3 -5
- package/dist/chunks/{ToolbarGroupContext-nriz3632ymugfj6h.js → ToolbarGroupContext-e5cg7needj0edodc.js} +3 -5
- package/dist/chunks/{ToolbarInput-er5t9irqvuwcjrir.js → ToolbarInput-i4h95tes75w0p5y2.js} +28 -33
- package/dist/chunks/{ToolbarRootContext-lvi96r1vvs93rhde.js → ToolbarRootContext-eqk40r8uh4h6r211.js} +1 -1
- package/dist/chunks/{TooltipPopup-l2zrbjavf1cqclfx.js → TooltipPopup-dm4y0hbdeylzp22y.js} +125 -127
- package/dist/chunks/{TooltipProvider-eyhgia63aq2x4frl.js → TooltipProvider-h40qf9wcn0atj15v.js} +14 -17
- package/dist/chunks/adaptiveOriginMiddleware-b8ztjthe278xq7lm.js +51 -0
- package/dist/chunks/{addEventListener-lhqvk2ahlzjsanyg.js → addEventListener-l40nxvf06iukgvnj.js} +1 -1
- package/dist/chunks/areArraysEqual-bcx201k1x9ziizym.js +15 -0
- package/dist/chunks/{autocomplete-dn6g4rc8bktdl4an.js → autocomplete-m6h1pbygknrz5div.js} +7 -7
- package/dist/chunks/{badge-xw5ydgdjx2o5qxbl.js → badge-dq8bx752b9dp7dst.js} +2 -1
- package/dist/chunks/{banner-n1ekcvrwashsgv93.js → banner-msnmqm7of2lck01x.js} +2 -2
- package/dist/chunks/{breadcrumbs-ffwe8tzqzmpyikq5.js → breadcrumbs-lhi1qrdh74mb4zsx.js} +4 -3
- package/dist/chunks/button-group-i9dh83xutyuxyry7.js +59 -0
- package/dist/chunks/{button-h36q7tklakhd38nx.js → button-pa1bq9b85hawg41a.js} +1 -1
- package/dist/chunks/{chart-qmls2klknm1pd6hs.js → chart-kd1xd6crso2i956o.js} +936 -49
- package/dist/chunks/{checkbox-jachq6akfh72x12r.js → checkbox-lbo436duy7krxcsk.js} +6 -7
- package/dist/chunks/clamp-jcjhzx71s6wt1rnc.js +7 -0
- package/dist/chunks/{clipboard-text-ms46uaujvkjmjnng.js → clipboard-text-gd6s3n1bqse9zgt8.js} +5 -5
- package/dist/chunks/{collapsible-jyajpe40jcca357s.js → collapsible-l8g94on4w7qfosmn.js} +1 -1
- package/dist/chunks/{combobox-hxarufzb1z61xnbv.js → combobox-hdxtsm2gqcxxgfju.js} +12 -11
- package/dist/chunks/{command-palette-iomiziccabzh4ogg.js → command-palette-crtm3nd32yjhuax1.js} +7 -7
- package/dist/chunks/{composite-o65hjzwwzb4kvl4w.js → composite-ab8dmdfoj6tmhcn1.js} +9 -21
- package/dist/chunks/{constants-j09lrtg73n4vlx5x.js → constants-flxfd6q03phtu007.js} +1 -1
- package/dist/chunks/{core-kjfqbvgicl9i3abf.js → core-n0de50o00ej2ecfe.js} +69 -55
- package/dist/chunks/createBaseUIEventDetails-3ob3qgs95ffm8l0w.js +49 -0
- package/dist/chunks/{ComboboxChipRemove-ksyozjezihhstmbu.js → createItems-b8n8vigg5nak6j9s.js} +113 -57
- package/dist/chunks/{createToastManager-kv89sv0xhhsvmq54.js → createToastManager-onmoqrmr8zo02rif.js} +305 -357
- package/dist/chunks/{css-d3t41yfupsmz7l1a.js → css-j501gxq1am2gnikh.js} +1 -1
- package/dist/chunks/{date-picker-fwe3vllwco4u1utz.js → date-picker-cotkexrpqu5tjikv.js} +54 -49
- package/dist/chunks/{date-range-picker-iymdx410i1hpvxai.js → date-range-picker-i6d8y1yemm7x5ins.js} +15 -14
- package/dist/chunks/{dialog-o0164pgcyc74lvp9.js → dialog-glpnivujociqs9lh.js} +13 -10
- package/dist/chunks/{dropdown-d5qrzj1w1a96w2we.js → dropdown-m53ji1d66mws89wh.js} +4 -4
- package/dist/chunks/{empty-ox60d384lkwbj5n4.js → empty-hkvg3is3uc6dj1at.js} +46 -38
- package/dist/chunks/{engine-io35xsj9fgfxtihg.js → engine-g5egnkub1ikv3wvy.js} +2 -2
- package/dist/chunks/{engine-javascript-d795u677f1802oaf.js → engine-javascript-e9xj8hhz9xfqhpnu.js} +200 -185
- package/dist/chunks/{engine-oniguruma-xjlw46ay321yj1av.js → engine-oniguruma-ias56ildu01gf939.js} +8 -7
- package/dist/chunks/error-f4f6l13zx6tynxmy.js +6 -0
- package/dist/chunks/{field-kgz7w7yixmtpg010.js → field-oqtso1v0oszlxi0e.js} +3 -3
- package/dist/chunks/{flow-fmfb3ri8cxo7w9ci.js → flow-iz8sn24h5q6q4b10.js} +76 -60
- package/dist/chunks/formatNumber-kcnmauoqxku5a84c.js +21 -0
- package/dist/chunks/{getCssDimensions-mi941fe1jvztqm6b.js → getCssDimensions-olosvhh5husavesv.js} +2 -2
- package/dist/chunks/getElementTransform-cuiqmjglkrz4db6c.js +38 -0
- package/dist/chunks/{getPseudoElementBounds-jg72lmrlwgbqhmjh.js → getPseudoElementBounds-x7b9uqi5hdb1lq2r.js} +13 -4
- package/dist/chunks/{github-light-kb466scjoy42qxpu.js → github-light-hir7yctc38258pwt.js} +1 -1
- package/dist/chunks/{graphql-gtqr4wytdf0qjybo.js → graphql-n9vlzkvcp2j19p7a.js} +1 -1
- package/dist/chunks/{html-ijyj3f9k0foag15c.js → html-nimj6ljkkifnc9ni.js} +2 -2
- package/dist/chunks/{index.parts-i4iu310eo65d7lfc.js → index.parts-b9zmk3ta77w8dy9f.js} +86 -34
- package/dist/chunks/{index.parts-mr7tgwe4pgfozkt5.js → index.parts-bq90erougcgrwlgk.js} +47 -50
- package/dist/chunks/{index.parts-7z8hqx6zl9yajzvs.js → index.parts-c1ocmbxanagpan6d.js} +206 -366
- package/dist/chunks/{index.parts-nd3mitrhxf806lsa.js → index.parts-cc0yi5vo7s4x3r9p.js} +140 -145
- package/dist/chunks/{index.parts-j2ecf25zajyd5ia3.js → index.parts-cdxa6fwtp3lpkpp4.js} +2 -2
- package/dist/chunks/{index.parts-komdbdvf823cm5jw.js → index.parts-cl2xux9bjec6cibd.js} +14 -11
- package/dist/chunks/{index.parts-bv57na43ve93uz3x.js → index.parts-d4wim8mcnl9a2n9d.js} +67 -36
- package/dist/chunks/{index.parts-gslyp9n88qdh38n1.js → index.parts-e9s1lqq3qa9l6ndm.js} +2 -2
- package/dist/chunks/{index.parts-i4lbjqdnhsnjtny6.js → index.parts-eks3uafpskcxle6j.js} +33 -22
- package/dist/chunks/{index2.parts-kiwz8e3k8utvm4zb.js → index.parts-fbip2x29k5okvypg.js} +9 -12
- package/dist/chunks/index.parts-fhza3s183grld7zq.js +102 -0
- package/dist/chunks/{index.parts-lz9cnngidxppvhz7.js → index.parts-ftxrjoy00esi3aau.js} +27 -40
- package/dist/chunks/{index.parts-kt0w73ciea6adi2i.js → index.parts-g390bxx23hdko02m.js} +2 -2
- package/dist/chunks/{index.parts-fl4zaorc97ed3keb.js → index.parts-gf9v1piz8xxt8ap1.js} +197 -244
- package/dist/chunks/{index.parts-ef9111sjk9e3al87.js → index.parts-h7wtkrxpz4m8eqn9.js} +63 -83
- package/dist/chunks/index.parts-hmx3qlh517ii56yi.js +116 -0
- package/dist/chunks/{index2.parts-mv7x6w0p2splvf6b.js → index.parts-i6gbeimeit8gzhvi.js} +2 -2
- package/dist/chunks/{index.parts-gj1k50tf9fcs7nru.js → index.parts-ioii4acz2bjrf6sb.js} +17 -21
- package/dist/chunks/{index.parts-i5twygaksh86erb7.js → index.parts-iq66xivmdw2mouvx.js} +7 -6
- package/dist/chunks/{index.parts-hxjt52jbictdzgad.js → index.parts-j6kbr29a542ya81m.js} +275 -388
- package/dist/chunks/{index.parts-lhpuh6pw7rjcddnl.js → index.parts-jjup1zgnozoxi7ky.js} +41 -57
- package/dist/chunks/index.parts-jknln7yxhdokkvd6.js +991 -0
- package/dist/chunks/{index.parts-nzwjx603vcq1kryz.js → index.parts-jpm6c0fe0gyky12m.js} +22 -54
- package/dist/chunks/{index.parts-jmb5ztstw4xlfyp9.js → index.parts-kgiqby97w6tn6jw7.js} +15 -20
- package/dist/chunks/{index.parts-c5yto0l67i7ok5fd.js → index.parts-lpafjiz853r94ydb.js} +59 -59
- package/dist/chunks/{index.parts-cpviii2nt413tb8k.js → index.parts-moguar0t0u4aumou.js} +6 -5
- package/dist/chunks/{index.parts-ieuelcd4z5e0mcb7.js → index.parts-mw0e646n3qp6v1qe.js} +11 -11
- package/dist/chunks/{index.parts-nc6jzjq91z2nye75.js → index.parts-olcmo45gi8e1qma1.js} +2 -3
- package/dist/chunks/{index.parts-bmzuqorz0tmneh7t.js → index.parts-p2lcxzhh1ll3584m.js} +41 -39
- package/dist/chunks/{inertValue-f9pgp32jxnm88df3.js → inertValue-e0o6qvuef83v78fk.js} +2 -2
- package/dist/chunks/inline-copy-text-gbd7jhwpor27l4rq.js +104 -0
- package/dist/chunks/{input-pehjmr1q131tz38w.js → input-c8lv9ulv0kortliq.js} +2 -2
- package/dist/chunks/{input-group-kshukialqry0fmra.js → input-group-fjr4r5ax0x78ppax.js} +10 -7
- package/dist/chunks/{input-ikfimmpl5sngvh9s.js → input-h5ox92gf13ge04hp.js} +11 -10
- package/dist/chunks/{isElementDisabled-ffsy1y4adxocmexb.js → isElementDisabled-o0j7po84u0xjuwgg.js} +1 -1
- package/dist/chunks/{label-ie2gpde0nco1avi7.js → label-gzyfw17u08irhdo8.js} +2 -2
- package/dist/chunks/{layer-card-dnikj7emx8qeaspz.js → layer-card-idh3863vdgprgqai.js} +5 -3
- package/dist/chunks/layer-dialog-j5ywmzs46ccg6oqy.js +381 -0
- package/dist/chunks/{link-gp4swsrd3vfnvori.js → link-cqyfjezntvr53rh7.js} +2 -2
- package/dist/chunks/locale-provider-kjlnws7jln3ak0dr.js +29 -0
- package/dist/chunks/{menubar-ljbsj2ulayebjyza.js → menubar-fjhotkmndttb8mua.js} +13 -12
- package/dist/chunks/{mergeCleanups-pexn3wul6a4zn873.js → mergeCleanups-ix8l84cgutsbotpd.js} +1 -1
- package/dist/chunks/{meter-fl03ece4glrrzizj.js → meter-majprsslwmpbmkzg.js} +1 -1
- package/dist/chunks/{pagination-i3jewbdolgru0xnr.js → pagination-oaenm9t7ou3lmcgw.js} +2 -2
- package/dist/chunks/{popover-jal8z9sv176703lf.js → popover-hr0bfgg48xzjggky.js} +2 -2
- package/dist/chunks/popupHandle-7ghmro8a5uerjwu5.js +177 -0
- package/dist/chunks/{popupStoreUtils-jrxqkz5jmlijlr91.js → popupStoreUtils-i0y57dvmcnqrh4pv.js} +178 -101
- package/dist/chunks/{popupStateMapping-hdv48wmkzb2mqful.js → popupTriggerMap-ehv0fuhnmy59j3pn.js} +167 -193
- package/dist/chunks/{portal-provider-gznk6snyqj6egd6d.js → portal-provider-eveknxf26oudn7pp.js} +4 -0
- package/dist/chunks/{radio-gvy6ekh5hu9awlru.js → radio-35dx7y6rjrezbjsp.js} +4 -4
- package/dist/chunks/reason-parts-m5ishukzeux3q0pc.js +39 -0
- package/dist/chunks/{resolveAriaLabelledBy-h9qwvo10ftlj6t9k.js → resolveAriaLabelledBy-nc8mdie5shy87nsb.js} +1 -1
- package/dist/chunks/{resolveValueLabel-bq3nrzord518kp9q.js → resolveValueLabel-hpmsash3ektitvnb.js} +44 -10
- package/dist/chunks/{safePolygon-szbj0u31i6mpt36d.js → safePolygon-kmd5wsz26l4xtj6c.js} +35 -29
- package/dist/chunks/{safeReact-bavzz23j5tex60z2.js → safeReact-hpp4cck3y2s5jg75.js} +2 -2
- package/dist/chunks/scrollable-b6m9ze1u7ps0q1qn.js +34 -0
- package/dist/chunks/{select-ndqpqpmqtmn497rq.js → select-futox5zqr3r80y9a.js} +8 -9
- package/dist/chunks/{sensitive-input-jtbp3mvdynz9wewu.js → sensitive-input-cw33yncetxk3fbrl.js} +3 -3
- package/dist/chunks/{serializeValue-ci3kihruew64i36f.js → serializeValue-ipcakiw32jb7kany.js} +1 -1
- package/dist/chunks/{sidebar-ob6c9b8fq0hx7uke.js → sidebar-in9zhvr473afsjpp.js} +118 -33
- package/dist/chunks/{skeleton-line-hlk5vauzo7xsalbo.js → skeleton-line-m9dyh126t9k07jvg.js} +8 -5
- package/dist/chunks/{sql-do9h6435gka97c4c.js → sql-hqp2eekl7qhmxe92.js} +1 -1
- package/dist/chunks/{stringifyLocale-cl8et9xf6zon4qbs.js → stringifyLocale-bxsgxdnzaef2vcar.js} +1 -1
- package/dist/chunks/{styles-dbhgpd8fm76fdfo3.js → styles-kl02oyrlnld7arja.js} +2 -2
- package/dist/chunks/{surface-ef2kr5pn7r1y3ipk.js → surface-irf0af2mfglu4p0j.js} +1 -1
- package/dist/chunks/{switch-oghrd7f6i5jqar59.js → switch-cqsvolm7h69z7vgg.js} +3 -3
- package/dist/chunks/{table-miggde3uqhhrd5at.js → table-yf8ul2e5nbemioi1.js} +1 -1
- package/dist/chunks/{tabs-mr2dsloqfe0io4a5.js → tabs-gf57qqf1wcclaejq.js} +1 -1
- package/dist/chunks/tag-input-ohfybx5dbxy3houy.js +139 -0
- package/dist/chunks/{text-jzp4mdlr222iuzxt.js → text-f1wxz183ckq7qtl7.js} +3 -2
- package/dist/chunks/{toast-g435fvt74w5orxqo.js → toast-bzaothy2yrezh787.js} +7 -6
- package/dist/chunks/{toolbar-e0b61hr6ys6dmwhv.js → toolbar-h213d8e22yjh5cwq.js} +6 -5
- package/dist/chunks/{tooltip-jq15p5jzgfrhslpo.js → tooltip-o4natsv01lpq8oq2.js} +3 -3
- package/dist/chunks/{useAnchoredPopupScrollLock-lbrqp1zm5z821z20.js → useAnchoredPopupScrollLock-kp3kai20u91sdm7v.js} +4 -4
- package/dist/chunks/{useAnimationFrame-ssgc72hyq6sg3yit.js → useAnimationFrame-0tt315hl9n3jzl86.js} +5 -4
- package/dist/chunks/{useAriaLabelledBy-bvw56m1d7czf0w3f.js → useAriaLabelledBy-ox8dum59shmgypq1.js} +3 -6
- package/dist/chunks/{useBaseUiId-gqkl5ep5pn6hd0rw.js → useBaseUiId-lg1teubxudgin0w2.js} +2 -2
- package/dist/chunks/{useButton-cpo6u2idqcnou6vy.js → useButton-h7s9aq1sfw6arawe.js} +56 -21
- package/dist/chunks/{useClick-fvwb39qgead2jyft.js → useClick-l0p0endoxrlp0ae5.js} +8 -7
- package/dist/chunks/{useCollapsiblePanel-bw63vwvq9a3sj73q.js → useCollapsiblePanel-g6t146nqj521pild.js} +60 -71
- package/dist/chunks/{useCompositeItem-esr3n4pmlssiuxuy.js → useCompositeItem-p7090ga00dpqcg5j.js} +4 -4
- package/dist/chunks/useCompositeListItem-odg6yo4h8866b37o.js +54 -0
- package/dist/chunks/{useControlled-nlx0kk1ksgk0auvi.js → useControlled-lfns1ot6kwowa4t4.js} +3 -3
- package/dist/chunks/{useDismiss-kbtx2o3ruyh3jwgn.js → useDismiss-me91ertzzz3gly12.js} +54 -23
- package/dist/chunks/useFieldValidation-e5pc8loiwzd68g4f.js +224 -0
- package/dist/chunks/{useFilteredItems-ns32d3hpp626kt73.js → useFilteredItems-kw2za6m9bng7twr0.js} +36 -38
- package/dist/chunks/{useFloatingRootContext-o6mk8fvodtbbm2v1.js → useFloatingRootContext-c849wtis7gx013m8.js} +7 -7
- package/dist/chunks/{useFocus-gdfx28bn90keg8cf.js → useFocus-lqwrnfa1svv3bcx1.js} +14 -10
- package/dist/chunks/{useForcedRerendering-el1fbg3ib5yo0v7k.js → useForcedRerendering-i3n4ms0xose8borh.js} +1 -1
- package/dist/chunks/{useId-l9soitgw3e4jk5ie.js → useId-f8w657f9yys10abm.js} +2 -2
- package/dist/chunks/{useLabel-nh9hf8h7o6oquqn5.js → useLabel-kcggu762z3z2taeb.js} +10 -9
- package/dist/chunks/useLabelableId-gqiiuqqn2k0u62r4.js +56 -0
- package/dist/chunks/{useListNavigation-jnxpvegv3ak857b1.js → useListNavigation-3nyjs362qcau34in.js} +51 -39
- package/dist/chunks/{useOnMount-j4wobeq47l3u9olo.js → useOnMount-hadwgyauanbzrvem.js} +3 -3
- package/dist/chunks/{useOpenChangeComplete-dpkex2e23s1evpol.js → useOpenChangeComplete-lk2gfu250t7r20c6.js} +48 -38
- package/dist/chunks/usePopupHandleStore-hx871cmn66j0q7wz.js +27 -0
- package/dist/chunks/{usePopupViewport-hu0kn0ziyf1vqzrs.js → usePopupViewport-iy5j9zawjrr3pcs0.js} +89 -57
- package/dist/chunks/{usePositioner-fz9uswhkhg22lo42.js → usePositioner-k9nc7cl550bgfwzs.js} +151 -142
- package/dist/chunks/{usePreviousValue-le0grv8f43vmunn1.js → usePreviousValue-io5t1pdxehw21l85.js} +2 -2
- package/dist/chunks/{useRegisterFieldControl-m1rxsuvtpau2341n.js → useRegisterFieldControl-lvusf6vc963clx02.js} +16 -10
- package/dist/chunks/{useRegisteredLabelId-dh83mybmzy75waje.js → useRegisteredLabelId-hw6b87h1k7kow1o2.js} +4 -4
- package/dist/chunks/{useRender-gtnbrp1ityffi4xf.js → useRender-onwjigxa00uch2ip.js} +2 -2
- package/dist/chunks/{useRenderDialogRoot-hhowqeoreyr6uuc7.js → useRenderDialogRoot-lddunc01twftravv.js} +123 -110
- package/dist/chunks/{useRenderElement-m8kc7jyuczp71mq8.js → useRenderElement-lrvp2pwrpt5zq1zd.js} +56 -46
- package/dist/chunks/{useScrollLock-mpns3u42eks8hhex.js → useScrollLock-buonkbwuland9wl3.js} +65 -38
- package/dist/chunks/{useStableCallback-ninxmksdjvwl6ejj.js → useStableCallback-b1i1ghzd9k75bb85.js} +3 -3
- package/dist/chunks/{useSwipeDismiss-bpbyw2ihsw3fw6y9.js → useSwipeDismiss-m1s13x9t9ey9ax3p.js} +73 -175
- package/dist/chunks/{useTimeout-oqptmu2xmyv5ccic.js → useTimeout-cpql3c8p250cr093.js} +3 -3
- package/dist/chunks/{useTransitionStatus-ig4waxl2kervpyw4.js → useTransitionStatus-bwqaavnekreihom2.js} +9 -5
- package/dist/chunks/{useTriggerFocusGuards-j8nano0pqu9dscrz.js → useTriggerFocusGuards-lz7wt484xltizro4.js} +4 -3
- package/dist/chunks/{useTypeahead-onenwjyhgw955ygx.js → useTypeahead-kvag4w6hu2g1kbwt.js} +10 -17
- package/dist/chunks/{useValueAsRef-lrn42zari17368c9.js → useValueAsRef-o4s9ohb3aczypmnk.js} +3 -3
- package/dist/chunks/{useValueChanged-kthmz4wk7ywnjwtx.js → useValueChanged-cz5wflhe8g15n6w1.js} +5 -8
- package/dist/chunks/{valueToPercent-henpkkj3juy3ukeu.js → valueToPercent-d7gbqk1umostj7ch.js} +1 -1
- package/dist/chunks/{vendor-floating-ui-dsysdmve7iazaaes.js → vendor-floating-ui-fqblx3wa0r71mjoo.js} +87 -187
- package/dist/chunks/{vendor-utils-luqsvbyuig727bnr.js → vendor-utils-ecfbsk425x1bm0gh.js} +119 -29
- package/dist/chunks/vesper-g839e590k3dxnwh3.js +5 -0
- package/dist/chunks/{visuallyHidden-n14xllazfozg55ox.js → visuallyHidden-nous086atnlxtf74.js} +1 -1
- package/dist/chunks/{wasm-nfbosyhilcq70atf.js → wasm-cpasy0o9lsjrm39j.js} +1 -1
- package/dist/code/server.d.ts +9 -10
- package/dist/code/server.js +8 -7
- package/dist/code.d.ts +8 -8
- package/dist/code.js +18 -16
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button-group.d.ts +2 -0
- package/dist/components/button-group.js +3 -0
- package/dist/components/button.js +1 -1
- package/dist/components/chart.d.ts +2 -2
- package/dist/components/chart.js +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/collapsible.js +1 -1
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.d.ts +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown.d.ts +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/empty.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/flow.js +1 -1
- package/dist/components/inline-copy-text.d.ts +2 -0
- package/dist/components/inline-copy-text.js +3 -0
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +1 -1
- package/dist/components/layer-card.js +1 -1
- package/dist/components/layer-dialog.d.ts +2 -0
- package/dist/components/layer-dialog.js +3 -0
- package/dist/components/link.d.ts +8 -9
- package/dist/components/link.js +1 -1
- package/dist/components/loader.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.d.ts +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sensitive-input.d.ts +1 -1
- package/dist/components/sensitive-input.js +1 -1
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/surface.js +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table-of-contents.d.ts +1 -1
- package/dist/components/table.d.ts +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/tag-input.d.ts +2 -0
- package/dist/components/tag-input.js +3 -0
- package/dist/components/text.d.ts +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/toolbar.d.ts +1 -1
- package/dist/components/toolbar.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/{index-BXsHCLB82.d.ts → index--RbAKeBL.d.ts} +1 -1
- package/dist/{index-CeBzVJP8.d.ts → index-BK1tZgmP.d.ts} +1 -1
- package/dist/{index-CGbkysYW2.d.ts → index-BMe3cpLB.d.ts} +5 -4
- package/dist/{index-Di3sC6UF.d.ts → index-C0d8uwYO.d.ts} +4 -4
- package/dist/index-C7RoG_CH.d.ts +57 -0
- package/dist/{index-DBlw3E9m.d.ts → index-CNJRbVxG.d.ts} +1 -1
- package/dist/{index-CMiftS8L2.d.ts → index-ChGFA5-n.d.ts} +10 -1
- package/dist/index-CiwC1j1N.d.ts +37 -0
- package/dist/{index-BoPqM1Ia2.d.ts → index-Cqrye3KD.d.ts} +1 -1
- package/dist/{index-Bw3M24Mi.d.ts → index-CrQi3QCY.d.ts} +2 -1
- package/dist/{index-BlEUcijd.d.ts → index-CtTNoYA2.d.ts} +69 -1
- package/dist/{index-D97n4Bpf2.d.ts → index-DWZia2ui.d.ts} +1 -1
- package/dist/index-NqlNd7cQ.d.ts +144 -0
- package/dist/index-jNWPjJl9.d.ts +75 -0
- package/dist/index.d.ts +31 -26
- package/dist/index.js +49 -44
- package/dist/{input-group-DpGSsAZy.d.ts → input-group-B3M_WRqm.d.ts} +1 -1
- package/dist/locale-provider-BLGya10h.d.ts +28 -0
- package/dist/{portal-provider-4AHCxYE6.d.ts → portal-provider-BAqPpq_a.d.ts} +4 -0
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/csp-provider.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +2 -2
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/otp-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.d.ts +1 -1
- package/dist/primitives.js +41 -41
- package/dist/scripts/theme-generator/config.d.ts +4 -5
- package/dist/scripts/theme-generator/types.d.ts +12 -13
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/{index-Dzzi1o7w2.d.ts → text-B4l7S5Z0.d.ts} +60 -1
- package/dist/{tooltip-BuCo6Ki4.d.ts → tooltip-D_vhi1PN.d.ts} +1 -1
- package/dist/{types-C402rKiz.d.ts → types-C6in2C8V.d.ts} +6 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +3 -2
- package/package.json +22 -5
- package/scripts/component-registry/discovery.ts +3 -0
- package/scripts/component-registry/metadata.ts +37 -0
- package/scripts/generate-globe-land-mask.mjs +80 -0
- package/dist/chunks/CheckboxIndicator-igofmpn0wcfdqooa.js +0 -49
- package/dist/chunks/CompositeList-tx08unuok7wsl2d9.js +0 -129
- package/dist/chunks/DialogHandle-b3froel96o9fwjmm.js +0 -139
- package/dist/chunks/DialogRoot-fp7d16uxogvye294.js +0 -15
- package/dist/chunks/FieldLabel-f6vwzm8nefzxwlh8.js +0 -558
- package/dist/chunks/Form-is7d5c1kbk1wn39s.js +0 -102
- package/dist/chunks/areArraysEqual-nlbeaqlzf4274zr3.js +0 -7
- package/dist/chunks/clamp-kvu4wtr1dw6b3pnd.js +0 -7
- package/dist/chunks/createBaseUIEventDetails-ddivuhl74gni72qn.js +0 -86
- package/dist/chunks/error-mm98alb8acdy93vq.js +0 -15
- package/dist/chunks/formatNumber-hjijm58g645q6a0n.js +0 -26
- package/dist/chunks/getEmptyRootContext-ekvv3rp5w16ewoqx.js +0 -18
- package/dist/chunks/index.parts-hve0zir3biaolih0.js +0 -128
- package/dist/chunks/index.parts-jv5kiaeixrjah9js.js +0 -119
- package/dist/chunks/index.parts-k7ezm98skegahepw.js +0 -2464
- package/dist/chunks/store-9b2cp7rx1dvq90fp.js +0 -88
- package/dist/chunks/useCompositeListItem-0exfww37ospqz69b.js +0 -75
- package/dist/chunks/useIsHydrating-b6whcsimonagru6u.js +0 -22
- package/dist/chunks/useLabelableId-b1kwq9st3rjrtakn.js +0 -60
- package/dist/chunks/vesper-ho3j3gt6ilwfuc1g.js +0 -5
- package/dist/cn-DCSItmT-.d.ts +0 -5
- /package/dist/{index-AMEc1MEg2.d.ts → index-AMEc1MEg.d.ts} +0 -0
- /package/dist/{index-D2Gvly0i2.d.ts → index-D2Gvly0i.d.ts} +0 -0
- /package/dist/{index-DIV3riUd2.d.ts → index-DIV3riUd.d.ts} +0 -0
- /package/dist/{index-FCkuxSvs2.d.ts → index-FCkuxSvs.d.ts} +0 -0
- /package/dist/{index-_Sl5wohy2.d.ts → index-_Sl5wohy.d.ts} +0 -0
- /package/dist/{index-bAud6rG22.d.ts → index-bAud6rG2.d.ts} +0 -0
|
@@ -1,2464 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-hi7ti5xiuxsegr96.js";
|
|
3
|
-
import { o as EMPTY_OBJECT, r as mergeProps, t as useRenderElement } from "./useRenderElement-m8kc7jyuczp71mq8.js";
|
|
4
|
-
import { h as BASE_UI_SWIPE_IGNORE_SELECTOR, r as popupStateMapping, t as CommonPopupDataAttributes } from "./popupStateMapping-hdv48wmkzb2mqful.js";
|
|
5
|
-
import { n as useIsoLayoutEffect, t as SafeReact } from "./safeReact-bavzz23j5tex60z2.js";
|
|
6
|
-
import { n as useTimeout } from "./useTimeout-oqptmu2xmyv5ccic.js";
|
|
7
|
-
import { D as activeElement, H as android, O as contains, k as getTarget, v as ownerDocument, x as isInteractiveElement } from "./vendor-utils-luqsvbyuig727bnr.js";
|
|
8
|
-
import { C as getParentNode, E as isHTMLElement, T as isElement, w as getWindow, x as getComputedStyle$1 } from "./vendor-floating-ui-dsysdmve7iazaaes.js";
|
|
9
|
-
import { j as swipe, s as closeWatcher, t as createChangeEventDetails } from "./createBaseUIEventDetails-ddivuhl74gni72qn.js";
|
|
10
|
-
import { t as addEventListener } from "./addEventListener-lhqvk2ahlzjsanyg.js";
|
|
11
|
-
import { t as useStableCallback } from "./useStableCallback-ninxmksdjvwl6ejj.js";
|
|
12
|
-
import { n as useAnimationFrame } from "./useAnimationFrame-ssgc72hyq6sg3yit.js";
|
|
13
|
-
import { a as FloatingFocusManager } from "./useScrollLock-mpns3u42eks8hhex.js";
|
|
14
|
-
import { t as useId$1 } from "./useId-l9soitgw3e4jk5ie.js";
|
|
15
|
-
import { i as transitionStatusMapping, r as TransitionStatusDataAttributes, t as useOpenChangeComplete } from "./useOpenChangeComplete-dpkex2e23s1evpol.js";
|
|
16
|
-
import { p as useTriggerRegistration, t as FOCUSABLE_POPUP_PROPS } from "./popupStoreUtils-jrxqkz5jmlijlr91.js";
|
|
17
|
-
import { t as useBaseUiId } from "./useBaseUiId-gqkl5ep5pn6hd0rw.js";
|
|
18
|
-
import { t as error } from "./error-mm98alb8acdy93vq.js";
|
|
19
|
-
import { t as useControlled } from "./useControlled-nlx0kk1ksgk0auvi.js";
|
|
20
|
-
import { a as findScrollableTouchTarget, i as getElementAtPoint, n as getElementTransform, r as useSwipeDismiss, t as getDisplacement } from "./useSwipeDismiss-bpbyw2ihsw3fw6y9.js";
|
|
21
|
-
import { t as clamp } from "./clamp-kvu4wtr1dw6b3pnd.js";
|
|
22
|
-
import { o as COMPOSITE_KEYS } from "./composite-o65hjzwwzb4kvl4w.js";
|
|
23
|
-
import { a as IsDrawerContext, i as useDialogPortalContext, o as useDialogRootContext, r as DialogPortal } from "./useRenderDialogRoot-hhowqeoreyr6uuc7.js";
|
|
24
|
-
import { i as DialogClose, n as DialogTitle, r as DialogDescription, t as DialogTrigger } from "./DialogTrigger-cmok07cf3ks0kzug.js";
|
|
25
|
-
import { t as DialogRoot } from "./DialogRoot-fp7d16uxogvye294.js";
|
|
26
|
-
import { n as createDialogHandle, r as DialogViewport, t as DialogHandle } from "./DialogHandle-b3froel96o9fwjmm.js";
|
|
27
|
-
import * as React$1 from "react";
|
|
28
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
29
|
-
import * as ReactDOM from "react-dom";
|
|
30
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/popup/DrawerPopupCssVars.mjs
|
|
31
|
-
let DrawerPopupCssVars = /*#__PURE__*/ function(DrawerPopupCssVars) {
|
|
32
|
-
/**
|
|
33
|
-
* The number of nested drawers that are currently open.
|
|
34
|
-
* @type {number}
|
|
35
|
-
*/
|
|
36
|
-
DrawerPopupCssVars["nestedDrawers"] = "--nested-drawers";
|
|
37
|
-
/**
|
|
38
|
-
* The height of the drawer popup.
|
|
39
|
-
* @type {CSS length}
|
|
40
|
-
*/
|
|
41
|
-
DrawerPopupCssVars["height"] = "--drawer-height";
|
|
42
|
-
/**
|
|
43
|
-
* The height of the frontmost open drawer in the current nested drawer stack.
|
|
44
|
-
* @type {CSS length}
|
|
45
|
-
*/
|
|
46
|
-
DrawerPopupCssVars["frontmostHeight"] = "--drawer-frontmost-height";
|
|
47
|
-
/**
|
|
48
|
-
* The swipe movement on the X axis.
|
|
49
|
-
* @type {CSS length}
|
|
50
|
-
*/
|
|
51
|
-
DrawerPopupCssVars["swipeMovementX"] = "--drawer-swipe-movement-x";
|
|
52
|
-
/**
|
|
53
|
-
* The swipe movement on the Y axis.
|
|
54
|
-
* @type {CSS length}
|
|
55
|
-
*/
|
|
56
|
-
DrawerPopupCssVars["swipeMovementY"] = "--drawer-swipe-movement-y";
|
|
57
|
-
/**
|
|
58
|
-
* The snap point offset used for translating the drawer.
|
|
59
|
-
* @type {CSS length}
|
|
60
|
-
*/
|
|
61
|
-
DrawerPopupCssVars["snapPointOffset"] = "--drawer-snap-point-offset";
|
|
62
|
-
/**
|
|
63
|
-
* A scalar (0.1-1) used to scale the swipe release transition duration in CSS.
|
|
64
|
-
* @type {number}
|
|
65
|
-
*/
|
|
66
|
-
DrawerPopupCssVars["swipeStrength"] = "--drawer-swipe-strength";
|
|
67
|
-
return DrawerPopupCssVars;
|
|
68
|
-
}({});
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/backdrop/DrawerBackdropCssVars.mjs
|
|
71
|
-
let DrawerBackdropCssVars = /*#__PURE__*/ function(DrawerBackdropCssVars) {
|
|
72
|
-
/**
|
|
73
|
-
* The swipe progress of the drawer gesture.
|
|
74
|
-
* @type {number}
|
|
75
|
-
*/
|
|
76
|
-
DrawerBackdropCssVars["swipeProgress"] = "--drawer-swipe-progress";
|
|
77
|
-
return DrawerBackdropCssVars;
|
|
78
|
-
}({});
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/backdrop/DrawerBackdrop.mjs
|
|
81
|
-
const stateAttributesMapping$4 = {
|
|
82
|
-
...popupStateMapping,
|
|
83
|
-
...transitionStatusMapping
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* An overlay displayed beneath the popup.
|
|
87
|
-
* Renders a `<div>` element.
|
|
88
|
-
*
|
|
89
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
90
|
-
*/
|
|
91
|
-
const DrawerBackdrop = /*#__PURE__*/ React$1.forwardRef(function DrawerBackdrop(componentProps, forwardedRef) {
|
|
92
|
-
const { render, className, style, forceRender = false, ...elementProps } = componentProps;
|
|
93
|
-
const { store } = useDialogRootContext();
|
|
94
|
-
const open = store.useState("open");
|
|
95
|
-
const nested = store.useState("nested");
|
|
96
|
-
const mounted = store.useState("mounted");
|
|
97
|
-
return useRenderElement("div", componentProps, {
|
|
98
|
-
state: {
|
|
99
|
-
open,
|
|
100
|
-
transitionStatus: store.useState("transitionStatus")
|
|
101
|
-
},
|
|
102
|
-
ref: [store.context.backdropRef, forwardedRef],
|
|
103
|
-
stateAttributesMapping: stateAttributesMapping$4,
|
|
104
|
-
props: [{
|
|
105
|
-
role: "presentation",
|
|
106
|
-
hidden: !mounted,
|
|
107
|
-
style: {
|
|
108
|
-
pointerEvents: !open ? "none" : void 0,
|
|
109
|
-
userSelect: "none",
|
|
110
|
-
WebkitUserSelect: "none",
|
|
111
|
-
[DrawerBackdropCssVars.swipeProgress]: "0",
|
|
112
|
-
[DrawerPopupCssVars.swipeStrength]: "1"
|
|
113
|
-
}
|
|
114
|
-
}, elementProps],
|
|
115
|
-
enabled: forceRender || !nested
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
DrawerBackdrop.displayName = "DrawerBackdrop";
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/close/DrawerClose.mjs
|
|
121
|
-
/**
|
|
122
|
-
* A button that closes the drawer.
|
|
123
|
-
* Renders a `<button>` element.
|
|
124
|
-
*
|
|
125
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
126
|
-
*/
|
|
127
|
-
const DrawerClose = DialogClose;
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/content/DrawerContentDataAttributes.mjs
|
|
130
|
-
const DRAWER_CONTENT_ATTRIBUTE = "data-drawer-content";
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/content/DrawerContent.mjs
|
|
133
|
-
/**
|
|
134
|
-
* A container for the drawer contents.
|
|
135
|
-
* Renders a `<div>` element.
|
|
136
|
-
*
|
|
137
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
138
|
-
*/
|
|
139
|
-
const DrawerContent = /*#__PURE__*/ React$1.forwardRef(function DrawerContent(componentProps, forwardedRef) {
|
|
140
|
-
const { render, className, style, ...elementProps } = componentProps;
|
|
141
|
-
useDialogRootContext();
|
|
142
|
-
return useRenderElement("div", componentProps, {
|
|
143
|
-
ref: forwardedRef,
|
|
144
|
-
props: [{ [DRAWER_CONTENT_ATTRIBUTE]: "" }, elementProps]
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
DrawerContent.displayName = "DrawerContent";
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/description/DrawerDescription.mjs
|
|
150
|
-
/**
|
|
151
|
-
* A paragraph with additional information about the drawer.
|
|
152
|
-
* Renders a `<p>` element.
|
|
153
|
-
*
|
|
154
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
155
|
-
*/
|
|
156
|
-
const DrawerDescription = DialogDescription;
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/provider/DrawerProviderContext.mjs
|
|
159
|
-
const DrawerProviderContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
160
|
-
DrawerProviderContext.displayName = "DrawerProviderContext";
|
|
161
|
-
function useDrawerProviderContext(optional) {
|
|
162
|
-
const context = React$1.useContext(DrawerProviderContext);
|
|
163
|
-
if (optional === false && context === void 0) throw new Error("Base UI: DrawerProviderContext is missing. Use <Drawer.Provider>.");
|
|
164
|
-
return context;
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/indent/DrawerIndent.mjs
|
|
168
|
-
const stateAttributesMapping$3 = { active(value) {
|
|
169
|
-
if (value) return { "data-active": "" };
|
|
170
|
-
return { "data-inactive": "" };
|
|
171
|
-
} };
|
|
172
|
-
/**
|
|
173
|
-
* A wrapper element intended to contain your app's main UI.
|
|
174
|
-
* Applies `data-active` when any drawer within the nearest `<Drawer.Provider>` is open.
|
|
175
|
-
* Renders a `<div>` element.
|
|
176
|
-
*
|
|
177
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
178
|
-
*/
|
|
179
|
-
const DrawerIndent = /*#__PURE__*/ React$1.forwardRef(function DrawerIndent(componentProps, forwardedRef) {
|
|
180
|
-
const { render, className, style, ...elementProps } = componentProps;
|
|
181
|
-
const providerContext = useDrawerProviderContext(true);
|
|
182
|
-
const active = providerContext?.active ?? false;
|
|
183
|
-
const visualStateStore = providerContext?.visualStateStore;
|
|
184
|
-
const indentRef = React$1.useRef(null);
|
|
185
|
-
useIsoLayoutEffect(() => {
|
|
186
|
-
const element = indentRef.current;
|
|
187
|
-
if (!element || !visualStateStore) return;
|
|
188
|
-
const syncVisualState = () => {
|
|
189
|
-
const { swipeProgress, frontmostHeight } = visualStateStore.getSnapshot();
|
|
190
|
-
if (swipeProgress <= 0) element.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
191
|
-
else element.style.setProperty(DrawerBackdropCssVars.swipeProgress, `${swipeProgress}`);
|
|
192
|
-
if (frontmostHeight <= 0) element.style.removeProperty(DrawerPopupCssVars.height);
|
|
193
|
-
else element.style.setProperty(DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
194
|
-
};
|
|
195
|
-
syncVisualState();
|
|
196
|
-
const unsubscribe = visualStateStore.subscribe(syncVisualState);
|
|
197
|
-
return () => {
|
|
198
|
-
unsubscribe();
|
|
199
|
-
element.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
200
|
-
element.style.removeProperty(DrawerPopupCssVars.height);
|
|
201
|
-
};
|
|
202
|
-
}, [visualStateStore]);
|
|
203
|
-
return useRenderElement("div", componentProps, {
|
|
204
|
-
ref: [forwardedRef, indentRef],
|
|
205
|
-
state: { active },
|
|
206
|
-
props: [{ style: { [DrawerBackdropCssVars.swipeProgress]: "0" } }, elementProps],
|
|
207
|
-
stateAttributesMapping: stateAttributesMapping$3
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
DrawerIndent.displayName = "DrawerIndent";
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/indent-background/DrawerIndentBackground.mjs
|
|
213
|
-
const stateAttributesMapping$2 = { active(value) {
|
|
214
|
-
if (value) return { "data-active": "" };
|
|
215
|
-
return { "data-inactive": "" };
|
|
216
|
-
} };
|
|
217
|
-
/**
|
|
218
|
-
* An element placed before `<Drawer.Indent>` to render a background layer that can be styled based on whether any drawer is open.
|
|
219
|
-
* Renders a `<div>` element.
|
|
220
|
-
*
|
|
221
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
222
|
-
*/
|
|
223
|
-
const DrawerIndentBackground = /*#__PURE__*/ React$1.forwardRef(function DrawerIndentBackground(componentProps, forwardedRef) {
|
|
224
|
-
const { render, className, style, ...elementProps } = componentProps;
|
|
225
|
-
return useRenderElement("div", componentProps, {
|
|
226
|
-
ref: forwardedRef,
|
|
227
|
-
state: { active: useDrawerProviderContext(true)?.active ?? false },
|
|
228
|
-
props: elementProps,
|
|
229
|
-
stateAttributesMapping: stateAttributesMapping$2
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
DrawerIndentBackground.displayName = "DrawerIndentBackground";
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/popup/DrawerPopupDataAttributes.mjs
|
|
235
|
-
let DrawerPopupDataAttributes = function(DrawerPopupDataAttributes) {
|
|
236
|
-
/**
|
|
237
|
-
* Present when the drawer is open.
|
|
238
|
-
*/
|
|
239
|
-
DrawerPopupDataAttributes[DrawerPopupDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
|
|
240
|
-
/**
|
|
241
|
-
* Present when the drawer is closed.
|
|
242
|
-
*/
|
|
243
|
-
DrawerPopupDataAttributes[DrawerPopupDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
244
|
-
/**
|
|
245
|
-
* Present when the drawer is animating in.
|
|
246
|
-
*/
|
|
247
|
-
DrawerPopupDataAttributes[DrawerPopupDataAttributes["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
248
|
-
/**
|
|
249
|
-
* Present when the drawer is animating out.
|
|
250
|
-
*/
|
|
251
|
-
DrawerPopupDataAttributes[DrawerPopupDataAttributes["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
252
|
-
/**
|
|
253
|
-
* Present when the drawer is at the expanded (full-height) snap point.
|
|
254
|
-
*/
|
|
255
|
-
DrawerPopupDataAttributes["expanded"] = "data-expanded";
|
|
256
|
-
/**
|
|
257
|
-
* Present when a nested drawer is open.
|
|
258
|
-
*/
|
|
259
|
-
DrawerPopupDataAttributes["nestedDrawerOpen"] = "data-nested-drawer-open";
|
|
260
|
-
/**
|
|
261
|
-
* Present when a nested drawer is being swiped.
|
|
262
|
-
*/
|
|
263
|
-
DrawerPopupDataAttributes["nestedDrawerSwiping"] = "data-nested-drawer-swiping";
|
|
264
|
-
/**
|
|
265
|
-
* Present when the drawer is dismissed by swiping.
|
|
266
|
-
*/
|
|
267
|
-
DrawerPopupDataAttributes["swipeDismiss"] = "data-swipe-dismiss";
|
|
268
|
-
/**
|
|
269
|
-
* Indicates the swipe direction.
|
|
270
|
-
* @type {'up' | 'down' | 'left' | 'right'}
|
|
271
|
-
*/
|
|
272
|
-
DrawerPopupDataAttributes["swipeDirection"] = "data-swipe-direction";
|
|
273
|
-
/**
|
|
274
|
-
* Present when the drawer is being swiped.
|
|
275
|
-
*/
|
|
276
|
-
DrawerPopupDataAttributes["swiping"] = "data-swiping";
|
|
277
|
-
return DrawerPopupDataAttributes;
|
|
278
|
-
}({});
|
|
279
|
-
//#endregion
|
|
280
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/root/DrawerRootContext.mjs
|
|
281
|
-
const DrawerRootContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
282
|
-
DrawerRootContext.displayName = "DrawerRootContext";
|
|
283
|
-
function useDrawerRootContext(optional) {
|
|
284
|
-
const drawerRootContext = React$1.useContext(DrawerRootContext);
|
|
285
|
-
if (optional === false && drawerRootContext === void 0) throw new Error("Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>.");
|
|
286
|
-
return drawerRootContext;
|
|
287
|
-
}
|
|
288
|
-
//#endregion
|
|
289
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/root/useDrawerSnapPoints.mjs
|
|
290
|
-
/**
|
|
291
|
-
* Resolves the vertical swipe movement for a snap point, applying square-root damping once the drag
|
|
292
|
-
* overshoots the fully-open edge (`nextOffset < 0`) so the popup resists travelling past it.
|
|
293
|
-
*/
|
|
294
|
-
function getSnapPointSwipeMovement(baseOffset, movementValue) {
|
|
295
|
-
const nextOffset = baseOffset + movementValue;
|
|
296
|
-
if (nextOffset >= 0) return movementValue;
|
|
297
|
-
return -Math.sqrt(-nextOffset) - baseOffset;
|
|
298
|
-
}
|
|
299
|
-
function resolveSnapPointValue(snapPoint, viewportHeight, rootFontSize) {
|
|
300
|
-
if (!Number.isFinite(viewportHeight) || viewportHeight <= 0) return null;
|
|
301
|
-
if (typeof snapPoint === "number") {
|
|
302
|
-
if (!Number.isFinite(snapPoint)) return null;
|
|
303
|
-
if (snapPoint <= 1) return clamp(snapPoint, 0, 1) * viewportHeight;
|
|
304
|
-
return snapPoint;
|
|
305
|
-
}
|
|
306
|
-
const trimmed = snapPoint.trim();
|
|
307
|
-
if (trimmed.endsWith("px")) {
|
|
308
|
-
const value = Number.parseFloat(trimmed);
|
|
309
|
-
return Number.isFinite(value) ? value : null;
|
|
310
|
-
}
|
|
311
|
-
if (trimmed.endsWith("rem")) {
|
|
312
|
-
const value = Number.parseFloat(trimmed);
|
|
313
|
-
return Number.isFinite(value) ? value * rootFontSize : null;
|
|
314
|
-
}
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
function findClosestSnapPoint(height, points) {
|
|
318
|
-
let closest = null;
|
|
319
|
-
let closestDistance = Infinity;
|
|
320
|
-
for (const point of points) {
|
|
321
|
-
const distance = Math.abs(point.height - height);
|
|
322
|
-
if (distance < closestDistance) {
|
|
323
|
-
closestDistance = distance;
|
|
324
|
-
closest = point;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return closest;
|
|
328
|
-
}
|
|
329
|
-
function useDrawerSnapPoints() {
|
|
330
|
-
const { store } = useDialogRootContext();
|
|
331
|
-
const { snapPoints, activeSnapPoint, setActiveSnapPoint, popupHeight } = useDrawerRootContext();
|
|
332
|
-
const viewportElement = store.useState("viewportElement");
|
|
333
|
-
const [viewportHeight, setViewportHeight] = React$1.useState(0);
|
|
334
|
-
const [rootFontSize, setRootFontSize] = React$1.useState(16);
|
|
335
|
-
const measureViewportHeight = useStableCallback(() => {
|
|
336
|
-
const html = ownerDocument(viewportElement).documentElement;
|
|
337
|
-
if (viewportElement) setViewportHeight(viewportElement.offsetHeight);
|
|
338
|
-
if (!viewportElement) setViewportHeight(html.clientHeight);
|
|
339
|
-
const fontSize = parseFloat(getComputedStyle(html).fontSize);
|
|
340
|
-
if (Number.isFinite(fontSize)) setRootFontSize(fontSize);
|
|
341
|
-
});
|
|
342
|
-
useIsoLayoutEffect(() => {
|
|
343
|
-
measureViewportHeight();
|
|
344
|
-
if (!viewportElement || typeof ResizeObserver !== "function") return;
|
|
345
|
-
const resizeObserver = new ResizeObserver(measureViewportHeight);
|
|
346
|
-
resizeObserver.observe(viewportElement);
|
|
347
|
-
return () => {
|
|
348
|
-
resizeObserver.disconnect();
|
|
349
|
-
};
|
|
350
|
-
}, [measureViewportHeight, viewportElement]);
|
|
351
|
-
const resolvedSnapPoints = React$1.useMemo(() => {
|
|
352
|
-
if (!snapPoints || snapPoints.length === 0 || viewportHeight <= 0 || popupHeight <= 0) return [];
|
|
353
|
-
const maxHeight = Math.min(popupHeight, viewportHeight);
|
|
354
|
-
if (!Number.isFinite(maxHeight) || maxHeight <= 0) return [];
|
|
355
|
-
const resolved = snapPoints.map((value) => {
|
|
356
|
-
const resolvedHeight = resolveSnapPointValue(value, viewportHeight, rootFontSize);
|
|
357
|
-
if (resolvedHeight === null || !Number.isFinite(resolvedHeight)) return null;
|
|
358
|
-
const clampedHeight = clamp(resolvedHeight, 0, maxHeight);
|
|
359
|
-
return {
|
|
360
|
-
value,
|
|
361
|
-
height: clampedHeight,
|
|
362
|
-
offset: Math.max(0, popupHeight - clampedHeight)
|
|
363
|
-
};
|
|
364
|
-
}).filter((point) => Boolean(point));
|
|
365
|
-
if (resolved.length <= 1) return resolved;
|
|
366
|
-
const deduped = [];
|
|
367
|
-
const seenHeights = [];
|
|
368
|
-
for (let index = resolved.length - 1; index >= 0; index -= 1) {
|
|
369
|
-
const point = resolved[index];
|
|
370
|
-
if (seenHeights.some((height) => Math.abs(height - point.height) <= 1)) continue;
|
|
371
|
-
seenHeights.push(point.height);
|
|
372
|
-
deduped.push(point);
|
|
373
|
-
}
|
|
374
|
-
deduped.reverse();
|
|
375
|
-
return deduped;
|
|
376
|
-
}, [
|
|
377
|
-
popupHeight,
|
|
378
|
-
rootFontSize,
|
|
379
|
-
snapPoints,
|
|
380
|
-
viewportHeight
|
|
381
|
-
]);
|
|
382
|
-
return {
|
|
383
|
-
snapPoints,
|
|
384
|
-
activeSnapPoint,
|
|
385
|
-
setActiveSnapPoint,
|
|
386
|
-
popupHeight,
|
|
387
|
-
viewportHeight,
|
|
388
|
-
resolvedSnapPoints,
|
|
389
|
-
activeSnapPointOffset: React$1.useMemo(() => {
|
|
390
|
-
if (activeSnapPoint === void 0) return resolvedSnapPoints[0];
|
|
391
|
-
if (activeSnapPoint === null) return;
|
|
392
|
-
const exactMatch = resolvedSnapPoints.find((point) => Object.is(point.value, activeSnapPoint));
|
|
393
|
-
if (exactMatch) return exactMatch;
|
|
394
|
-
const maxHeight = Math.min(popupHeight, viewportHeight);
|
|
395
|
-
const resolvedHeight = resolveSnapPointValue(activeSnapPoint, viewportHeight, rootFontSize);
|
|
396
|
-
if (resolvedHeight === null || !Number.isFinite(resolvedHeight)) return;
|
|
397
|
-
return findClosestSnapPoint(clamp(resolvedHeight, 0, maxHeight), resolvedSnapPoints) ?? void 0;
|
|
398
|
-
}, [
|
|
399
|
-
activeSnapPoint,
|
|
400
|
-
popupHeight,
|
|
401
|
-
resolvedSnapPoints,
|
|
402
|
-
rootFontSize,
|
|
403
|
-
viewportHeight
|
|
404
|
-
])?.offset ?? null
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
//#endregion
|
|
408
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/viewport/DrawerViewportContext.mjs
|
|
409
|
-
const DrawerViewportContext = /*#__PURE__*/ React$1.createContext(null);
|
|
410
|
-
DrawerViewportContext.displayName = "DrawerViewportContext";
|
|
411
|
-
function useDrawerViewportContext(optional) {
|
|
412
|
-
const context = React$1.useContext(DrawerViewportContext);
|
|
413
|
-
if (optional === false && context === null) throw new Error("Base UI: DrawerViewportContext is missing. Drawer parts must be placed within <Drawer.Viewport>.");
|
|
414
|
-
return context;
|
|
415
|
-
}
|
|
416
|
-
//#endregion
|
|
417
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/popup/DrawerPopup.mjs
|
|
418
|
-
let drawerSwipeVarsRegistered = false;
|
|
419
|
-
/**
|
|
420
|
-
* Removes inheritance of high-frequency drawer swipe CSS variables, which
|
|
421
|
-
* reduces style recalculation cost in complex drawers with deep subtrees.
|
|
422
|
-
* See https://motion.dev/blog/web-animation-performance-tier-list
|
|
423
|
-
* under the "Improving CSS variable performance" section.
|
|
424
|
-
*/
|
|
425
|
-
function removeCSSVariableInheritance() {
|
|
426
|
-
if (drawerSwipeVarsRegistered) return;
|
|
427
|
-
if (typeof CSS !== "undefined" && "registerProperty" in CSS) {
|
|
428
|
-
[
|
|
429
|
-
DrawerPopupCssVars.swipeMovementX,
|
|
430
|
-
DrawerPopupCssVars.swipeMovementY,
|
|
431
|
-
DrawerPopupCssVars.snapPointOffset
|
|
432
|
-
].forEach((name) => {
|
|
433
|
-
try {
|
|
434
|
-
CSS.registerProperty({
|
|
435
|
-
name,
|
|
436
|
-
syntax: "<length>",
|
|
437
|
-
inherits: false,
|
|
438
|
-
initialValue: "0px"
|
|
439
|
-
});
|
|
440
|
-
} catch {}
|
|
441
|
-
});
|
|
442
|
-
[{
|
|
443
|
-
name: DrawerBackdropCssVars.swipeProgress,
|
|
444
|
-
initialValue: "0"
|
|
445
|
-
}, {
|
|
446
|
-
name: DrawerPopupCssVars.swipeStrength,
|
|
447
|
-
initialValue: "1"
|
|
448
|
-
}].forEach(({ name, initialValue }) => {
|
|
449
|
-
try {
|
|
450
|
-
CSS.registerProperty({
|
|
451
|
-
name,
|
|
452
|
-
syntax: "<number>",
|
|
453
|
-
inherits: false,
|
|
454
|
-
initialValue
|
|
455
|
-
});
|
|
456
|
-
} catch {}
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
drawerSwipeVarsRegistered = true;
|
|
460
|
-
}
|
|
461
|
-
const stateAttributesMapping$1 = {
|
|
462
|
-
...popupStateMapping,
|
|
463
|
-
...transitionStatusMapping,
|
|
464
|
-
expanded(value) {
|
|
465
|
-
return value ? { [DrawerPopupDataAttributes.expanded]: "" } : null;
|
|
466
|
-
},
|
|
467
|
-
nestedDrawerOpen(value) {
|
|
468
|
-
return value ? { [DrawerPopupDataAttributes.nestedDrawerOpen]: "" } : null;
|
|
469
|
-
},
|
|
470
|
-
nestedDrawerSwiping(value) {
|
|
471
|
-
return value ? { [DrawerPopupDataAttributes.nestedDrawerSwiping]: "" } : null;
|
|
472
|
-
},
|
|
473
|
-
swipeDirection(value) {
|
|
474
|
-
return value ? { [DrawerPopupDataAttributes.swipeDirection]: value } : null;
|
|
475
|
-
},
|
|
476
|
-
swiping(value) {
|
|
477
|
-
return value ? { [DrawerPopupDataAttributes.swiping]: "" } : null;
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
/**
|
|
481
|
-
* A container for the drawer contents.
|
|
482
|
-
* Renders a `<div>` element.
|
|
483
|
-
*
|
|
484
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
485
|
-
*/
|
|
486
|
-
const DrawerPopup = /*#__PURE__*/ React$1.forwardRef(function DrawerPopup(componentProps, forwardedRef) {
|
|
487
|
-
const { render, className, style, finalFocus, initialFocus, ...elementProps } = componentProps;
|
|
488
|
-
const { store } = useDialogRootContext();
|
|
489
|
-
const popupRef = store.context.popupRef;
|
|
490
|
-
const { swipeDirection, frontmostHeight, hasNestedDrawer, nestedSwiping, nestedSwipeProgressStore, onPopupHeightChange, notifyParentFrontmostHeight, notifyParentHasNestedDrawer } = useDrawerRootContext();
|
|
491
|
-
const descriptionElementId = store.useState("descriptionElementId");
|
|
492
|
-
const disablePointerDismissal = store.useState("disablePointerDismissal");
|
|
493
|
-
const floatingRootContext = store.useState("floatingRootContext");
|
|
494
|
-
const rootPopupProps = store.useState("popupProps");
|
|
495
|
-
const modal = store.useState("modal");
|
|
496
|
-
const mounted = store.useState("mounted");
|
|
497
|
-
const nested = store.useState("nested");
|
|
498
|
-
const nestedOpenDrawerCount = store.useState("nestedOpenDrawerCount");
|
|
499
|
-
const transitionStatus = store.useState("transitionStatus");
|
|
500
|
-
const open = store.useState("open");
|
|
501
|
-
const openMethod = store.useState("openMethod");
|
|
502
|
-
const titleElementId = store.useState("titleElementId");
|
|
503
|
-
const role = store.useState("role");
|
|
504
|
-
const floatingId = floatingRootContext.useState("floatingId");
|
|
505
|
-
const popupId = elementProps.id ?? floatingId;
|
|
506
|
-
const swipe = useDrawerViewportContext(true);
|
|
507
|
-
useDialogPortalContext();
|
|
508
|
-
const { snapPoints, activeSnapPoint, activeSnapPointOffset } = useDrawerSnapPoints();
|
|
509
|
-
const nestedDrawerOpen = nestedOpenDrawerCount > 0;
|
|
510
|
-
const swiping = swipe?.swiping ?? false;
|
|
511
|
-
const swipeStrength = swipe?.swipeStrength ?? null;
|
|
512
|
-
const [popupHeight, setPopupHeight] = React$1.useState(0);
|
|
513
|
-
const popupHeightRef = React$1.useRef(0);
|
|
514
|
-
React$1.useEffect(() => {
|
|
515
|
-
if (swipe) return;
|
|
516
|
-
error(`<Drawer.Popup> expected to be rendered within <Drawer.Viewport>. Omitting the viewport disables drawer swipe handling and touch scroll locking. Wrap <Drawer.Popup> in <Drawer.Viewport>.${SafeReact.captureOwnerStack?.() || ""}`);
|
|
517
|
-
}, [swipe]);
|
|
518
|
-
const measureHeight = useStableCallback(() => {
|
|
519
|
-
const popupElement = popupRef.current;
|
|
520
|
-
if (!popupElement) return;
|
|
521
|
-
const offsetHeight = popupElement.offsetHeight;
|
|
522
|
-
if (popupHeightRef.current > 0 && frontmostHeight > popupHeightRef.current && offsetHeight > popupHeightRef.current) return;
|
|
523
|
-
if (popupHeightRef.current > 0 && hasNestedDrawer) {
|
|
524
|
-
const oldHeight = popupHeightRef.current;
|
|
525
|
-
setPopupHeight(oldHeight);
|
|
526
|
-
onPopupHeightChange(oldHeight);
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
const nextHeight = offsetHeight;
|
|
530
|
-
if (nextHeight === popupHeightRef.current) return;
|
|
531
|
-
popupHeightRef.current = nextHeight;
|
|
532
|
-
setPopupHeight(nextHeight);
|
|
533
|
-
onPopupHeightChange(nextHeight);
|
|
534
|
-
});
|
|
535
|
-
useIsoLayoutEffect(() => {
|
|
536
|
-
if (!mounted) {
|
|
537
|
-
popupHeightRef.current = 0;
|
|
538
|
-
setPopupHeight(0);
|
|
539
|
-
onPopupHeightChange(0);
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
const popupElement = popupRef.current;
|
|
543
|
-
if (!popupElement) return;
|
|
544
|
-
removeCSSVariableInheritance();
|
|
545
|
-
measureHeight();
|
|
546
|
-
if (typeof ResizeObserver !== "function") return;
|
|
547
|
-
const resizeObserver = new ResizeObserver(measureHeight);
|
|
548
|
-
resizeObserver.observe(popupElement);
|
|
549
|
-
return () => {
|
|
550
|
-
resizeObserver.disconnect();
|
|
551
|
-
};
|
|
552
|
-
}, [
|
|
553
|
-
measureHeight,
|
|
554
|
-
mounted,
|
|
555
|
-
nestedDrawerOpen,
|
|
556
|
-
onPopupHeightChange,
|
|
557
|
-
popupRef
|
|
558
|
-
]);
|
|
559
|
-
useIsoLayoutEffect(() => {
|
|
560
|
-
const syncNestedSwipeProgress = () => {
|
|
561
|
-
const popupElement = popupRef.current;
|
|
562
|
-
if (!popupElement) return;
|
|
563
|
-
const progress = nestedSwipeProgressStore.getSnapshot();
|
|
564
|
-
if (progress > 0) popupElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `${progress}`);
|
|
565
|
-
else popupElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
566
|
-
};
|
|
567
|
-
syncNestedSwipeProgress();
|
|
568
|
-
const unsubscribe = nestedSwipeProgressStore.subscribe(syncNestedSwipeProgress);
|
|
569
|
-
const popupElement = popupRef.current;
|
|
570
|
-
return () => {
|
|
571
|
-
unsubscribe();
|
|
572
|
-
if (popupElement) popupElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
573
|
-
};
|
|
574
|
-
}, [nestedSwipeProgressStore, popupRef]);
|
|
575
|
-
React$1.useEffect(() => {
|
|
576
|
-
if (!open) return;
|
|
577
|
-
notifyParentFrontmostHeight?.(frontmostHeight);
|
|
578
|
-
return () => {
|
|
579
|
-
notifyParentFrontmostHeight?.(0);
|
|
580
|
-
};
|
|
581
|
-
}, [
|
|
582
|
-
frontmostHeight,
|
|
583
|
-
open,
|
|
584
|
-
notifyParentFrontmostHeight
|
|
585
|
-
]);
|
|
586
|
-
React$1.useEffect(() => {
|
|
587
|
-
if (!notifyParentHasNestedDrawer) return;
|
|
588
|
-
notifyParentHasNestedDrawer(open || transitionStatus === "ending");
|
|
589
|
-
return () => {
|
|
590
|
-
notifyParentHasNestedDrawer(false);
|
|
591
|
-
};
|
|
592
|
-
}, [
|
|
593
|
-
notifyParentHasNestedDrawer,
|
|
594
|
-
open,
|
|
595
|
-
transitionStatus
|
|
596
|
-
]);
|
|
597
|
-
useOpenChangeComplete({
|
|
598
|
-
open,
|
|
599
|
-
ref: popupRef,
|
|
600
|
-
onComplete() {
|
|
601
|
-
if (open) store.context.onOpenChangeComplete?.(true);
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
const resolvedInitialFocus = initialFocus === void 0 ? popupRef : initialFocus;
|
|
605
|
-
const setPopupElement = store.useStateSetter("popupElement");
|
|
606
|
-
const state = {
|
|
607
|
-
open,
|
|
608
|
-
nested,
|
|
609
|
-
transitionStatus,
|
|
610
|
-
expanded: activeSnapPoint === 1,
|
|
611
|
-
nestedDrawerOpen,
|
|
612
|
-
nestedDrawerSwiping: nestedSwiping,
|
|
613
|
-
swipeDirection,
|
|
614
|
-
swiping
|
|
615
|
-
};
|
|
616
|
-
let popupHeightCssVarValue;
|
|
617
|
-
if (popupHeight && !(!hasNestedDrawer && transitionStatus !== "ending")) popupHeightCssVarValue = `${popupHeight}px`;
|
|
618
|
-
const shouldApplySnapPoints = snapPoints && snapPoints.length > 0 && (swipeDirection === "down" || swipeDirection === "up");
|
|
619
|
-
let snapPointOffsetValue = null;
|
|
620
|
-
if (shouldApplySnapPoints && activeSnapPointOffset !== null) snapPointOffsetValue = swipeDirection === "up" ? -activeSnapPointOffset : activeSnapPointOffset;
|
|
621
|
-
let dragStyles = swipe ? swipe.getDragStyles() : EMPTY_OBJECT;
|
|
622
|
-
if (shouldApplySnapPoints && swipeDirection === "down") {
|
|
623
|
-
const baseOffset = activeSnapPointOffset ?? 0;
|
|
624
|
-
const movementValue = Number.parseFloat(String(dragStyles[DrawerPopupCssVars.swipeMovementY] ?? 0));
|
|
625
|
-
if (swiping && Number.isFinite(movementValue)) dragStyles = {
|
|
626
|
-
...dragStyles,
|
|
627
|
-
transform: void 0,
|
|
628
|
-
[DrawerPopupCssVars.swipeMovementY]: `${getSnapPointSwipeMovement(baseOffset, movementValue)}px`
|
|
629
|
-
};
|
|
630
|
-
else dragStyles = {
|
|
631
|
-
...dragStyles,
|
|
632
|
-
transform: void 0
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
const element = useRenderElement("div", componentProps, {
|
|
636
|
-
state,
|
|
637
|
-
props: [
|
|
638
|
-
rootPopupProps,
|
|
639
|
-
{
|
|
640
|
-
id: popupId,
|
|
641
|
-
"aria-labelledby": titleElementId,
|
|
642
|
-
"aria-describedby": descriptionElementId,
|
|
643
|
-
role,
|
|
644
|
-
...FOCUSABLE_POPUP_PROPS,
|
|
645
|
-
hidden: !mounted,
|
|
646
|
-
onKeyDown(event) {
|
|
647
|
-
if (COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
648
|
-
},
|
|
649
|
-
style: {
|
|
650
|
-
...dragStyles,
|
|
651
|
-
[DrawerBackdropCssVars.swipeProgress]: "0",
|
|
652
|
-
[DrawerPopupCssVars.nestedDrawers]: nestedOpenDrawerCount,
|
|
653
|
-
[DrawerPopupCssVars.height]: popupHeightCssVarValue,
|
|
654
|
-
[DrawerPopupCssVars.snapPointOffset]: typeof snapPointOffsetValue === "number" ? `${snapPointOffsetValue}px` : "0px",
|
|
655
|
-
[DrawerPopupCssVars.frontmostHeight]: frontmostHeight ? `${frontmostHeight}px` : void 0,
|
|
656
|
-
[DrawerPopupCssVars.swipeStrength]: typeof swipeStrength === "number" && Number.isFinite(swipeStrength) && swipeStrength > 0 ? `${swipeStrength}` : "1"
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
elementProps
|
|
660
|
-
],
|
|
661
|
-
ref: [
|
|
662
|
-
forwardedRef,
|
|
663
|
-
popupRef,
|
|
664
|
-
setPopupElement
|
|
665
|
-
],
|
|
666
|
-
stateAttributesMapping: stateAttributesMapping$1
|
|
667
|
-
});
|
|
668
|
-
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
669
|
-
context: floatingRootContext,
|
|
670
|
-
openInteractionType: openMethod,
|
|
671
|
-
disabled: !mounted,
|
|
672
|
-
closeOnFocusOut: !disablePointerDismissal,
|
|
673
|
-
initialFocus: resolvedInitialFocus,
|
|
674
|
-
returnFocus: finalFocus,
|
|
675
|
-
modal: modal !== false,
|
|
676
|
-
restoreFocus: "popup",
|
|
677
|
-
children: element
|
|
678
|
-
});
|
|
679
|
-
});
|
|
680
|
-
DrawerPopup.displayName = "DrawerPopup";
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/portal/DrawerPortal.mjs
|
|
683
|
-
/**
|
|
684
|
-
* A portal element that moves the popup to a different part of the DOM.
|
|
685
|
-
* By default, the portal element is appended to `<body>`.
|
|
686
|
-
* Renders a `<div>` element.
|
|
687
|
-
*
|
|
688
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
689
|
-
*/
|
|
690
|
-
const DrawerPortal = DialogPortal;
|
|
691
|
-
//#endregion
|
|
692
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/provider/DrawerProvider.mjs
|
|
693
|
-
/**
|
|
694
|
-
* Provides a shared context for coordinating global Drawer UI, such as indent/background effects based on whether any Drawer is open.
|
|
695
|
-
* Doesn't render its own HTML element.
|
|
696
|
-
*
|
|
697
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
698
|
-
*/
|
|
699
|
-
function DrawerProvider(props) {
|
|
700
|
-
const { children } = props;
|
|
701
|
-
const [openById, setOpenById] = React$1.useState(() => /* @__PURE__ */ new Map());
|
|
702
|
-
const [visualStateStore] = React$1.useState(createVisualStateStore);
|
|
703
|
-
const setDrawerOpen = useStableCallback((drawerId, open) => {
|
|
704
|
-
setOpenById((prev) => {
|
|
705
|
-
if (prev.get(drawerId) === open) return prev;
|
|
706
|
-
const next = new Map(prev);
|
|
707
|
-
next.set(drawerId, open);
|
|
708
|
-
return next;
|
|
709
|
-
});
|
|
710
|
-
});
|
|
711
|
-
const removeDrawer = useStableCallback((drawerId) => {
|
|
712
|
-
setOpenById((prev) => {
|
|
713
|
-
if (!prev.has(drawerId)) return prev;
|
|
714
|
-
const next = new Map(prev);
|
|
715
|
-
next.delete(drawerId);
|
|
716
|
-
return next;
|
|
717
|
-
});
|
|
718
|
-
});
|
|
719
|
-
const active = React$1.useMemo(() => {
|
|
720
|
-
for (const open of openById.values()) if (open) return true;
|
|
721
|
-
return false;
|
|
722
|
-
}, [openById]);
|
|
723
|
-
const contextValue = React$1.useMemo(() => ({
|
|
724
|
-
setDrawerOpen,
|
|
725
|
-
removeDrawer,
|
|
726
|
-
active,
|
|
727
|
-
visualStateStore
|
|
728
|
-
}), [
|
|
729
|
-
active,
|
|
730
|
-
removeDrawer,
|
|
731
|
-
setDrawerOpen,
|
|
732
|
-
visualStateStore
|
|
733
|
-
]);
|
|
734
|
-
return /*#__PURE__*/ jsx(DrawerProviderContext.Provider, {
|
|
735
|
-
value: contextValue,
|
|
736
|
-
children
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
function createVisualStateStore() {
|
|
740
|
-
let state = {
|
|
741
|
-
swipeProgress: 0,
|
|
742
|
-
frontmostHeight: 0
|
|
743
|
-
};
|
|
744
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
745
|
-
return {
|
|
746
|
-
getSnapshot: () => state,
|
|
747
|
-
set(nextState) {
|
|
748
|
-
let nextSwipeProgress = state.swipeProgress;
|
|
749
|
-
if (nextState.swipeProgress !== void 0) nextSwipeProgress = Number.isFinite(nextState.swipeProgress) ? nextState.swipeProgress : 0;
|
|
750
|
-
let nextFrontmostHeight = state.frontmostHeight;
|
|
751
|
-
if (nextState.frontmostHeight !== void 0) nextFrontmostHeight = Number.isFinite(nextState.frontmostHeight) ? nextState.frontmostHeight : 0;
|
|
752
|
-
if (nextSwipeProgress === state.swipeProgress && nextFrontmostHeight === state.frontmostHeight) return;
|
|
753
|
-
state = {
|
|
754
|
-
swipeProgress: nextSwipeProgress,
|
|
755
|
-
frontmostHeight: nextFrontmostHeight
|
|
756
|
-
};
|
|
757
|
-
listeners.forEach((listener) => {
|
|
758
|
-
listener();
|
|
759
|
-
});
|
|
760
|
-
},
|
|
761
|
-
subscribe(listener) {
|
|
762
|
-
listeners.add(listener);
|
|
763
|
-
return () => {
|
|
764
|
-
listeners.delete(listener);
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
//#endregion
|
|
770
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/root/DrawerRoot.mjs
|
|
771
|
-
var _DrawerProviderReport;
|
|
772
|
-
var _DrawerProviderReport2;
|
|
773
|
-
/**
|
|
774
|
-
* Groups all parts of the drawer.
|
|
775
|
-
* Doesn't render its own HTML element.
|
|
776
|
-
*
|
|
777
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
778
|
-
*/
|
|
779
|
-
function DrawerRoot(props) {
|
|
780
|
-
const { children, open: openProp, defaultOpen = false, onOpenChange, onOpenChangeComplete, disablePointerDismissal = false, modal = true, actionsRef, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null, swipeDirection = "down", snapToSequentialPoints = false, snapPoints, snapPoint: snapPointProp, defaultSnapPoint, onSnapPointChange } = props;
|
|
781
|
-
const parentDrawerRootContext = useDrawerRootContext(true);
|
|
782
|
-
const notifyParentSwipeProgressChange = parentDrawerRootContext?.onNestedSwipeProgressChange;
|
|
783
|
-
const notifyParentFrontmostHeight = parentDrawerRootContext?.onNestedFrontmostHeightChange;
|
|
784
|
-
const notifyParentSwipingChange = parentDrawerRootContext?.onNestedSwipingChange;
|
|
785
|
-
const notifyParentHasNestedDrawer = parentDrawerRootContext?.onNestedDrawerPresenceChange;
|
|
786
|
-
const [popupHeight, setPopupHeight] = React$1.useState(0);
|
|
787
|
-
const [frontmostHeight, setFrontmostHeight] = React$1.useState(0);
|
|
788
|
-
const [hasNestedDrawer, setHasNestedDrawer] = React$1.useState(false);
|
|
789
|
-
const [nestedSwiping, setNestedSwiping] = React$1.useState(false);
|
|
790
|
-
const [nestedSwipeProgressStore] = React$1.useState(createNestedSwipeProgressStore);
|
|
791
|
-
const resolvedDefaultSnapPoint = defaultSnapPoint !== void 0 ? defaultSnapPoint : snapPoints?.[0] ?? null;
|
|
792
|
-
const isSnapPointControlled = snapPointProp !== void 0;
|
|
793
|
-
const [activeSnapPoint, setActiveSnapPointUnwrapped] = useControlled({
|
|
794
|
-
controlled: snapPointProp,
|
|
795
|
-
default: resolvedDefaultSnapPoint,
|
|
796
|
-
name: "Drawer",
|
|
797
|
-
state: "snapPoint"
|
|
798
|
-
});
|
|
799
|
-
const isNestedDrawerOpenRef = React$1.useRef(false);
|
|
800
|
-
const setActiveSnapPoint = useStableCallback((nextSnapPoint, eventDetails) => {
|
|
801
|
-
const resolvedEventDetails = eventDetails ?? createChangeEventDetails("none");
|
|
802
|
-
onSnapPointChange?.(nextSnapPoint, resolvedEventDetails);
|
|
803
|
-
if (resolvedEventDetails.isCanceled) return;
|
|
804
|
-
setActiveSnapPointUnwrapped(nextSnapPoint);
|
|
805
|
-
});
|
|
806
|
-
const resolvedActiveSnapPoint = React$1.useMemo(() => {
|
|
807
|
-
if (isSnapPointControlled) return activeSnapPoint;
|
|
808
|
-
if (!snapPoints || snapPoints.length === 0) return activeSnapPoint;
|
|
809
|
-
if (activeSnapPoint === null || !snapPoints.some((snapPoint) => Object.is(snapPoint, activeSnapPoint))) return resolvedDefaultSnapPoint;
|
|
810
|
-
return activeSnapPoint;
|
|
811
|
-
}, [
|
|
812
|
-
activeSnapPoint,
|
|
813
|
-
isSnapPointControlled,
|
|
814
|
-
resolvedDefaultSnapPoint,
|
|
815
|
-
snapPoints
|
|
816
|
-
]);
|
|
817
|
-
const onPopupHeightChange = useStableCallback((height) => {
|
|
818
|
-
setPopupHeight(height);
|
|
819
|
-
if (!isNestedDrawerOpenRef.current && height > 0) setFrontmostHeight(height);
|
|
820
|
-
});
|
|
821
|
-
const onNestedFrontmostHeightChange = useStableCallback((height) => {
|
|
822
|
-
if (height > 0) {
|
|
823
|
-
isNestedDrawerOpenRef.current = true;
|
|
824
|
-
setFrontmostHeight(height);
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
isNestedDrawerOpenRef.current = false;
|
|
828
|
-
if (popupHeight > 0) setFrontmostHeight(popupHeight);
|
|
829
|
-
});
|
|
830
|
-
const onNestedDrawerPresenceChange = useStableCallback((present) => {
|
|
831
|
-
setHasNestedDrawer(present);
|
|
832
|
-
});
|
|
833
|
-
const onNestedSwipeProgressChange = useStableCallback((progress) => {
|
|
834
|
-
nestedSwipeProgressStore.set(progress);
|
|
835
|
-
notifyParentSwipeProgressChange?.(progress);
|
|
836
|
-
});
|
|
837
|
-
const onNestedSwipingChange = useStableCallback((swiping) => {
|
|
838
|
-
setNestedSwiping(swiping);
|
|
839
|
-
notifyParentSwipingChange?.(swiping);
|
|
840
|
-
});
|
|
841
|
-
const handleOpenChange = useStableCallback((nextOpen, eventDetails) => {
|
|
842
|
-
onOpenChange?.(nextOpen, eventDetails);
|
|
843
|
-
if (eventDetails.isCanceled) return;
|
|
844
|
-
if (!nextOpen && snapPoints && snapPoints.length > 0) setActiveSnapPoint(resolvedDefaultSnapPoint, createChangeEventDetails(eventDetails.reason, eventDetails.event, eventDetails.trigger));
|
|
845
|
-
});
|
|
846
|
-
const contextValue = React$1.useMemo(() => ({
|
|
847
|
-
swipeDirection,
|
|
848
|
-
snapToSequentialPoints,
|
|
849
|
-
snapPoints,
|
|
850
|
-
activeSnapPoint: resolvedActiveSnapPoint,
|
|
851
|
-
setActiveSnapPoint,
|
|
852
|
-
frontmostHeight,
|
|
853
|
-
popupHeight,
|
|
854
|
-
hasNestedDrawer,
|
|
855
|
-
nestedSwiping,
|
|
856
|
-
nestedSwipeProgressStore,
|
|
857
|
-
onNestedDrawerPresenceChange,
|
|
858
|
-
onPopupHeightChange,
|
|
859
|
-
onNestedFrontmostHeightChange,
|
|
860
|
-
onNestedSwipingChange,
|
|
861
|
-
onNestedSwipeProgressChange,
|
|
862
|
-
notifyParentFrontmostHeight,
|
|
863
|
-
notifyParentSwipingChange,
|
|
864
|
-
notifyParentSwipeProgressChange,
|
|
865
|
-
notifyParentHasNestedDrawer
|
|
866
|
-
}), [
|
|
867
|
-
resolvedActiveSnapPoint,
|
|
868
|
-
frontmostHeight,
|
|
869
|
-
hasNestedDrawer,
|
|
870
|
-
nestedSwiping,
|
|
871
|
-
nestedSwipeProgressStore,
|
|
872
|
-
notifyParentHasNestedDrawer,
|
|
873
|
-
notifyParentSwipeProgressChange,
|
|
874
|
-
notifyParentSwipingChange,
|
|
875
|
-
notifyParentFrontmostHeight,
|
|
876
|
-
onNestedDrawerPresenceChange,
|
|
877
|
-
onNestedFrontmostHeightChange,
|
|
878
|
-
onNestedSwipeProgressChange,
|
|
879
|
-
onNestedSwipingChange,
|
|
880
|
-
onPopupHeightChange,
|
|
881
|
-
popupHeight,
|
|
882
|
-
setActiveSnapPoint,
|
|
883
|
-
snapPoints,
|
|
884
|
-
snapToSequentialPoints,
|
|
885
|
-
swipeDirection
|
|
886
|
-
]);
|
|
887
|
-
const resolvedChildren = typeof children === "function" ? (payload) => /*#__PURE__*/ jsxs(React$1.Fragment, { children: [_DrawerProviderReport || (_DrawerProviderReport = /*#__PURE__*/ jsx(DrawerProviderReporter, {})), children(payload)] }) : /*#__PURE__*/ jsxs(React$1.Fragment, { children: [_DrawerProviderReport2 || (_DrawerProviderReport2 = /*#__PURE__*/ jsx(DrawerProviderReporter, {})), children] });
|
|
888
|
-
return /*#__PURE__*/ jsx(DrawerRootContext.Provider, {
|
|
889
|
-
value: contextValue,
|
|
890
|
-
children: /*#__PURE__*/ jsx(IsDrawerContext.Provider, {
|
|
891
|
-
value: true,
|
|
892
|
-
children: /*#__PURE__*/ jsx(DialogRoot, {
|
|
893
|
-
open: openProp,
|
|
894
|
-
defaultOpen,
|
|
895
|
-
onOpenChange: handleOpenChange,
|
|
896
|
-
onOpenChangeComplete,
|
|
897
|
-
disablePointerDismissal,
|
|
898
|
-
modal,
|
|
899
|
-
actionsRef,
|
|
900
|
-
handle,
|
|
901
|
-
triggerId: triggerIdProp,
|
|
902
|
-
defaultTriggerId: defaultTriggerIdProp,
|
|
903
|
-
children: resolvedChildren
|
|
904
|
-
})
|
|
905
|
-
})
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
function createNestedSwipeProgressStore() {
|
|
909
|
-
let progress = 0;
|
|
910
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
911
|
-
return {
|
|
912
|
-
getSnapshot: () => progress,
|
|
913
|
-
set(nextProgress) {
|
|
914
|
-
const resolved = Number.isFinite(nextProgress) ? nextProgress : 0;
|
|
915
|
-
if (resolved === progress) return;
|
|
916
|
-
progress = resolved;
|
|
917
|
-
listeners.forEach((listener) => {
|
|
918
|
-
listener();
|
|
919
|
-
});
|
|
920
|
-
},
|
|
921
|
-
subscribe(listener) {
|
|
922
|
-
listeners.add(listener);
|
|
923
|
-
return () => {
|
|
924
|
-
listeners.delete(listener);
|
|
925
|
-
};
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
}
|
|
929
|
-
function DrawerProviderReporter() {
|
|
930
|
-
const drawerId = useId$1();
|
|
931
|
-
const providerContext = useDrawerProviderContext(true);
|
|
932
|
-
const { store } = useDialogRootContext(false);
|
|
933
|
-
const open = store.useState("open");
|
|
934
|
-
const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
|
|
935
|
-
const popupElement = store.useState("popupElement");
|
|
936
|
-
const isTopmost = nestedOpenDialogCount === 0;
|
|
937
|
-
React$1.useEffect(() => {
|
|
938
|
-
if (!providerContext || drawerId == null) return;
|
|
939
|
-
return () => {
|
|
940
|
-
providerContext.removeDrawer(drawerId);
|
|
941
|
-
};
|
|
942
|
-
}, [drawerId, providerContext]);
|
|
943
|
-
React$1.useEffect(() => {
|
|
944
|
-
if (drawerId == null) return;
|
|
945
|
-
providerContext?.setDrawerOpen(drawerId, open);
|
|
946
|
-
}, [
|
|
947
|
-
drawerId,
|
|
948
|
-
open,
|
|
949
|
-
providerContext
|
|
950
|
-
]);
|
|
951
|
-
React$1.useEffect(() => {
|
|
952
|
-
if (!open || !isTopmost || !android) return;
|
|
953
|
-
const CloseWatcherCtor = getWindow(popupElement).CloseWatcher;
|
|
954
|
-
if (!CloseWatcherCtor) return;
|
|
955
|
-
function handleCloseWatcher(event) {
|
|
956
|
-
if (!store.select("open")) return;
|
|
957
|
-
store.setOpen(false, createChangeEventDetails(closeWatcher, event));
|
|
958
|
-
}
|
|
959
|
-
const closeWatcher$1 = new CloseWatcherCtor();
|
|
960
|
-
const unsubscribe = addEventListener(closeWatcher$1, "close", handleCloseWatcher);
|
|
961
|
-
return () => {
|
|
962
|
-
unsubscribe();
|
|
963
|
-
closeWatcher$1.destroy();
|
|
964
|
-
};
|
|
965
|
-
}, [
|
|
966
|
-
store,
|
|
967
|
-
isTopmost,
|
|
968
|
-
open,
|
|
969
|
-
popupElement
|
|
970
|
-
]);
|
|
971
|
-
return null;
|
|
972
|
-
}
|
|
973
|
-
//#endregion
|
|
974
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/swipe-area/DrawerSwipeAreaDataAttributes.mjs
|
|
975
|
-
let DrawerSwipeAreaDataAttributes = function(DrawerSwipeAreaDataAttributes) {
|
|
976
|
-
/**
|
|
977
|
-
* Present when the drawer is open.
|
|
978
|
-
*/
|
|
979
|
-
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
|
|
980
|
-
/**
|
|
981
|
-
* Present when the drawer is closed.
|
|
982
|
-
*/
|
|
983
|
-
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
984
|
-
/**
|
|
985
|
-
* Present when the swipe area is disabled.
|
|
986
|
-
*/
|
|
987
|
-
DrawerSwipeAreaDataAttributes["disabled"] = "data-disabled";
|
|
988
|
-
/**
|
|
989
|
-
* Indicates the swipe direction.
|
|
990
|
-
* @type {'up' | 'down' | 'left' | 'right'}
|
|
991
|
-
*/
|
|
992
|
-
DrawerSwipeAreaDataAttributes["swipeDirection"] = "data-swipe-direction";
|
|
993
|
-
/**
|
|
994
|
-
* Present when the drawer is being swiped.
|
|
995
|
-
*/
|
|
996
|
-
DrawerSwipeAreaDataAttributes["swiping"] = "data-swiping";
|
|
997
|
-
return DrawerSwipeAreaDataAttributes;
|
|
998
|
-
}({});
|
|
999
|
-
//#endregion
|
|
1000
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/swipe-area/DrawerSwipeArea.mjs
|
|
1001
|
-
const DEFAULT_SWIPE_OPEN_RATIO = .5;
|
|
1002
|
-
const MIN_SWIPE_START_DISTANCE = 1;
|
|
1003
|
-
const VELOCITY_THRESHOLD = .1;
|
|
1004
|
-
const FALLBACK_SWIPE_OPEN_THRESHOLD = 40;
|
|
1005
|
-
const SWIPE_AREA_OPEN_HOOK = { [DrawerSwipeAreaDataAttributes.open]: "" };
|
|
1006
|
-
const SWIPE_AREA_CLOSED_HOOK = { [DrawerSwipeAreaDataAttributes.closed]: "" };
|
|
1007
|
-
const SWIPE_AREA_SWIPING_HOOK = { [DrawerSwipeAreaDataAttributes.swiping]: "" };
|
|
1008
|
-
const SWIPE_AREA_DISABLED_HOOK = { [DrawerSwipeAreaDataAttributes.disabled]: "" };
|
|
1009
|
-
const stateAttributesMapping = {
|
|
1010
|
-
open(value) {
|
|
1011
|
-
return value ? SWIPE_AREA_OPEN_HOOK : SWIPE_AREA_CLOSED_HOOK;
|
|
1012
|
-
},
|
|
1013
|
-
swiping(value) {
|
|
1014
|
-
return value ? SWIPE_AREA_SWIPING_HOOK : null;
|
|
1015
|
-
},
|
|
1016
|
-
swipeDirection(value) {
|
|
1017
|
-
return value ? { [DrawerSwipeAreaDataAttributes.swipeDirection]: value } : null;
|
|
1018
|
-
},
|
|
1019
|
-
disabled(value) {
|
|
1020
|
-
return value ? SWIPE_AREA_DISABLED_HOOK : null;
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
const oppositeSwipeDirection = {
|
|
1024
|
-
up: "down",
|
|
1025
|
-
down: "up",
|
|
1026
|
-
left: "right",
|
|
1027
|
-
right: "left"
|
|
1028
|
-
};
|
|
1029
|
-
function resolveTouchAction(direction) {
|
|
1030
|
-
return direction === "left" || direction === "right" ? "pan-y" : "pan-x";
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* An invisible area that listens for swipe gestures to open the drawer.
|
|
1034
|
-
* Renders a `<div>` element.
|
|
1035
|
-
*
|
|
1036
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
1037
|
-
*/
|
|
1038
|
-
const DrawerSwipeArea = /*#__PURE__*/ React$1.forwardRef(function DrawerSwipeArea(componentProps, forwardedRef) {
|
|
1039
|
-
const { render, className, style, disabled = false, swipeDirection: swipeDirectionProp, ...elementProps } = componentProps;
|
|
1040
|
-
const { store } = useDialogRootContext();
|
|
1041
|
-
const { swipeDirection, frontmostHeight } = useDrawerRootContext();
|
|
1042
|
-
const providerContext = useDrawerProviderContext(true);
|
|
1043
|
-
const [swipeActive, setSwipeActive] = React$1.useState(false);
|
|
1044
|
-
const releaseDismissTimeout = useTimeout();
|
|
1045
|
-
const swipeAreaRef = React$1.useRef(null);
|
|
1046
|
-
const swipeStartEventRef = React$1.useRef(null);
|
|
1047
|
-
const openedBySwipeRef = React$1.useRef(false);
|
|
1048
|
-
const dragDeltaRef = React$1.useRef({
|
|
1049
|
-
x: 0,
|
|
1050
|
-
y: 0
|
|
1051
|
-
});
|
|
1052
|
-
const closedOffsetRef = React$1.useRef(null);
|
|
1053
|
-
const appliedSwipeStylesRef = React$1.useRef(false);
|
|
1054
|
-
const popupTransitionRef = React$1.useRef(null);
|
|
1055
|
-
const swipeAreaId = useBaseUiId(componentProps.id);
|
|
1056
|
-
const registerTrigger = useTriggerRegistration(swipeAreaId, store);
|
|
1057
|
-
const open = store.useState("open");
|
|
1058
|
-
const resetDragDelta = useStableCallback(() => {
|
|
1059
|
-
dragDeltaRef.current.x = 0;
|
|
1060
|
-
dragDeltaRef.current.y = 0;
|
|
1061
|
-
});
|
|
1062
|
-
const resolvedSwipeDirection = swipeDirectionProp ?? oppositeSwipeDirection[swipeDirection];
|
|
1063
|
-
const dismissDirection = oppositeSwipeDirection[resolvedSwipeDirection];
|
|
1064
|
-
const enabled = !disabled && (!open || swipeActive);
|
|
1065
|
-
function disableDismissForSwipe() {
|
|
1066
|
-
releaseDismissTimeout.clear();
|
|
1067
|
-
store.context.outsidePressEnabledRef.current = false;
|
|
1068
|
-
}
|
|
1069
|
-
function enableDismissAfterRelease() {
|
|
1070
|
-
releaseDismissTimeout.start(0, () => {
|
|
1071
|
-
store.context.outsidePressEnabledRef.current = true;
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
function resolvePopupSize() {
|
|
1075
|
-
const popupElement = store.context.popupRef.current;
|
|
1076
|
-
if (!popupElement) return null;
|
|
1077
|
-
const size = dismissDirection === "left" || dismissDirection === "right" ? popupElement.offsetWidth : popupElement.offsetHeight;
|
|
1078
|
-
if (size <= 0) return null;
|
|
1079
|
-
return size;
|
|
1080
|
-
}
|
|
1081
|
-
function resolveClosedOffset() {
|
|
1082
|
-
const offset = resolvePopupSize();
|
|
1083
|
-
if (offset == null) return null;
|
|
1084
|
-
const popupElement = store.context.popupRef.current;
|
|
1085
|
-
if (!popupElement) return offset;
|
|
1086
|
-
const isHorizontal = dismissDirection === "left" || dismissDirection === "right";
|
|
1087
|
-
const transform = getElementTransform(popupElement);
|
|
1088
|
-
const transformOffset = isHorizontal ? transform.x : transform.y;
|
|
1089
|
-
if (Number.isFinite(transformOffset) && Math.abs(transformOffset) > .5) return Math.min(offset, Math.abs(transformOffset));
|
|
1090
|
-
return offset;
|
|
1091
|
-
}
|
|
1092
|
-
function resolveSwipeOpenThreshold() {
|
|
1093
|
-
const popupSize = resolvePopupSize();
|
|
1094
|
-
if (popupSize == null) return FALLBACK_SWIPE_OPEN_THRESHOLD;
|
|
1095
|
-
return popupSize * DEFAULT_SWIPE_OPEN_RATIO;
|
|
1096
|
-
}
|
|
1097
|
-
function applySwipeMovement() {
|
|
1098
|
-
if (!swipeActive) return;
|
|
1099
|
-
const popupElement = store.context.popupRef.current;
|
|
1100
|
-
if (!popupElement) return;
|
|
1101
|
-
if (!store.select("open") || !store.select("mounted")) return;
|
|
1102
|
-
if (closedOffsetRef.current == null) closedOffsetRef.current = resolveClosedOffset();
|
|
1103
|
-
const closedOffset = closedOffsetRef.current;
|
|
1104
|
-
if (!closedOffset || !Number.isFinite(closedOffset) || closedOffset <= 0) return;
|
|
1105
|
-
const { x, y } = dragDeltaRef.current;
|
|
1106
|
-
const displacement = getDisplacement(resolvedSwipeDirection, x, y);
|
|
1107
|
-
const clampedDisplacement = Math.max(0, displacement);
|
|
1108
|
-
const movement = (closedOffset - (clampedDisplacement > closedOffset ? closedOffset + Math.sqrt(clampedDisplacement - closedOffset) : clampedDisplacement)) * (dismissDirection === "left" || dismissDirection === "up" ? -1 : 1);
|
|
1109
|
-
const isHorizontal = dismissDirection === "left" || dismissDirection === "right";
|
|
1110
|
-
const movementX = isHorizontal ? movement : 0;
|
|
1111
|
-
const movementY = isHorizontal ? 0 : movement;
|
|
1112
|
-
const openProgress = Math.max(0, Math.min(1, clampedDisplacement / closedOffset));
|
|
1113
|
-
const backdropProgress = Math.max(0, Math.min(1, 1 - openProgress));
|
|
1114
|
-
popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementX, `${movementX}px`);
|
|
1115
|
-
popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementY, `${movementY}px`);
|
|
1116
|
-
popupElement.setAttribute(DrawerPopupDataAttributes.swiping, "");
|
|
1117
|
-
if (popupTransitionRef.current === null) popupTransitionRef.current = popupElement.style.transition;
|
|
1118
|
-
popupElement.style.transition = "none";
|
|
1119
|
-
const backdropElement = store.context.backdropRef.current;
|
|
1120
|
-
if (backdropElement) {
|
|
1121
|
-
backdropElement.setAttribute(DrawerPopupDataAttributes.swiping, "");
|
|
1122
|
-
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `${backdropProgress}`);
|
|
1123
|
-
if (openProgress > 0 && frontmostHeight > 0) backdropElement.style.setProperty(DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
1124
|
-
else backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1125
|
-
}
|
|
1126
|
-
providerContext?.visualStateStore.set({
|
|
1127
|
-
swipeProgress: openProgress,
|
|
1128
|
-
frontmostHeight: openProgress > 0 ? frontmostHeight : 0
|
|
1129
|
-
});
|
|
1130
|
-
appliedSwipeStylesRef.current = true;
|
|
1131
|
-
}
|
|
1132
|
-
const clearSwipeStyles = useStableCallback(() => {
|
|
1133
|
-
const popupElement = store.context.popupRef.current;
|
|
1134
|
-
if (popupElement && appliedSwipeStylesRef.current) {
|
|
1135
|
-
popupElement.style.removeProperty(DrawerPopupCssVars.swipeMovementX);
|
|
1136
|
-
popupElement.style.removeProperty(DrawerPopupCssVars.swipeMovementY);
|
|
1137
|
-
popupElement.removeAttribute(DrawerPopupDataAttributes.swiping);
|
|
1138
|
-
}
|
|
1139
|
-
if (popupElement && popupTransitionRef.current !== null) {
|
|
1140
|
-
popupElement.style.transition = popupTransitionRef.current;
|
|
1141
|
-
popupTransitionRef.current = null;
|
|
1142
|
-
}
|
|
1143
|
-
const backdropElement = store.context.backdropRef.current;
|
|
1144
|
-
if (backdropElement) {
|
|
1145
|
-
backdropElement.removeAttribute(DrawerPopupDataAttributes.swiping);
|
|
1146
|
-
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
1147
|
-
backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1148
|
-
}
|
|
1149
|
-
providerContext?.visualStateStore.set({
|
|
1150
|
-
swipeProgress: 0,
|
|
1151
|
-
frontmostHeight: 0
|
|
1152
|
-
});
|
|
1153
|
-
appliedSwipeStylesRef.current = false;
|
|
1154
|
-
});
|
|
1155
|
-
function openDrawer(event) {
|
|
1156
|
-
if (store.select("open")) return;
|
|
1157
|
-
openedBySwipeRef.current = true;
|
|
1158
|
-
store.setOpen(true, createChangeEventDetails(swipe, event, swipeAreaRef.current ?? void 0));
|
|
1159
|
-
}
|
|
1160
|
-
function closeDrawer(event) {
|
|
1161
|
-
if (!store.select("open")) return;
|
|
1162
|
-
store.setOpen(false, createChangeEventDetails(swipe, event, swipeAreaRef.current ?? void 0));
|
|
1163
|
-
}
|
|
1164
|
-
function resetSwipeInteractionState() {
|
|
1165
|
-
swipeStartEventRef.current = null;
|
|
1166
|
-
openedBySwipeRef.current = false;
|
|
1167
|
-
closedOffsetRef.current = null;
|
|
1168
|
-
setSwipeActive(false);
|
|
1169
|
-
}
|
|
1170
|
-
function finishSwipeInteraction() {
|
|
1171
|
-
resetSwipeInteractionState();
|
|
1172
|
-
enableDismissAfterRelease();
|
|
1173
|
-
resetDragDelta();
|
|
1174
|
-
clearSwipeStyles();
|
|
1175
|
-
}
|
|
1176
|
-
const swipe$2 = useSwipeDismiss({
|
|
1177
|
-
enabled,
|
|
1178
|
-
directions: [resolvedSwipeDirection],
|
|
1179
|
-
elementRef: swipeAreaRef,
|
|
1180
|
-
trackDrag: false,
|
|
1181
|
-
movementCssVars: {
|
|
1182
|
-
x: DrawerPopupCssVars.swipeMovementX,
|
|
1183
|
-
y: DrawerPopupCssVars.swipeMovementY
|
|
1184
|
-
},
|
|
1185
|
-
onSwipeStart(event) {
|
|
1186
|
-
disableDismissForSwipe();
|
|
1187
|
-
swipeStartEventRef.current = event;
|
|
1188
|
-
openedBySwipeRef.current = false;
|
|
1189
|
-
setSwipeActive(true);
|
|
1190
|
-
resetDragDelta();
|
|
1191
|
-
},
|
|
1192
|
-
onProgress(_progress, details) {
|
|
1193
|
-
if (!details) return;
|
|
1194
|
-
if (!swipeStartEventRef.current) return;
|
|
1195
|
-
dragDeltaRef.current.x = details.deltaX;
|
|
1196
|
-
dragDeltaRef.current.y = details.deltaY;
|
|
1197
|
-
if (details.direction !== resolvedSwipeDirection) return;
|
|
1198
|
-
if (getDisplacement(resolvedSwipeDirection, details.deltaX, details.deltaY) < MIN_SWIPE_START_DISTANCE && !openedBySwipeRef.current) return;
|
|
1199
|
-
if (!openedBySwipeRef.current) openDrawer(swipeStartEventRef.current);
|
|
1200
|
-
applySwipeMovement();
|
|
1201
|
-
},
|
|
1202
|
-
onRelease({ event, direction, deltaX, deltaY, releaseVelocityX, releaseVelocityY }) {
|
|
1203
|
-
const displacement = getDisplacement(resolvedSwipeDirection, deltaX, deltaY);
|
|
1204
|
-
const releaseVelocity = getDisplacement(resolvedSwipeDirection, releaseVelocityX, releaseVelocityY);
|
|
1205
|
-
const threshold = resolveSwipeOpenThreshold();
|
|
1206
|
-
if (threshold != null && direction === resolvedSwipeDirection && (threshold != null && displacement >= threshold || releaseVelocity >= VELOCITY_THRESHOLD) && !disabled) {
|
|
1207
|
-
if (!store.select("open")) openDrawer(event);
|
|
1208
|
-
} else if (openedBySwipeRef.current) closeDrawer(event);
|
|
1209
|
-
finishSwipeInteraction();
|
|
1210
|
-
return false;
|
|
1211
|
-
},
|
|
1212
|
-
onCancel: finishSwipeInteraction
|
|
1213
|
-
});
|
|
1214
|
-
const swipePointerProps = swipe$2.getPointerProps();
|
|
1215
|
-
const swipeTouchProps = swipe$2.getTouchProps();
|
|
1216
|
-
const resetSwipe = swipe$2.reset;
|
|
1217
|
-
React$1.useEffect(() => {
|
|
1218
|
-
if (!enabled) {
|
|
1219
|
-
resetSwipe();
|
|
1220
|
-
resetDragDelta();
|
|
1221
|
-
clearSwipeStyles();
|
|
1222
|
-
resetSwipeInteractionState();
|
|
1223
|
-
}
|
|
1224
|
-
}, [
|
|
1225
|
-
clearSwipeStyles,
|
|
1226
|
-
enabled,
|
|
1227
|
-
resetDragDelta,
|
|
1228
|
-
resetSwipe
|
|
1229
|
-
]);
|
|
1230
|
-
React$1.useEffect(() => {
|
|
1231
|
-
return () => {
|
|
1232
|
-
store.context.outsidePressEnabledRef.current = true;
|
|
1233
|
-
};
|
|
1234
|
-
}, [store]);
|
|
1235
|
-
return useRenderElement("div", componentProps, {
|
|
1236
|
-
state: {
|
|
1237
|
-
open,
|
|
1238
|
-
swiping: swipe$2.swiping,
|
|
1239
|
-
swipeDirection: resolvedSwipeDirection,
|
|
1240
|
-
disabled
|
|
1241
|
-
},
|
|
1242
|
-
ref: [
|
|
1243
|
-
forwardedRef,
|
|
1244
|
-
swipeAreaRef,
|
|
1245
|
-
registerTrigger
|
|
1246
|
-
],
|
|
1247
|
-
stateAttributesMapping,
|
|
1248
|
-
props: [
|
|
1249
|
-
{
|
|
1250
|
-
role: "presentation",
|
|
1251
|
-
"aria-hidden": true,
|
|
1252
|
-
style: {
|
|
1253
|
-
pointerEvents: !enabled ? "none" : void 0,
|
|
1254
|
-
touchAction: resolveTouchAction(resolvedSwipeDirection)
|
|
1255
|
-
},
|
|
1256
|
-
onPointerDown(event) {
|
|
1257
|
-
if (event.pointerType === "touch") return;
|
|
1258
|
-
swipePointerProps.onPointerDown?.(event);
|
|
1259
|
-
if (event.cancelable) event.preventDefault();
|
|
1260
|
-
},
|
|
1261
|
-
onPointerMove(event) {
|
|
1262
|
-
if (event.pointerType === "touch") return;
|
|
1263
|
-
swipePointerProps.onPointerMove?.(event);
|
|
1264
|
-
},
|
|
1265
|
-
onPointerUp(event) {
|
|
1266
|
-
if (event.pointerType === "touch") return;
|
|
1267
|
-
swipePointerProps.onPointerUp?.(event);
|
|
1268
|
-
},
|
|
1269
|
-
onPointerCancel(event) {
|
|
1270
|
-
if (event.pointerType === "touch") return;
|
|
1271
|
-
swipePointerProps.onPointerCancel?.(event);
|
|
1272
|
-
}
|
|
1273
|
-
},
|
|
1274
|
-
swipeTouchProps,
|
|
1275
|
-
swipeAreaId ? { id: swipeAreaId } : void 0,
|
|
1276
|
-
elementProps
|
|
1277
|
-
]
|
|
1278
|
-
});
|
|
1279
|
-
});
|
|
1280
|
-
DrawerSwipeArea.displayName = "DrawerSwipeArea";
|
|
1281
|
-
//#endregion
|
|
1282
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/title/DrawerTitle.mjs
|
|
1283
|
-
/**
|
|
1284
|
-
* A heading that labels the drawer.
|
|
1285
|
-
* Renders an `<h2>` element.
|
|
1286
|
-
*
|
|
1287
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
1288
|
-
*/
|
|
1289
|
-
const DrawerTitle = DialogTitle;
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/trigger/DrawerTrigger.mjs
|
|
1292
|
-
/**
|
|
1293
|
-
* A button that opens the drawer.
|
|
1294
|
-
* Renders a `<button>` element.
|
|
1295
|
-
*
|
|
1296
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
1297
|
-
*/
|
|
1298
|
-
const DrawerTrigger = DialogTrigger;
|
|
1299
|
-
//#endregion
|
|
1300
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/virtual-keyboard-provider/DrawerVirtualKeyboardContext.mjs
|
|
1301
|
-
const DrawerVirtualKeyboardContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
1302
|
-
DrawerVirtualKeyboardContext.displayName = "DrawerVirtualKeyboardContext";
|
|
1303
|
-
function useDrawerVirtualKeyboardContext() {
|
|
1304
|
-
return React$1.useContext(DrawerVirtualKeyboardContext);
|
|
1305
|
-
}
|
|
1306
|
-
//#endregion
|
|
1307
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/viewport/DrawerViewport.mjs
|
|
1308
|
-
const MIN_SWIPE_THRESHOLD = 10;
|
|
1309
|
-
const FAST_SWIPE_VELOCITY = .5;
|
|
1310
|
-
const SNAP_VELOCITY_THRESHOLD = .5;
|
|
1311
|
-
const SNAP_VELOCITY_MULTIPLIER = 300;
|
|
1312
|
-
const MAX_SNAP_VELOCITY = 4;
|
|
1313
|
-
const MIN_SWIPE_RELEASE_VELOCITY = .2;
|
|
1314
|
-
const MAX_SWIPE_RELEASE_VELOCITY = 4;
|
|
1315
|
-
const MIN_SWIPE_RELEASE_DURATION_MS = 80;
|
|
1316
|
-
const MAX_SWIPE_RELEASE_DURATION_MS = 360;
|
|
1317
|
-
const MIN_SWIPE_RELEASE_SCALAR = .1;
|
|
1318
|
-
const MAX_SWIPE_RELEASE_SCALAR = 1;
|
|
1319
|
-
const DRAWER_CONTENT_SELECTOR = `[${DRAWER_CONTENT_ATTRIBUTE}]`;
|
|
1320
|
-
/**
|
|
1321
|
-
* A positioning container for the drawer popup that can be made scrollable.
|
|
1322
|
-
* Renders a `<div>` element.
|
|
1323
|
-
*
|
|
1324
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
1325
|
-
*/
|
|
1326
|
-
const DrawerViewport = /*#__PURE__*/ React$1.forwardRef(function DrawerViewport(props, forwardedRef) {
|
|
1327
|
-
const { render, className, style, children, ...elementProps } = props;
|
|
1328
|
-
const { store } = useDialogRootContext();
|
|
1329
|
-
const popupRef = store.context.popupRef;
|
|
1330
|
-
const backdropRef = store.context.backdropRef;
|
|
1331
|
-
const { swipeDirection, notifyParentSwipingChange, notifyParentSwipeProgressChange, frontmostHeight, snapToSequentialPoints } = useDrawerRootContext();
|
|
1332
|
-
const providerContext = useDrawerProviderContext(true);
|
|
1333
|
-
const { snapPoints, resolvedSnapPoints, activeSnapPoint, activeSnapPointOffset, setActiveSnapPoint, popupHeight } = useDrawerSnapPoints();
|
|
1334
|
-
const open = store.useState("open");
|
|
1335
|
-
const mounted = store.useState("mounted");
|
|
1336
|
-
const nested = store.useState("nested");
|
|
1337
|
-
const nestedOpenDrawerCount = store.useState("nestedOpenDrawerCount");
|
|
1338
|
-
const viewportElement = store.useState("viewportElement");
|
|
1339
|
-
const popupElementState = store.useState("popupElement");
|
|
1340
|
-
const visualStateStore = providerContext?.visualStateStore;
|
|
1341
|
-
const nestedDrawerOpen = nestedOpenDrawerCount > 0;
|
|
1342
|
-
const scrollAxis = swipeDirection === "left" || swipeDirection === "right" ? "horizontal" : "vertical";
|
|
1343
|
-
const isVerticalScrollAxis = scrollAxis === "vertical";
|
|
1344
|
-
const crossScrollAxis = isVerticalScrollAxis ? "horizontal" : "vertical";
|
|
1345
|
-
const [swipeRelease, setSwipeRelease] = React$1.useState(null);
|
|
1346
|
-
const pendingSwipeCloseSnapPointRef = React$1.useRef(void 0);
|
|
1347
|
-
const resetSwipeRef = React$1.useRef(null);
|
|
1348
|
-
const controlledDismissFrame = useAnimationFrame();
|
|
1349
|
-
const swipingRef = React$1.useRef(false);
|
|
1350
|
-
const nestedSwipeActiveRef = React$1.useRef(false);
|
|
1351
|
-
const lastPointerTypeRef = React$1.useRef("");
|
|
1352
|
-
const ignoreNextTouchStartFromPenRef = React$1.useRef(false);
|
|
1353
|
-
const ignoreTouchSwipeRef = React$1.useRef(false);
|
|
1354
|
-
const touchScrollStateRef = React$1.useRef(null);
|
|
1355
|
-
const virtualKeyboard = useDrawerVirtualKeyboardContext();
|
|
1356
|
-
const snapPointRange = React$1.useMemo(() => {
|
|
1357
|
-
if (!snapPoints || snapPoints.length < 2) return null;
|
|
1358
|
-
if (swipeDirection !== "down" && swipeDirection !== "up") return null;
|
|
1359
|
-
if (resolvedSnapPoints.length < 2) return null;
|
|
1360
|
-
const offsets = resolvedSnapPoints.map((point) => point.offset).filter((offset) => Number.isFinite(offset)).sort((a, b) => a - b);
|
|
1361
|
-
if (offsets.length < 2) return null;
|
|
1362
|
-
const minOffset = offsets[0];
|
|
1363
|
-
const nextOffset = offsets[1];
|
|
1364
|
-
const maxOffset = offsets[offsets.length - 1];
|
|
1365
|
-
let range = nextOffset - minOffset;
|
|
1366
|
-
if (!Number.isFinite(range) || range <= 0) {
|
|
1367
|
-
const fallbackRange = maxOffset - minOffset;
|
|
1368
|
-
if (!Number.isFinite(fallbackRange) || fallbackRange <= 0) return null;
|
|
1369
|
-
range = fallbackRange;
|
|
1370
|
-
}
|
|
1371
|
-
return {
|
|
1372
|
-
minOffset,
|
|
1373
|
-
range
|
|
1374
|
-
};
|
|
1375
|
-
}, [
|
|
1376
|
-
resolvedSnapPoints,
|
|
1377
|
-
snapPoints,
|
|
1378
|
-
swipeDirection
|
|
1379
|
-
]);
|
|
1380
|
-
const snapPointProgress = React$1.useMemo(() => {
|
|
1381
|
-
if (!snapPointRange || activeSnapPointOffset === null) return null;
|
|
1382
|
-
return clamp((activeSnapPointOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1);
|
|
1383
|
-
}, [activeSnapPointOffset, snapPointRange]);
|
|
1384
|
-
const swipeDirections = React$1.useMemo(() => {
|
|
1385
|
-
if (snapPoints && snapPoints.length > 0 && (swipeDirection === "down" || swipeDirection === "up")) return swipeDirection === "down" ? ["down", "up"] : ["up", "down"];
|
|
1386
|
-
return [swipeDirection];
|
|
1387
|
-
}, [snapPoints, swipeDirection]);
|
|
1388
|
-
const setSwipeDismissed = useStableCallback((dismissed) => {
|
|
1389
|
-
setSwipeDismissedElements(popupRef.current, backdropRef.current, dismissed);
|
|
1390
|
-
});
|
|
1391
|
-
const clearSwipeRelease = useStableCallback(() => {
|
|
1392
|
-
setSwipeDismissed(false);
|
|
1393
|
-
popupRef.current?.removeAttribute(TransitionStatusDataAttributes.endingStyle);
|
|
1394
|
-
setSwipeRelease(null);
|
|
1395
|
-
});
|
|
1396
|
-
const finishNestedSwipe = useStableCallback(() => {
|
|
1397
|
-
if (!nestedSwipeActiveRef.current) return;
|
|
1398
|
-
nestedSwipeActiveRef.current = false;
|
|
1399
|
-
notifyParentSwipingChange?.(false);
|
|
1400
|
-
});
|
|
1401
|
-
const applySwipeProgress = useStableCallback(({ resolvedProgress, shouldTrackProgress, notifyParent }) => {
|
|
1402
|
-
const isActive = open && !nested && shouldTrackProgress;
|
|
1403
|
-
const swipeProgress = isActive ? resolvedProgress : 0;
|
|
1404
|
-
const nestedSwipeProgress = open && shouldTrackProgress ? resolvedProgress : 0;
|
|
1405
|
-
if (notifyParent && notifyParentSwipeProgressChange) {
|
|
1406
|
-
notifyParentSwipeProgressChange(nestedSwipeProgress);
|
|
1407
|
-
if (nestedSwipeProgress <= 0) finishNestedSwipe();
|
|
1408
|
-
}
|
|
1409
|
-
visualStateStore?.set({
|
|
1410
|
-
swipeProgress,
|
|
1411
|
-
frontmostHeight: swipeProgress > 0 ? frontmostHeight : 0
|
|
1412
|
-
});
|
|
1413
|
-
const backdropElement = backdropRef.current;
|
|
1414
|
-
if (!backdropElement) return;
|
|
1415
|
-
if (!isActive || swipeProgress <= 0) {
|
|
1416
|
-
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
1417
|
-
backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1418
|
-
return;
|
|
1419
|
-
}
|
|
1420
|
-
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `${swipeProgress}`);
|
|
1421
|
-
if (frontmostHeight > 0) backdropElement.style.setProperty(DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
1422
|
-
else backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1423
|
-
});
|
|
1424
|
-
function resolveSwipeRelease({ direction, deltaX, deltaY, velocityX, velocityY, releaseVelocityX, releaseVelocityY }) {
|
|
1425
|
-
if (!direction) return null;
|
|
1426
|
-
const popupElement = store.context.popupRef.current;
|
|
1427
|
-
if (!popupElement) return null;
|
|
1428
|
-
const size = direction === "left" || direction === "right" ? popupElement.offsetWidth : popupElement.offsetHeight;
|
|
1429
|
-
if (!Number.isFinite(size) || size <= 0) return null;
|
|
1430
|
-
const axisDelta = direction === "left" || direction === "right" ? deltaX : deltaY;
|
|
1431
|
-
const snapPointBaseOffset = snapPoints && snapPoints.length > 0 ? activeSnapPointOffset ?? 0 : 0;
|
|
1432
|
-
let baseOffset = 0;
|
|
1433
|
-
if (direction === "down") baseOffset = snapPointBaseOffset;
|
|
1434
|
-
else if (direction === "up") baseOffset = -snapPointBaseOffset;
|
|
1435
|
-
const translation = baseOffset + axisDelta;
|
|
1436
|
-
const translationAlongDirection = direction === "left" || direction === "up" ? -translation : translation;
|
|
1437
|
-
const remainingDistance = Math.max(0, size - translationAlongDirection);
|
|
1438
|
-
if (!Number.isFinite(remainingDistance) || remainingDistance <= 0) return null;
|
|
1439
|
-
const axisVelocity = direction === "left" || direction === "right" ? releaseVelocityX : releaseVelocityY;
|
|
1440
|
-
const fallbackVelocity = direction === "left" || direction === "right" ? velocityX : velocityY;
|
|
1441
|
-
const resolvedVelocity = Math.abs(axisVelocity) > 0 && Number.isFinite(axisVelocity) ? axisVelocity : fallbackVelocity;
|
|
1442
|
-
const directionalVelocity = direction === "left" || direction === "up" ? -resolvedVelocity : resolvedVelocity;
|
|
1443
|
-
if (!Number.isFinite(directionalVelocity) || directionalVelocity <= MIN_SWIPE_RELEASE_VELOCITY) return null;
|
|
1444
|
-
const durationMs = clamp(remainingDistance / clamp(directionalVelocity, MIN_SWIPE_RELEASE_VELOCITY, MAX_SWIPE_RELEASE_VELOCITY), MIN_SWIPE_RELEASE_DURATION_MS, MAX_SWIPE_RELEASE_DURATION_MS);
|
|
1445
|
-
if (!Number.isFinite(durationMs)) return null;
|
|
1446
|
-
const normalizedDuration = (durationMs - MIN_SWIPE_RELEASE_DURATION_MS) / (MAX_SWIPE_RELEASE_DURATION_MS - MIN_SWIPE_RELEASE_DURATION_MS);
|
|
1447
|
-
const durationScalar = clamp(MIN_SWIPE_RELEASE_SCALAR + normalizedDuration * (MAX_SWIPE_RELEASE_SCALAR - MIN_SWIPE_RELEASE_SCALAR), MIN_SWIPE_RELEASE_SCALAR, MAX_SWIPE_RELEASE_SCALAR);
|
|
1448
|
-
if (!Number.isFinite(durationScalar) || durationScalar <= 0) return null;
|
|
1449
|
-
return durationScalar;
|
|
1450
|
-
}
|
|
1451
|
-
function updateNestedSwipeActive(details) {
|
|
1452
|
-
if (nestedSwipeActiveRef.current || !details) return;
|
|
1453
|
-
const direction = details.direction ?? swipeDirection;
|
|
1454
|
-
const delta = direction === "left" || direction === "right" ? details.deltaX : details.deltaY;
|
|
1455
|
-
if (!Number.isFinite(delta) || Math.abs(delta) < MIN_SWIPE_THRESHOLD) return;
|
|
1456
|
-
nestedSwipeActiveRef.current = true;
|
|
1457
|
-
notifyParentSwipingChange?.(true);
|
|
1458
|
-
}
|
|
1459
|
-
const swipe$1 = useSwipeDismiss({
|
|
1460
|
-
enabled: mounted && !nestedDrawerOpen,
|
|
1461
|
-
directions: swipeDirections,
|
|
1462
|
-
elementRef: store.context.popupRef,
|
|
1463
|
-
ignoreSelectorWhenTouch: false,
|
|
1464
|
-
ignoreScrollableAncestors: true,
|
|
1465
|
-
movementCssVars: {
|
|
1466
|
-
x: DrawerPopupCssVars.swipeMovementX,
|
|
1467
|
-
y: DrawerPopupCssVars.swipeMovementY
|
|
1468
|
-
},
|
|
1469
|
-
onSwipeStart(event) {
|
|
1470
|
-
if ("touches" in event || "pointerType" in event && event.pointerType === "touch") return;
|
|
1471
|
-
const popupElement = popupRef.current;
|
|
1472
|
-
if (!popupElement) return;
|
|
1473
|
-
const selection = ownerDocument(popupElement).getSelection?.();
|
|
1474
|
-
if (!selection || selection.isCollapsed) return;
|
|
1475
|
-
const anchorElement = isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
1476
|
-
const focusElement = isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
1477
|
-
if (!contains(popupElement, anchorElement) && !contains(popupElement, focusElement)) return;
|
|
1478
|
-
selection.removeAllRanges();
|
|
1479
|
-
},
|
|
1480
|
-
onSwipingChange(swiping) {
|
|
1481
|
-
swipingRef.current = swiping;
|
|
1482
|
-
setBackdropSwipingAttribute(store.context.backdropRef.current, swiping);
|
|
1483
|
-
if (!swiping && !notifyParentSwipeProgressChange) finishNestedSwipe();
|
|
1484
|
-
},
|
|
1485
|
-
swipeThreshold({ element, direction }) {
|
|
1486
|
-
return getBaseSwipeThreshold(element, direction);
|
|
1487
|
-
},
|
|
1488
|
-
canStart(position, details) {
|
|
1489
|
-
const popupElement = store.context.popupRef.current;
|
|
1490
|
-
if (!popupElement) return false;
|
|
1491
|
-
const doc = popupElement.ownerDocument;
|
|
1492
|
-
const elementAtPoint = getElementAtPoint(doc, position.x, position.y);
|
|
1493
|
-
if (!elementAtPoint || !contains(popupElement, elementAtPoint)) return false;
|
|
1494
|
-
const nativeEvent = details.nativeEvent;
|
|
1495
|
-
if (("touches" in nativeEvent || "pointerType" in nativeEvent && nativeEvent.pointerType === "touch") && shouldIgnoreSwipeForTextSelection(doc, popupElement)) return false;
|
|
1496
|
-
if (nativeEvent.type === "touchstart" && isSwipeIgnoredTarget(elementAtPoint)) return false;
|
|
1497
|
-
return true;
|
|
1498
|
-
},
|
|
1499
|
-
onProgress(progress, details) {
|
|
1500
|
-
updateNestedSwipeActive(details);
|
|
1501
|
-
const hasSnapPoints = Boolean(snapPoints && snapPoints.length > 0);
|
|
1502
|
-
if (swipingRef.current && swipeDirection === "down" && hasSnapPoints && details && Number.isFinite(details.deltaY)) {
|
|
1503
|
-
const popupElement = store.context.popupRef.current;
|
|
1504
|
-
if (popupElement) {
|
|
1505
|
-
popupElement.style.removeProperty("transform");
|
|
1506
|
-
popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementY, `${getSnapPointSwipeMovement(activeSnapPointOffset ?? 0, details.deltaY)}px`);
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
const currentDirection = details?.direction ?? swipe$1.swipeDirection;
|
|
1510
|
-
const shouldTrackProgress = hasSnapPoints && (swipeDirection === "down" || swipeDirection === "up") || !hasSnapPoints || swipeDirection === "left" || swipeDirection === "right" || currentDirection === void 0 || currentDirection === swipeDirection;
|
|
1511
|
-
let resolvedProgress = progress;
|
|
1512
|
-
if (snapPointRange && popupHeight > 0) {
|
|
1513
|
-
if (details && Number.isFinite(details.deltaY)) resolvedProgress = clamp((clamp((activeSnapPointOffset ?? snapPointRange.minOffset) + details.deltaY, 0, popupHeight) - snapPointRange.minOffset) / snapPointRange.range, 0, 1);
|
|
1514
|
-
else if (snapPointProgress !== null) resolvedProgress = snapPointProgress;
|
|
1515
|
-
else if (currentDirection === "down" || currentDirection === "up") {
|
|
1516
|
-
const displacement = progress * popupHeight;
|
|
1517
|
-
const baseOffset = activeSnapPointOffset ?? snapPointRange.minOffset;
|
|
1518
|
-
resolvedProgress = clamp(((currentDirection === "down" ? baseOffset + displacement : baseOffset - displacement) - snapPointRange.minOffset) / snapPointRange.range, 0, 1);
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
applySwipeProgress({
|
|
1522
|
-
resolvedProgress,
|
|
1523
|
-
shouldTrackProgress,
|
|
1524
|
-
notifyParent: true
|
|
1525
|
-
});
|
|
1526
|
-
},
|
|
1527
|
-
onRelease({ event, deltaX, deltaY, direction, velocityX, velocityY, releaseVelocityX, releaseVelocityY }) {
|
|
1528
|
-
const swipeReleasePayload = {
|
|
1529
|
-
deltaX,
|
|
1530
|
-
deltaY,
|
|
1531
|
-
velocityX,
|
|
1532
|
-
velocityY,
|
|
1533
|
-
releaseVelocityX,
|
|
1534
|
-
releaseVelocityY
|
|
1535
|
-
};
|
|
1536
|
-
function startSwipeRelease(resolvedDirection) {
|
|
1537
|
-
const popupElement = store.context.popupRef.current;
|
|
1538
|
-
if (!popupElement) return;
|
|
1539
|
-
finishNestedSwipe();
|
|
1540
|
-
setSwipeDismissed(true);
|
|
1541
|
-
popupElement.style.removeProperty("transition");
|
|
1542
|
-
popupElement.setAttribute(TransitionStatusDataAttributes.endingStyle, "");
|
|
1543
|
-
ReactDOM.flushSync(() => {
|
|
1544
|
-
setSwipeRelease(resolveSwipeRelease({
|
|
1545
|
-
direction: resolvedDirection,
|
|
1546
|
-
...swipeReleasePayload
|
|
1547
|
-
}));
|
|
1548
|
-
});
|
|
1549
|
-
}
|
|
1550
|
-
if (!snapPoints || snapPoints.length === 0) {
|
|
1551
|
-
if (!direction) {
|
|
1552
|
-
clearSwipeRelease();
|
|
1553
|
-
return;
|
|
1554
|
-
}
|
|
1555
|
-
const element = store.context.popupRef.current;
|
|
1556
|
-
if (!element) {
|
|
1557
|
-
clearSwipeRelease();
|
|
1558
|
-
return;
|
|
1559
|
-
}
|
|
1560
|
-
const baseThreshold = getBaseSwipeThreshold(element, direction);
|
|
1561
|
-
const delta = direction === "left" || direction === "right" ? deltaX : deltaY;
|
|
1562
|
-
if (!Number.isFinite(delta)) {
|
|
1563
|
-
clearSwipeRelease();
|
|
1564
|
-
return;
|
|
1565
|
-
}
|
|
1566
|
-
const directionalDelta = direction === "left" || direction === "up" ? -delta : delta;
|
|
1567
|
-
if (directionalDelta <= 0) {
|
|
1568
|
-
clearSwipeRelease();
|
|
1569
|
-
return false;
|
|
1570
|
-
}
|
|
1571
|
-
const velocity = direction === "left" || direction === "right" ? velocityX : velocityY;
|
|
1572
|
-
if ((direction === "left" || direction === "up" ? -velocity : velocity) >= FAST_SWIPE_VELOCITY && directionalDelta > 0) {
|
|
1573
|
-
startSwipeRelease(direction);
|
|
1574
|
-
return true;
|
|
1575
|
-
}
|
|
1576
|
-
const shouldClose = directionalDelta > baseThreshold;
|
|
1577
|
-
if (shouldClose) startSwipeRelease(direction);
|
|
1578
|
-
else clearSwipeRelease();
|
|
1579
|
-
return shouldClose;
|
|
1580
|
-
}
|
|
1581
|
-
if (swipeDirection !== "down" && swipeDirection !== "up") {
|
|
1582
|
-
clearSwipeRelease();
|
|
1583
|
-
return;
|
|
1584
|
-
}
|
|
1585
|
-
if (!popupHeight || resolvedSnapPoints.length === 0) {
|
|
1586
|
-
clearSwipeRelease();
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
|
-
const dragDelta = swipeDirection === "down" ? deltaY : -deltaY;
|
|
1590
|
-
if (!Number.isFinite(dragDelta)) {
|
|
1591
|
-
clearSwipeRelease();
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
const dragDirection = Math.sign(dragDelta);
|
|
1595
|
-
const releaseDirectionalVelocity = swipeDirection === "down" ? releaseVelocityY : -releaseVelocityY;
|
|
1596
|
-
const fallbackDirectionalVelocity = swipeDirection === "down" ? velocityY : -velocityY;
|
|
1597
|
-
let resolvedDirectionalVelocity = Number.isFinite(releaseDirectionalVelocity) ? releaseDirectionalVelocity : fallbackDirectionalVelocity;
|
|
1598
|
-
if (dragDirection !== 0 && Math.abs(dragDelta) >= MIN_SWIPE_THRESHOLD && Number.isFinite(resolvedDirectionalVelocity)) {
|
|
1599
|
-
const velocityDirection = Math.sign(resolvedDirectionalVelocity);
|
|
1600
|
-
if (velocityDirection !== 0 && velocityDirection !== dragDirection) resolvedDirectionalVelocity = fallbackDirectionalVelocity;
|
|
1601
|
-
}
|
|
1602
|
-
const currentOffset = activeSnapPointOffset ?? 0;
|
|
1603
|
-
const dragTargetOffset = clamp(currentOffset + dragDelta, 0, popupHeight);
|
|
1604
|
-
const velocityOffset = Number.isFinite(resolvedDirectionalVelocity) && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD ? clamp(resolvedDirectionalVelocity, -4, MAX_SNAP_VELOCITY) * SNAP_VELOCITY_MULTIPLIER : 0;
|
|
1605
|
-
const targetOffset = snapToSequentialPoints ? dragTargetOffset : clamp(dragTargetOffset + velocityOffset, 0, popupHeight);
|
|
1606
|
-
const snapPointEventDetails = createChangeEventDetails(swipe, event);
|
|
1607
|
-
const closeFromSnapPoints = () => {
|
|
1608
|
-
pendingSwipeCloseSnapPointRef.current = activeSnapPoint;
|
|
1609
|
-
setActiveSnapPoint?.(null, snapPointEventDetails);
|
|
1610
|
-
startSwipeRelease(swipeDirection);
|
|
1611
|
-
return true;
|
|
1612
|
-
};
|
|
1613
|
-
if (snapToSequentialPoints) {
|
|
1614
|
-
const orderedSnapPoints = [...resolvedSnapPoints].sort((first, second) => first.offset - second.offset);
|
|
1615
|
-
if (orderedSnapPoints.length === 0) {
|
|
1616
|
-
clearSwipeRelease();
|
|
1617
|
-
return false;
|
|
1618
|
-
}
|
|
1619
|
-
let currentIndex = 0;
|
|
1620
|
-
let closestDistance = Math.abs(currentOffset - orderedSnapPoints[0].offset);
|
|
1621
|
-
for (let index = 1; index < orderedSnapPoints.length; index += 1) {
|
|
1622
|
-
const distance = Math.abs(currentOffset - orderedSnapPoints[index].offset);
|
|
1623
|
-
if (distance < closestDistance) {
|
|
1624
|
-
closestDistance = distance;
|
|
1625
|
-
currentIndex = index;
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
let targetSnapPoint = orderedSnapPoints[0];
|
|
1629
|
-
closestDistance = Math.abs(targetOffset - targetSnapPoint.offset);
|
|
1630
|
-
for (const snapPoint of orderedSnapPoints) {
|
|
1631
|
-
const distance = Math.abs(targetOffset - snapPoint.offset);
|
|
1632
|
-
if (distance < closestDistance) {
|
|
1633
|
-
closestDistance = distance;
|
|
1634
|
-
targetSnapPoint = snapPoint;
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
const velocityDirection = Math.sign(resolvedDirectionalVelocity);
|
|
1638
|
-
const shouldAdvance = dragDirection !== 0 && velocityDirection !== 0 && velocityDirection === dragDirection && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD;
|
|
1639
|
-
let effectiveTargetOffset = targetOffset;
|
|
1640
|
-
if (shouldAdvance) {
|
|
1641
|
-
const adjacentIndex = clamp(currentIndex + dragDirection, 0, orderedSnapPoints.length - 1);
|
|
1642
|
-
if (adjacentIndex !== currentIndex) {
|
|
1643
|
-
const adjacentPoint = orderedSnapPoints[adjacentIndex];
|
|
1644
|
-
if (dragDirection > 0 ? targetOffset < adjacentPoint.offset : targetOffset > adjacentPoint.offset) {
|
|
1645
|
-
targetSnapPoint = adjacentPoint;
|
|
1646
|
-
effectiveTargetOffset = adjacentPoint.offset;
|
|
1647
|
-
}
|
|
1648
|
-
} else if (dragDirection > 0) return closeFromSnapPoints();
|
|
1649
|
-
}
|
|
1650
|
-
if (Math.abs(effectiveTargetOffset - popupHeight) < Math.abs(effectiveTargetOffset - targetSnapPoint.offset)) return closeFromSnapPoints();
|
|
1651
|
-
setActiveSnapPoint?.(targetSnapPoint.value, snapPointEventDetails);
|
|
1652
|
-
clearSwipeRelease();
|
|
1653
|
-
return false;
|
|
1654
|
-
}
|
|
1655
|
-
if (resolvedDirectionalVelocity >= FAST_SWIPE_VELOCITY && dragDelta > 0) return closeFromSnapPoints();
|
|
1656
|
-
let closestSnapPoint = resolvedSnapPoints[0];
|
|
1657
|
-
let closestDistance = Math.abs(targetOffset - closestSnapPoint.offset);
|
|
1658
|
-
for (const snapPoint of resolvedSnapPoints) {
|
|
1659
|
-
const distance = Math.abs(targetOffset - snapPoint.offset);
|
|
1660
|
-
if (distance < closestDistance) {
|
|
1661
|
-
closestDistance = distance;
|
|
1662
|
-
closestSnapPoint = snapPoint;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
if (Math.abs(targetOffset - popupHeight) < closestDistance) return closeFromSnapPoints();
|
|
1666
|
-
setActiveSnapPoint?.(closestSnapPoint.value, snapPointEventDetails);
|
|
1667
|
-
clearSwipeRelease();
|
|
1668
|
-
return false;
|
|
1669
|
-
},
|
|
1670
|
-
onDismiss(event) {
|
|
1671
|
-
visualStateStore?.set({
|
|
1672
|
-
swipeProgress: 0,
|
|
1673
|
-
frontmostHeight: 0
|
|
1674
|
-
});
|
|
1675
|
-
const backdropElement = store.context.backdropRef.current;
|
|
1676
|
-
if (backdropElement) {
|
|
1677
|
-
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
1678
|
-
backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1679
|
-
}
|
|
1680
|
-
const dismissEventDetails = createChangeEventDetails(swipe, event);
|
|
1681
|
-
store.setOpen(false, dismissEventDetails);
|
|
1682
|
-
if (dismissEventDetails.isCanceled) {
|
|
1683
|
-
const pendingSnapPoint = pendingSwipeCloseSnapPointRef.current;
|
|
1684
|
-
if (pendingSnapPoint !== void 0) setActiveSnapPoint?.(pendingSnapPoint, createChangeEventDetails(swipe, event));
|
|
1685
|
-
pendingSwipeCloseSnapPointRef.current = void 0;
|
|
1686
|
-
resetSwipeRef.current?.();
|
|
1687
|
-
clearSwipeRelease();
|
|
1688
|
-
return;
|
|
1689
|
-
}
|
|
1690
|
-
if (store.select("open")) {
|
|
1691
|
-
const savedEvent = event;
|
|
1692
|
-
controlledDismissFrame.request(() => {
|
|
1693
|
-
if (store.select("open")) {
|
|
1694
|
-
const pendingSnapPoint = pendingSwipeCloseSnapPointRef.current;
|
|
1695
|
-
if (pendingSnapPoint !== void 0) setActiveSnapPoint?.(pendingSnapPoint, createChangeEventDetails(swipe, savedEvent));
|
|
1696
|
-
pendingSwipeCloseSnapPointRef.current = void 0;
|
|
1697
|
-
clearSwipeRelease();
|
|
1698
|
-
resetSwipeRef.current?.();
|
|
1699
|
-
} else pendingSwipeCloseSnapPointRef.current = void 0;
|
|
1700
|
-
});
|
|
1701
|
-
return;
|
|
1702
|
-
}
|
|
1703
|
-
pendingSwipeCloseSnapPointRef.current = void 0;
|
|
1704
|
-
setSwipeDismissed(true);
|
|
1705
|
-
}
|
|
1706
|
-
});
|
|
1707
|
-
const swipePointerProps = swipe$1.getPointerProps();
|
|
1708
|
-
const swipeTouchProps = swipe$1.getTouchProps();
|
|
1709
|
-
const { moveNative: moveSwipeNative, reset: resetSwipe } = swipe$1;
|
|
1710
|
-
resetSwipeRef.current = resetSwipe;
|
|
1711
|
-
React$1.useEffect(() => {
|
|
1712
|
-
const rootElement = viewportElement ?? popupElementState;
|
|
1713
|
-
if (!rootElement) return;
|
|
1714
|
-
const resolvedRootElement = rootElement;
|
|
1715
|
-
const doc = ownerDocument(resolvedRootElement);
|
|
1716
|
-
const win = getWindow(doc);
|
|
1717
|
-
function handleNativeTouchMove(event) {
|
|
1718
|
-
virtualKeyboard?.onTouchMove(event);
|
|
1719
|
-
if (ignoreTouchSwipeRef.current) return;
|
|
1720
|
-
const touchState = touchScrollStateRef.current;
|
|
1721
|
-
const touch = event.touches[0];
|
|
1722
|
-
if (!touch || !touchState) return;
|
|
1723
|
-
const drawerAxisDelta = isVerticalScrollAxis ? touch.clientY - touchState.lastY : touch.clientX - touchState.lastX;
|
|
1724
|
-
if (isEventOnRangeInput(event, win)) {
|
|
1725
|
-
touchState.allowSwipe = false;
|
|
1726
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1727
|
-
return;
|
|
1728
|
-
}
|
|
1729
|
-
if (event.touches.length === 2) {
|
|
1730
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
if (shouldIgnoreSwipeForTextSelection(doc, resolvedRootElement) || !open || !mounted || nestedDrawerOpen) {
|
|
1734
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1735
|
-
return;
|
|
1736
|
-
}
|
|
1737
|
-
if (preserveNativeCrossAxisScrollOnMove(touchState, touch, isVerticalScrollAxis)) {
|
|
1738
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1739
|
-
return;
|
|
1740
|
-
}
|
|
1741
|
-
const scrollTarget = touchState.scrollTarget;
|
|
1742
|
-
if (!scrollTarget || scrollTarget === doc.documentElement || scrollTarget === doc.body) {
|
|
1743
|
-
if (event.cancelable) event.preventDefault();
|
|
1744
|
-
event.stopPropagation();
|
|
1745
|
-
moveSwipeNative(event, resolvedRootElement);
|
|
1746
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
if (!hasScrollableContentOnAxis(scrollTarget, scrollAxis)) {
|
|
1750
|
-
if (event.cancelable) event.preventDefault();
|
|
1751
|
-
event.stopPropagation();
|
|
1752
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1753
|
-
return;
|
|
1754
|
-
}
|
|
1755
|
-
const delta = drawerAxisDelta;
|
|
1756
|
-
if (delta !== 0) {
|
|
1757
|
-
const canSwipeFromScrollEdge = canSwipeFromScrollEdgeOnMove(scrollTarget, scrollAxis, swipeDirection, delta);
|
|
1758
|
-
if (!touchState.allowSwipe) if (!event.cancelable) touchState.allowSwipe = false;
|
|
1759
|
-
else if (canSwipeFromScrollEdge) {
|
|
1760
|
-
touchState.allowSwipe = true;
|
|
1761
|
-
event.preventDefault();
|
|
1762
|
-
} else touchState.allowSwipe = false;
|
|
1763
|
-
else if (event.cancelable) event.preventDefault();
|
|
1764
|
-
}
|
|
1765
|
-
if (touchState.allowSwipe === true) {
|
|
1766
|
-
event.stopPropagation();
|
|
1767
|
-
moveSwipeNative(event, resolvedRootElement);
|
|
1768
|
-
}
|
|
1769
|
-
updateTouchScrollPosition(touchState, touch);
|
|
1770
|
-
}
|
|
1771
|
-
return addEventListener(doc, "touchmove", handleNativeTouchMove, {
|
|
1772
|
-
passive: false,
|
|
1773
|
-
capture: true
|
|
1774
|
-
});
|
|
1775
|
-
}, [
|
|
1776
|
-
mounted,
|
|
1777
|
-
nestedDrawerOpen,
|
|
1778
|
-
open,
|
|
1779
|
-
popupElementState,
|
|
1780
|
-
isVerticalScrollAxis,
|
|
1781
|
-
scrollAxis,
|
|
1782
|
-
swipeDirection,
|
|
1783
|
-
moveSwipeNative,
|
|
1784
|
-
viewportElement,
|
|
1785
|
-
virtualKeyboard
|
|
1786
|
-
]);
|
|
1787
|
-
React$1.useEffect(() => {
|
|
1788
|
-
if (!snapPointRange || swipe$1.swiping) return;
|
|
1789
|
-
applySwipeProgress({
|
|
1790
|
-
resolvedProgress: !open || nested ? 0 : snapPointProgress ?? 0,
|
|
1791
|
-
shouldTrackProgress: true,
|
|
1792
|
-
notifyParent: false
|
|
1793
|
-
});
|
|
1794
|
-
}, [
|
|
1795
|
-
applySwipeProgress,
|
|
1796
|
-
frontmostHeight,
|
|
1797
|
-
nested,
|
|
1798
|
-
notifyParentSwipeProgressChange,
|
|
1799
|
-
open,
|
|
1800
|
-
snapPointProgress,
|
|
1801
|
-
snapPointRange,
|
|
1802
|
-
swipe$1.swiping,
|
|
1803
|
-
store,
|
|
1804
|
-
visualStateStore
|
|
1805
|
-
]);
|
|
1806
|
-
React$1.useEffect(() => {
|
|
1807
|
-
if (!notifyParentSwipeProgressChange) return;
|
|
1808
|
-
if (!open) notifyParentSwipeProgressChange(0);
|
|
1809
|
-
return () => {
|
|
1810
|
-
notifyParentSwipeProgressChange(0);
|
|
1811
|
-
};
|
|
1812
|
-
}, [notifyParentSwipeProgressChange, open]);
|
|
1813
|
-
React$1.useEffect(() => {
|
|
1814
|
-
if (open) {
|
|
1815
|
-
resetSwipe();
|
|
1816
|
-
clearSwipeRelease();
|
|
1817
|
-
}
|
|
1818
|
-
}, [
|
|
1819
|
-
clearSwipeRelease,
|
|
1820
|
-
open,
|
|
1821
|
-
resetSwipe
|
|
1822
|
-
]);
|
|
1823
|
-
React$1.useEffect(() => {
|
|
1824
|
-
const backdropElement = backdropRef.current;
|
|
1825
|
-
return () => {
|
|
1826
|
-
visualStateStore?.set({
|
|
1827
|
-
swipeProgress: 0,
|
|
1828
|
-
frontmostHeight: 0
|
|
1829
|
-
});
|
|
1830
|
-
setBackdropSwipingAttribute(backdropElement, false);
|
|
1831
|
-
const currentBackdrop = backdropRef.current;
|
|
1832
|
-
if (currentBackdrop !== backdropElement) setBackdropSwipingAttribute(currentBackdrop, false);
|
|
1833
|
-
finishNestedSwipe();
|
|
1834
|
-
};
|
|
1835
|
-
}, [
|
|
1836
|
-
backdropRef,
|
|
1837
|
-
finishNestedSwipe,
|
|
1838
|
-
visualStateStore
|
|
1839
|
-
]);
|
|
1840
|
-
const swipeProviderValue = React$1.useMemo(() => ({
|
|
1841
|
-
swiping: swipe$1.swiping,
|
|
1842
|
-
getDragStyles: swipe$1.getDragStyles,
|
|
1843
|
-
swipeStrength: swipeRelease ?? null,
|
|
1844
|
-
setSwipeDismissed
|
|
1845
|
-
}), [
|
|
1846
|
-
setSwipeDismissed,
|
|
1847
|
-
swipe$1.getDragStyles,
|
|
1848
|
-
swipe$1.swiping,
|
|
1849
|
-
swipeRelease
|
|
1850
|
-
]);
|
|
1851
|
-
function resetTouchTrackingState() {
|
|
1852
|
-
ignoreTouchSwipeRef.current = false;
|
|
1853
|
-
touchScrollStateRef.current = null;
|
|
1854
|
-
lastPointerTypeRef.current = "";
|
|
1855
|
-
ignoreNextTouchStartFromPenRef.current = false;
|
|
1856
|
-
}
|
|
1857
|
-
return /*#__PURE__*/ jsx(DialogViewport, {
|
|
1858
|
-
ref: forwardedRef,
|
|
1859
|
-
className,
|
|
1860
|
-
style,
|
|
1861
|
-
render,
|
|
1862
|
-
...mergeProps(elementProps, {
|
|
1863
|
-
onPointerDown(event) {
|
|
1864
|
-
lastPointerTypeRef.current = event.pointerType;
|
|
1865
|
-
ignoreNextTouchStartFromPenRef.current = event.pointerType === "pen";
|
|
1866
|
-
if (!open || !mounted || nestedDrawerOpen) return;
|
|
1867
|
-
const elementAtPoint = getElementAtPoint(ownerDocument(event.currentTarget), event.clientX, event.clientY);
|
|
1868
|
-
if (isSwipeIgnoredTarget(elementAtPoint) || isDrawerContentTarget(elementAtPoint)) return;
|
|
1869
|
-
if (event.pointerType === "touch") return;
|
|
1870
|
-
swipePointerProps.onPointerDown?.(event);
|
|
1871
|
-
},
|
|
1872
|
-
onPointerMove(event) {
|
|
1873
|
-
if (event.pointerType === "touch") return;
|
|
1874
|
-
swipePointerProps.onPointerMove?.(event);
|
|
1875
|
-
},
|
|
1876
|
-
onPointerUp(event) {
|
|
1877
|
-
if (lastPointerTypeRef.current === event.pointerType) lastPointerTypeRef.current = "";
|
|
1878
|
-
if (event.pointerType === "touch") return;
|
|
1879
|
-
swipePointerProps.onPointerUp?.(event);
|
|
1880
|
-
},
|
|
1881
|
-
onPointerCancel(event) {
|
|
1882
|
-
if (lastPointerTypeRef.current === event.pointerType) lastPointerTypeRef.current = "";
|
|
1883
|
-
if (event.pointerType === "touch") return;
|
|
1884
|
-
swipePointerProps.onPointerCancel?.(event);
|
|
1885
|
-
},
|
|
1886
|
-
onTouchStart(event) {
|
|
1887
|
-
if (lastPointerTypeRef.current === "pen" && ignoreNextTouchStartFromPenRef.current) {
|
|
1888
|
-
ignoreNextTouchStartFromPenRef.current = false;
|
|
1889
|
-
ignoreTouchSwipeRef.current = false;
|
|
1890
|
-
touchScrollStateRef.current = null;
|
|
1891
|
-
return;
|
|
1892
|
-
}
|
|
1893
|
-
if (!open || !mounted || nestedDrawerOpen) {
|
|
1894
|
-
ignoreTouchSwipeRef.current = false;
|
|
1895
|
-
touchScrollStateRef.current = null;
|
|
1896
|
-
return;
|
|
1897
|
-
}
|
|
1898
|
-
const touch = event.touches[0];
|
|
1899
|
-
if (!touch) return;
|
|
1900
|
-
if (isReactTouchEventOnRangeInput(event)) {
|
|
1901
|
-
ignoreTouchSwipeRef.current = false;
|
|
1902
|
-
touchScrollStateRef.current = null;
|
|
1903
|
-
return;
|
|
1904
|
-
}
|
|
1905
|
-
const elementAtPoint = getElementAtPoint(ownerDocument(event.currentTarget), touch.clientX, touch.clientY);
|
|
1906
|
-
const rootElement = viewportElement ?? popupElementState;
|
|
1907
|
-
const eventTarget = getTarget(event.nativeEvent);
|
|
1908
|
-
const target = isElement(eventTarget) ? eventTarget : null;
|
|
1909
|
-
if (rootElement && target && !contains(rootElement, target)) {
|
|
1910
|
-
ignoreTouchSwipeRef.current = true;
|
|
1911
|
-
touchScrollStateRef.current = null;
|
|
1912
|
-
return;
|
|
1913
|
-
}
|
|
1914
|
-
virtualKeyboard?.onTouchStart(event);
|
|
1915
|
-
ignoreTouchSwipeRef.current = isSwipeIgnoredTarget(elementAtPoint);
|
|
1916
|
-
if (ignoreTouchSwipeRef.current) {
|
|
1917
|
-
touchScrollStateRef.current = null;
|
|
1918
|
-
return;
|
|
1919
|
-
}
|
|
1920
|
-
let scrollTarget = null;
|
|
1921
|
-
let hasCrossAxisScrollableContent = false;
|
|
1922
|
-
if (rootElement && target) {
|
|
1923
|
-
scrollTarget = findScrollableTouchTarget(target, rootElement, scrollAxis);
|
|
1924
|
-
hasCrossAxisScrollableContent = findScrollableTouchTarget(target, rootElement, crossScrollAxis) != null;
|
|
1925
|
-
}
|
|
1926
|
-
let allowSwipe = null;
|
|
1927
|
-
if (scrollTarget) allowSwipe = isAtSwipeStartEdge(scrollTarget, scrollAxis, swipeDirection) ? null : false;
|
|
1928
|
-
touchScrollStateRef.current = {
|
|
1929
|
-
startX: touch.clientX,
|
|
1930
|
-
startY: touch.clientY,
|
|
1931
|
-
lastX: touch.clientX,
|
|
1932
|
-
lastY: touch.clientY,
|
|
1933
|
-
scrollTarget,
|
|
1934
|
-
hasCrossAxisScrollableContent,
|
|
1935
|
-
allowSwipe,
|
|
1936
|
-
preserveNativeCrossAxisScroll: false
|
|
1937
|
-
};
|
|
1938
|
-
swipeTouchProps.onTouchStart?.(event);
|
|
1939
|
-
},
|
|
1940
|
-
onTouchEnd(event) {
|
|
1941
|
-
virtualKeyboard?.onTouchEnd(event);
|
|
1942
|
-
resetTouchTrackingState();
|
|
1943
|
-
swipeTouchProps.onTouchEnd?.(event);
|
|
1944
|
-
},
|
|
1945
|
-
onTouchCancel(event) {
|
|
1946
|
-
virtualKeyboard?.onTouchCancel();
|
|
1947
|
-
resetTouchTrackingState();
|
|
1948
|
-
swipeTouchProps.onTouchCancel?.(event);
|
|
1949
|
-
},
|
|
1950
|
-
["data-nested-dialog-open"]: void 0
|
|
1951
|
-
}),
|
|
1952
|
-
children: /*#__PURE__*/ jsx(DrawerViewportContext.Provider, {
|
|
1953
|
-
value: swipeProviderValue,
|
|
1954
|
-
children
|
|
1955
|
-
})
|
|
1956
|
-
});
|
|
1957
|
-
});
|
|
1958
|
-
DrawerViewport.displayName = "DrawerViewport";
|
|
1959
|
-
function setSwipeDismissedElements(popupElement, backdropElement, dismissed) {
|
|
1960
|
-
if (dismissed) {
|
|
1961
|
-
popupElement?.setAttribute(DrawerPopupDataAttributes.swipeDismiss, "");
|
|
1962
|
-
backdropElement?.setAttribute(DrawerPopupDataAttributes.swipeDismiss, "");
|
|
1963
|
-
return;
|
|
1964
|
-
}
|
|
1965
|
-
popupElement?.removeAttribute(DrawerPopupDataAttributes.swipeDismiss);
|
|
1966
|
-
backdropElement?.removeAttribute(DrawerPopupDataAttributes.swipeDismiss);
|
|
1967
|
-
}
|
|
1968
|
-
function setBackdropSwipingAttribute(backdropElement, swiping) {
|
|
1969
|
-
if (!backdropElement) return;
|
|
1970
|
-
if (swiping) {
|
|
1971
|
-
backdropElement.setAttribute(DrawerPopupDataAttributes.swiping, "");
|
|
1972
|
-
return;
|
|
1973
|
-
}
|
|
1974
|
-
backdropElement.removeAttribute(DrawerPopupDataAttributes.swiping);
|
|
1975
|
-
}
|
|
1976
|
-
function isSwipeIgnoredTarget(target) {
|
|
1977
|
-
return Boolean(target?.closest(BASE_UI_SWIPE_IGNORE_SELECTOR));
|
|
1978
|
-
}
|
|
1979
|
-
function isDrawerContentTarget(target) {
|
|
1980
|
-
return Boolean(target?.closest(DRAWER_CONTENT_SELECTOR));
|
|
1981
|
-
}
|
|
1982
|
-
function getBaseSwipeThreshold(element, direction) {
|
|
1983
|
-
const size = direction === "left" || direction === "right" ? element.offsetWidth : element.offsetHeight;
|
|
1984
|
-
return Math.max(size * .5, MIN_SWIPE_THRESHOLD);
|
|
1985
|
-
}
|
|
1986
|
-
function isRangeInput(target, win) {
|
|
1987
|
-
return target instanceof win.HTMLInputElement && target.type === "range";
|
|
1988
|
-
}
|
|
1989
|
-
function isTextSelectionControl(target) {
|
|
1990
|
-
if (!isElement(target)) return false;
|
|
1991
|
-
return target.tagName === "INPUT" || target.tagName === "TEXTAREA";
|
|
1992
|
-
}
|
|
1993
|
-
function hasExpandedSelectionWithinTarget(selection, target) {
|
|
1994
|
-
const anchorElement = isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
1995
|
-
const focusElement = isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
1996
|
-
return selection.containsNode(target, true) || contains(target, anchorElement) || contains(target, focusElement);
|
|
1997
|
-
}
|
|
1998
|
-
function shouldIgnoreSwipeForTextSelection(doc, rootElement) {
|
|
1999
|
-
const activeEl = activeElement(doc);
|
|
2000
|
-
if (Boolean(activeEl && contains(rootElement, activeEl)) && isTextSelectionControl(activeEl)) {
|
|
2001
|
-
const { selectionStart, selectionEnd } = activeEl;
|
|
2002
|
-
if (selectionStart != null && selectionEnd != null && selectionStart < selectionEnd) return true;
|
|
2003
|
-
}
|
|
2004
|
-
const selection = doc.getSelection?.();
|
|
2005
|
-
if (!selection || selection.isCollapsed) return false;
|
|
2006
|
-
return hasExpandedSelectionWithinTarget(selection, rootElement);
|
|
2007
|
-
}
|
|
2008
|
-
function isEventOnRangeInput(event, win) {
|
|
2009
|
-
const composedPath = event.composedPath();
|
|
2010
|
-
if (composedPath) return composedPath.some((pathTarget) => isRangeInput(pathTarget, win));
|
|
2011
|
-
return isRangeInput(getTarget(event), win);
|
|
2012
|
-
}
|
|
2013
|
-
function isReactTouchEventOnRangeInput(event) {
|
|
2014
|
-
return isEventOnRangeInput(event.nativeEvent, getWindow(event.currentTarget));
|
|
2015
|
-
}
|
|
2016
|
-
function updateTouchScrollPosition(touchState, touch) {
|
|
2017
|
-
touchState.lastX = touch.clientX;
|
|
2018
|
-
touchState.lastY = touch.clientY;
|
|
2019
|
-
}
|
|
2020
|
-
function preserveNativeCrossAxisScrollOnMove(touchState, touch, isVerticalScrollAxis) {
|
|
2021
|
-
if (touchState.preserveNativeCrossAxisScroll) return true;
|
|
2022
|
-
if (touchState.allowSwipe === true || !touchState.hasCrossAxisScrollableContent) return false;
|
|
2023
|
-
const drawerAxisGestureDelta = isVerticalScrollAxis ? touch.clientY - touchState.startY : touch.clientX - touchState.startX;
|
|
2024
|
-
const crossAxisGestureDelta = isVerticalScrollAxis ? touch.clientX - touchState.startX : touch.clientY - touchState.startY;
|
|
2025
|
-
const absDrawerAxisGestureDelta = Math.abs(drawerAxisGestureDelta);
|
|
2026
|
-
const absCrossAxisGestureDelta = Math.abs(crossAxisGestureDelta);
|
|
2027
|
-
if (absCrossAxisGestureDelta < 6 || absCrossAxisGestureDelta <= absDrawerAxisGestureDelta + 2) return false;
|
|
2028
|
-
touchState.preserveNativeCrossAxisScroll = true;
|
|
2029
|
-
return true;
|
|
2030
|
-
}
|
|
2031
|
-
function hasScrollableContentOnAxis(scrollTarget, axis) {
|
|
2032
|
-
return axis === "vertical" ? scrollTarget.scrollHeight > scrollTarget.clientHeight : scrollTarget.scrollWidth > scrollTarget.clientWidth;
|
|
2033
|
-
}
|
|
2034
|
-
function getScrollMetrics(scrollTarget, axis) {
|
|
2035
|
-
if (axis === "vertical") {
|
|
2036
|
-
const max = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight);
|
|
2037
|
-
return {
|
|
2038
|
-
offset: scrollTarget.scrollTop,
|
|
2039
|
-
max
|
|
2040
|
-
};
|
|
2041
|
-
}
|
|
2042
|
-
const max = Math.max(0, scrollTarget.scrollWidth - scrollTarget.clientWidth);
|
|
2043
|
-
return {
|
|
2044
|
-
offset: scrollTarget.scrollLeft,
|
|
2045
|
-
max
|
|
2046
|
-
};
|
|
2047
|
-
}
|
|
2048
|
-
function isAtSwipeStartEdge(scrollTarget, axis, direction) {
|
|
2049
|
-
const { offset, max } = getScrollMetrics(scrollTarget, axis);
|
|
2050
|
-
const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis);
|
|
2051
|
-
if (dismissFromStartEdge === null) return false;
|
|
2052
|
-
return dismissFromStartEdge ? offset <= 0 : offset >= max;
|
|
2053
|
-
}
|
|
2054
|
-
function canSwipeFromScrollEdgeOnMove(scrollTarget, axis, direction, delta) {
|
|
2055
|
-
const { offset, max } = getScrollMetrics(scrollTarget, axis);
|
|
2056
|
-
const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis);
|
|
2057
|
-
if (dismissFromStartEdge === null) return false;
|
|
2058
|
-
if (!(dismissFromStartEdge ? delta > 0 : delta < 0)) return false;
|
|
2059
|
-
return dismissFromStartEdge ? offset <= 0 : offset >= max;
|
|
2060
|
-
}
|
|
2061
|
-
function shouldDismissFromStartEdge(direction, axis) {
|
|
2062
|
-
if (axis === "vertical") {
|
|
2063
|
-
if (direction === "down") return true;
|
|
2064
|
-
if (direction === "up") return false;
|
|
2065
|
-
return null;
|
|
2066
|
-
}
|
|
2067
|
-
if (direction === "right") return true;
|
|
2068
|
-
if (direction === "left") return false;
|
|
2069
|
-
return null;
|
|
2070
|
-
}
|
|
2071
|
-
//#endregion
|
|
2072
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/viewport/DrawerViewportCssVars.mjs
|
|
2073
|
-
let DrawerViewportCssVars = /*#__PURE__*/ function(DrawerViewportCssVars) {
|
|
2074
|
-
/**
|
|
2075
|
-
* The software keyboard inset, measured from the bottom edge of the layout viewport.
|
|
2076
|
-
* Present only when the drawer is wrapped in `Drawer.VirtualKeyboardProvider`.
|
|
2077
|
-
* @type {CSS length}
|
|
2078
|
-
*/
|
|
2079
|
-
DrawerViewportCssVars["keyboardInset"] = "--drawer-keyboard-inset";
|
|
2080
|
-
return DrawerViewportCssVars;
|
|
2081
|
-
}({});
|
|
2082
|
-
//#endregion
|
|
2083
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/virtual-keyboard-provider/DrawerVirtualKeyboardProvider.mjs
|
|
2084
|
-
const KEYBOARD_RESIZE_THRESHOLD = 60;
|
|
2085
|
-
const KEYBOARD_VISIBILITY_MARGIN = 16;
|
|
2086
|
-
const KEYBOARD_SCROLL_SLACK = 48;
|
|
2087
|
-
const INPUT_TAP_MOVE_THRESHOLD = 10;
|
|
2088
|
-
const INPUT_TAP_HIT_SLOP = 16;
|
|
2089
|
-
const KEYBOARD_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
2090
|
-
"email",
|
|
2091
|
-
"number",
|
|
2092
|
-
"password",
|
|
2093
|
-
"search",
|
|
2094
|
-
"tel",
|
|
2095
|
-
"text",
|
|
2096
|
-
"url"
|
|
2097
|
-
]);
|
|
2098
|
-
const KEYBOARD_TAP_BLOCKED = Symbol("KeyboardTapBlocked");
|
|
2099
|
-
/**
|
|
2100
|
-
* Provides keyboard-aware focus and scroll handling for bottom-sheet drawers with form fields.
|
|
2101
|
-
*
|
|
2102
|
-
* Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
|
|
2103
|
-
*/
|
|
2104
|
-
function DrawerVirtualKeyboardProvider(props) {
|
|
2105
|
-
const { children } = props;
|
|
2106
|
-
const { store } = useDialogRootContext();
|
|
2107
|
-
const open = store.useState("open");
|
|
2108
|
-
const mounted = store.useState("mounted");
|
|
2109
|
-
const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
|
|
2110
|
-
const rootElement = store.useState("viewportElement");
|
|
2111
|
-
const nestedDrawerOpen = nestedOpenDialogCount > 0;
|
|
2112
|
-
const pendingKeyboardFocusMovedRef = React$1.useRef(false);
|
|
2113
|
-
const keyboardTouchStartRef = React$1.useRef(null);
|
|
2114
|
-
const focusedKeyboardTargetRef = React$1.useRef(null);
|
|
2115
|
-
const keyboardScrollAdjustmentRef = React$1.useRef(null);
|
|
2116
|
-
const keyboardFocusFrame = useAnimationFrame();
|
|
2117
|
-
const restoreKeyboardScrollAdjustment = useStableCallback(() => {
|
|
2118
|
-
const adjustment = keyboardScrollAdjustmentRef.current;
|
|
2119
|
-
if (!adjustment) return;
|
|
2120
|
-
adjustment.element.style.overflowAnchor = adjustment.overflowAnchor;
|
|
2121
|
-
adjustment.element.style.paddingBottom = adjustment.paddingBottom;
|
|
2122
|
-
adjustment.element.style.scrollPaddingBottom = adjustment.scrollPaddingBottom;
|
|
2123
|
-
keyboardScrollAdjustmentRef.current = null;
|
|
2124
|
-
});
|
|
2125
|
-
const setKeyboardScrollSlack = useStableCallback((element, slack) => {
|
|
2126
|
-
const roundedSlack = Math.max(0, Math.ceil(slack));
|
|
2127
|
-
let adjustment = keyboardScrollAdjustmentRef.current;
|
|
2128
|
-
if (adjustment && !adjustment.element.isConnected) {
|
|
2129
|
-
restoreKeyboardScrollAdjustment();
|
|
2130
|
-
adjustment = null;
|
|
2131
|
-
}
|
|
2132
|
-
if (roundedSlack === 0) {
|
|
2133
|
-
restoreKeyboardScrollAdjustment();
|
|
2134
|
-
return;
|
|
2135
|
-
}
|
|
2136
|
-
if (adjustment && adjustment.element !== element) {
|
|
2137
|
-
restoreKeyboardScrollAdjustment();
|
|
2138
|
-
adjustment = null;
|
|
2139
|
-
}
|
|
2140
|
-
if (!adjustment) {
|
|
2141
|
-
const styles = getComputedStyle$1(element);
|
|
2142
|
-
adjustment = {
|
|
2143
|
-
element,
|
|
2144
|
-
overflowAnchor: element.style.overflowAnchor,
|
|
2145
|
-
paddingBottom: element.style.paddingBottom,
|
|
2146
|
-
scrollPaddingBottom: element.style.scrollPaddingBottom,
|
|
2147
|
-
computedPaddingBottom: Number.parseFloat(styles.paddingBottom) || 0,
|
|
2148
|
-
computedScrollPaddingBottom: Number.parseFloat(styles.scrollPaddingBottom) || 0
|
|
2149
|
-
};
|
|
2150
|
-
keyboardScrollAdjustmentRef.current = adjustment;
|
|
2151
|
-
}
|
|
2152
|
-
element.style.overflowAnchor = "none";
|
|
2153
|
-
element.style.paddingBottom = `${adjustment.computedPaddingBottom + roundedSlack}px`;
|
|
2154
|
-
element.style.scrollPaddingBottom = `${adjustment.computedScrollPaddingBottom + KEYBOARD_VISIBILITY_MARGIN}px`;
|
|
2155
|
-
});
|
|
2156
|
-
const animateKeyboardScroll = useStableCallback((element, scrollTop) => {
|
|
2157
|
-
const behavior = getWindow(element).matchMedia?.("(prefers-reduced-motion: reduce)")?.matches ? "auto" : "smooth";
|
|
2158
|
-
element.scrollTo({
|
|
2159
|
-
top: scrollTop,
|
|
2160
|
-
behavior
|
|
2161
|
-
});
|
|
2162
|
-
});
|
|
2163
|
-
const resetTouchTrackingState = useStableCallback(() => {
|
|
2164
|
-
pendingKeyboardFocusMovedRef.current = false;
|
|
2165
|
-
keyboardTouchStartRef.current = null;
|
|
2166
|
-
});
|
|
2167
|
-
React$1.useEffect(() => {
|
|
2168
|
-
if (!mounted || !open) {
|
|
2169
|
-
focusedKeyboardTargetRef.current = null;
|
|
2170
|
-
restoreKeyboardScrollAdjustment();
|
|
2171
|
-
keyboardFocusFrame.cancel();
|
|
2172
|
-
return;
|
|
2173
|
-
}
|
|
2174
|
-
if (!rootElement) {
|
|
2175
|
-
restoreKeyboardScrollAdjustment();
|
|
2176
|
-
return;
|
|
2177
|
-
}
|
|
2178
|
-
const doc = ownerDocument(rootElement);
|
|
2179
|
-
const win = getWindow(rootElement);
|
|
2180
|
-
const visualViewport = win.visualViewport;
|
|
2181
|
-
const setDrawerKeyboardInset = (inset) => {
|
|
2182
|
-
rootElement.style.setProperty(DrawerViewportCssVars.keyboardInset, `${Math.max(0, Math.ceil(inset))}px`);
|
|
2183
|
-
};
|
|
2184
|
-
const resetDrawerKeyboardInset = () => {
|
|
2185
|
-
setDrawerKeyboardInset(0);
|
|
2186
|
-
};
|
|
2187
|
-
const clearFocusedKeyboardTarget = () => {
|
|
2188
|
-
focusedKeyboardTargetRef.current = null;
|
|
2189
|
-
resetDrawerKeyboardInset();
|
|
2190
|
-
restoreKeyboardScrollAdjustment();
|
|
2191
|
-
keyboardFocusFrame.cancel();
|
|
2192
|
-
};
|
|
2193
|
-
const alignFocusedKeyboardTarget = () => {
|
|
2194
|
-
const target = focusedKeyboardTargetRef.current;
|
|
2195
|
-
if (nestedDrawerOpen || !target || !contains(rootElement, target)) {
|
|
2196
|
-
resetDrawerKeyboardInset();
|
|
2197
|
-
restoreKeyboardScrollAdjustment();
|
|
2198
|
-
return;
|
|
2199
|
-
}
|
|
2200
|
-
const keyboardViewport = getKeyboardVisualViewport(win);
|
|
2201
|
-
if (!keyboardViewport) {
|
|
2202
|
-
resetDrawerKeyboardInset();
|
|
2203
|
-
restoreKeyboardScrollAdjustment();
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
|
-
setDrawerKeyboardInset(getDrawerKeyboardInset(win, keyboardViewport));
|
|
2207
|
-
const scrollTarget = findKeyboardScrollTarget(target, rootElement);
|
|
2208
|
-
if (!scrollTarget) {
|
|
2209
|
-
restoreKeyboardScrollAdjustment();
|
|
2210
|
-
return;
|
|
2211
|
-
}
|
|
2212
|
-
if (!scrollTarget.isConnected || !contains(rootElement, scrollTarget)) {
|
|
2213
|
-
resetDrawerKeyboardInset();
|
|
2214
|
-
restoreKeyboardScrollAdjustment();
|
|
2215
|
-
return;
|
|
2216
|
-
}
|
|
2217
|
-
const scrollTargetRect = scrollTarget.getBoundingClientRect();
|
|
2218
|
-
const clippedBottom = Math.min(scrollTargetRect.bottom, keyboardViewport.bottom);
|
|
2219
|
-
const overlap = Math.max(0, scrollTargetRect.bottom - keyboardViewport.bottom);
|
|
2220
|
-
setKeyboardScrollSlack(scrollTarget, overlap > 0 ? overlap + KEYBOARD_SCROLL_SLACK : 0);
|
|
2221
|
-
const maxScrollTop = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight);
|
|
2222
|
-
if (maxScrollTop <= 0) return;
|
|
2223
|
-
const visibleTop = Math.max(scrollTargetRect.top, keyboardViewport.top) + KEYBOARD_VISIBILITY_MARGIN;
|
|
2224
|
-
const visibleBottom = clippedBottom - KEYBOARD_VISIBILITY_MARGIN;
|
|
2225
|
-
if (visibleBottom <= visibleTop) return;
|
|
2226
|
-
const targetRect = target.getBoundingClientRect();
|
|
2227
|
-
const targetCenter = (targetRect.top + targetRect.bottom) / 2;
|
|
2228
|
-
const visibleCenter = (visibleTop + visibleBottom) / 2;
|
|
2229
|
-
const nextScrollTop = scrollTarget.scrollTop + targetCenter - visibleCenter;
|
|
2230
|
-
animateKeyboardScroll(scrollTarget, clamp(nextScrollTop, 0, maxScrollTop));
|
|
2231
|
-
};
|
|
2232
|
-
const scheduleKeyboardFocusAlignment = () => {
|
|
2233
|
-
keyboardFocusFrame.request(alignFocusedKeyboardTarget);
|
|
2234
|
-
};
|
|
2235
|
-
const captureFocusedKeyboardTarget = (eventTarget) => {
|
|
2236
|
-
if (nestedDrawerOpen) return false;
|
|
2237
|
-
const target = resolveKeyboardInputTarget(eventTarget);
|
|
2238
|
-
if (!target || !contains(rootElement, target)) return false;
|
|
2239
|
-
focusedKeyboardTargetRef.current = target;
|
|
2240
|
-
return true;
|
|
2241
|
-
};
|
|
2242
|
-
const handleFocusIn = (event) => {
|
|
2243
|
-
if (captureFocusedKeyboardTarget(getTarget(event))) scheduleKeyboardFocusAlignment();
|
|
2244
|
-
};
|
|
2245
|
-
const handleFocusOut = (event) => {
|
|
2246
|
-
if (captureFocusedKeyboardTarget(event.relatedTarget)) {
|
|
2247
|
-
scheduleKeyboardFocusAlignment();
|
|
2248
|
-
return;
|
|
2249
|
-
}
|
|
2250
|
-
clearFocusedKeyboardTarget();
|
|
2251
|
-
};
|
|
2252
|
-
const handleViewportUpdate = () => {
|
|
2253
|
-
if (focusedKeyboardTargetRef.current || captureFocusedKeyboardTarget(activeElement(doc))) scheduleKeyboardFocusAlignment();
|
|
2254
|
-
};
|
|
2255
|
-
const cleanupListeners = [];
|
|
2256
|
-
if (visualViewport) cleanupListeners.push(addEventListener(visualViewport, "resize", handleViewportUpdate), addEventListener(visualViewport, "scroll", handleViewportUpdate));
|
|
2257
|
-
cleanupListeners.push(addEventListener(doc, "focusin", handleFocusIn, true), addEventListener(doc, "focusout", handleFocusOut, true));
|
|
2258
|
-
if (captureFocusedKeyboardTarget(activeElement(doc))) scheduleKeyboardFocusAlignment();
|
|
2259
|
-
return () => {
|
|
2260
|
-
cleanupListeners.forEach((cleanup) => cleanup());
|
|
2261
|
-
clearFocusedKeyboardTarget();
|
|
2262
|
-
rootElement.style.removeProperty(DrawerViewportCssVars.keyboardInset);
|
|
2263
|
-
};
|
|
2264
|
-
}, [
|
|
2265
|
-
animateKeyboardScroll,
|
|
2266
|
-
keyboardFocusFrame,
|
|
2267
|
-
mounted,
|
|
2268
|
-
nestedDrawerOpen,
|
|
2269
|
-
open,
|
|
2270
|
-
restoreKeyboardScrollAdjustment,
|
|
2271
|
-
rootElement,
|
|
2272
|
-
setKeyboardScrollSlack
|
|
2273
|
-
]);
|
|
2274
|
-
const onTouchStart = useStableCallback((event) => {
|
|
2275
|
-
if (!open || !mounted || nestedDrawerOpen) {
|
|
2276
|
-
resetTouchTrackingState();
|
|
2277
|
-
return;
|
|
2278
|
-
}
|
|
2279
|
-
const touch = event.touches[0];
|
|
2280
|
-
if (!touch) return;
|
|
2281
|
-
pendingKeyboardFocusMovedRef.current = false;
|
|
2282
|
-
keyboardTouchStartRef.current = {
|
|
2283
|
-
x: touch.clientX,
|
|
2284
|
-
y: touch.clientY
|
|
2285
|
-
};
|
|
2286
|
-
});
|
|
2287
|
-
const onTouchMove = useStableCallback((event) => {
|
|
2288
|
-
const touch = event.touches[0];
|
|
2289
|
-
const touchStart = keyboardTouchStartRef.current;
|
|
2290
|
-
if (!touch || !touchStart || pendingKeyboardFocusMovedRef.current) return;
|
|
2291
|
-
if (Math.abs(touch.clientX - touchStart.x) > INPUT_TAP_MOVE_THRESHOLD || Math.abs(touch.clientY - touchStart.y) > INPUT_TAP_MOVE_THRESHOLD) pendingKeyboardFocusMovedRef.current = true;
|
|
2292
|
-
});
|
|
2293
|
-
const onTouchEnd = useStableCallback((event) => {
|
|
2294
|
-
if (!open || !mounted || nestedDrawerOpen || !rootElement || !keyboardTouchStartRef.current || pendingKeyboardFocusMovedRef.current) {
|
|
2295
|
-
resetTouchTrackingState();
|
|
2296
|
-
return;
|
|
2297
|
-
}
|
|
2298
|
-
const touch = event.changedTouches[0] ?? event.touches[0];
|
|
2299
|
-
const doc = ownerDocument(event.currentTarget);
|
|
2300
|
-
const nativeEventTarget = getTarget(event.nativeEvent);
|
|
2301
|
-
const pointTarget = touch ? resolveKeyboardTouchTargetFromPoint(doc, touch.clientX, touch.clientY) : null;
|
|
2302
|
-
if (pointTarget === KEYBOARD_TAP_BLOCKED) {
|
|
2303
|
-
resetTouchTrackingState();
|
|
2304
|
-
return;
|
|
2305
|
-
}
|
|
2306
|
-
const keyboardTarget = touch && (pointTarget ?? resolveKeyboardTouchTarget(nativeEventTarget));
|
|
2307
|
-
if (keyboardTarget && (!contains(rootElement, keyboardTarget.focusTarget) || !contains(rootElement, keyboardTarget.clickTarget))) {
|
|
2308
|
-
resetTouchTrackingState();
|
|
2309
|
-
return;
|
|
2310
|
-
}
|
|
2311
|
-
if (keyboardTarget) {
|
|
2312
|
-
const { clickTarget: keyboardClickTarget, focusTarget: keyboardFocusTarget } = keyboardTarget;
|
|
2313
|
-
const win = getWindow(keyboardFocusTarget);
|
|
2314
|
-
if (win.visualViewport && win.visualViewport.scale !== 1) {
|
|
2315
|
-
resetTouchTrackingState();
|
|
2316
|
-
return;
|
|
2317
|
-
}
|
|
2318
|
-
if (activeElement(ownerDocument(keyboardFocusTarget)) === keyboardFocusTarget && isKeyboardVisualViewportOpen(win)) {
|
|
2319
|
-
resetTouchTrackingState();
|
|
2320
|
-
return;
|
|
2321
|
-
}
|
|
2322
|
-
event.preventDefault();
|
|
2323
|
-
focusKeyboardInputWithoutPageScroll(keyboardFocusTarget);
|
|
2324
|
-
dispatchKeyboardClick(keyboardClickTarget, touch);
|
|
2325
|
-
resetTouchTrackingState();
|
|
2326
|
-
return;
|
|
2327
|
-
}
|
|
2328
|
-
resetTouchTrackingState();
|
|
2329
|
-
});
|
|
2330
|
-
const contextValue = React$1.useMemo(() => ({
|
|
2331
|
-
onTouchStart,
|
|
2332
|
-
onTouchMove,
|
|
2333
|
-
onTouchEnd,
|
|
2334
|
-
onTouchCancel: resetTouchTrackingState
|
|
2335
|
-
}), [
|
|
2336
|
-
onTouchEnd,
|
|
2337
|
-
onTouchMove,
|
|
2338
|
-
onTouchStart,
|
|
2339
|
-
resetTouchTrackingState
|
|
2340
|
-
]);
|
|
2341
|
-
return /*#__PURE__*/ jsx(DrawerVirtualKeyboardContext.Provider, {
|
|
2342
|
-
value: contextValue,
|
|
2343
|
-
children
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
function isKeyboardInputElement(element) {
|
|
2347
|
-
if (element.isContentEditable) return true;
|
|
2348
|
-
const win = getWindow(element);
|
|
2349
|
-
if (element instanceof win.HTMLTextAreaElement || element instanceof win.HTMLInputElement && KEYBOARD_INPUT_TYPES.has(element.type)) return !element.matches(":disabled");
|
|
2350
|
-
return false;
|
|
2351
|
-
}
|
|
2352
|
-
function resolveKeyboardInputTarget(target) {
|
|
2353
|
-
if (!isHTMLElement(target)) return null;
|
|
2354
|
-
if (isKeyboardInputElement(target)) return target.isContentEditable ? getContentEditableHost(target) : target;
|
|
2355
|
-
const control = target.closest("label")?.control ?? null;
|
|
2356
|
-
return isHTMLElement(control) && isKeyboardInputElement(control) ? control : null;
|
|
2357
|
-
}
|
|
2358
|
-
function resolveKeyboardTouchTarget(target) {
|
|
2359
|
-
const focusTarget = resolveKeyboardInputTarget(target);
|
|
2360
|
-
if (!focusTarget) return null;
|
|
2361
|
-
return {
|
|
2362
|
-
focusTarget,
|
|
2363
|
-
clickTarget: isHTMLElement(target) ? target : focusTarget
|
|
2364
|
-
};
|
|
2365
|
-
}
|
|
2366
|
-
function getContentEditableHost(element) {
|
|
2367
|
-
let host = element;
|
|
2368
|
-
while (host.parentElement?.isContentEditable) host = host.parentElement;
|
|
2369
|
-
return host;
|
|
2370
|
-
}
|
|
2371
|
-
function resolveKeyboardTouchTargetFromPoint(doc, clientX, clientY) {
|
|
2372
|
-
const exactTarget = getElementAtPoint(doc, clientX, clientY);
|
|
2373
|
-
const exactKeyboardTarget = resolveKeyboardInputTarget(exactTarget);
|
|
2374
|
-
if (exactKeyboardTarget) return {
|
|
2375
|
-
focusTarget: exactKeyboardTarget,
|
|
2376
|
-
clickTarget: isHTMLElement(exactTarget) ? exactTarget : exactKeyboardTarget
|
|
2377
|
-
};
|
|
2378
|
-
if (isInteractiveElement(exactTarget) || exactTarget?.closest("label") != null) return KEYBOARD_TAP_BLOCKED;
|
|
2379
|
-
for (const [offsetX, offsetY] of [
|
|
2380
|
-
[0, INPUT_TAP_HIT_SLOP],
|
|
2381
|
-
[0, -16],
|
|
2382
|
-
[INPUT_TAP_HIT_SLOP, 0],
|
|
2383
|
-
[-16, 0]
|
|
2384
|
-
]) {
|
|
2385
|
-
const keyboardTarget = resolveKeyboardInputTarget(getElementAtPoint(doc, clientX + offsetX, clientY + offsetY));
|
|
2386
|
-
if (keyboardTarget) return {
|
|
2387
|
-
focusTarget: keyboardTarget,
|
|
2388
|
-
clickTarget: keyboardTarget
|
|
2389
|
-
};
|
|
2390
|
-
}
|
|
2391
|
-
return null;
|
|
2392
|
-
}
|
|
2393
|
-
function dispatchKeyboardClick(target, touch) {
|
|
2394
|
-
const win = getWindow(target);
|
|
2395
|
-
const ClickEvent = win.PointerEvent ?? win.MouseEvent;
|
|
2396
|
-
target.dispatchEvent(new ClickEvent("click", {
|
|
2397
|
-
bubbles: true,
|
|
2398
|
-
cancelable: true,
|
|
2399
|
-
clientX: touch.clientX,
|
|
2400
|
-
clientY: touch.clientY,
|
|
2401
|
-
detail: 1,
|
|
2402
|
-
view: win
|
|
2403
|
-
}));
|
|
2404
|
-
}
|
|
2405
|
-
function focusKeyboardInputWithoutPageScroll(target) {
|
|
2406
|
-
const wasFocused = activeElement(ownerDocument(target)) === target;
|
|
2407
|
-
const previousOpacity = target.style.opacity;
|
|
2408
|
-
const previousTransform = target.style.transform;
|
|
2409
|
-
const previousTransition = target.style.transition;
|
|
2410
|
-
target.style.transition = "none";
|
|
2411
|
-
target.style.opacity = "0";
|
|
2412
|
-
target.style.transform = "translateY(-2000px)";
|
|
2413
|
-
try {
|
|
2414
|
-
if (wasFocused) target.blur();
|
|
2415
|
-
target.focus({ preventScroll: true });
|
|
2416
|
-
} finally {
|
|
2417
|
-
target.style.opacity = previousOpacity;
|
|
2418
|
-
target.style.transform = previousTransform;
|
|
2419
|
-
target.style.transition = previousTransition;
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
function findKeyboardScrollTarget(target, root) {
|
|
2423
|
-
const scrollStart = getParentNode(target);
|
|
2424
|
-
return findScrollableTouchTarget(scrollStart, root, "vertical") ?? findScrollableTouchTarget(scrollStart, root, "vertical", true);
|
|
2425
|
-
}
|
|
2426
|
-
function getKeyboardVisualViewport(win) {
|
|
2427
|
-
const visualViewport = win.visualViewport;
|
|
2428
|
-
if (!visualViewport || visualViewport.scale !== 1) return null;
|
|
2429
|
-
if (win.innerHeight - visualViewport.height <= KEYBOARD_RESIZE_THRESHOLD) return null;
|
|
2430
|
-
const top = Math.max(0, visualViewport.offsetTop);
|
|
2431
|
-
return {
|
|
2432
|
-
top,
|
|
2433
|
-
bottom: Math.min(win.innerHeight, top + visualViewport.height)
|
|
2434
|
-
};
|
|
2435
|
-
}
|
|
2436
|
-
function getDrawerKeyboardInset(win, keyboardViewport) {
|
|
2437
|
-
return Math.max(0, win.innerHeight - keyboardViewport.bottom);
|
|
2438
|
-
}
|
|
2439
|
-
function isKeyboardVisualViewportOpen(win) {
|
|
2440
|
-
return !win.visualViewport || getKeyboardVisualViewport(win) != null;
|
|
2441
|
-
}
|
|
2442
|
-
//#endregion
|
|
2443
|
-
//#region ../../node_modules/.pnpm/@base-ui+react@1.6.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/drawer/index.parts.mjs
|
|
2444
|
-
var index_parts_exports = /* @__PURE__ */ __exportAll({
|
|
2445
|
-
Backdrop: () => DrawerBackdrop,
|
|
2446
|
-
Close: () => DrawerClose,
|
|
2447
|
-
Content: () => DrawerContent,
|
|
2448
|
-
Description: () => DrawerDescription,
|
|
2449
|
-
Handle: () => DialogHandle,
|
|
2450
|
-
Indent: () => DrawerIndent,
|
|
2451
|
-
IndentBackground: () => DrawerIndentBackground,
|
|
2452
|
-
Popup: () => DrawerPopup,
|
|
2453
|
-
Portal: () => DrawerPortal,
|
|
2454
|
-
Provider: () => DrawerProvider,
|
|
2455
|
-
Root: () => DrawerRoot,
|
|
2456
|
-
SwipeArea: () => DrawerSwipeArea,
|
|
2457
|
-
Title: () => DrawerTitle,
|
|
2458
|
-
Trigger: () => DrawerTrigger,
|
|
2459
|
-
Viewport: () => DrawerViewport,
|
|
2460
|
-
VirtualKeyboardProvider: () => DrawerVirtualKeyboardProvider,
|
|
2461
|
-
createHandle: () => createDialogHandle
|
|
2462
|
-
});
|
|
2463
|
-
//#endregion
|
|
2464
|
-
export { index_parts_exports as t };
|