@nori-ui/core 0.0.5 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/animated-view.cjs +13 -0
- package/dist/animation/animated-view.cjs.map +1 -0
- package/dist/animation/animated-view.d.cts +6 -0
- package/dist/animation/animated-view.d.ts +6 -0
- package/dist/animation/animated-view.js +4 -0
- package/dist/animation/animated-view.js.map +1 -0
- package/dist/animation/animated-view.web.cjs +9 -0
- package/dist/animation/animated-view.web.cjs.map +1 -0
- package/dist/animation/animated-view.web.d.cts +5 -0
- package/dist/animation/animated-view.web.d.ts +5 -0
- package/dist/animation/animated-view.web.js +8 -0
- package/dist/animation/animated-view.web.js.map +1 -0
- package/dist/animation/use-animated-number.cjs +80 -0
- package/dist/animation/use-animated-number.cjs.map +1 -0
- package/dist/animation/use-animated-number.d.cts +8 -0
- package/dist/animation/use-animated-number.d.ts +8 -0
- package/dist/animation/use-animated-number.js +4 -0
- package/dist/animation/use-animated-number.js.map +1 -0
- package/dist/animation/use-animated-number.web.cjs +28 -0
- package/dist/animation/use-animated-number.web.cjs.map +1 -0
- package/dist/animation/use-animated-number.web.d.cts +8 -0
- package/dist/animation/use-animated-number.web.d.ts +8 -0
- package/dist/animation/use-animated-number.web.js +25 -0
- package/dist/animation/use-animated-number.web.js.map +1 -0
- package/dist/{chunk-RX7UULY3.js → chunk-33S7ADWM.js} +3 -3
- package/dist/{chunk-RX7UULY3.js.map → chunk-33S7ADWM.js.map} +1 -1
- package/dist/chunk-3BDDPFCI.js +108 -0
- package/dist/chunk-3BDDPFCI.js.map +1 -0
- package/dist/chunk-3F4TXKDY.js +314 -0
- package/dist/chunk-3F4TXKDY.js.map +1 -0
- package/dist/chunk-5A2QOOVN.js +15 -0
- package/dist/chunk-5A2QOOVN.js.map +1 -0
- package/dist/chunk-5XEGZFG5.js +208 -0
- package/dist/chunk-5XEGZFG5.js.map +1 -0
- package/dist/chunk-6AD6KCVB.js +178 -0
- package/dist/chunk-6AD6KCVB.js.map +1 -0
- package/dist/chunk-7GPDNQSX.js +967 -0
- package/dist/chunk-7GPDNQSX.js.map +1 -0
- package/dist/chunk-7UKRN73P.js +42 -0
- package/dist/chunk-7UKRN73P.js.map +1 -0
- package/dist/chunk-7Z4NMNX6.js +64 -0
- package/dist/chunk-7Z4NMNX6.js.map +1 -0
- package/dist/chunk-ACLHDHX3.js +29 -0
- package/dist/chunk-ACLHDHX3.js.map +1 -0
- package/dist/chunk-BZLT6R62.js +80 -0
- package/dist/chunk-BZLT6R62.js.map +1 -0
- package/dist/chunk-CCUXO2HN.js +450 -0
- package/dist/chunk-CCUXO2HN.js.map +1 -0
- package/dist/chunk-CHXHRJNZ.js +43 -0
- package/dist/chunk-CHXHRJNZ.js.map +1 -0
- package/dist/chunk-DDGMLLS3.js +188 -0
- package/dist/chunk-DDGMLLS3.js.map +1 -0
- package/dist/chunk-EWWQQ5DB.js +654 -0
- package/dist/chunk-EWWQQ5DB.js.map +1 -0
- package/dist/chunk-FEPTH5RV.js +169 -0
- package/dist/chunk-FEPTH5RV.js.map +1 -0
- package/dist/{chunk-SSTXLK5I.js → chunk-FT2XBBQJ.js} +42 -6
- package/dist/chunk-FT2XBBQJ.js.map +1 -0
- package/dist/chunk-IKLA2CVQ.js +260 -0
- package/dist/chunk-IKLA2CVQ.js.map +1 -0
- package/dist/chunk-JQQ3FBN7.js +18 -0
- package/dist/chunk-JQQ3FBN7.js.map +1 -0
- package/dist/chunk-JSAG5YO7.js +69 -0
- package/dist/chunk-JSAG5YO7.js.map +1 -0
- package/dist/chunk-JZ774T7U.js +76 -0
- package/dist/chunk-JZ774T7U.js.map +1 -0
- package/dist/chunk-KWRDJPP3.js +10 -0
- package/dist/chunk-KWRDJPP3.js.map +1 -0
- package/dist/chunk-LVWNMQGR.js +1106 -0
- package/dist/chunk-LVWNMQGR.js.map +1 -0
- package/dist/chunk-LWLK6HSW.js +143 -0
- package/dist/chunk-LWLK6HSW.js.map +1 -0
- package/dist/chunk-MDOZGILD.js +134 -0
- package/dist/chunk-MDOZGILD.js.map +1 -0
- package/dist/chunk-MKSDYRWQ.js +446 -0
- package/dist/chunk-MKSDYRWQ.js.map +1 -0
- package/dist/chunk-MRJWPRCX.js +80 -0
- package/dist/chunk-MRJWPRCX.js.map +1 -0
- package/dist/chunk-NRYWNOG5.js +410 -0
- package/dist/chunk-NRYWNOG5.js.map +1 -0
- package/dist/chunk-OMU4R4Y5.js +144 -0
- package/dist/chunk-OMU4R4Y5.js.map +1 -0
- package/dist/chunk-PNP7L4TA.js +103 -0
- package/dist/chunk-PNP7L4TA.js.map +1 -0
- package/dist/chunk-QI6646JZ.js +3 -0
- package/dist/{chunk-UAKFCMWK.js.map → chunk-QI6646JZ.js.map} +1 -1
- package/dist/chunk-QJNV7YQP.js +138 -0
- package/dist/chunk-QJNV7YQP.js.map +1 -0
- package/dist/chunk-R5JMDDCB.js +292 -0
- package/dist/chunk-R5JMDDCB.js.map +1 -0
- package/dist/chunk-RB3YBWQ4.js +77 -0
- package/dist/chunk-RB3YBWQ4.js.map +1 -0
- package/dist/chunk-RFW5SRZA.js +23 -0
- package/dist/chunk-RFW5SRZA.js.map +1 -0
- package/dist/chunk-RGJ3NBKE.js +8 -0
- package/dist/chunk-RGJ3NBKE.js.map +1 -0
- package/dist/chunk-SFNDR6DI.js +485 -0
- package/dist/chunk-SFNDR6DI.js.map +1 -0
- package/dist/chunk-SWC5CNKE.js +13 -0
- package/dist/chunk-SWC5CNKE.js.map +1 -0
- package/dist/chunk-TLS54G6Y.js +15 -0
- package/dist/chunk-TLS54G6Y.js.map +1 -0
- package/dist/chunk-WCQVDF3K.js +12 -0
- package/dist/{chunk-7QVYU63E.js.map → chunk-WCQVDF3K.js.map} +1 -1
- package/dist/chunk-WGT345SV.js +427 -0
- package/dist/chunk-WGT345SV.js.map +1 -0
- package/dist/chunk-X7APG7G2.js +1566 -0
- package/dist/chunk-X7APG7G2.js.map +1 -0
- package/dist/chunk-XALU6LOT.js +306 -0
- package/dist/chunk-XALU6LOT.js.map +1 -0
- package/dist/chunk-YNKKEO2A.js +336 -0
- package/dist/chunk-YNKKEO2A.js.map +1 -0
- package/dist/chunk-ZBW3BA5R.js +148 -0
- package/dist/chunk-ZBW3BA5R.js.map +1 -0
- package/dist/{chunk-FXKIWONG.js → chunk-ZIBNLXIV.js} +12 -6
- package/dist/chunk-ZIBNLXIV.js.map +1 -0
- package/dist/chunk-ZMSIYLSI.js +563 -0
- package/dist/chunk-ZMSIYLSI.js.map +1 -0
- package/dist/chunk-ZQMNGPLE.js +981 -0
- package/dist/chunk-ZQMNGPLE.js.map +1 -0
- package/dist/chunk-ZRD4FQBT.js +153 -0
- package/dist/chunk-ZRD4FQBT.js.map +1 -0
- package/dist/client.cjs +11289 -439
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +68 -117
- package/dist/client.d.ts +68 -117
- package/dist/client.js +58 -40
- package/dist/client.js.map +1 -1
- package/dist/components/Accordion/index.cjs +900 -0
- package/dist/components/Accordion/index.cjs.map +1 -0
- package/dist/components/Accordion/index.d.cts +72 -0
- package/dist/components/Accordion/index.d.ts +72 -0
- package/dist/components/Accordion/index.js +10 -0
- package/dist/components/Accordion/index.js.map +1 -0
- package/dist/components/Alert/index.cjs +567 -0
- package/dist/components/Alert/index.cjs.map +1 -0
- package/dist/components/Alert/index.d.cts +41 -0
- package/dist/components/Alert/index.d.ts +41 -0
- package/dist/components/Alert/index.js +8 -0
- package/dist/components/Alert/index.js.map +1 -0
- package/dist/components/AlertDialog/index.cjs +892 -0
- package/dist/components/AlertDialog/index.cjs.map +1 -0
- package/dist/components/AlertDialog/index.d.cts +68 -0
- package/dist/components/AlertDialog/index.d.ts +68 -0
- package/dist/components/AlertDialog/index.js +9 -0
- package/dist/components/AlertDialog/index.js.map +1 -0
- package/dist/components/Avatar/index.cjs +427 -0
- package/dist/components/Avatar/index.cjs.map +1 -0
- package/dist/components/Avatar/index.d.cts +40 -0
- package/dist/components/Avatar/index.d.ts +40 -0
- package/dist/components/Avatar/index.js +7 -0
- package/dist/components/Avatar/index.js.map +1 -0
- package/dist/components/Badge/index.cjs +433 -0
- package/dist/components/Badge/index.cjs.map +1 -0
- package/dist/components/Badge/index.d.cts +35 -0
- package/dist/components/Badge/index.d.ts +35 -0
- package/dist/components/Badge/index.js +7 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/Box/index.cjs +415 -0
- package/dist/components/Box/index.cjs.map +1 -0
- package/dist/components/Box/index.d.cts +24 -0
- package/dist/components/Box/index.d.ts +24 -0
- package/dist/components/Box/index.js +9 -0
- package/dist/components/Box/index.js.map +1 -0
- package/dist/components/Breadcrumb/index.cjs +1939 -0
- package/dist/components/Breadcrumb/index.cjs.map +1 -0
- package/dist/components/Breadcrumb/index.d.cts +186 -0
- package/dist/components/Breadcrumb/index.d.ts +186 -0
- package/dist/components/Breadcrumb/index.js +11 -0
- package/dist/components/Breadcrumb/index.js.map +1 -0
- package/dist/components/Button/index.cjs +631 -0
- package/dist/components/Button/index.cjs.map +1 -0
- package/dist/components/Button/index.d.cts +27 -0
- package/dist/components/Button/index.d.ts +27 -0
- package/dist/components/Button/index.js +9 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Calendar/index.cjs +3017 -0
- package/dist/components/Calendar/index.cjs.map +1 -0
- package/dist/components/Calendar/index.d.cts +169 -0
- package/dist/components/Calendar/index.d.ts +169 -0
- package/dist/components/Calendar/index.js +11 -0
- package/dist/components/Calendar/index.js.map +1 -0
- package/dist/components/Card/index.cjs +469 -0
- package/dist/components/Card/index.cjs.map +1 -0
- package/dist/components/Card/index.d.cts +33 -0
- package/dist/components/Card/index.d.ts +33 -0
- package/dist/components/Card/index.js +7 -0
- package/dist/components/Card/index.js.map +1 -0
- package/dist/components/Checkbox/index.cjs +590 -0
- package/dist/components/Checkbox/index.cjs.map +1 -0
- package/dist/components/Checkbox/index.d.cts +22 -0
- package/dist/components/Checkbox/index.d.ts +22 -0
- package/dist/components/Checkbox/index.js +9 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Dialog/index.cjs +888 -0
- package/dist/components/Dialog/index.cjs.map +1 -0
- package/dist/components/Dialog/index.d.cts +56 -0
- package/dist/components/Dialog/index.d.ts +56 -0
- package/dist/components/Dialog/index.js +10 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/FloatButton/index.cjs +1254 -0
- package/dist/components/FloatButton/index.cjs.map +1 -0
- package/dist/components/FloatButton/index.d.cts +133 -0
- package/dist/components/FloatButton/index.d.ts +133 -0
- package/dist/components/FloatButton/index.js +11 -0
- package/dist/components/FloatButton/index.js.map +1 -0
- package/dist/components/HStack/index.cjs +480 -0
- package/dist/components/HStack/index.cjs.map +1 -0
- package/dist/components/HStack/index.d.cts +24 -0
- package/dist/components/HStack/index.d.ts +24 -0
- package/dist/components/HStack/index.js +9 -0
- package/dist/components/HStack/index.js.map +1 -0
- package/dist/components/InputGroup/index.cjs +638 -0
- package/dist/components/InputGroup/index.cjs.map +1 -0
- package/dist/components/InputGroup/index.d.cts +33 -0
- package/dist/components/InputGroup/index.d.ts +33 -0
- package/dist/components/InputGroup/index.js +7 -0
- package/dist/components/InputGroup/index.js.map +1 -0
- package/dist/components/Pagination/index.cjs +2501 -0
- package/dist/components/Pagination/index.cjs.map +1 -0
- package/dist/components/Pagination/index.d.cts +164 -0
- package/dist/components/Pagination/index.d.ts +164 -0
- package/dist/components/Pagination/index.js +12 -0
- package/dist/components/Pagination/index.js.map +1 -0
- package/dist/components/Popover/index.cjs +739 -0
- package/dist/components/Popover/index.cjs.map +1 -0
- package/dist/components/Popover/index.d.cts +44 -0
- package/dist/components/Popover/index.d.ts +44 -0
- package/dist/components/Popover/index.js +8 -0
- package/dist/components/Popover/index.js.map +1 -0
- package/dist/components/Progress/index.cjs +493 -0
- package/dist/components/Progress/index.cjs.map +1 -0
- package/dist/components/Progress/index.d.cts +63 -0
- package/dist/components/Progress/index.d.ts +63 -0
- package/dist/components/Progress/index.js +7 -0
- package/dist/components/Progress/index.js.map +1 -0
- package/dist/components/Radio/index.cjs +584 -0
- package/dist/components/Radio/index.cjs.map +1 -0
- package/dist/components/Radio/index.d.cts +51 -0
- package/dist/components/Radio/index.d.ts +51 -0
- package/dist/components/Radio/index.js +7 -0
- package/dist/components/Radio/index.js.map +1 -0
- package/dist/components/SegmentedControl/index.cjs +502 -0
- package/dist/components/SegmentedControl/index.cjs.map +1 -0
- package/dist/components/SegmentedControl/index.d.cts +45 -0
- package/dist/components/SegmentedControl/index.d.ts +45 -0
- package/dist/components/SegmentedControl/index.js +7 -0
- package/dist/components/SegmentedControl/index.js.map +1 -0
- package/dist/components/Select/index.cjs +1359 -0
- package/dist/components/Select/index.cjs.map +1 -0
- package/dist/components/Select/index.d.cts +140 -0
- package/dist/components/Select/index.d.ts +140 -0
- package/dist/components/Select/index.js +8 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/components/Separator/index.cjs +358 -0
- package/dist/components/Separator/index.cjs.map +1 -0
- package/dist/components/Separator/index.d.cts +28 -0
- package/dist/components/Separator/index.d.ts +28 -0
- package/dist/components/Separator/index.js +6 -0
- package/dist/components/Separator/index.js.map +1 -0
- package/dist/components/Skeleton/index.cjs +384 -0
- package/dist/components/Skeleton/index.cjs.map +1 -0
- package/dist/components/Skeleton/index.d.cts +30 -0
- package/dist/components/Skeleton/index.d.ts +30 -0
- package/dist/components/Skeleton/index.js +6 -0
- package/dist/components/Skeleton/index.js.map +1 -0
- package/dist/components/Slider/index.cjs +880 -0
- package/dist/components/Slider/index.cjs.map +1 -0
- package/dist/components/Slider/index.d.cts +84 -0
- package/dist/components/Slider/index.d.ts +84 -0
- package/dist/components/Slider/index.js +6 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/Spinner/index.cjs +32 -0
- package/dist/components/Spinner/index.cjs.map +1 -0
- package/dist/components/Spinner/index.d.cts +25 -0
- package/dist/components/Spinner/index.d.ts +25 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Spinner/index.js.map +1 -0
- package/dist/components/Switch/index.cjs +623 -0
- package/dist/components/Switch/index.cjs.map +1 -0
- package/dist/components/Switch/index.d.cts +22 -0
- package/dist/components/Switch/index.d.ts +22 -0
- package/dist/components/Switch/index.js +10 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Tabs/index.cjs +630 -0
- package/dist/components/Tabs/index.cjs.map +1 -0
- package/dist/components/Tabs/index.d.cts +63 -0
- package/dist/components/Tabs/index.d.ts +63 -0
- package/dist/components/Tabs/index.js +7 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Text/index.cjs +401 -0
- package/dist/components/Text/index.cjs.map +1 -0
- package/dist/components/Text/index.d.cts +24 -0
- package/dist/components/Text/index.d.ts +24 -0
- package/dist/components/Text/index.js +7 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/TextArea/index.cjs +482 -0
- package/dist/components/TextArea/index.cjs.map +1 -0
- package/dist/components/TextArea/index.d.cts +25 -0
- package/dist/components/TextArea/index.d.ts +25 -0
- package/dist/components/TextArea/index.js +8 -0
- package/dist/components/TextArea/index.js.map +1 -0
- package/dist/components/TextInput/index.cjs +477 -0
- package/dist/components/TextInput/index.cjs.map +1 -0
- package/dist/components/TextInput/index.d.cts +33 -0
- package/dist/components/TextInput/index.d.ts +33 -0
- package/dist/components/TextInput/index.js +7 -0
- package/dist/components/TextInput/index.js.map +1 -0
- package/dist/components/Toast/index.cjs +167 -0
- package/dist/components/Toast/index.cjs.map +1 -0
- package/dist/components/Toast/index.d.cts +143 -0
- package/dist/components/Toast/index.d.ts +143 -0
- package/dist/components/Toast/index.js +4 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/components/Toggle/index.cjs +770 -0
- package/dist/components/Toggle/index.cjs.map +1 -0
- package/dist/components/Toggle/index.d.cts +83 -0
- package/dist/components/Toggle/index.d.ts +83 -0
- package/dist/components/Toggle/index.js +7 -0
- package/dist/components/Toggle/index.js.map +1 -0
- package/dist/components/Tooltip/index.cjs +813 -0
- package/dist/components/Tooltip/index.cjs.map +1 -0
- package/dist/components/Tooltip/index.d.cts +55 -0
- package/dist/components/Tooltip/index.d.ts +55 -0
- package/dist/components/Tooltip/index.js +8 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/VStack/index.cjs +480 -0
- package/dist/components/VStack/index.cjs.map +1 -0
- package/dist/components/VStack/index.d.cts +19 -0
- package/dist/components/VStack/index.d.ts +19 -0
- package/dist/components/VStack/index.js +9 -0
- package/dist/components/VStack/index.js.map +1 -0
- package/dist/i18n/index.cjs +39 -3
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +4 -60
- package/dist/i18n/index.d.ts +4 -60
- package/dist/i18n/index.js +3 -2
- package/dist/icons/index.cjs +326 -26
- package/dist/icons/index.cjs.map +1 -1
- package/dist/icons/index.js +4 -3
- package/dist/index-D3_M3G6U.d.ts +19 -0
- package/dist/index-uXPK_Rg8.d.cts +19 -0
- package/dist/index.cjs +11176 -463
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -183
- package/dist/index.d.ts +39 -183
- package/dist/index.js +49 -9
- package/dist/resolve-D-GOaxZy.d.cts +60 -0
- package/dist/resolve-D-GOaxZy.d.ts +60 -0
- package/dist/slot/index.cjs +9 -3
- package/dist/slot/index.cjs.map +1 -1
- package/dist/slot/index.js +2 -2
- package/dist/stories/index.cjs +108 -0
- package/dist/stories/index.cjs.map +1 -0
- package/dist/stories/index.d.cts +46 -0
- package/dist/stories/index.d.ts +46 -0
- package/dist/stories/index.js +94 -0
- package/dist/stories/index.js.map +1 -0
- package/dist/theme/index.cjs +259 -26
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.cts +26 -0
- package/dist/theme/index.d.ts +26 -0
- package/dist/theme/index.js +4 -3
- package/dist/use-theme-CoqfnvRs.d.cts +112 -0
- package/dist/use-theme-CoqfnvRs.d.ts +112 -0
- package/dist/utils/cn.cjs +18 -6
- package/dist/utils/cn.cjs.map +1 -1
- package/dist/utils/cn.js +2 -2
- package/package.json +41 -10
- package/dist/chunk-6OABNXBY.js +0 -213
- package/dist/chunk-6OABNXBY.js.map +0 -1
- package/dist/chunk-7QVYU63E.js +0 -6
- package/dist/chunk-FXKIWONG.js.map +0 -1
- package/dist/chunk-NDEDMCHT.js +0 -40
- package/dist/chunk-NDEDMCHT.js.map +0 -1
- package/dist/chunk-SSTXLK5I.js.map +0 -1
- package/dist/chunk-UAKFCMWK.js +0 -3
- package/dist/chunk-X3AJNNF6.js +0 -539
- package/dist/chunk-X3AJNNF6.js.map +0 -1
- package/dist/chunk-XGM2K4TT.js +0 -31
- package/dist/chunk-XGM2K4TT.js.map +0 -1
- package/dist/stories/story-registry.cjs +0 -776
- package/dist/stories/story-registry.cjs.map +0 -1
- package/dist/stories/story-registry.d.cts +0 -13
- package/dist/stories/story-registry.d.ts +0 -13
- package/dist/stories/story-registry.js +0 -106
- package/dist/stories/story-registry.js.map +0 -1
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
var Animated = require('react-native-reanimated');
|
|
6
|
+
var jsxRuntime = require('nativewind/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var Animated__default = /*#__PURE__*/_interopDefault(Animated);
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
|
+
var AnimatedView = Animated__default.default.View;
|
|
15
|
+
var IS_WEB = reactNative.Platform.OS === "web";
|
|
16
|
+
function useAnimatedNumber(property, target, options = {}) {
|
|
17
|
+
const { duration = 180 } = options;
|
|
18
|
+
if (IS_WEB) {
|
|
19
|
+
return webStyle(property, target, duration);
|
|
20
|
+
}
|
|
21
|
+
return useReanimatedTiming(property, target, duration);
|
|
22
|
+
}
|
|
23
|
+
__name(useAnimatedNumber, "useAnimatedNumber");
|
|
24
|
+
function webStyle(property, target, duration) {
|
|
25
|
+
if (property === "translateX" || property === "translateY") {
|
|
26
|
+
return {
|
|
27
|
+
transform: [{ [property]: target }],
|
|
28
|
+
transitionProperty: "transform",
|
|
29
|
+
transitionDuration: `${duration}ms`,
|
|
30
|
+
transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
[property]: target,
|
|
35
|
+
transitionProperty: property,
|
|
36
|
+
transitionDuration: `${duration}ms`,
|
|
37
|
+
transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
__name(webStyle, "webStyle");
|
|
41
|
+
function useReanimatedTiming(property, target, duration) {
|
|
42
|
+
const easing = Animated.Easing.bezier(0.16, 1, 0.3, 1);
|
|
43
|
+
const shared = Animated.useSharedValue(target);
|
|
44
|
+
react.useEffect(() => {
|
|
45
|
+
shared.value = Animated.withTiming(target, { duration, easing });
|
|
46
|
+
}, [target, shared, duration, easing]);
|
|
47
|
+
const translateXStyle = Animated.useAnimatedStyle(() => ({
|
|
48
|
+
transform: [{ translateX: shared.value }]
|
|
49
|
+
}));
|
|
50
|
+
const translateYStyle = Animated.useAnimatedStyle(() => ({
|
|
51
|
+
transform: [{ translateY: shared.value }]
|
|
52
|
+
}));
|
|
53
|
+
const leftStyle = Animated.useAnimatedStyle(() => ({ left: shared.value }));
|
|
54
|
+
const topStyle = Animated.useAnimatedStyle(() => ({ top: shared.value }));
|
|
55
|
+
const rightStyle = Animated.useAnimatedStyle(() => ({ right: shared.value }));
|
|
56
|
+
const bottomStyle = Animated.useAnimatedStyle(() => ({ bottom: shared.value }));
|
|
57
|
+
const opacityStyle = Animated.useAnimatedStyle(() => ({ opacity: shared.value }));
|
|
58
|
+
const heightStyle = Animated.useAnimatedStyle(() => ({ height: shared.value }));
|
|
59
|
+
if (property === "translateX") {
|
|
60
|
+
return translateXStyle;
|
|
61
|
+
}
|
|
62
|
+
if (property === "translateY") {
|
|
63
|
+
return translateYStyle;
|
|
64
|
+
}
|
|
65
|
+
if (property === "left") {
|
|
66
|
+
return leftStyle;
|
|
67
|
+
}
|
|
68
|
+
if (property === "top") {
|
|
69
|
+
return topStyle;
|
|
70
|
+
}
|
|
71
|
+
if (property === "right") {
|
|
72
|
+
return rightStyle;
|
|
73
|
+
}
|
|
74
|
+
if (property === "bottom") {
|
|
75
|
+
return bottomStyle;
|
|
76
|
+
}
|
|
77
|
+
if (property === "opacity") {
|
|
78
|
+
return opacityStyle;
|
|
79
|
+
}
|
|
80
|
+
return heightStyle;
|
|
81
|
+
}
|
|
82
|
+
__name(useReanimatedTiming, "useReanimatedTiming");
|
|
83
|
+
|
|
84
|
+
// src/slot/compose-refs.ts
|
|
85
|
+
function composeRefs(...refs) {
|
|
86
|
+
return (node) => {
|
|
87
|
+
for (const ref of refs) {
|
|
88
|
+
if (ref == null) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (typeof ref === "function") {
|
|
92
|
+
ref(node);
|
|
93
|
+
} else {
|
|
94
|
+
ref.current = node;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
__name(composeRefs, "composeRefs");
|
|
100
|
+
var Slot = react.forwardRef(/* @__PURE__ */ __name(function Slot2(props, forwardedRef) {
|
|
101
|
+
const { children, ...slotProps } = props;
|
|
102
|
+
if (!react.isValidElement(children)) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const child = react.Children.only(children);
|
|
106
|
+
const merged = mergeProps(slotProps, child.props);
|
|
107
|
+
const childRef = child.ref;
|
|
108
|
+
if (forwardedRef || childRef) {
|
|
109
|
+
merged.ref = composeRefs(forwardedRef, childRef);
|
|
110
|
+
}
|
|
111
|
+
return react.cloneElement(child, merged);
|
|
112
|
+
}, "Slot"));
|
|
113
|
+
Slot.displayName = "Slot";
|
|
114
|
+
function mergeProps(outer, inner) {
|
|
115
|
+
const merged = { ...outer };
|
|
116
|
+
for (const key of Object.keys(inner)) {
|
|
117
|
+
const outerValue = outer[key];
|
|
118
|
+
const innerValue = inner[key];
|
|
119
|
+
if (key === "className" || key === "class") {
|
|
120
|
+
merged[key] = joinClass(outerValue, innerValue);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (key === "style") {
|
|
124
|
+
merged[key] = {
|
|
125
|
+
...outerValue,
|
|
126
|
+
...innerValue
|
|
127
|
+
};
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (isEventHandler(key, outerValue, innerValue)) {
|
|
131
|
+
merged[key] = composeHandlers(outerValue, innerValue);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
merged[key] = innerValue;
|
|
135
|
+
}
|
|
136
|
+
return merged;
|
|
137
|
+
}
|
|
138
|
+
__name(mergeProps, "mergeProps");
|
|
139
|
+
function joinClass(outer, inner) {
|
|
140
|
+
const a = typeof outer === "string" ? outer : "";
|
|
141
|
+
const b = typeof inner === "string" ? inner : "";
|
|
142
|
+
const joined = [a, b].filter(Boolean).join(" ");
|
|
143
|
+
return joined.length > 0 ? joined : void 0;
|
|
144
|
+
}
|
|
145
|
+
__name(joinClass, "joinClass");
|
|
146
|
+
function isEventHandler(key, outer, inner) {
|
|
147
|
+
if (!key.startsWith("on") || key.length < 3) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (key[2] !== key[2]?.toUpperCase()) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return typeof outer === "function" && typeof inner === "function";
|
|
154
|
+
}
|
|
155
|
+
__name(isEventHandler, "isEventHandler");
|
|
156
|
+
function composeHandlers(outer, inner) {
|
|
157
|
+
return (...args) => {
|
|
158
|
+
outer(...args);
|
|
159
|
+
inner(...args);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
__name(composeHandlers, "composeHandlers");
|
|
163
|
+
|
|
164
|
+
// src/theme/px.ts
|
|
165
|
+
function px(value) {
|
|
166
|
+
if (typeof value === "number") {
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
const n = Number.parseFloat(value);
|
|
170
|
+
return Number.isFinite(n) ? n : 0;
|
|
171
|
+
}
|
|
172
|
+
__name(px, "px");
|
|
173
|
+
|
|
174
|
+
// ../tokens/build/theme.ts
|
|
175
|
+
var theme = {
|
|
176
|
+
color: {
|
|
177
|
+
danger: "#ef4444",
|
|
178
|
+
info: "#3b82f6",
|
|
179
|
+
neutral: {
|
|
180
|
+
"100": "#f4f4f5",
|
|
181
|
+
"200": "#e4e4e7",
|
|
182
|
+
"300": "#d4d4d8",
|
|
183
|
+
"400": "#a1a1aa",
|
|
184
|
+
"50": "#fafafa",
|
|
185
|
+
"500": "#71717a",
|
|
186
|
+
"600": "#52525b",
|
|
187
|
+
"700": "#3f3f46",
|
|
188
|
+
"800": "#27272a",
|
|
189
|
+
"900": "#18181b"
|
|
190
|
+
},
|
|
191
|
+
primary: {
|
|
192
|
+
"100": "#ccfbf1",
|
|
193
|
+
"200": "#99f6e4",
|
|
194
|
+
"300": "#5eead4",
|
|
195
|
+
"400": "#2dd4bf",
|
|
196
|
+
"50": "#f0fdfa",
|
|
197
|
+
"500": "#14b8a6",
|
|
198
|
+
"600": "#0d9488",
|
|
199
|
+
"700": "#0f766e",
|
|
200
|
+
"800": "#115e59",
|
|
201
|
+
"900": "#134e4a"
|
|
202
|
+
},
|
|
203
|
+
success: "#22c55e",
|
|
204
|
+
warning: "#f59e0b"
|
|
205
|
+
},
|
|
206
|
+
fontFamily: {
|
|
207
|
+
body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
208
|
+
display: "ui-serif, Georgia, 'Times New Roman', serif",
|
|
209
|
+
mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
|
|
210
|
+
},
|
|
211
|
+
fontSize: {
|
|
212
|
+
"2xl": "24px",
|
|
213
|
+
"3xl": "30px",
|
|
214
|
+
"4xl": "36px",
|
|
215
|
+
lg: "18px",
|
|
216
|
+
md: "16px",
|
|
217
|
+
sm: "14px",
|
|
218
|
+
xl: "20px",
|
|
219
|
+
xs: "12px"
|
|
220
|
+
},
|
|
221
|
+
fontWeight: {
|
|
222
|
+
bold: "700",
|
|
223
|
+
medium: "500",
|
|
224
|
+
regular: "400",
|
|
225
|
+
semibold: "600"
|
|
226
|
+
},
|
|
227
|
+
lineHeight: {
|
|
228
|
+
normal: "1.4",
|
|
229
|
+
relaxed: "1.6",
|
|
230
|
+
tight: "1.2"
|
|
231
|
+
},
|
|
232
|
+
radius: {
|
|
233
|
+
"2xl": "16px",
|
|
234
|
+
full: "9999px",
|
|
235
|
+
lg: "8px",
|
|
236
|
+
md: "6px",
|
|
237
|
+
none: "0px",
|
|
238
|
+
sm: "4px",
|
|
239
|
+
xl: "12px"
|
|
240
|
+
},
|
|
241
|
+
semantic: {
|
|
242
|
+
background: {
|
|
243
|
+
default: "#fafafa",
|
|
244
|
+
elevated: "#ffffff",
|
|
245
|
+
subtle: "#f4f4f5"
|
|
246
|
+
},
|
|
247
|
+
border: {
|
|
248
|
+
default: "#e4e4e7",
|
|
249
|
+
strong: "#d4d4d8"
|
|
250
|
+
},
|
|
251
|
+
interactive: {
|
|
252
|
+
destructive: "#ef4444",
|
|
253
|
+
primary: "#0d9488",
|
|
254
|
+
primaryHover: "#0f766e",
|
|
255
|
+
primaryPressed: "#115e59"
|
|
256
|
+
},
|
|
257
|
+
text: {
|
|
258
|
+
default: "#18181b",
|
|
259
|
+
inverted: "#fafafa",
|
|
260
|
+
muted: "#52525b"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
shadow: {
|
|
264
|
+
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
|
|
265
|
+
md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
|
|
266
|
+
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
|
|
267
|
+
},
|
|
268
|
+
spacing: {
|
|
269
|
+
"0": "0px",
|
|
270
|
+
"1": "4px",
|
|
271
|
+
"10": "40px",
|
|
272
|
+
"12": "48px",
|
|
273
|
+
"16": "64px",
|
|
274
|
+
"2": "8px",
|
|
275
|
+
"20": "80px",
|
|
276
|
+
"24": "96px",
|
|
277
|
+
"3": "12px",
|
|
278
|
+
"4": "16px",
|
|
279
|
+
"5": "20px",
|
|
280
|
+
"6": "24px",
|
|
281
|
+
"8": "32px"
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var themeDark = {
|
|
285
|
+
color: {
|
|
286
|
+
danger: "#ef4444",
|
|
287
|
+
info: "#3b82f6",
|
|
288
|
+
neutral: {
|
|
289
|
+
"100": "#f4f4f5",
|
|
290
|
+
"200": "#e4e4e7",
|
|
291
|
+
"300": "#d4d4d8",
|
|
292
|
+
"400": "#a1a1aa",
|
|
293
|
+
"50": "#fafafa",
|
|
294
|
+
"500": "#71717a",
|
|
295
|
+
"600": "#52525b",
|
|
296
|
+
"700": "#3f3f46",
|
|
297
|
+
"800": "#27272a",
|
|
298
|
+
"900": "#18181b"
|
|
299
|
+
},
|
|
300
|
+
primary: {
|
|
301
|
+
"100": "#ccfbf1",
|
|
302
|
+
"200": "#99f6e4",
|
|
303
|
+
"300": "#5eead4",
|
|
304
|
+
"400": "#2dd4bf",
|
|
305
|
+
"50": "#f0fdfa",
|
|
306
|
+
"500": "#14b8a6",
|
|
307
|
+
"600": "#0d9488",
|
|
308
|
+
"700": "#0f766e",
|
|
309
|
+
"800": "#115e59",
|
|
310
|
+
"900": "#134e4a"
|
|
311
|
+
},
|
|
312
|
+
success: "#22c55e",
|
|
313
|
+
warning: "#f59e0b"
|
|
314
|
+
},
|
|
315
|
+
fontFamily: {
|
|
316
|
+
body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
317
|
+
display: "ui-serif, Georgia, 'Times New Roman', serif",
|
|
318
|
+
mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
|
|
319
|
+
},
|
|
320
|
+
fontSize: {
|
|
321
|
+
"2xl": "24px",
|
|
322
|
+
"3xl": "30px",
|
|
323
|
+
"4xl": "36px",
|
|
324
|
+
lg: "18px",
|
|
325
|
+
md: "16px",
|
|
326
|
+
sm: "14px",
|
|
327
|
+
xl: "20px",
|
|
328
|
+
xs: "12px"
|
|
329
|
+
},
|
|
330
|
+
fontWeight: {
|
|
331
|
+
bold: "700",
|
|
332
|
+
medium: "500",
|
|
333
|
+
regular: "400",
|
|
334
|
+
semibold: "600"
|
|
335
|
+
},
|
|
336
|
+
lineHeight: {
|
|
337
|
+
normal: "1.4",
|
|
338
|
+
relaxed: "1.6",
|
|
339
|
+
tight: "1.2"
|
|
340
|
+
},
|
|
341
|
+
radius: {
|
|
342
|
+
"2xl": "16px",
|
|
343
|
+
full: "9999px",
|
|
344
|
+
lg: "8px",
|
|
345
|
+
md: "6px",
|
|
346
|
+
none: "0px",
|
|
347
|
+
sm: "4px",
|
|
348
|
+
xl: "12px"
|
|
349
|
+
},
|
|
350
|
+
semantic: {
|
|
351
|
+
background: {
|
|
352
|
+
default: "#18181b",
|
|
353
|
+
elevated: "#3f3f46",
|
|
354
|
+
subtle: "#27272a"
|
|
355
|
+
},
|
|
356
|
+
border: {
|
|
357
|
+
default: "#3f3f46",
|
|
358
|
+
strong: "#52525b"
|
|
359
|
+
},
|
|
360
|
+
interactive: {
|
|
361
|
+
destructive: "#ef4444",
|
|
362
|
+
primary: "#2dd4bf",
|
|
363
|
+
primaryHover: "#5eead4",
|
|
364
|
+
primaryPressed: "#99f6e4"
|
|
365
|
+
},
|
|
366
|
+
text: {
|
|
367
|
+
default: "#fafafa",
|
|
368
|
+
inverted: "#18181b",
|
|
369
|
+
muted: "#a1a1aa"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
shadow: {
|
|
373
|
+
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
|
|
374
|
+
md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
|
|
375
|
+
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
|
|
376
|
+
},
|
|
377
|
+
spacing: {
|
|
378
|
+
"0": "0px",
|
|
379
|
+
"1": "4px",
|
|
380
|
+
"10": "40px",
|
|
381
|
+
"12": "48px",
|
|
382
|
+
"16": "64px",
|
|
383
|
+
"2": "8px",
|
|
384
|
+
"20": "80px",
|
|
385
|
+
"24": "96px",
|
|
386
|
+
"3": "12px",
|
|
387
|
+
"4": "16px",
|
|
388
|
+
"5": "20px",
|
|
389
|
+
"6": "24px",
|
|
390
|
+
"8": "32px"
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
var defaultTheme = {
|
|
394
|
+
light: theme,
|
|
395
|
+
dark: themeDark
|
|
396
|
+
};
|
|
397
|
+
var ThemeContext = react.createContext(defaultTheme);
|
|
398
|
+
ThemeContext.displayName = "ThemeContext";
|
|
399
|
+
var ColorSchemeOverrideContext = react.createContext(null);
|
|
400
|
+
ColorSchemeOverrideContext.displayName = "ColorSchemeOverrideContext";
|
|
401
|
+
var isWeb = reactNative.Platform.OS === "web";
|
|
402
|
+
function readWebScheme() {
|
|
403
|
+
if (typeof document === "undefined") {
|
|
404
|
+
return "light";
|
|
405
|
+
}
|
|
406
|
+
const root = document.documentElement;
|
|
407
|
+
if (root.classList.contains("dark")) {
|
|
408
|
+
return "dark";
|
|
409
|
+
}
|
|
410
|
+
if (root.getAttribute("data-theme") === "dark") {
|
|
411
|
+
return "dark";
|
|
412
|
+
}
|
|
413
|
+
return "light";
|
|
414
|
+
}
|
|
415
|
+
__name(readWebScheme, "readWebScheme");
|
|
416
|
+
function useColorScheme() {
|
|
417
|
+
const override = react.useContext(ColorSchemeOverrideContext);
|
|
418
|
+
const [scheme, setScheme] = react.useState(() => {
|
|
419
|
+
if (isWeb) {
|
|
420
|
+
return readWebScheme();
|
|
421
|
+
}
|
|
422
|
+
return reactNative.Appearance.getColorScheme() ?? "light";
|
|
423
|
+
});
|
|
424
|
+
react.useEffect(() => {
|
|
425
|
+
if (isWeb) {
|
|
426
|
+
const root = document.documentElement;
|
|
427
|
+
const update = /* @__PURE__ */ __name(() => setScheme(readWebScheme()), "update");
|
|
428
|
+
const observer = new MutationObserver(update);
|
|
429
|
+
observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
|
|
430
|
+
update();
|
|
431
|
+
return () => observer.disconnect();
|
|
432
|
+
}
|
|
433
|
+
const sub = reactNative.Appearance.addChangeListener(({ colorScheme }) => {
|
|
434
|
+
setScheme(colorScheme ?? "light");
|
|
435
|
+
});
|
|
436
|
+
return () => sub.remove();
|
|
437
|
+
}, []);
|
|
438
|
+
return override ?? scheme;
|
|
439
|
+
}
|
|
440
|
+
__name(useColorScheme, "useColorScheme");
|
|
441
|
+
|
|
442
|
+
// src/theme/use-theme-colors.ts
|
|
443
|
+
function useThemeColors() {
|
|
444
|
+
const scheme = useColorScheme();
|
|
445
|
+
const themePair = react.useContext(ThemeContext);
|
|
446
|
+
return scheme === "dark" ? themePair.dark : themePair.light;
|
|
447
|
+
}
|
|
448
|
+
__name(useThemeColors, "useThemeColors");
|
|
449
|
+
|
|
450
|
+
// src/utils/cn.ts
|
|
451
|
+
function cn(...inputs) {
|
|
452
|
+
const out = [];
|
|
453
|
+
for (const input of inputs) {
|
|
454
|
+
append(out, input);
|
|
455
|
+
}
|
|
456
|
+
return out.join(" ");
|
|
457
|
+
}
|
|
458
|
+
__name(cn, "cn");
|
|
459
|
+
function append(out, input) {
|
|
460
|
+
if (!input) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (typeof input === "string") {
|
|
464
|
+
if (input.length > 0) {
|
|
465
|
+
out.push(input);
|
|
466
|
+
}
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (typeof input === "number") {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (Array.isArray(input)) {
|
|
473
|
+
for (const inner of input) {
|
|
474
|
+
append(out, inner);
|
|
475
|
+
}
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
if (typeof input === "object") {
|
|
479
|
+
for (const key of Object.keys(input)) {
|
|
480
|
+
if (input[key]) {
|
|
481
|
+
out.push(key);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
__name(append, "append");
|
|
487
|
+
var ROW_LAYOUT_BASE = { flexDirection: "row", alignItems: "center" };
|
|
488
|
+
var TRACK_BASE = {
|
|
489
|
+
width: 40,
|
|
490
|
+
height: 24,
|
|
491
|
+
borderRadius: 12,
|
|
492
|
+
// Relative so the absolutely-positioned thumb anchors against the
|
|
493
|
+
// track (not the page). The thumb's `left` value transitions between
|
|
494
|
+
// 2 (off) and 18 (on) — see thumb style below.
|
|
495
|
+
position: "relative"
|
|
496
|
+
};
|
|
497
|
+
var THUMB_BASE_STYLE = {
|
|
498
|
+
width: 20,
|
|
499
|
+
height: 20,
|
|
500
|
+
borderRadius: 10,
|
|
501
|
+
// Web: boxShadow (the modern CSS-style replacement for the legacy RN
|
|
502
|
+
// `shadow*` props that react-native-web has deprecated).
|
|
503
|
+
// Native: elevation (Android) — RN ignores boxShadow there.
|
|
504
|
+
...{ boxShadow: "0 1px 2px rgba(0, 0, 0, 0.15)" },
|
|
505
|
+
elevation: 2
|
|
506
|
+
};
|
|
507
|
+
var Switch = /* @__PURE__ */ __name(({
|
|
508
|
+
checked,
|
|
509
|
+
defaultChecked = false,
|
|
510
|
+
disabled,
|
|
511
|
+
onChange,
|
|
512
|
+
label,
|
|
513
|
+
className,
|
|
514
|
+
testID,
|
|
515
|
+
asChild,
|
|
516
|
+
children
|
|
517
|
+
}) => {
|
|
518
|
+
const colors = useThemeColors();
|
|
519
|
+
const [inner, setInner] = react.useState(defaultChecked);
|
|
520
|
+
const isControlled = checked !== void 0;
|
|
521
|
+
const value = isControlled ? Boolean(checked) : inner;
|
|
522
|
+
const slide = useAnimatedNumber("left", value ? 18 : 2);
|
|
523
|
+
const toggle = react.useCallback(() => {
|
|
524
|
+
if (disabled) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const next = !value;
|
|
528
|
+
if (!isControlled) {
|
|
529
|
+
setInner(next);
|
|
530
|
+
}
|
|
531
|
+
onChange?.(next);
|
|
532
|
+
}, [disabled, value, isControlled, onChange]);
|
|
533
|
+
const ariaChecked = value ? "true" : "false";
|
|
534
|
+
const commonProps = {
|
|
535
|
+
role: "switch",
|
|
536
|
+
"aria-checked": ariaChecked,
|
|
537
|
+
accessibilityRole: "switch",
|
|
538
|
+
accessibilityState: { checked: value, disabled: Boolean(disabled) },
|
|
539
|
+
testID
|
|
540
|
+
};
|
|
541
|
+
if (disabled) {
|
|
542
|
+
commonProps["aria-disabled"] = true;
|
|
543
|
+
}
|
|
544
|
+
if (label !== void 0) {
|
|
545
|
+
commonProps["aria-label"] = label;
|
|
546
|
+
commonProps.accessibilityLabel = label;
|
|
547
|
+
}
|
|
548
|
+
if (asChild) {
|
|
549
|
+
const slotProps = {
|
|
550
|
+
role: "switch",
|
|
551
|
+
"aria-checked": ariaChecked,
|
|
552
|
+
onClick: toggle
|
|
553
|
+
};
|
|
554
|
+
if (disabled) {
|
|
555
|
+
slotProps["aria-disabled"] = true;
|
|
556
|
+
}
|
|
557
|
+
if (label !== void 0) {
|
|
558
|
+
slotProps["aria-label"] = label;
|
|
559
|
+
}
|
|
560
|
+
if (testID !== void 0) {
|
|
561
|
+
slotProps["data-testid"] = testID;
|
|
562
|
+
}
|
|
563
|
+
if (className !== void 0) {
|
|
564
|
+
slotProps.className = className;
|
|
565
|
+
}
|
|
566
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Slot, { ...slotProps, children });
|
|
567
|
+
}
|
|
568
|
+
const trackClasses = cn(
|
|
569
|
+
"w-10 h-6 rounded-full justify-center px-0.5 transition-colors",
|
|
570
|
+
value ? "bg-semantic-interactive-primary" : "bg-neutral-300 dark:bg-neutral-700",
|
|
571
|
+
disabled ? "opacity-60" : void 0
|
|
572
|
+
);
|
|
573
|
+
const thumbClasses = cn("w-5 h-5 rounded-full bg-white dark:bg-neutral-100 shadow-sm");
|
|
574
|
+
const trackStyle = [
|
|
575
|
+
TRACK_BASE,
|
|
576
|
+
{
|
|
577
|
+
backgroundColor: value ? colors.semantic.interactive.primary : colors.color.neutral["600"],
|
|
578
|
+
// Subtle 180ms color transition between off → on. Web only;
|
|
579
|
+
// native has no equivalent for the track tint in v1.
|
|
580
|
+
...{ transitionProperty: "background-color", transitionDuration: "180ms" }
|
|
581
|
+
},
|
|
582
|
+
disabled ? { opacity: 0.6 } : null
|
|
583
|
+
];
|
|
584
|
+
const thumbStyle = [
|
|
585
|
+
THUMB_BASE_STYLE,
|
|
586
|
+
{
|
|
587
|
+
backgroundColor: colors.color.neutral["50"],
|
|
588
|
+
position: "absolute",
|
|
589
|
+
top: 2
|
|
590
|
+
},
|
|
591
|
+
slide
|
|
592
|
+
];
|
|
593
|
+
const rowStyle = { ...ROW_LAYOUT_BASE, gap: px(colors.spacing["2"]) };
|
|
594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
595
|
+
reactNative.Pressable,
|
|
596
|
+
{
|
|
597
|
+
onPress: toggle,
|
|
598
|
+
...commonProps,
|
|
599
|
+
className: cn("flex-row items-center gap-2", className),
|
|
600
|
+
style: rowStyle,
|
|
601
|
+
children: [
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { className: trackClasses, style: trackStyle, children: /* @__PURE__ */ jsxRuntime.jsx(AnimatedView, { className: thumbClasses, style: thumbStyle }) }),
|
|
603
|
+
label ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
604
|
+
reactNative.Text,
|
|
605
|
+
{
|
|
606
|
+
className: "text-md text-semantic-text-default",
|
|
607
|
+
style: {
|
|
608
|
+
color: colors.semantic.text.default,
|
|
609
|
+
fontFamily: colors.fontFamily.body,
|
|
610
|
+
fontSize: px(colors.fontSize.md)
|
|
611
|
+
},
|
|
612
|
+
children: label
|
|
613
|
+
}
|
|
614
|
+
) : null,
|
|
615
|
+
children
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}, "Switch");
|
|
620
|
+
|
|
621
|
+
exports.Switch = Switch;
|
|
622
|
+
//# sourceMappingURL=index.cjs.map
|
|
623
|
+
//# sourceMappingURL=index.cjs.map
|