@ornikar/kitt-universal 31.1.0 → 31.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/CHANGELOG.md +24 -0
- package/dist/definitions/Button/Button.d.ts +5 -0
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonGauge.d.ts +9 -0
- package/dist/definitions/Button/ButtonGauge.d.ts.map +1 -0
- package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts +4 -0
- package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts.map +1 -0
- package/dist/definitions/CardModal/CardModalAnimation/NativeRotationAnimation.d.ts +1 -0
- package/dist/definitions/CardModal/CardModalAnimation/NativeRotationAnimation.d.ts.map +1 -1
- package/dist/definitions/NavigationBottomSheet/NavigationBottomSheet.d.ts +3 -0
- package/dist/definitions/NavigationBottomSheet/NavigationBottomSheet.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +84 -11
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +84 -11
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.17.cjs.js +85 -10
- package/dist/index-node-22.17.cjs.js.map +1 -1
- package/dist/index-node-22.17.cjs.web.css +8 -0
- package/dist/index-node-22.17.cjs.web.js +152 -152
- package/dist/index-node-22.17.cjs.web.js.map +1 -1
- package/dist/index-node-22.17.es.mjs +86 -11
- package/dist/index-node-22.17.es.mjs.map +1 -1
- package/dist/index-node-22.17.es.web.css +8 -0
- package/dist/index-node-22.17.es.web.mjs +153 -153
- package/dist/index-node-22.17.es.web.mjs.map +1 -1
- package/dist/index.es.js +87 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +168 -167
- package/dist/index.es.web.js.map +1 -1
- package/dist/styles.css +8 -0
- package/dist/tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -3657,6 +3657,79 @@ function ButtonContent({
|
|
|
3657
3657
|
});
|
|
3658
3658
|
}
|
|
3659
3659
|
|
|
3660
|
+
function ButtonGauge({
|
|
3661
|
+
duration,
|
|
3662
|
+
running,
|
|
3663
|
+
onEnded
|
|
3664
|
+
}) {
|
|
3665
|
+
const [translate, setTranslate] = React.useState(100);
|
|
3666
|
+
const startTimeRef = React.useRef(0);
|
|
3667
|
+
const pauseTimeRef = React.useRef(0);
|
|
3668
|
+
const rafRef = React.useRef(undefined);
|
|
3669
|
+
const distance = 100;
|
|
3670
|
+
const draw = React.useCallback(timestamp => {
|
|
3671
|
+
const timeElapsedSinceStart = timestamp - startTimeRef.current;
|
|
3672
|
+
// Since the time between frame is not reliable and regular, we have to
|
|
3673
|
+
// limit the progress to prevent overflows
|
|
3674
|
+
const safeProgress = Math.min(distance * timeElapsedSinceStart / duration, distance);
|
|
3675
|
+
setTranslate(safeProgress);
|
|
3676
|
+
if (safeProgress < distance) {
|
|
3677
|
+
if (!rafRef) return;
|
|
3678
|
+
rafRef.current = requestAnimationFrame(draw);
|
|
3679
|
+
return;
|
|
3680
|
+
}
|
|
3681
|
+
onEnded();
|
|
3682
|
+
if (rafRef.current) {
|
|
3683
|
+
cancelAnimationFrame(rafRef.current);
|
|
3684
|
+
}
|
|
3685
|
+
},
|
|
3686
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3687
|
+
[]);
|
|
3688
|
+
React.useLayoutEffect(() => {
|
|
3689
|
+
if (running) {
|
|
3690
|
+
// Resuming from pause
|
|
3691
|
+
if (pauseTimeRef.current > 0) {
|
|
3692
|
+
startTimeRef.current += global.performance.now() - pauseTimeRef.current;
|
|
3693
|
+
draw(global.performance.now());
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
// First launch
|
|
3698
|
+
startTimeRef.current = global.performance.now();
|
|
3699
|
+
draw(startTimeRef.current);
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3702
|
+
// On pause
|
|
3703
|
+
if (!running && rafRef.current) {
|
|
3704
|
+
pauseTimeRef.current = global.performance.now();
|
|
3705
|
+
cancelAnimationFrame(rafRef.current);
|
|
3706
|
+
}
|
|
3707
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3708
|
+
}, [running]);
|
|
3709
|
+
React.useEffect(() => {
|
|
3710
|
+
return () => {
|
|
3711
|
+
if (rafRef.current) {
|
|
3712
|
+
cancelAnimationFrame(rafRef.current);
|
|
3713
|
+
}
|
|
3714
|
+
};
|
|
3715
|
+
}, []);
|
|
3716
|
+
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3717
|
+
position: "absolute",
|
|
3718
|
+
left: 0,
|
|
3719
|
+
right: 0,
|
|
3720
|
+
top: 0,
|
|
3721
|
+
bottom: 0,
|
|
3722
|
+
overflow: "hidden",
|
|
3723
|
+
alignItems: "flex-end",
|
|
3724
|
+
borderRadius: "kitt.button.borderRadius",
|
|
3725
|
+
children: /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3726
|
+
width: `${translate}%`,
|
|
3727
|
+
height: "100%",
|
|
3728
|
+
backgroundColor: "kitt.palettes.deepPurple['white-alpha.20']"
|
|
3729
|
+
})
|
|
3730
|
+
});
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3660
3733
|
function ButtonPadding({
|
|
3661
3734
|
children,
|
|
3662
3735
|
size,
|
|
@@ -3747,6 +3820,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3747
3820
|
hrefAttrs,
|
|
3748
3821
|
withBadge,
|
|
3749
3822
|
badgeCount,
|
|
3823
|
+
timerAttrs,
|
|
3750
3824
|
accessibilityRole = 'button',
|
|
3751
3825
|
innerSpacing = 'center',
|
|
3752
3826
|
isHoveredInternal,
|
|
@@ -3794,7 +3868,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3794
3868
|
isHovered,
|
|
3795
3869
|
isPressed,
|
|
3796
3870
|
isFocused
|
|
3797
|
-
}) => /*#__PURE__*/jsxRuntime.
|
|
3871
|
+
}) => /*#__PURE__*/jsxRuntime.jsxs(AnimatedContainer$2, {
|
|
3798
3872
|
animatedStyles: animatedStyles,
|
|
3799
3873
|
type: type,
|
|
3800
3874
|
isHovered: isHovered || isHoveredInternal,
|
|
@@ -3804,7 +3878,9 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3804
3878
|
size: size,
|
|
3805
3879
|
isIconOnly: isIconOnly,
|
|
3806
3880
|
isStretch: stretch,
|
|
3807
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
3881
|
+
children: [timerAttrs ? /*#__PURE__*/jsxRuntime.jsx(ButtonGauge, {
|
|
3882
|
+
...timerAttrs
|
|
3883
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsxs(ButtonPadding, {
|
|
3808
3884
|
size: size,
|
|
3809
3885
|
isIconOnly: isIconOnly,
|
|
3810
3886
|
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
|
|
@@ -3826,7 +3902,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3826
3902
|
isHovered: isHovered,
|
|
3827
3903
|
isPressed: isPressed
|
|
3828
3904
|
})]
|
|
3829
|
-
})
|
|
3905
|
+
})]
|
|
3830
3906
|
})
|
|
3831
3907
|
});
|
|
3832
3908
|
});
|
|
@@ -4343,7 +4419,7 @@ function NativeOpacityAnimation$2({
|
|
|
4343
4419
|
Animated.runOnJS(handleAnimationFinished)();
|
|
4344
4420
|
})
|
|
4345
4421
|
};
|
|
4346
|
-
}
|
|
4422
|
+
});
|
|
4347
4423
|
return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
|
|
4348
4424
|
style: [reactNative.StyleSheet.absoluteFillObject, opacityStyle],
|
|
4349
4425
|
children: children
|
|
@@ -4398,11 +4474,9 @@ function NativeRotationAnimation$1({
|
|
|
4398
4474
|
rotateZ: `${rotation.value}deg`
|
|
4399
4475
|
}]
|
|
4400
4476
|
};
|
|
4401
|
-
}
|
|
4477
|
+
});
|
|
4402
4478
|
return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
|
|
4403
|
-
style: [
|
|
4404
|
-
flexShrink: 1
|
|
4405
|
-
}, animatedStyle],
|
|
4479
|
+
style: [animatedStyle],
|
|
4406
4480
|
children: children
|
|
4407
4481
|
});
|
|
4408
4482
|
}
|
|
@@ -11710,7 +11784,7 @@ function NavigationBottomSheet({
|
|
|
11710
11784
|
snapPoints,
|
|
11711
11785
|
maxDynamicContentSize,
|
|
11712
11786
|
isVisible,
|
|
11713
|
-
isExpanded,
|
|
11787
|
+
isExpanded = false,
|
|
11714
11788
|
onClose
|
|
11715
11789
|
}) {
|
|
11716
11790
|
const bottomSheetRef = useBottomSheet();
|
|
@@ -11722,7 +11796,8 @@ function NavigationBottomSheet({
|
|
|
11722
11796
|
}
|
|
11723
11797
|
}, [bottomSheetRef, isVisible]);
|
|
11724
11798
|
React.useEffect(() => {
|
|
11725
|
-
if (isVisible
|
|
11799
|
+
if (!isVisible) return;
|
|
11800
|
+
if (isExpanded) {
|
|
11726
11801
|
bottomSheetRef.current?.expand();
|
|
11727
11802
|
} else {
|
|
11728
11803
|
bottomSheetRef.current?.collapse();
|