@dloizides/ui-feedback 1.8.0 → 1.11.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/CHANGELOG.md +21 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +79 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext, useMemo, useContext, useCallback, useState, useEffect, useSyncExternalStore, Component, useRef } from 'react';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { StyleSheet, Platform, View, Text, TouchableOpacity, ActivityIndicator,
|
|
3
|
+
import { StyleSheet, Platform, View, Text, TouchableOpacity, ActivityIndicator, Modal, Animated } from 'react-native';
|
|
4
|
+
import { Skeleton } from '@dloizides/ui-motion';
|
|
4
5
|
|
|
5
6
|
// src/context/FeedbackUiContext.tsx
|
|
6
7
|
var DEFAULT_FEEDBACK_VALUE = {
|
|
@@ -198,30 +199,30 @@ var LoadingFallback = ({ fullScreen = false, size = "large" }) => {
|
|
|
198
199
|
}
|
|
199
200
|
);
|
|
200
201
|
};
|
|
201
|
-
var ANIMATION_DURATION_MS = 1200;
|
|
202
202
|
var SKELETON_BORDER_RADIUS = 4;
|
|
203
|
-
var
|
|
204
|
-
var SKELETON_OPACITY_END = 0.7;
|
|
203
|
+
var CARD_BORDER_RADIUS = 8;
|
|
205
204
|
var DEFAULT_ROWS = 5;
|
|
205
|
+
var HEADER_HEIGHT = 32;
|
|
206
|
+
var HEADER_WIDTH = "60%";
|
|
207
|
+
var AVATAR_SIZE = 48;
|
|
208
|
+
var AVATAR_BORDER_RADIUS = 24;
|
|
209
|
+
var TEXT_LINE_HEIGHT = 16;
|
|
210
|
+
var TEXT_LINE_FULL_WIDTH = "100%";
|
|
211
|
+
var TEXT_LINE_SHORT_WIDTH = "70%";
|
|
212
|
+
var CARD_HEIGHT = 120;
|
|
206
213
|
var styles4 = StyleSheet.create({
|
|
207
214
|
container: {
|
|
208
215
|
flex: 1,
|
|
209
216
|
padding: 16
|
|
210
217
|
},
|
|
211
218
|
header: {
|
|
212
|
-
|
|
213
|
-
borderRadius: SKELETON_BORDER_RADIUS,
|
|
214
|
-
marginBottom: 24,
|
|
215
|
-
width: "60%"
|
|
219
|
+
marginBottom: 24
|
|
216
220
|
},
|
|
217
221
|
row: {
|
|
218
222
|
flexDirection: "row",
|
|
219
223
|
marginBottom: 16
|
|
220
224
|
},
|
|
221
225
|
avatar: {
|
|
222
|
-
width: 48,
|
|
223
|
-
height: 48,
|
|
224
|
-
borderRadius: 24,
|
|
225
226
|
marginRight: 12
|
|
226
227
|
},
|
|
227
228
|
textContainer: {
|
|
@@ -229,19 +230,9 @@ var styles4 = StyleSheet.create({
|
|
|
229
230
|
justifyContent: "center"
|
|
230
231
|
},
|
|
231
232
|
textLine: {
|
|
232
|
-
height: 16,
|
|
233
|
-
borderRadius: SKELETON_BORDER_RADIUS,
|
|
234
233
|
marginBottom: 8
|
|
235
234
|
},
|
|
236
|
-
textLineShort: {
|
|
237
|
-
width: "70%"
|
|
238
|
-
},
|
|
239
|
-
textLineFull: {
|
|
240
|
-
width: "100%"
|
|
241
|
-
},
|
|
242
235
|
card: {
|
|
243
|
-
height: 120,
|
|
244
|
-
borderRadius: 8,
|
|
245
236
|
marginBottom: 16
|
|
246
237
|
}
|
|
247
238
|
});
|
|
@@ -252,40 +243,51 @@ var PageSkeleton = ({
|
|
|
252
243
|
}) => {
|
|
253
244
|
const { theme, t } = useFeedbackUi();
|
|
254
245
|
const colors = theme.colors;
|
|
255
|
-
const animatedValue = React3.useRef(new Animated.Value(0)).current;
|
|
256
|
-
React3.useEffect(() => {
|
|
257
|
-
const animation = Animated.loop(
|
|
258
|
-
Animated.sequence([
|
|
259
|
-
Animated.timing(animatedValue, {
|
|
260
|
-
toValue: 1,
|
|
261
|
-
duration: ANIMATION_DURATION_MS,
|
|
262
|
-
easing: Easing.inOut(Easing.ease),
|
|
263
|
-
useNativeDriver: Platform.OS !== "web"
|
|
264
|
-
}),
|
|
265
|
-
Animated.timing(animatedValue, {
|
|
266
|
-
toValue: 0,
|
|
267
|
-
duration: ANIMATION_DURATION_MS,
|
|
268
|
-
easing: Easing.inOut(Easing.ease),
|
|
269
|
-
useNativeDriver: Platform.OS !== "web"
|
|
270
|
-
})
|
|
271
|
-
])
|
|
272
|
-
);
|
|
273
|
-
animation.start();
|
|
274
|
-
return () => animation.stop();
|
|
275
|
-
}, [animatedValue]);
|
|
276
|
-
const opacity = animatedValue.interpolate({
|
|
277
|
-
inputRange: [0, 1],
|
|
278
|
-
outputRange: [SKELETON_OPACITY_START, SKELETON_OPACITY_END]
|
|
279
|
-
});
|
|
280
246
|
const skeletonColor = String(colors.border);
|
|
281
247
|
const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style: styles4.row, children: [
|
|
282
|
-
/* @__PURE__ */ jsx(
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
Skeleton,
|
|
250
|
+
{
|
|
251
|
+
backgroundColor: skeletonColor,
|
|
252
|
+
borderRadius: AVATAR_BORDER_RADIUS,
|
|
253
|
+
height: AVATAR_SIZE,
|
|
254
|
+
style: styles4.avatar,
|
|
255
|
+
width: AVATAR_SIZE
|
|
256
|
+
}
|
|
257
|
+
),
|
|
283
258
|
/* @__PURE__ */ jsxs(View, { style: styles4.textContainer, children: [
|
|
284
|
-
/* @__PURE__ */ jsx(
|
|
285
|
-
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
Skeleton,
|
|
261
|
+
{
|
|
262
|
+
backgroundColor: skeletonColor,
|
|
263
|
+
borderRadius: SKELETON_BORDER_RADIUS,
|
|
264
|
+
height: TEXT_LINE_HEIGHT,
|
|
265
|
+
style: styles4.textLine,
|
|
266
|
+
width: TEXT_LINE_FULL_WIDTH
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
/* @__PURE__ */ jsx(
|
|
270
|
+
Skeleton,
|
|
271
|
+
{
|
|
272
|
+
backgroundColor: skeletonColor,
|
|
273
|
+
borderRadius: SKELETON_BORDER_RADIUS,
|
|
274
|
+
height: TEXT_LINE_HEIGHT,
|
|
275
|
+
style: styles4.textLine,
|
|
276
|
+
width: TEXT_LINE_SHORT_WIDTH
|
|
277
|
+
}
|
|
278
|
+
)
|
|
286
279
|
] })
|
|
287
280
|
] }, index);
|
|
288
|
-
const renderCard = (index) => /* @__PURE__ */ jsx(
|
|
281
|
+
const renderCard = (index) => /* @__PURE__ */ jsx(
|
|
282
|
+
Skeleton,
|
|
283
|
+
{
|
|
284
|
+
backgroundColor: skeletonColor,
|
|
285
|
+
borderRadius: CARD_BORDER_RADIUS,
|
|
286
|
+
height: CARD_HEIGHT,
|
|
287
|
+
style: styles4.card
|
|
288
|
+
},
|
|
289
|
+
index
|
|
290
|
+
);
|
|
289
291
|
const rowElements = Array.from({ length: rows }, (_, i) => variant === "cards" ? renderCard(i) : renderListRow(i));
|
|
290
292
|
return /* @__PURE__ */ jsxs(
|
|
291
293
|
View,
|
|
@@ -296,7 +298,16 @@ var PageSkeleton = ({
|
|
|
296
298
|
style: [styles4.container, { backgroundColor: colors.background }],
|
|
297
299
|
testID: FEEDBACK_TEST_IDS.pageSkeleton,
|
|
298
300
|
children: [
|
|
299
|
-
showHeader ? /* @__PURE__ */ jsx(
|
|
301
|
+
showHeader ? /* @__PURE__ */ jsx(
|
|
302
|
+
Skeleton,
|
|
303
|
+
{
|
|
304
|
+
backgroundColor: skeletonColor,
|
|
305
|
+
borderRadius: SKELETON_BORDER_RADIUS,
|
|
306
|
+
height: HEADER_HEIGHT,
|
|
307
|
+
style: styles4.header,
|
|
308
|
+
width: HEADER_WIDTH
|
|
309
|
+
}
|
|
310
|
+
) : null,
|
|
300
311
|
rowElements
|
|
301
312
|
]
|
|
302
313
|
}
|