@admin-layout/gluestack-ui-mobile 11.0.1-alpha.0 → 11.0.3-alpha.0
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/CHANGELOG.md +8 -0
- package/lib/components/Fallback.js +12 -12
- package/lib/components/Fallback.js.map +1 -1
- package/lib/components/Layout/components/BasicLayout.js +2 -2
- package/lib/components/Layout/components/BasicLayout.js.map +1 -1
- package/lib/components/Layout/components/BottomTabBar.js +6 -6
- package/lib/components/Layout/components/BottomTabBar.js.map +1 -1
- package/lib/components/Layout/components/Drawer.js +16 -17
- package/lib/components/Layout/components/Drawer.js.map +1 -1
- package/lib/components/Layout/components/Header.js +12 -15
- package/lib/components/Layout/components/Header.js.map +1 -1
- package/lib/components/Layout/components/Sample.js +1 -1
- package/lib/components/Layout/components/Sample.js.map +1 -1
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +9 -9
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -1
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js +37 -36
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js.map +1 -1
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +13 -2
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js.map +1 -1
- package/lib/components/Layout/components/SideBar.js +7 -10
- package/lib/components/Layout/components/SideBar.js.map +1 -1
- package/lib/components/ToastAlert.d.ts +1 -1
- package/lib/components/ToastAlert.js +4 -4
- package/lib/components/ToastAlert.js.map +1 -1
- package/lib/components/UnAuthenticatedComponent.js +9 -9
- package/lib/components/UnAuthenticatedComponent.js.map +1 -1
- package/lib/components/WithConfiguration.js +1 -1
- package/lib/components/WithConfiguration.js.map +1 -1
- package/lib/components/WithPermission.d.ts +1 -1
- package/lib/components/WithPermission.js +1 -1
- package/lib/components/WithPermission.js.map +1 -1
- package/lib/components/WithPolicy.js +1 -1
- package/lib/components/WithPolicy.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/ui/IconSymbol.d.ts +19 -0
- package/lib/components/ui/IconSymbol.ios.d.ts +10 -0
- package/lib/components/ui/IconSymbol.ios.js +12 -0
- package/lib/components/ui/IconSymbol.ios.js.map +1 -0
- package/lib/components/ui/IconSymbol.js +21 -0
- package/lib/components/ui/IconSymbol.js.map +1 -0
- package/lib/components/ui/TabBarBackground.d.ts +2 -0
- package/lib/components/ui/TabBarBackground.ios.d.ts +3 -0
- package/lib/components/ui/TabBarBackground.ios.js +20 -0
- package/lib/components/ui/TabBarBackground.ios.js.map +1 -0
- package/lib/components/ui/TabBarBackground.js +6 -0
- package/lib/components/ui/TabBarBackground.js.map +1 -0
- package/lib/components/ui/accordion/index.d.ts +193 -0
- package/lib/components/ui/accordion/index.js +177 -0
- package/lib/components/ui/accordion/index.js.map +1 -0
- package/lib/components/ui/actionsheet/index.d.ts +735 -0
- package/lib/components/ui/actionsheet/index.js +274 -0
- package/lib/components/ui/actionsheet/index.js.map +1 -0
- package/lib/components/ui/alert/index.d.ts +479 -0
- package/lib/components/ui/alert/index.js +153 -0
- package/lib/components/ui/alert/index.js.map +1 -0
- package/lib/components/ui/alert-dialog/index.d.ts +59 -0
- package/lib/components/ui/alert-dialog/index.js +137 -0
- package/lib/components/ui/alert-dialog/index.js.map +1 -0
- package/lib/components/ui/avatar/index.d.ts +144 -0
- package/lib/components/ui/avatar/index.js +99 -0
- package/lib/components/ui/avatar/index.js.map +1 -0
- package/lib/components/ui/badge/index.d.ts +386 -0
- package/lib/components/ui/badge/index.js +139 -0
- package/lib/components/ui/badge/index.js.map +1 -0
- package/lib/components/ui/box/index.d.ts +7 -0
- package/lib/components/ui/box/index.js +9 -0
- package/lib/components/ui/box/index.js.map +1 -0
- package/lib/components/ui/box/index.web.d.ts +6 -0
- package/lib/components/ui/box/index.web.js +8 -0
- package/lib/components/ui/box/index.web.js.map +1 -0
- package/lib/components/ui/box/styles.d.ts +1 -0
- package/lib/components/ui/box/styles.js +9 -0
- package/lib/components/ui/box/styles.js.map +1 -0
- package/lib/components/ui/button/index.d.ts +529 -0
- package/lib/components/ui/button/index.js +280 -0
- package/lib/components/ui/button/index.js.map +1 -0
- package/lib/components/ui/card/index.d.ts +129 -0
- package/lib/components/ui/card/index.js +9 -0
- package/lib/components/ui/card/index.js.map +1 -0
- package/lib/components/ui/card/index.web.d.ts +126 -0
- package/lib/components/ui/card/index.web.js +8 -0
- package/lib/components/ui/card/index.web.js.map +1 -0
- package/lib/components/ui/card/styles.d.ts +123 -0
- package/lib/components/ui/card/styles.js +20 -0
- package/lib/components/ui/card/styles.js.map +1 -0
- package/lib/components/ui/center/index.d.ts +5 -0
- package/lib/components/ui/center/index.js +9 -0
- package/lib/components/ui/center/index.js.map +1 -0
- package/lib/components/ui/center/index.web.d.ts +4 -0
- package/lib/components/ui/center/index.web.js +8 -0
- package/lib/components/ui/center/index.web.js.map +1 -0
- package/lib/components/ui/center/styles.d.ts +1 -0
- package/lib/components/ui/center/styles.js +7 -0
- package/lib/components/ui/center/styles.js.map +1 -0
- package/lib/components/ui/checkbox/index.d.ts +115 -0
- package/lib/components/ui/checkbox/index.js +127 -0
- package/lib/components/ui/checkbox/index.js.map +1 -0
- package/lib/components/ui/divider/index.d.ts +54 -0
- package/lib/components/ui/divider/index.js +22 -0
- package/lib/components/ui/divider/index.js.map +1 -0
- package/lib/components/ui/drawer/index.d.ts +207 -0
- package/lib/components/ui/drawer/index.js +198 -0
- package/lib/components/ui/drawer/index.js.map +1 -0
- package/lib/components/ui/fab/index.d.ts +520 -0
- package/lib/components/ui/fab/index.js +142 -0
- package/lib/components/ui/fab/index.js.map +1 -0
- package/lib/components/ui/flat-list/index.d.ts +1 -0
- package/lib/components/ui/flat-list/index.js +3 -0
- package/lib/components/ui/flat-list/index.js.map +1 -0
- package/lib/components/ui/form-control/index.d.ts +2072 -0
- package/lib/components/ui/form-control/index.js +290 -0
- package/lib/components/ui/form-control/index.js.map +1 -0
- package/lib/components/ui/gluestack-ui-provider/config.d.ts +4 -0
- package/lib/components/ui/gluestack-ui-provider/config.js +287 -0
- package/lib/components/ui/gluestack-ui-provider/config.js.map +1 -0
- package/lib/components/ui/gluestack-ui-provider/index.d.ts +8 -0
- package/lib/components/ui/gluestack-ui-provider/index.js +22 -0
- package/lib/components/ui/gluestack-ui-provider/index.js.map +1 -0
- package/lib/components/ui/gluestack-ui-provider/index.web.d.ts +7 -0
- package/lib/components/ui/gluestack-ui-provider/index.web.js +69 -0
- package/lib/components/ui/gluestack-ui-provider/index.web.js.map +1 -0
- package/lib/components/ui/gluestack-ui-provider/script.d.ts +1 -0
- package/lib/components/ui/gluestack-ui-provider/script.js +17 -0
- package/lib/components/ui/gluestack-ui-provider/script.js.map +1 -0
- package/lib/components/ui/gluestack-ui-provider/types.d.ts +1 -0
- package/lib/components/ui/gluestack-ui-provider/types.js +2 -0
- package/lib/components/ui/gluestack-ui-provider/types.js.map +1 -0
- package/lib/components/ui/grid/index.d.ts +27 -0
- package/lib/components/ui/grid/index.js +175 -0
- package/lib/components/ui/grid/index.js.map +1 -0
- package/lib/components/ui/grid/index.web.d.ts +23 -0
- package/lib/components/ui/grid/index.web.js +20 -0
- package/lib/components/ui/grid/index.web.js.map +1 -0
- package/lib/components/ui/grid/styles.d.ts +2 -0
- package/lib/components/ui/grid/styles.js +11 -0
- package/lib/components/ui/grid/styles.js.map +1 -0
- package/lib/components/ui/heading/index.d.ts +335 -0
- package/lib/components/ui/heading/index.js +135 -0
- package/lib/components/ui/heading/index.js.map +1 -0
- package/lib/components/ui/heading/index.web.d.ts +335 -0
- package/lib/components/ui/heading/index.web.js +113 -0
- package/lib/components/ui/heading/index.web.js.map +1 -0
- package/lib/components/ui/heading/styles.d.ts +330 -0
- package/lib/components/ui/heading/styles.js +43 -0
- package/lib/components/ui/heading/styles.js.map +1 -0
- package/lib/components/ui/hstack/index.d.ts +150 -0
- package/lib/components/ui/hstack/index.js +9 -0
- package/lib/components/ui/hstack/index.js.map +1 -0
- package/lib/components/ui/hstack/index.web.d.ts +148 -0
- package/lib/components/ui/hstack/index.web.js +8 -0
- package/lib/components/ui/hstack/index.web.js.map +1 -0
- package/lib/components/ui/hstack/styles.d.ts +145 -0
- package/lib/components/ui/hstack/styles.js +24 -0
- package/lib/components/ui/hstack/styles.js.map +1 -0
- package/lib/components/ui/icon/index.d.ts +364 -0
- package/lib/components/ui/icon/index.js +565 -0
- package/lib/components/ui/icon/index.js.map +1 -0
- package/lib/components/ui/icon/index.web.d.ts +489 -0
- package/lib/components/ui/icon/index.web.js +555 -0
- package/lib/components/ui/icon/index.web.js.map +1 -0
- package/lib/components/ui/image/index.d.ts +132 -0
- package/lib/components/ui/image/index.js +33 -0
- package/lib/components/ui/image/index.js.map +1 -0
- package/lib/components/ui/image-background/index.d.ts +3 -0
- package/lib/components/ui/image-background/index.js +11 -0
- package/lib/components/ui/image-background/index.js.map +1 -0
- package/lib/components/ui/index.d.ts +54 -0
- package/lib/components/ui/index.js +55 -0
- package/lib/components/ui/index.js.map +1 -0
- package/lib/components/ui/input/index.d.ts +262 -0
- package/lib/components/ui/input/index.js +121 -0
- package/lib/components/ui/input/index.js.map +1 -0
- package/lib/components/ui/input-accessory-view/index.d.ts +1 -0
- package/lib/components/ui/input-accessory-view/index.js +3 -0
- package/lib/components/ui/input-accessory-view/index.js.map +1 -0
- package/lib/components/ui/keyboard-avoiding-view/index.d.ts +1 -0
- package/lib/components/ui/keyboard-avoiding-view/index.js +3 -0
- package/lib/components/ui/keyboard-avoiding-view/index.js.map +1 -0
- package/lib/components/ui/link/index.d.ts +369 -0
- package/lib/components/ui/link/index.js +69 -0
- package/lib/components/ui/link/index.js.map +1 -0
- package/lib/components/ui/menu/index.d.ts +376 -0
- package/lib/components/ui/menu/index.js +120 -0
- package/lib/components/ui/menu/index.js.map +1 -0
- package/lib/components/ui/modal/index.d.ts +146 -0
- package/lib/components/ui/modal/index.js +137 -0
- package/lib/components/ui/modal/index.js.map +1 -0
- package/lib/components/ui/popover/index.d.ts +310 -0
- package/lib/components/ui/popover/index.js +172 -0
- package/lib/components/ui/popover/index.js.map +1 -0
- package/lib/components/ui/portal/index.d.ts +2 -0
- package/lib/components/ui/portal/index.js +9 -0
- package/lib/components/ui/portal/index.js.map +1 -0
- package/lib/components/ui/pressable/index.d.ts +13 -0
- package/lib/components/ui/pressable/index.js +20 -0
- package/lib/components/ui/pressable/index.js.map +1 -0
- package/lib/components/ui/progress/index.d.ts +174 -0
- package/lib/components/ui/progress/index.js +127 -0
- package/lib/components/ui/progress/index.js.map +1 -0
- package/lib/components/ui/radio/index.d.ts +160 -0
- package/lib/components/ui/radio/index.js +122 -0
- package/lib/components/ui/radio/index.js.map +1 -0
- package/lib/components/ui/refresh-control/index.d.ts +1 -0
- package/lib/components/ui/refresh-control/index.js +3 -0
- package/lib/components/ui/refresh-control/index.js.map +1 -0
- package/lib/components/ui/safe-area-view/index.d.ts +6 -0
- package/lib/components/ui/safe-area-view/index.js +9 -0
- package/lib/components/ui/safe-area-view/index.js.map +1 -0
- package/lib/components/ui/safe-area-view/styles.d.ts +1 -0
- package/lib/components/ui/safe-area-view/styles.js +9 -0
- package/lib/components/ui/safe-area-view/styles.js.map +1 -0
- package/lib/components/ui/scroll-view/index.d.ts +1 -0
- package/lib/components/ui/scroll-view/index.js +3 -0
- package/lib/components/ui/scroll-view/index.js.map +1 -0
- package/lib/components/ui/section-list/index.d.ts +1 -0
- package/lib/components/ui/section-list/index.js +3 -0
- package/lib/components/ui/section-list/index.js.map +1 -0
- package/lib/components/ui/select/index.d.ts +1708 -0
- package/lib/components/ui/select/index.js +155 -0
- package/lib/components/ui/select/index.js.map +1 -0
- package/lib/components/ui/select/select-actionsheet.d.ts +900 -0
- package/lib/components/ui/select/select-actionsheet.js +275 -0
- package/lib/components/ui/select/select-actionsheet.js.map +1 -0
- package/lib/components/ui/skeleton/index.d.ts +268 -0
- package/lib/components/ui/skeleton/index.js +63 -0
- package/lib/components/ui/skeleton/index.js.map +1 -0
- package/lib/components/ui/skeleton/index.web.d.ts +267 -0
- package/lib/components/ui/skeleton/index.web.js +37 -0
- package/lib/components/ui/skeleton/index.web.js.map +1 -0
- package/lib/components/ui/skeleton/styles.d.ts +257 -0
- package/lib/components/ui/skeleton/styles.js +35 -0
- package/lib/components/ui/skeleton/styles.js.map +1 -0
- package/lib/components/ui/slider/index.d.ts +211 -0
- package/lib/components/ui/slider/index.js +180 -0
- package/lib/components/ui/slider/index.js.map +1 -0
- package/lib/components/ui/spinner/index.d.ts +4 -0
- package/lib/components/ui/spinner/index.js +15 -0
- package/lib/components/ui/spinner/index.js.map +1 -0
- package/lib/components/ui/status-bar/index.d.ts +1 -0
- package/lib/components/ui/status-bar/index.js +3 -0
- package/lib/components/ui/status-bar/index.js.map +1 -0
- package/lib/components/ui/switch/index.d.ts +72 -0
- package/lib/components/ui/switch/index.js +25 -0
- package/lib/components/ui/switch/index.js.map +1 -0
- package/lib/components/ui/table/index.d.ts +17 -0
- package/lib/components/ui/table/index.js +96 -0
- package/lib/components/ui/table/index.js.map +1 -0
- package/lib/components/ui/table/index.web.d.ts +10 -0
- package/lib/components/ui/table/index.web.js +60 -0
- package/lib/components/ui/table/index.web.js.map +1 -0
- package/lib/components/ui/table/styles.d.ts +75 -0
- package/lib/components/ui/table/styles.js +36 -0
- package/lib/components/ui/table/styles.js.map +1 -0
- package/lib/components/ui/text/index.d.ts +358 -0
- package/lib/components/ui/text/index.js +19 -0
- package/lib/components/ui/text/index.js.map +1 -0
- package/lib/components/ui/text/index.web.d.ts +6 -0
- package/lib/components/ui/text/index.web.js +18 -0
- package/lib/components/ui/text/index.web.js.map +1 -0
- package/lib/components/ui/text/styles.d.ts +352 -0
- package/lib/components/ui/text/styles.js +45 -0
- package/lib/components/ui/text/styles.js.map +1 -0
- package/lib/components/ui/textarea/index.d.ts +129 -0
- package/lib/components/ui/textarea/index.js +52 -0
- package/lib/components/ui/textarea/index.js.map +1 -0
- package/lib/components/ui/toast/index.d.ts +527 -0
- package/lib/components/ui/toast/index.js +165 -0
- package/lib/components/ui/toast/index.js.map +1 -0
- package/lib/components/ui/tooltip/index.d.ts +391 -0
- package/lib/components/ui/tooltip/index.js +75 -0
- package/lib/components/ui/tooltip/index.js.map +1 -0
- package/lib/components/ui/utils/use-break-point-value.d.ts +14 -0
- package/lib/components/ui/utils/use-break-point-value.js +54 -0
- package/lib/components/ui/utils/use-break-point-value.js.map +1 -0
- package/lib/components/ui/view/index.d.ts +1 -0
- package/lib/components/ui/view/index.js +3 -0
- package/lib/components/ui/view/index.js.map +1 -0
- package/lib/components/ui/virtualized-list/index.d.ts +1 -0
- package/lib/components/ui/virtualized-list/index.js +3 -0
- package/lib/components/ui/virtualized-list/index.js.map +1 -0
- package/lib/components/ui/vstack/index.d.ts +149 -0
- package/lib/components/ui/vstack/index.js +9 -0
- package/lib/components/ui/vstack/index.js.map +1 -0
- package/lib/components/ui/vstack/index.web.d.ts +6 -0
- package/lib/components/ui/vstack/index.web.js +8 -0
- package/lib/components/ui/vstack/index.web.js.map +1 -0
- package/lib/components/ui/vstack/styles.d.ts +145 -0
- package/lib/components/ui/vstack/styles.js +24 -0
- package/lib/components/ui/vstack/styles.js.map +1 -0
- package/lib/components/usePermissionAutoFetch.d.ts +19 -7
- package/lib/components/with-interactions-lifecycle-managed.js +13 -11
- package/lib/components/with-interactions-lifecycle-managed.js.map +1 -1
- package/lib/components/with-interactions-managed.js +3 -3
- package/lib/components/with-interactions-managed.js.map +1 -1
- package/lib/containers/layout/ProLayout.js +2 -2
- package/lib/containers/layout/ProLayout.js.map +1 -1
- package/lib/global.css +3 -0
- package/lib/gluestack-ui-base-config.d.ts +8 -0
- package/lib/gluestack-ui-base-config.js +12 -0
- package/lib/gluestack-ui-base-config.js.map +1 -0
- package/lib/gluestack-ui.config.json +10 -0
- package/lib/index.d.ts +0 -3
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/nativewind-env.d.ts +1 -0
- package/lib/tailwind-base-config.d.ts +194 -0
- package/lib/tailwind-base-config.js +197 -0
- package/lib/tailwind-base-config.js.map +1 -0
- package/lib/tailwind.config.d.ts +1 -0
- package/lib/tailwind.config.js +197 -0
- package/lib/tailwind.config.js.map +1 -0
- package/lib/utils/generateMobileNavigations.js +26 -2
- package/lib/utils/generateMobileNavigations.js.map +1 -1
- package/package.json +39 -8
- package/src/components/Fallback.tsx +54 -58
- package/src/components/Layout/components/BasicLayout.tsx +2 -2
- package/src/components/Layout/components/BottomTabBar.tsx +92 -101
- package/src/components/Layout/components/Drawer.tsx +31 -28
- package/src/components/Layout/components/Header.tsx +26 -27
- package/src/components/Layout/components/Sample.tsx +1 -1
- package/src/components/Layout/components/SettingDrawer/LayoutButton.tsx +15 -29
- package/src/components/Layout/components/SettingDrawer/SettingDrawer.tsx +49 -57
- package/src/components/Layout/components/SettingDrawer/ThemeColorButton.tsx +14 -5
- package/src/components/Layout/components/SideBar.tsx +12 -17
- package/src/components/ToastAlert.tsx +13 -13
- package/src/components/UnAuthenticatedComponent.tsx +19 -27
- package/src/components/WithConfiguration.tsx +1 -1
- package/src/components/WithPermission.tsx +1 -1
- package/src/components/WithPolicy.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/ui/IconSymbol.ios.tsx +33 -0
- package/src/components/ui/IconSymbol.tsx +40 -0
- package/src/components/ui/TabBarBackground.ios.tsx +23 -0
- package/src/components/ui/TabBarBackground.tsx +6 -0
- package/src/components/ui/accordion/index.tsx +304 -0
- package/src/components/ui/actionsheet/index.tsx +499 -0
- package/src/components/ui/alert/index.tsx +205 -0
- package/src/components/ui/alert-dialog/index.tsx +260 -0
- package/src/components/ui/avatar/index.tsx +162 -0
- package/src/components/ui/badge/index.tsx +188 -0
- package/src/components/ui/box/index.tsx +14 -0
- package/src/components/ui/box/index.web.tsx +13 -0
- package/src/components/ui/box/styles.tsx +10 -0
- package/src/components/ui/button/index.tsx +353 -0
- package/src/components/ui/card/index.tsx +16 -0
- package/src/components/ui/card/index.web.tsx +15 -0
- package/src/components/ui/card/styles.tsx +20 -0
- package/src/components/ui/center/index.tsx +14 -0
- package/src/components/ui/center/index.web.tsx +14 -0
- package/src/components/ui/center/styles.tsx +8 -0
- package/src/components/ui/checkbox/index.tsx +192 -0
- package/src/components/ui/divider/index.tsx +38 -0
- package/src/components/ui/drawer/index.tsx +311 -0
- package/src/components/ui/fab/index.tsx +190 -0
- package/src/components/ui/flat-list/index.tsx +2 -0
- package/src/components/ui/form-control/index.tsx +432 -0
- package/src/components/ui/gluestack-ui-provider/config.ts +309 -0
- package/src/components/ui/gluestack-ui-provider/index.tsx +38 -0
- package/src/components/ui/gluestack-ui-provider/index.web.tsx +88 -0
- package/src/components/ui/gluestack-ui-provider/script.ts +17 -0
- package/src/components/ui/gluestack-ui-provider/types.ts +1 -0
- package/src/components/ui/grid/index.tsx +284 -0
- package/src/components/ui/grid/index.web.tsx +61 -0
- package/src/components/ui/grid/styles.tsx +13 -0
- package/src/components/ui/heading/index.tsx +193 -0
- package/src/components/ui/heading/index.web.tsx +177 -0
- package/src/components/ui/heading/styles.tsx +43 -0
- package/src/components/ui/hstack/index.tsx +17 -0
- package/src/components/ui/hstack/index.web.tsx +15 -0
- package/src/components/ui/hstack/styles.tsx +25 -0
- package/src/components/ui/icon/index.tsx +1202 -0
- package/src/components/ui/icon/index.web.tsx +1190 -0
- package/src/components/ui/image/index.tsx +48 -0
- package/src/components/ui/image-background/index.tsx +21 -0
- package/src/components/ui/index.ts +54 -0
- package/src/components/ui/input/index.tsx +191 -0
- package/src/components/ui/input-accessory-view/index.tsx +2 -0
- package/src/components/ui/keyboard-avoiding-view/index.tsx +2 -0
- package/src/components/ui/link/index.tsx +92 -0
- package/src/components/ui/menu/index.tsx +179 -0
- package/src/components/ui/modal/index.tsx +244 -0
- package/src/components/ui/popover/index.tsx +309 -0
- package/src/components/ui/portal/index.tsx +12 -0
- package/src/components/ui/pressable/index.tsx +34 -0
- package/src/components/ui/progress/index.tsx +160 -0
- package/src/components/ui/radio/index.tsx +178 -0
- package/src/components/ui/refresh-control/index.tsx +2 -0
- package/src/components/ui/safe-area-view/index.tsx +22 -0
- package/src/components/ui/safe-area-view/styles.tsx +10 -0
- package/src/components/ui/scroll-view/index.tsx +2 -0
- package/src/components/ui/section-list/index.tsx +2 -0
- package/src/components/ui/select/index.tsx +251 -0
- package/src/components/ui/select/select-actionsheet.tsx +503 -0
- package/src/components/ui/skeleton/index.tsx +113 -0
- package/src/components/ui/skeleton/index.web.tsx +92 -0
- package/src/components/ui/skeleton/styles.tsx +35 -0
- package/src/components/ui/slider/index.tsx +239 -0
- package/src/components/ui/spinner/index.tsx +31 -0
- package/src/components/ui/status-bar/index.tsx +2 -0
- package/src/components/ui/switch/index.tsx +33 -0
- package/src/components/ui/table/index.tsx +171 -0
- package/src/components/ui/table/index.web.tsx +95 -0
- package/src/components/ui/table/styles.tsx +44 -0
- package/src/components/ui/text/index.tsx +53 -0
- package/src/components/ui/text/index.web.tsx +45 -0
- package/src/components/ui/text/styles.tsx +47 -0
- package/src/components/ui/textarea/index.tsx +83 -0
- package/src/components/ui/toast/index.tsx +218 -0
- package/src/components/ui/tooltip/index.tsx +104 -0
- package/src/components/ui/utils/use-break-point-value.ts +79 -0
- package/src/components/ui/view/index.tsx +2 -0
- package/src/components/ui/virtualized-list/index.tsx +2 -0
- package/src/components/ui/vstack/index.tsx +17 -0
- package/src/components/ui/vstack/index.web.tsx +16 -0
- package/src/components/ui/vstack/styles.tsx +25 -0
- package/src/components/with-interactions-lifecycle-managed.tsx +13 -14
- package/src/components/with-interactions-managed.tsx +3 -7
- package/src/containers/layout/ProLayout.tsx +3 -3
- package/src/global.css +3 -0
- package/src/gluestack-ui-base-config.js +12 -0
- package/src/gluestack-ui.config.json +10 -0
- package/src/index.ts +6 -7
- package/src/nativewind-env.d.ts +1 -0
- package/src/tailwind-base-config.js +197 -0
- package/src/tailwind.config.js +198 -0
- package/src/utils/generateMobileNavigations.ts +29 -1
- package/tsconfig.json +3 -9
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { vars } from 'nativewind';
|
|
3
|
+
|
|
4
|
+
export const config = {
|
|
5
|
+
light: vars({
|
|
6
|
+
'--color-primary-0': '179 179 179',
|
|
7
|
+
'--color-primary-50': '153 153 153',
|
|
8
|
+
'--color-primary-100': '128 128 128',
|
|
9
|
+
'--color-primary-200': '115 115 115',
|
|
10
|
+
'--color-primary-300': '102 102 102',
|
|
11
|
+
'--color-primary-400': '82 82 82',
|
|
12
|
+
'--color-primary-500': '51 51 51',
|
|
13
|
+
'--color-primary-600': '41 41 41',
|
|
14
|
+
'--color-primary-700': '31 31 31',
|
|
15
|
+
'--color-primary-800': '13 13 13',
|
|
16
|
+
'--color-primary-900': '10 10 10',
|
|
17
|
+
'--color-primary-950': '8 8 8',
|
|
18
|
+
|
|
19
|
+
/* Secondary */
|
|
20
|
+
'--color-secondary-0': '253 253 253',
|
|
21
|
+
'--color-secondary-50': '251 251 251',
|
|
22
|
+
'--color-secondary-100': '246 246 246',
|
|
23
|
+
'--color-secondary-200': '242 242 242',
|
|
24
|
+
'--color-secondary-300': '237 237 237',
|
|
25
|
+
'--color-secondary-400': '230 230 231',
|
|
26
|
+
'--color-secondary-500': '217 217 219',
|
|
27
|
+
'--color-secondary-600': '198 199 199',
|
|
28
|
+
'--color-secondary-700': '189 189 189',
|
|
29
|
+
'--color-secondary-800': '177 177 177',
|
|
30
|
+
'--color-secondary-900': '165 164 164',
|
|
31
|
+
'--color-secondary-950': '157 157 157',
|
|
32
|
+
|
|
33
|
+
/* Tertiary */
|
|
34
|
+
'--color-tertiary-0': '255 250 245',
|
|
35
|
+
'--color-tertiary-50': '255 242 229',
|
|
36
|
+
'--color-tertiary-100': '255 233 213',
|
|
37
|
+
'--color-tertiary-200': '254 209 170',
|
|
38
|
+
'--color-tertiary-300': '253 180 116',
|
|
39
|
+
'--color-tertiary-400': '251 157 75',
|
|
40
|
+
'--color-tertiary-500': '231 129 40',
|
|
41
|
+
'--color-tertiary-600': '215 117 31',
|
|
42
|
+
'--color-tertiary-700': '180 98 26',
|
|
43
|
+
'--color-tertiary-800': '130 73 23',
|
|
44
|
+
'--color-tertiary-900': '108 61 19',
|
|
45
|
+
'--color-tertiary-950': '84 49 18',
|
|
46
|
+
|
|
47
|
+
/* Error */
|
|
48
|
+
'--color-error-0': '254 233 233',
|
|
49
|
+
'--color-error-50': '254 226 226',
|
|
50
|
+
'--color-error-100': '254 202 202',
|
|
51
|
+
'--color-error-200': '252 165 165',
|
|
52
|
+
'--color-error-300': '248 113 113',
|
|
53
|
+
'--color-error-400': '239 68 68',
|
|
54
|
+
'--color-error-500': '230 53 53',
|
|
55
|
+
'--color-error-600': '220 38 38',
|
|
56
|
+
'--color-error-700': '185 28 28',
|
|
57
|
+
'--color-error-800': '153 27 27',
|
|
58
|
+
'--color-error-900': '127 29 29',
|
|
59
|
+
'--color-error-950': '83 19 19',
|
|
60
|
+
|
|
61
|
+
/* Success */
|
|
62
|
+
'--color-success-0': '228 255 244',
|
|
63
|
+
'--color-success-50': '202 255 232',
|
|
64
|
+
'--color-success-100': '162 241 192',
|
|
65
|
+
'--color-success-200': '132 211 162',
|
|
66
|
+
'--color-success-300': '102 181 132',
|
|
67
|
+
'--color-success-400': '72 151 102',
|
|
68
|
+
'--color-success-500': '52 131 82',
|
|
69
|
+
'--color-success-600': '42 121 72',
|
|
70
|
+
'--color-success-700': '32 111 62',
|
|
71
|
+
'--color-success-800': '22 101 52',
|
|
72
|
+
'--color-success-900': '20 83 45',
|
|
73
|
+
'--color-success-950': '27 50 36',
|
|
74
|
+
|
|
75
|
+
/* Warning */
|
|
76
|
+
'--color-warning-0': '255 249 245',
|
|
77
|
+
'--color-warning-50': '255 244 236',
|
|
78
|
+
'--color-warning-100': '255 231 213',
|
|
79
|
+
'--color-warning-200': '254 205 170',
|
|
80
|
+
'--color-warning-300': '253 173 116',
|
|
81
|
+
'--color-warning-400': '251 149 75',
|
|
82
|
+
'--color-warning-500': '231 120 40',
|
|
83
|
+
'--color-warning-600': '215 108 31',
|
|
84
|
+
'--color-warning-700': '180 90 26',
|
|
85
|
+
'--color-warning-800': '130 68 23',
|
|
86
|
+
'--color-warning-900': '108 56 19',
|
|
87
|
+
'--color-warning-950': '84 45 18',
|
|
88
|
+
|
|
89
|
+
/* Info */
|
|
90
|
+
'--color-info-0': '236 248 254',
|
|
91
|
+
'--color-info-50': '199 235 252',
|
|
92
|
+
'--color-info-100': '162 221 250',
|
|
93
|
+
'--color-info-200': '124 207 248',
|
|
94
|
+
'--color-info-300': '87 194 246',
|
|
95
|
+
'--color-info-400': '50 180 244',
|
|
96
|
+
'--color-info-500': '13 166 242',
|
|
97
|
+
'--color-info-600': '11 141 205',
|
|
98
|
+
'--color-info-700': '9 115 168',
|
|
99
|
+
'--color-info-800': '7 90 131',
|
|
100
|
+
'--color-info-900': '5 64 93',
|
|
101
|
+
'--color-info-950': '3 38 56',
|
|
102
|
+
|
|
103
|
+
/* Typography */
|
|
104
|
+
'--color-typography-0': '254 254 255',
|
|
105
|
+
'--color-typography-50': '245 245 245',
|
|
106
|
+
'--color-typography-100': '229 229 229',
|
|
107
|
+
'--color-typography-200': '219 219 220',
|
|
108
|
+
'--color-typography-300': '212 212 212',
|
|
109
|
+
'--color-typography-400': '163 163 163',
|
|
110
|
+
'--color-typography-500': '140 140 140',
|
|
111
|
+
'--color-typography-600': '115 115 115',
|
|
112
|
+
'--color-typography-700': '82 82 82',
|
|
113
|
+
'--color-typography-800': '64 64 64',
|
|
114
|
+
'--color-typography-900': '38 38 39',
|
|
115
|
+
'--color-typography-950': '23 23 23',
|
|
116
|
+
|
|
117
|
+
/* Outline */
|
|
118
|
+
'--color-outline-0': '253 254 254',
|
|
119
|
+
'--color-outline-50': '243 243 243',
|
|
120
|
+
'--color-outline-100': '230 230 230',
|
|
121
|
+
'--color-outline-200': '221 220 219',
|
|
122
|
+
'--color-outline-300': '211 211 211',
|
|
123
|
+
'--color-outline-400': '165 163 163',
|
|
124
|
+
'--color-outline-500': '140 141 141',
|
|
125
|
+
'--color-outline-600': '115 116 116',
|
|
126
|
+
'--color-outline-700': '83 82 82',
|
|
127
|
+
'--color-outline-800': '65 65 65',
|
|
128
|
+
'--color-outline-900': '39 38 36',
|
|
129
|
+
'--color-outline-950': '26 23 23',
|
|
130
|
+
|
|
131
|
+
/* Background */
|
|
132
|
+
'--color-background-0': '255 255 255',
|
|
133
|
+
'--color-background-50': '246 246 246',
|
|
134
|
+
'--color-background-100': '242 241 241',
|
|
135
|
+
'--color-background-200': '220 219 219',
|
|
136
|
+
'--color-background-300': '213 212 212',
|
|
137
|
+
'--color-background-400': '162 163 163',
|
|
138
|
+
'--color-background-500': '142 142 142',
|
|
139
|
+
'--color-background-600': '116 116 116',
|
|
140
|
+
'--color-background-700': '83 82 82',
|
|
141
|
+
'--color-background-800': '65 64 64',
|
|
142
|
+
'--color-background-900': '39 38 37',
|
|
143
|
+
'--color-background-950': '18 18 18',
|
|
144
|
+
|
|
145
|
+
/* Background Special */
|
|
146
|
+
'--color-background-error': '254 241 241',
|
|
147
|
+
'--color-background-warning': '255 243 234',
|
|
148
|
+
'--color-background-success': '237 252 242',
|
|
149
|
+
'--color-background-muted': '247 248 247',
|
|
150
|
+
'--color-background-info': '235 248 254',
|
|
151
|
+
|
|
152
|
+
/* Focus Ring Indicator */
|
|
153
|
+
'--color-indicator-primary': '55 55 55',
|
|
154
|
+
'--color-indicator-info': '83 153 236',
|
|
155
|
+
'--color-indicator-error': '185 28 28',
|
|
156
|
+
}),
|
|
157
|
+
dark: vars({
|
|
158
|
+
'--color-primary-0': '166 166 166',
|
|
159
|
+
'--color-primary-50': '175 175 175',
|
|
160
|
+
'--color-primary-100': '186 186 186',
|
|
161
|
+
'--color-primary-200': '197 197 197',
|
|
162
|
+
'--color-primary-300': '212 212 212',
|
|
163
|
+
'--color-primary-400': '221 221 221',
|
|
164
|
+
'--color-primary-500': '230 230 230',
|
|
165
|
+
'--color-primary-600': '240 240 240',
|
|
166
|
+
'--color-primary-700': '250 250 250',
|
|
167
|
+
'--color-primary-800': '253 253 253',
|
|
168
|
+
'--color-primary-900': '254 249 249',
|
|
169
|
+
'--color-primary-950': '253 252 252',
|
|
170
|
+
|
|
171
|
+
/* Secondary */
|
|
172
|
+
'--color-secondary-0': '20 20 20',
|
|
173
|
+
'--color-secondary-50': '23 23 23',
|
|
174
|
+
'--color-secondary-100': '31 31 31',
|
|
175
|
+
'--color-secondary-200': '39 39 39',
|
|
176
|
+
'--color-secondary-300': '44 44 44',
|
|
177
|
+
'--color-secondary-400': '56 57 57',
|
|
178
|
+
'--color-secondary-500': '63 64 64',
|
|
179
|
+
'--color-secondary-600': '86 86 86',
|
|
180
|
+
'--color-secondary-700': '110 110 110',
|
|
181
|
+
'--color-secondary-800': '135 135 135',
|
|
182
|
+
'--color-secondary-900': '150 150 150',
|
|
183
|
+
'--color-secondary-950': '164 164 164',
|
|
184
|
+
|
|
185
|
+
/* Tertiary */
|
|
186
|
+
'--color-tertiary-0': '84 49 18',
|
|
187
|
+
'--color-tertiary-50': '108 61 19',
|
|
188
|
+
'--color-tertiary-100': '130 73 23',
|
|
189
|
+
'--color-tertiary-200': '180 98 26',
|
|
190
|
+
'--color-tertiary-300': '215 117 31',
|
|
191
|
+
'--color-tertiary-400': '231 129 40',
|
|
192
|
+
'--color-tertiary-500': '251 157 75',
|
|
193
|
+
'--color-tertiary-600': '253 180 116',
|
|
194
|
+
'--color-tertiary-700': '254 209 170',
|
|
195
|
+
'--color-tertiary-800': '255 233 213',
|
|
196
|
+
'--color-tertiary-900': '255 242 229',
|
|
197
|
+
'--color-tertiary-950': '255 250 245',
|
|
198
|
+
|
|
199
|
+
/* Error */
|
|
200
|
+
'--color-error-0': '83 19 19',
|
|
201
|
+
'--color-error-50': '127 29 29',
|
|
202
|
+
'--color-error-100': '153 27 27',
|
|
203
|
+
'--color-error-200': '185 28 28',
|
|
204
|
+
'--color-error-300': '220 38 38',
|
|
205
|
+
'--color-error-400': '230 53 53',
|
|
206
|
+
'--color-error-500': '239 68 68',
|
|
207
|
+
'--color-error-600': '249 97 96',
|
|
208
|
+
'--color-error-700': '229 91 90',
|
|
209
|
+
'--color-error-800': '254 202 202',
|
|
210
|
+
'--color-error-900': '254 226 226',
|
|
211
|
+
'--color-error-950': '254 233 233',
|
|
212
|
+
|
|
213
|
+
/* Success */
|
|
214
|
+
'--color-success-0': '27 50 36',
|
|
215
|
+
'--color-success-50': '20 83 45',
|
|
216
|
+
'--color-success-100': '22 101 52',
|
|
217
|
+
'--color-success-200': '32 111 62',
|
|
218
|
+
'--color-success-300': '42 121 72',
|
|
219
|
+
'--color-success-400': '52 131 82',
|
|
220
|
+
'--color-success-500': '72 151 102',
|
|
221
|
+
'--color-success-600': '102 181 132',
|
|
222
|
+
'--color-success-700': '132 211 162',
|
|
223
|
+
'--color-success-800': '162 241 192',
|
|
224
|
+
'--color-success-900': '202 255 232',
|
|
225
|
+
'--color-success-950': '228 255 244',
|
|
226
|
+
|
|
227
|
+
/* Warning */
|
|
228
|
+
'--color-warning-0': '84 45 18',
|
|
229
|
+
'--color-warning-50': '108 56 19',
|
|
230
|
+
'--color-warning-100': '130 68 23',
|
|
231
|
+
'--color-warning-200': '180 90 26',
|
|
232
|
+
'--color-warning-300': '215 108 31',
|
|
233
|
+
'--color-warning-400': '231 120 40',
|
|
234
|
+
'--color-warning-500': '251 149 75',
|
|
235
|
+
'--color-warning-600': '253 173 116',
|
|
236
|
+
'--color-warning-700': '254 205 170',
|
|
237
|
+
'--color-warning-800': '255 231 213',
|
|
238
|
+
'--color-warning-900': '255 244 237',
|
|
239
|
+
'--color-warning-950': '255 249 245',
|
|
240
|
+
|
|
241
|
+
/* Info */
|
|
242
|
+
'--color-info-0': '3 38 56',
|
|
243
|
+
'--color-info-50': '5 64 93',
|
|
244
|
+
'--color-info-100': '7 90 131',
|
|
245
|
+
'--color-info-200': '9 115 168',
|
|
246
|
+
'--color-info-300': '11 141 205',
|
|
247
|
+
'--color-info-400': '13 166 242',
|
|
248
|
+
'--color-info-500': '50 180 244',
|
|
249
|
+
'--color-info-600': '87 194 246',
|
|
250
|
+
'--color-info-700': '124 207 248',
|
|
251
|
+
'--color-info-800': '162 221 250',
|
|
252
|
+
'--color-info-900': '199 235 252',
|
|
253
|
+
'--color-info-950': '236 248 254',
|
|
254
|
+
|
|
255
|
+
/* Typography */
|
|
256
|
+
'--color-typography-0': '23 23 23',
|
|
257
|
+
'--color-typography-50': '38 38 39',
|
|
258
|
+
'--color-typography-100': '64 64 64',
|
|
259
|
+
'--color-typography-200': '82 82 82',
|
|
260
|
+
'--color-typography-300': '115 115 115',
|
|
261
|
+
'--color-typography-400': '140 140 140',
|
|
262
|
+
'--color-typography-500': '163 163 163',
|
|
263
|
+
'--color-typography-600': '212 212 212',
|
|
264
|
+
'--color-typography-700': '219 219 220',
|
|
265
|
+
'--color-typography-800': '229 229 229',
|
|
266
|
+
'--color-typography-900': '245 245 245',
|
|
267
|
+
'--color-typography-950': '254 254 255',
|
|
268
|
+
|
|
269
|
+
/* Outline */
|
|
270
|
+
'--color-outline-0': '26 23 23',
|
|
271
|
+
'--color-outline-50': '39 38 36',
|
|
272
|
+
'--color-outline-100': '65 65 65',
|
|
273
|
+
'--color-outline-200': '83 82 82',
|
|
274
|
+
'--color-outline-300': '115 116 116',
|
|
275
|
+
'--color-outline-400': '140 141 141',
|
|
276
|
+
'--color-outline-500': '165 163 163',
|
|
277
|
+
'--color-outline-600': '211 211 211',
|
|
278
|
+
'--color-outline-700': '221 220 219',
|
|
279
|
+
'--color-outline-800': '230 230 230',
|
|
280
|
+
'--color-outline-900': '243 243 243',
|
|
281
|
+
'--color-outline-950': '253 254 254',
|
|
282
|
+
|
|
283
|
+
/* Background */
|
|
284
|
+
'--color-background-0': '18 18 18',
|
|
285
|
+
'--color-background-50': '39 38 37',
|
|
286
|
+
'--color-background-100': '65 64 64',
|
|
287
|
+
'--color-background-200': '83 82 82',
|
|
288
|
+
'--color-background-300': '116 116 116',
|
|
289
|
+
'--color-background-400': '142 142 142',
|
|
290
|
+
'--color-background-500': '162 163 163',
|
|
291
|
+
'--color-background-600': '213 212 212',
|
|
292
|
+
'--color-background-700': '229 228 228',
|
|
293
|
+
'--color-background-800': '242 241 241',
|
|
294
|
+
'--color-background-900': '246 246 246',
|
|
295
|
+
'--color-background-950': '255 255 255',
|
|
296
|
+
|
|
297
|
+
/* Background Special */
|
|
298
|
+
'--color-background-error': '66 43 43',
|
|
299
|
+
'--color-background-warning': '65 47 35',
|
|
300
|
+
'--color-background-success': '28 43 33',
|
|
301
|
+
'--color-background-muted': '51 51 51',
|
|
302
|
+
'--color-background-info': '26 40 46',
|
|
303
|
+
|
|
304
|
+
/* Focus Ring Indicator */
|
|
305
|
+
'--color-indicator-primary': '247 247 247',
|
|
306
|
+
'--color-indicator-info': '161 199 245',
|
|
307
|
+
'--color-indicator-error': '232 70 69',
|
|
308
|
+
}),
|
|
309
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { config } from './config';
|
|
3
|
+
import { View, ViewProps } from 'react-native';
|
|
4
|
+
import { OverlayProvider } from '@gluestack-ui/overlay';
|
|
5
|
+
import { ToastProvider } from '@gluestack-ui/toast';
|
|
6
|
+
import { useColorScheme } from 'nativewind';
|
|
7
|
+
import { ModeType } from './types';
|
|
8
|
+
|
|
9
|
+
export function GluestackUIProvider({
|
|
10
|
+
mode = 'light',
|
|
11
|
+
...props
|
|
12
|
+
}: {
|
|
13
|
+
mode?: ModeType;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
style?: ViewProps['style'];
|
|
16
|
+
}) {
|
|
17
|
+
const { colorScheme, setColorScheme } = useColorScheme();
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setColorScheme(mode);
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
+
}, [mode]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View
|
|
26
|
+
style={[
|
|
27
|
+
config[colorScheme!],
|
|
28
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
29
|
+
{ flex: 1, height: '100%', width: '100%' },
|
|
30
|
+
props.style,
|
|
31
|
+
]}
|
|
32
|
+
>
|
|
33
|
+
<OverlayProvider>
|
|
34
|
+
<ToastProvider>{props.children}</ToastProvider>
|
|
35
|
+
</OverlayProvider>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useEffect, useLayoutEffect } from 'react';
|
|
3
|
+
import { config } from './config';
|
|
4
|
+
import { OverlayProvider } from '@gluestack-ui/overlay';
|
|
5
|
+
import { ToastProvider } from '@gluestack-ui/toast';
|
|
6
|
+
import { setFlushStyles } from '@gluestack-ui/nativewind-utils/flush';
|
|
7
|
+
import { script } from './script';
|
|
8
|
+
import { ModeType } from './types';
|
|
9
|
+
|
|
10
|
+
const variableStyleTagId = 'nativewind-style';
|
|
11
|
+
const createStyle = (styleTagId: string) => {
|
|
12
|
+
const style = document.createElement('style');
|
|
13
|
+
style.id = styleTagId;
|
|
14
|
+
style.appendChild(document.createTextNode(''));
|
|
15
|
+
return style;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
19
|
+
|
|
20
|
+
export function GluestackUIProvider({ mode = 'light', ...props }: { mode?: ModeType; children?: React.ReactNode }) {
|
|
21
|
+
let cssVariablesWithMode = ``;
|
|
22
|
+
Object.keys(config).forEach((configKey) => {
|
|
23
|
+
cssVariablesWithMode += configKey === 'dark' ? `\n .dark {\n ` : `\n:root {\n`;
|
|
24
|
+
const cssVariables = Object.keys(config[configKey as keyof typeof config]).reduce(
|
|
25
|
+
(acc: string, curr: string) => {
|
|
26
|
+
acc += `${curr}:${config[configKey as keyof typeof config][curr]}; `;
|
|
27
|
+
return acc;
|
|
28
|
+
},
|
|
29
|
+
'',
|
|
30
|
+
);
|
|
31
|
+
cssVariablesWithMode += `${cssVariables} \n}`;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
setFlushStyles(cssVariablesWithMode);
|
|
35
|
+
|
|
36
|
+
const handleMediaQuery = React.useCallback((e: MediaQueryListEvent) => {
|
|
37
|
+
script(e.matches ? 'dark' : 'light');
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
useSafeLayoutEffect(() => {
|
|
41
|
+
if (mode !== 'system') {
|
|
42
|
+
const documentElement = document.documentElement;
|
|
43
|
+
if (documentElement) {
|
|
44
|
+
documentElement.classList.add(mode);
|
|
45
|
+
documentElement.classList.remove(mode === 'light' ? 'dark' : 'light');
|
|
46
|
+
documentElement.style.colorScheme = mode;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [mode]);
|
|
50
|
+
|
|
51
|
+
useSafeLayoutEffect(() => {
|
|
52
|
+
if (mode !== 'system') return;
|
|
53
|
+
const media = window.matchMedia('(prefers-color-scheme: dark)');
|
|
54
|
+
|
|
55
|
+
media.addListener(handleMediaQuery);
|
|
56
|
+
|
|
57
|
+
return () => media.removeListener(handleMediaQuery);
|
|
58
|
+
}, [handleMediaQuery]);
|
|
59
|
+
|
|
60
|
+
useSafeLayoutEffect(() => {
|
|
61
|
+
if (typeof window !== 'undefined') {
|
|
62
|
+
const documentElement = document.documentElement;
|
|
63
|
+
if (documentElement) {
|
|
64
|
+
const head = documentElement.querySelector('head');
|
|
65
|
+
let style = head?.querySelector(`[id='${variableStyleTagId}']`);
|
|
66
|
+
if (!style) {
|
|
67
|
+
style = createStyle(variableStyleTagId);
|
|
68
|
+
style.innerHTML = cssVariablesWithMode;
|
|
69
|
+
if (head) head.appendChild(style);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<script
|
|
78
|
+
suppressHydrationWarning
|
|
79
|
+
dangerouslySetInnerHTML={{
|
|
80
|
+
__html: `(${script.toString()})('${mode}')`,
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
<OverlayProvider>
|
|
84
|
+
<ToastProvider>{props.children}</ToastProvider>
|
|
85
|
+
</OverlayProvider>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const script = (mode: string) => {
|
|
2
|
+
const documentElement = document.documentElement;
|
|
3
|
+
|
|
4
|
+
function getSystemColorMode() {
|
|
5
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const isSystem = mode === 'system';
|
|
10
|
+
const theme = isSystem ? getSystemColorMode() : mode;
|
|
11
|
+
documentElement.classList.remove(theme === 'light' ? 'dark' : 'light');
|
|
12
|
+
documentElement.classList.add(theme);
|
|
13
|
+
documentElement.style.colorScheme = theme;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
console.error(e);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ModeType = 'light' | 'dark' | 'system';
|