@cxpinsight/react-native 0.2.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.
Files changed (253) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -0
  3. package/babel.js +101 -0
  4. package/instrumented/Pressable.d.ts +2 -0
  5. package/instrumented/Pressable.js +2 -0
  6. package/instrumented/ScrollView.d.ts +2 -0
  7. package/instrumented/ScrollView.js +2 -0
  8. package/instrumented/TextInput.d.ts +2 -0
  9. package/instrumented/TextInput.js +2 -0
  10. package/instrumented/TouchableOpacity.d.ts +2 -0
  11. package/instrumented/TouchableOpacity.js +2 -0
  12. package/lib/CXPinsight.d.ts +113 -0
  13. package/lib/CXPinsight.d.ts.map +1 -0
  14. package/lib/CXPinsight.js +831 -0
  15. package/lib/CXPinsight.js.map +1 -0
  16. package/lib/CXPinsightProvider.d.ts +19 -0
  17. package/lib/CXPinsightProvider.d.ts.map +1 -0
  18. package/lib/CXPinsightProvider.js +382 -0
  19. package/lib/CXPinsightProvider.js.map +1 -0
  20. package/lib/core/autoScreenTracker.d.ts +20 -0
  21. package/lib/core/autoScreenTracker.d.ts.map +1 -0
  22. package/lib/core/autoScreenTracker.js +66 -0
  23. package/lib/core/autoScreenTracker.js.map +1 -0
  24. package/lib/core/deepLinkTracker.d.ts +17 -0
  25. package/lib/core/deepLinkTracker.d.ts.map +1 -0
  26. package/lib/core/deepLinkTracker.js +81 -0
  27. package/lib/core/deepLinkTracker.js.map +1 -0
  28. package/lib/core/deviceInfo.d.ts +14 -0
  29. package/lib/core/deviceInfo.d.ts.map +1 -0
  30. package/lib/core/deviceInfo.js +166 -0
  31. package/lib/core/deviceInfo.js.map +1 -0
  32. package/lib/core/eventQueue.d.ts +23 -0
  33. package/lib/core/eventQueue.d.ts.map +1 -0
  34. package/lib/core/eventQueue.js +240 -0
  35. package/lib/core/eventQueue.js.map +1 -0
  36. package/lib/core/lifecycle.d.ts +18 -0
  37. package/lib/core/lifecycle.d.ts.map +1 -0
  38. package/lib/core/lifecycle.js +127 -0
  39. package/lib/core/lifecycle.js.map +1 -0
  40. package/lib/core/mobileRecorder.d.ts +15 -0
  41. package/lib/core/mobileRecorder.d.ts.map +1 -0
  42. package/lib/core/mobileRecorder.js +231 -0
  43. package/lib/core/mobileRecorder.js.map +1 -0
  44. package/lib/core/network.d.ts +10 -0
  45. package/lib/core/network.d.ts.map +1 -0
  46. package/lib/core/network.js +74 -0
  47. package/lib/core/network.js.map +1 -0
  48. package/lib/core/networkCapture.d.ts +22 -0
  49. package/lib/core/networkCapture.d.ts.map +1 -0
  50. package/lib/core/networkCapture.js +100 -0
  51. package/lib/core/networkCapture.js.map +1 -0
  52. package/lib/core/scrollCapture.d.ts +48 -0
  53. package/lib/core/scrollCapture.d.ts.map +1 -0
  54. package/lib/core/scrollCapture.js +221 -0
  55. package/lib/core/scrollCapture.js.map +1 -0
  56. package/lib/core/session.d.ts +15 -0
  57. package/lib/core/session.d.ts.map +1 -0
  58. package/lib/core/session.js +157 -0
  59. package/lib/core/session.js.map +1 -0
  60. package/lib/core/storage.d.ts +11 -0
  61. package/lib/core/storage.d.ts.map +1 -0
  62. package/lib/core/storage.js +59 -0
  63. package/lib/core/storage.js.map +1 -0
  64. package/lib/core/triggerEngine.d.ts +56 -0
  65. package/lib/core/triggerEngine.d.ts.map +1 -0
  66. package/lib/core/triggerEngine.js +432 -0
  67. package/lib/core/triggerEngine.js.map +1 -0
  68. package/lib/index.d.ts +7 -0
  69. package/lib/index.d.ts.map +1 -0
  70. package/lib/index.js +11 -0
  71. package/lib/index.js.map +1 -0
  72. package/lib/instrumented/Pressable.d.ts +9 -0
  73. package/lib/instrumented/Pressable.d.ts.map +1 -0
  74. package/lib/instrumented/Pressable.js +96 -0
  75. package/lib/instrumented/Pressable.js.map +1 -0
  76. package/lib/instrumented/ScrollView.d.ts +6 -0
  77. package/lib/instrumented/ScrollView.d.ts.map +1 -0
  78. package/lib/instrumented/ScrollView.js +101 -0
  79. package/lib/instrumented/ScrollView.js.map +1 -0
  80. package/lib/instrumented/TextInput.d.ts +9 -0
  81. package/lib/instrumented/TextInput.d.ts.map +1 -0
  82. package/lib/instrumented/TextInput.js +75 -0
  83. package/lib/instrumented/TextInput.js.map +1 -0
  84. package/lib/instrumented/TouchableOpacity.d.ts +11 -0
  85. package/lib/instrumented/TouchableOpacity.d.ts.map +1 -0
  86. package/lib/instrumented/TouchableOpacity.js +96 -0
  87. package/lib/instrumented/TouchableOpacity.js.map +1 -0
  88. package/lib/instrumented/index.d.ts +19 -0
  89. package/lib/instrumented/index.d.ts.map +1 -0
  90. package/lib/instrumented/index.js +28 -0
  91. package/lib/instrumented/index.js.map +1 -0
  92. package/lib/instrumented/interactionObserver.d.ts +29 -0
  93. package/lib/instrumented/interactionObserver.d.ts.map +1 -0
  94. package/lib/instrumented/interactionObserver.js +38 -0
  95. package/lib/instrumented/interactionObserver.js.map +1 -0
  96. package/lib/setup/AccessibilityScanner.d.ts +32 -0
  97. package/lib/setup/AccessibilityScanner.d.ts.map +1 -0
  98. package/lib/setup/AccessibilityScanner.js +127 -0
  99. package/lib/setup/AccessibilityScanner.js.map +1 -0
  100. package/lib/setup/ElementIdentifier.d.ts +65 -0
  101. package/lib/setup/ElementIdentifier.d.ts.map +1 -0
  102. package/lib/setup/ElementIdentifier.js +114 -0
  103. package/lib/setup/ElementIdentifier.js.map +1 -0
  104. package/lib/setup/ElementRegistry.d.ts +22 -0
  105. package/lib/setup/ElementRegistry.d.ts.map +1 -0
  106. package/lib/setup/ElementRegistry.js +47 -0
  107. package/lib/setup/ElementRegistry.js.map +1 -0
  108. package/lib/setup/SetupCodeEntry.d.ts +15 -0
  109. package/lib/setup/SetupCodeEntry.d.ts.map +1 -0
  110. package/lib/setup/SetupCodeEntry.js +198 -0
  111. package/lib/setup/SetupCodeEntry.js.map +1 -0
  112. package/lib/setup/SetupController.d.ts +29 -0
  113. package/lib/setup/SetupController.d.ts.map +1 -0
  114. package/lib/setup/SetupController.js +189 -0
  115. package/lib/setup/SetupController.js.map +1 -0
  116. package/lib/setup/SetupOverlay.d.ts +10 -0
  117. package/lib/setup/SetupOverlay.d.ts.map +1 -0
  118. package/lib/setup/SetupOverlay.js +408 -0
  119. package/lib/setup/SetupOverlay.js.map +1 -0
  120. package/lib/setup/TapInterceptor.d.ts +19 -0
  121. package/lib/setup/TapInterceptor.d.ts.map +1 -0
  122. package/lib/setup/TapInterceptor.js +98 -0
  123. package/lib/setup/TapInterceptor.js.map +1 -0
  124. package/lib/setup/TouchObserver.d.ts +25 -0
  125. package/lib/setup/TouchObserver.d.ts.map +1 -0
  126. package/lib/setup/TouchObserver.js +88 -0
  127. package/lib/setup/TouchObserver.js.map +1 -0
  128. package/lib/setup/TouchPatcher.d.ts +27 -0
  129. package/lib/setup/TouchPatcher.d.ts.map +1 -0
  130. package/lib/setup/TouchPatcher.js +182 -0
  131. package/lib/setup/TouchPatcher.js.map +1 -0
  132. package/lib/setup/index.d.ts +13 -0
  133. package/lib/setup/index.d.ts.map +1 -0
  134. package/lib/setup/index.js +45 -0
  135. package/lib/setup/index.js.map +1 -0
  136. package/lib/setup/useCXPElement.d.ts +25 -0
  137. package/lib/setup/useCXPElement.d.ts.map +1 -0
  138. package/lib/setup/useCXPElement.js +33 -0
  139. package/lib/setup/useCXPElement.js.map +1 -0
  140. package/lib/survey/SurveyModal.d.ts +10 -0
  141. package/lib/survey/SurveyModal.d.ts.map +1 -0
  142. package/lib/survey/SurveyModal.js +1650 -0
  143. package/lib/survey/SurveyModal.js.map +1 -0
  144. package/lib/survey/expressionEval.d.ts +10 -0
  145. package/lib/survey/expressionEval.d.ts.map +1 -0
  146. package/lib/survey/expressionEval.js +287 -0
  147. package/lib/survey/expressionEval.js.map +1 -0
  148. package/lib/survey/frequencyCap.d.ts +15 -0
  149. package/lib/survey/frequencyCap.d.ts.map +1 -0
  150. package/lib/survey/frequencyCap.js +116 -0
  151. package/lib/survey/frequencyCap.js.map +1 -0
  152. package/lib/survey/handsFreeVoice.d.ts +30 -0
  153. package/lib/survey/handsFreeVoice.d.ts.map +1 -0
  154. package/lib/survey/handsFreeVoice.js +312 -0
  155. package/lib/survey/handsFreeVoice.js.map +1 -0
  156. package/lib/survey/interpolate.d.ts +6 -0
  157. package/lib/survey/interpolate.d.ts.map +1 -0
  158. package/lib/survey/interpolate.js +61 -0
  159. package/lib/survey/interpolate.js.map +1 -0
  160. package/lib/survey/pagesFromV1.d.ts +6 -0
  161. package/lib/survey/pagesFromV1.d.ts.map +1 -0
  162. package/lib/survey/pagesFromV1.js +83 -0
  163. package/lib/survey/pagesFromV1.js.map +1 -0
  164. package/lib/survey/questions/CSATQuestion.d.ts +16 -0
  165. package/lib/survey/questions/CSATQuestion.d.ts.map +1 -0
  166. package/lib/survey/questions/CSATQuestion.js +37 -0
  167. package/lib/survey/questions/CSATQuestion.js.map +1 -0
  168. package/lib/survey/questions/DateQuestion.d.ts +20 -0
  169. package/lib/survey/questions/DateQuestion.d.ts.map +1 -0
  170. package/lib/survey/questions/DateQuestion.js +103 -0
  171. package/lib/survey/questions/DateQuestion.js.map +1 -0
  172. package/lib/survey/questions/ImagePickerQuestion.d.ts +33 -0
  173. package/lib/survey/questions/ImagePickerQuestion.d.ts.map +1 -0
  174. package/lib/survey/questions/ImagePickerQuestion.js +68 -0
  175. package/lib/survey/questions/ImagePickerQuestion.js.map +1 -0
  176. package/lib/survey/questions/ImageQuestion.d.ts +26 -0
  177. package/lib/survey/questions/ImageQuestion.d.ts.map +1 -0
  178. package/lib/survey/questions/ImageQuestion.js +24 -0
  179. package/lib/survey/questions/ImageQuestion.js.map +1 -0
  180. package/lib/survey/questions/MatrixCell.d.ts +45 -0
  181. package/lib/survey/questions/MatrixCell.d.ts.map +1 -0
  182. package/lib/survey/questions/MatrixCell.js +54 -0
  183. package/lib/survey/questions/MatrixCell.js.map +1 -0
  184. package/lib/survey/questions/MatrixDropdownQuestion.d.ts +29 -0
  185. package/lib/survey/questions/MatrixDropdownQuestion.d.ts.map +1 -0
  186. package/lib/survey/questions/MatrixDropdownQuestion.js +42 -0
  187. package/lib/survey/questions/MatrixDropdownQuestion.js.map +1 -0
  188. package/lib/survey/questions/MatrixDynamicQuestion.d.ts +26 -0
  189. package/lib/survey/questions/MatrixDynamicQuestion.d.ts.map +1 -0
  190. package/lib/survey/questions/MatrixDynamicQuestion.js +52 -0
  191. package/lib/survey/questions/MatrixDynamicQuestion.js.map +1 -0
  192. package/lib/survey/questions/MatrixQuestion.d.ts +38 -0
  193. package/lib/survey/questions/MatrixQuestion.d.ts.map +1 -0
  194. package/lib/survey/questions/MatrixQuestion.js +64 -0
  195. package/lib/survey/questions/MatrixQuestion.js.map +1 -0
  196. package/lib/survey/questions/MultiTextQuestion.d.ts +19 -0
  197. package/lib/survey/questions/MultiTextQuestion.d.ts.map +1 -0
  198. package/lib/survey/questions/MultiTextQuestion.js +64 -0
  199. package/lib/survey/questions/MultiTextQuestion.js.map +1 -0
  200. package/lib/survey/questions/MultipleChoiceQuestion.d.ts +25 -0
  201. package/lib/survey/questions/MultipleChoiceQuestion.d.ts.map +1 -0
  202. package/lib/survey/questions/MultipleChoiceQuestion.js +111 -0
  203. package/lib/survey/questions/MultipleChoiceQuestion.js.map +1 -0
  204. package/lib/survey/questions/NPSQuestion.d.ts +18 -0
  205. package/lib/survey/questions/NPSQuestion.d.ts.map +1 -0
  206. package/lib/survey/questions/NPSQuestion.js +62 -0
  207. package/lib/survey/questions/NPSQuestion.js.map +1 -0
  208. package/lib/survey/questions/PanelDynamicQuestion.d.ts +50 -0
  209. package/lib/survey/questions/PanelDynamicQuestion.d.ts.map +1 -0
  210. package/lib/survey/questions/PanelDynamicQuestion.js +62 -0
  211. package/lib/survey/questions/PanelDynamicQuestion.js.map +1 -0
  212. package/lib/survey/questions/RankingQuestion.d.ts +34 -0
  213. package/lib/survey/questions/RankingQuestion.d.ts.map +1 -0
  214. package/lib/survey/questions/RankingQuestion.js +85 -0
  215. package/lib/survey/questions/RankingQuestion.js.map +1 -0
  216. package/lib/survey/questions/RatingQuestion.d.ts +20 -0
  217. package/lib/survey/questions/RatingQuestion.d.ts.map +1 -0
  218. package/lib/survey/questions/RatingQuestion.js +53 -0
  219. package/lib/survey/questions/RatingQuestion.js.map +1 -0
  220. package/lib/survey/questions/TextQuestion.d.ts +17 -0
  221. package/lib/survey/questions/TextQuestion.d.ts.map +1 -0
  222. package/lib/survey/questions/TextQuestion.js +46 -0
  223. package/lib/survey/questions/TextQuestion.js.map +1 -0
  224. package/lib/survey/styleContract.d.ts +230 -0
  225. package/lib/survey/styleContract.d.ts.map +1 -0
  226. package/lib/survey/styleContract.js +365 -0
  227. package/lib/survey/styleContract.js.map +1 -0
  228. package/lib/survey/themePalette.d.ts +56 -0
  229. package/lib/survey/themePalette.d.ts.map +1 -0
  230. package/lib/survey/themePalette.js +63 -0
  231. package/lib/survey/themePalette.js.map +1 -0
  232. package/lib/survey/translationLookup.d.ts +4 -0
  233. package/lib/survey/translationLookup.d.ts.map +1 -0
  234. package/lib/survey/translationLookup.js +62 -0
  235. package/lib/survey/translationLookup.js.map +1 -0
  236. package/lib/survey/validate.d.ts +3 -0
  237. package/lib/survey/validate.d.ts.map +1 -0
  238. package/lib/survey/validate.js +159 -0
  239. package/lib/survey/validate.js.map +1 -0
  240. package/lib/survey/variablesResolver.d.ts +10 -0
  241. package/lib/survey/variablesResolver.d.ts.map +1 -0
  242. package/lib/survey/variablesResolver.js +107 -0
  243. package/lib/survey/variablesResolver.js.map +1 -0
  244. package/lib/survey/voiceParsers.d.ts +47 -0
  245. package/lib/survey/voiceParsers.d.ts.map +1 -0
  246. package/lib/survey/voiceParsers.js +310 -0
  247. package/lib/survey/voiceParsers.js.map +1 -0
  248. package/lib/types.d.ts +349 -0
  249. package/lib/types.d.ts.map +1 -0
  250. package/lib/types.js +20 -0
  251. package/lib/types.js.map +1 -0
  252. package/metro.js +55 -0
  253. package/package.json +78 -0
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RankingQuestion = RankingQuestion;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_1 = require("react-native");
6
+ const styleContract_1 = require("../styleContract");
7
+ const valueOf = (o) => typeof o === 'string' ? o : String(o.value);
8
+ const labelOf = (o) => {
9
+ if (typeof o === 'string')
10
+ return o;
11
+ const raw = o.label ?? o.text ?? o.value;
12
+ return raw != null ? String(raw) : '';
13
+ };
14
+ function RankingQuestion({ options, value, onChange, contract, isRtl }) {
15
+ const c = contract ?? styleContract_1.DARK_CONTRACT;
16
+ const opts = Array.isArray(options) ? options : [];
17
+ const byValue = {};
18
+ for (const o of opts)
19
+ byValue[valueOf(o)] = o;
20
+ // Same default as web: authored order until the respondent reorders.
21
+ const order = Array.isArray(value) && value.length
22
+ ? value.map(String)
23
+ : opts.map(valueOf);
24
+ const move = (from, to) => {
25
+ if (to < 0 || to >= order.length)
26
+ return;
27
+ const next = [...order];
28
+ const [moved] = next.splice(from, 1);
29
+ next.splice(to, 0, moved);
30
+ onChange(next);
31
+ };
32
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.container, children: order.map((v, i) => {
33
+ const opt = byValue[v];
34
+ const first = i === 0;
35
+ const last = i === order.length - 1;
36
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
37
+ styles.row,
38
+ {
39
+ backgroundColor: c.optionBg,
40
+ borderColor: c.optionBorder,
41
+ borderRadius: c.optionRadius,
42
+ },
43
+ isRtl && styles.rtlRow,
44
+ ], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.rank, { backgroundColor: c.optionSelectedBg, borderColor: c.optionSelectedBorder }], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.rankText, { color: c.indicatorChecked }], children: i + 1 }) }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
45
+ styles.label,
46
+ { color: c.textPrimary, fontSize: c.fontSizeLabel, fontFamily: c.fontFamily },
47
+ isRtl && styles.rtlText,
48
+ ], numberOfLines: 2, children: opt != null ? labelOf(opt) : v }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.arrows, children: [(0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { onPress: () => move(i, i - 1), disabled: first, accessibilityRole: "button", accessibilityLabel: `Move ${opt != null ? labelOf(opt) : v} up`, style: [styles.arrow, { borderColor: c.optionBorder, opacity: first ? 0.3 : 1 }], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.arrowText, { color: c.textSecondary }], children: "\u2191" }) }), (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { onPress: () => move(i, i + 1), disabled: last, accessibilityRole: "button", accessibilityLabel: `Move ${opt != null ? labelOf(opt) : v} down`, style: [styles.arrow, { borderColor: c.optionBorder, opacity: last ? 0.3 : 1 }], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.arrowText, { color: c.textSecondary }], children: "\u2193" }) })] })] }, v));
49
+ }) }));
50
+ }
51
+ /* Layout only — every colour, radius and type size comes from the contract. */
52
+ const styles = react_native_1.StyleSheet.create({
53
+ container: { marginVertical: 8, gap: 8 },
54
+ row: {
55
+ flexDirection: 'row',
56
+ alignItems: 'center',
57
+ padding: 12,
58
+ borderWidth: 1,
59
+ gap: 12,
60
+ },
61
+ rtlRow: { flexDirection: 'row-reverse' },
62
+ rank: {
63
+ width: 26,
64
+ height: 26,
65
+ borderRadius: 13,
66
+ borderWidth: 1,
67
+ alignItems: 'center',
68
+ justifyContent: 'center',
69
+ },
70
+ rankText: { fontSize: 12, fontWeight: '700' },
71
+ label: { flex: 1 },
72
+ rtlText: { textAlign: 'right', writingDirection: 'rtl' },
73
+ arrows: { flexDirection: 'row', gap: 6 },
74
+ arrow: {
75
+ width: 30,
76
+ height: 30,
77
+ borderWidth: 1,
78
+ borderRadius: 6,
79
+ alignItems: 'center',
80
+ justifyContent: 'center',
81
+ },
82
+ arrowText: { fontSize: 15, fontWeight: '600' },
83
+ });
84
+ exports.default = RankingQuestion;
85
+ //# sourceMappingURL=RankingQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RankingQuestion.js","sourceRoot":"","sources":["../../../src/survey/questions/RankingQuestion.tsx"],"names":[],"mappings":";;;;AACA,+CAAwE;AACxE,oDAA2E;AA+B3E,MAAM,OAAO,GAAG,CAAC,CAAyB,EAAU,EAAE,CACpD,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAE9C,MAAM,OAAO,GAAG,CAAC,CAAyB,EAAU,EAAE;IACpD,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC;AAEF,yBAAgC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAS;IAClF,MAAM,CAAC,GAAG,QAAQ,IAAI,6BAAa,CAAC;IAEpC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,MAAM,OAAO,GAA2C,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAE9C,qEAAqE;IACrE,MAAM,KAAK,GAAa,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM;QAC1D,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CA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AAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE;IACxC,KAAK,EAAE;QACL,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,SAAS,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;CAC/C,CAAC,CAAC;kBAEY,eAAe"}
@@ -0,0 +1,20 @@
1
+ import type { ThemePalette } from '../themePalette';
2
+ import { type SurveyStyleContract } from '../styleContract';
3
+ interface Props {
4
+ value: number | null;
5
+ onChange: (value: number) => void;
6
+ rateMax?: number;
7
+ /**
8
+ * @deprecated Superseded by `contract.ratingFilledBg`. Still honoured so
9
+ * existing callers keep working; drop once SurveyModal passes `contract`
10
+ * everywhere.
11
+ */
12
+ primaryColor?: string;
13
+ /** @deprecated The 9-field subset. Pass `contract` instead — it is a superset. */
14
+ palette?: ThemePalette;
15
+ /** Full style contract. Every colour, radius and type size comes from here. */
16
+ contract?: SurveyStyleContract;
17
+ }
18
+ export declare function RatingQuestion({ value, onChange, rateMax, primaryColor, palette, contract, }: Props): import("react/jsx-runtime").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=RatingQuestion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RatingQuestion.d.ts","sourceRoot":"","sources":["../../../src/survey/questions/RatingQuestion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EAAE,QAAQ,EAAE,OAAW,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,GAC9D,EAAE,KAAK,2CAgDP"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RatingQuestion = RatingQuestion;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_1 = require("react-native");
6
+ const styleContract_1 = require("../styleContract");
7
+ function RatingQuestion({ value, onChange, rateMax = 5, primaryColor, palette, contract, }) {
8
+ // Resolution order preserves existing behaviour exactly:
9
+ // contract (new, widest) ▸ palette + primaryColor (legacy) ▸ dark defaults.
10
+ // DARK_CONTRACT's values are byte-identical to the literals this file used to
11
+ // hardcode, so an unstyled render is unchanged.
12
+ const c = contract ?? styleContract_1.DARK_CONTRACT;
13
+ const restBg = palette?.input ?? c.ratingBg;
14
+ const restBorder = palette?.inputBorder ?? c.ratingBorder;
15
+ const restText = palette?.textSecondary ?? c.ratingText;
16
+ const fillBg = primaryColor ?? c.ratingFilledBg;
17
+ const fillBorder = primaryColor ?? c.ratingFilledBorder;
18
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.container, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.row, { gap: c.fieldGap }], children: Array.from({ length: rateMax }, (_, i) => {
19
+ const num = i + 1;
20
+ const selected = value === num;
21
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: [
22
+ styles.button,
23
+ { backgroundColor: restBg, borderColor: restBorder, borderRadius: c.ratingRadius },
24
+ selected && { backgroundColor: fillBg, borderColor: fillBorder },
25
+ ], onPress: () => onChange(num), activeOpacity: 0.7, accessibilityRole: "button", accessibilityState: { selected }, accessibilityLabel: `${num} of ${rateMax}`, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
26
+ styles.buttonText,
27
+ { color: restText },
28
+ selected && { color: c.ratingFilledText },
29
+ ], children: num }) }, num));
30
+ }) }) }));
31
+ }
32
+ /* Layout only — every colour, radius and gap now comes from the contract. */
33
+ const styles = react_native_1.StyleSheet.create({
34
+ container: {
35
+ marginVertical: 8,
36
+ alignItems: 'center',
37
+ },
38
+ row: {
39
+ flexDirection: 'row',
40
+ },
41
+ button: {
42
+ width: 48,
43
+ height: 48,
44
+ borderWidth: 1,
45
+ alignItems: 'center',
46
+ justifyContent: 'center',
47
+ },
48
+ buttonText: {
49
+ fontSize: 16,
50
+ fontWeight: '600',
51
+ },
52
+ });
53
+ //# sourceMappingURL=RatingQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RatingQuestion.js","sourceRoot":"","sources":["../../../src/survey/questions/RatingQuestion.tsx"],"names":[],"mappings":";;;;AACA,+CAAwE;AAExE,oDAA2E;AAkB3E,wBAA+B,EAC7B,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,GACvD;IACN,yDAAyD;IACzD,8EAA8E;IAC9E,8EAA8E;IAC9E,gDAAgD;IAChD,MAAM,CAAC,GAAG,QAAQ,IAAI,6BAAa,CAAC;IAEpC,MAAM,MAAM,GAAO,OAAO,EAAE,KAAK,IAAW,CAAC,CAAC,QAAQ,CAAC;IACvD,MAAM,UAAU,GAAG,OAAO,EAAE,WAAW,IAAK,CAAC,CAAC,YAAY,CAAC;IAC3D,MAAM,QAAQ,GAAK,OAAO,EAAE,aAAa,IAAI,CAAC,CAAC,UAAU,CAAC;IAC1D,MAAM,MAAM,GAAO,YAAY,IAAI,CAAC,CAAC,cAAc,CAAC;IACpD,MAAM,UAAU,GAAG,YAAY,IAAI,CAAC,CAAC,kBAAkB,CAAC;IAEx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AAU,EAAE,QAAQ;KACrB;IACD,GAAG,EAAE;QACH,aAAa,EAAE,KAAK;KACrB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;CACF,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ThemePalette } from '../themePalette';
2
+ import { type SurveyStyleContract } from '../styleContract';
3
+ interface Props {
4
+ value: string;
5
+ onChange: (value: string) => void;
6
+ placeholder?: string;
7
+ multiline?: boolean;
8
+ /** @deprecated The 9-field subset. Pass `contract` — it is a superset. */
9
+ palette?: ThemePalette;
10
+ /** Full style contract. */
11
+ contract?: SurveyStyleContract;
12
+ /** Right-aligns the field for Arabic/Hebrew (spec §26). */
13
+ isRtl?: boolean;
14
+ }
15
+ export declare function TextQuestion({ value, onChange, placeholder, multiline, palette, contract, isRtl, }: Props): import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=TextQuestion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextQuestion.d.ts","sourceRoot":"","sources":["../../../src/survey/questions/TextQuestion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,GACzE,EAAE,KAAK,2CAoCP"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextQuestion = TextQuestion;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_1 = require("react-native");
6
+ const styleContract_1 = require("../styleContract");
7
+ function TextQuestion({ value, onChange, placeholder, multiline = true, palette, contract, isRtl, }) {
8
+ // contract ▸ legacy palette ▸ dark defaults. DARK_CONTRACT's input values are
9
+ // the literals this file used to hardcode, so an unstyled render is unchanged.
10
+ const c = contract ?? styleContract_1.DARK_CONTRACT;
11
+ const bg = palette?.input ?? c.input;
12
+ const border = palette?.inputBorder ?? c.inputBorder;
13
+ const text = palette?.textPrimary ?? c.inputText;
14
+ const placeholderC = palette?.placeholder ?? c.placeholder;
15
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.container, children: (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: [
16
+ styles.input,
17
+ {
18
+ backgroundColor: bg,
19
+ borderColor: border,
20
+ color: text,
21
+ borderRadius: c.inputRadius,
22
+ fontSize: c.fontSizeInput,
23
+ fontFamily: c.fontFamily,
24
+ },
25
+ multiline && styles.multiline,
26
+ isRtl && styles.rtl,
27
+ ], value: value, onChangeText: onChange, placeholder: placeholder ?? 'Type your answer...', placeholderTextColor: placeholderC, multiline: multiline, numberOfLines: multiline ? 4 : 1, textAlignVertical: multiline ? 'top' : 'center' }) }));
28
+ }
29
+ /* Layout only — colours, radius and type size come from the contract. */
30
+ const styles = react_native_1.StyleSheet.create({
31
+ container: {
32
+ marginVertical: 8,
33
+ },
34
+ input: {
35
+ borderWidth: 1,
36
+ padding: 14,
37
+ },
38
+ multiline: {
39
+ minHeight: 100,
40
+ },
41
+ rtl: {
42
+ textAlign: 'right',
43
+ writingDirection: 'rtl',
44
+ },
45
+ });
46
+ //# sourceMappingURL=TextQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextQuestion.js","sourceRoot":"","sources":["../../../src/survey/questions/TextQuestion.tsx"],"names":[],"mappings":";;;;AACA,+CAA2D;AAE3D,oDAA2E;AAe3E,sBAA6B,EAC3B,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,GAAG,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,GAClE;IACN,8EAA8E;IAC9E,+EAA+E;IAC/E,MAAM,CAAC,GAAG,QAAQ,IAAI,6BAAa,CAAC;IAEpC,MAAM,EAAE,GAAY,OAAO,EAAE,KAAK,IAAU,CAAC,CAAC,KAAK,CAAC;IACpD,MAAM,MAAM,GAAQ,OAAO,EAAE,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC;IAC1D,MAAM,IAAI,GAAU,OAAO,EAAE,WAAW,IAAI,CAAC,CAAC,SAAS,CAAC;IACxD,MAAM,YAAY,GAAG,OAAO,EAAE,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC;IAE3D,OAAO,CACL,uBAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,YAC3B,uBAAC,wBAAS,IACR,KAAK,EAAE;gBACL,MAAM,CAAC,KAAK;gBACZ;oBACE,eAAe,EAAE,EAAE;oBACnB,WAAW,EAAE,MAAM;oBACnB,KAAK,EAAE,IAAI;oBACX,YAAY,EAAE,CAAC,CAAC,WAAW;oBAC3B,QAAQ,EAAE,CAAC,CAAC,aAAa;oBACzB,UAAU,EAAE,CAAC,CAAC,UAAU;iBACzB;gBACD,SAAS,IAAI,MAAM,CAAC,SAAS;gBAC7B,KAAK,IAAI,MAAM,CAAC,GAAG;aACpB,EACD,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,QAAQ,EACtB,WAAW,EAAE,WAAW,IAAI,qBAAqB,EACjD,oBAAoB,EAAE,YAAY,EAClC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAChC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,GAC/C,GACG,CACR,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,cAAc,EAAE,CAAC;KAClB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,EAAE;KACZ;IACD,SAAS,EAAE;QACT,SAAS,EAAE,GAAG;KACf;IACD,GAAG,EAAE;QACH,SAAS,EAAE,OAAO;QAClB,gBAAgB,EAAE,KAAK;KACxB;CACF,CAAC,CAAC"}
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Survey style contract — the shared theming vocabulary.
3
+ *
4
+ * Why this exists
5
+ * ---------------
6
+ * `customCss` cannot work on React Native: RN has no CSS engine, so arbitrary
7
+ * CSS has nothing to act on. Rather than accept a permanent styling gap between
8
+ * web and mobile, theming moves to a *structured* contract that both platforms
9
+ * implement. A customer brands once; it applies everywhere.
10
+ *
11
+ * The trade, stated honestly: this is comprehensive, not arbitrary. Every
12
+ * surface the renderer draws is themeable. Author-invented selectors, cascade
13
+ * tricks and layout restructuring are not — those stay web-only via `customCss`.
14
+ *
15
+ * Relationship to `themePalette.ts`
16
+ * ---------------------------------
17
+ * `ThemePalette` (9 fields) is the shipped subset of this contract and stays
18
+ * working — `toLegacyPalette()` derives it, so existing callers and any host app
19
+ * passing `brandingPalette` are unaffected. This widens the vocabulary from 9
20
+ * fields to full coverage of the ~200 style properties the native renderer sets.
21
+ *
22
+ * Web mapping
23
+ * -----------
24
+ * The web renderer exposes the same concepts as `--vp-color-*` / `--vp-fs-*`
25
+ * custom properties. Field names here are the canonical vocabulary; the web side
26
+ * maps onto them. `CSS_VAR_MAP` at the bottom records that mapping so the two
27
+ * cannot drift silently.
28
+ */
29
+ export type ThemeName = 'light' | 'dark';
30
+ export interface SurveyStyleContract {
31
+ /** Primary brand colour. Actions, selected states, focus rings. */
32
+ accent: string;
33
+ /** Pressed/hover state of the accent. */
34
+ accentHover: string;
35
+ /** Text/icon colour that sits ON the accent. Must contrast with `accent`. */
36
+ accentText: string;
37
+ /** Behind the card — the modal scrim area or page ground. */
38
+ ground: string;
39
+ card: string;
40
+ cardBorder: string;
41
+ cardRadius: number;
42
+ cardPaddingTop?: number;
43
+ cardPaddingRight?: number;
44
+ cardPaddingBottom?: number;
45
+ cardPaddingLeft?: number;
46
+ cardPadding: number;
47
+ input: string;
48
+ inputBorder: string;
49
+ inputText: string;
50
+ inputRadius: number;
51
+ placeholder: string;
52
+ /** Border colour when a field is focused. */
53
+ inputFocusBorder: string;
54
+ /** Border colour when a field fails validation. */
55
+ inputErrorBorder: string;
56
+ errorText: string;
57
+ headingColor: string;
58
+ textPrimary: string;
59
+ textSecondary: string;
60
+ textMuted: string;
61
+ optionBg: string;
62
+ optionBorder: string;
63
+ optionRadius: number;
64
+ optionSelectedBg: string;
65
+ optionSelectedBorder: string;
66
+ /** The radio/checkbox ring when unselected. */
67
+ indicatorBorder: string;
68
+ /** The ring/fill when selected. */
69
+ indicatorChecked: string;
70
+ ratingBg: string;
71
+ ratingBorder: string;
72
+ ratingText: string;
73
+ ratingRadius: number;
74
+ /** NPS buttons are squarer than rating buttons in the shipped design. */
75
+ npsRadius: number;
76
+ /** Unfilled star / inactive scale mark. Distinct from ratingBorder. */
77
+ ratingEmpty: string;
78
+ ratingFilledBg: string;
79
+ ratingFilledBorder: string;
80
+ ratingFilledText: string;
81
+ buttonRadius: number;
82
+ buttonPaddingY: number;
83
+ buttonFontSize: number;
84
+ primaryBg: string;
85
+ primaryText: string;
86
+ primaryBorder: string;
87
+ secondaryBg: string;
88
+ secondaryText: string;
89
+ secondaryBorder: string;
90
+ /** Family for body and controls. RN needs a font already linked in the app. */
91
+ fontFamily?: string;
92
+ /** Family for the survey title and section headings. Falls back to fontFamily. */
93
+ fontFamilyHeading?: string;
94
+ fontSizeHeading: number;
95
+ fontSizeLabel: number;
96
+ fontSizeInput: number;
97
+ fontSizeDescription: number;
98
+ fontSizeSmall: number;
99
+ fontWeightHeading: '400' | '500' | '600' | '700';
100
+ fontWeightLabel: '400' | '500' | '600' | '700';
101
+ lineHeightBody: number;
102
+ /** Space between a label and its control. */
103
+ fieldGap: number;
104
+ /** Space between questions. */
105
+ sectionGap: number;
106
+ closeBg: string;
107
+ closeText: string;
108
+ brandNameColor: string;
109
+ descriptionColor: string;
110
+ progressText: string;
111
+ progressTrack: string;
112
+ /** The asterisk on a required question. */
113
+ requiredMark: string;
114
+ /** Language-switcher chips. */
115
+ chipBg: string;
116
+ chipBorder: string;
117
+ chipText: string;
118
+ /** "Complete on desktop" hint for question types mobile can't render yet. */
119
+ hintBg: string;
120
+ hintBorder: string;
121
+ hintText: string;
122
+ /**
123
+ * Explicit stand-in for the `::before` brand rule authors draw in web
124
+ * customCss. Pseudo-elements don't exist in RN, so the one decorative device
125
+ * that showed up repeatedly in real customCss becomes a first-class field.
126
+ * Height 0 disables it.
127
+ */
128
+ topRuleHeight: number;
129
+ topRuleColor: string;
130
+ }
131
+ /** Every field optional — a caller overrides only what it cares about. */
132
+ export type StyleOverride = Partial<SurveyStyleContract>;
133
+ export declare const DARK_CONTRACT: SurveyStyleContract;
134
+ /** Not a naive inversion — values are re-chosen to hold contrast on a pale ground. */
135
+ export declare const LIGHT_CONTRACT: SurveyStyleContract;
136
+ /**
137
+ * Resolve the contract for a render.
138
+ *
139
+ * Precedence, HIGHEST first — deliberately identical to the shipped
140
+ * `themePalette()` so ownership rules do not change:
141
+ * 1. `initOverride` — the host app, via CXPinsight.init({ brandingPalette })
142
+ * 2. `surveyOverride` — survey.branding.palette
143
+ * 3. `primaryColor` — convenience, fans out to every accent-derived field
144
+ * 4. theme defaults (light | dark)
145
+ *
146
+ * The host app wins because it owns the surface the survey appears on: an app in
147
+ * a dark skin must be able to stop a survey rendering light inside it. This
148
+ * matches themePalette()'s documented layering — do not invert it.
149
+ *
150
+ * Also mirrors themePalette()'s *truthy* override test: a field present but
151
+ * empty/undefined falls through rather than blanking the value, which a plain
152
+ * object spread would not do.
153
+ */
154
+ export declare function resolveStyleContract(args: {
155
+ theme?: ThemeName | string | null;
156
+ primaryColor?: string | null;
157
+ initOverride?: StyleOverride | null;
158
+ surveyOverride?: StyleOverride | null;
159
+ }): SurveyStyleContract;
160
+ /** The 9-field shape shipped as `ThemePalette`. Kept working, derived not duplicated. */
161
+ export interface LegacyThemePalette {
162
+ card: string;
163
+ cardBorder: string;
164
+ input: string;
165
+ inputBorder: string;
166
+ textPrimary: string;
167
+ textSecondary: string;
168
+ textMuted: string;
169
+ placeholder: string;
170
+ indicatorBorder: string;
171
+ }
172
+ /** Existing callers of themePalette() keep the exact same shape. */
173
+ export declare function toLegacyPalette(c: SurveyStyleContract): LegacyThemePalette;
174
+ /**
175
+ * Which web custom property carries each contract field.
176
+ *
177
+ * `null` means the web renderer has no dedicated property yet — those are the
178
+ * additive gaps to fill so both platforms cover the same surface. Recording
179
+ * them here (rather than in prose) means a golden test can assert the two
180
+ * implementations haven't drifted.
181
+ */
182
+ export declare const CSS_VAR_MAP: Partial<Record<keyof SurveyStyleContract, string | null>>;
183
+ /**
184
+ * The vocabulary authors actually write, via SurveyPaletteEditor →
185
+ * `survey.branding.palette[theme]`. It is NOT the same as `PaletteOverride`
186
+ * (the SDK-init shape), and that mismatch is why mobile has never reflected the
187
+ * palette editor: `themePalette()` iterates its own 9 keys, so `cardBg` never
188
+ * matched `card`, `inputBg` never matched `input`, and 7 of the author's 8
189
+ * choices were silently dropped. Only `textMuted` overlapped — and even that
190
+ * meant something different on each side (see below).
191
+ *
192
+ * Field meanings are taken from the web renderer, which is the authority since
193
+ * it already consumes these names (SurveyRenderer.tsx:904-916).
194
+ */
195
+ export interface AuthoredPalette {
196
+ /** Whole widget surface. web: --vp-color-bg + --vp-bg-rgb */
197
+ bg?: string;
198
+ /** Primary body copy. web: --vp-color-text */
199
+ text?: string;
200
+ /** Secondary copy — descriptions, hints. web: --vp-color-text-muted */
201
+ textMuted?: string;
202
+ /** Labels, placeholders, glyphs. web: --vp-color-text-faint */
203
+ textFaint?: string;
204
+ /** Dividers, input borders, scale outlines. web: --vp-color-input-border */
205
+ border?: string;
206
+ /** Instruction blocks, option rows, matrix rows. web: --vp-color-card */
207
+ cardBg?: string;
208
+ /** Text areas, selects, rating buttons. web: --vp-color-input-bg */
209
+ inputBg?: string;
210
+ /** Hover/active surface. web: --vp-color-hover */
211
+ hoverBg?: string;
212
+ }
213
+ /**
214
+ * Translate an authored palette into a contract override.
215
+ *
216
+ * One author field legitimately fans out to several contract fields: `border`
217
+ * covers input, option and rating outlines, because the web renderer's single
218
+ * `--vp-color-input-border` reaches all three.
219
+ *
220
+ * ⚠ The text tiers are OFF BY ONE between the two vocabularies:
221
+ * authored `text` → contract `textPrimary`
222
+ * authored `textMuted` → contract `textSecondary` (not `textMuted`!)
223
+ * authored `textFaint` → contract `textMuted` + `placeholder`
224
+ * This mirrors the web token names exactly. Do not "simplify" it.
225
+ *
226
+ * Keys that are already contract field names pass through untouched, so a
227
+ * palette written against the SDK vocabulary still works.
228
+ */
229
+ export declare function fromAuthoredPalette(authored?: AuthoredPalette | Record<string, string | undefined> | null): StyleOverride;
230
+ //# sourceMappingURL=styleContract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styleContract.d.ts","sourceRoot":"","sources":["../../src/survey/styleContract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAIzC,MAAM,WAAW,mBAAmB;IAElC,mEAAmE;IACnE,MAAM,E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