@ornikar/kitt-universal 29.1.0 → 29.3.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,12 +25,9 @@
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;}
32
31
  .kitt-u_exitActive_e1004d1h{-webkit-transform:translateY(8px);-ms-transform:translateY(8px);transform:translateY(8px);opacity:0;-webkit-transition:all 300ms ease-in-out;transition:all 300ms ease-in-out;}
33
- .kitt-u_skeleton_sc3upcl{background-color:#F1ECE4;position:relative;overflow:hidden;height:100%;width:100%;}@-webkit-keyframes flareTranslate-kitt-u_skeleton_sc3upcl{from{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);}to{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}@keyframes flareTranslate-kitt-u_skeleton_sc3upcl{from{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);}to{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);}}.kitt-u_skeleton_sc3upcl::after{content:'';position:absolute;width:100%;height:100%;top:0;left:0;background-image:linear-gradient( -90deg, #F1ECE4, #EAE3D6 50%, #F1ECE4 100% );-webkit-animation:1s ease-in-out infinite;animation:1s ease-in-out infinite;-webkit-animation-name:flareTranslate-kitt-u_skeleton_sc3upcl;animation-name:flareTranslate-kitt-u_skeleton_sc3upcl;}
34
- .kitt-u_skeletonWithoutAnimation_s12gop2o::after{background-image:none;-webkit-animation:none;animation:none;}
35
32
  .kitt-u_displayUnderline_dch42t > *{-webkit-text-decoration:underline;text-decoration:underline;}.kitt-u_displayUnderline_dch42t > *:hover,.kitt-u_displayUnderline_dch42t > *:active,.kitt-hover .kitt-u_displayUnderline_dch42t > *{-webkit-text-decoration:none;text-decoration:none;}
36
33
  .kitt-u_displayUnderlineWhenHovered_d80w0t7 > *{-webkit-text-decoration:none;text-decoration:none;}.kitt-u_displayUnderlineWhenHovered_d80w0t7 > *:hover,.kitt-u_displayUnderlineWhenHovered_d80w0t7 > *:active,.kitt-hover .kitt-u_displayUnderlineWhenHovered_d80w0t7 > *{-webkit-text-decoration:underline;text-decoration:underline;}
@@ -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,9 +14,11 @@ 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, interpolate, runOnJS } 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';
21
+ import { LinearGradient } from 'expo-linear-gradient';
20
22
  import { makeDecorator } from '@storybook/addons';
21
23
 
22
24
  const View = View$1;
@@ -2294,7 +2296,7 @@ const shadows = {
2294
2296
 
2295
2297
  const skeletonBackgroundColor = deepPurpleColorPalette['beige.2'];
2296
2298
  const skeletonFlareColor = deepPurpleColorPalette['beige.3'];
2297
- const skeleton$1 = {
2299
+ const skeleton = {
2298
2300
  backgroundColor: skeletonBackgroundColor,
2299
2301
  flareColor: skeletonFlareColor,
2300
2302
  animationDuration: 1000,
@@ -2634,7 +2636,7 @@ const theme = {
2634
2636
  pageLoader,
2635
2637
  picker,
2636
2638
  shadows,
2637
- skeleton: skeleton$1,
2639
+ skeleton,
2638
2640
  tabBar,
2639
2641
  tag,
2640
2642
  sticker,
@@ -10952,49 +10954,160 @@ function Notification({
10952
10954
  });
10953
10955
  }
10954
10956
 
10955
- const pageLoaderContainer = "kitt-u_pageLoaderContainer_ptkwz2j";
10956
- function PageLoader() {
10957
+ const AnimatedCircle = Animated.createAnimatedComponent(Circle$1);
10958
+ function AnimatedLoaderCircle({
10959
+ color,
10960
+ progress
10961
+ }) {
10962
+ const theme = useTheme();
10963
+ const {
10964
+ strokeWidth,
10965
+ size
10966
+ } = theme.kitt.pageLoader;
10967
+ const centerCoord = size * 0.5;
10968
+ const circlePerimeter = 2 * Math.PI * (size * 0.5 - strokeWidth);
10969
+ const strokeAnimation = useAnimatedProps(() => {
10970
+ return {
10971
+ strokeDashoffset: circlePerimeter - circlePerimeter * progress.value
10972
+ };
10973
+ }, [progress, circlePerimeter]);
10974
+ return /*#__PURE__*/jsx(AnimatedCircle, {
10975
+ "transform-origin": "center center",
10976
+ strokeWidth: strokeWidth,
10977
+ stroke: color,
10978
+ strokeLinecap: "round",
10979
+ cx: centerCoord,
10980
+ cy: centerCoord,
10981
+ r: centerCoord - strokeWidth,
10982
+ fill: "none",
10983
+ strokeDasharray: circlePerimeter,
10984
+ animatedProps: strokeAnimation
10985
+ });
10986
+ }
10987
+
10988
+ function AnimatedBackgroundCircle() {
10957
10989
  const theme = useTheme();
10990
+ const progress = useSharedValue(0);
10958
10991
  const {
10992
+ animation,
10959
10993
  colors,
10994
+ size
10995
+ } = theme.kitt.pageLoader;
10996
+ useEffect(() => {
10997
+ const {
10998
+ delay,
10999
+ circleBackgroundFillDuration,
11000
+ fillEasingFunction
11001
+ } = animation;
11002
+ const [x1, y1, x2, y2] = fillEasingFunction;
11003
+ progress.value = withDelay(delay, withTiming(1, {
11004
+ duration: circleBackgroundFillDuration,
11005
+ easing: Easing.bezier(x1, y1, x2, y2)
11006
+ }));
11007
+ }, [progress, animation]);
11008
+ return /*#__PURE__*/jsx(Svg, {
11009
+ width: size,
11010
+ height: size,
11011
+ viewBox: `0 0 ${size} ${size}`,
11012
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11013
+ color: colors.base,
11014
+ progress: progress
11015
+ })
11016
+ });
11017
+ }
11018
+
11019
+ const isInfinitAnimation$1 = -1;
11020
+ function AnimatedFillCircleContainer({
11021
+ children,
11022
+ duration
11023
+ }) {
11024
+ const theme = useTheme();
11025
+ const progress = useSharedValue(0);
11026
+ const {
11027
+ animation
11028
+ } = theme.kitt.pageLoader;
11029
+ useEffect(() => {
11030
+ const {
11031
+ delay
11032
+ } = animation;
11033
+ progress.value = withDelay(delay, withRepeat(withTiming(1, {
11034
+ duration,
11035
+ easing: Easing.linear
11036
+ }), isInfinitAnimation$1));
11037
+ }, [progress, animation, duration]);
11038
+ const rotationStyles = useAnimatedStyle(() => {
11039
+ return {
11040
+ transform: [{
11041
+ rotate: `${360 * progress.value}deg`
11042
+ }]
11043
+ };
11044
+ }, [progress]);
11045
+ return /*#__PURE__*/jsx(Animated.View, {
11046
+ style: [StyleSheet.absoluteFill, rotationStyles],
11047
+ children: children
11048
+ });
11049
+ }
11050
+
11051
+ const isInfinitAnimation = -1;
11052
+ const shouldReverse = true;
11053
+ function AnimatedFilledCircle() {
11054
+ const theme = useTheme();
11055
+ const progress = useSharedValue(0);
11056
+ const {
10960
11057
  size,
10961
- strokeWidth
11058
+ animation,
11059
+ colors
10962
11060
  } = 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
11061
+ useEffect(() => {
11062
+ const {
11063
+ delay,
11064
+ filledCircleFillDuration,
11065
+ fillEasingFunction
11066
+ } = animation;
11067
+ const [x1, y1, x2, y2] = fillEasingFunction;
11068
+ progress.value = withDelay(delay, withRepeat(withTiming(0.8, {
11069
+ duration: filledCircleFillDuration,
11070
+ easing: Easing.bezier(x1, y1, x2, y2)
11071
+ }), isInfinitAnimation, shouldReverse));
11072
+ }, [progress, animation]);
11073
+ return /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11074
+ duration: animation.groupFilledCircleRotationDuration,
11075
+ children: /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11076
+ duration: animation.filledCircleRotationDuration,
11077
+ children: /*#__PURE__*/jsx(Svg, {
11078
+ width: size,
11079
+ height: size,
11080
+ viewBox: `0 0 ${size} ${size}`,
11081
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11082
+ color: colors.fill,
11083
+ progress: progress
10992
11084
  })
10993
- })]
11085
+ })
10994
11086
  })
10995
11087
  });
10996
11088
  }
10997
11089
 
11090
+ function PageLoader() {
11091
+ const sharedTransformStyle = {
11092
+ style: {
11093
+ /* Needed to make the animation starting from the top of the circles */
11094
+ transform: [{
11095
+ rotate: '90deg'
11096
+ }, {
11097
+ scale: -1
11098
+ }]
11099
+ }
11100
+ };
11101
+ return /*#__PURE__*/jsxs(View, {
11102
+ position: "relative",
11103
+ height: "kitt.pageLoader.size",
11104
+ width: "kitt.pageLoader.size",
11105
+ _ios: sharedTransformStyle,
11106
+ _android: sharedTransformStyle,
11107
+ children: [/*#__PURE__*/jsx(AnimatedBackgroundCircle, {}), /*#__PURE__*/jsx(AnimatedFilledCircle, {})]
11108
+ });
11109
+ }
11110
+
10998
11111
  function getBackgroundColor({
10999
11112
  isSelected,
11000
11113
  isHighlighted,
@@ -11320,13 +11433,48 @@ function SegmentedProgressBar({
11320
11433
  });
11321
11434
  }
11322
11435
 
11323
- const skeleton = "kitt-u_skeleton_sc3upcl";
11324
- const skeletonWithoutAnimation = "kitt-u_skeletonWithoutAnimation_s12gop2o";
11325
11436
  function SkeletonContent({
11326
- isLoading
11437
+ isLoading,
11438
+ width
11327
11439
  }) {
11328
- return /*#__PURE__*/jsx("div", {
11329
- className: (skeleton ) + " " + ((!isLoading ? skeletonWithoutAnimation : undefined) || "")
11440
+ const theme = useTheme();
11441
+ const sharedX = useSharedValue(0);
11442
+ useEffect(() => {
11443
+ if (isLoading) {
11444
+ sharedX.value = withRepeat(withTiming(1, {
11445
+ duration: theme.kitt.skeleton.animationDuration,
11446
+ easing: Easing.inOut(Easing.ease)
11447
+ }), -1);
11448
+ }
11449
+ }, [sharedX, width, isLoading, theme]);
11450
+ const linearGradientStyle = useAnimatedStyle(() => {
11451
+ return {
11452
+ transform: [{
11453
+ translateX: interpolate(sharedX.value, [0, 1], [-width, width])
11454
+ }]
11455
+ };
11456
+ }, [sharedX, width]);
11457
+ return /*#__PURE__*/jsx(View, {
11458
+ height: "100%",
11459
+ width: "100%",
11460
+ backgroundColor: "kitt.skeleton.backgroundColor",
11461
+ borderColor: "kitt.skeleton.flareColor",
11462
+ children: /*#__PURE__*/jsx(Animated.View, {
11463
+ style: [StyleSheet.absoluteFill, linearGradientStyle],
11464
+ children: /*#__PURE__*/jsx(LinearGradient, {
11465
+ colors: [theme.kitt.skeleton.backgroundColor, theme.kitt.skeleton.flareColor, theme.kitt.skeleton.backgroundColor],
11466
+ locations: [0.1, 0.5, 0.9],
11467
+ start: {
11468
+ x: 0,
11469
+ y: 0
11470
+ },
11471
+ end: {
11472
+ x: 1,
11473
+ y: 0
11474
+ },
11475
+ style: StyleSheet.absoluteFill
11476
+ })
11477
+ })
11330
11478
  });
11331
11479
  }
11332
11480