@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.
- package/dist/definitions/ExternalAppLink/ExternalAppLink.d.ts +31 -0
- package/dist/definitions/ExternalAppLink/ExternalAppLink.d.ts.map +1 -0
- package/dist/definitions/Picker/Picker.d.ts.map +1 -1
- package/dist/definitions/forms/InputText/InputText.d.ts.map +1 -1
- package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
- package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +2 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +167 -37
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +167 -37
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +167 -37
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +142 -17
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +100 -23
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +73 -1
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -10,6 +10,8 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
10
10
|
import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, useAnimatedProps, withDelay, withTiming, Easing as Easing$1, withRepeat, interpolate } from 'react-native-reanimated';
|
|
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 { openBrowserAsync } from 'expo-web-browser';
|
|
14
16
|
import DateTimePicker, { DateTimePickerAndroid } from '@react-native-community/datetimepicker';
|
|
15
17
|
import { FormattedMessage } from 'react-intl';
|
|
@@ -104,7 +106,7 @@ var KittBreakpointsMax = {
|
|
|
104
106
|
LARGE: KittBreakpoints.WIDE - 1
|
|
105
107
|
};
|
|
106
108
|
|
|
107
|
-
var _excluded$
|
|
109
|
+
var _excluded$i = ["accessibilityRole", "base", "small", "medium", "large", "variant", "color", "textAlign"];
|
|
108
110
|
var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
|
|
109
111
|
var TypographyColorContext = /*#__PURE__*/createContext('black');
|
|
110
112
|
function useTypographyColor() {
|
|
@@ -186,7 +188,7 @@ function Typography(_ref5) {
|
|
|
186
188
|
variant = _ref5.variant,
|
|
187
189
|
color = _ref5.color,
|
|
188
190
|
textAlign = _ref5.textAlign,
|
|
189
|
-
otherProps = _objectWithoutProperties(_ref5, _excluded$
|
|
191
|
+
otherProps = _objectWithoutProperties(_ref5, _excluded$i);
|
|
190
192
|
|
|
191
193
|
var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
|
|
192
194
|
var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
|
|
@@ -274,7 +276,7 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
274
276
|
|
|
275
277
|
Typography.h5 = createHeading(5, 'header5');
|
|
276
278
|
|
|
277
|
-
var _excluded$
|
|
279
|
+
var _excluded$h = ["size", "round", "light", "sizeVariant"];
|
|
278
280
|
|
|
279
281
|
var getInitials = function (firstname, lastname) {
|
|
280
282
|
return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
|
|
@@ -345,7 +347,7 @@ function Avatar(_ref6) {
|
|
|
345
347
|
round = _ref6.round,
|
|
346
348
|
light = _ref6.light,
|
|
347
349
|
sizeVariant = _ref6.sizeVariant,
|
|
348
|
-
props = _objectWithoutProperties(_ref6, _excluded$
|
|
350
|
+
props = _objectWithoutProperties(_ref6, _excluded$h);
|
|
349
351
|
|
|
350
352
|
return /*#__PURE__*/jsx(StyledAvatarView, {
|
|
351
353
|
$size: size,
|
|
@@ -515,12 +517,12 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled.View.withConfig({
|
|
|
515
517
|
return defaultPadding;
|
|
516
518
|
});
|
|
517
519
|
|
|
518
|
-
var _excluded$
|
|
519
|
-
_excluded2$
|
|
520
|
+
var _excluded$g = ["color"],
|
|
521
|
+
_excluded2$3 = ["color"];
|
|
520
522
|
|
|
521
523
|
function TypographyIconSpecifiedColor(_ref) {
|
|
522
524
|
var color = _ref.color,
|
|
523
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
525
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
524
526
|
|
|
525
527
|
var theme = /*#__PURE__*/useTheme();
|
|
526
528
|
return /*#__PURE__*/jsx(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -537,7 +539,7 @@ function TypographyIconInheritColor(props) {
|
|
|
537
539
|
|
|
538
540
|
function TypographyIcon(_ref2) {
|
|
539
541
|
var color = _ref2.color,
|
|
540
|
-
props = _objectWithoutProperties(_ref2, _excluded2$
|
|
542
|
+
props = _objectWithoutProperties(_ref2, _excluded2$3);
|
|
541
543
|
|
|
542
544
|
if (color) {
|
|
543
545
|
return /*#__PURE__*/jsx(TypographyIconSpecifiedColor, _objectSpread({
|
|
@@ -552,7 +554,7 @@ function isSubtle(type) {
|
|
|
552
554
|
return type.startsWith('subtle');
|
|
553
555
|
}
|
|
554
556
|
|
|
555
|
-
var _excluded$
|
|
557
|
+
var _excluded$f = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
|
|
556
558
|
|
|
557
559
|
var getTextColorByType = function (type, variant) {
|
|
558
560
|
switch (type) {
|
|
@@ -694,7 +696,7 @@ function ButtonContent(_ref7) {
|
|
|
694
696
|
$isStretch = _ref7.$isStretch,
|
|
695
697
|
icon = _ref7.icon,
|
|
696
698
|
children = _ref7.children,
|
|
697
|
-
props = _objectWithoutProperties(_ref7, _excluded$
|
|
699
|
+
props = _objectWithoutProperties(_ref7, _excluded$f);
|
|
698
700
|
|
|
699
701
|
var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
700
702
|
return /*#__PURE__*/jsx(ButtonContentContainer, {
|
|
@@ -844,6 +846,130 @@ function Emoji(_ref3) {
|
|
|
844
846
|
});
|
|
845
847
|
}
|
|
846
848
|
|
|
849
|
+
var _excluded$e = ["as", "appScheme", "appValue", "onPress", "onOpenAppError"],
|
|
850
|
+
_excluded2$2 = ["phoneNumber", "children"],
|
|
851
|
+
_excluded3$1 = ["phoneNumber", "children"],
|
|
852
|
+
_excluded4 = ["emailAddress", "children"];
|
|
853
|
+
function ExternalAppLink(_ref) {
|
|
854
|
+
var Component = _ref.as,
|
|
855
|
+
appScheme = _ref.appScheme,
|
|
856
|
+
appValue = _ref.appValue,
|
|
857
|
+
onPress = _ref.onPress,
|
|
858
|
+
onOpenAppError = _ref.onOpenAppError,
|
|
859
|
+
rest = _objectWithoutProperties(_ref, _excluded$e);
|
|
860
|
+
|
|
861
|
+
var href = "".concat(appScheme, ":").concat(appValue);
|
|
862
|
+
|
|
863
|
+
var handleOnPress = /*#__PURE__*/function () {
|
|
864
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
|
|
865
|
+
var canOpen;
|
|
866
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
867
|
+
while (1) {
|
|
868
|
+
switch (_context.prev = _context.next) {
|
|
869
|
+
case 0:
|
|
870
|
+
_context.prev = 0;
|
|
871
|
+
_context.next = 3;
|
|
872
|
+
return Linking.canOpenURL(href);
|
|
873
|
+
|
|
874
|
+
case 3:
|
|
875
|
+
canOpen = _context.sent;
|
|
876
|
+
|
|
877
|
+
if (!canOpen) {
|
|
878
|
+
_context.next = 12;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
Linking.openURL(href)["catch"](function (err) {
|
|
883
|
+
console.error("An error occurred while opening ".concat(href), err);
|
|
884
|
+
onOpenAppError === null || onOpenAppError === void 0 ? void 0 : onOpenAppError("An error occurred while opening ".concat(href));
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
if (!onPress) {
|
|
888
|
+
_context.next = 10;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
onPress(e);
|
|
893
|
+
|
|
894
|
+
if (!(e !== null && e !== void 0 && e.defaultPrevented)) {
|
|
895
|
+
_context.next = 10;
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return _context.abrupt("return");
|
|
900
|
+
|
|
901
|
+
case 10:
|
|
902
|
+
_context.next = 13;
|
|
903
|
+
break;
|
|
904
|
+
|
|
905
|
+
case 12:
|
|
906
|
+
onOpenAppError === null || onOpenAppError === void 0 ? void 0 : onOpenAppError("Cannot open url: ".concat(href));
|
|
907
|
+
|
|
908
|
+
case 13:
|
|
909
|
+
_context.next = 18;
|
|
910
|
+
break;
|
|
911
|
+
|
|
912
|
+
case 15:
|
|
913
|
+
_context.prev = 15;
|
|
914
|
+
_context.t0 = _context["catch"](0);
|
|
915
|
+
onOpenAppError === null || onOpenAppError === void 0 ? void 0 : onOpenAppError('An error occured with Linkinf.canOpenURL');
|
|
916
|
+
|
|
917
|
+
case 18:
|
|
918
|
+
case "end":
|
|
919
|
+
return _context.stop();
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}, _callee, null, [[0, 15]]);
|
|
923
|
+
}));
|
|
924
|
+
|
|
925
|
+
return function () {
|
|
926
|
+
return _ref2.apply(this, arguments);
|
|
927
|
+
};
|
|
928
|
+
}();
|
|
929
|
+
|
|
930
|
+
return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({
|
|
931
|
+
href: href
|
|
932
|
+
}, rest), {}, {
|
|
933
|
+
onPress: handleOnPress
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
ExternalAppLink.Sms = function (_ref3) {
|
|
938
|
+
var phoneNumber = _ref3.phoneNumber,
|
|
939
|
+
children = _ref3.children,
|
|
940
|
+
rest = _objectWithoutProperties(_ref3, _excluded2$2);
|
|
941
|
+
|
|
942
|
+
return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
|
|
943
|
+
appScheme: "sms",
|
|
944
|
+
appValue: phoneNumber,
|
|
945
|
+
children: children
|
|
946
|
+
}));
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
ExternalAppLink.Tel = function (_ref4) {
|
|
950
|
+
var phoneNumber = _ref4.phoneNumber,
|
|
951
|
+
children = _ref4.children,
|
|
952
|
+
rest = _objectWithoutProperties(_ref4, _excluded3$1);
|
|
953
|
+
|
|
954
|
+
return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
|
|
955
|
+
appScheme: "tel",
|
|
956
|
+
appValue: phoneNumber,
|
|
957
|
+
children: children
|
|
958
|
+
}));
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
ExternalAppLink.Mail = function (_ref5) {
|
|
962
|
+
var emailAddress = _ref5.emailAddress,
|
|
963
|
+
children = _ref5.children,
|
|
964
|
+
rest = _objectWithoutProperties(_ref5, _excluded4);
|
|
965
|
+
|
|
966
|
+
return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
|
|
967
|
+
appScheme: "mailto",
|
|
968
|
+
appValue: emailAddress,
|
|
969
|
+
children: children
|
|
970
|
+
}));
|
|
971
|
+
};
|
|
972
|
+
|
|
847
973
|
var defaultOpenLinkBehavior = {
|
|
848
974
|
"native": 'openInModal',
|
|
849
975
|
web: 'targetBlank'
|
|
@@ -2458,7 +2584,13 @@ var StyledTextInput = /*#__PURE__*/styled(TextInput).withConfig({
|
|
|
2458
2584
|
}, function (_ref2) {
|
|
2459
2585
|
var theme = _ref2.theme,
|
|
2460
2586
|
multiline = _ref2.multiline;
|
|
2461
|
-
|
|
2587
|
+
var shouldHandleSingleLineOnIOS = Platform.OS === 'ios' && !multiline; // On basic text input, we set the line-height to zero for iOS to fix vertical text alignment
|
|
2588
|
+
// This is a iOS only fix since having 0 as a line-height value breaks text inputs on Android
|
|
2589
|
+
|
|
2590
|
+
if (shouldHandleSingleLineOnIOS) {
|
|
2591
|
+
return 0;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2462
2594
|
var typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
2463
2595
|
return "".concat(theme.kitt.typography.types.bodies.configs.body[typeConfigKey].lineHeight, "px");
|
|
2464
2596
|
}, function (_ref3) {
|
|
@@ -3589,32 +3721,30 @@ function Picker(_ref) {
|
|
|
3589
3721
|
variant: "bold",
|
|
3590
3722
|
children: title
|
|
3591
3723
|
})
|
|
3592
|
-
}), /*#__PURE__*/jsx(
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
var item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
|
|
3724
|
+
}), Platform.OS === 'ios' ? /*#__PURE__*/jsx(Picker$1, {
|
|
3725
|
+
testID: testID,
|
|
3726
|
+
selectedValue: value,
|
|
3727
|
+
itemStyle: theme.picker.ios["default"],
|
|
3728
|
+
onValueChange: function onValueChange(itemValue) {
|
|
3729
|
+
return setValue(itemValue);
|
|
3730
|
+
},
|
|
3731
|
+
children: React.Children.map(children, function (child) {
|
|
3732
|
+
var item = child; // iOS Picker doesn't support a custom Item component, we need to override its props manually for the selected one
|
|
3602
3733
|
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
})
|
|
3734
|
+
return /*#__PURE__*/cloneElement(item, {
|
|
3735
|
+
color: item.props.value === value ? theme.picker.ios.selected.color : undefined
|
|
3736
|
+
});
|
|
3737
|
+
})
|
|
3738
|
+
}) : /*#__PURE__*/jsx(ScrollView, {
|
|
3739
|
+
testID: testID,
|
|
3740
|
+
children: React.Children.map(children, function (child) {
|
|
3741
|
+
var item = child;
|
|
3742
|
+
return /*#__PURE__*/cloneElement(item, {
|
|
3743
|
+
onPress: function onPress(newValue) {
|
|
3744
|
+
return setValue(newValue);
|
|
3745
|
+
},
|
|
3746
|
+
isSelected: item.props.value === value
|
|
3747
|
+
});
|
|
3618
3748
|
})
|
|
3619
3749
|
}), /*#__PURE__*/jsx(Modal.Footer, {
|
|
3620
3750
|
children: /*#__PURE__*/jsx(Button, {
|
|
@@ -4605,5 +4735,5 @@ function MatchWindowSize(_ref) {
|
|
|
4605
4735
|
return children;
|
|
4606
4736
|
}
|
|
4607
4737
|
|
|
4608
|
-
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 };
|
|
4738
|
+
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 };
|
|
4609
4739
|
//# sourceMappingURL=index-browser-all.es.js.map
|