@teardown/cli 1.2.39 → 2.0.41
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/bin/teardown.js +11 -1
- package/package.json +77 -57
- package/src/cli/commands/init.ts +254 -0
- package/src/cli/commands/plugins.ts +93 -0
- package/src/cli/commands/prebuild.ts +168 -0
- package/src/cli/commands/run.ts +727 -0
- package/src/cli/commands/start.ts +87 -0
- package/src/cli/commands/validate.ts +62 -0
- package/src/cli/index.ts +59 -0
- package/src/config/index.ts +45 -0
- package/src/config/loader.ts +366 -0
- package/src/config/schema.ts +235 -0
- package/src/config/types.ts +322 -0
- package/src/index.ts +177 -0
- package/src/pipeline/cache.ts +179 -0
- package/src/pipeline/index.ts +10 -0
- package/src/pipeline/stages.ts +692 -0
- package/src/plugins/base.ts +370 -0
- package/src/plugins/capabilities/biometrics.ts +64 -0
- package/src/plugins/capabilities/bluetooth.ts +86 -0
- package/src/plugins/capabilities/calendar.ts +57 -0
- package/src/plugins/capabilities/camera.ts +77 -0
- package/src/plugins/capabilities/contacts.ts +57 -0
- package/src/plugins/capabilities/deep-linking.ts +124 -0
- package/src/plugins/capabilities/firebase.ts +138 -0
- package/src/plugins/capabilities/index.ts +96 -0
- package/src/plugins/capabilities/location.ts +87 -0
- package/src/plugins/capabilities/photo-library.ts +80 -0
- package/src/plugins/capabilities/push-notifications.ts +98 -0
- package/src/plugins/capabilities/sign-in-with-apple.ts +53 -0
- package/src/plugins/context.ts +220 -0
- package/src/plugins/index.ts +26 -0
- package/src/plugins/resolver.ts +321 -0
- package/src/templates/generator.ts +507 -0
- package/src/templates/index.ts +9 -0
- package/src/templates/paths.ts +25 -0
- package/src/transformers/android/gradle.ts +400 -0
- package/src/transformers/android/index.ts +19 -0
- package/src/transformers/android/manifest.ts +506 -0
- package/src/transformers/index.ts +39 -0
- package/src/transformers/ios/entitlements.ts +283 -0
- package/src/transformers/ios/index.ts +10 -0
- package/src/transformers/ios/pbxproj.ts +267 -0
- package/src/transformers/ios/plist.ts +198 -0
- package/src/utils/fs.ts +429 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/logger.ts +203 -0
- package/templates/.gitignore +63 -0
- package/templates/Gemfile +3 -0
- package/templates/android/app/build.gradle.kts +97 -0
- package/templates/android/app/proguard-rules.pro +10 -0
- package/templates/android/app/src/main/AndroidManifest.xml +26 -0
- package/templates/android/app/src/main/java/com/appname/MainActivity.kt +22 -0
- package/templates/android/app/src/main/java/com/appname/MainApplication.kt +44 -0
- package/templates/android/app/src/main/res/values/strings.xml +3 -0
- package/templates/android/app/src/main/res/values/styles.xml +7 -0
- package/templates/android/build.gradle.kts +44 -0
- package/templates/android/gradle.properties +39 -0
- package/templates/android/settings.gradle.kts +12 -0
- package/templates/babel.config.js +15 -0
- package/templates/index.js +7 -0
- package/templates/ios/.xcode.env +11 -0
- package/templates/ios/AppName/AppDelegate.swift +25 -0
- package/templates/ios/AppName/AppName-Bridging-Header.h +4 -0
- package/templates/ios/AppName/AppName.entitlements +6 -0
- package/templates/ios/AppName/Images.xcassets/AppIcon.appiconset/Contents.json +35 -0
- package/templates/ios/AppName/Images.xcassets/Contents.json +6 -0
- package/templates/ios/AppName/Info.plist +49 -0
- package/templates/ios/AppName/LaunchScreen.storyboard +38 -0
- package/templates/ios/AppName.xcodeproj/project.pbxproj +402 -0
- package/templates/ios/AppName.xcodeproj/xcshareddata/xcschemes/AppName.xcscheme +78 -0
- package/templates/ios/Podfile +35 -0
- package/templates/metro.config.js +41 -0
- package/templates/package.json +57 -0
- package/templates/react-native.config.js +8 -0
- package/templates/src/app/index.tsx +34 -0
- package/templates/src/assets/fonts/.gitkeep +1 -0
- package/templates/src/assets/images/.gitkeep +1 -0
- package/templates/src/components/ui/accordion.tsx +114 -0
- package/templates/src/components/ui/avatar.tsx +75 -0
- package/templates/src/components/ui/button.tsx +93 -0
- package/templates/src/components/ui/card.tsx +120 -0
- package/templates/src/components/ui/checkbox.tsx +133 -0
- package/templates/src/components/ui/chip.tsx +95 -0
- package/templates/src/components/ui/dialog.tsx +134 -0
- package/templates/src/components/ui/divider.tsx +67 -0
- package/templates/src/components/ui/error-view.tsx +82 -0
- package/templates/src/components/ui/form-field.tsx +101 -0
- package/templates/src/components/ui/index.ts +100 -0
- package/templates/src/components/ui/popover.tsx +92 -0
- package/templates/src/components/ui/pressable-feedback.tsx +88 -0
- package/templates/src/components/ui/radio-group.tsx +153 -0
- package/templates/src/components/ui/scroll-shadow.tsx +108 -0
- package/templates/src/components/ui/select.tsx +165 -0
- package/templates/src/components/ui/skeleton-group.tsx +97 -0
- package/templates/src/components/ui/skeleton.tsx +87 -0
- package/templates/src/components/ui/spinner.tsx +87 -0
- package/templates/src/components/ui/surface.tsx +95 -0
- package/templates/src/components/ui/switch.tsx +124 -0
- package/templates/src/components/ui/tabs.tsx +154 -0
- package/templates/src/components/ui/text-field.tsx +106 -0
- package/templates/src/components/ui/toast.tsx +129 -0
- package/templates/src/contexts/.gitkeep +2 -0
- package/templates/src/core/clients/api/api.client.ts +113 -0
- package/templates/src/core/clients/api/index.ts +1 -0
- package/templates/src/core/clients/storage/index.ts +1 -0
- package/templates/src/core/clients/storage/storage.client.ts +121 -0
- package/templates/src/core/constants/index.ts +19 -0
- package/templates/src/core/core.ts +40 -0
- package/templates/src/core/index.ts +10 -0
- package/templates/src/global.css +87 -0
- package/templates/src/hooks/index.ts +6 -0
- package/templates/src/hooks/use-debounce.ts +23 -0
- package/templates/src/hooks/use-mounted.ts +21 -0
- package/templates/src/index.ts +28 -0
- package/templates/src/lib/index.ts +5 -0
- package/templates/src/lib/utils.ts +115 -0
- package/templates/src/modules/.gitkeep +6 -0
- package/templates/src/navigation/index.ts +8 -0
- package/templates/src/navigation/navigation-provider.tsx +36 -0
- package/templates/src/navigation/router.tsx +137 -0
- package/templates/src/providers/app.provider.tsx +29 -0
- package/templates/src/providers/index.ts +5 -0
- package/templates/src/routes/(tabs)/_layout.tsx +42 -0
- package/templates/src/routes/(tabs)/explore.tsx +161 -0
- package/templates/src/routes/(tabs)/home.tsx +138 -0
- package/templates/src/routes/(tabs)/profile.tsx +151 -0
- package/templates/src/routes/_layout.tsx +18 -0
- package/templates/src/routes/settings.tsx +194 -0
- package/templates/src/screens/auth/index.ts +6 -0
- package/templates/src/screens/auth/login.tsx +165 -0
- package/templates/src/screens/auth/register.tsx +203 -0
- package/templates/src/screens/home.tsx +204 -0
- package/templates/src/screens/index.ts +17 -0
- package/templates/src/screens/profile.tsx +210 -0
- package/templates/src/screens/settings.tsx +216 -0
- package/templates/src/screens/welcome.tsx +101 -0
- package/templates/src/styles/index.ts +103 -0
- package/templates/src/types/common.ts +71 -0
- package/templates/src/types/index.ts +5 -0
- package/templates/tsconfig.json +14 -0
- package/README.md +0 -15
- package/assets/favicon.ico +0 -0
- package/dist/commands/dev/dev.d.ts +0 -22
- package/dist/commands/dev/dev.js +0 -56
- package/dist/commands/dev/dev.js.map +0 -1
- package/dist/commands/init/init-teardown.d.ts +0 -9
- package/dist/commands/init/init-teardown.js +0 -27
- package/dist/commands/init/init-teardown.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/modules/dev/dev-menu/keyboard-handler.d.ts +0 -21
- package/dist/modules/dev/dev-menu/keyboard-handler.js +0 -139
- package/dist/modules/dev/dev-menu/keyboard-handler.js.map +0 -1
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.d.ts +0 -18
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js +0 -106
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js.map +0 -1
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.d.ts +0 -6
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.js +0 -13
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.js.map +0 -1
- package/dist/modules/dev/dev-server/cdp/index.d.ts +0 -2
- package/dist/modules/dev/dev-server/cdp/index.js +0 -19
- package/dist/modules/dev/dev-server/cdp/index.js.map +0 -1
- package/dist/modules/dev/dev-server/cdp/types.d.ts +0 -107
- package/dist/modules/dev/dev-server/cdp/types.js +0 -3
- package/dist/modules/dev/dev-server/cdp/types.js.map +0 -1
- package/dist/modules/dev/dev-server/dev-server-checker.d.ts +0 -22
- package/dist/modules/dev/dev-server/dev-server-checker.js +0 -73
- package/dist/modules/dev/dev-server/dev-server-checker.js.map +0 -1
- package/dist/modules/dev/dev-server/dev-server.d.ts +0 -74
- package/dist/modules/dev/dev-server/dev-server.js +0 -272
- package/dist/modules/dev/dev-server/dev-server.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/device.d.ts +0 -46
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.d.ts +0 -37
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.js +0 -166
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/device.js +0 -578
- package/dist/modules/dev/dev-server/inspector/device.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/inspector.d.ts +0 -27
- package/dist/modules/dev/dev-server/inspector/inspector.js +0 -225
- package/dist/modules/dev/dev-server/inspector/inspector.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/types.d.ts +0 -156
- package/dist/modules/dev/dev-server/inspector/types.js +0 -3
- package/dist/modules/dev/dev-server/inspector/types.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.d.ts +0 -14
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js +0 -63
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.d.ts +0 -19
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js +0 -66
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.js +0 -51
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.js +0 -19
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.js +0 -63
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.js +0 -29
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/types.d.ts +0 -11
- package/dist/modules/dev/dev-server/plugins/types.js +0 -3
- package/dist/modules/dev/dev-server/plugins/types.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/index.d.ts +0 -3
- package/dist/modules/dev/dev-server/plugins/wss/index.js +0 -20
- package/dist/modules/dev/dev-server/plugins/wss/index.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.d.ts +0 -37
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js +0 -67
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.d.ts +0 -63
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js +0 -129
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.d.ts +0 -32
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js +0 -76
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.d.ts +0 -75
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js +0 -199
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.d.ts +0 -44
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js +0 -121
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.d.ts +0 -135
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js +0 -364
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/types.d.ts +0 -6
- package/dist/modules/dev/dev-server/plugins/wss/types.js +0 -3
- package/dist/modules/dev/dev-server/plugins/wss/types.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.d.ts +0 -32
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js +0 -58
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.d.ts +0 -13
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js +0 -27
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.d.ts +0 -39
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js +0 -47
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.d.ts +0 -24
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js +0 -56
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.d.ts +0 -7
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js +0 -41
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/sybmolicate/types.d.ts +0 -64
- package/dist/modules/dev/dev-server/sybmolicate/types.js +0 -3
- package/dist/modules/dev/dev-server/sybmolicate/types.js.map +0 -1
- package/dist/modules/dev/terminal/base.terminal.reporter.d.ts +0 -25
- package/dist/modules/dev/terminal/base.terminal.reporter.js +0 -79
- package/dist/modules/dev/terminal/base.terminal.reporter.js.map +0 -1
- package/dist/modules/dev/terminal/terminal.reporter.d.ts +0 -13
- package/dist/modules/dev/terminal/terminal.reporter.js +0 -83
- package/dist/modules/dev/terminal/terminal.reporter.js.map +0 -1
- package/dist/modules/dev/types.d.ts +0 -20
- package/dist/modules/dev/types.js +0 -3
- package/dist/modules/dev/types.js.map +0 -1
- package/dist/modules/dev/utils/log.d.ts +0 -23
- package/dist/modules/dev/utils/log.js +0 -74
- package/dist/modules/dev/utils/log.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { withTeardown } = require("@teardown/metro-config");
|
|
2
|
+
const { withUniwindConfig } = require("uniwind/metro");
|
|
3
|
+
const { withTeardownNavigation } = require("@teardown/navigation-metro");
|
|
4
|
+
const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Metro configuration with Teardown, Uniwind, and Navigation
|
|
8
|
+
*
|
|
9
|
+
* withTeardown() automatically handles:
|
|
10
|
+
* - Rust-powered transforms via Facetpack (36x faster builds)
|
|
11
|
+
* - Monorepo/workspace detection and watch folder configuration
|
|
12
|
+
* - Bun-specific handling (.bun directory blocking)
|
|
13
|
+
*
|
|
14
|
+
* withUniwindConfig() enables:
|
|
15
|
+
* - Tailwind CSS 4 support for React Native
|
|
16
|
+
* - Automatic className scanning and compilation
|
|
17
|
+
* - Hot reloading for style changes
|
|
18
|
+
*
|
|
19
|
+
* withTeardownNavigation() automatically handles:
|
|
20
|
+
* - Type-safe route generation from file-based routes
|
|
21
|
+
* - Deep linking configuration generation
|
|
22
|
+
* - Hot-reload support via file watching in development
|
|
23
|
+
*
|
|
24
|
+
* @type {import("metro-config").MetroConfig}
|
|
25
|
+
*/
|
|
26
|
+
const config = {};
|
|
27
|
+
|
|
28
|
+
// First apply Teardown config, then Navigation, then Uniwind (outermost)
|
|
29
|
+
const teardownConfig = withTeardown(mergeConfig(getDefaultConfig(__dirname), config));
|
|
30
|
+
|
|
31
|
+
const navigationConfig = withTeardownNavigation(teardownConfig, {
|
|
32
|
+
routesDir: "./src/routes",
|
|
33
|
+
generatedDir: "./.teardown",
|
|
34
|
+
prefixes: ["<%= slug %>://"],
|
|
35
|
+
verbose: false,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
module.exports = withUniwindConfig(navigationConfig, {
|
|
39
|
+
cssEntryFile: "./src/global.css",
|
|
40
|
+
dtsFile: "./src/uniwind-types.d.ts",
|
|
41
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= slug %>",
|
|
3
|
+
"version": "<%= version %>",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "teardown start",
|
|
7
|
+
"ios": "teardown run ios",
|
|
8
|
+
"android": "teardown run android",
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"prebuild": "teardown prebuild",
|
|
11
|
+
"prebuild:clean": "teardown prebuild --clean"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@react-navigation/bottom-tabs": "^7.2.0",
|
|
15
|
+
"@react-navigation/native": "^7.0.14",
|
|
16
|
+
"@react-navigation/native-stack": "^7.2.0",
|
|
17
|
+
"@teardown/dev-client": "^0.0.1",
|
|
18
|
+
"@teardown/navigation": "^0.1.0",
|
|
19
|
+
"heroui-native": "^1.0.0-beta.12",
|
|
20
|
+
"react": "18.3.1",
|
|
21
|
+
"react-native": "0.78.2",
|
|
22
|
+
"react-native-mmkv": "^3.2.0",
|
|
23
|
+
"react-native-reanimated": "^3.16.0",
|
|
24
|
+
"react-native-safe-area-context": "^4.14.0",
|
|
25
|
+
"react-native-screens": "^4.4.0",
|
|
26
|
+
"react-native-svg": "^15.8.0",
|
|
27
|
+
"uniwind": "^1.2.0",
|
|
28
|
+
"tailwindcss": "^4.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.26.0",
|
|
32
|
+
"@babel/preset-env": "^7.26.0",
|
|
33
|
+
"@babel/runtime": "^7.26.0",
|
|
34
|
+
"@ecrindigital/facetpack": "^0.2.0",
|
|
35
|
+
"@react-native-community/cli": "15.0.1",
|
|
36
|
+
"@react-native-community/cli-platform-android": "15.0.1",
|
|
37
|
+
"@react-native-community/cli-platform-ios": "15.0.1",
|
|
38
|
+
"@react-native/babel-preset": "0.78.2",
|
|
39
|
+
"@react-native/eslint-config": "0.78.2",
|
|
40
|
+
"@react-native/metro-config": "0.78.2",
|
|
41
|
+
"@react-native/typescript-config": "0.78.2",
|
|
42
|
+
"@teardown/cli": "<%= cliVersion %>",
|
|
43
|
+
"@teardown/metro-config": "^0.1.0",
|
|
44
|
+
"@teardown/navigation-metro": "^0.1.0",
|
|
45
|
+
"@types/react": "^18.3.18",
|
|
46
|
+
"@types/react-test-renderer": "^18.3.1",
|
|
47
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
48
|
+
"eslint": "^8.57.0",
|
|
49
|
+
"jest": "^29.7.0",
|
|
50
|
+
"prettier": "3.4.2",
|
|
51
|
+
"react-test-renderer": "18.3.1",
|
|
52
|
+
"typescript": "~5.7.3"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root App Component
|
|
3
|
+
*
|
|
4
|
+
* This is the main application component that wraps all providers
|
|
5
|
+
* and renders the navigation structure.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: global.css is imported here (not in index.ts) to enable
|
|
8
|
+
* hot reloading for Tailwind CSS changes.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import "../global.css";
|
|
12
|
+
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { View, StatusBar } from "react-native";
|
|
15
|
+
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
|
|
16
|
+
import { AppProviders } from "@/providers";
|
|
17
|
+
import { Router } from "@/navigation";
|
|
18
|
+
|
|
19
|
+
export function App(): React.JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<SafeAreaProvider>
|
|
22
|
+
<AppProviders>
|
|
23
|
+
<View className="flex-1 bg-background">
|
|
24
|
+
<StatusBar barStyle="dark-content" backgroundColor="transparent" translucent />
|
|
25
|
+
<SafeAreaView className="flex-1">
|
|
26
|
+
<Router />
|
|
27
|
+
</SafeAreaView>
|
|
28
|
+
</View>
|
|
29
|
+
</AppProviders>
|
|
30
|
+
</SafeAreaProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Add your custom fonts here
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Add your image assets here
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accordion Component
|
|
3
|
+
*
|
|
4
|
+
* A collapsible component for showing/hiding content sections.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Accordion>
|
|
9
|
+
* <AccordionItem key="1" title="Section 1">
|
|
10
|
+
* <Text>Content for section 1</Text>
|
|
11
|
+
* </AccordionItem>
|
|
12
|
+
* <AccordionItem key="2" title="Section 2">
|
|
13
|
+
* <Text>Content for section 2</Text>
|
|
14
|
+
* </AccordionItem>
|
|
15
|
+
* </Accordion>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example With Subtitle
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Accordion>
|
|
21
|
+
* <AccordionItem
|
|
22
|
+
* key="1"
|
|
23
|
+
* title="Account Settings"
|
|
24
|
+
* subtitle="Manage your account preferences"
|
|
25
|
+
* >
|
|
26
|
+
* <Text>Account settings content</Text>
|
|
27
|
+
* </AccordionItem>
|
|
28
|
+
* </Accordion>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Selection Modes
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Single selection (default)
|
|
34
|
+
* <Accordion selectionMode="single">
|
|
35
|
+
* <AccordionItem key="1" title="Item 1">Content 1</AccordionItem>
|
|
36
|
+
* <AccordionItem key="2" title="Item 2">Content 2</AccordionItem>
|
|
37
|
+
* </Accordion>
|
|
38
|
+
*
|
|
39
|
+
* // Multiple selection
|
|
40
|
+
* <Accordion selectionMode="multiple">
|
|
41
|
+
* <AccordionItem key="1" title="Item 1">Content 1</AccordionItem>
|
|
42
|
+
* <AccordionItem key="2" title="Item 2">Content 2</AccordionItem>
|
|
43
|
+
* </Accordion>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Controlled
|
|
47
|
+
* ```tsx
|
|
48
|
+
* const [selectedKeys, setSelectedKeys] = useState(new Set(['1']));
|
|
49
|
+
*
|
|
50
|
+
* <Accordion
|
|
51
|
+
* selectedKeys={selectedKeys}
|
|
52
|
+
* onSelectionChange={setSelectedKeys}
|
|
53
|
+
* >
|
|
54
|
+
* <AccordionItem key="1" title="Item 1">Content 1</AccordionItem>
|
|
55
|
+
* <AccordionItem key="2" title="Item 2">Content 2</AccordionItem>
|
|
56
|
+
* </Accordion>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Default Expanded
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <Accordion defaultExpandedKeys={['1']}>
|
|
62
|
+
* <AccordionItem key="1" title="Expanded by default">
|
|
63
|
+
* This section is expanded initially
|
|
64
|
+
* </AccordionItem>
|
|
65
|
+
* </Accordion>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Variants
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <Accordion variant="light">Light variant</Accordion>
|
|
71
|
+
* <Accordion variant="bordered">Bordered variant</Accordion>
|
|
72
|
+
* <Accordion variant="shadow">Shadow variant</Accordion>
|
|
73
|
+
* <Accordion variant="splitted">Splitted variant</Accordion>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Disabled Item
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Accordion>
|
|
79
|
+
* <AccordionItem key="1" title="Normal Item">Content</AccordionItem>
|
|
80
|
+
* <AccordionItem key="2" title="Disabled Item" isDisabled>
|
|
81
|
+
* This item is disabled
|
|
82
|
+
* </AccordionItem>
|
|
83
|
+
* </Accordion>
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
import type {
|
|
88
|
+
AccordionItemProps as HeroAccordionItemProps,
|
|
89
|
+
AccordionProps as HeroAccordionProps,
|
|
90
|
+
} from "heroui-native";
|
|
91
|
+
import { Accordion as HeroAccordion, AccordionItem as HeroAccordionItem } from "heroui-native";
|
|
92
|
+
import { forwardRef } from "react";
|
|
93
|
+
import type { View as ViewRef } from "react-native";
|
|
94
|
+
|
|
95
|
+
// Accordion Root component
|
|
96
|
+
const AccordionRoot = forwardRef<ViewRef, HeroAccordionProps>((props, ref) => {
|
|
97
|
+
return <HeroAccordion ref={ref} {...props} />;
|
|
98
|
+
});
|
|
99
|
+
AccordionRoot.displayName = "Accordion";
|
|
100
|
+
|
|
101
|
+
// Accordion Item component
|
|
102
|
+
const AccordionItemComponent = forwardRef<ViewRef, HeroAccordionItemProps>((props, ref) => {
|
|
103
|
+
return <HeroAccordionItem ref={ref} {...props} />;
|
|
104
|
+
});
|
|
105
|
+
AccordionItemComponent.displayName = "AccordionItem";
|
|
106
|
+
|
|
107
|
+
export const Accordion = AccordionRoot;
|
|
108
|
+
export const AccordionItem = AccordionItemComponent;
|
|
109
|
+
|
|
110
|
+
// Re-export types for convenience
|
|
111
|
+
export type {
|
|
112
|
+
HeroAccordionProps as AccordionProps,
|
|
113
|
+
HeroAccordionItemProps as AccordionItemProps,
|
|
114
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar Component
|
|
3
|
+
*
|
|
4
|
+
* A circular component for displaying user profile images or initials.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Avatar src="https://example.com/avatar.jpg" />
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example With Fallback
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Avatar
|
|
14
|
+
* src="https://example.com/avatar.jpg"
|
|
15
|
+
* fallback="JD"
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example With Name (auto-generates initials)
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Avatar name="John Doe" />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Sizes
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Avatar size="sm" src="..." />
|
|
27
|
+
* <Avatar size="md" src="..." />
|
|
28
|
+
* <Avatar size="lg" src="..." />
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Colors
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Avatar color="default" name="Default" />
|
|
34
|
+
* <Avatar color="primary" name="Primary" />
|
|
35
|
+
* <Avatar color="secondary" name="Secondary" />
|
|
36
|
+
* <Avatar color="success" name="Success" />
|
|
37
|
+
* <Avatar color="warning" name="Warning" />
|
|
38
|
+
* <Avatar color="danger" name="Danger" />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Bordered
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Avatar isBordered src="..." />
|
|
44
|
+
* <Avatar isBordered color="primary" src="..." />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Disabled
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Avatar isDisabled src="..." />
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Radius
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <Avatar radius="none" src="..." />
|
|
55
|
+
* <Avatar radius="sm" src="..." />
|
|
56
|
+
* <Avatar radius="md" src="..." />
|
|
57
|
+
* <Avatar radius="lg" src="..." />
|
|
58
|
+
* <Avatar radius="full" src="..." />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
import type { AvatarProps as HeroAvatarProps } from "heroui-native";
|
|
63
|
+
import { Avatar as HeroAvatar } from "heroui-native";
|
|
64
|
+
import { forwardRef } from "react";
|
|
65
|
+
import type { View as ViewRef } from "react-native";
|
|
66
|
+
|
|
67
|
+
const AvatarRoot = forwardRef<ViewRef, HeroAvatarProps>((props, ref) => {
|
|
68
|
+
return <HeroAvatar ref={ref} {...props} />;
|
|
69
|
+
});
|
|
70
|
+
AvatarRoot.displayName = "Avatar";
|
|
71
|
+
|
|
72
|
+
export const Avatar = AvatarRoot;
|
|
73
|
+
|
|
74
|
+
// Re-export types for convenience
|
|
75
|
+
export type { HeroAvatarProps as AvatarProps };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button Component
|
|
3
|
+
*
|
|
4
|
+
* A versatile button component with multiple variants, sizes, and states.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Button onPress={() => console.log('Pressed!')}>
|
|
9
|
+
* Click Me
|
|
10
|
+
* </Button>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example Variants
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Button variant="solid">Solid</Button>
|
|
16
|
+
* <Button variant="bordered">Bordered</Button>
|
|
17
|
+
* <Button variant="light">Light</Button>
|
|
18
|
+
* <Button variant="flat">Flat</Button>
|
|
19
|
+
* <Button variant="faded">Faded</Button>
|
|
20
|
+
* <Button variant="shadow">Shadow</Button>
|
|
21
|
+
* <Button variant="ghost">Ghost</Button>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Colors
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Button color="default">Default</Button>
|
|
27
|
+
* <Button color="primary">Primary</Button>
|
|
28
|
+
* <Button color="secondary">Secondary</Button>
|
|
29
|
+
* <Button color="success">Success</Button>
|
|
30
|
+
* <Button color="warning">Warning</Button>
|
|
31
|
+
* <Button color="danger">Danger</Button>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Sizes
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Button size="sm">Small</Button>
|
|
37
|
+
* <Button size="md">Medium</Button>
|
|
38
|
+
* <Button size="lg">Large</Button>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Loading State
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Button isLoading>
|
|
44
|
+
* Loading...
|
|
45
|
+
* </Button>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example Disabled State
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Button isDisabled>
|
|
51
|
+
* Disabled
|
|
52
|
+
* </Button>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example With Icon
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <Button startContent={<Icon name="star" />}>
|
|
58
|
+
* Favorite
|
|
59
|
+
* </Button>
|
|
60
|
+
* <Button endContent={<Icon name="arrow-right" />}>
|
|
61
|
+
* Next
|
|
62
|
+
* </Button>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example Icon Only
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <Button isIconOnly>
|
|
68
|
+
* <Icon name="settings" />
|
|
69
|
+
* </Button>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Full Width
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <Button fullWidth>
|
|
75
|
+
* Full Width Button
|
|
76
|
+
* </Button>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
import type { ButtonProps as HeroButtonProps } from "heroui-native";
|
|
81
|
+
import { Button as HeroButton } from "heroui-native";
|
|
82
|
+
import { forwardRef } from "react";
|
|
83
|
+
import type { View as ViewRef } from "react-native";
|
|
84
|
+
|
|
85
|
+
const ButtonRoot = forwardRef<ViewRef, HeroButtonProps>((props, ref) => {
|
|
86
|
+
return <HeroButton ref={ref} {...props} />;
|
|
87
|
+
});
|
|
88
|
+
ButtonRoot.displayName = "Button";
|
|
89
|
+
|
|
90
|
+
export const Button = ButtonRoot;
|
|
91
|
+
|
|
92
|
+
// Re-export types for convenience
|
|
93
|
+
export type { HeroButtonProps as ButtonProps };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card Component
|
|
3
|
+
*
|
|
4
|
+
* A container component for grouping related content with optional header, body, and footer.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Card>
|
|
9
|
+
* <CardBody>
|
|
10
|
+
* <Text>Card content goes here</Text>
|
|
11
|
+
* </CardBody>
|
|
12
|
+
* </Card>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example With Header
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Card>
|
|
18
|
+
* <CardHeader>
|
|
19
|
+
* <Text>Card Title</Text>
|
|
20
|
+
* </CardHeader>
|
|
21
|
+
* <CardBody>
|
|
22
|
+
* <Text>Card content goes here</Text>
|
|
23
|
+
* </CardBody>
|
|
24
|
+
* </Card>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Full Card Structure
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <Card>
|
|
30
|
+
* <CardHeader>
|
|
31
|
+
* <Text>Card Title</Text>
|
|
32
|
+
* </CardHeader>
|
|
33
|
+
* <CardBody>
|
|
34
|
+
* <Text>Main content area</Text>
|
|
35
|
+
* </CardBody>
|
|
36
|
+
* <CardFooter>
|
|
37
|
+
* <Button>Action</Button>
|
|
38
|
+
* </CardFooter>
|
|
39
|
+
* </Card>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Variants
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Card variant="solid">Solid Card</Card>
|
|
45
|
+
* <Card variant="bordered">Bordered Card</Card>
|
|
46
|
+
* <Card variant="flat">Flat Card</Card>
|
|
47
|
+
* <Card variant="faded">Faded Card</Card>
|
|
48
|
+
* <Card variant="shadow">Shadow Card</Card>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Pressable Card
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Card isPressable onPress={() => console.log('Card pressed!')}>
|
|
54
|
+
* <CardBody>
|
|
55
|
+
* <Text>Pressable Card</Text>
|
|
56
|
+
* </CardBody>
|
|
57
|
+
* </Card>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Disabled Card
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <Card isDisabled>
|
|
63
|
+
* <CardBody>
|
|
64
|
+
* <Text>Disabled Card</Text>
|
|
65
|
+
* </CardBody>
|
|
66
|
+
* </Card>
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
import type {
|
|
71
|
+
CardBodyProps as HeroCardBodyProps,
|
|
72
|
+
CardFooterProps as HeroCardFooterProps,
|
|
73
|
+
CardHeaderProps as HeroCardHeaderProps,
|
|
74
|
+
CardProps as HeroCardProps,
|
|
75
|
+
} from "heroui-native";
|
|
76
|
+
import {
|
|
77
|
+
Card as HeroCard,
|
|
78
|
+
CardBody as HeroCardBody,
|
|
79
|
+
CardFooter as HeroCardFooter,
|
|
80
|
+
CardHeader as HeroCardHeader,
|
|
81
|
+
} from "heroui-native";
|
|
82
|
+
import { forwardRef } from "react";
|
|
83
|
+
import type { View as ViewRef } from "react-native";
|
|
84
|
+
|
|
85
|
+
// Card Root component
|
|
86
|
+
const CardRoot = forwardRef<ViewRef, HeroCardProps>((props, ref) => {
|
|
87
|
+
return <HeroCard ref={ref} {...props} />;
|
|
88
|
+
});
|
|
89
|
+
CardRoot.displayName = "Card";
|
|
90
|
+
|
|
91
|
+
// Card Header component
|
|
92
|
+
const CardHeaderComponent = forwardRef<ViewRef, HeroCardHeaderProps>((props, ref) => {
|
|
93
|
+
return <HeroCardHeader ref={ref} {...props} />;
|
|
94
|
+
});
|
|
95
|
+
CardHeaderComponent.displayName = "CardHeader";
|
|
96
|
+
|
|
97
|
+
// Card Body component
|
|
98
|
+
const CardBodyComponent = forwardRef<ViewRef, HeroCardBodyProps>((props, ref) => {
|
|
99
|
+
return <HeroCardBody ref={ref} {...props} />;
|
|
100
|
+
});
|
|
101
|
+
CardBodyComponent.displayName = "CardBody";
|
|
102
|
+
|
|
103
|
+
// Card Footer component
|
|
104
|
+
const CardFooterComponent = forwardRef<ViewRef, HeroCardFooterProps>((props, ref) => {
|
|
105
|
+
return <HeroCardFooter ref={ref} {...props} />;
|
|
106
|
+
});
|
|
107
|
+
CardFooterComponent.displayName = "CardFooter";
|
|
108
|
+
|
|
109
|
+
export const Card = CardRoot;
|
|
110
|
+
export const CardHeader = CardHeaderComponent;
|
|
111
|
+
export const CardBody = CardBodyComponent;
|
|
112
|
+
export const CardFooter = CardFooterComponent;
|
|
113
|
+
|
|
114
|
+
// Re-export types for convenience
|
|
115
|
+
export type {
|
|
116
|
+
HeroCardProps as CardProps,
|
|
117
|
+
HeroCardHeaderProps as CardHeaderProps,
|
|
118
|
+
HeroCardBodyProps as CardBodyProps,
|
|
119
|
+
HeroCardFooterProps as CardFooterProps,
|
|
120
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox Component
|
|
3
|
+
*
|
|
4
|
+
* A selectable checkbox component with optional grouping support.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Checkbox>Accept terms and conditions</Checkbox>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example Controlled
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const [isSelected, setSelected] = useState(false);
|
|
14
|
+
*
|
|
15
|
+
* <Checkbox
|
|
16
|
+
* isSelected={isSelected}
|
|
17
|
+
* onValueChange={setSelected}
|
|
18
|
+
* >
|
|
19
|
+
* Remember me
|
|
20
|
+
* </Checkbox>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Default Selected
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Checkbox defaultSelected>
|
|
26
|
+
* Newsletter subscription
|
|
27
|
+
* </Checkbox>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Colors
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Checkbox color="default">Default</Checkbox>
|
|
33
|
+
* <Checkbox color="primary">Primary</Checkbox>
|
|
34
|
+
* <Checkbox color="secondary">Secondary</Checkbox>
|
|
35
|
+
* <Checkbox color="success">Success</Checkbox>
|
|
36
|
+
* <Checkbox color="warning">Warning</Checkbox>
|
|
37
|
+
* <Checkbox color="danger">Danger</Checkbox>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Sizes
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Checkbox size="sm">Small</Checkbox>
|
|
43
|
+
* <Checkbox size="md">Medium</Checkbox>
|
|
44
|
+
* <Checkbox size="lg">Large</Checkbox>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Disabled State
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Checkbox isDisabled>
|
|
50
|
+
* Disabled checkbox
|
|
51
|
+
* </Checkbox>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Readonly State
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <Checkbox isReadOnly defaultSelected>
|
|
57
|
+
* Read-only checkbox
|
|
58
|
+
* </Checkbox>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example Invalid State
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <Checkbox isInvalid>
|
|
64
|
+
* Invalid checkbox
|
|
65
|
+
* </Checkbox>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Checkbox Group
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <CheckboxGroup
|
|
71
|
+
* label="Select your hobbies"
|
|
72
|
+
* defaultValue={['reading']}
|
|
73
|
+
* >
|
|
74
|
+
* <Checkbox value="reading">Reading</Checkbox>
|
|
75
|
+
* <Checkbox value="gaming">Gaming</Checkbox>
|
|
76
|
+
* <Checkbox value="music">Music</Checkbox>
|
|
77
|
+
* </CheckboxGroup>
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example Controlled Group
|
|
81
|
+
* ```tsx
|
|
82
|
+
* const [selected, setSelected] = useState(['reading']);
|
|
83
|
+
*
|
|
84
|
+
* <CheckboxGroup
|
|
85
|
+
* label="Interests"
|
|
86
|
+
* value={selected}
|
|
87
|
+
* onValueChange={setSelected}
|
|
88
|
+
* >
|
|
89
|
+
* <Checkbox value="sports">Sports</Checkbox>
|
|
90
|
+
* <Checkbox value="travel">Travel</Checkbox>
|
|
91
|
+
* </CheckboxGroup>
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @example Horizontal Group
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <CheckboxGroup
|
|
97
|
+
* label="Options"
|
|
98
|
+
* orientation="horizontal"
|
|
99
|
+
* >
|
|
100
|
+
* <Checkbox value="a">Option A</Checkbox>
|
|
101
|
+
* <Checkbox value="b">Option B</Checkbox>
|
|
102
|
+
* </CheckboxGroup>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
import type {
|
|
107
|
+
CheckboxGroupProps as HeroCheckboxGroupProps,
|
|
108
|
+
CheckboxProps as HeroCheckboxProps,
|
|
109
|
+
} from "heroui-native";
|
|
110
|
+
import { Checkbox as HeroCheckbox, CheckboxGroup as HeroCheckboxGroup } from "heroui-native";
|
|
111
|
+
import { forwardRef } from "react";
|
|
112
|
+
import type { View as ViewRef } from "react-native";
|
|
113
|
+
|
|
114
|
+
// Checkbox component
|
|
115
|
+
const CheckboxRoot = forwardRef<ViewRef, HeroCheckboxProps>((props, ref) => {
|
|
116
|
+
return <HeroCheckbox ref={ref} {...props} />;
|
|
117
|
+
});
|
|
118
|
+
CheckboxRoot.displayName = "Checkbox";
|
|
119
|
+
|
|
120
|
+
// Checkbox Group component
|
|
121
|
+
const CheckboxGroupComponent = forwardRef<ViewRef, HeroCheckboxGroupProps>((props, ref) => {
|
|
122
|
+
return <HeroCheckboxGroup ref={ref} {...props} />;
|
|
123
|
+
});
|
|
124
|
+
CheckboxGroupComponent.displayName = "CheckboxGroup";
|
|
125
|
+
|
|
126
|
+
export const Checkbox = CheckboxRoot;
|
|
127
|
+
export const CheckboxGroup = CheckboxGroupComponent;
|
|
128
|
+
|
|
129
|
+
// Re-export types for convenience
|
|
130
|
+
export type {
|
|
131
|
+
HeroCheckboxProps as CheckboxProps,
|
|
132
|
+
HeroCheckboxGroupProps as CheckboxGroupProps,
|
|
133
|
+
};
|