@ornikar/kitt-universal 3.4.0 → 3.5.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 (33) hide show
  1. package/dist/definitions/Skeleton/Skeleton.d.ts +14 -0
  2. package/dist/definitions/Skeleton/Skeleton.d.ts.map +1 -0
  3. package/dist/definitions/Skeleton/SkeletonContent.d.ts +8 -0
  4. package/dist/definitions/Skeleton/SkeletonContent.d.ts.map +1 -0
  5. package/dist/definitions/Skeleton/SkeletonContent.web.d.ts +7 -0
  6. package/dist/definitions/Skeleton/SkeletonContent.web.d.ts.map +1 -0
  7. package/dist/definitions/forms/TextArea/TextArea.d.ts.map +1 -1
  8. package/dist/definitions/index.d.ts +4 -0
  9. package/dist/definitions/index.d.ts.map +1 -1
  10. package/dist/definitions/themes/default.d.ts +1 -0
  11. package/dist/definitions/themes/default.d.ts.map +1 -1
  12. package/dist/definitions/themes/late-ocean/skeletonTheme.d.ts +7 -0
  13. package/dist/definitions/themes/late-ocean/skeletonTheme.d.ts.map +1 -0
  14. package/dist/definitions/themes/late-ocean/typographyLateOceanTheme.d.ts +2 -0
  15. package/dist/definitions/themes/late-ocean/typographyLateOceanTheme.d.ts.map +1 -1
  16. package/dist/definitions/utils/hexToRgba.d.ts +2 -0
  17. package/dist/definitions/utils/hexToRgba.d.ts.map +1 -0
  18. package/dist/index-browser-all.es.android.js +154 -18
  19. package/dist/index-browser-all.es.android.js.map +1 -1
  20. package/dist/index-browser-all.es.ios.js +154 -18
  21. package/dist/index-browser-all.es.ios.js.map +1 -1
  22. package/dist/index-browser-all.es.js +154 -18
  23. package/dist/index-browser-all.es.js.map +1 -1
  24. package/dist/index-browser-all.es.web.js +108 -7
  25. package/dist/index-browser-all.es.web.js.map +1 -1
  26. package/dist/index-node-14.17.cjs.js +143 -15
  27. package/dist/index-node-14.17.cjs.js.map +1 -1
  28. package/dist/index-node-14.17.cjs.web.css +1 -0
  29. package/dist/index-node-14.17.cjs.web.js +98 -5
  30. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  31. package/dist/styles.css +1 -0
  32. package/dist/tsbuildinfo +1 -1
  33. package/package.json +4 -3
@@ -7,13 +7,14 @@ export { useWindowDimensions as useWindowSize } from 'react-native';
7
7
  import styled, { useTheme, css, ThemeProvider } from 'styled-components/native';
8
8
  import { useRef, useEffect, cloneElement, useContext, createContext, forwardRef, useMemo, useState, Fragment, Children } from 'react';
9
9
  import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
10
- import Animated$1, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring } from 'react-native-reanimated';
10
+ import Animated$1, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, withRepeat, withTiming, Easing as Easing$1, interpolate } from 'react-native-reanimated';
11
11
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
12
12
  import { parse } from 'twemoji-parser';
13
13
  import { openBrowserAsync } from 'expo-web-browser';
14
14
  import _extends from '@babel/runtime/helpers/extends';
15
15
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
16
16
  import { styled as styled$1 } from '@linaria/react';
17
+ import { LinearGradient } from 'expo-linear-gradient';
17
18
  import DateTimePicker from '@react-native-community/datetimepicker';
18
19
  import { FormattedMessage } from 'react-intl';
19
20
  import { useFloating, offset, shift, flip } from '@floating-ui/react-native';
@@ -781,7 +782,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
781
782
  });
782
783
  });
783
784
 
784
- var Container$6 = /*#__PURE__*/styled.View.withConfig({
785
+ var Container$7 = /*#__PURE__*/styled.View.withConfig({
785
786
  displayName: "Card__Container"
786
787
  })(["background-color:", ";padding:", ";border-radius:", ";border-width:", ";border-color:", ";"], function (_ref) {
787
788
  var theme = _ref.theme,
@@ -804,7 +805,7 @@ var Container$6 = /*#__PURE__*/styled.View.withConfig({
804
805
  function Card(_ref6) {
805
806
  var children = _ref6.children,
806
807
  type = _ref6.type;
807
- return /*#__PURE__*/jsx(Container$6, {
808
+ return /*#__PURE__*/jsx(Container$7, {
808
809
  type: type,
809
810
  children: children
810
811
  });
@@ -1027,7 +1028,7 @@ var Input = /*#__PURE__*/styled(TextInput).withConfig({
1027
1028
  var minHeight = _ref10.minHeight;
1028
1029
  return minHeight;
1029
1030
  });
1030
- var Container$5 = /*#__PURE__*/styled.View.withConfig({
1031
+ var Container$6 = /*#__PURE__*/styled.View.withConfig({
1031
1032
  displayName: "InputText__Container"
1032
1033
  })(["margin-top:", ";margin-bottom:", ";"], function (_ref11) {
1033
1034
  var theme = _ref11.theme;
@@ -1103,7 +1104,7 @@ var InputText = /*#__PURE__*/forwardRef(function (_ref15, ref) {
1103
1104
  isDisabled: disabled,
1104
1105
  formState: formState
1105
1106
  });
1106
- return /*#__PURE__*/jsxs(Container$5, {
1107
+ return /*#__PURE__*/jsxs(Container$6, {
1107
1108
  children: [/*#__PURE__*/jsx(Input, _objectSpread$c(_objectSpread$c({
1108
1109
  ref: ref,
1109
1110
  nativeID: id,
@@ -1203,7 +1204,7 @@ var SelectedInnerRadio = /*#__PURE__*/styled.View.withConfig({
1203
1204
  var theme = _ref14.theme;
1204
1205
  return theme.kitt.forms.radio.checked.innerSize / 2;
1205
1206
  });
1206
- var Container$4 = /*#__PURE__*/styled.Pressable.withConfig({
1207
+ var Container$5 = /*#__PURE__*/styled.Pressable.withConfig({
1207
1208
  displayName: "Radio__Container"
1208
1209
  })(["flex-direction:row;align-items:center;"]);
1209
1210
  var Text = /*#__PURE__*/styled(Typography.Text).withConfig({
@@ -1220,7 +1221,7 @@ function Radio(_ref16) {
1220
1221
  _ref16$disabled = _ref16.disabled,
1221
1222
  disabled = _ref16$disabled === void 0 ? false : _ref16$disabled,
1222
1223
  children = _ref16.children;
1223
- return /*#__PURE__*/jsxs(Container$4, {
1224
+ return /*#__PURE__*/jsxs(Container$5, {
1224
1225
  nativeID: id,
1225
1226
  disabled: disabled,
1226
1227
  accessibilityRole: "radio",
@@ -1249,7 +1250,8 @@ function TextArea(_ref) {
1249
1250
 
1250
1251
  var theme = /*#__PURE__*/useTheme();
1251
1252
  return /*#__PURE__*/jsx(InputText, _objectSpread$b(_objectSpread$b({
1252
- multiline: true
1253
+ multiline: true,
1254
+ textAlignVertical: "top"
1253
1255
  }, props), {}, {
1254
1256
  type: "text",
1255
1257
  minHeight: theme.kitt.forms.input.textAreaMinHeight
@@ -1399,7 +1401,7 @@ function FullScreenModalHeader(_ref6) {
1399
1401
  });
1400
1402
  }
1401
1403
 
1402
- var Container$3 = /*#__PURE__*/styled.View.withConfig({
1404
+ var Container$4 = /*#__PURE__*/styled.View.withConfig({
1403
1405
  displayName: "FullScreenModal__Container"
1404
1406
  })(["flex:1;background-color:", ";"], function (_ref) {
1405
1407
  var theme = _ref.theme;
@@ -1407,7 +1409,7 @@ var Container$3 = /*#__PURE__*/styled.View.withConfig({
1407
1409
  });
1408
1410
  function FullScreenModal(_ref2) {
1409
1411
  var children = _ref2.children;
1410
- return /*#__PURE__*/jsx(Container$3, {
1412
+ return /*#__PURE__*/jsx(Container$4, {
1411
1413
  children: children
1412
1414
  });
1413
1415
  }
@@ -1859,7 +1861,7 @@ function LargeLoader(_ref) {
1859
1861
 
1860
1862
  var xIconSize = 14;
1861
1863
  var mainIconSize = 20;
1862
- var Container$2 = /*#__PURE__*/styled.View.withConfig({
1864
+ var Container$3 = /*#__PURE__*/styled.View.withConfig({
1863
1865
  displayName: "Message__Container"
1864
1866
  })(["border-radius:", "px;background-color:", ";padding-bottom:", "px;padding-left:", "px;padding-right:", "px;padding-top:", "px;flex-direction:row;align-items:flex-start;justify-content:space-between;"], function (_ref) {
1865
1867
  var theme = _ref.theme,
@@ -1948,7 +1950,7 @@ function Message(_ref11) {
1948
1950
  onDismiss = _ref11.onDismiss,
1949
1951
  insets = _ref11.insets;
1950
1952
  var color = getColorByType(type);
1951
- return /*#__PURE__*/jsxs(Container$2, {
1953
+ return /*#__PURE__*/jsxs(Container$3, {
1952
1954
  type: type,
1953
1955
  noRadius: noRadius,
1954
1956
  insets: insets,
@@ -2152,6 +2154,127 @@ function Notification(_ref) {
2152
2154
  });
2153
2155
  }
2154
2156
 
2157
+ var Container$2 = /*#__PURE__*/styled.View.withConfig({
2158
+ displayName: "SkeletonContent__Container"
2159
+ })(["background-color:", ";border-color:", ";height:100%;width:100%;"], function (_ref) {
2160
+ var theme = _ref.theme;
2161
+ return theme.kitt.skeleton.backgroundColor;
2162
+ }, function (_ref2) {
2163
+ var theme = _ref2.theme;
2164
+ return theme.kitt.skeleton.flareColor;
2165
+ });
2166
+ var AnimatedLinearGradient = Animated$1.createAnimatedComponent(LinearGradient);
2167
+ function SkeletonContent(_ref3) {
2168
+ var isLoading = _ref3.isLoading,
2169
+ width = _ref3.width;
2170
+ var theme = /*#__PURE__*/useTheme();
2171
+ var sharedX = useSharedValue(0);
2172
+ useEffect(function () {
2173
+ if (isLoading) {
2174
+ sharedX.value = withRepeat(withTiming(1, {
2175
+ duration: theme.kitt.skeleton.animationDuration,
2176
+ easing: Easing$1.inOut(Easing$1.ease)
2177
+ }), -1);
2178
+ }
2179
+ }, [sharedX, width, isLoading, theme]);
2180
+ var linearGradientStyle = useAnimatedStyle(function () {
2181
+ var _f = function () {
2182
+ return {
2183
+ transform: [{
2184
+ translateX: interpolate(sharedX.value, [0, 1], [-width, width])
2185
+ }]
2186
+ };
2187
+ };
2188
+
2189
+ _f._closure = {
2190
+ interpolate: interpolate,
2191
+ sharedX: sharedX,
2192
+ width: width
2193
+ };
2194
+ _f.asString = "function _f(){const{interpolate,sharedX,width}=jsThis._closure;{return{transform:[{translateX:interpolate(sharedX.value,[0,1],[-width,width])}]};}}";
2195
+ _f.__workletHash = 1670955855244;
2196
+ _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Skeleton/SkeletonContent.tsx (41:47)";
2197
+ _f.__optimalization = 3;
2198
+
2199
+ global.__reanimatedWorkletInit(_f);
2200
+
2201
+ return _f;
2202
+ }());
2203
+ return /*#__PURE__*/jsx(Container$2, {
2204
+ children: /*#__PURE__*/jsx(AnimatedLinearGradient, {
2205
+ colors: [theme.kitt.skeleton.backgroundColor, theme.kitt.skeleton.flareColor, theme.kitt.skeleton.backgroundColor],
2206
+ locations: [0.1, 0.5, 0.9],
2207
+ start: {
2208
+ x: 0,
2209
+ y: 0
2210
+ },
2211
+ end: {
2212
+ x: 1,
2213
+ y: 0
2214
+ },
2215
+ style: [StyleSheet.absoluteFill, linearGradientStyle]
2216
+ })
2217
+ });
2218
+ }
2219
+
2220
+ function Skeleton(_ref) {
2221
+ var isLoading = _ref.isLoading,
2222
+ style = _ref.style;
2223
+
2224
+ var _useState = useState(0),
2225
+ _useState2 = _slicedToArray(_useState, 2),
2226
+ width = _useState2[0],
2227
+ setWidth = _useState2[1];
2228
+
2229
+ return /*#__PURE__*/jsx(View, {
2230
+ style: style,
2231
+ onLayout: function onLayout(_ref2) {
2232
+ var nativeEvent = _ref2.nativeEvent;
2233
+ return setWidth(nativeEvent.layout.width);
2234
+ },
2235
+ children: /*#__PURE__*/jsx(SkeletonContent, {
2236
+ isLoading: isLoading,
2237
+ width: width
2238
+ })
2239
+ });
2240
+ }
2241
+ var Bar = /*#__PURE__*/styled(Skeleton).withConfig({
2242
+ displayName: "Skeleton__Bar"
2243
+ })(["width:100%;height:", "px;border-radius:", "px;overflow:hidden;"], function (_ref3) {
2244
+ var theme = _ref3.theme;
2245
+ return theme.kitt.spacing * 2;
2246
+ }, function (_ref4) {
2247
+ var theme = _ref4.theme;
2248
+ return theme.kitt.spacing * 2;
2249
+ });
2250
+ var Circle = /*#__PURE__*/styled(Skeleton).withConfig({
2251
+ displayName: "Skeleton__Circle"
2252
+ })(["width:", "px;height:", "px;border-radius:", "px;overflow:hidden;"], function (_ref5) {
2253
+ var theme = _ref5.theme;
2254
+ return theme.kitt.spacing * 12;
2255
+ }, function (_ref6) {
2256
+ var theme = _ref6.theme;
2257
+ return theme.kitt.spacing * 12;
2258
+ }, function (_ref7) {
2259
+ var theme = _ref7.theme;
2260
+ return theme.kitt.spacing * 6;
2261
+ });
2262
+ var Square = /*#__PURE__*/styled(Skeleton).withConfig({
2263
+ displayName: "Skeleton__Square"
2264
+ })(["width:", "px;height:", "px;border-radius:", "px;overflow:hidden;"], function (_ref8) {
2265
+ var theme = _ref8.theme;
2266
+ return theme.kitt.spacing * 12;
2267
+ }, function (_ref9) {
2268
+ var theme = _ref9.theme;
2269
+ return theme.kitt.spacing * 12;
2270
+ }, function (_ref10) {
2271
+ var theme = _ref10.theme;
2272
+ return theme.kitt.spacing * 1.5;
2273
+ });
2274
+ Skeleton.Bar = Bar;
2275
+ Skeleton.Circle = Circle;
2276
+ Skeleton.Square = Square;
2277
+
2155
2278
  var Flex = /*#__PURE__*/styled.View.withConfig({
2156
2279
  shouldForwardProp: function shouldForwardProp(prop, defaultValidatorFn) {
2157
2280
  return !['direction', 'padding'].includes(prop) && defaultValidatorFn(prop);
@@ -2844,6 +2967,12 @@ var shadowsLateOceanTheme = {
2844
2967
  medium: '0px 10px 20px rgba(41, 48, 51, 0.25)'
2845
2968
  };
2846
2969
 
2970
+ var skeletonTheme = {
2971
+ backgroundColor: lateOceanColorPalette.black100,
2972
+ flareColor: lateOceanColorPalette.black200,
2973
+ animationDuration: 1000
2974
+ };
2975
+
2847
2976
  var tagLateOceanTheme = {
2848
2977
  borderRadius: '10px',
2849
2978
  padding: '2px 12px',
@@ -2897,20 +3026,18 @@ var tooltip = {
2897
3026
  var calcLineHeight = function (fontSize, lineHeightMultiplier) {
2898
3027
  return Math.round(fontSize * lineHeightMultiplier);
2899
3028
  };
2900
-
2901
3029
  var createTypographyTypeConfig = function (lineHeightMultiplier, baseAndSmallFontSize, mediumAndWideFontSize) {
2902
3030
  return {
2903
3031
  baseAndSmall: {
2904
3032
  fontSize: "".concat(baseAndSmallFontSize, "px"),
2905
- lineHeight: "".concat(calcLineHeight(lineHeightMultiplier, baseAndSmallFontSize), "px")
3033
+ lineHeight: "".concat(calcLineHeight(baseAndSmallFontSize, lineHeightMultiplier), "px")
2906
3034
  },
2907
3035
  mediumAndWide: {
2908
3036
  fontSize: "".concat(mediumAndWideFontSize, "px"),
2909
- lineHeight: "".concat(calcLineHeight(lineHeightMultiplier, baseAndSmallFontSize), "px")
3037
+ lineHeight: "".concat(calcLineHeight(mediumAndWideFontSize, lineHeightMultiplier), "px")
2910
3038
  }
2911
3039
  };
2912
3040
  };
2913
-
2914
3041
  var typographyLateOceanTheme = {
2915
3042
  colors: {
2916
3043
  black: lateOceanColorPalette.black1000,
@@ -3011,7 +3138,8 @@ var theme = {
3011
3138
  fullScreenModal: fullScreenModalLateOceanTheme,
3012
3139
  iconButton: iconButton,
3013
3140
  listItem: listItemLateOceanTheme,
3014
- tooltip: tooltip
3141
+ tooltip: tooltip,
3142
+ skeleton: skeletonTheme
3015
3143
  };
3016
3144
 
3017
3145
  function Title(_ref) {
@@ -3523,6 +3651,14 @@ function useKittTheme() {
3523
3651
  }, [dimensions]);
3524
3652
  }
3525
3653
 
3654
+ var hex2rgba = function (hex) {
3655
+ var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
3656
+ var r = parseInt(hex.slice(1, 3), 16);
3657
+ var g = parseInt(hex.slice(3, 5), 16);
3658
+ var b = parseInt(hex.slice(5, 7), 16);
3659
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
3660
+ };
3661
+
3526
3662
  function KittThemeProvider(_ref) {
3527
3663
  var children = _ref.children;
3528
3664
  var theme = useKittTheme();
@@ -3555,5 +3691,5 @@ function MatchWindowSize(_ref) {
3555
3691
  });
3556
3692
  }
3557
3693
 
3558
- export { Avatar, Button, Card, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputFeedback, InputField, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, LargeLoader, ListItem, Loader, MatchWindowSize, Message, Modal, Notification, Radio, DeprecatedSection as Section, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor };
3694
+ export { Avatar, Button, Card, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputFeedback, InputField, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, LargeLoader, ListItem, Loader, MatchWindowSize, Message, Modal, Notification, Radio, DeprecatedSection as Section, Skeleton, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor };
3559
3695
  //# sourceMappingURL=index-browser-all.es.js.map