@knitui/components 1.0.0 → 1.2.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/ActionIcon/ActionIcon.js +1 -1
- package/lib/commonjs/ActionIcon/ActionIcon.js.map +1 -1
- package/lib/commonjs/Affix/Affix.js +1 -1
- package/lib/commonjs/Affix/Affix.js.map +1 -1
- package/lib/commonjs/Alert/Alert.js +1 -1
- package/lib/commonjs/Alert/Alert.js.map +1 -1
- package/lib/commonjs/Avatar/Avatar.js +1 -1
- package/lib/commonjs/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/Badge/Badge.js +1 -1
- package/lib/commonjs/Badge/Badge.js.map +1 -1
- package/lib/commonjs/Button/Button.js +1 -1
- package/lib/commonjs/Button/Button.js.map +1 -1
- package/lib/commonjs/CloseButton/CloseButton.js +1 -1
- package/lib/commonjs/CloseButton/CloseButton.js.map +1 -1
- package/lib/commonjs/Image/Image.js +108 -27
- package/lib/commonjs/Image/Image.js.map +1 -1
- package/lib/commonjs/Image/createImage.js +26 -0
- package/lib/commonjs/Image/createImage.js.map +1 -1
- package/lib/commonjs/Image/shared.js +8 -1
- package/lib/commonjs/Image/shared.js.map +1 -1
- package/lib/commonjs/Input/Input.native.js +15 -6
- package/lib/commonjs/Input/Input.native.js.map +1 -1
- package/lib/commonjs/KeyboardAwareScrollView/KeyboardAwareScrollView.native.js.map +1 -1
- package/lib/commonjs/Modal/drag/DragDismissHost.js +4 -1
- package/lib/commonjs/Modal/drag/DragDismissHost.js.map +1 -1
- package/lib/commonjs/Modal/drag/DragDismissOverlay.js +4 -1
- package/lib/commonjs/Modal/drag/DragDismissOverlay.js.map +1 -1
- package/lib/commonjs/Modal/drag/useDragDismiss.js +83 -67
- package/lib/commonjs/Modal/drag/useDragDismiss.js.map +1 -1
- package/lib/commonjs/Modal/modal-base.js +2 -2
- package/lib/commonjs/Modal/modal-base.js.map +1 -1
- package/lib/commonjs/Pill/Pill.js +1 -1
- package/lib/commonjs/Pill/Pill.js.map +1 -1
- package/lib/commonjs/Popover/Popover.shared.js +1 -1
- package/lib/commonjs/Popover/Popover.shared.js.map +1 -1
- package/lib/commonjs/Portal/OverlayHost.js.map +1 -1
- package/lib/commonjs/Portal/OverlayPortal.js +33 -0
- package/lib/commonjs/Portal/OverlayPortal.js.map +1 -0
- package/lib/commonjs/Portal/index.js +7 -0
- package/lib/commonjs/Portal/index.js.map +1 -1
- package/lib/commonjs/ScrollArea/ScrollArea.native.js +25 -15
- package/lib/commonjs/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/commonjs/ThemeIcon/ThemeIcon.js +1 -1
- package/lib/commonjs/ThemeIcon/ThemeIcon.js.map +1 -1
- package/lib/commonjs/Tooltip/Tooltip.js +1 -1
- package/lib/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/gradient-shared.js +11 -1
- package/lib/commonjs/internal/gradient-shared.js.map +1 -1
- package/lib/commonjs/internal/gradient.js +6 -0
- package/lib/commonjs/internal/gradient.js.map +1 -1
- package/lib/commonjs/internal/gradient.native.js +6 -0
- package/lib/commonjs/internal/gradient.native.js.map +1 -1
- package/lib/commonjs/internal/use-looping-animation.native.js +1 -1
- package/lib/commonjs/internal/use-looping-animation.native.js.map +1 -1
- package/lib/module/ActionIcon/ActionIcon.js +2 -2
- package/lib/module/ActionIcon/ActionIcon.js.map +1 -1
- package/lib/module/Affix/Affix.js +2 -2
- package/lib/module/Affix/Affix.js.map +1 -1
- package/lib/module/Alert/Alert.js +2 -2
- package/lib/module/Alert/Alert.js.map +1 -1
- package/lib/module/Avatar/Avatar.js +2 -2
- package/lib/module/Avatar/Avatar.js.map +1 -1
- package/lib/module/Badge/Badge.js +2 -2
- package/lib/module/Badge/Badge.js.map +1 -1
- package/lib/module/Button/Button.js +2 -2
- package/lib/module/Button/Button.js.map +1 -1
- package/lib/module/CloseButton/CloseButton.js +2 -2
- package/lib/module/CloseButton/CloseButton.js.map +1 -1
- package/lib/module/Image/Image.js +108 -27
- package/lib/module/Image/Image.js.map +1 -1
- package/lib/module/Image/createImage.js +26 -1
- package/lib/module/Image/createImage.js.map +1 -1
- package/lib/module/Image/shared.js +7 -0
- package/lib/module/Image/shared.js.map +1 -1
- package/lib/module/Input/Input.native.js +15 -6
- package/lib/module/Input/Input.native.js.map +1 -1
- package/lib/module/KeyboardAwareScrollView/KeyboardAwareScrollView.native.js.map +1 -1
- package/lib/module/Modal/drag/DragDismissHost.js +4 -1
- package/lib/module/Modal/drag/DragDismissHost.js.map +1 -1
- package/lib/module/Modal/drag/DragDismissOverlay.js +4 -1
- package/lib/module/Modal/drag/DragDismissOverlay.js.map +1 -1
- package/lib/module/Modal/drag/useDragDismiss.js +84 -68
- package/lib/module/Modal/drag/useDragDismiss.js.map +1 -1
- package/lib/module/Modal/modal-base.js +3 -3
- package/lib/module/Modal/modal-base.js.map +1 -1
- package/lib/module/Pill/Pill.js +2 -2
- package/lib/module/Pill/Pill.js.map +1 -1
- package/lib/module/Popover/Popover.shared.js +2 -2
- package/lib/module/Popover/Popover.shared.js.map +1 -1
- package/lib/module/Portal/OverlayHost.js.map +1 -1
- package/lib/module/Portal/OverlayPortal.js +28 -0
- package/lib/module/Portal/OverlayPortal.js.map +1 -0
- package/lib/module/Portal/index.js +4 -0
- package/lib/module/Portal/index.js.map +1 -1
- package/lib/module/ScrollArea/ScrollArea.native.js +26 -16
- package/lib/module/ScrollArea/ScrollArea.native.js.map +1 -1
- package/lib/module/ThemeIcon/ThemeIcon.js +2 -2
- package/lib/module/ThemeIcon/ThemeIcon.js.map +1 -1
- package/lib/module/Tooltip/Tooltip.js +2 -2
- package/lib/module/Tooltip/Tooltip.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/gradient-shared.js +9 -0
- package/lib/module/internal/gradient-shared.js.map +1 -1
- package/lib/module/internal/gradient.js +2 -0
- package/lib/module/internal/gradient.js.map +1 -1
- package/lib/module/internal/gradient.native.js +2 -0
- package/lib/module/internal/gradient.native.js.map +1 -1
- package/lib/module/internal/use-looping-animation.native.js +1 -1
- package/lib/module/internal/use-looping-animation.native.js.map +1 -1
- package/lib/typescript/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/lib/typescript/Alert/Alert.d.ts.map +1 -1
- package/lib/typescript/Avatar/Avatar.d.ts +14 -14
- package/lib/typescript/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/Badge/Badge.d.ts.map +1 -1
- package/lib/typescript/Button/Button.d.ts.map +1 -1
- package/lib/typescript/CloseButton/CloseButton.d.ts.map +1 -1
- package/lib/typescript/Image/Image.d.ts +14 -14
- package/lib/typescript/Image/Image.d.ts.map +1 -1
- package/lib/typescript/Image/Image.native.d.ts +14 -14
- package/lib/typescript/Image/createImage.d.ts +25 -18
- package/lib/typescript/Image/createImage.d.ts.map +1 -1
- package/lib/typescript/Image/index.d.ts +1 -1
- package/lib/typescript/Image/index.d.ts.map +1 -1
- package/lib/typescript/Image/shared.d.ts +6 -0
- package/lib/typescript/Image/shared.d.ts.map +1 -1
- package/lib/typescript/Image/types.d.ts +54 -0
- package/lib/typescript/Image/types.d.ts.map +1 -1
- package/lib/typescript/Input/Input.native.d.ts +21 -21
- package/lib/typescript/Input/Input.native.d.ts.map +1 -1
- package/lib/typescript/KeyboardAvoidingView/KeyboardAvoidingView.native.d.ts +2 -2
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.native.d.ts +12 -18
- package/lib/typescript/KeyboardAwareScrollView/KeyboardAwareScrollView.native.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/DragDismissHost.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/DragDismissOverlay.d.ts.map +1 -1
- package/lib/typescript/Modal/drag/useDragDismiss.d.ts +2 -2
- package/lib/typescript/Modal/drag/useDragDismiss.d.ts.map +1 -1
- package/lib/typescript/Modal/modal-base-inner.native.d.ts +2 -2
- package/lib/typescript/Modal/modal-base-inner.native.d.ts.map +1 -1
- package/lib/typescript/Pill/Pill.d.ts.map +1 -1
- package/lib/typescript/Portal/OverlayHost.d.ts +2 -2
- package/lib/typescript/Portal/OverlayHost.d.ts.map +1 -1
- package/lib/typescript/Portal/OverlayPortal.d.ts +19 -0
- package/lib/typescript/Portal/OverlayPortal.d.ts.map +1 -0
- package/lib/typescript/Portal/index.d.ts +4 -0
- package/lib/typescript/Portal/index.d.ts.map +1 -1
- package/lib/typescript/ScrollArea/ScrollArea.native.d.ts.map +1 -1
- package/lib/typescript/ThemeIcon/ThemeIcon.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/internal/gradient-shared.d.ts +1 -0
- package/lib/typescript/internal/gradient-shared.d.ts.map +1 -1
- package/lib/typescript/internal/gradient.d.ts +1 -0
- package/lib/typescript/internal/gradient.d.ts.map +1 -1
- package/lib/typescript/internal/gradient.native.d.ts +1 -0
- package/lib/typescript/internal/gradient.native.d.ts.map +1 -1
- package/lib/typescript/internal/use-looping-animation.native.d.ts +2 -2
- package/lib/typescript/internal/use-looping-animation.native.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/ActionIcon/ActionIcon.tsx +2 -2
- package/src/Affix/Affix.tsx +2 -2
- package/src/Alert/Alert.tsx +2 -2
- package/src/Avatar/Avatar.tsx +2 -2
- package/src/Badge/Badge.tsx +2 -2
- package/src/Button/Button.tsx +2 -2
- package/src/CloseButton/CloseButton.tsx +2 -2
- package/src/Image/Image.tsx +109 -23
- package/src/Image/createImage.tsx +26 -0
- package/src/Image/index.ts +1 -1
- package/src/Image/shared.ts +14 -0
- package/src/Image/types.ts +57 -1
- package/src/Input/Input.native.tsx +22 -7
- package/src/KeyboardAwareScrollView/KeyboardAwareScrollView.native.tsx +33 -32
- package/src/Modal/drag/DragDismissHost.tsx +10 -5
- package/src/Modal/drag/DragDismissOverlay.tsx +9 -5
- package/src/Modal/drag/useDragDismiss.ts +29 -21
- package/src/Modal/modal-base.tsx +4 -4
- package/src/Pill/Pill.tsx +2 -2
- package/src/Popover/Popover.shared.tsx +3 -3
- package/src/Portal/OverlayHost.tsx +4 -4
- package/src/Portal/OverlayPortal.tsx +26 -0
- package/src/Portal/index.ts +4 -0
- package/src/ScrollArea/ScrollArea.native.tsx +39 -33
- package/src/ThemeIcon/ThemeIcon.tsx +2 -2
- package/src/Tooltip/Tooltip.tsx +3 -3
- package/src/index.ts +11 -1
- package/src/internal/gradient-shared.ts +13 -0
- package/src/internal/gradient.native.tsx +1 -0
- package/src/internal/gradient.tsx +1 -0
- package/src/internal/use-looping-animation.native.tsx +2 -2
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { RefreshControl, type
|
|
3
|
-
import {
|
|
2
|
+
import { RefreshControl, type ScrollViewInstance } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
GestureDetector,
|
|
5
|
+
type PanGestureConfig,
|
|
6
|
+
usePanGesture,
|
|
7
|
+
} from "react-native-gesture-handler";
|
|
4
8
|
import Animated, {
|
|
5
9
|
cancelAnimation,
|
|
6
10
|
useAnimatedReaction,
|
|
@@ -329,7 +333,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
329
333
|
const reducedMotion = useReducedMotion();
|
|
330
334
|
|
|
331
335
|
// The live native scroller (Autosize only; the Pan engine has none).
|
|
332
|
-
const scrollViewRef = React.useRef<
|
|
336
|
+
const scrollViewRef = React.useRef<ScrollViewInstance | null>(null);
|
|
333
337
|
|
|
334
338
|
// ── UI-thread state (shared values) ──────────────────────────────────────
|
|
335
339
|
// Scroll offset lives here, not in React state: the thumb worklet reads it every
|
|
@@ -565,19 +569,16 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
565
569
|
|
|
566
570
|
/* ---------------- native (Autosize) scroll handler ---------------- */
|
|
567
571
|
|
|
568
|
-
const scrollHandler = useAnimatedScrollHandler(
|
|
569
|
-
{
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
},
|
|
572
|
+
const scrollHandler = useAnimatedScrollHandler({
|
|
573
|
+
onScroll: (event) => {
|
|
574
|
+
"worklet";
|
|
575
|
+
scrollX.value = event.contentOffset.x;
|
|
576
|
+
scrollY.value = event.contentOffset.y;
|
|
577
|
+
if (needsJsScroll && shouldReportW(lastReportSV, reportIntervalMs)) {
|
|
578
|
+
runOnJS(reportScroll)(event.contentOffset.x, event.contentOffset.y);
|
|
579
|
+
}
|
|
578
580
|
},
|
|
579
|
-
|
|
580
|
-
);
|
|
581
|
+
});
|
|
581
582
|
|
|
582
583
|
/* ---------------- Pan engine ---------------- */
|
|
583
584
|
|
|
@@ -615,21 +616,28 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
615
616
|
},
|
|
616
617
|
);
|
|
617
618
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
619
|
+
// RNGH 3 hook API: the config object is memoized so its identity (which drives
|
|
620
|
+
// the handler re-configuration) only changes with the inputs it closes over.
|
|
621
|
+
const panConfig = React.useMemo(
|
|
622
|
+
(): PanGestureConfig => ({
|
|
623
|
+
// Only claim the axes we actually scroll, so a cross-axis drag (and a tap)
|
|
624
|
+
// passes through to ancestors / pressable children. Spread conditionally:
|
|
625
|
+
// an `undefined` offset key would be forwarded to the native config.
|
|
626
|
+
...(axes.x ? { activeOffsetX: [-PAN_ACTIVATE_THRESHOLD, PAN_ACTIVATE_THRESHOLD] } : null),
|
|
627
|
+
...(axes.y ? { activeOffsetY: [-PAN_ACTIVATE_THRESHOLD, PAN_ACTIVATE_THRESHOLD] } : null),
|
|
628
|
+
onBegin: () => {
|
|
621
629
|
"worklet";
|
|
622
630
|
cancelAnimation(scrollX);
|
|
623
631
|
cancelAnimation(scrollY);
|
|
624
632
|
panStartX.value = scrollX.value;
|
|
625
633
|
panStartY.value = scrollY.value;
|
|
626
|
-
}
|
|
627
|
-
|
|
634
|
+
},
|
|
635
|
+
onUpdate: (e) => {
|
|
628
636
|
"worklet";
|
|
629
637
|
scrollX.value = clampW(panStartX.value - e.translationX, 0, maxXSV.value);
|
|
630
638
|
scrollY.value = clampW(panStartY.value - e.translationY, 0, maxYSV.value);
|
|
631
|
-
}
|
|
632
|
-
|
|
639
|
+
},
|
|
640
|
+
onDeactivate: (e) => {
|
|
633
641
|
"worklet";
|
|
634
642
|
// No momentum under reduced motion — settle where the finger lifted.
|
|
635
643
|
if (reducedMotion) return;
|
|
@@ -647,13 +655,11 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
647
655
|
rubberBandEffect: false,
|
|
648
656
|
});
|
|
649
657
|
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
return g;
|
|
656
|
-
}, [axes.x, axes.y, reducedMotion, scrollX, scrollY, panStartX, panStartY, maxXSV, maxYSV]);
|
|
658
|
+
},
|
|
659
|
+
}),
|
|
660
|
+
[axes.x, axes.y, reducedMotion, scrollX, scrollY, panStartX, panStartY, maxXSV, maxYSV],
|
|
661
|
+
);
|
|
662
|
+
const panGesture = usePanGesture(panConfig);
|
|
657
663
|
|
|
658
664
|
/* ---------------- geometry (layout decisions, JS) ---------------- */
|
|
659
665
|
|
|
@@ -832,7 +838,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
832
838
|
"worklet";
|
|
833
839
|
const { offset } = thumbGeometryW(size.contentH, size.viewportH, yTrack, scrollY.value);
|
|
834
840
|
return { transform: [{ translateY: offset }] };
|
|
835
|
-
}
|
|
841
|
+
});
|
|
836
842
|
|
|
837
843
|
const yThumbInsetStyle = useAnimatedStyle(() => {
|
|
838
844
|
"worklet";
|
|
@@ -843,7 +849,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
843
849
|
"worklet";
|
|
844
850
|
const { offset } = thumbGeometryW(size.contentW, size.viewportW, xTrack, scrollX.value);
|
|
845
851
|
return { transform: [{ translateX: offset }] };
|
|
846
|
-
}
|
|
852
|
+
});
|
|
847
853
|
|
|
848
854
|
const xThumbInsetStyle = useAnimatedStyle(() => {
|
|
849
855
|
"worklet";
|
|
@@ -903,7 +909,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
903
909
|
showsHorizontalScrollIndicator: false,
|
|
904
910
|
scrollEventThrottle: 16,
|
|
905
911
|
nestedScrollEnabled: true,
|
|
906
|
-
keyboardShouldPersistTaps,
|
|
912
|
+
keyboardShouldPersistTaps: keyboardShouldPersistTaps as never,
|
|
907
913
|
...(onRefresh
|
|
908
914
|
? {
|
|
909
915
|
refreshControl: (
|
|
@@ -918,7 +924,7 @@ const ScrollAreaComponent = React.forwardRef<ScrollAreaHandle, ScrollAreaProps>(
|
|
|
918
924
|
...(mergedViewportProps as object),
|
|
919
925
|
};
|
|
920
926
|
|
|
921
|
-
const assignScroller = (node:
|
|
927
|
+
const assignScroller = (node: ScrollViewInstance | null) => {
|
|
922
928
|
scrollViewRef.current = node;
|
|
923
929
|
assignRef(viewportRef, node as unknown as TamaguiElement);
|
|
924
930
|
};
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import { Box } from "../Box";
|
|
12
12
|
import { ControlIconProvider } from "../internal/ControlIconProvider";
|
|
13
|
-
import { type GradientValue, useGradient } from "../internal/gradient";
|
|
13
|
+
import { gradientForVariant, type GradientValue, useGradient } from "../internal/gradient";
|
|
14
14
|
import {
|
|
15
15
|
pickVariants,
|
|
16
16
|
radiusVariant,
|
|
@@ -99,7 +99,7 @@ const ThemeIconComponent = styleable<ThemeIconProps>(
|
|
|
99
99
|
|
|
100
100
|
// Gradient fill (only when `variant="gradient"`): web paints a CSS
|
|
101
101
|
// `backgroundImage`; native renders the `layer` (an SVG fill) behind the icon.
|
|
102
|
-
const grad = useGradient(variant
|
|
102
|
+
const grad = useGradient(gradientForVariant(variant, gradient));
|
|
103
103
|
|
|
104
104
|
return (
|
|
105
105
|
<ThemeIconFrame ref={ref} variant={variant} size={size} {...grad.frameProps} {...rest}>
|
package/src/Tooltip/Tooltip.tsx
CHANGED
|
@@ -35,7 +35,7 @@ import { type MotionPresetName } from "../internal/motion";
|
|
|
35
35
|
import { useOverlayChrome } from "../internal/overlay-chrome";
|
|
36
36
|
import { type RadiusValue, radiusVariant, shadowVariant } from "../internal/style-props";
|
|
37
37
|
import { type SlotStyles } from "../internal/styles";
|
|
38
|
-
import {
|
|
38
|
+
import { OverlayPortal, useOverlayHost } from "../Portal";
|
|
39
39
|
import { Text } from "../Text";
|
|
40
40
|
import {
|
|
41
41
|
type OverlayTransitionConfig,
|
|
@@ -592,7 +592,7 @@ const TooltipBase = styleable<TooltipProps>(TooltipLabelFrame, function Tooltip(
|
|
|
592
592
|
const dropdownSlot = s.get("dropdown");
|
|
593
593
|
|
|
594
594
|
const labelNode = !t.rendered ? null : (
|
|
595
|
-
<
|
|
595
|
+
<OverlayPortal hostName={withinPortal ? overlayHost : undefined}>
|
|
596
596
|
<Theme name={themeName}>
|
|
597
597
|
<TooltipLabelFrame
|
|
598
598
|
ref={floatingRef}
|
|
@@ -648,7 +648,7 @@ const TooltipBase = styleable<TooltipProps>(TooltipLabelFrame, function Tooltip(
|
|
|
648
648
|
) : null}
|
|
649
649
|
</TooltipLabelFrame>
|
|
650
650
|
</Theme>
|
|
651
|
-
</
|
|
651
|
+
</OverlayPortal>
|
|
652
652
|
);
|
|
653
653
|
|
|
654
654
|
return (
|
package/src/index.ts
CHANGED
|
@@ -216,7 +216,15 @@ export {
|
|
|
216
216
|
type HoverCardTargetProps,
|
|
217
217
|
type HoverCardWidth,
|
|
218
218
|
} from "./HoverCard";
|
|
219
|
-
export {
|
|
219
|
+
export {
|
|
220
|
+
createImage,
|
|
221
|
+
Image,
|
|
222
|
+
type ImageProps,
|
|
223
|
+
type ImageStyles,
|
|
224
|
+
type ImageType,
|
|
225
|
+
type ImageWebProps,
|
|
226
|
+
type ImageWebSource,
|
|
227
|
+
} from "./Image";
|
|
220
228
|
export {
|
|
221
229
|
Indicator,
|
|
222
230
|
type IndicatorPosition,
|
|
@@ -412,6 +420,8 @@ export {
|
|
|
412
420
|
export {
|
|
413
421
|
OverlayHost,
|
|
414
422
|
type OverlayHostProps,
|
|
423
|
+
OverlayPortal,
|
|
424
|
+
type OverlayPortalProps,
|
|
415
425
|
Portal,
|
|
416
426
|
PortalHost,
|
|
417
427
|
type PortalHostProps,
|
|
@@ -65,6 +65,19 @@ const DEFAULT_FROM = "color5";
|
|
|
65
65
|
const DEFAULT_TO = "color9";
|
|
66
66
|
const DEFAULT_DEG = 45;
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The gradient a component paints for its `variant` / `gradient` props: `undefined`
|
|
70
|
+
* unless `variant="gradient"`, and the theme-ramp default (`color5` → `color9` at
|
|
71
|
+
* 45°) when the variant is set without a `gradient` prop. A shared frozen object,
|
|
72
|
+
* so the default keeps a stable identity across renders.
|
|
73
|
+
*/
|
|
74
|
+
const DEFAULT_GRADIENT: GradientValue = Object.freeze({});
|
|
75
|
+
export const gradientForVariant = (
|
|
76
|
+
variant: unknown,
|
|
77
|
+
gradient: GradientValue | undefined,
|
|
78
|
+
): GradientValue | undefined =>
|
|
79
|
+
variant === "gradient" ? (gradient ?? DEFAULT_GRADIENT) : undefined;
|
|
80
|
+
|
|
68
81
|
/** The resolved angle, defaulting to Mantine's 45°. */
|
|
69
82
|
export const gradientDeg = (gradient: GradientValue): number => gradient.deg ?? DEFAULT_DEG;
|
|
70
83
|
|
|
@@ -27,6 +27,7 @@ import type { GradientResult, GradientValue } from "./gradient-shared";
|
|
|
27
27
|
import { degToSvgCoords, gradientDeg, resolveStops } from "./gradient-shared";
|
|
28
28
|
|
|
29
29
|
export type { GradientStop, GradientValue } from "./gradient-shared";
|
|
30
|
+
export { gradientForVariant } from "./gradient-shared";
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* The no-gradient result, shared and frozen so the (overwhelmingly common)
|
|
@@ -20,6 +20,7 @@ import type { GradientResult, GradientValue } from "./gradient-shared";
|
|
|
20
20
|
import { gradientToCss } from "./gradient-shared";
|
|
21
21
|
|
|
22
22
|
export type { GradientStop, GradientValue } from "./gradient-shared";
|
|
23
|
+
export { gradientForVariant } from "./gradient-shared";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* The no-gradient result, shared and frozen so the (overwhelmingly common)
|
|
@@ -28,7 +28,7 @@ type Easer = EasingFunction | EasingFunctionFactory;
|
|
|
28
28
|
* worklet output) drives on the UI thread. Mirrors `LoopView` on web (a `Box`); the
|
|
29
29
|
* spread API (`<LoopView {...loop} />`) is identical across platforms.
|
|
30
30
|
*/
|
|
31
|
-
export const LoopView = Animated.View;
|
|
31
|
+
export const LoopView: typeof Animated.View = Animated.View;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Promote a frame component into a reanimated host so a {@link useLoopingAnimation}
|
|
@@ -116,7 +116,7 @@ export function useLoopingAnimation(motion: LoopMotion): LoopStyle {
|
|
|
116
116
|
// shimmer
|
|
117
117
|
const offset = progress.value * distance;
|
|
118
118
|
return { transform: axis === "y" ? [{ translateY: offset }] : [{ translateX: offset }] };
|
|
119
|
-
}
|
|
119
|
+
});
|
|
120
120
|
|
|
121
121
|
return { style };
|
|
122
122
|
}
|