@ornikar/kitt-universal 3.3.0 → 3.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/Avatar/Avatar.d.ts +9 -4
- package/dist/definitions/Avatar/Avatar.d.ts.map +1 -1
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts +2 -2
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableIconButton.d.ts.map +1 -1
- package/dist/definitions/Skeleton/Skeleton.d.ts +14 -0
- package/dist/definitions/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/definitions/Skeleton/SkeletonContent.d.ts +8 -0
- package/dist/definitions/Skeleton/SkeletonContent.d.ts.map +1 -0
- package/dist/definitions/Skeleton/SkeletonContent.web.d.ts +7 -0
- package/dist/definitions/Skeleton/SkeletonContent.web.d.ts.map +1 -0
- package/dist/definitions/forms/TextArea/TextArea.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +5 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/themes/default.d.ts +23 -31
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/avatarLateOceanTheme.d.ts +9 -10
- package/dist/definitions/themes/late-ocean/avatarLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/skeletonTheme.d.ts +7 -0
- package/dist/definitions/themes/late-ocean/skeletonTheme.d.ts.map +1 -0
- package/dist/definitions/themes/late-ocean/typographyLateOceanTheme.d.ts +2 -0
- package/dist/definitions/themes/late-ocean/typographyLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/typography/Typography.d.ts +2 -0
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/useKittTheme.d.ts +0 -2
- package/dist/definitions/useKittTheme.d.ts.map +1 -1
- package/dist/definitions/utils/hexToRgba.d.ts +2 -0
- package/dist/definitions/utils/hexToRgba.d.ts.map +1 -0
- package/dist/definitions/utils/withTheme.d.ts +2 -2
- package/dist/definitions/utils/withTheme.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +337 -151
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.css +2 -2
- package/dist/index-browser-all.es.ios.js +337 -151
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +296 -129
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +294 -166
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.css +2 -2
- package/dist/index-node-14.17.cjs.js +247 -78
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.css +4 -3
- package/dist/index-node-14.17.cjs.web.js +234 -103
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/styles.css +4 -3
- package/dist/tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const BabelPluginStyledComponentsReactNative = require('react-native');
|
|
6
6
|
const kittIcons = require('@ornikar/kitt-icons');
|
|
7
7
|
const styled = require('styled-components/native');
|
|
8
|
-
const react
|
|
9
|
-
const react = require('@linaria/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const react$1 = require('@linaria/react');
|
|
10
10
|
const jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
const twemojiParser = require('twemoji-parser');
|
|
12
12
|
const reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
@@ -28,16 +28,18 @@ const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
28
28
|
// };
|
|
29
29
|
// }
|
|
30
30
|
function withTheme(WrappedComponent) {
|
|
31
|
-
|
|
31
|
+
// eslint-disable-next-line prefer-arrow-callback
|
|
32
|
+
return /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
32
33
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
33
34
|
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
35
|
+
ref: ref,
|
|
34
36
|
theme: theme,
|
|
35
37
|
...props
|
|
36
38
|
});
|
|
37
|
-
};
|
|
39
|
+
});
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react.styled("div")({
|
|
42
|
+
const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
41
43
|
name: "StyledSpinningIconContainer",
|
|
42
44
|
class: "ssn8o83"
|
|
43
45
|
}));
|
|
@@ -68,7 +70,7 @@ function Icon({
|
|
|
68
70
|
align,
|
|
69
71
|
color
|
|
70
72
|
}) {
|
|
71
|
-
const clonedIcon = /*#__PURE__*/react
|
|
73
|
+
const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
|
|
72
74
|
color
|
|
73
75
|
});
|
|
74
76
|
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
|
|
@@ -129,10 +131,10 @@ const KittBreakpointsMax = {
|
|
|
129
131
|
LARGE: KittBreakpoints.WIDE - 1
|
|
130
132
|
};
|
|
131
133
|
|
|
132
|
-
const IsHeaderTypographyContext = /*#__PURE__*/react
|
|
133
|
-
const TypographyColorContext = /*#__PURE__*/react
|
|
134
|
+
const IsHeaderTypographyContext = /*#__PURE__*/react.createContext(undefined);
|
|
135
|
+
const TypographyColorContext = /*#__PURE__*/react.createContext('black');
|
|
134
136
|
function useTypographyColor() {
|
|
135
|
-
return react
|
|
137
|
+
return react.useContext(TypographyColorContext);
|
|
136
138
|
}
|
|
137
139
|
const getTypographyTypeConfigKey = theme => {
|
|
138
140
|
const isMediumOrAbove = theme.responsive.matchWindowSize({
|
|
@@ -197,6 +199,20 @@ function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
|
|
|
197
199
|
if (small && width >= KittBreakpoints.SMALL) return small;
|
|
198
200
|
return base;
|
|
199
201
|
}
|
|
202
|
+
function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
|
|
203
|
+
base,
|
|
204
|
+
color
|
|
205
|
+
}) {
|
|
206
|
+
// return the props set or undefined. In case of undefined, the value will be inherited from its parents.
|
|
207
|
+
if (hasTypographyAncestor) return {
|
|
208
|
+
base,
|
|
209
|
+
color
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
base: base ?? 'body',
|
|
213
|
+
color: color ?? 'black'
|
|
214
|
+
};
|
|
215
|
+
}
|
|
200
216
|
function Typography({
|
|
201
217
|
accessibilityRole,
|
|
202
218
|
base,
|
|
@@ -207,17 +223,22 @@ function Typography({
|
|
|
207
223
|
color,
|
|
208
224
|
...otherProps
|
|
209
225
|
}) {
|
|
210
|
-
const isHeaderTypographyInContext = react
|
|
211
|
-
const
|
|
226
|
+
const isHeaderTypographyInContext = react.useContext(IsHeaderTypographyContext);
|
|
227
|
+
const hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
|
|
228
|
+
const {
|
|
229
|
+
base: baseOrDefaultToBody,
|
|
230
|
+
color: colorOrDefaultToBlack
|
|
231
|
+
} = getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
|
|
232
|
+
base,
|
|
233
|
+
color
|
|
234
|
+
});
|
|
235
|
+
const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
|
|
212
236
|
const isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
|
|
213
|
-
const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular');
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const colorWithDefaultToBlack = color ?? (isHeaderTypographyInContext !== undefined ? undefined : 'black');
|
|
217
|
-
const content = base ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
|
|
237
|
+
const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular');
|
|
238
|
+
const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
|
|
218
239
|
value: isHeader,
|
|
219
240
|
children: /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
|
|
220
|
-
$color:
|
|
241
|
+
$color: colorOrDefaultToBlack,
|
|
221
242
|
$isHeader: isHeader,
|
|
222
243
|
$typeForCurrentWindowSize: typeForCurrentWindowSize,
|
|
223
244
|
$variant: nonNullableVariant,
|
|
@@ -225,7 +246,7 @@ function Typography({
|
|
|
225
246
|
...otherProps
|
|
226
247
|
})
|
|
227
248
|
}) : /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
|
|
228
|
-
$color:
|
|
249
|
+
$color: colorOrDefaultToBlack,
|
|
229
250
|
$isHeader: isHeader,
|
|
230
251
|
$variant: nonNullableVariant,
|
|
231
252
|
accessibilityRole: accessibilityRole || undefined,
|
|
@@ -290,31 +311,35 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
290
311
|
|
|
291
312
|
Typography.h5 = createHeading(5, 'header5');
|
|
292
313
|
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
const getInitials = (firstname, lastname) => (getFirstCharacter(firstname) + getFirstCharacter(lastname)).toUpperCase();
|
|
314
|
+
const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
|
|
296
315
|
|
|
297
316
|
const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
298
317
|
displayName: "Avatar__StyledAvatarView",
|
|
299
318
|
componentId: "kitt-universal__sc-9miubv-0"
|
|
300
|
-
})(["border-radius:", "
|
|
301
|
-
round,
|
|
302
|
-
size
|
|
303
|
-
}) => round ? size / 2 : 10, ({
|
|
319
|
+
})(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
|
|
304
320
|
theme,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
321
|
+
$isRound,
|
|
322
|
+
$size
|
|
323
|
+
}) => {
|
|
324
|
+
if ($isRound) return `${$size / 2}px`;
|
|
325
|
+
return theme.kitt.avatar.borderRadius;
|
|
326
|
+
}, ({
|
|
327
|
+
theme,
|
|
328
|
+
$isLight
|
|
329
|
+
}) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
|
|
330
|
+
$size
|
|
331
|
+
}) => $size, ({
|
|
332
|
+
$size
|
|
333
|
+
}) => $size);
|
|
311
334
|
|
|
312
335
|
function AvatarContent({
|
|
313
|
-
size
|
|
336
|
+
size,
|
|
314
337
|
src,
|
|
315
338
|
firstname,
|
|
316
339
|
lastname,
|
|
317
|
-
|
|
340
|
+
alt,
|
|
341
|
+
base,
|
|
342
|
+
isLight
|
|
318
343
|
}) {
|
|
319
344
|
if (src) {
|
|
320
345
|
return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
|
|
@@ -324,34 +349,43 @@ function AvatarContent({
|
|
|
324
349
|
style: {
|
|
325
350
|
width: size,
|
|
326
351
|
height: size
|
|
327
|
-
}
|
|
352
|
+
},
|
|
353
|
+
accessibilityLabel: alt
|
|
328
354
|
});
|
|
329
355
|
}
|
|
330
356
|
|
|
331
357
|
if (firstname && lastname) {
|
|
332
358
|
return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
333
|
-
base:
|
|
359
|
+
base: base,
|
|
334
360
|
variant: "bold",
|
|
335
|
-
color:
|
|
361
|
+
color: isLight ? 'black' : 'white',
|
|
336
362
|
children: getInitials(firstname, lastname)
|
|
337
363
|
});
|
|
338
364
|
}
|
|
339
365
|
|
|
340
366
|
return /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
341
367
|
icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
|
|
342
|
-
color:
|
|
368
|
+
color: isLight ? 'black' : 'white',
|
|
343
369
|
size: size / 2
|
|
344
370
|
});
|
|
345
371
|
}
|
|
346
372
|
|
|
347
373
|
function Avatar({
|
|
348
374
|
size = 40,
|
|
349
|
-
|
|
375
|
+
base = 'body-small',
|
|
376
|
+
round,
|
|
377
|
+
light,
|
|
378
|
+
...props
|
|
350
379
|
}) {
|
|
351
|
-
return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
|
|
352
|
-
size: size,
|
|
353
|
-
|
|
354
|
-
|
|
380
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
|
|
381
|
+
$size: size,
|
|
382
|
+
$isRound: round,
|
|
383
|
+
$isLight: light,
|
|
384
|
+
children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
|
|
385
|
+
size: size,
|
|
386
|
+
base: base,
|
|
387
|
+
isLight: light,
|
|
388
|
+
...props
|
|
355
389
|
})
|
|
356
390
|
});
|
|
357
391
|
}
|
|
@@ -360,7 +394,7 @@ function isSubtle(type) {
|
|
|
360
394
|
return type.startsWith('subtle');
|
|
361
395
|
}
|
|
362
396
|
|
|
363
|
-
const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react.styled("div")({
|
|
397
|
+
const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
364
398
|
name: "AnimatedButtonPressableContainer",
|
|
365
399
|
class: "a1vkj3mh",
|
|
366
400
|
vars: {
|
|
@@ -370,9 +404,6 @@ const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react.styled("d
|
|
|
370
404
|
"a1vkj3mh-1": [({
|
|
371
405
|
$isStretch
|
|
372
406
|
}) => $isStretch ? 'stretch' : 'baseline'],
|
|
373
|
-
"a1vkj3mh-2": [({
|
|
374
|
-
theme
|
|
375
|
-
}) => theme.breakpoints.min.mediumBreakpoint],
|
|
376
407
|
"a1vkj3mh-3": [({
|
|
377
408
|
theme
|
|
378
409
|
}) => theme.kitt.button.scale.medium.hover],
|
|
@@ -451,7 +482,7 @@ const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react.styled("d
|
|
|
451
482
|
}]
|
|
452
483
|
}
|
|
453
484
|
}));
|
|
454
|
-
const AnimatedButtonPressable = /*#__PURE__*/react
|
|
485
|
+
const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
455
486
|
$type,
|
|
456
487
|
$isStretch,
|
|
457
488
|
disabled,
|
|
@@ -703,7 +734,7 @@ function ButtonContent({
|
|
|
703
734
|
});
|
|
704
735
|
}
|
|
705
736
|
|
|
706
|
-
const Button = /*#__PURE__*/react
|
|
737
|
+
const Button = /*#__PURE__*/react.forwardRef(({
|
|
707
738
|
children,
|
|
708
739
|
type = 'default',
|
|
709
740
|
disabled,
|
|
@@ -785,7 +816,7 @@ function Emoji({
|
|
|
785
816
|
size,
|
|
786
817
|
style
|
|
787
818
|
}) {
|
|
788
|
-
const [emojiData] = react
|
|
819
|
+
const [emojiData] = react.useMemo(() => twemojiParser.parse(emoji, {
|
|
789
820
|
// on native plaforms, you can't display svg as Image
|
|
790
821
|
assetType: 'svg'
|
|
791
822
|
}), [emoji]);
|
|
@@ -887,8 +918,8 @@ function InputField({
|
|
|
887
918
|
}
|
|
888
919
|
|
|
889
920
|
const useInputText = () => {
|
|
890
|
-
const [isFocused, setIsFocused] = react
|
|
891
|
-
const [isPasswordVisible, setIsPasswordVisible] = react
|
|
921
|
+
const [isFocused, setIsFocused] = react.useState(false);
|
|
922
|
+
const [isPasswordVisible, setIsPasswordVisible] = react.useState(false);
|
|
892
923
|
return {
|
|
893
924
|
isFocused,
|
|
894
925
|
handleInputFocus: () => setIsFocused(true),
|
|
@@ -985,7 +1016,7 @@ const textContentTypeByType = {
|
|
|
985
1016
|
password: 'password',
|
|
986
1017
|
username: 'username'
|
|
987
1018
|
};
|
|
988
|
-
const InputText = /*#__PURE__*/react
|
|
1019
|
+
const InputText = /*#__PURE__*/react.forwardRef(({
|
|
989
1020
|
id,
|
|
990
1021
|
minHeight = 0,
|
|
991
1022
|
type,
|
|
@@ -1143,6 +1174,7 @@ function TextArea({ ...props
|
|
|
1143
1174
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
1144
1175
|
return /*#__PURE__*/jsxRuntime.jsx(InputText, {
|
|
1145
1176
|
multiline: true,
|
|
1177
|
+
textAlignVertical: "top",
|
|
1146
1178
|
...props,
|
|
1147
1179
|
type: "text",
|
|
1148
1180
|
minHeight: theme.kitt.forms.input.textAreaMinHeight
|
|
@@ -1251,8 +1283,8 @@ function FullScreenModalHeader({
|
|
|
1251
1283
|
top
|
|
1252
1284
|
} = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
1253
1285
|
const dimensions = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
1254
|
-
const [leftWidth, setLeftWidth] = react
|
|
1255
|
-
const [rightWidth, setRightWidth] = react
|
|
1286
|
+
const [leftWidth, setLeftWidth] = react.useState(0);
|
|
1287
|
+
const [rightWidth, setRightWidth] = react.useState(0);
|
|
1256
1288
|
|
|
1257
1289
|
const handleLayoutChange = (event, side) => {
|
|
1258
1290
|
// Prevents react to nullify event on rerenders
|
|
@@ -1311,16 +1343,13 @@ function StyleWebWrapper({
|
|
|
1311
1343
|
});
|
|
1312
1344
|
}
|
|
1313
1345
|
|
|
1314
|
-
const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react.styled("div")({
|
|
1346
|
+
const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
1315
1347
|
name: "PressableIconButtonWebWrapper",
|
|
1316
1348
|
class: "p1nlccvg",
|
|
1317
1349
|
vars: {
|
|
1318
1350
|
"p1nlccvg-0": [({
|
|
1319
1351
|
theme
|
|
1320
1352
|
}) => theme.kitt.iconButton.scale.base.hover],
|
|
1321
|
-
"p1nlccvg-1": [({
|
|
1322
|
-
theme
|
|
1323
|
-
}) => theme.breakpoints.min.mediumBreakpoint],
|
|
1324
1353
|
"p1nlccvg-2": [({
|
|
1325
1354
|
theme
|
|
1326
1355
|
}) => theme.kitt.iconButton.scale.medium.hover],
|
|
@@ -1328,11 +1357,16 @@ const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react.styled("div"
|
|
|
1328
1357
|
theme
|
|
1329
1358
|
}) => theme.kitt.iconButton.scale.base.active],
|
|
1330
1359
|
"p1nlccvg-4": [({
|
|
1331
|
-
theme
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1360
|
+
theme,
|
|
1361
|
+
$isWhite
|
|
1362
|
+
}) => {
|
|
1363
|
+
const {
|
|
1364
|
+
white,
|
|
1365
|
+
default: defaultIconButton
|
|
1366
|
+
} = theme.kitt.iconButton;
|
|
1367
|
+
if ($isWhite) return white.pressedBackgroundColor;
|
|
1368
|
+
return defaultIconButton.pressedBackgroundColor;
|
|
1369
|
+
}]
|
|
1336
1370
|
}
|
|
1337
1371
|
}));
|
|
1338
1372
|
const StyledPressableIconButton = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Pressable).withConfig({
|
|
@@ -1371,7 +1405,7 @@ function PressableIconButton({
|
|
|
1371
1405
|
}) {
|
|
1372
1406
|
return /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
|
|
1373
1407
|
as: PressableIconButtonWebWrapper,
|
|
1374
|
-
|
|
1408
|
+
$isWhite: color === 'white',
|
|
1375
1409
|
children: /*#__PURE__*/jsxRuntime.jsx(StyledPressableIconButton, { ...props
|
|
1376
1410
|
})
|
|
1377
1411
|
});
|
|
@@ -1534,7 +1568,7 @@ function ListItem({
|
|
|
1534
1568
|
onPress,
|
|
1535
1569
|
...rest
|
|
1536
1570
|
}) {
|
|
1537
|
-
const Wrapper = onPress ? BabelPluginStyledComponentsReactNative.Pressable : react
|
|
1571
|
+
const Wrapper = onPress ? BabelPluginStyledComponentsReactNative.Pressable : react.Fragment;
|
|
1538
1572
|
const wrapperProps = onPress ? {
|
|
1539
1573
|
accessibilityRole: 'button',
|
|
1540
1574
|
onPress,
|
|
@@ -1562,7 +1596,7 @@ ListItem.Content = ListItemContent;
|
|
|
1562
1596
|
ListItem.SideContent = ListItemSideContent;
|
|
1563
1597
|
ListItem.SideContainer = ListItemSideContainer;
|
|
1564
1598
|
|
|
1565
|
-
const LargeLoaderContainer = withTheme( /*#__PURE__*/react.styled("div")({
|
|
1599
|
+
const LargeLoaderContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
1566
1600
|
name: "LargeLoaderContainer",
|
|
1567
1601
|
class: "l2im3sa",
|
|
1568
1602
|
vars: {
|
|
@@ -1775,7 +1809,7 @@ function ModalFooter({
|
|
|
1775
1809
|
});
|
|
1776
1810
|
}
|
|
1777
1811
|
|
|
1778
|
-
const OnCloseContext = /*#__PURE__*/react
|
|
1812
|
+
const OnCloseContext = /*#__PURE__*/react.createContext(() => {});
|
|
1779
1813
|
|
|
1780
1814
|
const HeaderView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1781
1815
|
displayName: "Header__HeaderView",
|
|
@@ -1809,7 +1843,7 @@ function ModalHeader({
|
|
|
1809
1843
|
right,
|
|
1810
1844
|
children
|
|
1811
1845
|
}) {
|
|
1812
|
-
const onClose = react
|
|
1846
|
+
const onClose = react.useContext(OnCloseContext);
|
|
1813
1847
|
const isIconLeft = !!left;
|
|
1814
1848
|
return /*#__PURE__*/jsxRuntime.jsxs(HeaderView, {
|
|
1815
1849
|
children: [isIconLeft && /*#__PURE__*/jsxRuntime.jsx(LeftIconView, {
|
|
@@ -1894,6 +1928,83 @@ function Notification({
|
|
|
1894
1928
|
});
|
|
1895
1929
|
}
|
|
1896
1930
|
|
|
1931
|
+
const StyledSkeleton = withTheme( /*#__PURE__*/react$1.styled("div")({
|
|
1932
|
+
name: "StyledSkeleton",
|
|
1933
|
+
class: "sc3upcl",
|
|
1934
|
+
vars: {
|
|
1935
|
+
"sc3upcl-0": [({
|
|
1936
|
+
theme
|
|
1937
|
+
}) => theme.kitt.skeleton.backgroundColor],
|
|
1938
|
+
"sc3upcl-1": [({
|
|
1939
|
+
$isLoading,
|
|
1940
|
+
theme
|
|
1941
|
+
}) => $isLoading ? `linear-gradient(
|
|
1942
|
+
-90deg,
|
|
1943
|
+
${theme.kitt.skeleton.backgroundColor},
|
|
1944
|
+
${theme.kitt.skeleton.flareColor} 50%,
|
|
1945
|
+
${theme.kitt.skeleton.backgroundColor} 100%
|
|
1946
|
+
)` : 'none'],
|
|
1947
|
+
"sc3upcl-2": [({
|
|
1948
|
+
$isLoading
|
|
1949
|
+
}) => $isLoading ? '1s ease-in-out infinite' : 'none']
|
|
1950
|
+
}
|
|
1951
|
+
}));
|
|
1952
|
+
function SkeletonContent({
|
|
1953
|
+
isLoading
|
|
1954
|
+
}) {
|
|
1955
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledSkeleton, {
|
|
1956
|
+
$isLoading: isLoading
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
function Skeleton({
|
|
1961
|
+
isLoading,
|
|
1962
|
+
style
|
|
1963
|
+
}) {
|
|
1964
|
+
const [width, setWidth] = react.useState(0);
|
|
1965
|
+
return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.View, {
|
|
1966
|
+
style: style,
|
|
1967
|
+
onLayout: ({
|
|
1968
|
+
nativeEvent
|
|
1969
|
+
}) => setWidth(nativeEvent.layout.width),
|
|
1970
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SkeletonContent, {
|
|
1971
|
+
isLoading: isLoading,
|
|
1972
|
+
width: width
|
|
1973
|
+
})
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
const Bar = /*#__PURE__*/styled__default(Skeleton).withConfig({
|
|
1977
|
+
displayName: "Skeleton__Bar",
|
|
1978
|
+
componentId: "kitt-universal__sc-1w5cm3i-0"
|
|
1979
|
+
})(["width:100%;height:", "px;border-radius:", "px;overflow:hidden;"], ({
|
|
1980
|
+
theme
|
|
1981
|
+
}) => theme.kitt.spacing * 2, ({
|
|
1982
|
+
theme
|
|
1983
|
+
}) => theme.kitt.spacing * 2);
|
|
1984
|
+
const Circle = /*#__PURE__*/styled__default(Skeleton).withConfig({
|
|
1985
|
+
displayName: "Skeleton__Circle",
|
|
1986
|
+
componentId: "kitt-universal__sc-1w5cm3i-1"
|
|
1987
|
+
})(["width:", "px;height:", "px;border-radius:", "px;overflow:hidden;"], ({
|
|
1988
|
+
theme
|
|
1989
|
+
}) => theme.kitt.spacing * 12, ({
|
|
1990
|
+
theme
|
|
1991
|
+
}) => theme.kitt.spacing * 12, ({
|
|
1992
|
+
theme
|
|
1993
|
+
}) => theme.kitt.spacing * 6);
|
|
1994
|
+
const Square = /*#__PURE__*/styled__default(Skeleton).withConfig({
|
|
1995
|
+
displayName: "Skeleton__Square",
|
|
1996
|
+
componentId: "kitt-universal__sc-1w5cm3i-2"
|
|
1997
|
+
})(["width:", "px;height:", "px;border-radius:", "px;overflow:hidden;"], ({
|
|
1998
|
+
theme
|
|
1999
|
+
}) => theme.kitt.spacing * 12, ({
|
|
2000
|
+
theme
|
|
2001
|
+
}) => theme.kitt.spacing * 12, ({
|
|
2002
|
+
theme
|
|
2003
|
+
}) => theme.kitt.spacing * 1.5);
|
|
2004
|
+
Skeleton.Bar = Bar;
|
|
2005
|
+
Skeleton.Circle = Circle;
|
|
2006
|
+
Skeleton.Square = Square;
|
|
2007
|
+
|
|
1897
2008
|
const Flex = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
1898
2009
|
shouldForwardProp: (prop, defaultValidatorFn) => !['direction', 'padding'].includes(prop) && defaultValidatorFn(prop)
|
|
1899
2010
|
}).withConfig({
|
|
@@ -1936,10 +2047,10 @@ const getTypographyColorFromBlockColor = (color = 'transparent') => {
|
|
|
1936
2047
|
}
|
|
1937
2048
|
};
|
|
1938
2049
|
|
|
1939
|
-
const StoryBlockBackgroundContext = /*#__PURE__*/react
|
|
1940
|
-
const StoryBlockColorContext = /*#__PURE__*/react
|
|
2050
|
+
const StoryBlockBackgroundContext = /*#__PURE__*/react.createContext('transparent');
|
|
2051
|
+
const StoryBlockColorContext = /*#__PURE__*/react.createContext('black');
|
|
1941
2052
|
const useStoryBlockColor = color => {
|
|
1942
|
-
const storyBlockColor = react
|
|
2053
|
+
const storyBlockColor = react.useContext(StoryBlockColorContext);
|
|
1943
2054
|
return color || storyBlockColor;
|
|
1944
2055
|
};
|
|
1945
2056
|
const StyledStoryBlockView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
@@ -2197,14 +2308,14 @@ function StoryGridRow({
|
|
|
2197
2308
|
|
|
2198
2309
|
if (width < breakpointValue) {
|
|
2199
2310
|
return /*#__PURE__*/jsxRuntime.jsx(SmallScreenRow, {
|
|
2200
|
-
children: react
|
|
2311
|
+
children: react.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(SmallScreenCol, {
|
|
2201
2312
|
children: child
|
|
2202
2313
|
}))
|
|
2203
2314
|
});
|
|
2204
2315
|
}
|
|
2205
2316
|
|
|
2206
2317
|
return /*#__PURE__*/jsxRuntime.jsx(FlexRow, {
|
|
2207
|
-
children: react
|
|
2318
|
+
children: react.Children.map(children, child => /*#__PURE__*/jsxRuntime.jsx(FlexCol, {
|
|
2208
2319
|
children: child
|
|
2209
2320
|
}))
|
|
2210
2321
|
});
|
|
@@ -2316,17 +2427,6 @@ const lateOceanColorPalette = {
|
|
|
2316
2427
|
moonPurpleLight1: '#EDEBFC'
|
|
2317
2428
|
};
|
|
2318
2429
|
|
|
2319
|
-
const avatarLateOceanTheme = {
|
|
2320
|
-
default: {
|
|
2321
|
-
color: lateOceanColorPalette.white,
|
|
2322
|
-
backgroundColor: lateOceanColorPalette.lateOcean
|
|
2323
|
-
},
|
|
2324
|
-
light: {
|
|
2325
|
-
color: lateOceanColorPalette.black1000,
|
|
2326
|
-
backgroundColor: lateOceanColorPalette.black100
|
|
2327
|
-
}
|
|
2328
|
-
};
|
|
2329
|
-
|
|
2330
2430
|
const colorsLateOceanTheme = {
|
|
2331
2431
|
primary: lateOceanColorPalette.lateOcean,
|
|
2332
2432
|
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
@@ -2349,6 +2449,16 @@ const colorsLateOceanTheme = {
|
|
|
2349
2449
|
}
|
|
2350
2450
|
};
|
|
2351
2451
|
|
|
2452
|
+
const avatar = {
|
|
2453
|
+
borderRadius: '10px',
|
|
2454
|
+
default: {
|
|
2455
|
+
backgroundColor: colorsLateOceanTheme.primary
|
|
2456
|
+
},
|
|
2457
|
+
light: {
|
|
2458
|
+
backgroundColor: lateOceanColorPalette.black100
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2461
|
+
|
|
2352
2462
|
const buttonLateOceanTheme = {
|
|
2353
2463
|
borderRadius: '30px',
|
|
2354
2464
|
borderWidth: {
|
|
@@ -2575,6 +2685,12 @@ const shadowsLateOceanTheme = {
|
|
|
2575
2685
|
medium: '0px 10px 20px rgba(41, 48, 51, 0.25)'
|
|
2576
2686
|
};
|
|
2577
2687
|
|
|
2688
|
+
const skeletonTheme = {
|
|
2689
|
+
backgroundColor: lateOceanColorPalette.black100,
|
|
2690
|
+
flareColor: lateOceanColorPalette.black200,
|
|
2691
|
+
animationDuration: 1000
|
|
2692
|
+
};
|
|
2693
|
+
|
|
2578
2694
|
const tagLateOceanTheme = {
|
|
2579
2695
|
borderRadius: '10px',
|
|
2580
2696
|
padding: '2px 12px',
|
|
@@ -2626,18 +2742,16 @@ const tooltip = {
|
|
|
2626
2742
|
};
|
|
2627
2743
|
|
|
2628
2744
|
const calcLineHeight = (fontSize, lineHeightMultiplier) => Math.round(fontSize * lineHeightMultiplier);
|
|
2629
|
-
|
|
2630
2745
|
const createTypographyTypeConfig = (lineHeightMultiplier, baseAndSmallFontSize, mediumAndWideFontSize) => ({
|
|
2631
2746
|
baseAndSmall: {
|
|
2632
2747
|
fontSize: `${baseAndSmallFontSize}px`,
|
|
2633
|
-
lineHeight: `${calcLineHeight(
|
|
2748
|
+
lineHeight: `${calcLineHeight(baseAndSmallFontSize, lineHeightMultiplier)}px`
|
|
2634
2749
|
},
|
|
2635
2750
|
mediumAndWide: {
|
|
2636
2751
|
fontSize: `${mediumAndWideFontSize}px`,
|
|
2637
|
-
lineHeight: `${calcLineHeight(
|
|
2752
|
+
lineHeight: `${calcLineHeight(mediumAndWideFontSize, lineHeightMultiplier)}px`
|
|
2638
2753
|
}
|
|
2639
2754
|
});
|
|
2640
|
-
|
|
2641
2755
|
const typographyLateOceanTheme = {
|
|
2642
2756
|
colors: {
|
|
2643
2757
|
black: lateOceanColorPalette.black1000,
|
|
@@ -2719,7 +2833,7 @@ const breakpoints = {
|
|
|
2719
2833
|
wideBreakpoint: 'max-width: 1279px'
|
|
2720
2834
|
}
|
|
2721
2835
|
}; // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
2722
|
-
// TODO : seperate brand
|
|
2836
|
+
// TODO : seperate brand color usage definition from proper theme definition and add typings - https://ornikar.atlassian.net/browse/CME-156
|
|
2723
2837
|
|
|
2724
2838
|
const theme = {
|
|
2725
2839
|
spacing: 4,
|
|
@@ -2727,7 +2841,7 @@ const theme = {
|
|
|
2727
2841
|
palettes: {
|
|
2728
2842
|
lateOcean: lateOceanColorPalette
|
|
2729
2843
|
},
|
|
2730
|
-
avatar
|
|
2844
|
+
avatar,
|
|
2731
2845
|
button: buttonLateOceanTheme,
|
|
2732
2846
|
card: cardLateOceanTheme,
|
|
2733
2847
|
feedbackMessage: feedbackMessageLateOceanTheme,
|
|
@@ -2738,7 +2852,9 @@ const theme = {
|
|
|
2738
2852
|
fullScreenModal: fullScreenModalLateOceanTheme,
|
|
2739
2853
|
iconButton,
|
|
2740
2854
|
listItem: listItemLateOceanTheme,
|
|
2741
|
-
tooltip
|
|
2855
|
+
tooltip,
|
|
2856
|
+
skeleton: skeletonTheme,
|
|
2857
|
+
breakpoints
|
|
2742
2858
|
};
|
|
2743
2859
|
|
|
2744
2860
|
function TimePicker() {
|
|
@@ -2863,7 +2979,7 @@ function Tooltip({
|
|
|
2863
2979
|
}) {
|
|
2864
2980
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
2865
2981
|
const padding = floatingPadding || theme.kitt.tooltip.floatingPadding;
|
|
2866
|
-
const [visible, setVisible] = react
|
|
2982
|
+
const [visible, setVisible] = react.useState(Boolean(defaultVisible));
|
|
2867
2983
|
const {
|
|
2868
2984
|
x,
|
|
2869
2985
|
y,
|
|
@@ -2879,7 +2995,7 @@ function Tooltip({
|
|
|
2879
2995
|
middleware: [reactDom.offset(padding), reactDom.shift(), reactDom.flip()]
|
|
2880
2996
|
}); // Update on scroll and resize for all relevant nodes
|
|
2881
2997
|
|
|
2882
|
-
react
|
|
2998
|
+
react.useEffect(() => {
|
|
2883
2999
|
if (!refs.reference.current || !refs.floating.current) {
|
|
2884
3000
|
return () => undefined;
|
|
2885
3001
|
}
|
|
@@ -2896,7 +3012,7 @@ function Tooltip({
|
|
|
2896
3012
|
});
|
|
2897
3013
|
};
|
|
2898
3014
|
}, [refs.reference, refs.floating, update]);
|
|
2899
|
-
react
|
|
3015
|
+
react.useEffect(() => {
|
|
2900
3016
|
if (!onUpdate) return;
|
|
2901
3017
|
onUpdate({
|
|
2902
3018
|
x,
|
|
@@ -2980,16 +3096,21 @@ function TypographyEmoji({
|
|
|
2980
3096
|
});
|
|
2981
3097
|
}
|
|
2982
3098
|
|
|
2983
|
-
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react.styled("span")({
|
|
3099
|
+
const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react$1.styled("span")({
|
|
2984
3100
|
name: "TypographyLinkWebWrapper",
|
|
2985
|
-
class: "tcwz3nt"
|
|
3101
|
+
class: "tcwz3nt",
|
|
3102
|
+
vars: {
|
|
3103
|
+
"tcwz3nt-0": [({
|
|
3104
|
+
$hasNoUnderline
|
|
3105
|
+
}) => $hasNoUnderline ? 'underline' : 'none']
|
|
3106
|
+
}
|
|
2986
3107
|
}));
|
|
2987
3108
|
const StyledLink = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.Text).withConfig({
|
|
2988
3109
|
displayName: "TypographyLink__StyledLink",
|
|
2989
3110
|
componentId: "kitt-universal__sc-1o1zy30-0"
|
|
2990
3111
|
})(["text-decoration:", ";", ";", ";"], ({
|
|
2991
|
-
$
|
|
2992
|
-
}) => $
|
|
3112
|
+
$hasNoUnderline
|
|
3113
|
+
}) => $hasNoUnderline ? 'none' : 'underline', ({
|
|
2993
3114
|
$disabled
|
|
2994
3115
|
}) => {
|
|
2995
3116
|
return `
|
|
@@ -3017,10 +3138,10 @@ function TypographyLink({
|
|
|
3017
3138
|
accessibilityRole: "none",
|
|
3018
3139
|
children: /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
|
|
3019
3140
|
as: TypographyLinkWebWrapper,
|
|
3020
|
-
|
|
3141
|
+
$hasNoUnderline: noUnderline,
|
|
3021
3142
|
children: /*#__PURE__*/jsxRuntime.jsx(StyledLink, {
|
|
3022
3143
|
$disabled: disabled,
|
|
3023
|
-
$
|
|
3144
|
+
$hasNoUnderline: noUnderline,
|
|
3024
3145
|
href: href,
|
|
3025
3146
|
hrefAttrs: hrefAttrs,
|
|
3026
3147
|
accessibilityRole: "link",
|
|
@@ -3086,15 +3207,21 @@ function createWindowSizeHelper(dimensions) {
|
|
|
3086
3207
|
|
|
3087
3208
|
function useKittTheme() {
|
|
3088
3209
|
const dimensions = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
3089
|
-
return react
|
|
3210
|
+
return react.useMemo(() => {
|
|
3090
3211
|
return {
|
|
3091
3212
|
kitt: theme,
|
|
3092
|
-
responsive: createWindowSizeHelper(dimensions)
|
|
3093
|
-
breakpoints
|
|
3213
|
+
responsive: createWindowSizeHelper(dimensions)
|
|
3094
3214
|
};
|
|
3095
3215
|
}, [dimensions]);
|
|
3096
3216
|
}
|
|
3097
3217
|
|
|
3218
|
+
const hex2rgba = (hex, alpha = 1) => {
|
|
3219
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
3220
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
3221
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
3222
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3098
3225
|
function KittThemeProvider({
|
|
3099
3226
|
children
|
|
3100
3227
|
}) {
|
|
@@ -3155,6 +3282,7 @@ exports.Modal = Modal;
|
|
|
3155
3282
|
exports.Notification = Notification;
|
|
3156
3283
|
exports.Radio = Radio;
|
|
3157
3284
|
exports.Section = DeprecatedSection;
|
|
3285
|
+
exports.Skeleton = Skeleton;
|
|
3158
3286
|
exports.Story = Story;
|
|
3159
3287
|
exports.StoryBlock = StoryBlock;
|
|
3160
3288
|
exports.StoryContainer = StoryContainer;
|
|
@@ -3162,6 +3290,7 @@ exports.StoryDecorator = StoryDecorator;
|
|
|
3162
3290
|
exports.StoryGrid = StoryGrid;
|
|
3163
3291
|
exports.StorySection = StorySection;
|
|
3164
3292
|
exports.StoryTitle = StoryTitle;
|
|
3293
|
+
exports.StyleWebWrapper = StyleWebWrapper;
|
|
3165
3294
|
exports.Tag = Tag;
|
|
3166
3295
|
exports.TextArea = TextArea;
|
|
3167
3296
|
exports.TimePicker = TimePicker;
|
|
@@ -3171,12 +3300,14 @@ exports.TypographyEmoji = TypographyEmoji;
|
|
|
3171
3300
|
exports.TypographyIcon = TypographyIcon;
|
|
3172
3301
|
exports.TypographyLink = TypographyLink;
|
|
3173
3302
|
exports.createWindowSizeHelper = createWindowSizeHelper;
|
|
3303
|
+
exports.hex2rgba = hex2rgba;
|
|
3174
3304
|
exports.matchWindowSize = matchWindowSize;
|
|
3175
3305
|
exports.styledTextInputMixin = styledTextInputMixin;
|
|
3176
3306
|
exports.theme = theme;
|
|
3177
3307
|
exports.useKittTheme = useKittTheme;
|
|
3178
3308
|
exports.useMatchWindowSize = useMatchWindowSize;
|
|
3179
3309
|
exports.useStoryBlockColor = useStoryBlockColor;
|
|
3310
|
+
exports.withTheme = withTheme;
|
|
3180
3311
|
Object.keys(kittIcons).forEach(function (k) {
|
|
3181
3312
|
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = kittIcons[k];
|
|
3182
3313
|
});
|