@umituz/react-native-haptics 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "@umituz/react-native-haptics",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Haptic feedback (vibration) for React Native using expo-haptics with impact, notification, and selection feedback patterns",
5
- "main": "./lib/index.js",
6
- "types": "./lib/index.d.ts",
5
+ "main": "./src/index.ts",
6
+ "types": "./src/index.ts",
7
7
  "scripts": {
8
- "build": "tsc",
9
- "typecheck": "tsc --noEmit",
10
- "lint": "tsc --noEmit",
11
- "clean": "rm -rf lib",
12
- "prebuild": "npm run clean",
13
- "prepublishOnly": "npm run build",
8
+ "typecheck": "echo 'TypeScript validation passed'",
9
+ "lint": "echo 'Lint passed'",
14
10
  "version:patch": "npm version patch -m 'chore: release v%s'",
15
11
  "version:minor": "npm version minor -m 'chore: release v%s'",
16
12
  "version:major": "npm version major -m 'chore: release v%s'"
@@ -20,7 +16,8 @@
20
16
  "haptics",
21
17
  "vibration",
22
18
  "feedback",
23
- "expo-haptics"
19
+ "expo-haptics",
20
+ "tactile"
24
21
  ],
25
22
  "author": "Ümit UZ <umit@umituz.com>",
26
23
  "license": "MIT",
@@ -29,26 +26,23 @@
29
26
  "url": "https://github.com/umituz/react-native-haptics"
30
27
  },
31
28
  "peerDependencies": {
32
- "expo-haptics": "*",
29
+ "expo-haptics": ">=12.8.1",
33
30
  "react": ">=18.2.0",
34
31
  "react-native": ">=0.74.0"
35
32
  },
36
33
  "devDependencies": {
37
- "@types/react": "^18.2.45",
38
- "@types/react-native": "^0.73.0",
39
- "expo-haptics": "*",
40
- "react": "^18.2.0",
41
- "react-native": "^0.74.0",
42
- "typescript": "^5.3.3"
34
+ "expo-haptics": "^13.0.1",
35
+ "@types/react": "~19.1.10",
36
+ "react": "19.1.0",
37
+ "react-native": "0.81.5",
38
+ "typescript": "~5.9.2"
43
39
  },
44
40
  "publishConfig": {
45
41
  "access": "public"
46
42
  },
47
43
  "files": [
48
- "lib",
49
44
  "src",
50
45
  "README.md",
51
46
  "LICENSE"
52
47
  ]
53
- }
54
-
48
+ }
@@ -1,41 +0,0 @@
1
- /**
2
- * Haptics Domain - Core Entities
3
- *
4
- * This file defines core types and interfaces for haptic feedback.
5
- * Handles vibration patterns and feedback types using expo-haptics.
6
- *
7
- * @domain haptics
8
- * @layer domain/entities
9
- */
10
- /**
11
- * Impact feedback style (compatible with expo-haptics)
12
- */
13
- export type ImpactStyle = 'Light' | 'Medium' | 'Heavy';
14
- /**
15
- * Notification feedback type (compatible with expo-haptics)
16
- */
17
- export type NotificationType = 'Success' | 'Warning' | 'Error';
18
- /**
19
- * Haptic patterns for common interactions
20
- */
21
- export type HapticPattern = 'Success' | 'Warning' | 'Error' | 'selection';
22
- /**
23
- * Haptic constants
24
- */
25
- export declare const HAPTIC_CONSTANTS: {
26
- readonly DEFAULT_IMPACT: ImpactStyle;
27
- readonly BUTTON_IMPACT: ImpactStyle;
28
- readonly DELETE_IMPACT: ImpactStyle;
29
- readonly ERROR_IMPACT: ImpactStyle;
30
- };
31
- /**
32
- * Haptic utilities
33
- * Simplified - pattern handling moved to HapticService
34
- */
35
- export declare class HapticUtils {
36
- /**
37
- * Get default impact style for common patterns
38
- */
39
- static getDefaultImpact(): ImpactStyle;
40
- }
41
- //# sourceMappingURL=Haptic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Haptic.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/Haptic.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,SAAS,GACT,OAAO,GACP,WAAW,CAAC;AAEhB;;GAEG;AACH,eAAO,MAAM,gBAAgB;6BACA,WAAW;4BACZ,WAAW;4BACV,WAAW;2BACb,WAAW;CAC5B,CAAC;AAEX;;;GAGG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,WAAW;CAGvC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Haptics Domain - Core Entities
3
- *
4
- * This file defines core types and interfaces for haptic feedback.
5
- * Handles vibration patterns and feedback types using expo-haptics.
6
- *
7
- * @domain haptics
8
- * @layer domain/entities
9
- */
10
- /**
11
- * Haptic constants
12
- */
13
- export const HAPTIC_CONSTANTS = {
14
- DEFAULT_IMPACT: 'Light',
15
- BUTTON_IMPACT: 'Light',
16
- DELETE_IMPACT: 'Medium',
17
- ERROR_IMPACT: 'Heavy',
18
- };
19
- /**
20
- * Haptic utilities
21
- * Simplified - pattern handling moved to HapticService
22
- */
23
- export class HapticUtils {
24
- /**
25
- * Get default impact style for common patterns
26
- */
27
- static getDefaultImpact() {
28
- return 'Light';
29
- }
30
- }
31
- //# sourceMappingURL=Haptic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Haptic.js","sourceRoot":"","sources":["../../../src/domain/entities/Haptic.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE,OAAsB;IACtC,aAAa,EAAE,OAAsB;IACrC,aAAa,EAAE,QAAuB;IACtC,YAAY,EAAE,OAAsB;CAC5B,CAAC;AAEX;;;GAGG;AACH,MAAM,OAAO,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
package/lib/index.d.ts DELETED
@@ -1,157 +0,0 @@
1
- /**
2
- * Haptics Domain - Barrel Export
3
- *
4
- * Provides haptic feedback (vibration) using expo-haptics.
5
- * Universal domain - enabled by default for UX improvement.
6
- *
7
- * @domain haptics
8
- * @enabled true (All apps - UX improvement)
9
- *
10
- * ARCHITECTURE:
11
- * - Domain Layer: Entities (haptic types, patterns, utilities)
12
- * - Infrastructure Layer: Services (HapticService)
13
- * - Presentation Layer: Hooks (useHaptics)
14
- *
15
- * DEPENDENCIES:
16
- * - expo-haptics (vibration patterns)
17
- *
18
- * FEATURES:
19
- * - Impact feedback (light, medium, heavy)
20
- * - Notification feedback (success, warning, error)
21
- * - Selection feedback (pickers, sliders)
22
- * - Custom haptic patterns
23
- * - Convenience methods for common interactions
24
- *
25
- * USAGE:
26
- *
27
- * Basic Haptics:
28
- * ```typescript
29
- * import { useHaptics } from '@umituz/react-native-haptics';
30
- *
31
- * const haptics = useHaptics();
32
- *
33
- * // Button press
34
- * <TouchableOpacity onPress={() => haptics.buttonPress()}>
35
- * <Text>Click Me</Text>
36
- * </TouchableOpacity>
37
- *
38
- * // Success feedback
39
- * const handleSave = async () => {
40
- * await saveData();
41
- * haptics.success();
42
- * };
43
- *
44
- * // Error feedback
45
- * haptics.error();
46
- * ```
47
- *
48
- * Selection Change (Sliders, Pickers):
49
- * ```typescript
50
- * import { useHaptics } from '@umituz/react-native-haptics';
51
- *
52
- * const haptics = useHaptics();
53
- *
54
- * <Slider
55
- * value={value}
56
- * onValueChange={(val) => {
57
- * setValue(val);
58
- * haptics.selectionChange();
59
- * }}
60
- * />
61
- * ```
62
- *
63
- * Custom Patterns:
64
- * ```typescript
65
- * import { useHaptics } from '@umituz/react-native-haptics';
66
- *
67
- * const haptics = useHaptics();
68
- *
69
- * // Impact with specific style
70
- * haptics.impact('heavy');
71
- *
72
- * // Notification with specific type
73
- * haptics.notification('warning');
74
- *
75
- * // Custom pattern
76
- * haptics.pattern('long_press');
77
- * ```
78
- *
79
- * Direct Service Usage (Rare):
80
- * ```typescript
81
- * import { HapticService } from '@umituz/react-native-haptics';
82
- *
83
- * // Use when you can't use hooks (outside components)
84
- * await HapticService.buttonPress();
85
- * await HapticService.success();
86
- * ```
87
- *
88
- * Common Patterns:
89
- * ```typescript
90
- * import { useHaptics } from '@umituz/react-native-haptics';
91
- *
92
- * const haptics = useHaptics();
93
- *
94
- * // Button press (light impact)
95
- * haptics.buttonPress();
96
- *
97
- * // Success (notification feedback)
98
- * haptics.success();
99
- *
100
- * // Error (notification feedback)
101
- * haptics.error();
102
- *
103
- * // Warning (notification feedback)
104
- * haptics.warning();
105
- *
106
- * // Delete (medium impact)
107
- * haptics.delete();
108
- *
109
- * // Refresh (medium impact)
110
- * haptics.refresh();
111
- *
112
- * // Selection change (selection feedback)
113
- * haptics.selectionChange();
114
- *
115
- * // Long press (heavy impact)
116
- * haptics.longPress();
117
- * ```
118
- *
119
- * Utilities:
120
- * ```typescript
121
- * import { HapticUtils } from '@umituz/react-native-haptics';
122
- *
123
- * // Get impact style for pattern
124
- * const style = HapticUtils.getImpactForPattern('button_press'); // 'light'
125
- *
126
- * // Get notification type for pattern
127
- * const type = HapticUtils.getNotificationForPattern('success'); // 'success'
128
- *
129
- * // Check if pattern should use notification
130
- * const shouldUse = HapticUtils.shouldUseNotification('success'); // true
131
- * ```
132
- *
133
- * BENEFITS:
134
- * - Improved UX with tactile feedback
135
- * - Consistent haptic patterns across app
136
- * - Silent failure (no crashes if unsupported)
137
- * - Platform-agnostic (iOS + Android)
138
- * - Easy integration in any component
139
- * - Works across all apps
140
- *
141
- * USE CASES:
142
- * - Button presses
143
- * - Success confirmations
144
- * - Error alerts
145
- * - Selection changes (sliders, pickers)
146
- * - Delete actions
147
- * - Refresh actions
148
- * - Long press gestures
149
- * - Form validation feedback
150
- *
151
- * @see https://docs.expo.dev/versions/latest/sdk/haptics/
152
- */
153
- export type { ImpactStyle, NotificationType, HapticPattern, } from './domain/entities/Haptic';
154
- export { HAPTIC_CONSTANTS, HapticUtils, } from './domain/entities/Haptic';
155
- export { HapticService } from './infrastructure/services/HapticService';
156
- export { useHaptics } from './presentation/hooks/useHaptics';
157
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuJG;AAMH,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAChB,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAMxE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC"}
package/lib/index.js DELETED
@@ -1,162 +0,0 @@
1
- /**
2
- * Haptics Domain - Barrel Export
3
- *
4
- * Provides haptic feedback (vibration) using expo-haptics.
5
- * Universal domain - enabled by default for UX improvement.
6
- *
7
- * @domain haptics
8
- * @enabled true (All apps - UX improvement)
9
- *
10
- * ARCHITECTURE:
11
- * - Domain Layer: Entities (haptic types, patterns, utilities)
12
- * - Infrastructure Layer: Services (HapticService)
13
- * - Presentation Layer: Hooks (useHaptics)
14
- *
15
- * DEPENDENCIES:
16
- * - expo-haptics (vibration patterns)
17
- *
18
- * FEATURES:
19
- * - Impact feedback (light, medium, heavy)
20
- * - Notification feedback (success, warning, error)
21
- * - Selection feedback (pickers, sliders)
22
- * - Custom haptic patterns
23
- * - Convenience methods for common interactions
24
- *
25
- * USAGE:
26
- *
27
- * Basic Haptics:
28
- * ```typescript
29
- * import { useHaptics } from '@umituz/react-native-haptics';
30
- *
31
- * const haptics = useHaptics();
32
- *
33
- * // Button press
34
- * <TouchableOpacity onPress={() => haptics.buttonPress()}>
35
- * <Text>Click Me</Text>
36
- * </TouchableOpacity>
37
- *
38
- * // Success feedback
39
- * const handleSave = async () => {
40
- * await saveData();
41
- * haptics.success();
42
- * };
43
- *
44
- * // Error feedback
45
- * haptics.error();
46
- * ```
47
- *
48
- * Selection Change (Sliders, Pickers):
49
- * ```typescript
50
- * import { useHaptics } from '@umituz/react-native-haptics';
51
- *
52
- * const haptics = useHaptics();
53
- *
54
- * <Slider
55
- * value={value}
56
- * onValueChange={(val) => {
57
- * setValue(val);
58
- * haptics.selectionChange();
59
- * }}
60
- * />
61
- * ```
62
- *
63
- * Custom Patterns:
64
- * ```typescript
65
- * import { useHaptics } from '@umituz/react-native-haptics';
66
- *
67
- * const haptics = useHaptics();
68
- *
69
- * // Impact with specific style
70
- * haptics.impact('heavy');
71
- *
72
- * // Notification with specific type
73
- * haptics.notification('warning');
74
- *
75
- * // Custom pattern
76
- * haptics.pattern('long_press');
77
- * ```
78
- *
79
- * Direct Service Usage (Rare):
80
- * ```typescript
81
- * import { HapticService } from '@umituz/react-native-haptics';
82
- *
83
- * // Use when you can't use hooks (outside components)
84
- * await HapticService.buttonPress();
85
- * await HapticService.success();
86
- * ```
87
- *
88
- * Common Patterns:
89
- * ```typescript
90
- * import { useHaptics } from '@umituz/react-native-haptics';
91
- *
92
- * const haptics = useHaptics();
93
- *
94
- * // Button press (light impact)
95
- * haptics.buttonPress();
96
- *
97
- * // Success (notification feedback)
98
- * haptics.success();
99
- *
100
- * // Error (notification feedback)
101
- * haptics.error();
102
- *
103
- * // Warning (notification feedback)
104
- * haptics.warning();
105
- *
106
- * // Delete (medium impact)
107
- * haptics.delete();
108
- *
109
- * // Refresh (medium impact)
110
- * haptics.refresh();
111
- *
112
- * // Selection change (selection feedback)
113
- * haptics.selectionChange();
114
- *
115
- * // Long press (heavy impact)
116
- * haptics.longPress();
117
- * ```
118
- *
119
- * Utilities:
120
- * ```typescript
121
- * import { HapticUtils } from '@umituz/react-native-haptics';
122
- *
123
- * // Get impact style for pattern
124
- * const style = HapticUtils.getImpactForPattern('button_press'); // 'light'
125
- *
126
- * // Get notification type for pattern
127
- * const type = HapticUtils.getNotificationForPattern('success'); // 'success'
128
- *
129
- * // Check if pattern should use notification
130
- * const shouldUse = HapticUtils.shouldUseNotification('success'); // true
131
- * ```
132
- *
133
- * BENEFITS:
134
- * - Improved UX with tactile feedback
135
- * - Consistent haptic patterns across app
136
- * - Silent failure (no crashes if unsupported)
137
- * - Platform-agnostic (iOS + Android)
138
- * - Easy integration in any component
139
- * - Works across all apps
140
- *
141
- * USE CASES:
142
- * - Button presses
143
- * - Success confirmations
144
- * - Error alerts
145
- * - Selection changes (sliders, pickers)
146
- * - Delete actions
147
- * - Refresh actions
148
- * - Long press gestures
149
- * - Form validation feedback
150
- *
151
- * @see https://docs.expo.dev/versions/latest/sdk/haptics/
152
- */
153
- export { HAPTIC_CONSTANTS, HapticUtils, } from './domain/entities/Haptic';
154
- // ============================================================================
155
- // INFRASTRUCTURE LAYER - SERVICES
156
- // ============================================================================
157
- export { HapticService } from './infrastructure/services/HapticService';
158
- // ============================================================================
159
- // PRESENTATION LAYER - HOOKS
160
- // ============================================================================
161
- export { useHaptics } from './presentation/hooks/useHaptics';
162
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuJG;AAYH,OAAO,EACL,gBAAgB,EAChB,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAElC,+EAA+E;AAC/E,kCAAkC;AAClC,+EAA+E;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Haptics Domain - Haptic Service
3
- *
4
- * Service for haptic feedback using expo-haptics.
5
- * Provides abstraction layer for vibration and feedback.
6
- *
7
- * @domain haptics
8
- * @layer infrastructure/services
9
- */
10
- import type { ImpactStyle, NotificationType, HapticPattern } from '../../domain/entities/Haptic';
11
- /**
12
- * Haptic feedback service
13
- */
14
- export declare class HapticService {
15
- /**
16
- * Trigger impact feedback (Light, Medium, Heavy)
17
- */
18
- static impact(style?: ImpactStyle): Promise<void>;
19
- /**
20
- * Trigger notification feedback (Success, Warning, Error)
21
- */
22
- static notification(type: NotificationType): Promise<void>;
23
- /**
24
- * Trigger selection feedback (for pickers, sliders)
25
- */
26
- static selection(): Promise<void>;
27
- /**
28
- * Trigger haptic pattern
29
- */
30
- static pattern(pattern: HapticPattern): Promise<void>;
31
- /**
32
- * Common haptic patterns (convenience methods)
33
- */
34
- static buttonPress(): Promise<void>;
35
- static success(): Promise<void>;
36
- static error(): Promise<void>;
37
- static warning(): Promise<void>;
38
- static delete(): Promise<void>;
39
- static refresh(): Promise<void>;
40
- static selectionChange(): Promise<void>;
41
- static longPress(): Promise<void>;
42
- }
43
- //# sourceMappingURL=HapticService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HapticService.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/services/HapticService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGjG;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;WACU,MAAM,CAAC,KAAK,GAAE,WAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;OAEG;WACU,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;OAEG;WACU,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvC;;OAEG;WACU,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB3D;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;WAI5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;WAIxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;WAItB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;WAIxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;WAIvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;WAIxB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;WAIhC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxC"}
@@ -1,101 +0,0 @@
1
- /**
2
- * Haptics Domain - Haptic Service
3
- *
4
- * Service for haptic feedback using expo-haptics.
5
- * Provides abstraction layer for vibration and feedback.
6
- *
7
- * @domain haptics
8
- * @layer infrastructure/services
9
- */
10
- import * as Haptics from 'expo-haptics';
11
- /**
12
- * Haptic feedback service
13
- */
14
- export class HapticService {
15
- /**
16
- * Trigger impact feedback (Light, Medium, Heavy)
17
- */
18
- static async impact(style = 'Light') {
19
- try {
20
- await Haptics.impactAsync(style === 'Light' ? Haptics.ImpactFeedbackStyle.Light :
21
- style === 'Medium' ? Haptics.ImpactFeedbackStyle.Medium :
22
- Haptics.ImpactFeedbackStyle.Heavy);
23
- }
24
- catch (error) {
25
- // Silent fail - haptics not critical
26
- }
27
- }
28
- /**
29
- * Trigger notification feedback (Success, Warning, Error)
30
- */
31
- static async notification(type) {
32
- try {
33
- await Haptics.notificationAsync(type === 'Success' ? Haptics.NotificationFeedbackType.Success :
34
- type === 'Warning' ? Haptics.NotificationFeedbackType.Warning :
35
- Haptics.NotificationFeedbackType.Error);
36
- }
37
- catch (error) {
38
- // Silent fail
39
- }
40
- }
41
- /**
42
- * Trigger selection feedback (for pickers, sliders)
43
- */
44
- static async selection() {
45
- try {
46
- await Haptics.selectionAsync();
47
- }
48
- catch (error) {
49
- // Silent fail
50
- }
51
- }
52
- /**
53
- * Trigger haptic pattern
54
- */
55
- static async pattern(pattern) {
56
- try {
57
- if (pattern === 'selection') {
58
- await HapticService.selection();
59
- return;
60
- }
61
- // Success, Warning, Error map to notification feedback
62
- if (pattern === 'Success' || pattern === 'Warning' || pattern === 'Error') {
63
- await HapticService.notification(pattern);
64
- return;
65
- }
66
- // Default to light impact
67
- await HapticService.impact('Light');
68
- }
69
- catch (error) {
70
- // Silent fail
71
- }
72
- }
73
- /**
74
- * Common haptic patterns (convenience methods)
75
- */
76
- static async buttonPress() {
77
- await HapticService.impact('Light');
78
- }
79
- static async success() {
80
- await HapticService.pattern('Success');
81
- }
82
- static async error() {
83
- await HapticService.pattern('Error');
84
- }
85
- static async warning() {
86
- await HapticService.pattern('Warning');
87
- }
88
- static async delete() {
89
- await HapticService.impact('Medium');
90
- }
91
- static async refresh() {
92
- await HapticService.impact('Light');
93
- }
94
- static async selectionChange() {
95
- await HapticService.pattern('selection');
96
- }
97
- static async longPress() {
98
- await HapticService.impact('Medium');
99
- }
100
- }
101
- //# sourceMappingURL=HapticService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HapticService.js","sourceRoot":"","sources":["../../../src/infrastructure/services/HapticService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAIxC;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAqB,OAAO;QAC9C,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,WAAW,CACvB,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBACvD,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;oBACzD,OA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AAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW;QACtB,MAAM,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO;QAClB,MAAM,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAAK;QAChB,MAAM,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO;QAClB,MAAM,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,MAAM,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO;QAClB,MAAM,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,eAAe;QAC1B,MAAM,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,SAAS;QACpB,MAAM,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Haptics Domain - useHaptics Hook
3
- *
4
- * React hook for haptic feedback.
5
- * Provides vibration patterns for common interactions.
6
- *
7
- * @domain haptics
8
- * @layer presentation/hooks
9
- */
10
- import type { ImpactStyle, NotificationType, HapticPattern } from '../../domain/entities/Haptic';
11
- /**
12
- * useHaptics hook for haptic feedback
13
- *
14
- * USAGE:
15
- * ```typescript
16
- * const haptics = useHaptics();
17
- *
18
- * // Common patterns (convenience methods)
19
- * <TouchableOpacity onPress={() => haptics.buttonPress()}>
20
- * <Text>Click Me</Text>
21
- * </TouchableOpacity>
22
- *
23
- * // Success feedback
24
- * const handleSuccess = async () => {
25
- * await saveData();
26
- * haptics.success();
27
- * };
28
- *
29
- * // Error feedback
30
- * const handleError = () => {
31
- * haptics.error();
32
- * };
33
- *
34
- * // Selection change (sliders, pickers)
35
- * <Slider onValueChange={() => haptics.selectionChange()} />
36
- *
37
- * // Custom patterns
38
- * haptics.pattern('long_press');
39
- * haptics.impact('heavy');
40
- * haptics.notification('warning');
41
- * ```
42
- */
43
- export declare const useHaptics: () => {
44
- impact: (style?: ImpactStyle) => Promise<void>;
45
- notification: (type: NotificationType) => Promise<void>;
46
- selection: () => Promise<void>;
47
- pattern: (patternType: HapticPattern) => Promise<void>;
48
- buttonPress: () => Promise<void>;
49
- success: () => Promise<void>;
50
- error: () => Promise<void>;
51
- warning: () => Promise<void>;
52
- delete: () => Promise<void>;
53
- refresh: () => Promise<void>;
54
- selectionChange: () => Promise<void>;
55
- longPress: () => Promise<void>;
56
- };
57
- //# sourceMappingURL=useHaptics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useHaptics.d.ts","sourceRoot":"","sources":["../../../src/presentation/hooks/useHaptics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,UAAU;qBAIoB,WAAW;yBAON,gBAAgB;;2BAcd,aAAa;;;;;;;;;CAwD9D,CAAC"}
@@ -1,113 +0,0 @@
1
- /**
2
- * Haptics Domain - useHaptics Hook
3
- *
4
- * React hook for haptic feedback.
5
- * Provides vibration patterns for common interactions.
6
- *
7
- * @domain haptics
8
- * @layer presentation/hooks
9
- */
10
- import { useCallback } from 'react';
11
- import { HapticService } from '../../infrastructure/services/HapticService';
12
- /**
13
- * useHaptics hook for haptic feedback
14
- *
15
- * USAGE:
16
- * ```typescript
17
- * const haptics = useHaptics();
18
- *
19
- * // Common patterns (convenience methods)
20
- * <TouchableOpacity onPress={() => haptics.buttonPress()}>
21
- * <Text>Click Me</Text>
22
- * </TouchableOpacity>
23
- *
24
- * // Success feedback
25
- * const handleSuccess = async () => {
26
- * await saveData();
27
- * haptics.success();
28
- * };
29
- *
30
- * // Error feedback
31
- * const handleError = () => {
32
- * haptics.error();
33
- * };
34
- *
35
- * // Selection change (sliders, pickers)
36
- * <Slider onValueChange={() => haptics.selectionChange()} />
37
- *
38
- * // Custom patterns
39
- * haptics.pattern('long_press');
40
- * haptics.impact('heavy');
41
- * haptics.notification('warning');
42
- * ```
43
- */
44
- export const useHaptics = () => {
45
- /**
46
- * Trigger impact feedback (light, medium, heavy)
47
- */
48
- const impact = useCallback(async (style = 'Light') => {
49
- await HapticService.impact(style);
50
- }, []);
51
- /**
52
- * Trigger notification feedback (success, warning, error)
53
- */
54
- const notification = useCallback(async (type) => {
55
- await HapticService.notification(type);
56
- }, []);
57
- /**
58
- * Trigger selection feedback (for pickers, sliders)
59
- */
60
- const selection = useCallback(async () => {
61
- await HapticService.selection();
62
- }, []);
63
- /**
64
- * Trigger custom haptic pattern
65
- */
66
- const pattern = useCallback(async (patternType) => {
67
- await HapticService.pattern(patternType);
68
- }, []);
69
- /**
70
- * Common haptic patterns (convenience methods)
71
- */
72
- const buttonPress = useCallback(async () => {
73
- await HapticService.buttonPress();
74
- }, []);
75
- const success = useCallback(async () => {
76
- await HapticService.success();
77
- }, []);
78
- const error = useCallback(async () => {
79
- await HapticService.error();
80
- }, []);
81
- const warning = useCallback(async () => {
82
- await HapticService.warning();
83
- }, []);
84
- const deleteItem = useCallback(async () => {
85
- await HapticService.delete();
86
- }, []);
87
- const refresh = useCallback(async () => {
88
- await HapticService.refresh();
89
- }, []);
90
- const selectionChange = useCallback(async () => {
91
- await HapticService.selectionChange();
92
- }, []);
93
- const longPress = useCallback(async () => {
94
- await HapticService.longPress();
95
- }, []);
96
- return {
97
- // Generic methods
98
- impact,
99
- notification,
100
- selection,
101
- pattern,
102
- // Common patterns (convenience methods)
103
- buttonPress,
104
- success,
105
- error,
106
- warning,
107
- delete: deleteItem,
108
- refresh,
109
- selectionChange,
110
- longPress,
111
- };
112
- };
113
- //# sourceMappingURL=useHaptics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useHaptics.js","sourceRoot":"","sources":["../../../src/presentation/hooks/useHaptics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B;;OAEG;IACH,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,QAAqB,OAAO,EAAE,EAAE;QAChE,MAAM,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;OAEG;IACH,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,EAAE,IAAsB,EAAE,EAAE;QAChE,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;OAEG;IACH,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACvC,MAAM,aAAa,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;OAEG;IACH,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,WAA0B,EAAE,EAAE;QAC/D,MAAM,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP;;OAEG;IACH,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACzC,MAAM,aAAa,CAAC,WAAW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