@42-central/ui-react 0.19.2 → 0.20.1
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/biome/no-gray-scale-class.grit +27 -0
- package/dist/chunk-2HIX6DKN.js +85 -0
- package/dist/chunk-2HIX6DKN.js.map +1 -0
- package/dist/chunk-2LI3VPDP.js +39 -0
- package/dist/chunk-2LI3VPDP.js.map +1 -0
- package/dist/{chunk-VZH6TS7M.js → chunk-2MXWEIMD.js} +12 -6
- package/dist/chunk-2MXWEIMD.js.map +1 -0
- package/dist/{chunk-SVKU3GUN.js → chunk-3BXKTWWD.js} +14 -14
- package/dist/chunk-3BXKTWWD.js.map +1 -0
- package/dist/{chunk-Z6RPMRFH.js → chunk-45QRQKRC.js} +10 -9
- package/dist/chunk-45QRQKRC.js.map +1 -0
- package/dist/chunk-47LEAR6G.js +437 -0
- package/dist/chunk-47LEAR6G.js.map +1 -0
- package/dist/chunk-4ASNIDV7.js +17 -0
- package/dist/chunk-4ASNIDV7.js.map +1 -0
- package/dist/{chunk-P3XMBETI.js → chunk-4G3N7UMJ.js} +4 -7
- package/dist/chunk-4G3N7UMJ.js.map +1 -0
- package/dist/{chunk-LM6F6DLR.js → chunk-5HUEBSIS.js} +19 -10
- package/dist/chunk-5HUEBSIS.js.map +1 -0
- package/dist/{chunk-RKYXG6X7.js → chunk-6M6YZ3PQ.js} +17 -14
- package/dist/chunk-6M6YZ3PQ.js.map +1 -0
- package/dist/chunk-6N6J2DOE.js +27 -0
- package/dist/chunk-6N6J2DOE.js.map +1 -0
- package/dist/{chunk-CYWMES5P.js → chunk-6VYGK3Q3.js} +24 -12
- package/dist/chunk-6VYGK3Q3.js.map +1 -0
- package/dist/{chunk-IG7FBZVM.js → chunk-6YNLRQ25.js} +13 -12
- package/dist/chunk-6YNLRQ25.js.map +1 -0
- package/dist/{chunk-A6MYJTJI.js → chunk-7AQ4MN4M.js} +8 -9
- package/dist/chunk-7AQ4MN4M.js.map +1 -0
- package/dist/chunk-7BOSX65U.js +176 -0
- package/dist/chunk-7BOSX65U.js.map +1 -0
- package/dist/{chunk-BTFBBNRW.js → chunk-7CNDZZZ6.js} +6 -6
- package/dist/{chunk-BTFBBNRW.js.map → chunk-7CNDZZZ6.js.map} +1 -1
- package/dist/chunk-7TDHT3QD.js +62 -0
- package/dist/chunk-7TDHT3QD.js.map +1 -0
- package/dist/chunk-AHM6SGEU.js +15 -0
- package/dist/chunk-AHM6SGEU.js.map +1 -0
- package/dist/chunk-AZ2VUAGX.js +3 -0
- package/dist/chunk-AZ2VUAGX.js.map +1 -0
- package/dist/{chunk-RIP5G47F.js → chunk-BE2LWUHY.js} +14 -12
- package/dist/chunk-BE2LWUHY.js.map +1 -0
- package/dist/{chunk-YW6Q6ERX.js → chunk-BNWQ7IAZ.js} +49 -56
- package/dist/chunk-BNWQ7IAZ.js.map +1 -0
- package/dist/{chunk-HCYULRWT.js → chunk-C4NFRSOR.js} +39 -35
- package/dist/chunk-C4NFRSOR.js.map +1 -0
- package/dist/chunk-C6NVU4F7.js +89 -0
- package/dist/chunk-C6NVU4F7.js.map +1 -0
- package/dist/chunk-CQ4M4BSF.js +12 -0
- package/dist/chunk-CQ4M4BSF.js.map +1 -0
- package/dist/chunk-D2QIPQ74.js +80 -0
- package/dist/chunk-D2QIPQ74.js.map +1 -0
- package/dist/chunk-DA4QII2N.js +104 -0
- package/dist/chunk-DA4QII2N.js.map +1 -0
- package/dist/chunk-DHM4IG2O.js +13 -0
- package/dist/chunk-DHM4IG2O.js.map +1 -0
- package/dist/chunk-DJLNGWMM.js +140 -0
- package/dist/chunk-DJLNGWMM.js.map +1 -0
- package/dist/chunk-DT6LKNZF.js +148 -0
- package/dist/chunk-DT6LKNZF.js.map +1 -0
- package/dist/chunk-E5H3YWZV.js +337 -0
- package/dist/chunk-E5H3YWZV.js.map +1 -0
- package/dist/{chunk-K5UWVH6P.js → chunk-E63VD25L.js} +36 -27
- package/dist/chunk-E63VD25L.js.map +1 -0
- package/dist/chunk-EIBDLRAR.js +30 -0
- package/dist/chunk-EIBDLRAR.js.map +1 -0
- package/dist/chunk-F342ZT7O.js +104 -0
- package/dist/chunk-F342ZT7O.js.map +1 -0
- package/dist/chunk-FUNTJZX7.js +217 -0
- package/dist/chunk-FUNTJZX7.js.map +1 -0
- package/dist/chunk-GIPQUKCN.js +44 -0
- package/dist/chunk-GIPQUKCN.js.map +1 -0
- package/dist/{chunk-IRXZHLUL.js → chunk-H3PYSAWN.js} +5 -5
- package/dist/chunk-H3PYSAWN.js.map +1 -0
- package/dist/{chunk-AIQG7IIT.js → chunk-H7WOMZXO.js} +10 -5
- package/dist/chunk-H7WOMZXO.js.map +1 -0
- package/dist/chunk-HBWV5EPU.js +31 -0
- package/dist/chunk-HBWV5EPU.js.map +1 -0
- package/dist/chunk-HC4XVBP2.js +118 -0
- package/dist/chunk-HC4XVBP2.js.map +1 -0
- package/dist/chunk-HDYORQZN.js +23 -0
- package/dist/chunk-HDYORQZN.js.map +1 -0
- package/dist/{chunk-4NNGTNPV.js → chunk-HRNWWL3Y.js} +49 -35
- package/dist/chunk-HRNWWL3Y.js.map +1 -0
- package/dist/chunk-HX3LNK26.js +193 -0
- package/dist/chunk-HX3LNK26.js.map +1 -0
- package/dist/chunk-IOYZC7SA.js +948 -0
- package/dist/chunk-IOYZC7SA.js.map +1 -0
- package/dist/{chunk-57BTVRRB.js → chunk-IPYHTCFL.js} +3 -3
- package/dist/{chunk-57BTVRRB.js.map → chunk-IPYHTCFL.js.map} +1 -1
- package/dist/chunk-J2WSKRJW.js +3 -0
- package/dist/chunk-J2WSKRJW.js.map +1 -0
- package/dist/chunk-J43LSYQO.js +14 -0
- package/dist/chunk-J43LSYQO.js.map +1 -0
- package/dist/chunk-JQJ23YQX.js +38 -0
- package/dist/chunk-JQJ23YQX.js.map +1 -0
- package/dist/{chunk-WJOHNCYY.js → chunk-JVG5ISPT.js} +38 -91
- package/dist/chunk-JVG5ISPT.js.map +1 -0
- package/dist/chunk-JYKP4RSG.js +304 -0
- package/dist/chunk-JYKP4RSG.js.map +1 -0
- package/dist/chunk-K6YASO4L.js +25 -0
- package/dist/chunk-K6YASO4L.js.map +1 -0
- package/dist/{chunk-GCGX4FEF.js → chunk-KMZENCEP.js} +28 -42
- package/dist/chunk-KMZENCEP.js.map +1 -0
- package/dist/{chunk-UJZIF2BA.js → chunk-LBAE6FP6.js} +41 -55
- package/dist/chunk-LBAE6FP6.js.map +1 -0
- package/dist/{chunk-YQHOKMSV.js → chunk-LKFHUDEW.js} +61 -54
- package/dist/chunk-LKFHUDEW.js.map +1 -0
- package/dist/{chunk-PINENGML.js → chunk-MKKQE3TM.js} +16 -9
- package/dist/chunk-MKKQE3TM.js.map +1 -0
- package/dist/{chunk-2SVX3MQQ.js → chunk-MW42XVPD.js} +3 -3
- package/dist/{chunk-2SVX3MQQ.js.map → chunk-MW42XVPD.js.map} +1 -1
- package/dist/{chunk-VZBUQNLX.js → chunk-MXAACRWE.js} +52 -41
- package/dist/chunk-MXAACRWE.js.map +1 -0
- package/dist/{chunk-OGJFDNIS.js → chunk-NJPHZBLI.js} +86 -55
- package/dist/chunk-NJPHZBLI.js.map +1 -0
- package/dist/{chunk-WSIVRDRB.js → chunk-NKOTA5TM.js} +4 -4
- package/dist/{chunk-WSIVRDRB.js.map → chunk-NKOTA5TM.js.map} +1 -1
- package/dist/{chunk-FOMR74VE.js → chunk-NLOBBJAA.js} +6 -6
- package/dist/chunk-NLOBBJAA.js.map +1 -0
- package/dist/{chunk-YWRBG23W.js → chunk-NS6RGPWR.js} +7 -4
- package/dist/chunk-NS6RGPWR.js.map +1 -0
- package/dist/{chunk-FAOBC4IS.js → chunk-O5W3QWJ6.js} +39 -29
- package/dist/chunk-O5W3QWJ6.js.map +1 -0
- package/dist/chunk-O7LS6OZR.js +309 -0
- package/dist/chunk-O7LS6OZR.js.map +1 -0
- package/dist/{chunk-BEL75C7N.js → chunk-PMUCGFY5.js} +6 -4
- package/dist/chunk-PMUCGFY5.js.map +1 -0
- package/dist/{chunk-Z43YWH4R.js → chunk-POKLPMSB.js} +48 -26
- package/dist/chunk-POKLPMSB.js.map +1 -0
- package/dist/chunk-QKSLDQM2.js +120 -0
- package/dist/chunk-QKSLDQM2.js.map +1 -0
- package/dist/chunk-QNKD2SQM.js +340 -0
- package/dist/chunk-QNKD2SQM.js.map +1 -0
- package/dist/{chunk-I4SQQIP5.js → chunk-R5LYFTHA.js} +2 -2
- package/dist/chunk-R5LYFTHA.js.map +1 -0
- package/dist/{chunk-64T6Z7BA.js → chunk-RCF7HTG5.js} +108 -96
- package/dist/chunk-RCF7HTG5.js.map +1 -0
- package/dist/{chunk-CTSO6V72.js → chunk-RLOWPCGG.js} +12 -6
- package/dist/chunk-RLOWPCGG.js.map +1 -0
- package/dist/chunk-RNRD6ER5.js +32 -0
- package/dist/chunk-RNRD6ER5.js.map +1 -0
- package/dist/chunk-SDVZFXQ2.js +21 -0
- package/dist/chunk-SDVZFXQ2.js.map +1 -0
- package/dist/{chunk-CZEKZ5HR.js → chunk-SVKN5ZHX.js} +33 -12
- package/dist/chunk-SVKN5ZHX.js.map +1 -0
- package/dist/{chunk-QIDAXFKK.js → chunk-SWVUXEBT.js} +53 -19
- package/dist/chunk-SWVUXEBT.js.map +1 -0
- package/dist/chunk-SXNAUSEB.js +62 -0
- package/dist/chunk-SXNAUSEB.js.map +1 -0
- package/dist/chunk-TCFB23JT.js +354 -0
- package/dist/chunk-TCFB23JT.js.map +1 -0
- package/dist/chunk-TWLJQE75.js +345 -0
- package/dist/chunk-TWLJQE75.js.map +1 -0
- package/dist/{chunk-CHTN5AHI.js → chunk-TWNIAF7K.js} +4 -4
- package/dist/chunk-TWNIAF7K.js.map +1 -0
- package/dist/chunk-UAYENYS2.js +293 -0
- package/dist/chunk-UAYENYS2.js.map +1 -0
- package/dist/chunk-UT3TOV2Q.js +93 -0
- package/dist/chunk-UT3TOV2Q.js.map +1 -0
- package/dist/{chunk-YKUCSV34.js → chunk-UXPINIDN.js} +8 -14
- package/dist/chunk-UXPINIDN.js.map +1 -0
- package/dist/{chunk-TBTSEPGP.js → chunk-VD6PB3VA.js} +10 -8
- package/dist/chunk-VD6PB3VA.js.map +1 -0
- package/dist/{chunk-2NNZHVKD.js → chunk-VTDBWU6H.js} +23 -19
- package/dist/chunk-VTDBWU6H.js.map +1 -0
- package/dist/chunk-WG3BCIU4.js +20 -0
- package/dist/chunk-WG3BCIU4.js.map +1 -0
- package/dist/chunk-XFEPUGUZ.js +15 -0
- package/dist/chunk-XFEPUGUZ.js.map +1 -0
- package/dist/{chunk-CSCVTESP.js → chunk-XKDL4QS6.js} +5 -12
- package/dist/chunk-XKDL4QS6.js.map +1 -0
- package/dist/chunk-XXOR34T4.js +10 -0
- package/dist/chunk-XXOR34T4.js.map +1 -0
- package/dist/chunk-Y57NW6G7.js +316 -0
- package/dist/chunk-Y57NW6G7.js.map +1 -0
- package/dist/chunk-ZYX564HO.js +27 -0
- package/dist/chunk-ZYX564HO.js.map +1 -0
- package/dist/colors.css +16 -8
- package/dist/components/accordion/accordion.d.ts +13 -4
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/accordion/index.d.ts.map +1 -1
- package/dist/components/accordion/index.js +28 -16
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +6 -5
- package/dist/components/alert/alert.d.ts +20 -8
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert/index.d.ts.map +1 -1
- package/dist/components/alert/index.js +23 -11
- package/dist/components/alert/index.js.map +1 -1
- package/dist/components/ambient-background/ambient-background.d.ts +13 -3
- package/dist/components/ambient-background/ambient-background.d.ts.map +1 -1
- package/dist/components/ambient-background/index.js +39 -28
- package/dist/components/ambient-background/index.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +68 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.d.ts +1 -1
- package/dist/components/app-shell/index.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +47 -19
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +39 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.d.ts.map +1 -0
- package/dist/components/aspect-ratio/index.js +33 -0
- package/dist/components/aspect-ratio/index.js.map +1 -0
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +17 -20
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +14 -2
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/avatar/index.d.ts.map +1 -1
- package/dist/components/avatar/index.js +27 -14
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/index.js +6 -100
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +21 -5
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.d.ts +1 -1
- package/dist/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +31 -7
- package/dist/components/breadcrumb/index.js.map +1 -1
- package/dist/components/button/button.d.ts +37 -16
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +6 -5
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-multi-select/index.js +11 -9
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +11 -9
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/calendar-body.d.ts +10 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +24 -7
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +11 -9
- package/dist/components/camera/camera-machine.d.ts +131 -0
- package/dist/components/camera/camera-machine.d.ts.map +1 -0
- package/dist/components/camera/camera.d.ts +230 -0
- package/dist/components/camera/camera.d.ts.map +1 -0
- package/dist/components/camera/fake-camera.d.ts +77 -0
- package/dist/components/camera/fake-camera.d.ts.map +1 -0
- package/dist/components/camera/index.d.ts +5 -0
- package/dist/components/camera/index.d.ts.map +1 -0
- package/dist/components/camera/index.js +38 -0
- package/dist/components/camera/index.js.map +1 -0
- package/dist/components/camera/platform.d.ts +21 -0
- package/dist/components/camera/platform.d.ts.map +1 -0
- package/dist/components/camera/use-camera.d.ts +98 -0
- package/dist/components/camera/use-camera.d.ts.map +1 -0
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/index.js +3 -2
- package/dist/components/carousel/carousel.d.ts +270 -0
- package/dist/components/carousel/carousel.d.ts.map +1 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.d.ts.map +1 -0
- package/dist/components/carousel/index.js +666 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/chart/chart.d.ts +20 -2
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/chart/index.js +12 -2
- package/dist/components/chart/index.js.map +1 -1
- package/dist/components/chart/styles.css +12 -10
- package/dist/components/checkbox/checkbox.d.ts +8 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +8 -6
- package/dist/components/choice-card-group/choice-card-group.d.ts +1 -1
- package/dist/components/choice-card-group/choice-card-group.d.ts.map +1 -1
- package/dist/components/choice-card-group/index.js +51 -49
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +9 -1
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +13 -2
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/clipboard.d.ts +17 -8
- package/dist/components/clipboard/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard/copy.d.ts +19 -5
- package/dist/components/clipboard/copy.d.ts.map +1 -1
- package/dist/components/clipboard/index.d.ts +1 -1
- package/dist/components/clipboard/index.d.ts.map +1 -1
- package/dist/components/clipboard/index.js +61 -24
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +4 -3
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.d.ts +10 -9
- package/dist/components/code-block/chrome.d.ts.map +1 -1
- package/dist/components/code-block/chrome.js +11 -9
- package/dist/components/code-block/code-block.d.ts +6 -11
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/index.d.ts +2 -2
- package/dist/components/code-block/index.d.ts.map +1 -1
- package/dist/components/code-block/index.js +12 -10
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/code-block/static.d.ts +3 -5
- package/dist/components/code-block/static.d.ts.map +1 -1
- package/dist/components/code-block/static.js +4 -1
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/collapse/index.js +3 -3
- package/dist/components/combobox/combobox.d.ts +2 -2
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +11 -9
- package/dist/components/combobox-list/combobox-list.d.ts +10 -2
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/combobox-search-row.d.ts +31 -0
- package/dist/components/combobox-list/combobox-search-row.d.ts.map +1 -0
- package/dist/components/combobox-list/index.d.ts +1 -1
- package/dist/components/combobox-list/index.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -11
- package/dist/components/compare/compare.d.ts +45 -0
- package/dist/components/compare/compare.d.ts.map +1 -0
- package/dist/components/compare/index.d.ts +2 -0
- package/dist/components/compare/index.d.ts.map +1 -0
- package/dist/components/compare/index.js +206 -0
- package/dist/components/compare/index.js.map +1 -0
- package/dist/components/container/container.d.ts +7 -1
- package/dist/components/container/container.d.ts.map +1 -1
- package/dist/components/container/index.js +1 -1
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/data-table/data-table-filter/data-table-date-filter.d.ts +13 -12
- package/dist/components/data-table/data-table-filter/data-table-date-filter.d.ts.map +1 -1
- package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts +4 -1
- package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts.map +1 -1
- package/dist/components/data-table/data-table-filter/index.d.ts +8 -4
- package/dist/components/data-table/data-table-filter/index.d.ts.map +1 -1
- package/dist/components/data-table/data-table-header-cell.d.ts +6 -9
- package/dist/components/data-table/data-table-header-cell.d.ts.map +1 -1
- package/dist/components/data-table/data-table-icons.d.ts +27 -0
- package/dist/components/data-table/data-table-icons.d.ts.map +1 -0
- package/dist/components/data-table/data-table-pagination.d.ts +18 -3
- package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts +5 -2
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table-state.d.ts.map +1 -1
- package/dist/components/data-table/data-table-toolbar.d.ts +7 -2
- package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
- package/dist/components/data-table/data-table-translations.d.ts +11 -2
- package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +12 -1
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.d.ts +1 -0
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +282 -199
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +7 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +15 -6
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-time-text.d.ts +2 -2
- package/dist/components/date-picker/date-time-text.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +1 -1
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +24 -21
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/divider/divider.d.ts +12 -3
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/index.js +3 -2
- package/dist/components/download-button/download-button.d.ts +69 -0
- package/dist/components/download-button/download-button.d.ts.map +1 -0
- package/dist/components/download-button/index.d.ts +2 -0
- package/dist/components/download-button/index.d.ts.map +1 -0
- package/dist/components/download-button/index.js +13 -0
- package/dist/components/download-button/index.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +79 -44
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/index.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -7
- package/dist/components/field/field.d.ts +8 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +3 -2
- package/dist/components/figure/figure.d.ts +27 -0
- package/dist/components/figure/figure.d.ts.map +1 -0
- package/dist/components/figure/index.d.ts +2 -0
- package/dist/components/figure/index.d.ts.map +1 -0
- package/dist/components/figure/index.js +7 -0
- package/dist/components/figure/index.js.map +1 -0
- package/dist/components/file-item/file-item.d.ts +178 -0
- package/dist/components/file-item/file-item.d.ts.map +1 -0
- package/dist/components/file-item/index.d.ts +2 -0
- package/dist/components/file-item/index.d.ts.map +1 -0
- package/dist/components/file-item/index.js +25 -0
- package/dist/components/file-item/index.js.map +1 -0
- package/dist/components/file-preview/file-preview.d.ts +189 -0
- package/dist/components/file-preview/file-preview.d.ts.map +1 -0
- package/dist/components/file-preview/index.d.ts +2 -0
- package/dist/components/file-preview/index.d.ts.map +1 -0
- package/dist/components/file-preview/index.js +572 -0
- package/dist/components/file-preview/index.js.map +1 -0
- package/dist/components/file-queue-summary/file-queue-summary.d.ts +35 -0
- package/dist/components/file-queue-summary/file-queue-summary.d.ts.map +1 -0
- package/dist/components/file-queue-summary/index.d.ts +3 -0
- package/dist/components/file-queue-summary/index.d.ts.map +1 -0
- package/dist/components/file-queue-summary/index.js +7 -0
- package/dist/components/file-queue-summary/index.js.map +1 -0
- package/dist/components/file-trigger/file-trigger.d.ts +40 -0
- package/dist/components/file-trigger/file-trigger.d.ts.map +1 -0
- package/dist/components/file-trigger/index.d.ts +2 -0
- package/dist/components/file-trigger/index.d.ts.map +1 -0
- package/dist/components/file-trigger/index.js +11 -0
- package/dist/components/file-trigger/index.js.map +1 -0
- package/dist/components/file-upload/file-upload.d.ts +102 -14
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.d.ts +1 -1
- package/dist/components/file-upload/index.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +206 -102
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/flex/flex.d.ts +14 -2
- package/dist/components/flex/flex.d.ts.map +1 -1
- package/dist/components/flex/index.js +3 -2
- package/dist/components/gallery/gallery.d.ts +77 -0
- package/dist/components/gallery/gallery.d.ts.map +1 -0
- package/dist/components/gallery/index.d.ts +3 -0
- package/dist/components/gallery/index.d.ts.map +1 -0
- package/dist/components/gallery/index.js +272 -0
- package/dist/components/gallery/index.js.map +1 -0
- package/dist/components/gallery/layout.d.ts +96 -0
- package/dist/components/gallery/layout.d.ts.map +1 -0
- package/dist/components/grid/grid.d.ts +7 -1
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/grid/index.js +3 -11
- package/dist/components/grid/index.js.map +1 -1
- package/dist/components/hover-card/index.js +5 -4
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/blur-svg.d.ts +11 -0
- package/dist/components/image/blur-svg.d.ts.map +1 -0
- package/dist/components/image/image.d.ts +126 -0
- package/dist/components/image/image.d.ts.map +1 -0
- package/dist/components/image/index.d.ts +3 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +12 -0
- package/dist/components/image/index.js.map +1 -0
- package/dist/components/image/srcset.d.ts +47 -0
- package/dist/components/image/srcset.d.ts.map +1 -0
- package/dist/components/image-cropper/image-cropper.d.ts +208 -0
- package/dist/components/image-cropper/image-cropper.d.ts.map +1 -0
- package/dist/components/image-cropper/index.d.ts +2 -0
- package/dist/components/image-cropper/index.d.ts.map +1 -0
- package/dist/components/image-cropper/index.js +22 -0
- package/dist/components/image-cropper/index.js.map +1 -0
- package/dist/components/indicator/index.js +11 -4
- package/dist/components/indicator/index.js.map +1 -1
- package/dist/components/indicator/indicator.d.ts +21 -8
- package/dist/components/indicator/indicator.d.ts.map +1 -1
- package/dist/components/input/index.js +4 -3
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.d.ts +1 -0
- package/dist/components/kbd/index.d.ts.map +1 -1
- package/dist/components/kbd/index.js +10 -78
- package/dist/components/kbd/index.js.map +1 -1
- package/dist/components/kbd/kbd.d.ts +45 -3
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.d.ts +2 -0
- package/dist/components/lightbox/index.d.ts.map +1 -0
- package/dist/components/lightbox/index.js +1922 -0
- package/dist/components/lightbox/index.js.map +1 -0
- package/dist/components/lightbox/lightbox-controller.d.ts +97 -0
- package/dist/components/lightbox/lightbox-controller.d.ts.map +1 -0
- package/dist/components/lightbox/lightbox-machine.d.ts +165 -0
- package/dist/components/lightbox/lightbox-machine.d.ts.map +1 -0
- package/dist/components/lightbox/lightbox-zoom.d.ts +72 -0
- package/dist/components/lightbox/lightbox-zoom.d.ts.map +1 -0
- package/dist/components/lightbox/lightbox.d.ts +297 -0
- package/dist/components/lightbox/lightbox.d.ts.map +1 -0
- package/dist/components/mark/index.js +2 -2
- package/dist/components/mark/mark.d.ts.map +1 -1
- package/dist/components/menu/index.d.ts +1 -1
- package/dist/components/menu/index.d.ts.map +1 -1
- package/dist/components/menu/index.js +13 -7
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu-data.d.ts +5 -8
- package/dist/components/menu/menu-data.d.ts.map +1 -1
- package/dist/components/menu/menu.d.ts +40 -18
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/index.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -7
- package/dist/components/modal/modal.d.ts +25 -19
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.d.ts +1 -1
- package/dist/components/multi-combobox-list/index.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +16 -13
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +10 -2
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +26 -20
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +5 -2
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +10 -7
- package/dist/components/nav-link/nav-link.d.ts +5 -2
- package/dist/components/nav-link/nav-link.d.ts.map +1 -1
- package/dist/components/nav-link/navigation.d.ts +8 -1
- package/dist/components/nav-link/navigation.d.ts.map +1 -1
- package/dist/components/nav-link/tanstack.js +10 -7
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/notification/create-notifier.d.ts +4 -1
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.d.ts +1 -1
- package/dist/components/notification/index.d.ts.map +1 -1
- package/dist/components/notification/index.js +60 -22
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +41 -11
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/number-input/index.d.ts +1 -1
- package/dist/components/number-input/index.d.ts.map +1 -1
- package/dist/components/number-input/index.js +11 -9
- package/dist/components/number-input/number-input.d.ts +9 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/create-overlays.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +59 -0
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -0
- package/dist/components/overlays/index.js +29 -32
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/overlays/renderer.d.ts.map +1 -1
- package/dist/components/overlays/store.d.ts.map +1 -1
- package/dist/components/password-input/index.d.ts +1 -1
- package/dist/components/password-input/index.d.ts.map +1 -1
- package/dist/components/password-input/index.js +14 -6
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +10 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.d.ts +4 -0
- package/dist/components/photo-capture/index.d.ts.map +1 -0
- package/dist/components/photo-capture/index.js +519 -0
- package/dist/components/photo-capture/index.js.map +1 -0
- package/dist/components/photo-capture/photo-capture-machine.d.ts +74 -0
- package/dist/components/photo-capture/photo-capture-machine.d.ts.map +1 -0
- package/dist/components/photo-capture/photo-capture.d.ts +192 -0
- package/dist/components/photo-capture/photo-capture.d.ts.map +1 -0
- package/dist/components/photo-capture/use-photo-capture.d.ts +92 -0
- package/dist/components/photo-capture/use-photo-capture.d.ts.map +1 -0
- package/dist/components/pill/index.js +6 -4
- package/dist/components/pill/pill.d.ts +4 -3
- package/dist/components/pill/pill.d.ts.map +1 -1
- package/dist/components/pills-input/index.d.ts +1 -1
- package/dist/components/pills-input/index.d.ts.map +1 -1
- package/dist/components/pills-input/index.js +13 -7
- package/dist/components/pills-input/pills-input.d.ts +29 -10
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.d.ts +1 -1
- package/dist/components/pin-input/index.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +40 -13
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts +14 -2
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/icons.d.ts +9 -4
- package/dist/components/popover/icons.d.ts.map +1 -1
- package/dist/components/popover/index.js +5 -4
- package/dist/components/popover/popover.d.ts +12 -8
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -109
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/progress.d.ts +9 -1
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/radio-group/index.js +12 -6
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts +3 -3
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/icons.d.ts +0 -10
- package/dist/components/rating/icons.d.ts.map +1 -1
- package/dist/components/rating/index.d.ts +1 -1
- package/dist/components/rating/index.d.ts.map +1 -1
- package/dist/components/rating/index.js +17 -7
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts +18 -8
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.d.ts +6 -23
- package/dist/components/schedule/index.d.ts.map +1 -1
- package/dist/components/schedule/index.js +3315 -2730
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/schedule/now-cursor-line.d.ts +11 -3
- package/dist/components/schedule/now-cursor-line.d.ts.map +1 -1
- package/dist/components/schedule/schedule-agenda-list.d.ts +1 -1
- package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -1
- package/dist/components/schedule/schedule-agenda-view.d.ts +3 -4
- package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-all-day-row.d.ts +3 -1
- package/dist/components/schedule/schedule-all-day-row.d.ts.map +1 -1
- package/dist/components/schedule/schedule-create-draft.d.ts.map +1 -1
- package/dist/components/schedule/schedule-dates.d.ts +42 -19
- package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
- package/dist/components/schedule/schedule-day-column.d.ts +111 -0
- package/dist/components/schedule/schedule-day-column.d.ts.map +1 -0
- package/dist/components/schedule/schedule-days-view.d.ts +2 -2
- package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-chip.d.ts +31 -2
- package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-details-popover.d.ts +57 -0
- package/dist/components/schedule/schedule-event-details-popover.d.ts.map +1 -0
- package/dist/components/schedule/schedule-event-details.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-list-popover-content.d.ts +4 -1
- package/dist/components/schedule/schedule-event-list-popover-content.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-pill.d.ts +68 -0
- package/dist/components/schedule/schedule-event-pill.d.ts.map +1 -0
- package/dist/components/schedule/schedule-event-styles.d.ts +54 -0
- package/dist/components/schedule/schedule-event-styles.d.ts.map +1 -1
- package/dist/components/schedule/schedule-geometry.d.ts +10 -8
- package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
- package/dist/components/schedule/schedule-grid-gesture.d.ts +24 -2
- package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
- package/dist/components/schedule/schedule-icons.d.ts +20 -0
- package/dist/components/schedule/schedule-icons.d.ts.map +1 -0
- package/dist/components/schedule/schedule-month-view.d.ts +1 -1
- package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-overflow-chip.d.ts +4 -2
- package/dist/components/schedule/schedule-overflow-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-overflow-popover.d.ts +4 -1
- package/dist/components/schedule/schedule-overflow-popover.d.ts.map +1 -1
- package/dist/components/schedule/schedule-slot-cursor.d.ts +36 -0
- package/dist/components/schedule/schedule-slot-cursor.d.ts.map +1 -0
- package/dist/components/schedule/schedule-timed-grid-chrome.d.ts +86 -0
- package/dist/components/schedule/schedule-timed-grid-chrome.d.ts.map +1 -0
- package/dist/components/schedule/schedule-timed-grid.d.ts +3 -1
- package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts +33 -10
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +103 -15
- package/dist/components/schedule/schedule-types.d.ts.map +1 -1
- package/dist/components/schedule/schedule-view-pagination-chrome.d.ts +36 -0
- package/dist/components/schedule/schedule-view-pagination-chrome.d.ts.map +1 -0
- package/dist/components/schedule/schedule-year-view.d.ts +1 -1
- package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule.d.ts +0 -18
- package/dist/components/schedule/schedule.d.ts.map +1 -1
- package/dist/components/schedule/use-chip-keyboard-move.d.ts +45 -0
- package/dist/components/schedule/use-chip-keyboard-move.d.ts.map +1 -0
- package/dist/components/schedule/use-chip-motion.d.ts +28 -0
- package/dist/components/schedule/use-chip-motion.d.ts.map +1 -0
- package/dist/components/schedule/use-date-grid-navigation.d.ts +59 -0
- package/dist/components/schedule/use-date-grid-navigation.d.ts.map +1 -0
- package/dist/components/schedule/use-event-drag.d.ts.map +1 -1
- package/dist/components/schedule/use-event-resize.d.ts +10 -2
- package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
- package/dist/components/schedule/use-schedule-reveal.d.ts +29 -0
- package/dist/components/schedule/use-schedule-reveal.d.ts.map +1 -0
- package/dist/components/schedule/use-schedule-selection.d.ts +3 -1
- package/dist/components/schedule/use-schedule-selection.d.ts.map +1 -1
- package/dist/components/schedule/use-timed-grid-announcer.d.ts +21 -0
- package/dist/components/schedule/use-timed-grid-announcer.d.ts.map +1 -0
- package/dist/components/schedule/use-timed-grid-paging.d.ts +36 -0
- package/dist/components/schedule/use-timed-grid-paging.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +9 -7
- package/dist/components/segment-group/segment-group.d.ts +1 -1
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +14 -12
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/skeleton/index.js +3 -2
- package/dist/components/slider/index.js +6 -256
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/slider.d.ts +18 -10
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/spinner/index.js +3 -2
- package/dist/components/spinner/spinner.d.ts +7 -36
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spotlight/context.d.ts +50 -0
- package/dist/components/spotlight/context.d.ts.map +1 -0
- package/dist/components/spotlight/create-spotlight.d.ts +193 -0
- package/dist/components/spotlight/create-spotlight.d.ts.map +1 -0
- package/dist/components/spotlight/highlight.d.ts +23 -0
- package/dist/components/spotlight/highlight.d.ts.map +1 -0
- package/dist/components/spotlight/icons.d.ts +14 -0
- package/dist/components/spotlight/icons.d.ts.map +1 -0
- package/dist/components/spotlight/index.d.ts +12 -0
- package/dist/components/spotlight/index.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +1695 -0
- package/dist/components/spotlight/index.js.map +1 -0
- package/dist/components/spotlight/label.d.ts +9 -0
- package/dist/components/spotlight/label.d.ts.map +1 -0
- package/dist/components/spotlight/recents.d.ts +29 -0
- package/dist/components/spotlight/recents.d.ts.map +1 -0
- package/dist/components/spotlight/spotlight-engine.d.ts +86 -0
- package/dist/components/spotlight/spotlight-engine.d.ts.map +1 -0
- package/dist/components/spotlight/spotlight.d.ts +233 -0
- package/dist/components/spotlight/spotlight.d.ts.map +1 -0
- package/dist/components/spotlight/static-source.d.ts +32 -0
- package/dist/components/spotlight/static-source.d.ts.map +1 -0
- package/dist/components/spotlight/store.d.ts +39 -0
- package/dist/components/spotlight/store.d.ts.map +1 -0
- package/dist/components/spotlight/translations.d.ts +90 -0
- package/dist/components/spotlight/translations.d.ts.map +1 -0
- package/dist/components/spotlight/types.d.ts +297 -0
- package/dist/components/spotlight/types.d.ts.map +1 -0
- package/dist/components/spotlight/view.d.ts +139 -0
- package/dist/components/spotlight/view.d.ts.map +1 -0
- package/dist/components/switch/index.js +8 -7
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts +3 -2
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table/index.js +4 -2
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/tabs/index.js +6 -5
- package/dist/components/tabs/tabs-data.d.ts +6 -2
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tabs/tabs.d.ts +55 -34
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +42 -25
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +12 -5
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text/index.js +3 -3
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/text-input/index.js +4 -3
- package/dist/components/text-input/index.js.map +1 -1
- package/dist/components/textarea/index.js +4 -3
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/theme-icon/index.js +3 -3
- package/dist/components/theme-script/index.js.map +1 -1
- package/dist/components/theme-script/theme-script.d.ts +2 -2
- package/dist/components/theme-script/theme-script.d.ts.map +1 -1
- package/dist/components/time-input/hour-cycle.d.ts +17 -7
- package/dist/components/time-input/hour-cycle.d.ts.map +1 -1
- package/dist/components/time-input/index.js +22 -21
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/time-input/time-input.d.ts +2 -1
- package/dist/components/time-input/time-input.d.ts.map +1 -1
- package/dist/components/time-input/time-row.d.ts +20 -1
- package/dist/components/time-input/time-row.d.ts.map +1 -1
- package/dist/components/timeline/index.d.ts +1 -1
- package/dist/components/timeline/index.d.ts.map +1 -1
- package/dist/components/timeline/index.js +44 -31
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts +16 -2
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/title/index.js +3 -3
- package/dist/components/title/title.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +4 -3
- package/dist/components/tooltip/tooltip.d.ts +6 -4
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.d.ts +1 -1
- package/dist/components/tree-multi-select/index.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +112 -248
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +12 -5
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.d.ts +1 -1
- package/dist/components/tree-select/index.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +105 -321
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +126 -0
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -0
- package/dist/components/tree-select/tree-select.d.ts +24 -2
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +60 -113
- package/dist/index.js.map +1 -1
- package/dist/lib/as-child.d.ts +1 -1
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +1 -1
- package/dist/lib/cutout.d.ts +34 -0
- package/dist/lib/cutout.d.ts.map +1 -0
- package/dist/lib/dev-warn.d.ts +11 -0
- package/dist/lib/dev-warn.d.ts.map +1 -1
- package/dist/lib/file-kind-icons.d.ts +5 -0
- package/dist/lib/file-kind-icons.d.ts.map +1 -0
- package/dist/lib/file-queue-summary.d.ts +89 -0
- package/dist/lib/file-queue-summary.d.ts.map +1 -0
- package/dist/lib/file-queue.d.ts +147 -0
- package/dist/lib/file-queue.d.ts.map +1 -0
- package/dist/lib/files.d.ts +29 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/focus-styles.d.ts +46 -7
- package/dist/lib/focus-styles.d.ts.map +1 -1
- package/dist/lib/gap.d.ts +17 -0
- package/dist/lib/gap.d.ts.map +1 -0
- package/dist/lib/graphemes.d.ts +10 -0
- package/dist/lib/graphemes.d.ts.map +1 -0
- package/dist/lib/icons.d.ts +34 -0
- package/dist/lib/icons.d.ts.map +1 -0
- package/dist/lib/image-file.d.ts +9 -0
- package/dist/lib/image-file.d.ts.map +1 -0
- package/dist/lib/merge-refs.d.ts +34 -7
- package/dist/lib/merge-refs.d.ts.map +1 -1
- package/dist/lib/motion/animate.d.ts +42 -0
- package/dist/lib/motion/animate.d.ts.map +1 -0
- package/dist/lib/motion/easing.d.ts +33 -0
- package/dist/lib/motion/easing.d.ts.map +1 -0
- package/dist/lib/motion/gesture.d.ts +127 -0
- package/dist/lib/motion/gesture.d.ts.map +1 -0
- package/dist/lib/motion/morph.d.ts +61 -0
- package/dist/lib/motion/morph.d.ts.map +1 -0
- package/dist/lib/motion/physics.d.ts +44 -0
- package/dist/lib/motion/physics.d.ts.map +1 -0
- package/dist/lib/motion/rect.d.ts +39 -0
- package/dist/lib/motion/rect.d.ts.map +1 -0
- package/dist/lib/motion/reduced-motion.d.ts +23 -0
- package/dist/lib/motion/reduced-motion.d.ts.map +1 -0
- package/dist/lib/motion/spring.d.ts +80 -0
- package/dist/lib/motion/spring.d.ts.map +1 -0
- package/dist/lib/motion/tokens.d.ts +43 -0
- package/dist/lib/motion/tokens.d.ts.map +1 -0
- package/dist/lib/motion/use-gesture.d.ts +36 -0
- package/dist/lib/motion/use-gesture.d.ts.map +1 -0
- package/dist/lib/open-file.d.ts +82 -0
- package/dist/lib/open-file.d.ts.map +1 -0
- package/dist/lib/open-index.d.ts +59 -0
- package/dist/lib/open-index.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +15 -1
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/radius.d.ts +17 -0
- package/dist/lib/radius.d.ts.map +1 -0
- package/dist/lib/ratio.d.ts +16 -0
- package/dist/lib/ratio.d.ts.map +1 -0
- package/dist/lib/save-file.d.ts +52 -0
- package/dist/lib/save-file.d.ts.map +1 -0
- package/dist/lib/select-data.d.ts +57 -24
- package/dist/lib/select-data.d.ts.map +1 -1
- package/dist/lib/tree-data.d.ts +7 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/typography-size.d.ts +27 -8
- package/dist/lib/typography-size.d.ts.map +1 -1
- package/dist/lib/use-debounced.d.ts +17 -0
- package/dist/lib/use-debounced.d.ts.map +1 -0
- package/dist/lib/use-disclosure.d.ts.map +1 -1
- package/dist/lib/use-document-visibility.d.ts +16 -0
- package/dist/lib/use-document-visibility.d.ts.map +1 -0
- package/dist/lib/use-element-size.d.ts +42 -0
- package/dist/lib/use-element-size.d.ts.map +1 -0
- package/dist/lib/use-file-queue.d.ts +62 -0
- package/dist/lib/use-file-queue.d.ts.map +1 -0
- package/dist/lib/use-hotkey.d.ts +240 -0
- package/dist/lib/use-hotkey.d.ts.map +1 -0
- package/dist/lib/use-hydrated.d.ts +16 -0
- package/dist/lib/use-hydrated.d.ts.map +1 -0
- package/dist/lib/use-in-view.d.ts +37 -0
- package/dist/lib/use-in-view.d.ts.map +1 -0
- package/dist/lib/use-now.d.ts +34 -3
- package/dist/lib/use-now.d.ts.map +1 -1
- package/dist/lib/use-object-url.d.ts +61 -0
- package/dist/lib/use-object-url.d.ts.map +1 -0
- package/dist/lib/use-uncontrolled.d.ts.map +1 -1
- package/dist/theme.css +184 -16
- package/package.json +4 -2
- package/src/as-child.contract.test.tsx +221 -6
- package/src/biome-plugins.test.ts +34 -4
- package/src/colors.css +16 -8
- package/src/components/accordion/accordion.test.tsx +45 -2
- package/src/components/accordion/accordion.tsx +38 -17
- package/src/components/accordion/index.ts +2 -0
- package/src/components/action-icon/action-icon.tsx +8 -6
- package/src/components/alert/alert.test.tsx +49 -2
- package/src/components/alert/alert.tsx +47 -14
- package/src/components/alert/index.ts +8 -1
- package/src/components/ambient-background/ambient-background.test.tsx +21 -7
- package/src/components/ambient-background/ambient-background.tsx +49 -28
- package/src/components/app-shell/app-shell.test.tsx +58 -8
- package/src/components/app-shell/app-shell.tsx +69 -17
- package/src/components/app-shell/index.ts +2 -0
- package/src/components/aspect-ratio/aspect-ratio.test.tsx +82 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +63 -0
- package/src/components/aspect-ratio/index.ts +1 -0
- package/src/components/autocomplete/autocomplete.tsx +9 -14
- package/src/components/avatar/avatar.test.tsx +101 -2
- package/src/components/avatar/avatar.tsx +65 -15
- package/src/components/avatar/index.ts +2 -0
- package/src/components/badge/badge.tsx +3 -1
- package/src/components/breadcrumb/breadcrumb.test.tsx +46 -0
- package/src/components/breadcrumb/breadcrumb.tsx +51 -10
- package/src/components/breadcrumb/index.ts +2 -0
- package/src/components/button/button.test.tsx +65 -12
- package/src/components/button/button.tsx +119 -29
- package/src/components/button-select/button-select.tsx +1 -2
- package/src/components/calendar/calendar-body.tsx +42 -28
- package/src/components/calendar/calendar.test.tsx +89 -0
- package/src/components/calendar/calendar.tsx +42 -4
- package/src/components/calendar/index.ts +2 -0
- package/src/components/camera/camera-machine.test.ts +188 -0
- package/src/components/camera/camera-machine.ts +274 -0
- package/src/components/camera/camera.test.tsx +580 -0
- package/src/components/camera/camera.tsx +938 -0
- package/src/components/camera/fake-camera.ts +153 -0
- package/src/components/camera/index.ts +36 -0
- package/src/components/camera/platform.test.ts +40 -0
- package/src/components/camera/platform.ts +53 -0
- package/src/components/camera/use-camera.ts +428 -0
- package/src/components/card/card.test.tsx +80 -0
- package/src/components/card/card.tsx +9 -3
- package/src/components/carousel/carousel.test.tsx +757 -0
- package/src/components/carousel/carousel.tsx +1115 -0
- package/src/components/carousel/index.ts +24 -0
- package/src/components/chart/chart.test.tsx +26 -0
- package/src/components/chart/chart.tsx +33 -3
- package/src/components/chart/styles.css +12 -10
- package/src/components/checkbox/checkbox.test.tsx +38 -1
- package/src/components/checkbox/checkbox.tsx +34 -10
- package/src/components/checkbox/control.ts +3 -3
- package/src/components/checkbox/index.ts +6 -1
- package/src/components/choice-card-group/choice-card-group.test.tsx +18 -0
- package/src/components/choice-card-group/choice-card-group.tsx +78 -58
- package/src/components/circular-progress/circular-progress.test.tsx +24 -5
- package/src/components/circular-progress/circular-progress.tsx +26 -3
- package/src/components/clipboard/clipboard.test.tsx +64 -5
- package/src/components/clipboard/clipboard.tsx +62 -16
- package/src/components/clipboard/copy.tsx +35 -20
- package/src/components/clipboard/index.ts +7 -1
- package/src/components/code/code.test.tsx +1 -1
- package/src/components/code/code.tsx +2 -1
- package/src/components/code-block/chrome.tsx +49 -53
- package/src/components/code-block/code-block.test.tsx +34 -13
- package/src/components/code-block/code-block.tsx +8 -9
- package/src/components/code-block/index.ts +4 -0
- package/src/components/code-block/static.tsx +8 -5
- package/src/components/combobox/combobox.tsx +14 -6
- package/src/components/combobox-list/combobox-list.test.tsx +54 -0
- package/src/components/combobox-list/combobox-list.tsx +57 -61
- package/src/components/combobox-list/combobox-search-row.tsx +92 -0
- package/src/components/combobox-list/index.ts +2 -0
- package/src/components/compare/compare.test.tsx +291 -0
- package/src/components/compare/compare.tsx +300 -0
- package/src/components/compare/index.ts +3 -0
- package/src/components/container/container.test.tsx +47 -0
- package/src/components/container/container.tsx +8 -2
- package/src/components/data-table/data-table-filter/data-table-date-filter.tsx +24 -18
- package/src/components/data-table/data-table-filter/data-table-number-filter.tsx +6 -3
- package/src/components/data-table/data-table-filter/index.tsx +34 -9
- package/src/components/data-table/data-table-filter.test.tsx +72 -0
- package/src/components/data-table/data-table-header-cell.tsx +75 -68
- package/src/components/data-table/data-table-icons.tsx +79 -0
- package/src/components/data-table/data-table-pagination.tsx +55 -19
- package/src/components/data-table/data-table-placeholder.tsx +2 -2
- package/src/components/data-table/data-table-stack.tsx +19 -25
- package/src/components/data-table/data-table-state.ts +4 -5
- package/src/components/data-table/data-table-toolbar.tsx +10 -3
- package/src/components/data-table/data-table-translations.ts +15 -3
- package/src/components/data-table/data-table.test.tsx +300 -13
- package/src/components/data-table/data-table.tsx +54 -21
- package/src/components/data-table/index.ts +5 -0
- package/src/components/date-picker/aliases.tsx +8 -0
- package/src/components/date-picker/date-picker.test.tsx +75 -0
- package/src/components/date-picker/date-picker.tsx +102 -51
- package/src/components/date-picker/date-time-text.test.ts +9 -0
- package/src/components/date-picker/date-time-text.ts +12 -4
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/divider/divider.test.tsx +34 -5
- package/src/components/divider/divider.tsx +23 -6
- package/src/components/download-button/download-button.test.tsx +253 -0
- package/src/components/download-button/download-button.tsx +236 -0
- package/src/components/download-button/index.ts +11 -0
- package/src/components/drawer/drawer.test.tsx +287 -0
- package/src/components/drawer/drawer.tsx +238 -172
- package/src/components/drawer/index.ts +4 -11
- package/src/components/field/field.test.tsx +115 -0
- package/src/components/field/field.tsx +13 -4
- package/src/components/figure/figure.test.tsx +133 -0
- package/src/components/figure/figure.tsx +137 -0
- package/src/components/figure/index.ts +6 -0
- package/src/components/file-item/file-item.test.tsx +395 -0
- package/src/components/file-item/file-item.tsx +625 -0
- package/src/components/file-item/index.ts +22 -0
- package/src/components/file-preview/file-preview.test.tsx +479 -0
- package/src/components/file-preview/file-preview.tsx +953 -0
- package/src/components/file-preview/index.ts +22 -0
- package/src/components/file-queue-summary/file-queue-summary.test.tsx +285 -0
- package/src/components/file-queue-summary/file-queue-summary.tsx +121 -0
- package/src/components/file-queue-summary/index.ts +12 -0
- package/src/components/file-trigger/file-trigger.test.tsx +138 -0
- package/src/components/file-trigger/file-trigger.tsx +135 -0
- package/src/components/file-trigger/index.ts +3 -0
- package/src/components/file-upload/file-upload.test.tsx +416 -2
- package/src/components/file-upload/file-upload.tsx +391 -136
- package/src/components/file-upload/index.ts +11 -1
- package/src/components/flex/flex.test.tsx +15 -0
- package/src/components/flex/flex.tsx +20 -12
- package/src/components/gallery/gallery.test.tsx +436 -0
- package/src/components/gallery/gallery.tsx +367 -0
- package/src/components/gallery/index.ts +16 -0
- package/src/components/gallery/layout.test.ts +158 -0
- package/src/components/gallery/layout.ts +168 -0
- package/src/components/grid/grid.test.tsx +46 -0
- package/src/components/grid/grid.tsx +11 -11
- package/src/components/image/blur-svg.ts +54 -0
- package/src/components/image/image.test.tsx +481 -0
- package/src/components/image/image.tsx +424 -0
- package/src/components/image/index.ts +14 -0
- package/src/components/image/srcset.test.ts +73 -0
- package/src/components/image/srcset.ts +70 -0
- package/src/components/image-cropper/image-cropper.test.tsx +446 -0
- package/src/components/image-cropper/image-cropper.tsx +745 -0
- package/src/components/image-cropper/index.ts +24 -0
- package/src/components/indicator/indicator.test.tsx +73 -6
- package/src/components/indicator/indicator.tsx +38 -10
- package/src/components/input/input.tsx +6 -5
- package/src/components/kbd/index.ts +6 -0
- package/src/components/kbd/kbd.test.tsx +239 -2
- package/src/components/kbd/kbd.tsx +130 -6
- package/src/components/lightbox/index.ts +25 -0
- package/src/components/lightbox/lightbox-controller.ts +796 -0
- package/src/components/lightbox/lightbox-machine.test.ts +460 -0
- package/src/components/lightbox/lightbox-machine.ts +285 -0
- package/src/components/lightbox/lightbox-zoom.test.ts +130 -0
- package/src/components/lightbox/lightbox-zoom.ts +142 -0
- package/src/components/lightbox/lightbox.test.tsx +821 -0
- package/src/components/lightbox/lightbox.tsx +1301 -0
- package/src/components/mark/mark.test.tsx +21 -2
- package/src/components/mark/mark.tsx +15 -1
- package/src/components/menu/index.ts +4 -0
- package/src/components/menu/menu-data.tsx +20 -17
- package/src/components/menu/menu.test.tsx +123 -19
- package/src/components/menu/menu.tsx +150 -102
- package/src/components/modal/close-trigger.test.tsx +49 -0
- package/src/components/modal/index.ts +2 -0
- package/src/components/modal/modal.test.tsx +101 -0
- package/src/components/modal/modal.tsx +64 -103
- package/src/components/multi-combobox-list/index.ts +2 -0
- package/src/components/multi-combobox-list/multi-combobox-list.test.tsx +45 -0
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +45 -62
- package/src/components/multi-select/multi-select.test.tsx +10 -2
- package/src/components/multi-select/multi-select.tsx +20 -18
- package/src/components/nav-link/nav-link.test.tsx +43 -0
- package/src/components/nav-link/nav-link.tsx +34 -15
- package/src/components/nav-link/navigation.test.tsx +29 -1
- package/src/components/nav-link/navigation.tsx +45 -22
- package/src/components/notification/create-notifier.tsx +79 -13
- package/src/components/notification/index.ts +2 -0
- package/src/components/notification/notification.test.tsx +252 -1
- package/src/components/notification/notification.tsx +102 -58
- package/src/components/number-input/index.ts +7 -1
- package/src/components/number-input/number-input.test.tsx +45 -0
- package/src/components/number-input/number-input.tsx +34 -27
- package/src/components/overlays/create-overlays.tsx +18 -21
- package/src/components/overlays/dialog-parts.tsx +201 -0
- package/src/components/overlays/overlays.test.tsx +170 -0
- package/src/components/overlays/renderer.tsx +2 -9
- package/src/components/overlays/store.ts +4 -1
- package/src/components/password-input/index.ts +2 -0
- package/src/components/password-input/password-input.test.tsx +30 -0
- package/src/components/password-input/password-input.tsx +17 -3
- package/src/components/photo-capture/index.ts +35 -0
- package/src/components/photo-capture/photo-capture-machine.test.ts +147 -0
- package/src/components/photo-capture/photo-capture-machine.ts +112 -0
- package/src/components/photo-capture/photo-capture.test.tsx +375 -0
- package/src/components/photo-capture/photo-capture.tsx +665 -0
- package/src/components/photo-capture/use-photo-capture.ts +199 -0
- package/src/components/pill/pill.test.tsx +58 -1
- package/src/components/pill/pill.tsx +34 -16
- package/src/components/pills-input/index.ts +1 -0
- package/src/components/pills-input/pills-input.test.ts +14 -14
- package/src/components/pills-input/pills-input.test.tsx +39 -0
- package/src/components/pills-input/pills-input.tsx +70 -32
- package/src/components/pin-input/index.ts +1 -1
- package/src/components/pin-input/pin-input.test.tsx +28 -0
- package/src/components/pin-input/pin-input.tsx +64 -16
- package/src/components/popover/icons.tsx +16 -12
- package/src/components/popover/popover.test.tsx +11 -0
- package/src/components/popover/popover.tsx +21 -11
- package/src/components/progress/progress.test.tsx +17 -5
- package/src/components/progress/progress.tsx +23 -7
- package/src/components/radio-group/radio-group.test.tsx +21 -1
- package/src/components/radio-group/radio-group.tsx +66 -48
- package/src/components/rating/icons.tsx +4 -2
- package/src/components/rating/index.ts +2 -0
- package/src/components/rating/rating.test.tsx +43 -4
- package/src/components/rating/rating.tsx +29 -13
- package/src/components/schedule/index.ts +4 -1
- package/src/components/schedule/now-cursor-line.test.tsx +6 -6
- package/src/components/schedule/now-cursor-line.tsx +29 -15
- package/src/components/schedule/schedule-a11y.test.tsx +847 -0
- package/src/components/schedule/schedule-agenda-list.tsx +25 -44
- package/src/components/schedule/schedule-agenda-view.test.tsx +2 -2
- package/src/components/schedule/schedule-agenda-view.tsx +22 -37
- package/src/components/schedule/schedule-all-day-row.tsx +35 -96
- package/src/components/schedule/schedule-create-draft.tsx +23 -90
- package/src/components/schedule/schedule-dates.test.ts +64 -20
- package/src/components/schedule/schedule-dates.ts +65 -27
- package/src/components/schedule/schedule-day-column.tsx +607 -0
- package/src/components/schedule/schedule-days-view.tsx +40 -49
- package/src/components/schedule/schedule-details-popover.test.tsx +97 -0
- package/src/components/schedule/schedule-drag-ghost.tsx +30 -98
- package/src/components/schedule/schedule-event-chip.tsx +120 -262
- package/src/components/schedule/schedule-event-details-popover.tsx +132 -0
- package/src/components/schedule/schedule-event-details.tsx +6 -7
- package/src/components/schedule/schedule-event-list-popover-content.tsx +9 -5
- package/src/components/schedule/schedule-event-pill.tsx +159 -0
- package/src/components/schedule/schedule-event-styles.ts +71 -0
- package/src/components/schedule/schedule-geometry.test.ts +5 -5
- package/src/components/schedule/schedule-geometry.ts +16 -13
- package/src/components/schedule/schedule-grid-gesture.test.ts +99 -0
- package/src/components/schedule/schedule-grid-gesture.ts +50 -12
- package/src/components/schedule/schedule-icons.test.tsx +105 -0
- package/src/components/schedule/schedule-icons.tsx +40 -0
- package/src/components/schedule/schedule-month-view.test.tsx +118 -2
- package/src/components/schedule/schedule-month-view.tsx +258 -200
- package/src/components/schedule/schedule-overflow-chip.tsx +9 -4
- package/src/components/schedule/schedule-overflow-popover.tsx +5 -0
- package/src/components/schedule/schedule-slot-cursor.tsx +422 -0
- package/src/components/schedule/schedule-timed-grid-chrome.tsx +330 -0
- package/src/components/schedule/schedule-timed-grid.tsx +222 -893
- package/src/components/schedule/schedule-toolbar.tsx +108 -60
- package/src/components/schedule/schedule-types.test.ts +43 -2
- package/src/components/schedule/schedule-types.ts +164 -17
- package/src/components/schedule/schedule-view-pagination-chrome.tsx +101 -0
- package/src/components/schedule/schedule-year-view.test.tsx +86 -1
- package/src/components/schedule/schedule-year-view.tsx +163 -136
- package/src/components/schedule/schedule.test.tsx +275 -7
- package/src/components/schedule/schedule.tsx +36 -242
- package/src/components/schedule/use-chip-keyboard-move.ts +109 -0
- package/src/components/schedule/use-chip-motion.ts +71 -0
- package/src/components/schedule/use-date-grid-navigation.ts +120 -0
- package/src/components/schedule/use-event-drag.ts +1 -23
- package/src/components/schedule/use-event-resize.ts +27 -22
- package/src/components/schedule/use-schedule-reveal.ts +259 -0
- package/src/components/schedule/use-schedule-selection.ts +14 -2
- package/src/components/schedule/use-timed-grid-announcer.test.ts +72 -0
- package/src/components/schedule/use-timed-grid-announcer.ts +42 -0
- package/src/components/schedule/use-timed-grid-paging.ts +118 -0
- package/src/components/segment-group/segment-group.test.tsx +27 -5
- package/src/components/segment-group/segment-group.tsx +35 -28
- package/src/components/select/select.tsx +8 -8
- package/src/components/skeleton/skeleton.tsx +1 -1
- package/src/components/slider/slider.test.tsx +56 -5
- package/src/components/slider/slider.tsx +93 -31
- package/src/components/spinner/spinner.test.tsx +34 -10
- package/src/components/spinner/spinner.tsx +52 -49
- package/src/components/spotlight/context.ts +62 -0
- package/src/components/spotlight/create-spotlight.test.tsx +252 -0
- package/src/components/spotlight/create-spotlight.tsx +515 -0
- package/src/components/spotlight/highlight.test.ts +57 -0
- package/src/components/spotlight/highlight.ts +86 -0
- package/src/components/spotlight/icons.tsx +27 -0
- package/src/components/spotlight/index.ts +68 -0
- package/src/components/spotlight/label.ts +10 -0
- package/src/components/spotlight/recents.test.ts +46 -0
- package/src/components/spotlight/recents.ts +54 -0
- package/src/components/spotlight/spotlight-engine.test.ts +836 -0
- package/src/components/spotlight/spotlight-engine.ts +525 -0
- package/src/components/spotlight/spotlight.test.tsx +2532 -0
- package/src/components/spotlight/spotlight.tsx +1429 -0
- package/src/components/spotlight/static-source.test.ts +71 -0
- package/src/components/spotlight/static-source.ts +62 -0
- package/src/components/spotlight/store.test.ts +122 -0
- package/src/components/spotlight/store.ts +130 -0
- package/src/components/spotlight/translations.ts +124 -0
- package/src/components/spotlight/types.ts +308 -0
- package/src/components/spotlight/view.test.ts +216 -0
- package/src/components/spotlight/view.ts +350 -0
- package/src/components/switch/switch.test.tsx +8 -0
- package/src/components/switch/switch.tsx +12 -8
- package/src/components/table/table.test.tsx +35 -0
- package/src/components/table/table.tsx +28 -4
- package/src/components/tabs/tabs-data.tsx +7 -2
- package/src/components/tabs/tabs.test.tsx +211 -50
- package/src/components/tabs/tabs.tsx +309 -120
- package/src/components/tags-input/tags-input.test.tsx +116 -2
- package/src/components/tags-input/tags-input.tsx +51 -31
- package/src/components/text/text.test.tsx +1 -1
- package/src/components/text/text.tsx +1 -4
- package/src/components/theme-icon/theme-icon.tsx +2 -2
- package/src/components/theme-script/theme-script.test.tsx +52 -0
- package/src/components/theme-script/theme-script.tsx +1 -1
- package/src/components/time-input/hour-cycle.test.ts +37 -0
- package/src/components/time-input/hour-cycle.ts +37 -10
- package/src/components/time-input/time-input.test.tsx +34 -0
- package/src/components/time-input/time-input.tsx +12 -14
- package/src/components/time-input/time-row.test.ts +10 -0
- package/src/components/time-input/time-row.tsx +39 -19
- package/src/components/timeline/index.ts +1 -0
- package/src/components/timeline/timeline.test.tsx +39 -4
- package/src/components/timeline/timeline.tsx +43 -7
- package/src/components/title/title.test.tsx +3 -3
- package/src/components/title/title.tsx +2 -1
- package/src/components/tooltip/tooltip.test.tsx +38 -5
- package/src/components/tooltip/tooltip.tsx +17 -17
- package/src/components/tree-multi-select/index.ts +2 -0
- package/src/components/tree-multi-select/tree-multi-select.test.tsx +137 -3
- package/src/components/tree-multi-select/tree-multi-select.tsx +130 -332
- package/src/components/tree-select/index.ts +7 -1
- package/src/components/tree-select/tree-popover.tsx +484 -0
- package/src/components/tree-select/tree-select.test.tsx +93 -1
- package/src/components/tree-select/tree-select.tsx +117 -415
- package/src/icon-stroke.test.tsx +114 -0
- package/src/index.ts +71 -0
- package/src/lib/as-child.ts +1 -1
- package/src/lib/cn.test.ts +23 -2
- package/src/lib/cn.ts +9 -1
- package/src/lib/cutout.test.ts +37 -0
- package/src/lib/cutout.ts +56 -0
- package/src/lib/dev-warn.test.ts +89 -0
- package/src/lib/dev-warn.ts +61 -12
- package/src/lib/file-kind-icons.tsx +29 -0
- package/src/lib/file-queue-summary.test.ts +323 -0
- package/src/lib/file-queue-summary.ts +239 -0
- package/src/lib/file-queue.ts +493 -0
- package/src/lib/files.test.ts +72 -0
- package/src/lib/files.ts +211 -0
- package/src/lib/focus-styles.test.ts +97 -1
- package/src/lib/focus-styles.ts +153 -9
- package/src/lib/gap.ts +17 -0
- package/src/lib/graphemes.test.ts +26 -0
- package/src/lib/graphemes.ts +19 -0
- package/src/lib/icons.test.ts +22 -0
- package/src/lib/icons.ts +40 -0
- package/src/lib/image-file.test.ts +18 -0
- package/src/lib/image-file.ts +21 -0
- package/src/lib/merge-refs.test.tsx +79 -0
- package/src/lib/merge-refs.ts +58 -11
- package/src/lib/motion/animate.test.ts +114 -0
- package/src/lib/motion/animate.ts +88 -0
- package/src/lib/motion/easing.test.ts +57 -0
- package/src/lib/motion/easing.ts +107 -0
- package/src/lib/motion/gesture.test.ts +183 -0
- package/src/lib/motion/gesture.ts +300 -0
- package/src/lib/motion/morph.test.ts +93 -0
- package/src/lib/motion/morph.ts +88 -0
- package/src/lib/motion/physics.test.ts +75 -0
- package/src/lib/motion/physics.ts +61 -0
- package/src/lib/motion/rect.test.ts +52 -0
- package/src/lib/motion/rect.ts +67 -0
- package/src/lib/motion/reduced-motion.test.ts +57 -0
- package/src/lib/motion/reduced-motion.ts +34 -0
- package/src/lib/motion/spring.test.ts +93 -0
- package/src/lib/motion/spring.ts +143 -0
- package/src/lib/motion/tokens.ts +48 -0
- package/src/lib/motion/use-gesture.test.tsx +111 -0
- package/src/lib/motion/use-gesture.ts +133 -0
- package/src/lib/open-file.test.ts +275 -0
- package/src/lib/open-file.ts +351 -0
- package/src/lib/open-index.test.tsx +95 -0
- package/src/lib/open-index.tsx +90 -0
- package/src/lib/overlay-layer.test.tsx +32 -13
- package/src/lib/overlay-layer.tsx +25 -3
- package/src/lib/radius.ts +17 -0
- package/src/lib/ratio.test.ts +31 -0
- package/src/lib/ratio.ts +26 -0
- package/src/lib/save-file.test.ts +91 -0
- package/src/lib/save-file.ts +91 -0
- package/src/lib/select-data.test.tsx +123 -0
- package/src/lib/select-data.ts +130 -44
- package/src/lib/tree-data.ts +9 -4
- package/src/lib/typography-size.ts +28 -8
- package/src/lib/use-container-query.ts +4 -4
- package/src/lib/use-debounced.test.ts +105 -0
- package/src/lib/use-debounced.ts +44 -0
- package/src/lib/use-disclosure.ts +6 -1
- package/src/lib/use-document-visibility.test.tsx +46 -0
- package/src/lib/use-document-visibility.ts +37 -0
- package/src/lib/use-element-size.test.ts +142 -0
- package/src/lib/use-element-size.ts +87 -0
- package/src/lib/use-file-queue.test.tsx +774 -0
- package/src/lib/use-file-queue.ts +114 -0
- package/src/lib/use-hotkey.test.tsx +667 -0
- package/src/lib/use-hotkey.ts +562 -0
- package/src/lib/use-hydrated.test.tsx +43 -0
- package/src/lib/use-hydrated.ts +27 -0
- package/src/lib/use-in-view.test.ts +113 -0
- package/src/lib/use-in-view.ts +69 -0
- package/src/lib/use-now.test.tsx +65 -0
- package/src/lib/use-now.ts +37 -14
- package/src/lib/use-object-url.test.ts +195 -0
- package/src/lib/use-object-url.ts +108 -0
- package/src/lib/use-uncontrolled.test.ts +34 -2
- package/src/lib/use-uncontrolled.ts +7 -2
- package/src/test-setup.ts +65 -1
- package/src/theme.css +184 -16
- package/src/theme.forced-colors.test.tsx +152 -0
- package/src/theme.test.ts +34 -0
- package/src/visually-hidden-containment.test.tsx +32 -0
- package/dist/chunk-2GILNBZW.js +0 -31
- package/dist/chunk-2GILNBZW.js.map +0 -1
- package/dist/chunk-2NNZHVKD.js.map +0 -1
- package/dist/chunk-4NNGTNPV.js.map +0 -1
- package/dist/chunk-64T6Z7BA.js.map +0 -1
- package/dist/chunk-A6MYJTJI.js.map +0 -1
- package/dist/chunk-AIQG7IIT.js.map +0 -1
- package/dist/chunk-BEL75C7N.js.map +0 -1
- package/dist/chunk-CHTN5AHI.js.map +0 -1
- package/dist/chunk-CSCVTESP.js.map +0 -1
- package/dist/chunk-CTSO6V72.js.map +0 -1
- package/dist/chunk-CYWMES5P.js.map +0 -1
- package/dist/chunk-CZEKZ5HR.js.map +0 -1
- package/dist/chunk-DBTJEBMO.js +0 -291
- package/dist/chunk-DBTJEBMO.js.map +0 -1
- package/dist/chunk-FAOBC4IS.js.map +0 -1
- package/dist/chunk-FOMR74VE.js.map +0 -1
- package/dist/chunk-GCGX4FEF.js.map +0 -1
- package/dist/chunk-HCYULRWT.js.map +0 -1
- package/dist/chunk-I4SQQIP5.js.map +0 -1
- package/dist/chunk-IG7FBZVM.js.map +0 -1
- package/dist/chunk-INJUILCN.js +0 -31
- package/dist/chunk-INJUILCN.js.map +0 -1
- package/dist/chunk-IRXZHLUL.js.map +0 -1
- package/dist/chunk-K5UWVH6P.js.map +0 -1
- package/dist/chunk-LM6F6DLR.js.map +0 -1
- package/dist/chunk-MQO42HZL.js +0 -223
- package/dist/chunk-MQO42HZL.js.map +0 -1
- package/dist/chunk-OC7I2CTA.js +0 -8
- package/dist/chunk-OC7I2CTA.js.map +0 -1
- package/dist/chunk-OGJFDNIS.js.map +0 -1
- package/dist/chunk-P3XMBETI.js.map +0 -1
- package/dist/chunk-PINENGML.js.map +0 -1
- package/dist/chunk-PS2PZFXH.js +0 -84
- package/dist/chunk-PS2PZFXH.js.map +0 -1
- package/dist/chunk-QIDAXFKK.js.map +0 -1
- package/dist/chunk-QP4I37PA.js +0 -14
- package/dist/chunk-QP4I37PA.js.map +0 -1
- package/dist/chunk-RIP5G47F.js.map +0 -1
- package/dist/chunk-RKYXG6X7.js.map +0 -1
- package/dist/chunk-SVKU3GUN.js.map +0 -1
- package/dist/chunk-TBTSEPGP.js.map +0 -1
- package/dist/chunk-TWGCWKRV.js +0 -44
- package/dist/chunk-TWGCWKRV.js.map +0 -1
- package/dist/chunk-UJZIF2BA.js.map +0 -1
- package/dist/chunk-UVYTJQTJ.js +0 -14
- package/dist/chunk-UVYTJQTJ.js.map +0 -1
- package/dist/chunk-VZBUQNLX.js.map +0 -1
- package/dist/chunk-VZH6TS7M.js.map +0 -1
- package/dist/chunk-WJOHNCYY.js.map +0 -1
- package/dist/chunk-WZB6LPQI.js +0 -47
- package/dist/chunk-WZB6LPQI.js.map +0 -1
- package/dist/chunk-YKUCSV34.js.map +0 -1
- package/dist/chunk-YQHOKMSV.js.map +0 -1
- package/dist/chunk-YW6Q6ERX.js.map +0 -1
- package/dist/chunk-YWRBG23W.js.map +0 -1
- package/dist/chunk-Z43YWH4R.js.map +0 -1
- package/dist/chunk-Z6RPMRFH.js.map +0 -1
- package/dist/components/slider/sliderThumb.d.ts +0 -1
- package/dist/components/slider/sliderThumb.d.ts.map +0 -1
- package/src/components/slider/sliderThumb.tsx +0 -0
|
@@ -0,0 +1,1301 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
|
+
import { Dialog } from "@ark-ui/react/dialog"
|
|
5
|
+
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
6
|
+
import { Portal } from "@ark-ui/react/portal"
|
|
7
|
+
import { ChevronLeft, ChevronRight, Download, ImageOff, XIcon, ZoomIn, ZoomOut } from "lucide-react"
|
|
8
|
+
import {
|
|
9
|
+
type ComponentPropsWithoutRef,
|
|
10
|
+
type CSSProperties,
|
|
11
|
+
createContext,
|
|
12
|
+
Fragment,
|
|
13
|
+
type ReactNode,
|
|
14
|
+
type SyntheticEvent,
|
|
15
|
+
useContext,
|
|
16
|
+
useEffect,
|
|
17
|
+
useEffectEvent,
|
|
18
|
+
useMemo,
|
|
19
|
+
useRef,
|
|
20
|
+
useState,
|
|
21
|
+
useSyncExternalStore,
|
|
22
|
+
} from "react"
|
|
23
|
+
import { match, P } from "ts-pattern"
|
|
24
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
25
|
+
import { cn } from "../../lib/cn"
|
|
26
|
+
import { focusStyles } from "../../lib/focus-styles"
|
|
27
|
+
import { type IconMap, iconStroke, mergeIcons } from "../../lib/icons"
|
|
28
|
+
import { useDirectionCheck, useLocale } from "../../lib/intl"
|
|
29
|
+
import { useMergedRefs } from "../../lib/merge-refs"
|
|
30
|
+
import { useReducedMotion } from "../../lib/motion/reduced-motion"
|
|
31
|
+
import { useGesture } from "../../lib/motion/use-gesture"
|
|
32
|
+
import { OpenIndexProvider, useOpenIndexTrigger } from "../../lib/open-index"
|
|
33
|
+
import { OverlayContainerProvider } from "../../lib/overlay-container"
|
|
34
|
+
import { props } from "../../lib/props"
|
|
35
|
+
import type { WithTestId } from "../../lib/test-id"
|
|
36
|
+
import { useIsomorphicLayoutEffect } from "../../lib/use-isomorphic-layout-effect"
|
|
37
|
+
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
38
|
+
import { DownloadButton } from "../download-button/download-button"
|
|
39
|
+
import { Image, type ImageLoader } from "../image"
|
|
40
|
+
import { resolveSources } from "../image/srcset"
|
|
41
|
+
import { Modal } from "../modal/modal"
|
|
42
|
+
import { createController, type LightboxController, type SlideParts } from "./lightbox-controller"
|
|
43
|
+
import { initialState, type LightboxState, neighbour, type Phase } from "./lightbox-machine"
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Lightbox — a full-screen viewer for a set of images: open one from its
|
|
47
|
+
* thumbnail, swipe or arrow through the rest, pinch or double-tap to zoom,
|
|
48
|
+
* drag down to dismiss.
|
|
49
|
+
*
|
|
50
|
+
* <Lightbox data={photos}>
|
|
51
|
+
* <Gallery data={photos} />
|
|
52
|
+
* </Lightbox>
|
|
53
|
+
*
|
|
54
|
+
* Under a Lightbox, anything on the open-index seam opens it — a Gallery's
|
|
55
|
+
* tiles, a `Lightbox.Trigger` — at its own index, from its own pixels: the
|
|
56
|
+
* thumbnail grows into the full image in a cover → contain morph (`morph.ts`)
|
|
57
|
+
* and the full-resolution file crossfades in once it has decoded. Closing
|
|
58
|
+
* morphs back to the tile of whichever image is showing, and focus goes
|
|
59
|
+
* there too; without a visible tile it fades.
|
|
60
|
+
*
|
|
61
|
+
* Built on Ark's Dialog like `Modal` (focus trap, scroll lock, `Esc`, the
|
|
62
|
+
* nested-layer guard, the `--modal-z` band). The interaction state is a pure
|
|
63
|
+
* reducer (`lightbox-machine.ts`), driven by a controller that owns the DOM
|
|
64
|
+
* (`lightbox-controller.ts`); React renders only the phase, the index, the
|
|
65
|
+
* zoom level and whether the controls show.
|
|
66
|
+
*
|
|
67
|
+
* Slides sit in a three-slot window keyed by index and positioned with
|
|
68
|
+
* `inset-inline-start`, so navigating never reorders the DOM (a reorder
|
|
69
|
+
* restarts animations) and RTL mirrors without a branch.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// Types
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
export type LightboxItem = WithTestId & {
|
|
77
|
+
/** The full-size image. */
|
|
78
|
+
src: string
|
|
79
|
+
/** Required. Describe the image, or `""` when it's decorative. */
|
|
80
|
+
alt: string
|
|
81
|
+
/** Intrinsic width in px. With `height`, lays the image out before it loads and lets it morph. */
|
|
82
|
+
width?: number
|
|
83
|
+
/** Intrinsic height in px. */
|
|
84
|
+
height?: number
|
|
85
|
+
/** A ready-made srcset, when you don't use `loader`. */
|
|
86
|
+
srcSet?: string
|
|
87
|
+
/** The `sizes` for the srcset. Defaults to the full viewport width. */
|
|
88
|
+
sizes?: string
|
|
89
|
+
/** Shown under the image by `Lightbox.Caption`. */
|
|
90
|
+
caption?: ReactNode
|
|
91
|
+
/** Custom media in place of the image (a video, an embed). It fades rather than morphs, and doesn't zoom. */
|
|
92
|
+
content?: ReactNode
|
|
93
|
+
/** What `Lightbox.Download` saves. Defaults to `src`, named after its last path segment. */
|
|
94
|
+
download?: { src?: string; name?: string }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type LightboxTranslations = {
|
|
98
|
+
/** The dialog's accessible name. */
|
|
99
|
+
label?: string
|
|
100
|
+
closeLabel?: string
|
|
101
|
+
prevLabel?: string
|
|
102
|
+
nextLabel?: string
|
|
103
|
+
zoomInLabel?: string
|
|
104
|
+
zoomOutLabel?: string
|
|
105
|
+
downloadLabel?: string
|
|
106
|
+
/** Announced when the download fails. */
|
|
107
|
+
downloadError?: (name: string | undefined) => string
|
|
108
|
+
/** Names the thumbnail strip. */
|
|
109
|
+
thumbnailsLabel?: string
|
|
110
|
+
/** A slide's name, announced on navigation and naming its thumbnail. Numbers come locale-formatted. */
|
|
111
|
+
slideLabel?: (position: string, count: string) => string
|
|
112
|
+
/** The visible counter. */
|
|
113
|
+
counter?: (position: string, count: string) => string
|
|
114
|
+
/** Announced when the zoom changes. `percent` is relative to fit, formatted (`"250%"`). */
|
|
115
|
+
zoomLevel?: (percent: string) => string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const DEFAULT_TRANSLATIONS: Required<LightboxTranslations> = {
|
|
119
|
+
label: "Image viewer",
|
|
120
|
+
closeLabel: "Close",
|
|
121
|
+
prevLabel: "Previous image",
|
|
122
|
+
nextLabel: "Next image",
|
|
123
|
+
zoomInLabel: "Zoom in",
|
|
124
|
+
zoomOutLabel: "Zoom out",
|
|
125
|
+
downloadLabel: "Download",
|
|
126
|
+
downloadError: (name) => (name ? `${name} couldn't be downloaded` : "The download failed"),
|
|
127
|
+
thumbnailsLabel: "Thumbnails",
|
|
128
|
+
slideLabel: (position, count) => `Image ${position} of ${count}`,
|
|
129
|
+
counter: (position, count) => `${position} / ${count}`,
|
|
130
|
+
zoomLevel: (percent) => `Zoom ${percent}`,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type LightboxIconSlot =
|
|
134
|
+
| "prev"
|
|
135
|
+
| "next"
|
|
136
|
+
| "zoomIn"
|
|
137
|
+
| "zoomOut"
|
|
138
|
+
| "download"
|
|
139
|
+
| "close"
|
|
140
|
+
| "fallback"
|
|
141
|
+
export type LightboxIcons = IconMap<LightboxIconSlot>
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The default icons. The chevrons mirror on a right-to-left page; an icon
|
|
145
|
+
* passed through `icons` is drawn as given. `fallback` shows in place of an
|
|
146
|
+
* image that failed with no opener's pixels to keep.
|
|
147
|
+
*/
|
|
148
|
+
export const DEFAULT_ICONS: Record<LightboxIconSlot, ReactNode> = {
|
|
149
|
+
prev: <ChevronLeft className={cn(iconStroke, "rtl:-scale-x-100")} />,
|
|
150
|
+
next: <ChevronRight className={cn(iconStroke, "rtl:-scale-x-100")} />,
|
|
151
|
+
zoomIn: <ZoomIn className={iconStroke} />,
|
|
152
|
+
zoomOut: <ZoomOut className={iconStroke} />,
|
|
153
|
+
download: <Download className={iconStroke} />,
|
|
154
|
+
close: <XIcon className={iconStroke} />,
|
|
155
|
+
fallback: <ImageOff aria-hidden className={iconStroke} />,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** What `Lightbox.Context` hands its render function. */
|
|
159
|
+
export type LightboxApi = {
|
|
160
|
+
phase: Phase
|
|
161
|
+
open: boolean
|
|
162
|
+
index: number
|
|
163
|
+
count: number
|
|
164
|
+
/** Relative to fit: 1 is fitted. */
|
|
165
|
+
zoom: number
|
|
166
|
+
next: () => void
|
|
167
|
+
prev: () => void
|
|
168
|
+
goto: (index: number) => void
|
|
169
|
+
zoomIn: () => void
|
|
170
|
+
zoomOut: () => void
|
|
171
|
+
/** Back to fit. */
|
|
172
|
+
reset: () => void
|
|
173
|
+
close: () => void
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// Context
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
type Shared = {
|
|
181
|
+
data: readonly LightboxItem[]
|
|
182
|
+
loader?: ImageLoader
|
|
183
|
+
zoomable: boolean
|
|
184
|
+
t: Required<LightboxTranslations>
|
|
185
|
+
icons: Record<LightboxIconSlot, ReactNode>
|
|
186
|
+
format: (n: number) => string
|
|
187
|
+
percent: (n: number) => string
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const ControllerContext = createContext<LightboxController | null>(null)
|
|
191
|
+
const SharedContext = createContext<Shared | null>(null)
|
|
192
|
+
|
|
193
|
+
const useController = () => {
|
|
194
|
+
const controller = useContext(ControllerContext)
|
|
195
|
+
if (!controller) throw new Error("Lightbox parts must be rendered within <Lightbox.Root>.")
|
|
196
|
+
return controller
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const useShared = () => {
|
|
200
|
+
const shared = useContext(SharedContext)
|
|
201
|
+
if (!shared) throw new Error("Lightbox parts must be rendered within <Lightbox.Root>.")
|
|
202
|
+
return shared
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** One slice of the machine's state. Return a primitive: it's compared by identity. */
|
|
206
|
+
const useLightbox = <T,>(select: (state: LightboxState) => T): T => {
|
|
207
|
+
const controller = useController()
|
|
208
|
+
const snapshot = () => select(controller.getState())
|
|
209
|
+
return useSyncExternalStore(controller.subscribe, snapshot, snapshot)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Where slide `index` sits relative to the current one: −1, 0 or 1. */
|
|
213
|
+
const slotOf = (state: LightboxState, index: number): -1 | 0 | 1 => {
|
|
214
|
+
if (state.index === index) return 0
|
|
215
|
+
return neighbour(state, 1) === index ? 1 : -1
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
// Styles
|
|
220
|
+
// ---------------------------------------------------------------------------
|
|
221
|
+
|
|
222
|
+
/** A round, ≥ 44px control that reads on any photo. */
|
|
223
|
+
const control = cn(
|
|
224
|
+
"inline-grid size-11 shrink-0 place-items-center rounded-full",
|
|
225
|
+
"bg-black/35 text-white backdrop-blur-sm transition-colors duration-(--duration-fast) ease-standard",
|
|
226
|
+
"hover:bg-black/60 aria-disabled:opacity-40 aria-disabled:hover:bg-black/35",
|
|
227
|
+
"[&_svg]:size-5",
|
|
228
|
+
focusStyles({ offset: false }),
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
// Root
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
export type LightboxRootProps = {
|
|
236
|
+
/** The images, in order. */
|
|
237
|
+
data: readonly LightboxItem[]
|
|
238
|
+
open?: boolean
|
|
239
|
+
defaultOpen?: boolean
|
|
240
|
+
onOpenChange?: (open: boolean) => void
|
|
241
|
+
/** The image showing. */
|
|
242
|
+
index?: number
|
|
243
|
+
defaultIndex?: number
|
|
244
|
+
onIndexChange?: (index: number) => void
|
|
245
|
+
/** Wrap from the last image to the first. */
|
|
246
|
+
loop?: boolean
|
|
247
|
+
/** Pinch, double-tap, ⌘/ctrl + wheel and the zoom controls. */
|
|
248
|
+
zoom?: boolean
|
|
249
|
+
/** The deepest zoom, relative to fit. */
|
|
250
|
+
maxZoom?: number
|
|
251
|
+
/** Maps `{ src, width, quality }` to a CDN URL, for a srcset per image. */
|
|
252
|
+
loader?: ImageLoader
|
|
253
|
+
translations?: LightboxTranslations
|
|
254
|
+
/**
|
|
255
|
+
* Replaces the default icons: `prev`, `next`, `zoomIn`, `zoomOut`,
|
|
256
|
+
* `download`, `close` and `fallback`. A part's `children` win over these;
|
|
257
|
+
* `null` leaves a failed image's stage empty.
|
|
258
|
+
*/
|
|
259
|
+
icons?: LightboxIcons
|
|
260
|
+
/** Fires once the close animation has finished and the viewer unmounted. */
|
|
261
|
+
onExitComplete?: () => void
|
|
262
|
+
children?: ReactNode
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const LightboxRoot = ({
|
|
266
|
+
data,
|
|
267
|
+
open,
|
|
268
|
+
defaultOpen,
|
|
269
|
+
onOpenChange,
|
|
270
|
+
index,
|
|
271
|
+
defaultIndex,
|
|
272
|
+
onIndexChange,
|
|
273
|
+
loop = true,
|
|
274
|
+
zoom = true,
|
|
275
|
+
maxZoom = 4,
|
|
276
|
+
loader,
|
|
277
|
+
translations,
|
|
278
|
+
icons,
|
|
279
|
+
onExitComplete,
|
|
280
|
+
children,
|
|
281
|
+
}: LightboxRootProps) => {
|
|
282
|
+
const [isOpen, setOpen] = useUncontrolled({
|
|
283
|
+
value: open,
|
|
284
|
+
defaultValue: defaultOpen,
|
|
285
|
+
finalValue: false,
|
|
286
|
+
onChange: onOpenChange,
|
|
287
|
+
})
|
|
288
|
+
const [current, setIndex] = useUncontrolled({
|
|
289
|
+
value: index,
|
|
290
|
+
defaultValue: defaultIndex,
|
|
291
|
+
finalValue: 0,
|
|
292
|
+
onChange: onIndexChange,
|
|
293
|
+
})
|
|
294
|
+
const { dir } = useLocaleContext()
|
|
295
|
+
const locale = useLocale()
|
|
296
|
+
const [controller] = useState(() =>
|
|
297
|
+
createController(
|
|
298
|
+
initialState({ count: data.length, loop, maxZoom, zoomable: zoom, index: current }),
|
|
299
|
+
),
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
useIsomorphicLayoutEffect(() => {
|
|
303
|
+
controller.wire({ open: isOpen, setOpen, setIndex, inline: dir === "rtl" ? -1 : 1 })
|
|
304
|
+
})
|
|
305
|
+
useIsomorphicLayoutEffect(() => {
|
|
306
|
+
controller.dispatch({ type: "configure", count: data.length, loop, maxZoom, zoomable: zoom })
|
|
307
|
+
}, [controller, data.length, loop, maxZoom, zoom])
|
|
308
|
+
// A controlled `index` or `open` moving on its own: the machine follows.
|
|
309
|
+
useIsomorphicLayoutEffect(() => {
|
|
310
|
+
controller.dispatch({ type: "goto", index: current })
|
|
311
|
+
}, [controller, current])
|
|
312
|
+
useIsomorphicLayoutEffect(() => {
|
|
313
|
+
controller.dispatch(
|
|
314
|
+
isOpen ? { type: "open", index: controller.getState().index } : { type: "close" },
|
|
315
|
+
)
|
|
316
|
+
}, [controller, isOpen])
|
|
317
|
+
|
|
318
|
+
const shared = useMemo<Shared>(() => {
|
|
319
|
+
const number = new Intl.NumberFormat(locale)
|
|
320
|
+
const percent = new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 })
|
|
321
|
+
return {
|
|
322
|
+
data,
|
|
323
|
+
loader,
|
|
324
|
+
zoomable: zoom,
|
|
325
|
+
t: { ...DEFAULT_TRANSLATIONS, ...translations },
|
|
326
|
+
icons: mergeIcons(DEFAULT_ICONS, icons),
|
|
327
|
+
format: (n) => number.format(n),
|
|
328
|
+
percent: (n) => percent.format(n),
|
|
329
|
+
}
|
|
330
|
+
}, [data, loader, zoom, translations, icons, locale])
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
<ControllerContext value={controller}>
|
|
334
|
+
<SharedContext value={shared}>
|
|
335
|
+
<OpenIndexProvider value={controller.seam}>
|
|
336
|
+
<Modal.Root
|
|
337
|
+
open={isOpen}
|
|
338
|
+
onOpenChange={(details) => {
|
|
339
|
+
if (!details.open) controller.actions.close()
|
|
340
|
+
}}
|
|
341
|
+
// The content takes focus, so the keys work from the first press;
|
|
342
|
+
// on close it goes to the current image's tile (see the controller).
|
|
343
|
+
initialFocusEl={controller.content}
|
|
344
|
+
finalFocusEl={controller.focusTarget}
|
|
345
|
+
lazyMount
|
|
346
|
+
unmountOnExit
|
|
347
|
+
onExitComplete={() => {
|
|
348
|
+
controller.exited()
|
|
349
|
+
onExitComplete?.()
|
|
350
|
+
}}
|
|
351
|
+
>
|
|
352
|
+
{children}
|
|
353
|
+
</Modal.Root>
|
|
354
|
+
</OpenIndexProvider>
|
|
355
|
+
</SharedContext>
|
|
356
|
+
</ControllerContext>
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// ---------------------------------------------------------------------------
|
|
361
|
+
// Trigger
|
|
362
|
+
// ---------------------------------------------------------------------------
|
|
363
|
+
|
|
364
|
+
export type LightboxTriggerProps = HTMLArkProps<"button"> &
|
|
365
|
+
WithTestId & {
|
|
366
|
+
/** The image it opens. */
|
|
367
|
+
index?: number
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** Opens the viewer at `index`, and is where the morph and focus return to for that image. */
|
|
371
|
+
const LightboxTrigger = ({
|
|
372
|
+
index = 0,
|
|
373
|
+
className,
|
|
374
|
+
testId,
|
|
375
|
+
onClick,
|
|
376
|
+
...rest
|
|
377
|
+
}: LightboxTriggerProps) => {
|
|
378
|
+
const trigger = useOpenIndexTrigger(index)
|
|
379
|
+
return (
|
|
380
|
+
<ark.button
|
|
381
|
+
{...trigger}
|
|
382
|
+
{...props({ "data-testid": testId })}
|
|
383
|
+
{...rest}
|
|
384
|
+
onClick={(event) => {
|
|
385
|
+
onClick?.(event)
|
|
386
|
+
if (!event.defaultPrevented) trigger?.onClick(event)
|
|
387
|
+
}}
|
|
388
|
+
className={cn("cursor-zoom-in", focusStyles(), className)}
|
|
389
|
+
/>
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// ---------------------------------------------------------------------------
|
|
394
|
+
// Content
|
|
395
|
+
// ---------------------------------------------------------------------------
|
|
396
|
+
|
|
397
|
+
export type LightboxContentProps = NoAsChild<ComponentPropsWithoutRef<typeof Dialog.Content>> &
|
|
398
|
+
WithTestId & {
|
|
399
|
+
/** Portal target. Defaults to `document.body`. */
|
|
400
|
+
container?: HTMLElement | null
|
|
401
|
+
classNames?: { positioner?: string; backdrop?: string }
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/** The full-screen dialog: backdrop, live region, and whatever parts you put in it. */
|
|
405
|
+
const LightboxContent = ({
|
|
406
|
+
container,
|
|
407
|
+
className,
|
|
408
|
+
classNames,
|
|
409
|
+
testId,
|
|
410
|
+
style,
|
|
411
|
+
children,
|
|
412
|
+
onKeyDown,
|
|
413
|
+
onFocus,
|
|
414
|
+
asChild: _asChild,
|
|
415
|
+
...rest
|
|
416
|
+
}: LightboxContentProps) => {
|
|
417
|
+
const controller = useController()
|
|
418
|
+
const { t } = useShared()
|
|
419
|
+
const chrome = useLightbox((state) => state.chrome)
|
|
420
|
+
const positioner = useRef<HTMLDivElement>(null)
|
|
421
|
+
const direction = useDirectionCheck()
|
|
422
|
+
|
|
423
|
+
const contentRef = useMergedRefs(controller.attach.content, direction)
|
|
424
|
+
return (
|
|
425
|
+
<Portal container={container ? { current: container } : undefined}>
|
|
426
|
+
<Dialog.Positioner
|
|
427
|
+
ref={positioner}
|
|
428
|
+
className={cn(
|
|
429
|
+
"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))]",
|
|
430
|
+
classNames?.positioner,
|
|
431
|
+
)}
|
|
432
|
+
>
|
|
433
|
+
<OverlayContainerProvider value={positioner}>
|
|
434
|
+
<Dialog.Content
|
|
435
|
+
ref={contentRef}
|
|
436
|
+
aria-label={t.label}
|
|
437
|
+
data-chrome={chrome ? "shown" : "hidden"}
|
|
438
|
+
{...props({ "data-testid": testId })}
|
|
439
|
+
{...rest}
|
|
440
|
+
onKeyDown={(event) => {
|
|
441
|
+
onKeyDown?.(event)
|
|
442
|
+
if (!event.defaultPrevented) controller.keydown(event)
|
|
443
|
+
}}
|
|
444
|
+
onFocus={(event) => {
|
|
445
|
+
onFocus?.(event)
|
|
446
|
+
// Keyboard focus never lands on hidden controls.
|
|
447
|
+
if (event.target.matches(":focus-visible")) controller.showChrome()
|
|
448
|
+
}}
|
|
449
|
+
className={cn(
|
|
450
|
+
"group/lightbox relative size-full overflow-clip text-white select-none focus:outline-none",
|
|
451
|
+
// The page underneath never scrolls or zooms from in here.
|
|
452
|
+
"touch-none overscroll-contain",
|
|
453
|
+
"[--lb-dismiss:1] data-[chrome=hidden]:[--lb-chrome:0]",
|
|
454
|
+
"transition-[--lb-chrome] duration-(--duration-fast) ease-standard",
|
|
455
|
+
"data-[state=open]:animate-lightbox-in data-[state=closed]:animate-lightbox-out",
|
|
456
|
+
className,
|
|
457
|
+
)}
|
|
458
|
+
style={style}
|
|
459
|
+
>
|
|
460
|
+
<div
|
|
461
|
+
aria-hidden
|
|
462
|
+
data-part="backdrop"
|
|
463
|
+
className={cn(
|
|
464
|
+
"absolute inset-0 bg-black opacity-[calc(var(--lb-fade,1)*var(--lb-dismiss,1))]",
|
|
465
|
+
classNames?.backdrop,
|
|
466
|
+
)}
|
|
467
|
+
/>
|
|
468
|
+
{children}
|
|
469
|
+
<Flush />
|
|
470
|
+
<LiveRegion />
|
|
471
|
+
</Dialog.Content>
|
|
472
|
+
</OverlayContainerProvider>
|
|
473
|
+
</Dialog.Positioner>
|
|
474
|
+
</Portal>
|
|
475
|
+
)
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Runs the work the controller queued for after the render a phase or index
|
|
480
|
+
* change causes (a morph in, a slide). It sits after the parts inside the
|
|
481
|
+
* portal, so its layout effect runs once the slides have mounted and
|
|
482
|
+
* registered, before the browser paints.
|
|
483
|
+
*/
|
|
484
|
+
const Flush = () => {
|
|
485
|
+
const controller = useController()
|
|
486
|
+
useLightbox((state) => state.phase)
|
|
487
|
+
useLightbox((state) => state.index)
|
|
488
|
+
useIsomorphicLayoutEffect(() => controller.flush())
|
|
489
|
+
return null
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** Announces the position on navigation and the level on zoom; the visible counter stays silent. */
|
|
493
|
+
const LiveRegion = () => {
|
|
494
|
+
const { t, format, percent, data } = useShared()
|
|
495
|
+
const index = useLightbox((state) => state.index)
|
|
496
|
+
const zoom = useLightbox((state) => state.zoom)
|
|
497
|
+
const previous = useRef<{ index: number; zoom: number }>(undefined)
|
|
498
|
+
const [message, setMessage] = useState("")
|
|
499
|
+
// Reads the latest wording, but only index and zoom moving announce: a
|
|
500
|
+
// re-render with new `data` or `translations` says nothing.
|
|
501
|
+
const announce = useEffectEvent((moved: boolean) =>
|
|
502
|
+
setMessage(
|
|
503
|
+
moved ? t.slideLabel(format(index + 1), format(data.length)) : t.zoomLevel(percent(zoom)),
|
|
504
|
+
),
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
useEffect(() => {
|
|
508
|
+
const before = previous.current
|
|
509
|
+
previous.current = { index, zoom }
|
|
510
|
+
if (!before || before.index !== index) announce(true)
|
|
511
|
+
else if (before.zoom !== zoom) announce(false)
|
|
512
|
+
}, [index, zoom])
|
|
513
|
+
|
|
514
|
+
return (
|
|
515
|
+
<div aria-live="polite" aria-atomic className="sr-only">
|
|
516
|
+
{message}
|
|
517
|
+
</div>
|
|
518
|
+
)
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// ---------------------------------------------------------------------------
|
|
522
|
+
// Viewport + Slide
|
|
523
|
+
// ---------------------------------------------------------------------------
|
|
524
|
+
|
|
525
|
+
export type LightboxViewportProps = WithTestId & {
|
|
526
|
+
className?: string
|
|
527
|
+
style?: CSSProperties
|
|
528
|
+
/** Renders one slide; defaults to `<Lightbox.Slide index={index} />`. */
|
|
529
|
+
children?: (index: number) => ReactNode
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** Prefetches at low priority, ahead of the slides that are mounted (and so decoding). */
|
|
533
|
+
const usePrefetch = (indices: string) => {
|
|
534
|
+
const { data, loader } = useShared()
|
|
535
|
+
useEffect(() => {
|
|
536
|
+
indices.split(",").forEach((i) => {
|
|
537
|
+
const item = data[Number(i)]
|
|
538
|
+
if (!i || !item || item.content !== undefined) return
|
|
539
|
+
const sources = sourcesOf(item, loader)
|
|
540
|
+
const img = new globalThis.Image()
|
|
541
|
+
img.fetchPriority = "low"
|
|
542
|
+
if (sources.sizes) img.sizes = sources.sizes
|
|
543
|
+
if (sources.srcSet) img.srcset = sources.srcSet
|
|
544
|
+
img.src = sources.src
|
|
545
|
+
})
|
|
546
|
+
}, [indices, data, loader])
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const sourcesOf = (item: LightboxItem, loader?: ImageLoader) =>
|
|
550
|
+
item.srcSet
|
|
551
|
+
? { src: item.src, srcSet: item.srcSet, sizes: item.sizes ?? "100vw" }
|
|
552
|
+
: resolveSources({ src: item.src, loader, width: item.width, sizes: item.sizes ?? "100vw" })
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* The stage: takes the gestures and the wheel, and holds the sliding track
|
|
556
|
+
* with the current slide and its two neighbours.
|
|
557
|
+
*/
|
|
558
|
+
const LightboxViewport = ({
|
|
559
|
+
className,
|
|
560
|
+
style,
|
|
561
|
+
testId,
|
|
562
|
+
children = (index) => <LightboxSlide index={index} />,
|
|
563
|
+
}: LightboxViewportProps) => {
|
|
564
|
+
const controller = useController()
|
|
565
|
+
const phase = useLightbox((state) => state.phase)
|
|
566
|
+
const zoomed = useLightbox((state) => state.zoom > 1)
|
|
567
|
+
// Sorted by index, so React only ever inserts and removes slides around the
|
|
568
|
+
// ones it keeps: a moved node would restart its animations.
|
|
569
|
+
const slots = useLightbox((state) =>
|
|
570
|
+
[...new Set([neighbour(state, -1), state.index, neighbour(state, 1)])]
|
|
571
|
+
.filter((i) => i !== undefined)
|
|
572
|
+
.sort((a, b) => a - b)
|
|
573
|
+
.join(),
|
|
574
|
+
)
|
|
575
|
+
const prefetch = useLightbox((state) =>
|
|
576
|
+
[neighbour(state, -2), neighbour(state, 2)].filter((i) => i !== undefined).join(),
|
|
577
|
+
)
|
|
578
|
+
usePrefetch(prefetch)
|
|
579
|
+
|
|
580
|
+
const gestures = useGesture(controller.gesture, { lock: !zoomed })
|
|
581
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
582
|
+
|
|
583
|
+
// React's wheel listener is passive; zooming has to stop the page's own.
|
|
584
|
+
useEffect(() => {
|
|
585
|
+
const el = ref.current
|
|
586
|
+
el?.addEventListener("wheel", controller.wheel, { passive: false })
|
|
587
|
+
return () => el?.removeEventListener("wheel", controller.wheel)
|
|
588
|
+
}, [controller])
|
|
589
|
+
|
|
590
|
+
const viewportRef = useMergedRefs(ref, controller.attach.viewport)
|
|
591
|
+
return (
|
|
592
|
+
<div
|
|
593
|
+
ref={viewportRef}
|
|
594
|
+
data-part="viewport"
|
|
595
|
+
data-phase={phase}
|
|
596
|
+
{...props({ "data-testid": testId, "data-zoomed": zoomed })}
|
|
597
|
+
className={cn(
|
|
598
|
+
"absolute inset-0",
|
|
599
|
+
zoomed ? "cursor-grab active:cursor-grabbing" : "cursor-default",
|
|
600
|
+
className,
|
|
601
|
+
)}
|
|
602
|
+
style={style}
|
|
603
|
+
onPointerDown={(event) => {
|
|
604
|
+
// Custom media keeps its own pointer: a video's scrubber, an embed.
|
|
605
|
+
const custom =
|
|
606
|
+
event.target instanceof Element && event.target.closest('[data-part="custom"]')
|
|
607
|
+
if (event.button !== 0 || custom) return
|
|
608
|
+
controller.pointer(event.pointerType)
|
|
609
|
+
gestures.onPointerDown(event)
|
|
610
|
+
}}
|
|
611
|
+
onPointerMove={gestures.onPointerMove}
|
|
612
|
+
onPointerUp={gestures.onPointerUp}
|
|
613
|
+
onPointerCancel={gestures.onPointerCancel}
|
|
614
|
+
onLostPointerCapture={gestures.onLostPointerCapture}
|
|
615
|
+
>
|
|
616
|
+
<div ref={controller.attach.track} data-part="track" className="absolute inset-0">
|
|
617
|
+
{slots.split(",").map((i) => (
|
|
618
|
+
<Fragment key={i}>{children(Number(i))}</Fragment>
|
|
619
|
+
))}
|
|
620
|
+
</div>
|
|
621
|
+
</div>
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export type LightboxSlideProps = WithTestId & {
|
|
626
|
+
index: number
|
|
627
|
+
className?: string
|
|
628
|
+
/** Custom media instead of the image. Fades in and out, and doesn't zoom. */
|
|
629
|
+
children?: ReactNode
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
type Loaded = {
|
|
633
|
+
status: "loading" | "loaded" | "error"
|
|
634
|
+
natural?: { width: number; height: number }
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* One image (or custom media) in the window. Four nested boxes, each with
|
|
639
|
+
* one job: the slide places it in its slot, the pose carries zoom, pan and
|
|
640
|
+
* the dismiss drag, the frame is the morph's clipping box, and the media
|
|
641
|
+
* inside counter-scales so the picture never stretches.
|
|
642
|
+
*/
|
|
643
|
+
const LightboxSlide = ({ index, className, testId, children }: LightboxSlideProps) => {
|
|
644
|
+
const controller = useController()
|
|
645
|
+
const { data, loader, t, icons, format } = useShared()
|
|
646
|
+
const item = data[index]
|
|
647
|
+
const slot = useLightbox((state) => slotOf(state, index))
|
|
648
|
+
// Once zoomed in, the image asks its srcset for a rendition sized for the
|
|
649
|
+
// deepest zoom. The browser keeps showing the current one until it lands,
|
|
650
|
+
// and never trades back down, so the latch stays set.
|
|
651
|
+
const zoomed = useLightbox((state) => state.index === index && state.zoom > 1)
|
|
652
|
+
const maxZoom = useLightbox((state) => state.maxZoom)
|
|
653
|
+
const [detail, setDetail] = useState(false)
|
|
654
|
+
if (zoomed && !detail) setDetail(true)
|
|
655
|
+
const [placeholder] = useState(() => controller.placeholder(index))
|
|
656
|
+
const [loaded, setLoaded] = useState<Loaded>({ status: "loading" })
|
|
657
|
+
const root = useRef<HTMLDivElement>(null)
|
|
658
|
+
const pose = useRef<HTMLDivElement>(null)
|
|
659
|
+
const frame = useRef<HTMLDivElement>(null)
|
|
660
|
+
const media = useRef<HTMLDivElement>(null)
|
|
661
|
+
|
|
662
|
+
const custom = children ?? item?.content
|
|
663
|
+
const natural =
|
|
664
|
+
item?.width && item.height
|
|
665
|
+
? { width: item.width, height: item.height }
|
|
666
|
+
: (loaded.natural ?? placeholder?.natural)
|
|
667
|
+
const ratio = natural ? natural.width / natural.height : undefined
|
|
668
|
+
|
|
669
|
+
useIsomorphicLayoutEffect(() => {
|
|
670
|
+
if (!root.current || !pose.current || !frame.current || !media.current) return
|
|
671
|
+
const parts: SlideParts = {
|
|
672
|
+
root: root.current,
|
|
673
|
+
pose: pose.current,
|
|
674
|
+
frame: frame.current,
|
|
675
|
+
media: media.current,
|
|
676
|
+
natural: custom === undefined ? natural : undefined,
|
|
677
|
+
zoomable: custom === undefined,
|
|
678
|
+
}
|
|
679
|
+
return controller.slide(index, parts)
|
|
680
|
+
}, [controller, index, ratio, custom === undefined])
|
|
681
|
+
|
|
682
|
+
if (!item) return null
|
|
683
|
+
|
|
684
|
+
const reveal = (event: SyntheticEvent<HTMLImageElement>) => {
|
|
685
|
+
const img = event.currentTarget
|
|
686
|
+
const size = { width: img.naturalWidth, height: img.naturalHeight }
|
|
687
|
+
const decoded = typeof img.decode === "function" ? img.decode() : Promise.resolve()
|
|
688
|
+
decoded
|
|
689
|
+
.catch(() => undefined)
|
|
690
|
+
.then(() => img.isConnected && setLoaded({ status: "loaded", natural: size }))
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const sources = sourcesOf(item, loader)
|
|
694
|
+
const sizes = detail && sources.srcSet ? `${Math.round(maxZoom * 100)}vw` : sources.sizes
|
|
695
|
+
|
|
696
|
+
return (
|
|
697
|
+
// biome-ignore lint/a11y/useSemanticElements: a slide is a named group (APG carousel), not a form fieldset
|
|
698
|
+
<div
|
|
699
|
+
ref={root}
|
|
700
|
+
role="group"
|
|
701
|
+
aria-label={t.slideLabel(format(index + 1), format(data.length))}
|
|
702
|
+
inert={slot !== 0}
|
|
703
|
+
data-part="slide"
|
|
704
|
+
data-index={index}
|
|
705
|
+
{...props({ "data-current": slot === 0, "data-testid": testId ?? item.testId })}
|
|
706
|
+
style={{ "--slot": slot } as CSSProperties}
|
|
707
|
+
className={cn(
|
|
708
|
+
"absolute inset-y-0 start-[calc(var(--slot)*100%)] grid w-full place-items-center",
|
|
709
|
+
"[container-type:size] py-16 sm:px-16 group-data-thumbnails/lightbox:pb-32",
|
|
710
|
+
className,
|
|
711
|
+
)}
|
|
712
|
+
>
|
|
713
|
+
<div
|
|
714
|
+
ref={pose}
|
|
715
|
+
data-part="pose"
|
|
716
|
+
className={cn("relative", !ratio && "size-full")}
|
|
717
|
+
style={ratio ? { aspectRatio: ratio, width: `min(100cqw, 100cqh * ${ratio})` } : undefined}
|
|
718
|
+
>
|
|
719
|
+
<div ref={frame} data-part="frame" className="size-full overflow-hidden">
|
|
720
|
+
<div
|
|
721
|
+
ref={media}
|
|
722
|
+
data-part="media"
|
|
723
|
+
data-state={loaded.status}
|
|
724
|
+
className="group/media relative grid size-full place-items-center"
|
|
725
|
+
>
|
|
726
|
+
{custom !== undefined ? (
|
|
727
|
+
<div data-part="custom" className="max-h-full max-w-full">
|
|
728
|
+
{custom}
|
|
729
|
+
</div>
|
|
730
|
+
) : (
|
|
731
|
+
<>
|
|
732
|
+
{placeholder && (
|
|
733
|
+
// The opener's pixels, at once; hidden once the full image has faded in over them.
|
|
734
|
+
<img
|
|
735
|
+
src={placeholder.src}
|
|
736
|
+
alt=""
|
|
737
|
+
aria-hidden
|
|
738
|
+
draggable={false}
|
|
739
|
+
className={cn(
|
|
740
|
+
"absolute inset-0 size-full object-contain",
|
|
741
|
+
"transition-[visibility] delay-(--duration-normal) duration-0 motion-reduce:delay-0",
|
|
742
|
+
"group-data-[state=loaded]/media:invisible",
|
|
743
|
+
)}
|
|
744
|
+
/>
|
|
745
|
+
)}
|
|
746
|
+
{loaded.status === "error" && !placeholder ? (
|
|
747
|
+
<span
|
|
748
|
+
data-part="fallback"
|
|
749
|
+
className="grid place-items-center text-white/60 [&_svg]:size-8"
|
|
750
|
+
>
|
|
751
|
+
{icons.fallback}
|
|
752
|
+
</span>
|
|
753
|
+
) : (
|
|
754
|
+
<img
|
|
755
|
+
src={sources.src}
|
|
756
|
+
srcSet={sources.srcSet}
|
|
757
|
+
sizes={sizes}
|
|
758
|
+
alt={item.alt}
|
|
759
|
+
draggable={false}
|
|
760
|
+
decoding="async"
|
|
761
|
+
fetchPriority={slot === 0 ? "high" : "low"}
|
|
762
|
+
onLoad={reveal}
|
|
763
|
+
onError={() => setLoaded({ status: "error" })}
|
|
764
|
+
className={cn(
|
|
765
|
+
"relative size-full object-contain text-transparent",
|
|
766
|
+
"opacity-0 group-data-[state=loaded]/media:opacity-100",
|
|
767
|
+
"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none",
|
|
768
|
+
)}
|
|
769
|
+
/>
|
|
770
|
+
)}
|
|
771
|
+
</>
|
|
772
|
+
)}
|
|
773
|
+
</div>
|
|
774
|
+
</div>
|
|
775
|
+
</div>
|
|
776
|
+
</div>
|
|
777
|
+
)
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// ---------------------------------------------------------------------------
|
|
781
|
+
// Chrome
|
|
782
|
+
// ---------------------------------------------------------------------------
|
|
783
|
+
|
|
784
|
+
export type LightboxControlsProps = ComponentPropsWithoutRef<"div"> & WithTestId
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* A group of controls over the image. It fades with the backdrop (open,
|
|
788
|
+
* close, a dismiss drag) and hides on a tap on the image; it never hides
|
|
789
|
+
* while keyboard focus is inside. Clicks pass through its empty space.
|
|
790
|
+
*/
|
|
791
|
+
const LightboxControls = ({ className, testId, ...rest }: LightboxControlsProps) => (
|
|
792
|
+
<div
|
|
793
|
+
data-part="controls"
|
|
794
|
+
{...props({ "data-testid": testId })}
|
|
795
|
+
{...rest}
|
|
796
|
+
className={cn(
|
|
797
|
+
"pointer-events-none [&>*]:pointer-events-auto group-data-[chrome=hidden]/lightbox:[&>*]:pointer-events-none",
|
|
798
|
+
"opacity-[calc(var(--lb-fade,1)*var(--lb-dismiss,1)*var(--lb-chrome,1))]",
|
|
799
|
+
className,
|
|
800
|
+
)}
|
|
801
|
+
/>
|
|
802
|
+
)
|
|
803
|
+
|
|
804
|
+
export type LightboxCounterProps = Omit<ComponentPropsWithoutRef<"div">, "children"> &
|
|
805
|
+
WithTestId & {
|
|
806
|
+
/**
|
|
807
|
+
* Replaces `translations.counter`. A function gets the 1-based position
|
|
808
|
+
* and the count, already formatted for the locale.
|
|
809
|
+
*/
|
|
810
|
+
children?: ReactNode | ((counter: { position: string; count: string }) => ReactNode)
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/** "3 / 12". Hidden from assistive tech: the live region announces the position. Children replace it. */
|
|
814
|
+
const LightboxCounter = ({ className, testId, children, ...rest }: LightboxCounterProps) => {
|
|
815
|
+
const { t, format, data } = useShared()
|
|
816
|
+
const index = useLightbox((state) => state.index)
|
|
817
|
+
const counter = { position: format(index + 1), count: format(data.length) }
|
|
818
|
+
return (
|
|
819
|
+
<div
|
|
820
|
+
aria-hidden
|
|
821
|
+
data-part="counter"
|
|
822
|
+
{...props({ "data-testid": testId })}
|
|
823
|
+
{...rest}
|
|
824
|
+
className={cn("px-2 text-sm tabular-nums text-white/90", className)}
|
|
825
|
+
>
|
|
826
|
+
{match(children)
|
|
827
|
+
.with(P.instanceOf(Function), (render) => render(counter))
|
|
828
|
+
.with(P.nullish, () => t.counter(counter.position, counter.count))
|
|
829
|
+
.otherwise((node) => node)}
|
|
830
|
+
</div>
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export type LightboxCaptionProps = ComponentPropsWithoutRef<"div"> & WithTestId
|
|
835
|
+
|
|
836
|
+
/** The current image's `caption`, or your own children. Renders nothing when there's neither. */
|
|
837
|
+
const LightboxCaption = ({ className, testId, children, ...rest }: LightboxCaptionProps) => {
|
|
838
|
+
const { data } = useShared()
|
|
839
|
+
const caption = useLightbox((state) => data[state.index]?.caption)
|
|
840
|
+
const content = children ?? caption
|
|
841
|
+
if (content == null) return null
|
|
842
|
+
return (
|
|
843
|
+
<div
|
|
844
|
+
data-part="caption"
|
|
845
|
+
{...props({ "data-testid": testId })}
|
|
846
|
+
{...rest}
|
|
847
|
+
className={cn(
|
|
848
|
+
"max-w-prose rounded-sm bg-black/45 px-3 py-1.5 text-center text-sm text-white backdrop-blur-sm",
|
|
849
|
+
className,
|
|
850
|
+
)}
|
|
851
|
+
>
|
|
852
|
+
{content}
|
|
853
|
+
</div>
|
|
854
|
+
)
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export type LightboxThumbnailProps = ComponentPropsWithoutRef<"button"> &
|
|
858
|
+
WithTestId & {
|
|
859
|
+
/** The image it goes to. */
|
|
860
|
+
index: number
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* One image's button in the strip: `aria-current` and `data-current` on the
|
|
865
|
+
* image showing. Children replace the thumbnail `Image`; style the current
|
|
866
|
+
* one with `data-current:` (or `aria-current:`).
|
|
867
|
+
*/
|
|
868
|
+
const LightboxThumbnail = ({
|
|
869
|
+
index,
|
|
870
|
+
className,
|
|
871
|
+
testId,
|
|
872
|
+
children,
|
|
873
|
+
onClick,
|
|
874
|
+
...rest
|
|
875
|
+
}: LightboxThumbnailProps) => {
|
|
876
|
+
const controller = useController()
|
|
877
|
+
const { data, loader, t, format } = useShared()
|
|
878
|
+
const current = useLightbox((state) => state.index === index)
|
|
879
|
+
const item = data[index]
|
|
880
|
+
if (!item) return null
|
|
881
|
+
return (
|
|
882
|
+
<button
|
|
883
|
+
type="button"
|
|
884
|
+
aria-label={t.slideLabel(format(index + 1), format(data.length))}
|
|
885
|
+
aria-current={current ? "true" : undefined}
|
|
886
|
+
data-part="thumbnail"
|
|
887
|
+
data-index={index}
|
|
888
|
+
{...props({ "data-current": current, "data-testid": testId })}
|
|
889
|
+
{...rest}
|
|
890
|
+
onClick={(event) => {
|
|
891
|
+
onClick?.(event)
|
|
892
|
+
if (!event.defaultPrevented) controller.actions.goto(index)
|
|
893
|
+
}}
|
|
894
|
+
className={cn(
|
|
895
|
+
"size-14 shrink-0 rounded-xs opacity-55 transition-opacity duration-(--duration-fast) ease-standard",
|
|
896
|
+
"hover:opacity-85 aria-current:opacity-100 aria-current:ring-2 aria-current:ring-white",
|
|
897
|
+
focusStyles({ offset: false }),
|
|
898
|
+
className,
|
|
899
|
+
)}
|
|
900
|
+
>
|
|
901
|
+
{children ?? (
|
|
902
|
+
<Image
|
|
903
|
+
src={item.src}
|
|
904
|
+
alt=""
|
|
905
|
+
ratio={1}
|
|
906
|
+
sizes="56px"
|
|
907
|
+
loader={loader}
|
|
908
|
+
radius="xs"
|
|
909
|
+
className="block size-full"
|
|
910
|
+
/>
|
|
911
|
+
)}
|
|
912
|
+
</button>
|
|
913
|
+
)
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
export type LightboxThumbnailsProps = Omit<ComponentPropsWithoutRef<"div">, "children"> &
|
|
917
|
+
WithTestId & {
|
|
918
|
+
/**
|
|
919
|
+
* Renders one image's thumbnail. Defaults to `(index) => <Lightbox.Thumbnail index={index} />`;
|
|
920
|
+
* return a `Lightbox.Thumbnail` with your own children to restyle it.
|
|
921
|
+
*/
|
|
922
|
+
children?: (index: number) => ReactNode
|
|
923
|
+
classNames?: { thumbnail?: string }
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/** A strip of every image; the current one is centred, scrolled by delta so RTL needs nothing. */
|
|
927
|
+
const LightboxThumbnails = ({
|
|
928
|
+
className,
|
|
929
|
+
classNames,
|
|
930
|
+
testId,
|
|
931
|
+
children,
|
|
932
|
+
...rest
|
|
933
|
+
}: LightboxThumbnailsProps) => {
|
|
934
|
+
const { data, t } = useShared()
|
|
935
|
+
const index = useLightbox((state) => state.index)
|
|
936
|
+
const reduced = useReducedMotion()
|
|
937
|
+
const strip = useRef<HTMLDivElement>(null)
|
|
938
|
+
const settled = useRef(false)
|
|
939
|
+
|
|
940
|
+
useEffect(() => {
|
|
941
|
+
const el = strip.current
|
|
942
|
+
// By its index, so a render function may wrap or skip thumbnails.
|
|
943
|
+
const active = el?.querySelector(`[data-part="thumbnail"][data-index="${index}"]`)
|
|
944
|
+
if (!el || !active) return
|
|
945
|
+
const a = active.getBoundingClientRect()
|
|
946
|
+
const s = el.getBoundingClientRect()
|
|
947
|
+
el.scrollBy({
|
|
948
|
+
left: a.left + a.width / 2 - (s.left + s.width / 2),
|
|
949
|
+
// The first centring happens as the viewer opens: no visible scroll.
|
|
950
|
+
behavior: reduced || !settled.current ? "auto" : "smooth",
|
|
951
|
+
})
|
|
952
|
+
settled.current = true
|
|
953
|
+
}, [index, reduced])
|
|
954
|
+
|
|
955
|
+
return (
|
|
956
|
+
// biome-ignore lint/a11y/useSemanticElements: a named group of buttons, not a form fieldset
|
|
957
|
+
<div
|
|
958
|
+
ref={strip}
|
|
959
|
+
role="group"
|
|
960
|
+
aria-label={t.thumbnailsLabel}
|
|
961
|
+
data-part="thumbnails"
|
|
962
|
+
{...props({ "data-testid": testId })}
|
|
963
|
+
{...rest}
|
|
964
|
+
className={cn(
|
|
965
|
+
"flex max-w-full gap-1.5 overflow-x-auto p-1 [scrollbar-width:none]",
|
|
966
|
+
className,
|
|
967
|
+
)}
|
|
968
|
+
>
|
|
969
|
+
{data.map((_, i) => (
|
|
970
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: thumbnails are positional, like the data
|
|
971
|
+
<Fragment key={i}>
|
|
972
|
+
{children ? (
|
|
973
|
+
children(i)
|
|
974
|
+
) : (
|
|
975
|
+
<LightboxThumbnail index={i} className={classNames?.thumbnail} />
|
|
976
|
+
)}
|
|
977
|
+
</Fragment>
|
|
978
|
+
))}
|
|
979
|
+
</div>
|
|
980
|
+
)
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
type ButtonProps = ComponentPropsWithoutRef<"button"> & WithTestId
|
|
984
|
+
|
|
985
|
+
const ControlButton = ({
|
|
986
|
+
label,
|
|
987
|
+
disabled,
|
|
988
|
+
action,
|
|
989
|
+
icon,
|
|
990
|
+
className,
|
|
991
|
+
testId,
|
|
992
|
+
children,
|
|
993
|
+
onClick,
|
|
994
|
+
...rest
|
|
995
|
+
}: ButtonProps & { label: string; action: () => void; icon: ReactNode }) => (
|
|
996
|
+
<button
|
|
997
|
+
type="button"
|
|
998
|
+
aria-label={label}
|
|
999
|
+
// aria-disabled, not disabled: a control that runs out (Zoom in at max)
|
|
1000
|
+
// keeps focus instead of dropping it out of the dialog.
|
|
1001
|
+
{...props({ "aria-disabled": disabled, "data-testid": testId })}
|
|
1002
|
+
{...rest}
|
|
1003
|
+
onClick={(event) => {
|
|
1004
|
+
onClick?.(event)
|
|
1005
|
+
if (!disabled && !event.defaultPrevented) action()
|
|
1006
|
+
}}
|
|
1007
|
+
className={cn(control, className)}
|
|
1008
|
+
>
|
|
1009
|
+
{children ?? icon}
|
|
1010
|
+
</button>
|
|
1011
|
+
)
|
|
1012
|
+
|
|
1013
|
+
export type LightboxButtonProps = ButtonProps
|
|
1014
|
+
|
|
1015
|
+
/** Previous image. Disabled at the first one unless looping. Children replace `icons.prev`. */
|
|
1016
|
+
const LightboxPrev = (rest: LightboxButtonProps) => {
|
|
1017
|
+
const controller = useController()
|
|
1018
|
+
const { t, icons } = useShared()
|
|
1019
|
+
const disabled = useLightbox((state) => neighbour(state, -1) === undefined)
|
|
1020
|
+
return (
|
|
1021
|
+
<ControlButton
|
|
1022
|
+
label={t.prevLabel}
|
|
1023
|
+
disabled={disabled}
|
|
1024
|
+
action={controller.actions.prev}
|
|
1025
|
+
icon={icons.prev}
|
|
1026
|
+
{...rest}
|
|
1027
|
+
/>
|
|
1028
|
+
)
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/** Next image. Disabled at the last one unless looping. Children replace `icons.next`. */
|
|
1032
|
+
const LightboxNext = (rest: LightboxButtonProps) => {
|
|
1033
|
+
const controller = useController()
|
|
1034
|
+
const { t, icons } = useShared()
|
|
1035
|
+
const disabled = useLightbox((state) => neighbour(state, 1) === undefined)
|
|
1036
|
+
return (
|
|
1037
|
+
<ControlButton
|
|
1038
|
+
label={t.nextLabel}
|
|
1039
|
+
disabled={disabled}
|
|
1040
|
+
action={controller.actions.next}
|
|
1041
|
+
icon={icons.next}
|
|
1042
|
+
{...rest}
|
|
1043
|
+
/>
|
|
1044
|
+
)
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/** Zooms to the next level (fit → 2.5× → max). Children replace `icons.zoomIn`. */
|
|
1048
|
+
const LightboxZoomIn = (rest: LightboxButtonProps) => {
|
|
1049
|
+
const controller = useController()
|
|
1050
|
+
const { t, icons } = useShared()
|
|
1051
|
+
const zooms = useZooms()
|
|
1052
|
+
const disabled = useLightbox((state) => state.zoom >= state.maxZoom) || !zooms
|
|
1053
|
+
return (
|
|
1054
|
+
<ControlButton
|
|
1055
|
+
label={t.zoomInLabel}
|
|
1056
|
+
disabled={disabled}
|
|
1057
|
+
action={controller.actions.zoomIn}
|
|
1058
|
+
icon={icons.zoomIn}
|
|
1059
|
+
{...rest}
|
|
1060
|
+
/>
|
|
1061
|
+
)
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/** Zooms back a level. Children replace `icons.zoomOut`. */
|
|
1065
|
+
const LightboxZoomOut = (rest: LightboxButtonProps) => {
|
|
1066
|
+
const controller = useController()
|
|
1067
|
+
const { t, icons } = useShared()
|
|
1068
|
+
const zooms = useZooms()
|
|
1069
|
+
const disabled = useLightbox((state) => state.zoom <= 1) || !zooms
|
|
1070
|
+
return (
|
|
1071
|
+
<ControlButton
|
|
1072
|
+
label={t.zoomOutLabel}
|
|
1073
|
+
disabled={disabled}
|
|
1074
|
+
action={controller.actions.zoomOut}
|
|
1075
|
+
icon={icons.zoomOut}
|
|
1076
|
+
{...rest}
|
|
1077
|
+
/>
|
|
1078
|
+
)
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/** Whether the zoom controls act now: a still image, not custom media. */
|
|
1082
|
+
const useZooms = () => {
|
|
1083
|
+
const { data } = useShared()
|
|
1084
|
+
return useLightbox(
|
|
1085
|
+
(state) =>
|
|
1086
|
+
(state.phase === "idle" || state.phase === "zoomed") &&
|
|
1087
|
+
data[state.index]?.content === undefined,
|
|
1088
|
+
)
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/** Closes the viewer. Children replace `icons.close`. */
|
|
1092
|
+
const LightboxCloseTrigger = (rest: LightboxButtonProps) => {
|
|
1093
|
+
const controller = useController()
|
|
1094
|
+
const { t, icons } = useShared()
|
|
1095
|
+
return (
|
|
1096
|
+
<ControlButton
|
|
1097
|
+
label={t.closeLabel}
|
|
1098
|
+
action={controller.actions.close}
|
|
1099
|
+
icon={icons.close}
|
|
1100
|
+
{...rest}
|
|
1101
|
+
/>
|
|
1102
|
+
)
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
const fileName = (src: string) =>
|
|
1106
|
+
new URL(src, "https://x").pathname.split("/").filter(Boolean).at(-1) ?? "image"
|
|
1107
|
+
|
|
1108
|
+
export type LightboxDownloadProps = ButtonProps
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* Saves the current image (its `download.src`, or `src`), through
|
|
1112
|
+
* `DownloadButton`: busy while the image is fetched, re-clicks ignored, and a
|
|
1113
|
+
* failure announced. Children replace `icons.download`.
|
|
1114
|
+
*/
|
|
1115
|
+
const LightboxDownload = ({
|
|
1116
|
+
className,
|
|
1117
|
+
testId,
|
|
1118
|
+
children,
|
|
1119
|
+
onClick,
|
|
1120
|
+
...rest
|
|
1121
|
+
}: LightboxDownloadProps) => {
|
|
1122
|
+
const { data, t, icons } = useShared()
|
|
1123
|
+
const item = useLightbox((state) => data[state.index])
|
|
1124
|
+
if (!item) return null
|
|
1125
|
+
const src = item.download?.src ?? item.src
|
|
1126
|
+
return (
|
|
1127
|
+
<DownloadButton
|
|
1128
|
+
asChild
|
|
1129
|
+
name={item.download?.name ?? fileName(src)}
|
|
1130
|
+
// Fetched to a Blob so `name` holds for a cross-origin image too, which
|
|
1131
|
+
// a plain link would ignore (the image host must allow CORS).
|
|
1132
|
+
data={({ signal }) =>
|
|
1133
|
+
fetch(src, { signal }).then((response) => {
|
|
1134
|
+
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`)
|
|
1135
|
+
return response.blob()
|
|
1136
|
+
})
|
|
1137
|
+
}
|
|
1138
|
+
translations={{ error: t.downloadError }}
|
|
1139
|
+
testId={testId}
|
|
1140
|
+
onClick={onClick}
|
|
1141
|
+
>
|
|
1142
|
+
<button
|
|
1143
|
+
type="button"
|
|
1144
|
+
aria-label={t.downloadLabel}
|
|
1145
|
+
{...rest}
|
|
1146
|
+
className={cn(control, className)}
|
|
1147
|
+
>
|
|
1148
|
+
{children ?? icons.download}
|
|
1149
|
+
</button>
|
|
1150
|
+
</DownloadButton>
|
|
1151
|
+
)
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
export type LightboxContextProps = { children: (api: LightboxApi) => ReactNode }
|
|
1155
|
+
|
|
1156
|
+
/** The viewer's state and commands, for controls of your own. */
|
|
1157
|
+
const LightboxContext = ({ children }: LightboxContextProps) => {
|
|
1158
|
+
const controller = useController()
|
|
1159
|
+
const { data } = useShared()
|
|
1160
|
+
const state = useLightbox((s) => s)
|
|
1161
|
+
return children({
|
|
1162
|
+
phase: state.phase,
|
|
1163
|
+
open: state.phase !== "closed" && state.phase !== "closing",
|
|
1164
|
+
index: state.index,
|
|
1165
|
+
count: data.length,
|
|
1166
|
+
zoom: state.zoom,
|
|
1167
|
+
...controller.actions,
|
|
1168
|
+
})
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// ---------------------------------------------------------------------------
|
|
1172
|
+
// Ready-made viewer
|
|
1173
|
+
// ---------------------------------------------------------------------------
|
|
1174
|
+
|
|
1175
|
+
export type LightboxClassNames = {
|
|
1176
|
+
positioner?: string
|
|
1177
|
+
backdrop?: string
|
|
1178
|
+
content?: string
|
|
1179
|
+
viewport?: string
|
|
1180
|
+
controls?: string
|
|
1181
|
+
/** Every button alike: previous, next, zoom, download and close. */
|
|
1182
|
+
control?: string
|
|
1183
|
+
prev?: string
|
|
1184
|
+
next?: string
|
|
1185
|
+
zoomIn?: string
|
|
1186
|
+
zoomOut?: string
|
|
1187
|
+
download?: string
|
|
1188
|
+
close?: string
|
|
1189
|
+
counter?: string
|
|
1190
|
+
caption?: string
|
|
1191
|
+
thumbnails?: string
|
|
1192
|
+
/** Each thumbnail's button. */
|
|
1193
|
+
thumbnail?: string
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
export type LightboxProps = LightboxRootProps &
|
|
1197
|
+
WithTestId & {
|
|
1198
|
+
/** "3 / 12" in the top bar. On when there's more than one image. */
|
|
1199
|
+
withCounter?: boolean
|
|
1200
|
+
/** A strip of every image along the bottom. */
|
|
1201
|
+
withThumbnails?: boolean
|
|
1202
|
+
/** A button that saves the current image. */
|
|
1203
|
+
withDownload?: boolean
|
|
1204
|
+
withCloseButton?: boolean
|
|
1205
|
+
/** Portal target. Defaults to `document.body`. */
|
|
1206
|
+
container?: HTMLElement | null
|
|
1207
|
+
/** Applies to the dialog content. */
|
|
1208
|
+
className?: string
|
|
1209
|
+
classNames?: LightboxClassNames
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
const LightboxComponent = ({
|
|
1213
|
+
withCounter,
|
|
1214
|
+
withThumbnails = false,
|
|
1215
|
+
withDownload = false,
|
|
1216
|
+
withCloseButton = true,
|
|
1217
|
+
container,
|
|
1218
|
+
className,
|
|
1219
|
+
classNames,
|
|
1220
|
+
testId,
|
|
1221
|
+
children,
|
|
1222
|
+
...root
|
|
1223
|
+
}: LightboxProps) => {
|
|
1224
|
+
const multiple = root.data.length > 1
|
|
1225
|
+
const zoomable = root.zoom ?? true
|
|
1226
|
+
const button = (part: Exclude<LightboxIconSlot, "fallback">) =>
|
|
1227
|
+
cn(classNames?.control, classNames?.[part])
|
|
1228
|
+
return (
|
|
1229
|
+
<LightboxRoot {...root}>
|
|
1230
|
+
{children}
|
|
1231
|
+
<LightboxContent
|
|
1232
|
+
container={container}
|
|
1233
|
+
testId={testId}
|
|
1234
|
+
className={cn(className, classNames?.content)}
|
|
1235
|
+
classNames={{ positioner: classNames?.positioner, backdrop: classNames?.backdrop }}
|
|
1236
|
+
{...props({ "data-thumbnails": withThumbnails })}
|
|
1237
|
+
>
|
|
1238
|
+
<LightboxViewport className={classNames?.viewport} />
|
|
1239
|
+
<LightboxControls
|
|
1240
|
+
className={cn(
|
|
1241
|
+
"absolute inset-x-0 top-0 flex items-center gap-1 p-2 sm:p-3",
|
|
1242
|
+
classNames?.controls,
|
|
1243
|
+
)}
|
|
1244
|
+
>
|
|
1245
|
+
{(withCounter ?? multiple) && <LightboxCounter className={classNames?.counter} />}
|
|
1246
|
+
<div className="ms-auto flex gap-1">
|
|
1247
|
+
{zoomable && <LightboxZoomOut className={button("zoomOut")} />}
|
|
1248
|
+
{zoomable && <LightboxZoomIn className={button("zoomIn")} />}
|
|
1249
|
+
{withDownload && <LightboxDownload className={button("download")} />}
|
|
1250
|
+
{withCloseButton && <LightboxCloseTrigger className={button("close")} />}
|
|
1251
|
+
</div>
|
|
1252
|
+
</LightboxControls>
|
|
1253
|
+
{multiple && (
|
|
1254
|
+
<LightboxControls
|
|
1255
|
+
className={cn(
|
|
1256
|
+
"absolute inset-x-0 top-1/2 flex -translate-y-1/2 justify-between p-2 sm:p-3",
|
|
1257
|
+
classNames?.controls,
|
|
1258
|
+
)}
|
|
1259
|
+
>
|
|
1260
|
+
<LightboxPrev className={button("prev")} />
|
|
1261
|
+
<LightboxNext className={button("next")} />
|
|
1262
|
+
</LightboxControls>
|
|
1263
|
+
)}
|
|
1264
|
+
<LightboxControls
|
|
1265
|
+
className={cn(
|
|
1266
|
+
"absolute inset-x-0 bottom-0 flex flex-col items-center gap-2 p-3",
|
|
1267
|
+
classNames?.controls,
|
|
1268
|
+
)}
|
|
1269
|
+
>
|
|
1270
|
+
<LightboxCaption className={classNames?.caption} />
|
|
1271
|
+
{withThumbnails && (
|
|
1272
|
+
<LightboxThumbnails
|
|
1273
|
+
className={classNames?.thumbnails}
|
|
1274
|
+
classNames={{ thumbnail: classNames?.thumbnail }}
|
|
1275
|
+
/>
|
|
1276
|
+
)}
|
|
1277
|
+
</LightboxControls>
|
|
1278
|
+
</LightboxContent>
|
|
1279
|
+
</LightboxRoot>
|
|
1280
|
+
)
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
export const Lightbox = Object.assign(LightboxComponent, {
|
|
1284
|
+
Root: LightboxRoot,
|
|
1285
|
+
Trigger: LightboxTrigger,
|
|
1286
|
+
Content: LightboxContent,
|
|
1287
|
+
Viewport: LightboxViewport,
|
|
1288
|
+
Slide: LightboxSlide,
|
|
1289
|
+
Controls: LightboxControls,
|
|
1290
|
+
Counter: LightboxCounter,
|
|
1291
|
+
Caption: LightboxCaption,
|
|
1292
|
+
Thumbnails: LightboxThumbnails,
|
|
1293
|
+
Thumbnail: LightboxThumbnail,
|
|
1294
|
+
Prev: LightboxPrev,
|
|
1295
|
+
Next: LightboxNext,
|
|
1296
|
+
ZoomIn: LightboxZoomIn,
|
|
1297
|
+
ZoomOut: LightboxZoomOut,
|
|
1298
|
+
Download: LightboxDownload,
|
|
1299
|
+
CloseTrigger: LightboxCloseTrigger,
|
|
1300
|
+
Context: LightboxContext,
|
|
1301
|
+
})
|