@dloizides/ui-feedback 1.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.
- package/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/index.d.mts +145 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +456 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +441 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +106 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import React3, { createContext, useMemo, useContext, useCallback } from 'react';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { StyleSheet, View, Text, TouchableOpacity, ActivityIndicator, Animated, Platform, Easing, Modal } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// src/context/FeedbackUiContext.tsx
|
|
6
|
+
var FeedbackUiContext = createContext(null);
|
|
7
|
+
var FeedbackUiProvider = ({
|
|
8
|
+
theme,
|
|
9
|
+
t,
|
|
10
|
+
navigate,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const value = useMemo(() => ({ theme, t, navigate }), [theme, t, navigate]);
|
|
14
|
+
return /* @__PURE__ */ jsx(FeedbackUiContext.Provider, { value, children });
|
|
15
|
+
};
|
|
16
|
+
function useFeedbackUi() {
|
|
17
|
+
const ctx = useContext(FeedbackUiContext);
|
|
18
|
+
if (ctx === null)
|
|
19
|
+
throw new Error("useFeedbackUi must be used within a FeedbackUiProvider");
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/constants.ts
|
|
24
|
+
var MODAL_OVERLAY_COLOR = "rgba(0, 0, 0, 0.5)";
|
|
25
|
+
var DISABLED_OPACITY = 0.5;
|
|
26
|
+
var FEEDBACK_TEST_IDS = {
|
|
27
|
+
errorState: "error-state",
|
|
28
|
+
errorStateRetry: "error-state-retry",
|
|
29
|
+
emptyListCta: "empty-list-cta",
|
|
30
|
+
loadingFallback: "loading-fallback",
|
|
31
|
+
pageSkeleton: "page-skeleton",
|
|
32
|
+
confirmDialog: "confirm-dialog",
|
|
33
|
+
confirmButton: "confirm-button",
|
|
34
|
+
cancelConfirmButton: "cancel-confirm-button"
|
|
35
|
+
};
|
|
36
|
+
var MESSAGE_FONT_SIZE = 16;
|
|
37
|
+
var CONTAINER_PADDING = 20;
|
|
38
|
+
var BUTTON_MARGIN_TOP = 12;
|
|
39
|
+
var BUTTON_PADDING_V = 8;
|
|
40
|
+
var BUTTON_PADDING_H = 16;
|
|
41
|
+
var BUTTON_BORDER_RADIUS = 6;
|
|
42
|
+
var BUTTON_FONT_SIZE = 14;
|
|
43
|
+
var styles = StyleSheet.create({
|
|
44
|
+
container: {
|
|
45
|
+
flex: 1,
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
padding: CONTAINER_PADDING
|
|
49
|
+
},
|
|
50
|
+
message: {
|
|
51
|
+
fontSize: MESSAGE_FONT_SIZE,
|
|
52
|
+
textAlign: "center"
|
|
53
|
+
},
|
|
54
|
+
retryButton: {
|
|
55
|
+
marginTop: BUTTON_MARGIN_TOP,
|
|
56
|
+
paddingVertical: BUTTON_PADDING_V,
|
|
57
|
+
paddingHorizontal: BUTTON_PADDING_H,
|
|
58
|
+
borderRadius: BUTTON_BORDER_RADIUS
|
|
59
|
+
},
|
|
60
|
+
retryText: {
|
|
61
|
+
fontSize: BUTTON_FONT_SIZE,
|
|
62
|
+
fontWeight: "600"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var ErrorState = ({
|
|
66
|
+
message,
|
|
67
|
+
onRetry,
|
|
68
|
+
testID = FEEDBACK_TEST_IDS.errorState
|
|
69
|
+
}) => {
|
|
70
|
+
const { theme, t } = useFeedbackUi();
|
|
71
|
+
const errorColor = theme.semantic.error["500"];
|
|
72
|
+
const primary = theme.palette.primary["500"];
|
|
73
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.container, testID, children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.message, { color: errorColor }], children: message }),
|
|
75
|
+
typeof onRetry === "function" ? /* @__PURE__ */ jsx(
|
|
76
|
+
TouchableOpacity,
|
|
77
|
+
{
|
|
78
|
+
accessibilityHint: t("common.retryHint"),
|
|
79
|
+
accessibilityLabel: t("common.retry"),
|
|
80
|
+
accessibilityRole: "button",
|
|
81
|
+
style: [styles.retryButton, { backgroundColor: primary }],
|
|
82
|
+
testID: FEEDBACK_TEST_IDS.errorStateRetry,
|
|
83
|
+
onPress: onRetry,
|
|
84
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles.retryText, { color: theme.colors.surfaceElevated }], children: t("common.retry") })
|
|
85
|
+
}
|
|
86
|
+
) : null
|
|
87
|
+
] });
|
|
88
|
+
};
|
|
89
|
+
var MESSAGE_FONT_SIZE2 = 16;
|
|
90
|
+
var CTA_MARGIN_TOP = 16;
|
|
91
|
+
var CTA_PADDING_VERTICAL = 10;
|
|
92
|
+
var CTA_PADDING_HORIZONTAL = 20;
|
|
93
|
+
var CTA_BORDER_RADIUS = 8;
|
|
94
|
+
var CTA_FONT_SIZE = 14;
|
|
95
|
+
var CONTAINER_PADDING2 = 32;
|
|
96
|
+
var styles2 = StyleSheet.create({
|
|
97
|
+
container: {
|
|
98
|
+
flex: 1,
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
padding: CONTAINER_PADDING2
|
|
102
|
+
},
|
|
103
|
+
message: {
|
|
104
|
+
fontSize: MESSAGE_FONT_SIZE2,
|
|
105
|
+
textAlign: "center"
|
|
106
|
+
},
|
|
107
|
+
ctaButton: {
|
|
108
|
+
marginTop: CTA_MARGIN_TOP,
|
|
109
|
+
paddingVertical: CTA_PADDING_VERTICAL,
|
|
110
|
+
paddingHorizontal: CTA_PADDING_HORIZONTAL,
|
|
111
|
+
borderRadius: CTA_BORDER_RADIUS
|
|
112
|
+
},
|
|
113
|
+
ctaText: {
|
|
114
|
+
fontSize: CTA_FONT_SIZE,
|
|
115
|
+
fontWeight: "600"
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var EmptyListState = ({
|
|
119
|
+
messageKey,
|
|
120
|
+
ctaTextKey,
|
|
121
|
+
ctaHintKey,
|
|
122
|
+
ctaRoute,
|
|
123
|
+
testID
|
|
124
|
+
}) => {
|
|
125
|
+
const { theme, t, navigate } = useFeedbackUi();
|
|
126
|
+
const { colors } = theme;
|
|
127
|
+
const primary = theme.palette.primary["500"];
|
|
128
|
+
const handlePress = useCallback(() => {
|
|
129
|
+
if (typeof ctaRoute === "string" && typeof navigate === "function") navigate(ctaRoute);
|
|
130
|
+
}, [navigate, ctaRoute]);
|
|
131
|
+
const showCta = typeof ctaTextKey === "string" && typeof ctaHintKey === "string" && typeof ctaRoute === "string";
|
|
132
|
+
return /* @__PURE__ */ jsxs(View, { style: styles2.container, testID, children: [
|
|
133
|
+
/* @__PURE__ */ jsx(Text, { style: [styles2.message, { color: colors.textSecondary }], children: t(messageKey) }),
|
|
134
|
+
showCta ? /* @__PURE__ */ jsx(
|
|
135
|
+
TouchableOpacity,
|
|
136
|
+
{
|
|
137
|
+
accessibilityHint: t(ctaHintKey),
|
|
138
|
+
accessibilityLabel: t(ctaTextKey),
|
|
139
|
+
accessibilityRole: "button",
|
|
140
|
+
style: [styles2.ctaButton, { backgroundColor: primary }],
|
|
141
|
+
testID: FEEDBACK_TEST_IDS.emptyListCta,
|
|
142
|
+
onPress: handlePress,
|
|
143
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles2.ctaText, { color: colors.background }], children: t(ctaTextKey) })
|
|
144
|
+
}
|
|
145
|
+
) : null
|
|
146
|
+
] });
|
|
147
|
+
};
|
|
148
|
+
var FULLSCREEN_MIN_HEIGHT = 300;
|
|
149
|
+
var CONTAINER_MIN_HEIGHT = 100;
|
|
150
|
+
var styles3 = StyleSheet.create({
|
|
151
|
+
container: {
|
|
152
|
+
flex: 1,
|
|
153
|
+
justifyContent: "center",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
minHeight: CONTAINER_MIN_HEIGHT
|
|
156
|
+
},
|
|
157
|
+
fullScreen: {
|
|
158
|
+
minHeight: FULLSCREEN_MIN_HEIGHT
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
var LoadingFallback = ({ fullScreen = false, size = "large" }) => {
|
|
162
|
+
const { theme, t } = useFeedbackUi();
|
|
163
|
+
const colors = theme.colors;
|
|
164
|
+
const primary = theme.palette.primary["500"];
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
View,
|
|
167
|
+
{
|
|
168
|
+
accessibilityHint: t("loadingFallback.hint"),
|
|
169
|
+
accessibilityLabel: t("loadingFallback.label"),
|
|
170
|
+
accessibilityRole: "progressbar",
|
|
171
|
+
style: [styles3.container, fullScreen && styles3.fullScreen, { backgroundColor: colors.background }],
|
|
172
|
+
testID: FEEDBACK_TEST_IDS.loadingFallback,
|
|
173
|
+
children: /* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size })
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
var ANIMATION_DURATION_MS = 1200;
|
|
178
|
+
var SKELETON_BORDER_RADIUS = 4;
|
|
179
|
+
var SKELETON_OPACITY_START = 0.3;
|
|
180
|
+
var SKELETON_OPACITY_END = 0.7;
|
|
181
|
+
var DEFAULT_ROWS = 5;
|
|
182
|
+
var styles4 = StyleSheet.create({
|
|
183
|
+
container: {
|
|
184
|
+
flex: 1,
|
|
185
|
+
padding: 16
|
|
186
|
+
},
|
|
187
|
+
header: {
|
|
188
|
+
height: 32,
|
|
189
|
+
borderRadius: SKELETON_BORDER_RADIUS,
|
|
190
|
+
marginBottom: 24,
|
|
191
|
+
width: "60%"
|
|
192
|
+
},
|
|
193
|
+
row: {
|
|
194
|
+
flexDirection: "row",
|
|
195
|
+
marginBottom: 16
|
|
196
|
+
},
|
|
197
|
+
avatar: {
|
|
198
|
+
width: 48,
|
|
199
|
+
height: 48,
|
|
200
|
+
borderRadius: 24,
|
|
201
|
+
marginRight: 12
|
|
202
|
+
},
|
|
203
|
+
textContainer: {
|
|
204
|
+
flex: 1,
|
|
205
|
+
justifyContent: "center"
|
|
206
|
+
},
|
|
207
|
+
textLine: {
|
|
208
|
+
height: 16,
|
|
209
|
+
borderRadius: SKELETON_BORDER_RADIUS,
|
|
210
|
+
marginBottom: 8
|
|
211
|
+
},
|
|
212
|
+
textLineShort: {
|
|
213
|
+
width: "70%"
|
|
214
|
+
},
|
|
215
|
+
textLineFull: {
|
|
216
|
+
width: "100%"
|
|
217
|
+
},
|
|
218
|
+
card: {
|
|
219
|
+
height: 120,
|
|
220
|
+
borderRadius: 8,
|
|
221
|
+
marginBottom: 16
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
var PageSkeleton = ({
|
|
225
|
+
rows = DEFAULT_ROWS,
|
|
226
|
+
showHeader = true,
|
|
227
|
+
variant = "list"
|
|
228
|
+
}) => {
|
|
229
|
+
const { theme, t } = useFeedbackUi();
|
|
230
|
+
const colors = theme.colors;
|
|
231
|
+
const animatedValue = React3.useRef(new Animated.Value(0)).current;
|
|
232
|
+
React3.useEffect(() => {
|
|
233
|
+
const animation = Animated.loop(
|
|
234
|
+
Animated.sequence([
|
|
235
|
+
Animated.timing(animatedValue, {
|
|
236
|
+
toValue: 1,
|
|
237
|
+
duration: ANIMATION_DURATION_MS,
|
|
238
|
+
easing: Easing.inOut(Easing.ease),
|
|
239
|
+
useNativeDriver: Platform.OS !== "web"
|
|
240
|
+
}),
|
|
241
|
+
Animated.timing(animatedValue, {
|
|
242
|
+
toValue: 0,
|
|
243
|
+
duration: ANIMATION_DURATION_MS,
|
|
244
|
+
easing: Easing.inOut(Easing.ease),
|
|
245
|
+
useNativeDriver: Platform.OS !== "web"
|
|
246
|
+
})
|
|
247
|
+
])
|
|
248
|
+
);
|
|
249
|
+
animation.start();
|
|
250
|
+
return () => animation.stop();
|
|
251
|
+
}, [animatedValue]);
|
|
252
|
+
const opacity = animatedValue.interpolate({
|
|
253
|
+
inputRange: [0, 1],
|
|
254
|
+
outputRange: [SKELETON_OPACITY_START, SKELETON_OPACITY_END]
|
|
255
|
+
});
|
|
256
|
+
const skeletonColor = String(colors.border);
|
|
257
|
+
const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style: styles4.row, children: [
|
|
258
|
+
/* @__PURE__ */ jsx(Animated.View, { style: [styles4.avatar, { backgroundColor: skeletonColor, opacity }] }),
|
|
259
|
+
/* @__PURE__ */ jsxs(View, { style: styles4.textContainer, children: [
|
|
260
|
+
/* @__PURE__ */ jsx(Animated.View, { style: [styles4.textLine, styles4.textLineFull, { backgroundColor: skeletonColor, opacity }] }),
|
|
261
|
+
/* @__PURE__ */ jsx(Animated.View, { style: [styles4.textLine, styles4.textLineShort, { backgroundColor: skeletonColor, opacity }] })
|
|
262
|
+
] })
|
|
263
|
+
] }, index);
|
|
264
|
+
const renderCard = (index) => /* @__PURE__ */ jsx(Animated.View, { style: [styles4.card, { backgroundColor: skeletonColor, opacity }] }, index);
|
|
265
|
+
const rowElements = Array.from({ length: rows }, (_, i) => variant === "cards" ? renderCard(i) : renderListRow(i));
|
|
266
|
+
return /* @__PURE__ */ jsxs(
|
|
267
|
+
View,
|
|
268
|
+
{
|
|
269
|
+
accessibilityHint: t("pageSkeleton.loadingHint"),
|
|
270
|
+
accessibilityLabel: t("pageSkeleton.loadingLabel"),
|
|
271
|
+
accessibilityState: { busy: true },
|
|
272
|
+
style: [styles4.container, { backgroundColor: colors.background }],
|
|
273
|
+
testID: FEEDBACK_TEST_IDS.pageSkeleton,
|
|
274
|
+
children: [
|
|
275
|
+
showHeader ? /* @__PURE__ */ jsx(Animated.View, { style: [styles4.header, { backgroundColor: skeletonColor, opacity }] }) : null,
|
|
276
|
+
rowElements
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
var DIALOG_MAX_WIDTH = 400;
|
|
282
|
+
var styles5 = StyleSheet.create({
|
|
283
|
+
overlay: {
|
|
284
|
+
flex: 1,
|
|
285
|
+
backgroundColor: MODAL_OVERLAY_COLOR,
|
|
286
|
+
justifyContent: "center",
|
|
287
|
+
alignItems: "center",
|
|
288
|
+
padding: 20
|
|
289
|
+
},
|
|
290
|
+
dialog: {
|
|
291
|
+
width: "100%",
|
|
292
|
+
maxWidth: DIALOG_MAX_WIDTH,
|
|
293
|
+
borderRadius: 12,
|
|
294
|
+
padding: 20,
|
|
295
|
+
boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.25)",
|
|
296
|
+
elevation: 5
|
|
297
|
+
},
|
|
298
|
+
title: {
|
|
299
|
+
fontSize: 18,
|
|
300
|
+
fontWeight: "600",
|
|
301
|
+
marginBottom: 12
|
|
302
|
+
},
|
|
303
|
+
message: {
|
|
304
|
+
fontSize: 14,
|
|
305
|
+
lineHeight: 20,
|
|
306
|
+
marginBottom: 20
|
|
307
|
+
},
|
|
308
|
+
buttonRow: {
|
|
309
|
+
flexDirection: "row",
|
|
310
|
+
justifyContent: "flex-end",
|
|
311
|
+
gap: 12
|
|
312
|
+
},
|
|
313
|
+
button: {
|
|
314
|
+
paddingVertical: 10,
|
|
315
|
+
paddingHorizontal: 20,
|
|
316
|
+
borderRadius: 6,
|
|
317
|
+
minWidth: 80,
|
|
318
|
+
alignItems: "center",
|
|
319
|
+
justifyContent: "center"
|
|
320
|
+
},
|
|
321
|
+
cancelButton: {
|
|
322
|
+
borderWidth: 1
|
|
323
|
+
},
|
|
324
|
+
confirmButton: {},
|
|
325
|
+
buttonText: {
|
|
326
|
+
fontSize: 14,
|
|
327
|
+
fontWeight: "600"
|
|
328
|
+
},
|
|
329
|
+
disabledButton: {
|
|
330
|
+
opacity: DISABLED_OPACITY
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
var ConfirmDialog = ({
|
|
334
|
+
visible,
|
|
335
|
+
title,
|
|
336
|
+
message,
|
|
337
|
+
onConfirm,
|
|
338
|
+
onCancel,
|
|
339
|
+
confirmLabel,
|
|
340
|
+
cancelLabel,
|
|
341
|
+
confirmDisabled = false,
|
|
342
|
+
loading = false,
|
|
343
|
+
destructive = false
|
|
344
|
+
}) => {
|
|
345
|
+
const { theme, t } = useFeedbackUi();
|
|
346
|
+
const colorStyles = useMemo(
|
|
347
|
+
() => ({
|
|
348
|
+
dialog: { backgroundColor: theme.colors.surfaceElevated },
|
|
349
|
+
title: { color: theme.colors.text },
|
|
350
|
+
message: { color: theme.colors.textSecondary },
|
|
351
|
+
cancelButton: { borderColor: theme.colors.border },
|
|
352
|
+
cancelButtonText: { color: theme.colors.text },
|
|
353
|
+
confirmButton: {
|
|
354
|
+
backgroundColor: destructive ? theme.semantic.error["500"] : theme.palette.primary["500"]
|
|
355
|
+
},
|
|
356
|
+
confirmButtonText: { color: theme.colors.surfaceElevated }
|
|
357
|
+
}),
|
|
358
|
+
[theme, destructive]
|
|
359
|
+
);
|
|
360
|
+
const resolvedConfirmLabel = confirmLabel ?? t("common.confirm");
|
|
361
|
+
const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
|
|
362
|
+
const isConfirmDisabled = confirmDisabled || loading;
|
|
363
|
+
if (!visible)
|
|
364
|
+
return null;
|
|
365
|
+
return /* @__PURE__ */ jsx(
|
|
366
|
+
Modal,
|
|
367
|
+
{
|
|
368
|
+
transparent: true,
|
|
369
|
+
animationType: "fade",
|
|
370
|
+
visible,
|
|
371
|
+
onRequestClose: onCancel,
|
|
372
|
+
children: /* @__PURE__ */ jsx(View, { style: styles5.overlay, testID: FEEDBACK_TEST_IDS.confirmDialog, children: /* @__PURE__ */ jsxs(
|
|
373
|
+
View,
|
|
374
|
+
{
|
|
375
|
+
accessibilityViewIsModal: true,
|
|
376
|
+
"aria-label": title,
|
|
377
|
+
role: "dialog",
|
|
378
|
+
style: [styles5.dialog, colorStyles.dialog],
|
|
379
|
+
children: [
|
|
380
|
+
/* @__PURE__ */ jsx(Text, { style: [styles5.title, colorStyles.title], children: title }),
|
|
381
|
+
/* @__PURE__ */ jsx(Text, { style: [styles5.message, colorStyles.message], children: message }),
|
|
382
|
+
/* @__PURE__ */ jsxs(View, { style: styles5.buttonRow, children: [
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
TouchableOpacity,
|
|
385
|
+
{
|
|
386
|
+
accessibilityHint: t("common.cancelHint"),
|
|
387
|
+
accessibilityLabel: resolvedCancelLabel,
|
|
388
|
+
accessibilityRole: "button",
|
|
389
|
+
style: [
|
|
390
|
+
styles5.button,
|
|
391
|
+
styles5.cancelButton,
|
|
392
|
+
colorStyles.cancelButton
|
|
393
|
+
],
|
|
394
|
+
testID: FEEDBACK_TEST_IDS.cancelConfirmButton,
|
|
395
|
+
onPress: onCancel,
|
|
396
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles5.buttonText, colorStyles.cancelButtonText], children: resolvedCancelLabel })
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ jsx(
|
|
400
|
+
TouchableOpacity,
|
|
401
|
+
{
|
|
402
|
+
accessibilityHint: t("common.confirmHint"),
|
|
403
|
+
accessibilityLabel: resolvedConfirmLabel,
|
|
404
|
+
accessibilityRole: "button",
|
|
405
|
+
accessibilityState: { disabled: isConfirmDisabled },
|
|
406
|
+
disabled: isConfirmDisabled,
|
|
407
|
+
style: [
|
|
408
|
+
styles5.button,
|
|
409
|
+
styles5.confirmButton,
|
|
410
|
+
colorStyles.confirmButton,
|
|
411
|
+
isConfirmDisabled && styles5.disabledButton
|
|
412
|
+
],
|
|
413
|
+
testID: FEEDBACK_TEST_IDS.confirmButton,
|
|
414
|
+
onPress: onConfirm,
|
|
415
|
+
children: loading ? /* @__PURE__ */ jsx(
|
|
416
|
+
ActivityIndicator,
|
|
417
|
+
{
|
|
418
|
+
color: theme.colors.surfaceElevated,
|
|
419
|
+
size: "small",
|
|
420
|
+
testID: "confirm-loading"
|
|
421
|
+
}
|
|
422
|
+
) : /* @__PURE__ */ jsx(
|
|
423
|
+
Text,
|
|
424
|
+
{
|
|
425
|
+
style: [styles5.buttonText, colorStyles.confirmButtonText],
|
|
426
|
+
children: resolvedConfirmLabel
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
] })
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
) })
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
export { ConfirmDialog, DISABLED_OPACITY, EmptyListState, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LoadingFallback, MODAL_OVERLAY_COLOR, PageSkeleton, useFeedbackUi };
|
|
440
|
+
//# sourceMappingURL=index.mjs.map
|
|
441
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/FeedbackUiContext.tsx","../src/constants.ts","../src/ErrorState/ErrorState.tsx","../src/EmptyListState/EmptyListState.tsx","../src/LoadingFallback/LoadingFallback.tsx","../src/PageSkeleton/PageSkeleton.tsx","../src/ConfirmDialog/ConfirmDialog.tsx"],"names":["jsx","MESSAGE_FONT_SIZE","CONTAINER_PADDING","styles","StyleSheet","jsxs","View","Text","TouchableOpacity","React","useMemo","ActivityIndicator"],"mappings":";;;;;AAsCA,IAAM,iBAAA,GAAoB,cAAsC,IAAI,CAAA;AAW7D,IAAM,qBAAqB,CAAC;AAAA,EACjC,KAAA;AAAA,EACA,CAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,KAAmD;AACjD,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAyB,OAAO,EAAE,KAAA,EAAO,CAAA,EAAG,QAAA,EAAS,CAAA,EAAI,CAAC,KAAA,EAAO,CAAA,EAAG,QAAQ,CAAC,CAAA;AAC3F,EAAA,uBAAO,GAAA,CAAC,iBAAA,CAAkB,QAAA,EAAlB,EAA2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;AAAA,oBAACO,IAAAA;AAAA,oBAAA;AAAA,sBACC,KAAA,EAAO,CAACJ,OAAAA,CAAO,UAAA,EAAY,YAAY,iBAAiB,CAAA;AAAA,sBAEvD,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAEJ,aAAA,EACF;AAAA;AAAA;AAAA,OACF,EACF;AAAA;AAAA,GACF;AAEJ","file":"index.mjs","sourcesContent":["import React, { createContext, useContext, useMemo } from 'react';\n\n/**\n * The minimal theme surface the feedback components read. Each consuming app's\n * resolved theme object is structurally compatible with this shape, so apps pass\n * their existing `useTheme().theme` straight through the provider.\n */\nexport interface FeedbackThemeColors {\n background: string;\n surfaceElevated: string;\n text: string;\n textSecondary: string;\n border: string;\n}\n\n/** A colour scale where the `500` step is the one the feedback components use. */\nexport interface FeedbackColorScale {\n '500': string;\n}\n\nexport interface FeedbackTheme {\n colors: FeedbackThemeColors;\n palette: { primary: FeedbackColorScale };\n semantic: { error: FeedbackColorScale };\n}\n\n/** Translate function — mirrors the apps' `FM(key, p1?, p2?, p3?)` helper. */\nexport type FeedbackTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;\n\n/** Navigation callback used by EmptyListState's optional call-to-action. */\nexport type FeedbackNavigate = (route: string) => void;\n\nexport interface FeedbackUiValue {\n theme: FeedbackTheme;\n t: FeedbackTranslate;\n navigate?: FeedbackNavigate;\n}\n\nconst FeedbackUiContext = createContext<FeedbackUiValue | null>(null);\n\nexport interface FeedbackUiProviderProps extends FeedbackUiValue {\n children: React.ReactNode;\n}\n\n/**\n * Supplies the host app's theme + translate (+ optional navigate) to the\n * `@dloizides/ui-feedback` components. Mount once, high in the app tree, below\n * the app's own ThemeProvider.\n */\nexport const FeedbackUiProvider = ({\n theme,\n t,\n navigate,\n children,\n}: FeedbackUiProviderProps): React.ReactElement => {\n const value = useMemo<FeedbackUiValue>(() => ({ theme, t, navigate }), [theme, t, navigate]);\n return <FeedbackUiContext.Provider value={value}>{children}</FeedbackUiContext.Provider>;\n};\n\n/** Reads the feedback UI context; throws if used outside a FeedbackUiProvider. */\nexport function useFeedbackUi(): FeedbackUiValue {\n const ctx = useContext(FeedbackUiContext);\n if (ctx === null)\n throw new Error('useFeedbackUi must be used within a FeedbackUiProvider');\n return ctx;\n}\n","/** Semi-transparent scrim behind modal dialogs. */\nexport const MODAL_OVERLAY_COLOR = 'rgba(0, 0, 0, 0.5)';\n\n/** Opacity applied to disabled interactive controls. */\nexport const DISABLED_OPACITY = 0.5;\n\n/**\n * Default testID strings. These match the values the consuming apps already used\n * so existing Playwright selectors keep working after migration.\n */\nexport const FEEDBACK_TEST_IDS = {\n errorState: 'error-state',\n errorStateRetry: 'error-state-retry',\n emptyListCta: 'empty-list-cta',\n loadingFallback: 'loading-fallback',\n pageSkeleton: 'page-skeleton',\n confirmDialog: 'confirm-dialog',\n confirmButton: 'confirm-button',\n cancelConfirmButton: 'cancel-confirm-button',\n} as const;\n","/**\n * ErrorState - generic error display with optional retry button.\n */\nimport React from 'react';\n\nimport { StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useFeedbackUi } from '../context/FeedbackUiContext';\nimport { FEEDBACK_TEST_IDS } from '../constants';\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst MESSAGE_FONT_SIZE = 16;\nconst CONTAINER_PADDING = 20;\nconst BUTTON_MARGIN_TOP = 12;\nconst BUTTON_PADDING_V = 8;\nconst BUTTON_PADDING_H = 16;\nconst BUTTON_BORDER_RADIUS = 6;\nconst BUTTON_FONT_SIZE = 14;\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: CONTAINER_PADDING,\n },\n message: {\n fontSize: MESSAGE_FONT_SIZE,\n textAlign: 'center',\n },\n retryButton: {\n marginTop: BUTTON_MARGIN_TOP,\n paddingVertical: BUTTON_PADDING_V,\n paddingHorizontal: BUTTON_PADDING_H,\n borderRadius: BUTTON_BORDER_RADIUS,\n },\n retryText: {\n fontSize: BUTTON_FONT_SIZE,\n fontWeight: '600',\n },\n});\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport interface ErrorStateProps {\n message: string;\n onRetry?: () => void;\n testID?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport const ErrorState = ({\n message,\n onRetry,\n testID = FEEDBACK_TEST_IDS.errorState,\n}: ErrorStateProps): React.ReactElement => {\n const { theme, t } = useFeedbackUi();\n const errorColor = theme.semantic.error['500'];\n const primary = theme.palette.primary['500'];\n\n return (\n <View style={styles.container} testID={testID}>\n <Text style={[styles.message, { color: errorColor }]}>{message}</Text>\n {typeof onRetry === 'function' ? (\n <TouchableOpacity\n accessibilityHint={t('common.retryHint')}\n accessibilityLabel={t('common.retry')}\n accessibilityRole=\"button\"\n style={[styles.retryButton, { backgroundColor: primary }]}\n testID={FEEDBACK_TEST_IDS.errorStateRetry}\n onPress={onRetry}\n >\n <Text style={[styles.retryText, { color: theme.colors.surfaceElevated }]}>\n {t('common.retry')}\n </Text>\n </TouchableOpacity>\n ) : null}\n </View>\n );\n};\n\nexport default ErrorState;\n","/**\n * EmptyListState - empty-collection message with an optional call-to-action.\n *\n * The CTA navigates via the `navigate` callback supplied through FeedbackUiProvider\n * (the host app adapts its router, e.g. expo-router's `router.push`).\n */\nimport React, { useCallback } from 'react';\n\nimport { StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useFeedbackUi } from '../context/FeedbackUiContext';\nimport { FEEDBACK_TEST_IDS } from '../constants';\n\nconst MESSAGE_FONT_SIZE = 16;\nconst CTA_MARGIN_TOP = 16;\nconst CTA_PADDING_VERTICAL = 10;\nconst CTA_PADDING_HORIZONTAL = 20;\nconst CTA_BORDER_RADIUS = 8;\nconst CTA_FONT_SIZE = 14;\nconst CONTAINER_PADDING = 32;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: CONTAINER_PADDING,\n },\n message: {\n fontSize: MESSAGE_FONT_SIZE,\n textAlign: 'center',\n },\n ctaButton: {\n marginTop: CTA_MARGIN_TOP,\n paddingVertical: CTA_PADDING_VERTICAL,\n paddingHorizontal: CTA_PADDING_HORIZONTAL,\n borderRadius: CTA_BORDER_RADIUS,\n },\n ctaText: {\n fontSize: CTA_FONT_SIZE,\n fontWeight: '600',\n },\n});\n\nexport interface EmptyListStateProps {\n messageKey: string;\n ctaTextKey?: string;\n ctaHintKey?: string;\n ctaRoute?: string;\n testID: string;\n}\n\nexport const EmptyListState = ({\n messageKey,\n ctaTextKey,\n ctaHintKey,\n ctaRoute,\n testID,\n}: EmptyListStateProps): React.ReactElement => {\n const { theme, t, navigate } = useFeedbackUi();\n const { colors } = theme;\n const primary = theme.palette.primary['500'];\n\n const handlePress = useCallback((): void => {\n if (typeof ctaRoute === 'string' && typeof navigate === 'function') navigate(ctaRoute);\n }, [navigate, ctaRoute]);\n\n const showCta = typeof ctaTextKey === 'string'\n && typeof ctaHintKey === 'string'\n && typeof ctaRoute === 'string';\n\n return (\n <View style={styles.container} testID={testID}>\n <Text style={[styles.message, { color: colors.textSecondary }]}>\n {t(messageKey)}\n </Text>\n {showCta ? (\n <TouchableOpacity\n accessibilityHint={t(ctaHintKey as string)}\n accessibilityLabel={t(ctaTextKey as string)}\n accessibilityRole=\"button\"\n style={[styles.ctaButton, { backgroundColor: primary }]}\n testID={FEEDBACK_TEST_IDS.emptyListCta}\n onPress={handlePress}\n >\n <Text style={[styles.ctaText, { color: colors.background }]}>\n {t(ctaTextKey as string)}\n </Text>\n </TouchableOpacity>\n ) : null}\n </View>\n );\n};\n\nexport default EmptyListState;\n","/**\n * LoadingFallback - lightweight loading indicator for lazy-loaded components.\n *\n * Used with React.lazy() and Suspense to show a loading state while heavy\n * components are loading. Optimized for minimal bundle impact.\n */\nimport React from 'react';\n\nimport { ActivityIndicator, StyleSheet, View } from 'react-native';\n\nimport { useFeedbackUi } from '../context/FeedbackUiContext';\nimport { FEEDBACK_TEST_IDS } from '../constants';\n\nconst FULLSCREEN_MIN_HEIGHT = 300;\nconst CONTAINER_MIN_HEIGHT = 100;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n minHeight: CONTAINER_MIN_HEIGHT,\n },\n fullScreen: {\n minHeight: FULLSCREEN_MIN_HEIGHT,\n },\n});\n\nexport interface LoadingFallbackProps {\n /** Show as full-screen loader (default: false) */\n fullScreen?: boolean;\n /** Custom size for the spinner */\n size?: 'small' | 'large';\n}\n\nexport const LoadingFallback: React.FC<LoadingFallbackProps> = ({ fullScreen = false, size = 'large' }) => {\n const { theme, t } = useFeedbackUi();\n const colors = theme.colors;\n const primary = theme.palette.primary['500'];\n\n return (\n <View\n accessibilityHint={t('loadingFallback.hint')}\n accessibilityLabel={t('loadingFallback.label')}\n accessibilityRole=\"progressbar\"\n style={[styles.container, fullScreen && styles.fullScreen, { backgroundColor: colors.background }]}\n testID={FEEDBACK_TEST_IDS.loadingFallback}\n >\n <ActivityIndicator color={primary} size={size} />\n </View>\n );\n};\n\nexport default LoadingFallback;\n","/**\n * PageSkeleton - shimmer skeleton loader for full pages.\n *\n * Improves perceived performance (Speed Index) by showing immediate visual\n * feedback while page content loads.\n */\nimport React from 'react';\n\nimport { Animated, Easing, Platform, StyleSheet, View } from 'react-native';\n\nimport { useFeedbackUi } from '../context/FeedbackUiContext';\nimport { FEEDBACK_TEST_IDS } from '../constants';\n\nconst ANIMATION_DURATION_MS = 1200;\nconst SKELETON_BORDER_RADIUS = 4;\nconst SKELETON_OPACITY_START = 0.3;\nconst SKELETON_OPACITY_END = 0.7;\nconst DEFAULT_ROWS = 5;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n padding: 16,\n },\n header: {\n height: 32,\n borderRadius: SKELETON_BORDER_RADIUS,\n marginBottom: 24,\n width: '60%',\n },\n row: {\n flexDirection: 'row',\n marginBottom: 16,\n },\n avatar: {\n width: 48,\n height: 48,\n borderRadius: 24,\n marginRight: 12,\n },\n textContainer: {\n flex: 1,\n justifyContent: 'center',\n },\n textLine: {\n height: 16,\n borderRadius: SKELETON_BORDER_RADIUS,\n marginBottom: 8,\n },\n textLineShort: {\n width: '70%',\n },\n textLineFull: {\n width: '100%',\n },\n card: {\n height: 120,\n borderRadius: 8,\n marginBottom: 16,\n },\n});\n\nexport interface PageSkeletonProps {\n /** Number of skeleton rows to show */\n rows?: number;\n /** Show header skeleton */\n showHeader?: boolean;\n /** Show card skeletons instead of rows */\n variant?: 'list' | 'cards';\n}\n\nexport const PageSkeleton: React.FC<PageSkeletonProps> = ({\n rows = DEFAULT_ROWS,\n showHeader = true,\n variant = 'list',\n}) => {\n const { theme, t } = useFeedbackUi();\n const colors = theme.colors;\n\n const animatedValue = React.useRef(new Animated.Value(0)).current;\n\n React.useEffect(() => {\n const animation = Animated.loop(\n Animated.sequence([\n Animated.timing(animatedValue, {\n toValue: 1,\n duration: ANIMATION_DURATION_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: Platform.OS !== 'web',\n }),\n Animated.timing(animatedValue, {\n toValue: 0,\n duration: ANIMATION_DURATION_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: Platform.OS !== 'web',\n }),\n ]),\n );\n animation.start();\n return () => animation.stop();\n }, [animatedValue]);\n\n const opacity = animatedValue.interpolate({\n inputRange: [0, 1],\n outputRange: [SKELETON_OPACITY_START, SKELETON_OPACITY_END],\n });\n\n const skeletonColor = String(colors.border);\n\n const renderListRow = (index: number): React.ReactElement => (\n <View key={index} style={styles.row}>\n <Animated.View style={[styles.avatar, { backgroundColor: skeletonColor, opacity }]} />\n <View style={styles.textContainer}>\n <Animated.View style={[styles.textLine, styles.textLineFull, { backgroundColor: skeletonColor, opacity }]} />\n <Animated.View style={[styles.textLine, styles.textLineShort, { backgroundColor: skeletonColor, opacity }]} />\n </View>\n </View>\n );\n\n const renderCard = (index: number): React.ReactElement => (\n <Animated.View key={index} style={[styles.card, { backgroundColor: skeletonColor, opacity }]} />\n );\n\n const rowElements = Array.from({ length: rows }, (_, i) => (variant === 'cards' ? renderCard(i) : renderListRow(i)));\n\n return (\n <View\n accessibilityHint={t('pageSkeleton.loadingHint')}\n accessibilityLabel={t('pageSkeleton.loadingLabel')}\n accessibilityState={{ busy: true }}\n style={[styles.container, { backgroundColor: colors.background }]}\n testID={FEEDBACK_TEST_IDS.pageSkeleton}\n >\n {showHeader ? <Animated.View style={[styles.header, { backgroundColor: skeletonColor, opacity }]} /> : null}\n {rowElements}\n </View>\n );\n};\n\nexport default PageSkeleton;\n","/**\n * ConfirmDialog - modal confirm/cancel dialog with optional destructive + loading states.\n */\nimport React, { useMemo } from 'react';\n\nimport {\n ActivityIndicator,\n Modal,\n StyleSheet,\n Text,\n TouchableOpacity,\n View,\n} from 'react-native';\n\nimport { useFeedbackUi } from '../context/FeedbackUiContext';\nimport { DISABLED_OPACITY, MODAL_OVERLAY_COLOR, FEEDBACK_TEST_IDS } from '../constants';\n\nconst DIALOG_MAX_WIDTH = 400;\n\nconst styles = StyleSheet.create({\n overlay: {\n flex: 1,\n backgroundColor: MODAL_OVERLAY_COLOR,\n justifyContent: 'center',\n alignItems: 'center',\n padding: 20,\n },\n dialog: {\n width: '100%',\n maxWidth: DIALOG_MAX_WIDTH,\n borderRadius: 12,\n padding: 20,\n boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.25)',\n elevation: 5,\n },\n title: {\n fontSize: 18,\n fontWeight: '600',\n marginBottom: 12,\n },\n message: {\n fontSize: 14,\n lineHeight: 20,\n marginBottom: 20,\n },\n buttonRow: {\n flexDirection: 'row',\n justifyContent: 'flex-end',\n gap: 12,\n },\n button: {\n paddingVertical: 10,\n paddingHorizontal: 20,\n borderRadius: 6,\n minWidth: 80,\n alignItems: 'center',\n justifyContent: 'center',\n },\n cancelButton: {\n borderWidth: 1,\n },\n confirmButton: {},\n buttonText: {\n fontSize: 14,\n fontWeight: '600',\n },\n disabledButton: {\n opacity: DISABLED_OPACITY,\n },\n});\n\nexport interface ConfirmDialogProps {\n visible: boolean;\n title: string;\n message: string;\n onConfirm: () => void;\n onCancel: () => void;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmDisabled?: boolean;\n loading?: boolean;\n destructive?: boolean;\n}\n\nexport const ConfirmDialog = ({\n visible,\n title,\n message,\n onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n confirmDisabled = false,\n loading = false,\n destructive = false,\n}: ConfirmDialogProps): React.ReactElement | null => {\n const { theme, t } = useFeedbackUi();\n\n const colorStyles = useMemo(\n () => ({\n dialog: { backgroundColor: theme.colors.surfaceElevated },\n title: { color: theme.colors.text },\n message: { color: theme.colors.textSecondary },\n cancelButton: { borderColor: theme.colors.border },\n cancelButtonText: { color: theme.colors.text },\n confirmButton: {\n backgroundColor: destructive ? theme.semantic.error['500'] : theme.palette.primary['500'],\n },\n confirmButtonText: { color: theme.colors.surfaceElevated },\n }),\n [theme, destructive]\n );\n\n const resolvedConfirmLabel = confirmLabel ?? t('common.confirm');\n const resolvedCancelLabel = cancelLabel ?? t('common.cancel');\n\n const isConfirmDisabled = confirmDisabled || loading;\n\n if (!visible)\n return null;\n\n return (\n <Modal\n transparent\n animationType=\"fade\"\n visible={visible}\n onRequestClose={onCancel}\n >\n <View style={styles.overlay} testID={FEEDBACK_TEST_IDS.confirmDialog}>\n <View\n accessibilityViewIsModal\n aria-label={title}\n role=\"dialog\"\n style={[styles.dialog, colorStyles.dialog]}\n >\n <Text style={[styles.title, colorStyles.title]}>{title}</Text>\n <Text style={[styles.message, colorStyles.message]}>{message}</Text>\n\n <View style={styles.buttonRow}>\n <TouchableOpacity\n accessibilityHint={t('common.cancelHint')}\n accessibilityLabel={resolvedCancelLabel}\n accessibilityRole=\"button\"\n style={[\n styles.button,\n styles.cancelButton,\n colorStyles.cancelButton,\n ]}\n testID={FEEDBACK_TEST_IDS.cancelConfirmButton}\n onPress={onCancel}\n >\n <Text style={[styles.buttonText, colorStyles.cancelButtonText]}>\n {resolvedCancelLabel}\n </Text>\n </TouchableOpacity>\n\n <TouchableOpacity\n accessibilityHint={t('common.confirmHint')}\n accessibilityLabel={resolvedConfirmLabel}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled: isConfirmDisabled }}\n disabled={isConfirmDisabled}\n style={[\n styles.button,\n styles.confirmButton,\n colorStyles.confirmButton,\n isConfirmDisabled && styles.disabledButton,\n ]}\n testID={FEEDBACK_TEST_IDS.confirmButton}\n onPress={onConfirm}\n >\n {loading ? (\n <ActivityIndicator\n color={theme.colors.surfaceElevated}\n size=\"small\"\n testID=\"confirm-loading\"\n />\n ) : (\n <Text\n style={[styles.buttonText, colorStyles.confirmButtonText]}\n >\n {resolvedConfirmLabel}\n </Text>\n )}\n </TouchableOpacity>\n </View>\n </View>\n </View>\n </Modal>\n );\n};\n\nexport default ConfirmDialog;\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dloizides/ui-feedback",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Themable, brand-agnostic React Native (RN-web) feedback components — ErrorState, EmptyListState, LoadingFallback, PageSkeleton, ConfirmDialog — wired through a small injectable theme/translate provider. Part of the dloizides.com shared UI kit.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-native",
|
|
8
|
+
"react-native-web",
|
|
9
|
+
"ui",
|
|
10
|
+
"feedback",
|
|
11
|
+
"modal",
|
|
12
|
+
"skeleton",
|
|
13
|
+
"dloizides"
|
|
14
|
+
],
|
|
15
|
+
"author": "dloizides",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/openmindednewby/ui-feedback.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/openmindednewby/ui-feedback#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/openmindednewby/ui-feedback/issues"
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"module": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"react-native": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"browser": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/index.d.mts",
|
|
44
|
+
"default": "./dist/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
"default": {
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
48
|
+
"default": "./dist/index.js"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist",
|
|
54
|
+
"README.md",
|
|
55
|
+
"CHANGELOG.md"
|
|
56
|
+
],
|
|
57
|
+
"sideEffects": false,
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=18.0.0"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "rimraf dist && tsup",
|
|
63
|
+
"build:watch": "tsup --watch",
|
|
64
|
+
"test": "jest",
|
|
65
|
+
"test:watch": "jest --watch",
|
|
66
|
+
"test:coverage": "jest --coverage",
|
|
67
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
68
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"clean": "rimraf dist",
|
|
71
|
+
"security:audit": "npm audit --audit-level=high",
|
|
72
|
+
"deps:outdated": "npm outdated || exit 0",
|
|
73
|
+
"deps:unused": "npx depcheck --ignores \"@types/jest,@types/node,@types/react,@types/react-dom,rimraf,react-native\"",
|
|
74
|
+
"deps:licenses": "npx license-checker --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD;Unlicense;CC0-1.0\"",
|
|
75
|
+
"deps:health": "npm run deps:outdated && npm run deps:unused",
|
|
76
|
+
"prepublishOnly": "npm run clean && npm run build && npm run test",
|
|
77
|
+
"version": "npm run build"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"react": ">=18.0.0",
|
|
81
|
+
"react-native": ">=0.74.0"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@testing-library/dom": "^10.4.0",
|
|
85
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
86
|
+
"@testing-library/react": "^16.1.0",
|
|
87
|
+
"@types/jest": "^29.5.0",
|
|
88
|
+
"@types/node": "^20.19.32",
|
|
89
|
+
"@types/react": "^19.0.0",
|
|
90
|
+
"@types/react-dom": "^19.0.0",
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
92
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
93
|
+
"eslint": "^8.57.0",
|
|
94
|
+
"eslint-plugin-react": "^7.34.0",
|
|
95
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
96
|
+
"jest": "^29.7.0",
|
|
97
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
98
|
+
"react": "^19.2.4",
|
|
99
|
+
"react-dom": "^19.2.4",
|
|
100
|
+
"react-native": "0.81.5",
|
|
101
|
+
"rimraf": "^5.0.0",
|
|
102
|
+
"ts-jest": "^29.1.0",
|
|
103
|
+
"tsup": "^8.0.0",
|
|
104
|
+
"typescript": "^5.4.0"
|
|
105
|
+
}
|
|
106
|
+
}
|