@ornikar/kitt-universal 9.4.0 → 9.7.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/Actions/Actions.d.ts +13 -0
- package/dist/definitions/Actions/Actions.d.ts.map +1 -0
- package/dist/definitions/Actions/ActionsButton.d.ts +9 -0
- package/dist/definitions/Actions/ActionsButton.d.ts.map +1 -0
- package/dist/definitions/Actions/ActionsItem.d.ts +12 -0
- package/dist/definitions/Actions/ActionsItem.d.ts.map +1 -0
- package/dist/definitions/Choices/ChoiceItem.d.ts.map +1 -1
- package/dist/definitions/Choices/hooks/useNativeAnimation.d.ts +14 -0
- package/dist/definitions/Choices/hooks/useNativeAnimation.d.ts.map +1 -0
- package/dist/definitions/Choices/hooks/useNativeAnimation.web.d.ts +7 -0
- package/dist/definitions/Choices/hooks/useNativeAnimation.web.d.ts.map +1 -0
- package/dist/definitions/IconButton/IconButton.d.ts +1 -1
- package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts +1 -1
- package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts.map +1 -1
- package/dist/definitions/forms/InputField/InputField.d.ts.map +1 -1
- package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
- package/dist/definitions/index.d.ts +4 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +15 -15
- package/dist/definitions/native-base/acceptable-native-base-props.d.ts +5 -0
- package/dist/definitions/native-base/acceptable-native-base-props.d.ts.map +1 -1
- package/dist/definitions/native-base/layout.d.ts +4 -5
- package/dist/definitions/native-base/layout.d.ts.map +1 -1
- package/dist/definitions/native-base/primitives.d.ts +4 -5
- package/dist/definitions/native-base/primitives.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryBlock.d.ts +1 -1
- package/dist/definitions/themes/default.d.ts +7 -1
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/forms.d.ts +7 -1
- package/dist/definitions/themes/late-ocean/forms.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/inputField.d.ts +7 -1
- package/dist/definitions/themes/late-ocean/inputField.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyLink.d.ts +1 -1
- package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +629 -500
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +629 -500
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +629 -500
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +647 -602
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +564 -474
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.css +1 -1
- package/dist/index-node-14.17.cjs.web.js +573 -565
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.android.js +7 -1
- package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.ios.js +7 -1
- package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.js +7 -1
- package/dist/linaria-themes-browser-all.es.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.web.js +7 -1
- package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.js +7 -1
- package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.web.js +7 -1
- package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +27 -2
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const nativeBase = require('native-base');
|
|
6
|
+
const react = require('react');
|
|
7
|
+
const react$1 = require('@linaria/react');
|
|
5
8
|
const BabelPluginStyledComponentsReactNative = require('react-native');
|
|
6
|
-
const kittIcons = require('@ornikar/kitt-icons');
|
|
7
9
|
const styled = require('styled-components/native');
|
|
8
|
-
const react = require('react');
|
|
9
10
|
const jsxRuntime = require('react/jsx-runtime');
|
|
10
|
-
const
|
|
11
|
-
const react$1 = require('@linaria/react');
|
|
12
|
-
const Animated = require('react-native-reanimated');
|
|
11
|
+
const kittIcons = require('@ornikar/kitt-icons');
|
|
13
12
|
const twemojiParser = require('twemoji-parser');
|
|
14
13
|
const reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
15
14
|
const reactPortal = require('react-portal');
|
|
@@ -19,38 +18,225 @@ const addons = require('@storybook/addons');
|
|
|
19
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
20
19
|
|
|
21
20
|
const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
22
|
-
const Animated__default = /*#__PURE__*/_interopDefaultLegacy(Animated);
|
|
23
21
|
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
$
|
|
36
|
-
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
22
|
+
const Stack = nativeBase.Stack;
|
|
23
|
+
const VStack = nativeBase.VStack;
|
|
24
|
+
const HStack = nativeBase.HStack;
|
|
25
|
+
|
|
26
|
+
function warn(message) {
|
|
27
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
+
console.warn(message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function deprecatedMessage(symbol, deprecation, replaceBy) {
|
|
32
|
+
const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
|
|
33
|
+
warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
|
|
34
|
+
}
|
|
35
|
+
function deprecatedInComponent(component, deprecation, replaceBy) {
|
|
36
|
+
deprecatedMessage(`<${component} />`, deprecation, replaceBy);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
|
|
40
|
+
// type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
|
|
41
|
+
// export function withTheme<Props extends { theme: DefaultTheme }, C>(
|
|
42
|
+
// WrappedComponent: ComponentType<Props> & C,
|
|
43
|
+
// ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
|
|
44
|
+
// return function ThemedComponent(props) {
|
|
45
|
+
// const theme = useTheme();
|
|
46
|
+
// return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
|
|
47
|
+
// };
|
|
48
|
+
// }
|
|
49
|
+
function withTheme(WrappedComponent) {
|
|
50
|
+
// eslint-disable-next-line prefer-arrow-callback
|
|
51
|
+
return /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
52
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
53
|
+
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
54
|
+
ref: ref,
|
|
55
|
+
theme: theme,
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
60
|
|
|
61
|
+
const hasVariant = (button, variant) => {
|
|
62
|
+
return variant in button;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function getVariantValuesIfExist(theme, type, variant) {
|
|
66
|
+
const button = theme.kitt.button[type];
|
|
67
|
+
|
|
68
|
+
if (hasVariant(button, variant)) {
|
|
69
|
+
return button[variant];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return theme.kitt.button[type].default;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function isSubtle(type) {
|
|
76
|
+
return type.startsWith('subtle');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
80
|
+
name: "AnimatedButtonPressableContainer",
|
|
81
|
+
class: "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
|
|
82
|
+
vars: {
|
|
83
|
+
"a1vkj3mh-0": [({
|
|
84
|
+
$isStretch
|
|
85
|
+
}) => $isStretch ? 'inherit' : 'inline-flex'],
|
|
86
|
+
"a1vkj3mh-1": [({
|
|
87
|
+
$isStretch
|
|
88
|
+
}) => $isStretch ? 'stretch' : 'baseline'],
|
|
89
|
+
"a1vkj3mh-3": [({
|
|
90
|
+
theme
|
|
91
|
+
}) => theme.kitt.button.scale.medium.hover],
|
|
92
|
+
"a1vkj3mh-4": [({
|
|
93
|
+
theme,
|
|
94
|
+
$isDisabled
|
|
95
|
+
}) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
|
|
96
|
+
"a1vkj3mh-5": [({
|
|
97
|
+
theme,
|
|
98
|
+
$type,
|
|
99
|
+
$variant,
|
|
100
|
+
$isDisabled
|
|
101
|
+
}) => {
|
|
102
|
+
if ($isDisabled) return theme.kitt.button.disabled.default.hoverBackgroundColor;
|
|
103
|
+
return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
|
|
104
|
+
}],
|
|
105
|
+
"a1vkj3mh-6": [({
|
|
106
|
+
theme
|
|
107
|
+
}) => {
|
|
108
|
+
const {
|
|
109
|
+
duration,
|
|
110
|
+
timingFunction
|
|
111
|
+
} = theme.kitt.button.transition;
|
|
112
|
+
return `color, background, border-color, ${duration} ${timingFunction}`;
|
|
113
|
+
}],
|
|
114
|
+
"a1vkj3mh-7": [({
|
|
115
|
+
theme
|
|
116
|
+
}) => theme.kitt.button.borderRadius, "px"],
|
|
117
|
+
"a1vkj3mh-8": [({
|
|
118
|
+
theme
|
|
119
|
+
}) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
|
|
120
|
+
"a1vkj3mh-9": [({
|
|
121
|
+
$isDisabled
|
|
122
|
+
}) => $isDisabled ? 1 : 0],
|
|
123
|
+
"a1vkj3mh-10": [({
|
|
124
|
+
theme
|
|
125
|
+
}) => `-${theme.kitt.button.borderWidth.disabled}px`],
|
|
126
|
+
"a1vkj3mh-12": [({
|
|
127
|
+
theme
|
|
128
|
+
}) => `calc(100% - ${theme.kitt.button.borderWidth.disabled * 0.5}px)`],
|
|
129
|
+
"a1vkj3mh-14": [({
|
|
130
|
+
theme
|
|
131
|
+
}) => `${theme.kitt.button.borderWidth.disabled}px solid ${theme.kitt.button.disabled.default.borderColor}`],
|
|
132
|
+
"a1vkj3mh-15": [({
|
|
133
|
+
theme,
|
|
134
|
+
$type,
|
|
135
|
+
$variant
|
|
136
|
+
}) => `${theme.kitt.button.borderWidth.focus}px solid ${getVariantValuesIfExist(theme, $type, $variant).focusBorderColor}`],
|
|
137
|
+
"a1vkj3mh-16": [({
|
|
138
|
+
theme
|
|
139
|
+
}) => `-${theme.kitt.button.borderWidth.focus}px`],
|
|
140
|
+
"a1vkj3mh-18": [({
|
|
141
|
+
theme,
|
|
142
|
+
$type,
|
|
143
|
+
$isDisabled
|
|
144
|
+
}) => {
|
|
145
|
+
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
146
|
+
|
|
147
|
+
if (isSubtle($type)) {
|
|
148
|
+
return theme.kitt.button[$type].default.color;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return 'inherit';
|
|
152
|
+
}],
|
|
153
|
+
"a1vkj3mh-19": [({
|
|
154
|
+
theme,
|
|
155
|
+
$type,
|
|
156
|
+
$isDisabled
|
|
157
|
+
}) => {
|
|
158
|
+
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
159
|
+
|
|
160
|
+
if (isSubtle($type)) {
|
|
161
|
+
return theme.kitt.button[$type].default.hoverColor;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return 'inherit';
|
|
165
|
+
}],
|
|
166
|
+
"a1vkj3mh-20": [({
|
|
167
|
+
theme,
|
|
168
|
+
$type,
|
|
169
|
+
$isDisabled
|
|
170
|
+
}) => {
|
|
171
|
+
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
172
|
+
|
|
173
|
+
if (isSubtle($type)) {
|
|
174
|
+
return theme.kitt.button[$type].default.activeColor;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return 'inherit';
|
|
178
|
+
}]
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
182
|
+
$type,
|
|
183
|
+
$variant,
|
|
184
|
+
$isStretch,
|
|
185
|
+
disabled,
|
|
186
|
+
...props
|
|
187
|
+
}, ref) => {
|
|
188
|
+
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
|
|
189
|
+
ref: ref,
|
|
190
|
+
$type: $type,
|
|
191
|
+
$variant: $variant,
|
|
192
|
+
$isDisabled: !!disabled,
|
|
193
|
+
$isStretch: $isStretch,
|
|
194
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
|
|
195
|
+
disabled: disabled,
|
|
196
|
+
...props
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
202
|
+
displayName: "BaseStyledButtonPressable",
|
|
203
|
+
componentId: "kitt-universal__sc-4k8lse-0"
|
|
204
|
+
})(["position:relative;min-width:", "px;max-width:", ";width:", ";min-height:", "px;border-radius:", "px;flex-direction:row;align-items:center;justify-content:center;align-self:flex-start;background-color:", ";padding:", ";"], ({
|
|
205
|
+
theme
|
|
206
|
+
}) => theme.kitt.button.minWidth, ({
|
|
207
|
+
theme,
|
|
208
|
+
$isStretch
|
|
209
|
+
}) => $isStretch ? '100%' : `${theme.kitt.button.maxWidth}px`, ({
|
|
210
|
+
$isStretch
|
|
211
|
+
}) => $isStretch ? '100%' : 'auto', ({
|
|
212
|
+
theme
|
|
213
|
+
}) => theme.kitt.button.minHeight, ({
|
|
214
|
+
theme
|
|
215
|
+
}) => theme.kitt.button.borderRadius, ({
|
|
216
|
+
theme,
|
|
217
|
+
$isDisabled,
|
|
218
|
+
$type,
|
|
219
|
+
$variant
|
|
220
|
+
}) => {
|
|
221
|
+
if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
|
|
222
|
+
return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
|
|
223
|
+
}, ({
|
|
224
|
+
theme,
|
|
225
|
+
$size,
|
|
226
|
+
$isDisabled
|
|
227
|
+
}) => {
|
|
228
|
+
const {
|
|
229
|
+
large,
|
|
230
|
+
default: defaultPadding,
|
|
231
|
+
disabled: disabledPadding,
|
|
232
|
+
xLarge
|
|
233
|
+
} = theme.kitt.button.contentPadding;
|
|
234
|
+
if ($size === 'large') return large;
|
|
235
|
+
if ($size === 'xlarge') return xLarge;
|
|
236
|
+
if ($isDisabled) return disabledPadding;
|
|
237
|
+
return defaultPadding;
|
|
238
|
+
});
|
|
239
|
+
|
|
54
240
|
const KittBreakpoints = {
|
|
55
241
|
/**
|
|
56
242
|
* min-width: 0
|
|
@@ -271,301 +457,36 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
271
457
|
|
|
272
458
|
Typography.h5 = createHeading(5, 'header5');
|
|
273
459
|
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
$isRound,
|
|
282
|
-
$size,
|
|
283
|
-
$sizeVariant
|
|
284
|
-
}) => {
|
|
285
|
-
if ($isRound) return `${$size / 2}px`;
|
|
286
|
-
return `${$sizeVariant === 'large' ? theme.kitt.avatar.large.borderRadius : theme.kitt.avatar.borderRadius}px`;
|
|
287
|
-
}, ({
|
|
288
|
-
theme,
|
|
289
|
-
$isLight
|
|
290
|
-
}) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
|
|
460
|
+
const defaultIconSize = 20;
|
|
461
|
+
const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
462
|
+
displayName: "Icon__IconContainer",
|
|
463
|
+
componentId: "kitt-universal__sc-usm0ol-0"
|
|
464
|
+
})(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
|
|
465
|
+
$color
|
|
466
|
+
}) => $color, ({
|
|
291
467
|
$size
|
|
292
468
|
}) => $size, ({
|
|
293
469
|
$size
|
|
294
|
-
}) => $size
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
isLight,
|
|
303
|
-
sizeVariant
|
|
470
|
+
}) => $size, ({
|
|
471
|
+
$align = 'auto'
|
|
472
|
+
}) => $align);
|
|
473
|
+
function Icon({
|
|
474
|
+
icon,
|
|
475
|
+
size = defaultIconSize,
|
|
476
|
+
align,
|
|
477
|
+
color
|
|
304
478
|
}) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
source: {
|
|
308
|
-
uri: src
|
|
309
|
-
},
|
|
310
|
-
style: {
|
|
311
|
-
width: size,
|
|
312
|
-
height: size
|
|
313
|
-
},
|
|
314
|
-
accessibilityLabel: alt
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (firstname && lastname) {
|
|
319
|
-
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
320
|
-
base: sizeVariant === 'large' ? 'body-large' : 'body-small',
|
|
321
|
-
variant: sizeVariant === 'large' ? 'bold' : 'regular',
|
|
322
|
-
color: isLight ? 'black' : 'white',
|
|
323
|
-
children: getInitials(firstname, lastname)
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
328
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
|
|
329
|
-
color: isLight ? 'black' : 'white',
|
|
330
|
-
size: size / 2
|
|
479
|
+
const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
|
|
480
|
+
color
|
|
331
481
|
});
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
function Avatar({
|
|
335
|
-
size = 40,
|
|
336
|
-
round,
|
|
337
|
-
light,
|
|
338
|
-
sizeVariant,
|
|
339
|
-
...props
|
|
340
|
-
}) {
|
|
341
|
-
return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
|
|
482
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
|
|
483
|
+
$align: align,
|
|
342
484
|
$size: size,
|
|
343
|
-
$
|
|
344
|
-
|
|
345
|
-
$sizeVariant: sizeVariant,
|
|
346
|
-
children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
|
|
347
|
-
size: size,
|
|
348
|
-
isLight: light,
|
|
349
|
-
sizeVariant: sizeVariant,
|
|
350
|
-
...props
|
|
351
|
-
})
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
function warn(message) {
|
|
356
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
357
|
-
console.warn(message);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function deprecatedMessage(symbol, deprecation, replaceBy) {
|
|
361
|
-
const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
|
|
362
|
-
warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
|
|
363
|
-
}
|
|
364
|
-
function deprecatedInComponent(component, deprecation, replaceBy) {
|
|
365
|
-
deprecatedMessage(`<${component} />`, deprecation, replaceBy);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
|
|
369
|
-
// type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
|
|
370
|
-
// export function withTheme<Props extends { theme: DefaultTheme }, C>(
|
|
371
|
-
// WrappedComponent: ComponentType<Props> & C,
|
|
372
|
-
// ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
|
|
373
|
-
// return function ThemedComponent(props) {
|
|
374
|
-
// const theme = useTheme();
|
|
375
|
-
// return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
|
|
376
|
-
// };
|
|
377
|
-
// }
|
|
378
|
-
function withTheme(WrappedComponent) {
|
|
379
|
-
// eslint-disable-next-line prefer-arrow-callback
|
|
380
|
-
return /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
381
|
-
const theme = /*#__PURE__*/styled.useTheme();
|
|
382
|
-
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
383
|
-
ref: ref,
|
|
384
|
-
theme: theme,
|
|
385
|
-
...props
|
|
386
|
-
});
|
|
485
|
+
$color: color,
|
|
486
|
+
children: clonedIcon
|
|
387
487
|
});
|
|
388
488
|
}
|
|
389
489
|
|
|
390
|
-
const hasVariant = (button, variant) => {
|
|
391
|
-
return variant in button;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
function getVariantValuesIfExist(theme, type, variant) {
|
|
395
|
-
const button = theme.kitt.button[type];
|
|
396
|
-
|
|
397
|
-
if (hasVariant(button, variant)) {
|
|
398
|
-
return button[variant];
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return theme.kitt.button[type].default;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function isSubtle(type) {
|
|
405
|
-
return type.startsWith('subtle');
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
409
|
-
name: "AnimatedButtonPressableContainer",
|
|
410
|
-
class: "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
|
|
411
|
-
vars: {
|
|
412
|
-
"a1vkj3mh-0": [({
|
|
413
|
-
$isStretch
|
|
414
|
-
}) => $isStretch ? 'inherit' : 'inline-flex'],
|
|
415
|
-
"a1vkj3mh-1": [({
|
|
416
|
-
$isStretch
|
|
417
|
-
}) => $isStretch ? 'stretch' : 'baseline'],
|
|
418
|
-
"a1vkj3mh-3": [({
|
|
419
|
-
theme
|
|
420
|
-
}) => theme.kitt.button.scale.medium.hover],
|
|
421
|
-
"a1vkj3mh-4": [({
|
|
422
|
-
theme,
|
|
423
|
-
$isDisabled
|
|
424
|
-
}) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
|
|
425
|
-
"a1vkj3mh-5": [({
|
|
426
|
-
theme,
|
|
427
|
-
$type,
|
|
428
|
-
$variant,
|
|
429
|
-
$isDisabled
|
|
430
|
-
}) => {
|
|
431
|
-
if ($isDisabled) return theme.kitt.button.disabled.default.hoverBackgroundColor;
|
|
432
|
-
return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
|
|
433
|
-
}],
|
|
434
|
-
"a1vkj3mh-6": [({
|
|
435
|
-
theme
|
|
436
|
-
}) => {
|
|
437
|
-
const {
|
|
438
|
-
duration,
|
|
439
|
-
timingFunction
|
|
440
|
-
} = theme.kitt.button.transition;
|
|
441
|
-
return `color, background, border-color, ${duration} ${timingFunction}`;
|
|
442
|
-
}],
|
|
443
|
-
"a1vkj3mh-7": [({
|
|
444
|
-
theme
|
|
445
|
-
}) => theme.kitt.button.borderRadius, "px"],
|
|
446
|
-
"a1vkj3mh-8": [({
|
|
447
|
-
theme
|
|
448
|
-
}) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
|
|
449
|
-
"a1vkj3mh-9": [({
|
|
450
|
-
$isDisabled
|
|
451
|
-
}) => $isDisabled ? 1 : 0],
|
|
452
|
-
"a1vkj3mh-10": [({
|
|
453
|
-
theme
|
|
454
|
-
}) => `-${theme.kitt.button.borderWidth.disabled}px`],
|
|
455
|
-
"a1vkj3mh-12": [({
|
|
456
|
-
theme
|
|
457
|
-
}) => `calc(100% - ${theme.kitt.button.borderWidth.disabled * 0.5}px)`],
|
|
458
|
-
"a1vkj3mh-14": [({
|
|
459
|
-
theme
|
|
460
|
-
}) => `${theme.kitt.button.borderWidth.disabled}px solid ${theme.kitt.button.disabled.default.borderColor}`],
|
|
461
|
-
"a1vkj3mh-15": [({
|
|
462
|
-
theme,
|
|
463
|
-
$type,
|
|
464
|
-
$variant
|
|
465
|
-
}) => `${theme.kitt.button.borderWidth.focus}px solid ${getVariantValuesIfExist(theme, $type, $variant).focusBorderColor}`],
|
|
466
|
-
"a1vkj3mh-16": [({
|
|
467
|
-
theme
|
|
468
|
-
}) => `-${theme.kitt.button.borderWidth.focus}px`],
|
|
469
|
-
"a1vkj3mh-18": [({
|
|
470
|
-
theme,
|
|
471
|
-
$type,
|
|
472
|
-
$isDisabled
|
|
473
|
-
}) => {
|
|
474
|
-
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
475
|
-
|
|
476
|
-
if (isSubtle($type)) {
|
|
477
|
-
return theme.kitt.button[$type].default.color;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return 'inherit';
|
|
481
|
-
}],
|
|
482
|
-
"a1vkj3mh-19": [({
|
|
483
|
-
theme,
|
|
484
|
-
$type,
|
|
485
|
-
$isDisabled
|
|
486
|
-
}) => {
|
|
487
|
-
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
488
|
-
|
|
489
|
-
if (isSubtle($type)) {
|
|
490
|
-
return theme.kitt.button[$type].default.hoverColor;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
return 'inherit';
|
|
494
|
-
}],
|
|
495
|
-
"a1vkj3mh-20": [({
|
|
496
|
-
theme,
|
|
497
|
-
$type,
|
|
498
|
-
$isDisabled
|
|
499
|
-
}) => {
|
|
500
|
-
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
501
|
-
|
|
502
|
-
if (isSubtle($type)) {
|
|
503
|
-
return theme.kitt.button[$type].default.activeColor;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
return 'inherit';
|
|
507
|
-
}]
|
|
508
|
-
}
|
|
509
|
-
}));
|
|
510
|
-
const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
511
|
-
$type,
|
|
512
|
-
$variant,
|
|
513
|
-
$isStretch,
|
|
514
|
-
disabled,
|
|
515
|
-
...props
|
|
516
|
-
}, ref) => {
|
|
517
|
-
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
|
|
518
|
-
ref: ref,
|
|
519
|
-
$type: $type,
|
|
520
|
-
$variant: $variant,
|
|
521
|
-
$isDisabled: !!disabled,
|
|
522
|
-
$isStretch: $isStretch,
|
|
523
|
-
children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
|
|
524
|
-
disabled: disabled,
|
|
525
|
-
...props
|
|
526
|
-
})
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
531
|
-
displayName: "BaseStyledButtonPressable",
|
|
532
|
-
componentId: "kitt-universal__sc-4k8lse-0"
|
|
533
|
-
})(["position:relative;min-width:", "px;max-width:", ";width:", ";min-height:", "px;border-radius:", "px;flex-direction:row;align-items:center;justify-content:center;align-self:flex-start;background-color:", ";padding:", ";"], ({
|
|
534
|
-
theme
|
|
535
|
-
}) => theme.kitt.button.minWidth, ({
|
|
536
|
-
theme,
|
|
537
|
-
$isStretch
|
|
538
|
-
}) => $isStretch ? '100%' : `${theme.kitt.button.maxWidth}px`, ({
|
|
539
|
-
$isStretch
|
|
540
|
-
}) => $isStretch ? '100%' : 'auto', ({
|
|
541
|
-
theme
|
|
542
|
-
}) => theme.kitt.button.minHeight, ({
|
|
543
|
-
theme
|
|
544
|
-
}) => theme.kitt.button.borderRadius, ({
|
|
545
|
-
theme,
|
|
546
|
-
$isDisabled,
|
|
547
|
-
$type,
|
|
548
|
-
$variant
|
|
549
|
-
}) => {
|
|
550
|
-
if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
|
|
551
|
-
return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
|
|
552
|
-
}, ({
|
|
553
|
-
theme,
|
|
554
|
-
$size,
|
|
555
|
-
$isDisabled
|
|
556
|
-
}) => {
|
|
557
|
-
const {
|
|
558
|
-
large,
|
|
559
|
-
default: defaultPadding,
|
|
560
|
-
disabled: disabledPadding,
|
|
561
|
-
xLarge
|
|
562
|
-
} = theme.kitt.button.contentPadding;
|
|
563
|
-
if ($size === 'large') return large;
|
|
564
|
-
if ($size === 'xlarge') return xLarge;
|
|
565
|
-
if ($isDisabled) return disabledPadding;
|
|
566
|
-
return defaultPadding;
|
|
567
|
-
});
|
|
568
|
-
|
|
569
490
|
function TypographyIconSpecifiedColor({
|
|
570
491
|
color,
|
|
571
492
|
...props
|
|
@@ -706,7 +627,7 @@ function ButtonContentChildren({
|
|
|
706
627
|
};
|
|
707
628
|
return /*#__PURE__*/jsxRuntime.jsxs(StyledChildrenWithIcon, {
|
|
708
629
|
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
|
|
709
|
-
testID: "button
|
|
630
|
+
testID: "button.ButtonContent.leftButtonIcon",
|
|
710
631
|
icon: icon
|
|
711
632
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(StyledButtonText, {
|
|
712
633
|
base: "body",
|
|
@@ -736,105 +657,317 @@ const ButtonContentContainer = /*#__PURE__*/styled__default(BabelPluginStyledCom
|
|
|
736
657
|
}) => {
|
|
737
658
|
if (!$isSubtle) return undefined; // Needed for subtle type
|
|
738
659
|
|
|
739
|
-
return 'color: inherit';
|
|
740
|
-
});
|
|
741
|
-
function ButtonContent({
|
|
742
|
-
type,
|
|
743
|
-
variant,
|
|
744
|
-
isDisabled,
|
|
745
|
-
$isStretch,
|
|
746
|
-
icon,
|
|
660
|
+
return 'color: inherit';
|
|
661
|
+
});
|
|
662
|
+
function ButtonContent({
|
|
663
|
+
type,
|
|
664
|
+
variant,
|
|
665
|
+
isDisabled,
|
|
666
|
+
$isStretch,
|
|
667
|
+
icon,
|
|
668
|
+
children,
|
|
669
|
+
...props
|
|
670
|
+
}) {
|
|
671
|
+
const color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
672
|
+
return /*#__PURE__*/jsxRuntime.jsx(ButtonContentContainer, {
|
|
673
|
+
$isSubtle: isSubtle(type),
|
|
674
|
+
$isStretch: $isStretch,
|
|
675
|
+
$isIconOnly: Boolean(!children && icon),
|
|
676
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ButtonContentChildren, {
|
|
677
|
+
icon: icon,
|
|
678
|
+
type: type,
|
|
679
|
+
isDisabled: isDisabled,
|
|
680
|
+
color: color,
|
|
681
|
+
...props,
|
|
682
|
+
children: children
|
|
683
|
+
})
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const allowedGhostTypes = ['primary', 'default'];
|
|
688
|
+
|
|
689
|
+
const getButtonSize = ({
|
|
690
|
+
large,
|
|
691
|
+
xLarge,
|
|
692
|
+
size
|
|
693
|
+
}) => {
|
|
694
|
+
if (large) return 'large';
|
|
695
|
+
if (xLarge) return 'xlarge';
|
|
696
|
+
return size;
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
const Button = /*#__PURE__*/react.forwardRef(({
|
|
700
|
+
children,
|
|
701
|
+
type = 'default',
|
|
702
|
+
variant = 'default',
|
|
703
|
+
disabled,
|
|
704
|
+
stretch,
|
|
705
|
+
large,
|
|
706
|
+
xLarge,
|
|
707
|
+
icon,
|
|
708
|
+
size: sizeProp,
|
|
709
|
+
iconPosition = 'left',
|
|
710
|
+
testID,
|
|
711
|
+
href,
|
|
712
|
+
hrefAttrs,
|
|
713
|
+
accessibilityRole = 'button',
|
|
714
|
+
onPress
|
|
715
|
+
}, ref) => {
|
|
716
|
+
if ((process.env.NODE_ENV !== "production") && variant === 'ghost' && !allowedGhostTypes.includes(type)) {
|
|
717
|
+
throw new Error('variant=ghost is only allowed with type=primary or default');
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (large || xLarge) {
|
|
721
|
+
const deprecatedProp = large ? 'large' : 'xLarge';
|
|
722
|
+
deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
const size = getButtonSize({
|
|
726
|
+
large,
|
|
727
|
+
xLarge,
|
|
728
|
+
size: sizeProp
|
|
729
|
+
});
|
|
730
|
+
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
|
|
731
|
+
ref: ref,
|
|
732
|
+
accessibilityRole: accessibilityRole,
|
|
733
|
+
testID: testID,
|
|
734
|
+
href: href,
|
|
735
|
+
hrefAttrs: hrefAttrs,
|
|
736
|
+
disabled: disabled,
|
|
737
|
+
$isStretch: stretch,
|
|
738
|
+
$type: type,
|
|
739
|
+
$variant: variant,
|
|
740
|
+
onPress: onPress,
|
|
741
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
|
|
742
|
+
$type: type,
|
|
743
|
+
$variant: variant,
|
|
744
|
+
$isStretch: stretch,
|
|
745
|
+
$size: size,
|
|
746
|
+
$isDisabled: disabled,
|
|
747
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
|
|
748
|
+
type: type,
|
|
749
|
+
variant: variant,
|
|
750
|
+
$isStretch: stretch,
|
|
751
|
+
isDisabled: disabled,
|
|
752
|
+
icon: icon,
|
|
753
|
+
iconPosition: iconPosition,
|
|
754
|
+
children: children
|
|
755
|
+
}), null]
|
|
756
|
+
})
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
761
|
+
name: "StyledSpinningIconContainer",
|
|
762
|
+
class: "kitt-u_StyledSpinningIconContainer_ssn8o83"
|
|
763
|
+
}));
|
|
764
|
+
function SpinningIcon({
|
|
765
|
+
icon,
|
|
766
|
+
color
|
|
767
|
+
}) {
|
|
768
|
+
const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
|
|
769
|
+
color
|
|
770
|
+
});
|
|
771
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
|
|
772
|
+
children: clonedIcon
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function LoaderIcon({
|
|
777
|
+
color
|
|
778
|
+
}) {
|
|
779
|
+
return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
|
|
780
|
+
color: color,
|
|
781
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.ArcIcon, {})
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
const View = nativeBase.View;
|
|
786
|
+
const ScrollView = nativeBase.ScrollView;
|
|
787
|
+
const Pressable = nativeBase.Pressable;
|
|
788
|
+
|
|
789
|
+
function matchWindowSize({
|
|
790
|
+
width,
|
|
791
|
+
height
|
|
792
|
+
}, {
|
|
793
|
+
minWidth,
|
|
794
|
+
maxWidth,
|
|
795
|
+
minHeight,
|
|
796
|
+
maxHeight
|
|
797
|
+
}) {
|
|
798
|
+
const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
|
|
799
|
+
const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
|
|
800
|
+
return hasWidthMatched && hasHeightMatched;
|
|
801
|
+
}
|
|
802
|
+
function useMatchWindowSize(options) {
|
|
803
|
+
const {
|
|
804
|
+
width,
|
|
805
|
+
height
|
|
806
|
+
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
807
|
+
return matchWindowSize({
|
|
808
|
+
width,
|
|
809
|
+
height
|
|
810
|
+
}, options);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
function ActionsItem({
|
|
814
|
+
as,
|
|
815
|
+
onPress,
|
|
816
|
+
disabled,
|
|
817
|
+
icon,
|
|
818
|
+
...props
|
|
819
|
+
}) {
|
|
820
|
+
const isMedium = useMatchWindowSize({
|
|
821
|
+
minWidth: KittBreakpoints.MEDIUM
|
|
822
|
+
});
|
|
823
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
824
|
+
const mountedRef = react.useRef(false); // effect just for tracking mounted state, as onPress can unmount the ActionButton
|
|
825
|
+
|
|
826
|
+
react.useEffect(() => {
|
|
827
|
+
mountedRef.current = true;
|
|
828
|
+
return () => {
|
|
829
|
+
mountedRef.current = false;
|
|
830
|
+
};
|
|
831
|
+
}, []);
|
|
832
|
+
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
833
|
+
children: /*#__PURE__*/jsxRuntime.jsx(as, { ...props,
|
|
834
|
+
stretch: !isMedium ? true : undefined,
|
|
835
|
+
disabled: isLoading ? true : disabled,
|
|
836
|
+
icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
|
|
837
|
+
onPress: e => {
|
|
838
|
+
(async () => {
|
|
839
|
+
if (!onPress) return;
|
|
840
|
+
setIsLoading(true);
|
|
841
|
+
|
|
842
|
+
try {
|
|
843
|
+
await onPress(e);
|
|
844
|
+
|
|
845
|
+
if (mountedRef.current) {
|
|
846
|
+
setIsLoading(false);
|
|
847
|
+
}
|
|
848
|
+
} catch (err) {
|
|
849
|
+
if (mountedRef.current) {
|
|
850
|
+
setIsLoading(false);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
throw err;
|
|
854
|
+
}
|
|
855
|
+
})();
|
|
856
|
+
}
|
|
857
|
+
})
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
function ActionsButton({ ...props
|
|
862
|
+
}) {
|
|
863
|
+
return /*#__PURE__*/jsxRuntime.jsx(ActionsItem, {
|
|
864
|
+
as: Button,
|
|
865
|
+
...props
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function Actions({
|
|
747
870
|
children,
|
|
748
871
|
...props
|
|
749
872
|
}) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
873
|
+
return /*#__PURE__*/jsxRuntime.jsx(Stack, {
|
|
874
|
+
alignItems: {
|
|
875
|
+
base: 'stretch',
|
|
876
|
+
medium: 'center'
|
|
877
|
+
},
|
|
878
|
+
direction: {
|
|
879
|
+
base: 'column',
|
|
880
|
+
medium: 'row'
|
|
881
|
+
},
|
|
882
|
+
flex: 1,
|
|
883
|
+
...props,
|
|
884
|
+
space: "kitt.3",
|
|
885
|
+
children: children
|
|
763
886
|
});
|
|
764
887
|
}
|
|
888
|
+
Actions.Button = ActionsButton;
|
|
889
|
+
Actions.Item = ActionsItem;
|
|
765
890
|
|
|
766
|
-
const
|
|
891
|
+
const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
|
|
767
892
|
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
893
|
+
const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
894
|
+
displayName: "Avatar__StyledAvatarView",
|
|
895
|
+
componentId: "kitt-universal__sc-9miubv-0"
|
|
896
|
+
})(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
|
|
897
|
+
theme,
|
|
898
|
+
$isRound,
|
|
899
|
+
$size,
|
|
900
|
+
$sizeVariant
|
|
772
901
|
}) => {
|
|
773
|
-
if (
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
902
|
+
if ($isRound) return `${$size / 2}px`;
|
|
903
|
+
return `${$sizeVariant === 'large' ? theme.kitt.avatar.large.borderRadius : theme.kitt.avatar.borderRadius}px`;
|
|
904
|
+
}, ({
|
|
905
|
+
theme,
|
|
906
|
+
$isLight
|
|
907
|
+
}) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
|
|
908
|
+
$size
|
|
909
|
+
}) => $size, ({
|
|
910
|
+
$size
|
|
911
|
+
}) => $size);
|
|
777
912
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
913
|
+
function AvatarContent({
|
|
914
|
+
size,
|
|
915
|
+
src,
|
|
916
|
+
firstname,
|
|
917
|
+
lastname,
|
|
918
|
+
alt,
|
|
919
|
+
isLight,
|
|
920
|
+
sizeVariant
|
|
921
|
+
}) {
|
|
922
|
+
if (src) {
|
|
923
|
+
return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
|
|
924
|
+
source: {
|
|
925
|
+
uri: src
|
|
926
|
+
},
|
|
927
|
+
style: {
|
|
928
|
+
width: size,
|
|
929
|
+
height: size
|
|
930
|
+
},
|
|
931
|
+
accessibilityLabel: alt
|
|
932
|
+
});
|
|
797
933
|
}
|
|
798
934
|
|
|
799
|
-
if (
|
|
800
|
-
|
|
801
|
-
|
|
935
|
+
if (firstname && lastname) {
|
|
936
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
937
|
+
base: sizeVariant === 'large' ? 'body-large' : 'body-small',
|
|
938
|
+
variant: sizeVariant === 'large' ? 'bold' : 'regular',
|
|
939
|
+
color: isLight ? 'black' : 'white',
|
|
940
|
+
children: getInitials(firstname, lastname)
|
|
941
|
+
});
|
|
802
942
|
}
|
|
803
943
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
size:
|
|
944
|
+
return /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
945
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
|
|
946
|
+
color: isLight ? 'black' : 'white',
|
|
947
|
+
size: size / 2
|
|
808
948
|
});
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
variant: variant,
|
|
829
|
-
$isStretch: stretch,
|
|
830
|
-
isDisabled: disabled,
|
|
831
|
-
icon: icon,
|
|
832
|
-
iconPosition: iconPosition,
|
|
833
|
-
children: children
|
|
834
|
-
}), null]
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
function Avatar({
|
|
952
|
+
size = 40,
|
|
953
|
+
round,
|
|
954
|
+
light,
|
|
955
|
+
sizeVariant,
|
|
956
|
+
...props
|
|
957
|
+
}) {
|
|
958
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
|
|
959
|
+
$size: size,
|
|
960
|
+
$isRound: round,
|
|
961
|
+
$isLight: light,
|
|
962
|
+
$sizeVariant: sizeVariant,
|
|
963
|
+
children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
|
|
964
|
+
size: size,
|
|
965
|
+
isLight: light,
|
|
966
|
+
sizeVariant: sizeVariant,
|
|
967
|
+
...props
|
|
835
968
|
})
|
|
836
969
|
});
|
|
837
|
-
}
|
|
970
|
+
}
|
|
838
971
|
|
|
839
972
|
const Container$3 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
840
973
|
displayName: "Card__Container",
|
|
@@ -862,6 +995,14 @@ function Card({
|
|
|
862
995
|
});
|
|
863
996
|
}
|
|
864
997
|
|
|
998
|
+
const useNativeAnimation = () => {
|
|
999
|
+
return {
|
|
1000
|
+
onPressIn: () => {},
|
|
1001
|
+
onPressOut: () => {},
|
|
1002
|
+
backgroundStyles: undefined
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
|
|
865
1006
|
function getCurrentTextColor({
|
|
866
1007
|
isDisabled,
|
|
867
1008
|
isSelected,
|
|
@@ -896,7 +1037,7 @@ const DisabledBorder = /*#__PURE__*/styled__default(BabelPluginStyledComponentsR
|
|
|
896
1037
|
} = theme.kitt.choices.item.disabled.border;
|
|
897
1038
|
return styled.css(["border:", "px solid ", ";"], width, color);
|
|
898
1039
|
});
|
|
899
|
-
const ChoiceItemView = /*#__PURE__*/styled__default(
|
|
1040
|
+
const ChoiceItemView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
900
1041
|
displayName: "ChoiceItem__ChoiceItemView",
|
|
901
1042
|
componentId: "kitt-universal__sc-wuv3y6-1"
|
|
902
1043
|
})(["position:relative;border-radius:", "px;background-color:", ";", ";", ""], ({
|
|
@@ -957,74 +1098,11 @@ function ChoiceItem({
|
|
|
957
1098
|
onBlur,
|
|
958
1099
|
onFocus
|
|
959
1100
|
}) {
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
duration: theme.kitt.choices.item.transition.duration
|
|
966
|
-
});
|
|
967
|
-
};
|
|
968
|
-
|
|
969
|
-
_f._closure = {
|
|
970
|
-
withTiming: Animated.withTiming,
|
|
971
|
-
pressed,
|
|
972
|
-
theme: {
|
|
973
|
-
kitt: {
|
|
974
|
-
choices: {
|
|
975
|
-
item: {
|
|
976
|
-
transition: {
|
|
977
|
-
duration: theme.kitt.choices.item.transition.duration
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
_f.asString = "function _f(){const{withTiming,pressed,theme}=jsThis._closure;{return withTiming(pressed.value?1:0,{duration:theme.kitt.choices.item.transition.duration});}}";
|
|
985
|
-
_f.__workletHash = 1120030177160;
|
|
986
|
-
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (180:35)";
|
|
987
|
-
return _f;
|
|
988
|
-
}());
|
|
989
|
-
Animated.useAnimatedStyle(function () {
|
|
990
|
-
const _f = function () {
|
|
991
|
-
const {
|
|
992
|
-
default: defaultBg,
|
|
993
|
-
pressed: pressedBg,
|
|
994
|
-
selected: selectedBg,
|
|
995
|
-
disabled: disabledBg
|
|
996
|
-
} = theme.kitt.choices.item.backgroundColor;
|
|
997
|
-
if (disabled) return {
|
|
998
|
-
backgroundColor: disabledBg
|
|
999
|
-
};
|
|
1000
|
-
if (selected) return {
|
|
1001
|
-
backgroundColor: selectedBg
|
|
1002
|
-
};
|
|
1003
|
-
return {
|
|
1004
|
-
backgroundColor: Animated.interpolateColor(progress.value, [0, 1], [defaultBg, pressedBg])
|
|
1005
|
-
};
|
|
1006
|
-
};
|
|
1007
|
-
|
|
1008
|
-
_f._closure = {
|
|
1009
|
-
theme: {
|
|
1010
|
-
kitt: {
|
|
1011
|
-
choices: {
|
|
1012
|
-
item: {
|
|
1013
|
-
backgroundColor: theme.kitt.choices.item.backgroundColor
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
},
|
|
1018
|
-
disabled,
|
|
1019
|
-
selected,
|
|
1020
|
-
interpolateColor: Animated.interpolateColor,
|
|
1021
|
-
progress
|
|
1022
|
-
};
|
|
1023
|
-
_f.asString = "function _f(){const{theme,disabled,selected,interpolateColor,progress}=jsThis._closure;{const{default:defaultBg,pressed:pressedBg,selected:selectedBg,disabled:disabledBg}=theme.kitt.choices.item.backgroundColor;if(disabled)return{backgroundColor:disabledBg};if(selected)return{backgroundColor:selectedBg};return{backgroundColor:interpolateColor(progress.value,[0,1],[defaultBg,pressedBg])};}}";
|
|
1024
|
-
_f.__workletHash = 15506726129309;
|
|
1025
|
-
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Choices/ChoiceItem.tsx (184:44)";
|
|
1026
|
-
return _f;
|
|
1027
|
-
}());
|
|
1101
|
+
const {
|
|
1102
|
+
onPressIn,
|
|
1103
|
+
onPressOut,
|
|
1104
|
+
backgroundStyles
|
|
1105
|
+
} = useNativeAnimation();
|
|
1028
1106
|
|
|
1029
1107
|
const handleChange = () => {
|
|
1030
1108
|
if (!onChange) return; // Checkbox can be toggled
|
|
@@ -1037,7 +1115,7 @@ function ChoiceItem({
|
|
|
1037
1115
|
onChange(value);
|
|
1038
1116
|
};
|
|
1039
1117
|
|
|
1040
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
1118
|
+
return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
|
|
1041
1119
|
disabled: disabled,
|
|
1042
1120
|
accessibilityRole: type,
|
|
1043
1121
|
accessibilityState: {
|
|
@@ -1051,12 +1129,8 @@ function ChoiceItem({
|
|
|
1051
1129
|
handleChange();
|
|
1052
1130
|
if (onBlur) onBlur(e);
|
|
1053
1131
|
},
|
|
1054
|
-
onPressIn:
|
|
1055
|
-
|
|
1056
|
-
},
|
|
1057
|
-
onPressOut: () => {
|
|
1058
|
-
pressed.value = false;
|
|
1059
|
-
},
|
|
1132
|
+
onPressIn: onPressIn,
|
|
1133
|
+
onPressOut: onPressOut,
|
|
1060
1134
|
children: ({
|
|
1061
1135
|
isHovered,
|
|
1062
1136
|
isPressed
|
|
@@ -1683,8 +1757,14 @@ const input = {
|
|
|
1683
1757
|
};
|
|
1684
1758
|
|
|
1685
1759
|
const inputField = {
|
|
1760
|
+
containerPaddingTop: 5,
|
|
1761
|
+
containerPaddingBottom: 10,
|
|
1762
|
+
feedbackPaddingTop: {
|
|
1763
|
+
base: 5,
|
|
1764
|
+
small: 10
|
|
1765
|
+
},
|
|
1686
1766
|
labelContainerPaddingBottom: 5,
|
|
1687
|
-
|
|
1767
|
+
labelFeedbackMarginLeft: 6
|
|
1688
1768
|
};
|
|
1689
1769
|
|
|
1690
1770
|
const inputTag = {
|
|
@@ -1941,30 +2021,6 @@ const theme = {
|
|
|
1941
2021
|
navigationModal
|
|
1942
2022
|
};
|
|
1943
2023
|
|
|
1944
|
-
function matchWindowSize({
|
|
1945
|
-
width,
|
|
1946
|
-
height
|
|
1947
|
-
}, {
|
|
1948
|
-
minWidth,
|
|
1949
|
-
maxWidth,
|
|
1950
|
-
minHeight,
|
|
1951
|
-
maxHeight
|
|
1952
|
-
}) {
|
|
1953
|
-
const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
|
|
1954
|
-
const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
|
|
1955
|
-
return hasWidthMatched && hasHeightMatched;
|
|
1956
|
-
}
|
|
1957
|
-
function useMatchWindowSize(options) {
|
|
1958
|
-
const {
|
|
1959
|
-
width,
|
|
1960
|
-
height
|
|
1961
|
-
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
1962
|
-
return matchWindowSize({
|
|
1963
|
-
width,
|
|
1964
|
-
height
|
|
1965
|
-
}, options);
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
2024
|
// eslint-disable-next-line no-restricted-imports
|
|
1969
2025
|
function createWindowSizeHelper(dimensions) {
|
|
1970
2026
|
return {
|
|
@@ -2381,42 +2437,26 @@ function InputFeedback({
|
|
|
2381
2437
|
});
|
|
2382
2438
|
}
|
|
2383
2439
|
|
|
2384
|
-
const FieldContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2385
|
-
displayName: "InputField__FieldContainer",
|
|
2386
|
-
componentId: "kitt-universal__sc-13fkixs-0"
|
|
2387
|
-
})(["padding:5px 0 10px;"]);
|
|
2388
|
-
const FeedbackContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2389
|
-
displayName: "InputField__FeedbackContainer",
|
|
2390
|
-
componentId: "kitt-universal__sc-13fkixs-1"
|
|
2391
|
-
})(["", ";"], ({
|
|
2392
|
-
theme
|
|
2393
|
-
}) => theme.responsive.ifWindowSizeMatches({
|
|
2394
|
-
minWidth: KittBreakpoints.SMALL
|
|
2395
|
-
}, 'padding-top: 10px', 'padding-top: 5px'));
|
|
2396
|
-
const FieldLabelContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2397
|
-
displayName: "InputField__FieldLabelContainer",
|
|
2398
|
-
componentId: "kitt-universal__sc-13fkixs-2"
|
|
2399
|
-
})(["flex-direction:row;align-items:center;padding-bottom:", "px;"], ({
|
|
2400
|
-
theme
|
|
2401
|
-
}) => theme.kitt.forms.inputField.labelContainerPaddingBottom);
|
|
2402
|
-
const LabelContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
2403
|
-
displayName: "InputField__LabelContainer",
|
|
2404
|
-
componentId: "kitt-universal__sc-13fkixs-3"
|
|
2405
|
-
})(["margin-right:", "px;"], ({
|
|
2406
|
-
theme
|
|
2407
|
-
}) => theme.kitt.forms.inputField.iconMarginLeft);
|
|
2408
2440
|
function InputField({
|
|
2409
2441
|
label,
|
|
2410
2442
|
labelFeedback,
|
|
2411
2443
|
input,
|
|
2412
2444
|
feedback
|
|
2413
2445
|
}) {
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2446
|
+
const theme = /*#__PURE__*/styled.useTheme();
|
|
2447
|
+
return /*#__PURE__*/jsxRuntime.jsxs(View, {
|
|
2448
|
+
paddingTop: theme.kitt.forms.inputField.containerPaddingTop,
|
|
2449
|
+
paddingBottom: theme.kitt.forms.inputField.containerPaddingBottom,
|
|
2450
|
+
children: [label ? /*#__PURE__*/jsxRuntime.jsxs(View, {
|
|
2451
|
+
flexDirection: "row",
|
|
2452
|
+
alignItems: "center",
|
|
2453
|
+
paddingBottom: theme.kitt.forms.inputField.labelContainerPaddingBottom,
|
|
2454
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(View, {
|
|
2455
|
+
marginRight: theme.kitt.forms.inputField.labelFeedbackMarginLeft,
|
|
2417
2456
|
children: label
|
|
2418
2457
|
}), labelFeedback]
|
|
2419
|
-
}) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(
|
|
2458
|
+
}) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
2459
|
+
paddingTop: theme.kitt.forms.inputField.feedbackPaddingTop,
|
|
2420
2460
|
children: feedback
|
|
2421
2461
|
}) : null]
|
|
2422
2462
|
});
|
|
@@ -2795,22 +2835,6 @@ function FullScreenModal({
|
|
|
2795
2835
|
FullScreenModal.Header = FullScreenModalHeader;
|
|
2796
2836
|
FullScreenModal.Body = FullScreenModalBody;
|
|
2797
2837
|
|
|
2798
|
-
const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
2799
|
-
name: "StyledSpinningIconContainer",
|
|
2800
|
-
class: "kitt-u_StyledSpinningIconContainer_ssn8o83"
|
|
2801
|
-
}));
|
|
2802
|
-
function SpinningIcon({
|
|
2803
|
-
icon,
|
|
2804
|
-
color
|
|
2805
|
-
}) {
|
|
2806
|
-
const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
|
|
2807
|
-
color
|
|
2808
|
-
});
|
|
2809
|
-
return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
|
|
2810
|
-
children: clonedIcon
|
|
2811
|
-
});
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
2838
|
function StyleWebWrapper({
|
|
2815
2839
|
as,
|
|
2816
2840
|
children,
|
|
@@ -3089,15 +3113,6 @@ ListItem.Content = ListItemContent;
|
|
|
3089
3113
|
ListItem.SideContent = ListItemSideContent;
|
|
3090
3114
|
ListItem.SideContainer = ListItemSideContainer;
|
|
3091
3115
|
|
|
3092
|
-
function LoaderIcon({
|
|
3093
|
-
color
|
|
3094
|
-
}) {
|
|
3095
|
-
return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
|
|
3096
|
-
color: color,
|
|
3097
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.ArcIcon, {})
|
|
3098
|
-
});
|
|
3099
|
-
}
|
|
3100
|
-
|
|
3101
3116
|
function IconContent({
|
|
3102
3117
|
type,
|
|
3103
3118
|
color
|
|
@@ -3625,14 +3640,6 @@ function KittNativeBaseProvider({
|
|
|
3625
3640
|
});
|
|
3626
3641
|
}
|
|
3627
3642
|
|
|
3628
|
-
const Stack = nativeBase.Stack;
|
|
3629
|
-
const VStack = nativeBase.VStack;
|
|
3630
|
-
const HStack = nativeBase.HStack;
|
|
3631
|
-
|
|
3632
|
-
const View = nativeBase.View;
|
|
3633
|
-
const ScrollView = nativeBase.ScrollView;
|
|
3634
|
-
const Pressable = nativeBase.Pressable;
|
|
3635
|
-
|
|
3636
3643
|
const ViewWithPadding = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
3637
3644
|
displayName: "ContentPadding__ViewWithPadding",
|
|
3638
3645
|
componentId: "kitt-universal__sc-1rprqcv-0"
|
|
@@ -4826,6 +4833,7 @@ function MatchWindowSize({
|
|
|
4826
4833
|
}
|
|
4827
4834
|
|
|
4828
4835
|
exports.useWindowSize = BabelPluginStyledComponentsReactNative.useWindowDimensions;
|
|
4836
|
+
exports.Actions = Actions;
|
|
4829
4837
|
exports.Avatar = Avatar;
|
|
4830
4838
|
exports.Button = Button;
|
|
4831
4839
|
exports.Card = Card;
|