@ornikar/kitt-universal 9.3.2 → 9.4.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 (43) hide show
  1. package/dist/definitions/Choices/ChoiceItem.d.ts +38 -0
  2. package/dist/definitions/Choices/ChoiceItem.d.ts.map +1 -0
  3. package/dist/definitions/Choices/ChoiceItemContainer.d.ts +10 -0
  4. package/dist/definitions/Choices/ChoiceItemContainer.d.ts.map +1 -0
  5. package/dist/definitions/Choices/Choices.d.ts +33 -0
  6. package/dist/definitions/Choices/Choices.d.ts.map +1 -0
  7. package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
  8. package/dist/definitions/index.d.ts +3 -0
  9. package/dist/definitions/index.d.ts.map +1 -1
  10. package/dist/definitions/test-utils/TestWrapper.d.ts +7 -0
  11. package/dist/definitions/test-utils/TestWrapper.d.ts.map +1 -0
  12. package/dist/definitions/themes/default.d.ts +1 -0
  13. package/dist/definitions/themes/default.d.ts.map +1 -1
  14. package/dist/definitions/themes/late-ocean/choices.d.ts +35 -0
  15. package/dist/definitions/themes/late-ocean/choices.d.ts.map +1 -0
  16. package/dist/definitions/typography/Typography.d.ts +1 -0
  17. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  18. package/dist/index-browser-all.es.android.js +376 -20
  19. package/dist/index-browser-all.es.android.js.map +1 -1
  20. package/dist/index-browser-all.es.ios.js +376 -20
  21. package/dist/index-browser-all.es.ios.js.map +1 -1
  22. package/dist/index-browser-all.es.js +376 -20
  23. package/dist/index-browser-all.es.js.map +1 -1
  24. package/dist/index-browser-all.es.web.js +375 -16
  25. package/dist/index-browser-all.es.web.js.map +1 -1
  26. package/dist/index-node-14.17.cjs.js +368 -2
  27. package/dist/index-node-14.17.cjs.js.map +1 -1
  28. package/dist/index-node-14.17.cjs.web.js +369 -2
  29. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  30. package/dist/linaria-themes-browser-all.es.android.js +34 -0
  31. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  32. package/dist/linaria-themes-browser-all.es.ios.js +34 -0
  33. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  34. package/dist/linaria-themes-browser-all.es.js +34 -0
  35. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  36. package/dist/linaria-themes-browser-all.es.web.js +34 -0
  37. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  38. package/dist/linaria-themes-node-14.17.cjs.js +34 -0
  39. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  40. package/dist/linaria-themes-node-14.17.cjs.web.js +34 -0
  41. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  42. package/dist/tsbuildinfo +1 -1
  43. package/package.json +2 -2
@@ -1,15 +1,16 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { View as View$1, Image, Pressable as Pressable$1, Linking, useWindowDimensions, TextInput, StyleSheet, ScrollView as ScrollView$1, Modal as Modal$1, Text as Text$2 } from 'react-native';
3
+ import { View as View$1, Image, Pressable as Pressable$1, StyleSheet, ScrollView as ScrollView$1, Linking, useWindowDimensions, TextInput, Modal as Modal$1, Text as Text$2 } from 'react-native';
4
4
  export { useWindowDimensions as useWindowSize } from 'react-native';
5
5
  import { UserIcon, CheckboxMark, EyeOffIcon, EyeIcon, ArcIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, XIcon, TooltipArrowIcon } from '@ornikar/kitt-icons';
6
6
  export * from '@ornikar/kitt-icons';
7
7
  import styled, { useTheme, css, ThemeProvider } from 'styled-components/native';
8
- import { cloneElement, useContext, createContext, forwardRef, useMemo, useState, Fragment, useEffect, Children } from 'react';
8
+ import { cloneElement, useContext, createContext, forwardRef, useState, Children, useMemo, Fragment, useEffect } from 'react';
9
9
  import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
10
10
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
11
- import { Text as Text$1, Image as Image$1, NativeBaseProvider, extendTheme, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, View as View$2, ScrollView as ScrollView$2, Pressable as Pressable$2 } from 'native-base';
11
+ import { Text as Text$1, Pressable as Pressable$2, Image as Image$1, NativeBaseProvider, extendTheme, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, View as View$2, ScrollView as ScrollView$2 } from 'native-base';
12
12
  import { styled as styled$1 } from '@linaria/react';
13
+ import Animated, { useSharedValue, useDerivedValue, withTiming, useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
13
14
  import { parse } from 'twemoji-parser';
14
15
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
15
16
  import _regeneratorRuntime from '@babel/runtime/regenerator';
@@ -112,14 +113,20 @@ var KittBreakpointNameEnum;
112
113
  KittBreakpointNameEnum["WIDE"] = "wide";
113
114
  })(KittBreakpointNameEnum || (KittBreakpointNameEnum = {}));
114
115
 
115
- var _excluded$j = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
116
+ var _excluded$k = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
116
117
  var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
117
118
  var TypographyColorContext = /*#__PURE__*/createContext('black');
118
119
  function useTypographyColor() {
119
120
  return useContext(TypographyColorContext);
120
121
  }
122
+ var TypographyDefaultColorContext = /*#__PURE__*/createContext(undefined);
123
+
124
+ function useTypographyDefaultColor() {
125
+ return useContext(TypographyDefaultColorContext);
126
+ }
121
127
  /** @deprecated use native-base instead for SSR compatibility */
122
128
 
129
+
123
130
  var getTypographyTypeConfigKey = function (theme) {
124
131
  var isMediumOrAbove = theme.responsive.matchWindowSize({
125
132
  minWidth: KittBreakpoints.MEDIUM
@@ -154,6 +161,11 @@ function createNativeBaseFontSize(type) {
154
161
  });
155
162
  return fontSizeForNativeBase;
156
163
  }
164
+
165
+ function getNBThemeColorFromColorProps(colorName) {
166
+ return colorName ? "kitt.typography.".concat(colorName) : undefined;
167
+ }
168
+
157
169
  function Typography(_ref) {
158
170
  var _type$base;
159
171
 
@@ -173,9 +185,10 @@ function Typography(_ref) {
173
185
  } : _ref$type,
174
186
  variant = _ref.variant,
175
187
  color = _ref.color,
176
- otherProps = _objectWithoutProperties(_ref, _excluded$j);
188
+ otherProps = _objectWithoutProperties(_ref, _excluded$k);
177
189
 
178
190
  var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
191
+ var defaultColor = useTypographyDefaultColor();
179
192
  var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
180
193
  var baseOrDefaultToBody = hasTypographyAncestor ? type.base : (_type$base = type.base) !== null && _type$base !== void 0 ? _type$base : 'body';
181
194
  var isHeader = isTypographyHeader(baseOrDefaultToBody, isHeaderTypographyInContext);
@@ -196,14 +209,16 @@ function Typography(_ref) {
196
209
  });
197
210
  }
198
211
 
212
+ var currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
213
+
199
214
  var text = /*#__PURE__*/jsx(Text$1, _objectSpread({
200
215
  accessibilityRole: accessibilityRole || undefined,
201
216
  fontSize: fontSizeForNativeBase,
202
217
  lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
203
218
  fontWeight: isHeader ? "headers.".concat(nonNullableVariant) : "bodies.".concat(nonNullableVariant),
204
219
  fontFamily: isHeader ? "headers.".concat(nonNullableVariant) : "bodies.".concat(nonNullableVariant),
205
- color: color ? "kitt.typography.".concat(color) : undefined,
206
- textDecorationColor: color ? "kitt.typography.".concat(color) : undefined
220
+ color: getNBThemeColorFromColorProps(currentColor),
221
+ textDecorationColor: getNBThemeColorFromColorProps(currentColor)
207
222
  }, otherProps));
208
223
 
209
224
  var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
@@ -244,6 +259,7 @@ var createHeading = function (level, defaultBase) {
244
259
  return TypographyHeading;
245
260
  };
246
261
 
262
+ Typography.SetDefaultColor = TypographyDefaultColorContext.Provider;
247
263
  Typography.Text = TypographyText;
248
264
  Typography.Paragraph = TypographyParagraph;
249
265
  Typography.Header1 = createHeading(1);
@@ -268,7 +284,7 @@ Typography.h4 = createHeading(4, 'header4');
268
284
 
269
285
  Typography.h5 = createHeading(5, 'header5');
270
286
 
271
- var _excluded$i = ["size", "round", "light", "sizeVariant"];
287
+ var _excluded$j = ["size", "round", "light", "sizeVariant"];
272
288
 
273
289
  var getInitials = function (firstname, lastname) {
274
290
  return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
@@ -340,7 +356,7 @@ function Avatar(_ref6) {
340
356
  round = _ref6.round,
341
357
  light = _ref6.light,
342
358
  sizeVariant = _ref6.sizeVariant,
343
- props = _objectWithoutProperties(_ref6, _excluded$i);
359
+ props = _objectWithoutProperties(_ref6, _excluded$j);
344
360
 
345
361
  return /*#__PURE__*/jsx(StyledAvatarView, {
346
362
  $size: size,
@@ -407,7 +423,7 @@ function isSubtle(type) {
407
423
  return type.startsWith('subtle');
408
424
  }
409
425
 
410
- var _excluded$h = ["$type", "$variant", "$isStretch", "disabled"];
426
+ var _excluded$i = ["$type", "$variant", "$isStretch", "disabled"];
411
427
  var AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/styled$1("div")({
412
428
  name: "AnimatedButtonPressableContainer",
413
429
  "class": "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
@@ -521,7 +537,7 @@ var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref18, ref) {
521
537
  $variant = _ref18.$variant,
522
538
  $isStretch = _ref18.$isStretch,
523
539
  disabled = _ref18.disabled,
524
- props = _objectWithoutProperties(_ref18, _excluded$h);
540
+ props = _objectWithoutProperties(_ref18, _excluded$i);
525
541
 
526
542
  return /*#__PURE__*/jsx(AnimatedButtonPressableContainer, {
527
543
  ref: ref,
@@ -576,12 +592,12 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled(View$1).withConfig({
576
592
  return defaultPadding;
577
593
  });
578
594
 
579
- var _excluded$g = ["color"],
595
+ var _excluded$h = ["color"],
580
596
  _excluded2$3 = ["color"];
581
597
 
582
598
  function TypographyIconSpecifiedColor(_ref) {
583
599
  var color = _ref.color,
584
- props = _objectWithoutProperties(_ref, _excluded$g);
600
+ props = _objectWithoutProperties(_ref, _excluded$h);
585
601
 
586
602
  var theme = /*#__PURE__*/useTheme();
587
603
  return /*#__PURE__*/jsx(Icon, _objectSpread(_objectSpread({}, props), {}, {
@@ -609,7 +625,7 @@ function TypographyIcon(_ref2) {
609
625
  return /*#__PURE__*/jsx(TypographyIconInheritColor, _objectSpread({}, props));
610
626
  }
611
627
 
612
- var _excluded$f = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
628
+ var _excluded$g = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
613
629
 
614
630
  var getTextColorByType = function (type, variant) {
615
631
  switch (type) {
@@ -751,7 +767,7 @@ function ButtonContent(_ref7) {
751
767
  $isStretch = _ref7.$isStretch,
752
768
  icon = _ref7.icon,
753
769
  children = _ref7.children,
754
- props = _objectWithoutProperties(_ref7, _excluded$f);
770
+ props = _objectWithoutProperties(_ref7, _excluded$g);
755
771
 
756
772
  var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
757
773
  return /*#__PURE__*/jsx(ButtonContentContainer, {
@@ -875,6 +891,315 @@ function Card(_ref6) {
875
891
  });
876
892
  }
877
893
 
894
+ function getCurrentTextColor(_ref) {
895
+ var isDisabled = _ref.isDisabled,
896
+ isSelected = _ref.isSelected,
897
+ isPressed = _ref.isPressed,
898
+ isHovered = _ref.isHovered;
899
+ if (isDisabled) return 'black-light';
900
+ if (isSelected && isHovered) return 'white';
901
+ if (isSelected || isPressed) return 'white';
902
+ return 'black';
903
+ }
904
+
905
+ function getBorderRadius(defaultRadius, variant) {
906
+ // The clean way to have the rounded effect would have been to know the children height since radius >= height * 0.5
907
+ // We don't control over the height of the rendered children we just go with a arbitrary really high value
908
+ if (variant === 'rounded') return 800;
909
+ return defaultRadius;
910
+ }
911
+
912
+ var DisabledBorder = /*#__PURE__*/styled(View$1).withConfig({
913
+ displayName: "ChoiceItem__DisabledBorder",
914
+ componentId: "kitt-universal__sc-wuv3y6-0"
915
+ })(["border-radius:", "px;", ";"], function (_ref2) {
916
+ var theme = _ref2.theme,
917
+ $variant = _ref2.$variant;
918
+ return getBorderRadius(theme.kitt.choices.item.borderRadius, $variant);
919
+ }, function (_ref3) {
920
+ var theme = _ref3.theme;
921
+ var _theme$kitt$choices$i = theme.kitt.choices.item.disabled.border,
922
+ width = _theme$kitt$choices$i.width,
923
+ color = _theme$kitt$choices$i.color;
924
+ return css(["border:", "px solid ", ";"], width, color);
925
+ });
926
+ var ChoiceItemView = /*#__PURE__*/styled(Animated.View).withConfig({
927
+ displayName: "ChoiceItem__ChoiceItemView",
928
+ componentId: "kitt-universal__sc-wuv3y6-1"
929
+ })(["position:relative;border-radius:", "px;background-color:", ";", ";", ""], function (_ref4) {
930
+ var theme = _ref4.theme,
931
+ $variant = _ref4.$variant;
932
+ return getBorderRadius(theme.kitt.choices.item.borderRadius, $variant);
933
+ }, function (_ref5) {
934
+ var theme = _ref5.theme,
935
+ $isHovered = _ref5.$isHovered,
936
+ $isPressed = _ref5.$isPressed,
937
+ $isDisabled = _ref5.$isDisabled,
938
+ $isSelected = _ref5.$isSelected;
939
+ var _theme$kitt$choices$i2 = theme.kitt.choices.item.backgroundColor,
940
+ hoverWhenSelected = _theme$kitt$choices$i2.hoverWhenSelected,
941
+ hover = _theme$kitt$choices$i2.hover,
942
+ disabled = _theme$kitt$choices$i2.disabled,
943
+ selected = _theme$kitt$choices$i2.selected,
944
+ pressed = _theme$kitt$choices$i2.pressed,
945
+ defaultBackground = _theme$kitt$choices$i2["default"];
946
+ if ($isDisabled) return disabled;
947
+ if ($isSelected && $isHovered) return hoverWhenSelected;
948
+ if ($isPressed) return pressed;
949
+ if ($isHovered) return hover;
950
+ if ($isSelected) return selected;
951
+ return defaultBackground;
952
+ }, function (_ref6) {
953
+ var theme = _ref6.theme;
954
+ var _theme$kitt$choices$i3 = theme.kitt.choices.item.padding,
955
+ base = _theme$kitt$choices$i3.base,
956
+ small = _theme$kitt$choices$i3.small;
957
+ return theme.responsive.ifWindowSizeMatches({
958
+ minWidth: KittBreakpoints.SMALL
959
+ }, css(["padding:", "px;"], small), css(["padding:", "px;"], base));
960
+ }, function (_ref7) {
961
+ var theme = _ref7.theme;
962
+ var _theme$kitt$choices$i4 = theme.kitt.choices.item.transition,
963
+ property = _theme$kitt$choices$i4.property,
964
+ duration = _theme$kitt$choices$i4.duration,
965
+ timingFunction = _theme$kitt$choices$i4.timingFunction;
966
+ return css(["transition:", " ", "ms ", ";"], property, duration, timingFunction);
967
+ });
968
+ function ChoiceItem(_ref8) {
969
+ var _ref8$type = _ref8.type,
970
+ type = _ref8$type === void 0 ? 'button' : _ref8$type,
971
+ value = _ref8.value,
972
+ selected = _ref8.selected,
973
+ disabled = _ref8.disabled,
974
+ variant = _ref8.variant,
975
+ _children = _ref8.children,
976
+ isPressedInternal = _ref8.isPressedInternal,
977
+ isHoveredInternal = _ref8.isHoveredInternal,
978
+ onPress = _ref8.onPress,
979
+ onChange = _ref8.onChange,
980
+ onBlur = _ref8.onBlur,
981
+ onFocus = _ref8.onFocus;
982
+ var theme = /*#__PURE__*/useTheme();
983
+ var pressed = useSharedValue(Boolean(isPressedInternal));
984
+ var progress = useDerivedValue(function () {
985
+ var _f = function () {
986
+ return withTiming(pressed.value ? 1 : 0, {
987
+ duration: theme.kitt.choices.item.transition.duration
988
+ });
989
+ };
990
+
991
+ _f._closure = {
992
+ withTiming: withTiming,
993
+ pressed: pressed,
994
+ theme: {
995
+ kitt: {
996
+ choices: {
997
+ item: {
998
+ transition: {
999
+ duration: theme.kitt.choices.item.transition.duration
1000
+ }
1001
+ }
1002
+ }
1003
+ }
1004
+ }
1005
+ };
1006
+ _f.asString = "function _f(){const{withTiming,pressed,theme}=jsThis._closure;{return withTiming(pressed.value?1:0,{duration:theme.kitt.choices.item.transition.duration});}}";
1007
+ _f.__workletHash = 1120030177160;
1008
+ _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (180:35)";
1009
+ return _f;
1010
+ }());
1011
+ useAnimatedStyle(function () {
1012
+ var _f = function () {
1013
+ var _theme$kitt$choices$i5 = theme.kitt.choices.item.backgroundColor,
1014
+ defaultBg = _theme$kitt$choices$i5["default"],
1015
+ pressedBg = _theme$kitt$choices$i5.pressed,
1016
+ selectedBg = _theme$kitt$choices$i5.selected,
1017
+ disabledBg = _theme$kitt$choices$i5.disabled;
1018
+ if (disabled) return {
1019
+ backgroundColor: disabledBg
1020
+ };
1021
+ if (selected) return {
1022
+ backgroundColor: selectedBg
1023
+ };
1024
+ return {
1025
+ backgroundColor: interpolateColor(progress.value, [0, 1], [defaultBg, pressedBg])
1026
+ };
1027
+ };
1028
+
1029
+ _f._closure = {
1030
+ theme: {
1031
+ kitt: {
1032
+ choices: {
1033
+ item: {
1034
+ backgroundColor: theme.kitt.choices.item.backgroundColor
1035
+ }
1036
+ }
1037
+ }
1038
+ },
1039
+ disabled: disabled,
1040
+ selected: selected,
1041
+ interpolateColor: interpolateColor,
1042
+ progress: progress
1043
+ };
1044
+ _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])};}}";
1045
+ _f.__workletHash = 15506726129309;
1046
+ _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (184:44)";
1047
+ return _f;
1048
+ }());
1049
+
1050
+ var handleChange = function () {
1051
+ if (!onChange) return; // Checkbox can be toggled
1052
+
1053
+ if (type === 'checkbox') {
1054
+ onChange(selected ? undefined : value);
1055
+ return;
1056
+ }
1057
+
1058
+ onChange(value);
1059
+ };
1060
+
1061
+ return /*#__PURE__*/jsx(Pressable$2, {
1062
+ disabled: disabled,
1063
+ accessibilityRole: type,
1064
+ accessibilityState: {
1065
+ checked: selected
1066
+ },
1067
+ onBlur: onBlur,
1068
+ onFocus: onFocus,
1069
+ onPress: function handlePress(e) {
1070
+ if (onFocus) onFocus(e);
1071
+ if (onPress) onPress();
1072
+ handleChange();
1073
+ if (onBlur) onBlur(e);
1074
+ },
1075
+ onPressIn: function onPressIn() {
1076
+ pressed.value = true;
1077
+ },
1078
+ onPressOut: function onPressOut() {
1079
+ pressed.value = false;
1080
+ },
1081
+ children: function children(_ref9) {
1082
+ var isHovered = _ref9.isHovered,
1083
+ isPressed = _ref9.isPressed;
1084
+ return /*#__PURE__*/jsxs(ChoiceItemView, {
1085
+ style: undefined,
1086
+ $isHovered: isHovered || isHoveredInternal,
1087
+ $isDisabled: disabled,
1088
+ $isSelected: selected,
1089
+ $isPressed: isPressed || isPressedInternal,
1090
+ $variant: variant,
1091
+ children: [/*#__PURE__*/jsx(Typography.SetDefaultColor, {
1092
+ value: getCurrentTextColor({
1093
+ isDisabled: disabled,
1094
+ isSelected: selected || isPressedInternal,
1095
+ isPressed: isPressed,
1096
+ isHovered: isHovered || isHoveredInternal
1097
+ }),
1098
+ children: _children
1099
+ }), disabled ? /*#__PURE__*/jsx(DisabledBorder, {
1100
+ $variant: variant,
1101
+ style: StyleSheet.absoluteFillObject
1102
+ }) : null]
1103
+ });
1104
+ }
1105
+ });
1106
+ }
1107
+
1108
+ var ChoiceItemContainer = /*#__PURE__*/styled(View$1).withConfig({
1109
+ displayName: "ChoiceItemContainer",
1110
+ componentId: "kitt-universal__sc-17uuimx-0"
1111
+ })(["", ""], function (_ref) {
1112
+ var theme = _ref.theme,
1113
+ $isLast = _ref.$isLast,
1114
+ $direction = _ref.$direction;
1115
+ var _theme$kitt$choices$s = theme.kitt.choices.spacing,
1116
+ row = _theme$kitt$choices$s.row,
1117
+ column = _theme$kitt$choices$s.column;
1118
+
1119
+ if ($direction === 'row') {
1120
+ return css(["margin-right:", "px;"], $isLast ? 0 : row);
1121
+ }
1122
+
1123
+ return css(["margin-bottom:", "px;"], $isLast ? 0 : column);
1124
+ });
1125
+
1126
+ var _excluded$f = ["direction"];
1127
+
1128
+ function ChoicesContainer(_ref) {
1129
+ var direction = _ref.direction,
1130
+ props = _objectWithoutProperties(_ref, _excluded$f);
1131
+
1132
+ if (direction === 'row') {
1133
+ return /*#__PURE__*/jsx(ScrollView$1, _objectSpread({
1134
+ horizontal: true
1135
+ }, props));
1136
+ }
1137
+
1138
+ return /*#__PURE__*/jsx(View$1, _objectSpread({}, props));
1139
+ }
1140
+
1141
+ function Choices(_ref2) {
1142
+ var id = _ref2.id,
1143
+ testID = _ref2.testID,
1144
+ type = _ref2.type,
1145
+ _ref2$direction = _ref2.direction,
1146
+ direction = _ref2$direction === void 0 ? 'column' : _ref2$direction,
1147
+ disabled = _ref2.disabled,
1148
+ children = _ref2.children,
1149
+ value = _ref2.value,
1150
+ variant = _ref2.variant,
1151
+ onPress = _ref2.onPress,
1152
+ onChange = _ref2.onChange,
1153
+ onFocus = _ref2.onFocus,
1154
+ onBlur = _ref2.onBlur;
1155
+
1156
+ var _useState = useState(value),
1157
+ _useState2 = _slicedToArray(_useState, 2),
1158
+ currentValue = _useState2[0],
1159
+ setCurrentValue = _useState2[1];
1160
+
1161
+ var isForm = type && ['radio', 'checkbox'].includes(type);
1162
+ var childrenArray = Children.toArray(children);
1163
+ var sharedProps = {
1164
+ type: type,
1165
+ disabled: disabled,
1166
+ variant: variant,
1167
+ onPress: !isForm ? onPress : undefined,
1168
+ onChange: isForm ? function handleChange(newValue) {
1169
+ setCurrentValue(newValue);
1170
+ if (onChange) onChange(newValue);
1171
+ } : undefined,
1172
+ onFocus: onFocus,
1173
+ onBlur: onBlur
1174
+ };
1175
+ return /*#__PURE__*/jsx(ChoicesContainer, {
1176
+ direction: direction,
1177
+ testID: testID,
1178
+ nativeID: id,
1179
+ children: childrenArray.map(function (child, index) {
1180
+ var element = /*#__PURE__*/cloneElement(child, _objectSpread({
1181
+ selected: isForm ? child.props.value === currentValue : undefined
1182
+ }, sharedProps));
1183
+ return /*#__PURE__*/jsx(ChoiceItemContainer, {
1184
+ $direction: direction,
1185
+ $isLast: index === childrenArray.length - 1,
1186
+ children: element
1187
+ }, child.key);
1188
+ })
1189
+ });
1190
+ }
1191
+
1192
+ Choices.Item = ChoiceItem;
1193
+ function createChoicesComponent() {
1194
+ return Choices;
1195
+ }
1196
+ var ButtonChoices = createChoicesComponent();
1197
+ Choices.ButtonChoices = ButtonChoices;
1198
+ var ChoicesElements = {
1199
+ Item: ChoiceItem,
1200
+ ButtonChoices: ButtonChoices
1201
+ };
1202
+
878
1203
  function Emoji(_ref) {
879
1204
  var emoji = _ref.emoji,
880
1205
  size = _ref.size,
@@ -1236,6 +1561,39 @@ var card = {
1236
1561
  }
1237
1562
  };
1238
1563
 
1564
+ var choices = {
1565
+ spacing: {
1566
+ row: 12,
1567
+ column: 12
1568
+ },
1569
+ item: {
1570
+ borderRadius: 10,
1571
+ padding: {
1572
+ base: 16,
1573
+ small: 24
1574
+ },
1575
+ backgroundColor: {
1576
+ "default": lateOceanColorPalette.black50,
1577
+ disabled: colors.disabled,
1578
+ selected: colors.primary,
1579
+ pressed: lateOceanColorPalette.lateOceanLight1,
1580
+ hover: lateOceanColorPalette.black100,
1581
+ hoverWhenSelected: lateOceanColorPalette.lateOceanLight1
1582
+ },
1583
+ disabled: {
1584
+ border: {
1585
+ width: 2,
1586
+ color: lateOceanColorPalette.black100
1587
+ }
1588
+ },
1589
+ transition: {
1590
+ property: 'all',
1591
+ duration: 300,
1592
+ timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
1593
+ }
1594
+ }
1595
+ };
1596
+
1239
1597
  var feedbackMessage = {
1240
1598
  danger: {
1241
1599
  backgroundColor: colors.danger
@@ -1653,6 +2011,7 @@ var theme = {
1653
2011
  breakpoints: breakpoints,
1654
2012
  button: button,
1655
2013
  card: card,
2014
+ choices: choices,
1656
2015
  feedbackMessage: feedbackMessage,
1657
2016
  forms: forms,
1658
2017
  fullScreenModal: fullScreenModal,
@@ -4697,5 +5056,5 @@ function MatchWindowSize(_ref) {
4697
5056
  return children;
4698
5057
  }
4699
5058
 
4700
- export { Avatar, Button, Card, Checkbox, DatePicker, Emoji, ExternalAppLink, ExternalLink, Flex, FullScreenModal, HStack, Icon, IconButton, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpoints, KittBreakpointsMax, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MatchWindowSize, Message, Modal, ModalBehaviour, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, Radio, ScrollView, DeprecatedSection as Section, Skeleton, SpinningIcon, Stack, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, View, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
5059
+ export { Avatar, Button, Card, Checkbox, ChoicesElements, DatePicker, Emoji, ExternalAppLink, ExternalLink, Flex, FullScreenModal, HStack, Icon, IconButton, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpoints, KittBreakpointsMax, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MatchWindowSize, Message, Modal, ModalBehaviour, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, Radio, ScrollView, DeprecatedSection as Section, Skeleton, SpinningIcon, Stack, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, View, createChoicesComponent, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
4701
5060
  //# sourceMappingURL=index-browser-all.es.web.js.map