@ornikar/kitt-universal 32.3.0 → 32.3.1-canary.e5e3462569f2f32f91e8d06437eb0642c84cb55f.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/index.es.js CHANGED
@@ -8,7 +8,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
9
9
  import _extends from '@babel/runtime/helpers/extends';
10
10
  import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, withTiming, Easing as Easing$1, runOnJS, useDerivedValue, useAnimatedProps, withDelay, withRepeat, interpolate, ReducedMotionConfig, ReduceMotion } from 'react-native-reanimated';
11
- import { Platform, Animated as Animated$1, Easing, StyleSheet, Modal, ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, Keyboard, Text as Text$1, useWindowDimensions, PixelRatio } from 'react-native';
11
+ import { Platform, Animated as Animated$1, Easing, StyleSheet, Modal, Linking, Pressable as Pressable$2, Keyboard, Text as Text$1, useWindowDimensions, ScrollView as ScrollView$2, PixelRatio } from 'react-native';
12
12
  export { useWindowDimensions as useWindowSize } from 'react-native';
13
13
  import _typeof from '@babel/runtime/helpers/typeof';
14
14
  import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
@@ -4857,6 +4857,8 @@ function AnimatedChoiceItemView(_ref) {
4857
4857
  isDisabled = _ref.isDisabled,
4858
4858
  isSelected = _ref.isSelected,
4859
4859
  hasError = _ref.hasError,
4860
+ _ref$shouldExpand = _ref.shouldExpand,
4861
+ shouldExpand = _ref$shouldExpand === void 0 ? false : _ref$shouldExpand,
4860
4862
  animatedStyles = _ref.animatedStyles;
4861
4863
  var sx = useSx();
4862
4864
  var style = sx({
@@ -4874,7 +4876,9 @@ function AnimatedChoiceItemView(_ref) {
4874
4876
  isHovered: isHovered,
4875
4877
  isPressed: isPressed
4876
4878
  }),
4877
- padding: size === 'small' ? 'kitt.2' : 'kitt.4'
4879
+ padding: size === 'small' ? 'kitt.2' : 'kitt.4',
4880
+ flexGrow: shouldExpand ? 1 : undefined,
4881
+ flexShrink: shouldExpand ? 1 : undefined
4878
4882
  });
4879
4883
  return /*#__PURE__*/jsx(Animated.View, {
4880
4884
  style: [style, animatedStyles],
@@ -4937,6 +4941,8 @@ function ChoiceItem(_ref) {
4937
4941
  value = _ref.value,
4938
4942
  selected = _ref.selected,
4939
4943
  disabled = _ref.disabled,
4944
+ _ref$shouldExpand = _ref.shouldExpand,
4945
+ shouldExpand = _ref$shouldExpand === void 0 ? false : _ref$shouldExpand,
4940
4946
  _children = _ref.children,
4941
4947
  isPressedInternal = _ref.isPressedInternal,
4942
4948
  isHoveredInternal = _ref.isHoveredInternal,
@@ -4974,6 +4980,8 @@ function ChoiceItem(_ref) {
4974
4980
  checked: selected
4975
4981
  },
4976
4982
  style: style,
4983
+ flexGrow: shouldExpand ? 1 : undefined,
4984
+ flexShrink: shouldExpand ? 1 : undefined,
4977
4985
  onBlur: onBlur,
4978
4986
  onFocus: onFocus,
4979
4987
  onPress: function (e) {
@@ -4992,6 +5000,8 @@ function ChoiceItem(_ref) {
4992
5000
  });
4993
5001
  return /*#__PURE__*/jsxs(VStack, {
4994
5002
  space: "kitt.2",
5003
+ flexGrow: shouldExpand ? 1 : undefined,
5004
+ flexShrink: shouldExpand ? 1 : undefined,
4995
5005
  children: [/*#__PURE__*/jsxs(AnimatedChoiceItemView, {
4996
5006
  animatedStyles: backgroundStyles,
4997
5007
  isHovered: isHovered || isHoveredInternal,
@@ -4999,10 +5009,13 @@ function ChoiceItem(_ref) {
4999
5009
  isSelected: selected,
5000
5010
  isPressed: isPressed || isPressedInternal,
5001
5011
  hasError: hasError,
5012
+ shouldExpand: shouldExpand,
5002
5013
  size: size,
5003
5014
  children: [/*#__PURE__*/jsxs(Stack, {
5004
5015
  alignItems: "center",
5005
5016
  space: "kitt.2",
5017
+ flexGrow: shouldExpand ? 1 : undefined,
5018
+ flexShrink: shouldExpand ? 1 : undefined,
5006
5019
  children: [icon ? /*#__PURE__*/jsx(TypographyIcon, {
5007
5020
  color: textColor,
5008
5021
  icon: icon
@@ -5031,33 +5044,43 @@ function ChoiceItem(_ref) {
5031
5044
  function ChoiceItemContainer(_ref) {
5032
5045
  var children = _ref.children,
5033
5046
  direction = _ref.direction,
5047
+ shouldExpand = _ref.shouldExpand,
5034
5048
  isLast = _ref.isLast;
5035
5049
  var currentItemMarginValue = isLast ? undefined : 'kitt.3';
5036
- var flexProps = direction === 'row' ? {
5050
+ var directionFlexProps = direction === 'row' ? {
5037
5051
  flexGrow: 1,
5038
5052
  flexShrink: 1,
5039
5053
  flexBasis: 0
5040
5054
  } : {};
5041
- return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({
5055
+ var shouldExpandFlexProps = shouldExpand ? {
5056
+ flexGrow: 1,
5057
+ flexShrink: 1
5058
+ } : {};
5059
+ return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread(_objectSpread({
5042
5060
  marginRight: direction === 'row' ? currentItemMarginValue : undefined,
5043
5061
  marginBottom: direction === 'column' ? currentItemMarginValue : undefined
5044
- }, flexProps), {}, {
5062
+ }, directionFlexProps), shouldExpandFlexProps), {}, {
5045
5063
  children: children
5046
5064
  }));
5047
5065
  }
5048
5066
 
5049
- var _excluded$G = ["direction", "contentContainerStyle"];
5067
+ var _excluded$G = ["direction", "shouldExpand", "contentContainerStyle"];
5050
5068
  function ChoicesContainer(_ref) {
5051
5069
  var direction = _ref.direction,
5070
+ shouldExpand = _ref.shouldExpand,
5052
5071
  contentContainerStyle = _ref.contentContainerStyle,
5053
5072
  props = _objectWithoutProperties(_ref, _excluded$G);
5073
+ var shouldExpandFlexProps = shouldExpand ? {
5074
+ flexGrow: 1,
5075
+ flexShrink: 1
5076
+ } : {};
5054
5077
  if (direction === 'row') {
5055
- return /*#__PURE__*/jsx(ScrollView$2, _objectSpread({
5078
+ return /*#__PURE__*/jsx(ScrollView, _objectSpread(_objectSpread({
5056
5079
  horizontal: true,
5057
- contentContainerStyle: contentContainerStyle
5058
- }, props));
5080
+ contentContainerStyle: shouldExpand ? shouldExpandFlexProps : contentContainerStyle
5081
+ }, props), shouldExpandFlexProps));
5059
5082
  }
5060
- return /*#__PURE__*/jsx(View$2, _objectSpread({}, props));
5083
+ return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), shouldExpandFlexProps));
5061
5084
  }
5062
5085
 
5063
5086
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -5069,6 +5092,8 @@ function Choices(_ref2) {
5069
5092
  _ref2$direction = _ref2.direction,
5070
5093
  direction = _ref2$direction === void 0 ? 'column' : _ref2$direction,
5071
5094
  disabled = _ref2.disabled,
5095
+ _ref2$shouldExpand = _ref2.shouldExpand,
5096
+ shouldExpand = _ref2$shouldExpand === void 0 ? false : _ref2$shouldExpand,
5072
5097
  children = _ref2.children,
5073
5098
  value = _ref2.value,
5074
5099
  onPress = _ref2.onPress,
@@ -5087,6 +5112,7 @@ function Choices(_ref2) {
5087
5112
  var sharedProps = {
5088
5113
  type: type,
5089
5114
  disabled: disabled,
5115
+ shouldExpand: shouldExpand,
5090
5116
  onPress: !isForm ? onPress : undefined,
5091
5117
  onChange: isForm ? function (newValue) {
5092
5118
  setCurrentValue(newValue);
@@ -5098,6 +5124,7 @@ function Choices(_ref2) {
5098
5124
  };
5099
5125
  return /*#__PURE__*/jsx(ChoicesContainer, {
5100
5126
  direction: direction,
5127
+ shouldExpand: shouldExpand,
5101
5128
  testID: testID,
5102
5129
  id: id,
5103
5130
  style: style,
@@ -5108,6 +5135,7 @@ function Choices(_ref2) {
5108
5135
  }, sharedProps));
5109
5136
  return /*#__PURE__*/jsx(ChoiceItemContainer, {
5110
5137
  direction: direction,
5138
+ shouldExpand: shouldExpand,
5111
5139
  isLast: index === childrenArray.length - 1,
5112
5140
  children: element
5113
5141
  }, child.key);