@ornikar/kitt-universal 9.5.0 → 9.6.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 (39) hide show
  1. package/dist/definitions/Choices/ChoiceItem.d.ts.map +1 -1
  2. package/dist/definitions/Choices/hooks/useNativeAnimation.d.ts +14 -0
  3. package/dist/definitions/Choices/hooks/useNativeAnimation.d.ts.map +1 -0
  4. package/dist/definitions/Choices/hooks/useNativeAnimation.web.d.ts +7 -0
  5. package/dist/definitions/Choices/hooks/useNativeAnimation.web.d.ts.map +1 -0
  6. package/dist/definitions/forms/InputField/InputField.d.ts.map +1 -1
  7. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +1 -1
  8. package/dist/definitions/themes/default.d.ts +7 -1
  9. package/dist/definitions/themes/default.d.ts.map +1 -1
  10. package/dist/definitions/themes/late-ocean/forms.d.ts +7 -1
  11. package/dist/definitions/themes/late-ocean/forms.d.ts.map +1 -1
  12. package/dist/definitions/themes/late-ocean/inputField.d.ts +7 -1
  13. package/dist/definitions/themes/late-ocean/inputField.d.ts.map +1 -1
  14. package/dist/index-browser-all.es.android.js +117 -106
  15. package/dist/index-browser-all.es.android.js.map +1 -1
  16. package/dist/index-browser-all.es.ios.js +117 -106
  17. package/dist/index-browser-all.es.ios.js.map +1 -1
  18. package/dist/index-browser-all.es.js +117 -106
  19. package/dist/index-browser-all.es.js.map +1 -1
  20. package/dist/index-browser-all.es.web.js +38 -111
  21. package/dist/index-browser-all.es.web.js.map +1 -1
  22. package/dist/index-node-14.17.cjs.js +115 -104
  23. package/dist/index-node-14.17.cjs.js.map +1 -1
  24. package/dist/index-node-14.17.cjs.web.js +35 -106
  25. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  26. package/dist/linaria-themes-browser-all.es.android.js +7 -1
  27. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  28. package/dist/linaria-themes-browser-all.es.ios.js +7 -1
  29. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  30. package/dist/linaria-themes-browser-all.es.js +7 -1
  31. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  32. package/dist/linaria-themes-browser-all.es.web.js +7 -1
  33. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  34. package/dist/linaria-themes-node-14.17.cjs.js +7 -1
  35. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  36. package/dist/linaria-themes-node-14.17.cjs.web.js +7 -1
  37. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  38. package/dist/tsbuildinfo +1 -1
  39. package/package.json +27 -2
@@ -1008,6 +1008,90 @@ function Card({
1008
1008
  });
1009
1009
  }
1010
1010
 
1011
+ const useNativeAnimation = ({
1012
+ selected,
1013
+ disabled,
1014
+ isPressedInternal
1015
+ }) => {
1016
+ const theme = /*#__PURE__*/styled.useTheme();
1017
+ const pressed = Animated.useSharedValue(Boolean(isPressedInternal));
1018
+ const progress = Animated.useDerivedValue(function () {
1019
+ const _f = function () {
1020
+ return Animated.withTiming(pressed.value ? 1 : 0, {
1021
+ duration: theme.kitt.choices.item.transition.duration
1022
+ });
1023
+ };
1024
+
1025
+ _f._closure = {
1026
+ withTiming: Animated.withTiming,
1027
+ pressed,
1028
+ theme: {
1029
+ kitt: {
1030
+ choices: {
1031
+ item: {
1032
+ transition: {
1033
+ duration: theme.kitt.choices.item.transition.duration
1034
+ }
1035
+ }
1036
+ }
1037
+ }
1038
+ }
1039
+ };
1040
+ _f.asString = "function _f(){const{withTiming,pressed,theme}=jsThis._closure;{return withTiming(pressed.value?1:0,{duration:theme.kitt.choices.item.transition.duration});}}";
1041
+ _f.__workletHash = 1120030177160;
1042
+ _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/hooks/useNativeAnimation.tsx (31:35)";
1043
+ return _f;
1044
+ }());
1045
+ const backgroundStyles = Animated.useAnimatedStyle(function () {
1046
+ const _f = function () {
1047
+ const {
1048
+ default: defaultBg,
1049
+ pressed: pressedBg,
1050
+ selected: selectedBg,
1051
+ disabled: disabledBg
1052
+ } = theme.kitt.choices.item.backgroundColor;
1053
+ if (disabled) return {
1054
+ backgroundColor: disabledBg
1055
+ };
1056
+ if (selected) return {
1057
+ backgroundColor: selectedBg
1058
+ };
1059
+ return {
1060
+ backgroundColor: Animated.interpolateColor(progress.value, [0, 1], [defaultBg, pressedBg])
1061
+ };
1062
+ };
1063
+
1064
+ _f._closure = {
1065
+ theme: {
1066
+ kitt: {
1067
+ choices: {
1068
+ item: {
1069
+ backgroundColor: theme.kitt.choices.item.backgroundColor
1070
+ }
1071
+ }
1072
+ }
1073
+ },
1074
+ disabled,
1075
+ selected,
1076
+ interpolateColor: Animated.interpolateColor,
1077
+ progress
1078
+ };
1079
+ _f.asString = "function _f(){const{theme,disabled,selected,interpolateColor,progress}=jsThis._closure;{const{default:defaultBg,pressed:pressedBg,selected:selectedBg,disabled:disabledBg}=theme.kitt.choices.item.backgroundColor;if(disabled)return{backgroundColor:disabledBg};if(selected)return{backgroundColor:selectedBg};return{backgroundColor:interpolateColor(progress.value,[0,1],[defaultBg,pressedBg])};}}";
1080
+ _f.__workletHash = 15506726129309;
1081
+ _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/hooks/useNativeAnimation.tsx (35:44)";
1082
+ return _f;
1083
+ }());
1084
+ return {
1085
+ onPressIn: () => {
1086
+ pressed.value = true;
1087
+ },
1088
+ onPressOut: () => {
1089
+ pressed.value = false;
1090
+ },
1091
+ backgroundStyles
1092
+ };
1093
+ };
1094
+
1011
1095
  function getCurrentTextColor({
1012
1096
  isDisabled,
1013
1097
  isSelected,
@@ -1042,7 +1126,7 @@ const DisabledBorder = /*#__PURE__*/styled__default(reactNative.View).withConfig
1042
1126
  } = theme.kitt.choices.item.disabled.border;
1043
1127
  return styled.css(["border:", "px solid ", ";"], width, color);
1044
1128
  });
1045
- const ChoiceItemView = /*#__PURE__*/styled__default(Animated__default.View).withConfig({
1129
+ const ChoiceItemView = /*#__PURE__*/styled__default(reactNative.Platform.OS === 'web' ? reactNative.View : Animated__default.View).withConfig({
1046
1130
  displayName: "ChoiceItem__ChoiceItemView",
1047
1131
  componentId: "kitt-universal__sc-wuv3y6-1"
1048
1132
  })(["position:relative;border-radius:", "px;background-color:", ";", ";", ""], ({
@@ -1104,74 +1188,15 @@ function ChoiceItem({
1104
1188
  onBlur,
1105
1189
  onFocus
1106
1190
  }) {
1107
- const theme = /*#__PURE__*/styled.useTheme();
1108
- const pressed = Animated.useSharedValue(Boolean(isPressedInternal));
1109
- const progress = Animated.useDerivedValue(function () {
1110
- const _f = function () {
1111
- return Animated.withTiming(pressed.value ? 1 : 0, {
1112
- duration: theme.kitt.choices.item.transition.duration
1113
- });
1114
- };
1115
-
1116
- _f._closure = {
1117
- withTiming: Animated.withTiming,
1118
- pressed,
1119
- theme: {
1120
- kitt: {
1121
- choices: {
1122
- item: {
1123
- transition: {
1124
- duration: theme.kitt.choices.item.transition.duration
1125
- }
1126
- }
1127
- }
1128
- }
1129
- }
1130
- };
1131
- _f.asString = "function _f(){const{withTiming,pressed,theme}=jsThis._closure;{return withTiming(pressed.value?1:0,{duration:theme.kitt.choices.item.transition.duration});}}";
1132
- _f.__workletHash = 1120030177160;
1133
- _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (180:35)";
1134
- return _f;
1135
- }());
1136
- const backgroundStyles = Animated.useAnimatedStyle(function () {
1137
- const _f = function () {
1138
- const {
1139
- default: defaultBg,
1140
- pressed: pressedBg,
1141
- selected: selectedBg,
1142
- disabled: disabledBg
1143
- } = theme.kitt.choices.item.backgroundColor;
1144
- if (disabled) return {
1145
- backgroundColor: disabledBg
1146
- };
1147
- if (selected) return {
1148
- backgroundColor: selectedBg
1149
- };
1150
- return {
1151
- backgroundColor: Animated.interpolateColor(progress.value, [0, 1], [defaultBg, pressedBg])
1152
- };
1153
- };
1154
-
1155
- _f._closure = {
1156
- theme: {
1157
- kitt: {
1158
- choices: {
1159
- item: {
1160
- backgroundColor: theme.kitt.choices.item.backgroundColor
1161
- }
1162
- }
1163
- }
1164
- },
1165
- disabled,
1166
- selected,
1167
- interpolateColor: Animated.interpolateColor,
1168
- progress
1169
- };
1170
- _f.asString = "function _f(){const{theme,disabled,selected,interpolateColor,progress}=jsThis._closure;{const{default:defaultBg,pressed:pressedBg,selected:selectedBg,disabled:disabledBg}=theme.kitt.choices.item.backgroundColor;if(disabled)return{backgroundColor:disabledBg};if(selected)return{backgroundColor:selectedBg};return{backgroundColor:interpolateColor(progress.value,[0,1],[defaultBg,pressedBg])};}}";
1171
- _f.__workletHash = 15506726129309;
1172
- _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (184:44)";
1173
- return _f;
1174
- }());
1191
+ const {
1192
+ onPressIn,
1193
+ onPressOut,
1194
+ backgroundStyles
1195
+ } = useNativeAnimation({
1196
+ selected,
1197
+ disabled,
1198
+ isPressedInternal
1199
+ });
1175
1200
 
1176
1201
  const handleChange = () => {
1177
1202
  if (!onChange) return; // Checkbox can be toggled
@@ -1198,12 +1223,8 @@ function ChoiceItem({
1198
1223
  handleChange();
1199
1224
  if (onBlur) onBlur(e);
1200
1225
  },
1201
- onPressIn: () => {
1202
- pressed.value = true;
1203
- },
1204
- onPressOut: () => {
1205
- pressed.value = false;
1206
- },
1226
+ onPressIn: onPressIn,
1227
+ onPressOut: onPressOut,
1207
1228
  children: ({
1208
1229
  isHovered,
1209
1230
  isPressed
@@ -1853,8 +1874,14 @@ const input = {
1853
1874
  };
1854
1875
 
1855
1876
  const inputField = {
1877
+ containerPaddingTop: 5,
1878
+ containerPaddingBottom: 10,
1879
+ feedbackPaddingTop: {
1880
+ base: 5,
1881
+ small: 10
1882
+ },
1856
1883
  labelContainerPaddingBottom: 5,
1857
- iconMarginLeft: 6
1884
+ labelFeedbackMarginLeft: 6
1858
1885
  };
1859
1886
 
1860
1887
  const inputTag = {
@@ -3129,42 +3156,26 @@ function InputFeedback({
3129
3156
  });
3130
3157
  }
3131
3158
 
3132
- const FieldContainer = /*#__PURE__*/styled__default.View.withConfig({
3133
- displayName: "InputField__FieldContainer",
3134
- componentId: "kitt-universal__sc-13fkixs-0"
3135
- })(["padding:5px 0 10px;"]);
3136
- const FeedbackContainer = /*#__PURE__*/styled__default.View.withConfig({
3137
- displayName: "InputField__FeedbackContainer",
3138
- componentId: "kitt-universal__sc-13fkixs-1"
3139
- })(["", ";"], ({
3140
- theme
3141
- }) => theme.responsive.ifWindowSizeMatches({
3142
- minWidth: KittBreakpoints.SMALL
3143
- }, 'padding-top: 10px', 'padding-top: 5px'));
3144
- const FieldLabelContainer = /*#__PURE__*/styled__default.View.withConfig({
3145
- displayName: "InputField__FieldLabelContainer",
3146
- componentId: "kitt-universal__sc-13fkixs-2"
3147
- })(["flex-direction:row;align-items:center;padding-bottom:", "px;"], ({
3148
- theme
3149
- }) => theme.kitt.forms.inputField.labelContainerPaddingBottom);
3150
- const LabelContainer = /*#__PURE__*/styled__default.View.withConfig({
3151
- displayName: "InputField__LabelContainer",
3152
- componentId: "kitt-universal__sc-13fkixs-3"
3153
- })(["margin-right:", "px;"], ({
3154
- theme
3155
- }) => theme.kitt.forms.inputField.iconMarginLeft);
3156
3159
  function InputField({
3157
3160
  label,
3158
3161
  labelFeedback,
3159
3162
  input,
3160
3163
  feedback
3161
3164
  }) {
3162
- return /*#__PURE__*/jsxRuntime.jsxs(FieldContainer, {
3163
- children: [label ? /*#__PURE__*/jsxRuntime.jsxs(FieldLabelContainer, {
3164
- children: [/*#__PURE__*/jsxRuntime.jsx(LabelContainer, {
3165
+ const theme = /*#__PURE__*/styled.useTheme();
3166
+ return /*#__PURE__*/jsxRuntime.jsxs(View, {
3167
+ paddingTop: theme.kitt.forms.inputField.containerPaddingTop,
3168
+ paddingBottom: theme.kitt.forms.inputField.containerPaddingBottom,
3169
+ children: [label ? /*#__PURE__*/jsxRuntime.jsxs(View, {
3170
+ flexDirection: "row",
3171
+ alignItems: "center",
3172
+ paddingBottom: theme.kitt.forms.inputField.labelContainerPaddingBottom,
3173
+ children: [/*#__PURE__*/jsxRuntime.jsx(View, {
3174
+ marginRight: theme.kitt.forms.inputField.labelFeedbackMarginLeft,
3165
3175
  children: label
3166
3176
  }), labelFeedback]
3167
- }) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(FeedbackContainer, {
3177
+ }) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(View, {
3178
+ paddingTop: theme.kitt.forms.inputField.feedbackPaddingTop,
3168
3179
  children: feedback
3169
3180
  }) : null]
3170
3181
  });