@ornikar/kitt-universal 31.1.0 → 31.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/definitions/Button/Button.d.ts +5 -0
  3. package/dist/definitions/Button/Button.d.ts.map +1 -1
  4. package/dist/definitions/Button/ButtonGauge.d.ts +9 -0
  5. package/dist/definitions/Button/ButtonGauge.d.ts.map +1 -0
  6. package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts +4 -0
  7. package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts.map +1 -0
  8. package/dist/definitions/CardModal/CardModalAnimation/NativeRotationAnimation.d.ts +1 -0
  9. package/dist/definitions/CardModal/CardModalAnimation/NativeRotationAnimation.d.ts.map +1 -1
  10. package/dist/definitions/NavigationBottomSheet/NavigationBottomSheet.d.ts +3 -0
  11. package/dist/definitions/NavigationBottomSheet/NavigationBottomSheet.d.ts.map +1 -1
  12. package/dist/index-metro.es.android.js +84 -11
  13. package/dist/index-metro.es.android.js.map +1 -1
  14. package/dist/index-metro.es.ios.js +84 -11
  15. package/dist/index-metro.es.ios.js.map +1 -1
  16. package/dist/index-node-22.17.cjs.js +85 -10
  17. package/dist/index-node-22.17.cjs.js.map +1 -1
  18. package/dist/index-node-22.17.cjs.web.css +8 -0
  19. package/dist/index-node-22.17.cjs.web.js +152 -152
  20. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  21. package/dist/index-node-22.17.es.mjs +86 -11
  22. package/dist/index-node-22.17.es.mjs.map +1 -1
  23. package/dist/index-node-22.17.es.web.css +8 -0
  24. package/dist/index-node-22.17.es.web.mjs +153 -153
  25. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  26. package/dist/index.es.js +87 -11
  27. package/dist/index.es.js.map +1 -1
  28. package/dist/index.es.web.js +168 -167
  29. package/dist/index.es.web.js.map +1 -1
  30. package/dist/styles.css +8 -0
  31. package/dist/tsbuildinfo +1 -1
  32. package/package.json +2 -1
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { useContext, createContext, forwardRef, useMemo, cloneElement, useRef, useEffect, useState, Children, useReducer, useCallback, Fragment as Fragment$1 } from 'react';
3
+ import { useContext, createContext, forwardRef, useMemo, cloneElement, useState, useRef, useCallback, useLayoutEffect, useEffect, Children, useReducer, Fragment as Fragment$1 } from 'react';
4
4
  import { View as View$1, ScrollView as ScrollView$1, Pressable as Pressable$1, Image as Image$1, FlatList as FlatList$1, SectionList as SectionList$1, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, Center as Center$1, useBreakpointValue as useBreakpointValue$1, useSx, Text, Input, NativeBaseProvider, extendTheme } from 'native-base';
5
5
  export { useClipboard, useContrastText, useMediaQuery, useSx, useToken } from 'native-base';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -11,10 +11,9 @@ import _typeof from '@babel/runtime/helpers/typeof';
11
11
  import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
12
12
  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
- import { Animated, Easing, StyleSheet, Modal, ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
14
+ import { Animated, Easing, ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, StyleSheet, useWindowDimensions } from 'react-native';
15
15
  export { useWindowDimensions as useWindowSize } from 'react-native';
16
16
  import { createPortal } from 'react-dom';
17
- import Animated$1, { useAnimatedStyle, withTiming, Easing as Easing$1, runOnJS, useSharedValue, withSpring, interpolateColor, useAnimatedProps, withDelay, withRepeat, interpolate, ReducedMotionConfig, ReduceMotion } from 'react-native-reanimated';
18
17
  import { CSSTransition } from 'react-transition-group';
19
18
  import { parse } from '@twemoji/parser';
20
19
  import Downshift, { useSelect } from 'downshift';
@@ -23,6 +22,7 @@ import { launchImageLibraryAsync } from 'expo-image-picker';
23
22
  import { useDebouncedCallback } from 'use-debounce';
24
23
  import { Loader } from '@googlemaps/js-api-loader';
25
24
  import { parseNumber, getCountryCallingCode, isValidNumber } from 'libphonenumber-js';
25
+ import Animated$1, { useAnimatedStyle, withSpring, withTiming, useSharedValue, interpolateColor, Easing as Easing$1, useAnimatedProps, withDelay, withRepeat, interpolate, runOnJS, ReducedMotionConfig, ReduceMotion } from 'react-native-reanimated';
26
26
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
27
27
  import Svg, { Circle as Circle$1 } from 'react-native-svg';
28
28
  import { useFloating, autoUpdate, offset, autoPlacement, shift, arrow } from '@floating-ui/react-dom';
@@ -2863,7 +2863,7 @@ function ActionCardDisabled(_ref) {
2863
2863
  });
2864
2864
  }
2865
2865
 
2866
- var _excluded$P = ["children", "variant", "borderVariant", "borderRadius", "disabled", "isHovered", "isPressed", "isFocused"];
2866
+ var _excluded$Q = ["children", "variant", "borderVariant", "borderRadius", "disabled", "isHovered", "isPressed", "isFocused"];
2867
2867
  function ActionCard(_ref) {
2868
2868
  var children = _ref.children,
2869
2869
  _ref$variant = _ref.variant,
@@ -2876,7 +2876,7 @@ function ActionCard(_ref) {
2876
2876
  isHovered = _ref.isHovered,
2877
2877
  isPressed = _ref.isPressed,
2878
2878
  isFocused = _ref.isFocused,
2879
- props = _objectWithoutProperties(_ref, _excluded$P);
2879
+ props = _objectWithoutProperties(_ref, _excluded$Q);
2880
2880
  return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), {}, {
2881
2881
  children: disabled ? /*#__PURE__*/jsx(ActionCardDisabled, {
2882
2882
  borderRadius: borderRadius,
@@ -3208,7 +3208,7 @@ var getTypographyTypeWithAncestorValue = function (type, typographyTypeInContext
3208
3208
  return !!isAllValuesUndefined && !!typographyTypeInContext ? typographyTypeInContext : type;
3209
3209
  };
3210
3210
 
3211
- var _excluded$O = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
3211
+ var _excluded$P = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
3212
3212
  var TypographyFamilyContext = /*#__PURE__*/createContext(null);
3213
3213
  var TypographyTypeContext = /*#__PURE__*/createContext(null);
3214
3214
  var TypographyVariantContext = /*#__PURE__*/createContext(undefined);
@@ -3333,7 +3333,7 @@ var TypographyBase = /*#__PURE__*/forwardRef(function (_ref2, ref) {
3333
3333
  } : _ref2$type,
3334
3334
  variant = _ref2.variant,
3335
3335
  color = _ref2.color,
3336
- otherProps = _objectWithoutProperties(_ref2, _excluded$O);
3336
+ otherProps = _objectWithoutProperties(_ref2, _excluded$P);
3337
3337
  var sx = useSx();
3338
3338
 
3339
3339
  // ancestors
@@ -3495,12 +3495,12 @@ function Icon(_ref) {
3495
3495
  });
3496
3496
  }
3497
3497
 
3498
- var _excluded$N = ["color", "size"],
3498
+ var _excluded$O = ["color", "size"],
3499
3499
  _excluded2$6 = ["color"];
3500
3500
  function TypographyIconSpecifiedColor(_ref) {
3501
3501
  var color = _ref.color,
3502
3502
  size = _ref.size,
3503
- props = _objectWithoutProperties(_ref, _excluded$N);
3503
+ props = _objectWithoutProperties(_ref, _excluded$O);
3504
3504
  var colorValue = getTypographyColorValue(color);
3505
3505
  var sx = useSx();
3506
3506
  var _sx = sx({
@@ -3540,7 +3540,7 @@ var getButtonTextColorByType = function (type, variant, isHovered, isPressed, is
3540
3540
  return "".concat(baseKey, ".default");
3541
3541
  };
3542
3542
 
3543
- var _excluded$M = ["type", "variant", "isDisabled", "icon", "children", "isHovered", "isPressed", "isFocused", "innerSpacing", "size"];
3543
+ var _excluded$N = ["type", "variant", "isDisabled", "icon", "children", "isHovered", "isPressed", "isFocused", "innerSpacing", "size"];
3544
3544
  function ButtonContentChildren(_ref) {
3545
3545
  var type = _ref.type,
3546
3546
  icon = _ref.icon,
@@ -3640,7 +3640,7 @@ function ButtonContent(_ref2) {
3640
3640
  _ref2.isFocused;
3641
3641
  var innerSpacing = _ref2.innerSpacing,
3642
3642
  size = _ref2.size,
3643
- props = _objectWithoutProperties(_ref2, _excluded$M);
3643
+ props = _objectWithoutProperties(_ref2, _excluded$N);
3644
3644
  var color = getButtonTextColorByType(type, variant, isHovered, isPressed, isDisabled);
3645
3645
  return /*#__PURE__*/jsx(View, {
3646
3646
  _web: {
@@ -3665,6 +3665,81 @@ function ButtonContent(_ref2) {
3665
3665
  });
3666
3666
  }
3667
3667
 
3668
+ function ButtonGauge(_ref) {
3669
+ var duration = _ref.duration,
3670
+ running = _ref.running,
3671
+ onEnded = _ref.onEnded;
3672
+ var _useState = useState(100),
3673
+ _useState2 = _slicedToArray(_useState, 2),
3674
+ translate = _useState2[0],
3675
+ setTranslate = _useState2[1];
3676
+ var startTimeRef = useRef(0);
3677
+ var pauseTimeRef = useRef(0);
3678
+ var rafRef = useRef(undefined);
3679
+ var distance = 100;
3680
+ var draw = useCallback(function (timestamp) {
3681
+ var timeElapsedSinceStart = timestamp - startTimeRef.current;
3682
+ // Since the time between frame is not reliable and regular, we have to
3683
+ // limit the progress to prevent overflows
3684
+ var safeProgress = Math.min(distance * timeElapsedSinceStart / duration, distance);
3685
+ setTranslate(safeProgress);
3686
+ if (safeProgress < distance) {
3687
+ if (!rafRef) return;
3688
+ rafRef.current = requestAnimationFrame(draw);
3689
+ return;
3690
+ }
3691
+ onEnded();
3692
+ if (rafRef.current) {
3693
+ cancelAnimationFrame(rafRef.current);
3694
+ }
3695
+ },
3696
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3697
+ []);
3698
+ useLayoutEffect(function () {
3699
+ if (running) {
3700
+ // Resuming from pause
3701
+ if (pauseTimeRef.current > 0) {
3702
+ startTimeRef.current += global.performance.now() - pauseTimeRef.current;
3703
+ draw(global.performance.now());
3704
+ return;
3705
+ }
3706
+
3707
+ // First launch
3708
+ startTimeRef.current = global.performance.now();
3709
+ draw(startTimeRef.current);
3710
+ }
3711
+
3712
+ // On pause
3713
+ if (!running && rafRef.current) {
3714
+ pauseTimeRef.current = global.performance.now();
3715
+ cancelAnimationFrame(rafRef.current);
3716
+ }
3717
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3718
+ }, [running]);
3719
+ useEffect(function () {
3720
+ return function () {
3721
+ if (rafRef.current) {
3722
+ cancelAnimationFrame(rafRef.current);
3723
+ }
3724
+ };
3725
+ }, []);
3726
+ return /*#__PURE__*/jsx(View, {
3727
+ position: "absolute",
3728
+ left: 0,
3729
+ right: 0,
3730
+ top: 0,
3731
+ bottom: 0,
3732
+ overflow: "hidden",
3733
+ alignItems: "flex-end",
3734
+ borderRadius: "kitt.button.borderRadius",
3735
+ children: /*#__PURE__*/jsx(View, {
3736
+ width: "".concat(translate, "%"),
3737
+ height: "100%",
3738
+ backgroundColor: "kitt.palettes.deepPurple['white-alpha.20']"
3739
+ })
3740
+ });
3741
+ }
3742
+
3668
3743
  function ButtonPadding(_ref) {
3669
3744
  var children = _ref.children,
3670
3745
  size = _ref.size,
@@ -3736,6 +3811,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3736
3811
  hrefAttrs = _ref.hrefAttrs,
3737
3812
  withBadge = _ref.withBadge,
3738
3813
  badgeCount = _ref.badgeCount,
3814
+ timerAttrs = _ref.timerAttrs,
3739
3815
  _ref$accessibilityRol = _ref.accessibilityRole,
3740
3816
  accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
3741
3817
  _ref$innerSpacing = _ref.innerSpacing,
@@ -3780,7 +3856,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3780
3856
  var isHovered = _ref2.isHovered,
3781
3857
  isPressed = _ref2.isPressed,
3782
3858
  isFocused = _ref2.isFocused;
3783
- return /*#__PURE__*/jsx(AnimatedContainer$2, {
3859
+ return /*#__PURE__*/jsxs(AnimatedContainer$2, {
3784
3860
  animatedStyles: animatedStyles,
3785
3861
  type: type,
3786
3862
  isHovered: isHovered || isHoveredInternal,
@@ -3790,7 +3866,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3790
3866
  size: size,
3791
3867
  isIconOnly: isIconOnly,
3792
3868
  isStretch: stretch,
3793
- children: /*#__PURE__*/jsxs(ButtonPadding, {
3869
+ children: [timerAttrs ? /*#__PURE__*/jsx(ButtonGauge, _objectSpread({}, timerAttrs)) : null, /*#__PURE__*/jsxs(ButtonPadding, {
3794
3870
  size: size,
3795
3871
  isIconOnly: isIconOnly,
3796
3872
  children: [/*#__PURE__*/jsx(ButtonContent, {
@@ -3812,7 +3888,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3812
3888
  isHovered: isHovered,
3813
3889
  isPressed: isPressed
3814
3890
  })]
3815
- })
3891
+ })]
3816
3892
  });
3817
3893
  }
3818
3894
  });
@@ -3865,7 +3941,7 @@ function LoaderIcon(_ref) {
3865
3941
  });
3866
3942
  }
3867
3943
 
3868
- var _excluded$L = ["as", "onPress", "disabled", "icon", "stretch"];
3944
+ var _excluded$M = ["as", "onPress", "disabled", "icon", "stretch"];
3869
3945
  var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3870
3946
  var as = _ref.as,
3871
3947
  onPress = _ref.onPress,
@@ -3876,7 +3952,7 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3876
3952
  base: true,
3877
3953
  medium: false
3878
3954
  } : _ref$stretch,
3879
- props = _objectWithoutProperties(_ref, _excluded$L);
3955
+ props = _objectWithoutProperties(_ref, _excluded$M);
3880
3956
  var _useState = useState(false),
3881
3957
  _useState2 = _slicedToArray(_useState, 2),
3882
3958
  isLoading = _useState2[0],
@@ -3954,7 +4030,7 @@ function ActionsButton(_ref) {
3954
4030
  }, props));
3955
4031
  }
3956
4032
 
3957
- var _excluded$K = ["children", "layout", "reversed"];
4033
+ var _excluded$L = ["children", "layout", "reversed"];
3958
4034
  function getCurrentLayout(layout) {
3959
4035
  if (!layout) return {
3960
4036
  base: 'stretch',
@@ -3986,7 +4062,7 @@ function Actions(_ref) {
3986
4062
  reversed = _ref$reversed === void 0 ? {
3987
4063
  base: false
3988
4064
  } : _ref$reversed,
3989
- props = _objectWithoutProperties(_ref, _excluded$K);
4065
+ props = _objectWithoutProperties(_ref, _excluded$L);
3990
4066
  var shouldReverse = typeof reversed === 'boolean' ? {
3991
4067
  base: !!reversed
3992
4068
  } : createResponsiveStyleFromProp(reversed, true, false);
@@ -4039,7 +4115,7 @@ function getInitials(firstname, lastname) {
4039
4115
  return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
4040
4116
  }
4041
4117
 
4042
- var _excluded$J = ["size", "round", "light", "sizeVariant", "width", "height", "dark", "disabled"];
4118
+ var _excluded$K = ["size", "round", "light", "sizeVariant", "width", "height", "dark", "disabled"];
4043
4119
  function AvatarContent(_ref) {
4044
4120
  var size = _ref.size,
4045
4121
  src = _ref.src,
@@ -4102,7 +4178,7 @@ function Avatar(_ref2) {
4102
4178
  height = _ref2.height,
4103
4179
  dark = _ref2.dark,
4104
4180
  disabled = _ref2.disabled,
4105
- props = _objectWithoutProperties(_ref2, _excluded$J);
4181
+ props = _objectWithoutProperties(_ref2, _excluded$K);
4106
4182
  var currentSize = getCurrentSize({
4107
4183
  size: size,
4108
4184
  sizeVariant: sizeVariant
@@ -4288,159 +4364,84 @@ var CardModalRotationContainer = /*#__PURE__*/forwardRef(function (props, ref) {
4288
4364
  }));
4289
4365
  });
4290
4366
 
4291
- function NativeOpacityAnimation(_ref) {
4292
- var visible = _ref.visible,
4293
- children = _ref.children,
4294
- onExited = _ref.onExited;
4295
- var theme = useTheme();
4296
- var hasRunAnimationRef = useRef(false);
4297
- function handleAnimationFinished() {
4298
- if (visible) {
4299
- hasRunAnimationRef.current = true;
4300
- }
4301
- if (!visible && hasRunAnimationRef.current) {
4302
- onExited();
4303
- }
4304
- }
4305
- var opacityStyle = useAnimatedStyle(function () {
4306
- var _theme$kitt$cardModal = theme.kitt.cardModal.animation.overlay,
4307
- duration = _theme$kitt$cardModal.duration,
4308
- easing = _theme$kitt$cardModal.easing;
4309
- var x1 = easing.x1,
4310
- y1 = easing.y1,
4311
- x2 = easing.x2,
4312
- y2 = easing.y2;
4313
- return {
4314
- opacity: withTiming(visible ? 1 : 0, {
4315
- duration: duration,
4316
- easing: Easing$1.bezier(x1, y1, x2, y2)
4317
- }, function (isFinished) {
4318
- if (!isFinished) return;
4319
- runOnJS(handleAnimationFinished)();
4320
- })
4321
- };
4322
- }, [visible]);
4323
- return /*#__PURE__*/jsx(Animated$1.View, {
4324
- style: [StyleSheet.absoluteFillObject, opacityStyle],
4325
- children: children
4326
- });
4327
- }
4328
-
4329
- function NativeRotationAnimation(_ref) {
4330
- var visible = _ref.visible,
4331
- children = _ref.children,
4332
- onEntered = _ref.onEntered,
4333
- onExited = _ref.onExited;
4334
- var theme = useTheme();
4335
- var hasRunAnimationRef = useRef(false);
4336
- var rotation = useSharedValue(0.8);
4337
- function handleAnimationFinished() {
4338
- if (visible) {
4339
- if (onEntered) onEntered();
4340
- hasRunAnimationRef.current = true;
4341
- }
4342
- if (!visible && hasRunAnimationRef.current) onExited();
4343
- }
4344
- var animatedStyle = useAnimatedStyle(function () {
4345
- var _theme$kitt$cardModal = theme.kitt.cardModal.animation.content,
4346
- duration = _theme$kitt$cardModal.duration,
4347
- easing = _theme$kitt$cardModal.easing;
4348
- var x1 = easing.x1,
4349
- y1 = easing.y1,
4350
- x2 = easing.x2,
4351
- y2 = easing.y2;
4352
- rotation.value = withTiming(visible ? 0 : 5, {
4353
- duration: duration,
4354
- easing: Easing$1.bezier(x1, y1, x2, y2)
4355
- }, function (isFinished) {
4356
- if (!isFinished) return;
4357
- runOnJS(handleAnimationFinished)();
4358
- });
4359
- return {
4360
- opacity: withTiming(visible ? 1 : 0, {
4361
- duration: duration,
4362
- easing: Easing$1.bezier(x1, y1, x2, y2)
4363
- }),
4364
- transform: [{
4365
- scale: withTiming(visible ? 1 : 0.8, {
4366
- duration: duration,
4367
- easing: Easing$1.bezier(x1, y1, x2, y2)
4368
- })
4369
- }, {
4370
- rotateZ: "".concat(rotation.value, "deg")
4371
- }]
4372
- };
4373
- }, [rotation, visible]);
4374
- return /*#__PURE__*/jsx(Animated$1.View, {
4375
- style: [{
4376
- flexShrink: 1
4377
- }, animatedStyle],
4378
- children: children
4379
- });
4380
- }
4381
-
4367
+ var _excluded$J = ["children", "appear", "visible", "unmountOnExit", "isAnimationEnabled", "onEnter", "onEntered", "onExit", "onExited", "onClose"];
4368
+ var contentAnimationEnter$1 = "kitt-u_contentAnimationEnter_c11xxy4r";
4369
+ var contentAnimatioEnterActive$1 = "kitt-u_contentAnimatioEnterActive_cl52117";
4370
+ var contentAnimatioExit$1 = "kitt-u_contentAnimatioExit_cyjczep";
4371
+ var contentAnimatioExitActive$1 = "kitt-u_contentAnimatioExitActive_cpsy3dt";
4372
+ var contentAnimationClassNames$1 = {
4373
+ appear: contentAnimationEnter$1,
4374
+ appearActive: contentAnimatioEnterActive$1,
4375
+ enter: contentAnimationEnter$1,
4376
+ enterActive: contentAnimatioEnterActive$1,
4377
+ exit: contentAnimatioExit$1,
4378
+ exitActive: contentAnimatioExitActive$1
4379
+ };
4380
+ var opacityEnter$2 = "kitt-u_opacityEnter_o1ae40dx";
4381
+ var opacityEnterActive$2 = "kitt-u_opacityEnterActive_o1t4vl7b";
4382
+ var opacityExit$2 = "kitt-u_opacityExit_ogyytm1";
4383
+ var opacityExitActive$2 = "kitt-u_opacityExitActive_o18xvk52";
4384
+ var opacityClassNames$2 = {
4385
+ appear: opacityEnter$2,
4386
+ appearActive: opacityEnterActive$2,
4387
+ enter: opacityEnter$2,
4388
+ enterActive: opacityEnterActive$2,
4389
+ exit: opacityExit$2,
4390
+ exitActive: opacityExitActive$2
4391
+ };
4382
4392
  function CardModalAnimation(_ref) {
4383
- var visible = _ref.visible,
4384
- children = _ref.children,
4393
+ var children = _ref.children,
4394
+ _ref$appear = _ref.appear,
4395
+ appear = _ref$appear === void 0 ? true : _ref$appear,
4396
+ visible = _ref.visible,
4397
+ _ref$unmountOnExit = _ref.unmountOnExit,
4398
+ unmountOnExit = _ref$unmountOnExit === void 0 ? true : _ref$unmountOnExit,
4399
+ _ref$isAnimationEnabl = _ref.isAnimationEnabled,
4400
+ isAnimationEnabled = _ref$isAnimationEnabl === void 0 ? true : _ref$isAnimationEnabl,
4385
4401
  onEnter = _ref.onEnter,
4386
4402
  onEntered = _ref.onEntered,
4387
4403
  onExit = _ref.onExit,
4388
4404
  onExited = _ref.onExited,
4389
- onClose = _ref.onClose;
4390
- var _useState = useState(visible),
4391
- _useState2 = _slicedToArray(_useState, 2),
4392
- isModalVisible = _useState2[0],
4393
- setIsModalVisible = _useState2[1];
4394
- var _useState3 = useState(false),
4395
- _useState4 = _slicedToArray(_useState3, 2),
4396
- isContentVisible = _useState4[0],
4397
- setIsContentVisible = _useState4[1];
4398
- var handleAnimationExited = function () {
4399
- setIsModalVisible(false);
4400
- // Android doesn't handle the onDismiss callback on the modal, we need to call it manually
4405
+ onClose = _ref.onClose,
4406
+ props = _objectWithoutProperties(_ref, _excluded$J);
4407
+ // React 19 has removed the ReactDOM.findDOMNode method. We need to use refs to access DOM nodes in CSSTransition.
4408
+ // See https://github.com/reactjs/react-transition-group/issues/918
4409
+ var overlayRef = useRef(null);
4410
+ var contentRef = useRef(null);
4411
+ var theme = useTheme();
4412
+ var animation = theme.kitt.cardModal.animation;
4413
+ var sharedProps = {
4414
+ "in": visible,
4415
+ appear: appear,
4416
+ unmountOnExit: unmountOnExit
4401
4417
  };
4402
- useEffect(function () {
4403
- if (!(!visible && isContentVisible)) return;
4404
- if (onExit) onExit();
4405
- setIsContentVisible(false);
4406
- }, [visible, isContentVisible, onExit]);
4407
- return /*#__PURE__*/jsx(Modal, {
4408
- transparent: true,
4409
- supportedOrientations: ['landscape', 'portrait'],
4410
- visible: isModalVisible,
4411
- onShow: function () {
4412
- if (onEnter) onEnter();
4413
- setIsContentVisible(true);
4414
- },
4415
- onDismiss: function () {
4416
- if (onExited) onExited();
4417
- },
4418
- children: /*#__PURE__*/jsxs(View
4419
- // This is an ugly workaround to make the Modal calculate its height correctly on Android.
4420
- // This ugly workaround is used in FullScreenModalAnimation and DialogModalAnimation as well
4421
- // TODO [expo@>=53]: Check if still needed
4422
- , {
4423
- height: undefined,
4424
- position: "relative",
4425
- flexGrow: 1,
4426
- justifyContent: "center",
4427
- alignItems: "center",
4428
- children: [/*#__PURE__*/jsx(NativeOpacityAnimation, {
4429
- visible: isContentVisible,
4430
- onExited: handleAnimationExited,
4431
- children: /*#__PURE__*/jsx(Overlay, {
4432
- onPress: onClose
4433
- })
4434
- }), /*#__PURE__*/jsx(CardModalRotationContainer, {
4435
- children: /*#__PURE__*/jsx(NativeRotationAnimation, {
4436
- visible: isContentVisible,
4437
- onExited: handleAnimationExited,
4438
- onEntered: onEntered,
4439
- children: children
4440
- })
4441
- })]
4442
- })
4443
- });
4418
+ return /*#__PURE__*/jsxs(View, _objectSpread(_objectSpread({}, props), {}, {
4419
+ height: "100%",
4420
+ justifyContent: "center",
4421
+ children: [/*#__PURE__*/jsx(CSSTransition, _objectSpread(_objectSpread({}, sharedProps), {}, {
4422
+ nodeRef: overlayRef,
4423
+ timeout: isAnimationEnabled ? animation.overlay.duration : 0,
4424
+ classNames: opacityClassNames$2,
4425
+ children: /*#__PURE__*/jsx(Overlay, {
4426
+ ref: overlayRef,
4427
+ onPress: onClose
4428
+ })
4429
+ })), /*#__PURE__*/jsx(CSSTransition, _objectSpread(_objectSpread({}, sharedProps), {}, {
4430
+ nodeRef: contentRef,
4431
+ timeout: isAnimationEnabled ? animation.content.duration : 0,
4432
+ classNames: contentAnimationClassNames$1,
4433
+ onEnter: onEnter,
4434
+ onEntered: onEntered,
4435
+ onExit: onExit,
4436
+ onExited: onExited,
4437
+ children: /*#__PURE__*/jsx(CardModalRotationContainer, {
4438
+ ref: contentRef,
4439
+ alignItems: "center",
4440
+ margin: "auto",
4441
+ children: children
4442
+ })
4443
+ }))]
4444
+ }));
4444
4445
  }
4445
4446
 
4446
4447
  var _excluded$I = ["children", "visible", "onClose", "onExited"];