react-native-boxes 1.0.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.
- package/README.md +1 -0
- package/dist/Bar.d.ts +26 -0
- package/dist/Bar.js +159 -0
- package/dist/Bar.js.map +1 -0
- package/dist/Box.d.ts +14 -0
- package/dist/Box.js +103 -0
- package/dist/Box.js.map +1 -0
- package/dist/Button.d.ts +20 -0
- package/dist/Button.js +220 -0
- package/dist/Button.js.map +1 -0
- package/dist/Image.d.ts +21 -0
- package/dist/Image.js +79 -0
- package/dist/Image.js.map +1 -0
- package/dist/Input.d.ts +27 -0
- package/dist/Input.js +190 -0
- package/dist/Input.js.map +1 -0
- package/dist/Message.d.ts +7 -0
- package/dist/Message.js +97 -0
- package/dist/Message.js.map +1 -0
- package/dist/Modal.d.ts +22 -0
- package/dist/Modal.js +247 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Styles.d.ts +113 -0
- package/dist/Styles.js +105 -0
- package/dist/Styles.js.map +1 -0
- package/dist/Text.d.ts +5 -0
- package/dist/Text.js +49 -0
- package/dist/Text.js.map +1 -0
- package/dist/ThemeContext.d.ts +93 -0
- package/dist/ThemeContext.js +26 -0
- package/dist/ThemeContext.js.map +1 -0
- package/dist/demo.d.ts +5 -0
- package/dist/demo.js +301 -0
- package/dist/demo.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +45 -0
- package/dist/utils.js.map +1 -0
- package/package.json +37 -0
- package/src/Bar.tsx +185 -0
- package/src/Box.tsx +106 -0
- package/src/Button.tsx +282 -0
- package/src/Image.tsx +107 -0
- package/src/Input.tsx +244 -0
- package/src/Message.tsx +90 -0
- package/src/Modal.tsx +306 -0
- package/src/Styles.tsx +117 -0
- package/src/Text.tsx +56 -0
- package/src/ThemeContext.ts +25 -0
- package/src/demo.tsx +383 -0
- package/src/index.tsx +8 -0
- package/src/utils.ts +49 -0
- package/tsconfig.json +25 -0
package/dist/demo.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DemoScreen = void 0;
|
|
30
|
+
const react_1 = require("react");
|
|
31
|
+
const React = __importStar(require("react"));
|
|
32
|
+
const react_native_1 = require("react-native");
|
|
33
|
+
const _1 = require(".");
|
|
34
|
+
const FontAwesome_1 = __importDefault(require("@expo/vector-icons/FontAwesome"));
|
|
35
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
36
|
+
const Message_1 = require("./Message");
|
|
37
|
+
const Modal_1 = require("./Modal");
|
|
38
|
+
const Image_1 = require("./Image");
|
|
39
|
+
const utils_1 = require("./utils");
|
|
40
|
+
const Box_1 = __importDefault(require("./Box"));
|
|
41
|
+
const Styles_1 = require("./Styles");
|
|
42
|
+
function DemoScreen({ navigation }) {
|
|
43
|
+
const theme = (0, react_1.useContext)(_1.ThemeContext);
|
|
44
|
+
console.log('Rendering');
|
|
45
|
+
const btnIcon = (<FontAwesome_1.default name='google' size={theme.dimens.icon.md} color={theme.colors.invert.text}/>);
|
|
46
|
+
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
47
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
48
|
+
const [alert, setBs] = (0, react_1.useState)(`In this version, the icon used is always 'chevron-right' even when expanded.`);
|
|
49
|
+
const [bottomsheetVisible, setbottomsheetVisible] = (0, react_1.useState)(false);
|
|
50
|
+
function setAlert(bs) {
|
|
51
|
+
setBs(bs);
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
setBs(`In this version, the icon used is always 'chevron-right' even when expanded.`);
|
|
54
|
+
}, 5000);
|
|
55
|
+
}
|
|
56
|
+
const [selectedBottombarId, setSelectedBottomBarId] = (0, react_1.useState)('home');
|
|
57
|
+
const [mText, setMText] = (0, react_1.useState)(`@shivesh`);
|
|
58
|
+
const [bottomBarHeight, setBottombarHeight] = (0, react_1.useState)(theme.dimens.space.xl);
|
|
59
|
+
const [selectedTheme, setSelectedTheme] = (0, react_1.useState)(true);
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
theme.colors = selectedTheme ? Styles_1.LightColors : Styles_1.DarkColors;
|
|
62
|
+
forceUpdate();
|
|
63
|
+
}, [selectedTheme]);
|
|
64
|
+
const [, forceUpdate] = (0, react_1.useReducer)(x => x + 1, 0);
|
|
65
|
+
return (<_1.VBox style={{
|
|
66
|
+
backgroundColor: theme.colors.background,
|
|
67
|
+
padding: 0,
|
|
68
|
+
paddingBottom: bottomBarHeight,
|
|
69
|
+
margin: 0,
|
|
70
|
+
height: '100%'
|
|
71
|
+
}}>
|
|
72
|
+
<_1.SimpleToolbar title="Demo" homeIcon={(0, utils_1.ReactWrapper)(<Image_1.Icon color={theme.colors.invert.text} name="plus"/>)} options={[
|
|
73
|
+
{
|
|
74
|
+
id: 'test',
|
|
75
|
+
icon: 'gear',
|
|
76
|
+
onClick: (id) => {
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'test2',
|
|
81
|
+
icon: (0, utils_1.ReactWrapper)(<_1.PressableView>
|
|
82
|
+
<Image_1.Avatar style={{
|
|
83
|
+
margin: 0,
|
|
84
|
+
height: theme.dimens?.icon?.md * 1.25,
|
|
85
|
+
width: theme.dimens?.icon?.md * 1.25,
|
|
86
|
+
}} iconUrl="https://avatars.githubusercontent.com/u/16799797?v=4"/>
|
|
87
|
+
</_1.PressableView>),
|
|
88
|
+
onClick: (id) => {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]}/>
|
|
92
|
+
<Box_1.default automaticallyAdjustKeyboardInsets={true} keyboardShouldPersistTaps={'handled'} style={{
|
|
93
|
+
flexGrow: 1,
|
|
94
|
+
}} nestedScrollEnabled={true} showsHorizontalScrollIndicator={false} showsVerticalScrollIndicator={false}>
|
|
95
|
+
|
|
96
|
+
<_1.Center style={{
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
padding: 20
|
|
99
|
+
}}>
|
|
100
|
+
|
|
101
|
+
<Image_1.Avatar onPress={() => {
|
|
102
|
+
setbottomsheetVisible(true);
|
|
103
|
+
}} style={{
|
|
104
|
+
borderColor: theme.colors.success,
|
|
105
|
+
}} iconNameProps={{
|
|
106
|
+
name: 'user',
|
|
107
|
+
color: theme.colors.success,
|
|
108
|
+
size: theme.dimens.icon.lg
|
|
109
|
+
}}/>
|
|
110
|
+
<_1.Center>
|
|
111
|
+
<Image_1.Avatar style={{
|
|
112
|
+
borderWidth: theme.dimens.space.sm,
|
|
113
|
+
width: 100,
|
|
114
|
+
height: 100,
|
|
115
|
+
borderColor: theme.colors.success
|
|
116
|
+
}} iconText='SN' onPress={() => {
|
|
117
|
+
setbottomsheetVisible(true);
|
|
118
|
+
}} iconNameProps={{
|
|
119
|
+
name: 'user',
|
|
120
|
+
color: theme.colors.success,
|
|
121
|
+
size: theme.dimens.icon.lg
|
|
122
|
+
}} iconUrl='https://cdn.truelancer.com/user-picture/307510-5c1f11bad82e9.jpg'/>
|
|
123
|
+
<_1.Subtitle>{mText}</_1.Subtitle>
|
|
124
|
+
</_1.Center>
|
|
125
|
+
|
|
126
|
+
<Image_1.Avatar style={{
|
|
127
|
+
borderColor: theme.colors.success,
|
|
128
|
+
color: theme.colors.success
|
|
129
|
+
}} onPress={() => {
|
|
130
|
+
setbottomsheetVisible(true);
|
|
131
|
+
}} iconText='SN'/>
|
|
132
|
+
</_1.Center>
|
|
133
|
+
<_1.Expand title='Message Alert' initialExpand={false} style={{
|
|
134
|
+
backgroundColor: theme.colors.forground
|
|
135
|
+
}} titleBackgroundColor={theme.colors.forground}>
|
|
136
|
+
<_1.VBox>
|
|
137
|
+
<Message_1.AlertMessage text={alert} onDismiss={() => {
|
|
138
|
+
react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
|
|
139
|
+
setAlert('');
|
|
140
|
+
}}/>
|
|
141
|
+
<Message_1.AlertMessage text='Critial Message' type='critical'/>
|
|
142
|
+
<Message_1.AlertMessage text='Success' type='success'/>
|
|
143
|
+
<Message_1.AlertMessage text='Warning Message' type='warning'/>
|
|
144
|
+
</_1.VBox>
|
|
145
|
+
|
|
146
|
+
</_1.Expand>
|
|
147
|
+
<_1.Expand style={{
|
|
148
|
+
padding: 0,
|
|
149
|
+
borderWidth: 0.1,
|
|
150
|
+
borderColor: '#DCDCDC'
|
|
151
|
+
}} duration={200} title='In this version, the icon used is always chevron-right even when expanded. In this version, the icon used is always chevron-right even when expanded.' initialExpand={false} iconPosition='right'>
|
|
152
|
+
<_1.VBox>
|
|
153
|
+
<_1.Title>Text A</_1.Title>
|
|
154
|
+
<_1.Subtitle>Text A Text A Text AText A Text AText A</_1.Subtitle>
|
|
155
|
+
<_1.TextView>Text A</_1.TextView>
|
|
156
|
+
<_1.Caption>Text Caption</_1.Caption>
|
|
157
|
+
</_1.VBox>
|
|
158
|
+
</_1.Expand>
|
|
159
|
+
<_1.Expand title='Inputs'>
|
|
160
|
+
|
|
161
|
+
<_1.VBox>
|
|
162
|
+
<_1.TextInputView style={{
|
|
163
|
+
fontFamily: theme.fonts.Bold
|
|
164
|
+
}} initialText={mText} value={mText} onChangeText={t => setMText(t)}/>
|
|
165
|
+
<_1.CompositeTextInputView onChangeText={t => setMText(t)} placeholder='A test' initialText='Test'/>
|
|
166
|
+
<_1.CompositeTextInputView inputMode='decimal' icon={"close"} style={{}} alertTextColor={theme.colors.warning} placeholder='Enter your name' initialText='Test' value={mText} onChangeText={t => setMText(t)}/>
|
|
167
|
+
<_1.CompositeTextInputView style={{}} placeholder='Enter number' alertText={mText?.indexOf("@") > -1 ? '' : 'Please enter @ or else I am gonna come down at your place and mess you up buddy !'} initialText='Test' value={mText} onChangeText={t => setMText(t)}/>
|
|
168
|
+
</_1.VBox>
|
|
169
|
+
</_1.Expand>
|
|
170
|
+
|
|
171
|
+
<_1.Expand iconStyle={{
|
|
172
|
+
name: 'chevron-right',
|
|
173
|
+
color: 'red'
|
|
174
|
+
}} title='Buttons' initialExpand={false}>
|
|
175
|
+
<_1.VBox style={{}}>
|
|
176
|
+
<_1.VBox>
|
|
177
|
+
<_1.ButtonView icon={btnIcon} style={{}}>Button Icon</_1.ButtonView>
|
|
178
|
+
|
|
179
|
+
<_1.ButtonView style={{}}>Button Text</_1.ButtonView>
|
|
180
|
+
</_1.VBox>
|
|
181
|
+
<_1.RightIconButton text='Click Me Icon' icon={btnIcon}>
|
|
182
|
+
</_1.RightIconButton>
|
|
183
|
+
|
|
184
|
+
<_1.Center>
|
|
185
|
+
<_1.LoadingButton onPress={(e) => {
|
|
186
|
+
setLoading(!loading);
|
|
187
|
+
}} loading={loading} text='Click Me'/>
|
|
188
|
+
|
|
189
|
+
<_1.ButtonView underlayColor={theme.colors.transparent} style={{
|
|
190
|
+
color: theme.colors.accent,
|
|
191
|
+
backgroundColor: theme.colors.transparent,
|
|
192
|
+
}}>Tertiary button</_1.ButtonView>
|
|
193
|
+
|
|
194
|
+
</_1.Center>
|
|
195
|
+
|
|
196
|
+
<_1.Expand title='Nested expand'>
|
|
197
|
+
<_1.HBox style={{
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
}}>
|
|
200
|
+
<_1.LoadingButton style={{
|
|
201
|
+
width: 'auto'
|
|
202
|
+
}} onPress={(e) => {
|
|
203
|
+
setLoading(!loading);
|
|
204
|
+
}} loading={loading} text='Click Me left'/>
|
|
205
|
+
<_1.LoadingButton loaderStyle='transparent' style={{
|
|
206
|
+
width: 'auto'
|
|
207
|
+
}} onPress={(e) => {
|
|
208
|
+
setLoading(!loading);
|
|
209
|
+
}} loading={loading} text='Click Me right'/>
|
|
210
|
+
</_1.HBox>
|
|
211
|
+
</_1.Expand>
|
|
212
|
+
|
|
213
|
+
</_1.VBox>
|
|
214
|
+
</_1.Expand>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
<_1.ButtonView underlayColor={theme.colors.transparent} style={{
|
|
219
|
+
color: theme.colors.accent,
|
|
220
|
+
backgroundColor: theme.colors.transparent,
|
|
221
|
+
}} onPress={() => {
|
|
222
|
+
setSelectedTheme(!selectedTheme);
|
|
223
|
+
}}>{selectedTheme ? 'Light' : 'Dark'}</_1.ButtonView>
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
<_1.ButtonView underlayColor={theme.colors.transparent} style={{
|
|
227
|
+
color: theme.colors.accent,
|
|
228
|
+
backgroundColor: theme.colors.transparent,
|
|
229
|
+
}} onPress={() => {
|
|
230
|
+
setbottomsheetVisible(true);
|
|
231
|
+
}}>Show Sheet</_1.ButtonView>
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
</Box_1.default>
|
|
235
|
+
<_1.BottomNavBar style={{
|
|
236
|
+
borderTopLeftRadius: theme.dimens.space.md,
|
|
237
|
+
borderTopRightRadius: theme.dimens.space.md,
|
|
238
|
+
}} onSelect={setSelectedBottomBarId} selectedId={selectedBottombarId} options={[
|
|
239
|
+
{
|
|
240
|
+
id: 'home',
|
|
241
|
+
title: 'Home',
|
|
242
|
+
icon: 'home'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: 'create',
|
|
246
|
+
title: 'Create',
|
|
247
|
+
icon: 'plus'
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: 'search',
|
|
251
|
+
title: 'Search',
|
|
252
|
+
icon: 'search'
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: 'profile',
|
|
256
|
+
title: 'Profile',
|
|
257
|
+
icon: (0, utils_1.ReactWrapper)(<_1.PressableView>
|
|
258
|
+
<Image_1.Avatar onPress={() => {
|
|
259
|
+
setSelectedBottomBarId('profile');
|
|
260
|
+
}} style={{
|
|
261
|
+
borderColor: selectedBottombarId == 'profile' ?
|
|
262
|
+
theme.colors.accent : theme.colors.caption,
|
|
263
|
+
margin: 0,
|
|
264
|
+
height: theme.dimens?.icon?.md,
|
|
265
|
+
width: theme.dimens?.icon?.md,
|
|
266
|
+
}}
|
|
267
|
+
// iconName='user'
|
|
268
|
+
iconUrl="https://avatars.githubusercontent.com/u/16799797?v=4"/>
|
|
269
|
+
</_1.PressableView>)
|
|
270
|
+
}
|
|
271
|
+
]} onDimens={(w, h) => {
|
|
272
|
+
setBottombarHeight(h);
|
|
273
|
+
console.log("bottomBarHeight", h);
|
|
274
|
+
}}/>
|
|
275
|
+
|
|
276
|
+
<Modal_1.BottomSheet title="About" visible={bottomsheetVisible} onDismiss={() => {
|
|
277
|
+
setbottomsheetVisible(false);
|
|
278
|
+
}}>
|
|
279
|
+
<_1.TextView>Dinosaurs are a diverse group of reptiles of the clade Dinosauria. They first appeared during the Triassic period, between 243 and 233.23 million years ago, although the exact origin and timing of the evolution of dinosaurs is a subject of active research.</_1.TextView>
|
|
280
|
+
|
|
281
|
+
<_1.TextView>Dinosaurs are a diverse group of reptiles of the clade Dinosauria. They first appeared during the Triassic period, between 243 and 233.23 million years ago, although the exact origin and timing of the evolution of dinosaurs is a subject of active research.</_1.TextView>
|
|
282
|
+
<_1.Expand title='Types' initialExpand={false} style={{
|
|
283
|
+
padding: 0,
|
|
284
|
+
backgroundColor: theme.colors.forground
|
|
285
|
+
}} titleBackgroundColor={theme.colors.forground}>
|
|
286
|
+
<_1.VBox>
|
|
287
|
+
<Message_1.AlertMessage text={alert} onDismiss={() => {
|
|
288
|
+
react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
|
|
289
|
+
setAlert('');
|
|
290
|
+
}}/>
|
|
291
|
+
<Message_1.AlertMessage text='Tyrannosaurus rex' type='critical'/>
|
|
292
|
+
<Message_1.AlertMessage text='Spinosaurus' type='success'/>
|
|
293
|
+
<Message_1.AlertMessage text='Ankylosaurs' type='warning'/>
|
|
294
|
+
</_1.VBox>
|
|
295
|
+
|
|
296
|
+
</_1.Expand>
|
|
297
|
+
</Modal_1.BottomSheet>
|
|
298
|
+
</_1.VBox>);
|
|
299
|
+
}
|
|
300
|
+
exports.DemoScreen = DemoScreen;
|
|
301
|
+
//# sourceMappingURL=demo.js.map
|
package/dist/demo.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demo.js","sourceRoot":"","sources":["../src/demo.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAoE;AACpE,6CAA8B;AAC9B,+CAA6D;AAC7D,wBAAuO;AACvO,iFAAyD;A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C,gQAAgQ,EAAE,WAAQ,CAEpR;;QAAA,CAAC,WAAQ,CAAC,gQAAgQ,EAAE,WAAQ,CACpR;QAAA,CAAC,SAAM,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CACzC,KAAK,CAAC,CAAC;YACL,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS;SACxC,CAAC,CACF,oBAAoB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAE7C;UAAA,CAAC,OAAI,CACH;YAAA,CAAC,sBAAY,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE;YACzC,8BAAe,CAAC,aAAa,CAAC,8BAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACrE,QAAQ,CAAC,EAAE,CAAC,CAAA;QACd,CAAC,CAAC,EACF;YAAA,CAAC,sBAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,EACtD;YAAA,CAAC,sBAAY,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,EAC/C;YAAA,CAAC,sBAAY,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,EACjD;UAAA,EAAE,OAAI,CAER;;QAAA,EAAE,SAAM,CACV;MAAA,EAAE,mBAAW,CACf;IAAA,EAAE,OAAI,CAAC,CACR,CAAC;AACJ,CAAC;AA7WD,gCA6WC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Text"), exports);
|
|
18
|
+
__exportStar(require("./Box"), exports);
|
|
19
|
+
__exportStar(require("./Button"), exports);
|
|
20
|
+
__exportStar(require("./Modal"), exports);
|
|
21
|
+
__exportStar(require("./Image"), exports);
|
|
22
|
+
__exportStar(require("./Input"), exports);
|
|
23
|
+
__exportStar(require("./Bar"), exports);
|
|
24
|
+
__exportStar(require("./ThemeContext"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,wCAAsB;AACtB,iDAA+B"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function ReactWrapper(component: any): (props: any) => any;
|
|
2
|
+
export declare function randomColor(): undefined;
|
|
3
|
+
export declare function isWeb(): boolean;
|
|
4
|
+
export declare function isDesktop(): boolean;
|
|
5
|
+
export declare function assignFields(target: any, source: any, fields: string[], skipUndefined?: boolean): any;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assignFields = exports.isDesktop = exports.isWeb = exports.randomColor = exports.ReactWrapper = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const react_native_2 = require("react-native");
|
|
6
|
+
function ReactWrapper(component) {
|
|
7
|
+
return (props) => {
|
|
8
|
+
return component;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.ReactWrapper = ReactWrapper;
|
|
12
|
+
function randomColor() {
|
|
13
|
+
const letters = '0123456789ABCDEF';
|
|
14
|
+
let color = '#';
|
|
15
|
+
for (let i = 0; i < 6; i++) {
|
|
16
|
+
color += letters[Math.floor(Math.random() * 16)];
|
|
17
|
+
}
|
|
18
|
+
// return color;
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
exports.randomColor = randomColor;
|
|
22
|
+
function isWeb() {
|
|
23
|
+
return react_native_1.Platform.OS == 'web';
|
|
24
|
+
}
|
|
25
|
+
exports.isWeb = isWeb;
|
|
26
|
+
function isDesktop() {
|
|
27
|
+
const windowWidth = react_native_2.Dimensions.get('window').width;
|
|
28
|
+
const windowHeight = react_native_2.Dimensions.get('window').height;
|
|
29
|
+
return windowWidth > windowHeight;
|
|
30
|
+
}
|
|
31
|
+
exports.isDesktop = isDesktop;
|
|
32
|
+
function assignFields(target, source, fields, skipUndefined = true) {
|
|
33
|
+
if (!target)
|
|
34
|
+
target = {};
|
|
35
|
+
Object.keys(source || {}).forEach(k => {
|
|
36
|
+
if (fields?.indexOf(k) > -1) {
|
|
37
|
+
if (!skipUndefined && !source[k])
|
|
38
|
+
return;
|
|
39
|
+
target[k] = source[k];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
exports.assignFields = assignFields;
|
|
45
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings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C5B,OAAM;YACV,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACzB,CAAC;IACL,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACjB,CAAC;AAfD,oCAeC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-boxes",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A react native library for rapid development of UI using boxes",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc --build --verbose",
|
|
8
|
+
"test": "echo Skipping..."
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/shiveshnavin/react-native-boxes.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"react-native-libary",
|
|
16
|
+
"react-native-boxes",
|
|
17
|
+
"react-native-ui"
|
|
18
|
+
],
|
|
19
|
+
"author": "Shivesh Navin",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/shiveshnavin/react-native-boxes/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/shiveshnavin/react-native-boxes#readme",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@expo/vector-icons": "^13.0.0",
|
|
27
|
+
"react": "^18.2.0",
|
|
28
|
+
"react-native": "^0.73.6",
|
|
29
|
+
"react-native-safe-area-context": "^4.9.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@tsconfig/react-native": "^3.0.4",
|
|
33
|
+
"@types/jest": "^29.5.12",
|
|
34
|
+
"@types/react": "^18.2.71",
|
|
35
|
+
"typescript": "^5.4.3"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/Bar.tsx
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { StatusBar, TextStyle, ViewProps } from "react-native";
|
|
3
|
+
import { ThemeContext } from "./ThemeContext";
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
import { Center, HBox } from "./Box";
|
|
6
|
+
import { TextView } from "./Text";
|
|
7
|
+
import { Icon, getIcon } from "./Image";
|
|
8
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
9
|
+
import { PressableView } from "./Button";
|
|
10
|
+
import { isDesktop, isWeb } from "./utils";
|
|
11
|
+
|
|
12
|
+
export interface Option {
|
|
13
|
+
id: string,
|
|
14
|
+
title?: string,
|
|
15
|
+
icon?: string | any,
|
|
16
|
+
onClick?: (id: string) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SimpleToolbarProps extends ViewProps {
|
|
20
|
+
title?: String,
|
|
21
|
+
backgroundColor?: string,
|
|
22
|
+
forgroundColor?: string,
|
|
23
|
+
homeIcon?: string | typeof Icon,
|
|
24
|
+
onHomePress?: () => void
|
|
25
|
+
textStyle?: TextStyle
|
|
26
|
+
options?: Option[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SimpleToolbarHeight = 40
|
|
30
|
+
export function SimpleToolbar(props: SimpleToolbarProps) {
|
|
31
|
+
const theme = useContext(ThemeContext)
|
|
32
|
+
var HomeIcon = getIcon(props.homeIcon)
|
|
33
|
+
const insets = useSafeAreaInsets();
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<HBox style={[isWeb() ? {
|
|
37
|
+
paddingTop: theme.dimens.space.lg,
|
|
38
|
+
paddingBottom: theme.dimens.space.lg,
|
|
39
|
+
backgroundColor: theme.colors.accent || props.backgroundColor,
|
|
40
|
+
minHeight: SimpleToolbarHeight * (isDesktop() ? 1.3 : 1.25),
|
|
41
|
+
} : {
|
|
42
|
+
paddingTop: insets.top,
|
|
43
|
+
paddingBottom: theme.dimens.space.lg,
|
|
44
|
+
backgroundColor: theme.colors.accent || props.backgroundColor,
|
|
45
|
+
minHeight: SimpleToolbarHeight,
|
|
46
|
+
}, props.style]}>
|
|
47
|
+
<StatusBar
|
|
48
|
+
animated={true}
|
|
49
|
+
backgroundColor={theme.colors.accent || props.backgroundColor}
|
|
50
|
+
/>
|
|
51
|
+
<HBox style={{
|
|
52
|
+
left: 0,
|
|
53
|
+
paddingStart: HomeIcon ? 0 : theme.dimens.space.sm,
|
|
54
|
+
justifyContent: HomeIcon ? 'center' : 'flex-start',
|
|
55
|
+
alignSelf: 'center',
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
width: '100%',
|
|
58
|
+
}}>
|
|
59
|
+
<TextView style={[{
|
|
60
|
+
color: props.forgroundColor || theme.colors.invert.text
|
|
61
|
+
}, props.textStyle]} >
|
|
62
|
+
{props.title}
|
|
63
|
+
</TextView>
|
|
64
|
+
</HBox>
|
|
65
|
+
|
|
66
|
+
<HBox style={{
|
|
67
|
+
paddingLeft: theme.dimens.space.md,
|
|
68
|
+
alignSelf: 'center',
|
|
69
|
+
alignContent: 'center',
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
justifyContent: 'space-between',
|
|
72
|
+
width: '99.9%',
|
|
73
|
+
}}>
|
|
74
|
+
<Center style={{
|
|
75
|
+
paddingLeft: theme.dimens.space.sm,
|
|
76
|
+
margin: 0,
|
|
77
|
+
}}>
|
|
78
|
+
<PressableView onPress={() => {
|
|
79
|
+
props.onHomePress && props.onHomePress()
|
|
80
|
+
}}>
|
|
81
|
+
{HomeIcon && <HomeIcon />}
|
|
82
|
+
</PressableView>
|
|
83
|
+
</Center>
|
|
84
|
+
<HBox style={{
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
marginRight: isWeb() ? theme.dimens.space.sm : theme.dimens.space.md
|
|
87
|
+
}}>
|
|
88
|
+
{
|
|
89
|
+
props.options?.map((opt) => {
|
|
90
|
+
let ActionIcon = getIcon(opt.icon)
|
|
91
|
+
let title = opt.title || opt.id
|
|
92
|
+
return (
|
|
93
|
+
<PressableView
|
|
94
|
+
style={{
|
|
95
|
+
paddingStart: theme.dimens.space.md
|
|
96
|
+
}}
|
|
97
|
+
key={opt.id}
|
|
98
|
+
accessibilityHint={title}
|
|
99
|
+
onPress={() => {
|
|
100
|
+
opt.onClick && opt.onClick(opt.id)
|
|
101
|
+
}}>
|
|
102
|
+
<ActionIcon
|
|
103
|
+
color={props.forgroundColor || theme.colors.invert.text}
|
|
104
|
+
style={{
|
|
105
|
+
paddingLeft: theme.dimens.space.sm
|
|
106
|
+
}} />
|
|
107
|
+
</PressableView>
|
|
108
|
+
)
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
</HBox>
|
|
112
|
+
</HBox>
|
|
113
|
+
</HBox>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function BottomNavBar(props: ViewProps &
|
|
118
|
+
{
|
|
119
|
+
options: Option[],
|
|
120
|
+
selectedId: string,
|
|
121
|
+
onSelect: (id: string) => void,
|
|
122
|
+
onDimens?: (width: number, height: number) => void
|
|
123
|
+
}) {
|
|
124
|
+
const theme = useContext(ThemeContext)
|
|
125
|
+
const onDimens = props.onDimens
|
|
126
|
+
const hasText = props.options?.find((op) => {
|
|
127
|
+
return op.title != undefined
|
|
128
|
+
})
|
|
129
|
+
function getItem(op: Option) {
|
|
130
|
+
const color = props.selectedId == op.id ? theme.colors.accent : theme.colors.text
|
|
131
|
+
const ItemIcon = getIcon(op.icon)
|
|
132
|
+
const title = op.title || (hasText ? op.id : undefined)
|
|
133
|
+
return (
|
|
134
|
+
<PressableView
|
|
135
|
+
style={{
|
|
136
|
+
paddingTop: theme.dimens.space.sm
|
|
137
|
+
}}
|
|
138
|
+
key={op.id}
|
|
139
|
+
onPress={() => {
|
|
140
|
+
op.onClick && op.onClick(op.id)
|
|
141
|
+
props.onSelect(op.id)
|
|
142
|
+
}}>
|
|
143
|
+
<Center >
|
|
144
|
+
{op.icon && <ItemIcon color={color} />}
|
|
145
|
+
{title &&
|
|
146
|
+
<TextView style={{
|
|
147
|
+
fontSize: theme.dimens.font.sm,
|
|
148
|
+
color: color
|
|
149
|
+
}}>{title}</TextView>}
|
|
150
|
+
</Center>
|
|
151
|
+
</PressableView>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
if (!props.options || props.options?.length == 0) {
|
|
155
|
+
return null
|
|
156
|
+
}
|
|
157
|
+
return (
|
|
158
|
+
<HBox
|
|
159
|
+
onLayout={(event) => {
|
|
160
|
+
const { width, height } = event.nativeEvent.layout;
|
|
161
|
+
onDimens && onDimens(width, height)
|
|
162
|
+
}}
|
|
163
|
+
{...props}
|
|
164
|
+
style={[{
|
|
165
|
+
padding: theme.dimens.space.md,
|
|
166
|
+
paddingTop: !hasText ? theme.dimens.space.lg : theme.dimens.space.md,
|
|
167
|
+
paddingBottom: !hasText ? theme.dimens.space.lg : theme.dimens.space.md,
|
|
168
|
+
backgroundColor: theme.colors.forground,
|
|
169
|
+
zIndex: 100,
|
|
170
|
+
width: '100%',
|
|
171
|
+
justifyContent: 'space-around',
|
|
172
|
+
left: 0,
|
|
173
|
+
bottom: 0,
|
|
174
|
+
position: 'absolute'
|
|
175
|
+
}, props.style]}
|
|
176
|
+
>
|
|
177
|
+
{
|
|
178
|
+
props.options?.map(op => {
|
|
179
|
+
return getItem(op)
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
</HBox>
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
}
|