@btndprojects/loam-ui-native 0.1.1 → 0.3.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/accordion/index.js +7 -3
- package/dist/adaptive/index.js +16 -2
- package/dist/address-block/index.js +23 -0
- package/dist/alert/index.js +8 -2
- package/dist/analyzer/index.js +17 -6
- package/dist/announcement/index.js +18 -5
- package/dist/appearance-picker/index.js +15 -0
- package/dist/audio-player/index.js +29 -3
- package/dist/avatar/index.js +5 -2
- package/dist/avatar-group/index.js +9 -3
- package/dist/badge/index.js +10 -4
- package/dist/banner/index.js +6 -2
- package/dist/board/index.js +18 -6
- package/dist/button/index.js +9 -3
- package/dist/camera-permission/index.js +23 -12
- package/dist/capture-result/index.js +30 -17
- package/dist/card/index.js +10 -3
- package/dist/card-form/index.js +19 -9
- package/dist/carousel/index.js +6 -2
- package/dist/chart/index.js +18 -5
- package/dist/charts/index.js +21 -6
- package/dist/chat/index.js +41 -0
- package/dist/checkbox/index.js +9 -5
- package/dist/checklist/index.js +20 -8
- package/dist/checkout/index.js +30 -12
- package/dist/chip/index.js +11 -5
- package/dist/chunk-2BZD3NAP.js +1110 -0
- package/dist/chunk-2YKVID2V.js +35 -0
- package/dist/{chunk-JUAMLEHX.js → chunk-36DA3IPO.js} +137 -37
- package/dist/chunk-3A56MIAN.js +599 -0
- package/dist/chunk-3SCKCWF5.js +298 -0
- package/dist/chunk-3TZNDHKO.js +187 -0
- package/dist/chunk-43K3BLXV.js +9 -0
- package/dist/chunk-46ZJIQ2Z.js +208 -0
- package/dist/chunk-4CZMQDQL.js +192 -0
- package/dist/chunk-5DTKORLI.js +255 -0
- package/dist/{chunk-LOE5YNN3.js → chunk-5J4WFXFA.js} +68 -24
- package/dist/chunk-5KJ7TEQ6.js +305 -0
- package/dist/chunk-5NU33TXK.js +529 -0
- package/dist/chunk-5Z5ZYMOJ.js +1 -0
- package/dist/chunk-6KSUS7DF.js +690 -0
- package/dist/chunk-6RV6UW2J.js +349 -0
- package/dist/chunk-6RZM7RP2.js +520 -0
- package/dist/{chunk-4BXMXBJO.js → chunk-75BDCC7K.js} +24 -11
- package/dist/{chunk-PZXZJBMP.js → chunk-7CGJBQUA.js} +357 -32
- package/dist/{chunk-CJ5EOYZE.js → chunk-7IVF6JLJ.js} +24 -7
- package/dist/chunk-7IWCGXYA.js +143 -0
- package/dist/chunk-7LM4ASFH.js +172 -0
- package/dist/chunk-7MCEJFWV.js +341 -0
- package/dist/chunk-7NGMUVNU.js +245 -0
- package/dist/chunk-7PBSIXT7.js +355 -0
- package/dist/chunk-7QOYGENL.js +443 -0
- package/dist/{chunk-H6NIOQHK.js → chunk-A7SWYDE5.js} +66 -15
- package/dist/chunk-ADHPJALR.js +3051 -0
- package/dist/chunk-ALJYZLNQ.js +509 -0
- package/dist/chunk-APCWFOZW.js +28 -0
- package/dist/chunk-AQ5FIG74.js +419 -0
- package/dist/chunk-AWKQIE5I.js +139 -0
- package/dist/chunk-B2MMZZQB.js +426 -0
- package/dist/{chunk-ZVFE5QGU.js → chunk-B7JZ3N5G.js} +174 -97
- package/dist/chunk-BL37SW6G.js +1314 -0
- package/dist/chunk-BTRMA7GC.js +21 -0
- package/dist/chunk-C7IUWIUZ.js +643 -0
- package/dist/chunk-CA3DUVYD.js +10 -0
- package/dist/{chunk-S7F6XLTK.js → chunk-CBCJSO2B.js} +213 -54
- package/dist/chunk-CHPX4MFI.js +239 -0
- package/dist/chunk-CLGAMIOT.js +648 -0
- package/dist/chunk-CUE7VML6.js +1141 -0
- package/dist/chunk-CVU6S2E5.js +1587 -0
- package/dist/{chunk-AZRX6SAC.js → chunk-CXPQMA6Z.js} +112 -37
- package/dist/chunk-D2LN4I7I.js +581 -0
- package/dist/{chunk-UWFLYMAR.js → chunk-D34LNBO5.js} +635 -238
- package/dist/chunk-D4BCQICM.js +765 -0
- package/dist/chunk-EABKIIA4.js +1 -0
- package/dist/chunk-EICSYRAG.js +341 -0
- package/dist/chunk-EMWAJMAS.js +83 -0
- package/dist/chunk-EOLZWRV6.js +149 -0
- package/dist/chunk-EOQVTGB6.js +350 -0
- package/dist/{chunk-BEDBFJND.js → chunk-ESGUHNB2.js} +119 -43
- package/dist/{chunk-Q72LJOVE.js → chunk-F2KNBPKY.js} +74 -18
- package/dist/{chunk-O7AE6DAF.js → chunk-G7H3NX3G.js} +57 -24
- package/dist/chunk-GM7YIPB7.js +1052 -0
- package/dist/chunk-GVQQG435.js +581 -0
- package/dist/chunk-HE43OMEL.js +1056 -0
- package/dist/chunk-HHOMFQ7R.js +2535 -0
- package/dist/chunk-HJFFOOJ4.js +1 -0
- package/dist/chunk-HNAKS4Z3.js +207 -0
- package/dist/chunk-HP6ST2OW.js +352 -0
- package/dist/chunk-HW3OWDTU.js +1 -0
- package/dist/{chunk-3ENTMPQY.js → chunk-HZDB44K4.js} +102 -52
- package/dist/chunk-I2KLQ2HA.js +19 -0
- package/dist/chunk-I6CUP2LW.js +1155 -0
- package/dist/chunk-ICV4Y2WY.js +27 -0
- package/dist/chunk-IHSIENOE.js +3950 -0
- package/dist/{chunk-CUMUNPXY.js → chunk-IMMALLRU.js} +68 -32
- package/dist/chunk-J64KGCGX.js +55 -0
- package/dist/{chunk-IVNRBPGC.js → chunk-JA6TK7H2.js} +255 -84
- package/dist/{chunk-OOPPQH27.js → chunk-JAVZ5JPV.js} +83 -29
- package/dist/chunk-JCMTP3E4.js +1251 -0
- package/dist/{chunk-U7TFM2JA.js → chunk-JCXFFK64.js} +75 -18
- package/dist/chunk-JWCVBFDU.js +236 -0
- package/dist/chunk-JXRTD5RI.js +414 -0
- package/dist/chunk-JYIUZUIQ.js +1567 -0
- package/dist/chunk-K3TK3GIV.js +219 -0
- package/dist/chunk-KEVZIHM2.js +1511 -0
- package/dist/chunk-KHZDNQQD.js +171 -0
- package/dist/chunk-KL4GDV4V.js +131 -0
- package/dist/chunk-KNILMM4H.js +225 -0
- package/dist/chunk-KRBUZV45.js +25 -0
- package/dist/{chunk-ITTYJZWX.js → chunk-KXLDK6HB.js} +161 -45
- package/dist/chunk-KZ3X7TSL.js +196 -0
- package/dist/chunk-L2WMOA2V.js +474 -0
- package/dist/chunk-L4D5LHCH.js +109 -0
- package/dist/chunk-LAUJPLDB.js +853 -0
- package/dist/{chunk-SBMNWWBV.js → chunk-LGNTP5XA.js} +89 -17
- package/dist/chunk-LUZFCCSD.js +271 -0
- package/dist/{chunk-HPPW424V.js → chunk-LXJCP4PL.js} +129 -37
- package/dist/chunk-MCOZJWPU.js +731 -0
- package/dist/chunk-MG4SKWLL.js +2587 -0
- package/dist/chunk-MPEPTSER.js +414 -0
- package/dist/chunk-MWPJ4YGP.js +1 -0
- package/dist/{chunk-TKQYWZ5V.js → chunk-N7AX4OA4.js} +108 -41
- package/dist/chunk-NHSLM6SE.js +523 -0
- package/dist/chunk-NNCOFLNE.js +24 -0
- package/dist/{chunk-J7Q7VCVC.js → chunk-NNJLVA7M.js} +54 -15
- package/dist/chunk-NZG75DGA.js +282 -0
- package/dist/chunk-O76QXRBV.js +431 -0
- package/dist/chunk-OANH27AK.js +223 -0
- package/dist/chunk-OCHPK5YV.js +609 -0
- package/dist/chunk-OMHVEVX4.js +436 -0
- package/dist/{chunk-YF4NSSMT.js → chunk-ONKQUJWD.js} +220 -65
- package/dist/chunk-OVTK7A6T.js +615 -0
- package/dist/chunk-PCEFCOLN.js +120 -0
- package/dist/chunk-PFLNFIVB.js +186 -0
- package/dist/chunk-PHSZY37H.js +300 -0
- package/dist/chunk-PJLTKDVY.js +18 -0
- package/dist/{chunk-4YIP3CWS.js → chunk-PK7BN3MI.js} +89 -19
- package/dist/{chunk-KMI5ML5I.js → chunk-PWFRDRGS.js} +155 -29
- package/dist/chunk-PYPMD46W.js +707 -0
- package/dist/chunk-Q6CCHDI7.js +331 -0
- package/dist/chunk-QFA5WS2A.js +750 -0
- package/dist/chunk-QJMMM4RC.js +124 -0
- package/dist/chunk-QNZII37O.js +10 -0
- package/dist/chunk-QYWEVAM6.js +407 -0
- package/dist/chunk-R5T4VZ7Z.js +126 -0
- package/dist/chunk-R77HFLZD.js +1 -0
- package/dist/{chunk-YC6WORFL.js → chunk-RAESDNU5.js} +228 -102
- package/dist/chunk-RBYQUXNL.js +1 -0
- package/dist/chunk-RCM3DT5E.js +1 -0
- package/dist/chunk-RGNY56L7.js +282 -0
- package/dist/chunk-RIK6UX2K.js +344 -0
- package/dist/{chunk-LAECSR4H.js → chunk-RJA3RXO3.js} +75 -60
- package/dist/chunk-RJYRJ3LD.js +1 -0
- package/dist/chunk-RMA3NOY4.js +599 -0
- package/dist/{chunk-DM5QUKKO.js → chunk-RSWKKAHK.js} +160 -66
- package/dist/chunk-RVOIIX3V.js +204 -0
- package/dist/chunk-SA2RRBGT.js +1077 -0
- package/dist/chunk-SG3J4R45.js +1428 -0
- package/dist/chunk-SPUK7JD4.js +238 -0
- package/dist/chunk-SWXV2K5N.js +434 -0
- package/dist/chunk-SYJEPXP6.js +1303 -0
- package/dist/{chunk-N32RGOA5.js → chunk-SZLI34TA.js} +93 -28
- package/dist/{chunk-4GBOGOTV.js → chunk-T77WJA74.js} +143 -18
- package/dist/chunk-TDWWVJA4.js +630 -0
- package/dist/chunk-TFHI5XDR.js +610 -0
- package/dist/chunk-TH4PW2WU.js +17 -0
- package/dist/chunk-TTQ24HQX.js +12 -0
- package/dist/chunk-TUACVJNG.js +12 -0
- package/dist/{chunk-CYRBHQQZ.js → chunk-TUL5RUIA.js} +201 -59
- package/dist/{chunk-4ZAHCY44.js → chunk-TYOSA7JG.js} +74 -38
- package/dist/chunk-TYQTMMEV.js +1 -0
- package/dist/chunk-TZO6YDS7.js +346 -0
- package/dist/chunk-U3ETF22F.js +328 -0
- package/dist/chunk-U6BYHD2N.js +213 -0
- package/dist/{chunk-WSW6ZFAQ.js → chunk-UF6EJXPQ.js} +20 -5
- package/dist/chunk-UNNQIPGK.js +792 -0
- package/dist/chunk-UQEN55EY.js +1 -0
- package/dist/chunk-UQVO6AJV.js +171 -0
- package/dist/chunk-VFDQAAIW.js +351 -0
- package/dist/chunk-VIUE3VQT.js +1 -0
- package/dist/chunk-VJLSSSGC.js +438 -0
- package/dist/chunk-VLMT6KYT.js +350 -0
- package/dist/chunk-VMHGBUGS.js +35 -0
- package/dist/{chunk-7O2FMUPT.js → chunk-VQKPBYW6.js} +400 -139
- package/dist/{chunk-EJBDRVIH.js → chunk-VSSTWLC5.js} +61 -16
- package/dist/chunk-VZYYZRPN.js +1992 -0
- package/dist/chunk-W23G6JLF.js +37 -0
- package/dist/chunk-WAIJCD2V.js +480 -0
- package/dist/chunk-WFMQ3WKM.js +378 -0
- package/dist/chunk-WJ2KDRMY.js +66 -0
- package/dist/chunk-WKFZJO54.js +437 -0
- package/dist/{chunk-SYNOJOQO.js → chunk-WVVD3XOV.js} +189 -93
- package/dist/chunk-XAIWMSLB.js +1 -0
- package/dist/chunk-XBXUBBJZ.js +98 -0
- package/dist/chunk-XCU7MYBJ.js +1 -0
- package/dist/chunk-XHE4PGCI.js +717 -0
- package/dist/chunk-XRSJ32M3.js +331 -0
- package/dist/chunk-XTCVOEAW.js +1 -0
- package/dist/chunk-XWGXVQF6.js +58 -0
- package/dist/{chunk-35OFI3JG.js → chunk-Y3XKKO5K.js} +258 -123
- package/dist/chunk-Y4QNMBLO.js +533 -0
- package/dist/chunk-Y5H4CTKO.js +1 -0
- package/dist/chunk-YBQIN75A.js +403 -0
- package/dist/chunk-YJ5PXOX3.js +158 -0
- package/dist/{chunk-AWJOCGFZ.js → chunk-YLRSRUPS.js} +81 -55
- package/dist/chunk-YM6MPJ4A.js +1 -0
- package/dist/chunk-YV7KZENV.js +200 -0
- package/dist/chunk-Z7I4ZSO6.js +316 -0
- package/dist/chunk-ZIRMWD2B.js +555 -0
- package/dist/chunk-ZPMG3FWU.js +75 -0
- package/dist/{chunk-QWCMU5B2.js → chunk-ZTXMK2G7.js} +289 -115
- package/dist/chunk-ZVJCWXAL.js +541 -0
- package/dist/{chunk-P23EQNRQ.js → chunk-ZYQ23DPT.js} +215 -49
- package/dist/coachmark/index.js +10 -3
- package/dist/code-block/index.js +6 -3
- package/dist/color-field/index.js +15 -5
- package/dist/color-picker/index.js +23 -0
- package/dist/commerce/index.js +31 -17
- package/dist/confirm/index.js +31 -0
- package/dist/connection-card/index.js +34 -0
- package/dist/connectivity/index.js +6 -2
- package/dist/context-menu/index.js +13 -3
- package/dist/copy-button/index.js +5 -2
- package/dist/data-grid/index.js +35 -17
- package/dist/date-range-picker/index.js +22 -9
- package/dist/description-list/index.js +6 -1
- package/dist/device-frame/index.js +30 -0
- package/dist/dialog/index.js +10 -2
- package/dist/divider/index.js +2 -0
- package/dist/empty-state/index.js +15 -2
- package/dist/error-summary/index.js +9 -2
- package/dist/fab/index.js +7 -2
- package/dist/file-manager/index.js +44 -0
- package/dist/file-upload/index.js +16 -7
- package/dist/filter-bar/index.js +14 -7
- package/dist/flow-run/index.js +23 -13
- package/dist/form/index.js +32 -3
- package/dist/gallery/index.js +8 -2
- package/dist/hold-to-confirm/index.js +6 -2
- package/dist/hover-card/index.js +18 -0
- package/dist/icon-tile/index.js +10 -0
- package/dist/image/index.js +9 -0
- package/dist/index.d.ts +30789 -12332
- package/dist/index.js +424 -135
- package/dist/infinite-list/index.js +6 -2
- package/dist/inline-edit/index.js +8 -5
- package/dist/input/index.js +7 -4
- package/dist/interactions/index.js +5 -1
- package/dist/invoice/index.js +22 -9
- package/dist/job-row/index.js +22 -0
- package/dist/json-inspector/index.js +20 -0
- package/dist/kbd/index.js +5 -1
- package/dist/keyboard/index.js +9 -2
- package/dist/level-meter/index.js +9 -0
- package/dist/list-row/index.js +14 -4
- package/dist/log-viewer/index.js +11 -2
- package/dist/map-view/index.js +16 -3
- package/dist/markdown/index.js +12 -6
- package/dist/metric/index.js +10 -4
- package/dist/metric-strip/index.js +12 -0
- package/dist/money/index.js +16 -3
- package/dist/nav-drawer/index.js +8 -2
- package/dist/nav-header/index.js +15 -0
- package/dist/navigation/index.js +32 -2
- package/dist/notification-center/index.js +28 -12
- package/dist/number-roll/index.js +7 -2
- package/dist/onboarding-pager/index.js +22 -0
- package/dist/one-handed/index.js +5 -3
- package/dist/os-surfaces/index.js +9 -3
- package/dist/otp/index.js +9 -5
- package/dist/page-header/index.js +3 -1
- package/dist/pagination/index.js +8 -0
- package/dist/payment-method/index.js +21 -11
- package/dist/payment-status/index.js +26 -15
- package/dist/permission/index.js +21 -2
- package/dist/picker/index.js +22 -6
- package/dist/progress/index.js +11 -3
- package/dist/provenance/index.js +16 -0
- package/dist/pull-to-refresh/index.js +4 -2
- package/dist/qr-code/index.js +16 -0
- package/dist/query-builder/index.js +30 -0
- package/dist/radio-group/index.js +9 -5
- package/dist/rating/index.js +10 -2
- package/dist/receivables/index.js +35 -17
- package/dist/recording-indicator/index.js +21 -0
- package/dist/refund/index.js +28 -15
- package/dist/repeatable-rows/index.js +19 -0
- package/dist/save-status/index.js +7 -3
- package/dist/screen/index.js +3 -0
- package/dist/scroll-area/index.js +3 -1
- package/dist/search-field/index.js +13 -0
- package/dist/secret-field/index.js +19 -0
- package/dist/section-header/index.js +4 -0
- package/dist/segmented-control/index.js +4 -3
- package/dist/sheet/index.js +11 -3
- package/dist/shortcuts-sheet/index.js +2 -0
- package/dist/sign-in-screen/index.js +25 -0
- package/dist/skeleton/index.js +5 -1
- package/dist/slider/index.js +5 -2
- package/dist/sortable/index.js +8 -0
- package/dist/spinner/index.js +4 -1
- package/dist/split-button/index.js +21 -6
- package/dist/spotlight/index.js +9 -1
- package/dist/stack/index.js +2 -0
- package/dist/stage-timeline/index.js +8 -3
- package/dist/status-dot/index.js +8 -2
- package/dist/stepper/index.js +11 -4
- package/dist/streaming-text/index.js +4 -2
- package/dist/survey/index.js +29 -16
- package/dist/switch/index.js +9 -3
- package/dist/system-state/index.js +15 -4
- package/dist/tab-bar/index.js +13 -2
- package/dist/tabs/index.js +12 -2
- package/dist/tags-input/index.js +13 -0
- package/dist/text/index.js +4 -0
- package/dist/textarea/index.js +8 -5
- package/dist/thinking/index.js +6 -1
- package/dist/tile-rail/index.js +10 -0
- package/dist/time-field/index.js +20 -0
- package/dist/time-range-control/index.js +36 -0
- package/dist/timeline/index.js +4 -2
- package/dist/toast/index.js +6 -2
- package/dist/toolbar/index.js +5 -2
- package/dist/tour/index.js +15 -10
- package/dist/transcript/index.js +28 -0
- package/dist/truncation-notice/index.js +5 -2
- package/dist/update-notice/index.js +19 -9
- package/dist/video-player/index.js +29 -2
- package/dist/viewfinder/index.js +15 -5
- package/dist/widget/index.js +14 -4
- package/dist/wizard/index.js +10 -4
- package/package.json +13 -12
- package/dist/chunk-223Q2T2Q.js +0 -229
- package/dist/chunk-2A5NIQAK.js +0 -254
- package/dist/chunk-2GK6PHGE.js +0 -363
- package/dist/chunk-2ZZ7TDJ4.js +0 -324
- package/dist/chunk-3ARE4TES.js +0 -195
- package/dist/chunk-3NMD74ZU.js +0 -4
- package/dist/chunk-3WPW4KUN.js +0 -182
- package/dist/chunk-423B7SPN.js +0 -993
- package/dist/chunk-47FWHGUN.js +0 -394
- package/dist/chunk-4DS5ZWVC.js +0 -83
- package/dist/chunk-4SZYY6AN.js +0 -99
- package/dist/chunk-4YQOR7JM.js +0 -204
- package/dist/chunk-52X2VYTD.js +0 -228
- package/dist/chunk-5YNTNN5A.js +0 -177
- package/dist/chunk-6HT2LP62.js +0 -504
- package/dist/chunk-6N33LFQA.js +0 -35
- package/dist/chunk-6X6PQ443.js +0 -432
- package/dist/chunk-7CFF4HXS.js +0 -126
- package/dist/chunk-AI4DWZCD.js +0 -162
- package/dist/chunk-BTTFCMKG.js +0 -166
- package/dist/chunk-BV3B2HYZ.js +0 -1635
- package/dist/chunk-C2NTXVWM.js +0 -98
- package/dist/chunk-CDRZHT42.js +0 -424
- package/dist/chunk-DHWADYZX.js +0 -144
- package/dist/chunk-F5XNPWS7.js +0 -1024
- package/dist/chunk-FMYDDECK.js +0 -1521
- package/dist/chunk-GDKZTW34.js +0 -395
- package/dist/chunk-GL7B2DOW.js +0 -134
- package/dist/chunk-GNNJ4GCC.js +0 -471
- package/dist/chunk-HET4LLMX.js +0 -129
- package/dist/chunk-HZ6CNMAF.js +0 -870
- package/dist/chunk-IIQTAY3J.js +0 -715
- package/dist/chunk-JNH2TYIN.js +0 -96
- package/dist/chunk-JNY4ZHAR.js +0 -634
- package/dist/chunk-JXJB2X6M.js +0 -131
- package/dist/chunk-LRJNDEIA.js +0 -302
- package/dist/chunk-LSS54GLJ.js +0 -116
- package/dist/chunk-LZLHELAG.js +0 -137
- package/dist/chunk-MOUJOP55.js +0 -425
- package/dist/chunk-NKB7BZYK.js +0 -167
- package/dist/chunk-NQYBUO3K.js +0 -1795
- package/dist/chunk-O4AEHWII.js +0 -464
- package/dist/chunk-OETCUXQP.js +0 -134
- package/dist/chunk-OPXFZ4Y5.js +0 -204
- package/dist/chunk-PJXUJYS6.js +0 -248
- package/dist/chunk-PUPM2YGF.js +0 -376
- package/dist/chunk-QCDXZBC5.js +0 -247
- package/dist/chunk-QDYDBCFP.js +0 -197
- package/dist/chunk-QJJ6MADV.js +0 -274
- package/dist/chunk-QKXCPTFS.js +0 -349
- package/dist/chunk-RIBDXGUG.js +0 -108
- package/dist/chunk-RJQOOHT2.js +0 -214
- package/dist/chunk-RNGLIHFA.js +0 -191
- package/dist/chunk-RQ3HASCC.js +0 -6
- package/dist/chunk-RSOJT5YW.js +0 -124
- package/dist/chunk-RUZHTGKB.js +0 -237
- package/dist/chunk-RW6ZL2FQ.js +0 -284
- package/dist/chunk-TKVFVF5D.js +0 -95
- package/dist/chunk-TOXAGRDQ.js +0 -144
- package/dist/chunk-TUTI5HOZ.js +0 -112
- package/dist/chunk-UC2WGUP3.js +0 -627
- package/dist/chunk-UYG5L34B.js +0 -87
- package/dist/chunk-VBOXAEPI.js +0 -336
- package/dist/chunk-VCDBXW5H.js +0 -188
- package/dist/chunk-VEAYTRPX.js +0 -414
- package/dist/chunk-VQHPQEUH.js +0 -273
- package/dist/chunk-VXDZFJGP.js +0 -874
- package/dist/chunk-XNUVB5OL.js +0 -375
- package/dist/chunk-XOSCY2CW.js +0 -242
- package/dist/chunk-XXXEFXY5.js +0 -99
- package/dist/chunk-YDGVJETP.js +0 -60
- package/dist/chunk-YG3ZJHGU.js +0 -223
- package/dist/chunk-YTFKPRUK.js +0 -845
- package/dist/chunk-Z7H7VSFZ.js +0 -323
- package/dist/header/index.js +0 -5
- package/dist/search-bar/index.js +0 -5
- /package/dist/{chunk-3ECPOSKO.js → chunk-3BKLBYPK.js} +0 -0
- /package/dist/{chunk-JRLTGLN4.js → chunk-3UG6JUCV.js} +0 -0
- /package/dist/{chunk-RTIKSY6A.js → chunk-4QCR3K2J.js} +0 -0
- /package/dist/{chunk-VFCUIDRT.js → chunk-5WWRTEPS.js} +0 -0
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
import { DRAG_CURSOR } from './chunk-KTAC4MGE.js';
|
|
2
|
+
import { Sheet } from './chunk-B7JZ3N5G.js';
|
|
3
|
+
import { Input } from './chunk-KXLDK6HB.js';
|
|
4
|
+
import { haptics } from './chunk-NY2U3PBI.js';
|
|
5
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
6
|
+
import { Icon } from './chunk-PCEFCOLN.js';
|
|
7
|
+
import { useResolvedMotion } from './chunk-J64KGCGX.js';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { View, Pressable, Text, PanResponder, StyleSheet, Platform, Animated, Easing } from 'react-native';
|
|
10
|
+
import { Svg, Defs, LinearGradient, Stop, Rect, Pattern } from 'react-native-svg';
|
|
11
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var GEOMETRY = {
|
|
15
|
+
sm: { plane: 120, hue: 12, thumb: 16 },
|
|
16
|
+
md: { plane: 160, hue: 14, thumb: 18 }
|
|
17
|
+
};
|
|
18
|
+
function clamp(n, lo, hi) {
|
|
19
|
+
return Math.max(lo, Math.min(hi, n));
|
|
20
|
+
}
|
|
21
|
+
function hsvToRgb({ h, s, v }) {
|
|
22
|
+
const sat = s / 100;
|
|
23
|
+
const val = v / 100;
|
|
24
|
+
const c = val * sat;
|
|
25
|
+
const hp = h % 360 / 60;
|
|
26
|
+
const x = c * (1 - Math.abs(hp % 2 - 1));
|
|
27
|
+
let r = 0;
|
|
28
|
+
let g = 0;
|
|
29
|
+
let b = 0;
|
|
30
|
+
if (hp >= 0 && hp < 1) [r, g, b] = [c, x, 0];
|
|
31
|
+
else if (hp < 2) [r, g, b] = [x, c, 0];
|
|
32
|
+
else if (hp < 3) [r, g, b] = [0, c, x];
|
|
33
|
+
else if (hp < 4) [r, g, b] = [0, x, c];
|
|
34
|
+
else if (hp < 5) [r, g, b] = [x, 0, c];
|
|
35
|
+
else [r, g, b] = [c, 0, x];
|
|
36
|
+
const m = val - c;
|
|
37
|
+
return [Math.round((r + m) * 255), Math.round((g + m) * 255), Math.round((b + m) * 255)];
|
|
38
|
+
}
|
|
39
|
+
function rgbToHsv(r, g, b) {
|
|
40
|
+
const rn = r / 255;
|
|
41
|
+
const gn = g / 255;
|
|
42
|
+
const bn = b / 255;
|
|
43
|
+
const max = Math.max(rn, gn, bn);
|
|
44
|
+
const min = Math.min(rn, gn, bn);
|
|
45
|
+
const d = max - min;
|
|
46
|
+
let h = 0;
|
|
47
|
+
if (d !== 0) {
|
|
48
|
+
if (max === rn) h = (gn - bn) / d % 6;
|
|
49
|
+
else if (max === gn) h = (bn - rn) / d + 2;
|
|
50
|
+
else h = (rn - gn) / d + 4;
|
|
51
|
+
h *= 60;
|
|
52
|
+
if (h < 0) h += 360;
|
|
53
|
+
}
|
|
54
|
+
const s = max === 0 ? 0 : d / max * 100;
|
|
55
|
+
return { h, s, v: max * 100 };
|
|
56
|
+
}
|
|
57
|
+
function byteHex(n) {
|
|
58
|
+
return clamp(Math.round(n), 0, 255).toString(16).padStart(2, "0").toUpperCase();
|
|
59
|
+
}
|
|
60
|
+
function rgbToHex(r, g, b) {
|
|
61
|
+
return `#${byteHex(r)}${byteHex(g)}${byteHex(b)}`;
|
|
62
|
+
}
|
|
63
|
+
function normalizeHex(input) {
|
|
64
|
+
const raw = input.trim().replace(/^#/, "");
|
|
65
|
+
if (/^[0-9a-fA-F]{3}$/.test(raw)) {
|
|
66
|
+
const [a, b, c] = raw;
|
|
67
|
+
return `#${a}${a}${b}${b}${c}${c}`.toUpperCase();
|
|
68
|
+
}
|
|
69
|
+
if (/^[0-9a-fA-F]{6}$/.test(raw)) return `#${raw.toUpperCase()}`;
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function hexToRgb(input) {
|
|
73
|
+
const hex = normalizeHex(input);
|
|
74
|
+
if (!hex) return null;
|
|
75
|
+
return [
|
|
76
|
+
parseInt(hex.slice(1, 3), 16),
|
|
77
|
+
parseInt(hex.slice(3, 5), 16),
|
|
78
|
+
parseInt(hex.slice(5, 7), 16)
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
function hsvToHex(hsv) {
|
|
82
|
+
return rgbToHex(...hsvToRgb(hsv));
|
|
83
|
+
}
|
|
84
|
+
function hexToHsv(hex, prevHue) {
|
|
85
|
+
const rgb = hexToRgb(hex);
|
|
86
|
+
if (!rgb) return null;
|
|
87
|
+
const hsv = rgbToHsv(...rgb);
|
|
88
|
+
if (hsv.s === 0) hsv.h = prevHue;
|
|
89
|
+
return hsv;
|
|
90
|
+
}
|
|
91
|
+
var DEFAULT_LABELS = {
|
|
92
|
+
saturationBrightness: "Saturation and brightness",
|
|
93
|
+
hue: "Hue",
|
|
94
|
+
opacity: "Opacity",
|
|
95
|
+
planeNamed: (name) => `${name}, saturation and brightness`,
|
|
96
|
+
hueNamed: (name) => `${name}, hue`,
|
|
97
|
+
opacityNamed: (name) => `${name}, opacity`,
|
|
98
|
+
planeValue: (s, v) => `Saturation ${s} percent, brightness ${v} percent`,
|
|
99
|
+
opacityValue: (pct) => `${pct}% opacity`,
|
|
100
|
+
hexColour: "Hex colour",
|
|
101
|
+
hexError: "Enter a 6-digit hex, like #4A7C59",
|
|
102
|
+
savedColours: "Saved colours",
|
|
103
|
+
useSaved: (hex) => `Use saved colour ${hex}`,
|
|
104
|
+
presetColours: "Preset colours",
|
|
105
|
+
usePreset: (hex) => `Use preset colour ${hex}`,
|
|
106
|
+
saveColour: "Save this colour"
|
|
107
|
+
};
|
|
108
|
+
var CHECK = 4;
|
|
109
|
+
function Checker({ id, dark }) {
|
|
110
|
+
const [a, b] = dark ? ["#000000", "#333333"] : ["#ffffff", "#e0e0e0"];
|
|
111
|
+
return /* @__PURE__ */ jsxs(Pattern, { id, width: CHECK * 2, height: CHECK * 2, patternUnits: "userSpaceOnUse", children: [
|
|
112
|
+
/* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: CHECK * 2, height: CHECK * 2, fill: a }),
|
|
113
|
+
/* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: CHECK, height: CHECK, fill: b }),
|
|
114
|
+
/* @__PURE__ */ jsx(Rect, { x: CHECK, y: CHECK, width: CHECK, height: CHECK, fill: b })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
function ColorFieldBody({
|
|
118
|
+
value,
|
|
119
|
+
defaultValue = "#4A7C59",
|
|
120
|
+
onValueChange,
|
|
121
|
+
showInput = true,
|
|
122
|
+
surface = "filled",
|
|
123
|
+
disabled = false,
|
|
124
|
+
readOnly = false,
|
|
125
|
+
hint,
|
|
126
|
+
error,
|
|
127
|
+
success = false,
|
|
128
|
+
loading = false,
|
|
129
|
+
placeholder,
|
|
130
|
+
size = "md",
|
|
131
|
+
accessibilityLabel,
|
|
132
|
+
style,
|
|
133
|
+
savedColors,
|
|
134
|
+
presets,
|
|
135
|
+
onSavedColorsChange,
|
|
136
|
+
showAlpha = false,
|
|
137
|
+
alpha: alphaProp,
|
|
138
|
+
defaultAlpha = 1,
|
|
139
|
+
onAlphaChange,
|
|
140
|
+
labels: labelsProp,
|
|
141
|
+
motion = "full"
|
|
142
|
+
}) {
|
|
143
|
+
const labels = useLabels("colorField", DEFAULT_LABELS, labelsProp);
|
|
144
|
+
const isControlled = value !== void 0;
|
|
145
|
+
const initialHsv = React.useMemo(
|
|
146
|
+
() => hexToHsv(value ?? defaultValue, 0) ?? { h: 0, s: 0, v: 0 },
|
|
147
|
+
// Initial only — later syncing is handled by the effect below.
|
|
148
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
149
|
+
[]
|
|
150
|
+
);
|
|
151
|
+
const [hsv, setHsv] = React.useState(initialHsv);
|
|
152
|
+
const [hexText, setHexText] = React.useState(() => hsvToHex(initialHsv));
|
|
153
|
+
const { styles } = useStyles(sheet, { size, disabled });
|
|
154
|
+
const theme = useLoamTheme("color-field");
|
|
155
|
+
const hex = hsvToHex(hsv);
|
|
156
|
+
const hueColor = hsvToHex({ h: hsv.h, s: 100, v: 100 });
|
|
157
|
+
const planeRef = React.useRef(null);
|
|
158
|
+
const hueRef = React.useRef(null);
|
|
159
|
+
const planeBox = React.useRef({ w: 0, h: 0, x: 0, y: 0 });
|
|
160
|
+
const hueBox = React.useRef({ w: 0, x: 0 });
|
|
161
|
+
const hsvRef = React.useRef(hsv);
|
|
162
|
+
hsvRef.current = hsv;
|
|
163
|
+
const locked = disabled || readOnly;
|
|
164
|
+
const disabledRef = React.useRef(locked);
|
|
165
|
+
disabledRef.current = locked;
|
|
166
|
+
const editingHex = React.useRef(false);
|
|
167
|
+
const [hexTouched, setHexTouched] = React.useState(false);
|
|
168
|
+
const [planeW, setPlaneW] = React.useState(0);
|
|
169
|
+
const [hueW, setHueW] = React.useState(0);
|
|
170
|
+
const commit = React.useCallback(
|
|
171
|
+
(next, syncText = true) => {
|
|
172
|
+
hsvRef.current = next;
|
|
173
|
+
if (!isControlled) setHsv(next);
|
|
174
|
+
if (syncText) setHexText(hsvToHex(next));
|
|
175
|
+
onValueChange?.(hsvToHex(next));
|
|
176
|
+
},
|
|
177
|
+
[isControlled, onValueChange]
|
|
178
|
+
);
|
|
179
|
+
React.useEffect(() => {
|
|
180
|
+
if (!isControlled || value === void 0) return;
|
|
181
|
+
const next = hexToHsv(value, hsvRef.current.h);
|
|
182
|
+
if (!next || hsvToHex(next) === hsvToHex(hsvRef.current)) return;
|
|
183
|
+
setHsv(next);
|
|
184
|
+
if (!editingHex.current) setHexText(hsvToHex(next));
|
|
185
|
+
}, [value]);
|
|
186
|
+
const planeFromXY = React.useRef(() => {
|
|
187
|
+
});
|
|
188
|
+
planeFromXY.current = (pageX, pageY) => {
|
|
189
|
+
const { w, h, x, y } = planeBox.current;
|
|
190
|
+
if (!w || !h) return;
|
|
191
|
+
const s = clamp((pageX - x) / w * 100, 0, 100);
|
|
192
|
+
const v = clamp((1 - (pageY - y) / h) * 100, 0, 100);
|
|
193
|
+
commit({ ...hsvRef.current, s, v });
|
|
194
|
+
};
|
|
195
|
+
const hueFromX = React.useRef(() => {
|
|
196
|
+
});
|
|
197
|
+
hueFromX.current = (pageX) => {
|
|
198
|
+
const { w, x } = hueBox.current;
|
|
199
|
+
if (!w) return;
|
|
200
|
+
const h = clamp((pageX - x) / w * 360, 0, 360);
|
|
201
|
+
commit({ ...hsvRef.current, h });
|
|
202
|
+
};
|
|
203
|
+
const planePan = React.useRef(
|
|
204
|
+
PanResponder.create({
|
|
205
|
+
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
206
|
+
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
207
|
+
onPanResponderGrant: (e) => {
|
|
208
|
+
haptics.impact("light");
|
|
209
|
+
planeFromXY.current(e.nativeEvent.pageX, e.nativeEvent.pageY);
|
|
210
|
+
},
|
|
211
|
+
onPanResponderMove: (e) => planeFromXY.current(e.nativeEvent.pageX, e.nativeEvent.pageY)
|
|
212
|
+
})
|
|
213
|
+
).current;
|
|
214
|
+
const huePan = React.useRef(
|
|
215
|
+
PanResponder.create({
|
|
216
|
+
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
217
|
+
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
218
|
+
onPanResponderGrant: (e) => {
|
|
219
|
+
haptics.impact("light");
|
|
220
|
+
hueFromX.current(e.nativeEvent.pageX);
|
|
221
|
+
},
|
|
222
|
+
onPanResponderMove: (e) => hueFromX.current(e.nativeEvent.pageX)
|
|
223
|
+
})
|
|
224
|
+
).current;
|
|
225
|
+
const nudge = (axis, key, big) => {
|
|
226
|
+
if (disabledRef.current) return false;
|
|
227
|
+
const step = big ? 10 : 1;
|
|
228
|
+
const cur = hsvRef.current;
|
|
229
|
+
if (axis === "plane") {
|
|
230
|
+
if (key === "ArrowRight") commit({ ...cur, s: clamp(cur.s + step, 0, 100) });
|
|
231
|
+
else if (key === "ArrowLeft") commit({ ...cur, s: clamp(cur.s - step, 0, 100) });
|
|
232
|
+
else if (key === "ArrowUp") commit({ ...cur, v: clamp(cur.v + step, 0, 100) });
|
|
233
|
+
else if (key === "ArrowDown") commit({ ...cur, v: clamp(cur.v - step, 0, 100) });
|
|
234
|
+
else return false;
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
if (key === "ArrowRight" || key === "ArrowUp")
|
|
238
|
+
commit({ ...cur, h: clamp(cur.h + step, 0, 360) });
|
|
239
|
+
else if (key === "ArrowLeft" || key === "ArrowDown")
|
|
240
|
+
commit({ ...cur, h: clamp(cur.h - step, 0, 360) });
|
|
241
|
+
else if (key === "Home") commit({ ...cur, h: 0 });
|
|
242
|
+
else if (key === "End") commit({ ...cur, h: 360 });
|
|
243
|
+
else return false;
|
|
244
|
+
return true;
|
|
245
|
+
};
|
|
246
|
+
const keyHandler = (axis) => (e) => {
|
|
247
|
+
if (nudge(axis, e.key, Boolean(e.shiftKey))) e.preventDefault?.();
|
|
248
|
+
};
|
|
249
|
+
const hueActions = [{ name: "increment" }, { name: "decrement" }];
|
|
250
|
+
const onHueAction = (e) => {
|
|
251
|
+
nudge("hue", e.nativeEvent.actionName === "increment" ? "ArrowRight" : "ArrowLeft", true);
|
|
252
|
+
};
|
|
253
|
+
const onPlaneLayout = (e) => {
|
|
254
|
+
const { width, height } = e.nativeEvent.layout;
|
|
255
|
+
planeBox.current.w = width;
|
|
256
|
+
planeBox.current.h = height;
|
|
257
|
+
setPlaneW(width);
|
|
258
|
+
planeRef.current?.measureInWindow?.((x, y) => {
|
|
259
|
+
planeBox.current.x = x;
|
|
260
|
+
planeBox.current.y = y;
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
const onHueLayout = (e) => {
|
|
264
|
+
const { width } = e.nativeEvent.layout;
|
|
265
|
+
hueBox.current.w = width;
|
|
266
|
+
setHueW(width);
|
|
267
|
+
hueRef.current?.measureInWindow?.((x) => {
|
|
268
|
+
hueBox.current.x = x;
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
const alphaControlled = alphaProp !== void 0;
|
|
272
|
+
const [alphaInternal, setAlphaInternal] = React.useState(defaultAlpha);
|
|
273
|
+
const alpha = clamp(alphaControlled ? alphaProp : alphaInternal, 0, 1);
|
|
274
|
+
const alphaRefVal = React.useRef(alpha);
|
|
275
|
+
alphaRefVal.current = alpha;
|
|
276
|
+
const commitAlpha = React.useRef(() => {
|
|
277
|
+
});
|
|
278
|
+
commitAlpha.current = (next) => {
|
|
279
|
+
const a = clamp(Math.round(next * 100) / 100, 0, 1);
|
|
280
|
+
alphaRefVal.current = a;
|
|
281
|
+
if (!alphaControlled) setAlphaInternal(a);
|
|
282
|
+
onAlphaChange?.(a);
|
|
283
|
+
};
|
|
284
|
+
const alphaRef = React.useRef(null);
|
|
285
|
+
const alphaBox = React.useRef({ w: 0, x: 0 });
|
|
286
|
+
const [alphaW, setAlphaW] = React.useState(0);
|
|
287
|
+
const alphaFromX = (pageX) => {
|
|
288
|
+
const { w, x } = alphaBox.current;
|
|
289
|
+
if (w) commitAlpha.current((pageX - x) / w);
|
|
290
|
+
};
|
|
291
|
+
const alphaFromXRef = React.useRef(alphaFromX);
|
|
292
|
+
alphaFromXRef.current = alphaFromX;
|
|
293
|
+
const alphaPan = React.useRef(
|
|
294
|
+
PanResponder.create({
|
|
295
|
+
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
296
|
+
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
297
|
+
onPanResponderGrant: (e) => {
|
|
298
|
+
haptics.impact("light");
|
|
299
|
+
alphaFromXRef.current(e.nativeEvent.pageX);
|
|
300
|
+
},
|
|
301
|
+
onPanResponderMove: (e) => alphaFromXRef.current(e.nativeEvent.pageX)
|
|
302
|
+
})
|
|
303
|
+
).current;
|
|
304
|
+
const onAlphaLayout = (e) => {
|
|
305
|
+
const { width } = e.nativeEvent.layout;
|
|
306
|
+
alphaBox.current.w = width;
|
|
307
|
+
setAlphaW(width);
|
|
308
|
+
alphaRef.current?.measureInWindow?.((x) => {
|
|
309
|
+
alphaBox.current.x = x;
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
const onAlphaKey = (e) => {
|
|
313
|
+
if (disabledRef.current) return;
|
|
314
|
+
const step = e.shiftKey ? 0.1 : 0.01;
|
|
315
|
+
const cur = alphaRefVal.current;
|
|
316
|
+
let next;
|
|
317
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") next = cur + step;
|
|
318
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = cur - step;
|
|
319
|
+
else if (e.key === "Home") next = 0;
|
|
320
|
+
else if (e.key === "End") next = 1;
|
|
321
|
+
else return;
|
|
322
|
+
e.preventDefault?.();
|
|
323
|
+
commitAlpha.current(next);
|
|
324
|
+
};
|
|
325
|
+
const onAlphaAction = (e) => {
|
|
326
|
+
if (disabledRef.current) return;
|
|
327
|
+
commitAlpha.current(
|
|
328
|
+
alphaRefVal.current + (e.nativeEvent.actionName === "increment" ? 0.1 : -0.1)
|
|
329
|
+
);
|
|
330
|
+
};
|
|
331
|
+
const saveCurrent = () => {
|
|
332
|
+
const key = hex.toUpperCase();
|
|
333
|
+
const rest = (savedColors ?? []).filter((c) => c.toUpperCase() !== key);
|
|
334
|
+
onSavedColorsChange?.([key, ...rest]);
|
|
335
|
+
};
|
|
336
|
+
const pickSaved = (c) => {
|
|
337
|
+
if (locked) return;
|
|
338
|
+
const next = hexToHsv(c, hsvRef.current.h);
|
|
339
|
+
if (next) commit(next);
|
|
340
|
+
};
|
|
341
|
+
const onHexChange = (text) => {
|
|
342
|
+
setHexText(text);
|
|
343
|
+
const next = hexToHsv(text, hsvRef.current.h);
|
|
344
|
+
if (next) commit(next, false);
|
|
345
|
+
};
|
|
346
|
+
const geo = GEOMETRY[size];
|
|
347
|
+
const planeThumbX = hsv.s / 100 * planeW - geo.thumb / 2;
|
|
348
|
+
const planeThumbY = (1 - hsv.v / 100) * geo.plane - geo.thumb / 2;
|
|
349
|
+
const hueThumbX = hsv.h / 360 * hueW - geo.thumb / 2;
|
|
350
|
+
const hexValid = normalizeHex(hexText) !== null;
|
|
351
|
+
const hexError = !hexValid && (hexTouched || !/^\s*#?[0-9a-fA-F]{0,6}\s*$/.test(hexText));
|
|
352
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.wrap, style], children: [
|
|
353
|
+
/* @__PURE__ */ jsxs(
|
|
354
|
+
View,
|
|
355
|
+
{
|
|
356
|
+
ref: planeRef,
|
|
357
|
+
onLayout: onPlaneLayout,
|
|
358
|
+
accessibilityRole: "adjustable",
|
|
359
|
+
accessibilityLabel: accessibilityLabel ? labels.planeNamed(accessibilityLabel) : labels.saturationBrightness,
|
|
360
|
+
accessibilityValue: {
|
|
361
|
+
text: labels.planeValue(Math.round(hsv.s), Math.round(hsv.v))
|
|
362
|
+
},
|
|
363
|
+
accessibilityState: { disabled },
|
|
364
|
+
"aria-valuemin": 0,
|
|
365
|
+
"aria-valuemax": 100,
|
|
366
|
+
"aria-valuenow": Math.round(hsv.v),
|
|
367
|
+
"aria-valuetext": labels.planeValue(Math.round(hsv.s), Math.round(hsv.v)),
|
|
368
|
+
style: [styles.plane, !locked && DRAG_CURSOR],
|
|
369
|
+
...locked ? {} : planePan.panHandlers,
|
|
370
|
+
...{ tabIndex: locked ? -1 : 0, onKeyDown: keyHandler("plane") },
|
|
371
|
+
children: [
|
|
372
|
+
planeW > 0 ? /* @__PURE__ */ jsxs(Svg, { width: planeW, height: geo.plane, style: StyleSheet.absoluteFill, children: [
|
|
373
|
+
/* @__PURE__ */ jsxs(Defs, { children: [
|
|
374
|
+
/* @__PURE__ */ jsxs(LinearGradient, { id: "loam-cf-sat", x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
375
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: "#ffffff", stopOpacity: 1 }),
|
|
376
|
+
/* @__PURE__ */ jsx(Stop, { offset: "1", stopColor: "#ffffff", stopOpacity: 0 })
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ jsxs(LinearGradient, { id: "loam-cf-val", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
379
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: "#000000", stopOpacity: 0 }),
|
|
380
|
+
/* @__PURE__ */ jsx(Stop, { offset: "1", stopColor: "#000000", stopOpacity: 1 })
|
|
381
|
+
] })
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: planeW, height: geo.plane, fill: hueColor }),
|
|
384
|
+
/* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: planeW, height: geo.plane, fill: "url(#loam-cf-sat)" }),
|
|
385
|
+
/* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: planeW, height: geo.plane, fill: "url(#loam-cf-val)" })
|
|
386
|
+
] }) : null,
|
|
387
|
+
/* @__PURE__ */ jsx(
|
|
388
|
+
View,
|
|
389
|
+
{
|
|
390
|
+
style: [
|
|
391
|
+
styles.thumb,
|
|
392
|
+
{ transform: [{ translateX: planeThumbX }, { translateY: planeThumbY }] }
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ jsxs(
|
|
400
|
+
View,
|
|
401
|
+
{
|
|
402
|
+
ref: hueRef,
|
|
403
|
+
onLayout: onHueLayout,
|
|
404
|
+
accessibilityRole: "adjustable",
|
|
405
|
+
accessibilityLabel: accessibilityLabel ? labels.hueNamed(accessibilityLabel) : labels.hue,
|
|
406
|
+
accessibilityValue: { min: 0, max: 360, now: Math.round(hsv.h) },
|
|
407
|
+
accessibilityState: { disabled },
|
|
408
|
+
"aria-valuemin": 0,
|
|
409
|
+
"aria-valuemax": 360,
|
|
410
|
+
"aria-valuenow": Math.round(hsv.h),
|
|
411
|
+
accessibilityActions: hueActions,
|
|
412
|
+
onAccessibilityAction: onHueAction,
|
|
413
|
+
style: [styles.hue, !locked && DRAG_CURSOR],
|
|
414
|
+
...locked ? {} : huePan.panHandlers,
|
|
415
|
+
...{ tabIndex: locked ? -1 : 0, onKeyDown: keyHandler("hue") },
|
|
416
|
+
children: [
|
|
417
|
+
hueW > 0 ? /* @__PURE__ */ jsxs(Svg, { width: hueW, height: geo.hue, style: StyleSheet.absoluteFill, children: [
|
|
418
|
+
/* @__PURE__ */ jsx(Defs, { children: /* @__PURE__ */ jsxs(LinearGradient, { id: "loam-cf-hue", x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
419
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: "#ff0000" }),
|
|
420
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.17", stopColor: "#ffff00" }),
|
|
421
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.33", stopColor: "#00ff00" }),
|
|
422
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.5", stopColor: "#00ffff" }),
|
|
423
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.67", stopColor: "#0000ff" }),
|
|
424
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.83", stopColor: "#ff00ff" }),
|
|
425
|
+
/* @__PURE__ */ jsx(Stop, { offset: "1", stopColor: "#ff0000" })
|
|
426
|
+
] }) }),
|
|
427
|
+
/* @__PURE__ */ jsx(
|
|
428
|
+
Rect,
|
|
429
|
+
{
|
|
430
|
+
x: "0",
|
|
431
|
+
y: "0",
|
|
432
|
+
width: hueW,
|
|
433
|
+
height: geo.hue,
|
|
434
|
+
rx: geo.hue / 2,
|
|
435
|
+
fill: "url(#loam-cf-hue)"
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] }) : null,
|
|
439
|
+
/* @__PURE__ */ jsx(View, { style: [styles.thumb, styles.hueThumb, { transform: [{ translateX: hueThumbX }] }] })
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
),
|
|
443
|
+
showAlpha ? /* @__PURE__ */ jsxs(
|
|
444
|
+
View,
|
|
445
|
+
{
|
|
446
|
+
ref: alphaRef,
|
|
447
|
+
onLayout: onAlphaLayout,
|
|
448
|
+
accessibilityRole: "adjustable",
|
|
449
|
+
accessibilityLabel: accessibilityLabel ? labels.opacityNamed(accessibilityLabel) : labels.opacity,
|
|
450
|
+
accessibilityValue: {
|
|
451
|
+
min: 0,
|
|
452
|
+
max: 100,
|
|
453
|
+
now: Math.round(alpha * 100),
|
|
454
|
+
text: labels.opacityValue(Math.round(alpha * 100))
|
|
455
|
+
},
|
|
456
|
+
accessibilityState: { disabled },
|
|
457
|
+
"aria-valuemin": 0,
|
|
458
|
+
"aria-valuemax": 100,
|
|
459
|
+
"aria-valuenow": Math.round(alpha * 100),
|
|
460
|
+
"aria-valuetext": labels.opacityValue(Math.round(alpha * 100)),
|
|
461
|
+
accessibilityActions: hueActions,
|
|
462
|
+
onAccessibilityAction: onAlphaAction,
|
|
463
|
+
style: [styles.hue, !locked && DRAG_CURSOR],
|
|
464
|
+
...locked ? {} : alphaPan.panHandlers,
|
|
465
|
+
...{ tabIndex: locked ? -1 : 0, onKeyDown: onAlphaKey },
|
|
466
|
+
children: [
|
|
467
|
+
alphaW > 0 ? /* @__PURE__ */ jsxs(Svg, { width: alphaW, height: geo.hue, style: StyleSheet.absoluteFill, children: [
|
|
468
|
+
/* @__PURE__ */ jsxs(Defs, { children: [
|
|
469
|
+
/* @__PURE__ */ jsx(Checker, { id: "loam-cf-check" }),
|
|
470
|
+
/* @__PURE__ */ jsxs(LinearGradient, { id: "loam-cf-alpha", x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
471
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: hex, stopOpacity: 0 }),
|
|
472
|
+
/* @__PURE__ */ jsx(Stop, { offset: "1", stopColor: hex, stopOpacity: 1 })
|
|
473
|
+
] })
|
|
474
|
+
] }),
|
|
475
|
+
/* @__PURE__ */ jsx(
|
|
476
|
+
Rect,
|
|
477
|
+
{
|
|
478
|
+
x: "0",
|
|
479
|
+
y: "0",
|
|
480
|
+
width: alphaW,
|
|
481
|
+
height: geo.hue,
|
|
482
|
+
rx: geo.hue / 2,
|
|
483
|
+
fill: "url(#loam-cf-check)"
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
/* @__PURE__ */ jsx(
|
|
487
|
+
Rect,
|
|
488
|
+
{
|
|
489
|
+
x: "0",
|
|
490
|
+
y: "0",
|
|
491
|
+
width: alphaW,
|
|
492
|
+
height: geo.hue,
|
|
493
|
+
rx: geo.hue / 2,
|
|
494
|
+
fill: "url(#loam-cf-alpha)"
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
] }) : null,
|
|
498
|
+
/* @__PURE__ */ jsx(
|
|
499
|
+
View,
|
|
500
|
+
{
|
|
501
|
+
style: [
|
|
502
|
+
styles.thumb,
|
|
503
|
+
styles.hueThumb,
|
|
504
|
+
{ transform: [{ translateX: alpha * alphaW - geo.thumb / 2 }] }
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
]
|
|
509
|
+
}
|
|
510
|
+
) : null,
|
|
511
|
+
showInput ? /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
|
|
512
|
+
showAlpha ? /* @__PURE__ */ jsx(View, { style: [styles.preview, styles.alphaPreview], testID: "color-field-alpha-preview", children: [false, true].map((dark) => /* @__PURE__ */ jsxs(Svg, { width: "50%", height: "100%", children: [
|
|
513
|
+
/* @__PURE__ */ jsx(Defs, { children: /* @__PURE__ */ jsx(Checker, { id: dark ? "loam-cf-pd" : "loam-cf-pl", dark }) }),
|
|
514
|
+
/* @__PURE__ */ jsx(
|
|
515
|
+
Rect,
|
|
516
|
+
{
|
|
517
|
+
x: "0",
|
|
518
|
+
y: "0",
|
|
519
|
+
width: "100%",
|
|
520
|
+
height: "100%",
|
|
521
|
+
fill: `url(#${dark ? "loam-cf-pd" : "loam-cf-pl"})`
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
/* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: hex, fillOpacity: alpha })
|
|
525
|
+
] }, String(dark))) }) : /* @__PURE__ */ jsx(PreviewSwatch, { color: hex, style: styles.preview, motion }),
|
|
526
|
+
/* @__PURE__ */ jsx(View, { style: styles.inputWrap, children: /* @__PURE__ */ jsx(
|
|
527
|
+
Input,
|
|
528
|
+
{
|
|
529
|
+
surface,
|
|
530
|
+
value: hexText,
|
|
531
|
+
onChangeText: onHexChange,
|
|
532
|
+
onFocus: () => {
|
|
533
|
+
editingHex.current = true;
|
|
534
|
+
},
|
|
535
|
+
onBlur: () => {
|
|
536
|
+
editingHex.current = false;
|
|
537
|
+
setHexTouched(true);
|
|
538
|
+
setHexText(hex);
|
|
539
|
+
},
|
|
540
|
+
editable: !locked,
|
|
541
|
+
autoCapitalize: "characters",
|
|
542
|
+
autoCorrect: false,
|
|
543
|
+
maxLength: 7,
|
|
544
|
+
size: size === "sm" ? "md" : "lg",
|
|
545
|
+
placeholder,
|
|
546
|
+
loading,
|
|
547
|
+
success,
|
|
548
|
+
validationState: hexError || error ? "invalid" : "default",
|
|
549
|
+
message: error ?? (hexError ? labels.hexError : void 0),
|
|
550
|
+
showStatusIcon: false,
|
|
551
|
+
accessibilityLabel: labels.hexColour,
|
|
552
|
+
style: { fontFamily: theme.font.mono }
|
|
553
|
+
}
|
|
554
|
+
) })
|
|
555
|
+
] }) : null,
|
|
556
|
+
presets && presets.length > 0 ? /* @__PURE__ */ jsx(
|
|
557
|
+
View,
|
|
558
|
+
{
|
|
559
|
+
accessibilityRole: "radiogroup",
|
|
560
|
+
accessibilityLabel: labels.presetColours,
|
|
561
|
+
testID: "color-field-presets",
|
|
562
|
+
style: styles.saved,
|
|
563
|
+
children: presets.map((c) => {
|
|
564
|
+
const checked = c.toUpperCase() === hex.toUpperCase();
|
|
565
|
+
return /* @__PURE__ */ jsx(
|
|
566
|
+
Pressable,
|
|
567
|
+
{
|
|
568
|
+
accessibilityRole: "radio",
|
|
569
|
+
accessibilityLabel: labels.usePreset(c.toUpperCase()),
|
|
570
|
+
accessibilityState: { checked, disabled },
|
|
571
|
+
...Platform.OS === "web" ? { "aria-checked": checked } : null,
|
|
572
|
+
disabled: locked,
|
|
573
|
+
onPress: () => pickSaved(c),
|
|
574
|
+
hitSlop: theme.space[4],
|
|
575
|
+
style: [
|
|
576
|
+
styles.swatch,
|
|
577
|
+
{ backgroundColor: c },
|
|
578
|
+
checked ? styles.swatchChecked : null
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
c
|
|
582
|
+
);
|
|
583
|
+
})
|
|
584
|
+
}
|
|
585
|
+
) : null,
|
|
586
|
+
savedColors || onSavedColorsChange ? /* @__PURE__ */ jsxs(
|
|
587
|
+
View,
|
|
588
|
+
{
|
|
589
|
+
accessibilityRole: "group",
|
|
590
|
+
accessibilityLabel: labels.savedColours,
|
|
591
|
+
style: styles.saved,
|
|
592
|
+
children: [
|
|
593
|
+
(savedColors ?? []).map((c) => /* @__PURE__ */ jsx(
|
|
594
|
+
Pressable,
|
|
595
|
+
{
|
|
596
|
+
accessibilityRole: "button",
|
|
597
|
+
accessibilityLabel: labels.useSaved(c.toUpperCase()),
|
|
598
|
+
accessibilityState: { disabled },
|
|
599
|
+
disabled: locked,
|
|
600
|
+
onPress: () => pickSaved(c),
|
|
601
|
+
hitSlop: theme.space[4],
|
|
602
|
+
style: [styles.swatch, { backgroundColor: c }]
|
|
603
|
+
},
|
|
604
|
+
c
|
|
605
|
+
)),
|
|
606
|
+
onSavedColorsChange ? (
|
|
607
|
+
// A swatch-sized slot rather than a 30px button, so the row reads
|
|
608
|
+
// as one strip of equal squares with the next free slot at its end.
|
|
609
|
+
/* @__PURE__ */ jsx(
|
|
610
|
+
Pressable,
|
|
611
|
+
{
|
|
612
|
+
accessibilityRole: "button",
|
|
613
|
+
accessibilityLabel: labels.saveColour,
|
|
614
|
+
accessibilityState: { disabled },
|
|
615
|
+
disabled: locked,
|
|
616
|
+
onPress: saveCurrent,
|
|
617
|
+
hitSlop: theme.space[4],
|
|
618
|
+
style: ({ pressed }) => [
|
|
619
|
+
styles.swatch,
|
|
620
|
+
styles.saveSlot,
|
|
621
|
+
pressed ? { backgroundColor: theme.state.pressed } : null,
|
|
622
|
+
disabled ? { opacity: theme.state.disabledOpacity } : null
|
|
623
|
+
],
|
|
624
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "plus", size: 14, color: theme.color.text2 })
|
|
625
|
+
}
|
|
626
|
+
)
|
|
627
|
+
) : null
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
) : null,
|
|
631
|
+
hint ? /* @__PURE__ */ jsx(Text, { style: styles.hint, children: hint }) : null
|
|
632
|
+
] });
|
|
633
|
+
}
|
|
634
|
+
var HEAVY_SHADOW_RATIO = 1.2;
|
|
635
|
+
function PreviewSwatch({
|
|
636
|
+
color,
|
|
637
|
+
style,
|
|
638
|
+
motion = "full"
|
|
639
|
+
}) {
|
|
640
|
+
const theme = useLoamTheme("color-field");
|
|
641
|
+
const animate = useResolvedMotion(motion, "color-field") !== "none";
|
|
642
|
+
const progress = React.useRef(new Animated.Value(1)).current;
|
|
643
|
+
const [range, setRange] = React.useState([color, color]);
|
|
644
|
+
React.useEffect(() => {
|
|
645
|
+
setRange((prev) => prev[1] === color ? prev : [prev[1], color]);
|
|
646
|
+
}, [color]);
|
|
647
|
+
React.useEffect(() => {
|
|
648
|
+
if (range[0] === range[1]) return;
|
|
649
|
+
if (!animate) {
|
|
650
|
+
progress.setValue(1);
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
progress.setValue(0);
|
|
654
|
+
Animated.timing(progress, {
|
|
655
|
+
toValue: 1,
|
|
656
|
+
duration: theme.spring.fe.duration,
|
|
657
|
+
easing: Easing.out(Easing.quad),
|
|
658
|
+
useNativeDriver: false
|
|
659
|
+
}).start();
|
|
660
|
+
}, [range, progress, animate, theme.spring.fe.duration]);
|
|
661
|
+
const backgroundColor = progress.interpolate({ inputRange: [0, 1], outputRange: range });
|
|
662
|
+
return /* @__PURE__ */ jsx(Animated.View, { style: [style, { backgroundColor }] });
|
|
663
|
+
}
|
|
664
|
+
var sheet = createStyleSheet((theme) => ({
|
|
665
|
+
hint: { fontFamily: theme.font.sans, fontSize: theme.fontSize[12], color: theme.color.text3 },
|
|
666
|
+
sheetTrigger: { flexDirection: "row", alignItems: "center", gap: theme.space[8] },
|
|
667
|
+
sheetHex: { fontFamily: theme.font.mono, fontSize: theme.fontSize[14], color: theme.color.text },
|
|
668
|
+
// The per-size `width` is the picker's preferred measure: a plane a little wider
|
|
669
|
+
// than it is tall, which also leaves the swatch and the hex field a line they
|
|
670
|
+
// both fit on. The caller's `style` merges after it, so it is a default rather
|
|
671
|
+
// than a floor, and `maxWidth` keeps it from overflowing a narrower container.
|
|
672
|
+
wrap: {
|
|
673
|
+
flexDirection: "column",
|
|
674
|
+
gap: theme.space.s3,
|
|
675
|
+
maxWidth: "100%",
|
|
676
|
+
variants: {
|
|
677
|
+
size: {
|
|
678
|
+
sm: { width: GEOMETRY.sm.plane + theme.space[20] },
|
|
679
|
+
md: { width: GEOMETRY.md.plane + theme.space[40] }
|
|
680
|
+
},
|
|
681
|
+
disabled: {
|
|
682
|
+
true: { opacity: theme.state.disabledOpacity },
|
|
683
|
+
false: {}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
plane: {
|
|
688
|
+
width: "100%",
|
|
689
|
+
borderRadius: theme.radius.md,
|
|
690
|
+
borderWidth: theme.borderWidth.base,
|
|
691
|
+
borderColor: theme.color.border,
|
|
692
|
+
overflow: "hidden",
|
|
693
|
+
variants: {
|
|
694
|
+
size: {
|
|
695
|
+
sm: { height: GEOMETRY.sm.plane },
|
|
696
|
+
md: { height: GEOMETRY.md.plane }
|
|
697
|
+
},
|
|
698
|
+
disabled: {}
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
hue: {
|
|
702
|
+
width: "100%",
|
|
703
|
+
justifyContent: "center",
|
|
704
|
+
borderRadius: theme.radius.full,
|
|
705
|
+
variants: {
|
|
706
|
+
size: {
|
|
707
|
+
sm: { height: GEOMETRY.sm.hue },
|
|
708
|
+
md: { height: GEOMETRY.md.hue }
|
|
709
|
+
},
|
|
710
|
+
disabled: {}
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
// A hollow ring so the colour underneath shows through; positioned at 0,0 and
|
|
714
|
+
// moved with translate transforms.
|
|
715
|
+
thumb: {
|
|
716
|
+
position: "absolute",
|
|
717
|
+
top: 0,
|
|
718
|
+
left: 0,
|
|
719
|
+
// Let drags fall through to the plane/rail underneath.
|
|
720
|
+
pointerEvents: "none",
|
|
721
|
+
borderRadius: theme.radius.full,
|
|
722
|
+
backgroundColor: "transparent",
|
|
723
|
+
borderWidth: theme.borderWidth.thick,
|
|
724
|
+
borderColor: theme.color.knob,
|
|
725
|
+
// The reference's thumb elevation is tighter and more opaque than the
|
|
726
|
+
// switch knob's (`0 1px 3px` at .3 vs `0 2px 5px` at .25), so the geometry
|
|
727
|
+
// is overridden — but the *colour* comes from the theme's knob shadow,
|
|
728
|
+
// which carries the accent tint that `--sh-*` does on the web. A hardcoded
|
|
729
|
+
// `#000000` here made this one of the only shadows in the system that
|
|
730
|
+
// ignored the tint.
|
|
731
|
+
...theme.shadow.knob,
|
|
732
|
+
shadowOffset: { width: 0, height: theme.space[1] },
|
|
733
|
+
shadowOpacity: theme.shadow.knob.shadowOpacity * HEAVY_SHADOW_RATIO,
|
|
734
|
+
shadowRadius: theme.space[3],
|
|
735
|
+
variants: {
|
|
736
|
+
size: {
|
|
737
|
+
sm: { width: GEOMETRY.sm.thumb, height: GEOMETRY.sm.thumb },
|
|
738
|
+
md: { width: GEOMETRY.md.thumb, height: GEOMETRY.md.thumb }
|
|
739
|
+
},
|
|
740
|
+
disabled: {}
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
// The hue thumb rides the vertical centre of the (short) rail.
|
|
744
|
+
hueThumb: {
|
|
745
|
+
top: "50%",
|
|
746
|
+
variants: {
|
|
747
|
+
size: {
|
|
748
|
+
sm: { marginTop: -16 / 2 },
|
|
749
|
+
md: { marginTop: -18 / 2 }
|
|
750
|
+
},
|
|
751
|
+
disabled: {}
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
row: {
|
|
755
|
+
flexDirection: "row",
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
gap: theme.space.s2
|
|
758
|
+
},
|
|
759
|
+
preview: {
|
|
760
|
+
width: theme.space[32],
|
|
761
|
+
height: theme.space[32],
|
|
762
|
+
borderRadius: theme.radius.xs,
|
|
763
|
+
borderWidth: theme.borderWidth.base,
|
|
764
|
+
borderColor: theme.color.border
|
|
765
|
+
},
|
|
766
|
+
inputWrap: {
|
|
767
|
+
flex: 1
|
|
768
|
+
},
|
|
769
|
+
// Light and dark checker halves side by side, clipped to the swatch shape.
|
|
770
|
+
alphaPreview: {
|
|
771
|
+
flexDirection: "row",
|
|
772
|
+
overflow: "hidden"
|
|
773
|
+
},
|
|
774
|
+
saved: {
|
|
775
|
+
flexDirection: "row",
|
|
776
|
+
flexWrap: "wrap",
|
|
777
|
+
alignItems: "center",
|
|
778
|
+
gap: theme.space.s1
|
|
779
|
+
},
|
|
780
|
+
swatch: {
|
|
781
|
+
width: theme.space[24],
|
|
782
|
+
height: theme.space[24],
|
|
783
|
+
borderRadius: theme.radius.xs,
|
|
784
|
+
borderWidth: theme.borderWidth.base,
|
|
785
|
+
borderColor: theme.color.border
|
|
786
|
+
},
|
|
787
|
+
swatchChecked: {
|
|
788
|
+
borderWidth: theme.borderWidth.heavy,
|
|
789
|
+
borderColor: theme.color.text
|
|
790
|
+
},
|
|
791
|
+
saveSlot: {
|
|
792
|
+
alignItems: "center",
|
|
793
|
+
justifyContent: "center",
|
|
794
|
+
borderStyle: "dashed",
|
|
795
|
+
borderColor: theme.color.borderStrong
|
|
796
|
+
}
|
|
797
|
+
}));
|
|
798
|
+
function ColorField({
|
|
799
|
+
presentation = "inline",
|
|
800
|
+
...props
|
|
801
|
+
}) {
|
|
802
|
+
const [open, setOpen] = React.useState(false);
|
|
803
|
+
const [local, setLocal] = React.useState(props.value ?? props.defaultValue ?? "#4A7C59");
|
|
804
|
+
const { styles } = useStyles(sheet, {
|
|
805
|
+
size: props.size ?? "md",
|
|
806
|
+
disabled: props.disabled ?? false
|
|
807
|
+
});
|
|
808
|
+
const labels = useLabels("colorField", DEFAULT_LABELS, props.labels);
|
|
809
|
+
const current = props.value ?? local;
|
|
810
|
+
if (presentation === "inline") return /* @__PURE__ */ jsx(ColorFieldBody, { ...props });
|
|
811
|
+
const locked = Boolean(props.disabled || props.readOnly);
|
|
812
|
+
return /* @__PURE__ */ jsxs(View, { style: props.style, children: [
|
|
813
|
+
/* @__PURE__ */ jsxs(
|
|
814
|
+
Pressable,
|
|
815
|
+
{
|
|
816
|
+
accessibilityRole: "button",
|
|
817
|
+
accessibilityLabel: `${props.accessibilityLabel ?? labels.hexColour} ${current.toUpperCase()}`,
|
|
818
|
+
accessibilityState: { disabled: locked, expanded: open },
|
|
819
|
+
disabled: locked,
|
|
820
|
+
onPress: () => setOpen(true),
|
|
821
|
+
style: styles.sheetTrigger,
|
|
822
|
+
children: [
|
|
823
|
+
/* @__PURE__ */ jsx(PreviewSwatch, { color: current, style: styles.preview, motion: props.motion }),
|
|
824
|
+
/* @__PURE__ */ jsx(Text, { style: styles.sheetHex, children: current.toUpperCase() })
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
),
|
|
828
|
+
props.hint ? /* @__PURE__ */ jsx(Text, { style: styles.hint, children: props.hint }) : null,
|
|
829
|
+
/* @__PURE__ */ jsx(
|
|
830
|
+
Sheet,
|
|
831
|
+
{
|
|
832
|
+
open,
|
|
833
|
+
onClose: () => setOpen(false),
|
|
834
|
+
title: props.accessibilityLabel,
|
|
835
|
+
motion: props.motion,
|
|
836
|
+
children: /* @__PURE__ */ jsx(
|
|
837
|
+
ColorFieldBody,
|
|
838
|
+
{
|
|
839
|
+
...props,
|
|
840
|
+
style: void 0,
|
|
841
|
+
value: current,
|
|
842
|
+
onValueChange: (next) => {
|
|
843
|
+
setLocal(next);
|
|
844
|
+
props.onValueChange?.(next);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
)
|
|
848
|
+
}
|
|
849
|
+
)
|
|
850
|
+
] });
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
export { ColorField };
|