@42-central/ui-react 0.20.0 → 0.20.2
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/dist/{chunk-P276SCCV.js → chunk-2BNIHOMT.js} +6 -6
- package/dist/{chunk-P276SCCV.js.map → chunk-2BNIHOMT.js.map} +1 -1
- package/dist/{chunk-PAFS7TED.js → chunk-2HIX6DKN.js} +3 -3
- package/dist/{chunk-PAFS7TED.js.map → chunk-2HIX6DKN.js.map} +1 -1
- package/dist/{chunk-Z5WYYDG2.js → chunk-2MXWEIMD.js} +7 -4
- package/dist/chunk-2MXWEIMD.js.map +1 -0
- package/dist/{chunk-VVM7JMZS.js → chunk-37VQGKD6.js} +8 -8
- package/dist/{chunk-VVM7JMZS.js.map → chunk-37VQGKD6.js.map} +1 -1
- package/dist/{chunk-7R4CDHBK.js → chunk-45QRQKRC.js} +4 -4
- package/dist/{chunk-7R4CDHBK.js.map → chunk-45QRQKRC.js.map} +1 -1
- package/dist/{chunk-FZNPJAGJ.js → chunk-45TG7H5Q.js} +5 -5
- package/dist/{chunk-FZNPJAGJ.js.map → chunk-45TG7H5Q.js.map} +1 -1
- package/dist/{chunk-MKJKCBRE.js → chunk-47LEAR6G.js} +6 -6
- package/dist/{chunk-MKJKCBRE.js.map → chunk-47LEAR6G.js.map} +1 -1
- package/dist/chunk-4ASNIDV7.js +17 -0
- package/dist/chunk-4ASNIDV7.js.map +1 -0
- package/dist/{chunk-WFHY6NRQ.js → chunk-5CNVVA7I.js} +11 -11
- package/dist/{chunk-WFHY6NRQ.js.map → chunk-5CNVVA7I.js.map} +1 -1
- package/dist/{chunk-2TM7UVM2.js → chunk-6M6YZ3PQ.js} +4 -4
- package/dist/{chunk-2TM7UVM2.js.map → chunk-6M6YZ3PQ.js.map} +1 -1
- package/dist/{chunk-4BGU2UQB.js → chunk-6VYGK3Q3.js} +6 -6
- package/dist/{chunk-4BGU2UQB.js.map → chunk-6VYGK3Q3.js.map} +1 -1
- package/dist/{chunk-ZFUTGBJC.js → chunk-6YNLRQ25.js} +3 -3
- package/dist/{chunk-ZFUTGBJC.js.map → chunk-6YNLRQ25.js.map} +1 -1
- package/dist/{chunk-6OV6EJQ2.js → chunk-7AQ4MN4M.js} +6 -6
- package/dist/{chunk-6OV6EJQ2.js.map → chunk-7AQ4MN4M.js.map} +1 -1
- package/dist/{chunk-5337N3FE.js → chunk-7BOSX65U.js} +3 -3
- package/dist/{chunk-5337N3FE.js.map → chunk-7BOSX65U.js.map} +1 -1
- package/dist/{chunk-THLMW5IU.js → chunk-7CNDZZZ6.js} +4 -4
- package/dist/{chunk-THLMW5IU.js.map → chunk-7CNDZZZ6.js.map} +1 -1
- package/dist/{chunk-LJ3GHC4V.js → chunk-BE2LWUHY.js} +5 -5
- package/dist/{chunk-LJ3GHC4V.js.map → chunk-BE2LWUHY.js.map} +1 -1
- package/dist/{chunk-2KN3MI7I.js → chunk-C4NFRSOR.js} +4 -4
- package/dist/{chunk-2KN3MI7I.js.map → chunk-C4NFRSOR.js.map} +1 -1
- package/dist/{chunk-3REFDGOM.js → chunk-C6NVU4F7.js} +3 -3
- package/dist/{chunk-3REFDGOM.js.map → chunk-C6NVU4F7.js.map} +1 -1
- package/dist/{chunk-LSIX2PVU.js → chunk-C74TV64U.js} +7 -7
- package/dist/{chunk-LSIX2PVU.js.map → chunk-C74TV64U.js.map} +1 -1
- package/dist/{chunk-HVOEVB4E.js → chunk-D2QIPQ74.js} +3 -3
- package/dist/{chunk-HVOEVB4E.js.map → chunk-D2QIPQ74.js.map} +1 -1
- package/dist/{chunk-4EU6FGGB.js → chunk-DA4QII2N.js} +4 -4
- package/dist/{chunk-4EU6FGGB.js.map → chunk-DA4QII2N.js.map} +1 -1
- package/dist/{chunk-LZWA7V62.js → chunk-DJLNGWMM.js} +5 -5
- package/dist/{chunk-LZWA7V62.js.map → chunk-DJLNGWMM.js.map} +1 -1
- package/dist/{chunk-HEQ2H6VO.js → chunk-DT6LKNZF.js} +4 -4
- package/dist/{chunk-HEQ2H6VO.js.map → chunk-DT6LKNZF.js.map} +1 -1
- package/dist/{chunk-BUFALAEK.js → chunk-E5H3YWZV.js} +4 -4
- package/dist/{chunk-BUFALAEK.js.map → chunk-E5H3YWZV.js.map} +1 -1
- package/dist/{chunk-H7INUXZD.js → chunk-F342ZT7O.js} +4 -4
- package/dist/{chunk-H7INUXZD.js.map → chunk-F342ZT7O.js.map} +1 -1
- package/dist/{chunk-KOT4PWGE.js → chunk-FDCPMUJK.js} +6 -6
- package/dist/{chunk-KOT4PWGE.js.map → chunk-FDCPMUJK.js.map} +1 -1
- package/dist/{chunk-VALQ2XVA.js → chunk-H3PYSAWN.js} +3 -3
- package/dist/{chunk-VALQ2XVA.js.map → chunk-H3PYSAWN.js.map} +1 -1
- package/dist/{chunk-WR444JRU.js → chunk-HQPU73WV.js} +7 -7
- package/dist/{chunk-WR444JRU.js.map → chunk-HQPU73WV.js.map} +1 -1
- package/dist/{chunk-Q5ZO2O25.js → chunk-HRNWWL3Y.js} +6 -6
- package/dist/{chunk-Q5ZO2O25.js.map → chunk-HRNWWL3Y.js.map} +1 -1
- package/dist/{chunk-HBFN5W7Q.js → chunk-JVG5ISPT.js} +4 -4
- package/dist/{chunk-HBFN5W7Q.js.map → chunk-JVG5ISPT.js.map} +1 -1
- package/dist/{chunk-JL4QMM46.js → chunk-LFQDB5OD.js} +5 -5
- package/dist/{chunk-JL4QMM46.js.map → chunk-LFQDB5OD.js.map} +1 -1
- package/dist/{chunk-U2PNMMDB.js → chunk-LKFHUDEW.js} +7 -7
- package/dist/{chunk-U2PNMMDB.js.map → chunk-LKFHUDEW.js.map} +1 -1
- 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-S4TRYMCU.js → chunk-MXAACRWE.js} +6 -6
- package/dist/{chunk-S4TRYMCU.js.map → chunk-MXAACRWE.js.map} +1 -1
- package/dist/{chunk-ZN3WYGIQ.js → chunk-N66NC6QK.js} +121 -25
- package/dist/chunk-N66NC6QK.js.map +1 -0
- package/dist/{chunk-DUPE2CRU.js → chunk-NKOTA5TM.js} +3 -3
- package/dist/{chunk-DUPE2CRU.js.map → chunk-NKOTA5TM.js.map} +1 -1
- package/dist/{chunk-RGLNH7A5.js → chunk-NLOBBJAA.js} +3 -3
- package/dist/{chunk-RGLNH7A5.js.map → chunk-NLOBBJAA.js.map} +1 -1
- package/dist/{chunk-FXDLS23K.js → chunk-NS6RGPWR.js} +3 -3
- package/dist/{chunk-FXDLS23K.js.map → chunk-NS6RGPWR.js.map} +1 -1
- package/dist/{chunk-ZWOZL4XX.js → chunk-O5W3QWJ6.js} +5 -5
- package/dist/{chunk-ZWOZL4XX.js.map → chunk-O5W3QWJ6.js.map} +1 -1
- package/dist/{chunk-PD4FX34E.js → chunk-O7LS6OZR.js} +4 -4
- package/dist/{chunk-PD4FX34E.js.map → chunk-O7LS6OZR.js.map} +1 -1
- package/dist/{chunk-K6BHDFX3.js → chunk-QKSLDQM2.js} +3 -3
- package/dist/{chunk-K6BHDFX3.js.map → chunk-QKSLDQM2.js.map} +1 -1
- package/dist/{chunk-CDHIF2NV.js → chunk-QNKD2SQM.js} +8 -8
- package/dist/{chunk-CDHIF2NV.js.map → chunk-QNKD2SQM.js.map} +1 -1
- package/dist/{chunk-SE3CGQRO.js → chunk-RLOWPCGG.js} +3 -3
- package/dist/{chunk-SE3CGQRO.js.map → chunk-RLOWPCGG.js.map} +1 -1
- package/dist/{chunk-R57QP43T.js → chunk-SVKN5ZHX.js} +4 -4
- package/dist/{chunk-R57QP43T.js.map → chunk-SVKN5ZHX.js.map} +1 -1
- package/dist/{chunk-NJ4RO3CT.js → chunk-SWVUXEBT.js} +5 -5
- package/dist/{chunk-NJ4RO3CT.js.map → chunk-SWVUXEBT.js.map} +1 -1
- package/dist/{chunk-GGT4GJD6.js → chunk-TWNIAF7K.js} +3 -3
- package/dist/{chunk-GGT4GJD6.js.map → chunk-TWNIAF7K.js.map} +1 -1
- package/dist/{chunk-4TCTMRR5.js → chunk-UAYENYS2.js} +5 -5
- package/dist/{chunk-4TCTMRR5.js.map → chunk-UAYENYS2.js.map} +1 -1
- package/dist/{chunk-DHTSVJ4G.js → chunk-UCCJUFOG.js} +9 -9
- package/dist/{chunk-DHTSVJ4G.js.map → chunk-UCCJUFOG.js.map} +1 -1
- package/dist/{chunk-HDRC6ITF.js → chunk-UT3TOV2Q.js} +3 -3
- package/dist/{chunk-HDRC6ITF.js.map → chunk-UT3TOV2Q.js.map} +1 -1
- package/dist/{chunk-6KER77RS.js → chunk-UVQXRDRO.js} +7 -7
- package/dist/{chunk-6KER77RS.js.map → chunk-UVQXRDRO.js.map} +1 -1
- package/dist/{chunk-R52P43LZ.js → chunk-UXPINIDN.js} +3 -3
- package/dist/{chunk-R52P43LZ.js.map → chunk-UXPINIDN.js.map} +1 -1
- package/dist/chunk-V6PY7C6S.js +18 -0
- package/dist/chunk-V6PY7C6S.js.map +1 -0
- package/dist/{chunk-45DFYIK5.js → chunk-VD6PB3VA.js} +3 -3
- package/dist/{chunk-45DFYIK5.js.map → chunk-VD6PB3VA.js.map} +1 -1
- package/dist/{chunk-7AWOMWCQ.js → chunk-WXL5RP6P.js} +7 -7
- package/dist/{chunk-7AWOMWCQ.js.map → chunk-WXL5RP6P.js.map} +1 -1
- package/dist/{chunk-IMP5VHEN.js → chunk-XKDL4QS6.js} +3 -3
- package/dist/{chunk-IMP5VHEN.js.map → chunk-XKDL4QS6.js.map} +1 -1
- package/dist/{chunk-H26K66EU.js → chunk-Y57NW6G7.js} +3 -3
- package/dist/{chunk-H26K66EU.js.map → chunk-Y57NW6G7.js.map} +1 -1
- package/dist/{chunk-2OQP7UY4.js → chunk-YZJUPYPO.js} +5 -5
- package/dist/{chunk-2OQP7UY4.js.map → chunk-YZJUPYPO.js.map} +1 -1
- package/dist/{chunk-JYK6JVR3.js → chunk-Z4MBCKG5.js} +8 -8
- package/dist/{chunk-JYK6JVR3.js.map → chunk-Z4MBCKG5.js.map} +1 -1
- package/dist/components/accordion/index.js +5 -5
- package/dist/components/action-icon/index.js +4 -4
- package/dist/components/alert/index.js +6 -6
- package/dist/components/ambient-background/index.js +1 -1
- package/dist/components/app-shell/index.js +6 -6
- package/dist/components/aspect-ratio/index.js +1 -1
- package/dist/components/autocomplete/index.js +7 -6
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/badge/index.js +3 -3
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/button/index.js +4 -4
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-multi-select/index.js +7 -7
- package/dist/components/button-select/index.js +7 -7
- package/dist/components/calendar/index.js +6 -6
- package/dist/components/camera/index.js +15 -14
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/index.js +2 -2
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/chart/index.js +1 -1
- package/dist/components/checkbox/index.js +6 -6
- package/dist/components/choice-card-group/index.js +5 -5
- package/dist/components/circular-progress/index.js +1 -1
- package/dist/components/clipboard/index.js +6 -6
- package/dist/components/code/index.js +2 -2
- package/dist/components/code-block/chrome.js +7 -7
- package/dist/components/code-block/index.js +8 -8
- 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 +2 -2
- package/dist/components/combobox/index.js +7 -6
- package/dist/components/combobox-list/index.js +9 -8
- package/dist/components/compare/index.js +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/data-table/index.js +33 -33
- package/dist/components/date-picker/index.js +16 -15
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/divider/index.js +2 -2
- package/dist/components/download-button/index.js +5 -5
- package/dist/components/drawer/index.js +6 -6
- package/dist/components/field/index.js +2 -2
- package/dist/components/figure/index.js +2 -2
- package/dist/components/file-item/index.js +8 -8
- package/dist/components/file-preview/index.js +6 -6
- package/dist/components/file-queue-summary/index.js +2 -2
- package/dist/components/file-trigger/index.js +5 -5
- package/dist/components/file-upload/index.js +10 -10
- package/dist/components/flex/index.js +2 -2
- package/dist/components/gallery/index.js +4 -4
- package/dist/components/grid/index.js +1 -1
- package/dist/components/hover-card/hover-card.d.ts +44 -26
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +36 -54
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +2 -2
- package/dist/components/image-cropper/index.js +7 -7
- package/dist/components/indicator/index.js +1 -1
- package/dist/components/input/index.js +3 -3
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/lightbox/index.js +9 -9
- package/dist/components/mark/index.js +2 -2
- package/dist/components/menu/index.js +5 -5
- package/dist/components/modal/index.js +6 -6
- package/dist/components/multi-combobox-list/index.js +11 -10
- package/dist/components/multi-select/index.js +10 -9
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/nav-link/index.js +5 -5
- package/dist/components/nav-link/tanstack.js +5 -5
- package/dist/components/notification/index.js +7 -7
- package/dist/components/number-input/index.js +7 -6
- package/dist/components/overlays/index.js +8 -8
- package/dist/components/password-input/index.js +4 -4
- package/dist/components/photo-capture/index.js +18 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pill/index.js +3 -3
- package/dist/components/pills-input/index.js +6 -6
- package/dist/components/pin-input/index.js +3 -3
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/index.js +3 -2
- package/dist/components/popover/popover.d.ts +44 -29
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.js +2 -2
- package/dist/components/radio-group/index.js +4 -4
- package/dist/components/rating/index.js +3 -3
- package/dist/components/schedule/index.js +10 -10
- package/dist/components/segment-group/index.js +3 -3
- package/dist/components/select/index.js +8 -7
- package/dist/components/skeleton/index.js +2 -2
- package/dist/components/slider/index.js +4 -4
- package/dist/components/spinner/index.js +2 -2
- package/dist/components/spotlight/index.js +16 -15
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/switch/index.js +3 -3
- package/dist/components/table/index.js +3 -3
- package/dist/components/tabs/index.js +3 -3
- package/dist/components/tags-input/index.js +9 -8
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/text/index.js +2 -2
- package/dist/components/text-input/index.js +3 -3
- package/dist/components/textarea/index.js +3 -3
- package/dist/components/theme-icon/index.js +3 -3
- package/dist/components/time-input/index.js +9 -8
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/title/index.js +2 -2
- package/dist/components/tooltip/index.js +4 -4
- package/dist/components/tree-multi-select/index.js +11 -10
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-select/index.js +8 -7
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +1 -1
- package/dist/lib/placement.d.ts +42 -1
- package/dist/lib/placement.d.ts.map +1 -1
- package/dist/lib/slide-on-switch.d.ts +69 -0
- package/dist/lib/slide-on-switch.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/card/card.test.tsx +10 -0
- package/src/components/card/card.tsx +4 -1
- package/src/components/hover-card/hover-card.tsx +89 -167
- package/src/components/popover/index.ts +2 -0
- package/src/components/popover/popover.test.tsx +131 -0
- package/src/components/popover/popover.tsx +191 -53
- package/src/lib/cn.test.ts +9 -0
- package/src/lib/cn.ts +9 -1
- package/src/lib/placement.test.ts +37 -0
- package/src/lib/placement.ts +60 -1
- package/src/lib/slide-on-switch.ts +99 -0
- package/dist/chunk-G52U24GR.js +0 -10
- package/dist/chunk-G52U24GR.js.map +0 -1
- package/dist/chunk-QP4I37PA.js +0 -14
- package/dist/chunk-QP4I37PA.js.map +0 -1
- package/dist/chunk-Z5WYYDG2.js.map +0 -1
- package/dist/chunk-ZN3WYGIQ.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/image/srcset.ts","../src/components/image/blur-svg.ts","../src/components/image/image.tsx"],"names":["loader","width","match","P"],"mappings":";;;;;;;;;;;;;;AAiBO,IAAM,YAAA,GAAe;AAAA,EAC1B,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM;AAC5E;AAyBO,SAAS,cAAA,CAAe;AAAA,EAC7B,GAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAAiC;AAC/B,EAAA,OAAO,MAAM,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,CAAA,CAClC,IAAA,CAAK,EAAE,MAAA,EAAQ,EAAE,OAAA,EAAQ,EAAG,OAAO,EAAE,GAAA,GAAM,CAAA,CAC3C,IAAA,CAAK,EAAE,MAAA,EAAQ,EAAE,GAAA,CAAI,CAAA,CAAE,OAAO,CAAA,EAAG,KAAA,EAAO,EAAE,OAAA,EAAS,KAAA,EAAO,CAAA,CAAE,MAAA,IAAU,CAAC,EAAE,QAAAA,OAAAA,EAAQ,KAAA,EAAAC,QAAM,KAAM;AAC5F,IAAA,MAAM,EAAA,GAAK,CAAC,OAAA,KAAoBD,OAAAA,CAAO,EAAE,KAAK,KAAA,EAAOC,MAAAA,GAAQ,OAAA,EAAS,OAAA,EAAS,CAAA;AAC/E,IAAA,OAAO,EAAE,GAAA,EAAK,EAAA,CAAG,CAAC,GAAG,MAAA,EAAQ,CAAA,EAAG,EAAA,CAAG,CAAC,CAAC,CAAA,KAAA,EAAQ,EAAA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AA;AACH,cAEA;AAAA;AAAA;AAEJ;AAAA,GAEJ;AAEJ","file":"chunk-H26K66EU.js","sourcesContent":["import { match, P } from \"ts-pattern\"\n\n/**\n * Builds a CDN URL for one rendition of an image. The kit never resizes\n * anything itself: a loader maps `{ src, width, quality }` onto whatever query\n * string or path your image service expects.\n *\n * const unsplash: ImageLoader = ({ src, width, quality = 75 }) =>\n * `${src}?w=${width}&q=${quality}&auto=format`\n */\nexport type ImageLoader = (params: { src: string; width: number; quality?: number }) => string\n\n/**\n * Candidate widths for a `sizes`-driven srcset: next/image's small image sizes\n * followed by its device sizes, so a thumbnail and a full-bleed hero both land\n * near a real rendition.\n */\nexport const IMAGE_WIDTHS = [\n 16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840,\n] as const\n\nexport type ImageSources = { src: string; srcSet?: string; sizes?: string }\n\ntype ResolveOptions = {\n src: string\n loader?: ImageLoader\n width?: number\n sizes?: string\n quality?: number\n}\n\n/**\n * What the `<img>` (and its priority preload) should request.\n *\n * - No loader: the plain `src`. Without a service to ask, there are no other\n * renditions to choose from.\n * - Loader + `sizes`: `w` descriptors from `IMAGE_WIDTHS`, capped at twice\n * `width` when it's known (nothing gains from a rendition sharper than a 2x\n * screen needs). The browser picks one from `sizes`.\n * - Loader + `width`: a fixed-size image, so `1x` and `2x` are enough.\n * - Loader alone: treated as full-width (`sizes=\"100vw\"`).\n *\n * `src` is always the largest rendition, for browsers that ignore srcset.\n */\nexport function resolveSources({\n src,\n loader,\n width,\n sizes,\n quality,\n}: ResolveOptions): ImageSources {\n return match({ loader, width, sizes })\n .with({ loader: P.nullish }, () => ({ src }))\n .with({ loader: P.not(P.nullish), sizes: P.nullish, width: P.number }, ({ loader, width }) => {\n const at = (density: number) => loader({ src, width: width * density, quality })\n return { src: at(2), srcSet: `${at(1)} 1x, ${at(2)} 2x` }\n })\n .with({ loader: P.not(P.nullish) }, ({ loader }) => {\n const cap = width === undefined ? Number.POSITIVE_INFINITY : width * 2\n const fitting = IMAGE_WIDTHS.filter((w) => w <= cap)\n const widths = fitting.length > 0 ? fitting : [cap]\n const urls = widths.map((w) => ({ w, url: loader({ src, width: w, quality }) }))\n return {\n src: urls.at(-1)?.url ?? src,\n srcSet: urls.map(({ w, url }) => `${url} ${w}w`).join(\", \"),\n sizes: sizes ?? \"100vw\",\n }\n })\n .exhaustive()\n}\n","/**\n * A blurred version of a tiny `data:` placeholder, as a CSS `background-image`\n * value. Ported from next/image's `image-blur-svg.ts`: the thumbnail is drawn\n * into an SVG through an `feGaussianBlur`, so a 10px base64 image scales up\n * into a soft wash instead of a pixelated mosaic. No canvas, no dependency,\n * and it's plain CSS, so it's already painted in the server HTML.\n *\n * The middle of the filter (the `feColorMatrix` alpha boost, then compositing\n * the result over the source) keeps the edges opaque: a bare blur fades to\n * transparent near the border and the box would read as having a halo.\n *\n * With both dimensions known the SVG gets a matching viewBox and stretches to\n * fill (`preserveAspectRatio=\"none\"`), the way the image itself will. Without\n * them, the image inside the SVG follows `fit` instead.\n */\nconst BLUR = 20\n\ntype BlurOptions = {\n placeholder: string\n width?: number\n height?: number\n fit: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\"\n}\n\nconst ASPECT = {\n cover: \"xMidYMid slice\",\n contain: \"xMidYMid\",\n fill: \"none\",\n none: \"xMidYMid slice\",\n \"scale-down\": \"xMidYMid\",\n} as const\n\nexport function blurSvg({ placeholder, width, height, fit }: BlurOptions): string {\n const sized = width !== undefined && height !== undefined\n const viewBox = sized ? `viewBox='0 0 ${width} ${height}'` : \"\"\n const aspect = sized ? \"none\" : ASPECT[fit]\n const svg =\n `%3Csvg xmlns='http://www.w3.org/2000/svg' ${viewBox}%3E` +\n `%3Cfilter id='b' color-interpolation-filters='sRGB'%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E` +\n `%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E` +\n `%3CfeComposite operator='out' in='s'/%3E` +\n `%3CfeComposite in2='SourceGraphic'/%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3C/filter%3E` +\n `%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${aspect}' ` +\n `style='filter: url(%23b);' href='${placeholder}'/%3E` +\n `%3C/svg%3E`\n return `url(\"data:image/svg+xml;charset=utf-8,${svg}\")`\n}\n\n/** A placeholder string is a data URI (blurred) or any CSS color (painted flat). */\nexport const isDataUri = (placeholder: string): boolean => placeholder.startsWith(\"data:\")\n","\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { ImageOff } from \"lucide-react\"\nimport {\n type ComponentProps,\n type CSSProperties,\n type ReactNode,\n type SyntheticEvent,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { preload } from \"react-dom\"\nimport { match, P } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS } from \"../../lib/radius\"\nimport { type Ratio, ratioStyle } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useIsomorphicLayoutEffect } from \"../../lib/use-isomorphic-layout-effect\"\nimport { blurSvg, isDataUri } from \"./blur-svg\"\nimport { type ImageLoader, resolveSources } from \"./srcset\"\n\n/**\n * Image — an `<img>` that holds its box while it loads, then crossfades in.\n *\n * <Image src={photo.url} alt={photo.description} ratio=\"4/3\" placeholder={photo.blur} />\n *\n * Two elements: a root `<span>` that owns the box (aspect ratio, radius,\n * clipping) and paints the placeholder, and the `<img>` inside it, which\n * fades from transparent to opaque once it has loaded *and* decoded. The\n * placeholder is a CSS color, or a tiny `data:` URI blurred through an SVG\n * filter (`blur-svg.ts`); without one, the root pulses with Skeleton's own\n * tokens. All three are plain CSS, so they're in the server HTML. When the\n * image fails, a color or blur stays under the fallback as a hint of what\n * belonged there; the skeleton doesn't, since a shimmer reads as \"loading\".\n *\n * The fade is pure CSS keyed on `data-state`, so it only runs once React has\n * hydrated and seen the load: a non-priority image shows at hydration or at\n * load, whichever is later. `priority` opts out for the above-the-fold image\n * (the LCP candidate): it's preloaded, fetched eagerly, and never hidden.\n *\n * Loading is tracked per source, in a results map rather than a single flag\n * reset by an effect: a new `src` has no entry and so reads as `loading` on\n * its very first render, and a `fallbackSrc` that fails too is never retried,\n * so the fallback can't loop. The `<img>` is keyed by the source it shows, so\n * a late event from the previous one can't land on the next.\n *\n * Hydration-safe in the same way as next/image: an image that finished (or\n * failed) before React attached its handlers is caught in a layout effect,\n * through `complete` and `naturalWidth`.\n *\n * No `asChild`: the component is two elements, and the consumer's child could\n * only stand in for one of them.\n */\nconst imageRoot = cva(\n [\n \"relative inline-block max-w-full overflow-clip align-middle\",\n // Driven by `width` through a variable, so a consumer's `w-*` still wins.\n \"w-(--image-width)\",\n // The placeholder is dropped once the image is opaque, not when it starts\n // fading in: removing it at once would flash the page through the fade.\n // A zero-length transition with a delay is how CSS defers a discrete\n // change, and `allow-discrete` lets `background-image` take part.\n \"transition-[background] duration-0 transition-discrete\",\n // With no fade under reduced motion, there is nothing to wait for.\n \"data-[state=loaded]:delay-(--duration-normal) motion-reduce:data-[state=loaded]:delay-0\",\n ],\n {\n variants: {\n radius: MEDIA_RADIUS,\n // Skeleton's own surface, on a pseudo-element so the pulse never reaches\n // the image's opacity. Hidden on load with the same deferral as above.\n skeleton: {\n true: [\n \"before:absolute before:inset-0\",\n \"before:animate-pulse before:bg-black/15 dark:before:bg-white/8 motion-reduce:before:animate-none\",\n \"before:transition-[display] before:duration-0 before:transition-discrete\",\n \"data-[state=loaded]:before:hidden data-[state=loaded]:before:delay-(--duration-normal)\",\n \"motion-reduce:data-[state=loaded]:before:delay-0\",\n ],\n false: \"\",\n },\n },\n defaultVariants: { radius: \"xs\", skeleton: false },\n },\n)\n\nconst FIT = {\n cover: \"object-cover\",\n contain: \"object-contain\",\n fill: \"object-fill\",\n none: \"object-none\",\n \"scale-down\": \"object-scale-down\",\n} as const\n\n/** What the blurred placeholder's `background-size` mirrors, per `fit`. */\nconst BACKGROUND_SIZE = {\n cover: \"cover\",\n contain: \"contain\",\n fill: \"100% 100%\",\n none: \"cover\",\n \"scale-down\": \"contain\",\n} as const\n\n/**\n * Logical positions resolve through `--image-position`, flipped under RTL, so\n * the image and its blurred placeholder crop to the same side. A free-form\n * value is written to the same variable inline.\n */\nconst POSITION = {\n center: \"\",\n top: \"[--image-position:top]\",\n bottom: \"[--image-position:bottom]\",\n start: \"[--image-position:left] rtl:[--image-position:right]\",\n end: \"[--image-position:right] rtl:[--image-position:left]\",\n \"top-start\": \"[--image-position:left_top] rtl:[--image-position:right_top]\",\n \"top-end\": \"[--image-position:right_top] rtl:[--image-position:left_top]\",\n \"bottom-start\": \"[--image-position:left_bottom] rtl:[--image-position:right_bottom]\",\n \"bottom-end\": \"[--image-position:right_bottom] rtl:[--image-position:left_bottom]\",\n} as const\n\nconst isLogicalPosition = (position: string): position is keyof typeof POSITION =>\n Object.hasOwn(POSITION, position)\n\nexport type ImageStatus = \"empty\" | \"loading\" | \"loaded\" | \"error\"\nexport type ImageFit = keyof typeof FIT\nexport type ImagePosition = keyof typeof POSITION | (string & {})\nexport type ImageRadius = NonNullable<VariantProps<typeof imageRoot>[\"radius\"]>\nexport type { ImageLoader }\n\nexport type ImageIconSlot = \"fallback\"\nexport type ImageIcons = IconMap<ImageIconSlot>\n\nconst DEFAULT_ICONS: Record<ImageIconSlot, ReactNode> = {\n fallback: <ImageOff aria-hidden className={iconStroke} />,\n}\n\ntype ImageClassNames = {\n root?: string\n image?: string\n fallback?: string\n}\n\n/** Everything the kit decides itself, or redefines, is left out of the `<img>` passthrough. */\ntype ImgAttributes = Omit<\n ComponentProps<\"img\">,\n | \"src\"\n | \"alt\"\n | \"width\"\n | \"height\"\n | \"sizes\"\n | \"srcSet\"\n | \"loading\"\n | \"fetchPriority\"\n | \"placeholder\"\n | \"className\"\n | \"style\"\n>\n\nexport type ImageProps = ImgAttributes &\n WithTestId & {\n /** Image URL. Unset shows the fallback (`data-state=\"empty\"`). */\n src?: string\n /** Required. Describe the image, or pass `\"\"` when it's decorative. */\n alt: string\n /** Intrinsic width in px: sizes the box, and caps the srcset at 2x. */\n width?: number\n /** Intrinsic height in px: with `width`, gives the box its aspect ratio. */\n height?: number\n /** Box aspect ratio (`16 / 9` or `\"16/9\"`). Wins over `width`/`height`'s. */\n ratio?: Ratio\n /** How the image fills its box. */\n fit?: ImageFit\n /** Which part stays visible when cropped. `start`/`end` follow `dir`. */\n position?: ImagePosition\n /** Rendered width per breakpoint, for a loader's `w`-descriptor srcset. */\n sizes?: string\n /** Passed to `loader`. */\n quality?: number\n /** Maps `{ src, width, quality }` to a CDN URL; enables the srcset. */\n loader?: ImageLoader\n /** Above-the-fold image: preloaded, fetched eagerly, never hidden or faded. */\n priority?: boolean\n /** A CSS color, or a tiny `data:` URI shown blurred, also kept under the error fallback. Skeleton pulse when unset. */\n placeholder?: string\n /** Tried once, verbatim (no loader), when `src` fails. */\n fallbackSrc?: string\n /** Shown when there's nothing to load or everything failed. Wins over `icons.fallback`. */\n fallback?: ReactNode\n /**\n * Replaces the default icons: `fallback`, the broken picture shown when\n * there's nothing to load or everything failed. `null` leaves the box\n * empty: the wash, or the kept placeholder.\n */\n icons?: ImageIcons\n /** Corner radius. `\"none\"` for a square edge. */\n radius?: ImageRadius\n /** Fires on every status change after mount. */\n onStatusChange?: (status: ImageStatus) => void\n /** Applies to the root. */\n className?: string\n /** Applies to the root. */\n style?: CSSProperties\n classNames?: ImageClassNames\n }\n\ntype Result = \"loaded\" | \"error\"\n\n/** CSS custom properties alongside regular declarations, typed without a cast. */\ntype RootStyle = CSSProperties & Record<`--${string}`, string | undefined>\n\nexport function Image({\n src,\n alt,\n width,\n height,\n ratio,\n fit = \"cover\",\n position = \"center\",\n sizes,\n quality,\n loader,\n priority = false,\n placeholder,\n fallbackSrc,\n fallback,\n icons,\n radius,\n onStatusChange,\n className,\n style,\n classNames,\n testId,\n ref,\n onLoad,\n onError,\n ...rest\n}: ImageProps) {\n const [results, setResults] = useState<Record<string, Result>>({})\n const imgRef = useRef<HTMLImageElement>(null)\n\n const candidates = [...new Set([src, fallbackSrc].filter((c): c is string => Boolean(c)))]\n const current = candidates.find((c) => results[c] !== \"error\")\n const status: ImageStatus = match(current)\n .with(P.nullish, () => (candidates.length === 0 ? \"empty\" : \"error\"))\n .otherwise((c) => results[c] ?? \"loading\")\n\n // Only `src` goes through the loader: `fallbackSrc` is used verbatim, so a\n // misconfigured loader can't also take the fallback down with it.\n const sources = match(current)\n .with(P.nullish, () => undefined)\n .with(\n P.when((c) => c === src),\n (c) => resolveSources({ src: c, loader, width, sizes, quality }),\n )\n .otherwise((c) => ({ src: c }))\n\n if (priority && src && sources && current === src) {\n preload(sources.src, {\n as: \"image\",\n fetchPriority: \"high\",\n imageSrcSet: sources.srcSet,\n imageSizes: sources.sizes,\n })\n }\n\n const settle = (candidate: string, result: Result) =>\n setResults((previous) =>\n previous[candidate] === result ? previous : { ...previous, [candidate]: result },\n )\n\n /** Marks loaded once decoded, so the fade never starts on an undecoded frame. */\n const reveal = (img: HTMLImageElement, candidate: string) => {\n const decoded = typeof img.decode === \"function\" ? img.decode() : Promise.resolve()\n decoded\n .catch(() => undefined)\n .then(() => {\n if (img.isConnected) settle(candidate, \"loaded\")\n })\n }\n\n // An image that settled before hydration fired its events into the void.\n // A decoded one is revealed now; a broken one gets its `src` reassigned,\n // which makes the browser fire `error` again, this time with a listener.\n // Runs once per source: `reveal` only closes over a state setter.\n useIsomorphicLayoutEffect(() => {\n const img = imgRef.current\n if (!img || current === undefined || !img.complete) return\n const attribute = img.getAttribute(\"src\")\n if (img.naturalWidth > 0) reveal(img, current)\n else if (attribute) img.setAttribute(\"src\", attribute)\n }, [current])\n\n const reported = useRef(status)\n useEffect(() => {\n if (reported.current === status) return\n reported.current = status\n onStatusChange?.(status)\n }, [status, onStatusChange])\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) reveal(event.currentTarget, current)\n onLoad?.(event)\n }\n const handleError = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) settle(current, \"error\")\n onError?.(event)\n }\n\n // A failed image keeps its placeholder under the fallback, as a hint of what\n // should be there. The skeleton is never kept: a shimmer means \"loading\".\n const showsPlaceholder = placeholder !== undefined && (status === \"loading\" || status === \"error\")\n const keepsPlaceholder = showsPlaceholder && status === \"error\"\n const customPosition = isLogicalPosition(position) ? undefined : position\n const rootStyle: RootStyle = {\n ...(width !== undefined && { \"--image-width\": `${width}px` }),\n ...(width !== undefined && height !== undefined && { aspectRatio: `${width}/${height}` }),\n ...ratioStyle(ratio),\n ...(customPosition !== undefined && { \"--image-position\": customPosition }),\n ...(showsPlaceholder &&\n (isDataUri(placeholder)\n ? {\n backgroundImage: blurSvg({ placeholder, width, height, fit }),\n backgroundSize: BACKGROUND_SIZE[fit],\n backgroundPosition: \"var(--image-position, center)\",\n backgroundRepeat: \"no-repeat\",\n }\n : { backgroundColor: placeholder })),\n ...style,\n }\n\n const content = fallback ?? mergeIcons(DEFAULT_ICONS, icons).fallback\n const fallbackLabel = alt ? { role: \"img\", \"aria-label\": alt } : { \"aria-hidden\": true }\n\n const imageRef = useMergedRefs(imgRef, ref)\n return (\n <span\n data-part=\"root\"\n data-state={status}\n {...props({ \"data-priority\": priority, \"data-testid\": testId })}\n className={cn(\n imageRoot({\n radius,\n skeleton: placeholder === undefined && (status === \"loading\" || status === \"loaded\"),\n }),\n isLogicalPosition(position) && POSITION[position],\n classNames?.root,\n className,\n )}\n style={rootStyle}\n >\n {sources && current !== undefined ? (\n <img\n key={current}\n {...rest}\n ref={imageRef}\n data-part=\"image\"\n data-state={status}\n src={sources.src}\n srcSet={sources.srcSet}\n sizes={sources.sizes}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? \"eager\" : \"lazy\"}\n fetchPriority={priority ? \"high\" : undefined}\n decoding={priority ? undefined : \"async\"}\n onLoad={handleLoad}\n onError={handleError}\n className={cn(\n // `text-transparent` hides alt text a browser paints while it waits.\n \"block size-full text-transparent object-(--image-position)\",\n FIT[fit],\n !priority && [\n \"opacity-0 data-[state=loaded]:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n ],\n classNames?.image,\n )}\n />\n ) : (\n <span\n data-part=\"fallback\"\n data-state={status}\n {...props({ \"data-placeholder\": keepsPlaceholder })}\n {...fallbackLabel}\n className={cn(\n \"absolute inset-0 flex items-center justify-center\",\n \"bg-black/5 text-black/50 dark:bg-white/8 dark:text-white/50\",\n // Over a kept placeholder the wash would only dull it.\n \"data-placeholder:bg-transparent\",\n // Backgrounds are dropped in forced colors; a system-colored edge keeps the box.\n \"forced-colors:border forced-colors:border-[CanvasText]\",\n // Direct child only, so the chip below sizes its own icon.\n \"[&>svg]:size-6 [&>svg]:max-h-1/2 [&>svg]:max-w-1/2\",\n classNames?.fallback,\n )}\n >\n {content != null && keepsPlaceholder ? (\n // A blur can be light or dark in either theme, so the content gets\n // a small chip of its own rather than relying on the theme's text color.\n <span\n data-part=\"fallback-chip\"\n className={cn(\n \"flex flex-col items-center gap-1 rounded-sm px-1.5 py-1\",\n \"bg-white/75 text-brand-900/70 dark:bg-black/55 dark:text-white/80\",\n \"forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]\",\n \"[&_svg]:size-5\",\n )}\n >\n {content}\n </span>\n ) : (\n content\n )}\n </span>\n )}\n </span>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/image/srcset.ts","../src/components/image/blur-svg.ts","../src/components/image/image.tsx"],"names":["loader","width","match","P"],"mappings":";;;;;;;;;;;;;;AAiBO,IAAM,YAAA,GAAe;AAAA,EAC1B,EAAA;AAAA,EAAI,EAAA;AA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,MAAA;AAAA,UAC9B,aAAA,EAAe,WAAW,MAAA,GAAS,MAAA;AAAA,UACnC,QAAA,EAAU,WAAW,MAAA,GAAY,OAAA;AAAA,UACjC,MAAA,EAAQ,UAAA;AAAA,UACR,OAAA,EAAS,WAAA;AAAA,UACT,SAAA,EAAW,EAAA;AAAA;AAAA,YAET,4DAAA;AAAA,YACA,IAAI,GAAG,CAAA;AAAA,YACP,CAAC,QAAA,IAAY;AAAA,cACX,2CAAA;AAAA,cACA;AAAA,aACF;AAAA,YACA,UAAA,EAAY;AAAA;AACd,SAAA;AAAA,QAzBK;AAAA,OA0BP,mBAEA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,WAAA,EAAU,UAAA;AAAA,UACV,YAAA,EAAY,MAAA;AAAA,UACX,GAAG,KAAA,CAAM,EAAE,kBAAA,EAAoB,kBAAkB,CAAA;AAAA,UACjD,GAAG,aAAA;AAAA,UACJ,SAAA,EAAW,EAAA;AAAA,YACT,mDAAA;AAAA,YACA,6DAAA;AAAA;AAAA,YAEA,iCAAA;AAAA;AAAA,YAEA,wDAAA;AAAA;AAAA,YAEA,oDAAA;AAAA,YACA,UAAA,EAAY;AAAA,WACd;AAAA,UAEC,qBAAW,IAAA,IAAQ,gBAAA;AAAA;AAAA;AAAA,4BAGlB,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,WAAA,EAAU,eAAA;AAAA,gBACV,SAAA,EAAW,EAAA;AAAA,kBACT,yDAAA;AAAA,kBACA,mEAAA;AAAA,kBACA,2DAAA;AAAA,kBACA;AAAA,iBACF;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA;AACH,cAEA;AAAA;AAAA;AAEJ;AAAA,GAEJ;AAEJ","file":"chunk-Y57NW6G7.js","sourcesContent":["import { match, P } from \"ts-pattern\"\n\n/**\n * Builds a CDN URL for one rendition of an image. The kit never resizes\n * anything itself: a loader maps `{ src, width, quality }` onto whatever query\n * string or path your image service expects.\n *\n * const unsplash: ImageLoader = ({ src, width, quality = 75 }) =>\n * `${src}?w=${width}&q=${quality}&auto=format`\n */\nexport type ImageLoader = (params: { src: string; width: number; quality?: number }) => string\n\n/**\n * Candidate widths for a `sizes`-driven srcset: next/image's small image sizes\n * followed by its device sizes, so a thumbnail and a full-bleed hero both land\n * near a real rendition.\n */\nexport const IMAGE_WIDTHS = [\n 16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840,\n] as const\n\nexport type ImageSources = { src: string; srcSet?: string; sizes?: string }\n\ntype ResolveOptions = {\n src: string\n loader?: ImageLoader\n width?: number\n sizes?: string\n quality?: number\n}\n\n/**\n * What the `<img>` (and its priority preload) should request.\n *\n * - No loader: the plain `src`. Without a service to ask, there are no other\n * renditions to choose from.\n * - Loader + `sizes`: `w` descriptors from `IMAGE_WIDTHS`, capped at twice\n * `width` when it's known (nothing gains from a rendition sharper than a 2x\n * screen needs). The browser picks one from `sizes`.\n * - Loader + `width`: a fixed-size image, so `1x` and `2x` are enough.\n * - Loader alone: treated as full-width (`sizes=\"100vw\"`).\n *\n * `src` is always the largest rendition, for browsers that ignore srcset.\n */\nexport function resolveSources({\n src,\n loader,\n width,\n sizes,\n quality,\n}: ResolveOptions): ImageSources {\n return match({ loader, width, sizes })\n .with({ loader: P.nullish }, () => ({ src }))\n .with({ loader: P.not(P.nullish), sizes: P.nullish, width: P.number }, ({ loader, width }) => {\n const at = (density: number) => loader({ src, width: width * density, quality })\n return { src: at(2), srcSet: `${at(1)} 1x, ${at(2)} 2x` }\n })\n .with({ loader: P.not(P.nullish) }, ({ loader }) => {\n const cap = width === undefined ? Number.POSITIVE_INFINITY : width * 2\n const fitting = IMAGE_WIDTHS.filter((w) => w <= cap)\n const widths = fitting.length > 0 ? fitting : [cap]\n const urls = widths.map((w) => ({ w, url: loader({ src, width: w, quality }) }))\n return {\n src: urls.at(-1)?.url ?? src,\n srcSet: urls.map(({ w, url }) => `${url} ${w}w`).join(\", \"),\n sizes: sizes ?? \"100vw\",\n }\n })\n .exhaustive()\n}\n","/**\n * A blurred version of a tiny `data:` placeholder, as a CSS `background-image`\n * value. Ported from next/image's `image-blur-svg.ts`: the thumbnail is drawn\n * into an SVG through an `feGaussianBlur`, so a 10px base64 image scales up\n * into a soft wash instead of a pixelated mosaic. No canvas, no dependency,\n * and it's plain CSS, so it's already painted in the server HTML.\n *\n * The middle of the filter (the `feColorMatrix` alpha boost, then compositing\n * the result over the source) keeps the edges opaque: a bare blur fades to\n * transparent near the border and the box would read as having a halo.\n *\n * With both dimensions known the SVG gets a matching viewBox and stretches to\n * fill (`preserveAspectRatio=\"none\"`), the way the image itself will. Without\n * them, the image inside the SVG follows `fit` instead.\n */\nconst BLUR = 20\n\ntype BlurOptions = {\n placeholder: string\n width?: number\n height?: number\n fit: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\"\n}\n\nconst ASPECT = {\n cover: \"xMidYMid slice\",\n contain: \"xMidYMid\",\n fill: \"none\",\n none: \"xMidYMid slice\",\n \"scale-down\": \"xMidYMid\",\n} as const\n\nexport function blurSvg({ placeholder, width, height, fit }: BlurOptions): string {\n const sized = width !== undefined && height !== undefined\n const viewBox = sized ? `viewBox='0 0 ${width} ${height}'` : \"\"\n const aspect = sized ? \"none\" : ASPECT[fit]\n const svg =\n `%3Csvg xmlns='http://www.w3.org/2000/svg' ${viewBox}%3E` +\n `%3Cfilter id='b' color-interpolation-filters='sRGB'%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E` +\n `%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E` +\n `%3CfeComposite operator='out' in='s'/%3E` +\n `%3CfeComposite in2='SourceGraphic'/%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3C/filter%3E` +\n `%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${aspect}' ` +\n `style='filter: url(%23b);' href='${placeholder}'/%3E` +\n `%3C/svg%3E`\n return `url(\"data:image/svg+xml;charset=utf-8,${svg}\")`\n}\n\n/** A placeholder string is a data URI (blurred) or any CSS color (painted flat). */\nexport const isDataUri = (placeholder: string): boolean => placeholder.startsWith(\"data:\")\n","\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { ImageOff } from \"lucide-react\"\nimport {\n type ComponentProps,\n type CSSProperties,\n type ReactNode,\n type SyntheticEvent,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { preload } from \"react-dom\"\nimport { match, P } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS } from \"../../lib/radius\"\nimport { type Ratio, ratioStyle } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useIsomorphicLayoutEffect } from \"../../lib/use-isomorphic-layout-effect\"\nimport { blurSvg, isDataUri } from \"./blur-svg\"\nimport { type ImageLoader, resolveSources } from \"./srcset\"\n\n/**\n * Image — an `<img>` that holds its box while it loads, then crossfades in.\n *\n * <Image src={photo.url} alt={photo.description} ratio=\"4/3\" placeholder={photo.blur} />\n *\n * Two elements: a root `<span>` that owns the box (aspect ratio, radius,\n * clipping) and paints the placeholder, and the `<img>` inside it, which\n * fades from transparent to opaque once it has loaded *and* decoded. The\n * placeholder is a CSS color, or a tiny `data:` URI blurred through an SVG\n * filter (`blur-svg.ts`); without one, the root pulses with Skeleton's own\n * tokens. All three are plain CSS, so they're in the server HTML. When the\n * image fails, a color or blur stays under the fallback as a hint of what\n * belonged there; the skeleton doesn't, since a shimmer reads as \"loading\".\n *\n * The fade is pure CSS keyed on `data-state`, so it only runs once React has\n * hydrated and seen the load: a non-priority image shows at hydration or at\n * load, whichever is later. `priority` opts out for the above-the-fold image\n * (the LCP candidate): it's preloaded, fetched eagerly, and never hidden.\n *\n * Loading is tracked per source, in a results map rather than a single flag\n * reset by an effect: a new `src` has no entry and so reads as `loading` on\n * its very first render, and a `fallbackSrc` that fails too is never retried,\n * so the fallback can't loop. The `<img>` is keyed by the source it shows, so\n * a late event from the previous one can't land on the next.\n *\n * Hydration-safe in the same way as next/image: an image that finished (or\n * failed) before React attached its handlers is caught in a layout effect,\n * through `complete` and `naturalWidth`.\n *\n * No `asChild`: the component is two elements, and the consumer's child could\n * only stand in for one of them.\n */\nconst imageRoot = cva(\n [\n \"relative inline-block max-w-full overflow-clip align-middle\",\n // Driven by `width` through a variable, so a consumer's `w-*` still wins.\n \"w-(--image-width)\",\n // The placeholder is dropped once the image is opaque, not when it starts\n // fading in: removing it at once would flash the page through the fade.\n // A zero-length transition with a delay is how CSS defers a discrete\n // change, and `allow-discrete` lets `background-image` take part.\n \"transition-[background] duration-0 transition-discrete\",\n // With no fade under reduced motion, there is nothing to wait for.\n \"data-[state=loaded]:delay-(--duration-normal) motion-reduce:data-[state=loaded]:delay-0\",\n ],\n {\n variants: {\n radius: MEDIA_RADIUS,\n // Skeleton's own surface, on a pseudo-element so the pulse never reaches\n // the image's opacity. Hidden on load with the same deferral as above.\n skeleton: {\n true: [\n \"before:absolute before:inset-0\",\n \"before:animate-pulse before:bg-black/15 dark:before:bg-white/8 motion-reduce:before:animate-none\",\n \"before:transition-[display] before:duration-0 before:transition-discrete\",\n \"data-[state=loaded]:before:hidden data-[state=loaded]:before:delay-(--duration-normal)\",\n \"motion-reduce:data-[state=loaded]:before:delay-0\",\n ],\n false: \"\",\n },\n },\n defaultVariants: { radius: \"xs\", skeleton: false },\n },\n)\n\nconst FIT = {\n cover: \"object-cover\",\n contain: \"object-contain\",\n fill: \"object-fill\",\n none: \"object-none\",\n \"scale-down\": \"object-scale-down\",\n} as const\n\n/** What the blurred placeholder's `background-size` mirrors, per `fit`. */\nconst BACKGROUND_SIZE = {\n cover: \"cover\",\n contain: \"contain\",\n fill: \"100% 100%\",\n none: \"cover\",\n \"scale-down\": \"contain\",\n} as const\n\n/**\n * Logical positions resolve through `--image-position`, flipped under RTL, so\n * the image and its blurred placeholder crop to the same side. A free-form\n * value is written to the same variable inline.\n */\nconst POSITION = {\n center: \"\",\n top: \"[--image-position:top]\",\n bottom: \"[--image-position:bottom]\",\n start: \"[--image-position:left] rtl:[--image-position:right]\",\n end: \"[--image-position:right] rtl:[--image-position:left]\",\n \"top-start\": \"[--image-position:left_top] rtl:[--image-position:right_top]\",\n \"top-end\": \"[--image-position:right_top] rtl:[--image-position:left_top]\",\n \"bottom-start\": \"[--image-position:left_bottom] rtl:[--image-position:right_bottom]\",\n \"bottom-end\": \"[--image-position:right_bottom] rtl:[--image-position:left_bottom]\",\n} as const\n\nconst isLogicalPosition = (position: string): position is keyof typeof POSITION =>\n Object.hasOwn(POSITION, position)\n\nexport type ImageStatus = \"empty\" | \"loading\" | \"loaded\" | \"error\"\nexport type ImageFit = keyof typeof FIT\nexport type ImagePosition = keyof typeof POSITION | (string & {})\nexport type ImageRadius = NonNullable<VariantProps<typeof imageRoot>[\"radius\"]>\nexport type { ImageLoader }\n\nexport type ImageIconSlot = \"fallback\"\nexport type ImageIcons = IconMap<ImageIconSlot>\n\nconst DEFAULT_ICONS: Record<ImageIconSlot, ReactNode> = {\n fallback: <ImageOff aria-hidden className={iconStroke} />,\n}\n\ntype ImageClassNames = {\n root?: string\n image?: string\n fallback?: string\n}\n\n/** Everything the kit decides itself, or redefines, is left out of the `<img>` passthrough. */\ntype ImgAttributes = Omit<\n ComponentProps<\"img\">,\n | \"src\"\n | \"alt\"\n | \"width\"\n | \"height\"\n | \"sizes\"\n | \"srcSet\"\n | \"loading\"\n | \"fetchPriority\"\n | \"placeholder\"\n | \"className\"\n | \"style\"\n>\n\nexport type ImageProps = ImgAttributes &\n WithTestId & {\n /** Image URL. Unset shows the fallback (`data-state=\"empty\"`). */\n src?: string\n /** Required. Describe the image, or pass `\"\"` when it's decorative. */\n alt: string\n /** Intrinsic width in px: sizes the box, and caps the srcset at 2x. */\n width?: number\n /** Intrinsic height in px: with `width`, gives the box its aspect ratio. */\n height?: number\n /** Box aspect ratio (`16 / 9` or `\"16/9\"`). Wins over `width`/`height`'s. */\n ratio?: Ratio\n /** How the image fills its box. */\n fit?: ImageFit\n /** Which part stays visible when cropped. `start`/`end` follow `dir`. */\n position?: ImagePosition\n /** Rendered width per breakpoint, for a loader's `w`-descriptor srcset. */\n sizes?: string\n /** Passed to `loader`. */\n quality?: number\n /** Maps `{ src, width, quality }` to a CDN URL; enables the srcset. */\n loader?: ImageLoader\n /** Above-the-fold image: preloaded, fetched eagerly, never hidden or faded. */\n priority?: boolean\n /** A CSS color, or a tiny `data:` URI shown blurred, also kept under the error fallback. Skeleton pulse when unset. */\n placeholder?: string\n /** Tried once, verbatim (no loader), when `src` fails. */\n fallbackSrc?: string\n /** Shown when there's nothing to load or everything failed. Wins over `icons.fallback`. */\n fallback?: ReactNode\n /**\n * Replaces the default icons: `fallback`, the broken picture shown when\n * there's nothing to load or everything failed. `null` leaves the box\n * empty: the wash, or the kept placeholder.\n */\n icons?: ImageIcons\n /** Corner radius. `\"none\"` for a square edge. */\n radius?: ImageRadius\n /** Fires on every status change after mount. */\n onStatusChange?: (status: ImageStatus) => void\n /** Applies to the root. */\n className?: string\n /** Applies to the root. */\n style?: CSSProperties\n classNames?: ImageClassNames\n }\n\ntype Result = \"loaded\" | \"error\"\n\n/** CSS custom properties alongside regular declarations, typed without a cast. */\ntype RootStyle = CSSProperties & Record<`--${string}`, string | undefined>\n\nexport function Image({\n src,\n alt,\n width,\n height,\n ratio,\n fit = \"cover\",\n position = \"center\",\n sizes,\n quality,\n loader,\n priority = false,\n placeholder,\n fallbackSrc,\n fallback,\n icons,\n radius,\n onStatusChange,\n className,\n style,\n classNames,\n testId,\n ref,\n onLoad,\n onError,\n ...rest\n}: ImageProps) {\n const [results, setResults] = useState<Record<string, Result>>({})\n const imgRef = useRef<HTMLImageElement>(null)\n\n const candidates = [...new Set([src, fallbackSrc].filter((c): c is string => Boolean(c)))]\n const current = candidates.find((c) => results[c] !== \"error\")\n const status: ImageStatus = match(current)\n .with(P.nullish, () => (candidates.length === 0 ? \"empty\" : \"error\"))\n .otherwise((c) => results[c] ?? \"loading\")\n\n // Only `src` goes through the loader: `fallbackSrc` is used verbatim, so a\n // misconfigured loader can't also take the fallback down with it.\n const sources = match(current)\n .with(P.nullish, () => undefined)\n .with(\n P.when((c) => c === src),\n (c) => resolveSources({ src: c, loader, width, sizes, quality }),\n )\n .otherwise((c) => ({ src: c }))\n\n if (priority && src && sources && current === src) {\n preload(sources.src, {\n as: \"image\",\n fetchPriority: \"high\",\n imageSrcSet: sources.srcSet,\n imageSizes: sources.sizes,\n })\n }\n\n const settle = (candidate: string, result: Result) =>\n setResults((previous) =>\n previous[candidate] === result ? previous : { ...previous, [candidate]: result },\n )\n\n /** Marks loaded once decoded, so the fade never starts on an undecoded frame. */\n const reveal = (img: HTMLImageElement, candidate: string) => {\n const decoded = typeof img.decode === \"function\" ? img.decode() : Promise.resolve()\n decoded\n .catch(() => undefined)\n .then(() => {\n if (img.isConnected) settle(candidate, \"loaded\")\n })\n }\n\n // An image that settled before hydration fired its events into the void.\n // A decoded one is revealed now; a broken one gets its `src` reassigned,\n // which makes the browser fire `error` again, this time with a listener.\n // Runs once per source: `reveal` only closes over a state setter.\n useIsomorphicLayoutEffect(() => {\n const img = imgRef.current\n if (!img || current === undefined || !img.complete) return\n const attribute = img.getAttribute(\"src\")\n if (img.naturalWidth > 0) reveal(img, current)\n else if (attribute) img.setAttribute(\"src\", attribute)\n }, [current])\n\n const reported = useRef(status)\n useEffect(() => {\n if (reported.current === status) return\n reported.current = status\n onStatusChange?.(status)\n }, [status, onStatusChange])\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) reveal(event.currentTarget, current)\n onLoad?.(event)\n }\n const handleError = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) settle(current, \"error\")\n onError?.(event)\n }\n\n // A failed image keeps its placeholder under the fallback, as a hint of what\n // should be there. The skeleton is never kept: a shimmer means \"loading\".\n const showsPlaceholder = placeholder !== undefined && (status === \"loading\" || status === \"error\")\n const keepsPlaceholder = showsPlaceholder && status === \"error\"\n const customPosition = isLogicalPosition(position) ? undefined : position\n const rootStyle: RootStyle = {\n ...(width !== undefined && { \"--image-width\": `${width}px` }),\n ...(width !== undefined && height !== undefined && { aspectRatio: `${width}/${height}` }),\n ...ratioStyle(ratio),\n ...(customPosition !== undefined && { \"--image-position\": customPosition }),\n ...(showsPlaceholder &&\n (isDataUri(placeholder)\n ? {\n backgroundImage: blurSvg({ placeholder, width, height, fit }),\n backgroundSize: BACKGROUND_SIZE[fit],\n backgroundPosition: \"var(--image-position, center)\",\n backgroundRepeat: \"no-repeat\",\n }\n : { backgroundColor: placeholder })),\n ...style,\n }\n\n const content = fallback ?? mergeIcons(DEFAULT_ICONS, icons).fallback\n const fallbackLabel = alt ? { role: \"img\", \"aria-label\": alt } : { \"aria-hidden\": true }\n\n const imageRef = useMergedRefs(imgRef, ref)\n return (\n <span\n data-part=\"root\"\n data-state={status}\n {...props({ \"data-priority\": priority, \"data-testid\": testId })}\n className={cn(\n imageRoot({\n radius,\n skeleton: placeholder === undefined && (status === \"loading\" || status === \"loaded\"),\n }),\n isLogicalPosition(position) && POSITION[position],\n classNames?.root,\n className,\n )}\n style={rootStyle}\n >\n {sources && current !== undefined ? (\n <img\n key={current}\n {...rest}\n ref={imageRef}\n data-part=\"image\"\n data-state={status}\n src={sources.src}\n srcSet={sources.srcSet}\n sizes={sources.sizes}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? \"eager\" : \"lazy\"}\n fetchPriority={priority ? \"high\" : undefined}\n decoding={priority ? undefined : \"async\"}\n onLoad={handleLoad}\n onError={handleError}\n className={cn(\n // `text-transparent` hides alt text a browser paints while it waits.\n \"block size-full text-transparent object-(--image-position)\",\n FIT[fit],\n !priority && [\n \"opacity-0 data-[state=loaded]:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n ],\n classNames?.image,\n )}\n />\n ) : (\n <span\n data-part=\"fallback\"\n data-state={status}\n {...props({ \"data-placeholder\": keepsPlaceholder })}\n {...fallbackLabel}\n className={cn(\n \"absolute inset-0 flex items-center justify-center\",\n \"bg-black/5 text-black/50 dark:bg-white/8 dark:text-white/50\",\n // Over a kept placeholder the wash would only dull it.\n \"data-placeholder:bg-transparent\",\n // Backgrounds are dropped in forced colors; a system-colored edge keeps the box.\n \"forced-colors:border forced-colors:border-[CanvasText]\",\n // Direct child only, so the chip below sizes its own icon.\n \"[&>svg]:size-6 [&>svg]:max-h-1/2 [&>svg]:max-w-1/2\",\n classNames?.fallback,\n )}\n >\n {content != null && keepsPlaceholder ? (\n // A blur can be light or dark in either theme, so the content gets\n // a small chip of its own rather than relying on the theme's text color.\n <span\n data-part=\"fallback-chip\"\n className={cn(\n \"flex flex-col items-center gap-1 rounded-sm px-1.5 py-1\",\n \"bg-white/75 text-brand-900/70 dark:bg-black/55 dark:text-white/80\",\n \"forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]\",\n \"[&_svg]:size-5\",\n )}\n >\n {content}\n </span>\n ) : (\n content\n )}\n </span>\n )}\n </span>\n )\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveLogicalPlacement } from './chunk-
|
|
1
|
+
import { resolveLogicalPlacement } from './chunk-V6PY7C6S.js';
|
|
2
2
|
import { useOverlayContainer } from './chunk-7P32XCEU.js';
|
|
3
3
|
import { props } from './chunk-WYCMIIRR.js';
|
|
4
|
-
import { focusStyles } from './chunk-
|
|
4
|
+
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
5
5
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
6
|
-
import { cn } from './chunk-
|
|
6
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
7
7
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
8
8
|
import { Portal } from '@ark-ui/react/portal';
|
|
9
9
|
import { Tooltip as Tooltip$1 } from '@ark-ui/react/tooltip';
|
|
@@ -128,5 +128,5 @@ var Tooltip = Object.assign(TooltipComponent, {
|
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
export { Tooltip };
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
132
|
-
//# sourceMappingURL=chunk-
|
|
131
|
+
//# sourceMappingURL=chunk-YZJUPYPO.js.map
|
|
132
|
+
//# sourceMappingURL=chunk-YZJUPYPO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/tooltip.tsx"],"names":["ArkTooltip"],"mappings":";;;;;;;;;;;;;;AAqDA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,oCAAA;AAAA,EACA,yCAAA;AAAA,EACA,2DAAA;AAAA,EACA,8EAAA;AAAA,EACA,yEAAA;AAAA,EACA;AACF,CAAA;AAWA,IAAM,iBAAA,GAAoB,sBAAA;AAK1B,IAAM,YAAA,GAAe,EAAA,CAAG,mBAAA,EAAqB,8BAA8B,CAAA;AAO3E,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,gEAAA;AAAA,IACA,wCAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,EAAA,CAAG,gDAAA,EAAkD,kBAAA,CAAmB,OAAO,CAAA;AAAA,QACrF,MAAA,EAAQ;AAAA;AACV,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAYA,IAAM,cAAA,GAAiB,aAAA,CAAmC,EAAE,YAAA,EAAc,MAAM,CAAA;AAkBhF,IAAM,OAAO,CAAC;AAAA,EACZ,QAAA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AA,CAAW,OAAA;AAAA,QAAX;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,CAAA,EAAG,YAAY,OAAO,CAAA;AAAA,UAE7D;AAAA;AAAA;AACH,KACD,CAAA;AAAA,oBACH,IAAA,CAAC,OAAA,EAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,SAAS,MAAA,EACtC,QAAA,EAAA;AAAA,MAAA,SAAA,oBAAa,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY,KAAA,EAAO,CAAA;AAAA,MAClD;AAAA,KAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB;AAAA,EACrD,IAAA;AAAA,EACA,SAASA,SAAA,CAAW,OAAA;AAAA,EACpB,OAAA;AAAA,EACA;AACF,CAAC","file":"chunk-2OQP7UY4.js","sourcesContent":["\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Tooltip as ArkTooltip } from \"@ark-ui/react/tooltip\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, type ReactNode, useContext } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Tooltip — the kit's hover/focus **hint**, a styled layer over Ark UI's\n * Tooltip. It's the lightweight counterpart to `Popover` (which is a clickable,\n * focus-trapping panel): Ark's Tooltip machine opens on hover *and* keyboard\n * focus, wires `role=\"tooltip\"` + `aria-describedby` automatically, dismisses on\n * `Esc` / scroll / pointer-down, and never traps focus.\n *\n * Two ways to use it — the convenience form drops into running text or wraps any\n * element; the compound parts mirror `Popover.Root` / `Trigger` / `Content`.\n *\n * // 1. Inline — `children` become a focusable inline trigger\n * <Tooltip label=\"A project at 42.\">norm</Tooltip>\n *\n * // 2. Wrap an element — `asChild` makes the child the trigger\n * <Tooltip label=\"Delete\" asChild>\n * <ActionIcon aria-label=\"Delete\"><Trash /></ActionIcon>\n * </Tooltip>\n *\n * // 3. Compound\n * <Tooltip.Root position=\"end\">\n * <Tooltip.Trigger asChild><Button>Hover</Button></Tooltip.Trigger>\n * <Tooltip.Content>\n * <Tooltip.Arrow />\n * Rich <strong>content</strong>\n * </Tooltip.Content>\n * </Tooltip.Root>\n *\n * Visually it reuses the Popover's open/close animation but renders as a small,\n * **inverted** bubble (dark surface in light mode, light in dark) to read as an\n * ephemeral hint rather than a panel. Add `withArrow` (convenience form) or a\n * `Tooltip.Arrow` part (compound) to point the bubble at its trigger.\n */\n\n/** Inverted compact bubble — reuses the shared `popover-in/out` animation tokens\n * (which already honour reduced-motion in `theme.css`) and the placement-origin\n * trick so it grows out of the trigger's edge. */\nconst tooltipContent = cn(\n \"max-w-[16rem] rounded-xs px-2 py-1\",\n \"text-xs leading-snug focus:outline-none\",\n \"bg-brand-950 text-white dark:bg-white dark:text-brand-950\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n \"data-[placement^=left]:origin-right data-[placement^=right]:origin-left\",\n)\n\n/** The bubble's shadow lives on the *positioner* (this wrapper), not on the\n * content. A `box-shadow` on the content paints as one unit *with* its\n * background, so it lands on top of the behind-arrow (`-z-1`) and smears\n * across the protruding tip. Hosting the shadow here reorders the paint to\n * shadow → arrow → content: the positioner's shadow sits at the back of its\n * stacking context (it's the `isolate` root), the arrow paints above it, and\n * the content background paints last — so the shadow never touches the arrow,\n * the arrow never covers the label, and the bubble keeps its shadow.\n * `rounded-xs` matches the content radius so the shadow's corners line up. */\nconst tooltipPositioner = \"rounded-xs shadow-md\"\n\n/** Inverted arrow matching the bubble surface. The `!` overrides are required\n * because Ark sets the arrow background via an inline style; `-z-1` tucks the\n * square behind the bubble so only the rotated corner pokes out as the tip. */\nconst tooltipArrow = cn(\"-z-1! rounded-xxs\", \"bg-brand-950! dark:bg-white!\")\n\n/** Resets the `<button type=\"button\">` the default trigger renders down to plain\n * inline text, so a Tooltip can sit on a word inside a `<p>` (a `<button>` is\n * phrasing content) while staying a real, keyboard-focusable control rather\n * than a role-less `tabIndex` span. `cursor-help` signals the hint;\n * `[font:inherit]` and `text-start` undo the UA button's font and centring. */\nconst tooltipTrigger = cva(\n [\n \"inline cursor-help appearance-none border-0 bg-transparent p-0\",\n \"[font:inherit] text-inherit text-start\",\n focusStyles(),\n \"rounded-xs\",\n ],\n {\n variants: {\n variant: {\n text: cn(\"underline decoration-dotted underline-offset-2\", TEXT_COLOR_CLASSES.primary),\n inline: \"\",\n },\n },\n defaultVariants: {\n variant: \"inline\",\n },\n },\n)\n\ntype TooltipPlacement = NonNullable<NonNullable<ArkTooltip.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type TooltipPosition = LogicalPosition<TooltipPlacement>\n\ntype TooltipContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst TooltipContext = createContext<TooltipContextValue>({ withinPortal: true })\n\nexport type TooltipRootProps = Omit<ArkTooltip.RootProps, \"positioning\"> & {\n /** Bubble placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`top`, `bottom`, `top-start`, …).\n * Defaults to `\"top\"`. */\n position?: TooltipPosition\n /** Gap in px between the trigger and the bubble. */\n offset?: number\n /** Render the bubble in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — pointer/focus leaving the trigger, Escape, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"top\",\n offset,\n withinPortal = true,\n container,\n children,\n onOpenChange,\n onClose,\n ...rest\n}: TooltipRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <TooltipContext.Provider value={{ withinPortal, container }}>\n {/* Mount the bubble only while shown (lazyMount + unmountOnExit): closed →\n nothing rendered, so an inline trigger never emits a positioner <div>\n into a host <p> on SSR. Both are overridable via `...rest`. */}\n <ArkTooltip.Root\n lazyMount\n unmountOnExit\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={(details) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkTooltip.Root>\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipContentProps = ArkTooltip.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: TooltipContentProps) => {\n const { withinPortal, container } = useContext(TooltipContext)\n const portalContainer = useOverlayContainer(container)\n const bubble = (\n <ArkTooltip.Positioner className={tooltipPositioner}>\n <ArkTooltip.Content\n className={cn(tooltipContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n )\n if (!withinPortal) return bubble\n return <Portal container={portalContainer}>{bubble}</Portal>\n}\n\nexport type TooltipArrowProps = NoAsChild<ArkTooltip.ArrowProps> & WithTestId\n\n/** The little arrow linking the bubble to its trigger. Compose it inside a\n * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).\n * The CSS vars size the square (`--arrow-size`) and pull it back under the\n * bubble (`--arrow-offset`) so it reads as a pointer, not a detached diamond. */\nconst Arrow = ({ className, style, testId, asChild: _asChild, ...rest }: TooltipArrowProps) => (\n <ArkTooltip.Arrow\n style={{ [\"--arrow-size\" as string]: \"12px\", [\"--arrow-offset\" as string]: \"-8px\", ...style }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ArkTooltip.ArrowTip className={cn(tooltipArrow, className)} />\n </ArkTooltip.Arrow>\n)\n\nexport type TooltipProps = TooltipRootProps &\n WithTestId & {\n /** The hint shown on hover and keyboard focus. Named `label` for parity with\n * the rest of the kit; wired as a description via Ark's `aria-describedby`. */\n label: ReactNode\n /** The trigger. By default it's wrapped in a focusable inline trigger (so it\n * drops into running text); with `asChild`, this element *is* the trigger. */\n children: ReactNode\n /** Render `children` as the trigger instead of wrapping them. */\n asChild?: boolean\n /** Add a small arrow pointing at the trigger. For the compound form, compose\n * `<Tooltip.Arrow />` inside `<Tooltip.Content>` instead. */\n withArrow?: boolean\n variant?: VariantProps<typeof tooltipTrigger>[\"variant\"]\n classNames?: { trigger?: string; content?: string; arrow?: string }\n }\n\n/** Convenience form: `Root` + `Trigger` + `Content` wired from `label`/`children`.\n * `testId` lands on `Content` (the rendered bubble) — `Root` has no DOM node\n * of its own. */\nconst TooltipComponent = ({\n label,\n children,\n asChild,\n classNames,\n withArrow,\n variant = \"inline\",\n testId,\n ...root\n}: TooltipProps) => {\n return (\n <Root {...root}>\n {match({ asChild })\n .with({ asChild: true }, () => <ArkTooltip.Trigger asChild>{children}</ArkTooltip.Trigger>)\n .otherwise(() => (\n // Ark wires `aria-describedby` to the bubble itself, while it's shown.\n <ArkTooltip.Trigger\n type=\"button\"\n className={cn(tooltipTrigger({ variant }), classNames?.trigger)}\n >\n {children}\n </ArkTooltip.Trigger>\n ))}\n <Content className={classNames?.content} testId={testId}>\n {withArrow && <Arrow className={classNames?.arrow} />}\n {label}\n </Content>\n </Root>\n )\n}\n\nexport const Tooltip = Object.assign(TooltipComponent, {\n Root,\n Trigger: ArkTooltip.Trigger,\n Content,\n Arrow,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/tooltip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GAAU,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB;AAAA,EACrD,IAAA;AAAA,EACA,SAASA,SAAA,CAAW,OAAA;AAAA,EACpB,OAAA;AAAA,EACA;AACF,CAAC","file":"chunk-YZJUPYPO.js","sourcesContent":["\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Tooltip as ArkTooltip } from \"@ark-ui/react/tooltip\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, type ReactNode, useContext } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Tooltip — the kit's hover/focus **hint**, a styled layer over Ark UI's\n * Tooltip. It's the lightweight counterpart to `Popover` (which is a clickable,\n * focus-trapping panel): Ark's Tooltip machine opens on hover *and* keyboard\n * focus, wires `role=\"tooltip\"` + `aria-describedby` automatically, dismisses on\n * `Esc` / scroll / pointer-down, and never traps focus.\n *\n * Two ways to use it — the convenience form drops into running text or wraps any\n * element; the compound parts mirror `Popover.Root` / `Trigger` / `Content`.\n *\n * // 1. Inline — `children` become a focusable inline trigger\n * <Tooltip label=\"A project at 42.\">norm</Tooltip>\n *\n * // 2. Wrap an element — `asChild` makes the child the trigger\n * <Tooltip label=\"Delete\" asChild>\n * <ActionIcon aria-label=\"Delete\"><Trash /></ActionIcon>\n * </Tooltip>\n *\n * // 3. Compound\n * <Tooltip.Root position=\"end\">\n * <Tooltip.Trigger asChild><Button>Hover</Button></Tooltip.Trigger>\n * <Tooltip.Content>\n * <Tooltip.Arrow />\n * Rich <strong>content</strong>\n * </Tooltip.Content>\n * </Tooltip.Root>\n *\n * Visually it reuses the Popover's open/close animation but renders as a small,\n * **inverted** bubble (dark surface in light mode, light in dark) to read as an\n * ephemeral hint rather than a panel. Add `withArrow` (convenience form) or a\n * `Tooltip.Arrow` part (compound) to point the bubble at its trigger.\n */\n\n/** Inverted compact bubble — reuses the shared `popover-in/out` animation tokens\n * (which already honour reduced-motion in `theme.css`) and the placement-origin\n * trick so it grows out of the trigger's edge. */\nconst tooltipContent = cn(\n \"max-w-[16rem] rounded-xs px-2 py-1\",\n \"text-xs leading-snug focus:outline-none\",\n \"bg-brand-950 text-white dark:bg-white dark:text-brand-950\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n \"data-[placement^=left]:origin-right data-[placement^=right]:origin-left\",\n)\n\n/** The bubble's shadow lives on the *positioner* (this wrapper), not on the\n * content. A `box-shadow` on the content paints as one unit *with* its\n * background, so it lands on top of the behind-arrow (`-z-1`) and smears\n * across the protruding tip. Hosting the shadow here reorders the paint to\n * shadow → arrow → content: the positioner's shadow sits at the back of its\n * stacking context (it's the `isolate` root), the arrow paints above it, and\n * the content background paints last — so the shadow never touches the arrow,\n * the arrow never covers the label, and the bubble keeps its shadow.\n * `rounded-xs` matches the content radius so the shadow's corners line up. */\nconst tooltipPositioner = \"rounded-xs shadow-md\"\n\n/** Inverted arrow matching the bubble surface. The `!` overrides are required\n * because Ark sets the arrow background via an inline style; `-z-1` tucks the\n * square behind the bubble so only the rotated corner pokes out as the tip. */\nconst tooltipArrow = cn(\"-z-1! rounded-xxs\", \"bg-brand-950! dark:bg-white!\")\n\n/** Resets the `<button type=\"button\">` the default trigger renders down to plain\n * inline text, so a Tooltip can sit on a word inside a `<p>` (a `<button>` is\n * phrasing content) while staying a real, keyboard-focusable control rather\n * than a role-less `tabIndex` span. `cursor-help` signals the hint;\n * `[font:inherit]` and `text-start` undo the UA button's font and centring. */\nconst tooltipTrigger = cva(\n [\n \"inline cursor-help appearance-none border-0 bg-transparent p-0\",\n \"[font:inherit] text-inherit text-start\",\n focusStyles(),\n \"rounded-xs\",\n ],\n {\n variants: {\n variant: {\n text: cn(\"underline decoration-dotted underline-offset-2\", TEXT_COLOR_CLASSES.primary),\n inline: \"\",\n },\n },\n defaultVariants: {\n variant: \"inline\",\n },\n },\n)\n\ntype TooltipPlacement = NonNullable<NonNullable<ArkTooltip.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type TooltipPosition = LogicalPosition<TooltipPlacement>\n\ntype TooltipContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst TooltipContext = createContext<TooltipContextValue>({ withinPortal: true })\n\nexport type TooltipRootProps = Omit<ArkTooltip.RootProps, \"positioning\"> & {\n /** Bubble placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`top`, `bottom`, `top-start`, …).\n * Defaults to `\"top\"`. */\n position?: TooltipPosition\n /** Gap in px between the trigger and the bubble. */\n offset?: number\n /** Render the bubble in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — pointer/focus leaving the trigger, Escape, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"top\",\n offset,\n withinPortal = true,\n container,\n children,\n onOpenChange,\n onClose,\n ...rest\n}: TooltipRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <TooltipContext.Provider value={{ withinPortal, container }}>\n {/* Mount the bubble only while shown (lazyMount + unmountOnExit): closed →\n nothing rendered, so an inline trigger never emits a positioner <div>\n into a host <p> on SSR. Both are overridable via `...rest`. */}\n <ArkTooltip.Root\n lazyMount\n unmountOnExit\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={(details) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkTooltip.Root>\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipContentProps = ArkTooltip.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: TooltipContentProps) => {\n const { withinPortal, container } = useContext(TooltipContext)\n const portalContainer = useOverlayContainer(container)\n const bubble = (\n <ArkTooltip.Positioner className={tooltipPositioner}>\n <ArkTooltip.Content\n className={cn(tooltipContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n )\n if (!withinPortal) return bubble\n return <Portal container={portalContainer}>{bubble}</Portal>\n}\n\nexport type TooltipArrowProps = NoAsChild<ArkTooltip.ArrowProps> & WithTestId\n\n/** The little arrow linking the bubble to its trigger. Compose it inside a\n * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).\n * The CSS vars size the square (`--arrow-size`) and pull it back under the\n * bubble (`--arrow-offset`) so it reads as a pointer, not a detached diamond. */\nconst Arrow = ({ className, style, testId, asChild: _asChild, ...rest }: TooltipArrowProps) => (\n <ArkTooltip.Arrow\n style={{ [\"--arrow-size\" as string]: \"12px\", [\"--arrow-offset\" as string]: \"-8px\", ...style }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ArkTooltip.ArrowTip className={cn(tooltipArrow, className)} />\n </ArkTooltip.Arrow>\n)\n\nexport type TooltipProps = TooltipRootProps &\n WithTestId & {\n /** The hint shown on hover and keyboard focus. Named `label` for parity with\n * the rest of the kit; wired as a description via Ark's `aria-describedby`. */\n label: ReactNode\n /** The trigger. By default it's wrapped in a focusable inline trigger (so it\n * drops into running text); with `asChild`, this element *is* the trigger. */\n children: ReactNode\n /** Render `children` as the trigger instead of wrapping them. */\n asChild?: boolean\n /** Add a small arrow pointing at the trigger. For the compound form, compose\n * `<Tooltip.Arrow />` inside `<Tooltip.Content>` instead. */\n withArrow?: boolean\n variant?: VariantProps<typeof tooltipTrigger>[\"variant\"]\n classNames?: { trigger?: string; content?: string; arrow?: string }\n }\n\n/** Convenience form: `Root` + `Trigger` + `Content` wired from `label`/`children`.\n * `testId` lands on `Content` (the rendered bubble) — `Root` has no DOM node\n * of its own. */\nconst TooltipComponent = ({\n label,\n children,\n asChild,\n classNames,\n withArrow,\n variant = \"inline\",\n testId,\n ...root\n}: TooltipProps) => {\n return (\n <Root {...root}>\n {match({ asChild })\n .with({ asChild: true }, () => <ArkTooltip.Trigger asChild>{children}</ArkTooltip.Trigger>)\n .otherwise(() => (\n // Ark wires `aria-describedby` to the bubble itself, while it's shown.\n <ArkTooltip.Trigger\n type=\"button\"\n className={cn(tooltipTrigger({ variant }), classNames?.trigger)}\n >\n {children}\n </ArkTooltip.Trigger>\n ))}\n <Content className={classNames?.content} testId={testId}>\n {withArrow && <Arrow className={classNames?.arrow} />}\n {label}\n </Content>\n </Root>\n )\n}\n\nexport const Tooltip = Object.assign(TooltipComponent, {\n Root,\n Trigger: ArkTooltip.Trigger,\n Content,\n Arrow,\n})\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { normalizeSelectData } from './chunk-7TDHT3QD.js';
|
|
2
2
|
import { controlOpenProps } from './chunk-5FDOOG4J.js';
|
|
3
|
-
import { COMBOBOX_DEFAULT_TRANSLATIONS } from './chunk-
|
|
4
|
-
import { inputSlot, placeholderColor, shellGap, inputShell } from './chunk-
|
|
5
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
3
|
+
import { COMBOBOX_DEFAULT_TRANSLATIONS } from './chunk-2BNIHOMT.js';
|
|
4
|
+
import { inputSlot, placeholderColor, shellGap, inputShell } from './chunk-45QRQKRC.js';
|
|
5
|
+
import { FieldShell, fieldA11yProps } from './chunk-VD6PB3VA.js';
|
|
6
6
|
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
7
|
-
import { scrollHighlightedIntoView, popoverClearTrigger, popoverChevron, popoverGroupLabel, popoverList, popoverContent, popoverIndicator, popoverOption } from './chunk-
|
|
7
|
+
import { scrollHighlightedIntoView, popoverClearTrigger, popoverChevron, popoverGroupLabel, popoverList, popoverContent, popoverIndicator, popoverOption } from './chunk-N66NC6QK.js';
|
|
8
8
|
import { useOverlayContainer } from './chunk-7P32XCEU.js';
|
|
9
9
|
import { NestedLayer } from './chunk-H7WOMZXO.js';
|
|
10
|
-
import { CloseIcon, ChevronIcon, CheckIcon } from './chunk-
|
|
10
|
+
import { CloseIcon, ChevronIcon, CheckIcon } from './chunk-6YNLRQ25.js';
|
|
11
11
|
import { props } from './chunk-WYCMIIRR.js';
|
|
12
|
-
import { cn } from './chunk-
|
|
12
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
13
13
|
import { useFieldContext } from '@ark-ui/react/field';
|
|
14
14
|
import { Portal } from '@ark-ui/react/portal';
|
|
15
15
|
import { Select as Select$1 } from '@ark-ui/react/select';
|
|
@@ -217,5 +217,5 @@ var Select = ({
|
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
export { Select };
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-Z4MBCKG5.js.map
|
|
221
|
+
//# sourceMappingURL=chunk-Z4MBCKG5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/select/select.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;AAgJA,IAAM,UAAA,GAAa,CAAC,CAAA,KAClB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,CAAA,KAAM,IAAA,GAAO,EAAC,GAAI,CAAC,CAAC,CAAA;AAQpD,IAAM,gBAAgB,CAAC;AAAA,EACrB,GAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF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A,EAAM,CAAA,EACtD,QAAA,EAAA,MAAA,GACG,OAAO,GAAA,CAAI,CAAC,0BACV,IAAA,CAACA,QAAA,CAAI,WAAJ,EACC,QAAA,EAAA;AAAA,0BAAA,GAAA,CAACA,SAAI,cAAA,EAAJ,EAAmB,SAAA,EAAW,iBAAA,EAC5B,gBAAM,KAAA,EACT,CAAA;AAAA,UACC,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,YAAY;AAAA,SAAA,EAAA,EAJX,KAAA,CAAM,KAK1B,CACD,CAAA,GACD,KAAA,CAAM,IAAI,YAAY,CAAA,EAC5B,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,wBAEA,GAAA,CAACA,QAAA,CAAI,YAAA,EAAJ,EAAkB,GAAG,WAAA,EAAa;AAAA;AAAA;AAAA,GACrC;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MACvB,UAAA,EAAY,EAAE,KAAA,EAAO,UAAA,EAAY,KAAA,EAAM;AAAA,MAEtC,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-JYK6JVR3.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Select as Ark } from \"@ark-ui/react/select\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type ReactNode,\n type Ref,\n useMemo,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { NestedLayer } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { COMBOBOX_DEFAULT_TRANSLATIONS, type ComboboxTranslations } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputShell,\n inputSlot,\n placeholderColor,\n shellGap,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverGroupLabel,\n popoverIndicator,\n popoverList,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Select — data-driven single-value picker on Ark UI's Select machine. Pass\n * `data` and it renders: a styled trigger, a popover of options, native form\n * submission (hidden `<select>`), typeahead, and full keyboard / RTL / ARIA from\n * Ark. For a *searchable* picker use `Autocomplete`; for multiple values use\n * `MultiSelect`.\n *\n * - `data` accepts `string[]`, `{ value, label?, disabled? }[]`, or grouped\n * `{ group, items }[]` (see `SelectData`).\n * - Value is a single `string | null`; the machine's array contract is hidden.\n * - Label / description / error come from the built-in `Field` wrapper, so a\n * `Select` is accessible and complete on its own.\n * - `clearable` swaps the chevron for a clear button once a value is set.\n *\n * Palette rides on `data-color`; the trigger reuses the shared input shell and\n * the popover the shared option styling, so Select and Combobox look identical.\n */\n\ntype SelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with a sibling element for a visible label\n * placed elsewhere in the layout). */\n label?: string\n control?: string\n option?: string\n popover?: string\n}\n\nexport type SelectProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled value. */\n value?: SelectValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SelectValue<Data> | null\n /** Fires with the selected value (or `null` when cleared). */\n onChange?: (value: SelectValue<Data> | null) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including any check\n * affordance. Omit it to render the label + selected check.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder shown while no value is selected. */\n placeholder?: string\n /** Show a clear button (and allow deselecting) once a value is set. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the chevron / clear button. */\n endSlot?: ReactNode\n size?: InputSize\n variant?: InputVariant\n color?: Color\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Wires the hidden `<select>` into native form submission. */\n name?: string\n /** Forwarded to the trigger; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n /** Lands on the trigger `<button>` for focus-on-error. */\n ref?: Ref<HTMLButtonElement>\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n className?: string\n classNames?: SelectClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names — the same keys as\n * the rest of the combobox family. A partial override keeps the other default. */\n translations?: SelectTranslations\n }\n\n/** Ark's own Select `translations` type (its `clearTriggerLabel`), derived structurally rather\n * than imported from `@zag-js/select`, plus the combobox family's `triggerLabel` for the\n * kit's own chevron button. */\nexport type SelectTranslations = NonNullable<Ark.RootProps<NormalizedItem>[\"translations\"]> &\n Pick<ComboboxTranslations, \"triggerLabel\">\n\n/** Wrap a scalar value into Ark's array contract (or clear with `[]`). */\nconst toArkValue = (v: string | null | undefined): string[] | undefined =>\n v === undefined ? undefined : v === null ? [] : [v]\n\n/**\n * The real, focusable `<button role=\"combobox\">`, split out so it reads the\n * `Field` context from *inside* the wrapping `FieldShell` — `Select` itself\n * renders that shell, so calling `useFieldContext()` at its own top level\n * would run too early.\n */\nconst SelectTrigger = ({\n ref,\n onBlur,\n invalid,\n testId,\n className,\n children,\n}: {\n ref?: Ref<HTMLButtonElement>\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n invalid: boolean\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n return (\n <Ark.Trigger\n ref={ref}\n onBlur={onBlur}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Trigger>\n )\n}\n\nexport const Select = <const Data extends SelectData = SelectData>({\n withinPortal = true,\n container,\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Pick a value\",\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n size = \"md\",\n variant = \"default\",\n color,\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n ...selectProps\n}: SelectProps<Data> & Omit<ComponentProps<\"select\">, keyof SelectProps>) => {\n const resolvedTranslations = { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...translations }\n const portalContainer = useOverlayContainer(container)\n const { collection, items, groups } = useMemo(() => normalizeSelectData(data), [data])\n const controlRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const mergedTriggerRef = useMergedRefs(triggerRef, ref)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const selected = items.find(({ value: iv }) => value === iv)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Ark.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(popoverOption({ size }), classNames?.option)}\n >\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item, {\n selected: ctx.selected,\n highlighted: ctx.highlighted,\n })\n }\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{item.label}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n\n const control = (\n <Ark.Root\n collection={collection}\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n // The machine's collection is typed by value (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's value union.\n onValueChange={\n onChange ? (d) => onChange((d.value[0] ?? null) as SelectValue<Data> | null) : undefined\n }\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n deselectable={clearable}\n translations={resolvedTranslations}\n // Ark anchors Select's positioner to the Trigger, which sits inside the\n // padded `inputShell` Control — so `sameWidth` would inset the panel. Anchor\n // to the full Control instead (matching Combobox), so the panel aligns with\n // and matches the trigger's width.\n positioning={{\n sameWidth: true,\n getAnchorRect: () => controlRef.current?.getBoundingClientRect() ?? null,\n }}\n // Content is an `overflow-hidden` clip wrapper, so the machine's native\n // auto-scroll (which needs Content scrollable) no-ops; route scrolling to\n // the inner List scroller instead.\n scrollToIndexFn={scrollHighlightedIntoView}\n data-color={color}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n const showClear = Boolean(clearable) && api.hasSelectedItems && !disabled && !readOnly\n const showChevron = clearSectionMode === \"both\" || !showClear\n return (\n <Ark.Control\n ref={controlRef}\n {...props({\n \"data-invalid\": isInvalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron / clear control.\n \"data-with-end-slot\": true,\n })}\n // Tablet affordance: a tap on the shell's dead zones (padding) opens\n // the menu too, not just the trigger. The trigger, clear and chevron\n // are all buttons, so the helper skips them and they self-handle.\n // Inert when disabled / readOnly, so it never opens where the trigger won't.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n className={cn(inputShell({ size, variant }), \"cursor-pointer\", classNames?.control)}\n >\n <SelectTrigger\n ref={mergedTriggerRef}\n onBlur={onBlur}\n invalid={isInvalid}\n testId={testId}\n className={cn(\n \"flex min-w-0 flex-1 cursor-pointer items-center bg-transparent text-start outline-none disabled:cursor-not-allowed\",\n // Slots live inside the trigger (not the shell), so re-apply the\n // shell's per-size gap here to space the icon from the value.\n shellGap[size],\n )}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-start\">\n {api.hasSelectedItems ? (\n renderItem && selected ? (\n renderItem(selected, {\n selected: false,\n highlighted: false,\n })\n ) : (\n api.valueAsString\n )\n ) : (\n <span className={placeholderColor}>{placeholder}</span>\n )}\n </span>\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </SelectTrigger>\n {showClear && (\n <Ark.ClearTrigger className={popoverClearTrigger}>\n <CloseIcon />\n </Ark.ClearTrigger>\n )}\n {showChevron && (\n // A sibling toggle button (the value `Ark.Trigger` can't nest it\n // next to the clear button), so the chevron sits at the far edge\n // like the rest of the family. Focus the trigger first so keyboard\n // nav stays on the combobox; `preventDefault` stops the tap from\n // stealing focus to this button. `tabIndex=-1`: the trigger is the\n // tab stop.\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={resolvedTranslations.triggerLabel}\n data-chevron\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm data-disabled:cursor-not-allowed\",\n api.open && \"rotate-180\",\n )}\n {...props({\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n })}\n onPointerDown={(event) => event.preventDefault()}\n {...(!(disabled || readOnly) && {\n onClick: () => {\n triggerRef.current?.focus()\n api.setOpen(!api.open)\n },\n })}\n >\n <ChevronIcon />\n </button>\n )}\n </Ark.Control>\n )\n }}\n </Ark.Context>\n\n {/* Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content data-color={color} className={cn(popoverContent, classNames?.popover)}>\n <Ark.List className={popoverList({ withPaddingTop: true })}>\n {groups\n ? groups.map((group) => (\n <Ark.ItemGroup key={group.group}>\n <Ark.ItemGroupLabel className={popoverGroupLabel}>\n {group.group}\n </Ark.ItemGroupLabel>\n {group.items.map(renderOption)}\n </Ark.ItemGroup>\n ))\n : items.map(renderOption)}\n </Ark.List>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n\n <Ark.HiddenSelect {...selectProps} />\n </Ark.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/select/select.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;AAgJA,IAAM,UAAA,GAAa,CAAC,CAAA,KAClB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,CAAA,KAAM,IAAA,GAAO,EAAC,GAAI,CAAC,CAAC,CAAA;AAQpD,IAAM,gBAAgB,CAAC;AAAA,EACrB,GAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAMmB;AACjB,EAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAI,OAAA;AAAA,IAAJ;AAAA,MACC,GAAA;AAAA,MACA,MAAA;AAAA,MACC,G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AAmB,SAAA,EAAW,iBAAA,EAC5B,gBAAM,KAAA,EACT,CAAA;AAAA,UACC,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,YAAY;AAAA,SAAA,EAAA,EAJX,KAAA,CAAM,KAK1B,CACD,CAAA,GACD,KAAA,CAAM,IAAI,YAAY,CAAA,EAC5B,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,wBAEA,GAAA,CAACA,QAAA,CAAI,YAAA,EAAJ,EAAkB,GAAG,WAAA,EAAa;AAAA;AAAA;AAAA,GACrC;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MACvB,UAAA,EAAY,EAAE,KAAA,EAAO,UAAA,EAAY,KAAA,EAAM;AAAA,MAEtC,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-Z4MBCKG5.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Select as Ark } from \"@ark-ui/react/select\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type ReactNode,\n type Ref,\n useMemo,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { NestedLayer } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { COMBOBOX_DEFAULT_TRANSLATIONS, type ComboboxTranslations } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputShell,\n inputSlot,\n placeholderColor,\n shellGap,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverGroupLabel,\n popoverIndicator,\n popoverList,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Select — data-driven single-value picker on Ark UI's Select machine. Pass\n * `data` and it renders: a styled trigger, a popover of options, native form\n * submission (hidden `<select>`), typeahead, and full keyboard / RTL / ARIA from\n * Ark. For a *searchable* picker use `Autocomplete`; for multiple values use\n * `MultiSelect`.\n *\n * - `data` accepts `string[]`, `{ value, label?, disabled? }[]`, or grouped\n * `{ group, items }[]` (see `SelectData`).\n * - Value is a single `string | null`; the machine's array contract is hidden.\n * - Label / description / error come from the built-in `Field` wrapper, so a\n * `Select` is accessible and complete on its own.\n * - `clearable` swaps the chevron for a clear button once a value is set.\n *\n * Palette rides on `data-color`; the trigger reuses the shared input shell and\n * the popover the shared option styling, so Select and Combobox look identical.\n */\n\ntype SelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with a sibling element for a visible label\n * placed elsewhere in the layout). */\n label?: string\n control?: string\n option?: string\n popover?: string\n}\n\nexport type SelectProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled value. */\n value?: SelectValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SelectValue<Data> | null\n /** Fires with the selected value (or `null` when cleared). */\n onChange?: (value: SelectValue<Data> | null) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including any check\n * affordance. Omit it to render the label + selected check.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder shown while no value is selected. */\n placeholder?: string\n /** Show a clear button (and allow deselecting) once a value is set. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the chevron / clear button. */\n endSlot?: ReactNode\n size?: InputSize\n variant?: InputVariant\n color?: Color\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Wires the hidden `<select>` into native form submission. */\n name?: string\n /** Forwarded to the trigger; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n /** Lands on the trigger `<button>` for focus-on-error. */\n ref?: Ref<HTMLButtonElement>\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n className?: string\n classNames?: SelectClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names — the same keys as\n * the rest of the combobox family. A partial override keeps the other default. */\n translations?: SelectTranslations\n }\n\n/** Ark's own Select `translations` type (its `clearTriggerLabel`), derived structurally rather\n * than imported from `@zag-js/select`, plus the combobox family's `triggerLabel` for the\n * kit's own chevron button. */\nexport type SelectTranslations = NonNullable<Ark.RootProps<NormalizedItem>[\"translations\"]> &\n Pick<ComboboxTranslations, \"triggerLabel\">\n\n/** Wrap a scalar value into Ark's array contract (or clear with `[]`). */\nconst toArkValue = (v: string | null | undefined): string[] | undefined =>\n v === undefined ? undefined : v === null ? [] : [v]\n\n/**\n * The real, focusable `<button role=\"combobox\">`, split out so it reads the\n * `Field` context from *inside* the wrapping `FieldShell` — `Select` itself\n * renders that shell, so calling `useFieldContext()` at its own top level\n * would run too early.\n */\nconst SelectTrigger = ({\n ref,\n onBlur,\n invalid,\n testId,\n className,\n children,\n}: {\n ref?: Ref<HTMLButtonElement>\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n invalid: boolean\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n return (\n <Ark.Trigger\n ref={ref}\n onBlur={onBlur}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Trigger>\n )\n}\n\nexport const Select = <const Data extends SelectData = SelectData>({\n withinPortal = true,\n container,\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Pick a value\",\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n size = \"md\",\n variant = \"default\",\n color,\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n ...selectProps\n}: SelectProps<Data> & Omit<ComponentProps<\"select\">, keyof SelectProps>) => {\n const resolvedTranslations = { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...translations }\n const portalContainer = useOverlayContainer(container)\n const { collection, items, groups } = useMemo(() => normalizeSelectData(data), [data])\n const controlRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const mergedTriggerRef = useMergedRefs(triggerRef, ref)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const selected = items.find(({ value: iv }) => value === iv)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Ark.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(popoverOption({ size }), classNames?.option)}\n >\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item, {\n selected: ctx.selected,\n highlighted: ctx.highlighted,\n })\n }\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{item.label}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n\n const control = (\n <Ark.Root\n collection={collection}\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n // The machine's collection is typed by value (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's value union.\n onValueChange={\n onChange ? (d) => onChange((d.value[0] ?? null) as SelectValue<Data> | null) : undefined\n }\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n deselectable={clearable}\n translations={resolvedTranslations}\n // Ark anchors Select's positioner to the Trigger, which sits inside the\n // padded `inputShell` Control — so `sameWidth` would inset the panel. Anchor\n // to the full Control instead (matching Combobox), so the panel aligns with\n // and matches the trigger's width.\n positioning={{\n sameWidth: true,\n getAnchorRect: () => controlRef.current?.getBoundingClientRect() ?? null,\n }}\n // Content is an `overflow-hidden` clip wrapper, so the machine's native\n // auto-scroll (which needs Content scrollable) no-ops; route scrolling to\n // the inner List scroller instead.\n scrollToIndexFn={scrollHighlightedIntoView}\n data-color={color}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n const showClear = Boolean(clearable) && api.hasSelectedItems && !disabled && !readOnly\n const showChevron = clearSectionMode === \"both\" || !showClear\n return (\n <Ark.Control\n ref={controlRef}\n {...props({\n \"data-invalid\": isInvalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron / clear control.\n \"data-with-end-slot\": true,\n })}\n // Tablet affordance: a tap on the shell's dead zones (padding) opens\n // the menu too, not just the trigger. The trigger, clear and chevron\n // are all buttons, so the helper skips them and they self-handle.\n // Inert when disabled / readOnly, so it never opens where the trigger won't.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n className={cn(inputShell({ size, variant }), \"cursor-pointer\", classNames?.control)}\n >\n <SelectTrigger\n ref={mergedTriggerRef}\n onBlur={onBlur}\n invalid={isInvalid}\n testId={testId}\n className={cn(\n \"flex min-w-0 flex-1 cursor-pointer items-center bg-transparent text-start outline-none disabled:cursor-not-allowed\",\n // Slots live inside the trigger (not the shell), so re-apply the\n // shell's per-size gap here to space the icon from the value.\n shellGap[size],\n )}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-start\">\n {api.hasSelectedItems ? (\n renderItem && selected ? (\n renderItem(selected, {\n selected: false,\n highlighted: false,\n })\n ) : (\n api.valueAsString\n )\n ) : (\n <span className={placeholderColor}>{placeholder}</span>\n )}\n </span>\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </SelectTrigger>\n {showClear && (\n <Ark.ClearTrigger className={popoverClearTrigger}>\n <CloseIcon />\n </Ark.ClearTrigger>\n )}\n {showChevron && (\n // A sibling toggle button (the value `Ark.Trigger` can't nest it\n // next to the clear button), so the chevron sits at the far edge\n // like the rest of the family. Focus the trigger first so keyboard\n // nav stays on the combobox; `preventDefault` stops the tap from\n // stealing focus to this button. `tabIndex=-1`: the trigger is the\n // tab stop.\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={resolvedTranslations.triggerLabel}\n data-chevron\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm data-disabled:cursor-not-allowed\",\n api.open && \"rotate-180\",\n )}\n {...props({\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n })}\n onPointerDown={(event) => event.preventDefault()}\n {...(!(disabled || readOnly) && {\n onClick: () => {\n triggerRef.current?.focus()\n api.setOpen(!api.open)\n },\n })}\n >\n <ChevronIcon />\n </button>\n )}\n </Ark.Control>\n )\n }}\n </Ark.Context>\n\n {/* Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content data-color={color} className={cn(popoverContent, classNames?.popover)}>\n <Ark.List className={popoverList({ withPaddingTop: true })}>\n {groups\n ? groups.map((group) => (\n <Ark.ItemGroup key={group.group}>\n <Ark.ItemGroupLabel className={popoverGroupLabel}>\n {group.group}\n </Ark.ItemGroupLabel>\n {group.items.map(renderOption)}\n </Ark.ItemGroup>\n ))\n : items.map(renderOption)}\n </Ark.List>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n\n <Ark.HiddenSelect {...selectProps} />\n </Ark.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Title } from '../../chunk-
|
|
3
|
-
import { ChevronIcon } from '../../chunk-
|
|
4
|
-
import { Collapse } from '../../chunk-
|
|
2
|
+
import { Title } from '../../chunk-H3PYSAWN.js';
|
|
3
|
+
import { ChevronIcon } from '../../chunk-6YNLRQ25.js';
|
|
4
|
+
import { Collapse } from '../../chunk-NKOTA5TM.js';
|
|
5
5
|
import { mergeIcons } from '../../chunk-XXOR34T4.js';
|
|
6
6
|
import { composeChildren } from '../../chunk-R5LYFTHA.js';
|
|
7
7
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
8
|
-
import { focusStyles } from '../../chunk-
|
|
8
|
+
import { focusStyles } from '../../chunk-C6NVU4F7.js';
|
|
9
9
|
import { TEXT_COLOR_CLASSES } from '../../chunk-GIPQUKCN.js';
|
|
10
|
-
import { cn } from '../../chunk-
|
|
10
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
11
11
|
import { Accordion as Accordion$1 } from '@ark-ui/react/accordion';
|
|
12
12
|
import { cva } from 'class-variance-authority';
|
|
13
13
|
import { createContext, useContext } from 'react';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { ActionIcon } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
2
|
+
export { ActionIcon } from '../../chunk-BE2LWUHY.js';
|
|
3
|
+
import '../../chunk-D2QIPQ74.js';
|
|
4
4
|
import '../../chunk-R5LYFTHA.js';
|
|
5
5
|
import '../../chunk-WYCMIIRR.js';
|
|
6
|
-
import '../../chunk-
|
|
6
|
+
import '../../chunk-C6NVU4F7.js';
|
|
7
7
|
import '../../chunk-GIPQUKCN.js';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-4ASNIDV7.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { NOTIFICATION_DEFAULT_TRANSLATIONS, CloseTrigger, ActionTrigger, Description, Title, Icon, TOAST_STATUS } from '../../chunk-
|
|
2
|
+
import { NOTIFICATION_DEFAULT_TRANSLATIONS, CloseTrigger, ActionTrigger, Description, Title, Icon, TOAST_STATUS } from '../../chunk-LKFHUDEW.js';
|
|
3
3
|
import { devWarn } from '../../chunk-6N6J2DOE.js';
|
|
4
4
|
import '../../chunk-PMUCGFY5.js';
|
|
5
5
|
import '../../chunk-BUIHQJGE.js';
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
6
|
+
import '../../chunk-6YNLRQ25.js';
|
|
7
|
+
import '../../chunk-NKOTA5TM.js';
|
|
8
8
|
import '../../chunk-XXOR34T4.js';
|
|
9
|
-
import '../../chunk-
|
|
9
|
+
import '../../chunk-D2QIPQ74.js';
|
|
10
10
|
import { withAsChildContent } from '../../chunk-R5LYFTHA.js';
|
|
11
11
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
12
|
-
import { focusStyles } from '../../chunk-
|
|
12
|
+
import { focusStyles } from '../../chunk-C6NVU4F7.js';
|
|
13
13
|
import '../../chunk-GIPQUKCN.js';
|
|
14
|
-
import { cn } from '../../chunk-
|
|
14
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
15
15
|
import { ark } from '@ark-ui/react';
|
|
16
16
|
import { cva } from 'class-variance-authority';
|
|
17
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { warnRenamedProp } from '../../chunk-6N6J2DOE.js';
|
|
2
2
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
3
|
-
import { cn } from '../../chunk-
|
|
3
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
4
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
var AmbientBackground = ({
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Drawer } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
2
|
+
import { Drawer } from '../../chunk-O7LS6OZR.js';
|
|
3
|
+
import '../../chunk-DA4QII2N.js';
|
|
4
4
|
import { useContainerQuery } from '../../chunk-4G3N7UMJ.js';
|
|
5
5
|
import '../../chunk-2LI3VPDP.js';
|
|
6
6
|
import { useMergedRefs } from '../../chunk-HBWV5EPU.js';
|
|
7
7
|
import '../../chunk-7P32XCEU.js';
|
|
8
8
|
import '../../chunk-H7WOMZXO.js';
|
|
9
|
-
import '../../chunk-
|
|
9
|
+
import '../../chunk-BE2LWUHY.js';
|
|
10
10
|
import '../../chunk-6N6J2DOE.js';
|
|
11
11
|
import '../../chunk-BUIHQJGE.js';
|
|
12
12
|
import '../../chunk-XXOR34T4.js';
|
|
13
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-D2QIPQ74.js';
|
|
14
14
|
import '../../chunk-R5LYFTHA.js';
|
|
15
15
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
16
|
-
import '../../chunk-
|
|
16
|
+
import '../../chunk-C6NVU4F7.js';
|
|
17
17
|
import { TEXT_COLOR_CLASSES } from '../../chunk-GIPQUKCN.js';
|
|
18
|
-
import { cn } from '../../chunk-
|
|
18
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
19
19
|
import { ark } from '@ark-ui/react';
|
|
20
20
|
import { createContext, useRef, useState, useId, useContext } from 'react';
|
|
21
21
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MEDIA_RADIUS } from '../../chunk-J43LSYQO.js';
|
|
2
2
|
import { ratioStyle } from '../../chunk-AHM6SGEU.js';
|
|
3
3
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
4
|
-
import { cn } from '../../chunk-
|
|
4
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
5
5
|
import { ark } from '@ark-ui/react';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { normalizeSelectData, useLabelSearch, filterSelectData } from '../../chunk-7TDHT3QD.js';
|
|
3
3
|
import { controlOpenProps } from '../../chunk-5FDOOG4J.js';
|
|
4
|
-
import { resolveComboboxTranslations, Combobox } from '../../chunk-
|
|
5
|
-
import { inputControlClasses, inputSlot } from '../../chunk-
|
|
6
|
-
import { FieldShell } from '../../chunk-
|
|
7
|
-
import { popoverClearTrigger } from '../../chunk-
|
|
4
|
+
import { resolveComboboxTranslations, Combobox } from '../../chunk-2BNIHOMT.js';
|
|
5
|
+
import { inputControlClasses, inputSlot } from '../../chunk-45QRQKRC.js';
|
|
6
|
+
import { FieldShell } from '../../chunk-VD6PB3VA.js';
|
|
7
|
+
import { popoverClearTrigger } from '../../chunk-N66NC6QK.js';
|
|
8
|
+
import '../../chunk-V6PY7C6S.js';
|
|
8
9
|
import '../../chunk-7P32XCEU.js';
|
|
9
10
|
import '../../chunk-H7WOMZXO.js';
|
|
10
11
|
import { useUncontrolled } from '../../chunk-PMUCGFY5.js';
|
|
11
12
|
import '../../chunk-BUIHQJGE.js';
|
|
12
|
-
import { CloseIcon } from '../../chunk-
|
|
13
|
+
import { CloseIcon } from '../../chunk-6YNLRQ25.js';
|
|
13
14
|
import '../../chunk-XXOR34T4.js';
|
|
14
15
|
import '../../chunk-R5LYFTHA.js';
|
|
15
16
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
16
17
|
import '../../chunk-GIPQUKCN.js';
|
|
17
|
-
import { cn } from '../../chunk-
|
|
18
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
18
19
|
import { Combobox as Combobox$1 } from '@ark-ui/react/combobox';
|
|
19
20
|
import { useMemo } from 'react';
|
|
20
21
|
import { jsxs, jsx } from 'react/jsx-runtime';
|