@ornikar/kitt-universal 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/definitions/Avatar/Avatar.d.ts.map +1 -1
- package/dist/definitions/Button/Button.d.ts +4 -4
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonPressable.d.ts +4 -3
- package/dist/definitions/Button/ButtonPressable.d.ts.map +1 -1
- package/dist/definitions/Card/Card.d.ts.map +1 -1
- package/dist/definitions/Emoji/Emoji.d.ts +3 -3
- package/dist/definitions/Emoji/Emoji.d.ts.map +1 -1
- package/dist/definitions/ExternalLink/ExternalLink.d.ts +3 -3
- package/dist/definitions/ExternalLink/ExternalLink.d.ts.map +1 -1
- package/dist/definitions/ExternalLink/ExternalLink.web.d.ts.map +1 -1
- package/dist/definitions/FullScreenModal/Body.d.ts.map +1 -1
- package/dist/definitions/FullScreenModal/FullScreenModal.d.ts.map +1 -1
- package/dist/definitions/FullScreenModal/Header.d.ts.map +1 -1
- package/dist/definitions/Icon/Icon.d.ts.map +1 -1
- package/dist/definitions/Icon/SpinningIcon.web.d.ts +3 -2
- package/dist/definitions/Icon/SpinningIcon.web.d.ts.map +1 -1
- package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableAnimatedContainer.web.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableIconButton.d.ts +4 -4
- package/dist/definitions/IconButton/PressableIconButton.d.ts.map +1 -1
- package/dist/definitions/ListItem/ListItem.d.ts +3 -4
- package/dist/definitions/ListItem/ListItem.d.ts.map +1 -1
- package/dist/definitions/ListItem/ListItemContent.d.ts +2 -2
- package/dist/definitions/ListItem/ListItemContent.d.ts.map +1 -1
- package/dist/definitions/ListItem/ListItemSideContent.d.ts +3 -4
- package/dist/definitions/ListItem/ListItemSideContent.d.ts.map +1 -1
- package/dist/definitions/Loader/LargeLoader.d.ts.map +1 -1
- package/dist/definitions/Loader/LargeLoader.web.d.ts.map +1 -1
- package/dist/definitions/Loader/Loader.d.ts.map +1 -1
- package/dist/definitions/Loader/Loader.web.d.ts.map +1 -1
- package/dist/definitions/Message/Message.d.ts.map +1 -1
- package/dist/definitions/Modal/Body.d.ts.map +1 -1
- package/dist/definitions/Modal/Footer.d.ts.map +1 -1
- package/dist/definitions/Modal/Header.d.ts.map +1 -1
- package/dist/definitions/Modal/Modal.d.ts.map +1 -1
- package/dist/definitions/Notification/Notification.d.ts.map +1 -1
- package/dist/definitions/Overlay/Overlay.d.ts +2 -2
- package/dist/definitions/Overlay/Overlay.d.ts.map +1 -1
- package/dist/definitions/Tag/Tag.d.ts.map +1 -1
- package/dist/definitions/TimePicker/ModalDateTimePicker.d.ts +12 -0
- package/dist/definitions/TimePicker/ModalDateTimePicker.d.ts.map +1 -0
- package/dist/definitions/TimePicker/TimePicker.d.ts +15 -0
- package/dist/definitions/TimePicker/TimePicker.d.ts.map +1 -0
- package/dist/definitions/TimePicker/TimePicker.web.d.ts +3 -0
- package/dist/definitions/TimePicker/TimePicker.web.d.ts.map +1 -0
- package/dist/definitions/TimePicker/useTimePicker.d.ts +14 -0
- package/dist/definitions/TimePicker/useTimePicker.d.ts.map +1 -0
- package/dist/definitions/Tooltip/Tooltip.d.ts +23 -3
- package/dist/definitions/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/definitions/Tooltip/Tooltip.web.d.ts +8 -0
- package/dist/definitions/Tooltip/Tooltip.web.d.ts.map +1 -0
- package/dist/definitions/Tooltip/TooltipView.d.ts +8 -0
- package/dist/definitions/Tooltip/TooltipView.d.ts.map +1 -0
- package/dist/definitions/Tooltip/tooltipUtils.d.ts +5 -0
- package/dist/definitions/Tooltip/tooltipUtils.d.ts.map +1 -0
- package/dist/definitions/forms/InputFeedback/InputFeedback.d.ts.map +1 -1
- package/dist/definitions/forms/InputField/InputField.d.ts.map +1 -1
- package/dist/definitions/forms/InputText/InputText.d.ts +3 -2
- package/dist/definitions/forms/InputText/InputText.d.ts.map +1 -1
- package/dist/definitions/forms/Label/Label.d.ts.map +1 -1
- package/dist/definitions/forms/Radio/Radio.d.ts.map +1 -1
- package/dist/definitions/forms/TextArea/TextArea.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +3 -15
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/story-components/Flex.d.ts +2 -2
- package/dist/definitions/story-components/Flex.d.ts.map +1 -1
- package/dist/definitions/story-components/Story.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryBlock.d.ts +1 -2
- package/dist/definitions/story-components/StoryBlock.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryContainer.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryContainer.web.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryDecorator.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryGrid.d.ts.map +1 -1
- package/dist/definitions/story-components/StorySection.d.ts +7 -9
- package/dist/definitions/story-components/StorySection.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryTitle.d.ts.map +1 -1
- package/dist/definitions/themes/default.d.ts +3 -6
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts +1 -0
- package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/tooltip.d.ts +10 -0
- package/dist/definitions/themes/late-ocean/tooltip.d.ts.map +1 -0
- package/dist/definitions/themes/late-ocean/typographyLateOceanTheme.d.ts +6 -8
- package/dist/definitions/themes/late-ocean/typographyLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/typography/Typography.d.ts +16 -4
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyEmoji.d.ts +3 -4
- package/dist/definitions/typography/TypographyEmoji.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyLink.d.ts +6 -9
- package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/useKittTheme.d.ts +8 -1
- package/dist/definitions/useKittTheme.d.ts.map +1 -1
- package/dist/definitions/utils/StyleWebWrapper.d.ts +7 -0
- package/dist/definitions/utils/StyleWebWrapper.d.ts.map +1 -0
- package/dist/definitions/utils/storybook/{decorators/KittThemeDecorator.d.ts → KittThemeDecorator.d.ts} +1 -1
- package/dist/definitions/utils/storybook/KittThemeDecorator.d.ts.map +1 -0
- package/dist/definitions/utils/tests/renderWithProvidersUtils.d.ts +2 -2
- package/dist/definitions/utils/tests/renderWithProvidersUtils.d.ts.map +1 -1
- package/dist/definitions/utils/tests/styled-component-typing-test.d.ts +1 -0
- package/dist/definitions/utils/tests/styled-component-typing-test.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/MatchWindowSize.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts +2 -2
- package/dist/definitions/utils/withTheme.d.ts +7 -0
- package/dist/definitions/utils/withTheme.d.ts.map +1 -0
- package/dist/index-browser-all.es.android.js +1299 -622
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.css +2 -0
- package/dist/index-browser-all.es.ios.js +1300 -623
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +1262 -696
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +1113 -850
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.css +2 -0
- package/dist/index-node-14.17.cjs.js +1112 -619
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.css +4 -0
- package/dist/index-node-14.17.cjs.web.js +2979 -0
- package/dist/index-node-14.17.cjs.web.js.map +1 -0
- package/dist/styles.css +4 -0
- package/dist/tsbuildinfo +1 -1
- package/package.json +16 -6
- package/translations/es-ES.json +3 -0
- package/translations/fr-FR.json +3 -0
- package/dist/definitions/primitives/PrimitiveImage.d.ts +0 -13
- package/dist/definitions/primitives/PrimitiveImage.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveImage.web.d.ts +0 -4
- package/dist/definitions/primitives/PrimitiveImage.web.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveLink.d.ts +0 -13
- package/dist/definitions/primitives/PrimitiveLink.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveLink.web.d.ts +0 -4
- package/dist/definitions/primitives/PrimitiveLink.web.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitivePressable.d.ts +0 -19
- package/dist/definitions/primitives/PrimitivePressable.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitivePressable.web.d.ts +0 -4
- package/dist/definitions/primitives/PrimitivePressable.web.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveScrollView.d.ts +0 -8
- package/dist/definitions/primitives/PrimitiveScrollView.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveScrollView.web.d.ts +0 -4
- package/dist/definitions/primitives/PrimitiveScrollView.web.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveText.d.ts +0 -14
- package/dist/definitions/primitives/PrimitiveText.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveText.web.d.ts +0 -6
- package/dist/definitions/primitives/PrimitiveText.web.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveView.d.ts +0 -24
- package/dist/definitions/primitives/PrimitiveView.d.ts.map +0 -1
- package/dist/definitions/primitives/PrimitiveView.web.d.ts +0 -27
- package/dist/definitions/primitives/PrimitiveView.web.d.ts.map +0 -1
- package/dist/definitions/primitives/helpers.d.ts +0 -7
- package/dist/definitions/primitives/helpers.d.ts.map +0 -1
- package/dist/definitions/primitives/reset.d.ts +0 -2
- package/dist/definitions/primitives/reset.d.ts.map +0 -1
- package/dist/definitions/utils/storybook/decorators/KittThemeDecorator.d.ts.map +0 -1
- package/dist/definitions/utils/storybook/decorators/SafeAreaProviderDecorator.d.ts +0 -2
- package/dist/definitions/utils/storybook/decorators/SafeAreaProviderDecorator.d.ts.map +0 -1
- package/dist/definitions/utils/storybook/setup-global-decorators.d.ts +0 -2
- package/dist/definitions/utils/storybook/setup-global-decorators.d.ts.map +0 -1
|
@@ -0,0 +1,2979 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const BabelPluginStyledComponentsReactNative = require('react-native');
|
|
6
|
+
const kittIcons = require('@ornikar/kitt-icons');
|
|
7
|
+
const styled = require('styled-components/native');
|
|
8
|
+
const react$1 = require('react');
|
|
9
|
+
const react = require('@linaria/react');
|
|
10
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
const twemojiParser = require('twemoji-parser');
|
|
12
|
+
const reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
13
|
+
const reactDom = require('@floating-ui/react-dom');
|
|
14
|
+
const addons = require('@storybook/addons');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
17
|
+
|
|
18
|
+
const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
19
|
+
|
|
20
|
+
// type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
|
|
21
|
+
// type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
|
|
22
|
+
// export function withTheme<Props extends { theme: DefaultTheme }, C>(
|
|
23
|
+
// WrappedComponent: ComponentType<Props> & C,
|
|
24
|
+
// ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
|
|
25
|
+
// return function ThemedComponent(props) {
|
|
26
|
+
// const theme = useTheme();
|
|
27
|
+
// return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
|
|
28
|
+
// };
|
|
29
|
+
// }
|
|
30
|
+
function withTheme( // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
31
|
+
WrappedComponent) {
|
|
32
|
+
return function (props) {
|
|
33
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
34
|
+
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
35
|
+
theme: theme,
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react.styled("div")({
|
|
42
|
+
name: "StyledSpinningIconContainer",
|
|
43
|
+
class: "ssn8o83"
|
|
44
|
+
}));
|
|
45
|
+
function SpinningIcon({
|
|
46
|
+
children
|
|
47
|
+
}) {
|
|
48
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
|
|
49
|
+
children: children
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const IconContainer$2 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
54
|
+
displayName: "Icon__IconContainer",
|
|
55
|
+
componentId: "kitt-universal__sc-usm0ol-0"
|
|
56
|
+
})(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
|
|
57
|
+
color
|
|
58
|
+
}) => color, ({
|
|
59
|
+
size
|
|
60
|
+
}) => size, ({
|
|
61
|
+
size
|
|
62
|
+
}) => size, ({
|
|
63
|
+
align = 'auto'
|
|
64
|
+
}) => align);
|
|
65
|
+
function Icon({
|
|
66
|
+
icon,
|
|
67
|
+
size = 20,
|
|
68
|
+
spin,
|
|
69
|
+
align,
|
|
70
|
+
color
|
|
71
|
+
}) {
|
|
72
|
+
const clonedIcon = /*#__PURE__*/react$1.cloneElement(icon, {
|
|
73
|
+
color
|
|
74
|
+
});
|
|
75
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$2, {
|
|
76
|
+
align: align,
|
|
77
|
+
size: size,
|
|
78
|
+
color: color,
|
|
79
|
+
children: spin ? /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
|
|
80
|
+
children: clonedIcon
|
|
81
|
+
}) : clonedIcon
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const KittBreakpoints = {
|
|
86
|
+
/**
|
|
87
|
+
* min-width: 0
|
|
88
|
+
*/
|
|
89
|
+
BASE: 0,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* min-width: 480px
|
|
93
|
+
*/
|
|
94
|
+
SMALL: 480,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* min-width: 768px
|
|
98
|
+
*/
|
|
99
|
+
MEDIUM: 768,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* min-width: 1024px
|
|
103
|
+
*/
|
|
104
|
+
LARGE: 1024,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* min-width: 1280px
|
|
108
|
+
*/
|
|
109
|
+
WIDE: 1280
|
|
110
|
+
};
|
|
111
|
+
const KittBreakpointsMax = {
|
|
112
|
+
/**
|
|
113
|
+
* max-width: 479px
|
|
114
|
+
*/
|
|
115
|
+
BASE: KittBreakpoints.SMALL - 1,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* max-width: 767px
|
|
119
|
+
*/
|
|
120
|
+
SMALL: KittBreakpoints.MEDIUM - 1,
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* max-width: 1023px
|
|
124
|
+
*/
|
|
125
|
+
MEDIUM: KittBreakpoints.LARGE - 1,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* max-width: 1279px
|
|
129
|
+
*/
|
|
130
|
+
LARGE: KittBreakpoints.WIDE - 1
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const IsHeaderTypographyContext = /*#__PURE__*/react$1.createContext(undefined);
|
|
134
|
+
const TypographyColorContext = /*#__PURE__*/react$1.createContext('black');
|
|
135
|
+
function useTypographyColor() {
|
|
136
|
+
return react$1.useContext(TypographyColorContext);
|
|
137
|
+
}
|
|
138
|
+
const getTypographyTypeConfigKey = theme => {
|
|
139
|
+
const isMediumOrAbove = theme.responsive.matchWindowSize({
|
|
140
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
141
|
+
});
|
|
142
|
+
return isMediumOrAbove ? 'mediumAndWide' : 'baseAndSmall';
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const isTypeHeader = type => type.startsWith('header');
|
|
146
|
+
|
|
147
|
+
const isTypographyHeader = (type, typographyIsHeaderInContext) => {
|
|
148
|
+
if (type) return isTypeHeader(type);
|
|
149
|
+
if (typographyIsHeaderInContext != null) return typographyIsHeaderInContext;
|
|
150
|
+
throw new Error('You must set a "base" prop or wrap this Typography in one that does.');
|
|
151
|
+
};
|
|
152
|
+
function getTypographyTypeConfig(type, theme) {
|
|
153
|
+
if (isTypographyHeader(type, undefined)) {
|
|
154
|
+
return theme.kitt.typography.types.headers.configs[type];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return theme.kitt.typography.types.bodies.configs[type];
|
|
158
|
+
}
|
|
159
|
+
const StyledTypography = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Text).withConfig({
|
|
160
|
+
displayName: "Typography__StyledTypography",
|
|
161
|
+
componentId: "kitt-universal__sc-1dz700q-0"
|
|
162
|
+
})(["", " ", ""], ({
|
|
163
|
+
theme,
|
|
164
|
+
$isHeader,
|
|
165
|
+
$typeForCurrentWindowSize,
|
|
166
|
+
$variant
|
|
167
|
+
}) => {
|
|
168
|
+
const {
|
|
169
|
+
headers,
|
|
170
|
+
bodies
|
|
171
|
+
} = theme.kitt.typography.types;
|
|
172
|
+
const typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
173
|
+
return `
|
|
174
|
+
/* type */
|
|
175
|
+
${!$typeForCurrentWindowSize ? '' : `
|
|
176
|
+
font-family: ${$isHeader ? headers.fontFamily[$variant] : bodies.fontFamily[$variant]};
|
|
177
|
+
font-size: ${$isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].fontSize};
|
|
178
|
+
line-height: ${$isHeader ? headers.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight : bodies.configs[$typeForCurrentWindowSize][typeConfigKey].lineHeight};
|
|
179
|
+
`}
|
|
180
|
+
|
|
181
|
+
/* variant */
|
|
182
|
+
font-weight: ${$isHeader ? headers.fontWeight : bodies.fontWeight[$variant]};
|
|
183
|
+
font-style: ${$isHeader ? headers.fontStyle : bodies.fontStyle[$variant]};
|
|
184
|
+
`;
|
|
185
|
+
}, ({
|
|
186
|
+
theme,
|
|
187
|
+
$color
|
|
188
|
+
}) => !$color ? '' : `
|
|
189
|
+
color: ${theme.kitt.typography.colors[$color]};
|
|
190
|
+
text-decoration-color: ${theme.kitt.typography.colors[$color]};
|
|
191
|
+
`);
|
|
192
|
+
function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
|
|
193
|
+
const {
|
|
194
|
+
width
|
|
195
|
+
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
196
|
+
if (large && width >= KittBreakpoints.LARGE) return large;
|
|
197
|
+
if (medium && width >= KittBreakpoints.MEDIUM) return medium;
|
|
198
|
+
if (small && width >= KittBreakpoints.SMALL) return small;
|
|
199
|
+
return base;
|
|
200
|
+
}
|
|
201
|
+
function Typography({
|
|
202
|
+
accessibilityRole,
|
|
203
|
+
base,
|
|
204
|
+
small,
|
|
205
|
+
medium,
|
|
206
|
+
large,
|
|
207
|
+
variant,
|
|
208
|
+
color,
|
|
209
|
+
...otherProps
|
|
210
|
+
}) {
|
|
211
|
+
const isHeaderTypographyInContext = react$1.useContext(IsHeaderTypographyContext);
|
|
212
|
+
const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(base, small, medium, large);
|
|
213
|
+
const isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
|
|
214
|
+
const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular'); // if isHeaderTypographyInContext exists, it means we are inside another typography so we don't want to
|
|
215
|
+
// redefine the color, just inherit from it
|
|
216
|
+
|
|
217
|
+
const colorWithDefaultToBlack = color ?? (isHeaderTypographyInContext !== undefined ? undefined : 'black');
|
|
218
|
+
const content = base ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
|
|
219
|
+
value: isHeader,
|
|
220
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
|
|
221
|
+
$color: colorWithDefaultToBlack,
|
|
222
|
+
$isHeader: isHeader,
|
|
223
|
+
$typeForCurrentWindowSize: typeForCurrentWindowSize,
|
|
224
|
+
$variant: nonNullableVariant,
|
|
225
|
+
accessibilityRole: accessibilityRole || undefined,
|
|
226
|
+
...otherProps
|
|
227
|
+
})
|
|
228
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
|
|
229
|
+
$color: colorWithDefaultToBlack,
|
|
230
|
+
$isHeader: isHeader,
|
|
231
|
+
$variant: nonNullableVariant,
|
|
232
|
+
accessibilityRole: accessibilityRole || undefined,
|
|
233
|
+
...otherProps
|
|
234
|
+
});
|
|
235
|
+
return color ? /*#__PURE__*/jsxRuntime.jsx(TypographyColorContext.Provider, {
|
|
236
|
+
value: color,
|
|
237
|
+
children: content
|
|
238
|
+
}) : content;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function TypographyText(props) {
|
|
242
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
243
|
+
accessibilityRole: null,
|
|
244
|
+
...props
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function TypographyParagraph(props) {
|
|
249
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
250
|
+
accessibilityRole: "paragraph",
|
|
251
|
+
...props
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const createHeading = (level, defaultBase) => {
|
|
256
|
+
// https://github.com/necolas/react-native-web/issues/401
|
|
257
|
+
function TypographyHeading(props) {
|
|
258
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
259
|
+
accessibilityRole: "header",
|
|
260
|
+
base: defaultBase,
|
|
261
|
+
...props,
|
|
262
|
+
accessibilityLevel: level
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
TypographyHeading.displayName = `TypographyHeading${level}`;
|
|
267
|
+
return TypographyHeading;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
Typography.Text = TypographyText;
|
|
271
|
+
Typography.Paragraph = TypographyParagraph;
|
|
272
|
+
Typography.Header1 = createHeading(1);
|
|
273
|
+
Typography.Header2 = createHeading(2);
|
|
274
|
+
Typography.Header3 = createHeading(3);
|
|
275
|
+
Typography.Header4 = createHeading(4);
|
|
276
|
+
Typography.Header5 = createHeading(5);
|
|
277
|
+
Typography.Header6 = createHeading(6);
|
|
278
|
+
/** @deprecated use Typography.Header1 */
|
|
279
|
+
|
|
280
|
+
Typography.h1 = createHeading(1, 'header1');
|
|
281
|
+
/** @deprecated use Typography.Header2 */
|
|
282
|
+
|
|
283
|
+
Typography.h2 = createHeading(2, 'header2');
|
|
284
|
+
/** @deprecated use Typography.Header3 */
|
|
285
|
+
|
|
286
|
+
Typography.h3 = createHeading(3, 'header3');
|
|
287
|
+
/** @deprecated use Typography.Header4 */
|
|
288
|
+
|
|
289
|
+
Typography.h4 = createHeading(4, 'header4');
|
|
290
|
+
/** @deprecated use Typography.Header6 */
|
|
291
|
+
|
|
292
|
+
Typography.h5 = createHeading(5, 'header5');
|
|
293
|
+
|
|
294
|
+
const getFirstCharacter = string => string ? string[0] : '';
|
|
295
|
+
|
|
296
|
+
const getInitials = (firstname, lastname) => (getFirstCharacter(firstname) + getFirstCharacter(lastname)).toUpperCase();
|
|
297
|
+
|
|
298
|
+
const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
299
|
+
displayName: "Avatar__StyledAvatarView",
|
|
300
|
+
componentId: "kitt-universal__sc-9miubv-0"
|
|
301
|
+
})(["border-radius:", "px;background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
|
|
302
|
+
round,
|
|
303
|
+
size
|
|
304
|
+
}) => round ? size / 2 : 10, ({
|
|
305
|
+
theme,
|
|
306
|
+
light
|
|
307
|
+
}) => light ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
|
|
308
|
+
size
|
|
309
|
+
}) => size, ({
|
|
310
|
+
size
|
|
311
|
+
}) => size);
|
|
312
|
+
|
|
313
|
+
function AvatarContent({
|
|
314
|
+
size = 40,
|
|
315
|
+
src,
|
|
316
|
+
firstname,
|
|
317
|
+
lastname,
|
|
318
|
+
light
|
|
319
|
+
}) {
|
|
320
|
+
if (src) {
|
|
321
|
+
return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
|
|
322
|
+
source: {
|
|
323
|
+
uri: src
|
|
324
|
+
},
|
|
325
|
+
style: {
|
|
326
|
+
width: size,
|
|
327
|
+
height: size
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (firstname && lastname) {
|
|
333
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
334
|
+
base: "body-small",
|
|
335
|
+
variant: "bold",
|
|
336
|
+
color: light ? 'black' : 'white',
|
|
337
|
+
children: getInitials(firstname, lastname)
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
342
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
|
|
343
|
+
color: light ? 'black' : 'white',
|
|
344
|
+
size: size / 2
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function Avatar({
|
|
349
|
+
size = 40,
|
|
350
|
+
...rest
|
|
351
|
+
}) {
|
|
352
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, { ...rest,
|
|
353
|
+
size: size,
|
|
354
|
+
children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, { ...rest,
|
|
355
|
+
size: size
|
|
356
|
+
})
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function TypographyIconInheritColor(props) {
|
|
361
|
+
const color = useTypographyColor();
|
|
362
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
363
|
+
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...props,
|
|
364
|
+
color: theme.kitt.typography.colors[color]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function TypographyIconSpecifiedColor({
|
|
369
|
+
color,
|
|
370
|
+
...otherProps
|
|
371
|
+
}) {
|
|
372
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
373
|
+
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...otherProps,
|
|
374
|
+
color: theme.kitt.typography.colors[color]
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function TypographyIcon({
|
|
379
|
+
color,
|
|
380
|
+
...otherProps
|
|
381
|
+
}) {
|
|
382
|
+
if (color) {
|
|
383
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
|
|
384
|
+
color: color,
|
|
385
|
+
...otherProps
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...otherProps
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const getTextColorByType = (type, isPressed, disabled) => {
|
|
394
|
+
if (disabled) return 'black-light';
|
|
395
|
+
|
|
396
|
+
switch (type) {
|
|
397
|
+
case 'primary':
|
|
398
|
+
return 'white';
|
|
399
|
+
|
|
400
|
+
case 'subtle':
|
|
401
|
+
return isPressed ? 'primary-light' : 'primary';
|
|
402
|
+
|
|
403
|
+
case 'subtle-dark':
|
|
404
|
+
return isPressed ? 'black-light' : 'black';
|
|
405
|
+
|
|
406
|
+
case 'secondary':
|
|
407
|
+
default:
|
|
408
|
+
return 'black';
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const ButtonText = /*#__PURE__*/styled__default(Typography.Text).withConfig({
|
|
413
|
+
displayName: "ButtonContent__ButtonText",
|
|
414
|
+
componentId: "kitt-universal__sc-dnyw3n-0"
|
|
415
|
+
})(["text-align:center;"]);
|
|
416
|
+
const Content$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
417
|
+
displayName: "ButtonContent__Content",
|
|
418
|
+
componentId: "kitt-universal__sc-dnyw3n-1"
|
|
419
|
+
})(["flex-direction:row;align-items:center;justify-content:center;flex:", ";"], ({
|
|
420
|
+
stretch,
|
|
421
|
+
iconOnly
|
|
422
|
+
}) => `${stretch || iconOnly ? 1 : 0} 1 auto`);
|
|
423
|
+
const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
424
|
+
displayName: "ButtonContent__IconContainer",
|
|
425
|
+
componentId: "kitt-universal__sc-dnyw3n-2"
|
|
426
|
+
})(["", ""], ({
|
|
427
|
+
theme,
|
|
428
|
+
iconPosition
|
|
429
|
+
}) => {
|
|
430
|
+
const value = theme.kitt.spacing * 3;
|
|
431
|
+
|
|
432
|
+
if (iconPosition === 'left') {
|
|
433
|
+
return `margin: 0 ${value}px 0 0;`;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return `margin: 0 0 0 ${value}px;`;
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
function ButtonIcon({
|
|
440
|
+
icon,
|
|
441
|
+
spin,
|
|
442
|
+
color,
|
|
443
|
+
size,
|
|
444
|
+
iconPosition,
|
|
445
|
+
testID
|
|
446
|
+
}) {
|
|
447
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
|
|
448
|
+
iconPosition: iconPosition,
|
|
449
|
+
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
450
|
+
icon: icon,
|
|
451
|
+
spin: spin,
|
|
452
|
+
color: color,
|
|
453
|
+
size: size,
|
|
454
|
+
testID: testID
|
|
455
|
+
})
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function ButtonContent({
|
|
460
|
+
type,
|
|
461
|
+
isPressed,
|
|
462
|
+
stretch,
|
|
463
|
+
icon,
|
|
464
|
+
iconPosition,
|
|
465
|
+
iconSpin,
|
|
466
|
+
disabled,
|
|
467
|
+
children
|
|
468
|
+
}) {
|
|
469
|
+
const color = getTextColorByType(type, Boolean(isPressed), Boolean(disabled));
|
|
470
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
471
|
+
const sharedIconProps = {
|
|
472
|
+
spin: iconSpin,
|
|
473
|
+
color,
|
|
474
|
+
size: theme.kitt.button.iconSize
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
478
|
+
if (!(children || icon)) {
|
|
479
|
+
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (!children) {
|
|
484
|
+
return /*#__PURE__*/jsxRuntime.jsx(Content$1, {
|
|
485
|
+
iconOnly: true,
|
|
486
|
+
stretch: stretch,
|
|
487
|
+
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, { ...sharedIconProps,
|
|
488
|
+
icon: icon
|
|
489
|
+
})
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Content$1, {
|
|
494
|
+
stretch: stretch,
|
|
495
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...sharedIconProps,
|
|
496
|
+
icon: icon,
|
|
497
|
+
iconPosition: iconPosition,
|
|
498
|
+
testID: "button-left-icon"
|
|
499
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(ButtonText, {
|
|
500
|
+
base: "body",
|
|
501
|
+
color: color,
|
|
502
|
+
variant: "bold",
|
|
503
|
+
children: children
|
|
504
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...sharedIconProps,
|
|
505
|
+
icon: icon,
|
|
506
|
+
iconPosition: iconPosition
|
|
507
|
+
}) : null]
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const ButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
512
|
+
displayName: "ButtonPressable",
|
|
513
|
+
componentId: "kitt-universal__sc-7ckel6-0"
|
|
514
|
+
})(["min-width:", ";max-width:", ";width:", ";min-height:", ";background-color:", ";padding:", ";flex-direction:row;align-self:flex-start;border-radius:", ";border-color:", ";border-width:", ";"], ({
|
|
515
|
+
theme
|
|
516
|
+
}) => theme.kitt.button.minWidth, ({
|
|
517
|
+
theme,
|
|
518
|
+
stretch
|
|
519
|
+
}) => stretch ? 'auto' : theme.kitt.button.maxWidth, ({
|
|
520
|
+
stretch
|
|
521
|
+
}) => stretch ? '100%' : 'auto', ({
|
|
522
|
+
theme
|
|
523
|
+
}) => theme.kitt.button.minHeight, ({
|
|
524
|
+
theme,
|
|
525
|
+
isPressed,
|
|
526
|
+
disabled,
|
|
527
|
+
type
|
|
528
|
+
}) => {
|
|
529
|
+
if (disabled) {
|
|
530
|
+
return theme.kitt.button[type].disabledBackgroundColor;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
|
|
534
|
+
}, ({
|
|
535
|
+
theme
|
|
536
|
+
}) => theme.kitt.button.contentPadding.default, ({
|
|
537
|
+
theme
|
|
538
|
+
}) => theme.kitt.button.borderRadius, ({
|
|
539
|
+
theme,
|
|
540
|
+
disabled,
|
|
541
|
+
type
|
|
542
|
+
}) => disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent', ({
|
|
543
|
+
theme
|
|
544
|
+
}) => theme.kitt.button.borderWidth);
|
|
545
|
+
|
|
546
|
+
function Button({
|
|
547
|
+
children,
|
|
548
|
+
type = 'secondary',
|
|
549
|
+
icon,
|
|
550
|
+
iconPosition = 'left',
|
|
551
|
+
iconSpin,
|
|
552
|
+
stretch,
|
|
553
|
+
disabled,
|
|
554
|
+
testID,
|
|
555
|
+
href,
|
|
556
|
+
hrefAttrs,
|
|
557
|
+
onPress
|
|
558
|
+
}) {
|
|
559
|
+
const [isPressed, setIsPressed] = react$1.useState(false);
|
|
560
|
+
const sharedProps = {
|
|
561
|
+
type,
|
|
562
|
+
stretch,
|
|
563
|
+
disabled
|
|
564
|
+
};
|
|
565
|
+
return /*#__PURE__*/jsxRuntime.jsx(ButtonPressable // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
566
|
+
// TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
|
|
567
|
+
// underlayColor={globalTheme.button[type].pressedBackgroundColor}
|
|
568
|
+
, { ...sharedProps,
|
|
569
|
+
isPressed: isPressed,
|
|
570
|
+
accessibilityRole: "button",
|
|
571
|
+
testID: testID,
|
|
572
|
+
href: href,
|
|
573
|
+
hrefAttrs: hrefAttrs,
|
|
574
|
+
onPress: onPress,
|
|
575
|
+
onPressIn: () => setIsPressed(true),
|
|
576
|
+
onPressOut: () => setIsPressed(false),
|
|
577
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ButtonContent, { ...sharedProps,
|
|
578
|
+
icon: icon,
|
|
579
|
+
iconPosition: iconPosition,
|
|
580
|
+
iconSpin: iconSpin,
|
|
581
|
+
children: children
|
|
582
|
+
})
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const Container$5 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
587
|
+
displayName: "Card__Container",
|
|
588
|
+
componentId: "kitt-universal__sc-1n9psug-0"
|
|
589
|
+
})(["background-color:", ";padding:", ";border-radius:", ";border-width:", ";border-color:", ";"], ({
|
|
590
|
+
theme,
|
|
591
|
+
type
|
|
592
|
+
}) => theme.kitt.card[type].backgroundColor, ({
|
|
593
|
+
theme
|
|
594
|
+
}) => theme.kitt.card.padding, ({
|
|
595
|
+
theme
|
|
596
|
+
}) => theme.kitt.card.borderRadius, ({
|
|
597
|
+
theme
|
|
598
|
+
}) => theme.kitt.card.borderWidth, ({
|
|
599
|
+
theme,
|
|
600
|
+
type
|
|
601
|
+
}) => theme.kitt.card[type].borderColor);
|
|
602
|
+
function Card({
|
|
603
|
+
children,
|
|
604
|
+
type
|
|
605
|
+
}) {
|
|
606
|
+
return /*#__PURE__*/jsxRuntime.jsx(Container$5, {
|
|
607
|
+
type: type,
|
|
608
|
+
children: children
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const StyledEmoji = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Image).withConfig({
|
|
613
|
+
displayName: "Emoji__StyledEmoji",
|
|
614
|
+
componentId: "kitt-universal__sc-ggl6wj-0"
|
|
615
|
+
})(["width:", "px;height:", "px;"], ({
|
|
616
|
+
size
|
|
617
|
+
}) => size, ({
|
|
618
|
+
size
|
|
619
|
+
}) => size);
|
|
620
|
+
function Emoji({
|
|
621
|
+
emoji,
|
|
622
|
+
size,
|
|
623
|
+
style
|
|
624
|
+
}) {
|
|
625
|
+
const [emojiData] = react$1.useMemo(() => twemojiParser.parse(emoji, {
|
|
626
|
+
// on native plaforms, you can't display svg as Image
|
|
627
|
+
assetType: 'svg'
|
|
628
|
+
}), [emoji]);
|
|
629
|
+
if (!emojiData) return null;
|
|
630
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledEmoji, {
|
|
631
|
+
size: size,
|
|
632
|
+
accessibilityLabel: emojiData.text,
|
|
633
|
+
source: {
|
|
634
|
+
uri: emojiData.url
|
|
635
|
+
},
|
|
636
|
+
style: style
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
const defaultOpenLinkBehavior = {
|
|
641
|
+
native: 'openInModal',
|
|
642
|
+
web: 'targetBlank'
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
function ExternalLink({
|
|
646
|
+
as: Component,
|
|
647
|
+
href,
|
|
648
|
+
openLinkBehavior = defaultOpenLinkBehavior,
|
|
649
|
+
onPress,
|
|
650
|
+
...rest
|
|
651
|
+
}) {
|
|
652
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, { ...rest,
|
|
653
|
+
href: href,
|
|
654
|
+
hrefAttrs: openLinkBehavior?.web === 'targetSelf' ? undefined : {
|
|
655
|
+
target: '_blank',
|
|
656
|
+
rel: 'noopener noreferrer'
|
|
657
|
+
},
|
|
658
|
+
onPress: onPress
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const getColorFromState = state => {
|
|
663
|
+
switch (state) {
|
|
664
|
+
case 'invalid':
|
|
665
|
+
return 'danger';
|
|
666
|
+
|
|
667
|
+
default:
|
|
668
|
+
return 'black-light';
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
function InputFeedback({
|
|
673
|
+
state,
|
|
674
|
+
testID,
|
|
675
|
+
children
|
|
676
|
+
}) {
|
|
677
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
678
|
+
base: "body-small",
|
|
679
|
+
color: getColorFromState(state),
|
|
680
|
+
testID: testID,
|
|
681
|
+
children: children
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const FieldContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
686
|
+
displayName: "InputField__FieldContainer",
|
|
687
|
+
componentId: "kitt-universal__sc-13fkixs-0"
|
|
688
|
+
})(["padding:5px 0 10px;"]);
|
|
689
|
+
const FeedbackContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
690
|
+
displayName: "InputField__FeedbackContainer",
|
|
691
|
+
componentId: "kitt-universal__sc-13fkixs-1"
|
|
692
|
+
})(["", ";"], ({
|
|
693
|
+
theme
|
|
694
|
+
}) => theme.responsive.ifWindowSizeMatches({
|
|
695
|
+
minWidth: KittBreakpoints.SMALL
|
|
696
|
+
}, 'padding-top: 10px', 'padding-top: 5px'));
|
|
697
|
+
const FieldLabelContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
698
|
+
displayName: "InputField__FieldLabelContainer",
|
|
699
|
+
componentId: "kitt-universal__sc-13fkixs-2"
|
|
700
|
+
})(["flex-direction:row;align-items:center;padding-bottom:", "px;"], ({
|
|
701
|
+
theme
|
|
702
|
+
}) => theme.kitt.forms.inputField.labelContainerPaddingBottom);
|
|
703
|
+
const LabelContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
704
|
+
displayName: "InputField__LabelContainer",
|
|
705
|
+
componentId: "kitt-universal__sc-13fkixs-3"
|
|
706
|
+
})(["margin-right:", "px;"], ({
|
|
707
|
+
theme
|
|
708
|
+
}) => theme.kitt.forms.inputField.iconMarginLeft);
|
|
709
|
+
function InputField({
|
|
710
|
+
label,
|
|
711
|
+
labelFeedback,
|
|
712
|
+
input,
|
|
713
|
+
feedback
|
|
714
|
+
}) {
|
|
715
|
+
return /*#__PURE__*/jsxRuntime.jsxs(FieldContainer, {
|
|
716
|
+
children: [label ? /*#__PURE__*/jsxRuntime.jsxs(FieldLabelContainer, {
|
|
717
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(LabelContainer, {
|
|
718
|
+
children: label
|
|
719
|
+
}), labelFeedback]
|
|
720
|
+
}) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(FeedbackContainer, {
|
|
721
|
+
children: feedback
|
|
722
|
+
}) : null]
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const useInputText = () => {
|
|
727
|
+
const [isFocused, setIsFocused] = react$1.useState(false);
|
|
728
|
+
const [isPasswordVisible, setIsPasswordVisible] = react$1.useState(false);
|
|
729
|
+
return {
|
|
730
|
+
isFocused,
|
|
731
|
+
handleInputFocus: () => setIsFocused(true),
|
|
732
|
+
handleInputBlur: () => setIsFocused(false),
|
|
733
|
+
togglePasswordVisibility: () => setIsPasswordVisible(isVisible => !isVisible),
|
|
734
|
+
isPasswordVisible
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
const styledTextInputMixin = /*#__PURE__*/styled.css(["background-color:", ";border-width:", ";border-radius:", ";border-color:", ";font-size:", ";color:", ";font-family:", ";"], ({
|
|
739
|
+
theme,
|
|
740
|
+
state
|
|
741
|
+
}) => state === 'disabled' ? theme.kitt.forms.input.states.disabled.backgroundColor : theme.kitt.forms.input.states.default.backgroundColor, ({
|
|
742
|
+
theme
|
|
743
|
+
}) => theme.kitt.forms.input.borderWidth, ({
|
|
744
|
+
theme
|
|
745
|
+
}) => theme.kitt.forms.input.borderRadius, ({
|
|
746
|
+
theme,
|
|
747
|
+
state
|
|
748
|
+
}) => theme.kitt.forms.input.states[state].borderColor, ({
|
|
749
|
+
theme
|
|
750
|
+
}) => {
|
|
751
|
+
const typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
752
|
+
return theme.kitt.typography.types.bodies.configs.body[typeConfigKey].fontSize;
|
|
753
|
+
}, ({
|
|
754
|
+
theme,
|
|
755
|
+
state
|
|
756
|
+
}) => theme.kitt.typography.colors[theme.kitt.forms.input.states[state].color], ({
|
|
757
|
+
theme
|
|
758
|
+
}) => theme.kitt.typography.types.bodies.fontFamily.regular);
|
|
759
|
+
const Input = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.TextInput).withConfig({
|
|
760
|
+
displayName: "InputText__Input",
|
|
761
|
+
componentId: "kitt-universal__sc-uke279-0"
|
|
762
|
+
})(["", " padding:", ";line-height:", ";min-height:", "px;"], styledTextInputMixin, ({
|
|
763
|
+
theme,
|
|
764
|
+
multiline
|
|
765
|
+
}) => !multiline && "web" === 'ios' ? theme.kitt.forms.input.paddingSingleLineIOS : theme.kitt.forms.input.padding, ({
|
|
766
|
+
theme,
|
|
767
|
+
multiline
|
|
768
|
+
}) => {
|
|
769
|
+
if (!multiline && "web" === 'ios') return 0;
|
|
770
|
+
const typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
771
|
+
return theme.kitt.typography.types.bodies.configs.body[typeConfigKey].lineHeight;
|
|
772
|
+
}, ({
|
|
773
|
+
minHeight
|
|
774
|
+
}) => minHeight);
|
|
775
|
+
const Container$4 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
776
|
+
displayName: "InputText__Container",
|
|
777
|
+
componentId: "kitt-universal__sc-uke279-1"
|
|
778
|
+
})(["margin-top:", ";margin-bottom:", ";"], ({
|
|
779
|
+
theme
|
|
780
|
+
}) => theme.kitt.forms.input.marginTop, ({
|
|
781
|
+
theme
|
|
782
|
+
}) => theme.kitt.forms.input.marginBottom);
|
|
783
|
+
const PasswordButtonContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
784
|
+
displayName: "InputText__PasswordButtonContainer",
|
|
785
|
+
componentId: "kitt-universal__sc-uke279-2"
|
|
786
|
+
})(["position:absolute;right:0;top:0;bottom:0;justify-content:center;padding:", "px;"], ({
|
|
787
|
+
theme
|
|
788
|
+
}) => theme.kitt.forms.input.passwordButtonIconSize / 2);
|
|
789
|
+
|
|
790
|
+
const getInputState = ({
|
|
791
|
+
isDisabled,
|
|
792
|
+
isFocused,
|
|
793
|
+
formState
|
|
794
|
+
}) => {
|
|
795
|
+
if (isDisabled) return 'disabled';
|
|
796
|
+
if (isFocused) return 'focus';
|
|
797
|
+
if (formState === 'invalid') return 'invalid';
|
|
798
|
+
return 'default';
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
const keyboardTypeByTextInputType = {
|
|
802
|
+
text: 'default',
|
|
803
|
+
email: 'email-address',
|
|
804
|
+
password: 'default',
|
|
805
|
+
username: 'default'
|
|
806
|
+
};
|
|
807
|
+
const autoCompleteTypeByType = {
|
|
808
|
+
text: 'off',
|
|
809
|
+
email: 'email',
|
|
810
|
+
password: 'password',
|
|
811
|
+
username: 'name'
|
|
812
|
+
};
|
|
813
|
+
const autoCorrectByType = {
|
|
814
|
+
text: true,
|
|
815
|
+
email: false,
|
|
816
|
+
password: false,
|
|
817
|
+
username: false
|
|
818
|
+
};
|
|
819
|
+
const textContentTypeByType = {
|
|
820
|
+
text: 'none',
|
|
821
|
+
email: 'emailAddress',
|
|
822
|
+
password: 'password',
|
|
823
|
+
username: 'username'
|
|
824
|
+
};
|
|
825
|
+
const InputText = /*#__PURE__*/react$1.forwardRef(({
|
|
826
|
+
id,
|
|
827
|
+
minHeight = 0,
|
|
828
|
+
type,
|
|
829
|
+
state: formState,
|
|
830
|
+
internalForceState,
|
|
831
|
+
disabled = false,
|
|
832
|
+
onFocus,
|
|
833
|
+
onBlur,
|
|
834
|
+
...props
|
|
835
|
+
}, ref) => {
|
|
836
|
+
const {
|
|
837
|
+
isFocused,
|
|
838
|
+
handleInputBlur,
|
|
839
|
+
handleInputFocus,
|
|
840
|
+
isPasswordVisible,
|
|
841
|
+
togglePasswordVisibility
|
|
842
|
+
} = useInputText();
|
|
843
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
844
|
+
const state = internalForceState || getInputState({
|
|
845
|
+
isFocused,
|
|
846
|
+
isDisabled: disabled,
|
|
847
|
+
formState
|
|
848
|
+
});
|
|
849
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Container$4, {
|
|
850
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
851
|
+
ref: ref,
|
|
852
|
+
nativeID: id,
|
|
853
|
+
editable: !disabled,
|
|
854
|
+
keyboardType: keyboardTypeByTextInputType[type],
|
|
855
|
+
autoCompleteType: autoCompleteTypeByType[type],
|
|
856
|
+
autoCorrect: autoCorrectByType[type],
|
|
857
|
+
minHeight: minHeight,
|
|
858
|
+
textContentType: textContentTypeByType[type],
|
|
859
|
+
placeholderTextColor: theme.kitt.typography.colors[theme.kitt.forms.input.placeholderColor],
|
|
860
|
+
selectionColor: theme.kitt.forms.input.selectionColor,
|
|
861
|
+
secureTextEntry: type === 'password' && !isPasswordVisible,
|
|
862
|
+
...props,
|
|
863
|
+
state: state,
|
|
864
|
+
onFocus: e => {
|
|
865
|
+
handleInputFocus();
|
|
866
|
+
if (onFocus) onFocus(e);
|
|
867
|
+
},
|
|
868
|
+
onBlur: e => {
|
|
869
|
+
handleInputBlur();
|
|
870
|
+
if (onBlur) onBlur(e);
|
|
871
|
+
}
|
|
872
|
+
}), type === 'password' && !disabled && /*#__PURE__*/jsxRuntime.jsx(PasswordButtonContainer, {
|
|
873
|
+
accessibilityRole: "button",
|
|
874
|
+
onPress: togglePasswordVisibility,
|
|
875
|
+
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
876
|
+
icon: isPasswordVisible ? /*#__PURE__*/jsxRuntime.jsx(kittIcons.EyeIcon, {}) : /*#__PURE__*/jsxRuntime.jsx(kittIcons.EyeOffIcon, {}),
|
|
877
|
+
size: theme.kitt.forms.input.passwordButtonIconSize,
|
|
878
|
+
color: theme.kitt.forms.input.states[state].passwordButtonIconColor
|
|
879
|
+
})
|
|
880
|
+
})]
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
function Label({
|
|
885
|
+
htmlFor,
|
|
886
|
+
children
|
|
887
|
+
}) {
|
|
888
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
889
|
+
base: "body",
|
|
890
|
+
children: /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
891
|
+
htmlFor: htmlFor,
|
|
892
|
+
children: children
|
|
893
|
+
})
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const OuterRadio = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
898
|
+
displayName: "Radio__OuterRadio",
|
|
899
|
+
componentId: "kitt-universal__sc-1mdgr2o-0"
|
|
900
|
+
})(["background-color:", ";width:", "px;height:", "px;border-radius:", "px;border-width:", ";border-color:", ";"], ({
|
|
901
|
+
theme,
|
|
902
|
+
disabled
|
|
903
|
+
}) => theme.kitt.forms.radio[disabled ? 'disabled' : 'unchecked'].backgroundColor, ({
|
|
904
|
+
theme
|
|
905
|
+
}) => theme.kitt.forms.radio.size, ({
|
|
906
|
+
theme
|
|
907
|
+
}) => theme.kitt.forms.radio.size, ({
|
|
908
|
+
theme
|
|
909
|
+
}) => theme.kitt.forms.radio.size / 2, ({
|
|
910
|
+
theme
|
|
911
|
+
}) => theme.kitt.forms.radio.unchecked.borderWidth, ({
|
|
912
|
+
theme,
|
|
913
|
+
disabled
|
|
914
|
+
}) => theme.kitt.forms.radio[disabled ? 'disabled' : 'unchecked'].borderColor);
|
|
915
|
+
const SelectedOuterRadio = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
916
|
+
displayName: "Radio__SelectedOuterRadio",
|
|
917
|
+
componentId: "kitt-universal__sc-1mdgr2o-1"
|
|
918
|
+
})(["background-color:", ";width:", "px;height:", "px;border-radius:", "px;justify-content:center;align-items:center;"], ({
|
|
919
|
+
theme
|
|
920
|
+
}) => theme.kitt.forms.radio.checked.backgroundColor, ({
|
|
921
|
+
theme
|
|
922
|
+
}) => theme.kitt.forms.radio.size, ({
|
|
923
|
+
theme
|
|
924
|
+
}) => theme.kitt.forms.radio.size, ({
|
|
925
|
+
theme
|
|
926
|
+
}) => theme.kitt.forms.radio.size / 2);
|
|
927
|
+
const SelectedInnerRadio = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
928
|
+
displayName: "Radio__SelectedInnerRadio",
|
|
929
|
+
componentId: "kitt-universal__sc-1mdgr2o-2"
|
|
930
|
+
})(["background-color:", ";width:", "px;height:", "px;border-radius:", "px;"], ({
|
|
931
|
+
theme
|
|
932
|
+
}) => theme.kitt.forms.radio.checked.innerBackgroundColor, ({
|
|
933
|
+
theme
|
|
934
|
+
}) => theme.kitt.forms.radio.checked.innerSize, ({
|
|
935
|
+
theme
|
|
936
|
+
}) => theme.kitt.forms.radio.checked.innerSize, ({
|
|
937
|
+
theme
|
|
938
|
+
}) => theme.kitt.forms.radio.checked.innerSize / 2);
|
|
939
|
+
const Container$3 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
940
|
+
displayName: "Radio__Container",
|
|
941
|
+
componentId: "kitt-universal__sc-1mdgr2o-3"
|
|
942
|
+
})(["flex-direction:row;align-items:center;"]);
|
|
943
|
+
const Text = /*#__PURE__*/styled__default(Typography.Text).withConfig({
|
|
944
|
+
displayName: "Radio__Text",
|
|
945
|
+
componentId: "kitt-universal__sc-1mdgr2o-4"
|
|
946
|
+
})(["margin-left:", "px;"], ({
|
|
947
|
+
theme
|
|
948
|
+
}) => theme.kitt.spacing * 2);
|
|
949
|
+
function Radio({
|
|
950
|
+
id,
|
|
951
|
+
checked,
|
|
952
|
+
onChange,
|
|
953
|
+
value,
|
|
954
|
+
disabled = false,
|
|
955
|
+
children
|
|
956
|
+
}) {
|
|
957
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Container$3, {
|
|
958
|
+
nativeID: id,
|
|
959
|
+
disabled: disabled,
|
|
960
|
+
accessibilityRole: "radio",
|
|
961
|
+
"aria-checked": checked,
|
|
962
|
+
focusable: checked && !disabled,
|
|
963
|
+
onPress: () => {
|
|
964
|
+
onChange(value);
|
|
965
|
+
},
|
|
966
|
+
children: [checked && !disabled ? /*#__PURE__*/jsxRuntime.jsx(SelectedOuterRadio, {
|
|
967
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SelectedInnerRadio, {})
|
|
968
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(OuterRadio, {
|
|
969
|
+
disabled: disabled
|
|
970
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Text, {
|
|
971
|
+
base: "body",
|
|
972
|
+
color: disabled ? 'black-light' : 'black',
|
|
973
|
+
children: children
|
|
974
|
+
})]
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
function TextArea({ ...props
|
|
979
|
+
}) {
|
|
980
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
981
|
+
return /*#__PURE__*/jsxRuntime.jsx(InputText, {
|
|
982
|
+
multiline: true,
|
|
983
|
+
...props,
|
|
984
|
+
type: "text",
|
|
985
|
+
minHeight: theme.kitt.forms.input.textAreaMinHeight
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const Body = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
990
|
+
displayName: "Body",
|
|
991
|
+
componentId: "kitt-universal__sc-1ofncfn-0"
|
|
992
|
+
})(["", " background-color:", ";flex:1;"], ({
|
|
993
|
+
theme
|
|
994
|
+
}) => theme.responsive.ifWindowSizeMatches({
|
|
995
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
996
|
+
}, `padding-right: ${theme.kitt.spacing * 12}px;
|
|
997
|
+
padding-left: ${theme.kitt.spacing * 12}px;`, `padding-right: ${theme.kitt.spacing * 6}px;
|
|
998
|
+
padding-left: ${theme.kitt.spacing * 6}px;`), ({
|
|
999
|
+
theme
|
|
1000
|
+
}) => theme.kitt.colors.uiBackgroundLight);
|
|
1001
|
+
function FullScreenModalBody({
|
|
1002
|
+
children
|
|
1003
|
+
}) {
|
|
1004
|
+
return /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
1005
|
+
children: children
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
const SideContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1010
|
+
displayName: "Header__SideContainer",
|
|
1011
|
+
componentId: "kitt-universal__sc-dfmxi1-0"
|
|
1012
|
+
})(["", ""], ({
|
|
1013
|
+
theme,
|
|
1014
|
+
side = 'left'
|
|
1015
|
+
}) => {
|
|
1016
|
+
const padding = theme.kitt.spacing * 2;
|
|
1017
|
+
|
|
1018
|
+
if (side === 'left') {
|
|
1019
|
+
return `padding-right: ${padding}px;`;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return `padding-left: ${padding}px;`;
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1025
|
+
function getHeaderHorizontalMediumPadding(spacing) {
|
|
1026
|
+
return spacing * 6;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
const Header = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1030
|
+
displayName: "Header",
|
|
1031
|
+
componentId: "kitt-universal__sc-dfmxi1-1"
|
|
1032
|
+
})(["", ";border-bottom-color:", ";border-bottom-width:1px;flex-direction:row;align-items:center;"], ({
|
|
1033
|
+
theme,
|
|
1034
|
+
insetTop = 0
|
|
1035
|
+
}) => {
|
|
1036
|
+
const paddingTop = insetTop + theme.kitt.fullScreenModal.header.paddingVertical;
|
|
1037
|
+
const {
|
|
1038
|
+
paddingVertical,
|
|
1039
|
+
paddingHorizontal
|
|
1040
|
+
} = theme.kitt.fullScreenModal.header;
|
|
1041
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
1042
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
1043
|
+
}, `padding: ${paddingTop}px ${getHeaderHorizontalMediumPadding(theme.kitt.spacing)}px ${paddingVertical}px;`, `padding: ${paddingTop}px ${paddingHorizontal}px ${paddingVertical}px;`);
|
|
1044
|
+
}, ({
|
|
1045
|
+
theme
|
|
1046
|
+
}) => theme.kitt.fullScreenModal.header.borderColor);
|
|
1047
|
+
const HeaderContent = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1048
|
+
displayName: "Header__HeaderContent",
|
|
1049
|
+
componentId: "kitt-universal__sc-dfmxi1-2"
|
|
1050
|
+
})(["", ";", ";justify-content:center;align-items:center;"], ({
|
|
1051
|
+
theme,
|
|
1052
|
+
leftWidth,
|
|
1053
|
+
rightWidth,
|
|
1054
|
+
windowWidth
|
|
1055
|
+
}) => {
|
|
1056
|
+
/*
|
|
1057
|
+
* Since we don't have controll over the rendered left and right elements,
|
|
1058
|
+
* we must apply some logic to give the title all the available space
|
|
1059
|
+
*/
|
|
1060
|
+
const sideElementMaxWidth = Math.max(leftWidth, rightWidth);
|
|
1061
|
+
const parentHorizontalPadding = theme.kitt.fullScreenModal.header.paddingHorizontal * 2;
|
|
1062
|
+
const parentHorizontalPaddingMedium = getHeaderHorizontalMediumPadding(theme.kitt.spacing) * 2;
|
|
1063
|
+
|
|
1064
|
+
const computeWidth = breakpointPadding => windowWidth - breakpointPadding - sideElementMaxWidth * 2;
|
|
1065
|
+
|
|
1066
|
+
return theme.responsive.ifWindowSizeMatches({
|
|
1067
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
1068
|
+
}, `width: ${computeWidth(parentHorizontalPaddingMedium)}px;`, `width: ${computeWidth(parentHorizontalPadding)}px;`);
|
|
1069
|
+
}, ({
|
|
1070
|
+
leftWidth,
|
|
1071
|
+
rightWidth
|
|
1072
|
+
}) => {
|
|
1073
|
+
// Depending of the wider element, we must add a margin to fill the diff in space between elements
|
|
1074
|
+
const deltaMargin = Math.abs(leftWidth - rightWidth);
|
|
1075
|
+
|
|
1076
|
+
if (leftWidth > rightWidth) {
|
|
1077
|
+
return `margin-right: ${deltaMargin}px;`;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
return `margin-left: ${deltaMargin}px;`;
|
|
1081
|
+
});
|
|
1082
|
+
function FullScreenModalHeader({
|
|
1083
|
+
children,
|
|
1084
|
+
right,
|
|
1085
|
+
left
|
|
1086
|
+
}) {
|
|
1087
|
+
const {
|
|
1088
|
+
top
|
|
1089
|
+
} = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
1090
|
+
const dimensions = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
1091
|
+
const [leftWidth, setLeftWidth] = react$1.useState(0);
|
|
1092
|
+
const [rightWidth, setRightWidth] = react$1.useState(0);
|
|
1093
|
+
|
|
1094
|
+
const handleLayoutChange = (event, side) => {
|
|
1095
|
+
// Prevents react to nullify event on rerenders
|
|
1096
|
+
event.persist();
|
|
1097
|
+
|
|
1098
|
+
if (side === 'left') {
|
|
1099
|
+
setLeftWidth(event.nativeEvent.layout.width);
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
setRightWidth(event.nativeEvent.layout.width);
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Header, {
|
|
1107
|
+
insetTop: top,
|
|
1108
|
+
children: [left ? /*#__PURE__*/jsxRuntime.jsx(SideContainer, {
|
|
1109
|
+
onLayout: e => handleLayoutChange(e, 'left'),
|
|
1110
|
+
children: left
|
|
1111
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(HeaderContent, {
|
|
1112
|
+
windowWidth: dimensions.width,
|
|
1113
|
+
leftWidth: leftWidth,
|
|
1114
|
+
rightWidth: rightWidth,
|
|
1115
|
+
children: children
|
|
1116
|
+
}), right ? /*#__PURE__*/jsxRuntime.jsx(SideContainer, {
|
|
1117
|
+
side: "right",
|
|
1118
|
+
onLayout: e => handleLayoutChange(e, 'right'),
|
|
1119
|
+
children: right
|
|
1120
|
+
}) : null]
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
const Container$2 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1125
|
+
displayName: "FullScreenModal__Container",
|
|
1126
|
+
componentId: "kitt-universal__sc-11qpbe3-0"
|
|
1127
|
+
})(["flex:1;background-color:", ";"], ({
|
|
1128
|
+
theme
|
|
1129
|
+
}) => theme.kitt.colors.uiBackground);
|
|
1130
|
+
function FullScreenModal({
|
|
1131
|
+
children
|
|
1132
|
+
}) {
|
|
1133
|
+
return /*#__PURE__*/jsxRuntime.jsx(Container$2, {
|
|
1134
|
+
children: children
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
FullScreenModal.Header = FullScreenModalHeader;
|
|
1138
|
+
FullScreenModal.Body = FullScreenModalBody;
|
|
1139
|
+
|
|
1140
|
+
function StyleWebWrapper({
|
|
1141
|
+
as,
|
|
1142
|
+
children,
|
|
1143
|
+
...props
|
|
1144
|
+
}) {
|
|
1145
|
+
// as or default to div. If as is undefined, T is div but typescript is not sure
|
|
1146
|
+
return /*#__PURE__*/jsxRuntime.jsx(as || 'div', { ...props,
|
|
1147
|
+
children: children
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react.styled("div")({
|
|
1152
|
+
name: "PressableIconButtonWebWrapper",
|
|
1153
|
+
class: "p1nlccvg",
|
|
1154
|
+
vars: {
|
|
1155
|
+
"p1nlccvg-0": [({
|
|
1156
|
+
theme
|
|
1157
|
+
}) => theme.kitt.iconButton.scale.base.hover],
|
|
1158
|
+
"p1nlccvg-1": [({
|
|
1159
|
+
theme
|
|
1160
|
+
}) => theme.breakpoints.min.mediumBreakpoint],
|
|
1161
|
+
"p1nlccvg-2": [({
|
|
1162
|
+
theme
|
|
1163
|
+
}) => theme.kitt.iconButton.scale.medium.hover],
|
|
1164
|
+
"p1nlccvg-3": [({
|
|
1165
|
+
theme
|
|
1166
|
+
}) => theme.kitt.iconButton.scale.base.active],
|
|
1167
|
+
"p1nlccvg-4": [({
|
|
1168
|
+
theme
|
|
1169
|
+
}) => theme.kitt.iconButton.default.pressedBackgroundColor],
|
|
1170
|
+
"p1nlccvg-5": [({
|
|
1171
|
+
theme
|
|
1172
|
+
}) => theme.kitt.iconButton.white.pressedBackgroundColor]
|
|
1173
|
+
}
|
|
1174
|
+
}));
|
|
1175
|
+
const StyledPressableIconButton = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
1176
|
+
displayName: "PressableIconButton__StyledPressableIconButton",
|
|
1177
|
+
componentId: "kitt-universal__sc-1m6jo3s-0"
|
|
1178
|
+
})(["border-radius:", "px;width:", "px;height:", "px;align-items:center;justify-content:center;position:relative;background-color:transparent;", ";"], ({
|
|
1179
|
+
theme
|
|
1180
|
+
}) => theme.kitt.iconButton.borderRadius, ({
|
|
1181
|
+
theme
|
|
1182
|
+
}) => theme.kitt.iconButton.width, ({
|
|
1183
|
+
theme
|
|
1184
|
+
}) => theme.kitt.iconButton.height, ({
|
|
1185
|
+
theme,
|
|
1186
|
+
disabled
|
|
1187
|
+
}) => {
|
|
1188
|
+
const {
|
|
1189
|
+
iconButton
|
|
1190
|
+
} = theme.kitt;
|
|
1191
|
+
const {
|
|
1192
|
+
transition
|
|
1193
|
+
} = iconButton;
|
|
1194
|
+
|
|
1195
|
+
if (disabled) {
|
|
1196
|
+
return `
|
|
1197
|
+
background-color: ${iconButton.disabled.backgroundColor};
|
|
1198
|
+
`;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
return `
|
|
1202
|
+
transition: ${transition.property} ${transition.duration} ${transition.timingFunction};
|
|
1203
|
+
`;
|
|
1204
|
+
});
|
|
1205
|
+
function PressableIconButton({
|
|
1206
|
+
color,
|
|
1207
|
+
...props
|
|
1208
|
+
}) {
|
|
1209
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
|
|
1210
|
+
as: PressableIconButtonWebWrapper,
|
|
1211
|
+
"data-color-white": color === 'white' ? true : undefined,
|
|
1212
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledPressableIconButton, { ...props
|
|
1213
|
+
})
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
function PressableAnimatedContainer({
|
|
1218
|
+
children,
|
|
1219
|
+
color,
|
|
1220
|
+
disabled,
|
|
1221
|
+
onPress
|
|
1222
|
+
}) {
|
|
1223
|
+
return /*#__PURE__*/jsxRuntime.jsx(PressableIconButton, {
|
|
1224
|
+
accessibilityRole: "button",
|
|
1225
|
+
color: color,
|
|
1226
|
+
disabled: disabled,
|
|
1227
|
+
onPress: onPress,
|
|
1228
|
+
children: children
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
const IconButtonContentBorder = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1233
|
+
displayName: "IconButton__IconButtonContentBorder",
|
|
1234
|
+
componentId: "kitt-universal__sc-swelbf-0"
|
|
1235
|
+
})(["border:", ";border-color:", ";width:", "px;height:", "px;align-items:center;justify-content:center;border-radius:", "px;"], ({
|
|
1236
|
+
theme
|
|
1237
|
+
}) => `${theme.kitt.iconButton.borderWidth}px solid`, ({
|
|
1238
|
+
theme,
|
|
1239
|
+
disabled
|
|
1240
|
+
}) => disabled ? theme.kitt.iconButton.disabled.borderColor : theme.kitt.iconButton.borderColor, ({
|
|
1241
|
+
theme
|
|
1242
|
+
}) => theme.kitt.iconButton.width - theme.kitt.iconButton.borderWidth, ({
|
|
1243
|
+
theme
|
|
1244
|
+
}) => theme.kitt.iconButton.height - theme.kitt.iconButton.borderWidth, ({
|
|
1245
|
+
theme
|
|
1246
|
+
}) => theme.kitt.iconButton.borderRadius);
|
|
1247
|
+
|
|
1248
|
+
function IconButtonContent({
|
|
1249
|
+
disabled,
|
|
1250
|
+
color,
|
|
1251
|
+
icon
|
|
1252
|
+
}) {
|
|
1253
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconButtonContentBorder, {
|
|
1254
|
+
disabled: disabled,
|
|
1255
|
+
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
1256
|
+
color: disabled ? 'black-light' : color,
|
|
1257
|
+
icon: icon
|
|
1258
|
+
})
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function IconButton({
|
|
1263
|
+
icon,
|
|
1264
|
+
color,
|
|
1265
|
+
disabled,
|
|
1266
|
+
onPress
|
|
1267
|
+
}) {
|
|
1268
|
+
return /*#__PURE__*/jsxRuntime.jsx(PressableAnimatedContainer, {
|
|
1269
|
+
color: color,
|
|
1270
|
+
disabled: disabled,
|
|
1271
|
+
onPress: onPress,
|
|
1272
|
+
children: /*#__PURE__*/jsxRuntime.jsx(IconButtonContent, {
|
|
1273
|
+
disabled: disabled,
|
|
1274
|
+
color: color,
|
|
1275
|
+
icon: icon
|
|
1276
|
+
})
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
const ContentView$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1281
|
+
displayName: "ListItemContent__ContentView",
|
|
1282
|
+
componentId: "kitt-universal__sc-57q0u9-0"
|
|
1283
|
+
})(["flex:1 0 0%;align-self:center;"]);
|
|
1284
|
+
function ListItemContent({
|
|
1285
|
+
children,
|
|
1286
|
+
...rest
|
|
1287
|
+
}) {
|
|
1288
|
+
return /*#__PURE__*/jsxRuntime.jsx(ContentView$1, { ...rest,
|
|
1289
|
+
children: children
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
const SideContainerView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1294
|
+
displayName: "ListItemSideContent__SideContainerView",
|
|
1295
|
+
componentId: "kitt-universal__sc-1vajiw-0"
|
|
1296
|
+
})(["flex-direction:row;margin-left:", ";margin-right:", ";"], ({
|
|
1297
|
+
theme,
|
|
1298
|
+
side
|
|
1299
|
+
}) => side === 'right' ? theme.kitt.listItem.innerMargin : 0, ({
|
|
1300
|
+
theme,
|
|
1301
|
+
side
|
|
1302
|
+
}) => side === 'left' ? theme.kitt.listItem.innerMargin : 0); // Handles the vertical alignment of the side elements of the list item
|
|
1303
|
+
|
|
1304
|
+
function ListItemSideContainer({
|
|
1305
|
+
children,
|
|
1306
|
+
side = 'left',
|
|
1307
|
+
...rest
|
|
1308
|
+
}) {
|
|
1309
|
+
return /*#__PURE__*/jsxRuntime.jsx(SideContainerView, {
|
|
1310
|
+
side: side,
|
|
1311
|
+
...rest,
|
|
1312
|
+
children: children
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
const SideContentView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1316
|
+
displayName: "ListItemSideContent__SideContentView",
|
|
1317
|
+
componentId: "kitt-universal__sc-1vajiw-1"
|
|
1318
|
+
})(["align-self:", ";"], ({
|
|
1319
|
+
align
|
|
1320
|
+
}) => align);
|
|
1321
|
+
function ListItemSideContent({
|
|
1322
|
+
children,
|
|
1323
|
+
align = 'auto',
|
|
1324
|
+
...rest
|
|
1325
|
+
}) {
|
|
1326
|
+
return /*#__PURE__*/jsxRuntime.jsx(SideContentView, {
|
|
1327
|
+
align: align,
|
|
1328
|
+
...rest,
|
|
1329
|
+
children: children
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
const ContainerView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1334
|
+
displayName: "ListItem__ContainerView",
|
|
1335
|
+
componentId: "kitt-universal__sc-2afp9s-0"
|
|
1336
|
+
})(["flex-direction:row;padding:", ";", ";border-color:", ";background-color:", ";"], ({
|
|
1337
|
+
withPadding,
|
|
1338
|
+
theme
|
|
1339
|
+
}) => withPadding ? theme.kitt.listItem.padding : 0, ({
|
|
1340
|
+
theme,
|
|
1341
|
+
borders
|
|
1342
|
+
}) => {
|
|
1343
|
+
const {
|
|
1344
|
+
borderWidth
|
|
1345
|
+
} = theme.kitt.listItem;
|
|
1346
|
+
|
|
1347
|
+
if (borders === 'top') {
|
|
1348
|
+
return `border-top-width: ${borderWidth}`;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
if (borders === 'bottom') {
|
|
1352
|
+
return `border-bottom-width: ${borderWidth}`;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
if (borders === 'both') {
|
|
1356
|
+
return `border-top-width: ${borderWidth}; border-bottom-width: ${borderWidth}`;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
return 'border: none';
|
|
1360
|
+
}, ({
|
|
1361
|
+
theme
|
|
1362
|
+
}) => theme.kitt.listItem.borderColor, ({
|
|
1363
|
+
theme
|
|
1364
|
+
}) => theme.kitt.colors.uiBackgroundLight);
|
|
1365
|
+
function ListItem({
|
|
1366
|
+
children,
|
|
1367
|
+
withPadding,
|
|
1368
|
+
borders,
|
|
1369
|
+
left,
|
|
1370
|
+
right,
|
|
1371
|
+
onPress,
|
|
1372
|
+
...rest
|
|
1373
|
+
}) {
|
|
1374
|
+
const Wrapper = onPress ? BabelPluginStyledComponentsReactNative.Pressable : react$1.Fragment;
|
|
1375
|
+
const wrapperProps = onPress ? {
|
|
1376
|
+
accessibilityRole: 'button',
|
|
1377
|
+
onPress,
|
|
1378
|
+
...rest
|
|
1379
|
+
} : undefined;
|
|
1380
|
+
const containerProps = onPress ? undefined : rest;
|
|
1381
|
+
return /*#__PURE__*/jsxRuntime.jsx(Wrapper, { ...wrapperProps,
|
|
1382
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(ContainerView, {
|
|
1383
|
+
withPadding: withPadding,
|
|
1384
|
+
borders: borders,
|
|
1385
|
+
...containerProps,
|
|
1386
|
+
children: [left ? /*#__PURE__*/jsxRuntime.jsx(ListItemSideContainer, {
|
|
1387
|
+
side: "left",
|
|
1388
|
+
children: left
|
|
1389
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(ListItemContent, {
|
|
1390
|
+
children: children
|
|
1391
|
+
}), right ? /*#__PURE__*/jsxRuntime.jsx(ListItemSideContainer, {
|
|
1392
|
+
side: "right",
|
|
1393
|
+
children: right
|
|
1394
|
+
}) : null]
|
|
1395
|
+
})
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
ListItem.Content = ListItemContent;
|
|
1399
|
+
ListItem.SideContent = ListItemSideContent;
|
|
1400
|
+
ListItem.SideContainer = ListItemSideContainer;
|
|
1401
|
+
|
|
1402
|
+
const LargeLoaderContainer = withTheme( /*#__PURE__*/react.styled("div")({
|
|
1403
|
+
name: "LargeLoaderContainer",
|
|
1404
|
+
class: "l2im3sa",
|
|
1405
|
+
vars: {
|
|
1406
|
+
"l2im3sa-0": [({
|
|
1407
|
+
theme
|
|
1408
|
+
}) => theme.kitt.colors.separator],
|
|
1409
|
+
"l2im3sa-1": [({
|
|
1410
|
+
theme
|
|
1411
|
+
}) => theme.kitt.colors.primary]
|
|
1412
|
+
}
|
|
1413
|
+
}));
|
|
1414
|
+
function LargeLoader() {
|
|
1415
|
+
return /*#__PURE__*/jsxRuntime.jsx(LargeLoaderContainer, {
|
|
1416
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
1417
|
+
width: "60",
|
|
1418
|
+
height: "60",
|
|
1419
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1420
|
+
"data-large-loader": "base",
|
|
1421
|
+
children: /*#__PURE__*/jsxRuntime.jsx("circle", {
|
|
1422
|
+
cx: "30",
|
|
1423
|
+
cy: "30",
|
|
1424
|
+
r: "27",
|
|
1425
|
+
fill: "none"
|
|
1426
|
+
})
|
|
1427
|
+
}), /*#__PURE__*/jsxRuntime.jsx("g", {
|
|
1428
|
+
"data-large-loader": "fill",
|
|
1429
|
+
children: /*#__PURE__*/jsxRuntime.jsx("circle", {
|
|
1430
|
+
cx: "30",
|
|
1431
|
+
cy: "30",
|
|
1432
|
+
r: "27",
|
|
1433
|
+
fill: "none"
|
|
1434
|
+
})
|
|
1435
|
+
})]
|
|
1436
|
+
})
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
function Loader({
|
|
1441
|
+
color = 'primary',
|
|
1442
|
+
size = 20
|
|
1443
|
+
}) {
|
|
1444
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
1445
|
+
spin: true,
|
|
1446
|
+
color: color,
|
|
1447
|
+
size: size,
|
|
1448
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.LoaderIcon, {})
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
const xIconSize = 14;
|
|
1453
|
+
const mainIconSize = 20;
|
|
1454
|
+
const Container$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1455
|
+
displayName: "Message__Container",
|
|
1456
|
+
componentId: "kitt-universal__sc-c6400e-0"
|
|
1457
|
+
})(["border-radius:", "px;background-color:", ";padding-bottom:", "px;padding-left:", "px;padding-right:", "px;padding-top:", "px;flex-direction:row;align-items:flex-start;justify-content:space-between;"], ({
|
|
1458
|
+
theme,
|
|
1459
|
+
noRadius
|
|
1460
|
+
}) => noRadius ? 0 : theme.kitt.spacing * 5, ({
|
|
1461
|
+
theme,
|
|
1462
|
+
type
|
|
1463
|
+
}) => theme.kitt.feedbackMessage.backgroundColors[type], ({
|
|
1464
|
+
theme
|
|
1465
|
+
}) => theme.kitt.spacing * 4, ({
|
|
1466
|
+
theme
|
|
1467
|
+
}) => theme.kitt.spacing * 4, ({
|
|
1468
|
+
theme
|
|
1469
|
+
}) => theme.kitt.spacing * 4, ({
|
|
1470
|
+
theme,
|
|
1471
|
+
insets
|
|
1472
|
+
}) => (insets?.top ?? 0) + theme.kitt.spacing * 4);
|
|
1473
|
+
const CloseContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.TouchableOpacity).withConfig({
|
|
1474
|
+
displayName: "Message__CloseContainer",
|
|
1475
|
+
componentId: "kitt-universal__sc-c6400e-1"
|
|
1476
|
+
})(["margin-left:", "px;padding:", "px;"], ({
|
|
1477
|
+
theme
|
|
1478
|
+
}) => theme.kitt.spacing * 4, ({
|
|
1479
|
+
theme
|
|
1480
|
+
}) => theme.kitt.spacing);
|
|
1481
|
+
const IconContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1482
|
+
displayName: "Message__IconContainer",
|
|
1483
|
+
componentId: "kitt-universal__sc-c6400e-2"
|
|
1484
|
+
})(["margin-right:", "px;"], ({
|
|
1485
|
+
theme
|
|
1486
|
+
}) => theme.kitt.spacing * 4);
|
|
1487
|
+
const Content = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Text).withConfig({
|
|
1488
|
+
displayName: "Message__Content",
|
|
1489
|
+
componentId: "kitt-universal__sc-c6400e-3"
|
|
1490
|
+
})(["text-align:", ";flex:1;"], ({
|
|
1491
|
+
centeredText
|
|
1492
|
+
}) => centeredText ? 'center' : 'left');
|
|
1493
|
+
|
|
1494
|
+
const getColorByType = type => {
|
|
1495
|
+
switch (type) {
|
|
1496
|
+
case 'success':
|
|
1497
|
+
return 'white';
|
|
1498
|
+
|
|
1499
|
+
case 'danger':
|
|
1500
|
+
return 'white';
|
|
1501
|
+
|
|
1502
|
+
case 'warning':
|
|
1503
|
+
default:
|
|
1504
|
+
return 'black';
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
function getIconContent(type) {
|
|
1509
|
+
switch (type) {
|
|
1510
|
+
case 'warning':
|
|
1511
|
+
return /*#__PURE__*/jsxRuntime.jsx(kittIcons.AlertCircleIcon, {});
|
|
1512
|
+
|
|
1513
|
+
case 'success':
|
|
1514
|
+
return /*#__PURE__*/jsxRuntime.jsx(kittIcons.CheckIcon, {});
|
|
1515
|
+
|
|
1516
|
+
case 'danger':
|
|
1517
|
+
return /*#__PURE__*/jsxRuntime.jsx(kittIcons.AlertTriangleIcon, {});
|
|
1518
|
+
|
|
1519
|
+
default:
|
|
1520
|
+
return /*#__PURE__*/jsxRuntime.jsx(kittIcons.InfoIcon, {});
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
function Message({
|
|
1525
|
+
type = 'info',
|
|
1526
|
+
children,
|
|
1527
|
+
noRadius = false,
|
|
1528
|
+
centeredText = false,
|
|
1529
|
+
onDismiss,
|
|
1530
|
+
insets
|
|
1531
|
+
}) {
|
|
1532
|
+
const color = getColorByType(type);
|
|
1533
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Container$1, {
|
|
1534
|
+
type: type,
|
|
1535
|
+
noRadius: noRadius,
|
|
1536
|
+
insets: insets,
|
|
1537
|
+
children: [!centeredText ? /*#__PURE__*/jsxRuntime.jsx(IconContainer, {
|
|
1538
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1539
|
+
size: mainIconSize,
|
|
1540
|
+
color: color,
|
|
1541
|
+
icon: getIconContent(type)
|
|
1542
|
+
})
|
|
1543
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(Content, {
|
|
1544
|
+
type: type,
|
|
1545
|
+
centeredText: centeredText,
|
|
1546
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
1547
|
+
base: "body-small",
|
|
1548
|
+
color: color,
|
|
1549
|
+
children: children
|
|
1550
|
+
})
|
|
1551
|
+
}), onDismiss ? /*#__PURE__*/jsxRuntime.jsx(CloseContainer, {
|
|
1552
|
+
onPress: onDismiss,
|
|
1553
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
1554
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.XIcon, {}),
|
|
1555
|
+
size: xIconSize,
|
|
1556
|
+
color: color
|
|
1557
|
+
})
|
|
1558
|
+
}) : null]
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
// Don't use styled.Pressable here - babel-plugin-styled-components-react-native-web only supports tagged templates
|
|
1563
|
+
const OverlayPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
1564
|
+
displayName: "Overlay__OverlayPressable",
|
|
1565
|
+
componentId: "kitt-universal__sc-1cz1gbr-0"
|
|
1566
|
+
})(({
|
|
1567
|
+
theme
|
|
1568
|
+
}) => ({ ...BabelPluginStyledComponentsReactNative.StyleSheet.absoluteFillObject,
|
|
1569
|
+
backgroundColor: theme.kitt.colors.overlay.dark
|
|
1570
|
+
}));
|
|
1571
|
+
function Overlay({
|
|
1572
|
+
onPress
|
|
1573
|
+
}) {
|
|
1574
|
+
return /*#__PURE__*/jsxRuntime.jsx(OverlayPressable, {
|
|
1575
|
+
accessibilityRole: "none",
|
|
1576
|
+
onPress: onPress,
|
|
1577
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.View, {})
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
const BodyView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1582
|
+
displayName: "Body__BodyView",
|
|
1583
|
+
componentId: "kitt-universal__sc-17fwpo4-0"
|
|
1584
|
+
})(["padding:", "px ", "px;"], ({
|
|
1585
|
+
theme
|
|
1586
|
+
}) => theme.kitt.spacing * 6, ({
|
|
1587
|
+
theme
|
|
1588
|
+
}) => theme.kitt.spacing * 4);
|
|
1589
|
+
function ModalBody({
|
|
1590
|
+
children
|
|
1591
|
+
}) {
|
|
1592
|
+
return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.ScrollView, {
|
|
1593
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BodyView, {
|
|
1594
|
+
children: children
|
|
1595
|
+
})
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
const FooterView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1600
|
+
displayName: "Footer__FooterView",
|
|
1601
|
+
componentId: "kitt-universal__sc-1ujq2dc-0"
|
|
1602
|
+
})(["flex:0 0 auto;padding:", "px;border-top-width:1px;border-top-color:", ";"], ({
|
|
1603
|
+
theme
|
|
1604
|
+
}) => theme.kitt.spacing * 4, ({
|
|
1605
|
+
theme
|
|
1606
|
+
}) => theme.kitt.colors.separator);
|
|
1607
|
+
function ModalFooter({
|
|
1608
|
+
children
|
|
1609
|
+
}) {
|
|
1610
|
+
return /*#__PURE__*/jsxRuntime.jsx(FooterView, {
|
|
1611
|
+
children: children
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
const OnCloseContext = /*#__PURE__*/react$1.createContext(() => {});
|
|
1616
|
+
|
|
1617
|
+
const HeaderView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1618
|
+
displayName: "Header__HeaderView",
|
|
1619
|
+
componentId: "kitt-universal__sc-1iwabch-0"
|
|
1620
|
+
})(["position:relative;padding:", "px;display:flex;flex:0 0 auto;flex-direction:row;justify-content:space-between;align-items:center;border-bottom-width:1px;border-bottom-color:", ";min-height:57px;"], ({
|
|
1621
|
+
theme
|
|
1622
|
+
}) => theme.kitt.spacing * 2, ({
|
|
1623
|
+
theme
|
|
1624
|
+
}) => theme.kitt.colors.separator);
|
|
1625
|
+
const LeftIconView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1626
|
+
displayName: "Header__LeftIconView",
|
|
1627
|
+
componentId: "kitt-universal__sc-1iwabch-1"
|
|
1628
|
+
})(["align-self:flex-start;margin-right:", "px;"], ({
|
|
1629
|
+
theme
|
|
1630
|
+
}) => theme.kitt.spacing * 2);
|
|
1631
|
+
const RightIconView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1632
|
+
displayName: "Header__RightIconView",
|
|
1633
|
+
componentId: "kitt-universal__sc-1iwabch-2"
|
|
1634
|
+
})(["align-self:flex-start;margin-left:", "px;"], ({
|
|
1635
|
+
theme
|
|
1636
|
+
}) => theme.kitt.spacing * 2);
|
|
1637
|
+
const TitleView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1638
|
+
displayName: "Header__TitleView",
|
|
1639
|
+
componentId: "kitt-universal__sc-1iwabch-3"
|
|
1640
|
+
})(["padding-left:", "px;flex-shrink:1;"], ({
|
|
1641
|
+
theme,
|
|
1642
|
+
isIconLeft
|
|
1643
|
+
}) => isIconLeft ? 0 : theme.kitt.spacing * 2);
|
|
1644
|
+
function ModalHeader({
|
|
1645
|
+
left,
|
|
1646
|
+
right,
|
|
1647
|
+
children
|
|
1648
|
+
}) {
|
|
1649
|
+
const onClose = react$1.useContext(OnCloseContext);
|
|
1650
|
+
const isIconLeft = !!left;
|
|
1651
|
+
return /*#__PURE__*/jsxRuntime.jsxs(HeaderView, {
|
|
1652
|
+
children: [isIconLeft && /*#__PURE__*/jsxRuntime.jsx(LeftIconView, {
|
|
1653
|
+
children: left
|
|
1654
|
+
}), /*#__PURE__*/jsxRuntime.jsx(TitleView, {
|
|
1655
|
+
isIconLeft: isIconLeft,
|
|
1656
|
+
children: children
|
|
1657
|
+
}), right !== undefined ? right : /*#__PURE__*/jsxRuntime.jsx(RightIconView, {
|
|
1658
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1659
|
+
type: "subtle-dark",
|
|
1660
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.XIcon, {}),
|
|
1661
|
+
onPress: onClose
|
|
1662
|
+
})
|
|
1663
|
+
})]
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
const ModalView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1668
|
+
displayName: "Modal__ModalView",
|
|
1669
|
+
componentId: "kitt-universal__sc-1xy2w5u-0"
|
|
1670
|
+
})(["top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:", "px ", "px;"], ({
|
|
1671
|
+
theme
|
|
1672
|
+
}) => theme.kitt.spacing * 20, ({
|
|
1673
|
+
theme
|
|
1674
|
+
}) => theme.kitt.spacing * 4);
|
|
1675
|
+
const ContentView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1676
|
+
displayName: "Modal__ContentView",
|
|
1677
|
+
componentId: "kitt-universal__sc-1xy2w5u-1"
|
|
1678
|
+
})(["position:relative;display:flex;flex-direction:column;max-height:100%;max-width:540px;height:auto;width:100%;border-radius:", ";background-color:", ";"], ({
|
|
1679
|
+
theme
|
|
1680
|
+
}) => theme.kitt.card.borderRadius, ({
|
|
1681
|
+
theme
|
|
1682
|
+
}) => theme.kitt.palettes.lateOcean.white);
|
|
1683
|
+
function Modal({
|
|
1684
|
+
visible,
|
|
1685
|
+
children,
|
|
1686
|
+
onClose,
|
|
1687
|
+
onEntered,
|
|
1688
|
+
onExited
|
|
1689
|
+
}) {
|
|
1690
|
+
return /*#__PURE__*/jsxRuntime.jsx(OnCloseContext.Provider, {
|
|
1691
|
+
value: onClose,
|
|
1692
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Modal, {
|
|
1693
|
+
transparent: true,
|
|
1694
|
+
animationType: "fade",
|
|
1695
|
+
visible: visible,
|
|
1696
|
+
onShow: onEntered,
|
|
1697
|
+
onDismiss: onExited,
|
|
1698
|
+
onRequestClose: onClose,
|
|
1699
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(ModalView, {
|
|
1700
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Overlay, {
|
|
1701
|
+
onPress: onClose
|
|
1702
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ContentView, {
|
|
1703
|
+
children: children
|
|
1704
|
+
})]
|
|
1705
|
+
})
|
|
1706
|
+
})
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
Modal.Header = ModalHeader;
|
|
1710
|
+
Modal.Body = ModalBody;
|
|
1711
|
+
Modal.Footer = ModalFooter;
|
|
1712
|
+
|
|
1713
|
+
function Notification({
|
|
1714
|
+
type,
|
|
1715
|
+
children,
|
|
1716
|
+
centeredText,
|
|
1717
|
+
onDelete
|
|
1718
|
+
}) {
|
|
1719
|
+
const {
|
|
1720
|
+
top
|
|
1721
|
+
} = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
1722
|
+
return /*#__PURE__*/jsxRuntime.jsx(Message, {
|
|
1723
|
+
noRadius: true,
|
|
1724
|
+
type: type,
|
|
1725
|
+
centeredText: centeredText,
|
|
1726
|
+
insets: {
|
|
1727
|
+
top
|
|
1728
|
+
},
|
|
1729
|
+
onDismiss: onDelete,
|
|
1730
|
+
children: children
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
const Flex = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1735
|
+
shouldForwardProp: (prop, defaultValidatorFn) => !['direction', 'padding'].includes(prop) && defaultValidatorFn(prop)
|
|
1736
|
+
}).withConfig({
|
|
1737
|
+
displayName: "Flex",
|
|
1738
|
+
componentId: "kitt-universal__sc-15q3v3h-0"
|
|
1739
|
+
})(["display:flex;flex-direction:", ";flex-wrap:wrap;padding:", "px;"], ({
|
|
1740
|
+
direction
|
|
1741
|
+
}) => direction, ({
|
|
1742
|
+
theme,
|
|
1743
|
+
padding = 0
|
|
1744
|
+
}) => padding * theme.kitt.spacing);
|
|
1745
|
+
|
|
1746
|
+
const storyPadding = 16;
|
|
1747
|
+
|
|
1748
|
+
const getBackgroundColorFromBlockColor = (theme, color = 'transparent') => {
|
|
1749
|
+
switch (color) {
|
|
1750
|
+
case 'dark':
|
|
1751
|
+
return '#293033';
|
|
1752
|
+
|
|
1753
|
+
case 'light':
|
|
1754
|
+
return '#ffffff';
|
|
1755
|
+
|
|
1756
|
+
case 'primary':
|
|
1757
|
+
return theme.kitt.palettes.lateOcean.lateOcean;
|
|
1758
|
+
|
|
1759
|
+
default:
|
|
1760
|
+
return 'transparent';
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
const getTypographyColorFromBlockColor = (color = 'transparent') => {
|
|
1765
|
+
switch (color) {
|
|
1766
|
+
case 'dark':
|
|
1767
|
+
case 'primary':
|
|
1768
|
+
return 'white';
|
|
1769
|
+
|
|
1770
|
+
case 'light':
|
|
1771
|
+
default:
|
|
1772
|
+
return 'black';
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
|
|
1776
|
+
const StoryBlockBackgroundContext = /*#__PURE__*/react$1.createContext('transparent');
|
|
1777
|
+
const StoryBlockColorContext = /*#__PURE__*/react$1.createContext('black');
|
|
1778
|
+
const useStoryBlockColor = color => {
|
|
1779
|
+
const storyBlockColor = react$1.useContext(StoryBlockColorContext);
|
|
1780
|
+
return color || storyBlockColor;
|
|
1781
|
+
};
|
|
1782
|
+
const StyledStoryBlockView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1783
|
+
displayName: "StoryBlock__StyledStoryBlockView",
|
|
1784
|
+
componentId: "kitt-universal__sc-3w4hdm-0"
|
|
1785
|
+
})(["padding:16px ", "px 0;margin:0 -", "px;background:", ";"], storyPadding, storyPadding, ({
|
|
1786
|
+
theme,
|
|
1787
|
+
background
|
|
1788
|
+
}) => getBackgroundColorFromBlockColor(theme, background));
|
|
1789
|
+
function StoryBlock({
|
|
1790
|
+
children,
|
|
1791
|
+
background
|
|
1792
|
+
}) {
|
|
1793
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledStoryBlockView, {
|
|
1794
|
+
background: background,
|
|
1795
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StoryBlockColorContext.Provider, {
|
|
1796
|
+
value: getTypographyColorFromBlockColor(background),
|
|
1797
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StoryBlockBackgroundContext.Provider, {
|
|
1798
|
+
value: background,
|
|
1799
|
+
children: children
|
|
1800
|
+
})
|
|
1801
|
+
})
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
const StoryTitleContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1806
|
+
displayName: "StoryTitle__StoryTitleContainer",
|
|
1807
|
+
componentId: "kitt-universal__sc-sic7hb-0"
|
|
1808
|
+
})(["margin-bottom:30px;"]);
|
|
1809
|
+
const StorySubTitleContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1810
|
+
displayName: "StoryTitle__StorySubTitleContainer",
|
|
1811
|
+
componentId: "kitt-universal__sc-sic7hb-1"
|
|
1812
|
+
})(["margin-bottom:10px;"]);
|
|
1813
|
+
function StoryTitle({
|
|
1814
|
+
color,
|
|
1815
|
+
children,
|
|
1816
|
+
numberOfLines
|
|
1817
|
+
}) {
|
|
1818
|
+
return /*#__PURE__*/jsxRuntime.jsx(StoryTitleContainer, {
|
|
1819
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Header1, {
|
|
1820
|
+
variant: "bold",
|
|
1821
|
+
base: "header1",
|
|
1822
|
+
color: useStoryBlockColor(color),
|
|
1823
|
+
numberOfLines: numberOfLines,
|
|
1824
|
+
children: children
|
|
1825
|
+
})
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
function StoryTitleLevel2({
|
|
1830
|
+
color,
|
|
1831
|
+
children,
|
|
1832
|
+
numberOfLines
|
|
1833
|
+
}) {
|
|
1834
|
+
return /*#__PURE__*/jsxRuntime.jsx(StoryTitleContainer, {
|
|
1835
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Header2, {
|
|
1836
|
+
variant: "bold",
|
|
1837
|
+
base: "header2",
|
|
1838
|
+
color: useStoryBlockColor(color),
|
|
1839
|
+
numberOfLines: numberOfLines,
|
|
1840
|
+
children: children
|
|
1841
|
+
})
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
StoryTitleLevel2.displayName = 'StoryTitle.Level2';
|
|
1846
|
+
|
|
1847
|
+
function StoryTitleLevel3({
|
|
1848
|
+
color,
|
|
1849
|
+
children,
|
|
1850
|
+
numberOfLines
|
|
1851
|
+
}) {
|
|
1852
|
+
return /*#__PURE__*/jsxRuntime.jsx(StorySubTitleContainer, {
|
|
1853
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Header3, {
|
|
1854
|
+
variant: "bold",
|
|
1855
|
+
base: "header3",
|
|
1856
|
+
medium: "header4",
|
|
1857
|
+
color: useStoryBlockColor(color),
|
|
1858
|
+
numberOfLines: numberOfLines,
|
|
1859
|
+
children: children
|
|
1860
|
+
})
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
StoryTitleLevel3.displayName = 'StoryTitle.Level3';
|
|
1865
|
+
|
|
1866
|
+
function StoryTitleLevel4({
|
|
1867
|
+
color,
|
|
1868
|
+
children,
|
|
1869
|
+
numberOfLines
|
|
1870
|
+
}) {
|
|
1871
|
+
return /*#__PURE__*/jsxRuntime.jsx(StorySubTitleContainer, {
|
|
1872
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Header4, {
|
|
1873
|
+
variant: "bold",
|
|
1874
|
+
base: "header4",
|
|
1875
|
+
medium: "header5",
|
|
1876
|
+
color: useStoryBlockColor(color),
|
|
1877
|
+
numberOfLines: numberOfLines,
|
|
1878
|
+
children: children
|
|
1879
|
+
})
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
StoryTitleLevel4.displayName = 'StoryTitle.Level3';
|
|
1884
|
+
StoryTitle.Level2 = StoryTitleLevel2;
|
|
1885
|
+
StoryTitle.Level3 = StoryTitleLevel3;
|
|
1886
|
+
StoryTitle.Level4 = StoryTitleLevel4;
|
|
1887
|
+
|
|
1888
|
+
const StoryContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.ScrollView).withConfig({
|
|
1889
|
+
displayName: "Story__StoryContainer",
|
|
1890
|
+
componentId: "kitt-universal__sc-1kwdg2p-0"
|
|
1891
|
+
})(["padding:", "px;"], storyPadding);
|
|
1892
|
+
function Story({
|
|
1893
|
+
title,
|
|
1894
|
+
contentContainerStyle,
|
|
1895
|
+
children
|
|
1896
|
+
}) {
|
|
1897
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StoryContainer$1, {
|
|
1898
|
+
contentContainerStyle: contentContainerStyle,
|
|
1899
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(StoryTitle, {
|
|
1900
|
+
children: title
|
|
1901
|
+
}), children]
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
const StyledSection = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1906
|
+
displayName: "StorySection__StyledSection",
|
|
1907
|
+
componentId: "kitt-universal__sc-1b3liv5-0"
|
|
1908
|
+
})(["margin-bottom:32px;"]);
|
|
1909
|
+
function StorySection({
|
|
1910
|
+
title,
|
|
1911
|
+
children,
|
|
1912
|
+
internalIsDemoSection,
|
|
1913
|
+
...props
|
|
1914
|
+
}) {
|
|
1915
|
+
if (title === 'Demo' && !internalIsDemoSection) throw new Error('Use StorySection.Demo instead');
|
|
1916
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StyledSection, { ...props,
|
|
1917
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(StoryTitle.Level2, {
|
|
1918
|
+
children: title
|
|
1919
|
+
}), children]
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
const StyledSubSection = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1923
|
+
displayName: "StorySection__StyledSubSection",
|
|
1924
|
+
componentId: "kitt-universal__sc-1b3liv5-1"
|
|
1925
|
+
})(["margin-bottom:16px;"]);
|
|
1926
|
+
|
|
1927
|
+
function SubSection({
|
|
1928
|
+
title,
|
|
1929
|
+
children,
|
|
1930
|
+
...props
|
|
1931
|
+
}) {
|
|
1932
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StyledSubSection, { ...props,
|
|
1933
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(StoryTitle.Level3, {
|
|
1934
|
+
children: title
|
|
1935
|
+
}), children]
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
const StyledBlockSection = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1940
|
+
displayName: "StorySection__StyledBlockSection",
|
|
1941
|
+
componentId: "kitt-universal__sc-1b3liv5-2"
|
|
1942
|
+
})(["margin-bottom:16px;"]);
|
|
1943
|
+
|
|
1944
|
+
function BlockSection({
|
|
1945
|
+
title,
|
|
1946
|
+
children,
|
|
1947
|
+
...props
|
|
1948
|
+
}) {
|
|
1949
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StyledBlockSection, { ...props,
|
|
1950
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(StoryTitle.Level4, {
|
|
1951
|
+
children: title
|
|
1952
|
+
}), children]
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
const StyledDemoSection = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1957
|
+
displayName: "StorySection__StyledDemoSection",
|
|
1958
|
+
componentId: "kitt-universal__sc-1b3liv5-3"
|
|
1959
|
+
})(["margin-bottom:64px;"]);
|
|
1960
|
+
|
|
1961
|
+
function DemoSection({
|
|
1962
|
+
children
|
|
1963
|
+
}) {
|
|
1964
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledDemoSection, {
|
|
1965
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StorySection, {
|
|
1966
|
+
internalIsDemoSection: true,
|
|
1967
|
+
title: "Demo",
|
|
1968
|
+
children: children
|
|
1969
|
+
})
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
StorySection.SubSection = SubSection;
|
|
1974
|
+
StorySection.BlockSection = BlockSection;
|
|
1975
|
+
/** @deprecated use StorySection.Demo instead */
|
|
1976
|
+
|
|
1977
|
+
StorySection.DemoSection = DemoSection;
|
|
1978
|
+
StorySection.Demo = DemoSection;
|
|
1979
|
+
/** @deprecated use StorySection instead */
|
|
1980
|
+
|
|
1981
|
+
const DeprecatedSection = StorySection;
|
|
1982
|
+
|
|
1983
|
+
function StoryContainer({
|
|
1984
|
+
children,
|
|
1985
|
+
state,
|
|
1986
|
+
title,
|
|
1987
|
+
platform
|
|
1988
|
+
}) {
|
|
1989
|
+
if (platform === 'native') return null;
|
|
1990
|
+
return /*#__PURE__*/jsxRuntime.jsx(StorySection.BlockSection, {
|
|
1991
|
+
testID: state,
|
|
1992
|
+
title: title,
|
|
1993
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1994
|
+
className: state ? `kitt-${state}` : undefined,
|
|
1995
|
+
children: children
|
|
1996
|
+
})
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
function StoryDecorator(storyFn, context) {
|
|
2001
|
+
return /*#__PURE__*/jsxRuntime.jsx(Story, {
|
|
2002
|
+
title: context.name,
|
|
2003
|
+
children: storyFn()
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
const SmallScreenRow = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2008
|
+
displayName: "StoryGrid__SmallScreenRow",
|
|
2009
|
+
componentId: "kitt-universal__sc-4z5new-0"
|
|
2010
|
+
})(["flex-direction:column;margin:0;"]);
|
|
2011
|
+
const SmallScreenCol = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2012
|
+
displayName: "StoryGrid__SmallScreenCol",
|
|
2013
|
+
componentId: "kitt-universal__sc-4z5new-1"
|
|
2014
|
+
})(["padding:8px 0 16px;"]);
|
|
2015
|
+
const FlexRow = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2016
|
+
displayName: "StoryGrid__FlexRow",
|
|
2017
|
+
componentId: "kitt-universal__sc-4z5new-2"
|
|
2018
|
+
})(["flex-direction:row;margin:0 -4px 16px;"]);
|
|
2019
|
+
const FlexCol = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2020
|
+
displayName: "StoryGrid__FlexCol",
|
|
2021
|
+
componentId: "kitt-universal__sc-4z5new-3"
|
|
2022
|
+
})(["flex-grow:1;flex-basis:0;margin:0 8px;"]);
|
|
2023
|
+
|
|
2024
|
+
function StoryGridRow({
|
|
2025
|
+
children,
|
|
2026
|
+
breakpoint = 'small'
|
|
2027
|
+
}) {
|
|
2028
|
+
// eslint-disable-next-line unicorn/expiring-todo-comments
|
|
2029
|
+
// TODO use useBreakpoint instead
|
|
2030
|
+
const {
|
|
2031
|
+
width
|
|
2032
|
+
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
2033
|
+
const breakpointValue = breakpoint === 'small' ? 480 : 768;
|
|
2034
|
+
|
|
2035
|
+
if (width < breakpointValue) {
|
|
2036
|
+
return /*#__PURE__*/jsxRuntime.jsx(SmallScreenRow, {
|
|
2037
|
+
children: react$1.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(SmallScreenCol, {
|
|
2038
|
+
children: child
|
|
2039
|
+
}))
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
return /*#__PURE__*/jsxRuntime.jsx(FlexRow, {
|
|
2044
|
+
children: react$1.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(FlexCol, {
|
|
2045
|
+
children: child
|
|
2046
|
+
}))
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
function StoryGridCol({
|
|
2051
|
+
title,
|
|
2052
|
+
titleColor,
|
|
2053
|
+
children,
|
|
2054
|
+
platform = 'all'
|
|
2055
|
+
}) {
|
|
2056
|
+
if (platform === 'native') {
|
|
2057
|
+
return null;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2061
|
+
children: [title ? /*#__PURE__*/jsxRuntime.jsx(StoryTitle.Level4, {
|
|
2062
|
+
numberOfLines: 1,
|
|
2063
|
+
color: titleColor,
|
|
2064
|
+
children: title
|
|
2065
|
+
}) : null, children]
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
const StoryGrid = {
|
|
2070
|
+
Row: StoryGridRow,
|
|
2071
|
+
Col: StoryGridCol
|
|
2072
|
+
};
|
|
2073
|
+
|
|
2074
|
+
const Container = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2075
|
+
displayName: "Tag__Container",
|
|
2076
|
+
componentId: "kitt-universal__sc-19jmowi-0"
|
|
2077
|
+
})(["background-color:", ";border-width:", ";border-color:", ";padding:", ";border-radius:", ";align-self:flex-start;"], ({
|
|
2078
|
+
theme,
|
|
2079
|
+
type,
|
|
2080
|
+
variant
|
|
2081
|
+
}) => theme.kitt.tag[type][variant].backgroundColor, ({
|
|
2082
|
+
theme,
|
|
2083
|
+
type,
|
|
2084
|
+
variant
|
|
2085
|
+
}) => theme.kitt.tag[type][variant].borderWidth, ({
|
|
2086
|
+
theme,
|
|
2087
|
+
type,
|
|
2088
|
+
variant
|
|
2089
|
+
}) => theme.kitt.tag[type][variant].borderColor, ({
|
|
2090
|
+
theme
|
|
2091
|
+
}) => theme.kitt.tag.padding, ({
|
|
2092
|
+
theme
|
|
2093
|
+
}) => theme.kitt.tag.borderRadius);
|
|
2094
|
+
const getLabelColor = (type, variant) => {
|
|
2095
|
+
switch (type) {
|
|
2096
|
+
case 'danger':
|
|
2097
|
+
{
|
|
2098
|
+
return variant === 'outline' ? 'danger' : 'black';
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
case 'primary':
|
|
2102
|
+
{
|
|
2103
|
+
return 'primary';
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
case 'default':
|
|
2107
|
+
{
|
|
2108
|
+
return 'black';
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
default:
|
|
2112
|
+
{
|
|
2113
|
+
return 'black';
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
function Tag({
|
|
2118
|
+
label,
|
|
2119
|
+
type = 'default',
|
|
2120
|
+
variant = 'fill'
|
|
2121
|
+
}) {
|
|
2122
|
+
return /*#__PURE__*/jsxRuntime.jsx(Container, {
|
|
2123
|
+
type: type,
|
|
2124
|
+
variant: variant,
|
|
2125
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
2126
|
+
base: "body-xsmall",
|
|
2127
|
+
color: getLabelColor(type, variant),
|
|
2128
|
+
children: label
|
|
2129
|
+
})
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
const lateOceanColorPalette = {
|
|
2134
|
+
lateOcean: '#4C34E0',
|
|
2135
|
+
lateOceanLight1: '#705DE6',
|
|
2136
|
+
lateOceanLight2: '#9485EC',
|
|
2137
|
+
lateOceanLight3: '#D6BAF9',
|
|
2138
|
+
warmEmbrace: '#F4D3CE',
|
|
2139
|
+
warmEmbraceLight1: '#FFEDE6',
|
|
2140
|
+
black1000: '#000000',
|
|
2141
|
+
black555: '#737373',
|
|
2142
|
+
black200: '#CCCCCC',
|
|
2143
|
+
black100: '#E5E5E5',
|
|
2144
|
+
black50: '#F2F2F2',
|
|
2145
|
+
black25: '#F9F9F9',
|
|
2146
|
+
white: '#FFFFFF',
|
|
2147
|
+
viride: '#38836D',
|
|
2148
|
+
englishVermillon: '#D44148',
|
|
2149
|
+
goldCrayola: '#F8C583',
|
|
2150
|
+
aero: '#89BDDD',
|
|
2151
|
+
transparent: 'transparent',
|
|
2152
|
+
moonPurple: '#DBD6F9',
|
|
2153
|
+
moonPurpleLight1: '#EDEBFC'
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
const avatarLateOceanTheme = {
|
|
2157
|
+
default: {
|
|
2158
|
+
color: lateOceanColorPalette.white,
|
|
2159
|
+
backgroundColor: lateOceanColorPalette.lateOcean
|
|
2160
|
+
},
|
|
2161
|
+
light: {
|
|
2162
|
+
color: lateOceanColorPalette.black1000,
|
|
2163
|
+
backgroundColor: lateOceanColorPalette.black100
|
|
2164
|
+
}
|
|
2165
|
+
};
|
|
2166
|
+
|
|
2167
|
+
const buttonLateOceanTheme = {
|
|
2168
|
+
borderRadius: '30px',
|
|
2169
|
+
borderWidth: '2px',
|
|
2170
|
+
minHeight: '42px',
|
|
2171
|
+
minWidth: '40px',
|
|
2172
|
+
maxWidth: '335px',
|
|
2173
|
+
iconSize: 18,
|
|
2174
|
+
contentPadding: {
|
|
2175
|
+
default: '8px 16px'
|
|
2176
|
+
},
|
|
2177
|
+
primary: {
|
|
2178
|
+
backgroundColor: lateOceanColorPalette.lateOcean,
|
|
2179
|
+
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
2180
|
+
pressedBackgroundColor: lateOceanColorPalette.lateOceanLight1,
|
|
2181
|
+
disabledBorderColor: lateOceanColorPalette.black100
|
|
2182
|
+
},
|
|
2183
|
+
secondary: {
|
|
2184
|
+
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
2185
|
+
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
2186
|
+
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2187
|
+
disabledBorderColor: lateOceanColorPalette.black100
|
|
2188
|
+
},
|
|
2189
|
+
subtle: {
|
|
2190
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2191
|
+
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2192
|
+
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
2193
|
+
disabledBorderColor: lateOceanColorPalette.transparent
|
|
2194
|
+
},
|
|
2195
|
+
'subtle-dark': {
|
|
2196
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2197
|
+
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2198
|
+
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
2199
|
+
disabledBorderColor: lateOceanColorPalette.transparent
|
|
2200
|
+
},
|
|
2201
|
+
white: {
|
|
2202
|
+
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
2203
|
+
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2204
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2205
|
+
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2206
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)',
|
|
2207
|
+
disabledBorderColor: lateOceanColorPalette.transparent
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
|
|
2211
|
+
const cardLateOceanTheme = {
|
|
2212
|
+
borderRadius: '20px',
|
|
2213
|
+
borderWidth: '2px',
|
|
2214
|
+
padding: '16px',
|
|
2215
|
+
primary: {
|
|
2216
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
2217
|
+
borderColor: lateOceanColorPalette.lateOcean
|
|
2218
|
+
},
|
|
2219
|
+
secondary: {
|
|
2220
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
2221
|
+
borderColor: lateOceanColorPalette.black100
|
|
2222
|
+
},
|
|
2223
|
+
subtle: {
|
|
2224
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
2225
|
+
borderColor: lateOceanColorPalette.black100
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
|
|
2229
|
+
const colorsLateOceanTheme = {
|
|
2230
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
2231
|
+
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2232
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
2233
|
+
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2234
|
+
success: lateOceanColorPalette.viride,
|
|
2235
|
+
correct: lateOceanColorPalette.viride,
|
|
2236
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
2237
|
+
separator: lateOceanColorPalette.black100,
|
|
2238
|
+
hover: lateOceanColorPalette.black100,
|
|
2239
|
+
black: lateOceanColorPalette.black1000,
|
|
2240
|
+
uiBackground: lateOceanColorPalette.black25,
|
|
2241
|
+
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2242
|
+
overlay: {
|
|
2243
|
+
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2244
|
+
light: 'rgba(255, 255, 255, 0.90)',
|
|
2245
|
+
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2246
|
+
}
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
const feedbackMessageLateOceanTheme = {
|
|
2250
|
+
backgroundColors: {
|
|
2251
|
+
success: lateOceanColorPalette.viride,
|
|
2252
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
2253
|
+
warning: lateOceanColorPalette.goldCrayola,
|
|
2254
|
+
info: lateOceanColorPalette.aero
|
|
2255
|
+
}
|
|
2256
|
+
};
|
|
2257
|
+
|
|
2258
|
+
const inputFieldLateOceanTheme = {
|
|
2259
|
+
labelContainerPaddingBottom: 5,
|
|
2260
|
+
iconMarginLeft: 6
|
|
2261
|
+
};
|
|
2262
|
+
|
|
2263
|
+
const inputStatesStyle = {
|
|
2264
|
+
default: {
|
|
2265
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
2266
|
+
borderColor: lateOceanColorPalette.black100,
|
|
2267
|
+
color: 'black',
|
|
2268
|
+
passwordButtonIconColor: 'black'
|
|
2269
|
+
},
|
|
2270
|
+
hover: {
|
|
2271
|
+
borderColor: lateOceanColorPalette.black200,
|
|
2272
|
+
color: 'black',
|
|
2273
|
+
passwordButtonIconColor: 'black'
|
|
2274
|
+
},
|
|
2275
|
+
focus: {
|
|
2276
|
+
borderColor: lateOceanColorPalette.lateOcean,
|
|
2277
|
+
color: 'black',
|
|
2278
|
+
passwordButtonIconColor: 'black'
|
|
2279
|
+
},
|
|
2280
|
+
disabled: {
|
|
2281
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
2282
|
+
borderColor: lateOceanColorPalette.black100,
|
|
2283
|
+
color: 'black-light',
|
|
2284
|
+
passwordButtonIconColor: 'black-light'
|
|
2285
|
+
},
|
|
2286
|
+
invalid: {
|
|
2287
|
+
borderColor: lateOceanColorPalette.englishVermillon,
|
|
2288
|
+
color: 'black',
|
|
2289
|
+
passwordButtonIconColor: 'black'
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
const inputLateOceanTheme = {
|
|
2293
|
+
marginTop: '2px',
|
|
2294
|
+
marginBottom: '4px',
|
|
2295
|
+
borderWidth: '2px',
|
|
2296
|
+
borderRadius: '10px',
|
|
2297
|
+
passwordButtonIconSize: 20,
|
|
2298
|
+
padding: '7px 16px',
|
|
2299
|
+
paddingSingleLineIOS: '12px 16px',
|
|
2300
|
+
selectionColor: lateOceanColorPalette.lateOcean,
|
|
2301
|
+
placeholderColor: 'black-light',
|
|
2302
|
+
textAreaMinHeight: 120,
|
|
2303
|
+
states: inputStatesStyle
|
|
2304
|
+
};
|
|
2305
|
+
|
|
2306
|
+
const radioLateOceanTheme = {
|
|
2307
|
+
size: 18,
|
|
2308
|
+
unchecked: {
|
|
2309
|
+
backgroundColor: lateOceanColorPalette.white,
|
|
2310
|
+
borderWidth: '2px',
|
|
2311
|
+
borderColor: lateOceanColorPalette.black200
|
|
2312
|
+
},
|
|
2313
|
+
checked: {
|
|
2314
|
+
backgroundColor: lateOceanColorPalette.lateOcean,
|
|
2315
|
+
innerSize: 5,
|
|
2316
|
+
innerBackgroundColor: lateOceanColorPalette.white
|
|
2317
|
+
},
|
|
2318
|
+
disabled: {
|
|
2319
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
2320
|
+
borderColor: lateOceanColorPalette.black100
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
|
|
2324
|
+
const formsLateOceanTheme = {
|
|
2325
|
+
input: inputLateOceanTheme,
|
|
2326
|
+
radio: radioLateOceanTheme,
|
|
2327
|
+
inputField: inputFieldLateOceanTheme
|
|
2328
|
+
};
|
|
2329
|
+
|
|
2330
|
+
const fullScreenModalLateOceanTheme = {
|
|
2331
|
+
header: {
|
|
2332
|
+
paddingVertical: 12,
|
|
2333
|
+
paddingHorizontal: 16,
|
|
2334
|
+
borderColor: lateOceanColorPalette.black100
|
|
2335
|
+
}
|
|
2336
|
+
};
|
|
2337
|
+
|
|
2338
|
+
const iconButton = {
|
|
2339
|
+
backgroundColor: 'transparent',
|
|
2340
|
+
width: 40,
|
|
2341
|
+
height: 40,
|
|
2342
|
+
borderRadius: 20,
|
|
2343
|
+
borderWidth: 2,
|
|
2344
|
+
borderColor: 'transparent',
|
|
2345
|
+
transition: {
|
|
2346
|
+
property: 'all',
|
|
2347
|
+
duration: '200ms',
|
|
2348
|
+
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1);'
|
|
2349
|
+
},
|
|
2350
|
+
scale: {
|
|
2351
|
+
base: {
|
|
2352
|
+
default: 1,
|
|
2353
|
+
hover: 0.95,
|
|
2354
|
+
active: 0.95
|
|
2355
|
+
},
|
|
2356
|
+
medium: {
|
|
2357
|
+
hover: 1.05
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
disabled: {
|
|
2361
|
+
scale: 1,
|
|
2362
|
+
backgroundColor: buttonLateOceanTheme.secondary.disabledBackgroundColor,
|
|
2363
|
+
borderColor: buttonLateOceanTheme.secondary.disabledBorderColor
|
|
2364
|
+
},
|
|
2365
|
+
default: {
|
|
2366
|
+
pressedBackgroundColor: buttonLateOceanTheme.secondary.pressedBackgroundColor
|
|
2367
|
+
},
|
|
2368
|
+
white: {
|
|
2369
|
+
pressedBackgroundColor: buttonLateOceanTheme.white.hoverBackgroundColor
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
const listItemLateOceanTheme = {
|
|
2374
|
+
padding: '12px 16px',
|
|
2375
|
+
borderColor: colorsLateOceanTheme.separator,
|
|
2376
|
+
borderWidth: '1px',
|
|
2377
|
+
innerMargin: '8px'
|
|
2378
|
+
};
|
|
2379
|
+
|
|
2380
|
+
const shadowsLateOceanTheme = {
|
|
2381
|
+
medium: '0px 10px 20px rgba(41, 48, 51, 0.25)'
|
|
2382
|
+
};
|
|
2383
|
+
|
|
2384
|
+
const tagLateOceanTheme = {
|
|
2385
|
+
borderRadius: '10px',
|
|
2386
|
+
padding: '2px 12px',
|
|
2387
|
+
primary: {
|
|
2388
|
+
fill: {
|
|
2389
|
+
backgroundColor: lateOceanColorPalette.moonPurpleLight1,
|
|
2390
|
+
borderWidth: '0',
|
|
2391
|
+
borderColor: lateOceanColorPalette.transparent
|
|
2392
|
+
},
|
|
2393
|
+
outline: {
|
|
2394
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2395
|
+
borderWidth: '1px',
|
|
2396
|
+
borderColor: lateOceanColorPalette.lateOcean
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
default: {
|
|
2400
|
+
fill: {
|
|
2401
|
+
backgroundColor: lateOceanColorPalette.black50,
|
|
2402
|
+
borderWidth: '0',
|
|
2403
|
+
borderColor: lateOceanColorPalette.transparent
|
|
2404
|
+
},
|
|
2405
|
+
outline: {
|
|
2406
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2407
|
+
borderWidth: '1px',
|
|
2408
|
+
borderColor: lateOceanColorPalette.black1000
|
|
2409
|
+
}
|
|
2410
|
+
},
|
|
2411
|
+
danger: {
|
|
2412
|
+
fill: {
|
|
2413
|
+
backgroundColor: lateOceanColorPalette.warmEmbrace,
|
|
2414
|
+
borderWidth: '0',
|
|
2415
|
+
borderColor: lateOceanColorPalette.transparent
|
|
2416
|
+
},
|
|
2417
|
+
outline: {
|
|
2418
|
+
backgroundColor: lateOceanColorPalette.transparent,
|
|
2419
|
+
borderWidth: '1px',
|
|
2420
|
+
borderColor: colorsLateOceanTheme.danger
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
};
|
|
2424
|
+
|
|
2425
|
+
const tooltip = {
|
|
2426
|
+
backgroundColor: colorsLateOceanTheme.black,
|
|
2427
|
+
borderRadius: 10,
|
|
2428
|
+
opacity: 0.95,
|
|
2429
|
+
horizontalPadding: 16,
|
|
2430
|
+
verticalPadding: 4,
|
|
2431
|
+
floatingPadding: 8
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2434
|
+
const calcLineHeight = (fontSize, lineHeightMultiplier) => Math.round(fontSize * lineHeightMultiplier);
|
|
2435
|
+
|
|
2436
|
+
const createTypographyTypeConfig = (lineHeightMultiplier, baseAndSmallFontSize, mediumAndWideFontSize) => ({
|
|
2437
|
+
baseAndSmall: {
|
|
2438
|
+
fontSize: `${baseAndSmallFontSize}px`,
|
|
2439
|
+
lineHeight: `${calcLineHeight(lineHeightMultiplier, baseAndSmallFontSize)}px`
|
|
2440
|
+
},
|
|
2441
|
+
mediumAndWide: {
|
|
2442
|
+
fontSize: `${mediumAndWideFontSize}px`,
|
|
2443
|
+
lineHeight: `${calcLineHeight(lineHeightMultiplier, baseAndSmallFontSize)}px`
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
|
|
2447
|
+
const typographyLateOceanTheme = {
|
|
2448
|
+
colors: {
|
|
2449
|
+
black: lateOceanColorPalette.black1000,
|
|
2450
|
+
'black-light': lateOceanColorPalette.black555,
|
|
2451
|
+
white: lateOceanColorPalette.white,
|
|
2452
|
+
'white-light': lateOceanColorPalette.white,
|
|
2453
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
2454
|
+
'primary-light': lateOceanColorPalette.lateOceanLight1,
|
|
2455
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
2456
|
+
success: lateOceanColorPalette.viride,
|
|
2457
|
+
danger: lateOceanColorPalette.englishVermillon
|
|
2458
|
+
},
|
|
2459
|
+
types: {
|
|
2460
|
+
headers: {
|
|
2461
|
+
fontFamily: {
|
|
2462
|
+
regular: 'Moderat',
|
|
2463
|
+
bold: 'Moderat'
|
|
2464
|
+
},
|
|
2465
|
+
fontWeight: 400,
|
|
2466
|
+
fontStyle: 'normal',
|
|
2467
|
+
configs: {
|
|
2468
|
+
// also known as xxlarge
|
|
2469
|
+
header1: createTypographyTypeConfig(1.3, 38, 62),
|
|
2470
|
+
// also known as xlarge
|
|
2471
|
+
header2: createTypographyTypeConfig(1.3, 32, 48),
|
|
2472
|
+
// also known as medium
|
|
2473
|
+
header3: createTypographyTypeConfig(1.3, 24, 36),
|
|
2474
|
+
// also known as xsmall
|
|
2475
|
+
header4: createTypographyTypeConfig(1.3, 18, 24),
|
|
2476
|
+
// also known as xxsmall
|
|
2477
|
+
header5: createTypographyTypeConfig(1.3, 18, 18)
|
|
2478
|
+
}
|
|
2479
|
+
},
|
|
2480
|
+
bodies: {
|
|
2481
|
+
fontFamily: {
|
|
2482
|
+
regular: 'Noto Sans',
|
|
2483
|
+
bold: 'Noto Sans'
|
|
2484
|
+
},
|
|
2485
|
+
fontWeight: {
|
|
2486
|
+
regular: 400,
|
|
2487
|
+
bold: 700
|
|
2488
|
+
},
|
|
2489
|
+
fontStyle: {
|
|
2490
|
+
regular: 'normal',
|
|
2491
|
+
bold: 'normal'
|
|
2492
|
+
},
|
|
2493
|
+
configs: {
|
|
2494
|
+
'body-large': createTypographyTypeConfig(1.6, 18, 24),
|
|
2495
|
+
'body-medium': createTypographyTypeConfig(1.6, 18, 18),
|
|
2496
|
+
body: createTypographyTypeConfig(1.6, 16, 16),
|
|
2497
|
+
'body-small': createTypographyTypeConfig(1.6, 14, 14),
|
|
2498
|
+
'body-xsmall': createTypographyTypeConfig(1.6, 12, 12)
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
},
|
|
2502
|
+
link: {
|
|
2503
|
+
disabledColor: lateOceanColorPalette.black200
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
|
|
2507
|
+
const breakpoints = {
|
|
2508
|
+
values: {
|
|
2509
|
+
base: 0,
|
|
2510
|
+
small: 480,
|
|
2511
|
+
medium: 768,
|
|
2512
|
+
large: 1024,
|
|
2513
|
+
wide: 1280
|
|
2514
|
+
},
|
|
2515
|
+
min: {
|
|
2516
|
+
smallBreakpoint: 'min-width: 480px',
|
|
2517
|
+
mediumBreakpoint: 'min-width: 768px',
|
|
2518
|
+
largeBreakpoint: 'min-width: 1024px',
|
|
2519
|
+
wideBreakpoint: 'min-width: 1280px'
|
|
2520
|
+
},
|
|
2521
|
+
max: {
|
|
2522
|
+
smallBreakpoint: 'max-width: 479px',
|
|
2523
|
+
mediumBreakpoint: 'max-width: 767px',
|
|
2524
|
+
largeBreakpoint: 'max-width: 1023px',
|
|
2525
|
+
wideBreakpoint: 'max-width: 1279px'
|
|
2526
|
+
}
|
|
2527
|
+
}; // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
2528
|
+
// TODO : seperate brand color usage definition from proper theme definition and add typings - https://ornikar.atlassian.net/browse/CME-156
|
|
2529
|
+
|
|
2530
|
+
const theme = {
|
|
2531
|
+
spacing: 4,
|
|
2532
|
+
colors: colorsLateOceanTheme,
|
|
2533
|
+
palettes: {
|
|
2534
|
+
lateOcean: lateOceanColorPalette
|
|
2535
|
+
},
|
|
2536
|
+
avatar: avatarLateOceanTheme,
|
|
2537
|
+
button: buttonLateOceanTheme,
|
|
2538
|
+
card: cardLateOceanTheme,
|
|
2539
|
+
feedbackMessage: feedbackMessageLateOceanTheme,
|
|
2540
|
+
forms: formsLateOceanTheme,
|
|
2541
|
+
typography: typographyLateOceanTheme,
|
|
2542
|
+
tag: tagLateOceanTheme,
|
|
2543
|
+
shadows: shadowsLateOceanTheme,
|
|
2544
|
+
fullScreenModal: fullScreenModalLateOceanTheme,
|
|
2545
|
+
iconButton,
|
|
2546
|
+
listItem: listItemLateOceanTheme,
|
|
2547
|
+
tooltip
|
|
2548
|
+
};
|
|
2549
|
+
|
|
2550
|
+
function TimePicker() {
|
|
2551
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
2552
|
+
base: "body",
|
|
2553
|
+
children: "TimePicker is not implemented for the web"
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
var Arrow = function (props) {
|
|
2558
|
+
return /*#__PURE__*/jsxRuntime.jsx("svg", { ...props,
|
|
2559
|
+
children: /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
2560
|
+
fillRule: "evenodd",
|
|
2561
|
+
clipRule: "evenodd",
|
|
2562
|
+
d: "M22.399 6.128C20.939 7.722 19.767 9 18 9s-2.938-1.278-4.399-2.872C11.187 3.494 7.984 0 0 0h36c-7.984 0-11.187 3.494-13.601 6.128z",
|
|
2563
|
+
fill: "currentColor"
|
|
2564
|
+
})
|
|
2565
|
+
});
|
|
2566
|
+
};
|
|
2567
|
+
|
|
2568
|
+
Arrow.defaultProps = {
|
|
2569
|
+
width: "36",
|
|
2570
|
+
height: "8",
|
|
2571
|
+
viewBox: "0 0 36 9",
|
|
2572
|
+
fill: "none",
|
|
2573
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2574
|
+
};
|
|
2575
|
+
const StyledTooltipView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2576
|
+
displayName: "TooltipView__StyledTooltipView",
|
|
2577
|
+
componentId: "kitt-universal__sc-156zm6m-0"
|
|
2578
|
+
})(["align-items:center;"]);
|
|
2579
|
+
const StyledTooltipContent = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2580
|
+
displayName: "TooltipView__StyledTooltipContent",
|
|
2581
|
+
componentId: "kitt-universal__sc-156zm6m-1"
|
|
2582
|
+
})(["background-color:", ";border-radius:", "px;opacity:", ";padding:", ";"], ({
|
|
2583
|
+
theme
|
|
2584
|
+
}) => theme.kitt.tooltip.backgroundColor, ({
|
|
2585
|
+
theme
|
|
2586
|
+
}) => theme.kitt.tooltip.borderRadius, ({
|
|
2587
|
+
theme
|
|
2588
|
+
}) => theme.kitt.tooltip.opacity, ({
|
|
2589
|
+
theme
|
|
2590
|
+
}) => `${theme.kitt.tooltip.verticalPadding}px ${theme.kitt.tooltip.horizontalPadding}px`);
|
|
2591
|
+
|
|
2592
|
+
function ArrowView(props) {
|
|
2593
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
2594
|
+
return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.View, { ...props,
|
|
2595
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Arrow, {
|
|
2596
|
+
color: theme.kitt.tooltip.backgroundColor
|
|
2597
|
+
})
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
const StyledArrow = /*#__PURE__*/styled__default(ArrowView).withConfig({
|
|
2602
|
+
displayName: "TooltipView__StyledArrow",
|
|
2603
|
+
componentId: "kitt-universal__sc-156zm6m-2"
|
|
2604
|
+
})(["color:", ";transform:", ";"], ({
|
|
2605
|
+
theme
|
|
2606
|
+
}) => theme.kitt.tooltip.backgroundColor, ({
|
|
2607
|
+
$position
|
|
2608
|
+
}) => `rotate(${$position === 'bottom' ? 180 : 0}deg)`);
|
|
2609
|
+
function TooltipView({
|
|
2610
|
+
children,
|
|
2611
|
+
position
|
|
2612
|
+
}) {
|
|
2613
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StyledTooltipView, {
|
|
2614
|
+
children: [position === 'bottom' ? /*#__PURE__*/jsxRuntime.jsx(StyledArrow, {
|
|
2615
|
+
$position: position
|
|
2616
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(StyledTooltipContent, {
|
|
2617
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
2618
|
+
base: "body",
|
|
2619
|
+
color: "white",
|
|
2620
|
+
children: children
|
|
2621
|
+
})
|
|
2622
|
+
}), position === 'top' ? /*#__PURE__*/jsxRuntime.jsx(StyledArrow, {
|
|
2623
|
+
$position: position
|
|
2624
|
+
}) : null]
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
const tooltipDefaultPosition = 'top';
|
|
2629
|
+
const tooltipDefaultFloatingStrategy = {
|
|
2630
|
+
web: 'absolute'
|
|
2631
|
+
};
|
|
2632
|
+
|
|
2633
|
+
const StyledTooltipTrigger = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
2634
|
+
displayName: "Tooltipweb__StyledTooltipTrigger",
|
|
2635
|
+
componentId: "kitt-universal__sc-zn1y6f-0"
|
|
2636
|
+
})(["display:inline-flex;align-self:baseline;"]);
|
|
2637
|
+
const WebAnimatedTooltip = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2638
|
+
displayName: "Tooltipweb__WebAnimatedTooltip",
|
|
2639
|
+
componentId: "kitt-universal__sc-zn1y6f-1"
|
|
2640
|
+
})(["opacity:", ";transition:opacity 200ms;visibility:", ";"], ({
|
|
2641
|
+
theme,
|
|
2642
|
+
$visible
|
|
2643
|
+
}) => $visible ? theme.kitt.tooltip.opacity : 0, ({
|
|
2644
|
+
$visible
|
|
2645
|
+
}) => $visible ? 'visible' : 'hidden');
|
|
2646
|
+
|
|
2647
|
+
function getActualPosition(originalPosition, offsetMiddlewareData) {
|
|
2648
|
+
if (!offsetMiddlewareData) return originalPosition;
|
|
2649
|
+
|
|
2650
|
+
if (originalPosition === 'top') {
|
|
2651
|
+
return offsetMiddlewareData.y > 0 ? 'bottom' : originalPosition;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
if (originalPosition === 'bottom') {
|
|
2655
|
+
return offsetMiddlewareData.y < 0 ? 'top' : originalPosition;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
return originalPosition;
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
function Tooltip({
|
|
2662
|
+
children,
|
|
2663
|
+
defaultVisible,
|
|
2664
|
+
position = tooltipDefaultPosition,
|
|
2665
|
+
content,
|
|
2666
|
+
floatingStrategy = tooltipDefaultFloatingStrategy,
|
|
2667
|
+
floatingPadding,
|
|
2668
|
+
onUpdate
|
|
2669
|
+
}) {
|
|
2670
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
2671
|
+
const padding = floatingPadding || theme.kitt.tooltip.floatingPadding;
|
|
2672
|
+
const [visible, setVisible] = react$1.useState(Boolean(defaultVisible));
|
|
2673
|
+
const {
|
|
2674
|
+
x,
|
|
2675
|
+
y,
|
|
2676
|
+
reference,
|
|
2677
|
+
floating,
|
|
2678
|
+
strategy,
|
|
2679
|
+
update,
|
|
2680
|
+
refs,
|
|
2681
|
+
middlewareData
|
|
2682
|
+
} = reactDom.useFloating({
|
|
2683
|
+
placement: position,
|
|
2684
|
+
strategy: floatingStrategy?.web,
|
|
2685
|
+
middleware: [reactDom.offset(padding), reactDom.shift(), reactDom.flip()]
|
|
2686
|
+
}); // Update on scroll and resize for all relevant nodes
|
|
2687
|
+
|
|
2688
|
+
react$1.useEffect(() => {
|
|
2689
|
+
if (!refs.reference.current || !refs.floating.current) {
|
|
2690
|
+
return () => undefined;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
const parents = [...reactDom.getScrollParents(refs.reference.current), ...reactDom.getScrollParents(refs.floating.current)];
|
|
2694
|
+
parents.forEach(parent => {
|
|
2695
|
+
parent.addEventListener('scroll', update);
|
|
2696
|
+
parent.addEventListener('resize', update);
|
|
2697
|
+
});
|
|
2698
|
+
return () => {
|
|
2699
|
+
parents.forEach(parent => {
|
|
2700
|
+
parent.removeEventListener('scroll', update);
|
|
2701
|
+
parent.removeEventListener('resize', update);
|
|
2702
|
+
});
|
|
2703
|
+
};
|
|
2704
|
+
}, [refs.reference, refs.floating, update]);
|
|
2705
|
+
react$1.useEffect(() => {
|
|
2706
|
+
if (!onUpdate) return;
|
|
2707
|
+
onUpdate({
|
|
2708
|
+
x,
|
|
2709
|
+
y,
|
|
2710
|
+
reference,
|
|
2711
|
+
floating,
|
|
2712
|
+
strategy,
|
|
2713
|
+
update,
|
|
2714
|
+
refs,
|
|
2715
|
+
middlewareData
|
|
2716
|
+
});
|
|
2717
|
+
}, [x, y, reference, floating, strategy, update, refs, middlewareData, onUpdate]);
|
|
2718
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2719
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(StyledTooltipTrigger, {
|
|
2720
|
+
ref: reference,
|
|
2721
|
+
accessibilityRole: "button",
|
|
2722
|
+
onPress: () => setVisible(prev => !prev),
|
|
2723
|
+
onMouseEnter: () => {
|
|
2724
|
+
setVisible(true);
|
|
2725
|
+
},
|
|
2726
|
+
onFocus: () => {
|
|
2727
|
+
setVisible(true);
|
|
2728
|
+
},
|
|
2729
|
+
children: children
|
|
2730
|
+
}), /*#__PURE__*/jsxRuntime.jsx(WebAnimatedTooltip, {
|
|
2731
|
+
ref: floating,
|
|
2732
|
+
$visible: visible,
|
|
2733
|
+
accessibilityHidden: !visible,
|
|
2734
|
+
style: {
|
|
2735
|
+
position: strategy,
|
|
2736
|
+
top: 0,
|
|
2737
|
+
left: 0,
|
|
2738
|
+
transform: [{
|
|
2739
|
+
// @ts-expect-error translate3d is missing in react-native definitions, only supported in web
|
|
2740
|
+
translate3d: `${Math.round(x ?? 0)}px, ${Math.round(y ?? 0)}px, 0`
|
|
2741
|
+
}]
|
|
2742
|
+
},
|
|
2743
|
+
children: /*#__PURE__*/jsxRuntime.jsx(TooltipView, {
|
|
2744
|
+
position: getActualPosition(position, middlewareData.offset),
|
|
2745
|
+
children: content
|
|
2746
|
+
})
|
|
2747
|
+
})]
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
Tooltip.View = TooltipView;
|
|
2751
|
+
|
|
2752
|
+
const StyledTypographyEmoji = /*#__PURE__*/styled__default(Emoji).withConfig({
|
|
2753
|
+
displayName: "TypographyEmoji__StyledTypographyEmoji",
|
|
2754
|
+
componentId: "kitt-universal__sc-1if5guu-0"
|
|
2755
|
+
})(["align-self:center;", ""], ({
|
|
2756
|
+
size
|
|
2757
|
+
}) => {
|
|
2758
|
+
/* Style Twemoji: https://github.com/twitter/twemoji#inline-styles */
|
|
2759
|
+
return `
|
|
2760
|
+
margin: 0 ${size / 20}px 0 ${size / 10}px;
|
|
2761
|
+
transform: translateY(${size / 10 * 2}px);
|
|
2762
|
+
`;
|
|
2763
|
+
});
|
|
2764
|
+
function TypographyEmoji({
|
|
2765
|
+
emoji,
|
|
2766
|
+
base,
|
|
2767
|
+
small,
|
|
2768
|
+
medium,
|
|
2769
|
+
large
|
|
2770
|
+
}) {
|
|
2771
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
2772
|
+
const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(base, small, medium, large);
|
|
2773
|
+
const typeConfig = getTypographyTypeConfig(typeForCurrentWindowSize || 'body', theme);
|
|
2774
|
+
const typeConfigKey = getTypographyTypeConfigKey(theme);
|
|
2775
|
+
const {
|
|
2776
|
+
fontSize
|
|
2777
|
+
} = typeConfig[typeConfigKey];
|
|
2778
|
+
|
|
2779
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
2780
|
+
if (!fontSize.endsWith('px')) throw new Error(`Unexpected font-size value: ${fontSize}`);
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledTypographyEmoji, {
|
|
2784
|
+
size: parseInt(fontSize.slice(0, -2), 10),
|
|
2785
|
+
emoji: emoji
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react.styled("span")({
|
|
2790
|
+
name: "TypographyLinkWebWrapper",
|
|
2791
|
+
class: "tcwz3nt"
|
|
2792
|
+
}));
|
|
2793
|
+
const StyledLink = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Text).withConfig({
|
|
2794
|
+
displayName: "TypographyLink__StyledLink",
|
|
2795
|
+
componentId: "kitt-universal__sc-1o1zy30-0"
|
|
2796
|
+
})(["text-decoration:", ";", ";", ";"], ({
|
|
2797
|
+
$noUnderline
|
|
2798
|
+
}) => $noUnderline ? 'none' : 'underline', ({
|
|
2799
|
+
$disabled
|
|
2800
|
+
}) => {
|
|
2801
|
+
return `
|
|
2802
|
+
text-decoration-color: inherit;
|
|
2803
|
+
transition: color 0.2s ease-in-out;
|
|
2804
|
+
cursor: ${$disabled ? 'not-allowed' : 'pointer'};
|
|
2805
|
+
`;
|
|
2806
|
+
}, ({
|
|
2807
|
+
$disabled,
|
|
2808
|
+
theme
|
|
2809
|
+
}) => {
|
|
2810
|
+
if (!$disabled) return undefined;
|
|
2811
|
+
return `color: ${theme.kitt.typography.link.disabledColor};`;
|
|
2812
|
+
});
|
|
2813
|
+
function TypographyLink({
|
|
2814
|
+
children,
|
|
2815
|
+
disabled,
|
|
2816
|
+
noUnderline,
|
|
2817
|
+
href,
|
|
2818
|
+
hrefAttrs,
|
|
2819
|
+
onPress,
|
|
2820
|
+
...otherProps
|
|
2821
|
+
}) {
|
|
2822
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, { ...otherProps,
|
|
2823
|
+
accessibilityRole: "none",
|
|
2824
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
|
|
2825
|
+
as: TypographyLinkWebWrapper,
|
|
2826
|
+
"data-nounderline": noUnderline ? true : undefined,
|
|
2827
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledLink, {
|
|
2828
|
+
$disabled: disabled,
|
|
2829
|
+
$noUnderline: noUnderline,
|
|
2830
|
+
href: href,
|
|
2831
|
+
hrefAttrs: hrefAttrs,
|
|
2832
|
+
accessibilityRole: "link",
|
|
2833
|
+
dataSet: {
|
|
2834
|
+
// remove data-kitt-universal when we delete kitt web. See See :global(a) in Link styles.module.css
|
|
2835
|
+
'kitt-universal': 'true'
|
|
2836
|
+
},
|
|
2837
|
+
onPress: disabled ? undefined : onPress,
|
|
2838
|
+
children: children
|
|
2839
|
+
})
|
|
2840
|
+
})
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
function matchWindowSize(currentWidth, {
|
|
2845
|
+
minWidth,
|
|
2846
|
+
maxWidth
|
|
2847
|
+
}) {
|
|
2848
|
+
return currentWidth >= minWidth && (!maxWidth || currentWidth <= maxWidth);
|
|
2849
|
+
}
|
|
2850
|
+
function useMatchWindowSize(options) {
|
|
2851
|
+
const {
|
|
2852
|
+
width
|
|
2853
|
+
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
2854
|
+
return matchWindowSize(width, options);
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
function createWindowSizeHelper(currentWidth) {
|
|
2858
|
+
return {
|
|
2859
|
+
matchWindowSize: options => matchWindowSize(currentWidth, options),
|
|
2860
|
+
ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(currentWidth, options) ? valueIfTrue : valueIfFalse,
|
|
2861
|
+
mapWindowWidth: (...widthList) => {
|
|
2862
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
2863
|
+
widthList.slice(1).forEach(([minWidth], index) => {
|
|
2864
|
+
const previousMinWidth = widthList[index][0];
|
|
2865
|
+
|
|
2866
|
+
if (previousMinWidth > minWidth) {
|
|
2867
|
+
throw new Error(`mapWindowWidth: sort your values to be mobile first. ${minWidth} is < ${previousMinWidth}, so ${minWidth} should be before ${previousMinWidth}.`);
|
|
2868
|
+
}
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
const found = widthList.find(([minWidth, value]) => matchWindowSize(currentWidth, {
|
|
2873
|
+
minWidth: Number(minWidth)
|
|
2874
|
+
}));
|
|
2875
|
+
if (!found) return null;
|
|
2876
|
+
return found[1];
|
|
2877
|
+
}
|
|
2878
|
+
};
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
function useKittTheme() {
|
|
2882
|
+
const {
|
|
2883
|
+
width
|
|
2884
|
+
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
2885
|
+
return react$1.useMemo(() => {
|
|
2886
|
+
return {
|
|
2887
|
+
kitt: theme,
|
|
2888
|
+
responsive: createWindowSizeHelper(width),
|
|
2889
|
+
breakpoints
|
|
2890
|
+
};
|
|
2891
|
+
}, [width]);
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
function KittThemeProvider({
|
|
2895
|
+
children
|
|
2896
|
+
}) {
|
|
2897
|
+
const theme = useKittTheme();
|
|
2898
|
+
return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
|
|
2899
|
+
theme: theme,
|
|
2900
|
+
children: children
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
const KittThemeDecorator = addons.makeDecorator({
|
|
2904
|
+
name: 'ThemeDecorator',
|
|
2905
|
+
parameterName: 'theme',
|
|
2906
|
+
wrapper: (storyFn, context, {
|
|
2907
|
+
options = {},
|
|
2908
|
+
parameters = {}
|
|
2909
|
+
}) => {
|
|
2910
|
+
return /*#__PURE__*/jsxRuntime.jsx(KittThemeProvider, {
|
|
2911
|
+
children: storyFn(context)
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
});
|
|
2915
|
+
|
|
2916
|
+
function MatchWindowSize({
|
|
2917
|
+
children,
|
|
2918
|
+
...matchWindowSizeOptions
|
|
2919
|
+
}) {
|
|
2920
|
+
const match = useMatchWindowSize(matchWindowSizeOptions);
|
|
2921
|
+
if (!match) return null;
|
|
2922
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2923
|
+
children: children
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2927
|
+
exports.useWindowSize = BabelPluginStyledComponentsReactNative.useWindowDimensions;
|
|
2928
|
+
exports.Avatar = Avatar;
|
|
2929
|
+
exports.Button = Button;
|
|
2930
|
+
exports.Card = Card;
|
|
2931
|
+
exports.Emoji = Emoji;
|
|
2932
|
+
exports.ExternalLink = ExternalLink;
|
|
2933
|
+
exports.Flex = Flex;
|
|
2934
|
+
exports.FullScreenModal = FullScreenModal;
|
|
2935
|
+
exports.Icon = Icon;
|
|
2936
|
+
exports.IconButton = IconButton;
|
|
2937
|
+
exports.InputFeedback = InputFeedback;
|
|
2938
|
+
exports.InputField = InputField;
|
|
2939
|
+
exports.InputText = InputText;
|
|
2940
|
+
exports.KittBreakpoints = KittBreakpoints;
|
|
2941
|
+
exports.KittBreakpointsMax = KittBreakpointsMax;
|
|
2942
|
+
exports.KittThemeDecorator = KittThemeDecorator;
|
|
2943
|
+
exports.KittThemeProvider = KittThemeProvider;
|
|
2944
|
+
exports.Label = Label;
|
|
2945
|
+
exports.LargeLoader = LargeLoader;
|
|
2946
|
+
exports.ListItem = ListItem;
|
|
2947
|
+
exports.Loader = Loader;
|
|
2948
|
+
exports.MatchWindowSize = MatchWindowSize;
|
|
2949
|
+
exports.Message = Message;
|
|
2950
|
+
exports.Modal = Modal;
|
|
2951
|
+
exports.Notification = Notification;
|
|
2952
|
+
exports.Radio = Radio;
|
|
2953
|
+
exports.Section = DeprecatedSection;
|
|
2954
|
+
exports.Story = Story;
|
|
2955
|
+
exports.StoryBlock = StoryBlock;
|
|
2956
|
+
exports.StoryContainer = StoryContainer;
|
|
2957
|
+
exports.StoryDecorator = StoryDecorator;
|
|
2958
|
+
exports.StoryGrid = StoryGrid;
|
|
2959
|
+
exports.StorySection = StorySection;
|
|
2960
|
+
exports.StoryTitle = StoryTitle;
|
|
2961
|
+
exports.Tag = Tag;
|
|
2962
|
+
exports.TextArea = TextArea;
|
|
2963
|
+
exports.TimePicker = TimePicker;
|
|
2964
|
+
exports.Tooltip = Tooltip;
|
|
2965
|
+
exports.Typography = Typography;
|
|
2966
|
+
exports.TypographyEmoji = TypographyEmoji;
|
|
2967
|
+
exports.TypographyIcon = TypographyIcon;
|
|
2968
|
+
exports.TypographyLink = TypographyLink;
|
|
2969
|
+
exports.createWindowSizeHelper = createWindowSizeHelper;
|
|
2970
|
+
exports.matchWindowSize = matchWindowSize;
|
|
2971
|
+
exports.styledTextInputMixin = styledTextInputMixin;
|
|
2972
|
+
exports.theme = theme;
|
|
2973
|
+
exports.useKittTheme = useKittTheme;
|
|
2974
|
+
exports.useMatchWindowSize = useMatchWindowSize;
|
|
2975
|
+
exports.useStoryBlockColor = useStoryBlockColor;
|
|
2976
|
+
Object.keys(kittIcons).forEach(function (k) {
|
|
2977
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = kittIcons[k];
|
|
2978
|
+
});
|
|
2979
|
+
//# sourceMappingURL=index-node-14.17.cjs.web.js.map
|