@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.
@@ -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,8 +22,9 @@ 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, runOnJS, interpolate } 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';
29
30
  import { makeDecorator } from '@storybook/addons';
@@ -11138,46 +11139,155 @@ function Notification(_ref) {
11138
11139
  });
11139
11140
  }
11140
11141
 
11141
- var pageLoaderContainer = "kitt-u_pageLoaderContainer_ptkwz2j";
11142
- function PageLoader() {
11142
+ var AnimatedCircle = Animated.createAnimatedComponent(Circle$1);
11143
+ function AnimatedLoaderCircle(_ref) {
11144
+ var color = _ref.color,
11145
+ progress = _ref.progress;
11143
11146
  var theme = useTheme();
11144
11147
  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',
11148
+ strokeWidth = _theme$kitt$pageLoade.strokeWidth,
11149
+ size = _theme$kitt$pageLoade.size;
11150
+ var centerCoord = size * 0.5;
11151
+ var circlePerimeter = 2 * Math.PI * (size * 0.5 - strokeWidth);
11152
+ var strokeAnimation = useAnimatedProps(function () {
11153
+ return {
11154
+ strokeDashoffset: circlePerimeter - circlePerimeter * progress.value
11155
+ };
11156
+ }, [progress, circlePerimeter]);
11157
+ return /*#__PURE__*/jsx(AnimatedCircle, {
11158
+ "transform-origin": "center center",
11156
11159
  strokeWidth: strokeWidth,
11160
+ stroke: color,
11161
+ strokeLinecap: "round",
11162
+ cx: centerCoord,
11163
+ cy: centerCoord,
11164
+ r: centerCoord - strokeWidth,
11165
+ fill: "none",
11157
11166
  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
- })]
11167
+ animatedProps: strokeAnimation
11168
+ });
11169
+ }
11170
+
11171
+ function AnimatedBackgroundCircle() {
11172
+ var theme = useTheme();
11173
+ var progress = useSharedValue(0);
11174
+ var _theme$kitt$pageLoade = theme.kitt.pageLoader,
11175
+ animation = _theme$kitt$pageLoade.animation,
11176
+ colors = _theme$kitt$pageLoade.colors,
11177
+ size = _theme$kitt$pageLoade.size;
11178
+ useEffect(function () {
11179
+ var delay = animation.delay,
11180
+ circleBackgroundFillDuration = animation.circleBackgroundFillDuration,
11181
+ fillEasingFunction = animation.fillEasingFunction;
11182
+ var _fillEasingFunction = _slicedToArray(fillEasingFunction, 4),
11183
+ x1 = _fillEasingFunction[0],
11184
+ y1 = _fillEasingFunction[1],
11185
+ x2 = _fillEasingFunction[2],
11186
+ y2 = _fillEasingFunction[3];
11187
+ progress.value = withDelay(delay, withTiming(1, {
11188
+ duration: circleBackgroundFillDuration,
11189
+ easing: Easing.bezier(x1, y1, x2, y2)
11190
+ }));
11191
+ }, [progress, animation]);
11192
+ return /*#__PURE__*/jsx(Svg, {
11193
+ width: size,
11194
+ height: size,
11195
+ viewBox: "0 0 ".concat(size, " ").concat(size),
11196
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11197
+ color: colors.base,
11198
+ progress: progress
11199
+ })
11200
+ });
11201
+ }
11202
+
11203
+ var isInfinitAnimation$1 = -1;
11204
+ function AnimatedFillCircleContainer(_ref) {
11205
+ var children = _ref.children,
11206
+ duration = _ref.duration;
11207
+ var theme = useTheme();
11208
+ var progress = useSharedValue(0);
11209
+ var animation = theme.kitt.pageLoader.animation;
11210
+ useEffect(function () {
11211
+ var delay = animation.delay;
11212
+ progress.value = withDelay(delay, withRepeat(withTiming(1, {
11213
+ duration: duration,
11214
+ easing: Easing.linear
11215
+ }), isInfinitAnimation$1));
11216
+ }, [progress, animation, duration]);
11217
+ var rotationStyles = useAnimatedStyle(function () {
11218
+ return {
11219
+ transform: [{
11220
+ rotate: "".concat(360 * progress.value, "deg")
11221
+ }]
11222
+ };
11223
+ }, [progress]);
11224
+ return /*#__PURE__*/jsx(Animated.View, {
11225
+ style: [StyleSheet.absoluteFill, rotationStyles],
11226
+ children: children
11227
+ });
11228
+ }
11229
+
11230
+ var isInfinitAnimation = -1;
11231
+ var shouldReverse = true;
11232
+ function AnimatedFilledCircle() {
11233
+ var theme = useTheme();
11234
+ var progress = useSharedValue(0);
11235
+ var _theme$kitt$pageLoade = theme.kitt.pageLoader,
11236
+ size = _theme$kitt$pageLoade.size,
11237
+ animation = _theme$kitt$pageLoade.animation,
11238
+ colors = _theme$kitt$pageLoade.colors;
11239
+ useEffect(function () {
11240
+ var delay = animation.delay,
11241
+ filledCircleFillDuration = animation.filledCircleFillDuration,
11242
+ fillEasingFunction = animation.fillEasingFunction;
11243
+ var _fillEasingFunction = _slicedToArray(fillEasingFunction, 4),
11244
+ x1 = _fillEasingFunction[0],
11245
+ y1 = _fillEasingFunction[1],
11246
+ x2 = _fillEasingFunction[2],
11247
+ y2 = _fillEasingFunction[3];
11248
+ progress.value = withDelay(delay, withRepeat(withTiming(0.8, {
11249
+ duration: filledCircleFillDuration,
11250
+ easing: Easing.bezier(x1, y1, x2, y2)
11251
+ }), isInfinitAnimation, shouldReverse));
11252
+ }, [progress, animation]);
11253
+ return /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11254
+ duration: animation.groupFilledCircleRotationDuration,
11255
+ children: /*#__PURE__*/jsx(AnimatedFillCircleContainer, {
11256
+ duration: animation.filledCircleRotationDuration,
11257
+ children: /*#__PURE__*/jsx(Svg, {
11258
+ width: size,
11259
+ height: size,
11260
+ viewBox: "0 0 ".concat(size, " ").concat(size),
11261
+ children: /*#__PURE__*/jsx(AnimatedLoaderCircle, {
11262
+ color: colors.fill,
11263
+ progress: progress
11264
+ })
11265
+ })
11177
11266
  })
11178
11267
  });
11179
11268
  }
11180
11269
 
11270
+ function PageLoader() {
11271
+ var sharedTransformStyle = {
11272
+ style: {
11273
+ /* Needed to make the animation starting from the top of the circles */
11274
+ transform: [{
11275
+ rotate: '90deg'
11276
+ }, {
11277
+ scale: -1
11278
+ }]
11279
+ }
11280
+ };
11281
+ return /*#__PURE__*/jsxs(View, {
11282
+ position: "relative",
11283
+ height: "kitt.pageLoader.size",
11284
+ width: "kitt.pageLoader.size",
11285
+ _ios: sharedTransformStyle,
11286
+ _android: sharedTransformStyle,
11287
+ children: [/*#__PURE__*/jsx(AnimatedBackgroundCircle, {}), /*#__PURE__*/jsx(AnimatedFilledCircle, {})]
11288
+ });
11289
+ }
11290
+
11181
11291
  function getBackgroundColor(_ref) {
11182
11292
  var isSelected = _ref.isSelected,
11183
11293
  isHighlighted = _ref.isHighlighted,