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,31 +0,0 @@
|
|
|
1
|
-
import RNSegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
2
|
-
|
|
3
|
-
import { SegmentControlProps } from './types';
|
|
4
|
-
|
|
5
|
-
function SegmentedControl({
|
|
6
|
-
values,
|
|
7
|
-
selectedIndex,
|
|
8
|
-
onIndexChange,
|
|
9
|
-
onValueChange: onValueChangeProp,
|
|
10
|
-
enabled = true,
|
|
11
|
-
iosMomentary: _iosMomentary,
|
|
12
|
-
}: SegmentControlProps) {
|
|
13
|
-
function onChange(event: { nativeEvent: { selectedSegmentIndex: number } }) {
|
|
14
|
-
onIndexChange?.(event.nativeEvent.selectedSegmentIndex);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function onValueChange(value: string) {
|
|
18
|
-
onValueChangeProp?.(value);
|
|
19
|
-
}
|
|
20
|
-
return (
|
|
21
|
-
<RNSegmentedControl
|
|
22
|
-
enabled={enabled}
|
|
23
|
-
values={values}
|
|
24
|
-
selectedIndex={selectedIndex}
|
|
25
|
-
onChange={onChange}
|
|
26
|
-
onValueChange={onValueChange}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { SegmentedControl };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { SegmentControlProps } from './types';
|
|
5
|
-
|
|
6
|
-
import { Text } from '~/components/nativewindui/Text';
|
|
7
|
-
import { Button } from '~/components/nativewindui/Button';
|
|
8
|
-
import { cn } from '~/lib/cn';
|
|
9
|
-
|
|
10
|
-
function SegmentedControl({
|
|
11
|
-
values,
|
|
12
|
-
selectedIndex,
|
|
13
|
-
onIndexChange,
|
|
14
|
-
onValueChange,
|
|
15
|
-
enabled = true,
|
|
16
|
-
iosMomentary: _iosMomentary,
|
|
17
|
-
}: SegmentControlProps) {
|
|
18
|
-
const id = React.useId();
|
|
19
|
-
|
|
20
|
-
function onPress(index: number, value: string) {
|
|
21
|
-
return () => {
|
|
22
|
-
onIndexChange?.(index);
|
|
23
|
-
onValueChange?.(value);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return (
|
|
27
|
-
<View className="border-foreground/50 flex-row rounded-full border">
|
|
28
|
-
{values.map((value, index) => {
|
|
29
|
-
return (
|
|
30
|
-
<View key={`segment:${id}-${index}-${value}`} className="flex-1">
|
|
31
|
-
<Button
|
|
32
|
-
disabled={!enabled}
|
|
33
|
-
size="sm"
|
|
34
|
-
variant={selectedIndex === index ? 'tonal' : 'plain'}
|
|
35
|
-
androidRootClassName={cn(
|
|
36
|
-
'rounded-none',
|
|
37
|
-
index === 0 && 'rounded-l-full',
|
|
38
|
-
index === values?.length - 1 && 'rounded-r-full'
|
|
39
|
-
)}
|
|
40
|
-
className={cn(
|
|
41
|
-
'rounded-none py-2.5',
|
|
42
|
-
index === 0 && 'rounded-l-full',
|
|
43
|
-
index === values?.length - 1 ? 'rounded-r-full' : 'border-foreground/50 border-r'
|
|
44
|
-
)}
|
|
45
|
-
onPress={onPress(index, value)}>
|
|
46
|
-
<Text>{value}</Text>
|
|
47
|
-
</Button>
|
|
48
|
-
</View>
|
|
49
|
-
);
|
|
50
|
-
})}
|
|
51
|
-
</View>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { SegmentedControl };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SegmentedControl';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type SegmentControlProps = {
|
|
2
|
-
enabled?: boolean;
|
|
3
|
-
onIndexChange?: (index: number) => void;
|
|
4
|
-
onValueChange?: (value: string) => void;
|
|
5
|
-
selectedIndex?: number;
|
|
6
|
-
|
|
7
|
-
values: string[];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* If true, then selecting a segment won't persist visually. The onValueChange callback will still work as expected.
|
|
11
|
-
*/
|
|
12
|
-
iosMomentary?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type { SegmentControlProps };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Icon } from '@roninoss/icons';
|
|
2
|
-
import { Pressable, View, type PressableProps, type ViewProps, type ViewStyle } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { cn } from '~/lib/cn';
|
|
5
|
-
import { useColorScheme } from '~/lib/useColorScheme';
|
|
6
|
-
|
|
7
|
-
// Add as class when possible: https://github.com/marklawlor/nativewind/issues/522
|
|
8
|
-
const BORDER_CURVE: ViewStyle = {
|
|
9
|
-
borderCurve: 'continuous',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type withoutChildren<T> = Omit<T, 'children'>;
|
|
13
|
-
|
|
14
|
-
type StepperProps = withoutChildren<ViewProps> & {
|
|
15
|
-
subtractButton?: withoutChildren<PressableProps>;
|
|
16
|
-
addButton?: withoutChildren<PressableProps>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function Stepper({ className, subtractButton, addButton, ...props }: StepperProps) {
|
|
20
|
-
const { colors } = useColorScheme();
|
|
21
|
-
return (
|
|
22
|
-
<View
|
|
23
|
-
style={BORDER_CURVE}
|
|
24
|
-
className={cn(
|
|
25
|
-
'ios:bg-card ios:rounded-md ios:border-0 flex-row items-center overflow-hidden rounded-full border border-border',
|
|
26
|
-
className
|
|
27
|
-
)}
|
|
28
|
-
{...props}>
|
|
29
|
-
<Pressable
|
|
30
|
-
{...subtractButton}
|
|
31
|
-
className={cn(
|
|
32
|
-
'ios:active:bg-border/30 active:bg-primary/10 dark:active:bg-primary/15 dark:ios:active:bg-border/30 ios:px-3 ios:h-[30px] h-[38px] justify-center px-5',
|
|
33
|
-
subtractButton?.disabled && 'bg-border/20 opacity-70 dark:opacity-50',
|
|
34
|
-
subtractButton?.className
|
|
35
|
-
)}>
|
|
36
|
-
<Icon
|
|
37
|
-
name="minus"
|
|
38
|
-
size={21}
|
|
39
|
-
color={colors.foreground}
|
|
40
|
-
materialIcon={{ style: { opacity: 0.6 } }}
|
|
41
|
-
/>
|
|
42
|
-
</Pressable>
|
|
43
|
-
<View className="ios:h-5 ios:bg-border h-[38px] w-px rounded-full bg-border" />
|
|
44
|
-
<Pressable
|
|
45
|
-
{...addButton}
|
|
46
|
-
className={cn(
|
|
47
|
-
'ios:active:bg-border/30 active:bg-primary/10 dark:active:bg-primary/15 dark:ios:active:bg-border/30 ios:px-3 ios:h-[30px] h-[38px] justify-center px-5',
|
|
48
|
-
addButton?.disabled && 'bg-border/20 opacity-70 dark:opacity-50',
|
|
49
|
-
addButton?.className
|
|
50
|
-
)}>
|
|
51
|
-
<Icon
|
|
52
|
-
name="plus"
|
|
53
|
-
size={21}
|
|
54
|
-
color={colors.foreground}
|
|
55
|
-
materialIcon={{ style: { opacity: 0.6 } }}
|
|
56
|
-
/>
|
|
57
|
-
</Pressable>
|
|
58
|
-
</View>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { Stepper };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { VariantProps, cva } from 'class-variance-authority';
|
|
2
|
-
import { cssInterop } from 'nativewind';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { UITextView } from 'react-native-uitextview';
|
|
5
|
-
|
|
6
|
-
import { cn } from '~/lib/cn';
|
|
7
|
-
|
|
8
|
-
cssInterop(UITextView, { className: 'style' });
|
|
9
|
-
|
|
10
|
-
const textVariants = cva('text-foreground', {
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
largeTitle: 'text-4xl',
|
|
14
|
-
title1: 'text-2xl',
|
|
15
|
-
title2: 'text-[22px] leading-7',
|
|
16
|
-
title3: 'text-xl',
|
|
17
|
-
heading: 'text-[17px] leading-6 font-semibold',
|
|
18
|
-
body: 'text-[17px] leading-6',
|
|
19
|
-
callout: 'text-base',
|
|
20
|
-
subhead: 'text-[15px] leading-6',
|
|
21
|
-
footnote: 'text-[13px] leading-5',
|
|
22
|
-
caption1: 'text-xs',
|
|
23
|
-
caption2: 'text-[11px] leading-4',
|
|
24
|
-
},
|
|
25
|
-
color: {
|
|
26
|
-
primary: '',
|
|
27
|
-
secondary: 'text-secondary-foreground/90',
|
|
28
|
-
tertiary: 'text-muted-foreground/90',
|
|
29
|
-
quarternary: 'text-muted-foreground/50',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
defaultVariants: {
|
|
33
|
-
variant: 'body',
|
|
34
|
-
color: 'primary',
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const TextClassContext = React.createContext<string | undefined>(undefined);
|
|
39
|
-
|
|
40
|
-
function Text({
|
|
41
|
-
className,
|
|
42
|
-
variant,
|
|
43
|
-
color,
|
|
44
|
-
...props
|
|
45
|
-
}: React.ComponentPropsWithoutRef<typeof UITextView> & VariantProps<typeof textVariants>) {
|
|
46
|
-
const textClassName = React.useContext(TextClassContext);
|
|
47
|
-
return (
|
|
48
|
-
<UITextView
|
|
49
|
-
className={cn(textVariants({ variant, color }), textClassName, className)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { Text, TextClassContext, textVariants };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { useAugmentedRef, useControllableState } from '@rn-primitives/hooks';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Pressable, TextInput, View } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import type { TextFieldProps, TextFieldRef } from './types';
|
|
6
|
-
|
|
7
|
-
import { Text } from '~/components/nativewindui/Text';
|
|
8
|
-
import { cn } from '~/lib/cn';
|
|
9
|
-
|
|
10
|
-
const TextField = React.forwardRef<TextFieldRef, TextFieldProps>(
|
|
11
|
-
(
|
|
12
|
-
{
|
|
13
|
-
value: valueProp,
|
|
14
|
-
onChangeText: onChangeTextProp,
|
|
15
|
-
editable,
|
|
16
|
-
className,
|
|
17
|
-
children,
|
|
18
|
-
leftView,
|
|
19
|
-
rightView,
|
|
20
|
-
label,
|
|
21
|
-
labelClassName,
|
|
22
|
-
containerClassName,
|
|
23
|
-
accessibilityHint,
|
|
24
|
-
errorMessage,
|
|
25
|
-
materialVariant: _materialVariant,
|
|
26
|
-
...props
|
|
27
|
-
},
|
|
28
|
-
ref
|
|
29
|
-
) => {
|
|
30
|
-
const inputRef = useAugmentedRef({ ref, methods: { focus, blur, clear } });
|
|
31
|
-
|
|
32
|
-
const [value = '', onChangeText] = useControllableState({
|
|
33
|
-
prop: valueProp,
|
|
34
|
-
defaultProp: valueProp ?? '',
|
|
35
|
-
onChange: onChangeTextProp,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
function focus() {
|
|
39
|
-
inputRef.current?.focus();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function blur() {
|
|
43
|
-
inputRef.current?.blur();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function clear() {
|
|
47
|
-
onChangeText('');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Pressable
|
|
52
|
-
className={cn(editable === false && 'opacity-50', containerClassName)}
|
|
53
|
-
disabled={editable === false}
|
|
54
|
-
onPress={focus}>
|
|
55
|
-
{!!label && (
|
|
56
|
-
<View className={cn('flex-row pt-2', !leftView ? 'pl-1.5' : 'pl-2')}>
|
|
57
|
-
{leftView}
|
|
58
|
-
<Text
|
|
59
|
-
className={cn('text-muted-foreground', !leftView ? 'pl-1' : 'pl-2', labelClassName)}>
|
|
60
|
-
{label}
|
|
61
|
-
</Text>
|
|
62
|
-
</View>
|
|
63
|
-
)}
|
|
64
|
-
<View className="flex-row">
|
|
65
|
-
{!!leftView && !label && leftView}
|
|
66
|
-
<TextInput
|
|
67
|
-
ref={inputRef}
|
|
68
|
-
editable={editable}
|
|
69
|
-
className={cn('flex-1 px-2.5 py-3 text-[17px] text-foreground', className)}
|
|
70
|
-
onChangeText={onChangeText}
|
|
71
|
-
value={value}
|
|
72
|
-
clearButtonMode="while-editing"
|
|
73
|
-
accessibilityHint={accessibilityHint ?? errorMessage}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
{rightView}
|
|
77
|
-
</View>
|
|
78
|
-
</Pressable>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
TextField.displayName = 'iOSTextField';
|
|
84
|
-
|
|
85
|
-
export { TextField };
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { useAugmentedRef, useControllableState } from '@rn-primitives/hooks';
|
|
2
|
-
import { Icon } from '@roninoss/icons';
|
|
3
|
-
import { cva } from 'class-variance-authority';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
Pressable,
|
|
7
|
-
TextInput,
|
|
8
|
-
View,
|
|
9
|
-
ViewProps,
|
|
10
|
-
ViewStyle,
|
|
11
|
-
type NativeSyntheticEvent,
|
|
12
|
-
type TextInputFocusEventData,
|
|
13
|
-
} from 'react-native';
|
|
14
|
-
import Animated, {
|
|
15
|
-
FadeIn,
|
|
16
|
-
FadeOut,
|
|
17
|
-
useAnimatedStyle,
|
|
18
|
-
useDerivedValue,
|
|
19
|
-
withTiming,
|
|
20
|
-
} from 'react-native-reanimated';
|
|
21
|
-
|
|
22
|
-
import type { TextFieldProps, TextFieldRef } from './types';
|
|
23
|
-
|
|
24
|
-
import { cn } from '~/lib/cn';
|
|
25
|
-
import { useColorScheme } from '~/lib/useColorScheme';
|
|
26
|
-
|
|
27
|
-
const TextField = React.forwardRef<TextFieldRef, TextFieldProps>(
|
|
28
|
-
(
|
|
29
|
-
{
|
|
30
|
-
value: valueProp,
|
|
31
|
-
defaultValue: defaultValueProp,
|
|
32
|
-
onChangeText: onChangeTextProp,
|
|
33
|
-
onFocus: onFocusProp,
|
|
34
|
-
onBlur: onBlurProp,
|
|
35
|
-
placeholder,
|
|
36
|
-
editable,
|
|
37
|
-
className,
|
|
38
|
-
children,
|
|
39
|
-
leftView,
|
|
40
|
-
rightView,
|
|
41
|
-
label,
|
|
42
|
-
labelClassName,
|
|
43
|
-
containerClassName,
|
|
44
|
-
accessibilityHint,
|
|
45
|
-
errorMessage,
|
|
46
|
-
materialVariant = 'outlined',
|
|
47
|
-
...props
|
|
48
|
-
},
|
|
49
|
-
ref
|
|
50
|
-
) => {
|
|
51
|
-
const inputRef = useAugmentedRef({ ref, methods: { focus, blur, clear } });
|
|
52
|
-
const [isFocused, setIsFocused] = React.useState(false);
|
|
53
|
-
|
|
54
|
-
const [value = '', onChangeText] = useControllableState({
|
|
55
|
-
prop: valueProp,
|
|
56
|
-
defaultProp: valueProp ?? '',
|
|
57
|
-
onChange: onChangeTextProp,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
function focus() {
|
|
61
|
-
inputRef.current?.focus();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function blur() {
|
|
65
|
-
inputRef.current?.blur();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function clear() {
|
|
69
|
-
onChangeText('');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function onFocus(e: NativeSyntheticEvent<TextInputFocusEventData>) {
|
|
73
|
-
setIsFocused(true);
|
|
74
|
-
onFocusProp?.(e);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function onBlur(e: NativeSyntheticEvent<TextInputFocusEventData>) {
|
|
78
|
-
setIsFocused(false);
|
|
79
|
-
onBlurProp?.(e);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const InputWrapper = materialVariant === 'filled' ? FilledWrapper : FilledWrapper;
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<Pressable
|
|
86
|
-
className={rootVariants({
|
|
87
|
-
variant: materialVariant,
|
|
88
|
-
state: getInputState({
|
|
89
|
-
isFocused,
|
|
90
|
-
hasError: !!errorMessage,
|
|
91
|
-
editable,
|
|
92
|
-
}),
|
|
93
|
-
className: containerClassName,
|
|
94
|
-
})}
|
|
95
|
-
disabled={editable === false}
|
|
96
|
-
onPress={focus}>
|
|
97
|
-
<View
|
|
98
|
-
className={innerRootVariants({
|
|
99
|
-
variant: materialVariant,
|
|
100
|
-
state: getInputState({
|
|
101
|
-
isFocused,
|
|
102
|
-
hasError: !!errorMessage,
|
|
103
|
-
editable,
|
|
104
|
-
}),
|
|
105
|
-
})}>
|
|
106
|
-
{leftView}
|
|
107
|
-
<InputWrapper>
|
|
108
|
-
{!!label && (
|
|
109
|
-
<MaterialLabel
|
|
110
|
-
materialVariant={materialVariant}
|
|
111
|
-
isFocused={isFocused}
|
|
112
|
-
value={value}
|
|
113
|
-
materialLabel={label}
|
|
114
|
-
hasLeftView={!!leftView}
|
|
115
|
-
className={labelClassName}
|
|
116
|
-
hasError={!!errorMessage}
|
|
117
|
-
/>
|
|
118
|
-
)}
|
|
119
|
-
<TextInput
|
|
120
|
-
ref={inputRef}
|
|
121
|
-
editable={editable}
|
|
122
|
-
className={cn(
|
|
123
|
-
'flex-1 rounded py-3 pl-2.5 text-[17px] text-foreground dark:placeholder:text-white/30',
|
|
124
|
-
materialVariant === 'filled' && !!label && 'pb-2 pt-5',
|
|
125
|
-
className
|
|
126
|
-
)}
|
|
127
|
-
placeholder={isFocused || !label ? placeholder : ''}
|
|
128
|
-
onFocus={onFocus}
|
|
129
|
-
onBlur={onBlur}
|
|
130
|
-
onChangeText={onChangeText}
|
|
131
|
-
value={value}
|
|
132
|
-
accessibilityHint={accessibilityHint ?? errorMessage}
|
|
133
|
-
{...props}
|
|
134
|
-
/>
|
|
135
|
-
</InputWrapper>
|
|
136
|
-
{!!errorMessage ? (
|
|
137
|
-
<MaterialErrorIcon />
|
|
138
|
-
) : (
|
|
139
|
-
!!value && isFocused && <MaterialClearIcon clearText={clear} editable={editable} />
|
|
140
|
-
)}
|
|
141
|
-
{rightView}
|
|
142
|
-
</View>
|
|
143
|
-
</Pressable>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
TextField.displayName = 'TextField';
|
|
149
|
-
|
|
150
|
-
export { TextField };
|
|
151
|
-
|
|
152
|
-
type InputState = 'idle' | 'focused' | 'error' | 'errorAndFocused' | 'disabled';
|
|
153
|
-
|
|
154
|
-
type GetInputArgs = {
|
|
155
|
-
isFocused: boolean;
|
|
156
|
-
hasError?: boolean;
|
|
157
|
-
editable?: boolean;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
function getInputState(args: GetInputArgs): InputState {
|
|
161
|
-
if (args.editable === false) return 'disabled';
|
|
162
|
-
if (args.hasError && args.isFocused) return 'errorAndFocused';
|
|
163
|
-
if (args.isFocused) return 'focused';
|
|
164
|
-
return 'idle';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const rootVariants = cva('relative rounded-[5px]', {
|
|
168
|
-
variants: {
|
|
169
|
-
variant: {
|
|
170
|
-
outlined: 'border',
|
|
171
|
-
filled: 'border-b rounded-b-none',
|
|
172
|
-
},
|
|
173
|
-
state: {
|
|
174
|
-
idle: 'border-transparent',
|
|
175
|
-
error: 'border-transparent',
|
|
176
|
-
focused: 'border-primary',
|
|
177
|
-
errorAndFocused: 'border-destructive',
|
|
178
|
-
disabled: 'opacity-50',
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
defaultVariants: {
|
|
182
|
-
variant: 'outlined',
|
|
183
|
-
state: 'idle',
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
const innerRootVariants = cva('flex-row rounded', {
|
|
188
|
-
variants: {
|
|
189
|
-
variant: {
|
|
190
|
-
outlined: 'border border-border',
|
|
191
|
-
filled: 'border-b bg-border/70 rounded-b-none ',
|
|
192
|
-
},
|
|
193
|
-
state: {
|
|
194
|
-
idle: 'border-foreground/30',
|
|
195
|
-
error: 'border-destructive',
|
|
196
|
-
focused: 'border-primary',
|
|
197
|
-
errorAndFocused: 'border-destructive',
|
|
198
|
-
disabled: 'border-foreground/30',
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
defaultVariants: {
|
|
202
|
-
variant: 'outlined',
|
|
203
|
-
state: 'idle',
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
function FilledWrapper(props: ViewProps) {
|
|
208
|
-
return <View className="relative flex-1 flex-row" {...props} />;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
type MaterialLabelProps = {
|
|
212
|
-
isFocused: boolean;
|
|
213
|
-
value: string;
|
|
214
|
-
materialLabel: string;
|
|
215
|
-
hasLeftView: boolean;
|
|
216
|
-
hasError?: boolean;
|
|
217
|
-
className?: string;
|
|
218
|
-
materialVariant: 'outlined' | 'filled';
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const DEFAULT_TEXT_FIELD_HEIGHT = 56;
|
|
222
|
-
|
|
223
|
-
function MaterialLabel(props: MaterialLabelProps) {
|
|
224
|
-
const isLifted = props.isFocused || !!props.value;
|
|
225
|
-
const isLiftedDerived = useDerivedValue(() => isLifted);
|
|
226
|
-
const hasLeftViewDerived = useDerivedValue(() => props.hasLeftView);
|
|
227
|
-
const variantDerived = useDerivedValue(() => props.materialVariant);
|
|
228
|
-
const animatedRootStyle = useAnimatedStyle(() => {
|
|
229
|
-
const style: ViewStyle = {
|
|
230
|
-
position: 'absolute',
|
|
231
|
-
alignSelf: 'center',
|
|
232
|
-
};
|
|
233
|
-
if (variantDerived.value === 'outlined') {
|
|
234
|
-
style.paddingLeft = withTiming(hasLeftViewDerived.value && isLiftedDerived.value ? 0 : 12, {
|
|
235
|
-
duration: 200,
|
|
236
|
-
});
|
|
237
|
-
style.transform = [
|
|
238
|
-
{
|
|
239
|
-
translateY: withTiming(isLiftedDerived.value ? -DEFAULT_TEXT_FIELD_HEIGHT / 2 : 0, {
|
|
240
|
-
duration: 200,
|
|
241
|
-
}),
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
translateX: withTiming(hasLeftViewDerived.value && isLiftedDerived.value ? -12 : 0, {
|
|
245
|
-
duration: 200,
|
|
246
|
-
}),
|
|
247
|
-
},
|
|
248
|
-
];
|
|
249
|
-
}
|
|
250
|
-
if (variantDerived.value === 'filled') {
|
|
251
|
-
style.paddingLeft = 8;
|
|
252
|
-
style.transform = [
|
|
253
|
-
{
|
|
254
|
-
translateY: withTiming(isLiftedDerived.value ? -DEFAULT_TEXT_FIELD_HEIGHT / 4 : 0, {
|
|
255
|
-
duration: 200,
|
|
256
|
-
}),
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
translateX: 0,
|
|
260
|
-
},
|
|
261
|
-
];
|
|
262
|
-
}
|
|
263
|
-
return style;
|
|
264
|
-
});
|
|
265
|
-
const animatedTextStyle = useAnimatedStyle(() => {
|
|
266
|
-
return {
|
|
267
|
-
fontSize: withTiming(isLiftedDerived.value ? 10 : 17, { duration: 200 }),
|
|
268
|
-
};
|
|
269
|
-
});
|
|
270
|
-
return (
|
|
271
|
-
<Animated.View style={animatedRootStyle} pointerEvents="none">
|
|
272
|
-
<Animated.Text
|
|
273
|
-
className={cn(
|
|
274
|
-
'bg-card/0 text-foreground/70 rounded',
|
|
275
|
-
isLifted && 'px-0.5',
|
|
276
|
-
isLifted && props.materialVariant === 'outlined' && 'bg-background',
|
|
277
|
-
props.isFocused && 'text-primary/60 dark:text-primary',
|
|
278
|
-
props.hasError && 'text-destructive dark:text-destructive',
|
|
279
|
-
props.className
|
|
280
|
-
)}
|
|
281
|
-
style={animatedTextStyle}>
|
|
282
|
-
{props.materialLabel}
|
|
283
|
-
</Animated.Text>
|
|
284
|
-
</Animated.View>
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
type MaterialClearIconProps = {
|
|
289
|
-
editable?: boolean;
|
|
290
|
-
clearText: () => void;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
function MaterialClearIcon(props: MaterialClearIconProps) {
|
|
294
|
-
const { colors } = useColorScheme();
|
|
295
|
-
return (
|
|
296
|
-
<Animated.View entering={FadeIn.duration(200)} exiting={FadeOut.duration(200)}>
|
|
297
|
-
<Pressable
|
|
298
|
-
disabled={props.editable === false}
|
|
299
|
-
className="flex-1 justify-center px-2 active:opacity-65"
|
|
300
|
-
onPress={props.clearText}>
|
|
301
|
-
<Icon color={colors.grey2} name="close-circle-outline" size={24} />
|
|
302
|
-
</Pressable>
|
|
303
|
-
</Animated.View>
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function MaterialErrorIcon() {
|
|
308
|
-
const { colors } = useColorScheme();
|
|
309
|
-
return (
|
|
310
|
-
<Animated.View
|
|
311
|
-
pointerEvents="none"
|
|
312
|
-
entering={FadeIn.duration(200)}
|
|
313
|
-
exiting={FadeOut.duration(200)}
|
|
314
|
-
className="justify-center pr-2">
|
|
315
|
-
<Icon
|
|
316
|
-
color={colors.destructive}
|
|
317
|
-
name="close-circle-outline"
|
|
318
|
-
materialIcon={{
|
|
319
|
-
name: 'alert-circle',
|
|
320
|
-
type: 'MaterialCommunityIcons',
|
|
321
|
-
}}
|
|
322
|
-
size={24}
|
|
323
|
-
/>
|
|
324
|
-
</Animated.View>
|
|
325
|
-
);
|
|
326
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TextField';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { TextInput, TextInputProps } from 'react-native';
|
|
2
|
-
|
|
3
|
-
type TextFieldProps = TextInputProps & {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
leftView?: React.ReactNode;
|
|
6
|
-
rightView?: React.ReactNode;
|
|
7
|
-
label?: string;
|
|
8
|
-
labelClassName?: string;
|
|
9
|
-
containerClassName?: string;
|
|
10
|
-
/**
|
|
11
|
-
* For accessibility, can be overridden by accessibilityHint
|
|
12
|
-
* @Material - shows error state with destructive color and icon
|
|
13
|
-
* @iOS - No visual change
|
|
14
|
-
*/
|
|
15
|
-
errorMessage?: string;
|
|
16
|
-
/**
|
|
17
|
-
* @MaterialOnly
|
|
18
|
-
* @default outlined
|
|
19
|
-
* Material variant for the input.
|
|
20
|
-
*/
|
|
21
|
-
materialVariant?: 'outlined' | 'filled';
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
type TextFieldRef = TextInput;
|
|
25
|
-
|
|
26
|
-
export type { TextFieldProps, TextFieldRef };
|