@ornikar/kitt-universal 29.1.0 → 29.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.
@@ -25,7 +25,6 @@
25
25
  .kitt-u_opacityEnterActive_o2w8t0i{opacity:1;-webkit-transition:opacity 250ms cubic-bezier(0.42,1,0,1);transition:opacity 250ms cubic-bezier(0.42,1,0,1);}
26
26
  .kitt-u_opacityExit_o14r8iix{opacity:1;}
27
27
  .kitt-u_opacityExitActive_oim72y2{opacity:0;-webkit-transition:opacity 250ms cubic-bezier(0.42,1,0,1);transition:opacity 250ms cubic-bezier(0.42,1,0,1);}
28
- .kitt-u_pageLoaderContainer_ptkwz2j{width:60px;height:60px;-webkit-transform:scale(-1) rotate(90deg);-ms-transform:scale(-1) rotate(90deg);transform:scale(-1) rotate(90deg);}@-webkit-keyframes PageLoaderInit-kitt-u_pageLoaderContainer_ptkwz2j{0%{stroke-dashoffset:169.64600329384882px;}100%{stroke-dashoffset:0;}}@keyframes PageLoaderInit-kitt-u_pageLoaderContainer_ptkwz2j{0%{stroke-dashoffset:169.64600329384882px;}100%{stroke-dashoffset:0;}}@-webkit-keyframes PageLoaderOffset-kitt-u_pageLoaderContainer_ptkwz2j{0%{stroke-dashoffset:169.64600329384882px;}100%{stroke-dashoffset:33.929200658769766px;}}@keyframes PageLoaderOffset-kitt-u_pageLoaderContainer_ptkwz2j{0%{stroke-dashoffset:169.64600329384882px;}100%{stroke-dashoffset:33.929200658769766px;}}@-webkit-keyframes PageLoaderRotation-kitt-u_pageLoaderContainer_ptkwz2j{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}@keyframes PageLoaderRotation-kitt-u_pageLoaderContainer_ptkwz2j{0%{-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}.kitt-u_pageLoaderContainer_ptkwz2j circle,.kitt-u_pageLoaderContainer_ptkwz2j g{-webkit-transform-origin:center center;-ms-transform-origin:center center;transform-origin:center center;}.kitt-u_pageLoaderContainer_ptkwz2j g[data-large-loader='base'] circle{-webkit-animation:1000ms cubic-bezier(0.39,0.575,0.565,1) 500ms forwards;animation:1000ms cubic-bezier(0.39,0.575,0.565,1) 500ms forwards;-webkit-animation-name:PageLoaderInit-kitt-u_pageLoaderContainer_ptkwz2j;animation-name:PageLoaderInit-kitt-u_pageLoaderContainer_ptkwz2j;}.kitt-u_pageLoaderContainer_ptkwz2j g[data-large-loader='fill']{-webkit-animation:1800ms linear 500ms infinite;animation:1800ms linear 500ms infinite;-webkit-animation-name:PageLoaderRotation-kitt-u_pageLoaderContainer_ptkwz2j;animation-name:PageLoaderRotation-kitt-u_pageLoaderContainer_ptkwz2j;}.kitt-u_pageLoaderContainer_ptkwz2j g[data-large-loader='fill'] circle{-webkit-animation:1800ms cubic-bezier(0.39,0.575,0.565,1) 500ms infinite alternate,2160ms linear 500ms infinite;animation:1800ms cubic-bezier(0.39,0.575,0.565,1) 500ms infinite alternate,2160ms linear 500ms infinite;-webkit-animation-name:PageLoaderOffset-kitt-u_pageLoaderContainer_ptkwz2j,PageLoaderRotation-kitt-u_pageLoaderContainer_ptkwz2j;animation-name:PageLoaderOffset-kitt-u_pageLoaderContainer_ptkwz2j,PageLoaderRotation-kitt-u_pageLoaderContainer_ptkwz2j;}
29
28
  .kitt-u_enter_ereraf{-webkit-transform:translateY(8px);-ms-transform:translateY(8px);transform:translateY(8px);opacity:0;}
30
29
  .kitt-u_enterActive_e1jmsjrm{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);opacity:1;-webkit-transition:all 300ms ease-in-out;transition:all 300ms ease-in-out;}
31
30
  .kitt-u_exit_e1mwnccz{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);opacity:1;}
@@ -18,6 +18,7 @@ const jsApiLoader = require('@googlemaps/js-api-loader');
18
18
  const libphonenumberJs = require('libphonenumber-js');
19
19
  const Animated = require('react-native-reanimated');
20
20
  const reactNativeSafeAreaContext = require('react-native-safe-area-context');
21
+ const Svg = require('react-native-svg');
21
22
  const reactDom$1 = require('@floating-ui/react-dom');
22
23
  const addons = require('@storybook/addons');
23
24
 
@@ -25,6 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
25
26
 
26
27
  const Downshift__default = /*#__PURE__*/_interopDefaultLegacy(Downshift);
27
28
  const Animated__default = /*#__PURE__*/_interopDefaultLegacy(Animated);
29
+ const Svg__default = /*#__PURE__*/_interopDefaultLegacy(Svg);
28
30
 
29
31
  const View = nativeBase.View;
30
32
  const ScrollView = nativeBase.ScrollView;
@@ -10959,49 +10961,160 @@ function Notification({
10959
10961
  });
10960
10962
  }
10961
10963
 
10962
- const pageLoaderContainer = "kitt-u_pageLoaderContainer_ptkwz2j";
10963
- function PageLoader() {
10964
+ const AnimatedCircle = Animated__default.createAnimatedComponent(Svg.Circle);
10965
+ function AnimatedLoaderCircle({
10966
+ color,
10967
+ progress
10968
+ }) {
10969
+ const theme = useTheme();
10970
+ const {
10971
+ strokeWidth,
10972
+ size
10973
+ } = theme.kitt.pageLoader;
10974
+ const centerCoord = size * 0.5;
10975
+ const circlePerimeter = 2 * Math.PI * (size * 0.5 - strokeWidth);
10976
+ const strokeAnimation = Animated.useAnimatedProps(() => {
10977
+ return {
10978
+ strokeDashoffset: circlePerimeter - circlePerimeter * progress.value
10979
+ };
10980
+ }, [progress, circlePerimeter]);
10981
+ return /*#__PURE__*/jsxRuntime.jsx(AnimatedCircle, {
10982
+ "transform-origin": "center center",
10983
+ strokeWidth: strokeWidth,
10984
+ stroke: color,
10985
+ strokeLinecap: "round",
10986
+ cx: centerCoord,
10987
+ cy: centerCoord,
10988
+ r: centerCoord - strokeWidth,
10989
+ fill: "none",
10990
+ strokeDasharray: circlePerimeter,
10991
+ animatedProps: strokeAnimation
10992
+ });
10993
+ }
10994
+
10995
+ function AnimatedBackgroundCircle() {
10964
10996
  const theme = useTheme();
10997
+ const progress = Animated.useSharedValue(0);
10965
10998
  const {
10999
+ animation,
10966
11000
  colors,
11001
+ size
11002
+ } = theme.kitt.pageLoader;
11003
+ react.useEffect(() => {
11004
+ const {
11005
+ delay,
11006
+ circleBackgroundFillDuration,
11007
+ fillEasingFunction
11008
+ } = animation;
11009
+ const [x1, y1, x2, y2] = fillEasingFunction;
11010
+ progress.value = Animated.withDelay(delay, Animated.withTiming(1, {
11011
+ duration: circleBackgroundFillDuration,
11012
+ easing: Animated.Easing.bezier(x1, y1, x2, y2)
11013
+ }));
11014
+ }, [progress, animation]);
11015
+ return /*#__PURE__*/jsxRuntime.jsx(Svg__default, {
11016
+ width: size,
11017
+ height: size,
11018
+ viewBox: `0 0 ${size} ${size}`,
11019
+ children: /*#__PURE__*/jsxRuntime.jsx(AnimatedLoaderCircle, {
11020
+ color: colors.base,
11021
+ progress: progress
11022
+ })
11023
+ });
11024
+ }
11025
+
11026
+ const isInfinitAnimation$1 = -1;
11027
+ function AnimatedFillCircleContainer({
11028
+ children,
11029
+ duration
11030
+ }) {
11031
+ const theme = useTheme();
11032
+ const progress = Animated.useSharedValue(0);
11033
+ const {
11034
+ animation
11035
+ } = theme.kitt.pageLoader;
11036
+ react.useEffect(() => {
11037
+ const {
11038
+ delay
11039
+ } = animation;
11040
+ progress.value = Animated.withDelay(delay, Animated.withRepeat(Animated.withTiming(1, {
11041
+ duration,
11042
+ easing: Animated.Easing.linear
11043
+ }), isInfinitAnimation$1));
11044
+ }, [progress, animation, duration]);
11045
+ const rotationStyles = Animated.useAnimatedStyle(() => {
11046
+ return {
11047
+ transform: [{
11048
+ rotate: `${360 * progress.value}deg`
11049
+ }]
11050
+ };
11051
+ }, [progress]);
11052
+ return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
11053
+ style: [reactNative.StyleSheet.absoluteFill, rotationStyles],
11054
+ children: children
11055
+ });
11056
+ }
11057
+
11058
+ const isInfinitAnimation = -1;
11059
+ const shouldReverse = true;
11060
+ function AnimatedFilledCircle() {
11061
+ const theme = useTheme();
11062
+ const progress = Animated.useSharedValue(0);
11063
+ const {
10967
11064
  size,
10968
- strokeWidth
11065
+ animation,
11066
+ colors
10969
11067
  } = theme.kitt.pageLoader;
10970
- const center = size * 0.5;
10971
- const radius = center - strokeWidth;
10972
- const circlePerimeter = 2 * Math.PI * radius;
10973
- const sharedProps = {
10974
- cx: center,
10975
- cy: center,
10976
- r: radius,
10977
- fill: 'none',
10978
- strokeWidth,
10979
- strokeDasharray: circlePerimeter,
10980
- strokeDashoffset: circlePerimeter,
10981
- strokeLinecap: 'round'
10982
- };
10983
- return /*#__PURE__*/jsxRuntime.jsx("div", {
10984
- className: pageLoaderContainer,
10985
- children: /*#__PURE__*/jsxRuntime.jsxs("svg", {
10986
- width: size,
10987
- height: size,
10988
- children: [/*#__PURE__*/jsxRuntime.jsx("g", {
10989
- "data-large-loader": "base",
10990
- children: /*#__PURE__*/jsxRuntime.jsx("circle", {
10991
- ...sharedProps,
10992
- stroke: colors.base
10993
- })
10994
- }), /*#__PURE__*/jsxRuntime.jsx("g", {
10995
- "data-large-loader": "fill",
10996
- children: /*#__PURE__*/jsxRuntime.jsx("circle", {
10997
- ...sharedProps,
10998
- stroke: colors.fill
11068
+ react.useEffect(() => {
11069
+ const {
11070
+ delay,
11071
+ filledCircleFillDuration,
11072
+ fillEasingFunction
11073
+ } = animation;
11074
+ const [x1, y1, x2, y2] = fillEasingFunction;
11075
+ progress.value = Animated.withDelay(delay, Animated.withRepeat(Animated.withTiming(0.8, {
11076
+ duration: filledCircleFillDuration,
11077
+ easing: Animated.Easing.bezier(x1, y1, x2, y2)
11078
+ }), isInfinitAnimation, shouldReverse));
11079
+ }, [progress, animation]);
11080
+ return /*#__PURE__*/jsxRuntime.jsx(AnimatedFillCircleContainer, {
11081
+ duration: animation.groupFilledCircleRotationDuration,
11082
+ children: /*#__PURE__*/jsxRuntime.jsx(AnimatedFillCircleContainer, {
11083
+ duration: animation.filledCircleRotationDuration,
11084
+ children: /*#__PURE__*/jsxRuntime.jsx(Svg__default, {
11085
+ width: size,
11086
+ height: size,
11087
+ viewBox: `0 0 ${size} ${size}`,
11088
+ children: /*#__PURE__*/jsxRuntime.jsx(AnimatedLoaderCircle, {
11089
+ color: colors.fill,
11090
+ progress: progress
10999
11091
  })
11000
- })]
11092
+ })
11001
11093
  })
11002
11094
  });
11003
11095
  }
11004
11096
 
11097
+ function PageLoader() {
11098
+ const sharedTransformStyle = {
11099
+ style: {
11100
+ /* Needed to make the animation starting from the top of the circles */
11101
+ transform: [{
11102
+ rotate: '90deg'
11103
+ }, {
11104
+ scale: -1
11105
+ }]
11106
+ }
11107
+ };
11108
+ return /*#__PURE__*/jsxRuntime.jsxs(View, {
11109
+ position: "relative",
11110
+ height: "kitt.pageLoader.size",
11111
+ width: "kitt.pageLoader.size",
11112
+ _ios: sharedTransformStyle,
11113
+ _android: sharedTransformStyle,
11114
+ children: [/*#__PURE__*/jsxRuntime.jsx(AnimatedBackgroundCircle, {}), /*#__PURE__*/jsxRuntime.jsx(AnimatedFilledCircle, {})]
11115
+ });
11116
+ }
11117
+
11005
11118
  function getBackgroundColor({
11006
11119
  isSelected,
11007
11120
  isHighlighted,