react-native-my-survey-sdk 3.0.8 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/XeboRatingView.d.ts.map +1 -1
- package/dist/components/XeboRatingView.js +28 -15
- package/dist/components/XeboSurveyModal.d.ts.map +1 -1
- package/dist/components/XeboSurveyModal.js +3 -2
- package/dist/components/XeboTextBoxView.d.ts.map +1 -1
- package/dist/components/XeboTextBoxView.js +2 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGhE,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;
|
|
1
|
+
{"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGhE,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AA6ID,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAgJ1C,CAAC"}
|
|
@@ -45,18 +45,19 @@ const FLAT_EMOJI_CONFIGS = [
|
|
|
45
45
|
{ bg: '#8AC926', mouth: 'smile' },
|
|
46
46
|
{ bg: '#21B573', mouth: 'bigSmile' },
|
|
47
47
|
];
|
|
48
|
-
function FlatEmoji({ index, selected }) {
|
|
48
|
+
function FlatEmoji({ index, selected, hasSelection }) {
|
|
49
49
|
const conf = FLAT_EMOJI_CONFIGS[Math.min(index, FLAT_EMOJI_CONFIGS.length - 1)];
|
|
50
50
|
const size = 44;
|
|
51
51
|
const eyeSize = 5;
|
|
52
52
|
const mouthW = 18;
|
|
53
53
|
const mouthH = 9;
|
|
54
|
+
const opacity = hasSelection ? (selected ? 1 : 0.35) : 1;
|
|
54
55
|
return (<react_native_1.View style={{
|
|
55
56
|
width: size,
|
|
56
57
|
height: size,
|
|
57
58
|
borderRadius: size / 2,
|
|
58
59
|
backgroundColor: conf.bg,
|
|
59
|
-
opacity
|
|
60
|
+
opacity,
|
|
60
61
|
alignItems: 'center',
|
|
61
62
|
justifyContent: 'center',
|
|
62
63
|
}}>
|
|
@@ -81,7 +82,7 @@ function FlatEmoji({ index, selected }) {
|
|
|
81
82
|
</react_native_1.View>)}
|
|
82
83
|
</react_native_1.View>);
|
|
83
84
|
}
|
|
84
|
-
function RatingIcon({ style, index, selected, filled, color, }) {
|
|
85
|
+
function RatingIcon({ style, index, selected, filled, color, hasSelection, }) {
|
|
85
86
|
const activeColor = color || '#F59E0B';
|
|
86
87
|
switch (style) {
|
|
87
88
|
case 'heart':
|
|
@@ -90,13 +91,19 @@ function RatingIcon({ style, index, selected, filled, color, }) {
|
|
|
90
91
|
</react_native_1.Text>);
|
|
91
92
|
case 'circle':
|
|
92
93
|
return (<react_native_1.View style={{
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
95
|
-
borderRadius:
|
|
94
|
+
width: 42,
|
|
95
|
+
height: 42,
|
|
96
|
+
borderRadius: 21,
|
|
96
97
|
backgroundColor: filled ? activeColor : 'transparent',
|
|
97
|
-
borderWidth: 2,
|
|
98
|
+
borderWidth: filled ? 2.5 : 1.5,
|
|
98
99
|
borderColor: filled ? activeColor : '#D1D5DB',
|
|
99
|
-
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
}}>
|
|
103
|
+
<react_native_1.Text style={{ fontSize: 16, fontWeight: '600', color: filled ? '#FFFFFF' : '#6B7280' }}>
|
|
104
|
+
{index + 1}
|
|
105
|
+
</react_native_1.Text>
|
|
106
|
+
</react_native_1.View>);
|
|
100
107
|
case 'tile':
|
|
101
108
|
return (<react_native_1.View style={{
|
|
102
109
|
width: 44,
|
|
@@ -118,11 +125,9 @@ function RatingIcon({ style, index, selected, filled, color, }) {
|
|
|
118
125
|
case 'smiley':
|
|
119
126
|
case 'smileys':
|
|
120
127
|
case 'faces':
|
|
121
|
-
return <FlatEmoji index={index} selected={selected}/>;
|
|
122
|
-
case '3d_emoji':
|
|
123
|
-
|
|
124
|
-
return <FlatEmoji index={index} selected={selected}/>;
|
|
125
|
-
}
|
|
128
|
+
return <FlatEmoji index={index} selected={selected} hasSelection={hasSelection}/>;
|
|
129
|
+
case '3d_emoji':
|
|
130
|
+
return <FlatEmoji index={index} selected={selected} hasSelection={hasSelection}/>;
|
|
126
131
|
case 'star':
|
|
127
132
|
default:
|
|
128
133
|
return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : '#E5E7EB' }}>
|
|
@@ -190,8 +195,16 @@ const XeboRatingView = ({ question, isLastQuestion, onAnswer }) => {
|
|
|
190
195
|
const isFilled = isCumulative ? selected !== null && i <= selected : i === selected;
|
|
191
196
|
const label = question.showColLabels ? (_b = (_a = question.columns) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.text : undefined;
|
|
192
197
|
return (<react_native_1.TouchableOpacity key={i} onPress={() => handleSelect(i)} style={styles.iconButton} activeOpacity={0.7}>
|
|
193
|
-
<RatingIcon style={ratingStyle} index={i} selected={i === selected} filled={isFilled} color={ratingColor} totalSteps={totalSteps}/>
|
|
194
|
-
{!!label && (<react_native_1.Text style={[
|
|
198
|
+
<RatingIcon style={ratingStyle} index={i} selected={i === selected} filled={isFilled} color={ratingColor} totalSteps={totalSteps} hasSelection={selected !== null}/>
|
|
199
|
+
{!!label && (<react_native_1.Text style={[
|
|
200
|
+
styles.colLabel,
|
|
201
|
+
{
|
|
202
|
+
color: i === selected ? ratingColor : theme.textColor,
|
|
203
|
+
fontFamily: theme.fontFamily,
|
|
204
|
+
opacity: i === selected ? 1 : 0.5,
|
|
205
|
+
fontWeight: i === selected ? '600' : '400',
|
|
206
|
+
},
|
|
207
|
+
]} numberOfLines={1}>
|
|
195
208
|
{label}
|
|
196
209
|
</react_native_1.Text>)}
|
|
197
210
|
</react_native_1.TouchableOpacity>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboSurveyModal.d.ts","sourceRoot":"","sources":["../../src/components/XeboSurveyModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAqEjF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"XeboSurveyModal.d.ts","sourceRoot":"","sources":["../../src/components/XeboSurveyModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAqEjF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAkPnC,CAAC"}
|
|
@@ -74,7 +74,7 @@ function computeSheetHeight(question, screen, sh) {
|
|
|
74
74
|
case XeboModels_1.XeboQuestionType.rating:
|
|
75
75
|
return question.followUpQuestion ? sh * 0.55 : sh * 0.38;
|
|
76
76
|
case XeboModels_1.XeboQuestionType.singleTextBox:
|
|
77
|
-
return sh * 0.
|
|
77
|
+
return sh * 0.55;
|
|
78
78
|
case XeboModels_1.XeboQuestionType.multipleTextBox: {
|
|
79
79
|
const fieldCount = (_f = (_e = question.options) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 1;
|
|
80
80
|
return Math.min(sh * 0.70, sh * (0.28 + fieldCount * 0.10));
|
|
@@ -195,7 +195,8 @@ const XeboSurveyModal = () => {
|
|
|
195
195
|
const isLast = questionIndex === lastRealIndex;
|
|
196
196
|
// key must be passed directly (not via spread) — forces unmount/remount on question change,
|
|
197
197
|
// resetting all component state (selected score, text, etc.)
|
|
198
|
-
const
|
|
198
|
+
const numberedQuestion = Object.assign(Object.assign({}, question), { title: `${questionIndex + 1}. ${question.title}` });
|
|
199
|
+
const commonProps = { question: numberedQuestion, isLastQuestion: isLast, onAnswer: handleAnswer };
|
|
199
200
|
switch (question.type) {
|
|
200
201
|
case XeboModels_1.XeboQuestionType.singleChoice:
|
|
201
202
|
return <XeboSingleChoiceView_1.XeboSingleChoiceView key={question.id} {...commonProps}/>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboTextBoxView.d.ts","sourceRoot":"","sources":["../../src/components/XeboTextBoxView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAoB,MAAM,sBAAsB,CAAC;AAGlF,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"XeboTextBoxView.d.ts","sourceRoot":"","sources":["../../src/components/XeboTextBoxView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAoB,MAAM,sBAAsB,CAAC;AAGlF,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAmH3C,CAAC"}
|
|
@@ -104,8 +104,9 @@ const XeboTextBoxView = ({ question, isLastQuestion, onAnswer }) => {
|
|
|
104
104
|
color: theme.textColor,
|
|
105
105
|
fontFamily: theme.fontFamily,
|
|
106
106
|
borderRadius: theme.cornerRadius,
|
|
107
|
+
minHeight: isMulti ? 48 : 130,
|
|
107
108
|
},
|
|
108
|
-
]} placeholder={isMulti ? '' : (question.placeholder || 'Type your answer here...')} placeholderTextColor="#9CA3AF" value={(_a = values[field.id]) !== null && _a !== void 0 ? _a : ''} onChangeText={text => handleChange(field.id, text)} onFocus={() => handleFocus(idx)} multiline={!isMulti} numberOfLines={isMulti ? 1 :
|
|
109
|
+
]} placeholder={isMulti ? '' : (question.placeholder || 'Type your answer here...')} placeholderTextColor="#9CA3AF" value={(_a = values[field.id]) !== null && _a !== void 0 ? _a : ''} onChangeText={text => handleChange(field.id, text)} onFocus={() => handleFocus(idx)} multiline={!isMulti} numberOfLines={isMulti ? 1 : 6} textAlignVertical={isMulti ? 'center' : 'top'} returnKeyType={idx === fields.length - 1 ? 'done' : 'next'}/>
|
|
109
110
|
</react_native_1.View>);
|
|
110
111
|
})}
|
|
111
112
|
</react_native_1.ScrollView>
|