@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.
@@ -11,7 +11,7 @@ import _typeof from '@babel/runtime/helpers/typeof';
11
11
  import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
12
12
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
13
13
  import { SpinnerGapRegularIcon, UserRegularIcon, XRegularIcon, ArrowLeftRegularIcon, CaretUpFillIcon, CaretDownFillIcon, MapPinRegularIcon, EyeClosedRegularIcon, EyeRegularIcon, CheckCircleFillIcon, CaretDownRegularIcon, CaretRightRegularIcon, InfoRegularIcon, WarningRegularIcon, CheckRegularIcon, WarningCircleRegularIcon, ArrowCounterClockwiseRegularIcon, InfoFillIcon, WarningCircleFillIcon, WarningFillIcon } from '@ornikar/kitt-icons/phosphor';
14
- import { Animated, Easing, ScrollView as ScrollView$2, View as View$2, StyleSheet, Modal, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
14
+ import { Animated, Easing, StyleSheet, Modal, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
15
15
  export { useWindowDimensions as useWindowSize } from 'react-native';
16
16
  import { createPortal } from 'react-dom';
17
17
  import { CSSTransition } from 'react-transition-group';
@@ -4738,7 +4738,9 @@ function AnimatedChoiceItemView(_ref) {
4738
4738
  isPressed = _ref.isPressed,
4739
4739
  isDisabled = _ref.isDisabled,
4740
4740
  isSelected = _ref.isSelected,
4741
- hasError = _ref.hasError;
4741
+ hasError = _ref.hasError,
4742
+ _ref$shouldExpand = _ref.shouldExpand,
4743
+ shouldExpand = _ref$shouldExpand === void 0 ? false : _ref$shouldExpand;
4742
4744
  var theme = useTheme();
4743
4745
  return /*#__PURE__*/jsx(View, {
4744
4746
  position: "relative",
@@ -4756,6 +4758,8 @@ function AnimatedChoiceItemView(_ref) {
4756
4758
  isPressed: isPressed
4757
4759
  }),
4758
4760
  padding: size === 'small' ? 'kitt.2' : 'kitt.4',
4761
+ flexGrow: shouldExpand ? 1 : undefined,
4762
+ flexShrink: shouldExpand ? 1 : undefined,
4759
4763
  _web: {
4760
4764
  style: {
4761
4765
  transitionProperty: theme.kitt.choices.item.transition.property,
@@ -4792,6 +4796,8 @@ function ChoiceItem(_ref) {
4792
4796
  value = _ref.value,
4793
4797
  selected = _ref.selected,
4794
4798
  disabled = _ref.disabled,
4799
+ _ref$shouldExpand = _ref.shouldExpand,
4800
+ shouldExpand = _ref$shouldExpand === void 0 ? false : _ref$shouldExpand,
4795
4801
  _children = _ref.children,
4796
4802
  isPressedInternal = _ref.isPressedInternal,
4797
4803
  isHoveredInternal = _ref.isHoveredInternal,
@@ -4825,6 +4831,8 @@ function ChoiceItem(_ref) {
4825
4831
  checked: selected
4826
4832
  },
4827
4833
  style: style,
4834
+ flexGrow: shouldExpand ? 1 : undefined,
4835
+ flexShrink: shouldExpand ? 1 : undefined,
4828
4836
  onBlur: onBlur,
4829
4837
  onFocus: onFocus,
4830
4838
  onPress: function (e) {
@@ -4843,6 +4851,8 @@ function ChoiceItem(_ref) {
4843
4851
  });
4844
4852
  return /*#__PURE__*/jsxs(VStack, {
4845
4853
  space: "kitt.2",
4854
+ flexGrow: shouldExpand ? 1 : undefined,
4855
+ flexShrink: shouldExpand ? 1 : undefined,
4846
4856
  children: [/*#__PURE__*/jsxs(AnimatedChoiceItemView, {
4847
4857
  animatedStyles: backgroundStyles,
4848
4858
  isHovered: isHovered || isHoveredInternal,
@@ -4850,10 +4860,13 @@ function ChoiceItem(_ref) {
4850
4860
  isSelected: selected,
4851
4861
  isPressed: isPressed || isPressedInternal,
4852
4862
  hasError: hasError,
4863
+ shouldExpand: shouldExpand,
4853
4864
  size: size,
4854
4865
  children: [/*#__PURE__*/jsxs(Stack, {
4855
4866
  alignItems: "center",
4856
4867
  space: "kitt.2",
4868
+ flexGrow: shouldExpand ? 1 : undefined,
4869
+ flexShrink: shouldExpand ? 1 : undefined,
4857
4870
  children: [icon ? /*#__PURE__*/jsx(TypographyIcon, {
4858
4871
  color: textColor,
4859
4872
  icon: icon
@@ -4882,33 +4895,43 @@ function ChoiceItem(_ref) {
4882
4895
  function ChoiceItemContainer(_ref) {
4883
4896
  var children = _ref.children,
4884
4897
  direction = _ref.direction,
4898
+ shouldExpand = _ref.shouldExpand,
4885
4899
  isLast = _ref.isLast;
4886
4900
  var currentItemMarginValue = isLast ? undefined : 'kitt.3';
4887
- var flexProps = direction === 'row' ? {
4901
+ var directionFlexProps = direction === 'row' ? {
4888
4902
  flexGrow: 1,
4889
4903
  flexShrink: 1,
4890
4904
  flexBasis: 0
4891
4905
  } : {};
4892
- return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({
4906
+ var shouldExpandFlexProps = shouldExpand ? {
4907
+ flexGrow: 1,
4908
+ flexShrink: 1
4909
+ } : {};
4910
+ return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread(_objectSpread({
4893
4911
  marginRight: direction === 'row' ? currentItemMarginValue : undefined,
4894
4912
  marginBottom: direction === 'column' ? currentItemMarginValue : undefined
4895
- }, flexProps), {}, {
4913
+ }, directionFlexProps), shouldExpandFlexProps), {}, {
4896
4914
  children: children
4897
4915
  }));
4898
4916
  }
4899
4917
 
4900
- var _excluded$D = ["direction", "contentContainerStyle"];
4918
+ var _excluded$D = ["direction", "shouldExpand", "contentContainerStyle"];
4901
4919
  function ChoicesContainer(_ref) {
4902
4920
  var direction = _ref.direction,
4921
+ shouldExpand = _ref.shouldExpand,
4903
4922
  contentContainerStyle = _ref.contentContainerStyle,
4904
4923
  props = _objectWithoutProperties(_ref, _excluded$D);
4924
+ var shouldExpandFlexProps = shouldExpand ? {
4925
+ flexGrow: 1,
4926
+ flexShrink: 1
4927
+ } : {};
4905
4928
  if (direction === 'row') {
4906
- return /*#__PURE__*/jsx(ScrollView$2, _objectSpread({
4929
+ return /*#__PURE__*/jsx(ScrollView, _objectSpread(_objectSpread({
4907
4930
  horizontal: true,
4908
- contentContainerStyle: contentContainerStyle
4909
- }, props));
4931
+ contentContainerStyle: shouldExpand ? shouldExpandFlexProps : contentContainerStyle
4932
+ }, props), shouldExpandFlexProps));
4910
4933
  }
4911
- return /*#__PURE__*/jsx(View$2, _objectSpread({}, props));
4934
+ return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), shouldExpandFlexProps));
4912
4935
  }
4913
4936
 
4914
4937
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -4920,6 +4943,8 @@ function Choices(_ref2) {
4920
4943
  _ref2$direction = _ref2.direction,
4921
4944
  direction = _ref2$direction === void 0 ? 'column' : _ref2$direction,
4922
4945
  disabled = _ref2.disabled,
4946
+ _ref2$shouldExpand = _ref2.shouldExpand,
4947
+ shouldExpand = _ref2$shouldExpand === void 0 ? false : _ref2$shouldExpand,
4923
4948
  children = _ref2.children,
4924
4949
  value = _ref2.value,
4925
4950
  onPress = _ref2.onPress,
@@ -4938,6 +4963,7 @@ function Choices(_ref2) {
4938
4963
  var sharedProps = {
4939
4964
  type: type,
4940
4965
  disabled: disabled,
4966
+ shouldExpand: shouldExpand,
4941
4967
  onPress: !isForm ? onPress : undefined,
4942
4968
  onChange: isForm ? function (newValue) {
4943
4969
  setCurrentValue(newValue);
@@ -4949,6 +4975,7 @@ function Choices(_ref2) {
4949
4975
  };
4950
4976
  return /*#__PURE__*/jsx(ChoicesContainer, {
4951
4977
  direction: direction,
4978
+ shouldExpand: shouldExpand,
4952
4979
  testID: testID,
4953
4980
  id: id,
4954
4981
  style: style,
@@ -4959,6 +4986,7 @@ function Choices(_ref2) {
4959
4986
  }, sharedProps));
4960
4987
  return /*#__PURE__*/jsx(ChoiceItemContainer, {
4961
4988
  direction: direction,
4989
+ shouldExpand: shouldExpand,
4962
4990
  isLast: index === childrenArray.length - 1,
4963
4991
  children: element
4964
4992
  }, child.key);