aport-tools 4.0.33 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1,387 +1,74 @@
1
- /*! aport-tools v4.0.33 | ISC */
1
+ /*! aport-tools v4.1.0 | ISC */
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
5
5
  var reactNative = require('react-native');
6
6
  var asyncStorage = require('@react-native-async-storage/async-storage');
7
- var Animated = require('react-native-reanimated');
8
7
 
9
- function _arrayLikeToArray(r, a) {
10
- (null == a || a > r.length) && (a = r.length);
11
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
12
- return n;
13
- }
14
- function _arrayWithHoles(r) {
15
- if (Array.isArray(r)) return r;
16
- }
17
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
18
- try {
19
- var i = n[a](c),
20
- u = i.value;
21
- } catch (n) {
22
- return void e(n);
23
- }
24
- i.done ? t(u) : Promise.resolve(u).then(r, o);
25
- }
26
- function _asyncToGenerator(n) {
27
- return function () {
28
- var t = this,
29
- e = arguments;
30
- return new Promise(function (r, o) {
31
- var a = n.apply(t, e);
32
- function _next(n) {
33
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
34
- }
35
- function _throw(n) {
36
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
37
- }
38
- _next(void 0);
39
- });
40
- };
41
- }
42
- function _iterableToArrayLimit(r, l) {
43
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
44
- if (null != t) {
45
- var e,
46
- n,
47
- i,
48
- u,
49
- a = [],
50
- f = !0,
51
- o = !1;
52
- try {
53
- if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
54
- } catch (r) {
55
- o = !0, n = r;
56
- } finally {
57
- try {
58
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
59
- } finally {
60
- if (o) throw n;
61
- }
62
- }
63
- return a;
64
- }
65
- }
66
- function _nonIterableRest() {
67
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
68
- }
69
- function _regeneratorRuntime() {
70
- _regeneratorRuntime = function () {
71
- return e;
72
- };
73
- var t,
74
- e = {},
75
- r = Object.prototype,
76
- n = r.hasOwnProperty,
77
- o = Object.defineProperty || function (t, e, r) {
78
- t[e] = r.value;
79
- },
80
- i = "function" == typeof Symbol ? Symbol : {},
81
- a = i.iterator || "@@iterator",
82
- c = i.asyncIterator || "@@asyncIterator",
83
- u = i.toStringTag || "@@toStringTag";
84
- function define(t, e, r) {
85
- return Object.defineProperty(t, e, {
86
- value: r,
87
- enumerable: !0,
88
- configurable: !0,
89
- writable: !0
90
- }), t[e];
91
- }
92
- try {
93
- define({}, "");
94
- } catch (t) {
95
- define = function (t, e, r) {
96
- return t[e] = r;
97
- };
98
- }
99
- function wrap(t, e, r, n) {
100
- var i = e && e.prototype instanceof Generator ? e : Generator,
101
- a = Object.create(i.prototype),
102
- c = new Context(n || []);
103
- return o(a, "_invoke", {
104
- value: makeInvokeMethod(t, r, c)
105
- }), a;
106
- }
107
- function tryCatch(t, e, r) {
108
- try {
109
- return {
110
- type: "normal",
111
- arg: t.call(e, r)
112
- };
113
- } catch (t) {
114
- return {
115
- type: "throw",
116
- arg: t
117
- };
118
- }
119
- }
120
- e.wrap = wrap;
121
- var h = "suspendedStart",
122
- l = "suspendedYield",
123
- f = "executing",
124
- s = "completed",
125
- y = {};
126
- function Generator() {}
127
- function GeneratorFunction() {}
128
- function GeneratorFunctionPrototype() {}
129
- var p = {};
130
- define(p, a, function () {
131
- return this;
132
- });
133
- var d = Object.getPrototypeOf,
134
- v = d && d(d(values([])));
135
- v && v !== r && n.call(v, a) && (p = v);
136
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
137
- function defineIteratorMethods(t) {
138
- ["next", "throw", "return"].forEach(function (e) {
139
- define(t, e, function (t) {
140
- return this._invoke(e, t);
141
- });
142
- });
143
- }
144
- function AsyncIterator(t, e) {
145
- function invoke(r, o, i, a) {
146
- var c = tryCatch(t[r], t, o);
147
- if ("throw" !== c.type) {
148
- var u = c.arg,
149
- h = u.value;
150
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
151
- invoke("next", t, i, a);
152
- }, function (t) {
153
- invoke("throw", t, i, a);
154
- }) : e.resolve(h).then(function (t) {
155
- u.value = t, i(u);
156
- }, function (t) {
157
- return invoke("throw", t, i, a);
158
- });
159
- }
160
- a(c.arg);
161
- }
162
- var r;
163
- o(this, "_invoke", {
164
- value: function (t, n) {
165
- function callInvokeWithMethodAndArg() {
166
- return new e(function (e, r) {
167
- invoke(t, n, e, r);
168
- });
169
- }
170
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
171
- }
172
- });
173
- }
174
- function makeInvokeMethod(e, r, n) {
175
- var o = h;
176
- return function (i, a) {
177
- if (o === f) throw Error("Generator is already running");
178
- if (o === s) {
179
- if ("throw" === i) throw a;
180
- return {
181
- value: t,
182
- done: !0
183
- };
184
- }
185
- for (n.method = i, n.arg = a;;) {
186
- var c = n.delegate;
187
- if (c) {
188
- var u = maybeInvokeDelegate(c, n);
189
- if (u) {
190
- if (u === y) continue;
191
- return u;
192
- }
193
- }
194
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
195
- if (o === h) throw o = s, n.arg;
196
- n.dispatchException(n.arg);
197
- } else "return" === n.method && n.abrupt("return", n.arg);
198
- o = f;
199
- var p = tryCatch(e, r, n);
200
- if ("normal" === p.type) {
201
- if (o = n.done ? s : l, p.arg === y) continue;
202
- return {
203
- value: p.arg,
204
- done: n.done
205
- };
206
- }
207
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
208
- }
209
- };
210
- }
211
- function maybeInvokeDelegate(e, r) {
212
- var n = r.method,
213
- o = e.iterator[n];
214
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
215
- var i = tryCatch(o, e.iterator, r.arg);
216
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
217
- var a = i.arg;
218
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
219
- }
220
- function pushTryEntry(t) {
221
- var e = {
222
- tryLoc: t[0]
223
- };
224
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
225
- }
226
- function resetTryEntry(t) {
227
- var e = t.completion || {};
228
- e.type = "normal", delete e.arg, t.completion = e;
229
- }
230
- function Context(t) {
231
- this.tryEntries = [{
232
- tryLoc: "root"
233
- }], t.forEach(pushTryEntry, this), this.reset(!0);
234
- }
235
- function values(e) {
236
- if (e || "" === e) {
237
- var r = e[a];
238
- if (r) return r.call(e);
239
- if ("function" == typeof e.next) return e;
240
- if (!isNaN(e.length)) {
241
- var o = -1,
242
- i = function next() {
243
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
244
- return next.value = t, next.done = !0, next;
245
- };
246
- return i.next = i;
247
- }
248
- }
249
- throw new TypeError(typeof e + " is not iterable");
250
- }
251
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
252
- value: GeneratorFunctionPrototype,
253
- configurable: !0
254
- }), o(GeneratorFunctionPrototype, "constructor", {
255
- value: GeneratorFunction,
256
- configurable: !0
257
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
258
- var e = "function" == typeof t && t.constructor;
259
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
260
- }, e.mark = function (t) {
261
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
262
- }, e.awrap = function (t) {
263
- return {
264
- __await: t
265
- };
266
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
267
- return this;
268
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
269
- void 0 === i && (i = Promise);
270
- var a = new AsyncIterator(wrap(t, r, n, o), i);
271
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
272
- return t.done ? t.value : a.next();
273
- });
274
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
275
- return this;
276
- }), define(g, "toString", function () {
277
- return "[object Generator]";
278
- }), e.keys = function (t) {
279
- var e = Object(t),
280
- r = [];
281
- for (var n in e) r.push(n);
282
- return r.reverse(), function next() {
283
- for (; r.length;) {
284
- var t = r.pop();
285
- if (t in e) return next.value = t, next.done = !1, next;
286
- }
287
- return next.done = !0, next;
288
- };
289
- }, e.values = values, Context.prototype = {
290
- constructor: Context,
291
- reset: function (e) {
292
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
293
- },
294
- stop: function () {
295
- this.done = !0;
296
- var t = this.tryEntries[0].completion;
297
- if ("throw" === t.type) throw t.arg;
298
- return this.rval;
299
- },
300
- dispatchException: function (e) {
301
- if (this.done) throw e;
302
- var r = this;
303
- function handle(n, o) {
304
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
305
- }
306
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
307
- var i = this.tryEntries[o],
308
- a = i.completion;
309
- if ("root" === i.tryLoc) return handle("end");
310
- if (i.tryLoc <= this.prev) {
311
- var c = n.call(i, "catchLoc"),
312
- u = n.call(i, "finallyLoc");
313
- if (c && u) {
314
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
315
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
316
- } else if (c) {
317
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
318
- } else {
319
- if (!u) throw Error("try statement without catch or finally");
320
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
321
- }
322
- }
323
- }
324
- },
325
- abrupt: function (t, e) {
326
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
327
- var o = this.tryEntries[r];
328
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
329
- var i = o;
330
- break;
331
- }
332
- }
333
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
334
- var a = i ? i.completion : {};
335
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
336
- },
337
- complete: function (t, e) {
338
- if ("throw" === t.type) throw t.arg;
339
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
340
- },
341
- finish: function (t) {
342
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
343
- var r = this.tryEntries[e];
344
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
345
- }
346
- },
347
- catch: function (t) {
348
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
349
- var r = this.tryEntries[e];
350
- if (r.tryLoc === t) {
351
- var n = r.completion;
352
- if ("throw" === n.type) {
353
- var o = n.arg;
354
- resetTryEntry(r);
355
- }
356
- return o;
357
- }
358
- }
359
- throw Error("illegal catch attempt");
360
- },
361
- delegateYield: function (e, r, n) {
362
- return this.delegate = {
363
- iterator: values(e),
364
- resultName: r,
365
- nextLoc: n
366
- }, "next" === this.method && (this.arg = t), y;
367
- }
368
- }, e;
369
- }
370
- function _slicedToArray(r, e) {
371
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
372
- }
373
- function _unsupportedIterableToArray(r, a) {
374
- if (r) {
375
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
376
- var t = {}.toString.call(r).slice(8, -1);
377
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
378
- }
379
- }
8
+ /******************************************************************************
9
+ Copyright (c) Microsoft Corporation.
10
+
11
+ Permission to use, copy, modify, and/or distribute this software for any
12
+ purpose with or without fee is hereby granted.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ PERFORMANCE OF THIS SOFTWARE.
21
+ ***************************************************************************** */
22
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
23
+
24
+
25
+ function __awaiter(thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ }
34
+
35
+ function __generator(thisArg, body) {
36
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
37
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38
+ function verb(n) { return function (v) { return step([n, v]); }; }
39
+ function step(op) {
40
+ if (f) throw new TypeError("Generator is already executing.");
41
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
42
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
43
+ if (y = 0, t) op = [op[0] & 2, t.value];
44
+ switch (op[0]) {
45
+ case 0: case 1: t = op; break;
46
+ case 4: _.label++; return { value: op[1], done: false };
47
+ case 5: _.label++; y = op[1]; op = [0]; continue;
48
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
49
+ default:
50
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
51
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
52
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
53
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
54
+ if (t[2]) _.ops.pop();
55
+ _.trys.pop(); continue;
56
+ }
57
+ op = body.call(thisArg, _);
58
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60
+ }
61
+ }
62
+
63
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
64
+ var e = new Error(message);
65
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
66
+ };
380
67
 
381
68
  // src/styles/colors.ts
382
69
  var lightTheme = {
383
70
  primary: {
384
- hex: '#1A73E8',
71
+ hex: "#1A73E8",
385
72
  rgb: {
386
73
  r: 26,
387
74
  g: 115,
@@ -389,7 +76,7 @@ var lightTheme = {
389
76
  }
390
77
  },
391
78
  secondary: {
392
- hex: '#F0F6FF',
79
+ hex: "#F0F6FF",
393
80
  rgb: {
394
81
  r: 240,
395
82
  g: 246,
@@ -397,7 +84,7 @@ var lightTheme = {
397
84
  }
398
85
  },
399
86
  background: {
400
- hex: '#FFFFFF',
87
+ hex: "#FFFFFF",
401
88
  rgb: {
402
89
  r: 255,
403
90
  g: 255,
@@ -405,7 +92,7 @@ var lightTheme = {
405
92
  }
406
93
  },
407
94
  text: {
408
- hex: '#000000',
95
+ hex: "#000000",
409
96
  rgb: {
410
97
  r: 0,
411
98
  g: 0,
@@ -413,6 +100,39 @@ var lightTheme = {
413
100
  }
414
101
  },
415
102
  textButton: {
103
+ hex: "#FFFFFF",
104
+ rgb: {
105
+ r: 255,
106
+ g: 255,
107
+ b: 255
108
+ }
109
+ },
110
+ error: {
111
+ hex: "#FF5252",
112
+ rgb: {
113
+ r: 255,
114
+ g: 82,
115
+ b: 82
116
+ }
117
+ },
118
+ success: {
119
+ hex: "#4CAF50",
120
+ rgb: {
121
+ r: 76,
122
+ g: 175,
123
+ b: 80
124
+ }
125
+ },
126
+ warning: {
127
+ hex: "#FFC107",
128
+ rgb: {
129
+ r: 255,
130
+ g: 193,
131
+ b: 7
132
+ }
133
+ },
134
+ body: {
135
+ // Body color is the same as background in the light theme
416
136
  hex: '#FFFFFF',
417
137
  rgb: {
418
138
  r: 255,
@@ -423,7 +143,7 @@ var lightTheme = {
423
143
  };
424
144
  var darkTheme = {
425
145
  primary: {
426
- hex: '#BB86FC',
146
+ hex: "#BB86FC",
427
147
  rgb: {
428
148
  r: 187,
429
149
  g: 134,
@@ -431,7 +151,7 @@ var darkTheme = {
431
151
  }
432
152
  },
433
153
  secondary: {
434
- hex: '#03DAC6',
154
+ hex: "#03DAC6",
435
155
  rgb: {
436
156
  r: 3,
437
157
  g: 218,
@@ -439,7 +159,7 @@ var darkTheme = {
439
159
  }
440
160
  },
441
161
  background: {
442
- hex: '#121212',
162
+ hex: "#121212",
443
163
  rgb: {
444
164
  r: 18,
445
165
  g: 18,
@@ -447,7 +167,7 @@ var darkTheme = {
447
167
  }
448
168
  },
449
169
  text: {
450
- hex: '#FFFFFF',
170
+ hex: "#FFFFFF",
451
171
  rgb: {
452
172
  r: 255,
453
173
  g: 255,
@@ -455,14 +175,45 @@ var darkTheme = {
455
175
  }
456
176
  },
457
177
  textButton: {
458
- hex: '#FFFFFF',
178
+ hex: "#FFFFFF",
459
179
  rgb: {
460
180
  r: 255,
461
181
  g: 255,
462
182
  b: 255
463
183
  }
184
+ },
185
+ error: {
186
+ hex: "#CF6679",
187
+ rgb: {
188
+ r: 207,
189
+ g: 102,
190
+ b: 121
191
+ }
192
+ },
193
+ success: {
194
+ hex: "#03DAC6",
195
+ rgb: {
196
+ r: 3,
197
+ g: 218,
198
+ b: 198
199
+ }
200
+ },
201
+ warning: {
202
+ hex: "#FFB74D",
203
+ rgb: {
204
+ r: 255,
205
+ g: 183,
206
+ b: 77
207
+ }
208
+ },
209
+ body: {
210
+ hex: '#1C1C1E',
211
+ rgb: {
212
+ r: 28,
213
+ g: 28,
214
+ b: 30
215
+ }
464
216
  }
465
- // Add more categories as needed
466
217
  };
467
218
 
468
219
  /**
@@ -480,52 +231,43 @@ var ThemeContext = /*#__PURE__*/React.createContext({
480
231
  * @param children - The child components that will consume the theme context.
481
232
  * @param initialTheme - Optional prop to set the initial theme.
482
233
  */
483
- var ThemeProvider = function ThemeProvider(_ref) {
484
- var children = _ref.children,
485
- initialTheme = _ref.initialTheme;
486
- var _useState = React.useState(null),
487
- _useState2 = _slicedToArray(_useState, 2),
488
- colorScheme = _useState2[0],
489
- setColorScheme = _useState2[1];
234
+ var ThemeProvider = function ThemeProvider(_a) {
235
+ var children = _a.children,
236
+ initialTheme = _a.initialTheme;
237
+ var _b = React.useState(null),
238
+ colorScheme = _b[0],
239
+ setColorScheme = _b[1];
490
240
  // Use useAsyncStorage hook for managing the theme storage
491
- var _useAsyncStorage = asyncStorage.useAsyncStorage('theme'),
492
- getItem = _useAsyncStorage.getItem,
493
- setItem = _useAsyncStorage.setItem;
241
+ var _c = asyncStorage.useAsyncStorage('theme'),
242
+ getItem = _c.getItem,
243
+ setItem = _c.setItem;
494
244
  React.useEffect(function () {
495
- var loadTheme = /*#__PURE__*/function () {
496
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
245
+ var loadTheme = function loadTheme() {
246
+ return __awaiter(void 0, void 0, void 0, function () {
497
247
  var systemTheme;
498
- return _regeneratorRuntime().wrap(function _callee$(_context) {
499
- while (1) switch (_context.prev = _context.next) {
500
- case 0:
501
- try {
502
- // const storedTheme = await getItem();
503
- // if (storedTheme === 'dark' || storedTheme === 'light') {
504
- // setColorScheme(storedTheme);
505
- //}
506
- if (initialTheme) {
507
- setColorScheme(initialTheme);
508
- } else {
509
- systemTheme = reactNative.Appearance.getColorScheme();
510
- setColorScheme(systemTheme);
511
- }
512
- } catch (error) {
513
- console.error('Failed to load theme.', error);
514
- setColorScheme(reactNative.Appearance.getColorScheme());
515
- }
516
- case 1:
517
- case "end":
518
- return _context.stop();
248
+ return __generator(this, function (_a) {
249
+ try {
250
+ // const storedTheme = await getItem();
251
+ // if (storedTheme === 'dark' || storedTheme === 'light') {
252
+ // setColorScheme(storedTheme);
253
+ //}
254
+ if (initialTheme) {
255
+ setColorScheme(initialTheme);
256
+ } else {
257
+ systemTheme = reactNative.Appearance.getColorScheme();
258
+ setColorScheme(systemTheme);
259
+ }
260
+ } catch (error) {
261
+ console.error('Failed to load theme.', error);
262
+ setColorScheme(reactNative.Appearance.getColorScheme());
519
263
  }
520
- }, _callee);
521
- }));
522
- return function loadTheme() {
523
- return _ref2.apply(this, arguments);
524
- };
525
- }();
264
+ return [2 /*return*/];
265
+ });
266
+ });
267
+ };
526
268
  loadTheme();
527
- var subscription = reactNative.Appearance.addChangeListener(function (_ref3) {
528
- var colorScheme = _ref3.colorScheme;
269
+ var subscription = reactNative.Appearance.addChangeListener(function (_a) {
270
+ var colorScheme = _a.colorScheme;
529
271
  if (!colorScheme) return; // Prevent setting null
530
272
  setColorScheme(colorScheme);
531
273
  });
@@ -533,34 +275,29 @@ var ThemeProvider = function ThemeProvider(_ref) {
533
275
  return subscription.remove();
534
276
  };
535
277
  }, [initialTheme, getItem]);
536
- var toggleTheme = /*#__PURE__*/function () {
537
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
538
- var newTheme;
539
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
540
- while (1) switch (_context2.prev = _context2.next) {
278
+ var toggleTheme = function toggleTheme() {
279
+ return __awaiter(void 0, void 0, void 0, function () {
280
+ var newTheme, error_1;
281
+ return __generator(this, function (_a) {
282
+ switch (_a.label) {
541
283
  case 0:
542
- _context2.prev = 0;
284
+ _a.trys.push([0, 2,, 3]);
543
285
  newTheme = colorScheme === 'dark' ? 'light' : 'dark';
544
286
  setColorScheme(newTheme);
545
- _context2.next = 5;
546
- return setItem(newTheme);
547
- case 5:
548
- _context2.next = 10;
549
- break;
550
- case 7:
551
- _context2.prev = 7;
552
- _context2.t0 = _context2["catch"](0);
553
- console.error('Failed to toggle theme.', _context2.t0);
554
- case 10:
555
- case "end":
556
- return _context2.stop();
287
+ return [4 /*yield*/, setItem(newTheme)];
288
+ case 1:
289
+ _a.sent(); // Use setItem from useAsyncStorage
290
+ return [3 /*break*/, 3];
291
+ case 2:
292
+ error_1 = _a.sent();
293
+ console.error('Failed to toggle theme.', error_1);
294
+ return [3 /*break*/, 3];
295
+ case 3:
296
+ return [2 /*return*/];
557
297
  }
558
- }, _callee2, null, [[0, 7]]);
559
- }));
560
- return function toggleTheme() {
561
- return _ref4.apply(this, arguments);
562
- };
563
- }();
298
+ });
299
+ });
300
+ };
564
301
  var theme = {
565
302
  colors: colorScheme === 'dark' ? darkTheme : lightTheme
566
303
  };
@@ -573,9 +310,9 @@ var ThemeProvider = function ThemeProvider(_ref) {
573
310
  };
574
311
 
575
312
  var ThemeToggle = function ThemeToggle() {
576
- var _useContext = React.useContext(ThemeContext),
577
- theme = _useContext.theme,
578
- toggleTheme = _useContext.toggleTheme;
313
+ var _a = React.useContext(ThemeContext),
314
+ theme = _a.theme,
315
+ toggleTheme = _a.toggleTheme;
579
316
  var isDarkMode = theme.colors === darkTheme;
580
317
  return /*#__PURE__*/React.createElement(reactNative.View, {
581
318
  style: styles$2.container
@@ -650,21 +387,20 @@ function typeStyles(type, disabled, themeColors) {
650
387
  * @param borderRadius - Custom border radius value. Overrides the `rounded` prop if provided.
651
388
  * @param type - Specifies the button type for styling ('submit', 'button', 'cancel').
652
389
  */
653
- var Button = function Button(_ref) {
654
- var children = _ref.children,
655
- _ref$disabled = _ref.disabled,
656
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
657
- _ref$type = _ref.type,
658
- type = _ref$type === void 0 ? 'button' : _ref$type,
659
- _ref$rounded = _ref.rounded,
660
- rounded = _ref$rounded === void 0 ? true : _ref$rounded,
661
- _ref$borderRadius = _ref.borderRadius,
662
- borderRadius = _ref$borderRadius === void 0 ? 30 : _ref$borderRadius,
663
- _ref$isFullWidth = _ref.isFullWidth,
664
- isFullWidth = _ref$isFullWidth === void 0 ? false : _ref$isFullWidth,
665
- onPress = _ref.onPress;
666
- var _useContext = React.useContext(ThemeContext),
667
- theme = _useContext.theme;
390
+ var Button = function Button(_a) {
391
+ var children = _a.children,
392
+ _b = _a.disabled,
393
+ disabled = _b === void 0 ? false : _b,
394
+ _c = _a.type,
395
+ type = _c === void 0 ? 'button' : _c,
396
+ _d = _a.rounded,
397
+ rounded = _d === void 0 ? true : _d,
398
+ _e = _a.borderRadius,
399
+ borderRadius = _e === void 0 ? 30 : _e,
400
+ _f = _a.isFullWidth,
401
+ isFullWidth = _f === void 0 ? false : _f,
402
+ onPress = _a.onPress;
403
+ var theme = React.useContext(ThemeContext).theme;
668
404
  var colors = theme.colors;
669
405
  var computedStyles = React.useMemo(function () {
670
406
  return reactNative.StyleSheet.flatten([styles$1.button, typeStyles(type, disabled, colors), rounded && {
@@ -712,36 +448,21 @@ var styles$1 = reactNative.StyleSheet.create({
712
448
  * @param elevation - Elevation for Android shadow. Overrides default.
713
449
  * @param shadowProps - Custom shadow properties for iOS. Overrides defaults.
714
450
  */
715
- var Card = function Card(_ref) {
716
- var children = _ref.children,
717
- style = _ref.style,
718
- onPress = _ref.onPress,
719
- _ref$pressable = _ref.pressable,
720
- pressable = _ref$pressable === void 0 ? false : _ref$pressable,
721
- _ref$borderRadius = _ref.borderRadius,
722
- borderRadius = _ref$borderRadius === void 0 ? 12 : _ref$borderRadius,
723
- _ref$elevation = _ref.elevation,
724
- elevation = _ref$elevation === void 0 ? 4 : _ref$elevation,
725
- _ref$shadowProps = _ref.shadowProps,
726
- shadowProps = _ref$shadowProps === void 0 ? {} : _ref$shadowProps;
727
- var _useContext = React.useContext(ThemeContext),
728
- theme = _useContext.theme;
451
+ var Card = function Card(_a) {
452
+ var children = _a.children,
453
+ style = _a.style,
454
+ onPress = _a.onPress,
455
+ _b = _a.pressable,
456
+ pressable = _b === void 0 ? false : _b,
457
+ _c = _a.borderRadius,
458
+ borderRadius = _c === void 0 ? 12 : _c,
459
+ _d = _a.elevation,
460
+ elevation = _d === void 0 ? 4 : _d,
461
+ _e = _a.shadowProps,
462
+ shadowProps = _e === void 0 ? {} : _e;
463
+ var theme = React.useContext(ThemeContext).theme;
729
464
  var colors = theme.colors;
730
465
  // Animation state for pressable effect
731
- var scale = Animated.useSharedValue(1);
732
- var animatedStyle = Animated.useAnimatedStyle(function () {
733
- return {
734
- transform: [{
735
- scale: scale.value
736
- }]
737
- };
738
- });
739
- var handlePressIn = function handlePressIn() {
740
- scale.value = Animated.withSpring(0.95);
741
- };
742
- var handlePressOut = function handlePressOut() {
743
- scale.value = Animated.withSpring(1);
744
- };
745
466
  // Default shadow styles (improved platform-specific handling)
746
467
  var defaultShadow = reactNative.Platform.select({
747
468
  ios: {
@@ -760,7 +481,7 @@ var Card = function Card(_ref) {
760
481
  });
761
482
  var cardStyles = [styles.container, {
762
483
  borderRadius: borderRadius,
763
- backgroundColor: colors.background.hex
484
+ backgroundColor: colors.body.hex
764
485
  }, defaultShadow,
765
486
  // Dynamic shadows based on platform
766
487
  style // External styles
@@ -768,12 +489,8 @@ var Card = function Card(_ref) {
768
489
  return pressable ? (/*#__PURE__*/React.createElement(reactNative.TouchableOpacity, {
769
490
  activeOpacity: 0.8,
770
491
  onPress: onPress,
771
- onPressIn: handlePressIn,
772
- onPressOut: handlePressOut,
773
492
  style: cardStyles
774
- }, /*#__PURE__*/React.createElement(Animated.View, {
775
- style: animatedStyle
776
- }, children))) : (/*#__PURE__*/React.createElement(reactNative.View, {
493
+ }, children)) : (/*#__PURE__*/React.createElement(reactNative.View, {
777
494
  style: cardStyles
778
495
  }, children));
779
496
  };