react-native-persona 1.2.10 → 1.3.1

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 (77) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/RNPersonaInquiry.podspec +1 -1
  3. package/android/README.md +14 -0
  4. package/android/build.gradle +21 -100
  5. package/bin/persona-tool +1 -2
  6. package/lib/commonjs/index.js +477 -0
  7. package/lib/commonjs/index.js.map +1 -0
  8. package/lib/commonjs/persona-tools/AndroidResourcePrinter.js +694 -0
  9. package/lib/commonjs/persona-tools/AndroidResourcePrinter.js.map +1 -0
  10. package/lib/commonjs/persona-tools/Config.js +95 -0
  11. package/lib/commonjs/persona-tools/Config.js.map +1 -0
  12. package/lib/commonjs/persona-tools/Theme.js +228 -0
  13. package/lib/commonjs/persona-tools/Theme.js.map +1 -0
  14. package/lib/commonjs/persona-tools/index.js +41 -0
  15. package/lib/commonjs/persona-tools/index.js.map +1 -0
  16. package/lib/commonjs/persona-tools/prompts.js +48 -0
  17. package/lib/commonjs/persona-tools/prompts.js.map +1 -0
  18. package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js +112 -0
  19. package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
  20. package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js +50 -0
  21. package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js.map +1 -0
  22. package/lib/commonjs/util.js +36 -0
  23. package/lib/commonjs/util.js.map +1 -0
  24. package/lib/module/index.js +452 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/persona-tools/AndroidResourcePrinter.js +686 -0
  27. package/lib/module/persona-tools/AndroidResourcePrinter.js.map +1 -0
  28. package/lib/module/persona-tools/Config.js +82 -0
  29. package/lib/module/persona-tools/Config.js.map +1 -0
  30. package/lib/module/persona-tools/Theme.js +212 -0
  31. package/lib/module/persona-tools/Theme.js.map +1 -0
  32. package/lib/module/persona-tools/index.js +33 -0
  33. package/lib/module/persona-tools/index.js.map +1 -0
  34. package/lib/module/persona-tools/prompts.js +31 -0
  35. package/lib/module/persona-tools/prompts.js.map +1 -0
  36. package/lib/module/persona-tools/tools/AndroidThemeGenerator.js +82 -0
  37. package/lib/module/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
  38. package/lib/module/persona-tools/tools/IosThemeInstructions.js +37 -0
  39. package/lib/module/persona-tools/tools/IosThemeInstructions.js.map +1 -0
  40. package/lib/module/util.js +29 -0
  41. package/lib/module/util.js.map +1 -0
  42. package/{generatedTypes → lib/typescript}/index.d.ts +67 -3
  43. package/lib/typescript/persona-tools/AndroidResourcePrinter.d.ts +40 -0
  44. package/lib/typescript/persona-tools/Config.d.ts +15 -0
  45. package/lib/typescript/persona-tools/Theme.d.ts +124 -0
  46. package/lib/typescript/persona-tools/index.d.ts +1 -0
  47. package/lib/typescript/persona-tools/prompts.d.ts +8 -0
  48. package/lib/typescript/persona-tools/tools/AndroidThemeGenerator.d.ts +5 -0
  49. package/lib/typescript/persona-tools/tools/IosThemeInstructions.d.ts +5 -0
  50. package/lib/typescript/util.d.ts +3 -0
  51. package/package.json +79 -22
  52. package/src/index.ts +17 -18
  53. package/{persona-tools/lib → src/persona-tools}/AndroidResourcePrinter.ts +314 -278
  54. package/{persona-tools/config.ts → src/persona-tools/Config.ts} +7 -7
  55. package/src/persona-tools/Theme.ts +262 -0
  56. package/src/persona-tools/index.ts +30 -0
  57. package/{persona-tools/lib → src/persona-tools}/prompts.ts +11 -11
  58. package/{persona-tools → src/persona-tools}/tools/AndroidThemeGenerator.ts +31 -32
  59. package/{persona-tools → src/persona-tools}/tools/IosThemeInstructions.ts +8 -8
  60. package/src/util.ts +3 -3
  61. package/jest.config.js +0 -10
  62. package/persona-tools/Theme.js +0 -213
  63. package/persona-tools/Theme.ts +0 -260
  64. package/persona-tools/config.js +0 -72
  65. package/persona-tools/index.js +0 -30
  66. package/persona-tools/index.ts +0 -30
  67. package/persona-tools/lib/AndroidResourcePrinter.js +0 -832
  68. package/persona-tools/lib/AndroidResourcePrinter.spec.js +0 -1135
  69. package/persona-tools/lib/AndroidResourcePrinter.spec.ts +0 -1229
  70. package/persona-tools/lib/prompts.js +0 -39
  71. package/persona-tools/tools/AndroidThemeGenerator.js +0 -59
  72. package/persona-tools/tools/IosThemeInstructions.js +0 -34
  73. package/src/index.js +0 -307
  74. package/src/util.js +0 -29
  75. package/src/util.spec.js +0 -15
  76. package/src/util.spec.ts +0 -16
  77. package/tsconfig.json +0 -29
@@ -0,0 +1,694 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _xmlbuilder = require("xmlbuilder2");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ class AndroidResourcePrinter {
13
+ constructor(theme) {
14
+ _defineProperty(this, "theme", void 0);
15
+
16
+ _defineProperty(this, "root", void 0);
17
+
18
+ _defineProperty(this, "buttonDrawable", void 0);
19
+
20
+ _defineProperty(this, "buttonSecondaryDrawable", void 0);
21
+
22
+ _defineProperty(this, "buttonColor", void 0);
23
+
24
+ _defineProperty(this, "preprintQueue", []);
25
+
26
+ _defineProperty(this, "printQueue", []);
27
+
28
+ _defineProperty(this, "postPrintQueue", []);
29
+
30
+ this.theme = theme;
31
+ this.root = (0, _xmlbuilder.create)({
32
+ version: '1.0'
33
+ }).ele('resources');
34
+ this.buttonDrawable = (0, _xmlbuilder.create)({
35
+ version: '1.0'
36
+ }).ele('selector', {
37
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
38
+ });
39
+ this.buttonSecondaryDrawable = (0, _xmlbuilder.create)({
40
+ version: '1.0'
41
+ }).ele('selector', {
42
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
43
+ });
44
+ this.buttonColor = (0, _xmlbuilder.create)({
45
+ version: '1.0'
46
+ }).ele('selector', {
47
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
48
+ });
49
+ }
50
+
51
+ process() {
52
+ if (!this.hasTheme()) {
53
+ this.root = this.root.up();
54
+ } else {
55
+ this.print();
56
+ }
57
+
58
+ return {
59
+ style: this.root,
60
+ buttonDrawable: this.buttonDrawable,
61
+ buttonSecondaryDrawable: this.buttonSecondaryDrawable,
62
+ buttonColor: this.buttonColor
63
+ };
64
+ }
65
+
66
+ print() {
67
+ this.primaryColor();
68
+ this.accentColor();
69
+ this.darkPrimaryColor();
70
+ this.backgroundColor();
71
+ this.titleText();
72
+ this.bodyText();
73
+ this.footnoteText();
74
+ this.cameraInstructionsText();
75
+ this.cameraHintText();
76
+ this.cameraGuideHintText(); // this.formLabelText();
77
+
78
+ this.textField();
79
+ this.pickerText();
80
+ this.button();
81
+ this.progressColor();
82
+ this.successAsset();
83
+ this.failAsset();
84
+ this.loadingAnimationAsset();
85
+ this.selfieAnimationAsset();
86
+ this.preprintQueue.forEach(fn => fn()); // Precreate some style namespaces
87
+
88
+ this.root = this.root.ele('style', {
89
+ name: 'RN'
90
+ }).up();
91
+ this.root = this.root.ele('style', {
92
+ name: 'RN.Persona'
93
+ }).up();
94
+ this.root = this.root.ele('style', {
95
+ name: 'RN.Persona.Text'
96
+ }).up();
97
+ this.root = this.root.ele('style', {
98
+ name: 'Persona.Inquiry.Theme',
99
+ parent: 'Base.Persona.Inquiry.Theme.Light'
100
+ });
101
+ this.printQueue.forEach(fn => fn());
102
+ this.root = this.root.up();
103
+ this.postPrintQueue.forEach(fn => fn());
104
+ }
105
+
106
+ hasTheme() {
107
+ return Object.keys(this.theme).length > 0 && Object.values(this.theme).filter(Boolean).length > 0;
108
+ }
109
+
110
+ primaryColor() {
111
+ if (!this.theme.primaryColor) return;
112
+ this.printQueue.push(() => {
113
+ this.root = this.root.ele('item', {
114
+ name: 'colorPrimary'
115
+ }).txt(this.theme.primaryColor).up().txt(' ');
116
+ });
117
+ }
118
+
119
+ accentColor() {
120
+ if (!this.theme.accentColor) return;
121
+ this.printQueue.push(() => {
122
+ this.root = this.root.ele('item', {
123
+ name: 'colorAccent'
124
+ }).txt(this.theme.accentColor).up().txt(' ');
125
+ });
126
+ }
127
+
128
+ darkPrimaryColor() {
129
+ if (!this.theme.darkPrimaryColor) return;
130
+ this.printQueue.push(() => {
131
+ this.root = this.root.ele('item', {
132
+ name: 'colorPrimaryDark'
133
+ }).txt(this.theme.darkPrimaryColor).up().txt(' ');
134
+ });
135
+ }
136
+
137
+ backgroundColor() {
138
+ if (!this.theme.backgroundColor) return;
139
+ this.preprintQueue.push(() => {
140
+ this.root = this.root.ele('color', {
141
+ name: 'customPersonaBackgroundColor'
142
+ }).txt(this.theme.backgroundColor).up().txt(' ');
143
+ });
144
+ this.printQueue.push(() => {
145
+ this.root = this.root.ele('item', {
146
+ name: 'android:colorBackground'
147
+ }).txt('@color/customPersonaBackgroundColor').up().txt(' ');
148
+ });
149
+ }
150
+
151
+ titleText() {
152
+ if (this.theme.titleTextColor || this.theme.titleTextSize || this.theme.titleTextFont) {
153
+ this.printQueue.push(() => {
154
+ this.root = this.root.ele('item', {
155
+ name: 'personaTitleTextAppearance'
156
+ }).txt('@style/RN.Persona.Text.Title').up();
157
+ }); // Create a text appearance
158
+
159
+ this.postPrintQueue.push(() => {
160
+ this.root = this.root.ele('style', {
161
+ name: 'RN.Persona.Text.Title',
162
+ parent: 'Persona.Text.Body'
163
+ });
164
+
165
+ if (this.theme.titleTextColor) {
166
+ this.root = this.root.ele('item', {
167
+ name: 'android:textColor'
168
+ }).txt(this.theme.titleTextColor).up();
169
+ }
170
+
171
+ if (this.theme.titleTextFont) {
172
+ // TODO: Add notice about how to add a custom font that can be
173
+ // referenced here on Android
174
+ this.root = this.root.ele('item', {
175
+ name: 'android:fontFamily'
176
+ }).txt(this.theme.titleTextFont).up();
177
+ } // Default values taken from `Persona.Text.Title`
178
+ // in shared/src/main/res/values/styles.xml
179
+
180
+
181
+ const textSize = this.theme.titleTextSize ? `${this.theme.titleTextSize}sp` : '26sp';
182
+ this.root = this.root.ele('item', {
183
+ name: 'android:textSize'
184
+ }).txt(textSize).up().ele('item', {
185
+ name: 'android:textStyle'
186
+ }).txt('bold').up();
187
+ this.root = this.root.up();
188
+ });
189
+ } else {
190
+ this.printQueue.push(() => {
191
+ this.root = this.root.ele('item', {
192
+ name: 'personaTitleTextAppearance'
193
+ }).txt('@style/Persona.Text.Title').up();
194
+ });
195
+ }
196
+ }
197
+
198
+ bodyText() {
199
+ if (this.theme.bodyTextColor || this.theme.bodyTextSize || this.theme.bodyTextFont) {
200
+ this.printQueue.push(() => {
201
+ this.root = this.root.ele('item', {
202
+ name: 'personaBodyTextAppearance'
203
+ }).txt('@style/RN.Persona.Text.Body').up();
204
+ }); // Create a text appearance
205
+
206
+ this.postPrintQueue.push(() => {
207
+ this.root = this.root.ele('style', {
208
+ name: 'RN.Persona.Text.Body',
209
+ parent: 'Persona.Text.Body'
210
+ });
211
+
212
+ if (this.theme.bodyTextColor) {
213
+ this.root = this.root.ele('item', {
214
+ name: 'android:textColor'
215
+ }).txt(this.theme.bodyTextColor).up();
216
+ }
217
+
218
+ if (this.theme.bodyTextFont) {
219
+ // TODO: Add notice about how to add a custom font that can be
220
+ // referenced here on Android
221
+ this.root = this.root.ele('item', {
222
+ name: 'android:fontFamily'
223
+ }).txt(this.theme.bodyTextFont).up();
224
+ }
225
+
226
+ const textSize = this.theme.bodyTextSize ? `${this.theme.bodyTextSize}sp` : '18sp';
227
+ this.root = this.root.ele('item', {
228
+ name: 'android:textSize'
229
+ }).txt(textSize).up();
230
+ this.root = this.root.up();
231
+ });
232
+ } else {
233
+ this.printQueue.push(() => {
234
+ this.root = this.root.ele('item', {
235
+ name: 'personaBodyTextAppearance'
236
+ }).txt('@style/Persona.Text.Body').up();
237
+ });
238
+ }
239
+ }
240
+
241
+ footnoteText() {
242
+ if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
243
+ this.postPrintQueue.push(() => {
244
+ var _this$theme$footnoteT;
245
+
246
+ this.root = this.root.ele('style', {
247
+ name: 'TextAppearance.AppCompat.Small'
248
+ }).ele('item', {
249
+ name: 'android:textColor'
250
+ }).txt( // Used default value found in the Android SDK
251
+ (_this$theme$footnoteT = this.theme.footnoteTextColor) !== null && _this$theme$footnoteT !== void 0 ? _this$theme$footnoteT : '?android:attr/textColorTertiary').up();
252
+
253
+ if (this.theme.footnoteTextFont) {
254
+ var _this$theme$footnoteT2;
255
+
256
+ this.root = this.root.ele('item', {
257
+ name: 'android:fontFamily'
258
+ }).txt( // Used default value found in the Android SDK
259
+ (_this$theme$footnoteT2 = this.theme.footnoteTextFont) !== null && _this$theme$footnoteT2 !== void 0 ? _this$theme$footnoteT2 : '?android:attr/textColorTertiary').up();
260
+ } // Default value found in the Android SDK
261
+
262
+
263
+ const textSize = this.theme.footnoteTextSize ? `${this.theme.footnoteTextSize}sp` : '@dimen/abc_text_size_small_material';
264
+ this.root = this.root.ele('item', {
265
+ name: 'android:textSize'
266
+ }).txt(textSize).up();
267
+ this.root = this.root.up();
268
+ });
269
+ }
270
+ }
271
+
272
+ cameraInstructionsText() {
273
+ if (this.theme.cameraInstructionsTextColor || this.theme.cameraInstructionsTextSize || this.theme.cameraInstructionsTextFont) {
274
+ this.printQueue.push(() => {
275
+ this.root = this.root.ele('item', {
276
+ name: 'personaCameraTitleTextAppearance'
277
+ }).txt('@style/RN.Persona.Text.CameraTitle').up();
278
+ }); // Create a text appearance
279
+
280
+ this.postPrintQueue.push(() => {
281
+ this.root = this.root.ele('style', {
282
+ name: 'RN.Persona.Text.CameraTitle',
283
+ parent: 'Persona.Text.CameraTitle'
284
+ });
285
+
286
+ if (this.theme.cameraInstructionsTextColor) {
287
+ this.root = this.root.ele('item', {
288
+ name: 'android:textColor'
289
+ }).txt(this.theme.cameraInstructionsTextColor).up();
290
+ }
291
+
292
+ if (this.theme.cameraInstructionsTextFont) {
293
+ // TODO: Add notice about how to add a custom font that can be
294
+ // referenced here on Android
295
+ this.root = this.root.ele('item', {
296
+ name: 'android:fontFamily'
297
+ }).txt(this.theme.cameraInstructionsTextFont).up();
298
+ }
299
+
300
+ const textSize = this.theme.cameraInstructionsTextSize ? `${this.theme.cameraInstructionsTextSize}sp` : '20sp';
301
+ this.root = this.root.ele('item', {
302
+ name: 'android:textSize'
303
+ }).txt(textSize).up();
304
+ this.root = this.root.up();
305
+ });
306
+ } else {
307
+ this.printQueue.push(() => {
308
+ this.root = this.root.ele('item', {
309
+ name: 'personaCameraTitleTextAppearance'
310
+ }).txt('@style/Persona.Text.CameraTitle').up();
311
+ });
312
+ }
313
+ }
314
+
315
+ cameraHintText() {
316
+ if (this.theme.cameraHintTextColor || this.theme.cameraHintTextSize || this.theme.cameraHintTextFont) {
317
+ this.printQueue.push(() => {
318
+ this.root = this.root.ele('item', {
319
+ name: 'personaCameraBodyTextAppearance'
320
+ }).txt('@style/RN.Persona.Text.CameraBody').up();
321
+ }); // Create a text appearance
322
+
323
+ this.postPrintQueue.push(() => {
324
+ this.root = this.root.ele('style', {
325
+ name: 'RN.Persona.Text.CameraBody',
326
+ parent: 'Persona.Text.CameraBody'
327
+ });
328
+
329
+ if (this.theme.cameraHintTextColor) {
330
+ this.root = this.root.ele('item', {
331
+ name: 'android:textColor'
332
+ }).txt(this.theme.cameraHintTextColor).up();
333
+ }
334
+
335
+ if (this.theme.cameraHintTextFont) {
336
+ // TODO: Add notice about how to add a custom font that can be
337
+ // referenced here on Android
338
+ this.root = this.root.ele('item', {
339
+ name: 'android:fontFamily'
340
+ }).txt(this.theme.cameraHintTextFont).up();
341
+ }
342
+
343
+ const textSize = this.theme.cameraHintTextSize ? `${this.theme.cameraHintTextSize}sp` : '16sp';
344
+ this.root = this.root.ele('item', {
345
+ name: 'android:textSize'
346
+ }).txt(textSize).up();
347
+ this.root = this.root.up();
348
+ });
349
+ } else {
350
+ this.printQueue.push(() => {
351
+ this.root = this.root.ele('item', {
352
+ name: 'personaCameraBodyTextAppearance'
353
+ }).txt('@style/Persona.Text.CameraBody').up();
354
+ });
355
+ }
356
+ }
357
+
358
+ cameraGuideHintText() {
359
+ if (this.theme.cameraGuideHintTextColor || this.theme.cameraGuideHintTextSize || this.theme.cameraGuideHintTextFont) {
360
+ this.printQueue.push(() => {
361
+ this.root = this.root.ele('item', {
362
+ name: 'personaCameraHintTextAppearance'
363
+ }).txt('@style/RN.Persona.Text.CameraHint').up();
364
+ }); // Create a text appearance
365
+
366
+ this.postPrintQueue.push(() => {
367
+ this.root = this.root.ele('style', {
368
+ name: 'RN.Persona.Text.CameraHint',
369
+ parent: 'Persona.Text.CameraHint'
370
+ });
371
+
372
+ if (this.theme.cameraGuideHintTextColor) {
373
+ this.root = this.root.ele('item', {
374
+ name: 'android:textColor'
375
+ }).txt(this.theme.cameraGuideHintTextColor).up();
376
+ }
377
+
378
+ if (this.theme.cameraGuideHintTextFont) {
379
+ // TODO: Add notice about how to add a custom font that can be
380
+ // referenced here on Android
381
+ this.root = this.root.ele('item', {
382
+ name: 'android:fontFamily'
383
+ }).txt(this.theme.cameraGuideHintTextFont).up();
384
+ }
385
+
386
+ const textSize = this.theme.cameraGuideHintTextSize ? `${this.theme.cameraGuideHintTextSize}sp` : '20sp';
387
+ this.root = this.root.ele('item', {
388
+ name: 'android:textSize'
389
+ }).txt(textSize).up();
390
+ this.root = this.root.up();
391
+ });
392
+ } else {
393
+ this.printQueue.push(() => {
394
+ this.root = this.root.ele('item', {
395
+ name: 'personaCameraHintTextAppearance'
396
+ }).txt('@style/Persona.Text.CameraHint').up();
397
+ });
398
+ }
399
+ }
400
+
401
+ textField() {
402
+ if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
403
+ this.printQueue.push(() => {
404
+ this.root = this.root.ele('item', {
405
+ name: 'editTextStyle'
406
+ }).txt('@style/RN.Persona.EditText').up();
407
+ });
408
+ this.postPrintQueue.push(() => {
409
+ this.root = this.root.ele('style', {
410
+ name: 'RN.Persona.EditText',
411
+ parent: 'Widget.AppCompat.EditText'
412
+ }).ele('item', {
413
+ name: 'android:textAppearance'
414
+ }).txt('@style/RN.Persona.EditText.TextAppearance').up().ele('item', {
415
+ name: 'android:textColor'
416
+ }).txt(this.theme.textFieldTextColor).up().up();
417
+ this.root = this.root.ele('style', {
418
+ name: 'RN.Persona.EditText.TextAppearance',
419
+ parent: 'Base.TextAppearance.AppCompat.Medium'
420
+ });
421
+
422
+ if (this.theme.textFieldTextColor) {
423
+ this.root = this.root.ele('item', {
424
+ name: 'android:textSize'
425
+ }).txt('18sp').up();
426
+ }
427
+
428
+ if (this.theme.textFieldTextFont) {
429
+ this.root = this.root.ele('item', {
430
+ name: 'android:fontFamily'
431
+ }).txt(this.theme.textFieldTextFont).up();
432
+ }
433
+
434
+ this.root = this.root.up();
435
+ });
436
+ }
437
+ }
438
+
439
+ pickerText() {
440
+ if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
441
+ this.printQueue.push(() => {
442
+ this.root = this.root.ele('item', {
443
+ name: 'spinnerStyle'
444
+ }).txt('@style/RN.Persona.Spinner').up();
445
+ this.root = this.root.ele('item', {
446
+ name: 'spinnerDropDownItemStyle'
447
+ }).txt('@style/RN.Persona.DropDownItem.Spinner').up();
448
+ });
449
+ this.postPrintQueue.push(() => {
450
+ var _this$theme$pickerTex, _this$theme$pickerTex2;
451
+
452
+ // Build Rn.Persona.Spinner
453
+ this.root = this.root.ele('style', {
454
+ name: 'RN.Persona.Spinner',
455
+ parent: 'Widget.AppCompat.Spinner'
456
+ }).ele('item', {
457
+ name: 'android:textColor'
458
+ }).txt((_this$theme$pickerTex = this.theme.pickerTextColor) !== null && _this$theme$pickerTex !== void 0 ? _this$theme$pickerTex : '?android:attr/textColorPrimary').up().ele('item', {
459
+ name: 'android:textAppearance'
460
+ }).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Text.Body').up().up(); // Build RN.Persona.DropDownItem.Spinner
461
+
462
+ this.root = this.root.ele('style', {
463
+ name: 'RN.Persona.DropDownItem.Spinner',
464
+ parent: 'Widget.AppCompat.DropDownItem.Spinner'
465
+ }).ele('item', {
466
+ name: 'android:textColor'
467
+ }).txt((_this$theme$pickerTex2 = this.theme.pickerTextColor) !== null && _this$theme$pickerTex2 !== void 0 ? _this$theme$pickerTex2 : '?android:attr/textColorPrimary').up().ele('item', {
468
+ name: 'android:textAppearance'
469
+ }).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Text.Body').up().up(); // Build RN.Persona.Text.Spinner
470
+
471
+ this.root = this.root.ele('style', {
472
+ name: 'RN.Persona.Text.Spinner'
473
+ });
474
+
475
+ if (this.theme.pickerTextColor) {
476
+ this.root = this.root.ele('item', {
477
+ name: 'android:textColor'
478
+ }).txt(this.theme.pickerTextColor).up();
479
+ }
480
+
481
+ if (this.theme.pickerTextFont) {
482
+ // TODO: Add notice about how to add a custom font that can be
483
+ // referenced here on Android
484
+ this.root = this.root.ele('item', {
485
+ name: 'android:fontFamily'
486
+ }).txt(this.theme.pickerTextFont).up();
487
+ }
488
+
489
+ this.root = this.root.up();
490
+ });
491
+ }
492
+ }
493
+
494
+ button() {
495
+ if (this.theme.buttonBackgroundColor || this.theme.buttonDisabledBackgroundColor || this.theme.buttonTouchedBackgroundColor || this.theme.buttonTextColor || this.theme.buttonDisabledTextColor || this.theme.buttonCornerRadius || this.theme.buttonFont || this.theme.buttonTextSize) {
496
+ this.printQueue.push(() => {
497
+ this.root = this.root.ele('item', {
498
+ name: 'buttonStyle'
499
+ }).txt('@style/RN.Persona.Button').up();
500
+ this.root = this.root.ele('item', {
501
+ name: 'buttonStyleSecondary'
502
+ }).txt('@style/RN.Persona.Button.Secondary').up();
503
+ });
504
+ const textSize = this.theme.buttonTextSize ? `${this.theme.buttonTextSize}sp` : '18sp';
505
+ this.postPrintQueue.push(() => {
506
+ var _this$theme$buttonTou, _this$theme$buttonBac, _this$theme$buttonDis, _this$theme$buttonTex, _this$theme$buttonTex2;
507
+
508
+ this.root = this.root.ele('style', {
509
+ name: 'RN.Persona.Button',
510
+ parent: 'android:style/Widget.Button'
511
+ }) // Taken from
512
+ // appcompat's res/values/values.xml
513
+ .ele('item', {
514
+ name: 'android:minHeight'
515
+ }).txt('48dip').up() // Taken from
516
+ // appcompat's res/values/values.xml
517
+ .ele('item', {
518
+ name: 'android:minWidth'
519
+ }).txt('88dip').up() // Taken from
520
+ // persona-android's shared/src/main/res/values/styles.xml
521
+ .ele('item', {
522
+ name: 'android:textSize'
523
+ }).txt(textSize).up().ele('item', {
524
+ name: 'android:background'
525
+ }).txt('@drawable/rn_persona_button').up().ele('item', {
526
+ name: 'android:textColor'
527
+ }).txt('@color/rn_persona_button').up().up(); // Build RN.Persona.Button.Secondary
528
+
529
+ this.root = this.root.ele('style', {
530
+ name: 'RN.Persona.Button.Secondary',
531
+ parent: 'RN.Persona.Button'
532
+ }).ele('item', {
533
+ name: 'android:background'
534
+ }).txt('@drawable/rn_persona_button_secondary').up().up(); // Disabled
535
+
536
+ this.buttonDrawable = this.buttonDrawable.ele('item', {
537
+ 'android:state_enabled': 'false'
538
+ }).ele('shape', {
539
+ 'android:shape': 'rectangle'
540
+ }).ele('corners', {
541
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
542
+ }).up().ele('padding', {
543
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
544
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
545
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
546
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
547
+ }).up().ele('solid', {
548
+ 'android:color': this.theme.buttonDisabledBackgroundColor ? this.theme.buttonDisabledBackgroundColor : '?attr/colorPrimaryDark'
549
+ }).up().up().up(); // touched
550
+
551
+ this.buttonDrawable = this.buttonDrawable.ele('item', {
552
+ 'android:state_pressed': 'true'
553
+ }).ele('shape', {
554
+ 'android:shape': 'rectangle'
555
+ }).ele('corners', {
556
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
557
+ }).up().ele('solid', {
558
+ 'android:color': (_this$theme$buttonTou = this.theme.buttonTouchedBackgroundColor) !== null && _this$theme$buttonTou !== void 0 ? _this$theme$buttonTou : '?attr/colorPrimaryDark'
559
+ }).up().ele('padding', {
560
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
561
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
562
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
563
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
564
+ }).up().up().up();
565
+ this.buttonDrawable = this.buttonDrawable.ele('item').ele('shape', {
566
+ 'android:shape': 'rectangle'
567
+ }).ele('corners', {
568
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
569
+ }).up().ele('solid', {
570
+ 'android:color': (_this$theme$buttonBac = this.theme.buttonBackgroundColor) !== null && _this$theme$buttonBac !== void 0 ? _this$theme$buttonBac : '?attr/colorPrimary'
571
+ }).up().ele('padding', {
572
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
573
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
574
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
575
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
576
+ }).up().up().up(); // Finish button drawable
577
+
578
+ this.buttonDrawable = this.buttonDrawable.up();
579
+ this.buttonColor = this.buttonColor.ele('item', {
580
+ 'android:state_enabled': 'false',
581
+ 'android:color': (_this$theme$buttonDis = this.theme.buttonDisabledTextColor) !== null && _this$theme$buttonDis !== void 0 ? _this$theme$buttonDis : '@android:color/darker_gray'
582
+ }).up().ele('item', {
583
+ 'android:state_pressed': 'true',
584
+ 'android:color': (_this$theme$buttonTex = this.theme.buttonTextColor) !== null && _this$theme$buttonTex !== void 0 ? _this$theme$buttonTex : '@android:color/white'
585
+ }).up().ele('item', {
586
+ 'android:color': (_this$theme$buttonTex2 = this.theme.buttonTextColor) !== null && _this$theme$buttonTex2 !== void 0 ? _this$theme$buttonTex2 : '@android:color/white'
587
+ }).up();
588
+ this.buttonColor = this.buttonColor.up(); // Disabled
589
+
590
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.ele('item', {
591
+ 'android:state_enabled': 'false'
592
+ }).ele('shape', {
593
+ 'android:shape': 'rectangle'
594
+ }).ele('corners', {
595
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
596
+ }).up().ele('padding', {
597
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
598
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
599
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
600
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
601
+ }).up().ele('solid', {
602
+ 'android:color': '@android:color/darker_gray'
603
+ }).up().up().up(); // touched
604
+
605
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.ele('item', {
606
+ 'android:state_pressed': 'true'
607
+ }).ele('shape', {
608
+ 'android:shape': 'rectangle'
609
+ }).ele('corners', {
610
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
611
+ }).up().ele('solid', {
612
+ 'android:color': '@color/grayButtonDark'
613
+ }).up().ele('padding', {
614
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
615
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
616
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
617
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
618
+ }).up().up().up();
619
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.ele('item').ele('shape', {
620
+ 'android:shape': 'rectangle'
621
+ }).ele('corners', {
622
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
623
+ }).up().ele('solid', {
624
+ 'android:color': '@color/grayButton'
625
+ }).up().ele('padding', {
626
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
627
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
628
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
629
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
630
+ }).up().up().up(); // Finish button drawable
631
+
632
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.up();
633
+ this.root = this.root.up();
634
+ });
635
+ }
636
+ }
637
+
638
+ progressColor() {
639
+ if (this.theme.progressColor) {
640
+ this.printQueue.push(() => {
641
+ this.root = this.root.ele('item', {
642
+ name: 'colorControlActivated'
643
+ }).txt(this.theme.progressColor).up();
644
+ });
645
+ }
646
+ }
647
+
648
+ successAsset() {
649
+ if (!this.theme.successAsset) return;
650
+ this.printQueue.push(() => {
651
+ this.root = this.root.ele('item', {
652
+ name: 'personaInquiryCompleteImage'
653
+ }).txt(this.theme.successAsset).up().txt(' ');
654
+ });
655
+ }
656
+
657
+ failAsset() {
658
+ if (!this.theme.failAsset) return;
659
+ this.printQueue.push(() => {
660
+ this.root = this.root.ele('item', {
661
+ name: 'personaInquiryFailImage'
662
+ }).txt(this.theme.failAsset).up().txt(' ');
663
+ });
664
+ }
665
+
666
+ loadingAnimationAsset() {
667
+ if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent) return;
668
+ this.printQueue.push(() => {
669
+ this.root = this.root.ele('item', {
670
+ name: 'personaInquiryLoadingLottieRaw'
671
+ }).txt(this.theme.loadingAnimationAsset).up().txt(' ');
672
+ this.root = this.root.ele('item', {
673
+ name: 'personaInquiryLoadingLottieWidthPercent'
674
+ }).txt(this.theme.loadingAnimationWidthPercent).up().txt(' ');
675
+ });
676
+ }
677
+
678
+ selfieAnimationAsset() {
679
+ if (!this.theme.selfieAnimationAsset || !this.theme.selfieAnimationWidthPercent) return;
680
+ this.printQueue.push(() => {
681
+ this.root = this.root.ele('item', {
682
+ name: 'personaInquirySelfieLottieRaw'
683
+ }).txt(this.theme.selfieAnimationAsset).up().txt(' ');
684
+ this.root = this.root.ele('item', {
685
+ name: 'personaInquirySelfieLottieWidthPercent'
686
+ }).txt(this.theme.selfieAnimationWidthPercent).up().txt(' ');
687
+ });
688
+ }
689
+
690
+ }
691
+
692
+ var _default = AndroidResourcePrinter;
693
+ exports.default = _default;
694
+ //# sourceMappingURL=AndroidResourcePrinter.js.map