@ornikar/kitt-universal 9.3.0 → 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.
- package/dist/definitions/Choices/ChoiceItem.d.ts +38 -0
- package/dist/definitions/Choices/ChoiceItem.d.ts.map +1 -0
- package/dist/definitions/Choices/ChoiceItemContainer.d.ts +10 -0
- package/dist/definitions/Choices/ChoiceItemContainer.d.ts.map +1 -0
- package/dist/definitions/Choices/Choices.d.ts +33 -0
- package/dist/definitions/Choices/Choices.d.ts.map +1 -0
- package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
- package/dist/definitions/index.d.ts +3 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
- package/dist/definitions/test-utils/TestWrapper.d.ts +7 -0
- package/dist/definitions/test-utils/TestWrapper.d.ts.map +1 -0
- package/dist/definitions/themes/default.d.ts +1 -0
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/choices.d.ts +35 -0
- package/dist/definitions/themes/late-ocean/choices.d.ts.map +1 -0
- package/dist/definitions/typography/Typography.d.ts +1 -0
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +385 -26
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +385 -26
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +385 -26
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +384 -22
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +377 -8
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +378 -8
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.android.js +34 -0
- package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.ios.js +34 -0
- package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.js +34 -0
- package/dist/linaria-themes-browser-all.es.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.web.js +34 -0
- package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.js +34 -0
- package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.web.js +34 -0
- package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -2,14 +2,14 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import { UserIcon, CheckboxMark, XIcon, EyeOffIcon, EyeIcon, ArcIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, TooltipArrowIcon } from '@ornikar/kitt-icons';
|
|
4
4
|
export * from '@ornikar/kitt-icons';
|
|
5
|
-
import { Platform, Image,
|
|
5
|
+
import { Platform, Image, StyleSheet, View as View$1, ScrollView as ScrollView$1, Linking, useWindowDimensions, Pressable as Pressable$2, Modal as Modal$1, Text as Text$2, TextInput, Animated as Animated$1, Easing } from 'react-native';
|
|
6
6
|
export { useWindowDimensions as useWindowSize } from 'react-native';
|
|
7
7
|
import styled, { useTheme, css, ThemeProvider } from 'styled-components/native';
|
|
8
|
-
import React, { cloneElement, useContext, createContext, forwardRef, useMemo, useEffect,
|
|
8
|
+
import React, { cloneElement, useContext, createContext, forwardRef, useState, Children, useMemo, useEffect, useRef, Fragment as Fragment$1 } from 'react';
|
|
9
9
|
import { jsx, jsxs, Fragment } 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
|
|
12
|
-
import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, useAnimatedProps, withDelay,
|
|
11
|
+
import { Text as Text$1, Pressable as Pressable$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 } from 'native-base';
|
|
12
|
+
import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, useDerivedValue, withTiming, useAnimatedProps, withDelay, Easing as Easing$1, withRepeat, interpolate } from 'react-native-reanimated';
|
|
13
13
|
import { parse } from 'twemoji-parser';
|
|
14
14
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
15
15
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
@@ -115,14 +115,20 @@ var KittBreakpointNameEnum;
|
|
|
115
115
|
KittBreakpointNameEnum["WIDE"] = "wide";
|
|
116
116
|
})(KittBreakpointNameEnum || (KittBreakpointNameEnum = {}));
|
|
117
117
|
|
|
118
|
-
var _excluded$
|
|
118
|
+
var _excluded$l = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
|
|
119
119
|
var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
|
|
120
120
|
var TypographyColorContext = /*#__PURE__*/createContext('black');
|
|
121
121
|
function useTypographyColor() {
|
|
122
122
|
return useContext(TypographyColorContext);
|
|
123
123
|
}
|
|
124
|
+
var TypographyDefaultColorContext = /*#__PURE__*/createContext(undefined);
|
|
125
|
+
|
|
126
|
+
function useTypographyDefaultColor() {
|
|
127
|
+
return useContext(TypographyDefaultColorContext);
|
|
128
|
+
}
|
|
124
129
|
/** @deprecated use native-base instead for SSR compatibility */
|
|
125
130
|
|
|
131
|
+
|
|
126
132
|
var getTypographyTypeConfigKey = function (theme) {
|
|
127
133
|
var isMediumOrAbove = theme.responsive.matchWindowSize({
|
|
128
134
|
minWidth: KittBreakpoints.MEDIUM
|
|
@@ -157,6 +163,11 @@ function createNativeBaseFontSize(type) {
|
|
|
157
163
|
});
|
|
158
164
|
return fontSizeForNativeBase;
|
|
159
165
|
}
|
|
166
|
+
|
|
167
|
+
function getNBThemeColorFromColorProps(colorName) {
|
|
168
|
+
return colorName ? "kitt.typography.".concat(colorName) : undefined;
|
|
169
|
+
}
|
|
170
|
+
|
|
160
171
|
function Typography(_ref) {
|
|
161
172
|
var _type$base;
|
|
162
173
|
|
|
@@ -176,9 +187,10 @@ function Typography(_ref) {
|
|
|
176
187
|
} : _ref$type,
|
|
177
188
|
variant = _ref.variant,
|
|
178
189
|
color = _ref.color,
|
|
179
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
190
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$l);
|
|
180
191
|
|
|
181
192
|
var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
|
|
193
|
+
var defaultColor = useTypographyDefaultColor();
|
|
182
194
|
var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
|
|
183
195
|
var baseOrDefaultToBody = hasTypographyAncestor ? type.base : (_type$base = type.base) !== null && _type$base !== void 0 ? _type$base : 'body';
|
|
184
196
|
var isHeader = isTypographyHeader(baseOrDefaultToBody, isHeaderTypographyInContext);
|
|
@@ -199,14 +211,16 @@ function Typography(_ref) {
|
|
|
199
211
|
});
|
|
200
212
|
}
|
|
201
213
|
|
|
214
|
+
var currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
|
|
215
|
+
|
|
202
216
|
var text = /*#__PURE__*/jsx(Text$1, _objectSpread({
|
|
203
217
|
accessibilityRole: accessibilityRole || undefined,
|
|
204
218
|
fontSize: fontSizeForNativeBase,
|
|
205
|
-
lineHeight: fontSizeForNativeBase,
|
|
219
|
+
lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
|
|
206
220
|
fontWeight: isHeader ? "headers.".concat(nonNullableVariant) : "bodies.".concat(nonNullableVariant),
|
|
207
221
|
fontFamily: isHeader ? "headers.".concat(nonNullableVariant) : "bodies.".concat(nonNullableVariant),
|
|
208
|
-
color:
|
|
209
|
-
textDecorationColor:
|
|
222
|
+
color: getNBThemeColorFromColorProps(currentColor),
|
|
223
|
+
textDecorationColor: getNBThemeColorFromColorProps(currentColor)
|
|
210
224
|
}, otherProps));
|
|
211
225
|
|
|
212
226
|
var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
|
|
@@ -247,6 +261,7 @@ var createHeading = function (level, defaultBase) {
|
|
|
247
261
|
return TypographyHeading;
|
|
248
262
|
};
|
|
249
263
|
|
|
264
|
+
Typography.SetDefaultColor = TypographyDefaultColorContext.Provider;
|
|
250
265
|
Typography.Text = TypographyText;
|
|
251
266
|
Typography.Paragraph = TypographyParagraph;
|
|
252
267
|
Typography.Header1 = createHeading(1);
|
|
@@ -271,7 +286,7 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
271
286
|
|
|
272
287
|
Typography.h5 = createHeading(5, 'header5');
|
|
273
288
|
|
|
274
|
-
var _excluded$
|
|
289
|
+
var _excluded$k = ["size", "round", "light", "sizeVariant"];
|
|
275
290
|
|
|
276
291
|
var getInitials = function (firstname, lastname) {
|
|
277
292
|
return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
|
|
@@ -342,7 +357,7 @@ function Avatar(_ref6) {
|
|
|
342
357
|
round = _ref6.round,
|
|
343
358
|
light = _ref6.light,
|
|
344
359
|
sizeVariant = _ref6.sizeVariant,
|
|
345
|
-
props = _objectWithoutProperties(_ref6, _excluded$
|
|
360
|
+
props = _objectWithoutProperties(_ref6, _excluded$k);
|
|
346
361
|
|
|
347
362
|
return /*#__PURE__*/jsx(StyledAvatarView, {
|
|
348
363
|
$size: size,
|
|
@@ -521,12 +536,12 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled.View.withConfig({
|
|
|
521
536
|
return defaultPadding;
|
|
522
537
|
});
|
|
523
538
|
|
|
524
|
-
var _excluded$
|
|
539
|
+
var _excluded$j = ["color"],
|
|
525
540
|
_excluded2$3 = ["color"];
|
|
526
541
|
|
|
527
542
|
function TypographyIconSpecifiedColor(_ref) {
|
|
528
543
|
var color = _ref.color,
|
|
529
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
544
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
530
545
|
|
|
531
546
|
var theme = /*#__PURE__*/useTheme();
|
|
532
547
|
return /*#__PURE__*/jsx(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -558,7 +573,7 @@ function isSubtle(type) {
|
|
|
558
573
|
return type.startsWith('subtle');
|
|
559
574
|
}
|
|
560
575
|
|
|
561
|
-
var _excluded$
|
|
576
|
+
var _excluded$i = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
|
|
562
577
|
|
|
563
578
|
var getTextColorByType = function (type, variant) {
|
|
564
579
|
switch (type) {
|
|
@@ -700,7 +715,7 @@ function ButtonContent(_ref7) {
|
|
|
700
715
|
$isStretch = _ref7.$isStretch,
|
|
701
716
|
icon = _ref7.icon,
|
|
702
717
|
children = _ref7.children,
|
|
703
|
-
props = _objectWithoutProperties(_ref7, _excluded$
|
|
718
|
+
props = _objectWithoutProperties(_ref7, _excluded$i);
|
|
704
719
|
|
|
705
720
|
var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
706
721
|
return /*#__PURE__*/jsx(ButtonContentContainer, {
|
|
@@ -836,6 +851,313 @@ function Card(_ref6) {
|
|
|
836
851
|
});
|
|
837
852
|
}
|
|
838
853
|
|
|
854
|
+
function getCurrentTextColor(_ref) {
|
|
855
|
+
var isDisabled = _ref.isDisabled,
|
|
856
|
+
isSelected = _ref.isSelected,
|
|
857
|
+
isPressed = _ref.isPressed,
|
|
858
|
+
isHovered = _ref.isHovered;
|
|
859
|
+
if (isDisabled) return 'black-light';
|
|
860
|
+
if (isSelected && isHovered) return 'white';
|
|
861
|
+
if (isSelected || isPressed) return 'white';
|
|
862
|
+
return 'black';
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
function getBorderRadius(defaultRadius, variant) {
|
|
866
|
+
// The clean way to have the rounded effect would have been to know the children height since radius >= height * 0.5
|
|
867
|
+
// We don't control over the height of the rendered children we just go with a arbitrary really high value
|
|
868
|
+
if (variant === 'rounded') return 800;
|
|
869
|
+
return defaultRadius;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
var DisabledBorder = /*#__PURE__*/styled(View$1).withConfig({
|
|
873
|
+
displayName: "ChoiceItem__DisabledBorder"
|
|
874
|
+
})(["border-radius:", "px;", ";"], function (_ref2) {
|
|
875
|
+
var theme = _ref2.theme,
|
|
876
|
+
$variant = _ref2.$variant;
|
|
877
|
+
return getBorderRadius(theme.kitt.choices.item.borderRadius, $variant);
|
|
878
|
+
}, function (_ref3) {
|
|
879
|
+
var theme = _ref3.theme;
|
|
880
|
+
var _theme$kitt$choices$i = theme.kitt.choices.item.disabled.border,
|
|
881
|
+
width = _theme$kitt$choices$i.width,
|
|
882
|
+
color = _theme$kitt$choices$i.color;
|
|
883
|
+
return css(["border:", "px solid ", ";"], width, color);
|
|
884
|
+
});
|
|
885
|
+
var ChoiceItemView = /*#__PURE__*/styled(Animated.View).withConfig({
|
|
886
|
+
displayName: "ChoiceItem__ChoiceItemView"
|
|
887
|
+
})(["position:relative;border-radius:", "px;background-color:", ";", ";", ""], function (_ref4) {
|
|
888
|
+
var theme = _ref4.theme,
|
|
889
|
+
$variant = _ref4.$variant;
|
|
890
|
+
return getBorderRadius(theme.kitt.choices.item.borderRadius, $variant);
|
|
891
|
+
}, function (_ref5) {
|
|
892
|
+
var theme = _ref5.theme,
|
|
893
|
+
$isHovered = _ref5.$isHovered,
|
|
894
|
+
$isPressed = _ref5.$isPressed,
|
|
895
|
+
$isDisabled = _ref5.$isDisabled,
|
|
896
|
+
$isSelected = _ref5.$isSelected;
|
|
897
|
+
var _theme$kitt$choices$i2 = theme.kitt.choices.item.backgroundColor,
|
|
898
|
+
hoverWhenSelected = _theme$kitt$choices$i2.hoverWhenSelected,
|
|
899
|
+
hover = _theme$kitt$choices$i2.hover,
|
|
900
|
+
disabled = _theme$kitt$choices$i2.disabled,
|
|
901
|
+
selected = _theme$kitt$choices$i2.selected,
|
|
902
|
+
pressed = _theme$kitt$choices$i2.pressed,
|
|
903
|
+
defaultBackground = _theme$kitt$choices$i2["default"];
|
|
904
|
+
if ($isDisabled) return disabled;
|
|
905
|
+
if ($isSelected && $isHovered) return hoverWhenSelected;
|
|
906
|
+
if ($isPressed) return pressed;
|
|
907
|
+
if ($isHovered) return hover;
|
|
908
|
+
if ($isSelected) return selected;
|
|
909
|
+
return defaultBackground;
|
|
910
|
+
}, function (_ref6) {
|
|
911
|
+
var theme = _ref6.theme;
|
|
912
|
+
var _theme$kitt$choices$i3 = theme.kitt.choices.item.padding,
|
|
913
|
+
base = _theme$kitt$choices$i3.base,
|
|
914
|
+
small = _theme$kitt$choices$i3.small;
|
|
915
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
916
|
+
minWidth: KittBreakpoints.SMALL
|
|
917
|
+
}, css(["padding:", "px;"], small), css(["padding:", "px;"], base));
|
|
918
|
+
}, function (_ref7) {
|
|
919
|
+
var theme = _ref7.theme;
|
|
920
|
+
if (Platform.OS !== 'web') return undefined;
|
|
921
|
+
var _theme$kitt$choices$i4 = theme.kitt.choices.item.transition,
|
|
922
|
+
property = _theme$kitt$choices$i4.property,
|
|
923
|
+
duration = _theme$kitt$choices$i4.duration,
|
|
924
|
+
timingFunction = _theme$kitt$choices$i4.timingFunction;
|
|
925
|
+
return css(["transition:", " ", "ms ", ";"], property, duration, timingFunction);
|
|
926
|
+
});
|
|
927
|
+
function ChoiceItem(_ref8) {
|
|
928
|
+
var _ref8$type = _ref8.type,
|
|
929
|
+
type = _ref8$type === void 0 ? 'button' : _ref8$type,
|
|
930
|
+
value = _ref8.value,
|
|
931
|
+
selected = _ref8.selected,
|
|
932
|
+
disabled = _ref8.disabled,
|
|
933
|
+
variant = _ref8.variant,
|
|
934
|
+
_children = _ref8.children,
|
|
935
|
+
isPressedInternal = _ref8.isPressedInternal,
|
|
936
|
+
isHoveredInternal = _ref8.isHoveredInternal,
|
|
937
|
+
onPress = _ref8.onPress,
|
|
938
|
+
onChange = _ref8.onChange,
|
|
939
|
+
onBlur = _ref8.onBlur,
|
|
940
|
+
onFocus = _ref8.onFocus;
|
|
941
|
+
var theme = /*#__PURE__*/useTheme();
|
|
942
|
+
var pressed = useSharedValue(Boolean(isPressedInternal));
|
|
943
|
+
var progress = useDerivedValue(function () {
|
|
944
|
+
var _f = function () {
|
|
945
|
+
return withTiming(pressed.value ? 1 : 0, {
|
|
946
|
+
duration: theme.kitt.choices.item.transition.duration
|
|
947
|
+
});
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
_f._closure = {
|
|
951
|
+
withTiming: withTiming,
|
|
952
|
+
pressed: pressed,
|
|
953
|
+
theme: {
|
|
954
|
+
kitt: {
|
|
955
|
+
choices: {
|
|
956
|
+
item: {
|
|
957
|
+
transition: {
|
|
958
|
+
duration: theme.kitt.choices.item.transition.duration
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
_f.asString = "function _f(){const{withTiming,pressed,theme}=jsThis._closure;{return withTiming(pressed.value?1:0,{duration:theme.kitt.choices.item.transition.duration});}}";
|
|
966
|
+
_f.__workletHash = 1120030177160;
|
|
967
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (180:35)";
|
|
968
|
+
return _f;
|
|
969
|
+
}());
|
|
970
|
+
var backgroundStyles = useAnimatedStyle(function () {
|
|
971
|
+
var _f = function () {
|
|
972
|
+
var _theme$kitt$choices$i5 = theme.kitt.choices.item.backgroundColor,
|
|
973
|
+
defaultBg = _theme$kitt$choices$i5["default"],
|
|
974
|
+
pressedBg = _theme$kitt$choices$i5.pressed,
|
|
975
|
+
selectedBg = _theme$kitt$choices$i5.selected,
|
|
976
|
+
disabledBg = _theme$kitt$choices$i5.disabled;
|
|
977
|
+
if (disabled) return {
|
|
978
|
+
backgroundColor: disabledBg
|
|
979
|
+
};
|
|
980
|
+
if (selected) return {
|
|
981
|
+
backgroundColor: selectedBg
|
|
982
|
+
};
|
|
983
|
+
return {
|
|
984
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [defaultBg, pressedBg])
|
|
985
|
+
};
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
_f._closure = {
|
|
989
|
+
theme: {
|
|
990
|
+
kitt: {
|
|
991
|
+
choices: {
|
|
992
|
+
item: {
|
|
993
|
+
backgroundColor: theme.kitt.choices.item.backgroundColor
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
disabled: disabled,
|
|
999
|
+
selected: selected,
|
|
1000
|
+
interpolateColor: interpolateColor,
|
|
1001
|
+
progress: progress
|
|
1002
|
+
};
|
|
1003
|
+
_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])};}}";
|
|
1004
|
+
_f.__workletHash = 15506726129309;
|
|
1005
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (184:44)";
|
|
1006
|
+
return _f;
|
|
1007
|
+
}());
|
|
1008
|
+
|
|
1009
|
+
var handleChange = function () {
|
|
1010
|
+
if (!onChange) return; // Checkbox can be toggled
|
|
1011
|
+
|
|
1012
|
+
if (type === 'checkbox') {
|
|
1013
|
+
onChange(selected ? undefined : value);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
onChange(value);
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
return /*#__PURE__*/jsx(Pressable$1, {
|
|
1021
|
+
disabled: disabled,
|
|
1022
|
+
accessibilityRole: type,
|
|
1023
|
+
accessibilityState: {
|
|
1024
|
+
checked: selected
|
|
1025
|
+
},
|
|
1026
|
+
onBlur: onBlur,
|
|
1027
|
+
onFocus: onFocus,
|
|
1028
|
+
onPress: function handlePress(e) {
|
|
1029
|
+
if (onFocus) onFocus(e);
|
|
1030
|
+
if (onPress) onPress();
|
|
1031
|
+
handleChange();
|
|
1032
|
+
if (onBlur) onBlur(e);
|
|
1033
|
+
},
|
|
1034
|
+
onPressIn: function onPressIn() {
|
|
1035
|
+
pressed.value = true;
|
|
1036
|
+
},
|
|
1037
|
+
onPressOut: function onPressOut() {
|
|
1038
|
+
pressed.value = false;
|
|
1039
|
+
},
|
|
1040
|
+
children: function children(_ref9) {
|
|
1041
|
+
var isHovered = _ref9.isHovered,
|
|
1042
|
+
isPressed = _ref9.isPressed;
|
|
1043
|
+
return /*#__PURE__*/jsxs(ChoiceItemView, {
|
|
1044
|
+
style: Platform.OS !== 'web' ? [backgroundStyles] : undefined,
|
|
1045
|
+
$isHovered: isHovered || isHoveredInternal,
|
|
1046
|
+
$isDisabled: disabled,
|
|
1047
|
+
$isSelected: selected,
|
|
1048
|
+
$isPressed: isPressed || isPressedInternal,
|
|
1049
|
+
$variant: variant,
|
|
1050
|
+
children: [/*#__PURE__*/jsx(Typography.SetDefaultColor, {
|
|
1051
|
+
value: getCurrentTextColor({
|
|
1052
|
+
isDisabled: disabled,
|
|
1053
|
+
isSelected: selected || isPressedInternal,
|
|
1054
|
+
isPressed: isPressed,
|
|
1055
|
+
isHovered: isHovered || isHoveredInternal
|
|
1056
|
+
}),
|
|
1057
|
+
children: _children
|
|
1058
|
+
}), disabled ? /*#__PURE__*/jsx(DisabledBorder, {
|
|
1059
|
+
$variant: variant,
|
|
1060
|
+
style: StyleSheet.absoluteFillObject
|
|
1061
|
+
}) : null]
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
var ChoiceItemContainer = /*#__PURE__*/styled(View$1).withConfig({
|
|
1068
|
+
displayName: "ChoiceItemContainer"
|
|
1069
|
+
})(["", ""], function (_ref) {
|
|
1070
|
+
var theme = _ref.theme,
|
|
1071
|
+
$isLast = _ref.$isLast,
|
|
1072
|
+
$direction = _ref.$direction;
|
|
1073
|
+
var _theme$kitt$choices$s = theme.kitt.choices.spacing,
|
|
1074
|
+
row = _theme$kitt$choices$s.row,
|
|
1075
|
+
column = _theme$kitt$choices$s.column;
|
|
1076
|
+
|
|
1077
|
+
if ($direction === 'row') {
|
|
1078
|
+
return css(["margin-right:", "px;"], $isLast ? 0 : row);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
return css(["margin-bottom:", "px;"], $isLast ? 0 : column);
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
var _excluded$h = ["direction"];
|
|
1085
|
+
|
|
1086
|
+
function ChoicesContainer(_ref) {
|
|
1087
|
+
var direction = _ref.direction,
|
|
1088
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
1089
|
+
|
|
1090
|
+
if (direction === 'row') {
|
|
1091
|
+
return /*#__PURE__*/jsx(ScrollView$1, _objectSpread({
|
|
1092
|
+
horizontal: true
|
|
1093
|
+
}, props));
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return /*#__PURE__*/jsx(View$1, _objectSpread({}, props));
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
function Choices(_ref2) {
|
|
1100
|
+
var id = _ref2.id,
|
|
1101
|
+
testID = _ref2.testID,
|
|
1102
|
+
type = _ref2.type,
|
|
1103
|
+
_ref2$direction = _ref2.direction,
|
|
1104
|
+
direction = _ref2$direction === void 0 ? 'column' : _ref2$direction,
|
|
1105
|
+
disabled = _ref2.disabled,
|
|
1106
|
+
children = _ref2.children,
|
|
1107
|
+
value = _ref2.value,
|
|
1108
|
+
variant = _ref2.variant,
|
|
1109
|
+
onPress = _ref2.onPress,
|
|
1110
|
+
onChange = _ref2.onChange,
|
|
1111
|
+
onFocus = _ref2.onFocus,
|
|
1112
|
+
onBlur = _ref2.onBlur;
|
|
1113
|
+
|
|
1114
|
+
var _useState = useState(value),
|
|
1115
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1116
|
+
currentValue = _useState2[0],
|
|
1117
|
+
setCurrentValue = _useState2[1];
|
|
1118
|
+
|
|
1119
|
+
var isForm = type && ['radio', 'checkbox'].includes(type);
|
|
1120
|
+
var childrenArray = Children.toArray(children);
|
|
1121
|
+
var sharedProps = {
|
|
1122
|
+
type: type,
|
|
1123
|
+
disabled: disabled,
|
|
1124
|
+
variant: variant,
|
|
1125
|
+
onPress: !isForm ? onPress : undefined,
|
|
1126
|
+
onChange: isForm ? function handleChange(newValue) {
|
|
1127
|
+
setCurrentValue(newValue);
|
|
1128
|
+
if (onChange) onChange(newValue);
|
|
1129
|
+
} : undefined,
|
|
1130
|
+
onFocus: onFocus,
|
|
1131
|
+
onBlur: onBlur
|
|
1132
|
+
};
|
|
1133
|
+
return /*#__PURE__*/jsx(ChoicesContainer, {
|
|
1134
|
+
direction: direction,
|
|
1135
|
+
testID: testID,
|
|
1136
|
+
nativeID: id,
|
|
1137
|
+
children: childrenArray.map(function (child, index) {
|
|
1138
|
+
var element = /*#__PURE__*/cloneElement(child, _objectSpread({
|
|
1139
|
+
selected: isForm ? child.props.value === currentValue : undefined
|
|
1140
|
+
}, sharedProps));
|
|
1141
|
+
return /*#__PURE__*/jsx(ChoiceItemContainer, {
|
|
1142
|
+
$direction: direction,
|
|
1143
|
+
$isLast: index === childrenArray.length - 1,
|
|
1144
|
+
children: element
|
|
1145
|
+
}, child.key);
|
|
1146
|
+
})
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
Choices.Item = ChoiceItem;
|
|
1151
|
+
function createChoicesComponent() {
|
|
1152
|
+
return Choices;
|
|
1153
|
+
}
|
|
1154
|
+
var ButtonChoices = createChoicesComponent();
|
|
1155
|
+
Choices.ButtonChoices = ButtonChoices;
|
|
1156
|
+
var ChoicesElements = {
|
|
1157
|
+
Item: ChoiceItem,
|
|
1158
|
+
ButtonChoices: ButtonChoices
|
|
1159
|
+
};
|
|
1160
|
+
|
|
839
1161
|
function Emoji(_ref) {
|
|
840
1162
|
var emoji = _ref.emoji,
|
|
841
1163
|
size = _ref.size,
|
|
@@ -1220,6 +1542,39 @@ var card = {
|
|
|
1220
1542
|
}
|
|
1221
1543
|
};
|
|
1222
1544
|
|
|
1545
|
+
var choices = {
|
|
1546
|
+
spacing: {
|
|
1547
|
+
row: 12,
|
|
1548
|
+
column: 12
|
|
1549
|
+
},
|
|
1550
|
+
item: {
|
|
1551
|
+
borderRadius: 10,
|
|
1552
|
+
padding: {
|
|
1553
|
+
base: 16,
|
|
1554
|
+
small: 24
|
|
1555
|
+
},
|
|
1556
|
+
backgroundColor: {
|
|
1557
|
+
"default": lateOceanColorPalette.black50,
|
|
1558
|
+
disabled: colors.disabled,
|
|
1559
|
+
selected: colors.primary,
|
|
1560
|
+
pressed: lateOceanColorPalette.lateOceanLight1,
|
|
1561
|
+
hover: lateOceanColorPalette.black100,
|
|
1562
|
+
hoverWhenSelected: lateOceanColorPalette.lateOceanLight1
|
|
1563
|
+
},
|
|
1564
|
+
disabled: {
|
|
1565
|
+
border: {
|
|
1566
|
+
width: 2,
|
|
1567
|
+
color: lateOceanColorPalette.black100
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
transition: {
|
|
1571
|
+
property: 'all',
|
|
1572
|
+
duration: 300,
|
|
1573
|
+
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1223
1578
|
var feedbackMessage = {
|
|
1224
1579
|
danger: {
|
|
1225
1580
|
backgroundColor: colors.danger
|
|
@@ -1637,6 +1992,7 @@ var theme = {
|
|
|
1637
1992
|
breakpoints: breakpoints,
|
|
1638
1993
|
button: button,
|
|
1639
1994
|
card: card,
|
|
1995
|
+
choices: choices,
|
|
1640
1996
|
feedbackMessage: feedbackMessage,
|
|
1641
1997
|
forms: forms,
|
|
1642
1998
|
fullScreenModal: fullScreenModal,
|
|
@@ -1998,7 +2354,7 @@ function DatePickerAndroid(_ref) {
|
|
|
1998
2354
|
}
|
|
1999
2355
|
|
|
2000
2356
|
// Don't use styled.Pressable here - babel-plugin-styled-components-react-native-web only supports tagged templates
|
|
2001
|
-
var OverlayPressable = /*#__PURE__*/styled(Pressable$
|
|
2357
|
+
var OverlayPressable = /*#__PURE__*/styled(Pressable$2).withConfig({
|
|
2002
2358
|
displayName: "Overlay__OverlayPressable"
|
|
2003
2359
|
})(function (_ref) {
|
|
2004
2360
|
var theme = _ref.theme;
|
|
@@ -2747,7 +3103,7 @@ function InputIcon(_ref) {
|
|
|
2747
3103
|
function InputPressable(_ref) {
|
|
2748
3104
|
var props = _extends({}, _ref);
|
|
2749
3105
|
|
|
2750
|
-
return /*#__PURE__*/jsx(Pressable$
|
|
3106
|
+
return /*#__PURE__*/jsx(Pressable$2, _objectSpread({}, props));
|
|
2751
3107
|
}
|
|
2752
3108
|
|
|
2753
3109
|
var _excluded$8 = ["isPasswordDefaultVisible", "right"];
|
|
@@ -3255,7 +3611,7 @@ function ListItem(_ref5) {
|
|
|
3255
3611
|
onPress = _ref5.onPress,
|
|
3256
3612
|
rest = _objectWithoutProperties(_ref5, _excluded$5);
|
|
3257
3613
|
|
|
3258
|
-
var Wrapper = onPress ? Pressable$
|
|
3614
|
+
var Wrapper = onPress ? Pressable$2 : Fragment$1;
|
|
3259
3615
|
var wrapperProps = onPress ? _objectSpread({
|
|
3260
3616
|
accessibilityRole: 'button',
|
|
3261
3617
|
onPress: onPress
|
|
@@ -3507,8 +3863,13 @@ var createKittSpaces = function (spacing) {
|
|
|
3507
3863
|
}
|
|
3508
3864
|
|
|
3509
3865
|
return sizes;
|
|
3510
|
-
}; //
|
|
3866
|
+
}; // reset native-base to be able to set size / space as a number
|
|
3867
|
+
// https://docs.nativebase.io/next/default-theme#h2-size
|
|
3868
|
+
|
|
3511
3869
|
|
|
3870
|
+
var overridenNativeBaseSizeandSpaceScale = Object.fromEntries([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64, 72, 80, 96, 0.5, 1.5, 2.5, 3.5].map(function (value) {
|
|
3871
|
+
return [value, value];
|
|
3872
|
+
})); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type -- let typescript infer types
|
|
3512
3873
|
|
|
3513
3874
|
var createKittNativeBaseCustomTheme = function (theme) {
|
|
3514
3875
|
var spaces = createKittSpaces(theme.spacing);
|
|
@@ -3521,10 +3882,8 @@ var createKittNativeBaseCustomTheme = function (theme) {
|
|
|
3521
3882
|
radii: {
|
|
3522
3883
|
'kitt.borderRadius': theme.card.borderRadius
|
|
3523
3884
|
},
|
|
3524
|
-
sizes: _objectSpread(_objectSpread({}, spaces),
|
|
3525
|
-
|
|
3526
|
-
}))),
|
|
3527
|
-
space: spaces,
|
|
3885
|
+
sizes: _objectSpread(_objectSpread({}, spaces), overridenNativeBaseSizeandSpaceScale),
|
|
3886
|
+
space: _objectSpread(_objectSpread({}, spaces), overridenNativeBaseSizeandSpaceScale),
|
|
3528
3887
|
breakpoints: {
|
|
3529
3888
|
// kitt breakpoints
|
|
3530
3889
|
base: KittBreakpoints.BASE,
|
|
@@ -3645,7 +4004,7 @@ var HStack = HStack$1;
|
|
|
3645
4004
|
|
|
3646
4005
|
var View = View$2;
|
|
3647
4006
|
var ScrollView = ScrollView$2;
|
|
3648
|
-
var Pressable = Pressable$
|
|
4007
|
+
var Pressable = Pressable$1;
|
|
3649
4008
|
|
|
3650
4009
|
var _excluded$4 = ["children"];
|
|
3651
4010
|
var ViewWithPadding = /*#__PURE__*/styled(View$1).withConfig({
|
|
@@ -4976,7 +5335,7 @@ function Tooltip(_ref) {
|
|
|
4976
5335
|
return /*#__PURE__*/jsxs(TooltipContainer, {
|
|
4977
5336
|
children: [/*#__PURE__*/jsx(View$1, {
|
|
4978
5337
|
ref: reference,
|
|
4979
|
-
children: /*#__PURE__*/jsx(Pressable$
|
|
5338
|
+
children: /*#__PURE__*/jsx(Pressable$2, {
|
|
4980
5339
|
accessibilityRole: "button",
|
|
4981
5340
|
onPress: function handlePress() {
|
|
4982
5341
|
pressed.value = !pressed.value;
|
|
@@ -5216,5 +5575,5 @@ function withTheme(WrappedComponent) {
|
|
|
5216
5575
|
});
|
|
5217
5576
|
}
|
|
5218
5577
|
|
|
5219
|
-
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 };
|
|
5578
|
+
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 };
|
|
5220
5579
|
//# sourceMappingURL=index-browser-all.es.ios.js.map
|