@space-uy/pulsar-ui 0.2.0

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.
Files changed (155) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +148 -0
  3. package/lib/module/components/Accordion.js +242 -0
  4. package/lib/module/components/Accordion.js.map +1 -0
  5. package/lib/module/components/BottomSheet.js +183 -0
  6. package/lib/module/components/BottomSheet.js.map +1 -0
  7. package/lib/module/components/Button.js +64 -0
  8. package/lib/module/components/Button.js.map +1 -0
  9. package/lib/module/components/ButtonContainer.js +118 -0
  10. package/lib/module/components/ButtonContainer.js.map +1 -0
  11. package/lib/module/components/CalendarPicker.js +374 -0
  12. package/lib/module/components/CalendarPicker.js.map +1 -0
  13. package/lib/module/components/Card.js +43 -0
  14. package/lib/module/components/Card.js.map +1 -0
  15. package/lib/module/components/Checkbox.js +122 -0
  16. package/lib/module/components/Checkbox.js.map +1 -0
  17. package/lib/module/components/Chip.js +50 -0
  18. package/lib/module/components/Chip.js.map +1 -0
  19. package/lib/module/components/CopyToClipboard.js +98 -0
  20. package/lib/module/components/CopyToClipboard.js.map +1 -0
  21. package/lib/module/components/Dialog.js +232 -0
  22. package/lib/module/components/Dialog.js.map +1 -0
  23. package/lib/module/components/Header.js +94 -0
  24. package/lib/module/components/Header.js.map +1 -0
  25. package/lib/module/components/Icon.js +22 -0
  26. package/lib/module/components/Icon.js.map +1 -0
  27. package/lib/module/components/IconButton.js +57 -0
  28. package/lib/module/components/IconButton.js.map +1 -0
  29. package/lib/module/components/Input.js +111 -0
  30. package/lib/module/components/Input.js.map +1 -0
  31. package/lib/module/components/InputContainer.js +104 -0
  32. package/lib/module/components/InputContainer.js.map +1 -0
  33. package/lib/module/components/LoadingIndicator.js +62 -0
  34. package/lib/module/components/LoadingIndicator.js.map +1 -0
  35. package/lib/module/components/OtpInput.js +85 -0
  36. package/lib/module/components/OtpInput.js.map +1 -0
  37. package/lib/module/components/OtpInputContainer.js +148 -0
  38. package/lib/module/components/OtpInputContainer.js.map +1 -0
  39. package/lib/module/components/Select.js +189 -0
  40. package/lib/module/components/Select.js.map +1 -0
  41. package/lib/module/components/Switch.js +74 -0
  42. package/lib/module/components/Switch.js.map +1 -0
  43. package/lib/module/components/Tabs.js +99 -0
  44. package/lib/module/components/Tabs.js.map +1 -0
  45. package/lib/module/components/Text.js +66 -0
  46. package/lib/module/components/Text.js.map +1 -0
  47. package/lib/module/components/TextArea.js +106 -0
  48. package/lib/module/components/TextArea.js.map +1 -0
  49. package/lib/module/hooks/useTheme.js +20 -0
  50. package/lib/module/hooks/useTheme.js.map +1 -0
  51. package/lib/module/index.js +27 -0
  52. package/lib/module/index.js.map +1 -0
  53. package/lib/module/package.json +1 -0
  54. package/lib/module/store/themeStore.js +50 -0
  55. package/lib/module/store/themeStore.js.map +1 -0
  56. package/lib/module/theme/colors.js +25 -0
  57. package/lib/module/theme/colors.js.map +1 -0
  58. package/lib/module/theme/meassures.js +10 -0
  59. package/lib/module/theme/meassures.js.map +1 -0
  60. package/lib/module/utils/stringUtils.js +12 -0
  61. package/lib/module/utils/stringUtils.js.map +1 -0
  62. package/lib/module/utils/uiUtils.js +63 -0
  63. package/lib/module/utils/uiUtils.js.map +1 -0
  64. package/lib/typescript/package.json +1 -0
  65. package/lib/typescript/src/components/Accordion.d.ts +22 -0
  66. package/lib/typescript/src/components/Accordion.d.ts.map +1 -0
  67. package/lib/typescript/src/components/BottomSheet.d.ts +13 -0
  68. package/lib/typescript/src/components/BottomSheet.d.ts.map +1 -0
  69. package/lib/typescript/src/components/Button.d.ts +16 -0
  70. package/lib/typescript/src/components/Button.d.ts.map +1 -0
  71. package/lib/typescript/src/components/ButtonContainer.d.ts +30 -0
  72. package/lib/typescript/src/components/ButtonContainer.d.ts.map +1 -0
  73. package/lib/typescript/src/components/CalendarPicker.d.ts +19 -0
  74. package/lib/typescript/src/components/CalendarPicker.d.ts.map +1 -0
  75. package/lib/typescript/src/components/Card.d.ts +7 -0
  76. package/lib/typescript/src/components/Card.d.ts.map +1 -0
  77. package/lib/typescript/src/components/Checkbox.d.ts +11 -0
  78. package/lib/typescript/src/components/Checkbox.d.ts.map +1 -0
  79. package/lib/typescript/src/components/Chip.d.ts +9 -0
  80. package/lib/typescript/src/components/Chip.d.ts.map +1 -0
  81. package/lib/typescript/src/components/CopyToClipboard.d.ts +12 -0
  82. package/lib/typescript/src/components/CopyToClipboard.d.ts.map +1 -0
  83. package/lib/typescript/src/components/Dialog.d.ts +40 -0
  84. package/lib/typescript/src/components/Dialog.d.ts.map +1 -0
  85. package/lib/typescript/src/components/Header.d.ts +18 -0
  86. package/lib/typescript/src/components/Header.d.ts.map +1 -0
  87. package/lib/typescript/src/components/Icon.d.ts +12 -0
  88. package/lib/typescript/src/components/Icon.d.ts.map +1 -0
  89. package/lib/typescript/src/components/IconButton.d.ts +13 -0
  90. package/lib/typescript/src/components/IconButton.d.ts.map +1 -0
  91. package/lib/typescript/src/components/Input.d.ts +17 -0
  92. package/lib/typescript/src/components/Input.d.ts.map +1 -0
  93. package/lib/typescript/src/components/InputContainer.d.ts +22 -0
  94. package/lib/typescript/src/components/InputContainer.d.ts.map +1 -0
  95. package/lib/typescript/src/components/LoadingIndicator.d.ts +9 -0
  96. package/lib/typescript/src/components/LoadingIndicator.d.ts.map +1 -0
  97. package/lib/typescript/src/components/OtpInput.d.ts +3 -0
  98. package/lib/typescript/src/components/OtpInput.d.ts.map +1 -0
  99. package/lib/typescript/src/components/OtpInputContainer.d.ts +17 -0
  100. package/lib/typescript/src/components/OtpInputContainer.d.ts.map +1 -0
  101. package/lib/typescript/src/components/Select.d.ts +20 -0
  102. package/lib/typescript/src/components/Select.d.ts.map +1 -0
  103. package/lib/typescript/src/components/Switch.d.ts +10 -0
  104. package/lib/typescript/src/components/Switch.d.ts.map +1 -0
  105. package/lib/typescript/src/components/Tabs.d.ts +14 -0
  106. package/lib/typescript/src/components/Tabs.d.ts.map +1 -0
  107. package/lib/typescript/src/components/Text.d.ts +7 -0
  108. package/lib/typescript/src/components/Text.d.ts.map +1 -0
  109. package/lib/typescript/src/components/TextArea.d.ts +16 -0
  110. package/lib/typescript/src/components/TextArea.d.ts.map +1 -0
  111. package/lib/typescript/src/hooks/useTheme.d.ts +9 -0
  112. package/lib/typescript/src/hooks/useTheme.d.ts.map +1 -0
  113. package/lib/typescript/src/index.d.ts +27 -0
  114. package/lib/typescript/src/index.d.ts.map +1 -0
  115. package/lib/typescript/src/store/themeStore.d.ts +32 -0
  116. package/lib/typescript/src/store/themeStore.d.ts.map +1 -0
  117. package/lib/typescript/src/theme/colors.d.ts +14 -0
  118. package/lib/typescript/src/theme/colors.d.ts.map +1 -0
  119. package/lib/typescript/src/theme/meassures.d.ts +9 -0
  120. package/lib/typescript/src/theme/meassures.d.ts.map +1 -0
  121. package/lib/typescript/src/utils/stringUtils.d.ts +7 -0
  122. package/lib/typescript/src/utils/stringUtils.d.ts.map +1 -0
  123. package/lib/typescript/src/utils/uiUtils.d.ts +21 -0
  124. package/lib/typescript/src/utils/uiUtils.d.ts.map +1 -0
  125. package/package.json +173 -0
  126. package/src/components/Accordion.tsx +284 -0
  127. package/src/components/BottomSheet.tsx +259 -0
  128. package/src/components/Button.tsx +85 -0
  129. package/src/components/ButtonContainer.tsx +161 -0
  130. package/src/components/CalendarPicker.tsx +428 -0
  131. package/src/components/Card.tsx +55 -0
  132. package/src/components/Checkbox.tsx +160 -0
  133. package/src/components/Chip.tsx +58 -0
  134. package/src/components/CopyToClipboard.tsx +108 -0
  135. package/src/components/Dialog.tsx +263 -0
  136. package/src/components/Header.tsx +100 -0
  137. package/src/components/Icon.tsx +27 -0
  138. package/src/components/IconButton.tsx +71 -0
  139. package/src/components/Input.tsx +144 -0
  140. package/src/components/InputContainer.tsx +134 -0
  141. package/src/components/LoadingIndicator.tsx +78 -0
  142. package/src/components/OtpInput.tsx +109 -0
  143. package/src/components/OtpInputContainer.tsx +196 -0
  144. package/src/components/Select.tsx +219 -0
  145. package/src/components/Switch.tsx +104 -0
  146. package/src/components/Tabs.tsx +117 -0
  147. package/src/components/Text.tsx +64 -0
  148. package/src/components/TextArea.tsx +141 -0
  149. package/src/hooks/useTheme.tsx +23 -0
  150. package/src/index.tsx +38 -0
  151. package/src/store/themeStore.ts +57 -0
  152. package/src/theme/colors.ts +35 -0
  153. package/src/theme/meassures.ts +7 -0
  154. package/src/utils/stringUtils.ts +16 -0
  155. package/src/utils/uiUtils.ts +70 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 chacaa
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # @space-uy/pulsar-ui
2
+
3
+ <div align="center">
4
+
5
+ ![Version](https://img.shields.io/badge/version-0.1.0-blue.svg?cacheSeconds=2592000)
6
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
7
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
8
+
9
+ A modern React Native UI kit for SpaceDev applications, providing a collection of reusable components and utilities.
10
+
11
+ </div>
12
+
13
+ ## ✨ Features
14
+
15
+ - 🎨 Modern and consistent design system
16
+ - 📱 Cross-platform components for iOS, Android and Web
17
+ - 🚀 Built with performance in mind
18
+ - 📦 Easy to integrate and use
19
+ - 🔧 Fully typed with TypeScript
20
+ - 🎯 Comprehensive component library
21
+ - 🌈 Theme support
22
+ - 📖 Well-documented components
23
+
24
+ ## 📦 Installation
25
+
26
+ ```sh
27
+ # Using npm
28
+ npm install @space-uy/pulsar-ui
29
+
30
+ # Using yarn
31
+ yarn add @space-uy/pulsar-ui
32
+
33
+ # Using pnpm
34
+ pnpm add @space-uy/pulsar-ui
35
+ ```
36
+
37
+ ### Peer Dependencies
38
+
39
+ This library requires the following peer dependencies to be installed in your project:
40
+
41
+ ```json
42
+ {
43
+ "@react-navigation/elements": "^2.3.8", // Required for navigation components
44
+ "lucide-react-native": "^0.503.0", // Required for icons
45
+ "react": "*", // Core React dependency
46
+ "react-native": "*", // Core React Native dependency
47
+ "react-native-gesture-handler": "^2.25.0", // Required for gesture interactions
48
+ "react-native-reanimated": "~3.16.1", // Required for animations
49
+ "react-native-svg": "^15.11.2" // Required for SVG support
50
+ }
51
+ ```
52
+
53
+ #### Installation
54
+
55
+ You can install all peer dependencies at once using:
56
+
57
+ ```sh
58
+ # Using npm
59
+ npm install @react-navigation/elements@^2.3.8 lucide-react-native@^0.503.0 react-native-gesture-handler@^2.25.0 react-native-reanimated@~3.16.1 react-native-svg@^15.11.2
60
+
61
+ # Using yarn
62
+ yarn add @react-navigation/elements@^2.3.8 lucide-react-native@^0.503.0 react-native-gesture-handler@^2.25.0 react-native-reanimated@~3.16.1 react-native-svg@^15.11.2
63
+
64
+ # Using pnpm
65
+ pnpm add @react-navigation/elements@^2.3.8 lucide-react-native@^0.503.0 react-native-gesture-handler@^2.25.0 react-native-reanimated@~3.16.1 react-native-svg@^15.11.2
66
+ ```
67
+
68
+ Note: `react` and `react-native` are typically already installed in your React Native project, so you don't need to install them separately.
69
+
70
+ ## 🚀 Quick Start
71
+
72
+ ```jsx
73
+ import { Button } from '@space-uy/pulsar-ui';
74
+
75
+ function MyApp() {
76
+ return (
77
+ <>
78
+ {/* Primary button */}
79
+ <Button text="Click me" onPress={() => console.log('Button pressed!')} />
80
+
81
+ {/* Outline button */}
82
+ <Button
83
+ text="Outline Button"
84
+ variant="outlined"
85
+ onPress={() => console.log('Outline button pressed!')}
86
+ />
87
+
88
+ {/* Small button with icon */}
89
+ <Button
90
+ text="Small Button"
91
+ size="small"
92
+ iconName="Plus"
93
+ onPress={() => console.log('Small button pressed!')}
94
+ />
95
+ </>
96
+ );
97
+ }
98
+ ```
99
+
100
+ ## 🛠️ Development
101
+
102
+ ### Prerequisites
103
+
104
+ - Node.js (version specified in `.nvmrc`)
105
+ - Yarn (version 3.6.1 or later)
106
+ - React Native development environment set up
107
+
108
+ ### Setup
109
+
110
+ 1. Clone the repository:
111
+
112
+ ```sh
113
+ git clone https://github.com/SpaceUY/pulsar-ui.git
114
+ cd @space-uy/pulsar-ui
115
+ ```
116
+
117
+ 2. Install dependencies:
118
+
119
+ ```sh
120
+ yarn install
121
+ ```
122
+
123
+ 3. Start the example app:
124
+
125
+ ```sh
126
+ yarn example
127
+ ```
128
+
129
+ ### Available Scripts
130
+
131
+ - `yarn example` - Run the example app
132
+ - `yarn test` - Run tests
133
+ - `yarn typecheck` - Run TypeScript type checking
134
+ - `yarn lint` - Run ESLint
135
+ - `yarn clean` - Clean build files
136
+ - `yarn prepare` - Build the library
137
+
138
+ ## 🤝 Contributing
139
+
140
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and more.
141
+
142
+ ## 📄 License
143
+
144
+ MIT © [SpaceDev](https://github.com/SpaceUY)
145
+
146
+ ---
147
+
148
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+
3
+ import React, { useState, useMemo, useEffect } from 'react';
4
+ import { View, Pressable, StyleSheet, Platform } from 'react-native';
5
+ import Animated, { useSharedValue, useAnimatedStyle, withTiming, interpolateColor, interpolate } from 'react-native-reanimated';
6
+ import useTheme from "../hooks/useTheme.js";
7
+ import Text from "./Text.js";
8
+ import Icon from "./Icon.js";
9
+ import { convertHexToRgba } from "../utils/uiUtils.js";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export function AccordionItem({
12
+ title,
13
+ children,
14
+ isExpanded = false,
15
+ onToggle,
16
+ style
17
+ }) {
18
+ const {
19
+ colors
20
+ } = useTheme();
21
+ const pressed = useSharedValue(0);
22
+ const rotation = useSharedValue(0);
23
+ const height = useSharedValue(0);
24
+ const opacity = useSharedValue(0);
25
+ const [contentHeight, setContentHeight] = useState(0);
26
+ const itemStyle = useMemo(() => ({
27
+ borderBottomWidth: 1,
28
+ borderBottomColor: colors.border,
29
+ backgroundColor: colors.background
30
+ }), [colors]);
31
+ const pressedColor = convertHexToRgba(colors.border, 0.5);
32
+ const animatedTriggerStyle = useAnimatedStyle(() => {
33
+ return {
34
+ backgroundColor: interpolateColor(pressed.value, [0, 1], [colors.background, pressedColor])
35
+ };
36
+ });
37
+ const animatedChevronStyle = useAnimatedStyle(() => {
38
+ return {
39
+ transform: [{
40
+ rotate: `${interpolate(rotation.value, [0, 1], [0, 180])}deg`
41
+ }]
42
+ };
43
+ });
44
+ const animatedContentStyle = useAnimatedStyle(() => {
45
+ return {
46
+ height: height.value,
47
+ opacity: opacity.value
48
+ };
49
+ });
50
+ const updatePressAnimation = value => {
51
+ pressed.value = withTiming(value, {
52
+ duration: 200
53
+ });
54
+ };
55
+ const handlePressIn = () => {
56
+ Platform.OS !== 'web' && updatePressAnimation(1);
57
+ };
58
+ const handlePressOut = () => {
59
+ Platform.OS !== 'web' && updatePressAnimation(0);
60
+ };
61
+ useEffect(() => {
62
+ rotation.value = withTiming(isExpanded ? 1 : 0, {
63
+ duration: 200
64
+ });
65
+ }, [isExpanded, rotation]);
66
+ useEffect(() => {
67
+ if (contentHeight > 0) {
68
+ height.value = withTiming(isExpanded ? contentHeight : 0, {
69
+ duration: 250
70
+ });
71
+ opacity.value = withTiming(isExpanded ? 1 : 0, {
72
+ duration: 200
73
+ });
74
+ }
75
+ }, [isExpanded, contentHeight, height, opacity]);
76
+ const handleContentLayout = event => {
77
+ const {
78
+ height: layoutHeight
79
+ } = event.nativeEvent.layout;
80
+ if (layoutHeight > 0 && contentHeight !== layoutHeight) {
81
+ setContentHeight(layoutHeight);
82
+ if (isExpanded) {
83
+ height.value = layoutHeight;
84
+ opacity.value = 1;
85
+ } else {
86
+ height.value = 0;
87
+ opacity.value = 0;
88
+ }
89
+ }
90
+ };
91
+ return /*#__PURE__*/_jsxs(View, {
92
+ style: [itemStyle, style],
93
+ children: [/*#__PURE__*/_jsx(Pressable, {
94
+ style: styles.trigger,
95
+ onPress: onToggle,
96
+ onPressIn: handlePressIn,
97
+ onPressOut: handlePressOut,
98
+ onHoverIn: () => updatePressAnimation(1),
99
+ onHoverOut: () => updatePressAnimation(0),
100
+ children: /*#__PURE__*/_jsxs(Animated.View, {
101
+ style: [styles.triggerContent, animatedTriggerStyle],
102
+ children: [/*#__PURE__*/_jsx(Text, {
103
+ variant: "h4",
104
+ style: [styles.title, {
105
+ color: colors.foreground
106
+ }],
107
+ children: title
108
+ }), /*#__PURE__*/_jsx(Animated.View, {
109
+ style: [styles.chevron, animatedChevronStyle],
110
+ children: /*#__PURE__*/_jsx(Icon, {
111
+ name: "ChevronDown",
112
+ size: 20,
113
+ color: colors.foreground
114
+ })
115
+ })]
116
+ })
117
+ }), /*#__PURE__*/_jsxs(View, {
118
+ children: [/*#__PURE__*/_jsx(View, {
119
+ style: styles.hiddenContent,
120
+ onLayout: handleContentLayout,
121
+ children: /*#__PURE__*/_jsx(View, {
122
+ style: styles.content,
123
+ children: children
124
+ })
125
+ }), contentHeight > 0 && /*#__PURE__*/_jsx(Animated.View, {
126
+ style: [styles.contentContainer, animatedContentStyle],
127
+ children: /*#__PURE__*/_jsx(View, {
128
+ style: styles.content,
129
+ children: children
130
+ })
131
+ })]
132
+ })]
133
+ });
134
+ }
135
+ export default function Accordion({
136
+ type = 'single',
137
+ collapsible = false,
138
+ defaultValue,
139
+ value: controlledValue,
140
+ onValueChange,
141
+ children,
142
+ style
143
+ }) {
144
+ const {
145
+ colors,
146
+ theme
147
+ } = useTheme();
148
+ const getInitialExpandedItems = () => {
149
+ if (controlledValue !== undefined) {
150
+ return new Set(Array.isArray(controlledValue) ? controlledValue : [controlledValue]);
151
+ }
152
+ if (defaultValue !== undefined) {
153
+ return new Set(Array.isArray(defaultValue) ? defaultValue : [defaultValue]);
154
+ }
155
+ return new Set();
156
+ };
157
+ const [expandedItems, setExpandedItems] = useState(getInitialExpandedItems);
158
+ useEffect(() => {
159
+ if (controlledValue !== undefined) {
160
+ setExpandedItems(new Set(Array.isArray(controlledValue) ? controlledValue : [controlledValue]));
161
+ }
162
+ }, [controlledValue]);
163
+ const toggleItem = value => {
164
+ setExpandedItems(prev => {
165
+ const newSet = new Set(prev);
166
+ if (type === 'single') {
167
+ if (newSet.has(value)) {
168
+ if (collapsible) {
169
+ newSet.clear();
170
+ }
171
+ } else {
172
+ newSet.clear();
173
+ newSet.add(value);
174
+ }
175
+ } else if (newSet.has(value)) {
176
+ newSet.delete(value);
177
+ } else {
178
+ newSet.add(value);
179
+ }
180
+ const newValue = type === 'single' ? Array.from(newSet)[0] || '' : Array.from(newSet);
181
+ onValueChange?.(newValue);
182
+ return newSet;
183
+ });
184
+ };
185
+ const accordionStyle = useMemo(() => ({
186
+ backgroundColor: colors.background,
187
+ borderRadius: theme.roundness,
188
+ borderWidth: 1,
189
+ borderColor: colors.border,
190
+ overflow: 'hidden'
191
+ }), [colors, theme]);
192
+ const accordionItems = React.Children.map(children, (child, index) => {
193
+ if (/*#__PURE__*/React.isValidElement(child)) {
194
+ const value = child.props.value || `item-${index}`;
195
+ return /*#__PURE__*/React.cloneElement(child, {
196
+ isExpanded: expandedItems.has(value),
197
+ onToggle: () => toggleItem(value),
198
+ key: value
199
+ });
200
+ }
201
+ return child;
202
+ });
203
+ return /*#__PURE__*/_jsx(View, {
204
+ style: [accordionStyle, style],
205
+ children: accordionItems
206
+ });
207
+ }
208
+ const styles = StyleSheet.create({
209
+ trigger: {
210
+ overflow: 'hidden'
211
+ },
212
+ triggerContent: {
213
+ flexDirection: 'row',
214
+ alignItems: 'center',
215
+ justifyContent: 'space-between',
216
+ minHeight: 24,
217
+ paddingVertical: 16,
218
+ paddingHorizontal: 16
219
+ },
220
+ chevron: {
221
+ marginLeft: 8,
222
+ justifyContent: 'center',
223
+ alignItems: 'center'
224
+ },
225
+ content: {
226
+ paddingHorizontal: 16,
227
+ paddingBottom: 16,
228
+ overflow: 'hidden'
229
+ },
230
+ contentContainer: {
231
+ overflow: 'hidden'
232
+ },
233
+ hiddenContent: {
234
+ position: 'absolute',
235
+ opacity: 0,
236
+ zIndex: -1
237
+ },
238
+ title: {
239
+ flex: 1
240
+ }
241
+ });
242
+ //# sourceMappingURL=Accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","useMemo","useEffect","View","Pressable","StyleSheet","Platform","Animated","useSharedValue","useAnimatedStyle","withTiming","interpolateColor","interpolate","useTheme","Text","Icon","convertHexToRgba","jsx","_jsx","jsxs","_jsxs","AccordionItem","title","children","isExpanded","onToggle","style","colors","pressed","rotation","height","opacity","contentHeight","setContentHeight","itemStyle","borderBottomWidth","borderBottomColor","border","backgroundColor","background","pressedColor","animatedTriggerStyle","value","animatedChevronStyle","transform","rotate","animatedContentStyle","updatePressAnimation","duration","handlePressIn","OS","handlePressOut","handleContentLayout","event","layoutHeight","nativeEvent","layout","styles","trigger","onPress","onPressIn","onPressOut","onHoverIn","onHoverOut","triggerContent","variant","color","foreground","chevron","name","size","hiddenContent","onLayout","content","contentContainer","Accordion","type","collapsible","defaultValue","controlledValue","onValueChange","theme","getInitialExpandedItems","undefined","Set","Array","isArray","expandedItems","setExpandedItems","toggleItem","prev","newSet","has","clear","add","delete","newValue","from","accordionStyle","borderRadius","roundness","borderWidth","borderColor","overflow","accordionItems","Children","map","child","index","isValidElement","props","cloneElement","key","create","flexDirection","alignItems","justifyContent","minHeight","paddingVertical","paddingHorizontal","marginLeft","paddingBottom","position","zIndex","flex"],"sourceRoot":"../../../src","sources":["components/Accordion.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,OAAO;AAC3D,SACEC,IAAI,EACJC,SAAS,EACTC,UAAU,EAGVC,QAAQ,QAEH,cAAc;AACrB,OAAOC,QAAQ,IACbC,cAAc,EACdC,gBAAgB,EAChBC,UAAU,EACVC,gBAAgB,EAChBC,WAAW,QACN,yBAAyB;AAEhC,OAAOC,QAAQ,MAAM,sBAAmB;AACxC,OAAOC,IAAI,MAAM,WAAQ;AACzB,OAAOC,IAAI,MAAM,WAAQ;AACzB,SAASC,gBAAgB,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAqBpD,OAAO,SAASC,aAAaA,CAAC;EAC5BC,KAAK;EACLC,QAAQ;EACRC,UAAU,GAAG,KAAK;EAClBC,QAAQ;EACRC;AACkB,CAAC,EAAE;EACrB,MAAM;IAAEC;EAAO,CAAC,GAAGd,QAAQ,CAAC,CAAC;EAC7B,MAAMe,OAAO,GAAGpB,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMqB,QAAQ,GAAGrB,cAAc,CAAC,CAAC,CAAC;EAClC,MAAMsB,MAAM,GAAGtB,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMuB,OAAO,GAAGvB,cAAc,CAAC,CAAC,CAAC;EACjC,MAAM,CAACwB,aAAa,EAAEC,gBAAgB,CAAC,GAAGjC,QAAQ,CAAC,CAAC,CAAC;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;IAAEsG,IAAI,EAAE;EAAE;AACnB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
4
+ import { Modal, StyleSheet, TouchableWithoutFeedback, useWindowDimensions, View } from 'react-native';
5
+ import Animated, { Easing, Extrapolation, interpolate, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
6
+ import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
7
+ import useTheme from "../hooks/useTheme.js";
8
+ import { convertHexToRgba } from "../utils/uiUtils.js";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const BottomSheet = /*#__PURE__*/forwardRef(({
11
+ onBackdropPress = () => {},
12
+ children,
13
+ fullScreen = false
14
+ }, ref) => {
15
+ const [height, setHeight] = useState(0);
16
+ const [visible, setVisible] = useState(false);
17
+ const contentRef = useRef(null);
18
+ const {
19
+ colors,
20
+ theme
21
+ } = useTheme();
22
+ const {
23
+ width: screenWidth,
24
+ height: screenHeight
25
+ } = useWindowDimensions();
26
+ const offset = useSharedValue(screenHeight);
27
+ const opacity = useSharedValue(0);
28
+ useImperativeHandle(ref, () => ({
29
+ show: () => setVisible(true),
30
+ hide: () => runAnimation(false),
31
+ isActive: visible
32
+ }));
33
+ const transformAnimationStyle = useAnimatedStyle(() => {
34
+ return {
35
+ borderTopRightRadius: interpolate(offset.value, [0, screenHeight * 0.2], [0, 20], Extrapolation.CLAMP),
36
+ borderTopLeftRadius: interpolate(offset.value, [0, theme.insets.top + 150], [0, 20], Extrapolation.CLAMP),
37
+ transform: [{
38
+ translateY: offset.value
39
+ }]
40
+ };
41
+ });
42
+ const handleContainerAnimStyle = useAnimatedStyle(() => {
43
+ return {
44
+ paddingTop: interpolate(offset.value, [0, 100], [theme.insets.top + 16, 8], Extrapolation.CLAMP)
45
+ };
46
+ });
47
+ const handleAnimStyle = useAnimatedStyle(() => {
48
+ return {
49
+ width: interpolate(offset.value, [0, 100], [80, 40], Extrapolation.CLAMP)
50
+ };
51
+ });
52
+ const opacityAnimatedStyle = useAnimatedStyle(() => {
53
+ return {
54
+ opacity: opacity.value
55
+ };
56
+ });
57
+ const handleLayout = e => {
58
+ setHeight(e.nativeEvent.layout.height);
59
+ };
60
+ const getAnimationValue = (value, easing, closeOnFinish = false) => {
61
+ const config = {
62
+ duration: 300,
63
+ easing
64
+ };
65
+ // If we don't do it like this, the app throw an error regarding de value returned
66
+ if (closeOnFinish) {
67
+ return withTiming(value, config, () => {
68
+ runOnJS(setVisible)(false);
69
+ });
70
+ }
71
+ return withTiming(value, config);
72
+ };
73
+ const runAnimation = useCallback(isOpenAnim => {
74
+ const coordY = isOpenAnim ? screenHeight - height : screenHeight;
75
+ const easing = isOpenAnim ? Easing.out(Easing.exp) : Easing.in(Easing.exp);
76
+ offset.value = getAnimationValue(coordY, easing);
77
+ opacity.value = getAnimationValue(isOpenAnim ? 1 : 0, easing, !isOpenAnim);
78
+ }, [height, offset, opacity, screenHeight]);
79
+ const panGesture = Gesture.Pan().onUpdate(event => {
80
+ if (event.translationY > 0) {
81
+ offset.value = screenHeight - height + event.translationY;
82
+ }
83
+ }).onEnd(event => {
84
+ if (event.translationY > height * 0.3) {
85
+ offset.value = withTiming(screenHeight, {
86
+ duration: 300
87
+ }, () => {
88
+ runOnJS(setVisible)(false);
89
+ runOnJS(onBackdropPress)();
90
+ });
91
+ opacity.value = withTiming(0, {
92
+ duration: 300
93
+ });
94
+ } else {
95
+ offset.value = withTiming(screenHeight - height, {
96
+ duration: 300
97
+ });
98
+ }
99
+ });
100
+ const handleBackdropPress = () => {
101
+ onBackdropPress?.();
102
+ runAnimation(false);
103
+ };
104
+ useEffect(() => {
105
+ if (visible && height > 0) {
106
+ runAnimation(true);
107
+ }
108
+ }, [height, runAnimation, visible]);
109
+ return (
110
+ /*#__PURE__*/
111
+ /*
112
+ Need to wrap the modal with a View because there's a strange behavior in Android currently
113
+ which is not registering onPress events on components inside the modal. It seems to be something
114
+ related to the new architecture implementation on Andoid, change it once the issue is fixed.
115
+ See related issues:
116
+ - https://github.com/react-native-modal/react-native-modal/issues/737
117
+ - https://github.com/facebook/react-native/issues/36710
118
+ - https://github.com/facebook/react-native/issues/44643
119
+ */
120
+ _jsx(View, {
121
+ children: /*#__PURE__*/_jsx(Modal, {
122
+ transparent: true,
123
+ statusBarTranslucent: true,
124
+ visible: visible,
125
+ onShow: () => runAnimation(true),
126
+ children: /*#__PURE__*/_jsxs(GestureHandlerRootView, {
127
+ children: [/*#__PURE__*/_jsx(TouchableWithoutFeedback, {
128
+ onPress: handleBackdropPress,
129
+ children: /*#__PURE__*/_jsx(Animated.View, {
130
+ style: [StyleSheet.absoluteFill, opacityAnimatedStyle, {
131
+ backgroundColor: convertHexToRgba(colors.foreground, 0.1)
132
+ }]
133
+ })
134
+ }), /*#__PURE__*/_jsx(GestureDetector, {
135
+ gesture: panGesture,
136
+ children: /*#__PURE__*/_jsxs(Animated.View, {
137
+ ref: contentRef,
138
+ onLayout: handleLayout,
139
+ style: [styles.contentContainer, {
140
+ backgroundColor: colors.background,
141
+ width: screenWidth
142
+ }, transformAnimationStyle, fullScreen ? {
143
+ height: screenHeight
144
+ } : {
145
+ maxHeight: screenHeight * 0.8
146
+ }],
147
+ children: [/*#__PURE__*/_jsx(Animated.View, {
148
+ style: [handleContainerAnimStyle, {
149
+ width: screenWidth
150
+ }, styles.handleContainer],
151
+ children: /*#__PURE__*/_jsx(Animated.View, {
152
+ style: [styles.handle, {
153
+ backgroundColor: colors.border
154
+ }, handleAnimStyle]
155
+ })
156
+ }), children]
157
+ })
158
+ })]
159
+ })
160
+ })
161
+ })
162
+ );
163
+ });
164
+ const styles = StyleSheet.create({
165
+ container: {
166
+ flex: 1
167
+ },
168
+ contentContainer: {
169
+ overflow: 'hidden'
170
+ },
171
+ handle: {
172
+ height: 8,
173
+ borderRadius: 8,
174
+ alignSelf: 'center'
175
+ },
176
+ handleContainer: {
177
+ justifyContent: 'flex-end',
178
+ alignItems: 'center',
179
+ paddingBottom: 16
180
+ }
181
+ });
182
+ export default BottomSheet;
183
+ //# sourceMappingURL=BottomSheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","Modal","StyleSheet","TouchableWithoutFeedback","useWindowDimensions","View","Animated","Easing","Extrapolation","interpolate","runOnJS","useAnimatedStyle","useSharedValue","withTiming","Gesture","GestureDetector","GestureHandlerRootView","useTheme","convertHexToRgba","jsx","_jsx","jsxs","_jsxs","BottomSheet","onBackdropPress","children","fullScreen","ref","height","setHeight","visible","setVisible","contentRef","colors","theme","width","screenWidth","screenHeight","offset","opacity","show","hide","runAnimation","isActive","transformAnimationStyle","borderTopRightRadius","value","CLAMP","borderTopLeftRadius","insets","top","transform","translateY","handleContainerAnimStyle","paddingTop","handleAnimStyle","opacityAnimatedStyle","handleLayout","e","nativeEvent","layout","getAnimationValue","easing","closeOnFinish","config","duration","isOpenAnim","coordY","out","exp","in","panGesture","Pan","onUpdate","event","translationY","onEnd","handleBackdropPress","transparent","statusBarTranslucent","onShow","onPress","style","absoluteFill","backgroundColor","foreground","gesture","onLayout","styles","contentContainer","background","maxHeight","handleContainer","handle","border","create","container","flex","overflow","borderRadius","alignSelf","justifyContent","alignItems","paddingBottom"],"sourceRoot":"../../../src","sources":["components/BottomSheet.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QAEH,OAAO;AACd,SACEC,KAAK,EACLC,UAAU,EACVC,wBAAwB,EACxBC,mBAAmB,EACnBC,IAAI,QAEC,cAAc;AACrB,OAAOC,QAAQ,IACbC,MAAM,EACNC,aAAa,EACbC,WAAW,EACXC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAChC,SACEC,OAAO,EACPC,eAAe,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