@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;}
@@ -5,7 +5,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { SpinnerGapRegularIcon, UserRegularIcon, XRegularIcon, ArrowLeftRegularIcon, CaretUpFillIcon, CaretDownFillIcon, MapPinRegularIcon, EyeClosedRegularIcon, EyeRegularIcon, CheckCircleFillIcon, CaretDownRegularIcon, CaretRightRegularIcon, InfoRegularIcon, WarningRegularIcon, CheckRegularIcon, WarningCircleRegularIcon, ArrowCounterClockwiseRegularIcon, InfoFillIcon, WarningCircleFillIcon, WarningFillIcon } from '@ornikar/kitt-icons/phosphor';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { CSSTransition } from 'react-transition-group';
8
- import { ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
8
+ import { ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, StyleSheet, useWindowDimensions } from 'react-native';
9
9
  export { useWindowDimensions as useWindowSize } from 'react-native';
10
10
  import { parse } from '@twemoji/parser';
11
11
  import Downshift, { useSelect } from 'downshift';
@@ -14,8 +14,9 @@ import { launchImageLibraryAsync } from 'expo-image-picker';
14
14
  import { useDebouncedCallback } from 'use-debounce';
15
15
  import { Loader } from '@googlemaps/js-api-loader';
16
16
  import { parseNumber, getCountryCallingCode, isValidNumber } from 'libphonenumber-js';
17
- import Animated, { useAnimatedStyle, withSpring, withTiming, useSharedValue, interpolateColor, Easing, runOnJS, withDelay, interpolate } from 'react-native-reanimated';
17
+ import Animated, { useAnimatedStyle, withSpring, withTiming, useSharedValue, interpolateColor, Easing, useAnimatedProps, withDelay, withRepeat, runOnJS, interpolate } from 'react-native-reanimated';
18
18
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
19
+ import Svg, { Circle as Circle$1 } from 'react-native-svg';
19
20
  import { useFloating, autoUpdate, offset, autoPlacement, shift, arrow } from '@floating-ui/react-dom';
20
21
  import { makeDecorator } from '@storybook/addons';
21
22
 
@@ -10952,49 +10953,160 @@ function Notification({
10952
10953
  });
10953
10954
  }
10954
10955
 
10955
- const pageLoaderContainer = "kitt-u_pageLoaderContainer_ptkwz2j";
10956
- function PageLoader() {
10956
+ const AnimatedCircle = Animated.createAnimatedComponent(Circle$1);
10957
+ function AnimatedLoaderCircle({
10958
+ color,
10959
+ progress
10960
+ }) {
10961
+ const theme = useTheme();
10962
+ const {
10963
+ strokeWidth,
10964
+ size
10965
+ } = theme.kitt.pageLoader;
10966
+ const centerCoord = size * 0.5;
10967
+ const circlePerimeter = 2 * Math.PI * (size * 0.5 - strokeWidth);
10968
+ const strokeAnimation = useAnimatedProps(() => {
10969
+ return {
10970
+ strokeDashoffset: circlePerimeter - circlePerimeter * progress.value
10971
+ };
10972
+ }, [progress, circlePerimeter]);
10973
+ return /*#__PURE__*/jsx(AnimatedCircle, {
10974
+ "transform-origin": "center center",
10975
+ strokeWidth: strokeWidth,
10976
+ stroke: color,
10977
+ strokeLinecap: "round",
10978
+ cx: centerCoord,
10979
+ cy: centerCoord,
10980
+ r: centerCoord - strokeWidth,
10981
+ fill: "none",
10982
+ strokeDasharray: circlePerimeter,
10983
+ animatedProps: strokeAnimation
10984
+ });
10985
+ }
10986
+
10987
+ function AnimatedBackgroundCircle() {
10957
10988
  const theme = useTheme();
10989
+ const progress = useSharedValue(0);
10958
10990
  const {
10991
+ animation,
10959
10992
  colors,
10993
+ size
10994
+ } = theme.kitt.pageLoader;
10995
+ useEffect(() => {
10996
+ const {
10997
+ delay,
10998
+ circleBackgroundFillDuration,
10999
+ fillEasingFunction
11000
+ } = animation;
11001
+ const [x1, y1, x2, y2] = fillEasingFunction;
11002
+ progress.value = withDelay(delay, withTiming(1, {
11003
+ duration: circleBackgroundFillDuration,
11004
+ easing: Easing.bezier(x1, y1, x2, y2)
11005
+ }));
11006
+ }, [progress, animation]);
11007
+ return /*#__PURE__*/jsx(Svg, {
11008
+ width: size,
11009
+ height: size,
11010
+ viewBox: `0 0 ${size} ${size}`,
11011
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11012
+ color: colors.base,
11013
+ progress: progress
11014
+ })
11015
+ });
11016
+ }
11017
+
11018
+ const isInfinitAnimation$1 = -1;
11019
+ function AnimatedFillCircleContainer({
11020
+ children,
11021
+ duration
11022
+ }) {
11023
+ const theme = useTheme();
11024
+ const progress = useSharedValue(0);
11025
+ const {
11026
+ animation
11027
+ } = theme.kitt.pageLoader;
11028
+ useEffect(() => {
11029
+ const {
11030
+ delay
11031
+ } = animation;
11032
+ progress.value = withDelay(delay, withRepeat(withTiming(1, {
11033
+ duration,
11034
+ easing: Easing.linear
11035
+ }), isInfinitAnimation$1));
11036
+ }, [progress, animation, duration]);
11037
+ const rotationStyles = useAnimatedStyle(() => {
11038
+ return {
11039
+ transform: [{
11040
+ rotate: `${360 * progress.value}deg`
11041
+ }]
11042
+ };
11043
+ }, [progress]);
11044
+ return /*#__PURE__*/jsx(Animated.View, {
11045
+ style: [StyleSheet.absoluteFill, rotationStyles],
11046
+ children: children
11047
+ });
11048
+ }
11049
+
11050
+ const isInfinitAnimation = -1;
11051
+ const shouldReverse = true;
11052
+ function AnimatedFilledCircle() {
11053
+ const theme = useTheme();
11054
+ const progress = useSharedValue(0);
11055
+ const {
10960
11056
  size,
10961
- strokeWidth
11057
+ animation,
11058
+ colors
10962
11059
  } = theme.kitt.pageLoader;
10963
- const center = size * 0.5;
10964
- const radius = center - strokeWidth;
10965
- const circlePerimeter = 2 * Math.PI * radius;
10966
- const sharedProps = {
10967
- cx: center,
10968
- cy: center,
10969
- r: radius,
10970
- fill: 'none',
10971
- strokeWidth,
10972
- strokeDasharray: circlePerimeter,
10973
- strokeDashoffset: circlePerimeter,
10974
- strokeLinecap: 'round'
10975
- };
10976
- return /*#__PURE__*/jsx("div", {
10977
- className: pageLoaderContainer,
10978
- children: /*#__PURE__*/jsxs("svg", {
10979
- width: size,
10980
- height: size,
10981
- children: [/*#__PURE__*/jsx("g", {
10982
- "data-large-loader": "base",
10983
- children: /*#__PURE__*/jsx("circle", {
10984
- ...sharedProps,
10985
- stroke: colors.base
10986
- })
10987
- }), /*#__PURE__*/jsx("g", {
10988
- "data-large-loader": "fill",
10989
- children: /*#__PURE__*/jsx("circle", {
10990
- ...sharedProps,
10991
- stroke: colors.fill
11060
+ useEffect(() => {
11061
+ const {
11062
+ delay,
11063
+ filledCircleFillDuration,
11064
+ fillEasingFunction
11065
+ } = animation;
11066
+ const [x1, y1, x2, y2] = fillEasingFunction;
11067
+ progress.value = withDelay(delay, withRepeat(withTiming(0.8, {
11068
+ duration: filledCircleFillDuration,
11069
+ easing: Easing.bezier(x1, y1, x2, y2)
11070
+ }), isInfinitAnimation, shouldReverse));
11071
+ }, [progress, animation]);
11072
+ return /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11073
+ duration: animation.groupFilledCircleRotationDuration,
11074
+ children: /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11075
+ duration: animation.filledCircleRotationDuration,
11076
+ children: /*#__PURE__*/jsx(Svg, {
11077
+ width: size,
11078
+ height: size,
11079
+ viewBox: `0 0 ${size} ${size}`,
11080
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11081
+ color: colors.fill,
11082
+ progress: progress
10992
11083
  })
10993
- })]
11084
+ })
10994
11085
  })
10995
11086
  });
10996
11087
  }
10997
11088
 
11089
+ function PageLoader() {
11090
+ const sharedTransformStyle = {
11091
+ style: {
11092
+ /* Needed to make the animation starting from the top of the circles */
11093
+ transform: [{
11094
+ rotate: '90deg'
11095
+ }, {
11096
+ scale: -1
11097
+ }]
11098
+ }
11099
+ };
11100
+ return /*#__PURE__*/jsxs(View, {
11101
+ position: "relative",
11102
+ height: "kitt.pageLoader.size",
11103
+ width: "kitt.pageLoader.size",
11104
+ _ios: sharedTransformStyle,
11105
+ _android: sharedTransformStyle,
11106
+ children: [/*#__PURE__*/jsx(AnimatedBackgroundCircle, {}), /*#__PURE__*/jsx(AnimatedFilledCircle, {})]
11107
+ });
11108
+ }
11109
+
10998
11110
  function getBackgroundColor({
10999
11111
  isSelected,
11000
11112
  isHighlighted,