@oxyhq/bloom 0.26.1 → 0.28.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/animated-check/AnimatedCheck.js +162 -0
- package/lib/commonjs/animated-check/AnimatedCheck.js.map +1 -0
- package/lib/commonjs/animated-check/index.js +13 -0
- package/lib/commonjs/animated-check/index.js.map +1 -0
- package/lib/commonjs/avatar/Avatar.js +67 -96
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/avatar/AvatarRing.js +183 -0
- package/lib/commonjs/avatar/AvatarRing.js.map +1 -0
- package/lib/commonjs/avatar/index.js.map +1 -1
- package/lib/commonjs/avatar/squircle-path.js +14 -0
- package/lib/commonjs/avatar/squircle-path.js.map +1 -0
- package/lib/commonjs/avatar/svg-module.js +15 -0
- package/lib/commonjs/avatar/svg-module.js.map +1 -0
- package/lib/commonjs/dialog/placement.js +9 -7
- package/lib/commonjs/dialog/placement.js.map +1 -1
- package/lib/commonjs/fill/index.js.map +1 -1
- package/lib/commonjs/hooks/index.js +20 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useGutters.js +106 -0
- package/lib/commonjs/hooks/useGutters.js.map +1 -0
- package/lib/commonjs/hooks/useHaptics.js +69 -0
- package/lib/commonjs/hooks/useHaptics.js.map +1 -0
- package/lib/commonjs/hooks/useInteractionState.js +8 -2
- package/lib/commonjs/hooks/useInteractionState.js.map +1 -1
- package/lib/commonjs/index.js +155 -63
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +155 -63
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/media-inset-border/MediaInsetBorder.js +50 -0
- package/lib/commonjs/media-inset-border/MediaInsetBorder.js.map +1 -0
- package/lib/commonjs/media-inset-border/index.js +13 -0
- package/lib/commonjs/media-inset-border/index.js.map +1 -0
- package/lib/commonjs/motion/ScreenTransition.js +46 -0
- package/lib/commonjs/motion/ScreenTransition.js.map +1 -0
- package/lib/commonjs/motion/index.js +32 -0
- package/lib/commonjs/motion/index.js.map +1 -0
- package/lib/commonjs/motion/motion.js +93 -0
- package/lib/commonjs/motion/motion.js.map +1 -0
- package/lib/commonjs/pressable-scale/PressableScale.js +75 -0
- package/lib/commonjs/pressable-scale/PressableScale.js.map +1 -0
- package/lib/commonjs/pressable-scale/index.js +13 -0
- package/lib/commonjs/pressable-scale/index.js.map +1 -0
- package/lib/commonjs/pressable-with-hover/PressableWithHover.js +36 -0
- package/lib/commonjs/pressable-with-hover/PressableWithHover.js.map +1 -0
- package/lib/commonjs/pressable-with-hover/index.js +13 -0
- package/lib/commonjs/pressable-with-hover/index.js.map +1 -0
- package/lib/commonjs/styles/breakpoints.js +24 -0
- package/lib/commonjs/styles/breakpoints.js.map +1 -0
- package/lib/commonjs/styles/index.js +7 -0
- package/lib/commonjs/styles/index.js.map +1 -1
- package/lib/commonjs/subtle-hover/SubtleHover.js +69 -0
- package/lib/commonjs/subtle-hover/SubtleHover.js.map +1 -0
- package/lib/commonjs/subtle-hover/index.js +13 -0
- package/lib/commonjs/subtle-hover/index.js.map +1 -0
- package/lib/commonjs/theme/build-theme.js +2 -0
- package/lib/commonjs/theme/build-theme.js.map +1 -1
- package/lib/commonjs/theme/gradients.js +39 -0
- package/lib/commonjs/theme/gradients.js.map +1 -0
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/module/animated-check/AnimatedCheck.js +157 -0
- package/lib/module/animated-check/AnimatedCheck.js.map +1 -0
- package/lib/module/animated-check/index.js +4 -0
- package/lib/module/animated-check/index.js.map +1 -0
- package/lib/module/avatar/Avatar.js +66 -96
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/avatar/AvatarRing.js +177 -0
- package/lib/module/avatar/AvatarRing.js.map +1 -0
- package/lib/module/avatar/index.js.map +1 -1
- package/lib/module/avatar/squircle-path.js +10 -0
- package/lib/module/avatar/squircle-path.js.map +1 -0
- package/lib/module/avatar/svg-module.js +11 -0
- package/lib/module/avatar/svg-module.js.map +1 -0
- package/lib/module/dialog/placement.js +9 -7
- package/lib/module/dialog/placement.js.map +1 -1
- package/lib/module/fill/index.js.map +1 -1
- package/lib/module/hooks/index.js +2 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useGutters.js +103 -0
- package/lib/module/hooks/useGutters.js.map +1 -0
- package/lib/module/hooks/useHaptics.js +65 -0
- package/lib/module/hooks/useHaptics.js.map +1 -0
- package/lib/module/hooks/useInteractionState.js +10 -3
- package/lib/module/hooks/useInteractionState.js.map +1 -1
- package/lib/module/index.js +10 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +10 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/media-inset-border/MediaInsetBorder.js +47 -0
- package/lib/module/media-inset-border/MediaInsetBorder.js.map +1 -0
- package/lib/module/media-inset-border/index.js +4 -0
- package/lib/module/media-inset-border/index.js.map +1 -0
- package/lib/module/motion/ScreenTransition.js +40 -0
- package/lib/module/motion/ScreenTransition.js.map +1 -0
- package/lib/module/motion/index.js +5 -0
- package/lib/module/motion/index.js.map +1 -0
- package/lib/module/motion/motion.js +87 -0
- package/lib/module/motion/motion.js.map +1 -0
- package/lib/module/pressable-scale/PressableScale.js +72 -0
- package/lib/module/pressable-scale/PressableScale.js.map +1 -0
- package/lib/module/pressable-scale/index.js +4 -0
- package/lib/module/pressable-scale/index.js.map +1 -0
- package/lib/module/pressable-with-hover/PressableWithHover.js +31 -0
- package/lib/module/pressable-with-hover/PressableWithHover.js.map +1 -0
- package/lib/module/pressable-with-hover/index.js +4 -0
- package/lib/module/pressable-with-hover/index.js.map +1 -0
- package/lib/module/styles/breakpoints.js +20 -0
- package/lib/module/styles/breakpoints.js.map +1 -0
- package/lib/module/styles/index.js +1 -0
- package/lib/module/styles/index.js.map +1 -1
- package/lib/module/subtle-hover/SubtleHover.js +66 -0
- package/lib/module/subtle-hover/SubtleHover.js.map +1 -0
- package/lib/module/subtle-hover/index.js +4 -0
- package/lib/module/subtle-hover/index.js.map +1 -0
- package/lib/module/theme/build-theme.js +2 -0
- package/lib/module/theme/build-theme.js.map +1 -1
- package/lib/module/theme/gradients.js +35 -0
- package/lib/module/theme/gradients.js.map +1 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/module/theme/index.js.map +1 -1
- package/lib/typescript/commonjs/animated-check/AnimatedCheck.d.ts +18 -0
- package/lib/typescript/commonjs/animated-check/AnimatedCheck.d.ts.map +1 -0
- package/lib/typescript/commonjs/animated-check/index.d.ts +3 -0
- package/lib/typescript/commonjs/animated-check/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/AvatarRing.d.ts +27 -0
- package/lib/typescript/commonjs/avatar/AvatarRing.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/index.d.ts +1 -1
- package/lib/typescript/commonjs/avatar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/squircle-path.d.ts +8 -0
- package/lib/typescript/commonjs/avatar/squircle-path.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/svg-module.d.ts +8 -0
- package/lib/typescript/commonjs/avatar/svg-module.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/types.d.ts +30 -0
- package/lib/typescript/commonjs/avatar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/placement.d.ts +8 -7
- package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/commonjs/fill/index.d.ts +2 -2
- package/lib/typescript/commonjs/fill/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/index.d.ts +4 -0
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/useGutters.d.ts +32 -0
- package/lib/typescript/commonjs/hooks/useGutters.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useHaptics.d.ts +28 -0
- package/lib/typescript/commonjs/hooks/useHaptics.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useInteractionState.d.ts +6 -0
- package/lib/typescript/commonjs/hooks/useInteractionState.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +16 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +16 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-inset-border/MediaInsetBorder.d.ts +26 -0
- package/lib/typescript/commonjs/media-inset-border/MediaInsetBorder.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-inset-border/index.d.ts +3 -0
- package/lib/typescript/commonjs/media-inset-border/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/ScreenTransition.d.ts +33 -0
- package/lib/typescript/commonjs/motion/ScreenTransition.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/index.d.ts +4 -0
- package/lib/typescript/commonjs/motion/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/motion.d.ts +24 -0
- package/lib/typescript/commonjs/motion/motion.d.ts.map +1 -0
- package/lib/typescript/commonjs/pressable-scale/PressableScale.d.ts +21 -0
- package/lib/typescript/commonjs/pressable-scale/PressableScale.d.ts.map +1 -0
- package/lib/typescript/commonjs/pressable-scale/index.d.ts +3 -0
- package/lib/typescript/commonjs/pressable-scale/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/pressable-with-hover/PressableWithHover.d.ts +18 -0
- package/lib/typescript/commonjs/pressable-with-hover/PressableWithHover.d.ts.map +1 -0
- package/lib/typescript/commonjs/pressable-with-hover/index.d.ts +3 -0
- package/lib/typescript/commonjs/pressable-with-hover/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/styles/breakpoints.d.ts +18 -0
- package/lib/typescript/commonjs/styles/breakpoints.d.ts.map +1 -0
- package/lib/typescript/commonjs/styles/index.d.ts +2 -0
- package/lib/typescript/commonjs/styles/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/subtle-hover/SubtleHover.d.ts +32 -0
- package/lib/typescript/commonjs/subtle-hover/SubtleHover.d.ts.map +1 -0
- package/lib/typescript/commonjs/subtle-hover/index.d.ts +3 -0
- package/lib/typescript/commonjs/subtle-hover/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/build-theme.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/gradients.d.ts +12 -0
- package/lib/typescript/commonjs/theme/gradients.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +2 -1
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +11 -0
- package/lib/typescript/commonjs/theme/types.d.ts.map +1 -1
- package/lib/typescript/module/animated-check/AnimatedCheck.d.ts +18 -0
- package/lib/typescript/module/animated-check/AnimatedCheck.d.ts.map +1 -0
- package/lib/typescript/module/animated-check/index.d.ts +3 -0
- package/lib/typescript/module/animated-check/index.d.ts.map +1 -0
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/module/avatar/AvatarRing.d.ts +27 -0
- package/lib/typescript/module/avatar/AvatarRing.d.ts.map +1 -0
- package/lib/typescript/module/avatar/index.d.ts +1 -1
- package/lib/typescript/module/avatar/index.d.ts.map +1 -1
- package/lib/typescript/module/avatar/squircle-path.d.ts +8 -0
- package/lib/typescript/module/avatar/squircle-path.d.ts.map +1 -0
- package/lib/typescript/module/avatar/svg-module.d.ts +8 -0
- package/lib/typescript/module/avatar/svg-module.d.ts.map +1 -0
- package/lib/typescript/module/avatar/types.d.ts +30 -0
- package/lib/typescript/module/avatar/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/placement.d.ts +8 -7
- package/lib/typescript/module/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/module/fill/index.d.ts +2 -2
- package/lib/typescript/module/fill/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/index.d.ts +4 -0
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useGutters.d.ts +32 -0
- package/lib/typescript/module/hooks/useGutters.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useHaptics.d.ts +28 -0
- package/lib/typescript/module/hooks/useHaptics.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useInteractionState.d.ts +6 -0
- package/lib/typescript/module/hooks/useInteractionState.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +16 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +16 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/media-inset-border/MediaInsetBorder.d.ts +26 -0
- package/lib/typescript/module/media-inset-border/MediaInsetBorder.d.ts.map +1 -0
- package/lib/typescript/module/media-inset-border/index.d.ts +3 -0
- package/lib/typescript/module/media-inset-border/index.d.ts.map +1 -0
- package/lib/typescript/module/motion/ScreenTransition.d.ts +33 -0
- package/lib/typescript/module/motion/ScreenTransition.d.ts.map +1 -0
- package/lib/typescript/module/motion/index.d.ts +4 -0
- package/lib/typescript/module/motion/index.d.ts.map +1 -0
- package/lib/typescript/module/motion/motion.d.ts +24 -0
- package/lib/typescript/module/motion/motion.d.ts.map +1 -0
- package/lib/typescript/module/pressable-scale/PressableScale.d.ts +21 -0
- package/lib/typescript/module/pressable-scale/PressableScale.d.ts.map +1 -0
- package/lib/typescript/module/pressable-scale/index.d.ts +3 -0
- package/lib/typescript/module/pressable-scale/index.d.ts.map +1 -0
- package/lib/typescript/module/pressable-with-hover/PressableWithHover.d.ts +18 -0
- package/lib/typescript/module/pressable-with-hover/PressableWithHover.d.ts.map +1 -0
- package/lib/typescript/module/pressable-with-hover/index.d.ts +3 -0
- package/lib/typescript/module/pressable-with-hover/index.d.ts.map +1 -0
- package/lib/typescript/module/styles/breakpoints.d.ts +18 -0
- package/lib/typescript/module/styles/breakpoints.d.ts.map +1 -0
- package/lib/typescript/module/styles/index.d.ts +2 -0
- package/lib/typescript/module/styles/index.d.ts.map +1 -1
- package/lib/typescript/module/subtle-hover/SubtleHover.d.ts +32 -0
- package/lib/typescript/module/subtle-hover/SubtleHover.d.ts.map +1 -0
- package/lib/typescript/module/subtle-hover/index.d.ts +3 -0
- package/lib/typescript/module/subtle-hover/index.d.ts.map +1 -0
- package/lib/typescript/module/theme/build-theme.d.ts.map +1 -1
- package/lib/typescript/module/theme/gradients.d.ts +12 -0
- package/lib/typescript/module/theme/gradients.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +2 -1
- package/lib/typescript/module/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/types.d.ts +11 -0
- package/lib/typescript/module/theme/types.d.ts.map +1 -1
- package/package.json +73 -1
- package/src/__tests__/AnimatedCheck.test.tsx +31 -0
- package/src/__tests__/MediaInsetBorder.test.tsx +36 -0
- package/src/__tests__/Motion.test.tsx +58 -0
- package/src/__tests__/PressableScale.test.tsx +29 -0
- package/src/__tests__/PressableWithHover.test.tsx +48 -0
- package/src/__tests__/SubtleHover.test.tsx +42 -0
- package/src/__tests__/theme-gradients.test.ts +31 -0
- package/src/__tests__/theme.test.ts +3 -0
- package/src/__tests__/useGutters.test.ts +58 -0
- package/src/__tests__/useHaptics.test.tsx +58 -0
- package/src/__tests__/useInteractionState.test.ts +27 -0
- package/src/animated-check/AnimatedCheck.stories.tsx +60 -0
- package/src/animated-check/AnimatedCheck.tsx +173 -0
- package/src/animated-check/index.ts +2 -0
- package/src/avatar/Avatar.stories.tsx +95 -0
- package/src/avatar/Avatar.tsx +61 -110
- package/src/avatar/AvatarRing.tsx +170 -0
- package/src/avatar/index.ts +6 -1
- package/src/avatar/squircle-path.ts +11 -0
- package/src/avatar/svg-module.ts +11 -0
- package/src/avatar/types.ts +32 -0
- package/src/dialog/placement.ts +10 -7
- package/src/fill/index.tsx +2 -2
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useGutters.ts +99 -0
- package/src/hooks/useHaptics.tsx +69 -0
- package/src/hooks/useInteractionState.ts +8 -2
- package/src/index.ts +20 -0
- package/src/index.web.ts +20 -0
- package/src/media-inset-border/MediaInsetBorder.stories.tsx +60 -0
- package/src/media-inset-border/MediaInsetBorder.tsx +72 -0
- package/src/media-inset-border/index.ts +2 -0
- package/src/motion/Motion.stories.tsx +99 -0
- package/src/motion/ScreenTransition.tsx +71 -0
- package/src/motion/index.ts +3 -0
- package/src/motion/motion.ts +75 -0
- package/src/pressable-scale/PressableScale.stories.tsx +71 -0
- package/src/pressable-scale/PressableScale.tsx +103 -0
- package/src/pressable-scale/index.ts +2 -0
- package/src/pressable-with-hover/PressableWithHover.stories.tsx +43 -0
- package/src/pressable-with-hover/PressableWithHover.tsx +43 -0
- package/src/pressable-with-hover/index.ts +2 -0
- package/src/styles/breakpoints.ts +18 -0
- package/src/styles/index.ts +2 -0
- package/src/subtle-hover/SubtleHover.stories.tsx +72 -0
- package/src/subtle-hover/SubtleHover.tsx +90 -0
- package/src/subtle-hover/index.ts +2 -0
- package/src/theme/build-theme.ts +2 -0
- package/src/theme/gradients.ts +61 -0
- package/src/theme/index.ts +2 -1
- package/src/theme/types.ts +13 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AvatarRing = void 0;
|
|
7
|
+
exports.getRingOuterSize = getRingOuterSize;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _zIndex = require("../styles/z-index.js");
|
|
11
|
+
var _svgModule = require("./svg-module.js");
|
|
12
|
+
var _squirclePath = require("./squircle-path.js");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
// Module counter for unique gradient element ids — mirrors the `clipIdCounter`
|
|
16
|
+
// pattern in `Avatar.tsx`. Deterministic (no `Math.random()`) so ids are stable
|
|
17
|
+
// per mounted instance.
|
|
18
|
+
let ringGradientIdCounter = 0;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Size of the box the ring occupies. With `gap === 0` the ring overlays the
|
|
22
|
+
* avatar edge and the box equals the avatar size (footprint unchanged). With
|
|
23
|
+
* `gap > 0` the ring sits OUTSIDE the avatar, so the box grows and the avatar is
|
|
24
|
+
* centered inside it. Exported so `Avatar` reserves the same footprint with a
|
|
25
|
+
* single source for the geometry formula.
|
|
26
|
+
*/
|
|
27
|
+
function getRingOuterSize(size, width, gap) {
|
|
28
|
+
return gap > 0 ? size + 2 * (width + gap) : size;
|
|
29
|
+
}
|
|
30
|
+
function gradientCoords(direction) {
|
|
31
|
+
switch (direction) {
|
|
32
|
+
case 'horizontal':
|
|
33
|
+
return {
|
|
34
|
+
x1: '0',
|
|
35
|
+
y1: '0',
|
|
36
|
+
x2: '1',
|
|
37
|
+
y2: '0'
|
|
38
|
+
};
|
|
39
|
+
case 'vertical':
|
|
40
|
+
return {
|
|
41
|
+
x1: '0',
|
|
42
|
+
y1: '0',
|
|
43
|
+
x2: '0',
|
|
44
|
+
y2: '1'
|
|
45
|
+
};
|
|
46
|
+
case 'diagonal':
|
|
47
|
+
default:
|
|
48
|
+
return {
|
|
49
|
+
x1: '0',
|
|
50
|
+
y1: '0',
|
|
51
|
+
x2: '1',
|
|
52
|
+
y2: '1'
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Single ring primitive shared by the `live` indicator and the public `ring`
|
|
59
|
+
* prop. Renders either a solid or a gradient ring, for both `circle` and
|
|
60
|
+
* `squircle` avatars.
|
|
61
|
+
*
|
|
62
|
+
* - Solid circle → a plain bordered `<View>` (no `react-native-svg` needed).
|
|
63
|
+
* - Solid squircle → an SVG `<Path>` stroking the squircle outline.
|
|
64
|
+
* - Gradient (either shape) → an SVG `<LinearGradient>` stroke; degrades to a
|
|
65
|
+
* solid ring of the first color when `react-native-svg` is unavailable (a
|
|
66
|
+
* squircle then degrades to a circle border, matching the avatar's own no-SVG
|
|
67
|
+
* circle fallback).
|
|
68
|
+
*
|
|
69
|
+
* Internal to the avatar family — not exported from the package.
|
|
70
|
+
*/
|
|
71
|
+
const AvatarRingComponent = ({
|
|
72
|
+
size,
|
|
73
|
+
shape,
|
|
74
|
+
colors,
|
|
75
|
+
width,
|
|
76
|
+
gap,
|
|
77
|
+
gradientDirection
|
|
78
|
+
}) => {
|
|
79
|
+
const gradientId = (0, _react.useMemo)(() => `bloom-ring-grad${ringGradientIdCounter++}`, []);
|
|
80
|
+
const colorList = Array.isArray(colors) ? colors : [colors];
|
|
81
|
+
const wantsGradient = colorList.length >= 2;
|
|
82
|
+
const solidColor = colorList[0] ?? '#000000';
|
|
83
|
+
const outer = getRingOuterSize(size, width, gap);
|
|
84
|
+
// The ring's visible band is always the outermost `width` px inside the outer
|
|
85
|
+
// box; when it degrades to a circle border it is a full circle → radius
|
|
86
|
+
// `outer / 2`.
|
|
87
|
+
const ringRadius = outer / 2;
|
|
88
|
+
|
|
89
|
+
// `react-native-svg` is required for gradients (both shapes) and for the
|
|
90
|
+
// squircle outline. A solid circle ring is a plain border and never needs it.
|
|
91
|
+
const needsSvg = wantsGradient || shape === 'squircle';
|
|
92
|
+
const svg = needsSvg ? (0, _svgModule.getSvgModule)() : null;
|
|
93
|
+
|
|
94
|
+
// No SVG available (or a solid circle, which never needs SVG): draw a plain
|
|
95
|
+
// bordered View. A gradient degrades to its first color; a squircle degrades
|
|
96
|
+
// to a circle border.
|
|
97
|
+
if (!svg) {
|
|
98
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
99
|
+
pointerEvents: "none",
|
|
100
|
+
style: {
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
top: 0,
|
|
103
|
+
left: 0,
|
|
104
|
+
width: outer,
|
|
105
|
+
height: outer,
|
|
106
|
+
borderRadius: ringRadius,
|
|
107
|
+
borderColor: solidColor,
|
|
108
|
+
borderWidth: width,
|
|
109
|
+
zIndex: gap > 0 ? _zIndex.Z_INDEX.base : _zIndex.Z_INDEX.raised
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const {
|
|
114
|
+
default: Svg,
|
|
115
|
+
Defs,
|
|
116
|
+
LinearGradient,
|
|
117
|
+
Stop,
|
|
118
|
+
Circle,
|
|
119
|
+
Path
|
|
120
|
+
} = svg;
|
|
121
|
+
const stroke = wantsGradient ? `url(#${gradientId})` : solidColor;
|
|
122
|
+
const coords = gradientCoords(gradientDirection);
|
|
123
|
+
const gradientDefs = wantsGradient ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Defs, {
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradient, {
|
|
125
|
+
id: gradientId,
|
|
126
|
+
x1: coords.x1,
|
|
127
|
+
y1: coords.y1,
|
|
128
|
+
x2: coords.x2,
|
|
129
|
+
y2: coords.y2,
|
|
130
|
+
children: colorList.map((color, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Stop, {
|
|
131
|
+
offset: colorList.length === 1 ? 0 : index / (colorList.length - 1),
|
|
132
|
+
stopColor: color
|
|
133
|
+
}, `${gradientId}-${index}`))
|
|
134
|
+
})
|
|
135
|
+
}) : null;
|
|
136
|
+
|
|
137
|
+
// The overlay fills its parent; the SVG within is sized to the ring box so a
|
|
138
|
+
// `gap === 0` ring overlays the avatar edge exactly and a `gap > 0` ring sits
|
|
139
|
+
// on the reserved outer perimeter.
|
|
140
|
+
const overlayStyle = [_reactNative.StyleSheet.absoluteFill, {
|
|
141
|
+
zIndex: gap > 0 ? _zIndex.Z_INDEX.base : _zIndex.Z_INDEX.raised
|
|
142
|
+
}];
|
|
143
|
+
if (shape === 'squircle') {
|
|
144
|
+
// The path lives in 0–1 space, so the stroke width is expressed in the same
|
|
145
|
+
// units; center-stroking it and letting the viewport clip the outer half
|
|
146
|
+
// yields a ~`width`-px band on the inner edge of the outer box.
|
|
147
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
148
|
+
pointerEvents: "none",
|
|
149
|
+
style: overlayStyle,
|
|
150
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
151
|
+
width: outer,
|
|
152
|
+
height: outer,
|
|
153
|
+
viewBox: "0 0 1 1",
|
|
154
|
+
children: [gradientDefs, /*#__PURE__*/(0, _jsxRuntime.jsx)(Path, {
|
|
155
|
+
d: _squirclePath.SQUIRCLE_PATH,
|
|
156
|
+
fill: "none",
|
|
157
|
+
stroke: stroke,
|
|
158
|
+
strokeWidth: width / outer * 2
|
|
159
|
+
})]
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
164
|
+
pointerEvents: "none",
|
|
165
|
+
style: overlayStyle,
|
|
166
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
167
|
+
width: outer,
|
|
168
|
+
height: outer,
|
|
169
|
+
viewBox: `0 0 ${outer} ${outer}`,
|
|
170
|
+
children: [gradientDefs, /*#__PURE__*/(0, _jsxRuntime.jsx)(Circle, {
|
|
171
|
+
cx: outer / 2,
|
|
172
|
+
cy: outer / 2,
|
|
173
|
+
r: (outer - width) / 2,
|
|
174
|
+
fill: "none",
|
|
175
|
+
stroke: stroke,
|
|
176
|
+
strokeWidth: width
|
|
177
|
+
})]
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const AvatarRing = exports.AvatarRing = /*#__PURE__*/(0, _react.memo)(AvatarRingComponent);
|
|
182
|
+
AvatarRing.displayName = 'AvatarRing';
|
|
183
|
+
//# sourceMappingURL=AvatarRing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_zIndex","_svgModule","_squirclePath","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ringGradientIdCounter","getRingOuterSize","size","width","gap","gradientCoords","direction","x1","y1","x2","y2","AvatarRingComponent","shape","colors","gradientDirection","gradientId","useMemo","colorList","Array","isArray","wantsGradient","length","solidColor","outer","ringRadius","needsSvg","svg","getSvgModule","jsx","View","pointerEvents","style","position","top","left","height","borderRadius","borderColor","borderWidth","zIndex","Z_INDEX","base","raised","Svg","Defs","LinearGradient","Stop","Circle","Path","stroke","coords","gradientDefs","children","id","map","color","index","offset","stopColor","overlayStyle","StyleSheet","absoluteFill","jsxs","viewBox","d","SQUIRCLE_PATH","fill","strokeWidth","cx","cy","AvatarRing","exports","memo","displayName"],"sourceRoot":"../../../src","sources":["avatar/AvatarRing.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAA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,GAAG,CAAE;QACd8C,EAAE,EAAE9C,KAAK,GAAG,CAAE;QACdvC,CAAC,EAAE,CAACuC,KAAK,GAAGpB,KAAK,IAAI,CAAE;QACvB+D,IAAI,EAAC,MAAM;QACXjB,MAAM,EAAEA,MAAO;QACfkB,WAAW,EAAEhE;MAAM,CACpB,CAAC;IAAA,CACC;EAAC,CACF,CAAC;AAEX,CAAC;AAEM,MAAMmE,UAAU,GAAAC,OAAA,CAAAD,UAAA,gBAAG,IAAAE,WAAI,EAAC7D,mBAAmB,CAAC;AACnD2D,UAAU,CAACG,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Avatar","require","_placeholderContext","_defaultAvatar","_interopRequireDefault","e","__esModule","default","defaultAvatarSource","exports","defaultAvatar"],"sourceRoot":"../../../src","sources":["avatar/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_Avatar","require","_placeholderContext","_defaultAvatar","_interopRequireDefault","e","__esModule","default","defaultAvatarSource","exports","defaultAvatar"],"sourceRoot":"../../../src","sources":["avatar/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAWA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6C,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAF7C;AACA;;AAGA;AACO,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,sBAAa","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SQUIRCLE_PATH = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Squircle clip/outline path normalized to a 0–1 coordinate space
|
|
9
|
+
* (viewBox="0 0 1 1"). Shared by the squircle avatar image clip in `Avatar.tsx`
|
|
10
|
+
* and the squircle outline in `AvatarRing.tsx` so the geometry has a single
|
|
11
|
+
* source of truth.
|
|
12
|
+
*/
|
|
13
|
+
const SQUIRCLE_PATH = exports.SQUIRCLE_PATH = 'M0 0.5 L0.00122 0.31674 L0.00489 0.25123 L0.01103 0.20331 L0.01969 0.16478 L0.03097 0.13257 L0.04495 0.10518 L0.0618 0.08177 L0.08177 0.0618 L0.10518 0.04495 L0.13257 0.03097 L0.16478 0.01969 L0.20331 0.01103 L0.25123 0.00489 L0.31674 0.00122 L0.5 0' + ' L0.68895 0.0014 L0.7564 0.00561 L0.80559 0.01267 L0.84499 0.02264 L0.87771 0.03564 L0.9053 0.05181 L0.92862 0.07138 L0.94819 0.0947 L0.96436 0.12228 L0.97736 0.15501 L0.98733 0.19441 L0.99439 0.2436 L0.9986 0.31105 L1 0.5' + ' L0.9986 0.68895 L0.99439 0.7564 L0.98733 0.80559 L0.97736 0.84499 L0.96436 0.87771 L0.94819 0.9053 L0.92862 0.92862 L0.9053 0.94819 L0.87771 0.96436 L0.84499 0.97736 L0.80559 0.98733 L0.7564 0.99439 L0.68895 0.9986 L0.5 1' + ' L0.31105 0.9986 L0.2436 0.99439 L0.19441 0.98733 L0.15501 0.97736 L0.12228 0.96436 L0.0947 0.94819 L0.07138 0.92862 L0.05181 0.9053 L0.03564 0.87771 L0.02264 0.84499 L0.01267 0.80559 L0.00561 0.7564 L0.0014 0.68895 L0 0.5Z';
|
|
14
|
+
//# sourceMappingURL=squircle-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SQUIRCLE_PATH","exports"],"sourceRoot":"../../../src","sources":["avatar/squircle-path.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GACxB,2PAA2P,GAC3P,gOAAgO,GAChO,gOAAgO,GAChO,iOAAiO","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSvgModule = void 0;
|
|
7
|
+
var _lazyRequire = require("../utils/lazy-require.js");
|
|
8
|
+
/**
|
|
9
|
+
* Lazily loads `react-native-svg`, returning `null` when it is not installed
|
|
10
|
+
* (e.g. a web bundle that does not ship the optional peer). Shared by the
|
|
11
|
+
* squircle avatar image clip in `Avatar.tsx` and the `AvatarRing` so there is a
|
|
12
|
+
* single loader rather than one per call site.
|
|
13
|
+
*/
|
|
14
|
+
const getSvgModule = exports.getSvgModule = (0, _lazyRequire.lazyRequire)('react-native-svg');
|
|
15
|
+
//# sourceMappingURL=svg-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lazyRequire","require","getSvgModule","exports","lazyRequire"],"sourceRoot":"../../../src","sources":["avatar/svg-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,wBAAW,EAAgB,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ exports.SIDE_SHEET_MIN_GUTTER = exports.SHEET_BACKDROP_OPACITY = exports.PANEL_R
|
|
|
7
7
|
exports.useResolvedPlacement = useResolvedPlacement;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
|
+
var _breakpoints = require("../styles/breakpoints.js");
|
|
10
11
|
/**
|
|
11
12
|
* Anchor a `<Dialog>` can render against.
|
|
12
13
|
*
|
|
@@ -27,14 +28,15 @@ var _reactNative = require("react-native");
|
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
|
-
* Tailwind-default breakpoints (px)
|
|
31
|
-
*
|
|
32
|
-
* width
|
|
31
|
+
* Tailwind-default breakpoints (px), re-exported from the canonical
|
|
32
|
+
* {@link BREAKPOINTS} source. A responsive `placement` map resolves to the value
|
|
33
|
+
* for the largest key whose min-width is `<=` the current viewport width,
|
|
34
|
+
* falling back to `base`.
|
|
33
35
|
*/
|
|
34
|
-
const BREAKPOINT_SM = exports.BREAKPOINT_SM =
|
|
35
|
-
const BREAKPOINT_MD = exports.BREAKPOINT_MD =
|
|
36
|
-
const BREAKPOINT_LG = exports.BREAKPOINT_LG =
|
|
37
|
-
const BREAKPOINT_XL = exports.BREAKPOINT_XL =
|
|
36
|
+
const BREAKPOINT_SM = exports.BREAKPOINT_SM = _breakpoints.BREAKPOINTS.sm;
|
|
37
|
+
const BREAKPOINT_MD = exports.BREAKPOINT_MD = _breakpoints.BREAKPOINTS.md;
|
|
38
|
+
const BREAKPOINT_LG = exports.BREAKPOINT_LG = _breakpoints.BREAKPOINTS.lg;
|
|
39
|
+
const BREAKPOINT_XL = exports.BREAKPOINT_XL = _breakpoints.BREAKPOINTS.xl;
|
|
38
40
|
|
|
39
41
|
/** Ordered breakpoint table, widest first, so the first match wins. */
|
|
40
42
|
const RESPONSIVE_KEYS = [['xl', BREAKPOINT_XL], ['lg', BREAKPOINT_LG], ['md', BREAKPOINT_MD], ['sm', BREAKPOINT_SM]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","BREAKPOINT_SM","exports","BREAKPOINT_MD","BREAKPOINT_LG","BREAKPOINT_XL","RESPONSIVE_KEYS","DEFAULT_SIDE_WIDTH","DEFAULT_CENTER_MAX_WIDTH","DEFAULT_MAX_HEIGHT_RATIO","PANEL_RADIUS","DEFAULT_DIALOG_CONTENT_PADDING","ANIMATION_DURATION","CENTER_FADE_OUT_DURATION","EASE_OUT","SHEET_BACKDROP_OPACITY","DIALOG_SHEET_BACKDROP_TESTID","HANDLE_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","SIDE_SHEET_MIN_GUTTER","useResolvedPlacement","placement","width","useWindowDimensions","useMemo","undefined","key","minWidth","value","base"],"sourceRoot":"../../../src","sources":["dialog/placement.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACO,
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_breakpoints","BREAKPOINT_SM","exports","BREAKPOINTS","sm","BREAKPOINT_MD","md","BREAKPOINT_LG","lg","BREAKPOINT_XL","xl","RESPONSIVE_KEYS","DEFAULT_SIDE_WIDTH","DEFAULT_CENTER_MAX_WIDTH","DEFAULT_MAX_HEIGHT_RATIO","PANEL_RADIUS","DEFAULT_DIALOG_CONTENT_PADDING","ANIMATION_DURATION","CENTER_FADE_OUT_DURATION","EASE_OUT","SHEET_BACKDROP_OPACITY","DIALOG_SHEET_BACKDROP_TESTID","HANDLE_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","SIDE_SHEET_MIN_GUTTER","useResolvedPlacement","placement","width","useWindowDimensions","useMemo","undefined","key","minWidth","value","base"],"sourceRoot":"../../../src","sources":["dialog/placement.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,wBAAW,CAAC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ArB,OAAA,CAAAqB,aAAA,GAAG,CAAC;AACvB,MAAMC,aAAa,GAAAtB,OAAA,CAAAsB,aAAA,GAAG,CAAC;;AAE9B;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAAvB,OAAA,CAAAuB,qBAAA,GAAG,EAAE;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAClCC,SAAgD,EAC/B;EACjB,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EAEvC,OAAO,IAAAC,cAAO,EAAkB,MAAM;IACpC,IAAIH,SAAS,KAAKI,SAAS,EAAE,OAAO,QAAQ;IAC5C,IAAI,OAAOJ,SAAS,KAAK,QAAQ,EAAE,OAAOA,SAAS;IACnD,KAAK,MAAM,CAACK,GAAG,EAAEC,QAAQ,CAAC,IAAItB,eAAe,EAAE;MAC7C,IAAIiB,KAAK,IAAIK,QAAQ,EAAE;QACrB,MAAMC,KAAK,GAAGP,SAAS,CAACK,GAAG,CAAC;QAC5B,IAAIE,KAAK,KAAKH,SAAS,EAAE,OAAOG,KAAK;MACvC;IACF;IACA,OAAOP,SAAS,CAACQ,IAAI;EACvB,CAAC,EAAE,CAACR,SAAS,EAAEC,KAAK,CAAC,CAAC;AACxB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FillComponent","Fill","children","style","jsx","View","fillStyles","base","exports","memo","displayName","StyleSheet","create","position","top","right","bottom","left"],"sourceRoot":"../../../src","sources":["fill/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FillComponent","Fill","children","style","jsx","View","fillStyles","base","exports","memo","displayName","StyleSheet","create","position","top","right","bottom","left"],"sourceRoot":"../../../src","sources":["fill/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAgF,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAEhF,MAAMkB,aAAa,GAAG,SAASC,IAAIA,CAAC;EAClCC,QAAQ;EACRC;AAIF,CAAC,EAAE;EACD,oBACE,IAAAvB,WAAA,CAAAwB,GAAA,EAACzB,YAAA,CAAA0B,IAAI;IAACF,KAAK,EAAE,CAACG,UAAU,CAACC,IAAI,EAAEJ,KAAK,CAAE;IAAAD,QAAA,EACnCA;EAAQ,CACL,CAAC;AAEX,CAAC;AAEM,MAAMD,IAAI,GAAAO,OAAA,CAAAP,IAAA,gBAAG,IAAAQ,WAAI,EAACT,aAAa,CAAC;AACvCC,IAAI,CAACS,WAAW,GAAG,MAAM;AAEzB,MAAMJ,UAAU,GAAGK,uBAAU,CAACC,MAAM,CAAC;EACnCL,IAAI,EAAE;IACJM,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "BloomHapticsProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useHaptics.BloomHapticsProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "mergeRefs", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -15,6 +21,18 @@ Object.defineProperty(exports, "useDelayedLoading", {
|
|
|
15
21
|
return _useDelayedLoading.useDelayedLoading;
|
|
16
22
|
}
|
|
17
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "useGutters", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _useGutters.useGutters;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "useHaptics", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _useHaptics.useHaptics;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
18
36
|
Object.defineProperty(exports, "useInteractionState", {
|
|
19
37
|
enumerable: true,
|
|
20
38
|
get: function () {
|
|
@@ -44,4 +62,6 @@ var _useDelayedLoading = require("./useDelayedLoading.js");
|
|
|
44
62
|
var _useThrottledValue = require("./useThrottledValue.js");
|
|
45
63
|
var _usePressAnimation = require("./usePressAnimation.js");
|
|
46
64
|
var _mergeRefs = require("./mergeRefs.js");
|
|
65
|
+
var _useHaptics = require("./useHaptics.js");
|
|
66
|
+
var _useGutters = require("./useGutters.js");
|
|
47
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useInteractionState","require","_useDelayedLoading","_useThrottledValue","_usePressAnimation","_mergeRefs"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_useInteractionState","require","_useDelayedLoading","_useThrottledValue","_usePressAnimation","_mergeRefs","_useHaptics","_useGutters"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useGutters = useGutters;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _breakpoints = require("../styles/breakpoints.js");
|
|
10
|
+
var _tokens = require("../styles/tokens.js");
|
|
11
|
+
/**
|
|
12
|
+
* A named gutter size, or `0` for no padding on that edge.
|
|
13
|
+
*
|
|
14
|
+
* - `'compact'` — tight gutter (dense lists, chips).
|
|
15
|
+
* - `'base'` — the default page gutter.
|
|
16
|
+
* - `'wide'` — roomy gutter (marketing / hero surfaces).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Resolved edge padding in px — one value per side, ready to spread onto a style. */
|
|
20
|
+
|
|
21
|
+
/** The active viewport tier: the widest matched breakpoint, or `'base'` below `sm`. */
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Per-size gutter padding (px) at each viewport tier. Padding steps up around
|
|
25
|
+
* tablet width (`md`), mirroring the design-system scale: phones get a tighter
|
|
26
|
+
* gutter, wider screens a roomier one. Values come from the shared `space`
|
|
27
|
+
* tokens so gutters stay on the spacing grid.
|
|
28
|
+
*/
|
|
29
|
+
const GUTTER_SCALE = {
|
|
30
|
+
compact: {
|
|
31
|
+
base: _tokens.space.sm,
|
|
32
|
+
sm: _tokens.space.sm,
|
|
33
|
+
md: _tokens.space.md,
|
|
34
|
+
lg: _tokens.space.md,
|
|
35
|
+
xl: _tokens.space.md
|
|
36
|
+
},
|
|
37
|
+
base: {
|
|
38
|
+
base: _tokens.space.lg,
|
|
39
|
+
sm: _tokens.space.lg,
|
|
40
|
+
md: _tokens.space.xl,
|
|
41
|
+
lg: _tokens.space.xl,
|
|
42
|
+
xl: _tokens.space.xl
|
|
43
|
+
},
|
|
44
|
+
wide: {
|
|
45
|
+
base: _tokens.space.xl,
|
|
46
|
+
sm: _tokens.space.xl,
|
|
47
|
+
md: _tokens.space._3xl,
|
|
48
|
+
lg: _tokens.space._3xl,
|
|
49
|
+
xl: _tokens.space._3xl
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** Widest-first breakpoint table so the first match wins. */
|
|
54
|
+
const TIERS = [['xl', _breakpoints.BREAKPOINTS.xl], ['lg', _breakpoints.BREAKPOINTS.lg], ['md', _breakpoints.BREAKPOINTS.md], ['sm', _breakpoints.BREAKPOINTS.sm]];
|
|
55
|
+
function resolveTier(width) {
|
|
56
|
+
for (const [tier, minWidth] of TIERS) {
|
|
57
|
+
if (width >= minWidth) return tier;
|
|
58
|
+
}
|
|
59
|
+
return 'base';
|
|
60
|
+
}
|
|
61
|
+
function resolveEdge(size, tier) {
|
|
62
|
+
return size === 0 ? 0 : GUTTER_SCALE[size][tier];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Expand a 1/2/4-arg CSS-shorthand gutter list into `[top, right, bottom, left]`.
|
|
67
|
+
* `??` (not `||`) so an explicit `0` is preserved rather than falling through.
|
|
68
|
+
*/
|
|
69
|
+
function normalizeShorthand(gutters) {
|
|
70
|
+
const top = gutters[0] ?? 0;
|
|
71
|
+
const right = gutters[1] ?? top;
|
|
72
|
+
const bottom = gutters[2] ?? top;
|
|
73
|
+
const left = gutters[3] ?? right;
|
|
74
|
+
return [top, right, bottom, left];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Breakpoint-aware gutter padding. Give it CSS-shorthand gutter sizes and it
|
|
79
|
+
* returns resolved `padding*` values for the current viewport width, recomputed
|
|
80
|
+
* as the window crosses a breakpoint.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* const gutters = useGutters(['base']); // uniform
|
|
85
|
+
* const gutters = useGutters([0, 'wide']); // no vertical, wide horizontal
|
|
86
|
+
* const gutters = useGutters(['compact', 'base', 0, 'base']); // t / r / b / l
|
|
87
|
+
* <View style={gutters} />
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
function useGutters(gutters) {
|
|
92
|
+
const {
|
|
93
|
+
width
|
|
94
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
95
|
+
const [top, right, bottom, left] = normalizeShorthand(gutters);
|
|
96
|
+
return (0, _react.useMemo)(() => {
|
|
97
|
+
const tier = resolveTier(width);
|
|
98
|
+
return {
|
|
99
|
+
paddingTop: resolveEdge(top, tier),
|
|
100
|
+
paddingRight: resolveEdge(right, tier),
|
|
101
|
+
paddingBottom: resolveEdge(bottom, tier),
|
|
102
|
+
paddingLeft: resolveEdge(left, tier)
|
|
103
|
+
};
|
|
104
|
+
}, [width, top, right, bottom, left]);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=useGutters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_breakpoints","_tokens","GUTTER_SCALE","compact","base","space","sm","md","lg","xl","wide","_3xl","TIERS","BREAKPOINTS","resolveTier","width","tier","minWidth","resolveEdge","size","normalizeShorthand","gutters","top","right","bottom","left","useGutters","useWindowDimensions","useMemo","paddingTop","paddingRight","paddingBottom","paddingLeft"],"sourceRoot":"../../../src","sources":["hooks/useGutters.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAQA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,YAAoE,GAAG;EAC3EC,OAAO,EAAE;IAAEC,IAAI,EAAEC,aAAK,CAACC,EAAE;IAAEA,EAAE,EAAED,aAAK,CAACC,EAAE;IAAEC,EAAE,EAAEF,aAAK,CAACE,EAAE;IAAEC,EAAE,EAAEH,aAAK,CAACE,EAAE;IAAEE,EAAE,EAAEJ,aAAK,CAACE;EAAG,CAAC;EACnFH,IAAI,EAAE;IAAEA,IAAI,EAAEC,aAAK,CA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ChC,MAAMG,IAAI,GAAGJ,OAAO,CAAC,CAAC,CAAC,IAAIE,KAAK;EAChC,OAAO,CAACD,GAAG,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,SAASC,UAAUA,CAACL,OAAiB,EAAW;EACrD,MAAM;IAAEN;EAAM,CAAC,GAAG,IAAAY,gCAAmB,EAAC,CAAC;EACvC,MAAM,CAACL,GAAG,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,CAAC,GAAGL,kBAAkB,CAACC,OAAO,CAAC;EAE9D,OAAO,IAAAO,cAAO,EAAU,MAAM;IAC5B,MAAMZ,IAAI,GAAGF,WAAW,CAACC,KAAK,CAAC;IAC/B,OAAO;MACLc,UAAU,EAAEX,WAAW,CAACI,GAAG,EAAEN,IAAI,CAAC;MAClCc,YAAY,EAAEZ,WAAW,CAACK,KAAK,EAAEP,IAAI,CAAC;MACtCe,aAAa,EAAEb,WAAW,CAACM,MAAM,EAAER,IAAI,CAAC;MACxCgB,WAAW,EAAEd,WAAW,CAACO,IAAI,EAAET,IAAI;IACrC,CAAC;EACH,CAAC,EAAE,CAACD,KAAK,EAAEO,GAAG,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,CAAC,CAAC;AACvC","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BloomHapticsProvider = BloomHapticsProvider;
|
|
7
|
+
exports.useHaptics = useHaptics;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _lazyRequire = require("../utils/lazy-require.js");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
14
|
+
* Lazily loads `expo-haptics`, returning `null` when it is not installed. The
|
|
15
|
+
* dependency is an optional peer, so calls degrade to a no-op when absent.
|
|
16
|
+
*/const getHapticsModule = (0, _lazyRequire.lazyRequire)('expo-haptics');
|
|
17
|
+
|
|
18
|
+
/** Impact strength requested by a caller. */
|
|
19
|
+
|
|
20
|
+
const BloomHapticsContext = /*#__PURE__*/(0, _react.createContext)({
|
|
21
|
+
enabled: true
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Optional provider that toggles haptic feedback for its subtree — e.g. to honour
|
|
25
|
+
* a user "reduce haptics" preference. `useHaptics` defaults to enabled when no
|
|
26
|
+
* provider is present.
|
|
27
|
+
*/
|
|
28
|
+
function BloomHapticsProvider({
|
|
29
|
+
enabled = true,
|
|
30
|
+
children
|
|
31
|
+
}) {
|
|
32
|
+
const value = (0, _react.useMemo)(() => ({
|
|
33
|
+
enabled
|
|
34
|
+
}), [enabled]);
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BloomHapticsContext.Provider, {
|
|
36
|
+
value: value,
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
BloomHapticsProvider.displayName = 'BloomHapticsProvider';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns a function that fires a haptic impact. The returned callback no-ops on
|
|
44
|
+
* web, when haptics are disabled via {@link BloomHapticsProvider}, or when the
|
|
45
|
+
* optional `expo-haptics` peer is not installed.
|
|
46
|
+
*
|
|
47
|
+
* `strength` defaults to `'light'`. Android is clamped to the light impact style
|
|
48
|
+
* regardless of `strength` — its medium/heavy motors read as too strong for UI
|
|
49
|
+
* feedback (tuned to match iOS perceived intensity).
|
|
50
|
+
*/
|
|
51
|
+
function useHaptics() {
|
|
52
|
+
const {
|
|
53
|
+
enabled
|
|
54
|
+
} = (0, _react.useContext)(BloomHapticsContext);
|
|
55
|
+
return (0, _react.useCallback)((strength = 'light') => {
|
|
56
|
+
if (!enabled || _reactNative.Platform.OS === 'web') return;
|
|
57
|
+
const haptics = getHapticsModule();
|
|
58
|
+
if (!haptics) return;
|
|
59
|
+
const {
|
|
60
|
+
ImpactFeedbackStyle
|
|
61
|
+
} = haptics;
|
|
62
|
+
let style = ImpactFeedbackStyle.Light;
|
|
63
|
+
if (_reactNative.Platform.OS !== 'android') {
|
|
64
|
+
if (strength === 'medium') style = ImpactFeedbackStyle.Medium;else if (strength === 'heavy') style = ImpactFeedbackStyle.Heavy;
|
|
65
|
+
}
|
|
66
|
+
void haptics.impactAsync(style);
|
|
67
|
+
}, [enabled]);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=useHaptics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_lazyRequire","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getHapticsModule","lazyRequire","BloomHapticsContext","createContext","enabled","BloomHapticsProvider","children","value","useMemo","jsx","Provider","displayName","useHaptics","useContext","useCallback","strength","Platform","OS","haptics","ImpactFeedbackStyle","style","Light","Medium","Heavy","impactAsync"],"sourceRoot":"../../../src","sources":["hooks/useHaptics.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,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ractionState = useInteractionState;
|
|
7
7
|
exports.useInteractionStates = useInteractionStates;
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
/**
|
|
10
|
+
* Tracks a single boolean interaction flag (hovered / focused / pressed).
|
|
11
|
+
*
|
|
12
|
+
* Returns a memoized `{ state, onIn, onOut }` with stable handler identities,
|
|
13
|
+
* suitable for spreading onto Pressable-like components.
|
|
14
|
+
*/
|
|
9
15
|
function useInteractionState() {
|
|
10
16
|
const [state, setState] = (0, _react.useState)(false);
|
|
11
17
|
const onIn = (0, _react.useCallback)(() => {
|
|
@@ -14,11 +20,11 @@ function useInteractionState() {
|
|
|
14
20
|
const onOut = (0, _react.useCallback)(() => {
|
|
15
21
|
setState(false);
|
|
16
22
|
}, []);
|
|
17
|
-
return {
|
|
23
|
+
return (0, _react.useMemo)(() => ({
|
|
18
24
|
state,
|
|
19
25
|
onIn,
|
|
20
26
|
onOut
|
|
21
|
-
};
|
|
27
|
+
}), [state, onIn, onOut]);
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useInteractionState","state","setState","useState","onIn","useCallback","onOut","useInteractionStates","hovered","onHoverIn","onHoverOut","focused","onFocus","onBlur","pressed","onPressIn","onPressOut","hoverHandlers","focusHandlers","pressHandlers"],"sourceRoot":"../../../src","sources":["hooks/useInteractionState.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","useInteractionState","state","setState","useState","onIn","useCallback","onOut","useMemo","useInteractionStates","hovered","onHoverIn","onHoverOut","focused","onFocus","onBlur","pressed","onPressIn","onPressOut","hoverHandlers","focusHandlers","pressHandlers"],"sourceRoot":"../../../src","sources":["hooks/useInteractionState.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACpC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