@oxyhq/bloom 0.5.1 → 0.6.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/lib/commonjs/error-boundary/ErrorBoundary.js +27 -7
- package/lib/commonjs/error-boundary/ErrorBoundary.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/skeleton/index.js +30 -0
- package/lib/commonjs/skeleton/index.js.map +1 -1
- package/lib/module/error-boundary/ErrorBoundary.js +27 -7
- package/lib/module/error-boundary/ErrorBoundary.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/skeleton/index.js +29 -0
- package/lib/module/skeleton/index.js.map +1 -1
- package/lib/typescript/commonjs/error-boundary/ErrorBoundary.d.ts +3 -1
- package/lib/typescript/commonjs/error-boundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/typescript/commonjs/error-boundary/index.d.ts +1 -1
- package/lib/typescript/commonjs/error-boundary/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/error-boundary/types.d.ts +41 -2
- package/lib/typescript/commonjs/error-boundary/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/skeleton/index.d.ts +24 -1
- package/lib/typescript/commonjs/skeleton/index.d.ts.map +1 -1
- package/lib/typescript/module/error-boundary/ErrorBoundary.d.ts +3 -1
- package/lib/typescript/module/error-boundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/typescript/module/error-boundary/index.d.ts +1 -1
- package/lib/typescript/module/error-boundary/index.d.ts.map +1 -1
- package/lib/typescript/module/error-boundary/types.d.ts +41 -2
- package/lib/typescript/module/error-boundary/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/skeleton/index.d.ts +24 -1
- package/lib/typescript/module/skeleton/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/ErrorBoundary.test.tsx +217 -0
- package/src/__tests__/Skeleton.test.tsx +63 -0
- package/src/error-boundary/ErrorBoundary.tsx +28 -5
- package/src/error-boundary/index.ts +5 -1
- package/src/error-boundary/types.ts +45 -2
- package/src/index.ts +5 -1
- package/src/index.web.ts +5 -1
- package/src/skeleton/index.tsx +54 -1
package/src/skeleton/index.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
View,
|
|
5
|
+
type ViewStyle,
|
|
6
|
+
type TextStyle,
|
|
7
|
+
type DimensionValue,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
|
|
4
11
|
import { useTheme } from '../theme/use-theme';
|
|
5
12
|
import { SUPPORTS_NATIVE_DRIVER } from '../styles/native-driver';
|
|
@@ -129,6 +136,52 @@ export function Pill({
|
|
|
129
136
|
}
|
|
130
137
|
Pill.displayName = 'Skeleton.Pill';
|
|
131
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Generic rectangular shimmering placeholder. Use for image/card/banner
|
|
141
|
+
* placeholders where neither {@link Pill} (forced borderRadius: 999) nor
|
|
142
|
+
* {@link Circle} fit. Defaults to a small borderRadius (8). Pass `0` for
|
|
143
|
+
* sharp corners or any larger number / percentage string for custom shapes.
|
|
144
|
+
*/
|
|
145
|
+
export function Box({
|
|
146
|
+
width,
|
|
147
|
+
height,
|
|
148
|
+
borderRadius = 8,
|
|
149
|
+
blend,
|
|
150
|
+
style,
|
|
151
|
+
}: {
|
|
152
|
+
/** Width as a number, percentage string, or any valid RN dimension. */
|
|
153
|
+
width?: DimensionValue;
|
|
154
|
+
/** Height as a number, percentage string, or any valid RN dimension. */
|
|
155
|
+
height?: DimensionValue;
|
|
156
|
+
/**
|
|
157
|
+
* Corner radius — number or percentage string. Defaults to 8. Pass 0 for
|
|
158
|
+
* sharp corners.
|
|
159
|
+
*/
|
|
160
|
+
borderRadius?: ViewStyle['borderRadius'];
|
|
161
|
+
/** When true, dampens shimmer opacity (use for nested skeletons). */
|
|
162
|
+
blend?: boolean;
|
|
163
|
+
style?: ViewStyle | ViewStyle[];
|
|
164
|
+
}) {
|
|
165
|
+
const { colors } = useTheme();
|
|
166
|
+
const shimmer = useShimmer();
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Animated.View
|
|
170
|
+
style={[
|
|
171
|
+
{
|
|
172
|
+
backgroundColor: colors.contrast50,
|
|
173
|
+
width,
|
|
174
|
+
height,
|
|
175
|
+
borderRadius,
|
|
176
|
+
opacity: Animated.multiply(shimmer, blend ? 0.6 : 1),
|
|
177
|
+
},
|
|
178
|
+
style,
|
|
179
|
+
]}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
Box.displayName = 'Skeleton.Box';
|
|
184
|
+
|
|
132
185
|
export function Col({
|
|
133
186
|
children,
|
|
134
187
|
style,
|