@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';
|
|
@@ -116,14 +116,20 @@ var KittBreakpointNameEnum;
|
|
|
116
116
|
KittBreakpointNameEnum["WIDE"] = "wide";
|
|
117
117
|
})(KittBreakpointNameEnum || (KittBreakpointNameEnum = {}));
|
|
118
118
|
|
|
119
|
-
var _excluded$
|
|
119
|
+
var _excluded$l = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
|
|
120
120
|
var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
|
|
121
121
|
var TypographyColorContext = /*#__PURE__*/createContext('black');
|
|
122
122
|
function useTypographyColor() {
|
|
123
123
|
return useContext(TypographyColorContext);
|
|
124
124
|
}
|
|
125
|
+
var TypographyDefaultColorContext = /*#__PURE__*/createContext(undefined);
|
|
126
|
+
|
|
127
|
+
function useTypographyDefaultColor() {
|
|
128
|
+
return useContext(TypographyDefaultColorContext);
|
|
129
|
+
}
|
|
125
130
|
/** @deprecated use native-base instead for SSR compatibility */
|
|
126
131
|
|
|
132
|
+
|
|
127
133
|
var getTypographyTypeConfigKey = function (theme) {
|
|
128
134
|
var isMediumOrAbove = theme.responsive.matchWindowSize({
|
|
129
135
|
minWidth: KittBreakpoints.MEDIUM
|
|
@@ -158,6 +164,11 @@ function createNativeBaseFontSize(type) {
|
|
|
158
164
|
});
|
|
159
165
|
return fontSizeForNativeBase;
|
|
160
166
|
}
|
|
167
|
+
|
|
168
|
+
function getNBThemeColorFromColorProps(colorName) {
|
|
169
|
+
return colorName ? "kitt.typography.".concat(colorName) : undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
161
172
|
function Typography(_ref) {
|
|
162
173
|
var _type$base;
|
|
163
174
|
|
|
@@ -177,9 +188,10 @@ function Typography(_ref) {
|
|
|
177
188
|
} : _ref$type,
|
|
178
189
|
variant = _ref.variant,
|
|
179
190
|
color = _ref.color,
|
|
180
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
191
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$l);
|
|
181
192
|
|
|
182
193
|
var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
|
|
194
|
+
var defaultColor = useTypographyDefaultColor();
|
|
183
195
|
var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
|
|
184
196
|
var baseOrDefaultToBody = hasTypographyAncestor ? type.base : (_type$base = type.base) !== null && _type$base !== void 0 ? _type$base : 'body';
|
|
185
197
|
var isHeader = isTypographyHeader(baseOrDefaultToBody, isHeaderTypographyInContext);
|
|
@@ -200,14 +212,16 @@ function Typography(_ref) {
|
|
|
200
212
|
});
|
|
201
213
|
}
|
|
202
214
|
|
|
215
|
+
var currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
|
|
216
|
+
|
|
203
217
|
var text = /*#__PURE__*/jsx(Text$1, _objectSpread({
|
|
204
218
|
accessibilityRole: accessibilityRole || undefined,
|
|
205
219
|
fontSize: fontSizeForNativeBase,
|
|
206
|
-
lineHeight: fontSizeForNativeBase,
|
|
220
|
+
lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
|
|
207
221
|
fontWeight: isHeader ? "headers.".concat(nonNullableVariant) : "bodies.".concat(nonNullableVariant),
|
|
208
222
|
fontFamily: isHeader ? "headers.".concat(nonNullableVariant) : "bodies.".concat(nonNullableVariant),
|
|
209
|
-
color:
|
|
210
|
-
textDecorationColor:
|
|
223
|
+
color: getNBThemeColorFromColorProps(currentColor),
|
|
224
|
+
textDecorationColor: getNBThemeColorFromColorProps(currentColor)
|
|
211
225
|
}, otherProps));
|
|
212
226
|
|
|
213
227
|
var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
|
|
@@ -248,6 +262,7 @@ var createHeading = function (level, defaultBase) {
|
|
|
248
262
|
return TypographyHeading;
|
|
249
263
|
};
|
|
250
264
|
|
|
265
|
+
Typography.SetDefaultColor = TypographyDefaultColorContext.Provider;
|
|
251
266
|
Typography.Text = TypographyText;
|
|
252
267
|
Typography.Paragraph = TypographyParagraph;
|
|
253
268
|
Typography.Header1 = createHeading(1);
|
|
@@ -272,7 +287,7 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
272
287
|
|
|
273
288
|
Typography.h5 = createHeading(5, 'header5');
|
|
274
289
|
|
|
275
|
-
var _excluded$
|
|
290
|
+
var _excluded$k = ["size", "round", "light", "sizeVariant"];
|
|
276
291
|
|
|
277
292
|
var getInitials = function (firstname, lastname) {
|
|
278
293
|
return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
|
|
@@ -343,7 +358,7 @@ function Avatar(_ref6) {
|
|
|
343
358
|
round = _ref6.round,
|
|
344
359
|
light = _ref6.light,
|
|
345
360
|
sizeVariant = _ref6.sizeVariant,
|
|
346
|
-
props = _objectWithoutProperties(_ref6, _excluded$
|
|
361
|
+
props = _objectWithoutProperties(_ref6, _excluded$k);
|
|
347
362
|
|
|
348
363
|
return /*#__PURE__*/jsx(StyledAvatarView, {
|
|
349
364
|
$size: size,
|
|
@@ -522,12 +537,12 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled.View.withConfig({
|
|
|
522
537
|
return defaultPadding;
|
|
523
538
|
});
|
|
524
539
|
|
|
525
|
-
var _excluded$
|
|
540
|
+
var _excluded$j = ["color"],
|
|
526
541
|
_excluded2$3 = ["color"];
|
|
527
542
|
|
|
528
543
|
function TypographyIconSpecifiedColor(_ref) {
|
|
529
544
|
var color = _ref.color,
|
|
530
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
545
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
531
546
|
|
|
532
547
|
var theme = /*#__PURE__*/useTheme();
|
|
533
548
|
return /*#__PURE__*/jsx(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -559,7 +574,7 @@ function isSubtle(type) {
|
|
|
559
574
|
return type.startsWith('subtle');
|
|
560
575
|
}
|
|
561
576
|
|
|
562
|
-
var _excluded$
|
|
577
|
+
var _excluded$i = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
|
|
563
578
|
|
|
564
579
|
var getTextColorByType = function (type, variant) {
|
|
565
580
|
switch (type) {
|
|
@@ -701,7 +716,7 @@ function ButtonContent(_ref7) {
|
|
|
701
716
|
$isStretch = _ref7.$isStretch,
|
|
702
717
|
icon = _ref7.icon,
|
|
703
718
|
children = _ref7.children,
|
|
704
|
-
props = _objectWithoutProperties(_ref7, _excluded$
|
|
719
|
+
props = _objectWithoutProperties(_ref7, _excluded$i);
|
|
705
720
|
|
|
706
721
|
var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
707
722
|
return /*#__PURE__*/jsx(ButtonContentContainer, {
|
|
@@ -837,6 +852,313 @@ function Card(_ref6) {
|
|
|
837
852
|
});
|
|
838
853
|
}
|
|
839
854
|
|
|
855
|
+
function getCurrentTextColor(_ref) {
|
|
856
|
+
var isDisabled = _ref.isDisabled,
|
|
857
|
+
isSelected = _ref.isSelected,
|
|
858
|
+
isPressed = _ref.isPressed,
|
|
859
|
+
isHovered = _ref.isHovered;
|
|
860
|
+
if (isDisabled) return 'black-light';
|
|
861
|
+
if (isSelected && isHovered) return 'white';
|
|
862
|
+
if (isSelected || isPressed) return 'white';
|
|
863
|
+
return 'black';
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function getBorderRadius(defaultRadius, variant) {
|
|
867
|
+
// The clean way to have the rounded effect would have been to know the children height since radius >= height * 0.5
|
|
868
|
+
// We don't control over the height of the rendered children we just go with a arbitrary really high value
|
|
869
|
+
if (variant === 'rounded') return 800;
|
|
870
|
+
return defaultRadius;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
var DisabledBorder = /*#__PURE__*/styled(View$1).withConfig({
|
|
874
|
+
displayName: "ChoiceItem__DisabledBorder"
|
|
875
|
+
})(["border-radius:", "px;", ";"], function (_ref2) {
|
|
876
|
+
var theme = _ref2.theme,
|
|
877
|
+
$variant = _ref2.$variant;
|
|
878
|
+
return getBorderRadius(theme.kitt.choices.item.borderRadius, $variant);
|
|
879
|
+
}, function (_ref3) {
|
|
880
|
+
var theme = _ref3.theme;
|
|
881
|
+
var _theme$kitt$choices$i = theme.kitt.choices.item.disabled.border,
|
|
882
|
+
width = _theme$kitt$choices$i.width,
|
|
883
|
+
color = _theme$kitt$choices$i.color;
|
|
884
|
+
return css(["border:", "px solid ", ";"], width, color);
|
|
885
|
+
});
|
|
886
|
+
var ChoiceItemView = /*#__PURE__*/styled(Animated.View).withConfig({
|
|
887
|
+
displayName: "ChoiceItem__ChoiceItemView"
|
|
888
|
+
})(["position:relative;border-radius:", "px;background-color:", ";", ";", ""], function (_ref4) {
|
|
889
|
+
var theme = _ref4.theme,
|
|
890
|
+
$variant = _ref4.$variant;
|
|
891
|
+
return getBorderRadius(theme.kitt.choices.item.borderRadius, $variant);
|
|
892
|
+
}, function (_ref5) {
|
|
893
|
+
var theme = _ref5.theme,
|
|
894
|
+
$isHovered = _ref5.$isHovered,
|
|
895
|
+
$isPressed = _ref5.$isPressed,
|
|
896
|
+
$isDisabled = _ref5.$isDisabled,
|
|
897
|
+
$isSelected = _ref5.$isSelected;
|
|
898
|
+
var _theme$kitt$choices$i2 = theme.kitt.choices.item.backgroundColor,
|
|
899
|
+
hoverWhenSelected = _theme$kitt$choices$i2.hoverWhenSelected,
|
|
900
|
+
hover = _theme$kitt$choices$i2.hover,
|
|
901
|
+
disabled = _theme$kitt$choices$i2.disabled,
|
|
902
|
+
selected = _theme$kitt$choices$i2.selected,
|
|
903
|
+
pressed = _theme$kitt$choices$i2.pressed,
|
|
904
|
+
defaultBackground = _theme$kitt$choices$i2["default"];
|
|
905
|
+
if ($isDisabled) return disabled;
|
|
906
|
+
if ($isSelected && $isHovered) return hoverWhenSelected;
|
|
907
|
+
if ($isPressed) return pressed;
|
|
908
|
+
if ($isHovered) return hover;
|
|
909
|
+
if ($isSelected) return selected;
|
|
910
|
+
return defaultBackground;
|
|
911
|
+
}, function (_ref6) {
|
|
912
|
+
var theme = _ref6.theme;
|
|
913
|
+
var _theme$kitt$choices$i3 = theme.kitt.choices.item.padding,
|
|
914
|
+
base = _theme$kitt$choices$i3.base,
|
|
915
|
+
small = _theme$kitt$choices$i3.small;
|
|
916
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
917
|
+
minWidth: KittBreakpoints.SMALL
|
|
918
|
+
}, css(["padding:", "px;"], small), css(["padding:", "px;"], base));
|
|
919
|
+
}, function (_ref7) {
|
|
920
|
+
var theme = _ref7.theme;
|
|
921
|
+
if (Platform.OS !== 'web') return undefined;
|
|
922
|
+
var _theme$kitt$choices$i4 = theme.kitt.choices.item.transition,
|
|
923
|
+
property = _theme$kitt$choices$i4.property,
|
|
924
|
+
duration = _theme$kitt$choices$i4.duration,
|
|
925
|
+
timingFunction = _theme$kitt$choices$i4.timingFunction;
|
|
926
|
+
return css(["transition:", " ", "ms ", ";"], property, duration, timingFunction);
|
|
927
|
+
});
|
|
928
|
+
function ChoiceItem(_ref8) {
|
|
929
|
+
var _ref8$type = _ref8.type,
|
|
930
|
+
type = _ref8$type === void 0 ? 'button' : _ref8$type,
|
|
931
|
+
value = _ref8.value,
|
|
932
|
+
selected = _ref8.selected,
|
|
933
|
+
disabled = _ref8.disabled,
|
|
934
|
+
variant = _ref8.variant,
|
|
935
|
+
_children = _ref8.children,
|
|
936
|
+
isPressedInternal = _ref8.isPressedInternal,
|
|
937
|
+
isHoveredInternal = _ref8.isHoveredInternal,
|
|
938
|
+
onPress = _ref8.onPress,
|
|
939
|
+
onChange = _ref8.onChange,
|
|
940
|
+
onBlur = _ref8.onBlur,
|
|
941
|
+
onFocus = _ref8.onFocus;
|
|
942
|
+
var theme = /*#__PURE__*/useTheme();
|
|
943
|
+
var pressed = useSharedValue(Boolean(isPressedInternal));
|
|
944
|
+
var progress = useDerivedValue(function () {
|
|
945
|
+
var _f = function () {
|
|
946
|
+
return withTiming(pressed.value ? 1 : 0, {
|
|
947
|
+
duration: theme.kitt.choices.item.transition.duration
|
|
948
|
+
});
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
_f._closure = {
|
|
952
|
+
withTiming: withTiming,
|
|
953
|
+
pressed: pressed,
|
|
954
|
+
theme: {
|
|
955
|
+
kitt: {
|
|
956
|
+
choices: {
|
|
957
|
+
item: {
|
|
958
|
+
transition: {
|
|
959
|
+
duration: theme.kitt.choices.item.transition.duration
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
_f.asString = "function _f(){const{withTiming,pressed,theme}=jsThis._closure;{return withTiming(pressed.value?1:0,{duration:theme.kitt.choices.item.transition.duration});}}";
|
|
967
|
+
_f.__workletHash = 1120030177160;
|
|
968
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (180:35)";
|
|
969
|
+
return _f;
|
|
970
|
+
}());
|
|
971
|
+
var backgroundStyles = useAnimatedStyle(function () {
|
|
972
|
+
var _f = function () {
|
|
973
|
+
var _theme$kitt$choices$i5 = theme.kitt.choices.item.backgroundColor,
|
|
974
|
+
defaultBg = _theme$kitt$choices$i5["default"],
|
|
975
|
+
pressedBg = _theme$kitt$choices$i5.pressed,
|
|
976
|
+
selectedBg = _theme$kitt$choices$i5.selected,
|
|
977
|
+
disabledBg = _theme$kitt$choices$i5.disabled;
|
|
978
|
+
if (disabled) return {
|
|
979
|
+
backgroundColor: disabledBg
|
|
980
|
+
};
|
|
981
|
+
if (selected) return {
|
|
982
|
+
backgroundColor: selectedBg
|
|
983
|
+
};
|
|
984
|
+
return {
|
|
985
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [defaultBg, pressedBg])
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
_f._closure = {
|
|
990
|
+
theme: {
|
|
991
|
+
kitt: {
|
|
992
|
+
choices: {
|
|
993
|
+
item: {
|
|
994
|
+
backgroundColor: theme.kitt.choices.item.backgroundColor
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
disabled: disabled,
|
|
1000
|
+
selected: selected,
|
|
1001
|
+
interpolateColor: interpolateColor,
|
|
1002
|
+
progress: progress
|
|
1003
|
+
};
|
|
1004
|
+
_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])};}}";
|
|
1005
|
+
_f.__workletHash = 15506726129309;
|
|
1006
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (184:44)";
|
|
1007
|
+
return _f;
|
|
1008
|
+
}());
|
|
1009
|
+
|
|
1010
|
+
var handleChange = function () {
|
|
1011
|
+
if (!onChange) return; // Checkbox can be toggled
|
|
1012
|
+
|
|
1013
|
+
if (type === 'checkbox') {
|
|
1014
|
+
onChange(selected ? undefined : value);
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
onChange(value);
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
return /*#__PURE__*/jsx(Pressable$1, {
|
|
1022
|
+
disabled: disabled,
|
|
1023
|
+
accessibilityRole: type,
|
|
1024
|
+
accessibilityState: {
|
|
1025
|
+
checked: selected
|
|
1026
|
+
},
|
|
1027
|
+
onBlur: onBlur,
|
|
1028
|
+
onFocus: onFocus,
|
|
1029
|
+
onPress: function handlePress(e) {
|
|
1030
|
+
if (onFocus) onFocus(e);
|
|
1031
|
+
if (onPress) onPress();
|
|
1032
|
+
handleChange();
|
|
1033
|
+
if (onBlur) onBlur(e);
|
|
1034
|
+
},
|
|
1035
|
+
onPressIn: function onPressIn() {
|
|
1036
|
+
pressed.value = true;
|
|
1037
|
+
},
|
|
1038
|
+
onPressOut: function onPressOut() {
|
|
1039
|
+
pressed.value = false;
|
|
1040
|
+
},
|
|
1041
|
+
children: function children(_ref9) {
|
|
1042
|
+
var isHovered = _ref9.isHovered,
|
|
1043
|
+
isPressed = _ref9.isPressed;
|
|
1044
|
+
return /*#__PURE__*/jsxs(ChoiceItemView, {
|
|
1045
|
+
style: Platform.OS !== 'web' ? [backgroundStyles] : undefined,
|
|
1046
|
+
$isHovered: isHovered || isHoveredInternal,
|
|
1047
|
+
$isDisabled: disabled,
|
|
1048
|
+
$isSelected: selected,
|
|
1049
|
+
$isPressed: isPressed || isPressedInternal,
|
|
1050
|
+
$variant: variant,
|
|
1051
|
+
children: [/*#__PURE__*/jsx(Typography.SetDefaultColor, {
|
|
1052
|
+
value: getCurrentTextColor({
|
|
1053
|
+
isDisabled: disabled,
|
|
1054
|
+
isSelected: selected || isPressedInternal,
|
|
1055
|
+
isPressed: isPressed,
|
|
1056
|
+
isHovered: isHovered || isHoveredInternal
|
|
1057
|
+
}),
|
|
1058
|
+
children: _children
|
|
1059
|
+
}), disabled ? /*#__PURE__*/jsx(DisabledBorder, {
|
|
1060
|
+
$variant: variant,
|
|
1061
|
+
style: StyleSheet.absoluteFillObject
|
|
1062
|
+
}) : null]
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
var ChoiceItemContainer = /*#__PURE__*/styled(View$1).withConfig({
|
|
1069
|
+
displayName: "ChoiceItemContainer"
|
|
1070
|
+
})(["", ""], function (_ref) {
|
|
1071
|
+
var theme = _ref.theme,
|
|
1072
|
+
$isLast = _ref.$isLast,
|
|
1073
|
+
$direction = _ref.$direction;
|
|
1074
|
+
var _theme$kitt$choices$s = theme.kitt.choices.spacing,
|
|
1075
|
+
row = _theme$kitt$choices$s.row,
|
|
1076
|
+
column = _theme$kitt$choices$s.column;
|
|
1077
|
+
|
|
1078
|
+
if ($direction === 'row') {
|
|
1079
|
+
return css(["margin-right:", "px;"], $isLast ? 0 : row);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
return css(["margin-bottom:", "px;"], $isLast ? 0 : column);
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
var _excluded$h = ["direction"];
|
|
1086
|
+
|
|
1087
|
+
function ChoicesContainer(_ref) {
|
|
1088
|
+
var direction = _ref.direction,
|
|
1089
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
1090
|
+
|
|
1091
|
+
if (direction === 'row') {
|
|
1092
|
+
return /*#__PURE__*/jsx(ScrollView$1, _objectSpread({
|
|
1093
|
+
horizontal: true
|
|
1094
|
+
}, props));
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
return /*#__PURE__*/jsx(View$1, _objectSpread({}, props));
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
function Choices(_ref2) {
|
|
1101
|
+
var id = _ref2.id,
|
|
1102
|
+
testID = _ref2.testID,
|
|
1103
|
+
type = _ref2.type,
|
|
1104
|
+
_ref2$direction = _ref2.direction,
|
|
1105
|
+
direction = _ref2$direction === void 0 ? 'column' : _ref2$direction,
|
|
1106
|
+
disabled = _ref2.disabled,
|
|
1107
|
+
children = _ref2.children,
|
|
1108
|
+
value = _ref2.value,
|
|
1109
|
+
variant = _ref2.variant,
|
|
1110
|
+
onPress = _ref2.onPress,
|
|
1111
|
+
onChange = _ref2.onChange,
|
|
1112
|
+
onFocus = _ref2.onFocus,
|
|
1113
|
+
onBlur = _ref2.onBlur;
|
|
1114
|
+
|
|
1115
|
+
var _useState = useState(value),
|
|
1116
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1117
|
+
currentValue = _useState2[0],
|
|
1118
|
+
setCurrentValue = _useState2[1];
|
|
1119
|
+
|
|
1120
|
+
var isForm = type && ['radio', 'checkbox'].includes(type);
|
|
1121
|
+
var childrenArray = Children.toArray(children);
|
|
1122
|
+
var sharedProps = {
|
|
1123
|
+
type: type,
|
|
1124
|
+
disabled: disabled,
|
|
1125
|
+
variant: variant,
|
|
1126
|
+
onPress: !isForm ? onPress : undefined,
|
|
1127
|
+
onChange: isForm ? function handleChange(newValue) {
|
|
1128
|
+
setCurrentValue(newValue);
|
|
1129
|
+
if (onChange) onChange(newValue);
|
|
1130
|
+
} : undefined,
|
|
1131
|
+
onFocus: onFocus,
|
|
1132
|
+
onBlur: onBlur
|
|
1133
|
+
};
|
|
1134
|
+
return /*#__PURE__*/jsx(ChoicesContainer, {
|
|
1135
|
+
direction: direction,
|
|
1136
|
+
testID: testID,
|
|
1137
|
+
nativeID: id,
|
|
1138
|
+
children: childrenArray.map(function (child, index) {
|
|
1139
|
+
var element = /*#__PURE__*/cloneElement(child, _objectSpread({
|
|
1140
|
+
selected: isForm ? child.props.value === currentValue : undefined
|
|
1141
|
+
}, sharedProps));
|
|
1142
|
+
return /*#__PURE__*/jsx(ChoiceItemContainer, {
|
|
1143
|
+
$direction: direction,
|
|
1144
|
+
$isLast: index === childrenArray.length - 1,
|
|
1145
|
+
children: element
|
|
1146
|
+
}, child.key);
|
|
1147
|
+
})
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
Choices.Item = ChoiceItem;
|
|
1152
|
+
function createChoicesComponent() {
|
|
1153
|
+
return Choices;
|
|
1154
|
+
}
|
|
1155
|
+
var ButtonChoices = createChoicesComponent();
|
|
1156
|
+
Choices.ButtonChoices = ButtonChoices;
|
|
1157
|
+
var ChoicesElements = {
|
|
1158
|
+
Item: ChoiceItem,
|
|
1159
|
+
ButtonChoices: ButtonChoices
|
|
1160
|
+
};
|
|
1161
|
+
|
|
840
1162
|
function Emoji(_ref) {
|
|
841
1163
|
var emoji = _ref.emoji,
|
|
842
1164
|
size = _ref.size,
|
|
@@ -1221,6 +1543,39 @@ var card = {
|
|
|
1221
1543
|
}
|
|
1222
1544
|
};
|
|
1223
1545
|
|
|
1546
|
+
var choices = {
|
|
1547
|
+
spacing: {
|
|
1548
|
+
row: 12,
|
|
1549
|
+
column: 12
|
|
1550
|
+
},
|
|
1551
|
+
item: {
|
|
1552
|
+
borderRadius: 10,
|
|
1553
|
+
padding: {
|
|
1554
|
+
base: 16,
|
|
1555
|
+
small: 24
|
|
1556
|
+
},
|
|
1557
|
+
backgroundColor: {
|
|
1558
|
+
"default": lateOceanColorPalette.black50,
|
|
1559
|
+
disabled: colors.disabled,
|
|
1560
|
+
selected: colors.primary,
|
|
1561
|
+
pressed: lateOceanColorPalette.lateOceanLight1,
|
|
1562
|
+
hover: lateOceanColorPalette.black100,
|
|
1563
|
+
hoverWhenSelected: lateOceanColorPalette.lateOceanLight1
|
|
1564
|
+
},
|
|
1565
|
+
disabled: {
|
|
1566
|
+
border: {
|
|
1567
|
+
width: 2,
|
|
1568
|
+
color: lateOceanColorPalette.black100
|
|
1569
|
+
}
|
|
1570
|
+
},
|
|
1571
|
+
transition: {
|
|
1572
|
+
property: 'all',
|
|
1573
|
+
duration: 300,
|
|
1574
|
+
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1224
1579
|
var feedbackMessage = {
|
|
1225
1580
|
danger: {
|
|
1226
1581
|
backgroundColor: colors.danger
|
|
@@ -1638,6 +1993,7 @@ var theme = {
|
|
|
1638
1993
|
breakpoints: breakpoints,
|
|
1639
1994
|
button: button,
|
|
1640
1995
|
card: card,
|
|
1996
|
+
choices: choices,
|
|
1641
1997
|
feedbackMessage: feedbackMessage,
|
|
1642
1998
|
forms: forms,
|
|
1643
1999
|
fullScreenModal: fullScreenModal,
|
|
@@ -1999,7 +2355,7 @@ function DatePickerAndroid(_ref) {
|
|
|
1999
2355
|
}
|
|
2000
2356
|
|
|
2001
2357
|
// Don't use styled.Pressable here - babel-plugin-styled-components-react-native-web only supports tagged templates
|
|
2002
|
-
var OverlayPressable = /*#__PURE__*/styled(Pressable$
|
|
2358
|
+
var OverlayPressable = /*#__PURE__*/styled(Pressable$2).withConfig({
|
|
2003
2359
|
displayName: "Overlay__OverlayPressable"
|
|
2004
2360
|
})(function (_ref) {
|
|
2005
2361
|
var theme = _ref.theme;
|
|
@@ -2800,7 +3156,7 @@ function InputIcon(_ref) {
|
|
|
2800
3156
|
function InputPressable(_ref) {
|
|
2801
3157
|
var props = _extends({}, _ref);
|
|
2802
3158
|
|
|
2803
|
-
return /*#__PURE__*/jsx(Pressable$
|
|
3159
|
+
return /*#__PURE__*/jsx(Pressable$2, _objectSpread({}, props));
|
|
2804
3160
|
}
|
|
2805
3161
|
|
|
2806
3162
|
var _excluded$8 = ["isPasswordDefaultVisible", "right"];
|
|
@@ -3308,7 +3664,7 @@ function ListItem(_ref5) {
|
|
|
3308
3664
|
onPress = _ref5.onPress,
|
|
3309
3665
|
rest = _objectWithoutProperties(_ref5, _excluded$5);
|
|
3310
3666
|
|
|
3311
|
-
var Wrapper = onPress ? Pressable$
|
|
3667
|
+
var Wrapper = onPress ? Pressable$2 : Fragment$1;
|
|
3312
3668
|
var wrapperProps = onPress ? _objectSpread({
|
|
3313
3669
|
accessibilityRole: 'button',
|
|
3314
3670
|
onPress: onPress
|
|
@@ -3560,8 +3916,13 @@ var createKittSpaces = function (spacing) {
|
|
|
3560
3916
|
}
|
|
3561
3917
|
|
|
3562
3918
|
return sizes;
|
|
3563
|
-
}; //
|
|
3919
|
+
}; // reset native-base to be able to set size / space as a number
|
|
3920
|
+
// https://docs.nativebase.io/next/default-theme#h2-size
|
|
3921
|
+
|
|
3564
3922
|
|
|
3923
|
+
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) {
|
|
3924
|
+
return [value, value];
|
|
3925
|
+
})); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type -- let typescript infer types
|
|
3565
3926
|
|
|
3566
3927
|
var createKittNativeBaseCustomTheme = function (theme) {
|
|
3567
3928
|
var spaces = createKittSpaces(theme.spacing);
|
|
@@ -3574,10 +3935,8 @@ var createKittNativeBaseCustomTheme = function (theme) {
|
|
|
3574
3935
|
radii: {
|
|
3575
3936
|
'kitt.borderRadius': theme.card.borderRadius
|
|
3576
3937
|
},
|
|
3577
|
-
sizes: _objectSpread(_objectSpread({}, spaces),
|
|
3578
|
-
|
|
3579
|
-
}))),
|
|
3580
|
-
space: spaces,
|
|
3938
|
+
sizes: _objectSpread(_objectSpread({}, spaces), overridenNativeBaseSizeandSpaceScale),
|
|
3939
|
+
space: _objectSpread(_objectSpread({}, spaces), overridenNativeBaseSizeandSpaceScale),
|
|
3581
3940
|
breakpoints: {
|
|
3582
3941
|
// kitt breakpoints
|
|
3583
3942
|
base: KittBreakpoints.BASE,
|
|
@@ -3698,7 +4057,7 @@ var HStack = HStack$1;
|
|
|
3698
4057
|
|
|
3699
4058
|
var View = View$2;
|
|
3700
4059
|
var ScrollView = ScrollView$2;
|
|
3701
|
-
var Pressable = Pressable$
|
|
4060
|
+
var Pressable = Pressable$1;
|
|
3702
4061
|
|
|
3703
4062
|
var _excluded$4 = ["children"];
|
|
3704
4063
|
var ViewWithPadding = /*#__PURE__*/styled(View$1).withConfig({
|
|
@@ -5029,7 +5388,7 @@ function Tooltip(_ref) {
|
|
|
5029
5388
|
return /*#__PURE__*/jsxs(TooltipContainer, {
|
|
5030
5389
|
children: [/*#__PURE__*/jsx(View$1, {
|
|
5031
5390
|
ref: reference,
|
|
5032
|
-
children: /*#__PURE__*/jsx(Pressable$
|
|
5391
|
+
children: /*#__PURE__*/jsx(Pressable$2, {
|
|
5033
5392
|
accessibilityRole: "button",
|
|
5034
5393
|
onPress: function handlePress() {
|
|
5035
5394
|
pressed.value = !pressed.value;
|
|
@@ -5260,5 +5619,5 @@ function MatchWindowSize(_ref) {
|
|
|
5260
5619
|
return children;
|
|
5261
5620
|
}
|
|
5262
5621
|
|
|
5263
|
-
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 };
|
|
5622
|
+
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 };
|
|
5264
5623
|
//# sourceMappingURL=index-browser-all.es.js.map
|