@ornikar/kitt-universal 5.0.0 → 6.0.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 (52) hide show
  1. package/dist/definitions/Button/Button.d.ts +0 -1
  2. package/dist/definitions/Button/Button.d.ts.map +1 -1
  3. package/dist/definitions/Button/ButtonContent.d.ts +1 -1
  4. package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
  5. package/dist/definitions/Icon/Icon.d.ts +10 -2
  6. package/dist/definitions/Icon/Icon.d.ts.map +1 -1
  7. package/dist/definitions/Icon/SpinningIcon.d.ts +4 -4
  8. package/dist/definitions/Icon/SpinningIcon.d.ts.map +1 -1
  9. package/dist/definitions/Icon/SpinningIcon.web.d.ts +1 -1
  10. package/dist/definitions/Icon/SpinningIcon.web.d.ts.map +1 -1
  11. package/dist/definitions/Loader/Loader.d.ts.map +1 -1
  12. package/dist/definitions/Loader/Loader.web.d.ts +3 -3
  13. package/dist/definitions/Loader/Loader.web.d.ts.map +1 -1
  14. package/dist/definitions/forms/Checkbox/Checkbox.d.ts.map +1 -1
  15. package/dist/definitions/forms/DatePicker/DatePicker.d.ts.map +1 -1
  16. package/dist/definitions/forms/DatePicker/DatePickerAndroid.d.ts +12 -0
  17. package/dist/definitions/forms/DatePicker/DatePickerAndroid.d.ts.map +1 -0
  18. package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
  19. package/dist/definitions/index.d.ts +4 -0
  20. package/dist/definitions/index.d.ts.map +1 -1
  21. package/dist/definitions/typography/TypographySpinningIcon.d.ts +9 -0
  22. package/dist/definitions/typography/TypographySpinningIcon.d.ts.map +1 -0
  23. package/dist/index-browser-all.es.android.js +877 -767
  24. package/dist/index-browser-all.es.android.js.map +1 -1
  25. package/dist/index-browser-all.es.ios.js +246 -247
  26. package/dist/index-browser-all.es.ios.js.map +1 -1
  27. package/dist/index-browser-all.es.js +246 -247
  28. package/dist/index-browser-all.es.js.map +1 -1
  29. package/dist/index-browser-all.es.web.js +258 -312
  30. package/dist/index-browser-all.es.web.js.map +1 -1
  31. package/dist/index-node-14.17.cjs.js +161 -64
  32. package/dist/index-node-14.17.cjs.js.map +1 -1
  33. package/dist/index-node-14.17.cjs.web.css +1 -1
  34. package/dist/index-node-14.17.cjs.web.js +102 -66
  35. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  36. package/dist/linaria-themes-browser-all.es.android.js +3 -3
  37. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  38. package/dist/linaria-themes-browser-all.es.ios.js +3 -3
  39. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  40. package/dist/linaria-themes-browser-all.es.js +3 -3
  41. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  42. package/dist/linaria-themes-browser-all.es.web.js +3 -3
  43. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  44. package/dist/linaria-themes-node-14.17.cjs.js +3 -3
  45. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  46. package/dist/linaria-themes-node-14.17.cjs.web.js +3 -3
  47. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  48. package/dist/styles.css +1 -1
  49. package/dist/tsbuildinfo +1 -1
  50. package/package.json +7 -6
  51. package/dist/definitions/forms/DatePicker/DatePicker.android.d.ts +0 -4
  52. package/dist/definitions/forms/DatePicker/DatePicker.android.d.ts.map +0 -1
@@ -10,9 +10,9 @@ const jsxRuntime = require('react/jsx-runtime');
10
10
  const Animated = require('react-native-reanimated');
11
11
  const twemojiParser = require('twemoji-parser');
12
12
  const WebBrowser = require('expo-web-browser');
13
+ const DateTimePicker = require('@react-native-community/datetimepicker');
13
14
  const reactIntl = require('react-intl');
14
15
  const react$1 = require('@linaria/react');
15
- const DateTimePicker = require('@react-native-community/datetimepicker');
16
16
  const reactNativeSafeAreaContext = require('react-native-safe-area-context');
17
17
  const expoLinearGradient = require('expo-linear-gradient');
18
18
  const reactNative$1 = require('@floating-ui/react-native');
@@ -24,55 +24,22 @@ const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
24
24
  const Animated__default = /*#__PURE__*/_interopDefaultLegacy(Animated);
25
25
  const DateTimePicker__default = /*#__PURE__*/_interopDefaultLegacy(DateTimePicker);
26
26
 
27
- function SpinningIcon({
28
- children
29
- }) {
30
- const animationRef = react.useRef(new reactNative.Animated.Value(0));
31
- const rotation = animationRef.current.interpolate({
32
- inputRange: [0, 1],
33
- outputRange: ['0deg', '360deg']
34
- });
35
- react.useEffect(() => {
36
- if (process.env.TESTS) return undefined;
37
- const animation = reactNative.Animated.loop(reactNative.Animated.timing(animationRef.current, {
38
- toValue: 1,
39
- duration: 1100,
40
- easing: reactNative.Easing.linear,
41
- useNativeDriver: true
42
- }));
43
- animation.start();
44
- return () => {
45
- if (process.env.TESTS) return undefined;
46
- animation.stop();
47
- return undefined;
48
- };
49
- }, []);
50
- return /*#__PURE__*/jsxRuntime.jsx(reactNative.Animated.View, {
51
- style: {
52
- transform: [{
53
- rotate: rotation
54
- }]
55
- },
56
- children: children
57
- });
58
- }
59
-
27
+ const defaultIconSize = 20;
60
28
  const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
61
29
  displayName: "Icon__IconContainer",
62
30
  componentId: "kitt-universal__sc-usm0ol-0"
63
31
  })(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
64
- color
65
- }) => color, ({
66
- size
67
- }) => size, ({
68
- size
69
- }) => size, ({
70
- align = 'auto'
71
- }) => align);
32
+ $color
33
+ }) => $color, ({
34
+ $size
35
+ }) => $size, ({
36
+ $size
37
+ }) => $size, ({
38
+ $align = 'auto'
39
+ }) => $align);
72
40
  function Icon({
73
41
  icon,
74
- size = 20,
75
- spin,
42
+ size = defaultIconSize,
76
43
  align,
77
44
  color
78
45
  }) {
@@ -80,12 +47,10 @@ function Icon({
80
47
  color
81
48
  });
82
49
  return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
83
- align: align,
84
- size: size,
85
- color: color,
86
- children: spin ? /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
87
- children: clonedIcon
88
- }) : clonedIcon
50
+ $align: align,
51
+ $size: size,
52
+ $color: color,
53
+ children: clonedIcon
89
54
  });
90
55
  }
91
56
 
@@ -631,7 +596,6 @@ const StyledIconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
631
596
  function ButtonIcon({
632
597
  icon,
633
598
  color,
634
- spin,
635
599
  iconPosition,
636
600
  testID
637
601
  }) {
@@ -639,7 +603,6 @@ function ButtonIcon({
639
603
  $iconPosition: iconPosition,
640
604
  children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
641
605
  icon: icon,
642
- spin: spin,
643
606
  testID: testID,
644
607
  color: color
645
608
  })
@@ -654,7 +617,6 @@ function ButtonContentChildren({
654
617
  type,
655
618
  icon,
656
619
  iconPosition,
657
- iconSpin,
658
620
  isDisabled,
659
621
  color,
660
622
  children
@@ -668,9 +630,8 @@ function ButtonContentChildren({
668
630
  const isWebSubtle = isSubtle(type) && reactNative.Platform.OS === 'web' && !isDisabled;
669
631
 
670
632
  if (!children) {
671
- return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
672
- spin: iconSpin // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
673
- ,
633
+ return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
634
+ , {
674
635
  icon: icon,
675
636
  color: isWebSubtle ? 'inherit' : color
676
637
  });
@@ -678,7 +639,6 @@ function ButtonContentChildren({
678
639
 
679
640
  const buttonIconSharedProps = {
680
641
  type,
681
- spin: iconSpin,
682
642
  iconPosition,
683
643
  color: isWebSubtle ? 'inherit' : color
684
644
  };
@@ -766,7 +726,6 @@ const Button = /*#__PURE__*/react.forwardRef(({
766
726
  large,
767
727
  icon,
768
728
  iconPosition = 'left',
769
- iconSpin,
770
729
  testID,
771
730
  href,
772
731
  hrefAttrs,
@@ -794,7 +753,6 @@ const Button = /*#__PURE__*/react.forwardRef(({
794
753
  isDisabled: disabled,
795
754
  icon: icon,
796
755
  iconPosition: iconPosition,
797
- iconSpin: iconSpin,
798
756
  children: children
799
757
  }), reactNative.Platform.OS !== 'web' && disabled ? /*#__PURE__*/jsxRuntime.jsx(StyledDisabled, {}) : null]
800
758
  })
@@ -974,9 +932,9 @@ const button = {
974
932
  }
975
933
  },
976
934
  contentPadding: {
977
- default: '8px 16px 7px',
978
- large: '12px 24px 11px',
979
- disabled: '6px 14px 5px'
935
+ default: '7px 16px 7px',
936
+ large: '11px 24px 11px',
937
+ disabled: '5px 14px 5px'
980
938
  },
981
939
  transition: {
982
940
  duration: '200ms',
@@ -1484,7 +1442,7 @@ function useKittTheme() {
1484
1442
  const CheckboxAndLabelPressableWrapper = /*#__PURE__*/styled__default.Pressable.withConfig({
1485
1443
  displayName: "Checkbox__CheckboxAndLabelPressableWrapper",
1486
1444
  componentId: "kitt-universal__sc-1sav1n6-0"
1487
- })(["display:flex;flex-direction:row;align-items:center;"]);
1445
+ })(["display:flex;flex-direction:row;"]);
1488
1446
  const CheckboxContainer = /*#__PURE__*/styled__default.View.withConfig({
1489
1447
  displayName: "Checkbox__CheckboxContainer",
1490
1448
  componentId: "kitt-universal__sc-1sav1n6-1"
@@ -1702,6 +1660,51 @@ function DatePickerInputs({
1702
1660
  });
1703
1661
  }
1704
1662
 
1663
+ function DatePickerAndroid({
1664
+ onBlur,
1665
+ onFocus,
1666
+ pickerDefaultDate,
1667
+ pickerUITestID,
1668
+ setIsFocused,
1669
+ currentValue,
1670
+ setCurrentValue,
1671
+ onChange,
1672
+ isFocused,
1673
+ ...props
1674
+ }) {
1675
+ const handleClose = () => {
1676
+ if (onBlur) onBlur();
1677
+ };
1678
+
1679
+ return /*#__PURE__*/jsxRuntime.jsx(DatePickerInputs, {
1680
+ handleModalOpen: () => {
1681
+ setIsFocused(true);
1682
+ if (onFocus) onFocus();
1683
+ DateTimePicker.DateTimePickerAndroid.open({
1684
+ testID: pickerUITestID,
1685
+ value: currentValue || pickerDefaultDate || new Date(Date.now()),
1686
+ onChange: e => {
1687
+ setIsFocused(false);
1688
+ const {
1689
+ timestamp
1690
+ } = e.nativeEvent;
1691
+
1692
+ if (timestamp) {
1693
+ const date = new Date(timestamp);
1694
+ setCurrentValue(date);
1695
+ onChange(date);
1696
+ handleClose();
1697
+ }
1698
+ },
1699
+ onTouchCancel: handleClose
1700
+ });
1701
+ },
1702
+ currentValue: currentValue,
1703
+ isFocused: isFocused,
1704
+ ...props
1705
+ });
1706
+ }
1707
+
1705
1708
  // Don't use styled.Pressable here - babel-plugin-styled-components-react-native-web only supports tagged templates
1706
1709
  const OverlayPressable = /*#__PURE__*/styled__default(reactNative.Pressable).withConfig({
1707
1710
  displayName: "Overlay__OverlayPressable",
@@ -2247,6 +2250,20 @@ function DatePicker({
2247
2250
  const [isFocused, setIsFocused] = react.useState(false);
2248
2251
  const [currentValue, setCurrentValue] = react.useState(value);
2249
2252
 
2253
+ if (reactNative.Platform.OS === 'android') {
2254
+ return /*#__PURE__*/jsxRuntime.jsx(DatePickerAndroid, {
2255
+ pickerDefaultDate: pickerDefaultDate,
2256
+ pickerUITestID: pickerUITestID,
2257
+ currentValue: currentValue,
2258
+ setCurrentValue: setCurrentValue,
2259
+ isFocused: isFocused,
2260
+ setIsFocused: setIsFocused,
2261
+ onChange: onChange,
2262
+ onBlur: onBlur,
2263
+ ...props
2264
+ });
2265
+ }
2266
+
2250
2267
  const handleModalClose = () => {
2251
2268
  if (onBlur) onBlur();
2252
2269
  setIsPickerUIVisible(false);
@@ -2809,6 +2826,50 @@ function FullScreenModal({
2809
2826
  FullScreenModal.Header = FullScreenModalHeader;
2810
2827
  FullScreenModal.Body = FullScreenModalBody;
2811
2828
 
2829
+ function SpinningIcon({
2830
+ icon,
2831
+ size = defaultIconSize,
2832
+ align,
2833
+ color
2834
+ }) {
2835
+ const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
2836
+ color
2837
+ });
2838
+ const animationRef = react.useRef(new reactNative.Animated.Value(0));
2839
+ const rotation = animationRef.current.interpolate({
2840
+ inputRange: [0, 1],
2841
+ outputRange: ['0deg', '360deg']
2842
+ });
2843
+ react.useEffect(() => {
2844
+ if (process.env.NODE_ENV === 'test') return undefined;
2845
+ const animation = reactNative.Animated.loop(reactNative.Animated.timing(animationRef.current, {
2846
+ toValue: 1,
2847
+ duration: 1100,
2848
+ easing: reactNative.Easing.linear,
2849
+ useNativeDriver: true
2850
+ }));
2851
+ animation.start();
2852
+ return () => {
2853
+ if (process.env.NODE_ENV === 'test') return undefined;
2854
+ animation.stop();
2855
+ return undefined;
2856
+ };
2857
+ }, []);
2858
+ return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
2859
+ $align: align,
2860
+ $size: size,
2861
+ $color: color,
2862
+ children: /*#__PURE__*/jsxRuntime.jsx(reactNative.Animated.View, {
2863
+ style: {
2864
+ transform: [{
2865
+ rotate: rotation
2866
+ }]
2867
+ },
2868
+ children: clonedIcon
2869
+ })
2870
+ });
2871
+ }
2872
+
2812
2873
  const ContentView = /*#__PURE__*/styled__default.View.withConfig({
2813
2874
  displayName: "ListItemContent__ContentView",
2814
2875
  componentId: "kitt-universal__sc-57q0u9-0"
@@ -2936,9 +2997,10 @@ function getActivityIndicatorSize(size) {
2936
2997
  return size < 36 ? 'small' : 'large';
2937
2998
  }
2938
2999
 
3000
+ const defaultLoaderSize = defaultIconSize;
2939
3001
  function Loader({
2940
3002
  color = 'primary',
2941
- size = 20
3003
+ size = defaultLoaderSize
2942
3004
  }) {
2943
3005
  const theme = /*#__PURE__*/styled.useTheme();
2944
3006
  const colorHex = theme.kitt.typography.colors[color];
@@ -4055,6 +4117,39 @@ function TypographyLink({
4055
4117
  });
4056
4118
  }
4057
4119
 
4120
+ function TypographySpinningIconSpecifiedColor({
4121
+ color,
4122
+ ...props
4123
+ }) {
4124
+ const theme = /*#__PURE__*/styled.useTheme();
4125
+ return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, { ...props,
4126
+ color: color === 'inherit' ? 'inherit' : theme.kitt.typography.colors[color]
4127
+ });
4128
+ }
4129
+
4130
+ function TypographySpinningIconInheritColor(props) {
4131
+ const color = useTypographyColor();
4132
+ return /*#__PURE__*/jsxRuntime.jsx(TypographySpinningIconSpecifiedColor, {
4133
+ color: color,
4134
+ ...props
4135
+ });
4136
+ }
4137
+
4138
+ function TypographySpinningIcon({
4139
+ color,
4140
+ ...props
4141
+ }) {
4142
+ if (color) {
4143
+ return /*#__PURE__*/jsxRuntime.jsx(TypographySpinningIconSpecifiedColor, {
4144
+ color: color,
4145
+ ...props
4146
+ });
4147
+ }
4148
+
4149
+ return /*#__PURE__*/jsxRuntime.jsx(TypographySpinningIconInheritColor, { ...props
4150
+ });
4151
+ }
4152
+
4058
4153
  const hex2rgba = (hex, alpha = 1) => {
4059
4154
  const r = parseInt(hex.slice(1, 3), 16);
4060
4155
  const g = parseInt(hex.slice(3, 5), 16);
@@ -4129,6 +4224,7 @@ exports.Notification = Notification;
4129
4224
  exports.Radio = Radio;
4130
4225
  exports.Section = DeprecatedSection;
4131
4226
  exports.Skeleton = Skeleton;
4227
+ exports.SpinningIcon = SpinningIcon;
4132
4228
  exports.Story = Story;
4133
4229
  exports.StoryBlock = StoryBlock;
4134
4230
  exports.StoryContainer = StoryContainer;
@@ -4145,6 +4241,7 @@ exports.Typography = Typography;
4145
4241
  exports.TypographyEmoji = TypographyEmoji;
4146
4242
  exports.TypographyIcon = TypographyIcon;
4147
4243
  exports.TypographyLink = TypographyLink;
4244
+ exports.TypographySpinningIcon = TypographySpinningIcon;
4148
4245
  exports.createWindowSizeHelper = createWindowSizeHelper;
4149
4246
  exports.hex2rgba = hex2rgba;
4150
4247
  exports.matchWindowSize = matchWindowSize;