aport-tools 4.1.28 → 4.1.29
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -0
- package/dist/fonts/Text.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +311 -291
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +330 -313
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/styles/colors.d.ts +0 -22
- package/dist/styles/theme.d.ts +0 -4
- package/dist/theme/ThemeContext.d.ts +0 -40
- package/dist/theme/ThemeToggle.d.ts +0 -3
- package/dist/theme/index.d.ts +0 -2
package/dist/index.js
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
/*! aport-tools v4.1.
|
1
|
+
/*! aport-tools v4.1.29 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
5
|
-
var
|
6
|
-
var asyncStorage = require('@react-native-async-storage/async-storage');
|
5
|
+
var require$$1 = require('react-native');
|
7
6
|
|
8
7
|
/******************************************************************************
|
9
8
|
Copyright (c) Microsoft Corporation.
|
@@ -88,283 +87,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
88
87
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
89
88
|
};
|
90
89
|
|
91
|
-
// src/styles/colors.ts
|
92
|
-
var lightTheme = {
|
93
|
-
primary: {
|
94
|
-
hex: "#1A73E8",
|
95
|
-
rgb: {
|
96
|
-
r: 26,
|
97
|
-
g: 115,
|
98
|
-
b: 232
|
99
|
-
}
|
100
|
-
},
|
101
|
-
secondary: {
|
102
|
-
hex: "#F0F6FF",
|
103
|
-
rgb: {
|
104
|
-
r: 240,
|
105
|
-
g: 246,
|
106
|
-
b: 255
|
107
|
-
}
|
108
|
-
},
|
109
|
-
background: {
|
110
|
-
hex: "#FFFFFF",
|
111
|
-
rgb: {
|
112
|
-
r: 255,
|
113
|
-
g: 255,
|
114
|
-
b: 255
|
115
|
-
}
|
116
|
-
},
|
117
|
-
text: {
|
118
|
-
hex: "#000000",
|
119
|
-
rgb: {
|
120
|
-
r: 0,
|
121
|
-
g: 0,
|
122
|
-
b: 0
|
123
|
-
}
|
124
|
-
},
|
125
|
-
textButton: {
|
126
|
-
hex: "#FFFFFF",
|
127
|
-
rgb: {
|
128
|
-
r: 255,
|
129
|
-
g: 255,
|
130
|
-
b: 255
|
131
|
-
}
|
132
|
-
},
|
133
|
-
error: {
|
134
|
-
hex: "#FF5252",
|
135
|
-
rgb: {
|
136
|
-
r: 255,
|
137
|
-
g: 82,
|
138
|
-
b: 82
|
139
|
-
}
|
140
|
-
},
|
141
|
-
success: {
|
142
|
-
hex: "#4CAF50",
|
143
|
-
rgb: {
|
144
|
-
r: 76,
|
145
|
-
g: 175,
|
146
|
-
b: 80
|
147
|
-
}
|
148
|
-
},
|
149
|
-
warning: {
|
150
|
-
hex: "#FFC107",
|
151
|
-
rgb: {
|
152
|
-
r: 255,
|
153
|
-
g: 193,
|
154
|
-
b: 7
|
155
|
-
}
|
156
|
-
},
|
157
|
-
body: {
|
158
|
-
// Body color is the same as background in the light theme
|
159
|
-
hex: '#FFFFFF',
|
160
|
-
rgb: {
|
161
|
-
r: 255,
|
162
|
-
g: 255,
|
163
|
-
b: 255
|
164
|
-
}
|
165
|
-
}
|
166
|
-
};
|
167
|
-
var darkTheme = {
|
168
|
-
primary: {
|
169
|
-
hex: "#BB86FC",
|
170
|
-
rgb: {
|
171
|
-
r: 187,
|
172
|
-
g: 134,
|
173
|
-
b: 252
|
174
|
-
}
|
175
|
-
},
|
176
|
-
secondary: {
|
177
|
-
hex: "#03DAC6",
|
178
|
-
rgb: {
|
179
|
-
r: 3,
|
180
|
-
g: 218,
|
181
|
-
b: 198
|
182
|
-
}
|
183
|
-
},
|
184
|
-
background: {
|
185
|
-
hex: "#121212",
|
186
|
-
rgb: {
|
187
|
-
r: 18,
|
188
|
-
g: 18,
|
189
|
-
b: 18
|
190
|
-
}
|
191
|
-
},
|
192
|
-
text: {
|
193
|
-
hex: "#FFFFFF",
|
194
|
-
rgb: {
|
195
|
-
r: 255,
|
196
|
-
g: 255,
|
197
|
-
b: 255
|
198
|
-
}
|
199
|
-
},
|
200
|
-
textButton: {
|
201
|
-
hex: "#FFFFFF",
|
202
|
-
rgb: {
|
203
|
-
r: 255,
|
204
|
-
g: 255,
|
205
|
-
b: 255
|
206
|
-
}
|
207
|
-
},
|
208
|
-
error: {
|
209
|
-
hex: "#CF6679",
|
210
|
-
rgb: {
|
211
|
-
r: 207,
|
212
|
-
g: 102,
|
213
|
-
b: 121
|
214
|
-
}
|
215
|
-
},
|
216
|
-
success: {
|
217
|
-
hex: "#03DAC6",
|
218
|
-
rgb: {
|
219
|
-
r: 3,
|
220
|
-
g: 218,
|
221
|
-
b: 198
|
222
|
-
}
|
223
|
-
},
|
224
|
-
warning: {
|
225
|
-
hex: "#FFB74D",
|
226
|
-
rgb: {
|
227
|
-
r: 255,
|
228
|
-
g: 183,
|
229
|
-
b: 77
|
230
|
-
}
|
231
|
-
},
|
232
|
-
body: {
|
233
|
-
hex: '#1C1C1E',
|
234
|
-
rgb: {
|
235
|
-
r: 28,
|
236
|
-
g: 28,
|
237
|
-
b: 30
|
238
|
-
}
|
239
|
-
}
|
240
|
-
};
|
241
|
-
|
242
|
-
/**
|
243
|
-
* React context for managing theme-related data and functions.
|
244
|
-
*/
|
245
|
-
var ThemeContext = /*#__PURE__*/React.createContext({
|
246
|
-
theme: {
|
247
|
-
colors: lightTheme
|
248
|
-
},
|
249
|
-
toggleTheme: function toggleTheme() {}
|
250
|
-
});
|
251
|
-
/**
|
252
|
-
* ThemeProvider component that manages and provides theme data to its children.
|
253
|
-
*
|
254
|
-
* @param children - The child components that will consume the theme context.
|
255
|
-
* @param initialTheme - Optional prop to set the initial theme.
|
256
|
-
*/
|
257
|
-
var ThemeProvider = function ThemeProvider(_a) {
|
258
|
-
var children = _a.children,
|
259
|
-
initialTheme = _a.initialTheme;
|
260
|
-
var _b = React.useState(null),
|
261
|
-
colorScheme = _b[0],
|
262
|
-
setColorScheme = _b[1];
|
263
|
-
// Use useAsyncStorage hook for managing the theme storage
|
264
|
-
var _c = asyncStorage.useAsyncStorage('theme'),
|
265
|
-
getItem = _c.getItem,
|
266
|
-
setItem = _c.setItem;
|
267
|
-
React.useEffect(function () {
|
268
|
-
var loadTheme = function loadTheme() {
|
269
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
270
|
-
var systemTheme;
|
271
|
-
return __generator(this, function (_a) {
|
272
|
-
try {
|
273
|
-
// const storedTheme = await getItem();
|
274
|
-
// if (storedTheme === 'dark' || storedTheme === 'light') {
|
275
|
-
// setColorScheme(storedTheme);
|
276
|
-
//}
|
277
|
-
if (initialTheme) {
|
278
|
-
setColorScheme(initialTheme);
|
279
|
-
} else {
|
280
|
-
systemTheme = reactNative.Appearance.getColorScheme();
|
281
|
-
setColorScheme(systemTheme);
|
282
|
-
}
|
283
|
-
} catch (error) {
|
284
|
-
console.error('Failed to load theme.', error);
|
285
|
-
setColorScheme(reactNative.Appearance.getColorScheme());
|
286
|
-
}
|
287
|
-
return [2 /*return*/];
|
288
|
-
});
|
289
|
-
});
|
290
|
-
};
|
291
|
-
loadTheme();
|
292
|
-
var subscription = reactNative.Appearance.addChangeListener(function (_a) {
|
293
|
-
var colorScheme = _a.colorScheme;
|
294
|
-
if (!colorScheme) return; // Prevent setting null
|
295
|
-
setColorScheme(colorScheme);
|
296
|
-
});
|
297
|
-
return function () {
|
298
|
-
return subscription.remove();
|
299
|
-
};
|
300
|
-
}, [initialTheme, getItem]);
|
301
|
-
var toggleTheme = function toggleTheme() {
|
302
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
303
|
-
var newTheme, error_1;
|
304
|
-
return __generator(this, function (_a) {
|
305
|
-
switch (_a.label) {
|
306
|
-
case 0:
|
307
|
-
_a.trys.push([0, 2,, 3]);
|
308
|
-
newTheme = colorScheme === 'dark' ? 'light' : 'dark';
|
309
|
-
setColorScheme(newTheme);
|
310
|
-
return [4 /*yield*/, setItem(newTheme)];
|
311
|
-
case 1:
|
312
|
-
_a.sent(); // Use setItem from useAsyncStorage
|
313
|
-
return [3 /*break*/, 3];
|
314
|
-
case 2:
|
315
|
-
error_1 = _a.sent();
|
316
|
-
console.error('Failed to toggle theme.', error_1);
|
317
|
-
return [3 /*break*/, 3];
|
318
|
-
case 3:
|
319
|
-
return [2 /*return*/];
|
320
|
-
}
|
321
|
-
});
|
322
|
-
});
|
323
|
-
};
|
324
|
-
var theme = {
|
325
|
-
colors: colorScheme === 'dark' ? darkTheme : lightTheme
|
326
|
-
};
|
327
|
-
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
328
|
-
value: {
|
329
|
-
theme: theme,
|
330
|
-
toggleTheme: toggleTheme
|
331
|
-
}
|
332
|
-
}, children);
|
333
|
-
};
|
334
|
-
|
335
|
-
var ThemeToggle = function ThemeToggle() {
|
336
|
-
var _a = React.useContext(ThemeContext),
|
337
|
-
theme = _a.theme,
|
338
|
-
toggleTheme = _a.toggleTheme;
|
339
|
-
var isDarkMode = theme.colors === darkTheme;
|
340
|
-
return /*#__PURE__*/React.createElement(reactNative.View, {
|
341
|
-
style: styles$6.container
|
342
|
-
}, /*#__PURE__*/React.createElement(reactNative.Text, {
|
343
|
-
style: [styles$6.text, {
|
344
|
-
color: theme.colors.text.hex
|
345
|
-
}]
|
346
|
-
}, "Dark Mode"), /*#__PURE__*/React.createElement(reactNative.Switch, {
|
347
|
-
value: isDarkMode,
|
348
|
-
onValueChange: toggleTheme,
|
349
|
-
trackColor: {
|
350
|
-
"false": lightTheme.secondary.hex,
|
351
|
-
"true": darkTheme.primary.hex
|
352
|
-
},
|
353
|
-
thumbColor: isDarkMode ? darkTheme.secondary.hex : lightTheme.primary.hex
|
354
|
-
}));
|
355
|
-
};
|
356
|
-
var styles$6 = reactNative.StyleSheet.create({
|
357
|
-
container: {
|
358
|
-
marginTop: 20,
|
359
|
-
flexDirection: 'row',
|
360
|
-
alignItems: 'center'
|
361
|
-
},
|
362
|
-
text: {
|
363
|
-
marginRight: 10,
|
364
|
-
fontSize: 16
|
365
|
-
}
|
366
|
-
});
|
367
|
-
|
368
90
|
// src/forms/FormContext.tsx
|
369
91
|
var FormContext = /*#__PURE__*/React.createContext(undefined);
|
370
92
|
var useFormContext = function useFormContext() {
|
@@ -420,6 +142,302 @@ var Form = function Form(_a) {
|
|
420
142
|
}, children);
|
421
143
|
};
|
422
144
|
|
145
|
+
var dist = {};
|
146
|
+
|
147
|
+
/*! aport-themes v1.0.1 | ISC */
|
148
|
+
|
149
|
+
var hasRequiredDist;
|
150
|
+
|
151
|
+
function requireDist () {
|
152
|
+
if (hasRequiredDist) return dist;
|
153
|
+
hasRequiredDist = 1;
|
154
|
+
|
155
|
+
var React$1 = React;
|
156
|
+
var reactNative = require$$1;
|
157
|
+
|
158
|
+
// src/styles/colors.ts
|
159
|
+
var lightTheme = {
|
160
|
+
primary: {
|
161
|
+
hex: "#1A73E8",
|
162
|
+
rgb: {
|
163
|
+
r: 26,
|
164
|
+
g: 115,
|
165
|
+
b: 232
|
166
|
+
}
|
167
|
+
},
|
168
|
+
secondary: {
|
169
|
+
hex: "#F0F6FF",
|
170
|
+
rgb: {
|
171
|
+
r: 240,
|
172
|
+
g: 246,
|
173
|
+
b: 255
|
174
|
+
}
|
175
|
+
},
|
176
|
+
background: {
|
177
|
+
hex: "#FFFFFF",
|
178
|
+
rgb: {
|
179
|
+
r: 255,
|
180
|
+
g: 255,
|
181
|
+
b: 255
|
182
|
+
}
|
183
|
+
},
|
184
|
+
text: {
|
185
|
+
hex: "#000000",
|
186
|
+
rgb: {
|
187
|
+
r: 0,
|
188
|
+
g: 0,
|
189
|
+
b: 0
|
190
|
+
}
|
191
|
+
},
|
192
|
+
textButton: {
|
193
|
+
hex: "#FFFFFF",
|
194
|
+
rgb: {
|
195
|
+
r: 255,
|
196
|
+
g: 255,
|
197
|
+
b: 255
|
198
|
+
}
|
199
|
+
},
|
200
|
+
error: {
|
201
|
+
hex: "#FF5252",
|
202
|
+
rgb: {
|
203
|
+
r: 255,
|
204
|
+
g: 82,
|
205
|
+
b: 82
|
206
|
+
}
|
207
|
+
},
|
208
|
+
success: {
|
209
|
+
hex: "#4CAF50",
|
210
|
+
rgb: {
|
211
|
+
r: 76,
|
212
|
+
g: 175,
|
213
|
+
b: 80
|
214
|
+
}
|
215
|
+
},
|
216
|
+
warning: {
|
217
|
+
hex: "#FFC107",
|
218
|
+
rgb: {
|
219
|
+
r: 255,
|
220
|
+
g: 193,
|
221
|
+
b: 7
|
222
|
+
}
|
223
|
+
},
|
224
|
+
body: {
|
225
|
+
hex: '#F5F5F5',
|
226
|
+
rgb: {
|
227
|
+
r: 245,
|
228
|
+
g: 245,
|
229
|
+
b: 245
|
230
|
+
}
|
231
|
+
},
|
232
|
+
placeHolder: {
|
233
|
+
hex: '#A8A8A8',
|
234
|
+
rgb: {
|
235
|
+
r: 168,
|
236
|
+
g: 168,
|
237
|
+
b: 168
|
238
|
+
}
|
239
|
+
}
|
240
|
+
};
|
241
|
+
var darkTheme = {
|
242
|
+
primary: {
|
243
|
+
hex: "#BB86FC",
|
244
|
+
rgb: {
|
245
|
+
r: 187,
|
246
|
+
g: 134,
|
247
|
+
b: 252
|
248
|
+
}
|
249
|
+
},
|
250
|
+
secondary: {
|
251
|
+
hex: "#03DAC6",
|
252
|
+
rgb: {
|
253
|
+
r: 3,
|
254
|
+
g: 218,
|
255
|
+
b: 198
|
256
|
+
}
|
257
|
+
},
|
258
|
+
background: {
|
259
|
+
hex: "#121212",
|
260
|
+
rgb: {
|
261
|
+
r: 18,
|
262
|
+
g: 18,
|
263
|
+
b: 18
|
264
|
+
}
|
265
|
+
},
|
266
|
+
text: {
|
267
|
+
hex: "#FFFFFF",
|
268
|
+
rgb: {
|
269
|
+
r: 255,
|
270
|
+
g: 255,
|
271
|
+
b: 255
|
272
|
+
}
|
273
|
+
},
|
274
|
+
textButton: {
|
275
|
+
hex: "#FFFFFF",
|
276
|
+
rgb: {
|
277
|
+
r: 255,
|
278
|
+
g: 255,
|
279
|
+
b: 255
|
280
|
+
}
|
281
|
+
},
|
282
|
+
error: {
|
283
|
+
hex: "#CF6679",
|
284
|
+
rgb: {
|
285
|
+
r: 207,
|
286
|
+
g: 102,
|
287
|
+
b: 121
|
288
|
+
}
|
289
|
+
},
|
290
|
+
success: {
|
291
|
+
hex: "#03DAC6",
|
292
|
+
rgb: {
|
293
|
+
r: 3,
|
294
|
+
g: 218,
|
295
|
+
b: 198
|
296
|
+
}
|
297
|
+
},
|
298
|
+
warning: {
|
299
|
+
hex: "#FFB74D",
|
300
|
+
rgb: {
|
301
|
+
r: 255,
|
302
|
+
g: 183,
|
303
|
+
b: 77
|
304
|
+
}
|
305
|
+
},
|
306
|
+
body: {
|
307
|
+
hex: '#1C1C1E',
|
308
|
+
rgb: {
|
309
|
+
r: 28,
|
310
|
+
g: 28,
|
311
|
+
b: 30
|
312
|
+
}
|
313
|
+
},
|
314
|
+
placeHolder: {
|
315
|
+
hex: '#6C6C6E',
|
316
|
+
rgb: {
|
317
|
+
r: 108,
|
318
|
+
g: 108,
|
319
|
+
b: 110
|
320
|
+
}
|
321
|
+
}
|
322
|
+
};
|
323
|
+
|
324
|
+
// Utility to detect if running on React Native
|
325
|
+
var isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
326
|
+
// Platform-specific imports
|
327
|
+
var Appearance = isReactNative ? require$$1.Appearance : null;
|
328
|
+
/**
|
329
|
+
* React context for managing theme-related data and functions.
|
330
|
+
*/
|
331
|
+
var ThemeContext = /*#__PURE__*/React$1.createContext({
|
332
|
+
theme: {
|
333
|
+
colors: lightTheme
|
334
|
+
},
|
335
|
+
toggleTheme: function toggleTheme() {}
|
336
|
+
});
|
337
|
+
/**
|
338
|
+
* ThemeProvider component that manages and provides theme data to its children.
|
339
|
+
*
|
340
|
+
* @param children - The child components that will consume the theme context.
|
341
|
+
* @param initialTheme - Optional prop to set the initial theme.
|
342
|
+
*/
|
343
|
+
var ThemeProvider = function ThemeProvider(_a) {
|
344
|
+
var children = _a.children,
|
345
|
+
initialTheme = _a.initialTheme;
|
346
|
+
var _b = React$1.useState(initialTheme || null),
|
347
|
+
colorScheme = _b[0],
|
348
|
+
setColorScheme = _b[1];
|
349
|
+
React$1.useEffect(function () {
|
350
|
+
var loadTheme = function loadTheme() {
|
351
|
+
if (initialTheme) {
|
352
|
+
setColorScheme(initialTheme);
|
353
|
+
} else {
|
354
|
+
if (isReactNative) {
|
355
|
+
var systemTheme = Appearance.getColorScheme();
|
356
|
+
setColorScheme(systemTheme);
|
357
|
+
} else {
|
358
|
+
var systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
359
|
+
setColorScheme(systemTheme);
|
360
|
+
}
|
361
|
+
}
|
362
|
+
};
|
363
|
+
loadTheme();
|
364
|
+
if (isReactNative) {
|
365
|
+
var subscription_1 = Appearance.addChangeListener(function (_a) {
|
366
|
+
var colorScheme = _a.colorScheme;
|
367
|
+
setColorScheme(colorScheme);
|
368
|
+
});
|
369
|
+
return function () {
|
370
|
+
return subscription_1.remove();
|
371
|
+
};
|
372
|
+
} else {
|
373
|
+
var mediaQuery_1 = window.matchMedia('(prefers-color-scheme: dark)');
|
374
|
+
var mediaChangeHandler_1 = function mediaChangeHandler_1(e) {
|
375
|
+
setColorScheme(e.matches ? 'dark' : 'light');
|
376
|
+
};
|
377
|
+
mediaQuery_1.addEventListener('change', mediaChangeHandler_1);
|
378
|
+
return function () {
|
379
|
+
return mediaQuery_1.removeEventListener('change', mediaChangeHandler_1);
|
380
|
+
};
|
381
|
+
}
|
382
|
+
}, [initialTheme]);
|
383
|
+
var toggleTheme = function toggleTheme() {
|
384
|
+
setColorScheme(function (prevScheme) {
|
385
|
+
return prevScheme === 'dark' ? 'light' : 'dark';
|
386
|
+
});
|
387
|
+
};
|
388
|
+
var theme = {
|
389
|
+
colors: colorScheme === 'dark' ? darkTheme : lightTheme
|
390
|
+
};
|
391
|
+
return /*#__PURE__*/React$1.createElement(ThemeContext.Provider, {
|
392
|
+
value: {
|
393
|
+
theme: theme,
|
394
|
+
toggleTheme: toggleTheme
|
395
|
+
}
|
396
|
+
}, children);
|
397
|
+
};
|
398
|
+
|
399
|
+
var ThemeToggle = function ThemeToggle() {
|
400
|
+
var _a = React$1.useContext(ThemeContext),
|
401
|
+
theme = _a.theme,
|
402
|
+
toggleTheme = _a.toggleTheme;
|
403
|
+
var isDarkMode = theme.colors === darkTheme;
|
404
|
+
return /*#__PURE__*/React$1.createElement(reactNative.View, {
|
405
|
+
style: styles.container
|
406
|
+
}, /*#__PURE__*/React$1.createElement(reactNative.Text, {
|
407
|
+
style: [styles.text, {
|
408
|
+
color: theme.colors.text.hex
|
409
|
+
}]
|
410
|
+
}, "Dark Mode"), /*#__PURE__*/React$1.createElement(reactNative.Switch, {
|
411
|
+
value: isDarkMode,
|
412
|
+
onValueChange: toggleTheme,
|
413
|
+
trackColor: {
|
414
|
+
"false": lightTheme.secondary.hex,
|
415
|
+
"true": darkTheme.primary.hex
|
416
|
+
},
|
417
|
+
thumbColor: isDarkMode ? darkTheme.secondary.hex : lightTheme.primary.hex
|
418
|
+
}));
|
419
|
+
};
|
420
|
+
var styles = reactNative.StyleSheet.create({
|
421
|
+
container: {
|
422
|
+
marginTop: 20,
|
423
|
+
flexDirection: 'row',
|
424
|
+
alignItems: 'center'
|
425
|
+
},
|
426
|
+
text: {
|
427
|
+
marginRight: 10,
|
428
|
+
fontSize: 16
|
429
|
+
}
|
430
|
+
});
|
431
|
+
|
432
|
+
dist.ThemeContext = ThemeContext;
|
433
|
+
dist.ThemeProvider = ThemeProvider;
|
434
|
+
dist.ThemeToggle = ThemeToggle;
|
435
|
+
|
436
|
+
return dist;
|
437
|
+
}
|
438
|
+
|
439
|
+
var distExports = requireDist();
|
440
|
+
|
423
441
|
// src/fonts/Text.tsx
|
424
442
|
/**
|
425
443
|
* A dynamic Text component that supports HTML-like formatting.
|
@@ -452,7 +470,7 @@ var Text = function Text(_a) {
|
|
452
470
|
_j = _a.h,
|
453
471
|
h = _j === void 0 ? 0 : _j,
|
454
472
|
style = _a.style;
|
455
|
-
var theme = React.useContext(ThemeContext).theme;
|
473
|
+
var theme = React.useContext(distExports.ThemeContext).theme;
|
456
474
|
var colors = theme.colors;
|
457
475
|
// Calculate header size based on 'h' prop
|
458
476
|
var fontSize = size;
|
@@ -476,23 +494,23 @@ var Text = function Text(_a) {
|
|
476
494
|
textAlign: textAlign,
|
477
495
|
color: textColor
|
478
496
|
};
|
479
|
-
return /*#__PURE__*/React.createElement(
|
497
|
+
return /*#__PURE__*/React.createElement(require$$1.Text, {
|
480
498
|
style: [textStyles, style]
|
481
499
|
}, children);
|
482
500
|
};
|
483
|
-
|
501
|
+
require$$1.StyleSheet.create({
|
484
502
|
// Define any default styles if needed
|
485
503
|
});
|
486
504
|
|
487
505
|
// src/forms/ErrorList.tsx
|
488
506
|
var ErrorList = function ErrorList(_a) {
|
489
507
|
var errors = _a.errors;
|
490
|
-
var theme = React.useContext(ThemeContext).theme;
|
508
|
+
var theme = React.useContext(distExports.ThemeContext).theme;
|
491
509
|
var colors = theme.colors;
|
492
|
-
return /*#__PURE__*/React.createElement(
|
510
|
+
return /*#__PURE__*/React.createElement(require$$1.View, {
|
493
511
|
style: styles$5.container
|
494
512
|
}, errors.map(function (error, index) {
|
495
|
-
return /*#__PURE__*/React.createElement(
|
513
|
+
return /*#__PURE__*/React.createElement(require$$1.View, {
|
496
514
|
key: index,
|
497
515
|
style: styles$5.errorItem
|
498
516
|
}, /*#__PURE__*/React.createElement(Text, {
|
@@ -506,7 +524,7 @@ var ErrorList = function ErrorList(_a) {
|
|
506
524
|
}, error));
|
507
525
|
}));
|
508
526
|
};
|
509
|
-
var styles$5 =
|
527
|
+
var styles$5 = require$$1.StyleSheet.create({
|
510
528
|
container: {
|
511
529
|
marginTop: 4
|
512
530
|
},
|
@@ -550,7 +568,7 @@ var Input = function Input(_a) {
|
|
550
568
|
formValues = _b.formValues,
|
551
569
|
setFormValue = _b.setFormValue,
|
552
570
|
formErrors = _b.errors;
|
553
|
-
var theme = React.useContext(ThemeContext).theme;
|
571
|
+
var theme = React.useContext(distExports.ThemeContext).theme;
|
554
572
|
var colors = theme.colors;
|
555
573
|
/**
|
556
574
|
* Handles text changes in the input field, applying formatting based on the inputType.
|
@@ -583,13 +601,13 @@ var Input = function Input(_a) {
|
|
583
601
|
}
|
584
602
|
setFormValue(name, formattedText);
|
585
603
|
};
|
586
|
-
return /*#__PURE__*/React.createElement(
|
604
|
+
return /*#__PURE__*/React.createElement(require$$1.View, {
|
587
605
|
style: styles$4.container
|
588
606
|
}, /*#__PURE__*/React.createElement(Text, {
|
589
607
|
style: [styles$4.label, {
|
590
608
|
color: colors.text.hex
|
591
609
|
}]
|
592
|
-
}, label), /*#__PURE__*/React.createElement(
|
610
|
+
}, label), /*#__PURE__*/React.createElement(require$$1.TextInput, __assign({
|
593
611
|
style: [styles$4.input, {
|
594
612
|
backgroundColor: colors.body.hex,
|
595
613
|
borderColor: formErrors[name] ? colors.error.hex : "#CCC",
|
@@ -598,12 +616,12 @@ var Input = function Input(_a) {
|
|
598
616
|
value: formValues[name] || "",
|
599
617
|
onChangeText: handleChange,
|
600
618
|
placeholder: label,
|
601
|
-
placeholderTextColor: colors.
|
619
|
+
placeholderTextColor: colors.placeHolder.hex
|
602
620
|
}, rest)), formErrors[name] && formErrors[name].length > 0 && (/*#__PURE__*/React.createElement(ErrorList, {
|
603
621
|
errors: formErrors[name]
|
604
622
|
})));
|
605
623
|
};
|
606
|
-
var styles$4 =
|
624
|
+
var styles$4 = require$$1.StyleSheet.create({
|
607
625
|
container: {
|
608
626
|
marginBottom: 16
|
609
627
|
},
|
@@ -633,11 +651,11 @@ var TextArea = function TextArea(_a) {
|
|
633
651
|
var handleChange = function handleChange(text) {
|
634
652
|
setFormValue(name, text);
|
635
653
|
};
|
636
|
-
return /*#__PURE__*/React.createElement(
|
654
|
+
return /*#__PURE__*/React.createElement(require$$1.View, {
|
637
655
|
style: styles$3.container
|
638
656
|
}, /*#__PURE__*/React.createElement(Text, {
|
639
657
|
style: styles$3.label
|
640
|
-
}, label), /*#__PURE__*/React.createElement(
|
658
|
+
}, label), /*#__PURE__*/React.createElement(require$$1.TextInput, __assign({
|
641
659
|
style: [styles$3.textArea, style],
|
642
660
|
value: formValues[name] || '',
|
643
661
|
onChangeText: handleChange,
|
@@ -651,7 +669,7 @@ var TextArea = function TextArea(_a) {
|
|
651
669
|
errors: formErrors[name]
|
652
670
|
})));
|
653
671
|
};
|
654
|
-
var styles$3 =
|
672
|
+
var styles$3 = require$$1.StyleSheet.create({
|
655
673
|
container: {
|
656
674
|
marginBottom: 16
|
657
675
|
},
|
@@ -677,7 +695,7 @@ var styles$3 = reactNative.StyleSheet.create({
|
|
677
695
|
var Label = function Label(_a) {
|
678
696
|
var text = _a.text,
|
679
697
|
style = _a.style;
|
680
|
-
var theme = React.useContext(ThemeContext).theme;
|
698
|
+
var theme = React.useContext(distExports.ThemeContext).theme;
|
681
699
|
var colors = theme.colors;
|
682
700
|
return /*#__PURE__*/React.createElement(Text, {
|
683
701
|
style: [styles$2.label, style, {
|
@@ -685,7 +703,7 @@ var Label = function Label(_a) {
|
|
685
703
|
}]
|
686
704
|
}, text);
|
687
705
|
};
|
688
|
-
var styles$2 =
|
706
|
+
var styles$2 = require$$1.StyleSheet.create({
|
689
707
|
label: {
|
690
708
|
marginBottom: 4,
|
691
709
|
fontWeight: '500'
|
@@ -752,18 +770,20 @@ var Button = function Button(_a) {
|
|
752
770
|
_g = _a.loading,
|
753
771
|
loading = _g === void 0 ? false : _g,
|
754
772
|
onPress = _a.onPress;
|
755
|
-
var theme = React.useContext(ThemeContext).theme;
|
773
|
+
var theme = React.useContext(distExports.ThemeContext).theme;
|
756
774
|
var colors = theme.colors;
|
757
775
|
var handleSubmit = useFormContext().handleSubmit;
|
758
776
|
var computedStyles = React.useMemo(function () {
|
759
|
-
return
|
777
|
+
return require$$1.StyleSheet.flatten([styles$1.button, typeStyles(type, disabled, colors), rounded && {
|
760
778
|
borderRadius: borderRadius
|
761
779
|
}, isFullWidth && {
|
762
780
|
width: '100%'
|
763
781
|
}, (disabled || loading) && styles$1.disabled]);
|
764
782
|
}, [type, disabled, loading, rounded, borderRadius, isFullWidth, colors]);
|
765
783
|
var textColor = React.useMemo(function () {
|
766
|
-
return {
|
784
|
+
return type === "cancel" ? {
|
785
|
+
color: colors.text.hex
|
786
|
+
} : {
|
767
787
|
color: colors.textButton.hex
|
768
788
|
};
|
769
789
|
}, [type, colors]);
|
@@ -774,7 +794,7 @@ var Button = function Button(_a) {
|
|
774
794
|
onPress(); // Call a custom handler if needed
|
775
795
|
}
|
776
796
|
};
|
777
|
-
return /*#__PURE__*/React.createElement(
|
797
|
+
return /*#__PURE__*/React.createElement(require$$1.TouchableOpacity, {
|
778
798
|
style: computedStyles,
|
779
799
|
disabled: disabled || loading,
|
780
800
|
onPress: handlePress,
|
@@ -782,14 +802,14 @@ var Button = function Button(_a) {
|
|
782
802
|
}, loading ? (
|
783
803
|
/*#__PURE__*/
|
784
804
|
// Show loading spinner if loading
|
785
|
-
React.createElement(
|
805
|
+
React.createElement(require$$1.ActivityIndicator, {
|
786
806
|
size: "small",
|
787
807
|
color: colors.textButton.hex
|
788
|
-
})) : (/*#__PURE__*/React.createElement(
|
808
|
+
})) : (/*#__PURE__*/React.createElement(require$$1.Text, {
|
789
809
|
style: textColor
|
790
810
|
}, Array.isArray(children) ? children.join('').toUpperCase() : children === null || children === void 0 ? void 0 : children.toUpperCase())));
|
791
811
|
};
|
792
|
-
var styles$1 =
|
812
|
+
var styles$1 = require$$1.StyleSheet.create({
|
793
813
|
button: {
|
794
814
|
justifyContent: 'center',
|
795
815
|
alignItems: 'center',
|
@@ -826,11 +846,11 @@ var Card = function Card(_a) {
|
|
826
846
|
elevation = _d === void 0 ? 4 : _d,
|
827
847
|
_e = _a.shadowProps,
|
828
848
|
shadowProps = _e === void 0 ? {} : _e;
|
829
|
-
var theme = React.useContext(ThemeContext).theme;
|
849
|
+
var theme = React.useContext(distExports.ThemeContext).theme;
|
830
850
|
var colors = theme.colors;
|
831
851
|
// Animation state for pressable effect
|
832
852
|
// Default shadow styles (improved platform-specific handling)
|
833
|
-
var defaultShadow =
|
853
|
+
var defaultShadow = require$$1.Platform.select({
|
834
854
|
ios: {
|
835
855
|
shadowColor: (shadowProps === null || shadowProps === void 0 ? void 0 : shadowProps.shadowColor) || colors.text.hex,
|
836
856
|
// Defaulting to theme text color
|
@@ -847,20 +867,20 @@ var Card = function Card(_a) {
|
|
847
867
|
});
|
848
868
|
var cardStyles = [styles.container, {
|
849
869
|
borderRadius: borderRadius,
|
850
|
-
backgroundColor: colors.
|
870
|
+
backgroundColor: colors.background.hex
|
851
871
|
}, defaultShadow,
|
852
872
|
// Dynamic shadows based on platform
|
853
873
|
style // External styles
|
854
874
|
];
|
855
|
-
return pressable ? (/*#__PURE__*/React.createElement(
|
875
|
+
return pressable ? (/*#__PURE__*/React.createElement(require$$1.TouchableOpacity, {
|
856
876
|
activeOpacity: 0.8,
|
857
877
|
onPress: onPress,
|
858
878
|
style: cardStyles
|
859
|
-
}, children)) : (/*#__PURE__*/React.createElement(
|
879
|
+
}, children)) : (/*#__PURE__*/React.createElement(require$$1.View, {
|
860
880
|
style: cardStyles
|
861
881
|
}, children));
|
862
882
|
};
|
863
|
-
var styles =
|
883
|
+
var styles = require$$1.StyleSheet.create({
|
864
884
|
container: {
|
865
885
|
padding: 16,
|
866
886
|
borderRadius: 12
|
@@ -876,8 +896,5 @@ exports.Input = Input;
|
|
876
896
|
exports.Label = Label;
|
877
897
|
exports.Text = Text;
|
878
898
|
exports.TextArea = TextArea;
|
879
|
-
exports.ThemeContext = ThemeContext;
|
880
|
-
exports.ThemeProvider = ThemeProvider;
|
881
|
-
exports.ThemeToggle = ThemeToggle;
|
882
899
|
exports.useFormContext = useFormContext;
|
883
900
|
//# sourceMappingURL=index.js.map
|