@teardown/cli 1.2.39 → 2.0.42
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,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner Component
|
|
3
|
+
*
|
|
4
|
+
* A loading indicator component for showing async operations.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Spinner />
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example Sizes
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Spinner size="sm" />
|
|
14
|
+
* <Spinner size="md" />
|
|
15
|
+
* <Spinner size="lg" />
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Colors
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Spinner color="default" />
|
|
21
|
+
* <Spinner color="primary" />
|
|
22
|
+
* <Spinner color="secondary" />
|
|
23
|
+
* <Spinner color="success" />
|
|
24
|
+
* <Spinner color="warning" />
|
|
25
|
+
* <Spinner color="danger" />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example With Label
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Spinner label="Loading..." />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Label Placement
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <Spinner label="Loading" labelColor="primary" />
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example In Button
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Button isLoading>
|
|
41
|
+
* <Spinner size="sm" />
|
|
42
|
+
* Submitting...
|
|
43
|
+
* </Button>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Full Screen Loading
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
49
|
+
* <Spinner size="lg" />
|
|
50
|
+
* <Text style={{ marginTop: 16 }}>Loading data...</Text>
|
|
51
|
+
* </View>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Conditional Loading
|
|
55
|
+
* ```tsx
|
|
56
|
+
* {isLoading ? (
|
|
57
|
+
* <Spinner />
|
|
58
|
+
* ) : (
|
|
59
|
+
* <Content data={data} />
|
|
60
|
+
* )}
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example In Card
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <Card>
|
|
66
|
+
* <CardBody style={{ alignItems: 'center', padding: 32 }}>
|
|
67
|
+
* <Spinner size="lg" color="primary" />
|
|
68
|
+
* <Text style={{ marginTop: 16 }}>Fetching results...</Text>
|
|
69
|
+
* </CardBody>
|
|
70
|
+
* </Card>
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
import type { SpinnerProps as HeroSpinnerProps } from "heroui-native";
|
|
75
|
+
import { Spinner as HeroSpinner } from "heroui-native";
|
|
76
|
+
import { forwardRef } from "react";
|
|
77
|
+
import type { View as ViewRef } from "react-native";
|
|
78
|
+
|
|
79
|
+
const SpinnerRoot = forwardRef<ViewRef, HeroSpinnerProps>((props, ref) => {
|
|
80
|
+
return <HeroSpinner ref={ref} {...props} />;
|
|
81
|
+
});
|
|
82
|
+
SpinnerRoot.displayName = "Spinner";
|
|
83
|
+
|
|
84
|
+
export const Spinner = SpinnerRoot;
|
|
85
|
+
|
|
86
|
+
// Re-export types for convenience
|
|
87
|
+
export type { HeroSpinnerProps as SpinnerProps };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surface Component
|
|
3
|
+
*
|
|
4
|
+
* A themed container component that adapts to the current color scheme.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Surface>
|
|
9
|
+
* <Text>Content on a themed surface</Text>
|
|
10
|
+
* </Surface>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example With Padding
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Surface style={{ padding: 16 }}>
|
|
16
|
+
* <Text>Padded content</Text>
|
|
17
|
+
* </Surface>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example Elevation Levels
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <Surface elevation={0}>Base level</Surface>
|
|
23
|
+
* <Surface elevation={1}>Elevated</Surface>
|
|
24
|
+
* <Surface elevation={2}>More elevated</Surface>
|
|
25
|
+
* <Surface elevation={3}>Most elevated</Surface>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example As Card Container
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Surface style={{ borderRadius: 12, padding: 16 }}>
|
|
31
|
+
* <Text style={{ fontWeight: 'bold' }}>Title</Text>
|
|
32
|
+
* <Text>Description text goes here</Text>
|
|
33
|
+
* </Surface>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Nested Surfaces
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Surface style={{ padding: 16 }}>
|
|
39
|
+
* <Text>Outer surface</Text>
|
|
40
|
+
* <Surface elevation={1} style={{ padding: 12, marginTop: 8 }}>
|
|
41
|
+
* <Text>Inner elevated surface</Text>
|
|
42
|
+
* </Surface>
|
|
43
|
+
* </Surface>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Full Screen
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Surface style={{ flex: 1 }}>
|
|
49
|
+
* <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
50
|
+
* <Text>Centered content</Text>
|
|
51
|
+
* </View>
|
|
52
|
+
* </Surface>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example With Border
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <Surface
|
|
58
|
+
* style={{
|
|
59
|
+
* borderWidth: 1,
|
|
60
|
+
* borderColor: '#e0e0e0',
|
|
61
|
+
* borderRadius: 8,
|
|
62
|
+
* padding: 16
|
|
63
|
+
* }}
|
|
64
|
+
* >
|
|
65
|
+
* <Text>Bordered surface</Text>
|
|
66
|
+
* </Surface>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example List Container
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Surface>
|
|
72
|
+
* {items.map(item => (
|
|
73
|
+
* <View key={item.id} style={{ padding: 12 }}>
|
|
74
|
+
* <Text>{item.title}</Text>
|
|
75
|
+
* <Divider />
|
|
76
|
+
* </View>
|
|
77
|
+
* ))}
|
|
78
|
+
* </Surface>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
import type { SurfaceProps as HeroSurfaceProps } from "heroui-native";
|
|
83
|
+
import { Surface as HeroSurface } from "heroui-native";
|
|
84
|
+
import { forwardRef } from "react";
|
|
85
|
+
import type { View as ViewRef } from "react-native";
|
|
86
|
+
|
|
87
|
+
const SurfaceRoot = forwardRef<ViewRef, HeroSurfaceProps>((props, ref) => {
|
|
88
|
+
return <HeroSurface ref={ref} {...props} />;
|
|
89
|
+
});
|
|
90
|
+
SurfaceRoot.displayName = "Surface";
|
|
91
|
+
|
|
92
|
+
export const Surface = SurfaceRoot;
|
|
93
|
+
|
|
94
|
+
// Re-export types for convenience
|
|
95
|
+
export type { HeroSurfaceProps as SurfaceProps };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switch Component
|
|
3
|
+
*
|
|
4
|
+
* A toggle switch component for boolean settings.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Switch>Enable notifications</Switch>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example Controlled
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const [isEnabled, setEnabled] = useState(false);
|
|
14
|
+
*
|
|
15
|
+
* <Switch
|
|
16
|
+
* isSelected={isEnabled}
|
|
17
|
+
* onValueChange={setEnabled}
|
|
18
|
+
* >
|
|
19
|
+
* Dark mode
|
|
20
|
+
* </Switch>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Default Selected
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Switch defaultSelected>
|
|
26
|
+
* Auto-save enabled
|
|
27
|
+
* </Switch>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Colors
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Switch color="default">Default</Switch>
|
|
33
|
+
* <Switch color="primary">Primary</Switch>
|
|
34
|
+
* <Switch color="secondary">Secondary</Switch>
|
|
35
|
+
* <Switch color="success">Success</Switch>
|
|
36
|
+
* <Switch color="warning">Warning</Switch>
|
|
37
|
+
* <Switch color="danger">Danger</Switch>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Sizes
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Switch size="sm">Small</Switch>
|
|
43
|
+
* <Switch size="md">Medium</Switch>
|
|
44
|
+
* <Switch size="lg">Large</Switch>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Disabled State
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Switch isDisabled>
|
|
50
|
+
* Disabled switch
|
|
51
|
+
* </Switch>
|
|
52
|
+
*
|
|
53
|
+
* <Switch isDisabled defaultSelected>
|
|
54
|
+
* Disabled and selected
|
|
55
|
+
* </Switch>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example Readonly State
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Switch isReadOnly defaultSelected>
|
|
61
|
+
* Read-only switch
|
|
62
|
+
* </Switch>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example With Description
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
68
|
+
* <View>
|
|
69
|
+
* <Text>Push Notifications</Text>
|
|
70
|
+
* <Text style={{ color: 'gray' }}>Receive push notifications</Text>
|
|
71
|
+
* </View>
|
|
72
|
+
* <Switch isSelected={pushEnabled} onValueChange={setPushEnabled} />
|
|
73
|
+
* </View>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Settings List
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <View style={{ gap: 16 }}>
|
|
79
|
+
* <Switch isSelected={settings.wifi} onValueChange={v => updateSetting('wifi', v)}>
|
|
80
|
+
* Wi-Fi
|
|
81
|
+
* </Switch>
|
|
82
|
+
* <Switch isSelected={settings.bluetooth} onValueChange={v => updateSetting('bluetooth', v)}>
|
|
83
|
+
* Bluetooth
|
|
84
|
+
* </Switch>
|
|
85
|
+
* <Switch isSelected={settings.airplane} onValueChange={v => updateSetting('airplane', v)}>
|
|
86
|
+
* Airplane Mode
|
|
87
|
+
* </Switch>
|
|
88
|
+
* </View>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example With Icons
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <Switch
|
|
94
|
+
* thumbIcon={isSelected => (isSelected ? <SunIcon /> : <MoonIcon />)}
|
|
95
|
+
* >
|
|
96
|
+
* Theme
|
|
97
|
+
* </Switch>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example Start/End Content
|
|
101
|
+
* ```tsx
|
|
102
|
+
* <Switch
|
|
103
|
+
* startContent={<SunIcon />}
|
|
104
|
+
* endContent={<MoonIcon />}
|
|
105
|
+
* >
|
|
106
|
+
* Theme Mode
|
|
107
|
+
* </Switch>
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
import type { SwitchProps as HeroSwitchProps } from "heroui-native";
|
|
112
|
+
import { Switch as HeroSwitch } from "heroui-native";
|
|
113
|
+
import { forwardRef } from "react";
|
|
114
|
+
import type { View as ViewRef } from "react-native";
|
|
115
|
+
|
|
116
|
+
const SwitchRoot = forwardRef<ViewRef, HeroSwitchProps>((props, ref) => {
|
|
117
|
+
return <HeroSwitch ref={ref} {...props} />;
|
|
118
|
+
});
|
|
119
|
+
SwitchRoot.displayName = "Switch";
|
|
120
|
+
|
|
121
|
+
export const Switch = SwitchRoot;
|
|
122
|
+
|
|
123
|
+
// Re-export types for convenience
|
|
124
|
+
export type { HeroSwitchProps as SwitchProps };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs Component
|
|
3
|
+
*
|
|
4
|
+
* A tabbed interface component for organizing content into switchable panels.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Tabs>
|
|
9
|
+
* <Tab key="photos" title="Photos">
|
|
10
|
+
* <Text>Photos content</Text>
|
|
11
|
+
* </Tab>
|
|
12
|
+
* <Tab key="videos" title="Videos">
|
|
13
|
+
* <Text>Videos content</Text>
|
|
14
|
+
* </Tab>
|
|
15
|
+
* <Tab key="music" title="Music">
|
|
16
|
+
* <Text>Music content</Text>
|
|
17
|
+
* </Tab>
|
|
18
|
+
* </Tabs>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Controlled
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const [selected, setSelected] = useState('photos');
|
|
24
|
+
*
|
|
25
|
+
* <Tabs
|
|
26
|
+
* selectedKey={selected}
|
|
27
|
+
* onSelectionChange={setSelected}
|
|
28
|
+
* >
|
|
29
|
+
* <Tab key="photos" title="Photos">Photos</Tab>
|
|
30
|
+
* <Tab key="videos" title="Videos">Videos</Tab>
|
|
31
|
+
* </Tabs>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Default Selected
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Tabs defaultSelectedKey="videos">
|
|
37
|
+
* <Tab key="photos" title="Photos">Photos</Tab>
|
|
38
|
+
* <Tab key="videos" title="Videos">Videos</Tab>
|
|
39
|
+
* </Tabs>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Variants
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Tabs variant="solid">Solid tabs</Tabs>
|
|
45
|
+
* <Tabs variant="bordered">Bordered tabs</Tabs>
|
|
46
|
+
* <Tabs variant="light">Light tabs</Tabs>
|
|
47
|
+
* <Tabs variant="underlined">Underlined tabs</Tabs>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Colors
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <Tabs color="default">Default</Tabs>
|
|
53
|
+
* <Tabs color="primary">Primary</Tabs>
|
|
54
|
+
* <Tabs color="secondary">Secondary</Tabs>
|
|
55
|
+
* <Tabs color="success">Success</Tabs>
|
|
56
|
+
* <Tabs color="warning">Warning</Tabs>
|
|
57
|
+
* <Tabs color="danger">Danger</Tabs>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Sizes
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <Tabs size="sm">Small tabs</Tabs>
|
|
63
|
+
* <Tabs size="md">Medium tabs</Tabs>
|
|
64
|
+
* <Tabs size="lg">Large tabs</Tabs>
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example Disabled Tabs
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <Tabs disabledKeys={['videos']}>
|
|
70
|
+
* <Tab key="photos" title="Photos">Photos</Tab>
|
|
71
|
+
* <Tab key="videos" title="Videos">Videos (Disabled)</Tab>
|
|
72
|
+
* <Tab key="music" title="Music">Music</Tab>
|
|
73
|
+
* </Tabs>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Full Width
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Tabs fullWidth>
|
|
79
|
+
* <Tab key="tab1" title="Tab 1">Content 1</Tab>
|
|
80
|
+
* <Tab key="tab2" title="Tab 2">Content 2</Tab>
|
|
81
|
+
* </Tabs>
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example With Icons
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <Tabs>
|
|
87
|
+
* <Tab
|
|
88
|
+
* key="photos"
|
|
89
|
+
* title={
|
|
90
|
+
* <View style={{ flexDirection: 'row', gap: 4 }}>
|
|
91
|
+
* <PhotoIcon />
|
|
92
|
+
* <Text>Photos</Text>
|
|
93
|
+
* </View>
|
|
94
|
+
* }
|
|
95
|
+
* >
|
|
96
|
+
* Photos content
|
|
97
|
+
* </Tab>
|
|
98
|
+
* <Tab
|
|
99
|
+
* key="videos"
|
|
100
|
+
* title={
|
|
101
|
+
* <View style={{ flexDirection: 'row', gap: 4 }}>
|
|
102
|
+
* <VideoIcon />
|
|
103
|
+
* <Text>Videos</Text>
|
|
104
|
+
* </View>
|
|
105
|
+
* }
|
|
106
|
+
* >
|
|
107
|
+
* Videos content
|
|
108
|
+
* </Tab>
|
|
109
|
+
* </Tabs>
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @example Radius
|
|
113
|
+
* ```tsx
|
|
114
|
+
* <Tabs radius="none">No radius</Tabs>
|
|
115
|
+
* <Tabs radius="sm">Small radius</Tabs>
|
|
116
|
+
* <Tabs radius="md">Medium radius</Tabs>
|
|
117
|
+
* <Tabs radius="lg">Large radius</Tabs>
|
|
118
|
+
* <Tabs radius="full">Full radius</Tabs>
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example Placement
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <Tabs placement="top">Top placement</Tabs>
|
|
124
|
+
* <Tabs placement="bottom">Bottom placement</Tabs>
|
|
125
|
+
* <Tabs placement="start">Start placement</Tabs>
|
|
126
|
+
* <Tabs placement="end">End placement</Tabs>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
import type { TabProps as HeroTabProps, TabsProps as HeroTabsProps } from "heroui-native";
|
|
131
|
+
import { Tab as HeroTab, Tabs as HeroTabs } from "heroui-native";
|
|
132
|
+
import { forwardRef } from "react";
|
|
133
|
+
import type { View as ViewRef } from "react-native";
|
|
134
|
+
|
|
135
|
+
// Tabs component
|
|
136
|
+
const TabsRoot = forwardRef<ViewRef, HeroTabsProps>((props, ref) => {
|
|
137
|
+
return <HeroTabs ref={ref} {...props} />;
|
|
138
|
+
});
|
|
139
|
+
TabsRoot.displayName = "Tabs";
|
|
140
|
+
|
|
141
|
+
// Tab component
|
|
142
|
+
const TabComponent = forwardRef<ViewRef, HeroTabProps>((props, ref) => {
|
|
143
|
+
return <HeroTab ref={ref} {...props} />;
|
|
144
|
+
});
|
|
145
|
+
TabComponent.displayName = "Tab";
|
|
146
|
+
|
|
147
|
+
export const Tabs = TabsRoot;
|
|
148
|
+
export const Tab = TabComponent;
|
|
149
|
+
|
|
150
|
+
// Re-export types for convenience
|
|
151
|
+
export type {
|
|
152
|
+
HeroTabsProps as TabsProps,
|
|
153
|
+
HeroTabProps as TabProps,
|
|
154
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextField Component
|
|
3
|
+
*
|
|
4
|
+
* A flexible text input component with label, description, and validation support.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <TextField>
|
|
9
|
+
* <TextField.Label>Email</TextField.Label>
|
|
10
|
+
* <TextField.Input placeholder="Enter your email" />
|
|
11
|
+
* <TextField.Description>We'll never share your email</TextField.Description>
|
|
12
|
+
* </TextField>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example Required Field
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <TextField isRequired>
|
|
18
|
+
* <TextField.Label>Username</TextField.Label>
|
|
19
|
+
* <TextField.Input placeholder="Choose a username" />
|
|
20
|
+
* </TextField>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example With Validation
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <TextField isRequired isInvalid={hasError}>
|
|
26
|
+
* <TextField.Label>Email</TextField.Label>
|
|
27
|
+
* <TextField.Input placeholder="Enter your email" />
|
|
28
|
+
* <TextField.ErrorMessage>Please enter a valid email</TextField.ErrorMessage>
|
|
29
|
+
* </TextField>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example Multiline Input
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <TextField>
|
|
35
|
+
* <TextField.Label>Message</TextField.Label>
|
|
36
|
+
* <TextField.Input placeholder="Type your message..." multiline numberOfLines={4} />
|
|
37
|
+
* <TextField.Description>Maximum 500 characters</TextField.Description>
|
|
38
|
+
* </TextField>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Disabled State
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <TextField isDisabled>
|
|
44
|
+
* <TextField.Label>Disabled Field</TextField.Label>
|
|
45
|
+
* <TextField.Input placeholder="Cannot edit" value="Read only value" />
|
|
46
|
+
* </TextField>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
import type {
|
|
51
|
+
TextFieldDescriptionProps,
|
|
52
|
+
TextFieldErrorMessageProps,
|
|
53
|
+
TextFieldInputProps,
|
|
54
|
+
TextFieldLabelProps,
|
|
55
|
+
TextFieldRootProps,
|
|
56
|
+
} from "heroui-native";
|
|
57
|
+
import { TextField as HeroTextField } from "heroui-native";
|
|
58
|
+
import { forwardRef } from "react";
|
|
59
|
+
import type { TextInput as TextInputType, Text as TextRef, View as ViewRef } from "react-native";
|
|
60
|
+
|
|
61
|
+
// Root TextField component
|
|
62
|
+
const TextFieldRoot = forwardRef<ViewRef, TextFieldRootProps>((props, ref) => {
|
|
63
|
+
return <HeroTextField ref={ref} {...props} />;
|
|
64
|
+
});
|
|
65
|
+
TextFieldRoot.displayName = "TextField";
|
|
66
|
+
|
|
67
|
+
// Label component
|
|
68
|
+
const TextFieldLabel = forwardRef<TextRef, TextFieldLabelProps>((props, ref) => {
|
|
69
|
+
return <HeroTextField.Label ref={ref} {...props} />;
|
|
70
|
+
});
|
|
71
|
+
TextFieldLabel.displayName = "TextField.Label";
|
|
72
|
+
|
|
73
|
+
// Input component
|
|
74
|
+
const TextFieldInput = forwardRef<TextInputType, TextFieldInputProps>((props, ref) => {
|
|
75
|
+
return <HeroTextField.Input ref={ref} {...props} />;
|
|
76
|
+
});
|
|
77
|
+
TextFieldInput.displayName = "TextField.Input";
|
|
78
|
+
|
|
79
|
+
// Description component
|
|
80
|
+
const TextFieldDescription = forwardRef<TextRef, TextFieldDescriptionProps>((props, ref) => {
|
|
81
|
+
return <HeroTextField.Description ref={ref} {...props} />;
|
|
82
|
+
});
|
|
83
|
+
TextFieldDescription.displayName = "TextField.Description";
|
|
84
|
+
|
|
85
|
+
// Error Message component
|
|
86
|
+
const TextFieldErrorMessage = forwardRef<TextRef, TextFieldErrorMessageProps>((props, ref) => {
|
|
87
|
+
return <HeroTextField.ErrorMessage ref={ref} {...props} />;
|
|
88
|
+
});
|
|
89
|
+
TextFieldErrorMessage.displayName = "TextField.ErrorMessage";
|
|
90
|
+
|
|
91
|
+
// Compound TextField component
|
|
92
|
+
export const TextField = Object.assign(TextFieldRoot, {
|
|
93
|
+
Label: TextFieldLabel,
|
|
94
|
+
Input: TextFieldInput,
|
|
95
|
+
Description: TextFieldDescription,
|
|
96
|
+
ErrorMessage: TextFieldErrorMessage,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Re-export types for convenience
|
|
100
|
+
export type {
|
|
101
|
+
TextFieldRootProps as TextFieldProps,
|
|
102
|
+
TextFieldLabelProps,
|
|
103
|
+
TextFieldInputProps,
|
|
104
|
+
TextFieldDescriptionProps,
|
|
105
|
+
TextFieldErrorMessageProps,
|
|
106
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast Component
|
|
3
|
+
*
|
|
4
|
+
* A notification component for displaying brief messages.
|
|
5
|
+
*
|
|
6
|
+
* @example Basic Usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Toast>
|
|
9
|
+
* This is a toast message
|
|
10
|
+
* </Toast>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example Variants
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Toast variant="solid">Solid toast</Toast>
|
|
16
|
+
* <Toast variant="bordered">Bordered toast</Toast>
|
|
17
|
+
* <Toast variant="flat">Flat toast</Toast>
|
|
18
|
+
* <Toast variant="faded">Faded toast</Toast>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Colors
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Toast color="default">Default</Toast>
|
|
24
|
+
* <Toast color="primary">Primary</Toast>
|
|
25
|
+
* <Toast color="secondary">Secondary</Toast>
|
|
26
|
+
* <Toast color="success">Success</Toast>
|
|
27
|
+
* <Toast color="warning">Warning</Toast>
|
|
28
|
+
* <Toast color="danger">Danger</Toast>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example With Title and Description
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Toast
|
|
34
|
+
* title="Success"
|
|
35
|
+
* description="Your changes have been saved"
|
|
36
|
+
* color="success"
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example With Close Button
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Toast
|
|
43
|
+
* onClose={() => setVisible(false)}
|
|
44
|
+
* >
|
|
45
|
+
* Dismissible toast
|
|
46
|
+
* </Toast>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example With Icon
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Toast
|
|
52
|
+
* icon={<CheckIcon />}
|
|
53
|
+
* color="success"
|
|
54
|
+
* >
|
|
55
|
+
* Operation completed
|
|
56
|
+
* </Toast>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Placement
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <Toast placement="top">Top toast</Toast>
|
|
62
|
+
* <Toast placement="top-start">Top start</Toast>
|
|
63
|
+
* <Toast placement="top-end">Top end</Toast>
|
|
64
|
+
* <Toast placement="bottom">Bottom toast</Toast>
|
|
65
|
+
* <Toast placement="bottom-start">Bottom start</Toast>
|
|
66
|
+
* <Toast placement="bottom-end">Bottom end</Toast>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Auto-dismiss
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Toast
|
|
72
|
+
* timeout={3000}
|
|
73
|
+
* onClose={handleClose}
|
|
74
|
+
* >
|
|
75
|
+
* This will disappear in 3 seconds
|
|
76
|
+
* </Toast>
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example Toast Provider Pattern
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // In your provider
|
|
82
|
+
* const showToast = (message, options) => {
|
|
83
|
+
* setToasts([...toasts, { id: Date.now(), message, ...options }]);
|
|
84
|
+
* };
|
|
85
|
+
*
|
|
86
|
+
* // Usage
|
|
87
|
+
* showToast('Item saved successfully', { color: 'success' });
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example Promise Toast
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const handleSubmit = async () => {
|
|
93
|
+
* try {
|
|
94
|
+
* await submitData();
|
|
95
|
+
* showToast('Submitted successfully', { color: 'success' });
|
|
96
|
+
* } catch (error) {
|
|
97
|
+
* showToast('Failed to submit', { color: 'danger' });
|
|
98
|
+
* }
|
|
99
|
+
* };
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example With Action
|
|
103
|
+
* ```tsx
|
|
104
|
+
* <Toast
|
|
105
|
+
* action={
|
|
106
|
+
* <Button size="sm" variant="light" onPress={handleUndo}>
|
|
107
|
+
* Undo
|
|
108
|
+
* </Button>
|
|
109
|
+
* }
|
|
110
|
+
* >
|
|
111
|
+
* Item deleted
|
|
112
|
+
* </Toast>
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
import type { ToastProps as HeroToastProps } from "heroui-native";
|
|
117
|
+
import { Toast as HeroToast } from "heroui-native";
|
|
118
|
+
import { forwardRef } from "react";
|
|
119
|
+
import type { View as ViewRef } from "react-native";
|
|
120
|
+
|
|
121
|
+
const ToastRoot = forwardRef<ViewRef, HeroToastProps>((props, ref) => {
|
|
122
|
+
return <HeroToast ref={ref} {...props} />;
|
|
123
|
+
});
|
|
124
|
+
ToastRoot.displayName = "Toast";
|
|
125
|
+
|
|
126
|
+
export const Toast = ToastRoot;
|
|
127
|
+
|
|
128
|
+
// Re-export types for convenience
|
|
129
|
+
export type { HeroToastProps as ToastProps };
|