@ornikar/kitt-universal 7.6.0 → 7.8.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.
@@ -848,6 +848,78 @@ function Emoji({
848
848
  });
849
849
  }
850
850
 
851
+ function ExternalAppLink({
852
+ as: Component,
853
+ appScheme,
854
+ appValue,
855
+ onPress,
856
+ onOpenAppError,
857
+ ...rest
858
+ }) {
859
+ const href = `${appScheme}:${appValue}`;
860
+ return /*#__PURE__*/jsxRuntime.jsx(Component, {
861
+ href: href,
862
+ ...rest,
863
+ onPress: async e => {
864
+ try {
865
+ const canOpen = await reactNative.Linking.canOpenURL(href);
866
+
867
+ if (canOpen) {
868
+ reactNative.Linking.openURL(href).catch(err => {
869
+ console.error(`An error occurred while opening ${href}`, err);
870
+ onOpenAppError?.(`An error occurred while opening ${href}`);
871
+ });
872
+
873
+ if (onPress) {
874
+ onPress(e);
875
+ if (e?.defaultPrevented) return;
876
+ }
877
+ } else {
878
+ onOpenAppError?.(`Cannot open url: ${href}`);
879
+ }
880
+ } catch {
881
+ onOpenAppError?.('An error occured with Linkinf.canOpenURL');
882
+ }
883
+ }
884
+ });
885
+ }
886
+
887
+ ExternalAppLink.Sms = function ({
888
+ phoneNumber,
889
+ children,
890
+ ...rest
891
+ }) {
892
+ return /*#__PURE__*/jsxRuntime.jsx(ExternalAppLink, { ...rest,
893
+ appScheme: "sms",
894
+ appValue: phoneNumber,
895
+ children: children
896
+ });
897
+ };
898
+
899
+ ExternalAppLink.Tel = function ({
900
+ phoneNumber,
901
+ children,
902
+ ...rest
903
+ }) {
904
+ return /*#__PURE__*/jsxRuntime.jsx(ExternalAppLink, { ...rest,
905
+ appScheme: "tel",
906
+ appValue: phoneNumber,
907
+ children: children
908
+ });
909
+ };
910
+
911
+ ExternalAppLink.Mail = function ({
912
+ emailAddress,
913
+ children,
914
+ ...rest
915
+ }) {
916
+ return /*#__PURE__*/jsxRuntime.jsx(ExternalAppLink, { ...rest,
917
+ appScheme: "mailto",
918
+ appValue: emailAddress,
919
+ children: children
920
+ });
921
+ };
922
+
851
923
  const defaultOpenLinkBehavior = {
852
924
  native: 'openInModal',
853
925
  web: 'targetBlank'
@@ -2432,7 +2504,13 @@ const StyledTextInput = /*#__PURE__*/styled__default(reactNative.TextInput).with
2432
2504
  theme,
2433
2505
  multiline
2434
2506
  }) => {
2435
- if (!multiline && reactNative.Platform.OS !== 'web') return 0;
2507
+ const shouldHandleSingleLineOnIOS = reactNative.Platform.OS === 'ios' && !multiline; // On basic text input, we set the line-height to zero for iOS to fix vertical text alignment
2508
+ // This is a iOS only fix since having 0 as a line-height value breaks text inputs on Android
2509
+
2510
+ if (shouldHandleSingleLineOnIOS) {
2511
+ return 0;
2512
+ }
2513
+
2436
2514
  const typeConfigKey = getTypographyTypeConfigKey(theme);
2437
2515
  return `${theme.kitt.typography.types.bodies.configs.body[typeConfigKey].lineHeight}px`;
2438
2516
  }, ({
@@ -3527,28 +3605,26 @@ function Picker({
3527
3605
  variant: "bold",
3528
3606
  children: title
3529
3607
  })
3530
- }), /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
3531
- children: reactNative.Platform.OS === 'ios' ? /*#__PURE__*/jsxRuntime.jsx(picker$1.Picker, {
3532
- testID: testID,
3533
- selectedValue: value,
3534
- itemStyle: theme.picker.ios.default,
3535
- onValueChange: itemValue => setValue(itemValue),
3536
- children: React__default.Children.map(children, child => {
3537
- const item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
3538
-
3539
- return /*#__PURE__*/React.cloneElement(item, {
3540
- color: item.props.value === value ? theme.picker.ios.selected.color : undefined
3541
- });
3542
- })
3543
- }) : /*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
3544
- testID: testID,
3545
- children: React__default.Children.map(children, child => {
3546
- const item = child;
3547
- return /*#__PURE__*/React.cloneElement(item, {
3548
- onPress: newValue => setValue(newValue),
3549
- isSelected: item.props.value === value
3550
- });
3551
- })
3608
+ }), reactNative.Platform.OS === 'ios' ? /*#__PURE__*/jsxRuntime.jsx(picker$1.Picker, {
3609
+ testID: testID,
3610
+ selectedValue: value,
3611
+ itemStyle: theme.picker.ios.default,
3612
+ onValueChange: itemValue => setValue(itemValue),
3613
+ children: React__default.Children.map(children, child => {
3614
+ const item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
3615
+
3616
+ return /*#__PURE__*/React.cloneElement(item, {
3617
+ color: item.props.value === value ? theme.picker.ios.selected.color : undefined
3618
+ });
3619
+ })
3620
+ }) : /*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
3621
+ testID: testID,
3622
+ children: React__default.Children.map(children, child => {
3623
+ const item = child;
3624
+ return /*#__PURE__*/React.cloneElement(item, {
3625
+ onPress: newValue => setValue(newValue),
3626
+ isSelected: item.props.value === value
3627
+ });
3552
3628
  })
3553
3629
  }), /*#__PURE__*/jsxRuntime.jsx(Modal.Footer, {
3554
3630
  children: /*#__PURE__*/jsxRuntime.jsx(Button, {
@@ -4525,6 +4601,7 @@ exports.Card = Card;
4525
4601
  exports.Checkbox = Checkbox;
4526
4602
  exports.DatePicker = DatePicker;
4527
4603
  exports.Emoji = Emoji;
4604
+ exports.ExternalAppLink = ExternalAppLink;
4528
4605
  exports.ExternalLink = ExternalLink;
4529
4606
  exports.Flex = Flex;
4530
4607
  exports.FullScreenModal = FullScreenModal;