nwui-cli 0.4.1-staging.1 → 0.4.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/.turbo/turbo-build.log +2 -1
- package/build/index.js +33 -17
- package/build/install-component.js +105 -48
- package/build/login.js +14 -11
- package/build/utils/env.js +2 -2
- package/package.json +2 -1
- package/build/cli/src/index.js +0 -41
- package/build/cli/src/install-component.js +0 -42
- package/build/cli/src/login.js +0 -77
- package/build/cli/src/net.js +0 -12
- package/build/cli/src/project-setup.js +0 -1
- package/build/cli/src/prompts.js +0 -119
- package/build/cli/src/utils/local-storage.js +0 -19
- package/build/docs/app/data.js +0 -1380
- package/build/log/index.js +0 -81
- package/build/prompts.js +0 -119
- package/my-expo-app-2/app/+html.tsx +0 -46
- package/my-expo-app-2/app/+not-found.tsx +0 -33
- package/my-expo-app-2/app/_layout.tsx +0 -22
- package/my-expo-app-2/app/details.tsx +0 -17
- package/my-expo-app-2/app/index.tsx +0 -23
- package/my-expo-app-2/app-env.d.ts +0 -2
- package/my-expo-app-2/app.json +0 -48
- package/my-expo-app-2/assets/adaptive-icon.png +0 -0
- package/my-expo-app-2/assets/favicon.png +0 -0
- package/my-expo-app-2/assets/icon.png +0 -0
- package/my-expo-app-2/assets/splash.png +0 -0
- package/my-expo-app-2/babel.config.js +0 -18
- package/my-expo-app-2/cesconfig.json +0 -35
- package/my-expo-app-2/components/Button.tsx +0 -19
- package/my-expo-app-2/components/Container.tsx +0 -9
- package/my-expo-app-2/components/EditScreenInfo.tsx +0 -34
- package/my-expo-app-2/components/ScreenContent.tsx +0 -25
- package/my-expo-app-2/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.ios.tsx +0 -97
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.tsx +0 -264
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/AdaptiveSearchHeader/types.ts +0 -95
- package/my-expo-app-2/components/nativewindui/Alert/Alert.ios.tsx +0 -65
- package/my-expo-app-2/components/nativewindui/Alert/Alert.tsx +0 -291
- package/my-expo-app-2/components/nativewindui/Alert/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/Alert/types.ts +0 -27
- package/my-expo-app-2/components/nativewindui/Badge.tsx +0 -84
- package/my-expo-app-2/components/nativewindui/Button.tsx +0 -156
- package/my-expo-app-2/components/nativewindui/Checkbox.tsx +0 -61
- package/my-expo-app-2/components/nativewindui/ContextMenu/ContextMenu.ios.tsx +0 -221
- package/my-expo-app-2/components/nativewindui/ContextMenu/ContextMenu.tsx +0 -420
- package/my-expo-app-2/components/nativewindui/ContextMenu/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/ContextMenu/types.ts +0 -91
- package/my-expo-app-2/components/nativewindui/ContextMenu/utils.ts +0 -14
- package/my-expo-app-2/components/nativewindui/DrawerContent.tsx +0 -145
- package/my-expo-app-2/components/nativewindui/DropdownMenu/DropdownMenu.ios.tsx +0 -168
- package/my-expo-app-2/components/nativewindui/DropdownMenu/DropdownMenu.tsx +0 -330
- package/my-expo-app-2/components/nativewindui/DropdownMenu/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/DropdownMenu/types.ts +0 -93
- package/my-expo-app-2/components/nativewindui/DropdownMenu/utils.ts +0 -14
- package/my-expo-app-2/components/nativewindui/Form.tsx +0 -125
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/LargeTitleHeader.ios.tsx +0 -99
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/LargeTitleHeader.tsx +0 -288
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/LargeTitleHeader/types.ts +0 -89
- package/my-expo-app-2/components/nativewindui/List.tsx +0 -433
- package/my-expo-app-2/components/nativewindui/SearchInput/SearchInput.ios.tsx +0 -177
- package/my-expo-app-2/components/nativewindui/SearchInput/SearchInput.tsx +0 -86
- package/my-expo-app-2/components/nativewindui/SearchInput/index.tsx +0 -1
- package/my-expo-app-2/components/nativewindui/SearchInput/types.ts +0 -12
- package/my-expo-app-2/components/nativewindui/SegmentedControl/SegmentedControl.ios.tsx +0 -31
- package/my-expo-app-2/components/nativewindui/SegmentedControl/SegmentedControl.tsx +0 -55
- package/my-expo-app-2/components/nativewindui/SegmentedControl/index.ts +0 -1
- package/my-expo-app-2/components/nativewindui/SegmentedControl/types.ts +0 -15
- package/my-expo-app-2/components/nativewindui/Stepper.tsx +0 -62
- package/my-expo-app-2/components/nativewindui/Text.tsx +0 -55
- package/my-expo-app-2/components/nativewindui/TextField/TextField.ios.tsx +0 -85
- package/my-expo-app-2/components/nativewindui/TextField/TextField.tsx +0 -326
- package/my-expo-app-2/components/nativewindui/TextField/index.tsx +0 -1
- package/my-expo-app-2/components/nativewindui/TextField/types.ts +0 -26
- package/my-expo-app-2/components/nativewindui/Toolbar.tsx +0 -116
- package/my-expo-app-2/global.css +0 -3
- package/my-expo-app-2/metro.config.js +0 -12
- package/my-expo-app-2/package-lock.json +0 -19162
- package/my-expo-app-2/package.json +0 -74
- package/my-expo-app-2/prettier.config.js +0 -11
- package/my-expo-app-2/tailwind.config.js +0 -11
- package/my-expo-app-3/app/+html.tsx +0 -46
- package/my-expo-app-3/app/+not-found.tsx +0 -33
- package/my-expo-app-3/app/_layout.tsx +0 -22
- package/my-expo-app-3/app/details.tsx +0 -17
- package/my-expo-app-3/app/index.tsx +0 -23
- package/my-expo-app-3/app-env.d.ts +0 -2
- package/my-expo-app-3/app.json +0 -48
- package/my-expo-app-3/assets/adaptive-icon.png +0 -0
- package/my-expo-app-3/assets/favicon.png +0 -0
- package/my-expo-app-3/assets/icon.png +0 -0
- package/my-expo-app-3/assets/splash.png +0 -0
- package/my-expo-app-3/babel.config.js +0 -18
- package/my-expo-app-3/cesconfig.json +0 -35
- package/my-expo-app-3/components/Button.tsx +0 -19
- package/my-expo-app-3/components/Container.tsx +0 -9
- package/my-expo-app-3/components/EditScreenInfo.tsx +0 -34
- package/my-expo-app-3/components/ScreenContent.tsx +0 -25
- package/my-expo-app-3/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.ios.tsx +0 -97
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.tsx +0 -264
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/AdaptiveSearchHeader/types.ts +0 -95
- package/my-expo-app-3/components/nativewindui/Alert/Alert.ios.tsx +0 -65
- package/my-expo-app-3/components/nativewindui/Alert/Alert.tsx +0 -291
- package/my-expo-app-3/components/nativewindui/Alert/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/Alert/types.ts +0 -27
- package/my-expo-app-3/components/nativewindui/Badge.tsx +0 -84
- package/my-expo-app-3/components/nativewindui/Button.tsx +0 -156
- package/my-expo-app-3/components/nativewindui/Checkbox.tsx +0 -61
- package/my-expo-app-3/components/nativewindui/ContextMenu/ContextMenu.ios.tsx +0 -221
- package/my-expo-app-3/components/nativewindui/ContextMenu/ContextMenu.tsx +0 -420
- package/my-expo-app-3/components/nativewindui/ContextMenu/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/ContextMenu/types.ts +0 -91
- package/my-expo-app-3/components/nativewindui/ContextMenu/utils.ts +0 -14
- package/my-expo-app-3/components/nativewindui/DrawerContent.tsx +0 -145
- package/my-expo-app-3/components/nativewindui/DropdownMenu/DropdownMenu.ios.tsx +0 -168
- package/my-expo-app-3/components/nativewindui/DropdownMenu/DropdownMenu.tsx +0 -330
- package/my-expo-app-3/components/nativewindui/DropdownMenu/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/DropdownMenu/types.ts +0 -93
- package/my-expo-app-3/components/nativewindui/DropdownMenu/utils.ts +0 -14
- package/my-expo-app-3/components/nativewindui/Form.tsx +0 -125
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/LargeTitleHeader.ios.tsx +0 -99
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/LargeTitleHeader.tsx +0 -288
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/LargeTitleHeader/types.ts +0 -89
- package/my-expo-app-3/components/nativewindui/List.tsx +0 -433
- package/my-expo-app-3/components/nativewindui/SearchInput/SearchInput.ios.tsx +0 -177
- package/my-expo-app-3/components/nativewindui/SearchInput/SearchInput.tsx +0 -86
- package/my-expo-app-3/components/nativewindui/SearchInput/index.tsx +0 -1
- package/my-expo-app-3/components/nativewindui/SearchInput/types.ts +0 -12
- package/my-expo-app-3/components/nativewindui/SegmentedControl/SegmentedControl.ios.tsx +0 -31
- package/my-expo-app-3/components/nativewindui/SegmentedControl/SegmentedControl.tsx +0 -55
- package/my-expo-app-3/components/nativewindui/SegmentedControl/index.ts +0 -1
- package/my-expo-app-3/components/nativewindui/SegmentedControl/types.ts +0 -15
- package/my-expo-app-3/components/nativewindui/Stepper.tsx +0 -62
- package/my-expo-app-3/components/nativewindui/Text.tsx +0 -55
- package/my-expo-app-3/components/nativewindui/TextField/TextField.ios.tsx +0 -85
- package/my-expo-app-3/components/nativewindui/TextField/TextField.tsx +0 -326
- package/my-expo-app-3/components/nativewindui/TextField/index.tsx +0 -1
- package/my-expo-app-3/components/nativewindui/TextField/types.ts +0 -26
- package/my-expo-app-3/components/nativewindui/Toolbar.tsx +0 -116
- package/my-expo-app-3/components/nativewindui/examples/selectable-text.tsx +0 -43
- package/my-expo-app-3/components/nativewindui/examples/text.tsx +0 -43
- package/my-expo-app-3/global.css +0 -3
- package/my-expo-app-3/metro.config.js +0 -12
- package/my-expo-app-3/package-lock.json +0 -19141
- package/my-expo-app-3/package.json +0 -73
- package/my-expo-app-3/prettier.config.js +0 -11
- package/my-expo-app-3/tailwind.config.js +0 -11
- package/my-expo-app-test-case/app/+html.tsx +0 -46
- package/my-expo-app-test-case/app/+not-found.tsx +0 -33
- package/my-expo-app-test-case/app/_layout.tsx +0 -22
- package/my-expo-app-test-case/app/details.tsx +0 -17
- package/my-expo-app-test-case/app/index.tsx +0 -23
- package/my-expo-app-test-case/app-env.d.ts +0 -2
- package/my-expo-app-test-case/app.json +0 -48
- package/my-expo-app-test-case/assets/adaptive-icon.png +0 -0
- package/my-expo-app-test-case/assets/favicon.png +0 -0
- package/my-expo-app-test-case/assets/icon.png +0 -0
- package/my-expo-app-test-case/assets/splash.png +0 -0
- package/my-expo-app-test-case/babel.config.js +0 -18
- package/my-expo-app-test-case/cesconfig.json +0 -35
- package/my-expo-app-test-case/components/Button.tsx +0 -19
- package/my-expo-app-test-case/components/Container.tsx +0 -9
- package/my-expo-app-test-case/components/EditScreenInfo.tsx +0 -34
- package/my-expo-app-test-case/components/ScreenContent.tsx +0 -25
- package/my-expo-app-test-case/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.ios.tsx +0 -97
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/AdaptiveSearchHeader.tsx +0 -264
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/AdaptiveSearchHeader/types.ts +0 -95
- package/my-expo-app-test-case/components/nativewindui/Alert/Alert.ios.tsx +0 -65
- package/my-expo-app-test-case/components/nativewindui/Alert/Alert.tsx +0 -291
- package/my-expo-app-test-case/components/nativewindui/Alert/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/Alert/types.ts +0 -27
- package/my-expo-app-test-case/components/nativewindui/Badge.tsx +0 -84
- package/my-expo-app-test-case/components/nativewindui/Button.tsx +0 -156
- package/my-expo-app-test-case/components/nativewindui/Checkbox.tsx +0 -61
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/ContextMenu.ios.tsx +0 -221
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/ContextMenu.tsx +0 -420
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/types.ts +0 -91
- package/my-expo-app-test-case/components/nativewindui/ContextMenu/utils.ts +0 -14
- package/my-expo-app-test-case/components/nativewindui/DrawerContent.tsx +0 -145
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/DropdownMenu.ios.tsx +0 -168
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/DropdownMenu.tsx +0 -330
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/types.ts +0 -93
- package/my-expo-app-test-case/components/nativewindui/DropdownMenu/utils.ts +0 -14
- package/my-expo-app-test-case/components/nativewindui/Form.tsx +0 -125
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/LargeTitleHeader.ios.tsx +0 -99
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/LargeTitleHeader.tsx +0 -288
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/LargeTitleHeader/types.ts +0 -89
- package/my-expo-app-test-case/components/nativewindui/List.tsx +0 -433
- package/my-expo-app-test-case/components/nativewindui/SearchInput/SearchInput.ios.tsx +0 -177
- package/my-expo-app-test-case/components/nativewindui/SearchInput/SearchInput.tsx +0 -86
- package/my-expo-app-test-case/components/nativewindui/SearchInput/index.tsx +0 -1
- package/my-expo-app-test-case/components/nativewindui/SearchInput/types.ts +0 -12
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/SegmentedControl.ios.tsx +0 -31
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/SegmentedControl.tsx +0 -55
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/index.ts +0 -1
- package/my-expo-app-test-case/components/nativewindui/SegmentedControl/types.ts +0 -15
- package/my-expo-app-test-case/components/nativewindui/Stepper.tsx +0 -62
- package/my-expo-app-test-case/components/nativewindui/Text.tsx +0 -55
- package/my-expo-app-test-case/components/nativewindui/TextField/TextField.ios.tsx +0 -85
- package/my-expo-app-test-case/components/nativewindui/TextField/TextField.tsx +0 -326
- package/my-expo-app-test-case/components/nativewindui/TextField/index.tsx +0 -1
- package/my-expo-app-test-case/components/nativewindui/TextField/types.ts +0 -26
- package/my-expo-app-test-case/components/nativewindui/Toolbar.tsx +0 -116
- package/my-expo-app-test-case/components/nativewindui/examples/a-user-created-file.tsx +0 -0
- package/my-expo-app-test-case/components/nativewindui/examples/selectable-text.tsx +0 -43
- package/my-expo-app-test-case/components/nativewindui/examples/text.tsx +0 -43
- package/my-expo-app-test-case/global.css +0 -3
- package/my-expo-app-test-case/metro.config.js +0 -12
- package/my-expo-app-test-case/package-lock.json +0 -19141
- package/my-expo-app-test-case/package.json +0 -73
- package/my-expo-app-test-case/prettier.config.js +0 -11
- package/my-expo-app-test-case/tailwind.config.js +0 -11
- package/no-install/app/+html.tsx +0 -46
- package/no-install/app/+not-found.tsx +0 -25
- package/no-install/app/_layout.tsx +0 -7
- package/no-install/app/details.tsx +0 -20
- package/no-install/app/index.tsx +0 -19
- package/no-install/app-env.d.ts +0 -2
- package/no-install/app.json +0 -41
- package/no-install/assets/adaptive-icon.png +0 -0
- package/no-install/assets/favicon.png +0 -0
- package/no-install/assets/icon.png +0 -0
- package/no-install/assets/splash.png +0 -0
- package/no-install/babel.config.js +0 -13
- package/no-install/cesconfig.json +0 -35
- package/no-install/components/Button.tsx +0 -25
- package/no-install/components/Container.tsx +0 -9
- package/no-install/components/EditScreenInfo.tsx +0 -31
- package/no-install/components/ScreenContent.tsx +0 -29
- package/no-install/components/nativewindui/Slider.tsx +0 -26
- package/no-install/global.css +0 -3
- package/no-install/metro.config.js +0 -10
- package/no-install/package-lock.json +0 -17505
- package/no-install/package.json +0 -59
- package/no-install/prettier.config.js +0 -10
- package/no-install/tailwind.config.js +0 -14
- package/test-app/app/+html.tsx +0 -46
- package/test-app/app/+not-found.tsx +0 -25
- package/test-app/app/_layout.tsx +0 -7
- package/test-app/app/details.tsx +0 -20
- package/test-app/app/index.tsx +0 -19
- package/test-app/app-env.d.ts +0 -2
- package/test-app/app.json +0 -41
- package/test-app/assets/adaptive-icon.png +0 -0
- package/test-app/assets/favicon.png +0 -0
- package/test-app/assets/icon.png +0 -0
- package/test-app/assets/splash.png +0 -0
- package/test-app/babel.config.js +0 -13
- package/test-app/cesconfig.json +0 -35
- package/test-app/components/Button.tsx +0 -25
- package/test-app/components/Container.tsx +0 -9
- package/test-app/components/EditScreenInfo.tsx +0 -31
- package/test-app/components/ScreenContent.tsx +0 -29
- package/test-app/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/test-app/components/nativewindui/Avatar.tsx +0 -133
- package/test-app/components/nativewindui/DatePicker/DatePicker.android.tsx +0 -72
- package/test-app/components/nativewindui/DatePicker/DatePicker.tsx +0 -23
- package/test-app/components/nativewindui/DatePicker/index.ts +0 -1
- package/test-app/components/nativewindui/Picker.tsx +0 -42
- package/test-app/components/nativewindui/ProgressIndicator.tsx +0 -78
- package/test-app/components/nativewindui/Sheet.tsx +0 -52
- package/test-app/components/nativewindui/Slider.tsx +0 -26
- package/test-app/components/nativewindui/Text.tsx +0 -55
- package/test-app/components/nativewindui/Toggle.tsx +0 -20
- package/test-app/global.css +0 -3
- package/test-app/metro.config.js +0 -10
- package/test-app/package.json +0 -64
- package/test-app/prettier.config.js +0 -10
- package/test-app/tailwind.config.js +0 -14
- package/test-no-install/app/+html.tsx +0 -46
- package/test-no-install/app/+not-found.tsx +0 -25
- package/test-no-install/app/_layout.tsx +0 -7
- package/test-no-install/app/details.tsx +0 -20
- package/test-no-install/app/index.tsx +0 -19
- package/test-no-install/app-env.d.ts +0 -2
- package/test-no-install/app.json +0 -41
- package/test-no-install/assets/adaptive-icon.png +0 -0
- package/test-no-install/assets/favicon.png +0 -0
- package/test-no-install/assets/icon.png +0 -0
- package/test-no-install/assets/splash.png +0 -0
- package/test-no-install/babel.config.js +0 -13
- package/test-no-install/cesconfig.json +0 -35
- package/test-no-install/components/Button.tsx +0 -25
- package/test-no-install/components/Container.tsx +0 -9
- package/test-no-install/components/EditScreenInfo.tsx +0 -31
- package/test-no-install/components/ScreenContent.tsx +0 -29
- package/test-no-install/components/nativewindui/ActivityIndicator.tsx +0 -13
- package/test-no-install/components/nativewindui/Avatar.tsx +0 -133
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.android.tsx +0 -72
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.tsx +0 -23
- package/test-no-install/components/nativewindui/DatePicker/index.ts +0 -1
- package/test-no-install/components/nativewindui/Picker.tsx +0 -42
- package/test-no-install/components/nativewindui/ProgressIndicator.tsx +0 -78
- package/test-no-install/components/nativewindui/Sheet.tsx +0 -52
- package/test-no-install/components/nativewindui/Slider.tsx +0 -26
- package/test-no-install/components/nativewindui/Text.tsx +0 -55
- package/test-no-install/components/nativewindui/Toggle.tsx +0 -20
- package/test-no-install/global.css +0 -3
- package/test-no-install/metro.config.js +0 -10
- package/test-no-install/package.json +0 -64
- package/test-no-install/prettier.config.js +0 -10
- package/test-no-install/tailwind.config.js +0 -14
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import * as AlertDialogPrimitive from '@rn-primitives/alert-dialog';
|
|
2
|
-
import { useAugmentedRef } from '@rn-primitives/hooks';
|
|
3
|
-
import { Icon } from '@roninoss/icons';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { View } from 'react-native';
|
|
6
|
-
import { useReanimatedKeyboardAnimation } from 'react-native-keyboard-controller';
|
|
7
|
-
import Animated, {
|
|
8
|
-
FadeIn,
|
|
9
|
-
FadeInDown,
|
|
10
|
-
FadeOut,
|
|
11
|
-
FadeOutDown,
|
|
12
|
-
useAnimatedStyle,
|
|
13
|
-
} from 'react-native-reanimated';
|
|
14
|
-
|
|
15
|
-
import { AlertProps, AlertRef } from './types';
|
|
16
|
-
|
|
17
|
-
import { Button } from '~/components/nativewindui/Button';
|
|
18
|
-
import { Text } from '~/components/nativewindui/Text';
|
|
19
|
-
import { TextField } from '~/components/nativewindui/TextField';
|
|
20
|
-
import { TextFieldRef } from '~/components/nativewindui/TextField/types';
|
|
21
|
-
import { cn } from '~/lib/cn';
|
|
22
|
-
import { useColorScheme } from '~/lib/useColorScheme';
|
|
23
|
-
|
|
24
|
-
const Alert = React.forwardRef<AlertRef, AlertProps>(
|
|
25
|
-
(
|
|
26
|
-
{
|
|
27
|
-
children,
|
|
28
|
-
title: titleProp,
|
|
29
|
-
message: messageProp,
|
|
30
|
-
buttons: buttonsProp,
|
|
31
|
-
prompt: promptProp,
|
|
32
|
-
materialIcon: materialIconProp,
|
|
33
|
-
materialWidth: materialWidthProp,
|
|
34
|
-
materialPortalHost,
|
|
35
|
-
},
|
|
36
|
-
ref
|
|
37
|
-
) => {
|
|
38
|
-
const { height } = useReanimatedKeyboardAnimation();
|
|
39
|
-
const [open, setOpen] = React.useState(false);
|
|
40
|
-
const [{ title, message, buttons, prompt, materialIcon, materialWidth }, setProps] =
|
|
41
|
-
React.useState<AlertProps>({
|
|
42
|
-
title: titleProp,
|
|
43
|
-
message: messageProp,
|
|
44
|
-
buttons: buttonsProp,
|
|
45
|
-
prompt: promptProp,
|
|
46
|
-
materialIcon: materialIconProp,
|
|
47
|
-
materialWidth: materialWidthProp,
|
|
48
|
-
});
|
|
49
|
-
const [text, setText] = React.useState(promptProp?.defaultValue ?? '');
|
|
50
|
-
const [password, setPassword] = React.useState('');
|
|
51
|
-
const { colors } = useColorScheme();
|
|
52
|
-
const passwordRef = React.useRef<TextFieldRef>(null);
|
|
53
|
-
const augmentedRef = useAugmentedRef({
|
|
54
|
-
ref,
|
|
55
|
-
methods: {
|
|
56
|
-
show: () => {
|
|
57
|
-
setOpen(true);
|
|
58
|
-
},
|
|
59
|
-
alert,
|
|
60
|
-
prompt: promptAlert,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const bottomPaddingStyle = useAnimatedStyle(() => {
|
|
65
|
-
return {
|
|
66
|
-
paddingBottom: height.value * -1,
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
function promptAlert(args: AlertProps & { prompt: Required<AlertProps['prompt']> }) {
|
|
71
|
-
setText(args.prompt?.defaultValue ?? '');
|
|
72
|
-
setPassword('');
|
|
73
|
-
setProps(args);
|
|
74
|
-
setOpen(true);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function alert(args: AlertProps) {
|
|
78
|
-
setText(args.prompt?.defaultValue ?? '');
|
|
79
|
-
setPassword('');
|
|
80
|
-
setProps(args);
|
|
81
|
-
setOpen(true);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function onOpenChange(open: boolean) {
|
|
85
|
-
if (!open) {
|
|
86
|
-
setText(prompt?.defaultValue ?? '');
|
|
87
|
-
setPassword('');
|
|
88
|
-
}
|
|
89
|
-
setOpen(open);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<AlertDialogPrimitive.Root ref={augmentedRef} open={open} onOpenChange={onOpenChange}>
|
|
94
|
-
<AlertDialogPrimitive.Trigger asChild={!!children}>{children}</AlertDialogPrimitive.Trigger>
|
|
95
|
-
<AlertDialogPrimitive.Portal hostName={materialPortalHost}>
|
|
96
|
-
<AlertDialogPrimitive.Overlay asChild>
|
|
97
|
-
<Animated.View
|
|
98
|
-
entering={FadeIn}
|
|
99
|
-
exiting={FadeOut}
|
|
100
|
-
style={bottomPaddingStyle}
|
|
101
|
-
className={cn(
|
|
102
|
-
'bg-popover/80 absolute bottom-0 left-0 right-0 top-0 items-center justify-center px-3'
|
|
103
|
-
)}>
|
|
104
|
-
<AlertDialogPrimitive.Content>
|
|
105
|
-
<Animated.View
|
|
106
|
-
style={typeof materialWidth === 'number' ? { width: materialWidth } : undefined}
|
|
107
|
-
entering={FadeInDown}
|
|
108
|
-
exiting={FadeOutDown}
|
|
109
|
-
className="bg-card min-w-72 max-w-xl rounded-3xl p-6 pt-7 shadow-xl">
|
|
110
|
-
{!!materialIcon && (
|
|
111
|
-
<View className="items-center pb-4">
|
|
112
|
-
<Icon color={colors.foreground} size={27} {...materialIcon} />
|
|
113
|
-
</View>
|
|
114
|
-
)}
|
|
115
|
-
{!!message ? (
|
|
116
|
-
<>
|
|
117
|
-
<AlertDialogPrimitive.Title asChild>
|
|
118
|
-
<Text
|
|
119
|
-
variant="title2"
|
|
120
|
-
className={cn(!!materialIcon && 'text-center', 'pb-4')}>
|
|
121
|
-
{title}
|
|
122
|
-
</Text>
|
|
123
|
-
</AlertDialogPrimitive.Title>
|
|
124
|
-
<AlertDialogPrimitive.Description asChild>
|
|
125
|
-
<Text variant="subhead" className="pb-4 opacity-90">
|
|
126
|
-
{message}
|
|
127
|
-
</Text>
|
|
128
|
-
</AlertDialogPrimitive.Description>
|
|
129
|
-
</>
|
|
130
|
-
) : !!materialIcon ? (
|
|
131
|
-
<AlertDialogPrimitive.Title asChild>
|
|
132
|
-
<Text
|
|
133
|
-
variant="title2"
|
|
134
|
-
className={cn(!!materialIcon && 'text-center', 'pb-4')}>
|
|
135
|
-
{title}
|
|
136
|
-
</Text>
|
|
137
|
-
</AlertDialogPrimitive.Title>
|
|
138
|
-
) : (
|
|
139
|
-
<AlertDialogPrimitive.Title asChild>
|
|
140
|
-
<Text variant="subhead" className="pb-4 opacity-90">
|
|
141
|
-
{title}
|
|
142
|
-
</Text>
|
|
143
|
-
</AlertDialogPrimitive.Title>
|
|
144
|
-
)}
|
|
145
|
-
{!!prompt ? (
|
|
146
|
-
<View className="gap-4 pb-8">
|
|
147
|
-
<TextField
|
|
148
|
-
autoFocus
|
|
149
|
-
labelClassName="bg-card"
|
|
150
|
-
keyboardType={
|
|
151
|
-
prompt.type === 'secure-text' ? 'default' : prompt.keyboardType
|
|
152
|
-
}
|
|
153
|
-
label={prompt.type === 'login-password' ? 'Email' : ''}
|
|
154
|
-
secureTextEntry={prompt.type === 'secure-text'}
|
|
155
|
-
value={text}
|
|
156
|
-
onChangeText={setText}
|
|
157
|
-
onSubmitEditing={() => {
|
|
158
|
-
if (prompt.type === 'login-password' && passwordRef.current) {
|
|
159
|
-
passwordRef.current.focus();
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
for (const button of buttons) {
|
|
163
|
-
if (!button.style || button.style === 'default') {
|
|
164
|
-
button.onPress?.(text);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
onOpenChange(false);
|
|
168
|
-
}}
|
|
169
|
-
blurOnSubmit={prompt.type !== 'login-password'}
|
|
170
|
-
/>
|
|
171
|
-
{prompt.type === 'login-password' && (
|
|
172
|
-
<TextField
|
|
173
|
-
ref={passwordRef}
|
|
174
|
-
labelClassName="bg-card"
|
|
175
|
-
keyboardType={prompt.keyboardType}
|
|
176
|
-
defaultValue={prompt.defaultValue}
|
|
177
|
-
label="Password"
|
|
178
|
-
secureTextEntry={prompt.type === 'login-password'}
|
|
179
|
-
value={password}
|
|
180
|
-
onChangeText={setPassword}
|
|
181
|
-
onSubmitEditing={() => {
|
|
182
|
-
for (const button of buttons) {
|
|
183
|
-
if (!button.style || button.style === 'default') {
|
|
184
|
-
button.onPress?.(text);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
onOpenChange(false);
|
|
188
|
-
}}
|
|
189
|
-
/>
|
|
190
|
-
)}
|
|
191
|
-
</View>
|
|
192
|
-
) : (
|
|
193
|
-
<View className="h-0.5" />
|
|
194
|
-
)}
|
|
195
|
-
<View
|
|
196
|
-
className={cn(
|
|
197
|
-
'flex-row items-center justify-end gap-0.5',
|
|
198
|
-
buttons.length > 2 && 'justify-between'
|
|
199
|
-
)}>
|
|
200
|
-
{buttons.map((button, index) => {
|
|
201
|
-
if (button.style === 'cancel') {
|
|
202
|
-
return (
|
|
203
|
-
<View
|
|
204
|
-
key={`${button.text}-${index}`}
|
|
205
|
-
className={cn(
|
|
206
|
-
buttons.length > 2 && index === 0 && 'flex-1 items-start'
|
|
207
|
-
)}>
|
|
208
|
-
<AlertDialogPrimitive.Cancel asChild>
|
|
209
|
-
<Button
|
|
210
|
-
variant="plain"
|
|
211
|
-
onPress={() => {
|
|
212
|
-
button.onPress?.(
|
|
213
|
-
prompt?.type === 'login-password'
|
|
214
|
-
? { login: text, password }
|
|
215
|
-
: text
|
|
216
|
-
);
|
|
217
|
-
}}>
|
|
218
|
-
<Text className="text-primary text-[14px] font-medium">
|
|
219
|
-
{button.text}
|
|
220
|
-
</Text>
|
|
221
|
-
</Button>
|
|
222
|
-
</AlertDialogPrimitive.Cancel>
|
|
223
|
-
</View>
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
if (button.style === 'destructive') {
|
|
227
|
-
return (
|
|
228
|
-
<View
|
|
229
|
-
key={`${button.text}-${index}`}
|
|
230
|
-
className={cn(
|
|
231
|
-
buttons.length > 2 && index === 0 && 'flex-1 items-start'
|
|
232
|
-
)}>
|
|
233
|
-
<AlertDialogPrimitive.Action asChild>
|
|
234
|
-
<Button
|
|
235
|
-
variant="tonal"
|
|
236
|
-
className="bg-destructive/10 dark:bg-destructive/25"
|
|
237
|
-
onPress={() => {
|
|
238
|
-
button.onPress?.(
|
|
239
|
-
prompt?.type === 'login-password'
|
|
240
|
-
? { login: text, password }
|
|
241
|
-
: text
|
|
242
|
-
);
|
|
243
|
-
}}>
|
|
244
|
-
<Text className="text-foreground text-[14px] font-medium">
|
|
245
|
-
{button.text}
|
|
246
|
-
</Text>
|
|
247
|
-
</Button>
|
|
248
|
-
</AlertDialogPrimitive.Action>
|
|
249
|
-
</View>
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
return (
|
|
253
|
-
<View
|
|
254
|
-
key={`${button.text}-${index}`}
|
|
255
|
-
className={cn(buttons.length > 2 && index === 0 && 'flex-1 items-start')}>
|
|
256
|
-
<AlertDialogPrimitive.Action asChild>
|
|
257
|
-
<Button
|
|
258
|
-
variant="plain"
|
|
259
|
-
onPress={() => {
|
|
260
|
-
button.onPress?.(
|
|
261
|
-
prompt?.type === 'login-password'
|
|
262
|
-
? { login: text, password }
|
|
263
|
-
: text
|
|
264
|
-
);
|
|
265
|
-
}}>
|
|
266
|
-
<Text className="text-primary text-[14px] font-medium">
|
|
267
|
-
{button.text}
|
|
268
|
-
</Text>
|
|
269
|
-
</Button>
|
|
270
|
-
</AlertDialogPrimitive.Action>
|
|
271
|
-
</View>
|
|
272
|
-
);
|
|
273
|
-
})}
|
|
274
|
-
</View>
|
|
275
|
-
</Animated.View>
|
|
276
|
-
</AlertDialogPrimitive.Content>
|
|
277
|
-
</Animated.View>
|
|
278
|
-
</AlertDialogPrimitive.Overlay>
|
|
279
|
-
</AlertDialogPrimitive.Portal>
|
|
280
|
-
</AlertDialogPrimitive.Root>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
Alert.displayName = 'Alert';
|
|
286
|
-
|
|
287
|
-
const AlertAnchor = React.forwardRef<AlertRef>((_, ref) => {
|
|
288
|
-
return <Alert ref={ref} title="" buttons={[]} />;
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
export { Alert, AlertAnchor };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Alert';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IconProps, MaterialIconName } from '@roninoss/icons';
|
|
2
|
-
import { AlertButton, AlertType, KeyboardType, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
type AlertInputValue = { login: string; password: string } | string;
|
|
5
|
-
|
|
6
|
-
type AlertProps = {
|
|
7
|
-
title: string;
|
|
8
|
-
buttons: (Omit<AlertButton, 'onPress'> & { onPress?: (text: AlertInputValue) => void })[];
|
|
9
|
-
message?: string | undefined;
|
|
10
|
-
prompt?: {
|
|
11
|
-
type?: Exclude<AlertType, 'default'> | undefined;
|
|
12
|
-
defaultValue?: string | undefined;
|
|
13
|
-
keyboardType?: KeyboardType | undefined;
|
|
14
|
-
};
|
|
15
|
-
materialPortalHost?: string;
|
|
16
|
-
materialIcon?: Pick<IconProps<'material'>, 'color' | 'size'> & { name: MaterialIconName };
|
|
17
|
-
materialWidth?: number;
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type AlertRef = React.ElementRef<typeof View> & {
|
|
22
|
-
show: () => void;
|
|
23
|
-
prompt: (args: AlertProps & { prompt: AlertProps['prompt'] }) => void;
|
|
24
|
-
alert: (args: AlertProps) => void;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type { AlertInputValue, AlertProps, AlertRef };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { View, ViewStyle } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Text } from '~/components/nativewindui/Text';
|
|
5
|
-
import { cn } from '~/lib/cn';
|
|
6
|
-
|
|
7
|
-
const BORDER_CURVE: ViewStyle = {
|
|
8
|
-
borderCurve: 'continuous',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
type TextProps = React.ComponentPropsWithoutRef<typeof Text>;
|
|
12
|
-
|
|
13
|
-
type BadgeVariant = 'info' | 'destructive';
|
|
14
|
-
|
|
15
|
-
type BadgeProps = Omit<TextProps, 'variant'> & {
|
|
16
|
-
/**
|
|
17
|
-
* "info" | "destructive" - Defaults to 'destructive'
|
|
18
|
-
*/
|
|
19
|
-
variant?: BadgeVariant;
|
|
20
|
-
/**
|
|
21
|
-
* The maximum count to display. If the count is greater than the maxCount, it will display "{maxCount}+".
|
|
22
|
-
*/
|
|
23
|
-
maxCount?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Defaults to "caption2"
|
|
26
|
-
*/
|
|
27
|
-
textVariant?: TextProps['variant'];
|
|
28
|
-
containerClassName?: string;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Positioning is relative to its parent.
|
|
33
|
-
* @example With a count
|
|
34
|
-
* <View>
|
|
35
|
-
<Icon name="bell-outline" />
|
|
36
|
-
<Badge maxCount={9}>6</Badge>
|
|
37
|
-
</View>
|
|
38
|
-
* @example Without a count
|
|
39
|
-
* <View>
|
|
40
|
-
<Icon name="bell-outline" />
|
|
41
|
-
<Badge variant="info" />
|
|
42
|
-
</View>
|
|
43
|
-
*/
|
|
44
|
-
function Badge({
|
|
45
|
-
variant = 'destructive',
|
|
46
|
-
className,
|
|
47
|
-
textVariant = 'caption2',
|
|
48
|
-
children,
|
|
49
|
-
maxCount,
|
|
50
|
-
...props
|
|
51
|
-
}: BadgeProps) {
|
|
52
|
-
return (
|
|
53
|
-
<View
|
|
54
|
-
style={BORDER_CURVE}
|
|
55
|
-
className={cn(
|
|
56
|
-
variant === 'info' ? 'bg-primary' : variant === 'destructive' ? 'bg-destructive' : '',
|
|
57
|
-
'absolute z-50 items-center justify-center rounded-full text-center',
|
|
58
|
-
!children
|
|
59
|
-
? 'ios:-right-px -right-0.5 top-0 h-2.5 w-2.5'
|
|
60
|
-
: 'ios:-right-1 -right-1.5 -top-0.5 min-w-4 px-1'
|
|
61
|
-
)}>
|
|
62
|
-
<Text
|
|
63
|
-
variant={textVariant}
|
|
64
|
-
className={cn('font-extrabold text-white', className)}
|
|
65
|
-
children={getCount(children, maxCount)}
|
|
66
|
-
{...props}
|
|
67
|
-
/>
|
|
68
|
-
</View>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { Badge };
|
|
73
|
-
|
|
74
|
-
function getCount(count: React.ReactNode, maxCount?: number) {
|
|
75
|
-
if (maxCount == null) return count;
|
|
76
|
-
if (typeof count !== 'string' && typeof count !== 'number') return count;
|
|
77
|
-
// Check that the count string is a number
|
|
78
|
-
if (typeof count === 'string' && !/^\d+$/.test(count.trim())) return count;
|
|
79
|
-
|
|
80
|
-
const countNumber = typeof count === 'number' ? count : parseInt(count.trim(), 10);
|
|
81
|
-
if (Number.isNaN(countNumber)) return count;
|
|
82
|
-
|
|
83
|
-
return countNumber <= maxCount ? count : `${maxCount}+`;
|
|
84
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, Pressable, PressableProps, View, ViewStyle } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { TextClassContext } from '~/components/nativewindui/Text';
|
|
6
|
-
import * as Slot from '@rn-primitives/slot';
|
|
7
|
-
import { cn } from '~/lib/cn';
|
|
8
|
-
import { useColorScheme } from '~/lib/useColorScheme';
|
|
9
|
-
import { COLORS } from '~/theme/colors';
|
|
10
|
-
|
|
11
|
-
const buttonVariants = cva('flex-row items-center justify-center gap-2', {
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
primary: 'ios:active:opacity-80 bg-primary',
|
|
15
|
-
secondary: 'ios:border-primary ios:active:bg-primary/5 border border-foreground/40',
|
|
16
|
-
tonal:
|
|
17
|
-
'ios:bg-primary/10 dark:ios:bg-primary/10 ios:active:bg-primary/15 bg-primary/15 dark:bg-primary/30',
|
|
18
|
-
plain: 'ios:active:opacity-70',
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
none: '',
|
|
22
|
-
sm: 'py-1 px-2.5 rounded-full',
|
|
23
|
-
md: 'ios:rounded-lg py-2 ios:py-1.5 ios:px-3.5 px-5 rounded-full',
|
|
24
|
-
lg: 'py-2.5 px-5 ios:py-2 rounded-xl gap-2',
|
|
25
|
-
icon: 'ios:rounded-lg h-10 w-10 rounded-full',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
variant: 'primary',
|
|
30
|
-
size: 'md',
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const androidRootVariants = cva('overflow-hidden', {
|
|
35
|
-
variants: {
|
|
36
|
-
size: {
|
|
37
|
-
none: '',
|
|
38
|
-
icon: 'rounded-full',
|
|
39
|
-
sm: 'rounded-full',
|
|
40
|
-
md: 'rounded-full',
|
|
41
|
-
lg: 'rounded-xl',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
defaultVariants: {
|
|
45
|
-
size: 'md',
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const buttonTextVariants = cva('font-medium', {
|
|
50
|
-
variants: {
|
|
51
|
-
variant: {
|
|
52
|
-
primary: 'text-white',
|
|
53
|
-
secondary: 'ios:text-primary text-foreground',
|
|
54
|
-
tonal: 'ios:text-primary text-foreground',
|
|
55
|
-
plain: 'text-foreground',
|
|
56
|
-
},
|
|
57
|
-
size: {
|
|
58
|
-
none: '',
|
|
59
|
-
icon: '',
|
|
60
|
-
sm: 'text-[15px] leading-5',
|
|
61
|
-
md: 'text-[17px] leading-7',
|
|
62
|
-
lg: 'text-[17px] leading-7',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
defaultVariants: {
|
|
66
|
-
variant: 'primary',
|
|
67
|
-
size: 'md',
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
function convertToRGBA(rgb: string, opacity: number): string {
|
|
72
|
-
const rgbValues = rgb.match(/\d+/g);
|
|
73
|
-
if (!rgbValues || rgbValues.length !== 3) {
|
|
74
|
-
throw new Error('Invalid RGB color format');
|
|
75
|
-
}
|
|
76
|
-
const red = parseInt(rgbValues[0], 10);
|
|
77
|
-
const green = parseInt(rgbValues[1], 10);
|
|
78
|
-
const blue = parseInt(rgbValues[2], 10);
|
|
79
|
-
if (opacity < 0 || opacity > 1) {
|
|
80
|
-
throw new Error('Opacity must be a number between 0 and 1');
|
|
81
|
-
}
|
|
82
|
-
return `rgba(${red},${green},${blue},${opacity})`;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const ANDROID_RIPPLE = {
|
|
86
|
-
dark: {
|
|
87
|
-
primary: { color: convertToRGBA(COLORS.dark.grey3, 0.4), borderless: false },
|
|
88
|
-
secondary: { color: convertToRGBA(COLORS.dark.grey5, 0.8), borderless: false },
|
|
89
|
-
plain: { color: convertToRGBA(COLORS.dark.grey5, 0.8), borderless: false },
|
|
90
|
-
tonal: { color: convertToRGBA(COLORS.dark.grey5, 0.8), borderless: false },
|
|
91
|
-
},
|
|
92
|
-
light: {
|
|
93
|
-
primary: { color: convertToRGBA(COLORS.light.grey4, 0.4), borderless: false },
|
|
94
|
-
secondary: { color: convertToRGBA(COLORS.light.grey5, 0.4), borderless: false },
|
|
95
|
-
plain: { color: convertToRGBA(COLORS.light.grey5, 0.4), borderless: false },
|
|
96
|
-
tonal: { color: convertToRGBA(COLORS.light.grey6, 0.4), borderless: false },
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// Add as class when possible: https://github.com/marklawlor/nativewind/issues/522
|
|
101
|
-
const BORDER_CURVE: ViewStyle = {
|
|
102
|
-
borderCurve: 'continuous',
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
type ButtonVariantProps = Omit<VariantProps<typeof buttonVariants>, 'variant'> & {
|
|
106
|
-
variant?: Exclude<VariantProps<typeof buttonVariants>['variant'], null>;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
type AndroidOnlyButtonProps = {
|
|
110
|
-
/**
|
|
111
|
-
* ANDROID ONLY: The class name of root responsible for hidding the ripple overflow.
|
|
112
|
-
*/
|
|
113
|
-
androidRootClassName?: string;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
type ButtonProps = PressableProps & ButtonVariantProps & AndroidOnlyButtonProps;
|
|
117
|
-
|
|
118
|
-
const Root = Platform.OS === 'android' ? View : Slot.Pressable;
|
|
119
|
-
|
|
120
|
-
const Button = React.forwardRef<React.ElementRef<typeof Pressable>, ButtonProps>(
|
|
121
|
-
(
|
|
122
|
-
{ className, variant = 'primary', size, style = BORDER_CURVE, androidRootClassName, ...props },
|
|
123
|
-
ref
|
|
124
|
-
) => {
|
|
125
|
-
const { colorScheme } = useColorScheme();
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<TextClassContext.Provider value={buttonTextVariants({ variant, size })}>
|
|
129
|
-
<Root
|
|
130
|
-
className={Platform.select({
|
|
131
|
-
ios: undefined,
|
|
132
|
-
default: androidRootVariants({
|
|
133
|
-
size,
|
|
134
|
-
className: androidRootClassName,
|
|
135
|
-
}),
|
|
136
|
-
})}>
|
|
137
|
-
<Pressable
|
|
138
|
-
className={cn(
|
|
139
|
-
props.disabled && 'opacity-50',
|
|
140
|
-
buttonVariants({ variant, size, className })
|
|
141
|
-
)}
|
|
142
|
-
ref={ref}
|
|
143
|
-
style={style}
|
|
144
|
-
android_ripple={ANDROID_RIPPLE[colorScheme][variant]}
|
|
145
|
-
{...props}
|
|
146
|
-
/>
|
|
147
|
-
</Root>
|
|
148
|
-
</TextClassContext.Provider>
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
Button.displayName = 'Button';
|
|
154
|
-
|
|
155
|
-
export { Button, buttonTextVariants, buttonVariants };
|
|
156
|
-
export type { ButtonProps };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Icon } from '@roninoss/icons';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import * as CheckboxPrimitive from '@rn-primitives/checkbox';
|
|
6
|
-
import { useControllableState } from '@rn-primitives/hooks';
|
|
7
|
-
import { cn } from '~/lib/cn';
|
|
8
|
-
import { COLORS } from '~/theme/colors';
|
|
9
|
-
|
|
10
|
-
type CheckboxProps = Omit<
|
|
11
|
-
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,
|
|
12
|
-
'checked' | 'onCheckedChange'
|
|
13
|
-
> & {
|
|
14
|
-
defaultChecked?: boolean;
|
|
15
|
-
checked?: boolean;
|
|
16
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(
|
|
20
|
-
(
|
|
21
|
-
{
|
|
22
|
-
className,
|
|
23
|
-
checked: checkedProps,
|
|
24
|
-
onCheckedChange: onCheckedChangeProps,
|
|
25
|
-
defaultChecked = false,
|
|
26
|
-
...props
|
|
27
|
-
},
|
|
28
|
-
ref
|
|
29
|
-
) => {
|
|
30
|
-
const [checked = false, onCheckedChange] = useControllableState({
|
|
31
|
-
prop: checkedProps,
|
|
32
|
-
defaultProp: defaultChecked,
|
|
33
|
-
onChange: onCheckedChangeProps,
|
|
34
|
-
});
|
|
35
|
-
return (
|
|
36
|
-
<CheckboxPrimitive.Root
|
|
37
|
-
ref={ref}
|
|
38
|
-
className={cn(
|
|
39
|
-
'ios:rounded-full ios:h-[22px] ios:w-[22px] h-[18px] w-[18px] rounded-sm border border-muted-foreground',
|
|
40
|
-
checked && 'border-0 bg-primary',
|
|
41
|
-
props.disabled && 'opacity-50',
|
|
42
|
-
className
|
|
43
|
-
)}
|
|
44
|
-
checked={checked}
|
|
45
|
-
onCheckedChange={onCheckedChange}
|
|
46
|
-
{...props}>
|
|
47
|
-
<CheckboxPrimitive.Indicator className={cn('h-full w-full items-center justify-center')}>
|
|
48
|
-
<Icon
|
|
49
|
-
name="check"
|
|
50
|
-
ios={{ weight: 'medium' }}
|
|
51
|
-
size={Platform.select({ ios: 15, default: 16 })}
|
|
52
|
-
color={COLORS.white}
|
|
53
|
-
/>
|
|
54
|
-
</CheckboxPrimitive.Indicator>
|
|
55
|
-
</CheckboxPrimitive.Root>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
60
|
-
|
|
61
|
-
export { Checkbox };
|