react-native-my-survey-sdk 4.0.0 → 4.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"XeboDropdownView.d.ts","sourceRoot":"","sources":["../../src/components/XeboDropdownView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AASjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAc,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAKhG,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,kFA8H3B,CAAC"}
1
+ {"version":3,"file":"XeboDropdownView.d.ts","sourceRoot":"","sources":["../../src/components/XeboDropdownView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AASjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAc,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAKhG,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,kFA+H3B,CAAC"}
@@ -89,7 +89,7 @@ exports.XeboDropdownView = (0, react_1.forwardRef)(({ question, isLastQuestion,
89
89
  </react_native_1.Text>)}
90
90
 
91
91
  <react_native_1.Animated.View style={{ transform: [{ translateX: shakeAnim }] }}>
92
- <react_native_1.TouchableOpacity style={[styles.trigger, { borderColor: isOpen ? theme.primaryColor : '#E5E7EB', borderRadius: theme.cornerRadius }]} onPress={() => setIsOpen(prev => !prev)} activeOpacity={0.8}>
92
+ <react_native_1.TouchableOpacity style={[styles.trigger, { borderColor: isOpen ? theme.primaryColor : theme.borderColor, borderRadius: theme.cornerRadius }]} onPress={() => setIsOpen(prev => !prev)} activeOpacity={0.8}>
93
93
  <react_native_1.Text style={[
94
94
  styles.triggerText,
95
95
  { color: selectedChoice ? theme.textColor : '#9CA3AF', fontFamily: theme.fontFamily },
@@ -105,6 +105,7 @@ exports.XeboDropdownView = (0, react_1.forwardRef)(({ question, isLastQuestion,
105
105
  <react_native_1.ScrollView nestedScrollEnabled style={styles.optionsScroll} showsVerticalScrollIndicator={false}>
106
106
  {((_a = question.options) !== null && _a !== void 0 ? _a : []).map((choice) => (<react_native_1.TouchableOpacity key={choice.id} style={[
107
107
  styles.optionRow,
108
+ { borderBottomColor: theme.selectedSurfaceColor },
108
109
  (selectedChoice === null || selectedChoice === void 0 ? void 0 : selectedChoice.id) === choice.id && { backgroundColor: `${theme.primaryColor}15` },
109
110
  ]} onPress={() => handleSelect(choice)} activeOpacity={0.7}>
110
111
  <react_native_1.Text style={[
@@ -176,7 +177,6 @@ const styles = react_native_1.StyleSheet.create({
176
177
  optionRow: {
177
178
  padding: 14,
178
179
  borderBottomWidth: 1,
179
- borderBottomColor: '#F3F4F6',
180
180
  },
181
181
  optionText: {
182
182
  fontSize: 15,
@@ -29,7 +29,7 @@ const XeboLanguageView = ({ page, selectedLangKey, busy, onSelect, }) => {
29
29
  styles.button,
30
30
  {
31
31
  backgroundColor: selected ? theme.primaryColor : 'transparent',
32
- borderColor: selected ? theme.primaryColor : '#E5E7EB',
32
+ borderColor: selected ? theme.primaryColor : theme.borderColor,
33
33
  borderRadius: theme.cornerRadius,
34
34
  opacity: dimmed ? 0.4 : 1,
35
35
  },
@@ -1 +1 @@
1
- {"version":3,"file":"XeboMultiNPSView.d.ts","sourceRoot":"","sources":["../../src/components/XeboMultiNPSView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AASjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAmB,MAAM,sBAAsB,CAAC;AAKrG,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAqBD,eAAO,MAAM,gBAAgB,kFAoH3B,CAAC"}
1
+ {"version":3,"file":"XeboMultiNPSView.d.ts","sourceRoot":"","sources":["../../src/components/XeboMultiNPSView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AASjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAmB,MAAM,sBAAsB,CAAC;AAKrG,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAYD,eAAO,MAAM,gBAAgB,kFAoH3B,CAAC"}
@@ -51,15 +51,6 @@ function npsColor(score, npsLabels) {
51
51
  return (_b = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.passiveColor) !== null && _b !== void 0 ? _b : PASSIVE_COLOR;
52
52
  return (_c = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.promoterColor) !== null && _c !== void 0 ? _c : PROMOTER_COLOR;
53
53
  }
54
- function isColorDark(hex) {
55
- const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
56
- if (!m)
57
- return false;
58
- const r = parseInt(m[1], 16) / 255;
59
- const g = parseInt(m[2], 16) / 255;
60
- const b = parseInt(m[3], 16) / 255;
61
- return 0.299 * r + 0.587 * g + 0.114 * b < 0.5;
62
- }
63
54
  exports.XeboMultiNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion, onAnswer, embedded }, ref) => {
64
55
  var _a;
65
56
  const theme = (0, XeboTheme_1.getTheme)();
@@ -132,7 +123,7 @@ exports.XeboMultiNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion,
132
123
  ]} onPress={() => setScore(row.id, i)} activeOpacity={0.8}>
133
124
  <react_native_1.Text style={[
134
125
  styles.scoreText,
135
- { color: isColorDark(color) ? '#FFFFFF' : selected ? '#111111' : '#444444' },
126
+ { color: (0, XeboTheme_1.isColorDark)(color) ? '#FFFFFF' : selected ? '#111111' : '#444444' },
136
127
  ]}>
137
128
  {i}
138
129
  </react_native_1.Text>
@@ -110,15 +110,15 @@ exports.XeboMultiRatingView = (0, react_1.forwardRef)(({ question, isLastQuestio
110
110
  return (<react_native_1.TouchableOpacity key={i} onPress={() => setRating(row.id, i)} activeOpacity={0.7} style={styles.iconButton}>
111
111
  {ratingStyle === 'circle' ? (<react_native_1.View style={[
112
112
  styles.circle,
113
- { backgroundColor: isFilled ? ratingColor : '#E5E7EB' },
113
+ { backgroundColor: isFilled ? ratingColor : theme.borderColor },
114
114
  ]}/>) : ratingStyle === 'tile' ? (<react_native_1.View style={[
115
115
  styles.tile,
116
- { backgroundColor: isFilled ? ratingColor : '#E5E7EB' },
116
+ { backgroundColor: isFilled ? ratingColor : theme.borderColor },
117
117
  ]}>
118
- <react_native_1.Text style={[styles.tileText, { color: isFilled ? '#FFF' : '#6B7280' }]}>
118
+ <react_native_1.Text style={[styles.tileText, { color: isFilled ? '#FFF' : theme.mutedTextColor }]}>
119
119
  {i + 1}
120
120
  </react_native_1.Text>
121
- </react_native_1.View>) : (<react_native_1.Text style={{ fontSize: 30, color: isFilled ? ratingColor : '#E5E7EB' }}>
121
+ </react_native_1.View>) : (<react_native_1.Text style={{ fontSize: 30, color: isFilled ? ratingColor : theme.borderColor }}>
122
122
  {starIcon(isFilled)}
123
123
  </react_native_1.Text>)}
124
124
  </react_native_1.TouchableOpacity>);
@@ -109,8 +109,8 @@ exports.XeboMultipleChoiceView = (0, react_1.forwardRef)(({ question, isLastQues
109
109
  return (<react_native_1.TouchableOpacity key={choice.id} style={[
110
110
  styles.optionRow,
111
111
  selected
112
- ? { borderColor: theme.primaryColor, backgroundColor: '#F3F4F6' }
113
- : { borderColor: '#E5E7EB' },
112
+ ? { borderColor: theme.primaryColor, backgroundColor: theme.selectedSurfaceColor }
113
+ : { borderColor: theme.borderColor },
114
114
  ]} onPress={() => toggleChoice(choice)} activeOpacity={0.7}>
115
115
  <react_native_1.Text style={[styles.optionText, { color: theme.textColor, fontFamily: theme.fontFamily }, (0, XeboRtl_1.rtlText)()]}>
116
116
  {choice.text}
@@ -1 +1 @@
1
- {"version":3,"file":"XeboNPSView.d.ts","sourceRoot":"","sources":["../../src/components/XeboNPSView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAA6C,kBAAkB,EAAc,MAAM,sBAAsB,CAAC;AAM3I,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,KAAK,IAAI,CAAC;IACtD,+FAA+F;IAC/F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAyDD,eAAO,MAAM,WAAW,kFAydtB,CAAC"}
1
+ {"version":3,"file":"XeboNPSView.d.ts","sourceRoot":"","sources":["../../src/components/XeboNPSView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAA6C,kBAAkB,EAAc,MAAM,sBAAsB,CAAC;AAM3I,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,KAAK,IAAI,CAAC;IACtD,+FAA+F;IAC/F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AA+CD,eAAO,MAAM,WAAW,kFA0dtB,CAAC"}
@@ -85,16 +85,6 @@ function npsColor(score, npsLabels) {
85
85
  return (_b = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.passiveColor) !== null && _b !== void 0 ? _b : PASSIVE_COLOR;
86
86
  return (_c = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.promoterColor) !== null && _c !== void 0 ? _c : PROMOTER_COLOR;
87
87
  }
88
- /** Returns true if the hex color is perceived as dark (use white text on top) */
89
- function isColorDark(hex) {
90
- const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
91
- if (!m)
92
- return false;
93
- const r = parseInt(m[1], 16) / 255;
94
- const g = parseInt(m[2], 16) / 255;
95
- const b = parseInt(m[3], 16) / 255;
96
- return 0.299 * r + 0.587 * g + 0.114 * b < 0.5;
97
- }
98
88
  exports.XeboNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion, onAnswer, onFitHeight, embedded, onSelect }, ref) => {
99
89
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
100
90
  const theme = (0, XeboTheme_1.getTheme)();
@@ -357,7 +347,8 @@ exports.XeboNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion, onAns
357
347
  <react_native_1.TouchableOpacity style={[
358
348
  styles.scoreButton,
359
349
  styles.emojiCell,
360
- selected && { backgroundColor: '#F2F2F2', borderColor: '#8188A2', borderWidth: 1.5 },
350
+ { backgroundColor: theme.surfaceColor, borderColor: theme.strongBorderColor },
351
+ selected && { backgroundColor: theme.selectedSurfaceColor, borderColor: '#8188A2', borderWidth: 1.5 },
361
352
  ]} onPress={() => handleScorePress(i)} activeOpacity={0.8}>
362
353
  <react_native_1.Text style={{ fontSize: emojiSize }}>{NPS_EMOJIS[i]}</react_native_1.Text>
363
354
  </react_native_1.TouchableOpacity>
@@ -368,14 +359,14 @@ exports.XeboNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion, onAns
368
359
  styles.scoreButton,
369
360
  isPlain
370
361
  ? {
371
- backgroundColor: selected ? '#F2F2F2' : '#FFFFFF',
372
- borderColor: selected ? '#8188A2' : '#EEF0F4',
362
+ backgroundColor: selected ? theme.selectedSurfaceColor : theme.surfaceColor,
363
+ borderColor: selected ? '#8188A2' : theme.borderColor,
373
364
  borderWidth: selected ? 1.5 : 1,
374
365
  }
375
366
  : isAnimated
376
367
  ? {
377
- backgroundColor: filled ? fill : '#FFFFFF',
378
- borderColor: filled ? fill : '#E5E7EB',
368
+ backgroundColor: filled ? fill : theme.surfaceColor,
369
+ borderColor: filled ? fill : theme.borderColor,
379
370
  borderWidth: 1,
380
371
  borderRadius: selected ? 8 : 0,
381
372
  borderTopLeftRadius: selected || i === 0 ? 8 : 0,
@@ -392,10 +383,10 @@ exports.XeboNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion, onAns
392
383
  <react_native_1.Text style={[
393
384
  styles.scoreText,
394
385
  isPlain
395
- ? { color: '#374151' }
386
+ ? { color: theme.textColor }
396
387
  : isAnimated
397
- ? { color: filled ? '#FFFFFF' : '#374151', fontWeight: '500' }
398
- : { color: isColorDark(color) ? '#FFFFFF' : selected ? '#111111' : '#444444' },
388
+ ? { color: filled ? '#FFFFFF' : theme.textColor, fontWeight: '500' }
389
+ : { color: (0, XeboTheme_1.isColorDark)(color) ? '#FFFFFF' : selected ? '#111111' : '#444444' },
399
390
  ]}>
400
391
  {i}
401
392
  </react_native_1.Text>
@@ -415,24 +406,24 @@ exports.XeboNPSView = (0, react_1.forwardRef)(({ question, isLastQuestion, onAns
415
406
  </react_native_1.View>)}
416
407
 
417
408
  {/* Conditional follow-up (NPS Pro) */}
418
- {selectedScore !== null && activeFollowUp && (<react_native_1.View style={[styles.followUpCard, { borderColor: '#E5E7EB', borderRadius: theme.cornerRadius }]}>
409
+ {selectedScore !== null && activeFollowUp && (<react_native_1.View style={[styles.followUpCard, { borderColor: theme.borderColor, borderRadius: theme.cornerRadius }]}>
419
410
  <react_native_1.Text style={[styles.followUpTitle, { color: theme.textColor, fontFamily: theme.fontFamily }, (0, XeboRtl_1.rtlText)()]}>
420
411
  {activeFollowUp.followUpQuestion}
421
412
  </react_native_1.Text>
422
413
  {activeFollowUp.followUpType === XeboModels_1.XeboQuestionType.singleChoice && activeFollowUp.followUpOptions.length > 0 ? (activeFollowUp.followUpOptions.map(opt => (<react_native_1.TouchableOpacity key={opt.id} style={[
423
414
  styles.followUpOption,
424
- followUpChoice === opt.id && { borderColor: theme.primaryColor },
415
+ { borderColor: followUpChoice === opt.id ? theme.primaryColor : theme.borderColor },
425
416
  ]} onPress={() => setFollowUpChoice(opt.id)} activeOpacity={0.7}>
426
417
  <react_native_1.Text style={[styles.followUpOptionText, { color: theme.textColor }, (0, XeboRtl_1.rtlText)()]}>{opt.text}</react_native_1.Text>
427
- </react_native_1.TouchableOpacity>))) : (<react_native_1.TextInput style={[styles.followUpInput, { borderColor: '#E5E7EB', color: theme.textColor, borderRadius: theme.cornerRadius }, (0, XeboRtl_1.rtlInput)()]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>)}
418
+ </react_native_1.TouchableOpacity>))) : (<react_native_1.TextInput style={[styles.followUpInput, { borderColor: theme.borderColor, color: theme.textColor, borderRadius: theme.cornerRadius }, (0, XeboRtl_1.rtlInput)()]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>)}
428
419
  </react_native_1.View>)}
429
420
 
430
421
  {/* Simple text follow-up */}
431
- {selectedScore !== null && hasTextFollowUp && (<react_native_1.View style={[styles.followUpCard, { borderColor: '#E5E7EB', borderRadius: theme.cornerRadius }]}>
422
+ {selectedScore !== null && hasTextFollowUp && (<react_native_1.View style={[styles.followUpCard, { borderColor: theme.borderColor, borderRadius: theme.cornerRadius }]}>
432
423
  <react_native_1.Text style={[styles.followUpTitle, { color: theme.textColor, fontFamily: theme.fontFamily }, (0, XeboRtl_1.rtlText)()]}>
433
424
  {question.followUpQuestion}
434
425
  </react_native_1.Text>
435
- <react_native_1.TextInput style={[styles.followUpInput, { borderColor: '#E5E7EB', color: theme.textColor, borderRadius: theme.cornerRadius }, (0, XeboRtl_1.rtlInput)()]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>
426
+ <react_native_1.TextInput style={[styles.followUpInput, { borderColor: theme.borderColor, color: theme.textColor, borderRadius: theme.cornerRadius }, (0, XeboRtl_1.rtlInput)()]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>
436
427
  </react_native_1.View>)}
437
428
  </react_native_1.ScrollView>
438
429
 
@@ -496,7 +487,7 @@ const styles = react_native_1.StyleSheet.create({
496
487
  },
497
488
  arcCheckText: { fontSize: 9, fontWeight: '800' },
498
489
  arcFaceNumber: { width: 24, height: 16, textAlign: 'center', fontSize: 12, fontWeight: '500', color: '#4B5563' },
499
- emojiCell: { backgroundColor: '#FFFFFF', borderColor: '#CBD1DC', borderWidth: 1, borderRadius: 2 },
490
+ emojiCell: { borderWidth: 1, borderRadius: 2 },
500
491
  labelsRow: {
501
492
  flexDirection: 'row',
502
493
  justifyContent: 'space-between',
@@ -511,7 +502,6 @@ const styles = react_native_1.StyleSheet.create({
511
502
  followUpTitle: { fontSize: 15, fontWeight: '600', marginBottom: 12 },
512
503
  followUpOption: {
513
504
  borderWidth: 1.5,
514
- borderColor: '#E5E7EB',
515
505
  borderRadius: 8,
516
506
  padding: 10,
517
507
  marginBottom: 8,
@@ -95,8 +95,8 @@ exports.XeboPageView = (0, react_1.forwardRef)(({ questions, isLastPage, onOk, o
95
95
  // In the bottom row Previous takes the same size as Next/Submit, like the web.
96
96
  const previousButton = (index, bottom = false) => {
97
97
  var _a, _b, _c;
98
- return previousIconOnly ? (<react_native_1.TouchableOpacity style={[styles.iconButton, { backgroundColor: (_a = prevColor === null || prevColor === void 0 ? void 0 : prevColor.background) !== null && _a !== void 0 ? _a : '#F2F2F2', borderRadius: theme.cornerRadius }]} onPress={() => handlePrevious(index)} activeOpacity={0.8} accessibilityLabel={previousLabel}>
99
- <react_native_1.Text style={[styles.iconText, { color: (_b = prevColor === null || prevColor === void 0 ? void 0 : prevColor.text) !== null && _b !== void 0 ? _b : '#1F2937' }]}>{(0, XeboRtl_1.isRtl)() ? '›' : '‹'}</react_native_1.Text>
98
+ return previousIconOnly ? (<react_native_1.TouchableOpacity style={[styles.iconButton, { backgroundColor: (_a = prevColor === null || prevColor === void 0 ? void 0 : prevColor.background) !== null && _a !== void 0 ? _a : theme.selectedSurfaceColor, borderRadius: theme.cornerRadius }]} onPress={() => handlePrevious(index)} activeOpacity={0.8} accessibilityLabel={previousLabel}>
99
+ <react_native_1.Text style={[styles.iconText, { color: (_b = prevColor === null || prevColor === void 0 ? void 0 : prevColor.text) !== null && _b !== void 0 ? _b : theme.textColor }]}>{(0, XeboRtl_1.isRtl)() ? '›' : '‹'}</react_native_1.Text>
100
100
  </react_native_1.TouchableOpacity>) : (<react_native_1.TouchableOpacity style={[
101
101
  bottom ? styles.button : styles.pairButton,
102
102
  { borderRadius: theme.cornerRadius },
@@ -1 +1 @@
1
- {"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAWjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAc,MAAM,sBAAsB,CAAC;AAKhG,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,+FAA+F;IAC/F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAYD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAe,EAAE,IAAS,EAAE,KAAK,EAAE,YAAY,GAC/E,EAAE;IACD,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,qBAmDA;AAsFD,eAAO,MAAM,cAAc,kFAgKzB,CAAC"}
1
+ {"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAWjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAc,MAAM,sBAAsB,CAAC;AAKhG,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACvC,+FAA+F;IAC/F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAYD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAe,EAAE,IAAS,EAAE,KAAK,EAAE,YAAY,GAC/E,EAAE;IACD,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,qBAmDA;AAuFD,eAAO,MAAM,cAAc,kFAgKzB,CAAC"}
@@ -64,7 +64,7 @@ function FlatEmoji({ index, selected, hasSelection, outline = false, size = 44,
64
64
  width: size,
65
65
  height: size,
66
66
  borderRadius: size / 2,
67
- backgroundColor: outline ? '#fff' : conf.bg,
67
+ backgroundColor: outline ? (0, XeboTheme_1.getTheme)().surfaceColor : conf.bg,
68
68
  borderWidth: outline ? 2 : 0,
69
69
  borderColor: conf.bg,
70
70
  opacity,
@@ -94,9 +94,10 @@ function FlatEmoji({ index, selected, hasSelection, outline = false, size = 44,
94
94
  }
95
95
  function RatingIcon({ style, index, selected, filled, color, hasSelection, }) {
96
96
  const activeColor = color || '#F59E0B';
97
+ const theme = (0, XeboTheme_1.getTheme)();
97
98
  switch (style) {
98
99
  case 'heart':
99
- return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : '#E5E7EB' }}>
100
+ return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : theme.borderColor }}>
100
101
  {filled ? '♥' : '♡'}
101
102
  </react_native_1.Text>);
102
103
  case 'circle':
@@ -106,11 +107,11 @@ function RatingIcon({ style, index, selected, filled, color, hasSelection, }) {
106
107
  borderRadius: 21,
107
108
  backgroundColor: 'transparent',
108
109
  borderWidth: filled ? 3 : 1.5,
109
- borderColor: filled ? activeColor : '#D1D5DB',
110
+ borderColor: filled ? activeColor : theme.strongBorderColor,
110
111
  alignItems: 'center',
111
112
  justifyContent: 'center',
112
113
  }}>
113
- <react_native_1.Text style={{ fontSize: 16, fontWeight: '600', color: filled ? activeColor : '#6B7280' }}>
114
+ <react_native_1.Text style={{ fontSize: 16, fontWeight: '600', color: filled ? activeColor : theme.mutedTextColor }}>
114
115
  {index + 1}
115
116
  </react_native_1.Text>
116
117
  </react_native_1.View>);
@@ -119,13 +120,13 @@ function RatingIcon({ style, index, selected, filled, color, hasSelection, }) {
119
120
  width: 44,
120
121
  height: 44,
121
122
  borderRadius: 8,
122
- backgroundColor: filled ? activeColor : '#F3F4F6',
123
+ backgroundColor: filled ? activeColor : theme.selectedSurfaceColor,
123
124
  borderWidth: filled ? 0 : 1.5,
124
- borderColor: '#D1D5DB',
125
+ borderColor: theme.strongBorderColor,
125
126
  alignItems: 'center',
126
127
  justifyContent: 'center',
127
128
  }}>
128
- <react_native_1.Text style={{ fontSize: 15, fontWeight: '700', color: filled ? '#FFF' : '#6B7280' }}>
129
+ <react_native_1.Text style={{ fontSize: 15, fontWeight: '700', color: filled ? '#FFF' : theme.mutedTextColor }}>
129
130
  {index + 1}
130
131
  </react_native_1.Text>
131
132
  </react_native_1.View>);
@@ -142,7 +143,7 @@ function RatingIcon({ style, index, selected, filled, color, hasSelection, }) {
142
143
  return <FlatEmoji index={index} selected={selected} hasSelection={hasSelection} outline/>;
143
144
  case 'star':
144
145
  default:
145
- return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : '#E5E7EB' }}>
146
+ return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : theme.borderColor }}>
146
147
  {filled ? '★' : '☆'}
147
148
  </react_native_1.Text>);
148
149
  }
@@ -239,11 +240,11 @@ exports.XeboRatingView = (0, react_1.forwardRef)(({ question, isLastQuestion, on
239
240
  </react_native_1.View>
240
241
 
241
242
  {/* Follow-up after rating */}
242
- {selected !== null && !!question.followUpQuestion && (<react_native_1.View style={[styles.followUpCard, { borderRadius: theme.cornerRadius }]}>
243
+ {selected !== null && !!question.followUpQuestion && (<react_native_1.View style={[styles.followUpCard, { borderColor: theme.borderColor, borderRadius: theme.cornerRadius }]}>
243
244
  <react_native_1.Text style={[styles.followUpTitle, { color: theme.textColor, fontFamily: theme.fontFamily }, (0, XeboRtl_1.rtlText)()]}>
244
245
  {question.followUpQuestion}
245
246
  </react_native_1.Text>
246
- <react_native_1.TextInput style={[styles.followUpInput, { borderColor: '#E5E7EB', color: theme.textColor, borderRadius: theme.cornerRadius }, (0, XeboRtl_1.rtlInput)()]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>
247
+ <react_native_1.TextInput style={[styles.followUpInput, { borderColor: theme.borderColor, color: theme.textColor, borderRadius: theme.cornerRadius }, (0, XeboRtl_1.rtlInput)()]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>
247
248
  </react_native_1.View>)}
248
249
  </react_native_1.ScrollView>
249
250
 
@@ -281,7 +282,6 @@ const styles = react_native_1.StyleSheet.create({
281
282
  colLabel: { fontSize: 11, opacity: 0.6, textAlign: 'center', marginTop: 6 },
282
283
  followUpCard: {
283
284
  borderWidth: 1.5,
284
- borderColor: '#E5E7EB',
285
285
  padding: 14,
286
286
  marginBottom: 16,
287
287
  },
@@ -98,8 +98,8 @@ exports.XeboSingleChoiceView = (0, react_1.forwardRef)(({ question, isLastQuesti
98
98
  return (<react_native_1.TouchableOpacity key={choice.id} style={[
99
99
  styles.optionRow,
100
100
  selected
101
- ? { borderColor: theme.primaryColor, backgroundColor: '#F3F4F6' }
102
- : { borderColor: '#E5E7EB' },
101
+ ? { borderColor: theme.primaryColor, backgroundColor: theme.selectedSurfaceColor }
102
+ : { borderColor: theme.borderColor },
103
103
  ]} onPress={() => handleSelect(choice)} activeOpacity={0.7}>
104
104
  <react_native_1.Text style={[styles.optionText, { color: theme.textColor, fontFamily: theme.fontFamily }, (0, XeboRtl_1.rtlText)()]}>
105
105
  {choice.text}
@@ -441,7 +441,7 @@ const XeboSurveyModal = () => {
441
441
  ]}>
442
442
  {/* Handle bar */}
443
443
  <react_native_1.View style={styles.handleWrap}>
444
- <react_native_1.View style={styles.handle}/>
444
+ <react_native_1.View style={[styles.handle, { backgroundColor: theme.strongBorderColor }]}/>
445
445
  </react_native_1.View>
446
446
 
447
447
  {/* Header row: Survey name / X close on the thank-you page */}
@@ -501,7 +501,6 @@ const styles = react_native_1.StyleSheet.create({
501
501
  width: 36,
502
502
  height: 4,
503
503
  borderRadius: 2,
504
- backgroundColor: '#D1D5DB',
505
504
  },
506
505
  headerRow: {
507
506
  flexDirection: 'row',
@@ -111,7 +111,7 @@ exports.XeboTextBoxView = (0, react_1.forwardRef)(({ question, isLastQuestion, o
111
111
  <react_native_1.TextInput style={[
112
112
  styles.input,
113
113
  {
114
- borderColor: '#E5E7EB',
114
+ borderColor: theme.borderColor,
115
115
  color: theme.textColor,
116
116
  fontFamily: theme.fontFamily,
117
117
  borderRadius: theme.cornerRadius,
@@ -5,7 +5,14 @@ export interface XeboTheme {
5
5
  textColor: string;
6
6
  cornerRadius: number;
7
7
  fontFamily: string | undefined;
8
+ surfaceColor: string;
9
+ selectedSurfaceColor: string;
10
+ borderColor: string;
11
+ strongBorderColor: string;
12
+ mutedTextColor: string;
8
13
  }
14
+ /** Returns true if the hex color is perceived as dark (use white text on top) */
15
+ export declare function isColorDark(hex: string): boolean;
9
16
  export declare function configureTheme(config: XeboThemeConfig): void;
10
17
  export declare function getTheme(): XeboTheme;
11
18
  //# sourceMappingURL=XeboTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"XeboTheme.d.ts","sourceRoot":"","sources":["../../src/theme/XeboTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAYD,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAQ5D;AAED,wBAAgB,QAAQ,IAAI,SAAS,CAEpC"}
1
+ {"version":3,"file":"XeboTheme.d.ts","sourceRoot":"","sources":["../../src/theme/XeboTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAkBD,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhD;AAaD,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAU5D;AAED,wBAAgB,QAAQ,IAAI,SAAS,CAEpC"}
@@ -1,24 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isColorDark = isColorDark;
3
4
  exports.configureTheme = configureTheme;
4
5
  exports.getTheme = getTheme;
5
- const defaultTheme = {
6
- primaryColor: '#4F46E5',
7
- backgroundColor: '#FFFFFF',
8
- textColor: '#1F2937',
9
- cornerRadius: 12,
10
- fontFamily: undefined,
6
+ const lightNeutrals = {
7
+ surfaceColor: '#FFFFFF',
8
+ selectedSurfaceColor: '#F3F4F6',
9
+ borderColor: '#E5E7EB',
10
+ strongBorderColor: '#D1D5DB',
11
+ mutedTextColor: '#6B7280',
11
12
  };
13
+ const darkNeutrals = {
14
+ surfaceColor: '#1F2937',
15
+ selectedSurfaceColor: '#374151',
16
+ borderColor: '#374151',
17
+ strongBorderColor: '#4B5563',
18
+ mutedTextColor: '#9CA3AF',
19
+ };
20
+ /** Returns true if the hex color is perceived as dark (use white text on top) */
21
+ function isColorDark(hex) {
22
+ const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
23
+ if (!m)
24
+ return false;
25
+ const r = parseInt(m[1], 16) / 255;
26
+ const g = parseInt(m[2], 16) / 255;
27
+ const b = parseInt(m[3], 16) / 255;
28
+ return 0.299 * r + 0.587 * g + 0.114 * b < 0.5;
29
+ }
30
+ const defaultTheme = Object.assign({ primaryColor: '#4F46E5', backgroundColor: '#FFFFFF', textColor: '#1F2937', cornerRadius: 12, fontFamily: undefined }, lightNeutrals);
12
31
  let currentTheme = Object.assign({}, defaultTheme);
13
32
  function configureTheme(config) {
14
33
  var _a, _b, _c, _d, _e;
15
- currentTheme = {
16
- primaryColor: (_a = config.primaryColor) !== null && _a !== void 0 ? _a : defaultTheme.primaryColor,
17
- backgroundColor: (_b = config.backgroundColor) !== null && _b !== void 0 ? _b : defaultTheme.backgroundColor,
18
- textColor: (_c = config.textColor) !== null && _c !== void 0 ? _c : defaultTheme.textColor,
19
- cornerRadius: (_d = config.cornerRadius) !== null && _d !== void 0 ? _d : defaultTheme.cornerRadius,
20
- fontFamily: (_e = config.fontFamily) !== null && _e !== void 0 ? _e : defaultTheme.fontFamily,
21
- };
34
+ const backgroundColor = (_a = config.backgroundColor) !== null && _a !== void 0 ? _a : defaultTheme.backgroundColor;
35
+ currentTheme = Object.assign({ primaryColor: (_b = config.primaryColor) !== null && _b !== void 0 ? _b : defaultTheme.primaryColor, backgroundColor, textColor: (_c = config.textColor) !== null && _c !== void 0 ? _c : defaultTheme.textColor, cornerRadius: (_d = config.cornerRadius) !== null && _d !== void 0 ? _d : defaultTheme.cornerRadius, fontFamily: (_e = config.fontFamily) !== null && _e !== void 0 ? _e : defaultTheme.fontFamily }, (isColorDark(backgroundColor) ? darkNeutrals : lightNeutrals));
22
36
  }
23
37
  function getTheme() {
24
38
  return currentTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-my-survey-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Xebo survey collection SDK for React Native",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",