@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.
Files changed (45) hide show
  1. package/lib/commonjs/error-boundary/ErrorBoundary.js +27 -7
  2. package/lib/commonjs/error-boundary/ErrorBoundary.js.map +1 -1
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/index.web.js.map +1 -1
  5. package/lib/commonjs/skeleton/index.js +30 -0
  6. package/lib/commonjs/skeleton/index.js.map +1 -1
  7. package/lib/module/error-boundary/ErrorBoundary.js +27 -7
  8. package/lib/module/error-boundary/ErrorBoundary.js.map +1 -1
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/module/index.web.js.map +1 -1
  11. package/lib/module/skeleton/index.js +29 -0
  12. package/lib/module/skeleton/index.js.map +1 -1
  13. package/lib/typescript/commonjs/error-boundary/ErrorBoundary.d.ts +3 -1
  14. package/lib/typescript/commonjs/error-boundary/ErrorBoundary.d.ts.map +1 -1
  15. package/lib/typescript/commonjs/error-boundary/index.d.ts +1 -1
  16. package/lib/typescript/commonjs/error-boundary/index.d.ts.map +1 -1
  17. package/lib/typescript/commonjs/error-boundary/types.d.ts +41 -2
  18. package/lib/typescript/commonjs/error-boundary/types.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/index.d.ts +1 -1
  20. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/index.web.d.ts +1 -1
  22. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  23. package/lib/typescript/commonjs/skeleton/index.d.ts +24 -1
  24. package/lib/typescript/commonjs/skeleton/index.d.ts.map +1 -1
  25. package/lib/typescript/module/error-boundary/ErrorBoundary.d.ts +3 -1
  26. package/lib/typescript/module/error-boundary/ErrorBoundary.d.ts.map +1 -1
  27. package/lib/typescript/module/error-boundary/index.d.ts +1 -1
  28. package/lib/typescript/module/error-boundary/index.d.ts.map +1 -1
  29. package/lib/typescript/module/error-boundary/types.d.ts +41 -2
  30. package/lib/typescript/module/error-boundary/types.d.ts.map +1 -1
  31. package/lib/typescript/module/index.d.ts +1 -1
  32. package/lib/typescript/module/index.d.ts.map +1 -1
  33. package/lib/typescript/module/index.web.d.ts +1 -1
  34. package/lib/typescript/module/index.web.d.ts.map +1 -1
  35. package/lib/typescript/module/skeleton/index.d.ts +24 -1
  36. package/lib/typescript/module/skeleton/index.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/__tests__/ErrorBoundary.test.tsx +217 -0
  39. package/src/__tests__/Skeleton.test.tsx +63 -0
  40. package/src/error-boundary/ErrorBoundary.tsx +28 -5
  41. package/src/error-boundary/index.ts +5 -1
  42. package/src/error-boundary/types.ts +45 -2
  43. package/src/index.ts +5 -1
  44. package/src/index.web.ts +5 -1
  45. package/src/skeleton/index.tsx +54 -1
@@ -1,5 +1,12 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { Animated, View, type ViewStyle, type TextStyle, StyleSheet } from 'react-native';
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,