@jfrader/ui 0.5.1 → 0.7.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/README.md +28 -7
- package/dist/{accordion-DLul6vIl.js → accordion-D6myONB9.js} +36 -35
- package/dist/accordion.js +1 -1
- package/dist/activity-rings-Uszvwqdl.js +528 -0
- package/dist/activity-rings.js +2 -0
- package/dist/{alert-DS_einpy.js → alert-Bhj-qSMs.js} +15 -14
- package/dist/alert.js +1 -1
- package/dist/{announcement-bar-Dlbq5-9D.js → announcement-bar-B5J33QUh.js} +132 -131
- package/dist/announcement-bar.js +1 -1
- package/dist/{avatar-group-M1opAQEG.js → avatar-group-BlMLNw4J.js} +10 -9
- package/dist/avatar-group.js +1 -1
- package/dist/avatar-sPxDqFiZ.js +133 -0
- package/dist/avatar.js +1 -1
- package/dist/{badge-CjM5Agqk.js → badge-CfhTcA-Z.js} +10 -9
- package/dist/badge.js +1 -1
- package/dist/billing-toggle-CgC7yxxo.js +349 -0
- package/dist/billing-toggle.js +2 -0
- package/dist/{bottom-sheet-DjZOPq4k.js → bottom-sheet-BFQKO0Wo.js} +282 -264
- package/dist/bottom-sheet.js +1 -1
- package/dist/{breadcrumbs-BDK_LiwH.js → breadcrumbs-CG3akw-b.js} +19 -18
- package/dist/breadcrumbs.js +1 -1
- package/dist/{button-NLY0h6EJ.js → button-C6OV0C7J.js} +14 -13
- package/dist/button-group-B9wP2ddS.js +611 -0
- package/dist/button-group.js +2 -0
- package/dist/button.js +1 -1
- package/dist/calendar-Bg6D2sul.js +377 -0
- package/dist/calendar.js +1 -1
- package/dist/calendar.utils-azmB4Ej7.js +79 -0
- package/dist/card-C008OQCp.js +164 -0
- package/dist/card.js +1 -1
- package/dist/{carousel-B7OrvD6J.js → carousel-lTH4Foke.js} +13 -12
- package/dist/carousel.js +1 -1
- package/dist/chat-thread-DkB-WMWJ.js +864 -0
- package/dist/chat-thread.js +2 -0
- package/dist/{checkbox-DKSzExj2.js → checkbox-CClE61GV.js} +9 -8
- package/dist/checkbox.js +1 -1
- package/dist/{chip-group-DjQ0_6Y9.js → chip-group-BZUX9KPF.js} +17 -16
- package/dist/chip-group.js +1 -1
- package/dist/{choice-control-5kJkLXgv.js → choice-control-BsWOZPc9.js} +1 -1
- package/dist/{code-block-B5we2lZa.js → code-block-CYP89_6h.js} +35 -34
- package/dist/code-block.js +1 -1
- package/dist/{combobox-DFFqOBCi.js → combobox-D2Oc-co7.js} +21 -20
- package/dist/combobox.js +1 -1
- package/dist/command-palette-BrT1n9bb.js +394 -0
- package/dist/command-palette.js +1 -1
- package/dist/comment-thread-DXfqgRNI.js +772 -0
- package/dist/comment-thread.js +1 -1
- package/dist/{container-BOaSptJa.js → container-BxtwJSSD.js} +3 -2
- package/dist/container.js +1 -1
- package/dist/{context-menu-__1c2Dk9.js → context-menu-I4i0LRpm.js} +52 -51
- package/dist/context-menu.js +1 -1
- package/dist/{copy-button-DCSLcYS-.js → copy-button-C0p_qrgf.js} +4 -4
- package/dist/copy-button.js +1 -1
- package/dist/{countdown-Dp_TD1VP.js → countdown-EcpV6rXy.js} +18 -17
- package/dist/countdown.js +1 -1
- package/dist/css-BYJhdGh-.js +2 -0
- package/dist/{date-picker-BiPN7yeK.js → date-picker-D-bn-iHs.js} +14 -13
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker-rXcZsI1Y.js +589 -0
- package/dist/date-range-picker.js +1 -1
- package/dist/dialog-CR1xdkrC.js +222 -0
- package/dist/dialog.js +1 -1
- package/dist/{divider-Cp7aNbhM.js → divider-zOJzkcHh.js} +7 -6
- package/dist/divider.js +1 -1
- package/dist/drawer-CceaEhCr.js +590 -0
- package/dist/drawer.js +1 -1
- package/dist/emblem-DnXmpZCh.js +166 -0
- package/dist/emblem.js +2 -0
- package/dist/{empty-state-CDgrjPPf.js → empty-state-DO0ApylK.js} +2 -1
- package/dist/empty-state.js +1 -1
- package/dist/{expandable-card-rUATve0o.js → expandable-card-W97vjix9.js} +52 -51
- package/dist/expandable-card.js +1 -1
- package/dist/{expanding-search-BxOwtdwt.js → expanding-search-Bb2_YfNx.js} +16 -15
- package/dist/expanding-search.js +1 -1
- package/dist/{field-anatomy-COVdNpf5.js → field-anatomy-BDIP42MI.js} +2 -1
- package/dist/{file-dropzone-BuXm3Tea.js → file-dropzone-Bi5ikRIz.js} +14 -13
- package/dist/file-dropzone.js +1 -1
- package/dist/{filter-toolbar-Cy5Hqur-.js → filter-toolbar-QRnC4S_H.js} +33 -32
- package/dist/filter-toolbar.js +1 -1
- package/dist/{flex-Dh-_J5-U.js → flex-CS7eMRcK.js} +2 -2
- package/dist/flex.js +1 -1
- package/dist/game-card-Oeu74giK.js +194 -0
- package/dist/game-card.js +2 -0
- package/dist/{hold-to-confirm-DjB2EVjM.js → hold-to-confirm-CVBA0wNT.js} +18 -17
- package/dist/hold-to-confirm.js +1 -1
- package/dist/{hover-card-CoMJKg1g.js → hover-card-Dgu2CwMD.js} +20 -19
- package/dist/hover-card.js +1 -1
- package/dist/{icon-wrapper-stN8sD7R.js → icon-wrapper-C-zMD0uL.js} +1 -1
- package/dist/{image-compare-BxY8Ykzt.js → image-compare-Ln2UUqTU.js} +20 -19
- package/dist/image-compare.js +1 -1
- package/dist/in-view-title-BUZCMqge.js +225 -0
- package/dist/in-view-title.js +2 -0
- package/dist/index.js +102 -83
- package/dist/initials-DEdwNe9_.js +18 -0
- package/dist/{inline-edit-C0eeml65.js → inline-edit-D-pR2RPC.js} +22 -21
- package/dist/inline-edit.js +1 -1
- package/dist/{input-control-DmMuAuPS.js → input-control-B6HVBgwl.js} +1 -1
- package/dist/{json-viewer-DgWqyU75.js → json-viewer-Dro3WrjS.js} +31 -30
- package/dist/json-viewer.js +1 -1
- package/dist/{kbd-C3ACoMoE.js → kbd-BI_9qzYr.js} +2 -1
- package/dist/kbd.js +1 -1
- package/dist/keycap-keyboard-Cdx-OAS1.js +311 -0
- package/dist/keycap-keyboard.js +2 -0
- package/dist/{layout-style-Cbd1Vilw.js → layout-style-BE0gSqrH.js} +1 -1
- package/dist/lightbox-gallery-D0YaSTut.js +777 -0
- package/dist/lightbox-gallery.js +2 -0
- package/dist/link-unfurl-CReyIjyy.js +695 -0
- package/dist/link-unfurl.js +2 -0
- package/dist/{listbox-style-WX-RASp1.js → listbox-style-DNOxAulu.js} +1 -1
- package/dist/{loading-ring-B8-30Dl1.js → loading-ring-D0lGrK8z.js} +1 -1
- package/dist/locale-switcher-DTkySKsM.js +375 -0
- package/dist/locale-switcher.js +2 -0
- package/dist/{mention-input-sq61si9L.js → mention-input-BjjAbJCf.js} +6 -6
- package/dist/mention-input.js +1 -1
- package/dist/{menu-DDKgmK2F.js → menu-CVzpsyXn.js} +113 -96
- package/dist/menu.js +1 -1
- package/dist/{metric-card--lVTz5Wn.js → metric-card-BnFssTXj.js} +12 -11
- package/dist/metric-card.js +1 -1
- package/dist/{multi-select-DG1BCFX7.js → multi-select-B3puEVo0.js} +67 -66
- package/dist/multi-select.js +1 -1
- package/dist/{navigation-CC26JDr-.js → navigation-C_JD43gA.js} +41 -40
- package/dist/navigation.js +1 -1
- package/dist/next.js +65 -0
- package/dist/now-playing-DjVm1Phm.js +439 -0
- package/dist/now-playing.js +2 -0
- package/dist/overlay-motion-Cr77ihn2.js +90 -0
- package/dist/{overlay-portal-C4JZFq2M.js → overlay-portal-C9igMHnC.js} +1 -1
- package/dist/{pagination-BfkeWbmP.js → pagination-Dkh4bJQh.js} +10 -9
- package/dist/pagination.js +1 -1
- package/dist/{password-field-03pWRkuY.js → password-field-Da58GP1g.js} +4 -4
- package/dist/password-field.js +1 -1
- package/dist/photo-grid-Dtl17D74.js +830 -0
- package/dist/photo-grid.js +2 -0
- package/dist/{pill-BaS-uIbn.js → pill-Dd7pog19.js} +10 -9
- package/dist/pill.js +1 -1
- package/dist/{popover-CErIw2q3.js → popover-CUMOcMtj.js} +5 -4
- package/dist/popover.js +1 -1
- package/dist/presence-spring-4zwtUDQN.js +12 -0
- package/dist/{progress-DAQkfhPd.js → progress-Bcuz3Ob4.js} +11 -10
- package/dist/progress.js +1 -1
- package/dist/{radio-cards-Cu9cBssN.js → radio-cards-FkAhESb5.js} +35 -34
- package/dist/radio-cards.js +1 -1
- package/dist/{radio-group-TIK0-iPX.js → radio-group-DItMf2YM.js} +18 -17
- package/dist/radio-group.js +1 -1
- package/dist/{resizable-panels-DUpQEpwG.js → resizable-panels-61h9hA3B.js} +13 -12
- package/dist/resizable-panels.js +1 -1
- package/dist/{scroll-area-CcZyiSOQ.js → scroll-area-B8KkCPOM.js} +16 -15
- package/dist/scroll-area.js +1 -1
- package/dist/{search-field-DMvho0KQ.js → search-field-CbsajaZb.js} +93 -92
- package/dist/search-field.js +1 -1
- package/dist/{segmented-control-8ZUGnsZm.js → segmented-control-DCh-4ca-.js} +26 -25
- package/dist/segmented-control.js +1 -1
- package/dist/{select-D5rhJ8gi.js → select-SrcQqZjo.js} +27 -26
- package/dist/select.js +1 -1
- package/dist/sheet-stack-DYX1SGSB.js +820 -0
- package/dist/sheet-stack.js +2 -0
- package/dist/shortcut-recorder-VgTQdjjn.js +688 -0
- package/dist/shortcut-recorder.js +2 -0
- package/dist/{signature-pad-_bTeguN9.js → signature-pad-khL2yhQI.js} +15 -14
- package/dist/signature-pad.js +1 -1
- package/dist/{skeleton-XQQDkCHd.js → skeleton-LJsQsveI.js} +9 -8
- package/dist/skeleton.js +1 -1
- package/dist/slider-DjAnGmlC.js +535 -0
- package/dist/slider.js +1 -1
- package/dist/{sortable-data-table-CYKT_Ng7.js → sortable-data-table-Bpitup_d.js} +29 -28
- package/dist/sortable-data-table.js +1 -1
- package/dist/{spinner-DtxvDPdM.js → spinner-CvzajSg9.js} +11 -10
- package/dist/spinner.js +1 -1
- package/dist/{split-button-BCw4zZom.js → split-button-Bu41f2AY.js} +20 -19
- package/dist/split-button.js +1 -1
- package/dist/{stack-DC3IbtWk.js → stack-Bac4sJeI.js} +2 -2
- package/dist/stack.js +1 -1
- package/dist/{stepper-CruHbXxX.js → stepper-C8Ncavbr.js} +22 -21
- package/dist/stepper.js +1 -1
- package/dist/stretch-refresh-OrnTEj7P.js +349 -0
- package/dist/stretch-refresh.js +2 -0
- package/dist/{surface-DZ4d-2aL.js → surface-C69kwSuk.js} +13 -3
- package/dist/{swipe-actions-CBuJREU1.js → swipe-actions-1H5UOZKE.js} +26 -25
- package/dist/swipe-actions.js +1 -1
- package/dist/{switch-C1WrKrf-.js → switch-79-hkQqg.js} +15 -14
- package/dist/switch.js +1 -1
- package/dist/sx-BJXJ2xJK.js +23 -0
- package/dist/{tabs-XluwRjgg.js → tabs-Bb5-noYE.js} +43 -42
- package/dist/tabs.js +1 -1
- package/dist/{tag-input-DSRCyrX2.js → tag-input-BQaueKEb.js} +5 -5
- package/dist/tag-input.js +1 -1
- package/dist/{text-field-hU72iSVS.js → text-field-D0VP7b4P.js} +3 -3
- package/dist/text-field.js +1 -1
- package/dist/{textarea-3k4Y0QQ3.js → textarea-D1YwEPmn.js} +3 -3
- package/dist/textarea.js +1 -1
- package/dist/theme-provider-BvcY-iJu.js +20 -0
- package/dist/theme-root-BrYVcTzt.js +163 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-DGWy4H0C.js +62 -0
- package/dist/{theme-switch-C505TtU8.js → theme-switch-CP42mVDb.js} +12 -11
- package/dist/theme-switch.js +1 -1
- package/dist/thread-parts-Cpktor6D.js +683 -0
- package/dist/{time-picker-CPlhW0tr.js → time-picker-Tnd-JBLC.js} +16 -15
- package/dist/time-picker.js +1 -1
- package/dist/{timeline-B0uAAVfT.js → timeline-BcF46lG9.js} +22 -21
- package/dist/timeline.js +1 -1
- package/dist/{toast-B7wo3sX1.js → toast-CSAbl5yK.js} +12 -11
- package/dist/{toast-stack-B40VpS4M.js → toast-stack-BCR4Cu7V.js} +10 -9
- package/dist/toast-stack.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/{toggle-group-B2fpFZwV.js → toggle-group-C7ye1v4s.js} +23 -22
- package/dist/toggle-group.js +1 -1
- package/dist/{tooltip-BvgVTCTN.js → tooltip-IajLwdUb.js} +48 -39
- package/dist/tooltip.js +1 -1
- package/dist/{tree-view-j8qLqkb_.js → tree-view-CoW4oJIZ.js} +15 -14
- package/dist/tree-view.js +1 -1
- package/dist/{trigger-style-B1KVC8O1.js → trigger-style-CtOrdPk4.js} +1 -1
- package/dist/types/components/activity-rings/activity-rings.d.ts +113 -0
- package/dist/types/components/activity-rings/index.d.ts +2 -0
- package/dist/types/components/avatar-group/avatar-group.d.ts +3 -3
- package/dist/types/components/billing-toggle/billing-toggle.d.ts +57 -0
- package/dist/types/components/billing-toggle/index.d.ts +2 -0
- package/dist/types/components/button/button.d.ts +7 -7
- package/dist/types/components/button-group/button-group.d.ts +72 -0
- package/dist/types/components/button-group/index.d.ts +2 -0
- package/dist/types/components/card/card.d.ts +7 -1
- package/dist/types/components/chat-thread/chat-thread.d.ts +130 -0
- package/dist/types/components/chat-thread/index.d.ts +2 -0
- package/dist/types/components/chip-group/chip-group.d.ts +2 -2
- package/dist/types/components/combobox/combobox.d.ts +2 -2
- package/dist/types/components/command-palette/command-palette.d.ts +1 -1
- package/dist/types/components/comment-thread/comment-thread.d.ts +7 -7
- package/dist/types/components/copy-button/copy-button.d.ts +6 -6
- package/dist/types/components/countdown/countdown.d.ts +2 -2
- package/dist/types/components/dialog/dialog.d.ts +18 -20
- package/dist/types/components/drawer/drawer.d.ts +7 -1
- package/dist/types/components/emblem/emblem.d.ts +59 -0
- package/dist/types/components/emblem/index.d.ts +2 -0
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/file-dropzone/file-dropzone.d.ts +3 -4
- package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +2 -2
- package/dist/types/components/game-card/card-frame.d.ts +16 -0
- package/dist/types/components/game-card/decks.d.ts +27 -0
- package/dist/types/components/game-card/game-card.d.ts +37 -0
- package/dist/types/components/game-card/index.d.ts +4 -0
- package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +1 -1
- package/dist/types/components/hover-card/hover-card.d.ts +5 -5
- package/dist/types/components/in-view-title/in-view-title.d.ts +23 -0
- package/dist/types/components/in-view-title/index.d.ts +1 -0
- package/dist/types/components/inline-edit/inline-edit.d.ts +6 -6
- package/dist/types/components/json-viewer/json-viewer.d.ts +7 -9
- package/dist/types/components/keycap-keyboard/index.d.ts +2 -0
- package/dist/types/components/keycap-keyboard/keycap-keyboard.d.ts +32 -0
- package/dist/types/components/lightbox-gallery/index.d.ts +2 -0
- package/dist/types/components/lightbox-gallery/lightbox-gallery.d.ts +74 -0
- package/dist/types/components/link-unfurl/index.d.ts +2 -0
- package/dist/types/components/link-unfurl/link-unfurl.d.ts +104 -0
- package/dist/types/components/locale-switcher/index.d.ts +2 -0
- package/dist/types/components/locale-switcher/locale-switcher.d.ts +64 -0
- package/dist/types/components/mention-input/mention-input.d.ts +7 -7
- package/dist/types/components/menu/menu.d.ts +29 -5
- package/dist/types/components/metric-card/metric-card.d.ts +2 -2
- package/dist/types/components/navigation/navigation.d.ts +1 -1
- package/dist/types/components/next/emotion-registry.d.ts +14 -0
- package/dist/types/components/next/index.d.ts +2 -0
- package/dist/types/components/next/registry.d.ts +21 -0
- package/dist/types/components/now-playing/index.d.ts +1 -0
- package/dist/types/components/now-playing/now-playing.d.ts +88 -0
- package/dist/types/components/password-field/password-field.d.ts +1 -1
- package/dist/types/components/photo-grid/index.d.ts +2 -0
- package/dist/types/components/photo-grid/photo-grid.d.ts +82 -0
- package/dist/types/components/progress/progress.d.ts +1 -1
- package/dist/types/components/select/select.d.ts +1 -1
- package/dist/types/components/sheet-stack/index.d.ts +2 -0
- package/dist/types/components/sheet-stack/sheet-stack.d.ts +81 -0
- package/dist/types/components/shortcut-recorder/index.d.ts +2 -0
- package/dist/types/components/shortcut-recorder/shortcut-recorder.d.ts +117 -0
- package/dist/types/components/signature-pad/signature-pad.d.ts +2 -2
- package/dist/types/components/split-button/split-button.d.ts +3 -4
- package/dist/types/components/stretch-refresh/index.d.ts +1 -0
- package/dist/types/components/stretch-refresh/stretch-refresh.d.ts +49 -0
- package/dist/types/components/swipe-actions/swipe-actions.d.ts +1 -2
- package/dist/types/components/tag-input/tag-input.d.ts +2 -3
- package/dist/types/components/theme-root/index.d.ts +1 -0
- package/dist/types/components/theme-root/theme-root.d.ts +10 -3
- package/dist/types/components/theme-switch/theme-switch.d.ts +3 -3
- package/dist/types/components/{comment-thread → thread}/thread-parts.d.ts +7 -2
- package/dist/types/components/time-picker/time-picker.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +4 -4
- package/dist/types/components/toast/toast.d.ts +3 -3
- package/dist/types/components/tooltip/tooltip.d.ts +8 -1
- package/dist/types/components/tree-view/tree-view.d.ts +4 -3
- package/dist/types/components/typewriter-terminal/index.d.ts +2 -0
- package/dist/types/components/typewriter-terminal/typewriter-terminal.d.ts +87 -0
- package/dist/types/components/usage-meter/usage-meter.d.ts +6 -16
- package/dist/types/components/usage-meter/usage-model.d.ts +30 -0
- package/dist/types/components/user-menu/index.d.ts +2 -0
- package/dist/types/components/user-menu/user-menu.d.ts +118 -0
- package/dist/types/index.d.ts +18 -1
- package/dist/types/overlay/exit-motion.d.ts +24 -0
- package/dist/types/overlay/presence-spring.d.ts +12 -0
- package/dist/types/overlay/use-native-dialog.d.ts +10 -1
- package/dist/types/styling/create-theme.d.ts +24 -0
- package/dist/types/styling/css.d.ts +1 -1
- package/dist/types/styling/motion-timings.d.ts +5 -0
- package/dist/types/styling/overlay-motion.d.ts +95 -0
- package/dist/types/styling/surface.d.ts +7 -0
- package/dist/types/styling/sx.d.ts +1 -1
- package/dist/types/styling/theme-scope.d.ts +29 -3
- package/dist/types/styling/theme.d.ts +15 -0
- package/dist/types/utils/initials.d.ts +2 -0
- package/dist/typewriter-terminal-BUEsMzo3.js +588 -0
- package/dist/typewriter-terminal.js +2 -0
- package/dist/{usage-meter-qyQ3rYVv.js → usage-meter-CYvlB6l3.js} +165 -175
- package/dist/usage-meter.js +1 -1
- package/dist/usage-model-C0fS47w4.js +32 -0
- package/dist/use-native-dialog-FB0p7lkg.js +93 -0
- package/dist/use-scroll-lock-40gXwwAy.js +23 -0
- package/dist/user-menu-MctRu_Lh.js +757 -0
- package/dist/user-menu.js +2 -0
- package/dist/{visually-hidden-BJdvqqvn.js → visually-hidden-DgVO3NaB.js} +1 -1
- package/package.json +87 -5
- package/dist/avatar-CaGJHy1N.js +0 -145
- package/dist/calendar-BzJdv_SZ.js +0 -449
- package/dist/card-Ca4KQKYQ.js +0 -154
- package/dist/command-palette-BmQu2w4H.js +0 -391
- package/dist/comment-thread-ASaXDcGo.js +0 -1410
- package/dist/date-range-picker-DQpUeKqV.js +0 -570
- package/dist/dialog-BX1zYMs-.js +0 -219
- package/dist/drawer-DsASTiP-.js +0 -553
- package/dist/elastic-slider-BG6K019r.js +0 -395
- package/dist/elastic-slider.js +0 -2
- package/dist/slider-DVG6-Awh.js +0 -308
- package/dist/sx-Dx9JUKp5.js +0 -23
- package/dist/theme-root-Bs1U3uPA.js +0 -46
- package/dist/theme-scope-t7nAKc2c.js +0 -27
- package/dist/types/components/elastic-slider/elastic-slider.d.ts +0 -53
- package/dist/types/components/elastic-slider/index.d.ts +0 -1
- package/dist/use-native-dialog-DWpIUVO1.js +0 -84
- package/dist/use-slider-interaction-ChL-208h.js +0 -234
- /package/dist/types/components/{comment-thread → thread}/thread-core.d.ts +0 -0
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { a as e, i as t } from "./css-BYJhdGh-.js";
|
|
3
|
+
import { n } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n as r, r as i } from "./media-8yrN85VT.js";
|
|
5
|
+
import { t as ee } from "./sx-BJXJ2xJK.js";
|
|
6
|
+
import { t as a } from "./use-controlled-state-DpeVQZNR.js";
|
|
7
|
+
import { t as te } from "./renderable-DzcIj1Lo.js";
|
|
8
|
+
import { i as o, r as ne, t as re } from "./use-native-dialog-FB0p7lkg.js";
|
|
9
|
+
import { useEffect as s, useId as ie, useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
10
|
+
import { vars as d } from "@jfrader/tokens/vars";
|
|
11
|
+
import { createElement as ae } from "@emotion/react";
|
|
12
|
+
import { Fragment as oe, jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import { LayoutGroup as m, MotionConfig as h, motion as g, useMotionValue as se, useReducedMotion as ce } from "motion/react";
|
|
14
|
+
import { useMergeRefs as le } from "@floating-ui/react";
|
|
15
|
+
//#region src/components/photo-grid/photo-grid.tsx
|
|
16
|
+
var _ = [
|
|
17
|
+
5,
|
|
18
|
+
3,
|
|
19
|
+
2
|
|
20
|
+
], v = 3, ue = [], y = 3, b = .15, x = .5, S = 3, C = 40, de = 100, w = "--photo-grid-min-cell-unit", T = 2, fe = {
|
|
21
|
+
type: "spring",
|
|
22
|
+
stiffness: 360,
|
|
23
|
+
damping: 36
|
|
24
|
+
}, E = e({
|
|
25
|
+
from: { transform: "scale(0.85)" },
|
|
26
|
+
to: { transform: "scale(1)" }
|
|
27
|
+
}), pe = e({
|
|
28
|
+
from: { opacity: 0 },
|
|
29
|
+
to: { opacity: 1 }
|
|
30
|
+
}), me = {
|
|
31
|
+
larger: "Larger thumbnails",
|
|
32
|
+
smaller: "Smaller thumbnails",
|
|
33
|
+
density: "Thumbnail size",
|
|
34
|
+
empty: "No photos",
|
|
35
|
+
unavailable: "Photo unavailable",
|
|
36
|
+
imageUnavailable: "Image unavailable",
|
|
37
|
+
close: "Close viewer",
|
|
38
|
+
previous: "Previous photo",
|
|
39
|
+
next: "Next photo",
|
|
40
|
+
filmstrip: "Choose photo",
|
|
41
|
+
zoomIn: "Zoom in",
|
|
42
|
+
zoomOut: "Zoom out",
|
|
43
|
+
resetZoom: "Reset zoom",
|
|
44
|
+
panLeft: "Pan left",
|
|
45
|
+
panRight: "Pan right",
|
|
46
|
+
panUp: "Pan up",
|
|
47
|
+
panDown: "Pan down",
|
|
48
|
+
favorite: (e, t) => `${t ? "Remove" : "Add"} ${e} ${t ? "from" : "to"} favorites`,
|
|
49
|
+
openPhoto: (e, t, n) => `${e}${t && t !== e ? `, ${t}` : ""}${n ? ", favorite" : ""}`,
|
|
50
|
+
position: (e, t, n) => `${n}, ${e} / ${t}`,
|
|
51
|
+
columns: (e) => `${e} columns`
|
|
52
|
+
}, D = t({
|
|
53
|
+
label: "photo-grid",
|
|
54
|
+
display: "grid",
|
|
55
|
+
gap: d.space[4],
|
|
56
|
+
minInlineSize: 0,
|
|
57
|
+
fontFamily: d.font.sans,
|
|
58
|
+
color: d.color.text,
|
|
59
|
+
lineHeight: d.lineHeight.base,
|
|
60
|
+
"&:focus-visible": n
|
|
61
|
+
}), he = t({
|
|
62
|
+
display: "flex",
|
|
63
|
+
flexWrap: "wrap",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "space-between",
|
|
66
|
+
gap: d.space[3]
|
|
67
|
+
}), ge = t({
|
|
68
|
+
margin: 0,
|
|
69
|
+
fontSize: d.textSize.lg,
|
|
70
|
+
overflowWrap: "anywhere"
|
|
71
|
+
}), _e = t({
|
|
72
|
+
display: "flex",
|
|
73
|
+
flexWrap: "wrap",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
gap: d.space[2]
|
|
76
|
+
}), O = t({
|
|
77
|
+
appearance: "none",
|
|
78
|
+
boxSizing: "border-box",
|
|
79
|
+
minBlockSize: d.space[8],
|
|
80
|
+
minInlineSize: d.space[8],
|
|
81
|
+
paddingBlock: d.space[1],
|
|
82
|
+
paddingInline: d.space[3],
|
|
83
|
+
border: `1px solid ${d.color.borderControl}`,
|
|
84
|
+
borderRadius: d.radius.sm,
|
|
85
|
+
background: d.color.surfaceRaised,
|
|
86
|
+
color: d.color.text,
|
|
87
|
+
font: "inherit",
|
|
88
|
+
fontSize: d.textSize.sm,
|
|
89
|
+
cursor: "pointer",
|
|
90
|
+
overflowWrap: "anywhere",
|
|
91
|
+
"&:disabled": {
|
|
92
|
+
cursor: "default",
|
|
93
|
+
color: d.color.textMuted
|
|
94
|
+
},
|
|
95
|
+
"&:focus-visible": n,
|
|
96
|
+
"&[aria-pressed=\"true\"]": {
|
|
97
|
+
color: d.color.accentText,
|
|
98
|
+
borderColor: d.color.accentText
|
|
99
|
+
},
|
|
100
|
+
transitionProperty: "background-color, border-color",
|
|
101
|
+
transitionDuration: d.motion.duration.fast,
|
|
102
|
+
[i]: { transitionDuration: "0s" },
|
|
103
|
+
[r]: {
|
|
104
|
+
borderColor: "ButtonText",
|
|
105
|
+
"&[aria-pressed=\"true\"]": {
|
|
106
|
+
borderColor: "Highlight",
|
|
107
|
+
outline: "1px solid Highlight"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}), k = t({
|
|
111
|
+
display: "grid",
|
|
112
|
+
gridTemplateColumns: "repeat(var(--photo-grid-columns), minmax(0, 1fr))",
|
|
113
|
+
gap: d.space[3],
|
|
114
|
+
padding: 0,
|
|
115
|
+
margin: 0,
|
|
116
|
+
listStyle: "none",
|
|
117
|
+
[w]: d.space[12],
|
|
118
|
+
touchAction: "pan-y"
|
|
119
|
+
}), A = t({
|
|
120
|
+
display: "grid",
|
|
121
|
+
gap: d.space[2],
|
|
122
|
+
minInlineSize: 0
|
|
123
|
+
}), j = t({
|
|
124
|
+
position: "relative",
|
|
125
|
+
display: "grid",
|
|
126
|
+
placeItems: "center",
|
|
127
|
+
inlineSize: "100%",
|
|
128
|
+
aspectRatio: "1",
|
|
129
|
+
padding: 0,
|
|
130
|
+
borderRadius: d.radius.md,
|
|
131
|
+
background: d.color.surfaceInset
|
|
132
|
+
}), ve = t({
|
|
133
|
+
display: "block",
|
|
134
|
+
inlineSize: "100%",
|
|
135
|
+
blockSize: "100%",
|
|
136
|
+
objectFit: "cover",
|
|
137
|
+
borderRadius: "inherit"
|
|
138
|
+
}), ye = t({
|
|
139
|
+
padding: d.space[3],
|
|
140
|
+
boxSizing: "border-box",
|
|
141
|
+
textAlign: "center",
|
|
142
|
+
color: d.color.textMuted
|
|
143
|
+
}), be = t({
|
|
144
|
+
justifySelf: "start",
|
|
145
|
+
maxInlineSize: "100%",
|
|
146
|
+
"&[aria-pressed=\"true\"]": { animation: `${E} ${d.motion.duration.base} ${d.motion.easeStandard}` },
|
|
147
|
+
[i]: { "&[aria-pressed=\"true\"]": { animation: "none" } }
|
|
148
|
+
}), xe = t({
|
|
149
|
+
inlineSize: "100%",
|
|
150
|
+
blockSize: "100%",
|
|
151
|
+
borderRadius: "inherit"
|
|
152
|
+
}), M = t({
|
|
153
|
+
boxSizing: "border-box",
|
|
154
|
+
inlineSize: `calc(100% - ${d.space[8]})`,
|
|
155
|
+
maxInlineSize: "100%",
|
|
156
|
+
maxBlockSize: `calc(100dvh - ${d.space[8]})`,
|
|
157
|
+
overflow: "auto",
|
|
158
|
+
border: `1px solid ${d.color.borderControl}`,
|
|
159
|
+
borderRadius: d.radius.lg,
|
|
160
|
+
padding: d.space[4],
|
|
161
|
+
background: d.color.surfaceRaised,
|
|
162
|
+
color: d.color.text,
|
|
163
|
+
boxShadow: d.shadow.floating,
|
|
164
|
+
fontFamily: d.font.sans,
|
|
165
|
+
"&::backdrop": { background: d.color.scrim }
|
|
166
|
+
}), Se = t({
|
|
167
|
+
display: "grid",
|
|
168
|
+
gap: d.space[3]
|
|
169
|
+
}), Ce = t({
|
|
170
|
+
position: "relative",
|
|
171
|
+
display: "grid",
|
|
172
|
+
placeItems: "center",
|
|
173
|
+
blockSize: "min(55dvh, 40rem)",
|
|
174
|
+
overflow: "hidden",
|
|
175
|
+
borderRadius: d.radius.md,
|
|
176
|
+
background: d.color.surfaceInset,
|
|
177
|
+
touchAction: "none",
|
|
178
|
+
"&:focus-visible": n
|
|
179
|
+
}), we = t({
|
|
180
|
+
display: "block",
|
|
181
|
+
inlineSize: "100%",
|
|
182
|
+
blockSize: "100%",
|
|
183
|
+
objectFit: "contain",
|
|
184
|
+
userSelect: "none",
|
|
185
|
+
pointerEvents: "none"
|
|
186
|
+
}), Te = t({
|
|
187
|
+
inlineSize: "100%",
|
|
188
|
+
minBlockSize: d.space[8],
|
|
189
|
+
accentColor: d.color.accent,
|
|
190
|
+
"&:focus-visible": n
|
|
191
|
+
}), Ee = t({
|
|
192
|
+
fontSize: d.textSize.sm,
|
|
193
|
+
color: d.color.textMuted,
|
|
194
|
+
overflowWrap: "anywhere"
|
|
195
|
+
}), De = t({
|
|
196
|
+
margin: 0,
|
|
197
|
+
color: d.color.textMuted,
|
|
198
|
+
fontSize: d.textSize.sm,
|
|
199
|
+
overflowWrap: "anywhere",
|
|
200
|
+
animation: `${pe} ${d.motion.duration.slow} ${d.motion.easeStandard}`,
|
|
201
|
+
[i]: { animation: "none" }
|
|
202
|
+
});
|
|
203
|
+
function Oe(...e) {
|
|
204
|
+
return e.filter(Boolean).join(" ") || void 0;
|
|
205
|
+
}
|
|
206
|
+
function ke(e) {
|
|
207
|
+
let t = [...new Set(e.filter((e) => Number.isInteger(e) && e > 0))].sort((e, t) => t - e);
|
|
208
|
+
return t.length ? t : [..._];
|
|
209
|
+
}
|
|
210
|
+
function N(e, t) {
|
|
211
|
+
return e === void 0 || !Number.isFinite(e) ? t.includes(v) ? v : t[0] : t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t, t[0]);
|
|
212
|
+
}
|
|
213
|
+
function P(e, t) {
|
|
214
|
+
let n = e;
|
|
215
|
+
for (; n;) {
|
|
216
|
+
if (/(auto|scroll)/.test(getComputedStyle(n).overflowY) && n.scrollHeight > n.clientHeight) {
|
|
217
|
+
n.scrollTop += t;
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
n = n.parentElement;
|
|
221
|
+
}
|
|
222
|
+
e.ownerDocument.defaultView?.scrollBy(0, t);
|
|
223
|
+
}
|
|
224
|
+
function Ae({ photo: e, full: t, unavailable: n }) {
|
|
225
|
+
let [r, i] = u(!1);
|
|
226
|
+
return r || !e.src ? /* @__PURE__ */ f("span", {
|
|
227
|
+
"data-image-state": "error",
|
|
228
|
+
"aria-hidden": !t || void 0,
|
|
229
|
+
title: n,
|
|
230
|
+
css: ye,
|
|
231
|
+
children: t ? n : /* @__PURE__ */ p(oe, { children: ["▧ ", e.title] })
|
|
232
|
+
}) : /* @__PURE__ */ f("img", {
|
|
233
|
+
src: e.src,
|
|
234
|
+
srcSet: e.srcSet,
|
|
235
|
+
sizes: e.sizes,
|
|
236
|
+
alt: "",
|
|
237
|
+
width: e.width,
|
|
238
|
+
height: e.height,
|
|
239
|
+
loading: t ? "eager" : "lazy",
|
|
240
|
+
decoding: "async",
|
|
241
|
+
draggable: !1,
|
|
242
|
+
css: t ? we : ve,
|
|
243
|
+
onError: () => i(!0)
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function F({ ref: e, register: t, ...n }) {
|
|
247
|
+
let r = le([e, t]);
|
|
248
|
+
return /* @__PURE__ */ f("button", {
|
|
249
|
+
...n,
|
|
250
|
+
ref: r
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function I({ photos: e, selected: t, open: n, controller: r, select: i, favorites: ee, toggleFavorite: a, labels: o, format: c, slots: d, restore: ae }) {
|
|
254
|
+
let m = ie(), h = l(null), _ = l(null), v = l(null), ue = le([_, d?.stage?.ref]), y = r, b = re(d?.viewer ?? {}), w = ne({
|
|
255
|
+
...y,
|
|
256
|
+
open: n && e.length > 0
|
|
257
|
+
}, {
|
|
258
|
+
onCancel: (e) => {
|
|
259
|
+
e.target === e.currentTarget && b.onCancel?.(e);
|
|
260
|
+
},
|
|
261
|
+
onClick: b.onClick,
|
|
262
|
+
onClose: (e) => {
|
|
263
|
+
e.target === e.currentTarget && (b.onClose?.(e), ae());
|
|
264
|
+
}
|
|
265
|
+
}, b.ref, h), T = e.findIndex((e) => e.id === t), E = e[T], [pe, me] = u({
|
|
266
|
+
id: t,
|
|
267
|
+
value: 1
|
|
268
|
+
}), D = pe.id === t ? pe.value : 1, k = se(0), A = se(0), j = se(1), ve = ce(), we = E ? o.position(c.format(T + 1), c.format(e.length), E.title) : o.unavailable, ke = E && te(E.detail) && E.detail !== "", N = l(/* @__PURE__ */ new Map()), P = l(null);
|
|
269
|
+
s(() => {
|
|
270
|
+
k.set(0), A.set(0), j.set(1), n || me({
|
|
271
|
+
id: t,
|
|
272
|
+
value: 1
|
|
273
|
+
}), N.current.clear(), P.current = null;
|
|
274
|
+
}, [
|
|
275
|
+
t,
|
|
276
|
+
n,
|
|
277
|
+
k,
|
|
278
|
+
A,
|
|
279
|
+
j
|
|
280
|
+
]), s(() => {
|
|
281
|
+
h.current?.open && v.current?.focus({ preventScroll: !0 });
|
|
282
|
+
}, [n, y.repairToken]), s(() => {
|
|
283
|
+
if (!n || !E || h.current?.ownerDocument.visibilityState === "hidden") return;
|
|
284
|
+
let t = h.current?.ownerDocument.defaultView?.Image;
|
|
285
|
+
if (!t) return;
|
|
286
|
+
let r = [e[T - 1], e[T + 1]].filter((e) => e !== void 0).map((e) => {
|
|
287
|
+
let n = new t();
|
|
288
|
+
return e.sizes && (n.sizes = e.sizes), e.srcSet && (n.srcset = e.srcSet), n.src = e.src, n;
|
|
289
|
+
});
|
|
290
|
+
return () => {
|
|
291
|
+
for (let e of r) e.src = "";
|
|
292
|
+
};
|
|
293
|
+
}, [
|
|
294
|
+
n,
|
|
295
|
+
E,
|
|
296
|
+
T,
|
|
297
|
+
e
|
|
298
|
+
]);
|
|
299
|
+
let F = (e) => {
|
|
300
|
+
let n = Math.min(S, Math.max(1, e));
|
|
301
|
+
me({
|
|
302
|
+
id: t,
|
|
303
|
+
value: n
|
|
304
|
+
}), j.set(n), k.set(0), A.set(0);
|
|
305
|
+
}, I = (e, t) => {
|
|
306
|
+
let n = _.current?.getBoundingClientRect(), r = (n?.width ?? 0) * (D - 1) / 2, i = (n?.height ?? 0) * (D - 1) / 2;
|
|
307
|
+
k.set(Math.min(r, Math.max(-r, k.get() + e))), A.set(Math.min(i, Math.max(-i, A.get() + t)));
|
|
308
|
+
}, L = (t) => {
|
|
309
|
+
let n = e[Math.min(e.length - 1, Math.max(0, t))];
|
|
310
|
+
n && i(n.id);
|
|
311
|
+
}, R = (t) => {
|
|
312
|
+
if (t.defaultPrevented || !E || t.target.closest("input, button, textarea, select")) return;
|
|
313
|
+
let n = t.currentTarget.matches(":dir(rtl)") ? -1 : 1;
|
|
314
|
+
if (D > 1 && t.target === _.current) {
|
|
315
|
+
let e = {
|
|
316
|
+
ArrowLeft: [C, 0],
|
|
317
|
+
ArrowRight: [-40, 0],
|
|
318
|
+
ArrowUp: [0, C],
|
|
319
|
+
ArrowDown: [0, -40]
|
|
320
|
+
}[t.key];
|
|
321
|
+
if (e) {
|
|
322
|
+
t.preventDefault(), I(...e);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
let r = {
|
|
327
|
+
ArrowLeft: T - n,
|
|
328
|
+
ArrowRight: T + n,
|
|
329
|
+
Home: 0,
|
|
330
|
+
End: e.length - 1
|
|
331
|
+
};
|
|
332
|
+
D === 1 && r[t.key] !== void 0 && (t.preventDefault(), L(r[t.key])), (t.key === "+" || t.key === "=") && (t.preventDefault(), F(D + x)), t.key === "-" && (t.preventDefault(), F(D - x));
|
|
333
|
+
}, z = (e, t, n = !1) => /* @__PURE__ */ f("button", {
|
|
334
|
+
type: "button",
|
|
335
|
+
css: O,
|
|
336
|
+
disabled: n,
|
|
337
|
+
onClick: t,
|
|
338
|
+
children: e
|
|
339
|
+
});
|
|
340
|
+
return /* @__PURE__ */ f("dialog", {
|
|
341
|
+
...b,
|
|
342
|
+
ref: w.ref,
|
|
343
|
+
"data-ui": "photo-grid-viewer",
|
|
344
|
+
"aria-modal": "true",
|
|
345
|
+
"aria-labelledby": Oe(b["aria-labelledby"], `${m}-title`),
|
|
346
|
+
"aria-describedby": Oe(b["aria-describedby"], ke && `${m}-detail`),
|
|
347
|
+
css: [M, b.css],
|
|
348
|
+
onCancel: (e) => {
|
|
349
|
+
e.target === e.currentTarget && w.onCancel(e);
|
|
350
|
+
},
|
|
351
|
+
onClose: (e) => {
|
|
352
|
+
e.target === e.currentTarget && w.onClose(e);
|
|
353
|
+
},
|
|
354
|
+
onClick: w.onClick,
|
|
355
|
+
onKeyDown: (e) => {
|
|
356
|
+
b.onKeyDown?.(e), R(e);
|
|
357
|
+
},
|
|
358
|
+
children: /* @__PURE__ */ p("div", {
|
|
359
|
+
css: Se,
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ p("header", {
|
|
362
|
+
role: "presentation",
|
|
363
|
+
css: he,
|
|
364
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
365
|
+
id: `${m}-title`,
|
|
366
|
+
css: ge,
|
|
367
|
+
children: E?.title ?? o.unavailable
|
|
368
|
+
}), /* @__PURE__ */ f("button", {
|
|
369
|
+
ref: v,
|
|
370
|
+
type: "button",
|
|
371
|
+
css: O,
|
|
372
|
+
onClick: y.requestClose,
|
|
373
|
+
children: o.close
|
|
374
|
+
})]
|
|
375
|
+
}),
|
|
376
|
+
/* @__PURE__ */ f("div", {
|
|
377
|
+
...d?.stage,
|
|
378
|
+
ref: ue,
|
|
379
|
+
"data-ui": "photo-grid-stage",
|
|
380
|
+
tabIndex: E ? 0 : void 0,
|
|
381
|
+
role: "group",
|
|
382
|
+
"aria-label": d?.stage?.["aria-label"] ?? E?.title ?? o.unavailable,
|
|
383
|
+
css: [Ce, d?.stage?.css],
|
|
384
|
+
"data-zoom": D,
|
|
385
|
+
onPointerDown: (e) => {
|
|
386
|
+
if (d?.stage?.onPointerDown?.(e), e.defaultPrevented || !E || e.button !== 0) return;
|
|
387
|
+
N.current.set(e.pointerId, {
|
|
388
|
+
x: e.clientX,
|
|
389
|
+
y: e.clientY
|
|
390
|
+
}), e.currentTarget.setPointerCapture(e.pointerId);
|
|
391
|
+
let t = [...N.current.values()];
|
|
392
|
+
P.current = {
|
|
393
|
+
originX: e.clientX,
|
|
394
|
+
originY: e.clientY,
|
|
395
|
+
x: k.get(),
|
|
396
|
+
y: A.get(),
|
|
397
|
+
zoom: D,
|
|
398
|
+
distance: t.length === 2 ? Math.hypot(t[1].x - t[0].x, t[1].y - t[0].y) : void 0
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
onPointerMove: (e) => {
|
|
402
|
+
d?.stage?.onPointerMove?.(e);
|
|
403
|
+
let t = P.current;
|
|
404
|
+
if (e.defaultPrevented || !t || !N.current.has(e.pointerId)) return;
|
|
405
|
+
N.current.set(e.pointerId, {
|
|
406
|
+
x: e.clientX,
|
|
407
|
+
y: e.clientY
|
|
408
|
+
});
|
|
409
|
+
let n = [...N.current.values()];
|
|
410
|
+
if (n.length === 2 && t.distance) {
|
|
411
|
+
let e = Math.hypot(n[1].x - n[0].x, n[1].y - n[0].y) / t.distance;
|
|
412
|
+
j.set(Math.min(S, Math.max(1, t.zoom * e)));
|
|
413
|
+
} else D > 1 ? I(t.x + e.clientX - t.originX - k.get(), t.y + e.clientY - t.originY - A.get()) : ve || (k.set(e.clientX - t.originX), A.set(e.clientY - t.originY));
|
|
414
|
+
},
|
|
415
|
+
onPointerUp: (e) => {
|
|
416
|
+
d?.stage?.onPointerUp?.(e);
|
|
417
|
+
let t = P.current;
|
|
418
|
+
if (N.current.delete(e.pointerId), !N.current.size) {
|
|
419
|
+
if (P.current = null, t?.distance) {
|
|
420
|
+
e.defaultPrevented ? j.set(D) : F(j.get());
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
D === 1 && (!e.defaultPrevented && t && Math.abs(e.clientY - t.originY) > de ? y.requestClose() : !e.defaultPrevented && t && Math.abs(e.clientX - t.originX) > de && L(T + (e.clientX < t.originX ? 1 : -1)), k.set(0), A.set(0));
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
onPointerCancel: (e) => {
|
|
427
|
+
d?.stage?.onPointerCancel?.(e), N.current.clear(), P.current = null, k.set(0), A.set(0), j.set(D);
|
|
428
|
+
},
|
|
429
|
+
onLostPointerCapture: (e) => {
|
|
430
|
+
d?.stage?.onLostPointerCapture?.(e), N.current.delete(e.pointerId), N.current.size || (P.current = null);
|
|
431
|
+
},
|
|
432
|
+
children: E ? /* @__PURE__ */ f(g.div, {
|
|
433
|
+
layoutId: n && !ve ? E.id : void 0,
|
|
434
|
+
transition: fe,
|
|
435
|
+
css: xe,
|
|
436
|
+
children: /* @__PURE__ */ f(g.div, {
|
|
437
|
+
style: {
|
|
438
|
+
x: k,
|
|
439
|
+
y: A,
|
|
440
|
+
scale: j
|
|
441
|
+
},
|
|
442
|
+
css: xe,
|
|
443
|
+
children: n && /* @__PURE__ */ f(Ae, {
|
|
444
|
+
photo: E,
|
|
445
|
+
full: !0,
|
|
446
|
+
unavailable: o.imageUnavailable
|
|
447
|
+
}, `${E.src}\u0000${E.srcSet ?? ""}`)
|
|
448
|
+
})
|
|
449
|
+
}, E.id) : /* @__PURE__ */ f("span", {
|
|
450
|
+
css: ye,
|
|
451
|
+
children: o.unavailable
|
|
452
|
+
})
|
|
453
|
+
}),
|
|
454
|
+
/* @__PURE__ */ p("div", {
|
|
455
|
+
...d?.controls,
|
|
456
|
+
css: [_e, d?.controls?.css],
|
|
457
|
+
children: [
|
|
458
|
+
z(o.previous, () => L(T - 1), T <= 0),
|
|
459
|
+
z(o.next, () => L(T + 1), T < 0 || T >= e.length - 1),
|
|
460
|
+
z(o.zoomIn, () => F(D + x), !E || D >= S),
|
|
461
|
+
z(o.zoomOut, () => F(D - x), !E || D <= 1),
|
|
462
|
+
z(o.resetZoom, () => F(1), !E || D === 1),
|
|
463
|
+
D > 1 && /* @__PURE__ */ p(oe, { children: [
|
|
464
|
+
z(o.panLeft, () => I(C, 0)),
|
|
465
|
+
z(o.panRight, () => I(-40, 0)),
|
|
466
|
+
z(o.panUp, () => I(0, C)),
|
|
467
|
+
z(o.panDown, () => I(0, -40))
|
|
468
|
+
] })
|
|
469
|
+
]
|
|
470
|
+
}),
|
|
471
|
+
/* @__PURE__ */ f("input", {
|
|
472
|
+
...d?.filmstrip,
|
|
473
|
+
type: "range",
|
|
474
|
+
"data-ui": "photo-grid-filmstrip",
|
|
475
|
+
min: 0,
|
|
476
|
+
max: Math.max(0, e.length - 1),
|
|
477
|
+
step: 1,
|
|
478
|
+
value: Math.max(0, T),
|
|
479
|
+
disabled: e.length < 2 || !E,
|
|
480
|
+
"aria-label": d?.filmstrip?.["aria-label"] ?? o.filmstrip,
|
|
481
|
+
"aria-valuetext": we,
|
|
482
|
+
css: [Te, d?.filmstrip?.css],
|
|
483
|
+
onChange: (e) => {
|
|
484
|
+
d?.filmstrip?.onChange?.(e), e.defaultPrevented || L(e.currentTarget.valueAsNumber);
|
|
485
|
+
}
|
|
486
|
+
}),
|
|
487
|
+
E && /* @__PURE__ */ p("button", {
|
|
488
|
+
...d?.favorite,
|
|
489
|
+
type: "button",
|
|
490
|
+
"aria-pressed": ee.has(E.id),
|
|
491
|
+
css: [
|
|
492
|
+
O,
|
|
493
|
+
be,
|
|
494
|
+
d?.favorite?.css
|
|
495
|
+
],
|
|
496
|
+
onClick: (e) => {
|
|
497
|
+
d?.favorite?.onClick?.(e), e.defaultPrevented || a(E.id);
|
|
498
|
+
},
|
|
499
|
+
children: [
|
|
500
|
+
ee.has(E.id) ? "★" : "☆",
|
|
501
|
+
" ",
|
|
502
|
+
o.favorite(E.title, ee.has(E.id))
|
|
503
|
+
]
|
|
504
|
+
}),
|
|
505
|
+
ke && /* @__PURE__ */ f("p", {
|
|
506
|
+
id: `${m}-detail`,
|
|
507
|
+
css: De,
|
|
508
|
+
children: E.detail
|
|
509
|
+
}, E.id),
|
|
510
|
+
/* @__PURE__ */ f("div", {
|
|
511
|
+
role: "status",
|
|
512
|
+
"aria-live": "polite",
|
|
513
|
+
"aria-atomic": "true",
|
|
514
|
+
css: Ee,
|
|
515
|
+
children: we
|
|
516
|
+
})
|
|
517
|
+
]
|
|
518
|
+
})
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function L({ ref: e, photos: t, title: n, densitySteps: r = _, density: i, defaultDensity: te, onDensityChange: ne, favorites: re, defaultFavorites: d = ue, onFavoritesChange: oe, onFavoriteChange: v, value: x, defaultValue: S, onValueChange: C, open: de, defaultOpen: E = !1, onOpenChange: pe, labels: ve, locale: ye, slotProps: M, className: Se, sx: Ce, onKeyDown: we, ...Te }) {
|
|
522
|
+
let L = ie(), R = ke(r), [z] = u(() => N(te, R)), [je, Me] = a(i, z, ne), B = N(je, R), [Ne, Pe] = a(re, d, (e) => oe?.([...e])), V = new Set(Ne ?? ue), [H, Fe] = a(x, S === void 0 ? t[0]?.id ?? null : S, C), [U, Ie] = a(de, E, pe), Le = o((U ?? !1) && t.length > 0, Ie), W = {
|
|
523
|
+
...me,
|
|
524
|
+
...ve
|
|
525
|
+
}, Re = new Intl.NumberFormat(ye), G = l(null), ze = l(null), Be = le([G, e]), Ve = le([ze, M?.list?.ref]), K = l(/* @__PURE__ */ new Map()), q = l(null), He = l(null), J = l(null), [Ue, We] = u(B), Y = Math.min(B, Ue), Ge = ce(), [Ke, qe] = u(!0), X = l(/* @__PURE__ */ new Map()), Z = l(null), Q = se(1), Je = R.indexOf(B), [Ye, Xe] = u(""), Ze = l({
|
|
526
|
+
density: B,
|
|
527
|
+
selected: H,
|
|
528
|
+
favorites: V
|
|
529
|
+
});
|
|
530
|
+
if (process.env.NODE_ENV !== "production") {
|
|
531
|
+
let e = /* @__PURE__ */ new Set();
|
|
532
|
+
for (let n of t) {
|
|
533
|
+
if (e.has(n.id)) throw Error("PhotoGrid: photo IDs must be unique.");
|
|
534
|
+
if (!Number.isFinite(n.width) || n.width <= 0 || !Number.isFinite(n.height) || n.height <= 0) throw Error("PhotoGrid: photo dimensions must be finite positive numbers.");
|
|
535
|
+
e.add(n.id);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
c(() => {
|
|
539
|
+
let e = ze.current;
|
|
540
|
+
if (!e) return;
|
|
541
|
+
let t = () => {
|
|
542
|
+
let t = getComputedStyle(e), n = Number.parseFloat(t.getPropertyValue(w)) * T, r = Number.parseFloat(t.columnGap) || 0;
|
|
543
|
+
We(n > 0 ? Math.max(1, Math.floor((e.clientWidth + r) / (n + r))) : Infinity);
|
|
544
|
+
};
|
|
545
|
+
t();
|
|
546
|
+
let n = new ResizeObserver(t);
|
|
547
|
+
return n.observe(e), () => n.disconnect();
|
|
548
|
+
}, [t.length === 0]), s(() => {
|
|
549
|
+
let e = G.current;
|
|
550
|
+
if (!e) return;
|
|
551
|
+
let t = e.ownerDocument, n = !0, r = () => qe(n && t.visibilityState !== "hidden"), i = new IntersectionObserver(([e]) => {
|
|
552
|
+
n = e?.isIntersecting ?? !1, r();
|
|
553
|
+
});
|
|
554
|
+
return i.observe(e), t.addEventListener("visibilitychange", r), () => {
|
|
555
|
+
i.disconnect(), t.removeEventListener("visibilitychange", r);
|
|
556
|
+
};
|
|
557
|
+
}, []), s(() => {
|
|
558
|
+
let e = G.current?.ownerDocument;
|
|
559
|
+
if (!e) return;
|
|
560
|
+
let t = (e) => {
|
|
561
|
+
ze.current?.contains(e.target) || (X.current.delete(e.pointerId), Z.current = null, Q.set(1));
|
|
562
|
+
};
|
|
563
|
+
return e.addEventListener("pointerup", t, !0), e.addEventListener("pointercancel", t, !0), () => {
|
|
564
|
+
e.removeEventListener("pointerup", t, !0), e.removeEventListener("pointercancel", t, !0);
|
|
565
|
+
};
|
|
566
|
+
}, [Q]), c(() => {
|
|
567
|
+
let e = J.current;
|
|
568
|
+
if (!e || e.density !== B) return;
|
|
569
|
+
J.current = null;
|
|
570
|
+
let t = K.current.get(e.id);
|
|
571
|
+
t && G.current && (t.focus({ preventScroll: !0 }), P(G.current, t.getBoundingClientRect().top - e.top));
|
|
572
|
+
}, [B, Y]), c(() => {
|
|
573
|
+
let e = q.current;
|
|
574
|
+
if (!e || t.some((t) => t.id === e.id) || U) return;
|
|
575
|
+
let n = t[Math.min(e.index, t.length - 1)], r = G.current?.ownerDocument.activeElement;
|
|
576
|
+
r !== G.current?.ownerDocument.body && r?.isConnected || (n ? K.current.get(n.id)?.focus() : G.current?.focus());
|
|
577
|
+
}, [t, U]), s(() => {
|
|
578
|
+
let e = Ze.current;
|
|
579
|
+
if (e.density !== B) Xe(W.columns(Re.format(B)));
|
|
580
|
+
else if (e.selected !== H && U) {
|
|
581
|
+
let e = t.findIndex((e) => e.id === H);
|
|
582
|
+
Xe(e >= 0 ? W.position(Re.format(e + 1), Re.format(t.length), t[e].title) : W.unavailable);
|
|
583
|
+
} else if (e.favorites.size !== V.size || [...V].some((t) => !e.favorites.has(t))) {
|
|
584
|
+
let n = t.find((t) => V.has(t.id) !== e.favorites.has(t.id));
|
|
585
|
+
n && Xe(W.favorite(n.title, V.has(n.id)));
|
|
586
|
+
}
|
|
587
|
+
Ze.current = {
|
|
588
|
+
density: B,
|
|
589
|
+
selected: H,
|
|
590
|
+
favorites: V
|
|
591
|
+
};
|
|
592
|
+
}, [
|
|
593
|
+
B,
|
|
594
|
+
H,
|
|
595
|
+
Ne,
|
|
596
|
+
U
|
|
597
|
+
]);
|
|
598
|
+
let Qe = (e) => {
|
|
599
|
+
let t = new Set(V), n = !t.has(e);
|
|
600
|
+
n ? t.add(e) : t.delete(e), Pe([...t]), v?.(e, n);
|
|
601
|
+
}, $ = (e, n = q.current?.id ?? t[0]?.id) => {
|
|
602
|
+
let r = R[Math.min(R.length - 1, Math.max(0, Je + e))];
|
|
603
|
+
if (r === B) return;
|
|
604
|
+
let i = n ? K.current.get(n) : void 0;
|
|
605
|
+
J.current = i && n ? {
|
|
606
|
+
id: n,
|
|
607
|
+
top: i.getBoundingClientRect().top,
|
|
608
|
+
density: r
|
|
609
|
+
} : null, Me(r);
|
|
610
|
+
}, $e = (e) => {
|
|
611
|
+
let n = t[Math.min(t.length - 1, Math.max(0, e))];
|
|
612
|
+
n && K.current.get(n.id)?.focus();
|
|
613
|
+
}, et = (e, n) => {
|
|
614
|
+
if (e.defaultPrevented) return;
|
|
615
|
+
let r = e.currentTarget.matches(":dir(rtl)") ? -1 : 1, i = {
|
|
616
|
+
ArrowLeft: n - r,
|
|
617
|
+
ArrowRight: n + r,
|
|
618
|
+
ArrowUp: n - Y,
|
|
619
|
+
ArrowDown: n + Y,
|
|
620
|
+
PageUp: n - y * Y,
|
|
621
|
+
PageDown: n + y * Y,
|
|
622
|
+
Home: 0,
|
|
623
|
+
End: t.length - 1
|
|
624
|
+
};
|
|
625
|
+
i[e.key] !== void 0 && (e.preventDefault(), $e(i[e.key])), (e.key === "+" || e.key === "=") && (e.preventDefault(), $(1, t[n].id)), e.key === "-" && (e.preventDefault(), $(-1, t[n].id));
|
|
626
|
+
}, tt = () => {
|
|
627
|
+
let e = t[Math.min(q.current?.index ?? 0, t.length - 1)];
|
|
628
|
+
(K.current.get(He.current ?? "") ?? (e ? K.current.get(e.id) : null) ?? G.current)?.focus({ preventScroll: !0 });
|
|
629
|
+
};
|
|
630
|
+
return /* @__PURE__ */ f(h, {
|
|
631
|
+
reducedMotion: "user",
|
|
632
|
+
children: /* @__PURE__ */ f(m, {
|
|
633
|
+
id: L,
|
|
634
|
+
children: /* @__PURE__ */ f(ee, {
|
|
635
|
+
className: Se,
|
|
636
|
+
styles: D,
|
|
637
|
+
sx: Ce,
|
|
638
|
+
children: (e) => /* @__PURE__ */ p("div", {
|
|
639
|
+
...Te,
|
|
640
|
+
ref: Be,
|
|
641
|
+
className: e,
|
|
642
|
+
"data-ui": "photo-grid",
|
|
643
|
+
role: "region",
|
|
644
|
+
tabIndex: Te.tabIndex ?? -1,
|
|
645
|
+
"aria-labelledby": Oe(Te["aria-labelledby"], M?.title?.id ?? `${L}-title`),
|
|
646
|
+
"data-density": B,
|
|
647
|
+
"data-columns": Y,
|
|
648
|
+
onKeyDown: we,
|
|
649
|
+
children: [
|
|
650
|
+
/* @__PURE__ */ p("header", {
|
|
651
|
+
...M?.header,
|
|
652
|
+
role: M?.header?.role ?? "presentation",
|
|
653
|
+
css: [he, M?.header?.css],
|
|
654
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
655
|
+
...M?.title,
|
|
656
|
+
id: M?.title?.id ?? `${L}-title`,
|
|
657
|
+
css: [ge, M?.title?.css],
|
|
658
|
+
children: n
|
|
659
|
+
}), /* @__PURE__ */ p("div", {
|
|
660
|
+
...M?.density,
|
|
661
|
+
role: "group",
|
|
662
|
+
"aria-label": M?.density?.["aria-label"] ?? W.density,
|
|
663
|
+
css: [_e, M?.density?.css],
|
|
664
|
+
children: [/* @__PURE__ */ f("button", {
|
|
665
|
+
type: "button",
|
|
666
|
+
css: O,
|
|
667
|
+
disabled: !t.length || Je === R.length - 1,
|
|
668
|
+
onClick: () => $(1),
|
|
669
|
+
children: W.larger
|
|
670
|
+
}), /* @__PURE__ */ f("button", {
|
|
671
|
+
type: "button",
|
|
672
|
+
css: O,
|
|
673
|
+
disabled: !t.length || Je === 0,
|
|
674
|
+
onClick: () => $(-1),
|
|
675
|
+
children: W.smaller
|
|
676
|
+
})]
|
|
677
|
+
})]
|
|
678
|
+
}),
|
|
679
|
+
t.length ? /* @__PURE__ */ f(g.div, {
|
|
680
|
+
style: { scale: Q },
|
|
681
|
+
children: /* @__PURE__ */ f("ul", {
|
|
682
|
+
...M?.list,
|
|
683
|
+
ref: Ve,
|
|
684
|
+
css: [k, M?.list?.css],
|
|
685
|
+
"data-ui": "photo-grid-list",
|
|
686
|
+
"aria-labelledby": Oe(M?.list?.["aria-labelledby"], M?.title?.id ?? `${L}-title`),
|
|
687
|
+
style: {
|
|
688
|
+
...M?.list?.style,
|
|
689
|
+
"--photo-grid-columns": Y
|
|
690
|
+
},
|
|
691
|
+
onPointerDown: (e) => {
|
|
692
|
+
if (M?.list?.onPointerDown?.(e), !(e.defaultPrevented || e.pointerType !== "touch") && (X.current.set(e.pointerId, {
|
|
693
|
+
x: e.clientX,
|
|
694
|
+
y: e.clientY
|
|
695
|
+
}), X.current.size === 2)) {
|
|
696
|
+
let t = [...X.current.values()], n = e.target.closest("[data-photo-id]");
|
|
697
|
+
Z.current = {
|
|
698
|
+
distance: Math.hypot(t[1].x - t[0].x, t[1].y - t[0].y),
|
|
699
|
+
ratio: 1,
|
|
700
|
+
focalId: n?.dataset.photoId ?? q.current?.id ?? null
|
|
701
|
+
}, e.currentTarget.setPointerCapture(e.pointerId);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
onPointerMove: (e) => {
|
|
705
|
+
if (M?.list?.onPointerMove?.(e), e.defaultPrevented || !X.current.has(e.pointerId)) return;
|
|
706
|
+
X.current.set(e.pointerId, {
|
|
707
|
+
x: e.clientX,
|
|
708
|
+
y: e.clientY
|
|
709
|
+
});
|
|
710
|
+
let t = Z.current, n = [...X.current.values()];
|
|
711
|
+
t && n.length === 2 && t.distance && (t.ratio = Math.hypot(n[1].x - n[0].x, n[1].y - n[0].y) / t.distance, !Ge && Ke && Q.set(Math.min(1.15, Math.max(.85, t.ratio))));
|
|
712
|
+
},
|
|
713
|
+
onPointerUp: (e) => {
|
|
714
|
+
M?.list?.onPointerUp?.(e);
|
|
715
|
+
let t = Z.current;
|
|
716
|
+
X.current.delete(e.pointerId), Z.current = null, Q.set(1), !e.defaultPrevented && t && Math.abs(t.ratio - 1) >= b && $(t.ratio > 1 ? 1 : -1, t.focalId ?? void 0);
|
|
717
|
+
},
|
|
718
|
+
onPointerCancel: (e) => {
|
|
719
|
+
M?.list?.onPointerCancel?.(e), X.current.clear(), Z.current = null, Q.set(1);
|
|
720
|
+
},
|
|
721
|
+
onLostPointerCapture: (e) => {
|
|
722
|
+
M?.list?.onLostPointerCapture?.(e), X.current.clear(), Z.current = null, Q.set(1);
|
|
723
|
+
},
|
|
724
|
+
children: t.map((e, t) => /* @__PURE__ */ ae("li", {
|
|
725
|
+
...M?.item,
|
|
726
|
+
key: e.id,
|
|
727
|
+
"data-photo-id": e.id,
|
|
728
|
+
css: M?.item?.css
|
|
729
|
+
}, /* @__PURE__ */ p(g.div, {
|
|
730
|
+
layout: !Ge && Ke && q.current?.id !== e.id && J.current?.id !== e.id ? "position" : !1,
|
|
731
|
+
transition: fe,
|
|
732
|
+
css: A,
|
|
733
|
+
children: [/* @__PURE__ */ f(F, {
|
|
734
|
+
...M?.photo,
|
|
735
|
+
ref: M?.photo?.ref,
|
|
736
|
+
register: (t) => (t && K.current.set(e.id, t), () => {
|
|
737
|
+
K.current.delete(e.id);
|
|
738
|
+
}),
|
|
739
|
+
"data-ui": "photo-grid-photo",
|
|
740
|
+
type: "button",
|
|
741
|
+
"aria-label": M?.photo?.["aria-label"] ?? W.openPhoto(e.title, e.alt, V.has(e.id)),
|
|
742
|
+
css: [
|
|
743
|
+
O,
|
|
744
|
+
j,
|
|
745
|
+
M?.photo?.css
|
|
746
|
+
],
|
|
747
|
+
onFocus: (n) => {
|
|
748
|
+
M?.photo?.onFocus?.(n), K.current.set(e.id, n.currentTarget), q.current = {
|
|
749
|
+
id: e.id,
|
|
750
|
+
index: t,
|
|
751
|
+
kind: "photo"
|
|
752
|
+
};
|
|
753
|
+
},
|
|
754
|
+
onClick: (t) => {
|
|
755
|
+
M?.photo?.onClick?.(t), !t.defaultPrevented && (He.current = e.id, Fe(e.id), Le.setOpen(!0));
|
|
756
|
+
},
|
|
757
|
+
onKeyDown: (e) => {
|
|
758
|
+
M?.photo?.onKeyDown?.(e), e.defaultPrevented || et(e, t);
|
|
759
|
+
},
|
|
760
|
+
children: /* @__PURE__ */ f(g.div, {
|
|
761
|
+
layoutId: !Ge && Ke ? e.id : void 0,
|
|
762
|
+
transition: fe,
|
|
763
|
+
css: xe,
|
|
764
|
+
children: /* @__PURE__ */ f(Ae, {
|
|
765
|
+
photo: e,
|
|
766
|
+
unavailable: W.imageUnavailable
|
|
767
|
+
}, `${e.src}\u0000${e.srcSet ?? ""}`)
|
|
768
|
+
})
|
|
769
|
+
}), /* @__PURE__ */ f("button", {
|
|
770
|
+
...M?.favorite,
|
|
771
|
+
type: "button",
|
|
772
|
+
"data-ui": "photo-grid-favorite",
|
|
773
|
+
"aria-pressed": V.has(e.id),
|
|
774
|
+
"aria-label": M?.favorite?.["aria-label"] ?? W.favorite(e.title, V.has(e.id)),
|
|
775
|
+
css: [
|
|
776
|
+
O,
|
|
777
|
+
be,
|
|
778
|
+
M?.favorite?.css
|
|
779
|
+
],
|
|
780
|
+
onFocus: (n) => {
|
|
781
|
+
M?.favorite?.onFocus?.(n), q.current = {
|
|
782
|
+
id: e.id,
|
|
783
|
+
index: t,
|
|
784
|
+
kind: "favorite"
|
|
785
|
+
};
|
|
786
|
+
},
|
|
787
|
+
onClick: (t) => {
|
|
788
|
+
M?.favorite?.onClick?.(t), t.defaultPrevented || Qe(e.id);
|
|
789
|
+
},
|
|
790
|
+
children: V.has(e.id) ? "★" : "☆"
|
|
791
|
+
})]
|
|
792
|
+
})))
|
|
793
|
+
})
|
|
794
|
+
}) : /* @__PURE__ */ f("p", {
|
|
795
|
+
css: De,
|
|
796
|
+
children: W.empty
|
|
797
|
+
}),
|
|
798
|
+
/* @__PURE__ */ f("div", {
|
|
799
|
+
...M?.status,
|
|
800
|
+
role: "status",
|
|
801
|
+
"aria-live": "polite",
|
|
802
|
+
"aria-atomic": "true",
|
|
803
|
+
css: [Ee, M?.status?.css],
|
|
804
|
+
children: Ye
|
|
805
|
+
}),
|
|
806
|
+
/* @__PURE__ */ f(I, {
|
|
807
|
+
photos: t,
|
|
808
|
+
selected: H,
|
|
809
|
+
open: U ?? !1,
|
|
810
|
+
controller: {
|
|
811
|
+
...Le,
|
|
812
|
+
open: (U ?? !1) && t.length > 0
|
|
813
|
+
},
|
|
814
|
+
select: Fe,
|
|
815
|
+
favorites: V,
|
|
816
|
+
toggleFavorite: Qe,
|
|
817
|
+
labels: W,
|
|
818
|
+
format: Re,
|
|
819
|
+
slots: M,
|
|
820
|
+
restore: tt
|
|
821
|
+
})
|
|
822
|
+
]
|
|
823
|
+
})
|
|
824
|
+
})
|
|
825
|
+
})
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
L.displayName = "PhotoGrid";
|
|
829
|
+
//#endregion
|
|
830
|
+
export { L as t };
|