@42-central/ui-react 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-JYK6JVR3.js → chunk-3BXKTWWD.js} +8 -8
- package/dist/{chunk-JYK6JVR3.js.map → chunk-3BXKTWWD.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-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-ZN3WYGIQ.js → chunk-5HUEBSIS.js} +3 -3
- package/dist/{chunk-ZN3WYGIQ.js.map → chunk-5HUEBSIS.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-LSIX2PVU.js → chunk-BNWQ7IAZ.js} +7 -7
- package/dist/{chunk-LSIX2PVU.js.map → chunk-BNWQ7IAZ.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-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-WR444JRU.js → chunk-E63VD25L.js} +7 -7
- package/dist/{chunk-WR444JRU.js.map → chunk-E63VD25L.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-VALQ2XVA.js → chunk-H3PYSAWN.js} +3 -3
- package/dist/{chunk-VALQ2XVA.js.map → chunk-H3PYSAWN.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-DHTSVJ4G.js → chunk-IOYZC7SA.js} +9 -9
- package/dist/{chunk-DHTSVJ4G.js.map → chunk-IOYZC7SA.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-6KER77RS.js → chunk-KMZENCEP.js} +7 -7
- package/dist/{chunk-6KER77RS.js.map → chunk-KMZENCEP.js.map} +1 -1
- package/dist/{chunk-VVM7JMZS.js → chunk-LBAE6FP6.js} +8 -8
- package/dist/{chunk-VVM7JMZS.js.map → chunk-LBAE6FP6.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-P276SCCV.js → chunk-MKKQE3TM.js} +6 -6
- package/dist/{chunk-P276SCCV.js.map → chunk-MKKQE3TM.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-WFHY6NRQ.js → chunk-NJPHZBLI.js} +11 -11
- package/dist/{chunk-WFHY6NRQ.js.map → chunk-NJPHZBLI.js.map} +1 -1
- 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-JL4QMM46.js → chunk-POKLPMSB.js} +5 -5
- package/dist/{chunk-JL4QMM46.js.map → chunk-POKLPMSB.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-KOT4PWGE.js → chunk-RCF7HTG5.js} +5 -5
- package/dist/{chunk-KOT4PWGE.js.map → chunk-RCF7HTG5.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-FZNPJAGJ.js → chunk-SXNAUSEB.js} +5 -5
- package/dist/{chunk-FZNPJAGJ.js.map → chunk-SXNAUSEB.js.map} +1 -1
- package/dist/{chunk-7AWOMWCQ.js → chunk-TWLJQE75.js} +7 -7
- package/dist/{chunk-7AWOMWCQ.js.map → chunk-TWLJQE75.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-HDRC6ITF.js → chunk-UT3TOV2Q.js} +3 -3
- package/dist/{chunk-HDRC6ITF.js.map → chunk-UT3TOV2Q.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-45DFYIK5.js → chunk-VD6PB3VA.js} +3 -3
- package/dist/{chunk-45DFYIK5.js.map → chunk-VD6PB3VA.js.map} +1 -1
- package/dist/{chunk-2OQP7UY4.js → chunk-VTDBWU6H.js} +4 -4
- package/dist/{chunk-2OQP7UY4.js.map → chunk-VTDBWU6H.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/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 +6 -6
- 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 +14 -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 +6 -6
- package/dist/components/code-block/index.js +7 -7
- 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 +6 -6
- package/dist/components/combobox-list/index.js +8 -8
- package/dist/components/compare/index.js +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/data-table/index.js +32 -32
- package/dist/components/date-picker/index.js +15 -15
- 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/index.js +2 -2
- 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 +4 -4
- package/dist/components/modal/index.js +6 -6
- package/dist/components/multi-combobox-list/index.js +10 -10
- package/dist/components/multi-select/index.js +9 -9
- 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 +6 -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 +17 -17
- 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.js +2 -2
- 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 +9 -9
- package/dist/components/segment-group/index.js +3 -3
- package/dist/components/select/index.js +7 -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 +15 -15
- 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 +8 -8
- 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 +8 -8
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/title/index.js +2 -2
- package/dist/components/tooltip/index.js +3 -3
- package/dist/components/tree-multi-select/index.js +10 -10
- package/dist/components/tree-select/index.js +7 -7
- package/dist/index.js +2 -2
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +1 -1
- package/package.json +1 -1
- package/src/components/card/card.test.tsx +10 -0
- package/src/components/card/card.tsx +4 -1
- package/src/lib/cn.test.ts +9 -0
- package/src/lib/cn.ts +9 -1
- package/dist/chunk-QP4I37PA.js +0 -14
- package/dist/chunk-QP4I37PA.js.map +0 -1
- package/dist/chunk-Z5WYYDG2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/image-cropper/image-cropper.tsx"],"names":["shape","Ark","useArkImageCropperContext"],"mappings":";;;;;;;;;;;;;;;;;;;AA+GO,IAAM,oBAAA,GAA2D;AAAA,EACtE,KAAA,EAAO,eAAA;AAAA,EACP,eAAA,EAAiB,eAAA;AAAA,EACjB,OAAA,EAAS,mBAAA;AAAA,EACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,UAAU,CAAA,EAAG,CAAA,EAAG,OAAO,MAAA,EAAO,KAC9C,QAAQ,IAAI,CAAA,UAAA,EAAa,QAAQ,CAAA,UAAA,EAAa,CAAC,wBAAwB,CAAC,CAAA,iBAAA,EAAoB,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAA;AAAA,EAClH,cAAA,EAAgB,CAAC,KAAA,KAAU,CAAA,gBAAA,EAAmB,KAAK,CAAA,CAAA,CAAA;AAAA,EACnD,wBAAA,EAA0B,WAAA;AAAA,EAC1B,qBAAA,EACE,8GAAA;AAAA,EACF,gBAAgB,CAAC,EAAE,KAAA,EAAO,CAAA,EAAG,GAAG,KAAA,EAAO,MAAA,EAAO,KAC5C,KAAA,CAAM,KAAK,CAAA,CACR,IAAA,CAAK,QAAA,EAAU,MAAM,cAAc,CAAC,CAAA,MAAA,EAAS,CAAC,CAAA,aAAA,EAAgB,KAAK,CAAA,GAAA,CAAK,CAAA,CACxE,IAAA,CAAK,WAAA,EAAa,MAAM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,EACA,QAAA;AAAA,EACA,OAAA,EAAS,QAAA;AAAA,EACT,GAAG;AACL,CAAA,qBACE,IAAA,CAAC,gBAAA,EAAA,EAAkB,GAAG,IAAA,EACpB,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,oBAAA,EAAA,EAAqB,MAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,QAAA,EAC3D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,GAAA,EAAU,WAAA,EAA0B,SAAA,EAAW,YAAY,KAAA,EAAO,CAAA;AAAA,oBACrF,GAAA,CAAC,qBAAA,EAAA,EAAsB,QAAA,EAAoB,SAAA,EAAW,YAAY,SAAA,EAAW;AAAA,GAAA,EAC/E,CAAA;AAAA,EACC,YAAA,oBAAgB,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,YAAY,QAAA,EAAU,CAAA;AAAA,EACvE;AAAA,CAAA,EACH,CAAA;AAGK,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,SAAA,EAAW,qBAAA;AAAA,EACX,MAAA,EAAQ,kBAAA;AAAA,EACR,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAC","file":"chunk-MKJKCBRE.js","sourcesContent":["\"use client\"\n\nimport {\n ImageCropper as Ark,\n type ImageCropperRootProps as ArkRootProps,\n type ImageCropperCropChangeDetails,\n type ImageCropperFlipState,\n type ImageCropperHandlePosition,\n type UseImageCropperContext,\n useImageCropperContext as useArkImageCropperContext,\n} from \"@ark-ui/react/image-cropper\"\nimport {\n FlipHorizontal2,\n FlipVertical2,\n RefreshCcw,\n RotateCcw,\n RotateCw,\n ZoomIn,\n ZoomOut,\n} from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n} from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { cutoutMask } from \"../../lib/cutout\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useDirectionCheck, useLocale } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport { type Ratio, ratioToNumber } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { useObjectUrl } from \"../../lib/use-object-url\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Slider } from \"../slider/slider\"\n\n/**\n * ImageCropper — pick the part of an image to keep: drag the selection, pull\n * its handles, pinch or wheel to zoom, rotate and flip, then export the crop.\n *\n * <ImageCropper src={file} ratio={1} shape=\"circle\" withControls>\n * <ImageCropper.Context>\n * {(api) => <Button onClick={() => api.getCroppedImage().then(upload)}>Save</Button>}\n * </ImageCropper.Context>\n * </ImageCropper>\n *\n * Built on Ark's image cropper (a \"preview\" component in Ark 5.39, see the\n * docs page), which owns the geometry, the gestures, the keyboard and the\n * canvas export. The kit adds the look (an outside dim, handles that survive\n * forced colors), the controls, `src` as a `Blob`, `ratio` in the media\n * components' shape, flattened callbacks and translations with\n * locale-formatted numbers.\n *\n * The result is read from `ImageCropper.Context`, not an imperative ref:\n * `getCroppedImage()` draws the crop to a canvas and resolves a `Blob` (or a\n * data URL), `getCropData()` returns the crop in the image's own pixels for a\n * server to cut.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperShape = \"rectangle\" | \"circle\"\nexport type ImageCropperFlip = ImageCropperFlipState\n/** A crop rectangle, in px of the viewport. */\nexport type ImageCropperRect = ImageCropperCropChangeDetails[\"crop\"]\nexport type { ImageCropperHandlePosition }\n\n/** A crop rectangle with every number already formatted for the locale. */\nexport type ImageCropperFormattedRect = { x: string; y: string; width: string; height: string }\n\nexport type ImageCropperTranslations = {\n /** The cropper's accessible name. */\n label?: string\n /** What kind of thing the cropper is, announced with its name. */\n roleDescription?: string\n /** The cropper's description while the image loads. */\n loading?: string\n /** The cropper's description once the image is ready. `zoom` is a percent, `rotation` in degrees. */\n preview?: (details: ImageCropperFormattedRect & { zoom: string; rotation: string }) => string\n /** The selection's accessible name. */\n selectionLabel?: (shape: ImageCropperShape) => string\n /** What kind of thing the selection is. Ark's default is the APG \"2d slider\". */\n selectionRoleDescription?: string\n /** How to move it from the keyboard, read as the selection's description. */\n selectionInstructions?: string\n /** The selection's `aria-valuetext`: where it is and how big. */\n selectionValue?: (details: ImageCropperFormattedRect & { shape: ImageCropperShape }) => string\n /** Names the group of controls. */\n controlsLabel?: string\n zoomLabel?: string\n /** The zoom slider's `aria-valuetext`. `percent` is formatted (`\"150%\"`). */\n zoomValue?: (percent: string) => string\n rotateLeftLabel?: string\n rotateRightLabel?: string\n flipHorizontalLabel?: string\n flipVerticalLabel?: string\n resetLabel?: string\n}\n\nexport const DEFAULT_TRANSLATIONS: Required<ImageCropperTranslations> = {\n label: \"Image cropper\",\n roleDescription: \"image cropper\",\n loading: \"Loading the image\",\n preview: ({ zoom, rotation, x, y, width, height }) =>\n `Zoom ${zoom}, rotated ${rotation}. Crop at ${x}px from the left and ${y}px from the top, ${width}px by ${height}px.`,\n selectionLabel: (shape) => `Crop selection (${shape})`,\n selectionRoleDescription: \"2d slider\",\n selectionInstructions:\n \"Use the arrow keys to move the crop. Hold Alt with the arrow keys to resize it. Press plus or minus to zoom.\",\n selectionValue: ({ shape, x, y, width, height }) =>\n match(shape)\n .with(\"circle\", () => `Position X ${x}px, Y ${y}px. Diameter ${width}px.`)\n .with(\"rectangle\", () => `Position X ${x}px, Y ${y}px. Size ${width}px by ${height}px.`)\n .exhaustive(),\n controlsLabel: \"Crop controls\",\n zoomLabel: \"Zoom\",\n zoomValue: (percent) => percent,\n rotateLeftLabel: \"Rotate left\",\n rotateRightLabel: \"Rotate right\",\n flipHorizontalLabel: \"Flip horizontally\",\n flipVerticalLabel: \"Flip vertically\",\n resetLabel: \"Reset\",\n}\n\ntype ArkTranslations = NonNullable<ArkRootProps[\"translations\"]>\n\n/** What the Root shares with the parts Ark's context doesn't cover. */\nexport type ImageCropperIconSlot =\n | \"rotateLeft\"\n | \"rotateRight\"\n | \"flipHorizontal\"\n | \"flipVertical\"\n | \"zoomOut\"\n | \"zoomIn\"\n | \"reset\"\nexport type ImageCropperIcons = IconMap<ImageCropperIconSlot>\n\n/**\n * The default icons of `ImageCropper.Controls`, named like the\n * `translations` labels of the buttons they sit in. None of them points along\n * the inline axis (a rotation turns the same way in either direction, and the\n * zoom glyphs sit at the slider's start and end), so none mirrors under RTL.\n */\nexport const DEFAULT_ICONS: Record<ImageCropperIconSlot, ReactNode> = {\n rotateLeft: <RotateCcw className={iconStroke} />,\n rotateRight: <RotateCw className={iconStroke} />,\n flipHorizontal: <FlipHorizontal2 className={iconStroke} />,\n flipVertical: <FlipVertical2 className={iconStroke} />,\n zoomOut: <ZoomOut className={iconStroke} />,\n zoomIn: <ZoomIn className={iconStroke} />,\n reset: <RefreshCcw className={iconStroke} />,\n}\n\ntype Shared = {\n t: Required<ImageCropperTranslations>\n icons: Record<ImageCropperIconSlot, ReactNode>\n percent: (value: number) => string\n minZoom: number\n maxZoom: number\n shape: ImageCropperShape\n /** The locked width / height (1 for a circle), which the export holds to the pixel. */\n aspect: number | undefined\n}\n\nconst SharedContext = createContext<Shared>({\n t: DEFAULT_TRANSLATIONS,\n icons: DEFAULT_ICONS,\n percent: String,\n minZoom: 1,\n maxZoom: 5,\n shape: \"rectangle\",\n aspect: undefined,\n})\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\n/**\n * Each handle's hit box and visible mark, by position. Ark already places the\n * handle on the selection's edge (`top`/`left`/`right`/`bottom`, centered\n * with `translate`, edges at 96% of the side); this sizes the hit box and\n * shapes the mark, an `::after` centered in it, so the handle stays a bare\n * element any `asChild` child can become.\n *\n * The mark is the Slider thumb: a palette border on the page-tinted fill.\n * Corners are round thumbs, edges are pills along their side. The hit box is\n * 24px under a mouse and 44px (WCAG 2.5.8) under a finger, around the same\n * small mark.\n *\n * Physical sides, not logical ones: the crop is a rectangle in the image's own\n * space, where `e` is the image's right edge whatever the text direction, and\n * Ark positions the handles that way too.\n *\n * Corners sit above the edge bars (`z-1`), which overlap them at 96% of the\n * side, so a press near a corner resizes both ways. On a circle only the four\n * edge pills show: they're the points that touch it.\n */\nconst HANDLE: Record<ImageCropperHandlePosition, string> = {\n nw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n ne: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n se: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n sw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n n: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n s: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n e: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n w: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n}\n\n/** A ≥ 44px control (WCAG 2.5.8). */\nconst control = \"h-11 [&_svg]:size-5\"\n/** The zoom slider's end glyphs: decorative, the slider carries the name. */\nconst zoomIcon = \"flex shrink-0 [&_svg]:size-4\"\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperRootProps = Omit<\n ArkRootProps,\n | \"aspectRatio\"\n | \"cropShape\"\n | \"translations\"\n | \"onZoomChange\"\n | \"onRotationChange\"\n | \"onFlipChange\"\n | \"onCropChange\"\n> &\n WithTestId & {\n /** Locks the selection to this width / height. Free when unset; a circle is always 1. */\n ratio?: Ratio\n /** A circle crop still exports a square: mask it where you show it. */\n shape?: ImageCropperShape\n /** Fires as the zoom changes, from 1 (fit) up. */\n onZoomChange?: (zoom: number) => void\n /** Fires as the rotation changes, in degrees. */\n onRotationChange?: (rotation: number) => void\n onFlipChange?: (flip: ImageCropperFlip) => void\n /** Fires as the selection moves or resizes, in px of the viewport. */\n onCropChange?: (crop: ImageCropperRect) => void\n translations?: ImageCropperTranslations\n /** Replaces the control icons: `rotateLeft`, `rotateRight`, `flipHorizontal`,\n * `flipVertical`, `zoomOut`, `zoomIn`, `reset`. Drawn as given, never restroked. */\n icons?: ImageCropperIcons\n /**\n * The palette of the selection's edge, handles, focus ring and zoom slider.\n * `brand` by default: on a photo, the kit's black-and-white default palette\n * would read as plain chrome rather than as a control.\n */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\n/** `\"16/9\"` → `1.777…`, and nothing for a ratio that can't lock a selection. */\nconst aspectRatioOf = (ratio: Ratio | undefined) => {\n const value = ratio === undefined ? Number.NaN : ratioToNumber(ratio)\n return Number.isFinite(value) && value > 0 ? value : undefined\n}\n\nconst ImageCropperRoot = ({\n ratio,\n shape,\n onZoomChange,\n onRotationChange,\n onFlipChange,\n onCropChange,\n translations,\n icons,\n minZoom = 1,\n maxZoom = 5,\n color = \"brand\",\n className,\n testId,\n ref,\n ...rest\n}: ImageCropperRootProps) => {\n const locale = useLocale()\n const direction = useDirectionCheck()\n\n const [shared, arkTranslations] = useMemo(() => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const pixels = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 })\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n const degrees = new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"degree\",\n maximumFractionDigits: 0,\n })\n const rect = ({ x, y, width, height }: ImageCropperRect): ImageCropperFormattedRect => ({\n x: pixels.format(x),\n y: pixels.format(y),\n width: pixels.format(width),\n height: pixels.format(height),\n })\n const ark: ArkTranslations = {\n rootLabel: t.label,\n rootRoleDescription: t.roleDescription,\n previewLoading: t.loading,\n previewDescription: ({ crop, zoom, rotation }) =>\n t.preview({\n ...rect(crop),\n zoom: percent.format(zoom ?? 1),\n rotation: degrees.format(rotation ?? 0),\n }),\n selectionLabel: ({ shape }) => t.selectionLabel(shape),\n selectionRoleDescription: t.selectionRoleDescription,\n selectionInstructions: t.selectionInstructions,\n selectionValueText: ({ shape, ...crop }) => t.selectionValue({ shape, ...rect(crop) }),\n }\n const value: Shared = {\n t,\n icons: mergeIcons(DEFAULT_ICONS, icons),\n percent: (n) => percent.format(n),\n minZoom,\n maxZoom,\n shape: shape ?? \"rectangle\",\n aspect: shape === \"circle\" ? 1 : aspectRatioOf(ratio),\n }\n return [value, ark] as const\n }, [translations, icons, locale, minZoom, maxZoom, shape, ratio])\n\n const rootRef = useMergedRefs(ref, direction)\n return (\n <SharedContext value={shared}>\n <Ark.Root\n ref={rootRef}\n aspectRatio={aspectRatioOf(ratio)}\n cropShape={shape}\n minZoom={minZoom}\n maxZoom={maxZoom}\n translations={arkTranslations}\n onZoomChange={onZoomChange && (({ zoom }) => onZoomChange(zoom))}\n onRotationChange={onRotationChange && (({ rotation }) => onRotationChange(rotation))}\n onFlipChange={onFlipChange && (({ flip }) => onFlipChange(flip))}\n onCropChange={onCropChange && (({ crop }) => onCropChange(crop))}\n data-color={color}\n className={cn(\"flex w-full flex-col gap-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </SharedContext>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperViewportProps = Ark.ViewportProps &\n WithTestId & {\n /** Corner radius, from the media scale. */\n radius?: MediaRadius\n }\n\n/** The frame the image is cropped in. Takes the pan, wheel and pinch gestures. */\nconst ImageCropperViewport = ({\n radius = \"xs\",\n className,\n testId,\n ...rest\n}: ImageCropperViewportProps) => (\n <Ark.Viewport\n className={cn(\n \"relative touch-none select-none overflow-clip bg-black/80\",\n MEDIA_RADIUS[radius],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperImageProps = NoAsChild<\n Omit<Ark.ImageProps, \"src\"> &\n WithTestId & {\n /** A URL, or a `Blob` / `File`, shown through an object URL that's revoked when it changes. */\n src: string | Blob\n }\n>\n\n/**\n * The image being cropped. Decorative to assistive technology: the cropper's\n * own description says what's selected. Fades in once Ark has measured it.\n *\n * A cross-origin URL needs `crossOrigin=\"anonymous\"` (and CORS headers on the\n * server) for `getCroppedImage()`; without them the canvas is tainted and the\n * export resolves `null`.\n */\nconst ImageCropperImage = ({\n src,\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: ImageCropperImageProps) => {\n const url = useObjectUrl(src)\n return (\n <Ark.Image\n src={url}\n className={cn(\n \"block h-auto w-full max-w-none opacity-0 data-ready:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ImageCropperSelectionProps = NoAsChild<\n Ark.SelectionProps &\n WithTestId & {\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n }\n>\n\n/** The selection's hole in the dim: Ark sets the crop rectangle as custom properties on the root. */\nconst CROP_RECT = {\n x: \"var(--crop-x)\",\n y: \"var(--crop-y)\",\n width: \"var(--crop-width)\",\n height: \"var(--crop-height)\",\n}\n\n/**\n * The crop area: a `role=\"slider\"` that moves with the arrow keys, resizes\n * with Alt + arrows and zooms with `+`/`-`.\n *\n * Everything outside it is dimmed like a Modal backdrop by an overlay drawn\n * just before it, with the selection cut out of it (`lib/cutout.ts`): a real\n * rectangle or circle, following the crop through Ark's `--crop-*` custom\n * properties without a render. The overlay steps aside in forced colors,\n * where it would paint `Canvas` over the image; the edge and the handles,\n * borders both, are repainted instead.\n */\nconst ImageCropperSelection = ({\n withGrid = true,\n className,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperSelectionProps) => {\n const { shape } = useContext(SharedContext)\n return (\n <>\n <div\n aria-hidden\n data-part=\"overlay\"\n data-shape={shape}\n // The Modal backdrop's dim, with a light blur: the frame stays legible\n // around the crop without competing with it.\n className=\"pointer-events-none absolute inset-0 bg-black/50 backdrop-blur-xs forced-colors:hidden\"\n style={cutoutMask(shape, CROP_RECT)}\n />\n <Ark.Selection\n className={cn(\n \"cursor-move border border-(--c-solid) data-[shape=circle]:rounded-full\",\n // A pale halo around the 1px palette edge: two tones, so it holds on a dark photo and a bright one.\n \"shadow-[0_0_0_1px_rgb(255_255_255/0.45)]\",\n \"data-disabled:cursor-default\",\n // Inset and gap-less: the selection can sit flush with the clipping viewport.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withGrid && (\n <>\n <ImageCropperGrid axis=\"horizontal\" />\n <ImageCropperGrid axis=\"vertical\" />\n </>\n )}\n {Ark.handles.map((position) => (\n <ImageCropperHandle key={position} position={position} />\n ))}\n {children}\n </Ark.Selection>\n </>\n )\n}\n\nexport type ImageCropperHandleProps = Ark.HandleProps & WithTestId\n\n/** One resize handle. `Selection` renders all eight; use it when you compose your own. */\nconst ImageCropperHandle = ({ position, className, testId, ...rest }: ImageCropperHandleProps) => (\n <Ark.Handle\n position={position}\n className={cn(\n \"after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:rounded-full\",\n \"after:border-2 after:border-(--c-solid) after:bg-brand-50 after:shadow-sm dark:after:bg-brand-950\",\n // Grows a touch while held, like the Slider thumb.\n \"after:transition-[scale] after:duration-(--duration-fast) after:ease-standard motion-reduce:after:transition-none\",\n \"in-data-dragging:after:scale-110\",\n \"data-disabled:hidden\",\n HANDLE[position],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperGridProps = Ark.GridProps & WithTestId\n\n/** A pair of rule-of-thirds lines, along `axis`. Fades in while the crop is dragged, resized or panned. */\nconst ImageCropperGrid = ({ className, testId, ...rest }: ImageCropperGridProps) => (\n <Ark.Grid\n className={cn(\n \"border-white/50 data-[axis=horizontal]:border-y data-[axis=vertical]:border-x\",\n \"opacity-0 data-dragging:opacity-100 data-panning:opacity-100\",\n \"transition-opacity duration-(--duration-fast) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperControlsProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Zoom slider, rotate ±90°, flip and reset, wired to the nearest cropper. Each\n * is a 44px button named from `translations`; the flips are toggle buttons.\n */\nconst ImageCropperControls = ({ className, testId, ...rest }: ImageCropperControlsProps) => {\n const api = useImageCropperContext()\n const { t, icons, percent, minZoom, maxZoom } = useContext(SharedContext)\n return (\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={t.controlsLabel}\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateLeftLabel}\n onClick={() => api.rotateBy(-90)}\n >\n {icons.rotateLeft}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateRightLabel}\n onClick={() => api.rotateBy(90)}\n >\n {icons.rotateRight}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipHorizontalLabel}\n aria-pressed={api.flip.horizontal}\n onClick={() => api.flipHorizontally()}\n >\n {icons.flipHorizontal}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipVerticalLabel}\n aria-pressed={api.flip.vertical}\n onClick={() => api.flipVertically()}\n >\n {icons.flipVertical}\n </ActionIcon>\n <div\n className={cn(\n \"flex min-w-40 flex-1 items-center gap-2 px-2\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n )}\n >\n <span aria-hidden className={zoomIcon}>\n {icons.zoomOut}\n </span>\n <Slider\n min={minZoom}\n max={maxZoom}\n step={0.01}\n value={api.zoom}\n onChange={(zoom) => api.setZoom(zoom)}\n aria-label={[t.zoomLabel]}\n getAriaValueText={({ value }) => t.zoomValue(percent(value))}\n classNames={{ field: \"flex-1\" }}\n />\n <span aria-hidden className={zoomIcon}>\n {icons.zoomIn}\n </span>\n </div>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.resetLabel}\n onClick={() => api.reset()}\n >\n {icons.reset}\n </ActionIcon>\n </div>\n )\n}\n\ntype CropExport = UseImageCropperContext[\"getCroppedImage\"]\n\n/** The size a `width × height` export should have at `aspect`: its short side stretched to match the long one. */\nconst exactSize = (width: number, height: number, aspect: number) =>\n width / height > aspect\n ? { width, height: Math.round(width / aspect) }\n : { width: Math.round(height * aspect), height }\n\n/**\n * Ark's export, held to a locked ratio. Ark sizes the canvas from the image's\n * rounded layout box, scaling each side on its own, so a 1:1 crop can come\n * out 511 × 512. When it does, the crop is exported again losslessly and\n * redrawn at the exact size, then encoded once as asked.\n */\nexport const exactExport =\n (getCroppedImage: CropExport, aspect: number | undefined): CropExport =>\n async (options) => {\n const blob = await getCroppedImage(options)\n if (aspect === undefined || !(blob instanceof Blob) || typeof createImageBitmap !== \"function\")\n return blob\n const shot = await createImageBitmap(blob)\n // Read the size before `close()`: a closed bitmap reports 0 × 0.\n const { width, height } = shot\n shot.close()\n const size = exactSize(width, height, aspect)\n if (size.width === width && size.height === height) return blob\n const lossless = await getCroppedImage({ ...options, type: \"image/png\" })\n if (!(lossless instanceof Blob)) return blob\n const source = await createImageBitmap(lossless)\n const canvas = document.createElement(\"canvas\")\n canvas.width = size.width\n canvas.height = size.height\n const context = canvas.getContext(\"2d\")\n if (!context) return blob\n context.drawImage(source, 0, 0, size.width, size.height)\n source.close()\n return new Promise<Blob | null>((resolve) =>\n canvas.toBlob(resolve, options?.type ?? \"image/png\", options?.quality ?? 1),\n )\n }\n\n/**\n * The nearest cropper's API: Ark's, with `getCroppedImage()` held to the\n * locked ratio (or the circle) to the pixel.\n */\nconst useImageCropperContext = (): UseImageCropperContext => {\n const api = useArkImageCropperContext()\n const { aspect } = useContext(SharedContext)\n return { ...api, getCroppedImage: exactExport(api.getCroppedImage, aspect) }\n}\n\nexport type ImageCropperContextProps = Ark.ContextProps\n\n/** Renders its child function with the cropper's API, for an export button. */\nconst ImageCropperContext = ({ children }: ImageCropperContextProps) =>\n children(useImageCropperContext())\n\n// ---------------------------------------------------------------------------\n// Convenience\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperClassNames = {\n viewport?: string\n image?: string\n selection?: string\n controls?: string\n}\n\nexport type ImageCropperProps = NoAsChild<\n Omit<ImageCropperRootProps, \"children\"> & {\n /** The image to crop: a URL, or a `Blob` / `File` (a pick or a drop). */\n src: string | Blob\n /** Needed on a cross-origin URL for the export to read its pixels. */\n crossOrigin?: ImageCropperImageProps[\"crossOrigin\"]\n /** The viewport's corner radius, from the media scale. */\n radius?: MediaRadius\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n /** The zoom slider and the rotate, flip and reset buttons, under the image. */\n withControls?: boolean\n classNames?: ImageCropperClassNames\n /** Rendered last, inside the root: an `ImageCropper.Context` for the export. */\n children?: ReactNode\n }\n>\n\nconst ImageCropperComponent = ({\n src,\n crossOrigin,\n radius,\n withGrid,\n withControls = false,\n classNames,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperProps) => (\n <ImageCropperRoot {...rest}>\n <ImageCropperViewport radius={radius} className={classNames?.viewport}>\n <ImageCropperImage src={src} crossOrigin={crossOrigin} className={classNames?.image} />\n <ImageCropperSelection withGrid={withGrid} className={classNames?.selection} />\n </ImageCropperViewport>\n {withControls && <ImageCropperControls className={classNames?.controls} />}\n {children}\n </ImageCropperRoot>\n)\n\nexport const ImageCropper = Object.assign(ImageCropperComponent, {\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n Controls: ImageCropperControls,\n Context: ImageCropperContext,\n})\n\nexport { useImageCropperContext }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/image-cropper/image-cropper.tsx"],"names":["shape","Ark","useArkImageCropperContext"],"mappings":";;;;;;;;;;;;;;;;;;;AA+GO,IAAM,oBAAA,GAA2D;AAAA,EACtE,KAAA,EAAO,eAAA;AAAA,EACP,eAAA,EAAiB,eAAA;AAAA,EACjB,OAAA,EAAS,mBAAA;AAAA,EACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,UAAU,CAAA,EAAG,CAAA,EAAG,OAAO,MAAA,EAAO,KAC9C,QAAQ,IAAI,CAAA,UAAA,EAAa,QAAQ,CAAA,UAAA,EAAa,CAAC,wBAAwB,CAAC,CAAA,iBAAA,EAAoB,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAA;AAAA,EAClH,cAAA,EAAgB,CAAC,KAAA,KAAU,CAAA,gBAAA,EAAmB,KAAK,CAAA,CAAA,CAAA;AAAA,EACnD,wBAAA,EAA0B,WAAA;AAAA,EAC1B,qBAAA,EACE,8GAAA;AAAA,EACF,gBAAgB,CAAC,EAAE,KAAA,EAAO,CAAA,EAAG,GAAG,KAAA,EAAO,MAAA,EAAO,KAC5C,KAAA,CAAM,KAAK,CAAA,CACR,IAAA,CAAK,QAAA,EAAU,MAAM,cAAc,CAAC,CAAA,MAAA,EA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ACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA,GAAe,KAAA;AAAA,EACf,UAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA,EAAS,QAAA;AAAA,EACT,GAAG;AACL,CAAA,qBACE,IAAA,CAAC,gBAAA,EAAA,EAAkB,GAAG,IAAA,EACpB,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,oBAAA,EAAA,EAAqB,MAAA,EAAgB,SAAA,EAAW,UAAA,EAAY,QAAA,EAC3D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,GAAA,EAAU,WAAA,EAA0B,SAAA,EAAW,YAAY,KAAA,EAAO,CAAA;AAAA,oBACrF,GAAA,CAAC,qBAAA,EAAA,EAAsB,QAAA,EAAoB,SAAA,EAAW,YAAY,SAAA,EAAW;AAAA,GAAA,EAC/E,CAAA;AAAA,EACC,YAAA,oBAAgB,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,YAAY,QAAA,EAAU,CAAA;AAAA,EACvE;AAAA,CAAA,EACH,CAAA;AAGK,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,SAAA,EAAW,qBAAA;AAAA,EACX,MAAA,EAAQ,kBAAA;AAAA,EACR,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAC","file":"chunk-47LEAR6G.js","sourcesContent":["\"use client\"\n\nimport {\n ImageCropper as Ark,\n type ImageCropperRootProps as ArkRootProps,\n type ImageCropperCropChangeDetails,\n type ImageCropperFlipState,\n type ImageCropperHandlePosition,\n type UseImageCropperContext,\n useImageCropperContext as useArkImageCropperContext,\n} from \"@ark-ui/react/image-cropper\"\nimport {\n FlipHorizontal2,\n FlipVertical2,\n RefreshCcw,\n RotateCcw,\n RotateCw,\n ZoomIn,\n ZoomOut,\n} from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n} from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { cutoutMask } from \"../../lib/cutout\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useDirectionCheck, useLocale } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport { type Ratio, ratioToNumber } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { useObjectUrl } from \"../../lib/use-object-url\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Slider } from \"../slider/slider\"\n\n/**\n * ImageCropper — pick the part of an image to keep: drag the selection, pull\n * its handles, pinch or wheel to zoom, rotate and flip, then export the crop.\n *\n * <ImageCropper src={file} ratio={1} shape=\"circle\" withControls>\n * <ImageCropper.Context>\n * {(api) => <Button onClick={() => api.getCroppedImage().then(upload)}>Save</Button>}\n * </ImageCropper.Context>\n * </ImageCropper>\n *\n * Built on Ark's image cropper (a \"preview\" component in Ark 5.39, see the\n * docs page), which owns the geometry, the gestures, the keyboard and the\n * canvas export. The kit adds the look (an outside dim, handles that survive\n * forced colors), the controls, `src` as a `Blob`, `ratio` in the media\n * components' shape, flattened callbacks and translations with\n * locale-formatted numbers.\n *\n * The result is read from `ImageCropper.Context`, not an imperative ref:\n * `getCroppedImage()` draws the crop to a canvas and resolves a `Blob` (or a\n * data URL), `getCropData()` returns the crop in the image's own pixels for a\n * server to cut.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperShape = \"rectangle\" | \"circle\"\nexport type ImageCropperFlip = ImageCropperFlipState\n/** A crop rectangle, in px of the viewport. */\nexport type ImageCropperRect = ImageCropperCropChangeDetails[\"crop\"]\nexport type { ImageCropperHandlePosition }\n\n/** A crop rectangle with every number already formatted for the locale. */\nexport type ImageCropperFormattedRect = { x: string; y: string; width: string; height: string }\n\nexport type ImageCropperTranslations = {\n /** The cropper's accessible name. */\n label?: string\n /** What kind of thing the cropper is, announced with its name. */\n roleDescription?: string\n /** The cropper's description while the image loads. */\n loading?: string\n /** The cropper's description once the image is ready. `zoom` is a percent, `rotation` in degrees. */\n preview?: (details: ImageCropperFormattedRect & { zoom: string; rotation: string }) => string\n /** The selection's accessible name. */\n selectionLabel?: (shape: ImageCropperShape) => string\n /** What kind of thing the selection is. Ark's default is the APG \"2d slider\". */\n selectionRoleDescription?: string\n /** How to move it from the keyboard, read as the selection's description. */\n selectionInstructions?: string\n /** The selection's `aria-valuetext`: where it is and how big. */\n selectionValue?: (details: ImageCropperFormattedRect & { shape: ImageCropperShape }) => string\n /** Names the group of controls. */\n controlsLabel?: string\n zoomLabel?: string\n /** The zoom slider's `aria-valuetext`. `percent` is formatted (`\"150%\"`). */\n zoomValue?: (percent: string) => string\n rotateLeftLabel?: string\n rotateRightLabel?: string\n flipHorizontalLabel?: string\n flipVerticalLabel?: string\n resetLabel?: string\n}\n\nexport const DEFAULT_TRANSLATIONS: Required<ImageCropperTranslations> = {\n label: \"Image cropper\",\n roleDescription: \"image cropper\",\n loading: \"Loading the image\",\n preview: ({ zoom, rotation, x, y, width, height }) =>\n `Zoom ${zoom}, rotated ${rotation}. Crop at ${x}px from the left and ${y}px from the top, ${width}px by ${height}px.`,\n selectionLabel: (shape) => `Crop selection (${shape})`,\n selectionRoleDescription: \"2d slider\",\n selectionInstructions:\n \"Use the arrow keys to move the crop. Hold Alt with the arrow keys to resize it. Press plus or minus to zoom.\",\n selectionValue: ({ shape, x, y, width, height }) =>\n match(shape)\n .with(\"circle\", () => `Position X ${x}px, Y ${y}px. Diameter ${width}px.`)\n .with(\"rectangle\", () => `Position X ${x}px, Y ${y}px. Size ${width}px by ${height}px.`)\n .exhaustive(),\n controlsLabel: \"Crop controls\",\n zoomLabel: \"Zoom\",\n zoomValue: (percent) => percent,\n rotateLeftLabel: \"Rotate left\",\n rotateRightLabel: \"Rotate right\",\n flipHorizontalLabel: \"Flip horizontally\",\n flipVerticalLabel: \"Flip vertically\",\n resetLabel: \"Reset\",\n}\n\ntype ArkTranslations = NonNullable<ArkRootProps[\"translations\"]>\n\n/** What the Root shares with the parts Ark's context doesn't cover. */\nexport type ImageCropperIconSlot =\n | \"rotateLeft\"\n | \"rotateRight\"\n | \"flipHorizontal\"\n | \"flipVertical\"\n | \"zoomOut\"\n | \"zoomIn\"\n | \"reset\"\nexport type ImageCropperIcons = IconMap<ImageCropperIconSlot>\n\n/**\n * The default icons of `ImageCropper.Controls`, named like the\n * `translations` labels of the buttons they sit in. None of them points along\n * the inline axis (a rotation turns the same way in either direction, and the\n * zoom glyphs sit at the slider's start and end), so none mirrors under RTL.\n */\nexport const DEFAULT_ICONS: Record<ImageCropperIconSlot, ReactNode> = {\n rotateLeft: <RotateCcw className={iconStroke} />,\n rotateRight: <RotateCw className={iconStroke} />,\n flipHorizontal: <FlipHorizontal2 className={iconStroke} />,\n flipVertical: <FlipVertical2 className={iconStroke} />,\n zoomOut: <ZoomOut className={iconStroke} />,\n zoomIn: <ZoomIn className={iconStroke} />,\n reset: <RefreshCcw className={iconStroke} />,\n}\n\ntype Shared = {\n t: Required<ImageCropperTranslations>\n icons: Record<ImageCropperIconSlot, ReactNode>\n percent: (value: number) => string\n minZoom: number\n maxZoom: number\n shape: ImageCropperShape\n /** The locked width / height (1 for a circle), which the export holds to the pixel. */\n aspect: number | undefined\n}\n\nconst SharedContext = createContext<Shared>({\n t: DEFAULT_TRANSLATIONS,\n icons: DEFAULT_ICONS,\n percent: String,\n minZoom: 1,\n maxZoom: 5,\n shape: \"rectangle\",\n aspect: undefined,\n})\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\n/**\n * Each handle's hit box and visible mark, by position. Ark already places the\n * handle on the selection's edge (`top`/`left`/`right`/`bottom`, centered\n * with `translate`, edges at 96% of the side); this sizes the hit box and\n * shapes the mark, an `::after` centered in it, so the handle stays a bare\n * element any `asChild` child can become.\n *\n * The mark is the Slider thumb: a palette border on the page-tinted fill.\n * Corners are round thumbs, edges are pills along their side. The hit box is\n * 24px under a mouse and 44px (WCAG 2.5.8) under a finger, around the same\n * small mark.\n *\n * Physical sides, not logical ones: the crop is a rectangle in the image's own\n * space, where `e` is the image's right edge whatever the text direction, and\n * Ark positions the handles that way too.\n *\n * Corners sit above the edge bars (`z-1`), which overlap them at 96% of the\n * side, so a press near a corner resizes both ways. On a circle only the four\n * edge pills show: they're the points that touch it.\n */\nconst HANDLE: Record<ImageCropperHandlePosition, string> = {\n nw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n ne: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n se: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n sw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n n: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n s: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n e: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n w: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n}\n\n/** A ≥ 44px control (WCAG 2.5.8). */\nconst control = \"h-11 [&_svg]:size-5\"\n/** The zoom slider's end glyphs: decorative, the slider carries the name. */\nconst zoomIcon = \"flex shrink-0 [&_svg]:size-4\"\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperRootProps = Omit<\n ArkRootProps,\n | \"aspectRatio\"\n | \"cropShape\"\n | \"translations\"\n | \"onZoomChange\"\n | \"onRotationChange\"\n | \"onFlipChange\"\n | \"onCropChange\"\n> &\n WithTestId & {\n /** Locks the selection to this width / height. Free when unset; a circle is always 1. */\n ratio?: Ratio\n /** A circle crop still exports a square: mask it where you show it. */\n shape?: ImageCropperShape\n /** Fires as the zoom changes, from 1 (fit) up. */\n onZoomChange?: (zoom: number) => void\n /** Fires as the rotation changes, in degrees. */\n onRotationChange?: (rotation: number) => void\n onFlipChange?: (flip: ImageCropperFlip) => void\n /** Fires as the selection moves or resizes, in px of the viewport. */\n onCropChange?: (crop: ImageCropperRect) => void\n translations?: ImageCropperTranslations\n /** Replaces the control icons: `rotateLeft`, `rotateRight`, `flipHorizontal`,\n * `flipVertical`, `zoomOut`, `zoomIn`, `reset`. Drawn as given, never restroked. */\n icons?: ImageCropperIcons\n /**\n * The palette of the selection's edge, handles, focus ring and zoom slider.\n * `brand` by default: on a photo, the kit's black-and-white default palette\n * would read as plain chrome rather than as a control.\n */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\n/** `\"16/9\"` → `1.777…`, and nothing for a ratio that can't lock a selection. */\nconst aspectRatioOf = (ratio: Ratio | undefined) => {\n const value = ratio === undefined ? Number.NaN : ratioToNumber(ratio)\n return Number.isFinite(value) && value > 0 ? value : undefined\n}\n\nconst ImageCropperRoot = ({\n ratio,\n shape,\n onZoomChange,\n onRotationChange,\n onFlipChange,\n onCropChange,\n translations,\n icons,\n minZoom = 1,\n maxZoom = 5,\n color = \"brand\",\n className,\n testId,\n ref,\n ...rest\n}: ImageCropperRootProps) => {\n const locale = useLocale()\n const direction = useDirectionCheck()\n\n const [shared, arkTranslations] = useMemo(() => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const pixels = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 })\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n const degrees = new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"degree\",\n maximumFractionDigits: 0,\n })\n const rect = ({ x, y, width, height }: ImageCropperRect): ImageCropperFormattedRect => ({\n x: pixels.format(x),\n y: pixels.format(y),\n width: pixels.format(width),\n height: pixels.format(height),\n })\n const ark: ArkTranslations = {\n rootLabel: t.label,\n rootRoleDescription: t.roleDescription,\n previewLoading: t.loading,\n previewDescription: ({ crop, zoom, rotation }) =>\n t.preview({\n ...rect(crop),\n zoom: percent.format(zoom ?? 1),\n rotation: degrees.format(rotation ?? 0),\n }),\n selectionLabel: ({ shape }) => t.selectionLabel(shape),\n selectionRoleDescription: t.selectionRoleDescription,\n selectionInstructions: t.selectionInstructions,\n selectionValueText: ({ shape, ...crop }) => t.selectionValue({ shape, ...rect(crop) }),\n }\n const value: Shared = {\n t,\n icons: mergeIcons(DEFAULT_ICONS, icons),\n percent: (n) => percent.format(n),\n minZoom,\n maxZoom,\n shape: shape ?? \"rectangle\",\n aspect: shape === \"circle\" ? 1 : aspectRatioOf(ratio),\n }\n return [value, ark] as const\n }, [translations, icons, locale, minZoom, maxZoom, shape, ratio])\n\n const rootRef = useMergedRefs(ref, direction)\n return (\n <SharedContext value={shared}>\n <Ark.Root\n ref={rootRef}\n aspectRatio={aspectRatioOf(ratio)}\n cropShape={shape}\n minZoom={minZoom}\n maxZoom={maxZoom}\n translations={arkTranslations}\n onZoomChange={onZoomChange && (({ zoom }) => onZoomChange(zoom))}\n onRotationChange={onRotationChange && (({ rotation }) => onRotationChange(rotation))}\n onFlipChange={onFlipChange && (({ flip }) => onFlipChange(flip))}\n onCropChange={onCropChange && (({ crop }) => onCropChange(crop))}\n data-color={color}\n className={cn(\"flex w-full flex-col gap-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </SharedContext>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperViewportProps = Ark.ViewportProps &\n WithTestId & {\n /** Corner radius, from the media scale. */\n radius?: MediaRadius\n }\n\n/** The frame the image is cropped in. Takes the pan, wheel and pinch gestures. */\nconst ImageCropperViewport = ({\n radius = \"xs\",\n className,\n testId,\n ...rest\n}: ImageCropperViewportProps) => (\n <Ark.Viewport\n className={cn(\n \"relative touch-none select-none overflow-clip bg-black/80\",\n MEDIA_RADIUS[radius],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperImageProps = NoAsChild<\n Omit<Ark.ImageProps, \"src\"> &\n WithTestId & {\n /** A URL, or a `Blob` / `File`, shown through an object URL that's revoked when it changes. */\n src: string | Blob\n }\n>\n\n/**\n * The image being cropped. Decorative to assistive technology: the cropper's\n * own description says what's selected. Fades in once Ark has measured it.\n *\n * A cross-origin URL needs `crossOrigin=\"anonymous\"` (and CORS headers on the\n * server) for `getCroppedImage()`; without them the canvas is tainted and the\n * export resolves `null`.\n */\nconst ImageCropperImage = ({\n src,\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: ImageCropperImageProps) => {\n const url = useObjectUrl(src)\n return (\n <Ark.Image\n src={url}\n className={cn(\n \"block h-auto w-full max-w-none opacity-0 data-ready:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ImageCropperSelectionProps = NoAsChild<\n Ark.SelectionProps &\n WithTestId & {\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n }\n>\n\n/** The selection's hole in the dim: Ark sets the crop rectangle as custom properties on the root. */\nconst CROP_RECT = {\n x: \"var(--crop-x)\",\n y: \"var(--crop-y)\",\n width: \"var(--crop-width)\",\n height: \"var(--crop-height)\",\n}\n\n/**\n * The crop area: a `role=\"slider\"` that moves with the arrow keys, resizes\n * with Alt + arrows and zooms with `+`/`-`.\n *\n * Everything outside it is dimmed like a Modal backdrop by an overlay drawn\n * just before it, with the selection cut out of it (`lib/cutout.ts`): a real\n * rectangle or circle, following the crop through Ark's `--crop-*` custom\n * properties without a render. The overlay steps aside in forced colors,\n * where it would paint `Canvas` over the image; the edge and the handles,\n * borders both, are repainted instead.\n */\nconst ImageCropperSelection = ({\n withGrid = true,\n className,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperSelectionProps) => {\n const { shape } = useContext(SharedContext)\n return (\n <>\n <div\n aria-hidden\n data-part=\"overlay\"\n data-shape={shape}\n // The Modal backdrop's dim, with a light blur: the frame stays legible\n // around the crop without competing with it.\n className=\"pointer-events-none absolute inset-0 bg-black/50 backdrop-blur-xs forced-colors:hidden\"\n style={cutoutMask(shape, CROP_RECT)}\n />\n <Ark.Selection\n className={cn(\n \"cursor-move border border-(--c-solid) data-[shape=circle]:rounded-full\",\n // A pale halo around the 1px palette edge: two tones, so it holds on a dark photo and a bright one.\n \"shadow-[0_0_0_1px_rgb(255_255_255/0.45)]\",\n \"data-disabled:cursor-default\",\n // Inset and gap-less: the selection can sit flush with the clipping viewport.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withGrid && (\n <>\n <ImageCropperGrid axis=\"horizontal\" />\n <ImageCropperGrid axis=\"vertical\" />\n </>\n )}\n {Ark.handles.map((position) => (\n <ImageCropperHandle key={position} position={position} />\n ))}\n {children}\n </Ark.Selection>\n </>\n )\n}\n\nexport type ImageCropperHandleProps = Ark.HandleProps & WithTestId\n\n/** One resize handle. `Selection` renders all eight; use it when you compose your own. */\nconst ImageCropperHandle = ({ position, className, testId, ...rest }: ImageCropperHandleProps) => (\n <Ark.Handle\n position={position}\n className={cn(\n \"after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:rounded-full\",\n \"after:border-2 after:border-(--c-solid) after:bg-brand-50 after:shadow-sm dark:after:bg-brand-950\",\n // Grows a touch while held, like the Slider thumb.\n \"after:transition-[scale] after:duration-(--duration-fast) after:ease-standard motion-reduce:after:transition-none\",\n \"in-data-dragging:after:scale-110\",\n \"data-disabled:hidden\",\n HANDLE[position],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperGridProps = Ark.GridProps & WithTestId\n\n/** A pair of rule-of-thirds lines, along `axis`. Fades in while the crop is dragged, resized or panned. */\nconst ImageCropperGrid = ({ className, testId, ...rest }: ImageCropperGridProps) => (\n <Ark.Grid\n className={cn(\n \"border-white/50 data-[axis=horizontal]:border-y data-[axis=vertical]:border-x\",\n \"opacity-0 data-dragging:opacity-100 data-panning:opacity-100\",\n \"transition-opacity duration-(--duration-fast) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperControlsProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Zoom slider, rotate ±90°, flip and reset, wired to the nearest cropper. Each\n * is a 44px button named from `translations`; the flips are toggle buttons.\n */\nconst ImageCropperControls = ({ className, testId, ...rest }: ImageCropperControlsProps) => {\n const api = useImageCropperContext()\n const { t, icons, percent, minZoom, maxZoom } = useContext(SharedContext)\n return (\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={t.controlsLabel}\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateLeftLabel}\n onClick={() => api.rotateBy(-90)}\n >\n {icons.rotateLeft}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateRightLabel}\n onClick={() => api.rotateBy(90)}\n >\n {icons.rotateRight}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipHorizontalLabel}\n aria-pressed={api.flip.horizontal}\n onClick={() => api.flipHorizontally()}\n >\n {icons.flipHorizontal}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipVerticalLabel}\n aria-pressed={api.flip.vertical}\n onClick={() => api.flipVertically()}\n >\n {icons.flipVertical}\n </ActionIcon>\n <div\n className={cn(\n \"flex min-w-40 flex-1 items-center gap-2 px-2\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n )}\n >\n <span aria-hidden className={zoomIcon}>\n {icons.zoomOut}\n </span>\n <Slider\n min={minZoom}\n max={maxZoom}\n step={0.01}\n value={api.zoom}\n onChange={(zoom) => api.setZoom(zoom)}\n aria-label={[t.zoomLabel]}\n getAriaValueText={({ value }) => t.zoomValue(percent(value))}\n classNames={{ field: \"flex-1\" }}\n />\n <span aria-hidden className={zoomIcon}>\n {icons.zoomIn}\n </span>\n </div>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.resetLabel}\n onClick={() => api.reset()}\n >\n {icons.reset}\n </ActionIcon>\n </div>\n )\n}\n\ntype CropExport = UseImageCropperContext[\"getCroppedImage\"]\n\n/** The size a `width × height` export should have at `aspect`: its short side stretched to match the long one. */\nconst exactSize = (width: number, height: number, aspect: number) =>\n width / height > aspect\n ? { width, height: Math.round(width / aspect) }\n : { width: Math.round(height * aspect), height }\n\n/**\n * Ark's export, held to a locked ratio. Ark sizes the canvas from the image's\n * rounded layout box, scaling each side on its own, so a 1:1 crop can come\n * out 511 × 512. When it does, the crop is exported again losslessly and\n * redrawn at the exact size, then encoded once as asked.\n */\nexport const exactExport =\n (getCroppedImage: CropExport, aspect: number | undefined): CropExport =>\n async (options) => {\n const blob = await getCroppedImage(options)\n if (aspect === undefined || !(blob instanceof Blob) || typeof createImageBitmap !== \"function\")\n return blob\n const shot = await createImageBitmap(blob)\n // Read the size before `close()`: a closed bitmap reports 0 × 0.\n const { width, height } = shot\n shot.close()\n const size = exactSize(width, height, aspect)\n if (size.width === width && size.height === height) return blob\n const lossless = await getCroppedImage({ ...options, type: \"image/png\" })\n if (!(lossless instanceof Blob)) return blob\n const source = await createImageBitmap(lossless)\n const canvas = document.createElement(\"canvas\")\n canvas.width = size.width\n canvas.height = size.height\n const context = canvas.getContext(\"2d\")\n if (!context) return blob\n context.drawImage(source, 0, 0, size.width, size.height)\n source.close()\n return new Promise<Blob | null>((resolve) =>\n canvas.toBlob(resolve, options?.type ?? \"image/png\", options?.quality ?? 1),\n )\n }\n\n/**\n * The nearest cropper's API: Ark's, with `getCroppedImage()` held to the\n * locked ratio (or the circle) to the pixel.\n */\nconst useImageCropperContext = (): UseImageCropperContext => {\n const api = useArkImageCropperContext()\n const { aspect } = useContext(SharedContext)\n return { ...api, getCroppedImage: exactExport(api.getCroppedImage, aspect) }\n}\n\nexport type ImageCropperContextProps = Ark.ContextProps\n\n/** Renders its child function with the cropper's API, for an export button. */\nconst ImageCropperContext = ({ children }: ImageCropperContextProps) =>\n children(useImageCropperContext())\n\n// ---------------------------------------------------------------------------\n// Convenience\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperClassNames = {\n viewport?: string\n image?: string\n selection?: string\n controls?: string\n}\n\nexport type ImageCropperProps = NoAsChild<\n Omit<ImageCropperRootProps, \"children\"> & {\n /** The image to crop: a URL, or a `Blob` / `File` (a pick or a drop). */\n src: string | Blob\n /** Needed on a cross-origin URL for the export to read its pixels. */\n crossOrigin?: ImageCropperImageProps[\"crossOrigin\"]\n /** The viewport's corner radius, from the media scale. */\n radius?: MediaRadius\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n /** The zoom slider and the rotate, flip and reset buttons, under the image. */\n withControls?: boolean\n classNames?: ImageCropperClassNames\n /** Rendered last, inside the root: an `ImageCropper.Context` for the export. */\n children?: ReactNode\n }\n>\n\nconst ImageCropperComponent = ({\n src,\n crossOrigin,\n radius,\n withGrid,\n withControls = false,\n classNames,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperProps) => (\n <ImageCropperRoot {...rest}>\n <ImageCropperViewport radius={radius} className={classNames?.viewport}>\n <ImageCropperImage src={src} crossOrigin={crossOrigin} className={classNames?.image} />\n <ImageCropperSelection withGrid={withGrid} className={classNames?.selection} />\n </ImageCropperViewport>\n {withControls && <ImageCropperControls className={classNames?.controls} />}\n {children}\n </ImageCropperRoot>\n)\n\nexport const ImageCropper = Object.assign(ImageCropperComponent, {\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n Controls: ImageCropperControls,\n Context: ImageCropperContext,\n})\n\nexport { useImageCropperContext }\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
// src/lib/cn.ts
|
|
5
|
+
var twMerge = extendTailwindMerge({
|
|
6
|
+
extend: {
|
|
7
|
+
classGroups: { "text-box-trim": ["text-trim"] },
|
|
8
|
+
theme: { radius: ["xxs", "button", "action-icon", "badge", "card", "input", "pill"] }
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function cn(...inputs) {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { cn };
|
|
16
|
+
//# sourceMappingURL=chunk-4ASNIDV7.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-4ASNIDV7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/cn.ts"],"names":[],"mappings":";;;;AA0BA,IAAM,UAAU,mBAAA,CAAqC;AAAA,EACnD,MAAA,EAAQ;AAAA,IACN,WAAA,EAAa,EAAE,eAAA,EAAiB,CAAC,WAAW,CAAA,EAAE;AAAA,IAC9C,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAC,KAAA,EAAO,QAAA,EAAU,aAAA,EAAe,OAAA,EAAS,MAAA,EAAQ,OAAA,EAAS,MAAM,CAAA;AAAE;AAExF,CAAC,CAAA;AAEM,SAAS,MAAM,MAAA,EAA8B;AAClD,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B","file":"chunk-4ASNIDV7.js","sourcesContent":["/**\n * The single class-merging utility for the entire UI kit.\n *\n * Combines:\n * - clsx — conditional class composition (objects, arrays, falsy filtering)\n * - tailwind-merge — last-wins conflict resolution for Tailwind utility classes\n *\n * Consumers should never reach for raw template literals or hand-rolled\n * concatenation; route every dynamic class through `cn` for predictable\n * override behavior.\n */\n\nimport { type ClassValue, clsx } from \"clsx\"\nimport { extendTailwindMerge } from \"tailwind-merge\"\n\n/**\n * The kit's own `@utility` classes (theme.css) are unknown to tailwind-merge,\n * which guesses from the prefix: `text-trim` reads as a text *color*, so it\n * and a real color class silently knocked each other out. Registering it as\n * its own group makes it conflict only with itself.\n *\n * The kit's `--radius-*` tokens beyond the t-shirt scale are unknown too, so\n * a component default like `rounded-card` survived a consumer's `rounded-2xl`\n * and the stylesheet's order picked the winner. Listing them in the radius\n * scale makes the consumer's class replace the default.\n */\nconst twMerge = extendTailwindMerge<\"text-box-trim\">({\n extend: {\n classGroups: { \"text-box-trim\": [\"text-trim\"] },\n theme: { radius: [\"xxs\", \"button\", \"action-icon\", \"badge\", \"card\", \"input\", \"pill\"] },\n },\n})\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs))\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { useLayerGuard, useNestedLayer, OverlayLayerProvider } from './chunk-H7W
|
|
|
3
3
|
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
4
4
|
import { props } from './chunk-WYCMIIRR.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 { Popover as Popover$1, usePopoverContext } from '@ark-ui/react/popover';
|
|
8
8
|
import { Portal } from '@ark-ui/react/portal';
|
|
9
9
|
import { cva } from 'class-variance-authority';
|
|
@@ -333,5 +333,5 @@ var Popover = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
export { Popover, popoverChevron, popoverChrome, popoverClearTrigger, popoverContent, popoverEmpty, popoverGroupLabel, popoverIndicator, popoverList, popoverOption, popoverPanel, scrollHighlightedIntoView };
|
|
336
|
-
//# sourceMappingURL=chunk-
|
|
337
|
-
//# sourceMappingURL=chunk-
|
|
336
|
+
//# sourceMappingURL=chunk-5HUEBSIS.js.map
|
|
337
|
+
//# sourceMappingURL=chunk-5HUEBSIS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/popover/popover.tsx"],"names":["ArkPopover"],"mappings":";;;;;;;;;;;;AAiDO,IAAM,aAAA,GAAgB,EAAA;AAAA,EAC3B,+DAAA;AAAA,EACA,qCAAA;AAAA,EACA,kBAAA;AAAA,EACA,8BAAA;AAAA,EACA,8EAAA;AAAA,EACA;AACF;AASO,IAAM,cAAA,GAAiB,EAAA,CAAG,aAAA,EAAe,sCAAsC;AAQ/E,IAAM,WAAA,GAAc,GAAA;AAAA,EACzB;AAAA,IACE,qCAAA;AAAA,IACA,oCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,cAAA,EAAgB;AAAA,QACd,IAAA,EAAM;AAAA;AACR;AACF;AAEJ;AAOO,IAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,CAAA,KAEM,YAAW,EAAG,cAAA,CAAe,EAAE,KAAA,EAAO,WAAW;AAOhD,IAAM,YAAA,GAAe,EAAA,CAAG,aAAA,EAAe,+BAA+B;AAItE,IAAM,eAAA,GAAkB,EAAA;AA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,QAAA,EAAU,UAAA,EAAY,SAAS,CAAA;AAAA,IAC5C,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AASF,IAAM,MAAA,GAAS,CAAC,EAAE,SAAA,EAAW,QAAQ,GAAG,IAAA,EAAK,qBAC3C,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,GAAG,QAAA,EAAU,SAAS,CAAA,EAAI,GAAG,KAAA,CAAM,EAAE,eAAe,MAAA,EAAQ,CAAA,EAAI,GAAG,IAAA,EAAM,CAAA;AAM3F,IAAM,OAAO,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBACzC,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,SAAA,EAAW,EAAA,CAAG,eAAA,EAAiB,QAAA,EAAU,SAAS,CAAA;AAAA,IACjD,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAKK,IAAM,OAAA,GAAU;AAAA,EACrB,IAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQA,SAAA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-ZN3WYGIQ.js","sourcesContent":["\"use client\"\n\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\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)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron = \"shrink-0 text-black/50 transition-transform dark:text-white/50\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-black/50 transition-colors hover:text-brand-900/70 dark:text-white/50 dark:hover:text-white/80\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel = cn(\n \"px-2 py-1.5 text-xs font-medium select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty = cn(\n \"px-2 py-6 text-center text-sm select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\ntype PopoverPosition = NonNullable<NonNullable<ArkPopover.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. */\n onPointerEnter: (event: PointerEvent) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so the close Ark answers it with becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = ArkPopover.RootProps &\n PopoverModeProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Panel placement relative to the trigger. Defaults to Ark's `\"bottom\"`. */\n position?: PopoverPosition\n /** Gap in px between the trigger and the panel. */\n gutter?: number\n /** Fine placement, in px: `mainAxis` is the gap from the trigger (it replaces `gutter` when\n * set), `crossAxis` slides the panel along the trigger's edge. Floating UI's `offset()`. */\n offset?:\n | {\n mainAxis?: number | undefined\n crossAxis?: number | undefined\n }\n | undefined\n /** Hide the panel (`visibility: hidden`, no pointer events) once the\n * trigger is fully clipped by its own scrolling ancestor, and restore it\n * once back in view — Floating UI's `hide()` middleware\n * (`strategy: \"referenceHidden\"`), already wired into Ark's positioning\n * engine, just not exposed until now. Rides the positioner's existing\n * scroll/resize listeners, so no extra observer is needed. Default `true`\n * — a panel that can't see its own trigger is never in a state worth\n * keeping visible; pass `false` to restore the old \"keep following the\n * trigger's last known position\" behavior. */\n hideWhenDetached?: boolean\n /** Ark's full positioning options (`flip`, `slide`, `overlap`, `boundary`,\n * `getAnchorElement`, …), for placements the props above can't express.\n * Applied over them, so a key set here wins. */\n positioning?: ArkPopover.RootProps[\"positioning\"]\n\n /** Render the panel 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) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\ntype UsePopoverHoverOptions = {\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n */\nconst usePopoverHover = ({\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return { open: isOpen, press: source === \"press\", hover, onArkOpenChange }\n}\n\nconst Root = ({\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached = true,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n return (\n <PopoverContext.Provider\n value={{ width, withinPortal, container, layers: guard.layers, hover }}\n >\n <ArkPopover.Root\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={{\n sameWidth: width === \"target\",\n placement: position,\n gutter,\n offset,\n hideWhenDetached,\n ...positioning,\n }}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n {...state}\n {...rest}\n >\n {children}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps & WithTestId\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n testId,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> & WithTestId\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. Unlike `Header`, it draws no divider: a footer of\n * actions (Apply / Cancel, a time row) reads as part of the panel, the way `Modal` and\n * `Drawer` footers do. `slotEdge` still sets the hairline colour, so a consumer who wants\n * one adds only `className=\"border-t\"`. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/popover/popover.tsx"],"names":["ArkPopover"],"mappings":";;;;;;;;;;;;AAiDO,IAAM,aAAA,GAAgB,EAAA;AAAA,EAC3B,+DAAA;AAAA,EACA,qCAAA;AAAA,EACA,kBAAA;AAAA,EACA,8BAAA;AAAA,EACA,8EAAA;AAAA,EACA;AACF;AASO,IAAM,cAAA,GAAiB,EAAA,CAAG,aAAA,EAAe,sCAAsC;AAQ/E,IAAM,WAAA,GAAc,GAAA;AAAA,EACzB;AAAA,IACE,qCAAA;AAAA,IACA,oCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,cAAA,EAAgB;AAAA,QACd,IAAA,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A,EAAkB,QAAA,EAAA,KAAA,EAAM,CAAA;AACpD,CAAA;AAEA,IAAM,QAAA,GAAW,+DAAA;AAKjB,IAAM,SAAS,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBAC3C,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,SAAA,EAAW,EAAA,CAAG,QAAA,EAAU,UAAA,EAAY,SAAS,CAAA;AAAA,IAC5C,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AASF,IAAM,MAAA,GAAS,CAAC,EAAE,SAAA,EAAW,QAAQ,GAAG,IAAA,EAAK,qBAC3C,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,GAAG,QAAA,EAAU,SAAS,CAAA,EAAI,GAAG,KAAA,CAAM,EAAE,eAAe,MAAA,EAAQ,CAAA,EAAI,GAAG,IAAA,EAAM,CAAA;AAM3F,IAAM,OAAO,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBACzC,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,SAAA,EAAW,EAAA,CAAG,eAAA,EAAiB,QAAA,EAAU,SAAS,CAAA;AAAA,IACjD,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAKK,IAAM,OAAA,GAAU;AAAA,EACrB,IAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQA,SAAA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-5HUEBSIS.js","sourcesContent":["\"use client\"\n\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\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)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron = \"shrink-0 text-black/50 transition-transform dark:text-white/50\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-black/50 transition-colors hover:text-brand-900/70 dark:text-white/50 dark:hover:text-white/80\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel = cn(\n \"px-2 py-1.5 text-xs font-medium select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty = cn(\n \"px-2 py-6 text-center text-sm select-none\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\ntype PopoverPosition = NonNullable<NonNullable<ArkPopover.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. */\n onPointerEnter: (event: PointerEvent) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so the close Ark answers it with becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = ArkPopover.RootProps &\n PopoverModeProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Panel placement relative to the trigger. Defaults to Ark's `\"bottom\"`. */\n position?: PopoverPosition\n /** Gap in px between the trigger and the panel. */\n gutter?: number\n /** Fine placement, in px: `mainAxis` is the gap from the trigger (it replaces `gutter` when\n * set), `crossAxis` slides the panel along the trigger's edge. Floating UI's `offset()`. */\n offset?:\n | {\n mainAxis?: number | undefined\n crossAxis?: number | undefined\n }\n | undefined\n /** Hide the panel (`visibility: hidden`, no pointer events) once the\n * trigger is fully clipped by its own scrolling ancestor, and restore it\n * once back in view — Floating UI's `hide()` middleware\n * (`strategy: \"referenceHidden\"`), already wired into Ark's positioning\n * engine, just not exposed until now. Rides the positioner's existing\n * scroll/resize listeners, so no extra observer is needed. Default `true`\n * — a panel that can't see its own trigger is never in a state worth\n * keeping visible; pass `false` to restore the old \"keep following the\n * trigger's last known position\" behavior. */\n hideWhenDetached?: boolean\n /** Ark's full positioning options (`flip`, `slide`, `overlap`, `boundary`,\n * `getAnchorElement`, …), for placements the props above can't express.\n * Applied over them, so a key set here wins. */\n positioning?: ArkPopover.RootProps[\"positioning\"]\n\n /** Render the panel 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) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\ntype UsePopoverHoverOptions = {\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n */\nconst usePopoverHover = ({\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return { open: isOpen, press: source === \"press\", hover, onArkOpenChange }\n}\n\nconst Root = ({\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached = true,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n return (\n <PopoverContext.Provider\n value={{ width, withinPortal, container, layers: guard.layers, hover }}\n >\n <ArkPopover.Root\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={{\n sameWidth: width === \"target\",\n placement: position,\n gutter,\n offset,\n hideWhenDetached,\n ...positioning,\n }}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n {...state}\n {...rest}\n >\n {children}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps & WithTestId\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n testId,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> & WithTestId\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. Unlike `Header`, it draws no divider: a footer of\n * actions (Apply / Cancel, a time row) reads as part of the panel, the way `Modal` and\n * `Drawer` footers do. `slotEdge` still sets the hairline colour, so a consumer who wants\n * one adds only `className=\"border-t\"`. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { iconStroke } from './chunk-XXOR34T4.js';
|
|
2
2
|
import { composeChildren } from './chunk-R5LYFTHA.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 { ark } from '@ark-ui/react';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import { createContext, useContext } from 'react';
|
|
@@ -158,5 +158,5 @@ var PillGroup = ({
|
|
|
158
158
|
) });
|
|
159
159
|
|
|
160
160
|
export { Pill, PillGroup, PillGroupContext, pill, pillRemove };
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-6M6YZ3PQ.js.map
|
|
162
|
+
//# sourceMappingURL=chunk-6M6YZ3PQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/pill/pill.tsx"],"names":[],"mappings":";;;;;;;;;;;AAiCO,IAAM,gBAAA,GAAmB,cAA4C,IAAI;AAGzE,IAAM,IAAA,GAAO,GAAA;AAAA,EAClB;AAAA,IACE,qCAAA;AAAA,IACA,4CAAA;AAAA,IACA,0BAAA;AAAA;AAAA,IAEA,EAAA,CAAG,6BAAA,EAA+B,kBAAA,CAAmB,OAAO,CAAA;AAAA,IAC5D,4CAAA;AAAA,IACA,wDAAA;AAAA,IACA,2DAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,gBAAA,EAAkB;AAAA,QAChB,EAAA,EAAI,eAAA;AAAA,QACJ,EAAA,EAAI,cAAA;AAAA,QACJ,EAAA,EAAI,aAAA;AAAA,QACJ,EAAA,EAAI,cAAA;AAAA,QACJ,EAAA,EAAI;AAAA,OACN;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,uCAAA;AAAA,QACJ,EAAA,EAAI,wBAAA;AAAA,QACJ,EAAA,EAAI,0BAAA;AAAA,QACJ,EAAA,EAAI,0BAAA;AAAA,QAC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EAAW,GAAG,UAAA,CAAW,EAAE,MAAM,CAAA,EAAG,YAAY,MAAM,CAAA;AAAA,YACrD,GAAG,MAAM,EAAE,aAAA,EAAe,UAAU,CAAA,EAAG,MAAM,WAAW,CAAA;AAAA,YAEzD,8BAAC,UAAA,EAAA,EAAW;AAAA;AAAA;AACd,OAAA,EAEJ,CACD;AAAA;AAAA,GACH;AAEJ;AAEA,IAAM,cAAA,GAA2C;AAAA,EAC/C,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAUO,IAAM,YAAY,CAAC;AAAA,EACxB,IAAA,GAAO,IAAA;AAAA,EACP,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA,CAAC,iBAAiB,QAAA,EAAjB,EAA0B,OAAO,EAAE,IAAA,EAAM,UAAS,EACjD,QAAA,kBAAA,GAAA;AAAA,EAAC,GAAA,CAAI,GAAA;AAAA,EAAJ;AAAA,IACE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IACnC,SAAA,EAAW,EAAA;AAAA,MACT,+CAAA;AAAA,MACA,eAAe,IAAI,CAAA;AAAA,MACnB;AAAA,KACF;AAAA,IACC,GAAG,IAAA;AAAA,IAEH;AAAA;AACH,CAAA,EACF","file":"chunk-2TM7UVM2.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, useContext } from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { iconStroke } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { RequiredIfTrue } from \"../../lib/required-if\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Pill — compact, optionally removable chip. The visual the form family renders\n * selected values into (MultiSelect / TagsInput), and a standalone tag/token\n * elsewhere.\n *\n * - Neutral gray by default; pass a `color` to tint it with the palette's\n * soft surface + text slots (`--c-soft` / `--c-text`) via `data-color`.\n * - `withRemoveButton` renders a trailing `×` button that fires `onRemove`.\n * - `size` (and `disabled`) can be set per-pill or inherited once from a\n * wrapping `PillGroup` through context — explicit props win.\n *\n * `asChild` (from the `ark.span` factory) renders the pill as the consumer's\n * element, a link for a clickable tag, with the label (and remove button)\n * folded inside it.\n */\n\ntype PillGroupContextValue = { size?: PillSize; disabled?: boolean }\n/** Exported so `PillsInput` can size/disable the pills it hosts (same as a group). */\nexport const PillGroupContext = createContext<PillGroupContextValue | null>(null)\n\n/** Exported so TagsInput can style its Ark tag preview to look like a Pill. */\nexport const pill = cva(\n [\n \"inline-flex items-center max-w-full\",\n \"whitespace-nowrap select-none align-middle\",\n \"rounded-pill font-medium\",\n // Neutral default; a `data-color` tint overrides it (higher specificity).\n cn(\"bg-black/8 dark:bg-white/16\", TEXT_COLOR_CLASSES.primary),\n \"border border-black/8 dark:border-white/15\",\n \"data-color:bg-(--c-soft)/35 data-color:text-(--c-text)\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n ],\n {\n variants: {\n withRemoveButton: {\n xs: \"pe-[0.125rem]\",\n sm: \"pe-[0.15rem]\",\n md: \"pe-[0.2rem]\",\n lg: \"pe-[0.25rem]\",\n xl: \"pe-[0.3rem]\",\n },\n size: {\n xs: \"h-4.5 px-1.5 text-[0.6875rem] gap-0.5\",\n sm: \"h-5 px-2 text-xs gap-1\",\n md: \"h-5.5 px-2 text-xs gap-1\",\n lg: \"h-6 px-2.5 text-sm gap-1\",\n xl: \"h-7 px-3 text-sm gap-1.5\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/**\n * The label: `text-trim`'d so its box hugs cap height → baseline and the\n * pill's `items-center` centres the caps optically. That trimmed box ends at\n * the baseline, so it must not clip vertically: `truncate`'s `overflow: hidden`\n * cut every descender (g, p, y, q) and anything above the cap line (É).\n * `overflow-x: clip` clips the inline axis only — enough for the ellipsis —\n * and, unlike `hidden`, leaves `overflow-y` visible instead of forcing it to\n * `auto`. Not being a scroll container, it no longer zeroes a flex item's\n * automatic minimum width, hence the explicit `min-w-0` that lets it shrink.\n */\nconst pillLabel = \"min-w-0 overflow-x-clip text-ellipsis whitespace-nowrap text-trim\"\n\n/** Exported alongside `pill` for TagsInput's delete trigger. */\nexport const pillRemove = cva(\n [\n \"inline-flex items-center justify-center shrink-0 rounded-full\",\n \"text-current/70 hover:text-current\",\n \"transition-colors hover:bg-black/10 dark:hover:bg-white/10\",\n focusStyles({ ring: \"palette\", offset: false }),\n \"disabled:pointer-events-none\",\n \"cursor-pointer\",\n ],\n {\n variants: {\n size: {\n xs: \"size-3\",\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-4.5\",\n xl: \"size-5\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nexport type PillSize = NonNullable<VariantProps<typeof pill>[\"size\"]>\n\nconst RemoveIcon = () => (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n className={iconStroke}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n)\n\ntype PillClassNames = {\n root?: string\n label?: string\n remove?: string\n}\n\nexport type PillProps<WithRemoveButton extends boolean = false> = Omit<\n HTMLArkProps<\"span\">,\n \"color\"\n> &\n WithTestId & {\n size?: PillSize\n /** Accent palette — tints the chip with the soft surface. Neutral when unset. */\n color?: Color\n /**\n * Render a trailing remove (`×`) button that fires `onRemove`. Passing a\n * literal `true` (or otherwise call-site-resolvable value) makes\n * `onRemove` a **compile error** to omit — see `lib/required-if.ts`. A\n * non-literal `withRemoveButton` (a plain `boolean` variable) can't be\n * resolved to a specific value at compile time, so it conservatively\n * requires `onRemove` too, rather than silently allowing its absence.\n */\n withRemoveButton?: WithRemoveButton\n /** Accessible label for the remove button. Defaults to `` `Remove ${children}` `` when\n * `children` is a plain string (so each pill's × is told apart), else `\"Remove\"`. */\n removeLabel?: string\n disabled?: boolean\n classNames?: PillClassNames\n } & RequiredIfTrue<WithRemoveButton, { onRemove: () => void }>\n\nexport function Pill<const WithRemoveButton extends boolean = false>({\n size: sizeProp,\n color,\n withRemoveButton,\n onRemove,\n removeLabel,\n disabled: disabledProp,\n children,\n className,\n classNames,\n testId,\n asChild,\n ...rest\n}: PillProps<WithRemoveButton>) {\n const group = useContext(PillGroupContext)\n const size = sizeProp ?? group?.size ?? \"md\"\n const disabled = disabledProp ?? group?.disabled\n\n return (\n <ark.span\n asChild={asChild}\n data-color={color}\n className={cn(\n pill({ size, withRemoveButton: withRemoveButton ? size : undefined }),\n className,\n classNames?.root,\n )}\n {...props({ \"data-disabled\": disabled, \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n <span className={cn(pillLabel, classNames?.label)}>{own}</span>\n {withRemoveButton && (\n <button\n type=\"button\"\n aria-label={\n removeLabel ?? (typeof children === \"string\" ? `Remove ${children}` : \"Remove\")\n }\n disabled={disabled}\n // Keep focus on the host input (e.g. inside a PillsInput) and stop\n // the click from bubbling to an enclosing option / control.\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.stopPropagation()\n onRemove?.()\n }}\n className={cn(pillRemove({ size }), classNames?.remove)}\n {...props({ \"data-testid\": testId && `${testId}-remove` })}\n >\n <RemoveIcon />\n </button>\n )}\n </>\n ))}\n </ark.span>\n )\n}\n\nconst PILL_GROUP_GAP: Record<PillSize, string> = {\n xs: \"gap-1\",\n sm: \"gap-1\",\n md: \"gap-1\",\n lg: \"gap-1.5\",\n xl: \"gap-1.5\",\n}\n\nexport type PillGroupProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Shared size for child pills (each pill can still override). */\n size?: PillSize\n /** Disable every pill in the group. */\n disabled?: boolean\n }\n\nexport const PillGroup = ({\n size = \"md\",\n disabled,\n className,\n children,\n testId,\n ...rest\n}: PillGroupProps) => (\n <PillGroupContext.Provider value={{ size, disabled }}>\n <ark.div\n {...props({ \"data-testid\": testId })}\n className={cn(\n \"inline-flex max-w-full flex-wrap items-center\",\n PILL_GROUP_GAP[size],\n className,\n )}\n {...rest}\n >\n {children}\n </ark.div>\n </PillGroupContext.Provider>\n)\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/pill/pill.tsx"],"names":[],"mappings":";;;;;;;;;;;AAiCO,IAAM,gBAAA,GAAmB,cAA4C,IAAI;AAGzE,IAAM,IAAA,GAAO,GAAA;AAAA,EAClB;AAAA,IACE,qCAAA;AAAA,IACA,4CAAA;AAAA,IACA,0BAAA;AAAA;AAAA,IAEA,EAAA,CAAG,6BAAA,EAA+B,kBAAA,CAAmB,OAAO,CAAA;AAAA,IAC5D,4CAAA;AAAA,IACA,wDAAA;AAAA,IACA,2DAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,gBAAA,EAAkB;AAAA,QAChB,EAAA,EAAI,eAAA;AAAA,QACJ,EAAA,EAAI,cAAA;AAAA,QACJ,EAAA,EAAI,aAAA;AAAA,QACJ,EAAA,EAAI,cAAA;AAAA,QACJ,EAAA,EAAI;AAAA,OACN;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,uCAAA;AAAA,QACJ,EAAA,EAAI,wBAAA;AAAA,QACJ,EAAA,EAAI,0BAAA;AAAA,QACJ,EAAA,EAAI,0BAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,IAAA,E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AA,YACrD,GAAG,MAAM,EAAE,aAAA,EAAe,UAAU,CAAA,EAAG,MAAM,WAAW,CAAA;AAAA,YAEzD,8BAAC,UAAA,EAAA,EAAW;AAAA;AAAA;AACd,OAAA,EAEJ,CACD;AAAA;AAAA,GACH;AAEJ;AAEA,IAAM,cAAA,GAA2C;AAAA,EAC/C,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAUO,IAAM,YAAY,CAAC;AAAA,EACxB,IAAA,GAAO,IAAA;AAAA,EACP,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA,CAAC,iBAAiB,QAAA,EAAjB,EAA0B,OAAO,EAAE,IAAA,EAAM,UAAS,EACjD,QAAA,kBAAA,GAAA;AAAA,EAAC,GAAA,CAAI,GAAA;AAAA,EAAJ;AAAA,IACE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IACnC,SAAA,EAAW,EAAA;AAAA,MACT,+CAAA;AAAA,MACA,eAAe,IAAI,CAAA;AAAA,MACnB;AAAA,KACF;AAAA,IACC,GAAG,IAAA;AAAA,IAEH;AAAA;AACH,CAAA,EACF","file":"chunk-6M6YZ3PQ.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, useContext } from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { iconStroke } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { RequiredIfTrue } from \"../../lib/required-if\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Pill — compact, optionally removable chip. The visual the form family renders\n * selected values into (MultiSelect / TagsInput), and a standalone tag/token\n * elsewhere.\n *\n * - Neutral gray by default; pass a `color` to tint it with the palette's\n * soft surface + text slots (`--c-soft` / `--c-text`) via `data-color`.\n * - `withRemoveButton` renders a trailing `×` button that fires `onRemove`.\n * - `size` (and `disabled`) can be set per-pill or inherited once from a\n * wrapping `PillGroup` through context — explicit props win.\n *\n * `asChild` (from the `ark.span` factory) renders the pill as the consumer's\n * element, a link for a clickable tag, with the label (and remove button)\n * folded inside it.\n */\n\ntype PillGroupContextValue = { size?: PillSize; disabled?: boolean }\n/** Exported so `PillsInput` can size/disable the pills it hosts (same as a group). */\nexport const PillGroupContext = createContext<PillGroupContextValue | null>(null)\n\n/** Exported so TagsInput can style its Ark tag preview to look like a Pill. */\nexport const pill = cva(\n [\n \"inline-flex items-center max-w-full\",\n \"whitespace-nowrap select-none align-middle\",\n \"rounded-pill font-medium\",\n // Neutral default; a `data-color` tint overrides it (higher specificity).\n cn(\"bg-black/8 dark:bg-white/16\", TEXT_COLOR_CLASSES.primary),\n \"border border-black/8 dark:border-white/15\",\n \"data-color:bg-(--c-soft)/35 data-color:text-(--c-text)\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n ],\n {\n variants: {\n withRemoveButton: {\n xs: \"pe-[0.125rem]\",\n sm: \"pe-[0.15rem]\",\n md: \"pe-[0.2rem]\",\n lg: \"pe-[0.25rem]\",\n xl: \"pe-[0.3rem]\",\n },\n size: {\n xs: \"h-4.5 px-1.5 text-[0.6875rem] gap-0.5\",\n sm: \"h-5 px-2 text-xs gap-1\",\n md: \"h-5.5 px-2 text-xs gap-1\",\n lg: \"h-6 px-2.5 text-sm gap-1\",\n xl: \"h-7 px-3 text-sm gap-1.5\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/**\n * The label: `text-trim`'d so its box hugs cap height → baseline and the\n * pill's `items-center` centres the caps optically. That trimmed box ends at\n * the baseline, so it must not clip vertically: `truncate`'s `overflow: hidden`\n * cut every descender (g, p, y, q) and anything above the cap line (É).\n * `overflow-x: clip` clips the inline axis only — enough for the ellipsis —\n * and, unlike `hidden`, leaves `overflow-y` visible instead of forcing it to\n * `auto`. Not being a scroll container, it no longer zeroes a flex item's\n * automatic minimum width, hence the explicit `min-w-0` that lets it shrink.\n */\nconst pillLabel = \"min-w-0 overflow-x-clip text-ellipsis whitespace-nowrap text-trim\"\n\n/** Exported alongside `pill` for TagsInput's delete trigger. */\nexport const pillRemove = cva(\n [\n \"inline-flex items-center justify-center shrink-0 rounded-full\",\n \"text-current/70 hover:text-current\",\n \"transition-colors hover:bg-black/10 dark:hover:bg-white/10\",\n focusStyles({ ring: \"palette\", offset: false }),\n \"disabled:pointer-events-none\",\n \"cursor-pointer\",\n ],\n {\n variants: {\n size: {\n xs: \"size-3\",\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-4.5\",\n xl: \"size-5\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nexport type PillSize = NonNullable<VariantProps<typeof pill>[\"size\"]>\n\nconst RemoveIcon = () => (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n className={iconStroke}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n)\n\ntype PillClassNames = {\n root?: string\n label?: string\n remove?: string\n}\n\nexport type PillProps<WithRemoveButton extends boolean = false> = Omit<\n HTMLArkProps<\"span\">,\n \"color\"\n> &\n WithTestId & {\n size?: PillSize\n /** Accent palette — tints the chip with the soft surface. Neutral when unset. */\n color?: Color\n /**\n * Render a trailing remove (`×`) button that fires `onRemove`. Passing a\n * literal `true` (or otherwise call-site-resolvable value) makes\n * `onRemove` a **compile error** to omit — see `lib/required-if.ts`. A\n * non-literal `withRemoveButton` (a plain `boolean` variable) can't be\n * resolved to a specific value at compile time, so it conservatively\n * requires `onRemove` too, rather than silently allowing its absence.\n */\n withRemoveButton?: WithRemoveButton\n /** Accessible label for the remove button. Defaults to `` `Remove ${children}` `` when\n * `children` is a plain string (so each pill's × is told apart), else `\"Remove\"`. */\n removeLabel?: string\n disabled?: boolean\n classNames?: PillClassNames\n } & RequiredIfTrue<WithRemoveButton, { onRemove: () => void }>\n\nexport function Pill<const WithRemoveButton extends boolean = false>({\n size: sizeProp,\n color,\n withRemoveButton,\n onRemove,\n removeLabel,\n disabled: disabledProp,\n children,\n className,\n classNames,\n testId,\n asChild,\n ...rest\n}: PillProps<WithRemoveButton>) {\n const group = useContext(PillGroupContext)\n const size = sizeProp ?? group?.size ?? \"md\"\n const disabled = disabledProp ?? group?.disabled\n\n return (\n <ark.span\n asChild={asChild}\n data-color={color}\n className={cn(\n pill({ size, withRemoveButton: withRemoveButton ? size : undefined }),\n className,\n classNames?.root,\n )}\n {...props({ \"data-disabled\": disabled, \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n <span className={cn(pillLabel, classNames?.label)}>{own}</span>\n {withRemoveButton && (\n <button\n type=\"button\"\n aria-label={\n removeLabel ?? (typeof children === \"string\" ? `Remove ${children}` : \"Remove\")\n }\n disabled={disabled}\n // Keep focus on the host input (e.g. inside a PillsInput) and stop\n // the click from bubbling to an enclosing option / control.\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.stopPropagation()\n onRemove?.()\n }}\n className={cn(pillRemove({ size }), classNames?.remove)}\n {...props({ \"data-testid\": testId && `${testId}-remove` })}\n >\n <RemoveIcon />\n </button>\n )}\n </>\n ))}\n </ark.span>\n )\n}\n\nconst PILL_GROUP_GAP: Record<PillSize, string> = {\n xs: \"gap-1\",\n sm: \"gap-1\",\n md: \"gap-1\",\n lg: \"gap-1.5\",\n xl: \"gap-1.5\",\n}\n\nexport type PillGroupProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Shared size for child pills (each pill can still override). */\n size?: PillSize\n /** Disable every pill in the group. */\n disabled?: boolean\n }\n\nexport const PillGroup = ({\n size = \"md\",\n disabled,\n className,\n children,\n testId,\n ...rest\n}: PillGroupProps) => (\n <PillGroupContext.Provider value={{ size, disabled }}>\n <ark.div\n {...props({ \"data-testid\": testId })}\n className={cn(\n \"inline-flex max-w-full flex-wrap items-center\",\n PILL_GROUP_GAP[size],\n className,\n )}\n {...rest}\n >\n {children}\n </ark.div>\n </PillGroupContext.Provider>\n)\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { controlIndicator } from './chunk-
|
|
2
|
-
import { requiredMark, fieldLabel, FieldShell, fieldRoot, fieldA11yProps } from './chunk-
|
|
3
|
-
import { CheckIcon } from './chunk-
|
|
1
|
+
import { controlIndicator } from './chunk-NLOBBJAA.js';
|
|
2
|
+
import { requiredMark, fieldLabel, FieldShell, fieldRoot, fieldA11yProps } from './chunk-VD6PB3VA.js';
|
|
3
|
+
import { CheckIcon } from './chunk-6YNLRQ25.js';
|
|
4
4
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
5
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
6
|
-
import { cn } from './chunk-
|
|
6
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
7
7
|
import { Checkbox as Checkbox$1 } from '@ark-ui/react/checkbox';
|
|
8
8
|
import { useFieldContext } from '@ark-ui/react/field';
|
|
9
9
|
import { Minus } from 'lucide-react';
|
|
@@ -101,5 +101,5 @@ var Checkbox = ({
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
export { Checkbox };
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-6VYGK3Q3.js.map
|
|
105
|
+
//# sourceMappingURL=chunk-6VYGK3Q3.js.map
|
|
@@ -1 +1 @@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AE,gBAAM,aAAA,EAAc;AAAA,SAAA,EACpD,CAAA;AAAA,QAEC,QAAA,mBACC,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,SAAA,CAAU,EAAE,IAAA,EAAM,CAAA,EAAG,UAAA,EAAY,KAAK,CAAA,EACtD,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,0BACD,GAAA,CAAC,cAAW,WAAA,EAA0B,KAAA,EAAc,MAClD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB,CAAA,EACjD;AAAA,SAAA,EACF,oBAEA,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,0BACD,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,WAAA;AAAA,cACA,KAAA;AAAA,cACA,IAAA;AAAA,cACA,WAAW,UAAA,EAAY,KAAA;AAAA,cAEvB,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB;AAAA;AAAA;AACjD,SAAA,EACF;AAAA;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-4BGU2UQB.js","sourcesContent":["\"use client\"\n\nimport { Checkbox as Ark } from \"@ark-ui/react/checkbox\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Minus } from \"lucide-react\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { FieldShell, fieldA11yProps, fieldLabel, fieldRoot, requiredMark } from \"../field/field\"\nimport { CheckIcon } from \"../popover/icons\"\nimport { type ControlIndicatorVariant, controlIndicator } from \"./control\"\n\n/**\n * Checkbox — a single boolean (or tri-state) control on Ark UI's Checkbox\n * machine. The label sits inline beside the box, rendered through the\n * checkbox's own `Ark.Label` part (not `Field`'s) so it stays correctly\n * wired to the hidden input's `aria-labelledby` and — critically — carries no\n * layout footprint when it's visually hidden (e.g. `classNames.label:\n * \"sr-only\"`): an absolutely-positioned flex child isn't a flex item at all,\n * so it can't pick up the root's `gap-2`. `description` / `error` live below\n * it via the shared `Field` scaffold, so a `Checkbox` is accessible and\n * complete on its own. Implements the kit's `FormControlProps` contract: the\n * `ref` and `onBlur` land on the submittable hidden `<input>`, and `name`\n * wires it into native form submission.\n *\n * - The checked state is `boolean | \"indeterminate\"`; `onCheckedChange`\n * hands you that next value directly (the indeterminate state never sets\n * itself — drive it from the parent, e.g. a \"select all\" header).\n * - `invalid` is OR'd with `error != null`, matching the rest of the family,\n * so a form library can flip the red state independently of the message.\n *\n * Two `variant`s decide the checked fill: `default` is a neutral, monochrome\n * box (palette-independent), while `filled` tints the checked fill with the\n * active palette via `data-color` + the `--c-solid` slot var. The box is\n * palette-independent at rest, and the focus ring is always the brand ring.\n */\n\nexport type CheckboxIconSlot = \"check\" | \"indeterminate\"\nexport type CheckboxIcons = IconMap<CheckboxIconSlot>\n\n/** The default marks: a check, and a dash for the indeterminate state. */\nexport const DEFAULT_ICONS: Record<CheckboxIconSlot, ReactNode> = {\n check: <CheckIcon />,\n indeterminate: <Minus className={iconStroke} />,\n}\n\nexport type CheckboxProps = WithTestId & {\n /** Controlled checked state. `\"indeterminate\"` renders the partial mark. */\n checked?: boolean | \"indeterminate\"\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean | \"indeterminate\"\n /** Fires with the next checked state (a value, not a DOM event). */\n onCheckedChange?: (checked: boolean | \"indeterminate\") => void\n /** Inline label beside the box. */\n label?: ReactNode\n /** Helper text above the control. */\n description?: ReactNode\n /** Error message below the control; its presence sets the invalid state. */\n error?: ReactNode\n /** Required flag (and, with a label, the red asterisk). */\n required?: boolean\n /** Red invalid state, OR'd with `error != null`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n size?: Size\n /** Checked-fill treatment: `default` (monochrome) or `filled` (palette-colored). */\n variant?: ControlIndicatorVariant\n color?: Color\n /** Field name for native form submission. */\n name?: string\n /** Submitted value when checked (defaults to `\"on\"`). */\n value?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the hidden `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the hidden `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Replaces the marks: `check` and `indeterminate`. A missing key keeps its default. */\n icons?: CheckboxIcons\n className?: string\n classNames?: {\n root?: string\n control?: string\n label?: string\n field?: string\n }\n}\n\n/**\n * The real, submittable hidden `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `Checkbox` itself renders that shell, so calling `useFieldContext()`\n * at its own top level would run too early. Same pattern as `Switch`: `fieldA11yProps` points\n * `aria-describedby` at the error once invalid (Ark's own tracking doesn't reliably catch up) and\n * adds `aria-errormessage`. Its `aria-labelledby` is left out: this `Field` never renders a label\n * (the checkbox's own `Ark.Label` names the input), so it would point at nothing.\n */\nconst CheckboxHiddenInput = ({ ref, onBlur }: Pick<CheckboxProps, \"ref\" | \"onBlur\">) => {\n const { \"aria-labelledby\": _unrendered, ...described } = fieldA11yProps(useFieldContext())\n return <Ark.HiddenInput ref={ref} onBlur={onBlur} {...described} />\n}\n\nexport const Checkbox = ({\n checked,\n defaultChecked,\n onCheckedChange,\n label,\n description,\n error,\n required,\n invalid,\n disabled,\n readOnly,\n size = \"md\",\n variant,\n color,\n name,\n value,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n icons: iconsProp,\n}: CheckboxProps) => {\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\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\n // A visible label above description/error needs the two grouped into one\n // flex-col item, or they'd land side by side in the root's row instead of\n // stacked. Label-only (incl. sr-only) never needs this extra wrapper.\n const hasStack = label != null && (description != null || error != null)\n\n const labelNode = label != null && (\n <Ark.Label\n className={cn(fieldLabel({ size }), !hasStack && \"min-w-0 flex-1\", classNames?.label)}\n >\n {label}\n {required && (\n <span aria-hidden=\"true\" {...requiredMark}>\n *\n </span>\n )}\n </Ark.Label>\n )\n\n return (\n <Ark.Root\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={onCheckedChange ? (d) => onCheckedChange(d.checked) : undefined}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n value={value}\n id={id}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\n \"relative inline-flex items-center gap-2 select-none\",\n className,\n classNames?.root,\n )}\n >\n <Ark.Control className={cn(controlIndicator({ size, variant }), classNames?.control)}>\n <Ark.Indicator>{icons.check}</Ark.Indicator>\n <Ark.Indicator indeterminate>{icons.indeterminate}</Ark.Indicator>\n </Ark.Control>\n\n {hasStack ? (\n <div className={cn(fieldRoot({ size }), classNames?.field)}>\n {labelNode}\n <FieldShell description={description} error={error} size={size}>\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </div>\n ) : (\n <>\n {labelNode}\n <FieldShell\n description={description}\n error={error}\n size={size}\n className={classNames?.field}\n >\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </>\n )}\n </Ark.Root>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/checkbox/checkbox.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;AA6CO,IAAM,aAAA,GAAqD;AAAA,EAChE,KAAA,sBAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,EAClB,aAAA,kBAAe,GAAA,CAAC,KAAA,EAAA,EAAM,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UAAA,SAAA;AAAA,0BACD,GAAA,CAAC,cAAW,WAAA,EAA0B,KAAA,EAAc,MAClD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB,CAAA,EACjD;AAAA,SAAA,EACF,oBAEA,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,0BACD,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,WAAA;AAAA,cACA,KAAA;AAAA,cACA,IAAA;AAAA,cACA,WAAW,UAAA,EAAY,KAAA;AAAA,cAEvB,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB;AAAA;AAAA;AACjD,SAAA,EACF;AAAA;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-6VYGK3Q3.js","sourcesContent":["\"use client\"\n\nimport { Checkbox as Ark } from \"@ark-ui/react/checkbox\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Minus } from \"lucide-react\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { FieldShell, fieldA11yProps, fieldLabel, fieldRoot, requiredMark } from \"../field/field\"\nimport { CheckIcon } from \"../popover/icons\"\nimport { type ControlIndicatorVariant, controlIndicator } from \"./control\"\n\n/**\n * Checkbox — a single boolean (or tri-state) control on Ark UI's Checkbox\n * machine. The label sits inline beside the box, rendered through the\n * checkbox's own `Ark.Label` part (not `Field`'s) so it stays correctly\n * wired to the hidden input's `aria-labelledby` and — critically — carries no\n * layout footprint when it's visually hidden (e.g. `classNames.label:\n * \"sr-only\"`): an absolutely-positioned flex child isn't a flex item at all,\n * so it can't pick up the root's `gap-2`. `description` / `error` live below\n * it via the shared `Field` scaffold, so a `Checkbox` is accessible and\n * complete on its own. Implements the kit's `FormControlProps` contract: the\n * `ref` and `onBlur` land on the submittable hidden `<input>`, and `name`\n * wires it into native form submission.\n *\n * - The checked state is `boolean | \"indeterminate\"`; `onCheckedChange`\n * hands you that next value directly (the indeterminate state never sets\n * itself — drive it from the parent, e.g. a \"select all\" header).\n * - `invalid` is OR'd with `error != null`, matching the rest of the family,\n * so a form library can flip the red state independently of the message.\n *\n * Two `variant`s decide the checked fill: `default` is a neutral, monochrome\n * box (palette-independent), while `filled` tints the checked fill with the\n * active palette via `data-color` + the `--c-solid` slot var. The box is\n * palette-independent at rest, and the focus ring is always the brand ring.\n */\n\nexport type CheckboxIconSlot = \"check\" | \"indeterminate\"\nexport type CheckboxIcons = IconMap<CheckboxIconSlot>\n\n/** The default marks: a check, and a dash for the indeterminate state. */\nexport const DEFAULT_ICONS: Record<CheckboxIconSlot, ReactNode> = {\n check: <CheckIcon />,\n indeterminate: <Minus className={iconStroke} />,\n}\n\nexport type CheckboxProps = WithTestId & {\n /** Controlled checked state. `\"indeterminate\"` renders the partial mark. */\n checked?: boolean | \"indeterminate\"\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean | \"indeterminate\"\n /** Fires with the next checked state (a value, not a DOM event). */\n onCheckedChange?: (checked: boolean | \"indeterminate\") => void\n /** Inline label beside the box. */\n label?: ReactNode\n /** Helper text above the control. */\n description?: ReactNode\n /** Error message below the control; its presence sets the invalid state. */\n error?: ReactNode\n /** Required flag (and, with a label, the red asterisk). */\n required?: boolean\n /** Red invalid state, OR'd with `error != null`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n size?: Size\n /** Checked-fill treatment: `default` (monochrome) or `filled` (palette-colored). */\n variant?: ControlIndicatorVariant\n color?: Color\n /** Field name for native form submission. */\n name?: string\n /** Submitted value when checked (defaults to `\"on\"`). */\n value?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the hidden `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the hidden `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Replaces the marks: `check` and `indeterminate`. A missing key keeps its default. */\n icons?: CheckboxIcons\n className?: string\n classNames?: {\n root?: string\n control?: string\n label?: string\n field?: string\n }\n}\n\n/**\n * The real, submittable hidden `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `Checkbox` itself renders that shell, so calling `useFieldContext()`\n * at its own top level would run too early. Same pattern as `Switch`: `fieldA11yProps` points\n * `aria-describedby` at the error once invalid (Ark's own tracking doesn't reliably catch up) and\n * adds `aria-errormessage`. Its `aria-labelledby` is left out: this `Field` never renders a label\n * (the checkbox's own `Ark.Label` names the input), so it would point at nothing.\n */\nconst CheckboxHiddenInput = ({ ref, onBlur }: Pick<CheckboxProps, \"ref\" | \"onBlur\">) => {\n const { \"aria-labelledby\": _unrendered, ...described } = fieldA11yProps(useFieldContext())\n return <Ark.HiddenInput ref={ref} onBlur={onBlur} {...described} />\n}\n\nexport const Checkbox = ({\n checked,\n defaultChecked,\n onCheckedChange,\n label,\n description,\n error,\n required,\n invalid,\n disabled,\n readOnly,\n size = \"md\",\n variant,\n color,\n name,\n value,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n icons: iconsProp,\n}: CheckboxProps) => {\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\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\n // A visible label above description/error needs the two grouped into one\n // flex-col item, or they'd land side by side in the root's row instead of\n // stacked. Label-only (incl. sr-only) never needs this extra wrapper.\n const hasStack = label != null && (description != null || error != null)\n\n const labelNode = label != null && (\n <Ark.Label\n className={cn(fieldLabel({ size }), !hasStack && \"min-w-0 flex-1\", classNames?.label)}\n >\n {label}\n {required && (\n <span aria-hidden=\"true\" {...requiredMark}>\n *\n </span>\n )}\n </Ark.Label>\n )\n\n return (\n <Ark.Root\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={onCheckedChange ? (d) => onCheckedChange(d.checked) : undefined}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n value={value}\n id={id}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\n \"relative inline-flex items-center gap-2 select-none\",\n className,\n classNames?.root,\n )}\n >\n <Ark.Control className={cn(controlIndicator({ size, variant }), classNames?.control)}>\n <Ark.Indicator>{icons.check}</Ark.Indicator>\n <Ark.Indicator indeterminate>{icons.indeterminate}</Ark.Indicator>\n </Ark.Control>\n\n {hasStack ? (\n <div className={cn(fieldRoot({ size }), classNames?.field)}>\n {labelNode}\n <FieldShell description={description} error={error} size={size}>\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </div>\n ) : (\n <>\n {labelNode}\n <FieldShell\n description={description}\n error={error}\n size={size}\n className={classNames?.field}\n >\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </>\n )}\n </Ark.Root>\n )\n}\n"]}
|