@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,1587 @@
|
|
|
1
|
+
import { storageKey, readStored, writeStored } from './chunk-NNCOFLNE.js';
|
|
2
|
+
import { MonthList } from './chunk-TZO6YDS7.js';
|
|
3
|
+
import { ListRow } from './chunk-JA6TK7H2.js';
|
|
4
|
+
import { getClipboard } from './chunk-TTQ24HQX.js';
|
|
5
|
+
import { Chip } from './chunk-7NGMUVNU.js';
|
|
6
|
+
import { Sheet } from './chunk-B7JZ3N5G.js';
|
|
7
|
+
import { Button } from './chunk-5DTKORLI.js';
|
|
8
|
+
import { Switch } from './chunk-VFDQAAIW.js';
|
|
9
|
+
import { SegmentedControl } from './chunk-NZG75DGA.js';
|
|
10
|
+
import { Input } from './chunk-KXLDK6HB.js';
|
|
11
|
+
import { isAndroidIdiom } from './chunk-TH4PW2WU.js';
|
|
12
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
13
|
+
import { Icon } from './chunk-PCEFCOLN.js';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import { View, Text, ScrollView, Pressable, AppState, I18nManager } from 'react-native';
|
|
16
|
+
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
17
|
+
import { DEFAULT_DATE_LABELS, timeRangeValue, dateZone, timeRangeReachesNow, timeRangeLabel, zoomTimeRange, resolveDateValue, TIME_RANGE_OPTIONS, sameDateValue, timeRangeReceipt, valueLabel, timeRangeText, parseTimeRange, findTimeRangeOption, durationLabel, zoneLabel, DATE_ZONES, zoneName, shiftTimeRange, isDateMath, parseDateRange, DAY_MS, HOUR_MS, pad2, localeNames, quickRangeLabel, timeLabel, dayLabel, formatDateMathInstant } from '@btndprojects/loam-date';
|
|
18
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
|
+
|
|
20
|
+
var UNIT_ROW = {
|
|
21
|
+
second: "Seconds",
|
|
22
|
+
minute: "Minutes",
|
|
23
|
+
hour: "Hours",
|
|
24
|
+
day: "Days",
|
|
25
|
+
week: "Weeks",
|
|
26
|
+
month: "Months",
|
|
27
|
+
quarter: "Quarters",
|
|
28
|
+
year: "Years"
|
|
29
|
+
};
|
|
30
|
+
var DEFAULT_LABELS = {
|
|
31
|
+
...DEFAULT_DATE_LABELS,
|
|
32
|
+
timeRange: "Time range",
|
|
33
|
+
triggerLabel: (label, value) => `${label}, ${value}`,
|
|
34
|
+
moveBack: "Move back in time",
|
|
35
|
+
moveForward: "Move forward in time",
|
|
36
|
+
zoomOut: "Zoom out",
|
|
37
|
+
command: "Type a range",
|
|
38
|
+
commandPlaceholder: "45m, yesterday, now-2d to now-1d\u2026",
|
|
39
|
+
notARange: "Not a range yet",
|
|
40
|
+
lastHeading: "Last",
|
|
41
|
+
unitRow: (unit) => UNIT_ROW[unit],
|
|
42
|
+
periodsHeading: "Periods",
|
|
43
|
+
periodNames: {
|
|
44
|
+
today: "Today",
|
|
45
|
+
yesterday: "Yesterday",
|
|
46
|
+
week: "This week",
|
|
47
|
+
month: "This month",
|
|
48
|
+
year: "This year"
|
|
49
|
+
},
|
|
50
|
+
soFar: "So far",
|
|
51
|
+
preview: "Preview",
|
|
52
|
+
stepNames: {
|
|
53
|
+
relative: "Last\u2026",
|
|
54
|
+
periods: "Periods",
|
|
55
|
+
quickRanges: "All quick ranges",
|
|
56
|
+
custom: "Custom range"
|
|
57
|
+
},
|
|
58
|
+
stepHints: {
|
|
59
|
+
relative: "Minutes to months back",
|
|
60
|
+
periods: "Today, this week, this month\u2026",
|
|
61
|
+
quickRanges: "Search every preset",
|
|
62
|
+
custom: "Exact dates and times"
|
|
63
|
+
},
|
|
64
|
+
back: "Back",
|
|
65
|
+
viewSwitch: "Preview as",
|
|
66
|
+
viewNames: { clock: "Clock", calendar: "Calendar", year: "Year" },
|
|
67
|
+
clockHint: "Drag across the hours, or move an end.",
|
|
68
|
+
calendarHint: "Pick two days for a custom range.",
|
|
69
|
+
calendarHintEnd: "Now pick the last day.",
|
|
70
|
+
previousMonth: "Previous month",
|
|
71
|
+
nextMonth: "Next month",
|
|
72
|
+
now: "now",
|
|
73
|
+
from: "From",
|
|
74
|
+
to: "To",
|
|
75
|
+
applyRange: "Apply time range",
|
|
76
|
+
copyRange: "Copy the time range",
|
|
77
|
+
pasteRange: "Paste a time range",
|
|
78
|
+
copied: "Time range copied.",
|
|
79
|
+
clipboardUnavailable: "The clipboard is not available here.",
|
|
80
|
+
clipboardNoRange: "The clipboard does not hold a time range.",
|
|
81
|
+
pasted: (from, to) => `Pasted ${from} to ${to}.`,
|
|
82
|
+
reportIn: "Report in",
|
|
83
|
+
changeSettings: "Change time settings",
|
|
84
|
+
hideSettings: "Hide time settings",
|
|
85
|
+
recentlyUsed: "Recently used",
|
|
86
|
+
quickRangeList: "Quick ranges",
|
|
87
|
+
searchRanges: (list) => `Search ${list.toLowerCase()}`,
|
|
88
|
+
noRangeMatches: (q) => `No range matches \u201C${q}\u201D.`,
|
|
89
|
+
refresh: "Refresh",
|
|
90
|
+
cancel: "Cancel",
|
|
91
|
+
cancelRefresh: "Cancel refresh",
|
|
92
|
+
customChip: "Custom",
|
|
93
|
+
autoRefresh: "Auto-refresh",
|
|
94
|
+
off: "Off"
|
|
95
|
+
};
|
|
96
|
+
function dateLabelsOf(labels) {
|
|
97
|
+
const out = {};
|
|
98
|
+
for (const k of Object.keys(DEFAULT_DATE_LABELS)) {
|
|
99
|
+
out[k] = labels[k];
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
var DEFAULT_PARTS = {
|
|
104
|
+
command: true,
|
|
105
|
+
relative: true,
|
|
106
|
+
periods: true,
|
|
107
|
+
recent: true,
|
|
108
|
+
quickRanges: false,
|
|
109
|
+
preview: true,
|
|
110
|
+
fields: true,
|
|
111
|
+
actions: true,
|
|
112
|
+
zone: true,
|
|
113
|
+
clipboard: true
|
|
114
|
+
};
|
|
115
|
+
var TIME_RANGE_UNITS = [
|
|
116
|
+
{ unit: "minute", counts: [5, 15, 30] },
|
|
117
|
+
{ unit: "hour", counts: [1, 3, 6, 12, 24] },
|
|
118
|
+
{ unit: "day", counts: [2, 7, 14, 30, 90] },
|
|
119
|
+
{ unit: "month", counts: [6, 12] }
|
|
120
|
+
];
|
|
121
|
+
var TIME_RANGE_PERIODS = [
|
|
122
|
+
{ id: "today", from: "now/d", to: "now/d", toSoFar: "now" },
|
|
123
|
+
{ id: "yesterday", from: "now-1d/d", to: "now-1d/d" },
|
|
124
|
+
{ id: "week", from: "now/w", to: "now/w", toSoFar: "now" },
|
|
125
|
+
{ id: "month", from: "now/M", to: "now/M", toSoFar: "now" },
|
|
126
|
+
{ id: "year", from: "now/y", to: "now/y", toSoFar: "now" }
|
|
127
|
+
];
|
|
128
|
+
var TIME_RANGE_VIEWS = ["clock", "calendar", "year"];
|
|
129
|
+
var QUARTER_MS = HOUR_MS / 4;
|
|
130
|
+
var STEP_ICON = {
|
|
131
|
+
relative: "clock",
|
|
132
|
+
periods: "calendar",
|
|
133
|
+
quickRanges: "list-ul",
|
|
134
|
+
custom: "sliders"
|
|
135
|
+
};
|
|
136
|
+
var UNIT_CODE = {
|
|
137
|
+
second: "s",
|
|
138
|
+
minute: "m",
|
|
139
|
+
hour: "h",
|
|
140
|
+
day: "d",
|
|
141
|
+
week: "w",
|
|
142
|
+
month: "M",
|
|
143
|
+
quarter: "Q",
|
|
144
|
+
year: "y"
|
|
145
|
+
};
|
|
146
|
+
function TimeRangeOptionRow({
|
|
147
|
+
title,
|
|
148
|
+
selected,
|
|
149
|
+
pressed = false,
|
|
150
|
+
onPress
|
|
151
|
+
}) {
|
|
152
|
+
const { styles } = useStyles(sheet);
|
|
153
|
+
return /* @__PURE__ */ jsxs(
|
|
154
|
+
Pressable,
|
|
155
|
+
{
|
|
156
|
+
accessibilityRole: "radio",
|
|
157
|
+
accessibilityState: { checked: selected, disabled: !onPress },
|
|
158
|
+
"aria-checked": selected,
|
|
159
|
+
disabled: !onPress,
|
|
160
|
+
onPress,
|
|
161
|
+
style: ({ pressed: down }) => [
|
|
162
|
+
styles.optionRow,
|
|
163
|
+
selected ? styles.optionRowOn : null,
|
|
164
|
+
pressed || down ? styles.optionRowPressed : null
|
|
165
|
+
],
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsx(View, { style: [styles.radio, selected && styles.optionRadioOn], children: selected ? /* @__PURE__ */ jsx(View, { style: styles.radioDot }) : null }),
|
|
168
|
+
/* @__PURE__ */ jsx(Text, { style: styles.rowText, children: title })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function readRangeText(text) {
|
|
174
|
+
const trimmed = text.trim();
|
|
175
|
+
try {
|
|
176
|
+
const json = JSON.parse(trimmed);
|
|
177
|
+
if (json && typeof json.from === "string" && typeof json.to === "string") {
|
|
178
|
+
return { from: json.from, to: json.to };
|
|
179
|
+
}
|
|
180
|
+
} catch {
|
|
181
|
+
}
|
|
182
|
+
const m = /^(.+?)\s+(?:to|→)\s+(.+)$/i.exec(trimmed);
|
|
183
|
+
return m ? { from: m[1], to: m[2] } : null;
|
|
184
|
+
}
|
|
185
|
+
function readCommand(text, ctx) {
|
|
186
|
+
const q = text.trim();
|
|
187
|
+
if (!q) return null;
|
|
188
|
+
const split = /^(.+?)(?:\s*→\s*|\s+(?:to|–)\s+)(.+)$/i.exec(q);
|
|
189
|
+
if (split && parseTimeRange(split[1], split[2], ctx).ok) {
|
|
190
|
+
return { from: split[1].trim(), to: split[2].trim() };
|
|
191
|
+
}
|
|
192
|
+
const short = /^(\d+)\s*(mo|[smhdwMQy])$/.exec(q);
|
|
193
|
+
if (short && Number(short[1]) > 0) return { from: `now-${short[1]}${short[2]}`, to: "now" };
|
|
194
|
+
if (isDateMath(q) && parseTimeRange(q, "now", ctx).ok) return { from: q, to: "now" };
|
|
195
|
+
const r = parseDateRange(q, ctx);
|
|
196
|
+
if (!r.ok || !r.value) return null;
|
|
197
|
+
const v = r.value;
|
|
198
|
+
if (v.kind === "rolling") {
|
|
199
|
+
const c = UNIT_CODE[v.unit];
|
|
200
|
+
return v.includePartial === false ? { from: `now-${v.n}${c}/${c}`, to: `now-1${c}/${c}` } : { from: `now-${v.n}${c}`, to: "now" };
|
|
201
|
+
}
|
|
202
|
+
if (v.kind === "toDate") return { from: `now/${UNIT_CODE[v.unit]}`, to: "now" };
|
|
203
|
+
if (v.kind === "span") {
|
|
204
|
+
const c = UNIT_CODE[v.unit];
|
|
205
|
+
const at = v.off ? `now${v.off > 0 ? "+" : ""}${v.off}${c}/${c}` : `now/${c}`;
|
|
206
|
+
return { from: at, to: at };
|
|
207
|
+
}
|
|
208
|
+
return timeRangeText(v, ctx);
|
|
209
|
+
}
|
|
210
|
+
function dayText(Z, ms) {
|
|
211
|
+
return formatDateMathInstant(Z, ms).slice(0, 10);
|
|
212
|
+
}
|
|
213
|
+
function autoView(from, to, Z) {
|
|
214
|
+
const span = to - from;
|
|
215
|
+
const wholeDays = from === Z.startOfDay(from) && to === Z.startOfDay(to);
|
|
216
|
+
if (wholeDays && span <= 62 * DAY_MS) return "calendar";
|
|
217
|
+
if (span <= DAY_MS) return "clock";
|
|
218
|
+
return span <= 62 * DAY_MS ? "calendar" : "year";
|
|
219
|
+
}
|
|
220
|
+
function TimeRangeSheetBody({
|
|
221
|
+
ctx,
|
|
222
|
+
value,
|
|
223
|
+
onApply,
|
|
224
|
+
onCancel,
|
|
225
|
+
options,
|
|
226
|
+
recent,
|
|
227
|
+
labels,
|
|
228
|
+
dateLabels,
|
|
229
|
+
children,
|
|
230
|
+
timezone,
|
|
231
|
+
onTimezoneChange,
|
|
232
|
+
timezones = DATE_ZONES,
|
|
233
|
+
onNotify,
|
|
234
|
+
parts: partsProp,
|
|
235
|
+
units = TIME_RANGE_UNITS,
|
|
236
|
+
periods = TIME_RANGE_PERIODS,
|
|
237
|
+
views = TIME_RANGE_VIEWS,
|
|
238
|
+
view: viewProp = "auto",
|
|
239
|
+
defaultSoFar = true,
|
|
240
|
+
applyMode = "instant",
|
|
241
|
+
allowFuture = false,
|
|
242
|
+
ampm = false,
|
|
243
|
+
platform,
|
|
244
|
+
optionStyle = "list",
|
|
245
|
+
surface
|
|
246
|
+
}) {
|
|
247
|
+
const theme = useLoamTheme();
|
|
248
|
+
const { styles } = useStyles(sheet);
|
|
249
|
+
const android = isAndroidIdiom(theme, platform);
|
|
250
|
+
const Z = ctx.Z;
|
|
251
|
+
const now = ctx.now ?? Date.now();
|
|
252
|
+
const part = { ...DEFAULT_PARTS, ...partsProp };
|
|
253
|
+
const initial = React.useMemo(() => timeRangeText(value, ctx), [value, ctx]);
|
|
254
|
+
const [from, setFrom] = React.useState(initial.from || "now-6h");
|
|
255
|
+
const [to, setTo] = React.useState(initial.to || "now");
|
|
256
|
+
const [command, setCommand] = React.useState("");
|
|
257
|
+
const steps = [
|
|
258
|
+
["relative", part.relative && units.length > 0],
|
|
259
|
+
["periods", part.periods && periods.length > 0],
|
|
260
|
+
["quickRanges", part.quickRanges],
|
|
261
|
+
["custom", part.preview || part.fields]
|
|
262
|
+
].filter(([, on]) => on).map(([key]) => key);
|
|
263
|
+
const recentShown = part.recent ? recent.slice(0, 3) : [];
|
|
264
|
+
const single = steps.length === 1 && !part.command && recentShown.length === 0;
|
|
265
|
+
const [stepState, setStep] = React.useState("home");
|
|
266
|
+
const step = single ? steps[0] : stepState;
|
|
267
|
+
const [query, setQuery] = React.useState("");
|
|
268
|
+
const [soFar, setSoFar] = React.useState(() => {
|
|
269
|
+
const p = periods.find((x) => x.from === initial.from);
|
|
270
|
+
if (p && p.toSoFar != null && initial.to === p.toSoFar) return true;
|
|
271
|
+
if (p && initial.to === p.to) return false;
|
|
272
|
+
return defaultSoFar;
|
|
273
|
+
});
|
|
274
|
+
const [viewPick, setViewPick] = React.useState(
|
|
275
|
+
viewProp === "auto" ? null : viewProp
|
|
276
|
+
);
|
|
277
|
+
const [anchor, setAnchor] = React.useState(null);
|
|
278
|
+
const clockDrag = React.useRef(null);
|
|
279
|
+
const [rulerWidth, setRulerWidth] = React.useState(0);
|
|
280
|
+
const [calView, setCalView] = React.useState(null);
|
|
281
|
+
const [error, setError] = React.useState(null);
|
|
282
|
+
const parsed = React.useMemo(() => parseTimeRange(from, to, ctx), [from, to, ctx]);
|
|
283
|
+
const draft = parsed.ok ? parsed.value : null;
|
|
284
|
+
const lastGood = React.useRef(null);
|
|
285
|
+
if (draft) {
|
|
286
|
+
const r = resolveDateValue(draft, ctx);
|
|
287
|
+
if (r.from != null && r.to != null) lastGood.current = { from: r.from, to: r.to };
|
|
288
|
+
}
|
|
289
|
+
const shown = lastGood.current ?? { from: now - 6 * HOUR_MS, to: now };
|
|
290
|
+
const live = to.trim() === "now";
|
|
291
|
+
const dirty = from !== (initial.from || "now-6h") || to !== (initial.to || "now");
|
|
292
|
+
const apply = () => {
|
|
293
|
+
const r = parseTimeRange(from, to, ctx);
|
|
294
|
+
if (!r.ok) {
|
|
295
|
+
setError({ field: r.field, message: r.message });
|
|
296
|
+
setStep("custom");
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
setError(null);
|
|
300
|
+
onApply(r.value);
|
|
301
|
+
};
|
|
302
|
+
const fill = (next, keep = {}) => {
|
|
303
|
+
setFrom(next.from);
|
|
304
|
+
setTo(next.to);
|
|
305
|
+
setError(null);
|
|
306
|
+
if (!keep.command) setCommand("");
|
|
307
|
+
if (!keep.view) {
|
|
308
|
+
setViewPick(viewProp === "auto" ? null : viewProp);
|
|
309
|
+
setCalView(null);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const pick = (next, keep) => {
|
|
313
|
+
if (applyMode === "instant") {
|
|
314
|
+
const r = parseTimeRange(next.from, next.to, ctx);
|
|
315
|
+
if (r.ok) {
|
|
316
|
+
onApply(r.value);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
setAnchor(null);
|
|
321
|
+
fill(next, keep);
|
|
322
|
+
};
|
|
323
|
+
const chip = (key, on, text, onPress, a11y) => (
|
|
324
|
+
// Chip sm with the state-selected fill: the label keeps its weight, so it
|
|
325
|
+
// never changes width on tap (F49).
|
|
326
|
+
/* @__PURE__ */ jsx(
|
|
327
|
+
Chip,
|
|
328
|
+
{
|
|
329
|
+
variant: "filter",
|
|
330
|
+
size: "sm",
|
|
331
|
+
selected: on,
|
|
332
|
+
onSelectedChange: () => onPress(),
|
|
333
|
+
accessibilityLabel: a11y,
|
|
334
|
+
children: text
|
|
335
|
+
},
|
|
336
|
+
key
|
|
337
|
+
)
|
|
338
|
+
);
|
|
339
|
+
const sheetRow = (key, on, title, onPress, leading) => optionStyle === "radio" && on != null && !leading ? /* @__PURE__ */ jsx(TimeRangeOptionRow, { title, selected: on, onPress }, key) : /* @__PURE__ */ jsx(
|
|
340
|
+
ListRow,
|
|
341
|
+
{
|
|
342
|
+
platform: android ? "android" : "ios",
|
|
343
|
+
title,
|
|
344
|
+
selected: on ?? void 0,
|
|
345
|
+
onPress,
|
|
346
|
+
leading: leading ?? (android && on != null ? /* @__PURE__ */ jsx(View, { style: [styles.radio, on && styles.radioOn], children: on ? /* @__PURE__ */ jsx(View, { style: styles.radioDot }) : null }) : void 0),
|
|
347
|
+
trailing: !android && on ? /* @__PURE__ */ jsx(Icon, { name: "check", size: theme.icon.sm, color: theme.color.accentStrong }) : void 0
|
|
348
|
+
},
|
|
349
|
+
key
|
|
350
|
+
);
|
|
351
|
+
const commandEnds = command.trim() ? readCommand(command, ctx) : null;
|
|
352
|
+
const commandBad = command.trim() !== "" && !commandEnds;
|
|
353
|
+
const commandBox = /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
|
|
354
|
+
/* @__PURE__ */ jsx(
|
|
355
|
+
Input,
|
|
356
|
+
{
|
|
357
|
+
size: "sm",
|
|
358
|
+
surface,
|
|
359
|
+
leadingIcon: "search",
|
|
360
|
+
autoCapitalize: "none",
|
|
361
|
+
autoCorrect: false,
|
|
362
|
+
accessibilityLabel: labels.command,
|
|
363
|
+
placeholder: labels.commandPlaceholder,
|
|
364
|
+
value: command,
|
|
365
|
+
error: commandBad,
|
|
366
|
+
onChangeText: (text) => {
|
|
367
|
+
setCommand(text);
|
|
368
|
+
const ends = readCommand(text, ctx);
|
|
369
|
+
if (ends) {
|
|
370
|
+
setAnchor(null);
|
|
371
|
+
fill(ends, { command: true });
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
onSubmitEditing: () => {
|
|
375
|
+
if (commandEnds) apply();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
commandBad ? /* @__PURE__ */ jsx(Text, { style: styles.statusBad, children: labels.notARange }) : draft ? /* @__PURE__ */ jsxs(View, { style: styles.status, children: [
|
|
380
|
+
/* @__PURE__ */ jsx(Icon, { name: "check", size: theme.icon.xs, color: theme.color.accent }),
|
|
381
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.statusText, children: valueLabel(draft, ctx) })
|
|
382
|
+
] }) : null
|
|
383
|
+
] });
|
|
384
|
+
const ladderCols = Math.max(...units.map((r) => r.counts.length), 1);
|
|
385
|
+
const ladder = /* @__PURE__ */ jsx(View, { style: styles.group, children: units.map((row) => {
|
|
386
|
+
const code = UNIT_CODE[row.unit];
|
|
387
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.unitRow, children: [
|
|
388
|
+
/* @__PURE__ */ jsx(Text, { style: styles.unitName, children: labels.unitRow(row.unit) }),
|
|
389
|
+
/* @__PURE__ */ jsx(View, { style: styles.chips, children: Array.from({ length: ladderCols }, (_, i) => {
|
|
390
|
+
const n = row.counts[i];
|
|
391
|
+
if (n == null) return /* @__PURE__ */ jsx(View, { style: styles.cell }, `gap-${i}`);
|
|
392
|
+
const ends = { from: `now-${n}${code}`, to: "now" };
|
|
393
|
+
return /* @__PURE__ */ jsx(View, { style: styles.cell, children: chip(
|
|
394
|
+
n,
|
|
395
|
+
from === ends.from && to === ends.to,
|
|
396
|
+
n.toLocaleString(ctx.locale),
|
|
397
|
+
() => pick(ends),
|
|
398
|
+
dateLabels.lastN(n, row.unit)
|
|
399
|
+
) }, n);
|
|
400
|
+
}) })
|
|
401
|
+
] }, row.unit);
|
|
402
|
+
}) });
|
|
403
|
+
const hasSoFar = periods.some((p) => p.toSoFar != null);
|
|
404
|
+
const periodEnds = (p, on) => ({
|
|
405
|
+
from: p.from,
|
|
406
|
+
to: on && p.toSoFar != null ? p.toSoFar : p.to
|
|
407
|
+
});
|
|
408
|
+
const activePeriod = periods.find((p) => from === p.from && (to === p.to || to === p.toSoFar));
|
|
409
|
+
const periodList = /* @__PURE__ */ jsxs(View, { children: [
|
|
410
|
+
periods.map((p) => {
|
|
411
|
+
const ends = periodEnds(p, soFar);
|
|
412
|
+
const on = from === ends.from && to === ends.to;
|
|
413
|
+
return sheetRow(p.id, on, labels.periodNames[p.id] ?? p.label ?? p.id, () => pick(ends));
|
|
414
|
+
}),
|
|
415
|
+
hasSoFar ? /* @__PURE__ */ jsxs(View, { style: styles.soFar, children: [
|
|
416
|
+
/* @__PURE__ */ jsx(Text, { style: styles.rowText, children: labels.soFar }),
|
|
417
|
+
/* @__PURE__ */ jsx(
|
|
418
|
+
Switch,
|
|
419
|
+
{
|
|
420
|
+
size: "sm",
|
|
421
|
+
accessibilityLabel: labels.soFar,
|
|
422
|
+
value: soFar,
|
|
423
|
+
onValueChange: (on) => {
|
|
424
|
+
setSoFar(on);
|
|
425
|
+
if (activePeriod) fill(periodEnds(activePeriod, on), { view: true });
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
] }) : null
|
|
430
|
+
] });
|
|
431
|
+
const recentList = /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
|
|
432
|
+
/* @__PURE__ */ jsx(Text, { role: "heading", style: styles.partLabel, children: labels.recentlyUsed }),
|
|
433
|
+
/* @__PURE__ */ jsx(View, { accessibilityRole: "list", children: recentShown.map(
|
|
434
|
+
(r, i) => sheetRow(
|
|
435
|
+
i,
|
|
436
|
+
null,
|
|
437
|
+
timeRangeLabel(r, ctx),
|
|
438
|
+
() => pick(timeRangeText(r, ctx)),
|
|
439
|
+
/* @__PURE__ */ jsx(Icon, { name: "clock", size: theme.icon.sm, color: theme.color.text3 })
|
|
440
|
+
)
|
|
441
|
+
) })
|
|
442
|
+
] });
|
|
443
|
+
const selected = value?.kind === "expression" ? findTimeRangeOption(value, options) : null;
|
|
444
|
+
const quickList = () => {
|
|
445
|
+
const q = query.trim().toLowerCase();
|
|
446
|
+
const rows = options.filter(
|
|
447
|
+
(o) => !q || o.label.toLowerCase().includes(q) || quickRangeLabel(o, dateLabels).toLowerCase().includes(q) || o.from.toLowerCase().includes(q)
|
|
448
|
+
).map((o) => ({
|
|
449
|
+
key: `${o.from}|${o.to}`,
|
|
450
|
+
name: o.label,
|
|
451
|
+
label: quickRangeLabel(o, dateLabels),
|
|
452
|
+
option: o
|
|
453
|
+
}));
|
|
454
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
|
|
455
|
+
/* @__PURE__ */ jsx(
|
|
456
|
+
Input,
|
|
457
|
+
{
|
|
458
|
+
size: "sm",
|
|
459
|
+
surface,
|
|
460
|
+
leadingIcon: "search",
|
|
461
|
+
autoCapitalize: "none",
|
|
462
|
+
autoCorrect: false,
|
|
463
|
+
accessibilityLabel: labels.searchRanges(labels.quickRangeList),
|
|
464
|
+
placeholder: labels.searchRanges(labels.quickRangeList),
|
|
465
|
+
value: query,
|
|
466
|
+
onChangeText: setQuery
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
/* @__PURE__ */ jsx(View, { accessibilityRole: "list", children: rows.length === 0 ? /* @__PURE__ */ jsx(Text, { style: styles.empty, children: labels.noRangeMatches(query.trim()) }) : rows.map((row) => {
|
|
470
|
+
const on = selected?.label === row.name;
|
|
471
|
+
return sheetRow(row.key, on, row.label, () => {
|
|
472
|
+
const v = timeRangeValue(row.option);
|
|
473
|
+
if (applyMode === "instant") onApply(v);
|
|
474
|
+
else pick(timeRangeText(v, ctx));
|
|
475
|
+
});
|
|
476
|
+
}) })
|
|
477
|
+
] });
|
|
478
|
+
};
|
|
479
|
+
const offered = views.length > 0 ? views : TIME_RANGE_VIEWS;
|
|
480
|
+
const auto = autoView(shown.from, shown.to, Z);
|
|
481
|
+
const mode = viewPick && offered.includes(viewPick) ? viewPick : offered.includes(auto) ? auto : offered[0];
|
|
482
|
+
const todayStart = Z.startOfDay(now);
|
|
483
|
+
const lastDay = Z.startOfDay(shown.to - 1);
|
|
484
|
+
const clockRange = (a, b) => {
|
|
485
|
+
let lo = Math.min(a, b);
|
|
486
|
+
let hi = Math.max(a, b);
|
|
487
|
+
if (!allowFuture) hi = Math.min(hi, now);
|
|
488
|
+
if (hi - lo < QUARTER_MS) lo = hi - QUARTER_MS;
|
|
489
|
+
fill(
|
|
490
|
+
{
|
|
491
|
+
from: formatDateMathInstant(Z, lo),
|
|
492
|
+
to: hi >= now ? "now" : formatDateMathInstant(Z, hi)
|
|
493
|
+
},
|
|
494
|
+
{ view: true }
|
|
495
|
+
);
|
|
496
|
+
setViewPick("clock");
|
|
497
|
+
};
|
|
498
|
+
const clock = () => {
|
|
499
|
+
const anchorAt = shown.to > now - DAY_MS ? Math.max(now, shown.to) : shown.to;
|
|
500
|
+
const w = Z.wall(anchorAt);
|
|
501
|
+
const end = clockDrag.current?.end ?? Z.ms(w.y, w.mo, w.d, w.h) + (w.mi || w.s ? HOUR_MS : 0);
|
|
502
|
+
const start = end - DAY_MS;
|
|
503
|
+
const pct = (t) => Math.max(0, Math.min(100, (t - start) / DAY_MS * 100));
|
|
504
|
+
const snap = (t) => start + Math.round((t - start) / QUARTER_MS) * QUARTER_MS;
|
|
505
|
+
const ticks = [];
|
|
506
|
+
for (let i = 1; i < 24; i++) {
|
|
507
|
+
const t = start + i * HOUR_MS;
|
|
508
|
+
const tw = Z.wall(t);
|
|
509
|
+
if (tw.mi === 0 && tw.h % 6 === 0)
|
|
510
|
+
ticks.push({ at: pct(t), text: pad2(tw.h), midnight: tw.h === 0 });
|
|
511
|
+
}
|
|
512
|
+
const end2 = (ms) => `${dayLabel(Z, ms, { noYear: true, locale: ctx.locale })}, ${timeLabel(Z, ms, ampm, false, dateLabels)}`;
|
|
513
|
+
const oneDay = shown.to - shown.from <= DAY_MS && Z.dayKey(shown.from) === Z.dayKey(shown.to - 1);
|
|
514
|
+
const endText = (ms) => oneDay ? timeLabel(Z, ms, ampm, false, dateLabels) : end2(ms);
|
|
515
|
+
const at = (pageX, left) => {
|
|
516
|
+
let f = rulerWidth > 0 ? Math.max(0, Math.min(1, (pageX - left) / rulerWidth)) : 0;
|
|
517
|
+
if (I18nManager.isRTL) f = 1 - f;
|
|
518
|
+
return snap(start + f * DAY_MS);
|
|
519
|
+
};
|
|
520
|
+
const onGrant = (e) => {
|
|
521
|
+
const { pageX, locationX } = e.nativeEvent;
|
|
522
|
+
const left = pageX - locationX;
|
|
523
|
+
const t = at(pageX, left);
|
|
524
|
+
const near = HOUR_MS * 44 / Math.max(120, rulerWidth);
|
|
525
|
+
const fixed = Math.abs(t - shown.to) <= near ? shown.from : Math.abs(t - shown.from) <= near ? shown.to : t;
|
|
526
|
+
clockDrag.current = { fixed, end, left };
|
|
527
|
+
clockRange(fixed, fixed === t ? t + QUARTER_MS : t);
|
|
528
|
+
};
|
|
529
|
+
const onMove = (e) => {
|
|
530
|
+
const d = clockDrag.current;
|
|
531
|
+
if (d) clockRange(d.fixed, at(e.nativeEvent.pageX, d.left));
|
|
532
|
+
};
|
|
533
|
+
const onEnd = () => {
|
|
534
|
+
clockDrag.current = null;
|
|
535
|
+
};
|
|
536
|
+
const move = (which, by) => {
|
|
537
|
+
if (which === "from")
|
|
538
|
+
clockRange(Math.min(snap(shown.from + by), shown.to - QUARTER_MS), shown.to);
|
|
539
|
+
else clockRange(shown.from, Math.max(snap(shown.to + by), shown.from + QUARTER_MS));
|
|
540
|
+
};
|
|
541
|
+
const nudge = (which) => (e) => move(which, e.nativeEvent.actionName === "increment" ? QUARTER_MS : -QUARTER_MS);
|
|
542
|
+
const keys = (which) => ({
|
|
543
|
+
onKeyDown: (e) => {
|
|
544
|
+
const step2 = (e.shiftKey ? HOUR_MS : QUARTER_MS) * (I18nManager.isRTL ? -1 : 1);
|
|
545
|
+
const by = e.key === "ArrowRight" || e.key === "ArrowUp" ? step2 : e.key === "ArrowLeft" || e.key === "ArrowDown" ? -step2 : 0;
|
|
546
|
+
if (!by) return;
|
|
547
|
+
e.preventDefault();
|
|
548
|
+
move(which, by);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
const handle = (which) => {
|
|
552
|
+
const t = which === "from" ? shown.from : shown.to;
|
|
553
|
+
if (t < start) return null;
|
|
554
|
+
return /* @__PURE__ */ jsx(
|
|
555
|
+
View,
|
|
556
|
+
{
|
|
557
|
+
accessible: true,
|
|
558
|
+
accessibilityRole: "adjustable",
|
|
559
|
+
accessibilityLabel: `${labels.preview}: ${which === "from" ? labels.from : labels.to}`,
|
|
560
|
+
accessibilityValue: { text: which === "to" && live ? labels.now : end2(t) },
|
|
561
|
+
"aria-valuemin": 0,
|
|
562
|
+
"aria-valuemax": 100,
|
|
563
|
+
"aria-valuenow": Math.round(pct(t)),
|
|
564
|
+
accessibilityActions: [{ name: "increment" }, { name: "decrement" }],
|
|
565
|
+
onAccessibilityAction: nudge(which),
|
|
566
|
+
focusable: true,
|
|
567
|
+
...keys(which),
|
|
568
|
+
pointerEvents: "none",
|
|
569
|
+
style: [styles.handle, { start: `${pct(t)}%` }],
|
|
570
|
+
children: /* @__PURE__ */ jsx(View, { style: styles.handleGrip })
|
|
571
|
+
},
|
|
572
|
+
which
|
|
573
|
+
);
|
|
574
|
+
};
|
|
575
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
|
|
576
|
+
/* @__PURE__ */ jsxs(
|
|
577
|
+
Text,
|
|
578
|
+
{
|
|
579
|
+
accessibilityLabel: labels.timeRangeTo(
|
|
580
|
+
end2(shown.from),
|
|
581
|
+
live ? labels.now : end2(shown.to)
|
|
582
|
+
),
|
|
583
|
+
style: [styles.bigTime, !oneDay && styles.bigTimeDays],
|
|
584
|
+
children: [
|
|
585
|
+
endText(shown.from),
|
|
586
|
+
/* @__PURE__ */ jsx(Text, { style: styles.arrow, children: " \u2192 " }),
|
|
587
|
+
live ? labels.now : endText(shown.to)
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ jsxs(View, { children: [
|
|
592
|
+
/* @__PURE__ */ jsxs(
|
|
593
|
+
View,
|
|
594
|
+
{
|
|
595
|
+
onLayout: (e) => setRulerWidth(e.nativeEvent.layout.width),
|
|
596
|
+
onStartShouldSetResponder: () => true,
|
|
597
|
+
onMoveShouldSetResponder: () => true,
|
|
598
|
+
onResponderTerminationRequest: () => false,
|
|
599
|
+
onResponderGrant: onGrant,
|
|
600
|
+
onResponderMove: onMove,
|
|
601
|
+
onResponderRelease: onEnd,
|
|
602
|
+
onResponderTerminate: onEnd,
|
|
603
|
+
style: styles.rulerTouch,
|
|
604
|
+
children: [
|
|
605
|
+
/* @__PURE__ */ jsxs(View, { pointerEvents: "none", style: styles.ruler, children: [
|
|
606
|
+
ticks.map((t) => /* @__PURE__ */ jsx(
|
|
607
|
+
View,
|
|
608
|
+
{
|
|
609
|
+
style: [styles.tick, t.midnight && styles.tickMidnight, { start: `${t.at}%` }]
|
|
610
|
+
},
|
|
611
|
+
t.at
|
|
612
|
+
)),
|
|
613
|
+
/* @__PURE__ */ jsx(
|
|
614
|
+
View,
|
|
615
|
+
{
|
|
616
|
+
style: [
|
|
617
|
+
styles.band,
|
|
618
|
+
shown.from < start && styles.bandClipped,
|
|
619
|
+
{ start: `${pct(shown.from)}%`, width: `${pct(shown.to) - pct(shown.from)}%` }
|
|
620
|
+
]
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
!live && now >= start && now <= end ? /* @__PURE__ */ jsx(View, { style: [styles.nowMark, { start: `${pct(now)}%` }] }) : null
|
|
624
|
+
] }),
|
|
625
|
+
handle("from"),
|
|
626
|
+
handle("to")
|
|
627
|
+
]
|
|
628
|
+
}
|
|
629
|
+
),
|
|
630
|
+
/* @__PURE__ */ jsx(
|
|
631
|
+
View,
|
|
632
|
+
{
|
|
633
|
+
...{ "aria-hidden": true },
|
|
634
|
+
importantForAccessibility: "no-hide-descendants",
|
|
635
|
+
style: styles.tickLabels,
|
|
636
|
+
children: ticks.map((t) => /* @__PURE__ */ jsx(Text, { style: [styles.tickText, { start: `${t.at}%` }], children: t.text }, t.at))
|
|
637
|
+
}
|
|
638
|
+
)
|
|
639
|
+
] }),
|
|
640
|
+
/* @__PURE__ */ jsx(Text, { style: styles.empty, children: labels.clockHint })
|
|
641
|
+
] });
|
|
642
|
+
};
|
|
643
|
+
const pickDay = (ms) => {
|
|
644
|
+
const d = Z.startOfDay(ms);
|
|
645
|
+
if (anchor == null) {
|
|
646
|
+
setAnchor(d);
|
|
647
|
+
fill({ from: dayText(Z, d), to: dayText(Z, d) }, { view: true });
|
|
648
|
+
setViewPick("calendar");
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const lo = Math.min(anchor, d);
|
|
652
|
+
const hi = Math.max(anchor, d);
|
|
653
|
+
setAnchor(null);
|
|
654
|
+
fill({ from: dayText(Z, lo), to: dayText(Z, hi) }, { view: true });
|
|
655
|
+
setViewPick("calendar");
|
|
656
|
+
};
|
|
657
|
+
const month = calView ?? Z.startOfMonth(lastDay);
|
|
658
|
+
const lastMonth = allowFuture ? null : Z.startOfMonth(now);
|
|
659
|
+
const navButton = (dir) => {
|
|
660
|
+
const off = dir > 0 && lastMonth != null && month >= lastMonth;
|
|
661
|
+
return /* @__PURE__ */ jsx(
|
|
662
|
+
Pressable,
|
|
663
|
+
{
|
|
664
|
+
accessibilityRole: "button",
|
|
665
|
+
accessibilityLabel: dir < 0 ? labels.previousMonth : labels.nextMonth,
|
|
666
|
+
accessibilityState: { disabled: off },
|
|
667
|
+
disabled: off,
|
|
668
|
+
onPress: () => setCalView(Z.addMonths(month, dir)),
|
|
669
|
+
style: ({ pressed }) => [styles.nav, off && styles.off, pressed && styles.pressed],
|
|
670
|
+
children: /* @__PURE__ */ jsx(
|
|
671
|
+
Icon,
|
|
672
|
+
{
|
|
673
|
+
name: dir < 0 ? "chevron-left" : "chevron-right",
|
|
674
|
+
size: theme.icon.sm,
|
|
675
|
+
color: theme.color.text2
|
|
676
|
+
}
|
|
677
|
+
)
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
};
|
|
681
|
+
const calendar = () => /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
|
|
682
|
+
/* @__PURE__ */ jsxs(View, { style: styles.navRow, children: [
|
|
683
|
+
navButton(-1),
|
|
684
|
+
navButton(1)
|
|
685
|
+
] }),
|
|
686
|
+
/* @__PURE__ */ jsx(
|
|
687
|
+
MonthList,
|
|
688
|
+
{
|
|
689
|
+
Z,
|
|
690
|
+
anchorMs: month,
|
|
691
|
+
radius: 0,
|
|
692
|
+
ctx,
|
|
693
|
+
from: anchor ?? Z.startOfDay(shown.from),
|
|
694
|
+
to: anchor != null ? null : Z.addDays(lastDay, 1),
|
|
695
|
+
constraints: allowFuture ? void 0 : { disableFuture: true },
|
|
696
|
+
onPick: pickDay
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
/* @__PURE__ */ jsx(Text, { style: styles.empty, children: anchor != null ? labels.calendarHintEnd : labels.calendarHint })
|
|
700
|
+
] });
|
|
701
|
+
const year = () => {
|
|
702
|
+
const names = localeNames(ctx.locale);
|
|
703
|
+
const endMonth = Z.startOfMonth(lastDay);
|
|
704
|
+
const cells = [];
|
|
705
|
+
for (let i = 11; i >= 0; i--) {
|
|
706
|
+
const s = Z.addMonths(endMonth, -i);
|
|
707
|
+
const e = Z.addMonths(s, 1);
|
|
708
|
+
const sw = Z.wall(s);
|
|
709
|
+
const overlap = Math.max(0, Math.min(e, shown.to) - Math.max(s, shown.from));
|
|
710
|
+
const fillPct = Math.round(overlap / (e - s) * 100);
|
|
711
|
+
const future = !allowFuture && s > now;
|
|
712
|
+
const lastPick = allowFuture ? Z.addDays(e, -1) : Math.min(Z.addDays(e, -1), todayStart);
|
|
713
|
+
const ends = { from: dayText(Z, s), to: dayText(Z, lastPick) };
|
|
714
|
+
const on = from === ends.from && to === ends.to;
|
|
715
|
+
cells.push(
|
|
716
|
+
/* @__PURE__ */ jsxs(
|
|
717
|
+
Pressable,
|
|
718
|
+
{
|
|
719
|
+
accessibilityRole: "button",
|
|
720
|
+
accessibilityLabel: `${names.months[sw.mo]} ${sw.y}`,
|
|
721
|
+
accessibilityState: { disabled: future, selected: on },
|
|
722
|
+
...{ "aria-pressed": on },
|
|
723
|
+
disabled: future,
|
|
724
|
+
onPress: () => {
|
|
725
|
+
setAnchor(null);
|
|
726
|
+
fill(ends, { view: true });
|
|
727
|
+
},
|
|
728
|
+
style: ({ pressed }) => [
|
|
729
|
+
styles.monthCell,
|
|
730
|
+
future && styles.off,
|
|
731
|
+
pressed && styles.pressed
|
|
732
|
+
],
|
|
733
|
+
children: [
|
|
734
|
+
/* @__PURE__ */ jsx(Text, { style: styles.monthName, children: names.abbr[sw.mo] }),
|
|
735
|
+
/* @__PURE__ */ jsx(View, { style: styles.monthBar, children: /* @__PURE__ */ jsx(View, { style: [styles.monthFill, { height: `${fillPct}%` }] }) }),
|
|
736
|
+
/* @__PURE__ */ jsx(Text, { style: styles.monthYear, children: sw.mo === 0 || i === 11 ? sw.y : "" })
|
|
737
|
+
]
|
|
738
|
+
},
|
|
739
|
+
s
|
|
740
|
+
)
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
return /* @__PURE__ */ jsx(View, { style: styles.yearGrid, children: cells });
|
|
744
|
+
};
|
|
745
|
+
const preview = /* @__PURE__ */ jsxs(View, { accessibilityLabel: labels.preview, style: styles.group, children: [
|
|
746
|
+
/* @__PURE__ */ jsxs(View, { style: styles.headingRow, children: [
|
|
747
|
+
offered.length > 1 ? /* @__PURE__ */ jsx(
|
|
748
|
+
SegmentedControl,
|
|
749
|
+
{
|
|
750
|
+
size: "sm",
|
|
751
|
+
accessibilityLabel: labels.viewSwitch,
|
|
752
|
+
items: offered.map((v) => ({ value: v, label: labels.viewNames[v] })),
|
|
753
|
+
value: mode,
|
|
754
|
+
onValueChange: (v) => setViewPick(v)
|
|
755
|
+
}
|
|
756
|
+
) : null,
|
|
757
|
+
/* @__PURE__ */ jsx(Text, { style: styles.duration, children: durationLabel(shown.from, shown.to, dateLabels) })
|
|
758
|
+
] }),
|
|
759
|
+
mode === "clock" ? clock() : mode === "calendar" ? calendar() : year()
|
|
760
|
+
] });
|
|
761
|
+
const field = (side) => /* @__PURE__ */ jsxs(View, { style: styles.field, children: [
|
|
762
|
+
/* @__PURE__ */ jsx(Text, { style: styles.partLabel, children: side === "from" ? labels.from : labels.to }),
|
|
763
|
+
/* @__PURE__ */ jsx(
|
|
764
|
+
Input,
|
|
765
|
+
{
|
|
766
|
+
size: "sm",
|
|
767
|
+
surface,
|
|
768
|
+
autoCapitalize: "none",
|
|
769
|
+
autoCorrect: false,
|
|
770
|
+
accessibilityLabel: side === "from" ? labels.from : labels.to,
|
|
771
|
+
value: side === "from" ? from : to,
|
|
772
|
+
error: error?.field === side,
|
|
773
|
+
onChangeText: (t) => {
|
|
774
|
+
(side === "from" ? setFrom : setTo)(t);
|
|
775
|
+
setCommand("");
|
|
776
|
+
setAnchor(null);
|
|
777
|
+
if (error?.field === side) setError(null);
|
|
778
|
+
},
|
|
779
|
+
onSubmitEditing: apply
|
|
780
|
+
}
|
|
781
|
+
)
|
|
782
|
+
] }, side);
|
|
783
|
+
const inLadder = units.some(
|
|
784
|
+
(row) => row.counts.some((n) => from === `now-${n}${UNIT_CODE[row.unit]}` && to === "now")
|
|
785
|
+
);
|
|
786
|
+
const holder = !draft ? null : inLadder && steps.includes("relative") ? "relative" : activePeriod && steps.includes("periods") ? "periods" : steps.includes("custom") ? "custom" : null;
|
|
787
|
+
const home = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
788
|
+
part.command ? commandBox : null,
|
|
789
|
+
steps.length > 0 ? /* @__PURE__ */ jsx(View, { children: steps.map((s) => {
|
|
790
|
+
const on = holder === s;
|
|
791
|
+
return /* @__PURE__ */ jsx(
|
|
792
|
+
ListRow,
|
|
793
|
+
{
|
|
794
|
+
platform: android ? "android" : "ios",
|
|
795
|
+
onPress: () => setStep(s),
|
|
796
|
+
chevron: true,
|
|
797
|
+
accessibilityLabel: labels.stepNames[s],
|
|
798
|
+
leading: /* @__PURE__ */ jsx(View, { style: [styles.stepIcon, on && styles.stepIconOn], children: /* @__PURE__ */ jsx(
|
|
799
|
+
Icon,
|
|
800
|
+
{
|
|
801
|
+
name: STEP_ICON[s],
|
|
802
|
+
size: theme.icon.sm,
|
|
803
|
+
color: on ? theme.color.accentStrong : theme.color.text2
|
|
804
|
+
}
|
|
805
|
+
) }),
|
|
806
|
+
title: labels.stepNames[s],
|
|
807
|
+
subtitle: (
|
|
808
|
+
// A plain string takes ListRow's own themed ink; a bare `Text` here
|
|
809
|
+
// would fall back to the platform's black.
|
|
810
|
+
on && draft ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.stepHintOn, children: timeRangeLabel(draft, ctx) }) : labels.stepHints[s]
|
|
811
|
+
)
|
|
812
|
+
},
|
|
813
|
+
s
|
|
814
|
+
);
|
|
815
|
+
}) }) : null,
|
|
816
|
+
recentShown.length > 0 ? recentList : null,
|
|
817
|
+
children
|
|
818
|
+
] });
|
|
819
|
+
const [zoneOpen, setZoneOpen] = React.useState(false);
|
|
820
|
+
const [announced, setAnnounced] = React.useState("");
|
|
821
|
+
const copy = async () => {
|
|
822
|
+
try {
|
|
823
|
+
const board = getClipboard();
|
|
824
|
+
if (!board) throw new Error("no clipboard");
|
|
825
|
+
await board.writeText(JSON.stringify({ from, to }));
|
|
826
|
+
onNotify?.({ text: labels.copied, tone: "good" });
|
|
827
|
+
} catch {
|
|
828
|
+
onNotify?.({ text: labels.clipboardUnavailable, tone: "danger" });
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
const paste = async () => {
|
|
832
|
+
let text;
|
|
833
|
+
try {
|
|
834
|
+
const board = getClipboard();
|
|
835
|
+
if (!board) throw new Error("no clipboard");
|
|
836
|
+
text = await board.readText();
|
|
837
|
+
} catch {
|
|
838
|
+
onNotify?.({ text: labels.clipboardUnavailable, tone: "danger" });
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
const range = readRangeText(text);
|
|
842
|
+
if (!range) {
|
|
843
|
+
onNotify?.({ text: labels.clipboardNoRange, tone: "danger" });
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
fill(range);
|
|
847
|
+
setAnnounced(labels.pasted(range.from, range.to));
|
|
848
|
+
};
|
|
849
|
+
const clipboard = part.clipboard ? /* @__PURE__ */ jsx(View, { style: styles.clipboard, children: [
|
|
850
|
+
["copy", labels.copyRange, copy],
|
|
851
|
+
["clipboard", labels.pasteRange, paste]
|
|
852
|
+
].map(([icon, name, run]) => /* @__PURE__ */ jsx(
|
|
853
|
+
Pressable,
|
|
854
|
+
{
|
|
855
|
+
accessibilityRole: "button",
|
|
856
|
+
accessibilityLabel: name,
|
|
857
|
+
onPress: () => void run(),
|
|
858
|
+
style: ({ pressed }) => [styles.nav, pressed && styles.pressed],
|
|
859
|
+
children: /* @__PURE__ */ jsx(Icon, { name: icon, size: theme.icon.sm, color: theme.color.text })
|
|
860
|
+
},
|
|
861
|
+
icon
|
|
862
|
+
)) }) : null;
|
|
863
|
+
const header = (title, trailing) => /* @__PURE__ */ jsxs(View, { style: styles.stepHeader, children: [
|
|
864
|
+
single ? null : /* @__PURE__ */ jsx(
|
|
865
|
+
Pressable,
|
|
866
|
+
{
|
|
867
|
+
accessibilityRole: "button",
|
|
868
|
+
accessibilityLabel: labels.back,
|
|
869
|
+
onPress: () => setStep("home"),
|
|
870
|
+
style: ({ pressed }) => [styles.nav, pressed && styles.pressed],
|
|
871
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left", size: theme.icon.sm, color: theme.color.text })
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
/* @__PURE__ */ jsx(Text, { role: "heading", numberOfLines: 1, style: styles.stepTitle, children: title }),
|
|
875
|
+
trailing
|
|
876
|
+
] });
|
|
877
|
+
const custom = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
878
|
+
header(labels.stepNames.custom, clipboard),
|
|
879
|
+
announced ? /* @__PURE__ */ jsx(Text, { accessibilityLiveRegion: "polite", style: styles.srOnly, children: announced }) : null,
|
|
880
|
+
part.preview ? preview : null,
|
|
881
|
+
part.fields ? /* @__PURE__ */ jsxs(View, { style: styles.fields, children: [
|
|
882
|
+
field("from"),
|
|
883
|
+
field("to")
|
|
884
|
+
] }) : null,
|
|
885
|
+
part.zone ? /* @__PURE__ */ jsxs(View, { style: styles.zone, children: [
|
|
886
|
+
/* @__PURE__ */ jsx(Icon, { name: "globe", size: theme.icon.xs, color: theme.color.text3 }),
|
|
887
|
+
/* @__PURE__ */ jsx(Text, { style: styles.zoneText, children: zoneLabel(Z, now) }),
|
|
888
|
+
onTimezoneChange ? /* @__PURE__ */ jsx(
|
|
889
|
+
Pressable,
|
|
890
|
+
{
|
|
891
|
+
accessibilityRole: "button",
|
|
892
|
+
accessibilityLabel: zoneOpen ? labels.hideSettings : labels.changeSettings,
|
|
893
|
+
accessibilityState: { expanded: zoneOpen },
|
|
894
|
+
onPress: () => setZoneOpen((o) => !o),
|
|
895
|
+
style: ({ pressed }) => [styles.nav, pressed && styles.pressed],
|
|
896
|
+
children: /* @__PURE__ */ jsx(
|
|
897
|
+
Icon,
|
|
898
|
+
{
|
|
899
|
+
name: zoneOpen ? "chevron-up" : "chevron-down",
|
|
900
|
+
size: theme.icon.sm,
|
|
901
|
+
color: theme.color.text2
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
}
|
|
905
|
+
) : null
|
|
906
|
+
] }) : null,
|
|
907
|
+
part.zone && onTimezoneChange && zoneOpen ? /* @__PURE__ */ jsxs(View, { style: styles.zoneRow, children: [
|
|
908
|
+
/* @__PURE__ */ jsx(Text, { style: styles.partLabel, children: labels.reportIn }),
|
|
909
|
+
/* @__PURE__ */ jsx(View, { role: "group", "aria-label": labels.reportIn, style: styles.zoneChips, children: timezones.map((z) => {
|
|
910
|
+
const on = z.id === timezone;
|
|
911
|
+
return chip(z.id, on, zoneName(z, dateLabels), () => onTimezoneChange(z.id));
|
|
912
|
+
}) })
|
|
913
|
+
] }) : null
|
|
914
|
+
] });
|
|
915
|
+
const showActions = part.actions && (step === "custom" || dirty || error != null);
|
|
916
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.panel, children: [
|
|
917
|
+
step === "home" ? home : null,
|
|
918
|
+
step === "relative" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
919
|
+
header(labels.lastHeading),
|
|
920
|
+
ladder
|
|
921
|
+
] }) : null,
|
|
922
|
+
step === "periods" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
923
|
+
header(labels.periodsHeading),
|
|
924
|
+
periodList
|
|
925
|
+
] }) : null,
|
|
926
|
+
step === "quickRanges" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
927
|
+
header(labels.quickRangeList),
|
|
928
|
+
quickList()
|
|
929
|
+
] }) : null,
|
|
930
|
+
step === "custom" ? custom : null,
|
|
931
|
+
error ? /* @__PURE__ */ jsx(Text, { accessibilityRole: "alert", style: styles.error, children: error.message }) : null,
|
|
932
|
+
showActions ? /* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
|
|
933
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onPress: onCancel, children: labels.cancel }),
|
|
934
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", onPress: apply, children: labels.applyRange })
|
|
935
|
+
] }) : null
|
|
936
|
+
] });
|
|
937
|
+
}
|
|
938
|
+
var sheet = createStyleSheet((theme) => {
|
|
939
|
+
const small = {
|
|
940
|
+
fontFamily: theme.font.sans,
|
|
941
|
+
fontSize: theme.type.footnote.fontSize,
|
|
942
|
+
lineHeight: theme.type.footnote.lineHeight
|
|
943
|
+
};
|
|
944
|
+
const tiny = {
|
|
945
|
+
fontFamily: theme.font.mono,
|
|
946
|
+
fontSize: theme.type.caption2.fontSize,
|
|
947
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
948
|
+
color: theme.color.text3
|
|
949
|
+
};
|
|
950
|
+
return {
|
|
951
|
+
panel: { gap: theme.space.s5 },
|
|
952
|
+
stepIcon: {
|
|
953
|
+
width: theme.tapMin - theme.space.s2,
|
|
954
|
+
height: theme.tapMin - theme.space.s2,
|
|
955
|
+
alignItems: "center",
|
|
956
|
+
justifyContent: "center",
|
|
957
|
+
borderRadius: theme.radius.md,
|
|
958
|
+
borderWidth: theme.borderWidth.base,
|
|
959
|
+
borderColor: "transparent",
|
|
960
|
+
backgroundColor: theme.color.surface2
|
|
961
|
+
},
|
|
962
|
+
stepIconOn: { backgroundColor: theme.color.accentSoft, borderColor: theme.edge.accent },
|
|
963
|
+
stepTitle: {
|
|
964
|
+
flexShrink: 1,
|
|
965
|
+
fontFamily: theme.font.sans,
|
|
966
|
+
fontSize: theme.type.body.fontSize,
|
|
967
|
+
lineHeight: theme.type.body.lineHeight,
|
|
968
|
+
fontWeight: theme.fontWeight.semibold,
|
|
969
|
+
color: theme.color.text
|
|
970
|
+
},
|
|
971
|
+
stepHintOn: { color: theme.color.accentOnSoft },
|
|
972
|
+
stepHeader: {
|
|
973
|
+
flexDirection: "row",
|
|
974
|
+
alignItems: "center",
|
|
975
|
+
gap: theme.space.s1,
|
|
976
|
+
marginStart: -theme.space.s3
|
|
977
|
+
},
|
|
978
|
+
group: { gap: theme.space.s2 },
|
|
979
|
+
headingRow: {
|
|
980
|
+
flexDirection: "row",
|
|
981
|
+
alignItems: "center",
|
|
982
|
+
justifyContent: "space-between",
|
|
983
|
+
gap: theme.space.s2
|
|
984
|
+
},
|
|
985
|
+
partLabel: {
|
|
986
|
+
fontFamily: theme.font.sans,
|
|
987
|
+
fontSize: theme.type.caption2.fontSize,
|
|
988
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
989
|
+
fontWeight: theme.fontWeight.bold,
|
|
990
|
+
color: theme.color.text2
|
|
991
|
+
},
|
|
992
|
+
status: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
|
|
993
|
+
statusText: { ...small, flexShrink: 1, color: theme.color.text2 },
|
|
994
|
+
statusBad: { ...small, color: theme.color.dangerOnSoft },
|
|
995
|
+
unitRow: { flexDirection: "row", alignItems: "center", gap: theme.space.s2 },
|
|
996
|
+
unitName: { ...small, width: theme.space.s8 * 2, color: theme.color.text3 },
|
|
997
|
+
chips: { flex: 1, flexDirection: "row", gap: theme.space.s1 },
|
|
998
|
+
cell: { flex: 1, minWidth: 0 },
|
|
999
|
+
wrap: { flexDirection: "row", flexWrap: "wrap", gap: theme.space.s1 },
|
|
1000
|
+
soFar: {
|
|
1001
|
+
flexDirection: "row",
|
|
1002
|
+
alignItems: "center",
|
|
1003
|
+
gap: theme.space.s2,
|
|
1004
|
+
minHeight: theme.tapMin,
|
|
1005
|
+
paddingHorizontal: theme.space.s1,
|
|
1006
|
+
marginTop: theme.space.s2,
|
|
1007
|
+
borderTopWidth: theme.borderWidth.base,
|
|
1008
|
+
borderTopColor: theme.color.border
|
|
1009
|
+
},
|
|
1010
|
+
soFarText: { ...small, color: theme.color.text3 },
|
|
1011
|
+
empty: { ...small, color: theme.color.text3 },
|
|
1012
|
+
// Android's leading radio: 20 ring, 9 dot, text-3 edge, accent when chosen.
|
|
1013
|
+
radio: {
|
|
1014
|
+
width: theme.space[20],
|
|
1015
|
+
height: theme.space[20],
|
|
1016
|
+
alignItems: "center",
|
|
1017
|
+
justifyContent: "center",
|
|
1018
|
+
borderRadius: theme.radius.full,
|
|
1019
|
+
borderWidth: theme.borderWidth.heavy,
|
|
1020
|
+
borderColor: theme.color.text3
|
|
1021
|
+
},
|
|
1022
|
+
radioOn: { borderColor: theme.focus.ringColor },
|
|
1023
|
+
radioDot: {
|
|
1024
|
+
width: theme.space[9],
|
|
1025
|
+
height: theme.space[9],
|
|
1026
|
+
borderRadius: theme.radius.full,
|
|
1027
|
+
backgroundColor: theme.color.accent
|
|
1028
|
+
},
|
|
1029
|
+
optionRow: {
|
|
1030
|
+
flexDirection: "row",
|
|
1031
|
+
alignItems: "center",
|
|
1032
|
+
gap: theme.space.s3,
|
|
1033
|
+
minHeight: theme.tapMin,
|
|
1034
|
+
paddingHorizontal: theme.space.s3,
|
|
1035
|
+
borderRadius: theme.radius.md,
|
|
1036
|
+
backgroundColor: theme.color.surface
|
|
1037
|
+
},
|
|
1038
|
+
optionRowOn: { backgroundColor: theme.state.selected },
|
|
1039
|
+
optionRowPressed: { backgroundColor: theme.state.pressed },
|
|
1040
|
+
optionRadioOn: { borderColor: theme.focus.ringColor },
|
|
1041
|
+
rowText: {
|
|
1042
|
+
flex: 1,
|
|
1043
|
+
fontFamily: theme.font.sans,
|
|
1044
|
+
fontSize: theme.type.body.fontSize,
|
|
1045
|
+
lineHeight: theme.type.body.lineHeight,
|
|
1046
|
+
color: theme.color.text
|
|
1047
|
+
},
|
|
1048
|
+
duration: { ...tiny, marginStart: "auto" },
|
|
1049
|
+
bigTimeDays: { fontSize: theme.type.title3.fontSize, lineHeight: theme.type.title3.lineHeight },
|
|
1050
|
+
bigTime: {
|
|
1051
|
+
fontFamily: theme.font.mono,
|
|
1052
|
+
fontSize: theme.type.title2.fontSize,
|
|
1053
|
+
lineHeight: theme.type.title2.lineHeight,
|
|
1054
|
+
fontWeight: theme.fontWeight.bold,
|
|
1055
|
+
fontVariant: ["tabular-nums"],
|
|
1056
|
+
color: theme.color.text
|
|
1057
|
+
},
|
|
1058
|
+
arrow: { color: theme.color.text3 },
|
|
1059
|
+
rulerTouch: { justifyContent: "center", minHeight: theme.tapMin },
|
|
1060
|
+
ruler: {
|
|
1061
|
+
height: theme.space.s6,
|
|
1062
|
+
borderRadius: theme.radius.xs,
|
|
1063
|
+
backgroundColor: theme.color.surface2
|
|
1064
|
+
},
|
|
1065
|
+
tick: {
|
|
1066
|
+
position: "absolute",
|
|
1067
|
+
top: 0,
|
|
1068
|
+
bottom: 0,
|
|
1069
|
+
width: 1,
|
|
1070
|
+
backgroundColor: theme.color.border
|
|
1071
|
+
},
|
|
1072
|
+
tickMidnight: { backgroundColor: theme.color.borderStrong },
|
|
1073
|
+
band: {
|
|
1074
|
+
position: "absolute",
|
|
1075
|
+
top: 0,
|
|
1076
|
+
bottom: 0,
|
|
1077
|
+
borderRadius: theme.radius.xs,
|
|
1078
|
+
borderWidth: theme.borderWidth.base,
|
|
1079
|
+
borderColor: theme.edge.accent,
|
|
1080
|
+
backgroundColor: theme.color.accentSoft
|
|
1081
|
+
},
|
|
1082
|
+
bandClipped: { borderStartWidth: 0, borderTopStartRadius: 0, borderBottomStartRadius: 0 },
|
|
1083
|
+
nowMark: {
|
|
1084
|
+
position: "absolute",
|
|
1085
|
+
top: -theme.space.s1,
|
|
1086
|
+
bottom: -theme.space.s1,
|
|
1087
|
+
width: 1,
|
|
1088
|
+
backgroundColor: theme.color.text3
|
|
1089
|
+
},
|
|
1090
|
+
handle: {
|
|
1091
|
+
position: "absolute",
|
|
1092
|
+
top: 0,
|
|
1093
|
+
bottom: 0,
|
|
1094
|
+
width: theme.space.s4,
|
|
1095
|
+
marginStart: -theme.space.s2,
|
|
1096
|
+
alignItems: "center",
|
|
1097
|
+
justifyContent: "center"
|
|
1098
|
+
},
|
|
1099
|
+
handleGrip: {
|
|
1100
|
+
width: theme.borderWidth.heavy * 2,
|
|
1101
|
+
height: theme.space.s6 + theme.space.s2,
|
|
1102
|
+
borderRadius: theme.radius.full,
|
|
1103
|
+
backgroundColor: theme.color.accent
|
|
1104
|
+
},
|
|
1105
|
+
tickLabels: { height: theme.type.caption1.lineHeight, marginTop: theme.space.s1 },
|
|
1106
|
+
tickText: {
|
|
1107
|
+
...tiny,
|
|
1108
|
+
fontSize: theme.fontSize[12],
|
|
1109
|
+
lineHeight: theme.type.caption1.lineHeight,
|
|
1110
|
+
fontWeight: theme.fontWeight.medium,
|
|
1111
|
+
fontVariant: ["tabular-nums"],
|
|
1112
|
+
color: theme.color.text2,
|
|
1113
|
+
position: "absolute",
|
|
1114
|
+
transform: [{ translateX: -theme.space.s2 }]
|
|
1115
|
+
},
|
|
1116
|
+
navRow: { flexDirection: "row", justifyContent: "space-between" },
|
|
1117
|
+
nav: {
|
|
1118
|
+
minWidth: theme.tapMin,
|
|
1119
|
+
minHeight: theme.tapMin,
|
|
1120
|
+
alignItems: "center",
|
|
1121
|
+
justifyContent: "center"
|
|
1122
|
+
},
|
|
1123
|
+
yearGrid: { flexDirection: "row", flexWrap: "wrap", rowGap: theme.space.s2 },
|
|
1124
|
+
monthCell: {
|
|
1125
|
+
width: `${100 / 6}%`,
|
|
1126
|
+
alignItems: "stretch",
|
|
1127
|
+
gap: theme.space.s1,
|
|
1128
|
+
paddingHorizontal: theme.space.s1
|
|
1129
|
+
},
|
|
1130
|
+
monthName: {
|
|
1131
|
+
...small,
|
|
1132
|
+
textAlign: "center",
|
|
1133
|
+
fontWeight: theme.fontWeight.semibold,
|
|
1134
|
+
color: theme.color.text2
|
|
1135
|
+
},
|
|
1136
|
+
monthBar: {
|
|
1137
|
+
height: theme.space.s8,
|
|
1138
|
+
overflow: "hidden",
|
|
1139
|
+
justifyContent: "flex-end",
|
|
1140
|
+
borderRadius: theme.radius.xs,
|
|
1141
|
+
backgroundColor: theme.color.surface2
|
|
1142
|
+
},
|
|
1143
|
+
monthFill: { backgroundColor: theme.color.accent },
|
|
1144
|
+
monthYear: { ...tiny, textAlign: "center" },
|
|
1145
|
+
fields: { flexDirection: "row", gap: theme.space.s2 },
|
|
1146
|
+
field: { flex: 1, gap: theme.space.s1 },
|
|
1147
|
+
error: { ...small, color: theme.color.dangerOnSoft },
|
|
1148
|
+
actions: { flexDirection: "row", justifyContent: "flex-end", gap: theme.space.s2 },
|
|
1149
|
+
off: { opacity: theme.state.disabledOpacity },
|
|
1150
|
+
pressed: { opacity: theme.state.pressedOpacity },
|
|
1151
|
+
zone: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
|
|
1152
|
+
zoneRow: { gap: theme.space.s1 },
|
|
1153
|
+
zoneChips: { flexDirection: "row", flexWrap: "wrap", gap: theme.space.s1 },
|
|
1154
|
+
srOnly: { position: "absolute", width: theme.space[1], height: theme.space[1], opacity: 0 },
|
|
1155
|
+
clipboard: { marginStart: "auto", flexDirection: "row" },
|
|
1156
|
+
zoneText: {
|
|
1157
|
+
fontFamily: theme.font.sans,
|
|
1158
|
+
fontSize: theme.type.caption2.fontSize,
|
|
1159
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
1160
|
+
color: theme.color.text3
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
});
|
|
1164
|
+
var REFRESH_INTERVALS = ["10s", "30s", "1m", "5m", "15m", "1h"];
|
|
1165
|
+
var INTERVAL_UNIT = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
1166
|
+
function refreshIntervalMs(interval) {
|
|
1167
|
+
const m = /^(\d+)([smhd])$/.exec(interval ?? "");
|
|
1168
|
+
if (!m) return null;
|
|
1169
|
+
const ms = Number(m[1]) * INTERVAL_UNIT[m[2]];
|
|
1170
|
+
return ms > 0 ? ms : null;
|
|
1171
|
+
}
|
|
1172
|
+
function useRefreshTimer(ms, paused, onTick) {
|
|
1173
|
+
const [active, setActive] = React.useState(AppState.currentState !== "background");
|
|
1174
|
+
const tick = React.useRef(onTick);
|
|
1175
|
+
tick.current = onTick;
|
|
1176
|
+
React.useEffect(() => {
|
|
1177
|
+
const sub = AppState.addEventListener("change", (s) => setActive(s === "active"));
|
|
1178
|
+
return () => sub.remove();
|
|
1179
|
+
}, []);
|
|
1180
|
+
const [n, setN] = React.useState(0);
|
|
1181
|
+
React.useEffect(() => {
|
|
1182
|
+
if (ms == null || paused || !active) return;
|
|
1183
|
+
const id = setTimeout(() => {
|
|
1184
|
+
setN((x) => x + 1);
|
|
1185
|
+
tick.current();
|
|
1186
|
+
}, ms);
|
|
1187
|
+
return () => clearTimeout(id);
|
|
1188
|
+
}, [ms, paused, active, n]);
|
|
1189
|
+
}
|
|
1190
|
+
var DEFAULT_VALUE = timeRangeValue({ from: "now-6h", to: "now" });
|
|
1191
|
+
function TimeRangeControl({
|
|
1192
|
+
value: valueProp,
|
|
1193
|
+
defaultValue = DEFAULT_VALUE,
|
|
1194
|
+
onChange,
|
|
1195
|
+
open: openProp,
|
|
1196
|
+
defaultOpen = false,
|
|
1197
|
+
onOpenChange,
|
|
1198
|
+
timezone: timezoneProp,
|
|
1199
|
+
defaultTimezone = "default",
|
|
1200
|
+
onTimezoneChange,
|
|
1201
|
+
timezones,
|
|
1202
|
+
options = TIME_RANGE_OPTIONS,
|
|
1203
|
+
weekStartsOn = 1,
|
|
1204
|
+
locale,
|
|
1205
|
+
now,
|
|
1206
|
+
recent: recentProp,
|
|
1207
|
+
onRecentChange,
|
|
1208
|
+
storage,
|
|
1209
|
+
storageId,
|
|
1210
|
+
recentLimit = 5,
|
|
1211
|
+
shift = true,
|
|
1212
|
+
zoom = true,
|
|
1213
|
+
onRefresh,
|
|
1214
|
+
loading = false,
|
|
1215
|
+
onCancelRefresh,
|
|
1216
|
+
refreshInterval,
|
|
1217
|
+
defaultRefreshInterval = "off",
|
|
1218
|
+
onRefreshIntervalChange,
|
|
1219
|
+
refreshIntervals = REFRESH_INTERVALS,
|
|
1220
|
+
minRefreshInterval,
|
|
1221
|
+
onNotify,
|
|
1222
|
+
asSheet = true,
|
|
1223
|
+
label: labelProp,
|
|
1224
|
+
size = "sm",
|
|
1225
|
+
disabled = false,
|
|
1226
|
+
density = "comfortable",
|
|
1227
|
+
orientation = "horizontal",
|
|
1228
|
+
variant = "outline",
|
|
1229
|
+
placeholder,
|
|
1230
|
+
error,
|
|
1231
|
+
style,
|
|
1232
|
+
quickRanges,
|
|
1233
|
+
quickRangesCustom = false,
|
|
1234
|
+
stepStyle = "double",
|
|
1235
|
+
ruler = false,
|
|
1236
|
+
labels: labelsProp,
|
|
1237
|
+
...panelOptions
|
|
1238
|
+
}) {
|
|
1239
|
+
const labels = useLabels("timeRangeControl", DEFAULT_LABELS, labelsProp);
|
|
1240
|
+
const label = labelProp ?? labels.timeRange;
|
|
1241
|
+
const dateLabels = React.useMemo(() => dateLabelsOf(labels), [labels]);
|
|
1242
|
+
const theme = useLoamTheme();
|
|
1243
|
+
const { styles } = useStyles(sheet2);
|
|
1244
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
1245
|
+
const value = valueProp !== void 0 ? valueProp : internalValue;
|
|
1246
|
+
const key = storage && storageId ? storageKey("time-range", storageId) : null;
|
|
1247
|
+
const [internalRecent, setInternalRecent] = React.useState(
|
|
1248
|
+
() => (key ? readStored(storage, key) : null) ?? []
|
|
1249
|
+
);
|
|
1250
|
+
const recent = recentProp ?? internalRecent;
|
|
1251
|
+
const floor = refreshIntervalMs(minRefreshInterval) ?? 0;
|
|
1252
|
+
const offered = refreshIntervals.filter((i) => (refreshIntervalMs(i) ?? 0) >= floor);
|
|
1253
|
+
const [internalInterval, setInternalInterval] = React.useState(defaultRefreshInterval);
|
|
1254
|
+
const chosen = refreshInterval ?? internalInterval;
|
|
1255
|
+
const interval = (refreshIntervalMs(chosen) ?? 0) >= floor ? chosen : "off";
|
|
1256
|
+
const pickInterval = (next) => {
|
|
1257
|
+
if (refreshInterval === void 0) setInternalInterval(next);
|
|
1258
|
+
onRefreshIntervalChange?.(next);
|
|
1259
|
+
};
|
|
1260
|
+
useRefreshTimer(
|
|
1261
|
+
onRefresh ? refreshIntervalMs(interval) : null,
|
|
1262
|
+
loading || disabled,
|
|
1263
|
+
() => onRefresh?.()
|
|
1264
|
+
);
|
|
1265
|
+
const [internalZone, setInternalZone] = React.useState(defaultTimezone);
|
|
1266
|
+
const timezone = timezoneProp ?? internalZone;
|
|
1267
|
+
const changeZone = (zone) => {
|
|
1268
|
+
if (timezoneProp === void 0) setInternalZone(zone);
|
|
1269
|
+
onTimezoneChange?.(zone);
|
|
1270
|
+
};
|
|
1271
|
+
const zoneEditable = timezoneProp === void 0 || onTimezoneChange != null;
|
|
1272
|
+
const Z = React.useMemo(() => dateZone(timezone), [timezone]);
|
|
1273
|
+
const readCtx = () => ({
|
|
1274
|
+
Z,
|
|
1275
|
+
now: now?.() ?? Date.now(),
|
|
1276
|
+
weekStartsOn,
|
|
1277
|
+
granularity: "second",
|
|
1278
|
+
locale,
|
|
1279
|
+
labels: dateLabels
|
|
1280
|
+
});
|
|
1281
|
+
const ctx = readCtx();
|
|
1282
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
1283
|
+
const open = openProp ?? internalOpen;
|
|
1284
|
+
const setOpen = (next) => {
|
|
1285
|
+
if (openProp === void 0) setInternalOpen(next);
|
|
1286
|
+
onOpenChange?.(next);
|
|
1287
|
+
};
|
|
1288
|
+
const [session, setSession] = React.useState(0);
|
|
1289
|
+
React.useEffect(() => {
|
|
1290
|
+
if (open) setSession((n) => n + 1);
|
|
1291
|
+
}, [open]);
|
|
1292
|
+
const commit = (next, source) => {
|
|
1293
|
+
const c = readCtx();
|
|
1294
|
+
const r = resolveDateValue(next, c);
|
|
1295
|
+
if (valueProp === void 0) setInternalValue(next);
|
|
1296
|
+
onChange?.({
|
|
1297
|
+
value: next,
|
|
1298
|
+
from: r.from,
|
|
1299
|
+
to: r.to,
|
|
1300
|
+
label: valueLabel(next, c),
|
|
1301
|
+
tz: Z.tz,
|
|
1302
|
+
exact: r.exact,
|
|
1303
|
+
source
|
|
1304
|
+
});
|
|
1305
|
+
};
|
|
1306
|
+
const commitFromSheet = (next) => {
|
|
1307
|
+
commit(next, "panel");
|
|
1308
|
+
const list = [next, ...recent.filter((r) => !sameDateValue(r, next))].slice(0, recentLimit);
|
|
1309
|
+
if (recentProp === void 0) setInternalRecent(list);
|
|
1310
|
+
if (key) writeStored(storage, key, list);
|
|
1311
|
+
onRecentChange?.(list);
|
|
1312
|
+
setOpen(false);
|
|
1313
|
+
};
|
|
1314
|
+
const step = (dir) => {
|
|
1315
|
+
if (!value) return;
|
|
1316
|
+
const next = shiftTimeRange(value, dir, readCtx());
|
|
1317
|
+
if (next) commit(next, "shift");
|
|
1318
|
+
};
|
|
1319
|
+
const zoomOut = () => {
|
|
1320
|
+
if (!value) return;
|
|
1321
|
+
const next = zoomTimeRange(value, 2, readCtx());
|
|
1322
|
+
if (next) commit(next, "zoom");
|
|
1323
|
+
};
|
|
1324
|
+
const atNow = value ? timeRangeReachesNow(value, ctx) : true;
|
|
1325
|
+
const text = value ? timeRangeLabel(value, ctx) : placeholder ?? labels.anyTime;
|
|
1326
|
+
const compact = density === "compact";
|
|
1327
|
+
const vertical = orientation === "vertical";
|
|
1328
|
+
const invalid = error != null && error !== false;
|
|
1329
|
+
const canZoom = value != null && zoomTimeRange(value, 2, ctx) != null;
|
|
1330
|
+
const cancelling = loading && onCancelRefresh != null;
|
|
1331
|
+
const drawn = theme.ctl[size];
|
|
1332
|
+
const slopY = Math.max(0, (theme.hit[size] - drawn) / 2);
|
|
1333
|
+
const hitSlop = { top: slopY, bottom: slopY };
|
|
1334
|
+
const single = stepStyle === "single";
|
|
1335
|
+
const rulerTicks = React.useMemo(() => {
|
|
1336
|
+
if (!ruler || !value) return [];
|
|
1337
|
+
const r = resolveDateValue(value, ctx);
|
|
1338
|
+
if (r.from == null || r.to == null) return [];
|
|
1339
|
+
const span = r.to - r.from;
|
|
1340
|
+
const hours = span <= 2 * 864e5;
|
|
1341
|
+
return [0, 1, 2].map((i) => {
|
|
1342
|
+
const w = Z.wall(r.from + span * i / 2);
|
|
1343
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
1344
|
+
return hours ? `${two(w.h)}:${two(w.mi)}` : `${two(w.d)}/${two(w.mo + 1)}`;
|
|
1345
|
+
});
|
|
1346
|
+
}, [ruler, value, Z, ctx.now]);
|
|
1347
|
+
const iconButton = (name, a11y, off, onPress) => (
|
|
1348
|
+
// Step and zoom join the trigger's tier as outline icon buttons (F48).
|
|
1349
|
+
/* @__PURE__ */ jsx(
|
|
1350
|
+
Button,
|
|
1351
|
+
{
|
|
1352
|
+
variant,
|
|
1353
|
+
size,
|
|
1354
|
+
leadingIcon: name,
|
|
1355
|
+
accessibilityLabel: a11y,
|
|
1356
|
+
disabled: off,
|
|
1357
|
+
onPress
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1360
|
+
);
|
|
1361
|
+
const body = /* @__PURE__ */ jsx(
|
|
1362
|
+
TimeRangeSheetBody,
|
|
1363
|
+
{
|
|
1364
|
+
...panelOptions,
|
|
1365
|
+
ctx,
|
|
1366
|
+
value,
|
|
1367
|
+
options,
|
|
1368
|
+
recent,
|
|
1369
|
+
labels,
|
|
1370
|
+
dateLabels,
|
|
1371
|
+
timezone,
|
|
1372
|
+
onTimezoneChange: zoneEditable ? changeZone : void 0,
|
|
1373
|
+
timezones,
|
|
1374
|
+
onNotify,
|
|
1375
|
+
onApply: commitFromSheet,
|
|
1376
|
+
onCancel: () => setOpen(false),
|
|
1377
|
+
children: onRefresh ? /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
|
|
1378
|
+
/* @__PURE__ */ jsx(Text, { style: styles.partLabel, children: labels.autoRefresh }),
|
|
1379
|
+
/* @__PURE__ */ jsx(
|
|
1380
|
+
ScrollView,
|
|
1381
|
+
{
|
|
1382
|
+
horizontal: true,
|
|
1383
|
+
showsHorizontalScrollIndicator: false,
|
|
1384
|
+
contentContainerStyle: styles.chips,
|
|
1385
|
+
children: ["off", ...offered].map((i) => {
|
|
1386
|
+
const on = (refreshIntervalMs(interval) == null ? "off" : interval) === i;
|
|
1387
|
+
return /* @__PURE__ */ jsx(
|
|
1388
|
+
Chip,
|
|
1389
|
+
{
|
|
1390
|
+
variant: "filter",
|
|
1391
|
+
size: "sm",
|
|
1392
|
+
selected: on,
|
|
1393
|
+
onSelectedChange: () => pickInterval(i),
|
|
1394
|
+
accessibilityLabel: i === "off" ? labels.off : i,
|
|
1395
|
+
children: i === "off" ? labels.off : i
|
|
1396
|
+
},
|
|
1397
|
+
i
|
|
1398
|
+
);
|
|
1399
|
+
})
|
|
1400
|
+
}
|
|
1401
|
+
)
|
|
1402
|
+
] }) : null
|
|
1403
|
+
},
|
|
1404
|
+
session
|
|
1405
|
+
);
|
|
1406
|
+
return /* @__PURE__ */ jsxs(View, { children: [
|
|
1407
|
+
quickRanges && (quickRanges.length > 0 || quickRangesCustom) ? /* @__PURE__ */ jsxs(
|
|
1408
|
+
ScrollView,
|
|
1409
|
+
{
|
|
1410
|
+
horizontal: true,
|
|
1411
|
+
showsHorizontalScrollIndicator: false,
|
|
1412
|
+
contentContainerStyle: styles.chips,
|
|
1413
|
+
style: styles.quick,
|
|
1414
|
+
children: [
|
|
1415
|
+
quickRanges.map((q) => /* @__PURE__ */ jsx(
|
|
1416
|
+
Chip,
|
|
1417
|
+
{
|
|
1418
|
+
variant: "filter",
|
|
1419
|
+
size: "sm",
|
|
1420
|
+
disabled,
|
|
1421
|
+
selected: value != null && sameDateValue(value, q.value),
|
|
1422
|
+
onSelectedChange: () => commit(q.value, "panel"),
|
|
1423
|
+
children: q.label
|
|
1424
|
+
},
|
|
1425
|
+
q.label
|
|
1426
|
+
)),
|
|
1427
|
+
quickRangesCustom ? /* @__PURE__ */ jsx(
|
|
1428
|
+
Chip,
|
|
1429
|
+
{
|
|
1430
|
+
variant: "filter",
|
|
1431
|
+
size: "sm",
|
|
1432
|
+
leadingIcon: "calendar",
|
|
1433
|
+
disabled,
|
|
1434
|
+
selected: false,
|
|
1435
|
+
onSelectedChange: () => setOpen(true),
|
|
1436
|
+
children: labels.customChip
|
|
1437
|
+
}
|
|
1438
|
+
) : null
|
|
1439
|
+
]
|
|
1440
|
+
}
|
|
1441
|
+
) : null,
|
|
1442
|
+
/* @__PURE__ */ jsxs(
|
|
1443
|
+
View,
|
|
1444
|
+
{
|
|
1445
|
+
style: [
|
|
1446
|
+
styles.root,
|
|
1447
|
+
compact ? styles.rootCompact : null,
|
|
1448
|
+
vertical ? styles.rootVertical : null,
|
|
1449
|
+
style
|
|
1450
|
+
],
|
|
1451
|
+
children: [
|
|
1452
|
+
shift ? iconButton(
|
|
1453
|
+
single ? "chevron-left" : "chevrons-left",
|
|
1454
|
+
labels.moveBack,
|
|
1455
|
+
disabled || !value,
|
|
1456
|
+
() => step(-1)
|
|
1457
|
+
) : null,
|
|
1458
|
+
/* @__PURE__ */ jsxs(
|
|
1459
|
+
Pressable,
|
|
1460
|
+
{
|
|
1461
|
+
accessibilityRole: "button",
|
|
1462
|
+
accessibilityLabel: labels.triggerLabel(label, text),
|
|
1463
|
+
accessibilityHint: value ? timeRangeReceipt(value, ctx) : void 0,
|
|
1464
|
+
accessibilityState: { disabled, expanded: open },
|
|
1465
|
+
"aria-invalid": invalid || void 0,
|
|
1466
|
+
disabled,
|
|
1467
|
+
onPress: () => setOpen(!open),
|
|
1468
|
+
hitSlop,
|
|
1469
|
+
style: ({ pressed }) => [
|
|
1470
|
+
styles.trigger,
|
|
1471
|
+
compact ? styles.triggerCompact : null,
|
|
1472
|
+
variant === "ghost" ? styles.triggerGhost : null,
|
|
1473
|
+
invalid ? { borderColor: theme.color.danger } : null,
|
|
1474
|
+
{ height: drawn },
|
|
1475
|
+
disabled && styles.off,
|
|
1476
|
+
pressed && styles.pressed
|
|
1477
|
+
],
|
|
1478
|
+
children: [
|
|
1479
|
+
/* @__PURE__ */ jsx(Icon, { name: "clock", size: theme.icon.sm, color: theme.color.text2 }),
|
|
1480
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [theme.ctl.label[size], styles.triggerText], children: text }),
|
|
1481
|
+
/* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: theme.icon.sm, color: theme.color.text2 })
|
|
1482
|
+
]
|
|
1483
|
+
}
|
|
1484
|
+
),
|
|
1485
|
+
shift ? iconButton(
|
|
1486
|
+
single ? "chevron-right" : "chevrons-right",
|
|
1487
|
+
labels.moveForward,
|
|
1488
|
+
disabled || atNow,
|
|
1489
|
+
() => step(1)
|
|
1490
|
+
) : null,
|
|
1491
|
+
zoom ? iconButton("zoom-out", labels.zoomOut, disabled || !canZoom, zoomOut) : null,
|
|
1492
|
+
onRefresh ? /* @__PURE__ */ jsx(
|
|
1493
|
+
Button,
|
|
1494
|
+
{
|
|
1495
|
+
variant,
|
|
1496
|
+
size,
|
|
1497
|
+
disabled,
|
|
1498
|
+
loading: loading && !cancelling,
|
|
1499
|
+
leadingIcon: cancelling ? "x" : "refresh",
|
|
1500
|
+
accessibilityLabel: cancelling ? labels.cancelRefresh : labels.refresh,
|
|
1501
|
+
onPress: () => cancelling ? onCancelRefresh() : onRefresh(),
|
|
1502
|
+
children: cancelling ? labels.cancel : refreshIntervalMs(interval) ? interval : labels.refresh
|
|
1503
|
+
}
|
|
1504
|
+
) : null,
|
|
1505
|
+
asSheet ? /* @__PURE__ */ jsx(
|
|
1506
|
+
Sheet,
|
|
1507
|
+
{
|
|
1508
|
+
open,
|
|
1509
|
+
onClose: () => setOpen(false),
|
|
1510
|
+
title: label,
|
|
1511
|
+
detents: ["half", "full"],
|
|
1512
|
+
children: body
|
|
1513
|
+
}
|
|
1514
|
+
) : null
|
|
1515
|
+
]
|
|
1516
|
+
}
|
|
1517
|
+
),
|
|
1518
|
+
typeof error === "string" && error ? /* @__PURE__ */ jsx(Text, { style: styles.errorText, role: "alert", children: error }) : null,
|
|
1519
|
+
rulerTicks.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles.ruler, accessibilityElementsHidden: true, importantForAccessibility: "no", children: rulerTicks.map((t, i) => /* @__PURE__ */ jsx(Text, { style: styles.rulerTick, children: t }, i)) }) : null,
|
|
1520
|
+
!asSheet && open ? /* @__PURE__ */ jsx(View, { style: styles.card, children: body }) : null
|
|
1521
|
+
] });
|
|
1522
|
+
}
|
|
1523
|
+
var sheet2 = createStyleSheet((theme) => ({
|
|
1524
|
+
root: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
|
|
1525
|
+
rootCompact: { gap: theme.space[2] },
|
|
1526
|
+
rootVertical: { flexDirection: "column", alignItems: "stretch" },
|
|
1527
|
+
triggerCompact: { paddingHorizontal: theme.space.s2, gap: theme.space.s1 },
|
|
1528
|
+
triggerGhost: { borderColor: "transparent", backgroundColor: "transparent" },
|
|
1529
|
+
errorText: {
|
|
1530
|
+
marginTop: theme.space.s1,
|
|
1531
|
+
fontFamily: theme.font.sans,
|
|
1532
|
+
fontSize: theme.type.footnote.fontSize,
|
|
1533
|
+
color: theme.color.danger
|
|
1534
|
+
},
|
|
1535
|
+
trigger: {
|
|
1536
|
+
flexShrink: 1,
|
|
1537
|
+
flexDirection: "row",
|
|
1538
|
+
alignItems: "center",
|
|
1539
|
+
gap: theme.space.s2,
|
|
1540
|
+
paddingHorizontal: theme.space.s3,
|
|
1541
|
+
borderRadius: theme.radius.md,
|
|
1542
|
+
borderWidth: theme.borderWidth.base,
|
|
1543
|
+
borderColor: theme.color.border,
|
|
1544
|
+
backgroundColor: theme.color.surface
|
|
1545
|
+
},
|
|
1546
|
+
triggerText: {
|
|
1547
|
+
flexShrink: 1,
|
|
1548
|
+
fontFamily: theme.font.sans,
|
|
1549
|
+
// The value reads at the tier's label size (R12) but stays regular weight.
|
|
1550
|
+
fontWeight: theme.fontWeight.regular,
|
|
1551
|
+
color: theme.color.text
|
|
1552
|
+
},
|
|
1553
|
+
card: {
|
|
1554
|
+
marginTop: theme.space.s2,
|
|
1555
|
+
padding: theme.space.s3,
|
|
1556
|
+
borderRadius: theme.radius.md,
|
|
1557
|
+
borderWidth: theme.borderWidth.base,
|
|
1558
|
+
borderColor: theme.color.border,
|
|
1559
|
+
backgroundColor: theme.color.surface
|
|
1560
|
+
},
|
|
1561
|
+
off: { opacity: theme.state.disabledOpacity },
|
|
1562
|
+
pressed: { opacity: theme.state.pressedOpacity },
|
|
1563
|
+
group: { gap: theme.space.s1 },
|
|
1564
|
+
partLabel: {
|
|
1565
|
+
fontFamily: theme.font.sans,
|
|
1566
|
+
fontSize: theme.type.caption2.fontSize,
|
|
1567
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
1568
|
+
fontWeight: theme.fontWeight.bold,
|
|
1569
|
+
color: theme.color.text2
|
|
1570
|
+
},
|
|
1571
|
+
chips: { flexDirection: "row", gap: theme.space.s1 },
|
|
1572
|
+
ruler: {
|
|
1573
|
+
flexDirection: "row",
|
|
1574
|
+
justifyContent: "space-between",
|
|
1575
|
+
marginTop: theme.space.s2,
|
|
1576
|
+
paddingHorizontal: theme.space.s1
|
|
1577
|
+
},
|
|
1578
|
+
rulerTick: {
|
|
1579
|
+
fontFamily: theme.font.mono,
|
|
1580
|
+
fontSize: theme.type.caption2.fontSize,
|
|
1581
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
1582
|
+
color: theme.color.text3
|
|
1583
|
+
},
|
|
1584
|
+
quick: { marginBottom: theme.space.s2 }
|
|
1585
|
+
}));
|
|
1586
|
+
|
|
1587
|
+
export { REFRESH_INTERVALS, TIME_RANGE_PERIODS, TIME_RANGE_UNITS, TIME_RANGE_VIEWS, TimeRangeControl, refreshIntervalMs };
|