@ornikar/kitt-universal 31.1.2-canary.b586e0e9612495f8597e9c4be7d2c5a28baa9437.0 → 31.2.1-canary.338c0e3dad9e12a43d9c58a1a2e846e1df8c075b.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.
@@ -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: {
@@ -3941,7 +3941,7 @@ function LoaderIcon(_ref) {
3941
3941
  });
3942
3942
  }
3943
3943
 
3944
- var _excluded$L = ["as", "onPress", "disabled", "icon", "stretch"];
3944
+ var _excluded$M = ["as", "onPress", "disabled", "icon", "stretch"];
3945
3945
  var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3946
3946
  var as = _ref.as,
3947
3947
  onPress = _ref.onPress,
@@ -3952,7 +3952,7 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3952
3952
  base: true,
3953
3953
  medium: false
3954
3954
  } : _ref$stretch,
3955
- props = _objectWithoutProperties(_ref, _excluded$L);
3955
+ props = _objectWithoutProperties(_ref, _excluded$M);
3956
3956
  var _useState = useState(false),
3957
3957
  _useState2 = _slicedToArray(_useState, 2),
3958
3958
  isLoading = _useState2[0],
@@ -4030,7 +4030,7 @@ function ActionsButton(_ref) {
4030
4030
  }, props));
4031
4031
  }
4032
4032
 
4033
- var _excluded$K = ["children", "layout", "reversed"];
4033
+ var _excluded$L = ["children", "layout", "reversed"];
4034
4034
  function getCurrentLayout(layout) {
4035
4035
  if (!layout) return {
4036
4036
  base: 'stretch',
@@ -4062,7 +4062,7 @@ function Actions(_ref) {
4062
4062
  reversed = _ref$reversed === void 0 ? {
4063
4063
  base: false
4064
4064
  } : _ref$reversed,
4065
- props = _objectWithoutProperties(_ref, _excluded$K);
4065
+ props = _objectWithoutProperties(_ref, _excluded$L);
4066
4066
  var shouldReverse = typeof reversed === 'boolean' ? {
4067
4067
  base: !!reversed
4068
4068
  } : createResponsiveStyleFromProp(reversed, true, false);
@@ -4115,7 +4115,7 @@ function getInitials(firstname, lastname) {
4115
4115
  return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
4116
4116
  }
4117
4117
 
4118
- var _excluded$J = ["size", "round", "light", "sizeVariant", "width", "height", "dark", "disabled"];
4118
+ var _excluded$K = ["size", "round", "light", "sizeVariant", "width", "height", "dark", "disabled"];
4119
4119
  function AvatarContent(_ref) {
4120
4120
  var size = _ref.size,
4121
4121
  src = _ref.src,
@@ -4178,7 +4178,7 @@ function Avatar(_ref2) {
4178
4178
  height = _ref2.height,
4179
4179
  dark = _ref2.dark,
4180
4180
  disabled = _ref2.disabled,
4181
- props = _objectWithoutProperties(_ref2, _excluded$J);
4181
+ props = _objectWithoutProperties(_ref2, _excluded$K);
4182
4182
  var currentSize = getCurrentSize({
4183
4183
  size: size,
4184
4184
  sizeVariant: sizeVariant
@@ -4364,159 +4364,84 @@ var CardModalRotationContainer = /*#__PURE__*/forwardRef(function (props, ref) {
4364
4364
  }));
4365
4365
  });
4366
4366
 
4367
- function NativeOpacityAnimation(_ref) {
4368
- var visible = _ref.visible,
4369
- children = _ref.children,
4370
- onExited = _ref.onExited;
4371
- var theme = useTheme();
4372
- var hasRunAnimationRef = useRef(false);
4373
- function handleAnimationFinished() {
4374
- if (visible) {
4375
- hasRunAnimationRef.current = true;
4376
- }
4377
- if (!visible && hasRunAnimationRef.current) {
4378
- onExited();
4379
- }
4380
- }
4381
- var opacityStyle = useAnimatedStyle(function () {
4382
- var _theme$kitt$cardModal = theme.kitt.cardModal.animation.overlay,
4383
- duration = _theme$kitt$cardModal.duration,
4384
- easing = _theme$kitt$cardModal.easing;
4385
- var x1 = easing.x1,
4386
- y1 = easing.y1,
4387
- x2 = easing.x2,
4388
- y2 = easing.y2;
4389
- return {
4390
- opacity: withTiming(visible ? 1 : 0, {
4391
- duration: duration,
4392
- easing: Easing$1.bezier(x1, y1, x2, y2)
4393
- }, function (isFinished) {
4394
- if (!isFinished) return;
4395
- runOnJS(handleAnimationFinished)();
4396
- })
4397
- };
4398
- }, [visible]);
4399
- return /*#__PURE__*/jsx(Animated$1.View, {
4400
- style: [StyleSheet.absoluteFillObject, opacityStyle],
4401
- children: children
4402
- });
4403
- }
4404
-
4405
- function NativeRotationAnimation(_ref) {
4406
- var visible = _ref.visible,
4407
- children = _ref.children,
4408
- onEntered = _ref.onEntered,
4409
- onExited = _ref.onExited;
4410
- var theme = useTheme();
4411
- var hasRunAnimationRef = useRef(false);
4412
- var rotation = useSharedValue(0.8);
4413
- function handleAnimationFinished() {
4414
- if (visible) {
4415
- if (onEntered) onEntered();
4416
- hasRunAnimationRef.current = true;
4417
- }
4418
- if (!visible && hasRunAnimationRef.current) onExited();
4419
- }
4420
- var animatedStyle = useAnimatedStyle(function () {
4421
- var _theme$kitt$cardModal = theme.kitt.cardModal.animation.content,
4422
- duration = _theme$kitt$cardModal.duration,
4423
- easing = _theme$kitt$cardModal.easing;
4424
- var x1 = easing.x1,
4425
- y1 = easing.y1,
4426
- x2 = easing.x2,
4427
- y2 = easing.y2;
4428
- rotation.value = withTiming(visible ? 0 : 5, {
4429
- duration: duration,
4430
- easing: Easing$1.bezier(x1, y1, x2, y2)
4431
- }, function (isFinished) {
4432
- if (!isFinished) return;
4433
- runOnJS(handleAnimationFinished)();
4434
- });
4435
- return {
4436
- opacity: withTiming(visible ? 1 : 0, {
4437
- duration: duration,
4438
- easing: Easing$1.bezier(x1, y1, x2, y2)
4439
- }),
4440
- transform: [{
4441
- scale: withTiming(visible ? 1 : 0.8, {
4442
- duration: duration,
4443
- easing: Easing$1.bezier(x1, y1, x2, y2)
4444
- })
4445
- }, {
4446
- rotateZ: "".concat(rotation.value, "deg")
4447
- }]
4448
- };
4449
- }, [rotation, visible]);
4450
- return /*#__PURE__*/jsx(Animated$1.View, {
4451
- style: [{
4452
- flexShrink: 1
4453
- }, animatedStyle],
4454
- children: children
4455
- });
4456
- }
4457
-
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
+ };
4458
4392
  function CardModalAnimation(_ref) {
4459
- var visible = _ref.visible,
4460
- 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,
4461
4401
  onEnter = _ref.onEnter,
4462
4402
  onEntered = _ref.onEntered,
4463
4403
  onExit = _ref.onExit,
4464
4404
  onExited = _ref.onExited,
4465
- onClose = _ref.onClose;
4466
- var _useState = useState(visible),
4467
- _useState2 = _slicedToArray(_useState, 2),
4468
- isModalVisible = _useState2[0],
4469
- setIsModalVisible = _useState2[1];
4470
- var _useState3 = useState(false),
4471
- _useState4 = _slicedToArray(_useState3, 2),
4472
- isContentVisible = _useState4[0],
4473
- setIsContentVisible = _useState4[1];
4474
- var handleAnimationExited = function () {
4475
- setIsModalVisible(false);
4476
- // 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
4477
4417
  };
4478
- useEffect(function () {
4479
- if (!(!visible && isContentVisible)) return;
4480
- if (onExit) onExit();
4481
- setIsContentVisible(false);
4482
- }, [visible, isContentVisible, onExit]);
4483
- return /*#__PURE__*/jsx(Modal, {
4484
- transparent: true,
4485
- supportedOrientations: ['landscape', 'portrait'],
4486
- visible: isModalVisible,
4487
- onShow: function () {
4488
- if (onEnter) onEnter();
4489
- setIsContentVisible(true);
4490
- },
4491
- onDismiss: function () {
4492
- if (onExited) onExited();
4493
- },
4494
- children: /*#__PURE__*/jsxs(View
4495
- // This is an ugly workaround to make the Modal calculate its height correctly on Android.
4496
- // This ugly workaround is used in FullScreenModalAnimation and DialogModalAnimation as well
4497
- // TODO [expo@>=53]: Check if still needed
4498
- , {
4499
- height: undefined,
4500
- position: "relative",
4501
- flexGrow: 1,
4502
- justifyContent: "center",
4503
- alignItems: "center",
4504
- children: [/*#__PURE__*/jsx(NativeOpacityAnimation, {
4505
- visible: isContentVisible,
4506
- onExited: handleAnimationExited,
4507
- children: /*#__PURE__*/jsx(Overlay, {
4508
- onPress: onClose
4509
- })
4510
- }), /*#__PURE__*/jsx(CardModalRotationContainer, {
4511
- children: /*#__PURE__*/jsx(NativeRotationAnimation, {
4512
- visible: isContentVisible,
4513
- onExited: handleAnimationExited,
4514
- onEntered: onEntered,
4515
- children: children
4516
- })
4517
- })]
4518
- })
4519
- });
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
+ }));
4520
4445
  }
4521
4446
 
4522
4447
  var _excluded$I = ["children", "visible", "onClose", "onExited"];