@ornikar/kitt-universal 1.0.0-pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-browser-all-dev.es.js +1934 -0
- package/dist/index-browser-all-dev.es.js.map +1 -0
- package/dist/index-browser-all.es.js +1920 -0
- package/dist/index-browser-all.es.js.map +1 -0
- package/dist/index-node-12.13-dev.cjs.js +2059 -0
- package/dist/index-node-12.13-dev.cjs.js.map +1 -0
- package/dist/index-node-12.13.cjs.js +2048 -0
- package/dist/index-node-12.13.cjs.js.map +1 -0
- package/index.js +7 -0
- package/package.json +61 -0
- package/src/.eslintrc.json +42 -0
- package/src/Avatar/Avatar.stories.tsx +47 -0
- package/src/Avatar/Avatar.tsx +60 -0
- package/src/Avatar/__snapshots__/Avatar.stories.tsx.snap +1229 -0
- package/src/Button/Button.stories.tsx +303 -0
- package/src/Button/Button.tsx +60 -0
- package/src/Button/ButtonContainer.tsx +32 -0
- package/src/Button/ButtonContent.tsx +133 -0
- package/src/Button/__snapshots__/Button.stories.tsx.snap +7483 -0
- package/src/Button/useButton.ts +14 -0
- package/src/Card/Card.stories.tsx +33 -0
- package/src/Card/Card.tsx +25 -0
- package/src/Card/__snapshots__/Card.stories.tsx.snap +306 -0
- package/src/FullScreenModal/Body.tsx +25 -0
- package/src/FullScreenModal/FullScreenModal.stories.tsx +65 -0
- package/src/FullScreenModal/FullScreenModal.tsx +21 -0
- package/src/FullScreenModal/Header.tsx +129 -0
- package/src/FullScreenModal/__snapshots__/FullScreenModal.stories.tsx.snap +771 -0
- package/src/Icon/Icon.stories.tsx +61 -0
- package/src/Icon/Icon.tsx +37 -0
- package/src/Icon/SpinningIcon.tsx +38 -0
- package/src/Icon/SpinningIcon.web.css +13 -0
- package/src/Icon/SpinningIcon.web.tsx +11 -0
- package/src/Icon/__snapshots__/Icon.stories.tsx.snap +5648 -0
- package/src/KittBreakpoints.ts +44 -0
- package/src/KittThemeProvider.tsx +30 -0
- package/src/ListItem/ListItem.stories.tsx +124 -0
- package/src/ListItem/ListItem.tsx +61 -0
- package/src/ListItem/ListItemContent.tsx +17 -0
- package/src/ListItem/ListItemSideContent.tsx +41 -0
- package/src/ListItem/__snapshots__/ListItem.stories.tsx.snap +1514 -0
- package/src/Loader/LargeLoader.tsx +12 -0
- package/src/Loader/LargeLoader.web.css +103 -0
- package/src/Loader/LargeLoader.web.test.tsx +10 -0
- package/src/Loader/LargeLoader.web.tsx +18 -0
- package/src/Loader/Loader.stories.tsx +49 -0
- package/src/Loader/Loader.tsx +21 -0
- package/src/Loader/Loader.web.test.tsx +20 -0
- package/src/Loader/Loader.web.tsx +14 -0
- package/src/Loader/__snapshots__/LargeLoader.web.test.tsx.snap +33 -0
- package/src/Loader/__snapshots__/Loader.stories.tsx.snap +607 -0
- package/src/Loader/__snapshots__/Loader.web.test.tsx.snap +103 -0
- package/src/Message/Message.stories.tsx +104 -0
- package/src/Message/Message.tsx +114 -0
- package/src/Message/__snapshots__/Message.stories.tsx.snap +2776 -0
- package/src/Modal/Body.tsx +20 -0
- package/src/Modal/Footer.tsx +18 -0
- package/src/Modal/Header.tsx +66 -0
- package/src/Modal/Modal.stories.tsx +183 -0
- package/src/Modal/Modal.tsx +66 -0
- package/src/Modal/OnCloseContext.ts +3 -0
- package/src/Modal/__snapshots__/Modal.stories.tsx.snap +2960 -0
- package/src/Notification/Notification.stories.tsx +103 -0
- package/src/Notification/Notification.tsx +21 -0
- package/src/Notification/__snapshots__/Notification.stories.tsx.snap +2861 -0
- package/src/Overlay/Overlay.tsx +22 -0
- package/src/Tag/Tag.stories.tsx +19 -0
- package/src/Tag/Tag.tsx +31 -0
- package/src/Tag/__snapshots__/Tag.stories.tsx.snap +303 -0
- package/src/Tooltip/Tooltip.tsx +17 -0
- package/src/__mocks__/react-native-safe-area-context.tsx +26 -0
- package/src/forms/InputFeedback/InputFeedback.stories.tsx +20 -0
- package/src/forms/InputFeedback/InputFeedback.tsx +28 -0
- package/src/forms/InputFeedback/__snapshots__/InputFeedback.stories.tsx.snap +252 -0
- package/src/forms/InputField/InputField.stories.tsx +21 -0
- package/src/forms/InputField/InputField.tsx +45 -0
- package/src/forms/InputField/__snapshots__/InputField.stories.tsx.snap +240 -0
- package/src/forms/InputFormState.ts +1 -0
- package/src/forms/InputText/InputText.stories.tsx +87 -0
- package/src/forms/InputText/InputText.tsx +172 -0
- package/src/forms/InputText/__snapshots__/InputText.stories.tsx.snap +4274 -0
- package/src/forms/InputText/useInputText.ts +19 -0
- package/src/forms/Label/Label.stories.tsx +16 -0
- package/src/forms/Label/Label.tsx +17 -0
- package/src/forms/Label/__snapshots__/Label.stories.tsx.snap +174 -0
- package/src/forms/Radio/Radio.stories.tsx +50 -0
- package/src/forms/Radio/Radio.tsx +81 -0
- package/src/forms/Radio/__snapshots__/Radio.stories.tsx.snap +967 -0
- package/src/forms/TextArea/TextArea.stories.tsx +74 -0
- package/src/forms/TextArea/TextArea.tsx +12 -0
- package/src/forms/TextArea/__snapshots__/TextArea.stories.tsx.snap +2091 -0
- package/src/index.ts +43 -0
- package/src/stories/Block.tsx +24 -0
- package/src/stories/Flex.tsx +16 -0
- package/src/stories/color-tokens.stories.tsx +143 -0
- package/src/stories-list.tsx +22 -0
- package/src/story-components/Section.tsx +56 -0
- package/src/story-components/Story.tsx +24 -0
- package/src/story-components/StoryDecorator.tsx +8 -0
- package/src/story-components/StoryGrid.tsx +80 -0
- package/src/story-components/StoryTitle.stories.tsx +12 -0
- package/src/story-components/StoryTitle.tsx +69 -0
- package/src/story-components/__snapshots__/StoryTitle.stories.tsx.snap +155 -0
- package/src/story-components/index.ts +13 -0
- package/src/themes/default.ts +34 -0
- package/src/themes/late-ocean/avatarLateOceanTheme.ts +12 -0
- package/src/themes/late-ocean/buttonLateOceanTheme.ts +37 -0
- package/src/themes/late-ocean/cardLateOceanTheme.ts +19 -0
- package/src/themes/late-ocean/colorsLateOceanTheme.ts +19 -0
- package/src/themes/late-ocean/feedbackMessageLateOceanTheme.ts +10 -0
- package/src/themes/late-ocean/formLateOceanTheme.ts +9 -0
- package/src/themes/late-ocean/fullScreenModalLateOceanTheme.ts +8 -0
- package/src/themes/late-ocean/inputFieldLateOceanTheme.ts +4 -0
- package/src/themes/late-ocean/inputLateOceanTheme.ts +55 -0
- package/src/themes/late-ocean/listItemLateOceanTheme.ts +8 -0
- package/src/themes/late-ocean/radioLateOceanTheme.ts +19 -0
- package/src/themes/late-ocean/shadowsLateOceanTheme.ts +3 -0
- package/src/themes/late-ocean/tagLateOceanTheme.ts +17 -0
- package/src/themes/late-ocean/typographyLateOceanTheme.ts +94 -0
- package/src/themes/palettes/lateOceanColorPalette.ts +24 -0
- package/src/typings/babel-config.d.ts +6 -0
- package/src/typings/metro.d.ts +6 -0
- package/src/typography/Typography.stories.tsx +115 -0
- package/src/typography/Typography.tsx +165 -0
- package/src/typography/TypographyIcon.stories.tsx +32 -0
- package/src/typography/TypographyIcon.tsx +35 -0
- package/src/typography/TypographyLink.stories.tsx +89 -0
- package/src/typography/TypographyLink.tsx +48 -0
- package/src/typography/__snapshots__/Typography.stories.tsx.snap +6118 -0
- package/src/typography/__snapshots__/TypographyIcon.stories.tsx.snap +334 -0
- package/src/typography/__snapshots__/TypographyLink.stories.tsx.snap +10945 -0
- package/src/utils/storybook/decorators/KittThemeDecorator.tsx +11 -0
- package/src/utils/storybook/decorators/SafeAreaProviderDecorator.tsx +11 -0
- package/src/utils/storybook/setup-global-decorators.ts +6 -0
- package/src/utils/tests/renderWithProvidersUtils.tsx +17 -0
- package/src/utils/typeUtils.ts +6 -0
- package/src/utils/windowSize/MatchWindowSize.tsx +14 -0
- package/src/utils/windowSize/__snapshots__/windowSize.stories.tsx.snap +1485 -0
- package/src/utils/windowSize/createWindowSizeHelper.test.ts +11 -0
- package/src/utils/windowSize/createWindowSizeHelper.ts +65 -0
- package/src/utils/windowSize/useMatchWindowSize.ts +14 -0
- package/src/utils/windowSize/useWindowSize.ts +1 -0
- package/src/utils/windowSize/windowSize.stories.tsx +116 -0
- package/tsconfig.build.json +30 -0
- package/tsconfig.json +13 -0
- package/yarn-error.log +22274 -0
|
@@ -0,0 +1,1934 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
4
|
+
import { UserIcon, EyeIcon, EyeOffIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, XIcon } from '@ornikar/kitt-icons';
|
|
5
|
+
export * from '@ornikar/kitt-icons';
|
|
6
|
+
import React, { useRef, useEffect, useContext, createContext, useState, forwardRef, useMemo } from 'react';
|
|
7
|
+
import { Animated, Easing, Image, Platform, useWindowDimensions, Pressable, StyleSheet, View, ScrollView, Modal as Modal$1 } from 'react-native';
|
|
8
|
+
export { useWindowDimensions as useWindowSize } from 'react-native';
|
|
9
|
+
import styled, { useTheme, css, ThemeProvider } from 'styled-components/native';
|
|
10
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
11
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
12
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
13
|
+
|
|
14
|
+
function SpinningIcon(_ref) {
|
|
15
|
+
var children = _ref.children;
|
|
16
|
+
var animationRef = useRef(new Animated.Value(0));
|
|
17
|
+
var rotation = animationRef.current.interpolate({
|
|
18
|
+
inputRange: [0, 1],
|
|
19
|
+
outputRange: ['0deg', '360deg']
|
|
20
|
+
});
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (process.env.TESTS) return undefined;
|
|
23
|
+
var animation = Animated.loop(Animated.timing(animationRef.current, {
|
|
24
|
+
toValue: 1,
|
|
25
|
+
duration: 1100,
|
|
26
|
+
easing: Easing.linear,
|
|
27
|
+
useNativeDriver: true
|
|
28
|
+
}));
|
|
29
|
+
animation.start();
|
|
30
|
+
return function () {
|
|
31
|
+
if (process.env.TESTS) return undefined;
|
|
32
|
+
animation.stop();
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
37
|
+
style: {
|
|
38
|
+
transform: [{
|
|
39
|
+
rotate: rotation
|
|
40
|
+
}]
|
|
41
|
+
}
|
|
42
|
+
}, children);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var _templateObject$p;
|
|
46
|
+
var IconContainer$2 = styled.View(_templateObject$p || (_templateObject$p = _taggedTemplateLiteral(["\n color: ", ";\n width: ", "px;\n height: ", "px;\n align-self: ", ";\n"])), function (_ref) {
|
|
47
|
+
var color = _ref.color;
|
|
48
|
+
return color;
|
|
49
|
+
}, function (_ref2) {
|
|
50
|
+
var size = _ref2.size;
|
|
51
|
+
return size;
|
|
52
|
+
}, function (_ref3) {
|
|
53
|
+
var size = _ref3.size;
|
|
54
|
+
return size;
|
|
55
|
+
}, function (_ref4) {
|
|
56
|
+
var _ref4$align = _ref4.align,
|
|
57
|
+
align = _ref4$align === void 0 ? 'auto' : _ref4$align;
|
|
58
|
+
return align;
|
|
59
|
+
});
|
|
60
|
+
function Icon(_ref5) {
|
|
61
|
+
var icon = _ref5.icon,
|
|
62
|
+
_ref5$size = _ref5.size,
|
|
63
|
+
size = _ref5$size === void 0 ? 20 : _ref5$size,
|
|
64
|
+
spin = _ref5.spin,
|
|
65
|
+
align = _ref5.align,
|
|
66
|
+
color = _ref5.color;
|
|
67
|
+
var clonedIcon = /*#__PURE__*/React.cloneElement(icon, {
|
|
68
|
+
color: color
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/React.createElement(IconContainer$2, {
|
|
71
|
+
align: align,
|
|
72
|
+
size: size,
|
|
73
|
+
color: color
|
|
74
|
+
}, spin ? /*#__PURE__*/React.createElement(SpinningIcon, null, clonedIcon) : clonedIcon);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var _templateObject$o;
|
|
78
|
+
var TypographyTypeContext = /*#__PURE__*/createContext(undefined);
|
|
79
|
+
var TypographyColorContext = /*#__PURE__*/createContext('black');
|
|
80
|
+
function useTypographyColor() {
|
|
81
|
+
return useContext(TypographyColorContext);
|
|
82
|
+
}
|
|
83
|
+
var StyledTypography = styled.Text(_templateObject$o || (_templateObject$o = _taggedTemplateLiteral(["\n /* font */\n ", "\n\n /* color */\n ", "\n"])), function (_ref) {
|
|
84
|
+
var theme = _ref.theme,
|
|
85
|
+
isHeader = _ref.isHeader,
|
|
86
|
+
type = _ref.type,
|
|
87
|
+
variant = _ref.variant;
|
|
88
|
+
var _theme$kitt$typograph = theme.kitt.typography.types,
|
|
89
|
+
headers = _theme$kitt$typograph.headers,
|
|
90
|
+
bodies = _theme$kitt$typograph.bodies;
|
|
91
|
+
return "\n /* type */\n ".concat(!type ? '' : "\n font-family: ".concat(isHeader ? headers.fontFamily[variant] : bodies.fontFamily[variant], ";\n font-size: ").concat(isHeader ? headers.configs[type].baseAndSmall.fontSize : bodies.configs[type].baseAndSmall.fontSize, ";\n line-height: ").concat(isHeader ? headers.configs[type].baseAndSmall.lineHeight : bodies.configs[type].baseAndSmall.lineHeight, ";\n "), "\n\n /* variant */\n font-weight: ").concat(isHeader ? headers.fontWeight : bodies.fontWeight[variant], ";\n font-style: ").concat(isHeader ? headers.fontStyle : bodies.fontStyle[variant], ";\n ");
|
|
92
|
+
}, function (_ref2) {
|
|
93
|
+
var theme = _ref2.theme,
|
|
94
|
+
color = _ref2.color;
|
|
95
|
+
return !color ? '' : "\n color: ".concat(theme.kitt.typography.colors[color], ";\n text-decoration-color: ").concat(theme.kitt.typography.colors[color], ";\n ");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
var isTypeHeader = function (type) {
|
|
99
|
+
return type.startsWith('header');
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
var isTypographyHeader = function (base, typeInContext) {
|
|
103
|
+
if (base) return isTypeHeader(base);
|
|
104
|
+
if (typeInContext) return isTypeHeader(typeInContext);
|
|
105
|
+
throw new Error('You must set a "base" prop or wrap this Typography in one that does.');
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
function Typography(_ref3) {
|
|
109
|
+
_ref3.accessibilityRole;
|
|
110
|
+
var base = _ref3.base,
|
|
111
|
+
variant = _ref3.variant,
|
|
112
|
+
color = _ref3.color,
|
|
113
|
+
otherProps = _objectWithoutProperties(_ref3, ["accessibilityRole", "base", "variant", "color"]);
|
|
114
|
+
|
|
115
|
+
var typeInContext = useContext(TypographyTypeContext);
|
|
116
|
+
var isHeader = isTypographyHeader(base, typeInContext);
|
|
117
|
+
var nonNullableVariant = variant !== null && variant !== void 0 ? variant : isHeader ? 'bold' : 'regular';
|
|
118
|
+
var colorWithDefaultToBlack = color !== null && color !== void 0 ? color : typeInContext ? undefined : 'black';
|
|
119
|
+
var content = base ?
|
|
120
|
+
/*#__PURE__*/
|
|
121
|
+
// use the type and pass the type to the context for children
|
|
122
|
+
React.createElement(TypographyTypeContext.Provider, {
|
|
123
|
+
value: base
|
|
124
|
+
}, /*#__PURE__*/React.createElement(StyledTypography, _extends({
|
|
125
|
+
color: colorWithDefaultToBlack,
|
|
126
|
+
isHeader: isHeader,
|
|
127
|
+
type: base,
|
|
128
|
+
variant: nonNullableVariant
|
|
129
|
+
}, otherProps))) : /*#__PURE__*/React.createElement(StyledTypography, _extends({
|
|
130
|
+
color: colorWithDefaultToBlack,
|
|
131
|
+
isHeader: isHeader,
|
|
132
|
+
variant: nonNullableVariant
|
|
133
|
+
}, otherProps));
|
|
134
|
+
return color ? /*#__PURE__*/React.createElement(TypographyColorContext.Provider, {
|
|
135
|
+
value: color
|
|
136
|
+
}, content) : content;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function TypographyText(props) {
|
|
140
|
+
return /*#__PURE__*/React.createElement(Typography, _extends({
|
|
141
|
+
accessibilityRole: null
|
|
142
|
+
}, props));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function TypographyParagraph(props) {
|
|
146
|
+
// @ts-expect-error paragraph is not allowed in react-native but exists in react-native-web
|
|
147
|
+
return /*#__PURE__*/React.createElement(Typography, _extends({
|
|
148
|
+
accessibilityRole: "paragraph"
|
|
149
|
+
}, props));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var createHeading = function (level) {
|
|
153
|
+
// https://github.com/necolas/react-native-web/issues/401
|
|
154
|
+
function TypographyHeading(props) {
|
|
155
|
+
return /*#__PURE__*/React.createElement(Typography, _extends({
|
|
156
|
+
accessibilityRole: "header"
|
|
157
|
+
}, props, {
|
|
158
|
+
"aria-level": level
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
TypographyHeading.displayName = "TypographyHeading".concat(level);
|
|
163
|
+
return TypographyHeading;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
Typography.Text = TypographyText;
|
|
167
|
+
Typography.Paragraph = TypographyParagraph;
|
|
168
|
+
Typography.h1 = createHeading('1');
|
|
169
|
+
Typography.h2 = createHeading('2');
|
|
170
|
+
Typography.h3 = createHeading('3');
|
|
171
|
+
Typography.h4 = createHeading('4');
|
|
172
|
+
Typography.h5 = createHeading('5');
|
|
173
|
+
|
|
174
|
+
var _templateObject$n;
|
|
175
|
+
|
|
176
|
+
var getFirstCharacter = function (string) {
|
|
177
|
+
return string ? string[0] : '';
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
var getInitials = function (firstname, lastname) {
|
|
181
|
+
return (getFirstCharacter(firstname) + getFirstCharacter(lastname)).toUpperCase();
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var StyledAvatarView = styled.View(_templateObject$n || (_templateObject$n = _taggedTemplateLiteral(["\n border-radius: ", "px;\n background-color: ", ";\n height: ", "px;\n width: ", "px;\n overflow: hidden;\n align-items: center;\n justify-content: center;\n"])), function (_ref) {
|
|
185
|
+
var round = _ref.round,
|
|
186
|
+
size = _ref.size;
|
|
187
|
+
return round ? size / 2 : 10;
|
|
188
|
+
}, function (_ref2) {
|
|
189
|
+
var theme = _ref2.theme,
|
|
190
|
+
light = _ref2.light;
|
|
191
|
+
return light ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar["default"].backgroundColor;
|
|
192
|
+
}, function (_ref3) {
|
|
193
|
+
var size = _ref3.size;
|
|
194
|
+
return size;
|
|
195
|
+
}, function (_ref4) {
|
|
196
|
+
var size = _ref4.size;
|
|
197
|
+
return size;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
function AvatarContent(_ref5) {
|
|
201
|
+
var _ref5$size = _ref5.size,
|
|
202
|
+
size = _ref5$size === void 0 ? 40 : _ref5$size,
|
|
203
|
+
src = _ref5.src,
|
|
204
|
+
firstname = _ref5.firstname,
|
|
205
|
+
lastname = _ref5.lastname,
|
|
206
|
+
light = _ref5.light;
|
|
207
|
+
|
|
208
|
+
if (src) {
|
|
209
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
210
|
+
source: {
|
|
211
|
+
uri: src
|
|
212
|
+
},
|
|
213
|
+
style: {
|
|
214
|
+
width: size,
|
|
215
|
+
height: size
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (firstname && lastname) {
|
|
221
|
+
return /*#__PURE__*/React.createElement(Typography.Text, {
|
|
222
|
+
base: "body-small",
|
|
223
|
+
variant: "bold",
|
|
224
|
+
color: light ? 'black' : 'white'
|
|
225
|
+
}, getInitials(firstname, lastname));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
229
|
+
icon: /*#__PURE__*/React.createElement(UserIcon, null),
|
|
230
|
+
color: light ? 'black' : 'white',
|
|
231
|
+
size: size / 2
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function Avatar(_ref6) {
|
|
236
|
+
var _ref6$size = _ref6.size,
|
|
237
|
+
size = _ref6$size === void 0 ? 40 : _ref6$size,
|
|
238
|
+
rest = _objectWithoutProperties(_ref6, ["size"]);
|
|
239
|
+
|
|
240
|
+
return /*#__PURE__*/React.createElement(StyledAvatarView, _extends({}, rest, {
|
|
241
|
+
size: size
|
|
242
|
+
}), /*#__PURE__*/React.createElement(AvatarContent, _extends({}, rest, {
|
|
243
|
+
size: size
|
|
244
|
+
})));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
var _templateObject$m;
|
|
248
|
+
var ButtonContainer = styled.Pressable(_templateObject$m || (_templateObject$m = _taggedTemplateLiteral(["\n min-width: ", ";\n max-width: ", ";\n width: ", ";\n min-height: ", ";\n background-color: ", ";\n padding: ", ";\n flex-direction: row;\n\n /* Emulate inline-* css display by making the button taking only its necessary space */\n align-self: flex-start;\n border-radius: ", ";\n border-color: ", ";\n border-width: ", ";\n"])), function (_ref) {
|
|
249
|
+
var theme = _ref.theme;
|
|
250
|
+
return theme.kitt.button.minWidth;
|
|
251
|
+
}, function (_ref2) {
|
|
252
|
+
var theme = _ref2.theme,
|
|
253
|
+
stretch = _ref2.stretch;
|
|
254
|
+
return stretch ? 'auto' : theme.kitt.button.maxWidth;
|
|
255
|
+
}, function (_ref3) {
|
|
256
|
+
var stretch = _ref3.stretch;
|
|
257
|
+
return stretch ? '100%' : 'auto';
|
|
258
|
+
}, function (_ref4) {
|
|
259
|
+
var theme = _ref4.theme;
|
|
260
|
+
return theme.kitt.button.minHeight;
|
|
261
|
+
}, function (_ref5) {
|
|
262
|
+
var theme = _ref5.theme,
|
|
263
|
+
isPressed = _ref5.isPressed,
|
|
264
|
+
disabled = _ref5.disabled,
|
|
265
|
+
type = _ref5.type;
|
|
266
|
+
|
|
267
|
+
if (disabled) {
|
|
268
|
+
return theme.kitt.button[type].disabledBackgroundColor;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
|
|
272
|
+
}, function (_ref6) {
|
|
273
|
+
var theme = _ref6.theme;
|
|
274
|
+
return theme.kitt.button.contentPadding["default"];
|
|
275
|
+
}, function (_ref7) {
|
|
276
|
+
var theme = _ref7.theme;
|
|
277
|
+
return theme.kitt.button.borderRadius;
|
|
278
|
+
}, function (_ref8) {
|
|
279
|
+
var theme = _ref8.theme,
|
|
280
|
+
disabled = _ref8.disabled,
|
|
281
|
+
type = _ref8.type;
|
|
282
|
+
return disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent';
|
|
283
|
+
}, function (_ref9) {
|
|
284
|
+
var theme = _ref9.theme;
|
|
285
|
+
return theme.kitt.button.borderWidth;
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
function TypographyIconInheritColor(props) {
|
|
289
|
+
var color = useTypographyColor();
|
|
290
|
+
var theme = useTheme();
|
|
291
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
292
|
+
color: theme.kitt.typography.colors[color]
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function TypographyIconSpecifiedColor(_ref) {
|
|
297
|
+
var color = _ref.color,
|
|
298
|
+
otherProps = _objectWithoutProperties(_ref, ["color"]);
|
|
299
|
+
|
|
300
|
+
var theme = useTheme();
|
|
301
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, otherProps, {
|
|
302
|
+
color: theme.kitt.typography.colors[color]
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function TypographyIcon(_ref2) {
|
|
307
|
+
var color = _ref2.color,
|
|
308
|
+
otherProps = _objectWithoutProperties(_ref2, ["color"]);
|
|
309
|
+
|
|
310
|
+
if (color) {
|
|
311
|
+
return /*#__PURE__*/React.createElement(TypographyIconSpecifiedColor, _extends({
|
|
312
|
+
color: color
|
|
313
|
+
}, otherProps));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return /*#__PURE__*/React.createElement(TypographyIconInheritColor, otherProps);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
var _templateObject$l, _templateObject2$b, _templateObject3$8;
|
|
320
|
+
|
|
321
|
+
var getTextColorByType = function (type, isPressed, disabled) {
|
|
322
|
+
if (disabled) return 'black-light';
|
|
323
|
+
|
|
324
|
+
switch (type) {
|
|
325
|
+
case 'primary':
|
|
326
|
+
return 'white';
|
|
327
|
+
|
|
328
|
+
case 'subtle':
|
|
329
|
+
return isPressed ? 'primary-light' : 'primary';
|
|
330
|
+
|
|
331
|
+
case 'subtle-dark':
|
|
332
|
+
return isPressed ? 'black-light' : 'black';
|
|
333
|
+
|
|
334
|
+
case 'secondary':
|
|
335
|
+
default:
|
|
336
|
+
return 'black';
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
var ButtonText = styled(Typography.Text)(_templateObject$l || (_templateObject$l = _taggedTemplateLiteral(["\n /* On native code, this is the only way to ensure that the text is centered */\n text-align: center;\n"])));
|
|
341
|
+
var Content$1 = styled.View(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: center;\n justify-content: center;\n\n /*\n On native code flex grow does not work as expected which cause an issue with the flex props.\n In order to occupy only the needed space, we enable flex grow only when stretched\n */\n flex: ", ";\n"])), function (_ref) {
|
|
342
|
+
var stretch = _ref.stretch,
|
|
343
|
+
iconOnly = _ref.iconOnly;
|
|
344
|
+
return "".concat(stretch || iconOnly ? 1 : 0, " 1 auto");
|
|
345
|
+
});
|
|
346
|
+
var IconContainer$1 = styled.View(_templateObject3$8 || (_templateObject3$8 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref2) {
|
|
347
|
+
var theme = _ref2.theme,
|
|
348
|
+
iconPosition = _ref2.iconPosition;
|
|
349
|
+
var value = theme.kitt.spacing * 3;
|
|
350
|
+
|
|
351
|
+
if (iconPosition === 'left') {
|
|
352
|
+
return "margin: 0 ".concat(value, "px 0 0;");
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return "margin: 0 0 0 ".concat(value, "px;");
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
function ButtonIcon(_ref3) {
|
|
359
|
+
var icon = _ref3.icon,
|
|
360
|
+
spin = _ref3.spin,
|
|
361
|
+
color = _ref3.color,
|
|
362
|
+
size = _ref3.size,
|
|
363
|
+
iconPosition = _ref3.iconPosition,
|
|
364
|
+
testID = _ref3.testID;
|
|
365
|
+
return /*#__PURE__*/React.createElement(IconContainer$1, {
|
|
366
|
+
iconPosition: iconPosition
|
|
367
|
+
}, /*#__PURE__*/React.createElement(TypographyIcon, {
|
|
368
|
+
icon: icon,
|
|
369
|
+
spin: spin,
|
|
370
|
+
color: color,
|
|
371
|
+
size: size,
|
|
372
|
+
testID: testID
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function ButtonContent(_ref4) {
|
|
377
|
+
var type = _ref4.type,
|
|
378
|
+
isPressed = _ref4.isPressed,
|
|
379
|
+
stretch = _ref4.stretch,
|
|
380
|
+
icon = _ref4.icon,
|
|
381
|
+
iconPosition = _ref4.iconPosition,
|
|
382
|
+
iconSpin = _ref4.iconSpin,
|
|
383
|
+
disabled = _ref4.disabled,
|
|
384
|
+
children = _ref4.children;
|
|
385
|
+
var color = getTextColorByType(type, Boolean(isPressed), Boolean(disabled));
|
|
386
|
+
var theme = useTheme();
|
|
387
|
+
var sharedIconProps = {
|
|
388
|
+
spin: iconSpin,
|
|
389
|
+
color: color,
|
|
390
|
+
size: theme.kitt.button.iconSize
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
if (!(children || icon)) {
|
|
394
|
+
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (!children) {
|
|
398
|
+
return /*#__PURE__*/React.createElement(Content$1, {
|
|
399
|
+
iconOnly: true,
|
|
400
|
+
stretch: stretch
|
|
401
|
+
}, /*#__PURE__*/React.createElement(TypographyIcon, _extends({}, sharedIconProps, {
|
|
402
|
+
icon: icon
|
|
403
|
+
})));
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return /*#__PURE__*/React.createElement(Content$1, {
|
|
407
|
+
stretch: stretch
|
|
408
|
+
}, icon && iconPosition === 'left' ? /*#__PURE__*/React.createElement(ButtonIcon, _extends({}, sharedIconProps, {
|
|
409
|
+
icon: icon,
|
|
410
|
+
iconPosition: iconPosition,
|
|
411
|
+
testID: "button-left-icon"
|
|
412
|
+
})) : null, /*#__PURE__*/React.createElement(ButtonText, {
|
|
413
|
+
base: "body",
|
|
414
|
+
color: color,
|
|
415
|
+
variant: "bold"
|
|
416
|
+
}, children), icon && iconPosition === 'right' ? /*#__PURE__*/React.createElement(ButtonIcon, _extends({}, sharedIconProps, {
|
|
417
|
+
icon: icon,
|
|
418
|
+
iconPosition: iconPosition
|
|
419
|
+
})) : null);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
var useButton = function () {
|
|
423
|
+
var _useState = useState(false),
|
|
424
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
425
|
+
isPressed = _useState2[0],
|
|
426
|
+
setIsPressed = _useState2[1];
|
|
427
|
+
|
|
428
|
+
return {
|
|
429
|
+
isPressed: isPressed,
|
|
430
|
+
handleButtonPressIn: function handleButtonPressIn() {
|
|
431
|
+
return setIsPressed(true);
|
|
432
|
+
},
|
|
433
|
+
handleButtonPressOut: function handleButtonPressOut() {
|
|
434
|
+
return setIsPressed(false);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
function Button(_ref) {
|
|
440
|
+
var children = _ref.children,
|
|
441
|
+
_ref$type = _ref.type,
|
|
442
|
+
type = _ref$type === void 0 ? 'secondary' : _ref$type,
|
|
443
|
+
icon = _ref.icon,
|
|
444
|
+
_ref$iconPosition = _ref.iconPosition,
|
|
445
|
+
iconPosition = _ref$iconPosition === void 0 ? 'left' : _ref$iconPosition,
|
|
446
|
+
iconSpin = _ref.iconSpin,
|
|
447
|
+
stretch = _ref.stretch,
|
|
448
|
+
disabled = _ref.disabled,
|
|
449
|
+
onPress = _ref.onPress,
|
|
450
|
+
testID = _ref.testID;
|
|
451
|
+
|
|
452
|
+
var _useButton = useButton(),
|
|
453
|
+
isPressed = _useButton.isPressed,
|
|
454
|
+
handleButtonPressIn = _useButton.handleButtonPressIn,
|
|
455
|
+
handleButtonPressOut = _useButton.handleButtonPressOut;
|
|
456
|
+
|
|
457
|
+
var sharedProps = {
|
|
458
|
+
type: type,
|
|
459
|
+
stretch: stretch,
|
|
460
|
+
disabled: disabled
|
|
461
|
+
};
|
|
462
|
+
return /*#__PURE__*/React.createElement(ButtonContainer // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
463
|
+
// TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
|
|
464
|
+
// underlayColor={globalTheme.button[type].pressedBackgroundColor}
|
|
465
|
+
, _extends({}, sharedProps, {
|
|
466
|
+
isPressed: isPressed,
|
|
467
|
+
accessibilityRole: "button",
|
|
468
|
+
testID: testID,
|
|
469
|
+
onPress: onPress,
|
|
470
|
+
onPressIn: handleButtonPressIn,
|
|
471
|
+
onPressOut: handleButtonPressOut
|
|
472
|
+
}), /*#__PURE__*/React.createElement(ButtonContent, _extends({}, sharedProps, {
|
|
473
|
+
icon: icon,
|
|
474
|
+
iconPosition: iconPosition,
|
|
475
|
+
iconSpin: iconSpin
|
|
476
|
+
}), children));
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
var _templateObject$k;
|
|
480
|
+
var Container$5 = styled.View(_templateObject$k || (_templateObject$k = _taggedTemplateLiteral(["\n background-color: ", ";\n padding: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-color: ", ";\n"])), function (_ref) {
|
|
481
|
+
var theme = _ref.theme,
|
|
482
|
+
type = _ref.type;
|
|
483
|
+
return theme.kitt.card[type].backgroundColor;
|
|
484
|
+
}, function (_ref2) {
|
|
485
|
+
var theme = _ref2.theme;
|
|
486
|
+
return theme.kitt.card.padding;
|
|
487
|
+
}, function (_ref3) {
|
|
488
|
+
var theme = _ref3.theme;
|
|
489
|
+
return theme.kitt.card.borderRadius;
|
|
490
|
+
}, function (_ref4) {
|
|
491
|
+
var theme = _ref4.theme;
|
|
492
|
+
return theme.kitt.card.borderWidth;
|
|
493
|
+
}, function (_ref5) {
|
|
494
|
+
var theme = _ref5.theme,
|
|
495
|
+
type = _ref5.type;
|
|
496
|
+
return theme.kitt.card[type].borderColor;
|
|
497
|
+
});
|
|
498
|
+
function Card(_ref6) {
|
|
499
|
+
var children = _ref6.children,
|
|
500
|
+
type = _ref6.type;
|
|
501
|
+
return /*#__PURE__*/React.createElement(Container$5, {
|
|
502
|
+
type: type
|
|
503
|
+
}, children);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
var getColorFromState = function (state) {
|
|
507
|
+
switch (state) {
|
|
508
|
+
case 'invalid':
|
|
509
|
+
return 'danger';
|
|
510
|
+
|
|
511
|
+
default:
|
|
512
|
+
return 'grey';
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
function InputFeedback(_ref) {
|
|
517
|
+
var state = _ref.state,
|
|
518
|
+
testID = _ref.testID,
|
|
519
|
+
children = _ref.children;
|
|
520
|
+
return /*#__PURE__*/React.createElement(Typography.Text, {
|
|
521
|
+
base: "body-small",
|
|
522
|
+
color: getColorFromState(state),
|
|
523
|
+
testID: testID
|
|
524
|
+
}, children);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
var _templateObject$j, _templateObject2$a, _templateObject3$7, _templateObject4$5;
|
|
528
|
+
var FieldContainer = styled.View(_templateObject$j || (_templateObject$j = _taggedTemplateLiteral(["\n padding: 5px 0 10px;\n"]))); // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
529
|
+
// TODO: https://ornikar.atlassian.net/browse/INSTRUCTOR-202
|
|
530
|
+
// @media (--small-breakpoint) {
|
|
531
|
+
// padding: 10px 0;
|
|
532
|
+
// }
|
|
533
|
+
|
|
534
|
+
var FeedbackContainer = styled.View(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteral(["\n padding-top: 5px;\n"])));
|
|
535
|
+
var FieldLabelContainer = styled.View(_templateObject3$7 || (_templateObject3$7 = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: center;\n padding-bottom: ", "px;\n"])), function (_ref) {
|
|
536
|
+
var theme = _ref.theme;
|
|
537
|
+
return theme.reactForms.labelContainerPaddingBottom;
|
|
538
|
+
});
|
|
539
|
+
var LabelContainer = styled.View(_templateObject4$5 || (_templateObject4$5 = _taggedTemplateLiteral(["\n margin-right: ", "px;\n"])), function (_ref2) {
|
|
540
|
+
var theme = _ref2.theme;
|
|
541
|
+
return theme.reactForms.iconMarginLeft;
|
|
542
|
+
});
|
|
543
|
+
function InputField(_ref3) {
|
|
544
|
+
var label = _ref3.label,
|
|
545
|
+
labelFeedback = _ref3.labelFeedback,
|
|
546
|
+
input = _ref3.input,
|
|
547
|
+
feedback = _ref3.feedback;
|
|
548
|
+
return /*#__PURE__*/React.createElement(FieldContainer, null, label ? /*#__PURE__*/React.createElement(FieldLabelContainer, null, /*#__PURE__*/React.createElement(LabelContainer, null, label), labelFeedback) : null, input, feedback ? /*#__PURE__*/React.createElement(FeedbackContainer, null, feedback) : null);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
var useInputText = function () {
|
|
552
|
+
var _useState = useState(false),
|
|
553
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
554
|
+
isFocused = _useState2[0],
|
|
555
|
+
setIsFocused = _useState2[1];
|
|
556
|
+
|
|
557
|
+
var _useState3 = useState(false),
|
|
558
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
559
|
+
isPasswordVisible = _useState4[0],
|
|
560
|
+
setIsPasswordVisible = _useState4[1];
|
|
561
|
+
|
|
562
|
+
return {
|
|
563
|
+
isFocused: isFocused,
|
|
564
|
+
handleInputFocus: function handleInputFocus() {
|
|
565
|
+
return setIsFocused(true);
|
|
566
|
+
},
|
|
567
|
+
handleInputBlur: function handleInputBlur() {
|
|
568
|
+
return setIsFocused(false);
|
|
569
|
+
},
|
|
570
|
+
togglePasswordVisibility: function togglePasswordVisibility() {
|
|
571
|
+
return setIsPasswordVisible(function (isVisible) {
|
|
572
|
+
return !isVisible;
|
|
573
|
+
});
|
|
574
|
+
},
|
|
575
|
+
isPasswordVisible: isPasswordVisible
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
var _templateObject$i, _templateObject2$9, _templateObject3$6, _templateObject4$4;
|
|
580
|
+
var styledTextInputMixin = css(_templateObject$i || (_templateObject$i = _taggedTemplateLiteral(["\n /* stylelint-disable declaration-property-value-allowed-list */\n background-color: ", ";\n border-width: ", ";\n border-radius: ", ";\n border-color: ", ";\n font-size: ", ";\n color: ", ";\n font-family: ", ";\n"])), function (_ref) {
|
|
581
|
+
var theme = _ref.theme,
|
|
582
|
+
state = _ref.state;
|
|
583
|
+
return state === 'disabled' ? theme.kitt.forms.input.states.disabled.backgroundColor : theme.kitt.forms.input.states["default"].backgroundColor;
|
|
584
|
+
}, function (_ref2) {
|
|
585
|
+
var theme = _ref2.theme;
|
|
586
|
+
return theme.kitt.forms.input.borderWidth;
|
|
587
|
+
}, function (_ref3) {
|
|
588
|
+
var theme = _ref3.theme;
|
|
589
|
+
return theme.kitt.forms.input.borderRadius;
|
|
590
|
+
}, function (_ref4) {
|
|
591
|
+
var theme = _ref4.theme,
|
|
592
|
+
state = _ref4.state;
|
|
593
|
+
return theme.kitt.forms.input.states[state].borderColor;
|
|
594
|
+
}, function (_ref5) {
|
|
595
|
+
var theme = _ref5.theme;
|
|
596
|
+
return theme.kitt.typography.types.bodies.configs.body.baseAndSmall.fontSize;
|
|
597
|
+
}, function (_ref6) {
|
|
598
|
+
var theme = _ref6.theme,
|
|
599
|
+
state = _ref6.state;
|
|
600
|
+
return theme.kitt.typography.colors[theme.kitt.forms.input.states[state].color];
|
|
601
|
+
}, function (_ref7) {
|
|
602
|
+
var theme = _ref7.theme;
|
|
603
|
+
return theme.kitt.typography.types.bodies.fontFamily.regular;
|
|
604
|
+
});
|
|
605
|
+
var Input = styled.TextInput(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteral(["\n /* stylelint-disable declaration-bang-space-before */\n /* stylelint-disable comment-word-disallowed-list */\n\n /* FIXME: text input is not vertically centered on iOS because of bigger line-height */\n ", "\n padding: ", ";\n line-height: ", ";\n min-height: ", "px;\n"])), styledTextInputMixin, function (_ref8) {
|
|
606
|
+
var theme = _ref8.theme,
|
|
607
|
+
multiline = _ref8.multiline;
|
|
608
|
+
return !multiline && Platform.OS === 'ios' ? theme.kitt.forms.input.paddingSingleLineIOS : theme.kitt.forms.input.padding;
|
|
609
|
+
}, function (_ref9) {
|
|
610
|
+
var theme = _ref9.theme,
|
|
611
|
+
multiline = _ref9.multiline;
|
|
612
|
+
return !multiline && Platform.OS === 'ios' ? 0 : theme.kitt.typography.types.bodies.configs.body.baseAndSmall.lineHeight;
|
|
613
|
+
}, function (_ref10) {
|
|
614
|
+
var minHeight = _ref10.minHeight;
|
|
615
|
+
return minHeight;
|
|
616
|
+
});
|
|
617
|
+
var Container$4 = styled.View(_templateObject3$6 || (_templateObject3$6 = _taggedTemplateLiteral(["\n margin-top: ", ";\n margin-bottom: ", ";\n"])), function (_ref11) {
|
|
618
|
+
var theme = _ref11.theme;
|
|
619
|
+
return theme.kitt.forms.input.marginTop;
|
|
620
|
+
}, function (_ref12) {
|
|
621
|
+
var theme = _ref12.theme;
|
|
622
|
+
return theme.kitt.forms.input.marginBottom;
|
|
623
|
+
});
|
|
624
|
+
var PasswordButtonContainer = styled.Pressable(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteral(["\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n justify-content: center;\n padding: ", "px;\n"])), function (_ref13) {
|
|
625
|
+
var theme = _ref13.theme;
|
|
626
|
+
return theme.kitt.forms.input.passwordButtonIconSize / 2;
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
var getInputState = function (_ref14) {
|
|
630
|
+
var isDisabled = _ref14.isDisabled,
|
|
631
|
+
isFocused = _ref14.isFocused,
|
|
632
|
+
formState = _ref14.formState;
|
|
633
|
+
if (isDisabled) return 'disabled';
|
|
634
|
+
if (isFocused) return 'focus';
|
|
635
|
+
if (formState === 'invalid') return 'invalid';
|
|
636
|
+
return 'default';
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
var keyboardTypeByTextInputType = {
|
|
640
|
+
text: 'default',
|
|
641
|
+
email: 'email-address',
|
|
642
|
+
password: 'default',
|
|
643
|
+
username: 'default'
|
|
644
|
+
};
|
|
645
|
+
var autoCompleteTypeByType = {
|
|
646
|
+
text: 'off',
|
|
647
|
+
email: 'email',
|
|
648
|
+
password: 'password',
|
|
649
|
+
username: 'name'
|
|
650
|
+
};
|
|
651
|
+
var autoCorrectByType = {
|
|
652
|
+
text: true,
|
|
653
|
+
email: false,
|
|
654
|
+
password: false,
|
|
655
|
+
username: false
|
|
656
|
+
};
|
|
657
|
+
var textContentTypeByType = {
|
|
658
|
+
text: 'none',
|
|
659
|
+
email: 'emailAddress',
|
|
660
|
+
password: 'password',
|
|
661
|
+
username: 'username'
|
|
662
|
+
};
|
|
663
|
+
var InputText = /*#__PURE__*/forwardRef(function (_ref15, ref) {
|
|
664
|
+
var id = _ref15.id,
|
|
665
|
+
_ref15$minHeight = _ref15.minHeight,
|
|
666
|
+
minHeight = _ref15$minHeight === void 0 ? 0 : _ref15$minHeight,
|
|
667
|
+
type = _ref15.type,
|
|
668
|
+
formState = _ref15.state,
|
|
669
|
+
internalForceState = _ref15.internalForceState,
|
|
670
|
+
_ref15$disabled = _ref15.disabled,
|
|
671
|
+
disabled = _ref15$disabled === void 0 ? false : _ref15$disabled,
|
|
672
|
+
_onFocus = _ref15.onFocus,
|
|
673
|
+
_onBlur = _ref15.onBlur,
|
|
674
|
+
props = _objectWithoutProperties(_ref15, ["id", "minHeight", "type", "state", "internalForceState", "disabled", "onFocus", "onBlur"]);
|
|
675
|
+
|
|
676
|
+
var _useInputText = useInputText(),
|
|
677
|
+
isFocused = _useInputText.isFocused,
|
|
678
|
+
handleInputBlur = _useInputText.handleInputBlur,
|
|
679
|
+
handleInputFocus = _useInputText.handleInputFocus,
|
|
680
|
+
isPasswordVisible = _useInputText.isPasswordVisible,
|
|
681
|
+
togglePasswordVisibility = _useInputText.togglePasswordVisibility;
|
|
682
|
+
|
|
683
|
+
var theme = useTheme();
|
|
684
|
+
var state = internalForceState || getInputState({
|
|
685
|
+
isFocused: isFocused,
|
|
686
|
+
isDisabled: disabled,
|
|
687
|
+
formState: formState
|
|
688
|
+
});
|
|
689
|
+
return /*#__PURE__*/React.createElement(Container$4, null, /*#__PURE__*/React.createElement(Input, _extends({
|
|
690
|
+
ref: ref,
|
|
691
|
+
nativeID: id,
|
|
692
|
+
editable: !disabled,
|
|
693
|
+
keyboardType: keyboardTypeByTextInputType[type],
|
|
694
|
+
autoCompleteType: autoCompleteTypeByType[type],
|
|
695
|
+
autoCorrect: autoCorrectByType[type],
|
|
696
|
+
minHeight: minHeight,
|
|
697
|
+
textContentType: textContentTypeByType[type],
|
|
698
|
+
placeholderTextColor: theme.kitt.typography.colors[theme.kitt.forms.input.placeholderColor],
|
|
699
|
+
selectionColor: theme.kitt.forms.input.selectionColor,
|
|
700
|
+
secureTextEntry: type === 'password' && !isPasswordVisible
|
|
701
|
+
}, props, {
|
|
702
|
+
state: state,
|
|
703
|
+
onFocus: function onFocus(e) {
|
|
704
|
+
handleInputFocus();
|
|
705
|
+
if (_onFocus) _onFocus(e);
|
|
706
|
+
},
|
|
707
|
+
onBlur: function onBlur(e) {
|
|
708
|
+
handleInputBlur();
|
|
709
|
+
if (_onBlur) _onBlur(e);
|
|
710
|
+
}
|
|
711
|
+
})), type === 'password' && !disabled && /*#__PURE__*/React.createElement(PasswordButtonContainer, {
|
|
712
|
+
onPress: togglePasswordVisibility
|
|
713
|
+
}, /*#__PURE__*/React.createElement(TypographyIcon, {
|
|
714
|
+
icon: isPasswordVisible ? /*#__PURE__*/React.createElement(EyeIcon, null) : /*#__PURE__*/React.createElement(EyeOffIcon, null),
|
|
715
|
+
size: theme.kitt.forms.input.passwordButtonIconSize,
|
|
716
|
+
color: theme.kitt.forms.input.states[state].passwordButtonIconColor
|
|
717
|
+
})));
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
function Label(_ref) {
|
|
721
|
+
var htmlFor = _ref.htmlFor,
|
|
722
|
+
children = _ref.children;
|
|
723
|
+
return /*#__PURE__*/React.createElement(Typography.Text, {
|
|
724
|
+
base: "body"
|
|
725
|
+
}, Platform.OS === 'web' ? /*#__PURE__*/React.createElement("label", {
|
|
726
|
+
htmlFor: htmlFor
|
|
727
|
+
}, children) : children);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
var _templateObject$h, _templateObject2$8, _templateObject3$5, _templateObject4$3, _templateObject5;
|
|
731
|
+
var OuterRadio = styled.View(_templateObject$h || (_templateObject$h = _taggedTemplateLiteral(["\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n border-radius: ", "px;\n border-width: ", ";\n border-color: ", ";\n"])), function (_ref) {
|
|
732
|
+
var theme = _ref.theme,
|
|
733
|
+
disabled = _ref.disabled;
|
|
734
|
+
return theme.kitt.forms.radio[disabled ? 'disabled' : 'unchecked'].backgroundColor;
|
|
735
|
+
}, function (_ref2) {
|
|
736
|
+
var theme = _ref2.theme;
|
|
737
|
+
return theme.kitt.forms.radio.size;
|
|
738
|
+
}, function (_ref3) {
|
|
739
|
+
var theme = _ref3.theme;
|
|
740
|
+
return theme.kitt.forms.radio.size;
|
|
741
|
+
}, function (_ref4) {
|
|
742
|
+
var theme = _ref4.theme;
|
|
743
|
+
return theme.kitt.forms.radio.size / 2;
|
|
744
|
+
}, function (_ref5) {
|
|
745
|
+
var theme = _ref5.theme;
|
|
746
|
+
return theme.kitt.forms.radio.unchecked.borderWidth;
|
|
747
|
+
}, function (_ref6) {
|
|
748
|
+
var theme = _ref6.theme,
|
|
749
|
+
disabled = _ref6.disabled;
|
|
750
|
+
return theme.kitt.forms.radio[disabled ? 'disabled' : 'unchecked'].borderColor;
|
|
751
|
+
});
|
|
752
|
+
var SelectedOuterRadio = styled.View(_templateObject2$8 || (_templateObject2$8 = _taggedTemplateLiteral(["\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n border-radius: ", "px;\n justify-content: center;\n align-items: center;\n"])), function (_ref7) {
|
|
753
|
+
var theme = _ref7.theme;
|
|
754
|
+
return theme.kitt.forms.radio.checked.backgroundColor;
|
|
755
|
+
}, function (_ref8) {
|
|
756
|
+
var theme = _ref8.theme;
|
|
757
|
+
return theme.kitt.forms.radio.size;
|
|
758
|
+
}, function (_ref9) {
|
|
759
|
+
var theme = _ref9.theme;
|
|
760
|
+
return theme.kitt.forms.radio.size;
|
|
761
|
+
}, function (_ref10) {
|
|
762
|
+
var theme = _ref10.theme;
|
|
763
|
+
return theme.kitt.forms.radio.size / 2;
|
|
764
|
+
});
|
|
765
|
+
var SelectedInnerRadio = styled.View(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteral(["\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n border-radius: ", "px;\n"])), function (_ref11) {
|
|
766
|
+
var theme = _ref11.theme;
|
|
767
|
+
return theme.kitt.forms.radio.checked.innerBackgroundColor;
|
|
768
|
+
}, function (_ref12) {
|
|
769
|
+
var theme = _ref12.theme;
|
|
770
|
+
return theme.kitt.forms.radio.checked.innerSize;
|
|
771
|
+
}, function (_ref13) {
|
|
772
|
+
var theme = _ref13.theme;
|
|
773
|
+
return theme.kitt.forms.radio.checked.innerSize;
|
|
774
|
+
}, function (_ref14) {
|
|
775
|
+
var theme = _ref14.theme;
|
|
776
|
+
return theme.kitt.forms.radio.checked.innerSize / 2;
|
|
777
|
+
});
|
|
778
|
+
var Container$3 = styled.Pressable(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteral(["\n flex-direction: row;\n align-items: center;\n"])));
|
|
779
|
+
var Text = styled(Typography.Text)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n"])), function (_ref15) {
|
|
780
|
+
var theme = _ref15.theme;
|
|
781
|
+
return theme.kitt.spacing * 2;
|
|
782
|
+
});
|
|
783
|
+
function Radio(_ref16) {
|
|
784
|
+
var id = _ref16.id,
|
|
785
|
+
checked = _ref16.checked,
|
|
786
|
+
onChange = _ref16.onChange,
|
|
787
|
+
value = _ref16.value,
|
|
788
|
+
_ref16$disabled = _ref16.disabled,
|
|
789
|
+
disabled = _ref16$disabled === void 0 ? false : _ref16$disabled,
|
|
790
|
+
children = _ref16.children;
|
|
791
|
+
return /*#__PURE__*/React.createElement(Container$3, {
|
|
792
|
+
nativeID: id,
|
|
793
|
+
disabled: disabled,
|
|
794
|
+
accessibilityRole: "radio",
|
|
795
|
+
"aria-checked": checked,
|
|
796
|
+
accessible: checked && !disabled,
|
|
797
|
+
onPress: function handlePress() {
|
|
798
|
+
onChange(value);
|
|
799
|
+
}
|
|
800
|
+
}, checked && !disabled ? /*#__PURE__*/React.createElement(SelectedOuterRadio, null, /*#__PURE__*/React.createElement(SelectedInnerRadio, null)) : /*#__PURE__*/React.createElement(OuterRadio, {
|
|
801
|
+
disabled: disabled
|
|
802
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
803
|
+
base: "body",
|
|
804
|
+
color: disabled ? 'black-light' : 'black'
|
|
805
|
+
}, children));
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
function TextArea(_ref) {
|
|
809
|
+
var props = _extends({}, _ref);
|
|
810
|
+
|
|
811
|
+
var theme = useTheme();
|
|
812
|
+
return /*#__PURE__*/React.createElement(InputText, _extends({
|
|
813
|
+
multiline: true
|
|
814
|
+
}, props, {
|
|
815
|
+
type: "text",
|
|
816
|
+
minHeight: theme.kitt.forms.input.textAreaMinHeight
|
|
817
|
+
}));
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
var KittBreakpoints = {
|
|
821
|
+
/**
|
|
822
|
+
* min-width: 0
|
|
823
|
+
*/
|
|
824
|
+
BASE: 0,
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* min-width: 480px
|
|
828
|
+
*/
|
|
829
|
+
SMALL: 480,
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* min-width: 768px
|
|
833
|
+
*/
|
|
834
|
+
MEDIUM: 768,
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* min-width: 1024px
|
|
838
|
+
*/
|
|
839
|
+
LARGE: 1024,
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* min-width: 1280px
|
|
843
|
+
*/
|
|
844
|
+
WIDE: 1280
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
var _templateObject$g;
|
|
848
|
+
var Body = styled.View(_templateObject$g || (_templateObject$g = _taggedTemplateLiteral(["\n ", "\n background-color: ", ";\n flex: 1;\n"])), function (_ref) {
|
|
849
|
+
var theme = _ref.theme;
|
|
850
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
851
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
852
|
+
}, "padding-right: ".concat(theme.kitt.spacing * 12, "px;\n padding-left: ").concat(theme.kitt.spacing * 12, "px;"), "padding-right: ".concat(theme.kitt.spacing * 6, "px;\n padding-left: ").concat(theme.kitt.spacing * 6, "px;"));
|
|
853
|
+
}, function (_ref2) {
|
|
854
|
+
var theme = _ref2.theme;
|
|
855
|
+
return theme.kitt.colors.uiBackgroundLight;
|
|
856
|
+
});
|
|
857
|
+
function FullScreenModalBody(_ref3) {
|
|
858
|
+
var children = _ref3.children;
|
|
859
|
+
return /*#__PURE__*/React.createElement(Body, null, children);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
var _templateObject$f, _templateObject2$7, _templateObject3$4;
|
|
863
|
+
var SideContainer = styled.View(_templateObject$f || (_templateObject$f = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
864
|
+
var theme = _ref.theme,
|
|
865
|
+
_ref$side = _ref.side,
|
|
866
|
+
side = _ref$side === void 0 ? 'left' : _ref$side;
|
|
867
|
+
var padding = theme.kitt.spacing * 2;
|
|
868
|
+
|
|
869
|
+
if (side === 'left') {
|
|
870
|
+
return "padding-right: ".concat(padding, "px;");
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
return "padding-left: ".concat(padding, "px;");
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
function getHeaderHorizontalMediumPadding(spacing) {
|
|
877
|
+
return spacing * 6;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
var Header = styled.View(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteral(["\n ", ";\n border-bottom-color: ", ";\n border-bottom-width: 1px;\n flex-direction: row;\n align-items: center;\n"])), function (_ref2) {
|
|
881
|
+
var theme = _ref2.theme,
|
|
882
|
+
_ref2$insetTop = _ref2.insetTop,
|
|
883
|
+
insetTop = _ref2$insetTop === void 0 ? 0 : _ref2$insetTop;
|
|
884
|
+
var paddingTop = insetTop + theme.kitt.fullScreenModal.header.padding;
|
|
885
|
+
var padding = theme.kitt.fullScreenModal.header.padding;
|
|
886
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
887
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
888
|
+
}, "padding: ".concat(paddingTop, "px ").concat(getHeaderHorizontalMediumPadding(theme.kitt.spacing), "px ").concat(padding, "px;"), "padding: ".concat(paddingTop, "px ").concat(padding, "px ").concat(padding, "px;"));
|
|
889
|
+
}, function (_ref3) {
|
|
890
|
+
var theme = _ref3.theme;
|
|
891
|
+
return theme.kitt.fullScreenModal.header.borderColor;
|
|
892
|
+
});
|
|
893
|
+
var HeaderContent = styled.View(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n justify-content: center;\n align-items: center;\n"])), function (_ref4) {
|
|
894
|
+
var theme = _ref4.theme,
|
|
895
|
+
leftWidth = _ref4.leftWidth,
|
|
896
|
+
rightWidth = _ref4.rightWidth,
|
|
897
|
+
windowWidth = _ref4.windowWidth;
|
|
898
|
+
|
|
899
|
+
/*
|
|
900
|
+
* Since we don't have controll over the rendered left and right elements,
|
|
901
|
+
* we must apply some logic to give the title all the available space
|
|
902
|
+
*/
|
|
903
|
+
var sideElementMaxWidth = Math.max(leftWidth, rightWidth);
|
|
904
|
+
var parentHorizontalPadding = theme.kitt.fullScreenModal.header.padding * 2;
|
|
905
|
+
var parentHorizontalPaddingMedium = getHeaderHorizontalMediumPadding(theme.kitt.spacing) * 2;
|
|
906
|
+
|
|
907
|
+
var computeWidth = function (breakpointPadding) {
|
|
908
|
+
return windowWidth - breakpointPadding - sideElementMaxWidth * 2;
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
912
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
913
|
+
}, "width: ".concat(computeWidth(parentHorizontalPaddingMedium), "px;"), "width: ".concat(computeWidth(parentHorizontalPadding), "px;"));
|
|
914
|
+
}, function (_ref5) {
|
|
915
|
+
var leftWidth = _ref5.leftWidth,
|
|
916
|
+
rightWidth = _ref5.rightWidth;
|
|
917
|
+
// Depending of the wider element, we must add a margin to fill the diff in space between elements
|
|
918
|
+
var deltaMargin = Math.abs(leftWidth - rightWidth);
|
|
919
|
+
|
|
920
|
+
if (leftWidth > rightWidth) {
|
|
921
|
+
return "margin-right: ".concat(deltaMargin, "px;");
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
return "margin-left: ".concat(deltaMargin, "px;");
|
|
925
|
+
});
|
|
926
|
+
function FullScreenModalHeader(_ref6) {
|
|
927
|
+
var children = _ref6.children,
|
|
928
|
+
right = _ref6.right,
|
|
929
|
+
left = _ref6.left;
|
|
930
|
+
|
|
931
|
+
var _useSafeAreaInsets = useSafeAreaInsets(),
|
|
932
|
+
top = _useSafeAreaInsets.top;
|
|
933
|
+
|
|
934
|
+
var dimensions = useWindowDimensions();
|
|
935
|
+
|
|
936
|
+
var _useState = useState(0),
|
|
937
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
938
|
+
leftWidth = _useState2[0],
|
|
939
|
+
setLeftWidth = _useState2[1];
|
|
940
|
+
|
|
941
|
+
var _useState3 = useState(0),
|
|
942
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
943
|
+
rightWidth = _useState4[0],
|
|
944
|
+
setRightWidth = _useState4[1];
|
|
945
|
+
|
|
946
|
+
var handleLayoutChange = function (event, side) {
|
|
947
|
+
// Prevents react to nullify event on rerenders
|
|
948
|
+
event.persist();
|
|
949
|
+
|
|
950
|
+
if (side === 'left') {
|
|
951
|
+
setLeftWidth(event.nativeEvent.layout.width);
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
setRightWidth(event.nativeEvent.layout.width);
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
return /*#__PURE__*/React.createElement(Header, {
|
|
959
|
+
insetTop: Platform.OS === 'ios' ? undefined : top
|
|
960
|
+
}, left ? /*#__PURE__*/React.createElement(SideContainer, {
|
|
961
|
+
onLayout: function onLayout(e) {
|
|
962
|
+
return handleLayoutChange(e, 'left');
|
|
963
|
+
}
|
|
964
|
+
}, left) : null, /*#__PURE__*/React.createElement(HeaderContent, {
|
|
965
|
+
windowWidth: dimensions.width,
|
|
966
|
+
leftWidth: leftWidth,
|
|
967
|
+
rightWidth: rightWidth
|
|
968
|
+
}, children), right ? /*#__PURE__*/React.createElement(SideContainer, {
|
|
969
|
+
side: "right",
|
|
970
|
+
onLayout: function onLayout(e) {
|
|
971
|
+
return handleLayoutChange(e, 'right');
|
|
972
|
+
}
|
|
973
|
+
}, right) : null);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
var _templateObject$e;
|
|
977
|
+
var Container$2 = styled.View(_templateObject$e || (_templateObject$e = _taggedTemplateLiteral(["\n flex: 1;\n background-color: ", ";\n"])), function (_ref) {
|
|
978
|
+
var theme = _ref.theme;
|
|
979
|
+
return theme.kitt.colors.uiBackground;
|
|
980
|
+
});
|
|
981
|
+
function FullScreenModal(_ref2) {
|
|
982
|
+
var children = _ref2.children;
|
|
983
|
+
return /*#__PURE__*/React.createElement(Container$2, null, children);
|
|
984
|
+
}
|
|
985
|
+
FullScreenModal.Header = FullScreenModalHeader;
|
|
986
|
+
FullScreenModal.Body = FullScreenModalBody;
|
|
987
|
+
|
|
988
|
+
var lateOceanColorPalette = {
|
|
989
|
+
lateOcean: '#4C34E0',
|
|
990
|
+
lateOceanLight1: '#705DE6',
|
|
991
|
+
lateOceanLight2: '#9485EC',
|
|
992
|
+
lateOceanLight3: '#D6BAF9',
|
|
993
|
+
warmEmbrace: '#F4D3CE',
|
|
994
|
+
warmEmbraceLight1: '#FFEDE6',
|
|
995
|
+
black1000: '#000000',
|
|
996
|
+
black555: '#737373',
|
|
997
|
+
black200: '#CCCCCC',
|
|
998
|
+
black100: '#E5E5E5',
|
|
999
|
+
black50: '#F2F2F2',
|
|
1000
|
+
black25: '#F9F9F9',
|
|
1001
|
+
white: '#FFFFFF',
|
|
1002
|
+
viride: '#38836D',
|
|
1003
|
+
englishVermillon: '#D44148',
|
|
1004
|
+
goldCrayola: '#F8C583',
|
|
1005
|
+
aero: '#89BDDD',
|
|
1006
|
+
transparent: 'transparent'
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
var avatarLateOceanTheme = {
|
|
1010
|
+
"default": {
|
|
1011
|
+
color: lateOceanColorPalette.white,
|
|
1012
|
+
backgroundColor: lateOceanColorPalette.lateOcean
|
|
1013
|
+
},
|
|
1014
|
+
light: {
|
|
1015
|
+
color: lateOceanColorPalette.black1000,
|
|
1016
|
+
backgroundColor: lateOceanColorPalette.black100
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
var buttonLateOceanTheme = {
|
|
1021
|
+
borderRadius: '30px',
|
|
1022
|
+
borderWidth: '2px',
|
|
1023
|
+
minHeight: '42px',
|
|
1024
|
+
minWidth: '40px',
|
|
1025
|
+
maxWidth: '335px',
|
|
1026
|
+
iconSize: 18,
|
|
1027
|
+
contentPadding: {
|
|
1028
|
+
"default": '8px 16px'
|
|
1029
|
+
},
|
|
1030
|
+
primary: {
|
|
1031
|
+
backgroundColor: lateOceanColorPalette.lateOcean,
|
|
1032
|
+
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
1033
|
+
pressedBackgroundColor: lateOceanColorPalette.lateOceanLight1,
|
|
1034
|
+
disabledBorderColor: lateOceanColorPalette.black100
|
|
1035
|
+
},
|
|
1036
|
+
secondary: {
|
|
1037
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
1038
|
+
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
1039
|
+
pressedBackgroundColor: lateOceanColorPalette.black100,
|
|
1040
|
+
disabledBorderColor: lateOceanColorPalette.black100
|
|
1041
|
+
},
|
|
1042
|
+
subtle: {
|
|
1043
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
1044
|
+
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
1045
|
+
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
1046
|
+
disabledBorderColor: lateOceanColorPalette.transparent
|
|
1047
|
+
},
|
|
1048
|
+
'subtle-dark': {
|
|
1049
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
1050
|
+
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
1051
|
+
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
1052
|
+
disabledBorderColor: lateOceanColorPalette.transparent
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
var cardLateOceanTheme = {
|
|
1057
|
+
borderRadius: '20px',
|
|
1058
|
+
borderWidth: '2px',
|
|
1059
|
+
padding: '16px',
|
|
1060
|
+
primary: {
|
|
1061
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
1062
|
+
borderColor: lateOceanColorPalette.lateOcean
|
|
1063
|
+
},
|
|
1064
|
+
secondary: {
|
|
1065
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
1066
|
+
borderColor: lateOceanColorPalette.black100
|
|
1067
|
+
},
|
|
1068
|
+
subtle: {
|
|
1069
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
1070
|
+
borderColor: lateOceanColorPalette.black100
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
var colorsLateOceanTheme = {
|
|
1075
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
1076
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
1077
|
+
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
1078
|
+
success: lateOceanColorPalette.viride,
|
|
1079
|
+
correct: lateOceanColorPalette.viride,
|
|
1080
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
1081
|
+
separator: lateOceanColorPalette.black100,
|
|
1082
|
+
hover: lateOceanColorPalette.black100,
|
|
1083
|
+
uiBackground: lateOceanColorPalette.black25,
|
|
1084
|
+
uiBackgroundLight: lateOceanColorPalette.white,
|
|
1085
|
+
overlay: {
|
|
1086
|
+
dark: 'rgba(41, 48, 51, 0.25)',
|
|
1087
|
+
light: 'rgba(255, 255, 255, 0.90)',
|
|
1088
|
+
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
var feedbackMessageLateOceanTheme = {
|
|
1093
|
+
backgroundColors: {
|
|
1094
|
+
success: lateOceanColorPalette.viride,
|
|
1095
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
1096
|
+
warning: lateOceanColorPalette.goldCrayola,
|
|
1097
|
+
info: lateOceanColorPalette.aero
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
var inputStatesStyle = {
|
|
1102
|
+
"default": {
|
|
1103
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
1104
|
+
borderColor: lateOceanColorPalette.black100,
|
|
1105
|
+
color: 'black',
|
|
1106
|
+
passwordButtonIconColor: 'black'
|
|
1107
|
+
},
|
|
1108
|
+
hover: {
|
|
1109
|
+
borderColor: lateOceanColorPalette.black200,
|
|
1110
|
+
color: 'black',
|
|
1111
|
+
passwordButtonIconColor: 'black'
|
|
1112
|
+
},
|
|
1113
|
+
focus: {
|
|
1114
|
+
borderColor: lateOceanColorPalette.lateOcean,
|
|
1115
|
+
color: 'black',
|
|
1116
|
+
passwordButtonIconColor: 'black'
|
|
1117
|
+
},
|
|
1118
|
+
disabled: {
|
|
1119
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
1120
|
+
borderColor: lateOceanColorPalette.black100,
|
|
1121
|
+
color: 'black-light',
|
|
1122
|
+
passwordButtonIconColor: 'black-light'
|
|
1123
|
+
},
|
|
1124
|
+
invalid: {
|
|
1125
|
+
borderColor: lateOceanColorPalette.englishVermillon,
|
|
1126
|
+
color: 'black',
|
|
1127
|
+
passwordButtonIconColor: 'black'
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
var inputLateOceanTheme = {
|
|
1131
|
+
marginTop: '2px',
|
|
1132
|
+
marginBottom: '4px',
|
|
1133
|
+
borderWidth: '2px',
|
|
1134
|
+
borderRadius: '10px',
|
|
1135
|
+
passwordButtonIconSize: 20,
|
|
1136
|
+
padding: '7px 16px',
|
|
1137
|
+
paddingSingleLineIOS: '12px 16px',
|
|
1138
|
+
selectionColor: lateOceanColorPalette.lateOcean,
|
|
1139
|
+
placeholderColor: 'black-light',
|
|
1140
|
+
textAreaMinHeight: 120,
|
|
1141
|
+
states: inputStatesStyle
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
var radioLateOceanTheme = {
|
|
1145
|
+
size: 18,
|
|
1146
|
+
unchecked: {
|
|
1147
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
1148
|
+
borderWidth: '2px',
|
|
1149
|
+
borderColor: lateOceanColorPalette.black200
|
|
1150
|
+
},
|
|
1151
|
+
checked: {
|
|
1152
|
+
backgroundColor: lateOceanColorPalette.lateOcean,
|
|
1153
|
+
innerSize: 5,
|
|
1154
|
+
innerBackgroundColor: lateOceanColorPalette.white
|
|
1155
|
+
},
|
|
1156
|
+
disabled: {
|
|
1157
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
1158
|
+
borderColor: lateOceanColorPalette.black100
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
var formsLateOceanTheme = {
|
|
1163
|
+
input: inputLateOceanTheme,
|
|
1164
|
+
radio: radioLateOceanTheme
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
var fullScreenModalLateOceanTheme = {
|
|
1168
|
+
header: {
|
|
1169
|
+
padding: 11,
|
|
1170
|
+
borderColor: lateOceanColorPalette.black100
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
var listItemLateOceanTheme = {
|
|
1175
|
+
padding: '12px 16px',
|
|
1176
|
+
borderColor: colorsLateOceanTheme.separator,
|
|
1177
|
+
borderWidth: '1px',
|
|
1178
|
+
innerMargin: '8px'
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
var shadowsLateOceanTheme = {
|
|
1182
|
+
medium: '0px 10px 20px rgba(41, 48, 51, 0.25)'
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
var tagLateOceanTheme = {
|
|
1186
|
+
borderRadius: '10px',
|
|
1187
|
+
padding: '2px 12px',
|
|
1188
|
+
primary: {
|
|
1189
|
+
// eslint-disable-next-line unicorn/expiring-todo-comments
|
|
1190
|
+
// TODO: validate Moon shadow color with design team
|
|
1191
|
+
backgroundColor: '#EDEBFC'
|
|
1192
|
+
},
|
|
1193
|
+
"default": {
|
|
1194
|
+
backgroundColor: lateOceanColorPalette.black50
|
|
1195
|
+
},
|
|
1196
|
+
danger: {
|
|
1197
|
+
backgroundColor: lateOceanColorPalette.warmEmbrace
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
var calcLineHeight = function (fontSize, lineHeightMultiplier) {
|
|
1202
|
+
return Math.round(fontSize * lineHeightMultiplier);
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
var createTypographyTypeConfig = function (lineHeightMultiplier, baseAndSmallFontSize, mediumAndWideFontSize) {
|
|
1206
|
+
return {
|
|
1207
|
+
baseAndSmall: {
|
|
1208
|
+
fontSize: "".concat(baseAndSmallFontSize, "px"),
|
|
1209
|
+
lineHeight: "".concat(calcLineHeight(lineHeightMultiplier, baseAndSmallFontSize), "px")
|
|
1210
|
+
},
|
|
1211
|
+
mediumAndWide: {
|
|
1212
|
+
fontSize: "".concat(mediumAndWideFontSize, "px"),
|
|
1213
|
+
lineHeight: "".concat(calcLineHeight(lineHeightMultiplier, baseAndSmallFontSize), "px")
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
var typographyLateOceanTheme = {
|
|
1219
|
+
colors: {
|
|
1220
|
+
black: lateOceanColorPalette.black1000,
|
|
1221
|
+
'black-light': lateOceanColorPalette.black555,
|
|
1222
|
+
grey: lateOceanColorPalette.black555,
|
|
1223
|
+
'grey-light': lateOceanColorPalette.black200,
|
|
1224
|
+
white: lateOceanColorPalette.white,
|
|
1225
|
+
'white-light': lateOceanColorPalette.white,
|
|
1226
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
1227
|
+
'primary-light': lateOceanColorPalette.lateOceanLight1,
|
|
1228
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
1229
|
+
success: lateOceanColorPalette.viride,
|
|
1230
|
+
danger: lateOceanColorPalette.englishVermillon
|
|
1231
|
+
},
|
|
1232
|
+
types: {
|
|
1233
|
+
headers: {
|
|
1234
|
+
fontFamily: {
|
|
1235
|
+
regular: Platform.OS === 'web' ? 'Moderat' : 'Moderat-Extended-Bold',
|
|
1236
|
+
bold: Platform.OS === 'web' ? 'Moderat' : 'Moderat-Extended-Bold',
|
|
1237
|
+
italic: Platform.OS === 'web' ? 'Moderat' : 'Moderat-Extended-Bold'
|
|
1238
|
+
},
|
|
1239
|
+
fontWeight: 400,
|
|
1240
|
+
fontStyle: 'normal',
|
|
1241
|
+
configs: {
|
|
1242
|
+
// also known as xxlarge
|
|
1243
|
+
header1: createTypographyTypeConfig(1.3, 38, 62),
|
|
1244
|
+
// also known as xlarge
|
|
1245
|
+
header2: createTypographyTypeConfig(1.3, 32, 48),
|
|
1246
|
+
// also known as medium
|
|
1247
|
+
header3: createTypographyTypeConfig(1.3, 24, 36),
|
|
1248
|
+
// also known as xsmall
|
|
1249
|
+
header4: createTypographyTypeConfig(1.3, 18, 24),
|
|
1250
|
+
// also known as xxsmall
|
|
1251
|
+
header5: createTypographyTypeConfig(1.3, 18, 18)
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
bodies: {
|
|
1255
|
+
fontFamily: {
|
|
1256
|
+
regular: Platform.OS === 'web' ? 'Noto Sans' : 'NotoSans',
|
|
1257
|
+
bold: Platform.OS === 'web' ? 'Noto Sans' : 'NotoSans-Bold',
|
|
1258
|
+
italic: Platform.OS === 'web' ? 'Noto Sans' : 'NotoSans-Italic'
|
|
1259
|
+
},
|
|
1260
|
+
fontWeight: {
|
|
1261
|
+
regular: 400,
|
|
1262
|
+
bold: 700,
|
|
1263
|
+
italic: 400
|
|
1264
|
+
},
|
|
1265
|
+
fontStyle: {
|
|
1266
|
+
regular: 'normal',
|
|
1267
|
+
bold: 'normal',
|
|
1268
|
+
italic: 'italic'
|
|
1269
|
+
},
|
|
1270
|
+
configs: {
|
|
1271
|
+
'body-large': createTypographyTypeConfig(1.6, 18, 24),
|
|
1272
|
+
'body-medium': createTypographyTypeConfig(1.6, 18, 18),
|
|
1273
|
+
body: createTypographyTypeConfig(1.6, 16, 16),
|
|
1274
|
+
'body-small': createTypographyTypeConfig(1.6, 14, 14),
|
|
1275
|
+
'body-xsmall': createTypographyTypeConfig(1.6, 12, 12)
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
var theme = {
|
|
1282
|
+
spacing: 4,
|
|
1283
|
+
colors: colorsLateOceanTheme,
|
|
1284
|
+
palettes: {
|
|
1285
|
+
lateOcean: lateOceanColorPalette
|
|
1286
|
+
},
|
|
1287
|
+
avatar: avatarLateOceanTheme,
|
|
1288
|
+
button: buttonLateOceanTheme,
|
|
1289
|
+
card: cardLateOceanTheme,
|
|
1290
|
+
feedbackMessage: feedbackMessageLateOceanTheme,
|
|
1291
|
+
forms: formsLateOceanTheme,
|
|
1292
|
+
typography: typographyLateOceanTheme,
|
|
1293
|
+
tag: tagLateOceanTheme,
|
|
1294
|
+
shadows: shadowsLateOceanTheme,
|
|
1295
|
+
fullScreenModal: fullScreenModalLateOceanTheme,
|
|
1296
|
+
listItem: listItemLateOceanTheme
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
function matchWindowSize(currentWidth, _ref) {
|
|
1300
|
+
var minWidth = _ref.minWidth,
|
|
1301
|
+
maxWidth = _ref.maxWidth;
|
|
1302
|
+
return currentWidth >= minWidth && (!maxWidth || currentWidth <= maxWidth);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
function createWindowSizeHelper(currentWidth) {
|
|
1306
|
+
return {
|
|
1307
|
+
matchWindowSize: function matchWindowSize$1(options) {
|
|
1308
|
+
return matchWindowSize(currentWidth, options);
|
|
1309
|
+
},
|
|
1310
|
+
ifWindowSizeMatches: function ifWindowSizeMatches(options, valueIfTrue, valueIfFalse) {
|
|
1311
|
+
return matchWindowSize(currentWidth, options) ? valueIfTrue : valueIfFalse;
|
|
1312
|
+
},
|
|
1313
|
+
mapWindowWidth: function mapWindowWidth() {
|
|
1314
|
+
for (var _len = arguments.length, widthList = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1315
|
+
widthList[_key] = arguments[_key];
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
widthList.slice(1).forEach(function (_ref, index) {
|
|
1319
|
+
var _ref2 = _slicedToArray(_ref, 1),
|
|
1320
|
+
minWidth = _ref2[0];
|
|
1321
|
+
|
|
1322
|
+
var previousMinWidth = widthList[index][0];
|
|
1323
|
+
|
|
1324
|
+
if (previousMinWidth > minWidth) {
|
|
1325
|
+
throw new Error("mapWindowWidth: sort your values to be mobile first. ".concat(minWidth, " is < ").concat(previousMinWidth, ", so ").concat(minWidth, " should be before ").concat(previousMinWidth, "."));
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
var found = widthList.find(function (_ref3) {
|
|
1329
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1330
|
+
minWidth = _ref4[0];
|
|
1331
|
+
_ref4[1];
|
|
1332
|
+
|
|
1333
|
+
return matchWindowSize(currentWidth, {
|
|
1334
|
+
minWidth: Number(minWidth)
|
|
1335
|
+
});
|
|
1336
|
+
});
|
|
1337
|
+
if (!found) return null;
|
|
1338
|
+
return found[1];
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1344
|
+
|
|
1345
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1346
|
+
function KittThemeProvider(_ref) {
|
|
1347
|
+
var children = _ref.children,
|
|
1348
|
+
_ref$appTheme = _ref.appTheme,
|
|
1349
|
+
appTheme = _ref$appTheme === void 0 ? {} : _ref$appTheme;
|
|
1350
|
+
|
|
1351
|
+
var _useWindowSize = useWindowDimensions(),
|
|
1352
|
+
width = _useWindowSize.width;
|
|
1353
|
+
|
|
1354
|
+
var themeWithWindowSizeHelper = useMemo(function () {
|
|
1355
|
+
return _objectSpread$1(_objectSpread$1({
|
|
1356
|
+
kitt: theme
|
|
1357
|
+
}, appTheme), {}, {
|
|
1358
|
+
responsive: createWindowSizeHelper(width)
|
|
1359
|
+
});
|
|
1360
|
+
}, [width, appTheme]);
|
|
1361
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
1362
|
+
theme: themeWithWindowSizeHelper
|
|
1363
|
+
}, children);
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
var _templateObject$d;
|
|
1367
|
+
var ContentView$1 = styled.View(_templateObject$d || (_templateObject$d = _taggedTemplateLiteral(["\n flex: 1 0 0%;\n align-self: center;\n"])));
|
|
1368
|
+
function ListItemContent(_ref) {
|
|
1369
|
+
var children = _ref.children,
|
|
1370
|
+
rest = _objectWithoutProperties(_ref, ["children"]);
|
|
1371
|
+
|
|
1372
|
+
return /*#__PURE__*/React.createElement(ContentView$1, rest, children);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
var _templateObject$c, _templateObject2$6;
|
|
1376
|
+
var SideContainerView = styled.View(_templateObject$c || (_templateObject$c = _taggedTemplateLiteral(["\n flex-direction: row;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (_ref) {
|
|
1377
|
+
var theme = _ref.theme,
|
|
1378
|
+
side = _ref.side;
|
|
1379
|
+
return side === 'right' ? theme.kitt.listItem.innerMargin : 0;
|
|
1380
|
+
}, function (_ref2) {
|
|
1381
|
+
var theme = _ref2.theme,
|
|
1382
|
+
side = _ref2.side;
|
|
1383
|
+
return side === 'left' ? theme.kitt.listItem.innerMargin : 0;
|
|
1384
|
+
}); // Handles the vertical alignment of the side elements of the list item
|
|
1385
|
+
|
|
1386
|
+
function ListItemSideContainer(_ref3) {
|
|
1387
|
+
var children = _ref3.children,
|
|
1388
|
+
_ref3$side = _ref3.side,
|
|
1389
|
+
side = _ref3$side === void 0 ? 'left' : _ref3$side,
|
|
1390
|
+
rest = _objectWithoutProperties(_ref3, ["children", "side"]);
|
|
1391
|
+
|
|
1392
|
+
return /*#__PURE__*/React.createElement(SideContainerView, _extends({
|
|
1393
|
+
side: side
|
|
1394
|
+
}, rest), children);
|
|
1395
|
+
}
|
|
1396
|
+
var SideContentView = styled.View(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n align-self: ", ";\n"])), function (_ref4) {
|
|
1397
|
+
var align = _ref4.align;
|
|
1398
|
+
return align;
|
|
1399
|
+
});
|
|
1400
|
+
function ListItemSideContent(_ref5) {
|
|
1401
|
+
var children = _ref5.children,
|
|
1402
|
+
_ref5$align = _ref5.align,
|
|
1403
|
+
align = _ref5$align === void 0 ? 'auto' : _ref5$align,
|
|
1404
|
+
rest = _objectWithoutProperties(_ref5, ["children", "align"]);
|
|
1405
|
+
|
|
1406
|
+
return /*#__PURE__*/React.createElement(SideContentView, _extends({
|
|
1407
|
+
align: align
|
|
1408
|
+
}, rest), children);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
var _templateObject$b;
|
|
1412
|
+
var ContainerView = styled.View(_templateObject$b || (_templateObject$b = _taggedTemplateLiteral(["\n flex-direction: row;\n padding: ", ";\n ", ";\n border-color: ", ";\n background-color: ", ";\n"])), function (_ref) {
|
|
1413
|
+
var withPadding = _ref.withPadding,
|
|
1414
|
+
theme = _ref.theme;
|
|
1415
|
+
return withPadding ? theme.kitt.listItem.padding : 0;
|
|
1416
|
+
}, function (_ref2) {
|
|
1417
|
+
var theme = _ref2.theme,
|
|
1418
|
+
borders = _ref2.borders;
|
|
1419
|
+
var borderWidth = theme.kitt.listItem.borderWidth;
|
|
1420
|
+
|
|
1421
|
+
if (borders === 'top') {
|
|
1422
|
+
return "border-top-width: ".concat(borderWidth);
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
if (borders === 'bottom') {
|
|
1426
|
+
return "border-bottom-width: ".concat(borderWidth);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
if (borders === 'both') {
|
|
1430
|
+
return "border-top-width: ".concat(borderWidth, "; border-bottom-width: ").concat(borderWidth);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
return 'border: none';
|
|
1434
|
+
}, function (_ref3) {
|
|
1435
|
+
var theme = _ref3.theme;
|
|
1436
|
+
return theme.kitt.listItem.borderColor;
|
|
1437
|
+
}, function (_ref4) {
|
|
1438
|
+
var theme = _ref4.theme;
|
|
1439
|
+
return theme.kitt.colors.uiBackgroundLight;
|
|
1440
|
+
});
|
|
1441
|
+
function ListItem(_ref5) {
|
|
1442
|
+
var children = _ref5.children,
|
|
1443
|
+
withPadding = _ref5.withPadding,
|
|
1444
|
+
borders = _ref5.borders,
|
|
1445
|
+
left = _ref5.left,
|
|
1446
|
+
right = _ref5.right,
|
|
1447
|
+
rest = _objectWithoutProperties(_ref5, ["children", "withPadding", "borders", "left", "right"]);
|
|
1448
|
+
|
|
1449
|
+
return /*#__PURE__*/React.createElement(Pressable, rest, /*#__PURE__*/React.createElement(ContainerView, {
|
|
1450
|
+
withPadding: withPadding,
|
|
1451
|
+
borders: borders
|
|
1452
|
+
}, left ? /*#__PURE__*/React.createElement(ListItemSideContainer, {
|
|
1453
|
+
side: "left"
|
|
1454
|
+
}, left) : null, /*#__PURE__*/React.createElement(ListItemContent, null, children), right ? /*#__PURE__*/React.createElement(ListItemSideContainer, {
|
|
1455
|
+
side: "right"
|
|
1456
|
+
}, right) : null));
|
|
1457
|
+
}
|
|
1458
|
+
ListItem.Content = ListItemContent;
|
|
1459
|
+
ListItem.SideContent = ListItemSideContent;
|
|
1460
|
+
ListItem.SideContainer = ListItemSideContainer;
|
|
1461
|
+
|
|
1462
|
+
var _templateObject$a, _templateObject2$5, _templateObject3$3, _templateObject4$2;
|
|
1463
|
+
var xIconSize = 14;
|
|
1464
|
+
var mainIconSize = 20;
|
|
1465
|
+
var Container$1 = styled.View(_templateObject$a || (_templateObject$a = _taggedTemplateLiteral(["\n border-radius: ", "px;\n background-color: ", ";\n padding-bottom: ", "px;\n padding-left: ", "px;\n padding-right: ", "px;\n padding-top: ", "px;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n"])), function (_ref) {
|
|
1466
|
+
var theme = _ref.theme,
|
|
1467
|
+
noRadius = _ref.noRadius;
|
|
1468
|
+
return noRadius ? 0 : theme.kitt.spacing * 5;
|
|
1469
|
+
}, function (_ref2) {
|
|
1470
|
+
var theme = _ref2.theme,
|
|
1471
|
+
type = _ref2.type;
|
|
1472
|
+
return theme.kitt.feedbackMessage.backgroundColors[type];
|
|
1473
|
+
}, function (_ref3) {
|
|
1474
|
+
var theme = _ref3.theme;
|
|
1475
|
+
return theme.kitt.spacing * 4;
|
|
1476
|
+
}, function (_ref4) {
|
|
1477
|
+
var theme = _ref4.theme;
|
|
1478
|
+
return theme.kitt.spacing * 4;
|
|
1479
|
+
}, function (_ref5) {
|
|
1480
|
+
var theme = _ref5.theme;
|
|
1481
|
+
return theme.kitt.spacing * 4;
|
|
1482
|
+
}, function (_ref6) {
|
|
1483
|
+
var _insets$top;
|
|
1484
|
+
|
|
1485
|
+
var theme = _ref6.theme,
|
|
1486
|
+
insets = _ref6.insets;
|
|
1487
|
+
return ((_insets$top = insets === null || insets === void 0 ? void 0 : insets.top) !== null && _insets$top !== void 0 ? _insets$top : 0) + theme.kitt.spacing * 4;
|
|
1488
|
+
});
|
|
1489
|
+
var CloseContainer = styled.TouchableOpacity(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n padding: ", "px;\n"])), function (_ref7) {
|
|
1490
|
+
var theme = _ref7.theme;
|
|
1491
|
+
return theme.kitt.spacing * 4;
|
|
1492
|
+
}, function (_ref8) {
|
|
1493
|
+
var theme = _ref8.theme;
|
|
1494
|
+
return theme.kitt.spacing;
|
|
1495
|
+
});
|
|
1496
|
+
var IconContainer = styled.View(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteral(["\n margin-right: ", "px;\n"])), function (_ref9) {
|
|
1497
|
+
var theme = _ref9.theme;
|
|
1498
|
+
return theme.kitt.spacing * 4;
|
|
1499
|
+
});
|
|
1500
|
+
var Content = styled.Text(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteral(["\n text-align: ", ";\n flex: 1;\n"])), function (_ref10) {
|
|
1501
|
+
var centeredText = _ref10.centeredText;
|
|
1502
|
+
return centeredText ? 'center' : 'left';
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
var getColorByType = function (type) {
|
|
1506
|
+
switch (type) {
|
|
1507
|
+
case 'success':
|
|
1508
|
+
return 'white';
|
|
1509
|
+
|
|
1510
|
+
case 'danger':
|
|
1511
|
+
return 'white';
|
|
1512
|
+
|
|
1513
|
+
case 'warning':
|
|
1514
|
+
default:
|
|
1515
|
+
return 'black';
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
|
|
1519
|
+
function IconContent(_ref11) {
|
|
1520
|
+
var type = _ref11.type;
|
|
1521
|
+
|
|
1522
|
+
switch (type) {
|
|
1523
|
+
case 'warning':
|
|
1524
|
+
return /*#__PURE__*/React.createElement(AlertCircleIcon, null);
|
|
1525
|
+
|
|
1526
|
+
case 'success':
|
|
1527
|
+
return /*#__PURE__*/React.createElement(CheckIcon, null);
|
|
1528
|
+
|
|
1529
|
+
case 'danger':
|
|
1530
|
+
return /*#__PURE__*/React.createElement(AlertTriangleIcon, null);
|
|
1531
|
+
|
|
1532
|
+
default:
|
|
1533
|
+
return /*#__PURE__*/React.createElement(InfoIcon, null);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
function Message(_ref12) {
|
|
1538
|
+
var _ref12$type = _ref12.type,
|
|
1539
|
+
type = _ref12$type === void 0 ? 'info' : _ref12$type,
|
|
1540
|
+
children = _ref12.children,
|
|
1541
|
+
_ref12$noRadius = _ref12.noRadius,
|
|
1542
|
+
noRadius = _ref12$noRadius === void 0 ? false : _ref12$noRadius,
|
|
1543
|
+
_ref12$centeredText = _ref12.centeredText,
|
|
1544
|
+
centeredText = _ref12$centeredText === void 0 ? false : _ref12$centeredText,
|
|
1545
|
+
onDismiss = _ref12.onDismiss,
|
|
1546
|
+
insets = _ref12.insets;
|
|
1547
|
+
var color = getColorByType(type);
|
|
1548
|
+
return /*#__PURE__*/React.createElement(Container$1, {
|
|
1549
|
+
type: type,
|
|
1550
|
+
noRadius: noRadius,
|
|
1551
|
+
insets: insets
|
|
1552
|
+
}, !centeredText ? /*#__PURE__*/React.createElement(IconContainer, null, /*#__PURE__*/React.createElement(Icon, {
|
|
1553
|
+
size: mainIconSize,
|
|
1554
|
+
color: color,
|
|
1555
|
+
icon: /*#__PURE__*/React.createElement(IconContent, {
|
|
1556
|
+
type: type
|
|
1557
|
+
})
|
|
1558
|
+
})) : null, /*#__PURE__*/React.createElement(Content, {
|
|
1559
|
+
type: type,
|
|
1560
|
+
centeredText: centeredText
|
|
1561
|
+
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
1562
|
+
base: "body-small",
|
|
1563
|
+
color: color
|
|
1564
|
+
}, children)), onDismiss ? /*#__PURE__*/React.createElement(CloseContainer, {
|
|
1565
|
+
onPress: onDismiss
|
|
1566
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1567
|
+
name: "x",
|
|
1568
|
+
size: xIconSize,
|
|
1569
|
+
color: color
|
|
1570
|
+
})) : null);
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1574
|
+
|
|
1575
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1576
|
+
var OverlayPressable = styled.Pressable(function (_ref) {
|
|
1577
|
+
var theme = _ref.theme;
|
|
1578
|
+
return _objectSpread(_objectSpread({}, StyleSheet.absoluteFillObject), {}, {
|
|
1579
|
+
backgroundColor: theme.kitt.colors.overlay.dark
|
|
1580
|
+
});
|
|
1581
|
+
});
|
|
1582
|
+
function Overlay(_ref2) {
|
|
1583
|
+
var onPress = _ref2.onPress;
|
|
1584
|
+
return /*#__PURE__*/React.createElement(OverlayPressable, {
|
|
1585
|
+
onPress: onPress
|
|
1586
|
+
}, /*#__PURE__*/React.createElement(View, null));
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
var _templateObject$9;
|
|
1590
|
+
var BodyView = styled.View(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteral(["\n padding: ", "px ", "px;\n"])), function (_ref) {
|
|
1591
|
+
var theme = _ref.theme;
|
|
1592
|
+
return theme.kitt.spacing * 6;
|
|
1593
|
+
}, function (_ref2) {
|
|
1594
|
+
var theme = _ref2.theme;
|
|
1595
|
+
return theme.kitt.spacing * 4;
|
|
1596
|
+
});
|
|
1597
|
+
var ModalBody = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
1598
|
+
var children = _ref3.children;
|
|
1599
|
+
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
1600
|
+
ref: ref
|
|
1601
|
+
}, /*#__PURE__*/React.createElement(BodyView, null, children));
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
var _templateObject$8;
|
|
1605
|
+
var FooterView = styled.View(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n padding: ", "px;\n border-top-width: 1px;\n border-top-color: ", ";\n"])), function (_ref) {
|
|
1606
|
+
var theme = _ref.theme;
|
|
1607
|
+
return theme.kitt.spacing * 4;
|
|
1608
|
+
}, function (_ref2) {
|
|
1609
|
+
var theme = _ref2.theme;
|
|
1610
|
+
return theme.kitt.colors.separator;
|
|
1611
|
+
});
|
|
1612
|
+
function ModalFooter(_ref3) {
|
|
1613
|
+
var children = _ref3.children;
|
|
1614
|
+
return /*#__PURE__*/React.createElement(FooterView, null, children);
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
var OnCloseContext = /*#__PURE__*/createContext(function () {});
|
|
1618
|
+
|
|
1619
|
+
var _templateObject$7, _templateObject2$4, _templateObject3$2, _templateObject4$1;
|
|
1620
|
+
var HeaderView = styled.View(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteral(["\n position: relative;\n padding: ", "px;\n display: flex;\n flex: 0 0 auto;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n border-bottom-width: 1px;\n border-bottom-color: ", ";\n min-height: 57px;\n"])), function (_ref) {
|
|
1621
|
+
var theme = _ref.theme;
|
|
1622
|
+
return theme.kitt.spacing * 2;
|
|
1623
|
+
}, function (_ref2) {
|
|
1624
|
+
var theme = _ref2.theme;
|
|
1625
|
+
return theme.kitt.colors.separator;
|
|
1626
|
+
});
|
|
1627
|
+
var LeftIconView = styled.View(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteral(["\n align-self: flex-start;\n margin-right: ", "px;\n"])), function (_ref3) {
|
|
1628
|
+
var theme = _ref3.theme;
|
|
1629
|
+
return theme.kitt.spacing * 2;
|
|
1630
|
+
});
|
|
1631
|
+
var RightIconView = styled.View(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteral(["\n align-self: flex-start;\n margin-left: ", "px;\n"])), function (_ref4) {
|
|
1632
|
+
var theme = _ref4.theme;
|
|
1633
|
+
return theme.kitt.spacing * 2;
|
|
1634
|
+
});
|
|
1635
|
+
var TitleView = styled.View(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n padding-left: ", "px;\n flex-shrink: 1;\n"])), function (_ref5) {
|
|
1636
|
+
var theme = _ref5.theme,
|
|
1637
|
+
isIconLeft = _ref5.isIconLeft;
|
|
1638
|
+
return isIconLeft ? 0 : theme.kitt.spacing * 2;
|
|
1639
|
+
});
|
|
1640
|
+
function ModalHeader(_ref6) {
|
|
1641
|
+
var left = _ref6.left,
|
|
1642
|
+
right = _ref6.right,
|
|
1643
|
+
children = _ref6.children;
|
|
1644
|
+
var onClose = useContext(OnCloseContext);
|
|
1645
|
+
var isIconLeft = !!left;
|
|
1646
|
+
return /*#__PURE__*/React.createElement(HeaderView, null, isIconLeft && /*#__PURE__*/React.createElement(LeftIconView, null, left), /*#__PURE__*/React.createElement(TitleView, {
|
|
1647
|
+
isIconLeft: isIconLeft
|
|
1648
|
+
}, children), right !== undefined ? right : /*#__PURE__*/React.createElement(RightIconView, null, /*#__PURE__*/React.createElement(Button, {
|
|
1649
|
+
type: "subtle-dark",
|
|
1650
|
+
icon: /*#__PURE__*/React.createElement(XIcon, null),
|
|
1651
|
+
onPress: onClose
|
|
1652
|
+
})));
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
var _templateObject$6, _templateObject2$3;
|
|
1656
|
+
var ModalView = styled.View(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ", "px ", "px;\n"])), function (_ref) {
|
|
1657
|
+
var theme = _ref.theme;
|
|
1658
|
+
return theme.kitt.spacing * 20;
|
|
1659
|
+
}, function (_ref2) {
|
|
1660
|
+
var theme = _ref2.theme;
|
|
1661
|
+
return theme.kitt.spacing * 4;
|
|
1662
|
+
});
|
|
1663
|
+
var ContentView = styled.View(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n max-width: 540px;\n height: auto;\n width: 100%;\n border-radius: ", ";\n background-color: ", ";\n"])), function (_ref3) {
|
|
1664
|
+
var theme = _ref3.theme;
|
|
1665
|
+
return theme.kitt.card.borderRadius;
|
|
1666
|
+
}, function (_ref4) {
|
|
1667
|
+
var theme = _ref4.theme;
|
|
1668
|
+
return theme.kitt.palettes.lateOcean.white;
|
|
1669
|
+
});
|
|
1670
|
+
function Modal(_ref5) {
|
|
1671
|
+
var visible = _ref5.visible,
|
|
1672
|
+
children = _ref5.children,
|
|
1673
|
+
onClose = _ref5.onClose,
|
|
1674
|
+
onEntered = _ref5.onEntered,
|
|
1675
|
+
onExited = _ref5.onExited;
|
|
1676
|
+
return /*#__PURE__*/React.createElement(OnCloseContext.Provider, {
|
|
1677
|
+
value: onClose
|
|
1678
|
+
}, /*#__PURE__*/React.createElement(Modal$1, {
|
|
1679
|
+
transparent: true,
|
|
1680
|
+
animationType: "fade",
|
|
1681
|
+
visible: visible,
|
|
1682
|
+
onShow: onEntered,
|
|
1683
|
+
onDismiss: onExited,
|
|
1684
|
+
onRequestClose: onClose
|
|
1685
|
+
}, /*#__PURE__*/React.createElement(ModalView, null, /*#__PURE__*/React.createElement(Overlay, {
|
|
1686
|
+
onPress: onClose
|
|
1687
|
+
}), /*#__PURE__*/React.createElement(ContentView, null, children))));
|
|
1688
|
+
}
|
|
1689
|
+
Modal.Header = ModalHeader;
|
|
1690
|
+
Modal.Body = ModalBody;
|
|
1691
|
+
Modal.Footer = ModalFooter;
|
|
1692
|
+
|
|
1693
|
+
function Notification(_ref) {
|
|
1694
|
+
var type = _ref.type,
|
|
1695
|
+
children = _ref.children,
|
|
1696
|
+
centeredText = _ref.centeredText,
|
|
1697
|
+
onDelete = _ref.onDelete;
|
|
1698
|
+
|
|
1699
|
+
var _useSafeAreaInsets = useSafeAreaInsets(),
|
|
1700
|
+
top = _useSafeAreaInsets.top;
|
|
1701
|
+
|
|
1702
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
1703
|
+
noRadius: true,
|
|
1704
|
+
type: type,
|
|
1705
|
+
centeredText: centeredText,
|
|
1706
|
+
insets: {
|
|
1707
|
+
top: top
|
|
1708
|
+
},
|
|
1709
|
+
onDismiss: onDelete
|
|
1710
|
+
}, children);
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
var _templateObject$5, _templateObject2$2;
|
|
1714
|
+
var StoryTitleContainer = styled.View(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n margin-bottom: 30px;\n"])));
|
|
1715
|
+
var StorySubTitleContainer = styled.View(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n margin-bottom: 10px;\n"])));
|
|
1716
|
+
function StoryTitle(_ref) {
|
|
1717
|
+
var color = _ref.color,
|
|
1718
|
+
children = _ref.children,
|
|
1719
|
+
numberOfLines = _ref.numberOfLines;
|
|
1720
|
+
return /*#__PURE__*/React.createElement(StoryTitleContainer, null, /*#__PURE__*/React.createElement(Typography.h1, {
|
|
1721
|
+
variant: "bold",
|
|
1722
|
+
base: "header1",
|
|
1723
|
+
color: color,
|
|
1724
|
+
numberOfLines: numberOfLines
|
|
1725
|
+
}, children));
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
function StoryTitleLevel2(_ref2) {
|
|
1729
|
+
var color = _ref2.color,
|
|
1730
|
+
children = _ref2.children,
|
|
1731
|
+
numberOfLines = _ref2.numberOfLines;
|
|
1732
|
+
return /*#__PURE__*/React.createElement(StoryTitleContainer, null, /*#__PURE__*/React.createElement(Typography.h2, {
|
|
1733
|
+
variant: "bold",
|
|
1734
|
+
base: "header2",
|
|
1735
|
+
color: color,
|
|
1736
|
+
numberOfLines: numberOfLines
|
|
1737
|
+
}, children));
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
StoryTitleLevel2.displayName = 'StoryTitle.Level2';
|
|
1741
|
+
|
|
1742
|
+
function StoryTitleLevel3(_ref3) {
|
|
1743
|
+
var color = _ref3.color,
|
|
1744
|
+
children = _ref3.children,
|
|
1745
|
+
numberOfLines = _ref3.numberOfLines;
|
|
1746
|
+
return /*#__PURE__*/React.createElement(StorySubTitleContainer, null, /*#__PURE__*/React.createElement(Typography.h3, {
|
|
1747
|
+
variant: "bold",
|
|
1748
|
+
base: "header3",
|
|
1749
|
+
medium: "header4",
|
|
1750
|
+
color: color,
|
|
1751
|
+
numberOfLines: numberOfLines
|
|
1752
|
+
}, children));
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
StoryTitleLevel3.displayName = 'StoryTitle.Level3';
|
|
1756
|
+
|
|
1757
|
+
function StoryTitleLevel4(_ref4) {
|
|
1758
|
+
var color = _ref4.color,
|
|
1759
|
+
children = _ref4.children,
|
|
1760
|
+
numberOfLines = _ref4.numberOfLines;
|
|
1761
|
+
return /*#__PURE__*/React.createElement(StorySubTitleContainer, null, /*#__PURE__*/React.createElement(Typography.h4, {
|
|
1762
|
+
variant: "bold",
|
|
1763
|
+
base: "header4",
|
|
1764
|
+
medium: "header5",
|
|
1765
|
+
color: color,
|
|
1766
|
+
numberOfLines: numberOfLines
|
|
1767
|
+
}, children));
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
StoryTitleLevel4.displayName = 'StoryTitle.Level3';
|
|
1771
|
+
StoryTitle.Level2 = StoryTitleLevel2;
|
|
1772
|
+
StoryTitle.Level3 = StoryTitleLevel3;
|
|
1773
|
+
StoryTitle.Level4 = StoryTitleLevel4;
|
|
1774
|
+
|
|
1775
|
+
var _templateObject$4, _templateObject2$1, _templateObject3$1;
|
|
1776
|
+
var StyledSection = styled.View(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n margin-bottom: 30px;\n"])));
|
|
1777
|
+
function Section(_ref) {
|
|
1778
|
+
var title = _ref.title;
|
|
1779
|
+
_ref.className;
|
|
1780
|
+
var children = _ref.children,
|
|
1781
|
+
props = _objectWithoutProperties(_ref, ["title", "className", "children"]);
|
|
1782
|
+
|
|
1783
|
+
return /*#__PURE__*/React.createElement(StyledSection, props, /*#__PURE__*/React.createElement(StoryTitle.Level2, null, title), children);
|
|
1784
|
+
}
|
|
1785
|
+
var StyledSubSection = styled.View(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n margin-bottom: 20px;\n"])));
|
|
1786
|
+
|
|
1787
|
+
function SubSection(_ref2) {
|
|
1788
|
+
var title = _ref2.title;
|
|
1789
|
+
_ref2.className;
|
|
1790
|
+
var children = _ref2.children,
|
|
1791
|
+
props = _objectWithoutProperties(_ref2, ["title", "className", "children"]);
|
|
1792
|
+
|
|
1793
|
+
return /*#__PURE__*/React.createElement(StyledSubSection, props, /*#__PURE__*/React.createElement(StoryTitle.Level3, null, title), children);
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
var StyledDemoSection = styled.View(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n margin-bottom: 90px;\n"])));
|
|
1797
|
+
|
|
1798
|
+
function DemoSection(_ref3) {
|
|
1799
|
+
var children = _ref3.children;
|
|
1800
|
+
return /*#__PURE__*/React.createElement(StyledDemoSection, null, /*#__PURE__*/React.createElement(Section, {
|
|
1801
|
+
title: "Demo"
|
|
1802
|
+
}, children));
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
Section.SubSection = SubSection;
|
|
1806
|
+
Section.DemoSection = DemoSection;
|
|
1807
|
+
|
|
1808
|
+
var _templateObject$3;
|
|
1809
|
+
var StoryContainer = styled.ScrollView(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n padding: 10px;\n"])));
|
|
1810
|
+
function Story(_ref) {
|
|
1811
|
+
var title = _ref.title,
|
|
1812
|
+
contentContainerStyle = _ref.contentContainerStyle,
|
|
1813
|
+
children = _ref.children;
|
|
1814
|
+
return /*#__PURE__*/React.createElement(StoryContainer, {
|
|
1815
|
+
contentContainerStyle: contentContainerStyle
|
|
1816
|
+
}, /*#__PURE__*/React.createElement(StoryTitle, null, title), children);
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
function StoryDecorator(storyFn, context) {
|
|
1820
|
+
return /*#__PURE__*/React.createElement(Story, {
|
|
1821
|
+
title: context.name
|
|
1822
|
+
}, storyFn());
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
var _templateObject$2, _templateObject2, _templateObject3, _templateObject4;
|
|
1826
|
+
var SmallScreenRow = styled.View(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n flex-direction: column;\n margin: 0;\n"])));
|
|
1827
|
+
var SmallScreenCol = styled.View(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 10px 0 20px;\n"])));
|
|
1828
|
+
var FlexRow = styled.View(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex-direction: row;\n margin: 0 -5px 20px;\n"])));
|
|
1829
|
+
var FlexCol = styled.View(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex-grow: 1;\n flex-basis: 0;\n margin: 0 5px 10px;\n"])));
|
|
1830
|
+
|
|
1831
|
+
function StoryGridRow(_ref) {
|
|
1832
|
+
var children = _ref.children,
|
|
1833
|
+
_ref$breakpoint = _ref.breakpoint,
|
|
1834
|
+
breakpoint = _ref$breakpoint === void 0 ? 'small' : _ref$breakpoint;
|
|
1835
|
+
|
|
1836
|
+
// eslint-disable-next-line unicorn/expiring-todo-comments
|
|
1837
|
+
// TODO use useBreakpoint instead
|
|
1838
|
+
var _useWindowDimensions = useWindowDimensions(),
|
|
1839
|
+
width = _useWindowDimensions.width;
|
|
1840
|
+
|
|
1841
|
+
var breakpointValue = breakpoint === 'small' ? 480 : 768;
|
|
1842
|
+
|
|
1843
|
+
if (width < breakpointValue) {
|
|
1844
|
+
return /*#__PURE__*/React.createElement(SmallScreenRow, null, React.Children.map(children, function (child) {
|
|
1845
|
+
return /*#__PURE__*/React.createElement(SmallScreenCol, null, child);
|
|
1846
|
+
}));
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
return /*#__PURE__*/React.createElement(FlexRow, null, React.Children.map(children, function (child) {
|
|
1850
|
+
return /*#__PURE__*/React.createElement(FlexCol, null, child);
|
|
1851
|
+
}));
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
function StoryGridCol(_ref2) {
|
|
1855
|
+
var title = _ref2.title,
|
|
1856
|
+
titleColor = _ref2.titleColor,
|
|
1857
|
+
children = _ref2.children;
|
|
1858
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, title ? /*#__PURE__*/React.createElement(StoryTitle.Level4, {
|
|
1859
|
+
numberOfLines: 1,
|
|
1860
|
+
color: titleColor
|
|
1861
|
+
}, title) : null, children);
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
var StoryGrid = {
|
|
1865
|
+
Row: StoryGridRow,
|
|
1866
|
+
Col: StoryGridCol
|
|
1867
|
+
};
|
|
1868
|
+
|
|
1869
|
+
var StoryComponents = {
|
|
1870
|
+
Section: Section,
|
|
1871
|
+
Story: Story,
|
|
1872
|
+
StoryDecorator: StoryDecorator,
|
|
1873
|
+
StoryGrid: StoryGrid,
|
|
1874
|
+
StoryTitle: StoryTitle
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
var _templateObject$1;
|
|
1878
|
+
var Container = styled.View(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n background-color: ", ";\n padding: ", ";\n border-radius: ", ";\n align-self: flex-start;\n"])), function (_ref) {
|
|
1879
|
+
var theme = _ref.theme,
|
|
1880
|
+
type = _ref.type;
|
|
1881
|
+
return theme.kitt.tag[type].backgroundColor;
|
|
1882
|
+
}, function (_ref2) {
|
|
1883
|
+
var theme = _ref2.theme;
|
|
1884
|
+
return theme.kitt.tag.padding;
|
|
1885
|
+
}, function (_ref3) {
|
|
1886
|
+
var theme = _ref3.theme;
|
|
1887
|
+
return theme.kitt.tag.borderRadius;
|
|
1888
|
+
});
|
|
1889
|
+
function Tag(_ref4) {
|
|
1890
|
+
var label = _ref4.label,
|
|
1891
|
+
_ref4$type = _ref4.type,
|
|
1892
|
+
type = _ref4$type === void 0 ? 'default' : _ref4$type;
|
|
1893
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
1894
|
+
type: type
|
|
1895
|
+
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
1896
|
+
base: "body-xsmall",
|
|
1897
|
+
color: type === 'primary' ? 'primary-light' : undefined
|
|
1898
|
+
}, label));
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
function Tooltip(_ref) {
|
|
1902
|
+
var children = _ref.children;
|
|
1903
|
+
return /*#__PURE__*/React.createElement(View, null, children);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
var _templateObject;
|
|
1907
|
+
var StyledLink = styled(Typography).withConfig({
|
|
1908
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
1909
|
+
return !['disabled', 'noUnderline'].includes(prop);
|
|
1910
|
+
}
|
|
1911
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-decoration: ", ";\n ", ";\n margin: 0;\n"])), function (_ref) {
|
|
1912
|
+
var noUnderline = _ref.noUnderline;
|
|
1913
|
+
return noUnderline ? 'none' : 'underline';
|
|
1914
|
+
}, function (_ref2) {
|
|
1915
|
+
var disabled = _ref2.disabled;
|
|
1916
|
+
return Platform.OS === 'web' ? "\n text-decoration-color: inherit;\n transition: color 0.2s ease-in-out;\n cursor: ".concat(disabled ? 'not-allowed' : 'pointer', ";\n ") : null;
|
|
1917
|
+
});
|
|
1918
|
+
function TypographyLink(_ref3) {
|
|
1919
|
+
var disabled = _ref3.disabled,
|
|
1920
|
+
noUnderline = _ref3.noUnderline,
|
|
1921
|
+
_ref3$variant = _ref3.variant,
|
|
1922
|
+
variant = _ref3$variant === void 0 ? 'bold' : _ref3$variant,
|
|
1923
|
+
otherProps = _objectWithoutProperties(_ref3, ["disabled", "noUnderline", "variant"]);
|
|
1924
|
+
|
|
1925
|
+
return /*#__PURE__*/React.createElement(StyledLink, _extends({
|
|
1926
|
+
disabled: disabled,
|
|
1927
|
+
noUnderline: noUnderline,
|
|
1928
|
+
variant: variant,
|
|
1929
|
+
accessibilityRole: "link"
|
|
1930
|
+
}, otherProps));
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
export { Avatar, Button, Card, FullScreenModal, Icon, InputFeedback, InputField, InputText, KittThemeProvider, Label, ListItem, Message, Modal, Notification, Radio, StoryComponents, Tag, TextArea, Tooltip, Typography, TypographyIcon, TypographyLink, createWindowSizeHelper, styledTextInputMixin, theme, useButton };
|
|
1934
|
+
//# sourceMappingURL=index-browser-all-dev.es.js.map
|