@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.
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { View, Text as Text$1, useWindowDimensions, Image, Pressable, TextInput, StyleSheet, ScrollView, Modal as Modal$1 } from 'react-native';
3
+ import { View, Text as Text$1, useWindowDimensions, Image, Pressable, Linking, TextInput, StyleSheet, ScrollView, Modal as Modal$1 } from 'react-native';
4
4
  export { useWindowDimensions as useWindowSize } from 'react-native';
5
5
  import { UserIcon, CheckboxMark, EyeOffIcon, EyeIcon, ArcIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, XIcon, TooltipArrowIcon } from '@ornikar/kitt-icons';
6
6
  export * from '@ornikar/kitt-icons';
@@ -10,6 +10,8 @@ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
10
10
  import { styled as styled$1 } from '@linaria/react';
11
11
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
12
12
  import { parse } from 'twemoji-parser';
13
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
14
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
13
15
  import _extends from '@babel/runtime/helpers/extends';
14
16
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
15
17
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -99,7 +101,7 @@ var KittBreakpointsMax = {
99
101
  LARGE: KittBreakpoints.WIDE - 1
100
102
  };
101
103
 
102
- var _excluded$g = ["accessibilityRole", "base", "small", "medium", "large", "variant", "color", "textAlign"];
104
+ var _excluded$h = ["accessibilityRole", "base", "small", "medium", "large", "variant", "color", "textAlign"];
103
105
  var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
104
106
  var TypographyColorContext = /*#__PURE__*/createContext('black');
105
107
  function useTypographyColor() {
@@ -182,7 +184,7 @@ function Typography(_ref5) {
182
184
  variant = _ref5.variant,
183
185
  color = _ref5.color,
184
186
  textAlign = _ref5.textAlign,
185
- otherProps = _objectWithoutProperties(_ref5, _excluded$g);
187
+ otherProps = _objectWithoutProperties(_ref5, _excluded$h);
186
188
 
187
189
  var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
188
190
  var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
@@ -270,7 +272,7 @@ Typography.h4 = createHeading(4, 'header4');
270
272
 
271
273
  Typography.h5 = createHeading(5, 'header5');
272
274
 
273
- var _excluded$f = ["size", "round", "light", "sizeVariant"];
275
+ var _excluded$g = ["size", "round", "light", "sizeVariant"];
274
276
 
275
277
  var getInitials = function (firstname, lastname) {
276
278
  return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
@@ -342,7 +344,7 @@ function Avatar(_ref6) {
342
344
  round = _ref6.round,
343
345
  light = _ref6.light,
344
346
  sizeVariant = _ref6.sizeVariant,
345
- props = _objectWithoutProperties(_ref6, _excluded$f);
347
+ props = _objectWithoutProperties(_ref6, _excluded$g);
346
348
 
347
349
  return /*#__PURE__*/jsx(StyledAvatarView, {
348
350
  $size: size,
@@ -396,7 +398,7 @@ function isSubtle(type) {
396
398
  return type.startsWith('subtle');
397
399
  }
398
400
 
399
- var _excluded$e = ["$type", "$variant", "$isStretch", "disabled"];
401
+ var _excluded$f = ["$type", "$variant", "$isStretch", "disabled"];
400
402
  var AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/styled$1("div")({
401
403
  name: "AnimatedButtonPressableContainer",
402
404
  "class": "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
@@ -510,7 +512,7 @@ var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref18, ref) {
510
512
  $variant = _ref18.$variant,
511
513
  $isStretch = _ref18.$isStretch,
512
514
  disabled = _ref18.disabled,
513
- props = _objectWithoutProperties(_ref18, _excluded$e);
515
+ props = _objectWithoutProperties(_ref18, _excluded$f);
514
516
 
515
517
  return /*#__PURE__*/jsx(AnimatedButtonPressableContainer, {
516
518
  ref: ref,
@@ -566,12 +568,12 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled(View).withConfig({
566
568
  return defaultPadding;
567
569
  });
568
570
 
569
- var _excluded$d = ["color"],
570
- _excluded2$2 = ["color"];
571
+ var _excluded$e = ["color"],
572
+ _excluded2$3 = ["color"];
571
573
 
572
574
  function TypographyIconSpecifiedColor(_ref) {
573
575
  var color = _ref.color,
574
- props = _objectWithoutProperties(_ref, _excluded$d);
576
+ props = _objectWithoutProperties(_ref, _excluded$e);
575
577
 
576
578
  var theme = /*#__PURE__*/useTheme();
577
579
  return /*#__PURE__*/jsx(Icon, _objectSpread(_objectSpread({}, props), {}, {
@@ -588,7 +590,7 @@ function TypographyIconInheritColor(props) {
588
590
 
589
591
  function TypographyIcon(_ref2) {
590
592
  var color = _ref2.color,
591
- props = _objectWithoutProperties(_ref2, _excluded2$2);
593
+ props = _objectWithoutProperties(_ref2, _excluded2$3);
592
594
 
593
595
  if (color) {
594
596
  return /*#__PURE__*/jsx(TypographyIconSpecifiedColor, _objectSpread({
@@ -599,7 +601,7 @@ function TypographyIcon(_ref2) {
599
601
  return /*#__PURE__*/jsx(TypographyIconInheritColor, _objectSpread({}, props));
600
602
  }
601
603
 
602
- var _excluded$c = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
604
+ var _excluded$d = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
603
605
 
604
606
  var getTextColorByType = function (type, variant) {
605
607
  switch (type) {
@@ -741,7 +743,7 @@ function ButtonContent(_ref7) {
741
743
  $isStretch = _ref7.$isStretch,
742
744
  icon = _ref7.icon,
743
745
  children = _ref7.children,
744
- props = _objectWithoutProperties(_ref7, _excluded$c);
746
+ props = _objectWithoutProperties(_ref7, _excluded$d);
745
747
 
746
748
  var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
747
749
  return /*#__PURE__*/jsx(ButtonContentContainer, {
@@ -880,6 +882,130 @@ function Emoji(_ref3) {
880
882
  });
881
883
  }
882
884
 
885
+ var _excluded$c = ["as", "appScheme", "appValue", "onPress", "onOpenAppError"],
886
+ _excluded2$2 = ["phoneNumber", "children"],
887
+ _excluded3$1 = ["phoneNumber", "children"],
888
+ _excluded4 = ["emailAddress", "children"];
889
+ function ExternalAppLink(_ref) {
890
+ var Component = _ref.as,
891
+ appScheme = _ref.appScheme,
892
+ appValue = _ref.appValue,
893
+ onPress = _ref.onPress,
894
+ onOpenAppError = _ref.onOpenAppError,
895
+ rest = _objectWithoutProperties(_ref, _excluded$c);
896
+
897
+ var href = "".concat(appScheme, ":").concat(appValue);
898
+
899
+ var handleOnPress = /*#__PURE__*/function () {
900
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
901
+ var canOpen;
902
+ return _regeneratorRuntime.wrap(function (_context) {
903
+ while (1) {
904
+ switch (_context.prev = _context.next) {
905
+ case 0:
906
+ _context.prev = 0;
907
+ _context.next = 3;
908
+ return Linking.canOpenURL(href);
909
+
910
+ case 3:
911
+ canOpen = _context.sent;
912
+
913
+ if (!canOpen) {
914
+ _context.next = 12;
915
+ break;
916
+ }
917
+
918
+ Linking.openURL(href)["catch"](function (err) {
919
+ console.error("An error occurred while opening ".concat(href), err);
920
+ onOpenAppError === null || onOpenAppError === void 0 ? void 0 : onOpenAppError("An error occurred while opening ".concat(href));
921
+ });
922
+
923
+ if (!onPress) {
924
+ _context.next = 10;
925
+ break;
926
+ }
927
+
928
+ onPress(e);
929
+
930
+ if (!(e !== null && e !== void 0 && e.defaultPrevented)) {
931
+ _context.next = 10;
932
+ break;
933
+ }
934
+
935
+ return _context.abrupt("return");
936
+
937
+ case 10:
938
+ _context.next = 13;
939
+ break;
940
+
941
+ case 12:
942
+ onOpenAppError === null || onOpenAppError === void 0 ? void 0 : onOpenAppError("Cannot open url: ".concat(href));
943
+
944
+ case 13:
945
+ _context.next = 18;
946
+ break;
947
+
948
+ case 15:
949
+ _context.prev = 15;
950
+ _context.t0 = _context["catch"](0);
951
+ onOpenAppError === null || onOpenAppError === void 0 ? void 0 : onOpenAppError('An error occured with Linkinf.canOpenURL');
952
+
953
+ case 18:
954
+ case "end":
955
+ return _context.stop();
956
+ }
957
+ }
958
+ }, _callee, null, [[0, 15]]);
959
+ }));
960
+
961
+ return function () {
962
+ return _ref2.apply(this, arguments);
963
+ };
964
+ }();
965
+
966
+ return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({
967
+ href: href
968
+ }, rest), {}, {
969
+ onPress: handleOnPress
970
+ }));
971
+ }
972
+
973
+ ExternalAppLink.Sms = function (_ref3) {
974
+ var phoneNumber = _ref3.phoneNumber,
975
+ children = _ref3.children,
976
+ rest = _objectWithoutProperties(_ref3, _excluded2$2);
977
+
978
+ return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
979
+ appScheme: "sms",
980
+ appValue: phoneNumber,
981
+ children: children
982
+ }));
983
+ };
984
+
985
+ ExternalAppLink.Tel = function (_ref4) {
986
+ var phoneNumber = _ref4.phoneNumber,
987
+ children = _ref4.children,
988
+ rest = _objectWithoutProperties(_ref4, _excluded3$1);
989
+
990
+ return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
991
+ appScheme: "tel",
992
+ appValue: phoneNumber,
993
+ children: children
994
+ }));
995
+ };
996
+
997
+ ExternalAppLink.Mail = function (_ref5) {
998
+ var emailAddress = _ref5.emailAddress,
999
+ children = _ref5.children,
1000
+ rest = _objectWithoutProperties(_ref5, _excluded4);
1001
+
1002
+ return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
1003
+ appScheme: "mailto",
1004
+ appValue: emailAddress,
1005
+ children: children
1006
+ }));
1007
+ };
1008
+
883
1009
  var defaultOpenLinkBehavior = {
884
1010
  "native": 'openInModal',
885
1011
  web: 'targetBlank'
@@ -1868,9 +1994,8 @@ var StyledTextInput = /*#__PURE__*/styled(TextInput).withConfig({
1868
1994
  if (!multiline && "web" !== 'web') return "0 ".concat(theme.kitt.forms.input.padding.horizontal, "px");
1869
1995
  return "".concat(theme.kitt.forms.input.padding.vertical, "px ").concat(theme.kitt.forms.input.padding.horizontal, "px");
1870
1996
  }, function (_ref2) {
1871
- var theme = _ref2.theme,
1872
- multiline = _ref2.multiline;
1873
- if (!multiline && "web" !== 'web') return 0;
1997
+ var theme = _ref2.theme;
1998
+ _ref2.multiline;
1874
1999
  var typeConfigKey = getTypographyTypeConfigKey(theme);
1875
2000
  return "".concat(theme.kitt.typography.types.bodies.configs.body[typeConfigKey].lineHeight, "px");
1876
2001
  }, function (_ref3) {
@@ -4011,5 +4136,5 @@ function MatchWindowSize(_ref) {
4011
4136
  return children;
4012
4137
  }
4013
4138
 
4014
- export { Avatar, Button, Card, Checkbox, DatePicker, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MatchWindowSize, Message, Modal, Notification, Overlay, PageLoader, Picker, Radio, DeprecatedSection as Section, Skeleton, SpinningIcon, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
4139
+ export { Avatar, Button, Card, Checkbox, DatePicker, Emoji, ExternalAppLink, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MatchWindowSize, Message, Modal, Notification, Overlay, PageLoader, Picker, Radio, DeprecatedSection as Section, Skeleton, SpinningIcon, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
4015
4140
  //# sourceMappingURL=index-browser-all.es.web.js.map