@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.
@@ -13,7 +13,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
13
13
  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';
14
14
  import { createPortal } from 'react-dom';
15
15
  import { CSSTransition } from 'react-transition-group';
16
- import { ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
16
+ import { ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, StyleSheet, useWindowDimensions } from 'react-native';
17
17
  export { useWindowDimensions as useWindowSize } from 'react-native';
18
18
  import { parse } from '@twemoji/parser';
19
19
  import Downshift, { useSelect } from 'downshift';
@@ -22,10 +22,12 @@ import { launchImageLibraryAsync } from 'expo-image-picker';
22
22
  import { useDebouncedCallback } from 'use-debounce';
23
23
  import { Loader } from '@googlemaps/js-api-loader';
24
24
  import { parseNumber, getCountryCallingCode, isValidNumber } from 'libphonenumber-js';
25
- import Animated, { useAnimatedStyle, withSpring, withTiming, useSharedValue, interpolateColor, Easing, runOnJS, withDelay, interpolate } from 'react-native-reanimated';
25
+ import Animated, { useAnimatedStyle, withSpring, withTiming, useSharedValue, interpolateColor, Easing, useAnimatedProps, withDelay, withRepeat, interpolate, runOnJS } from 'react-native-reanimated';
26
26
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
27
+ import Svg, { Circle as Circle$1 } from 'react-native-svg';
27
28
  import { useFloating, autoUpdate, offset, autoPlacement, shift, arrow } from '@floating-ui/react-dom';
28
29
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
30
+ import { LinearGradient } from 'expo-linear-gradient';
29
31
  import { makeDecorator } from '@storybook/addons';
30
32
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
31
33
 
@@ -2312,7 +2314,7 @@ var shadows = {
2312
2314
 
2313
2315
  var skeletonBackgroundColor = deepPurpleColorPalette['beige.2'];
2314
2316
  var skeletonFlareColor = deepPurpleColorPalette['beige.3'];
2315
- var skeleton$1 = {
2317
+ var skeleton = {
2316
2318
  backgroundColor: skeletonBackgroundColor,
2317
2319
  flareColor: skeletonFlareColor,
2318
2320
  animationDuration: 1000,
@@ -2654,7 +2656,7 @@ var theme = {
2654
2656
  pageLoader: pageLoader,
2655
2657
  picker: picker,
2656
2658
  shadows: shadows,
2657
- skeleton: skeleton$1,
2659
+ skeleton: skeleton,
2658
2660
  tabBar: tabBar,
2659
2661
  tag: tag,
2660
2662
  sticker: sticker,
@@ -11138,46 +11140,155 @@ function Notification(_ref) {
11138
11140
  });
11139
11141
  }
11140
11142
 
11141
- var pageLoaderContainer = "kitt-u_pageLoaderContainer_ptkwz2j";
11142
- function PageLoader() {
11143
+ var AnimatedCircle = Animated.createAnimatedComponent(Circle$1);
11144
+ function AnimatedLoaderCircle(_ref) {
11145
+ var color = _ref.color,
11146
+ progress = _ref.progress;
11143
11147
  var theme = useTheme();
11144
11148
  var _theme$kitt$pageLoade = theme.kitt.pageLoader,
11145
- colors = _theme$kitt$pageLoade.colors,
11146
- size = _theme$kitt$pageLoade.size,
11147
- strokeWidth = _theme$kitt$pageLoade.strokeWidth;
11148
- var center = size * 0.5;
11149
- var radius = center - strokeWidth;
11150
- var circlePerimeter = 2 * Math.PI * radius;
11151
- var sharedProps = {
11152
- cx: center,
11153
- cy: center,
11154
- r: radius,
11155
- fill: 'none',
11149
+ strokeWidth = _theme$kitt$pageLoade.strokeWidth,
11150
+ size = _theme$kitt$pageLoade.size;
11151
+ var centerCoord = size * 0.5;
11152
+ var circlePerimeter = 2 * Math.PI * (size * 0.5 - strokeWidth);
11153
+ var strokeAnimation = useAnimatedProps(function () {
11154
+ return {
11155
+ strokeDashoffset: circlePerimeter - circlePerimeter * progress.value
11156
+ };
11157
+ }, [progress, circlePerimeter]);
11158
+ return /*#__PURE__*/jsx(AnimatedCircle, {
11159
+ "transform-origin": "center center",
11156
11160
  strokeWidth: strokeWidth,
11161
+ stroke: color,
11162
+ strokeLinecap: "round",
11163
+ cx: centerCoord,
11164
+ cy: centerCoord,
11165
+ r: centerCoord - strokeWidth,
11166
+ fill: "none",
11157
11167
  strokeDasharray: circlePerimeter,
11158
- strokeDashoffset: circlePerimeter,
11159
- strokeLinecap: 'round'
11160
- };
11161
- return /*#__PURE__*/jsx("div", {
11162
- className: pageLoaderContainer,
11163
- children: /*#__PURE__*/jsxs("svg", {
11164
- width: size,
11165
- height: size,
11166
- children: [/*#__PURE__*/jsx("g", {
11167
- "data-large-loader": "base",
11168
- children: /*#__PURE__*/jsx("circle", _objectSpread(_objectSpread({}, sharedProps), {}, {
11169
- stroke: colors.base
11170
- }))
11171
- }), /*#__PURE__*/jsx("g", {
11172
- "data-large-loader": "fill",
11173
- children: /*#__PURE__*/jsx("circle", _objectSpread(_objectSpread({}, sharedProps), {}, {
11174
- stroke: colors.fill
11175
- }))
11176
- })]
11168
+ animatedProps: strokeAnimation
11169
+ });
11170
+ }
11171
+
11172
+ function AnimatedBackgroundCircle() {
11173
+ var theme = useTheme();
11174
+ var progress = useSharedValue(0);
11175
+ var _theme$kitt$pageLoade = theme.kitt.pageLoader,
11176
+ animation = _theme$kitt$pageLoade.animation,
11177
+ colors = _theme$kitt$pageLoade.colors,
11178
+ size = _theme$kitt$pageLoade.size;
11179
+ useEffect(function () {
11180
+ var delay = animation.delay,
11181
+ circleBackgroundFillDuration = animation.circleBackgroundFillDuration,
11182
+ fillEasingFunction = animation.fillEasingFunction;
11183
+ var _fillEasingFunction = _slicedToArray(fillEasingFunction, 4),
11184
+ x1 = _fillEasingFunction[0],
11185
+ y1 = _fillEasingFunction[1],
11186
+ x2 = _fillEasingFunction[2],
11187
+ y2 = _fillEasingFunction[3];
11188
+ progress.value = withDelay(delay, withTiming(1, {
11189
+ duration: circleBackgroundFillDuration,
11190
+ easing: Easing.bezier(x1, y1, x2, y2)
11191
+ }));
11192
+ }, [progress, animation]);
11193
+ return /*#__PURE__*/jsx(Svg, {
11194
+ width: size,
11195
+ height: size,
11196
+ viewBox: "0 0 ".concat(size, " ").concat(size),
11197
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11198
+ color: colors.base,
11199
+ progress: progress
11177
11200
  })
11178
11201
  });
11179
11202
  }
11180
11203
 
11204
+ var isInfinitAnimation$1 = -1;
11205
+ function AnimatedFillCircleContainer(_ref) {
11206
+ var children = _ref.children,
11207
+ duration = _ref.duration;
11208
+ var theme = useTheme();
11209
+ var progress = useSharedValue(0);
11210
+ var animation = theme.kitt.pageLoader.animation;
11211
+ useEffect(function () {
11212
+ var delay = animation.delay;
11213
+ progress.value = withDelay(delay, withRepeat(withTiming(1, {
11214
+ duration: duration,
11215
+ easing: Easing.linear
11216
+ }), isInfinitAnimation$1));
11217
+ }, [progress, animation, duration]);
11218
+ var rotationStyles = useAnimatedStyle(function () {
11219
+ return {
11220
+ transform: [{
11221
+ rotate: "".concat(360 * progress.value, "deg")
11222
+ }]
11223
+ };
11224
+ }, [progress]);
11225
+ return /*#__PURE__*/jsx(Animated.View, {
11226
+ style: [StyleSheet.absoluteFill, rotationStyles],
11227
+ children: children
11228
+ });
11229
+ }
11230
+
11231
+ var isInfinitAnimation = -1;
11232
+ var shouldReverse = true;
11233
+ function AnimatedFilledCircle() {
11234
+ var theme = useTheme();
11235
+ var progress = useSharedValue(0);
11236
+ var _theme$kitt$pageLoade = theme.kitt.pageLoader,
11237
+ size = _theme$kitt$pageLoade.size,
11238
+ animation = _theme$kitt$pageLoade.animation,
11239
+ colors = _theme$kitt$pageLoade.colors;
11240
+ useEffect(function () {
11241
+ var delay = animation.delay,
11242
+ filledCircleFillDuration = animation.filledCircleFillDuration,
11243
+ fillEasingFunction = animation.fillEasingFunction;
11244
+ var _fillEasingFunction = _slicedToArray(fillEasingFunction, 4),
11245
+ x1 = _fillEasingFunction[0],
11246
+ y1 = _fillEasingFunction[1],
11247
+ x2 = _fillEasingFunction[2],
11248
+ y2 = _fillEasingFunction[3];
11249
+ progress.value = withDelay(delay, withRepeat(withTiming(0.8, {
11250
+ duration: filledCircleFillDuration,
11251
+ easing: Easing.bezier(x1, y1, x2, y2)
11252
+ }), isInfinitAnimation, shouldReverse));
11253
+ }, [progress, animation]);
11254
+ return /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11255
+ duration: animation.groupFilledCircleRotationDuration,
11256
+ children: /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11257
+ duration: animation.filledCircleRotationDuration,
11258
+ children: /*#__PURE__*/jsx(Svg, {
11259
+ width: size,
11260
+ height: size,
11261
+ viewBox: "0 0 ".concat(size, " ").concat(size),
11262
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11263
+ color: colors.fill,
11264
+ progress: progress
11265
+ })
11266
+ })
11267
+ })
11268
+ });
11269
+ }
11270
+
11271
+ function PageLoader() {
11272
+ var sharedTransformStyle = {
11273
+ style: {
11274
+ /* Needed to make the animation starting from the top of the circles */
11275
+ transform: [{
11276
+ rotate: '90deg'
11277
+ }, {
11278
+ scale: -1
11279
+ }]
11280
+ }
11281
+ };
11282
+ return /*#__PURE__*/jsxs(View, {
11283
+ position: "relative",
11284
+ height: "kitt.pageLoader.size",
11285
+ width: "kitt.pageLoader.size",
11286
+ _ios: sharedTransformStyle,
11287
+ _android: sharedTransformStyle,
11288
+ children: [/*#__PURE__*/jsx(AnimatedBackgroundCircle, {}), /*#__PURE__*/jsx(AnimatedFilledCircle, {})]
11289
+ });
11290
+ }
11291
+
11181
11292
  function getBackgroundColor(_ref) {
11182
11293
  var isSelected = _ref.isSelected,
11183
11294
  isHighlighted = _ref.isHighlighted,
@@ -11501,12 +11612,47 @@ function SegmentedProgressBar(_ref) {
11501
11612
  });
11502
11613
  }
11503
11614
 
11504
- var skeleton = "kitt-u_skeleton_sc3upcl";
11505
- var skeletonWithoutAnimation = "kitt-u_skeletonWithoutAnimation_s12gop2o";
11506
11615
  function SkeletonContent(_ref) {
11507
- var isLoading = _ref.isLoading;
11508
- return /*#__PURE__*/jsx("div", {
11509
- className: (skeleton ) + " " + ((!isLoading ? skeletonWithoutAnimation : undefined) || "")
11616
+ var isLoading = _ref.isLoading,
11617
+ width = _ref.width;
11618
+ var theme = useTheme();
11619
+ var sharedX = useSharedValue(0);
11620
+ useEffect(function () {
11621
+ if (isLoading) {
11622
+ sharedX.value = withRepeat(withTiming(1, {
11623
+ duration: theme.kitt.skeleton.animationDuration,
11624
+ easing: Easing.inOut(Easing.ease)
11625
+ }), -1);
11626
+ }
11627
+ }, [sharedX, width, isLoading, theme]);
11628
+ var linearGradientStyle = useAnimatedStyle(function () {
11629
+ return {
11630
+ transform: [{
11631
+ translateX: interpolate(sharedX.value, [0, 1], [-width, width])
11632
+ }]
11633
+ };
11634
+ }, [sharedX, width]);
11635
+ return /*#__PURE__*/jsx(View, {
11636
+ height: "100%",
11637
+ width: "100%",
11638
+ backgroundColor: "kitt.skeleton.backgroundColor",
11639
+ borderColor: "kitt.skeleton.flareColor",
11640
+ children: /*#__PURE__*/jsx(Animated.View, {
11641
+ style: [StyleSheet.absoluteFill, linearGradientStyle],
11642
+ children: /*#__PURE__*/jsx(LinearGradient, {
11643
+ colors: [theme.kitt.skeleton.backgroundColor, theme.kitt.skeleton.flareColor, theme.kitt.skeleton.backgroundColor],
11644
+ locations: [0.1, 0.5, 0.9],
11645
+ start: {
11646
+ x: 0,
11647
+ y: 0
11648
+ },
11649
+ end: {
11650
+ x: 1,
11651
+ y: 0
11652
+ },
11653
+ style: StyleSheet.absoluteFill
11654
+ })
11655
+ })
11510
11656
  });
11511
11657
  }
11512
11658