@ornikar/kitt-universal 3.0.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/definitions/Button/AnimatedButtonPressable.d.ts +14 -0
- package/dist/definitions/Button/AnimatedButtonPressable.d.ts.map +1 -0
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts +17 -0
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts.map +1 -0
- package/dist/definitions/Button/BaseStyledButtonPressable.d.ts +11 -0
- package/dist/definitions/Button/BaseStyledButtonPressable.d.ts.map +1 -0
- package/dist/definitions/Button/Button.d.ts +9 -4
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonContent.d.ts +11 -3
- package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
- package/dist/definitions/Button/StyledDisabled.d.ts +3 -0
- package/dist/definitions/Button/StyledDisabled.d.ts.map +1 -0
- package/dist/definitions/Button/isSubtle.d.ts +3 -0
- package/dist/definitions/Button/isSubtle.d.ts.map +1 -0
- package/dist/definitions/Icon/SpinningIcon.web.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableIconButton.d.ts.map +1 -1
- package/dist/definitions/Loader/LargeLoader.web.d.ts.map +1 -1
- package/dist/definitions/Loader/Loader.d.ts +1 -1
- package/dist/definitions/Loader/Loader.d.ts.map +1 -1
- package/dist/definitions/themes/default.d.ts +3 -43
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/buttonLateOceanTheme.d.ts +42 -35
- package/dist/definitions/themes/late-ocean/buttonLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts +2 -0
- package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/typography/Typography.d.ts +13 -11
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyIcon.d.ts +2 -2
- package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts +7 -2
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts +5 -2
- package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts.map +1 -1
- 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 +461 -255
- 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 +461 -255
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +504 -291
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +500 -281
- 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 +462 -213
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.css +3 -2
- package/dist/index-node-14.17.cjs.web.js +448 -215
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/styles.css +3 -2
- package/dist/tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/definitions/Button/ButtonPressable.d.ts +0 -13
- package/dist/definitions/Button/ButtonPressable.d.ts.map +0 -1
|
@@ -5,14 +5,14 @@ export * from '@ornikar/kitt-icons';
|
|
|
5
5
|
import { Animated, Easing, useWindowDimensions, Image, Platform, Linking, TextInput, Pressable, ActivityIndicator, TouchableOpacity, View, StyleSheet, ScrollView, Modal as Modal$1, Text as Text$1 } from 'react-native';
|
|
6
6
|
export { useWindowDimensions as useWindowSize } from 'react-native';
|
|
7
7
|
import styled, { useTheme, css, ThemeProvider } from 'styled-components/native';
|
|
8
|
-
import { useRef, useEffect, cloneElement, useContext, createContext,
|
|
8
|
+
import { useRef, useEffect, cloneElement, useContext, createContext, forwardRef, useMemo, useState, Fragment, Children } from 'react';
|
|
9
9
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
10
|
+
import Animated$1, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring } from 'react-native-reanimated';
|
|
10
11
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
11
12
|
import { parse } from 'twemoji-parser';
|
|
12
13
|
import { openBrowserAsync } from 'expo-web-browser';
|
|
13
14
|
import _extends from '@babel/runtime/helpers/extends';
|
|
14
15
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
15
|
-
import Animated$1, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
|
|
16
16
|
import DateTimePicker from '@react-native-community/datetimepicker';
|
|
17
17
|
import { FormattedMessage } from 'react-intl';
|
|
18
18
|
import { useFloating, offset, shift, flip } from '@floating-ui/react-native';
|
|
@@ -50,7 +50,7 @@ function SpinningIcon(_ref) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
var IconContainer$
|
|
53
|
+
var IconContainer$1 = /*#__PURE__*/styled.View.withConfig({
|
|
54
54
|
displayName: "Icon__IconContainer"
|
|
55
55
|
})(["color:", ";width:", "px;height:", "px;align-self:", ";"], function (_ref) {
|
|
56
56
|
var color = _ref.color;
|
|
@@ -76,7 +76,7 @@ function Icon(_ref5) {
|
|
|
76
76
|
var clonedIcon = /*#__PURE__*/cloneElement(icon, {
|
|
77
77
|
color: color
|
|
78
78
|
});
|
|
79
|
-
return /*#__PURE__*/jsx(IconContainer$
|
|
79
|
+
return /*#__PURE__*/jsx(IconContainer$1, {
|
|
80
80
|
align: align,
|
|
81
81
|
size: size,
|
|
82
82
|
color: color,
|
|
@@ -134,11 +134,11 @@ var KittBreakpointsMax = {
|
|
|
134
134
|
LARGE: KittBreakpoints.WIDE - 1
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
var _excluded$
|
|
137
|
+
var _excluded$d = ["accessibilityRole", "base", "small", "medium", "large", "variant", "color"];
|
|
138
138
|
|
|
139
|
-
function ownKeys$
|
|
139
|
+
function ownKeys$g(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
140
140
|
|
|
141
|
-
function _objectSpread$
|
|
141
|
+
function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
142
142
|
var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
|
|
143
143
|
var TypographyColorContext = /*#__PURE__*/createContext('black');
|
|
144
144
|
function useTypographyColor() {
|
|
@@ -193,34 +193,53 @@ function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
|
|
|
193
193
|
if (small && width >= KittBreakpoints.SMALL) return small;
|
|
194
194
|
return base;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, _ref3) {
|
|
197
|
+
var base = _ref3.base,
|
|
198
|
+
color = _ref3.color;
|
|
199
|
+
// return the props set or undefined. In case of undefined, the value will be inherited from its parents.
|
|
200
|
+
if (hasTypographyAncestor) return {
|
|
201
|
+
base: base,
|
|
202
|
+
color: color
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
base: base !== null && base !== void 0 ? base : 'body',
|
|
206
|
+
color: color !== null && color !== void 0 ? color : 'black'
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function Typography(_ref4) {
|
|
210
|
+
var accessibilityRole = _ref4.accessibilityRole,
|
|
211
|
+
base = _ref4.base,
|
|
212
|
+
small = _ref4.small,
|
|
213
|
+
medium = _ref4.medium,
|
|
214
|
+
large = _ref4.large,
|
|
215
|
+
variant = _ref4.variant,
|
|
216
|
+
color = _ref4.color,
|
|
217
|
+
otherProps = _objectWithoutProperties(_ref4, _excluded$d);
|
|
205
218
|
|
|
206
219
|
var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
var
|
|
210
|
-
|
|
220
|
+
var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
|
|
221
|
+
|
|
222
|
+
var _getTypographyInherit = getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
|
|
223
|
+
base: base,
|
|
224
|
+
color: color
|
|
225
|
+
}),
|
|
226
|
+
baseOrDefaultToBody = _getTypographyInherit.base,
|
|
227
|
+
colorOrDefaultToBlack = _getTypographyInherit.color;
|
|
211
228
|
|
|
212
|
-
var
|
|
213
|
-
var
|
|
229
|
+
var typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
|
|
230
|
+
var isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
|
|
231
|
+
var nonNullableVariant = variant !== null && variant !== void 0 ? variant : isHeader ? 'bold' : 'regular';
|
|
232
|
+
var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
|
|
214
233
|
value: isHeader,
|
|
215
|
-
children: /*#__PURE__*/jsx(StyledTypography, _objectSpread$
|
|
216
|
-
$color:
|
|
234
|
+
children: /*#__PURE__*/jsx(StyledTypography, _objectSpread$g({
|
|
235
|
+
$color: colorOrDefaultToBlack,
|
|
217
236
|
$isHeader: isHeader,
|
|
218
237
|
$typeForCurrentWindowSize: typeForCurrentWindowSize,
|
|
219
238
|
$variant: nonNullableVariant,
|
|
220
239
|
accessibilityRole: accessibilityRole || undefined
|
|
221
240
|
}, otherProps))
|
|
222
|
-
}) : /*#__PURE__*/jsx(StyledTypography, _objectSpread$
|
|
223
|
-
$color:
|
|
241
|
+
}) : /*#__PURE__*/jsx(StyledTypography, _objectSpread$g({
|
|
242
|
+
$color: colorOrDefaultToBlack,
|
|
224
243
|
$isHeader: isHeader,
|
|
225
244
|
$variant: nonNullableVariant,
|
|
226
245
|
accessibilityRole: accessibilityRole || undefined
|
|
@@ -232,13 +251,13 @@ function Typography(_ref3) {
|
|
|
232
251
|
}
|
|
233
252
|
|
|
234
253
|
function TypographyText(props) {
|
|
235
|
-
return /*#__PURE__*/jsx(Typography, _objectSpread$
|
|
254
|
+
return /*#__PURE__*/jsx(Typography, _objectSpread$g({
|
|
236
255
|
accessibilityRole: null
|
|
237
256
|
}, props));
|
|
238
257
|
}
|
|
239
258
|
|
|
240
259
|
function TypographyParagraph(props) {
|
|
241
|
-
return /*#__PURE__*/jsx(Typography, _objectSpread$
|
|
260
|
+
return /*#__PURE__*/jsx(Typography, _objectSpread$g({
|
|
242
261
|
accessibilityRole: "paragraph"
|
|
243
262
|
}, props));
|
|
244
263
|
}
|
|
@@ -246,7 +265,7 @@ function TypographyParagraph(props) {
|
|
|
246
265
|
var createHeading = function (level, defaultBase) {
|
|
247
266
|
// https://github.com/necolas/react-native-web/issues/401
|
|
248
267
|
function TypographyHeading(props) {
|
|
249
|
-
return /*#__PURE__*/jsx(Typography, _objectSpread$
|
|
268
|
+
return /*#__PURE__*/jsx(Typography, _objectSpread$g(_objectSpread$g({
|
|
250
269
|
accessibilityRole: "header",
|
|
251
270
|
base: defaultBase
|
|
252
271
|
}, props), {}, {
|
|
@@ -282,11 +301,11 @@ Typography.h4 = createHeading(4, 'header4');
|
|
|
282
301
|
|
|
283
302
|
Typography.h5 = createHeading(5, 'header5');
|
|
284
303
|
|
|
285
|
-
var _excluded$
|
|
304
|
+
var _excluded$c = ["size"];
|
|
286
305
|
|
|
287
|
-
function ownKeys$
|
|
306
|
+
function ownKeys$f(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
288
307
|
|
|
289
|
-
function _objectSpread$
|
|
308
|
+
function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
290
309
|
|
|
291
310
|
var getFirstCharacter = function (string) {
|
|
292
311
|
return string ? string[0] : '';
|
|
@@ -353,95 +372,242 @@ function AvatarContent(_ref5) {
|
|
|
353
372
|
function Avatar(_ref6) {
|
|
354
373
|
var _ref6$size = _ref6.size,
|
|
355
374
|
size = _ref6$size === void 0 ? 40 : _ref6$size,
|
|
356
|
-
rest = _objectWithoutProperties(_ref6, _excluded$
|
|
375
|
+
rest = _objectWithoutProperties(_ref6, _excluded$c);
|
|
357
376
|
|
|
358
|
-
return /*#__PURE__*/jsx(StyledAvatarView, _objectSpread$
|
|
377
|
+
return /*#__PURE__*/jsx(StyledAvatarView, _objectSpread$f(_objectSpread$f({}, rest), {}, {
|
|
359
378
|
size: size,
|
|
360
|
-
children: /*#__PURE__*/jsx(AvatarContent, _objectSpread$
|
|
379
|
+
children: /*#__PURE__*/jsx(AvatarContent, _objectSpread$f(_objectSpread$f({}, rest), {}, {
|
|
361
380
|
size: size
|
|
362
381
|
}))
|
|
363
382
|
}));
|
|
364
383
|
}
|
|
365
384
|
|
|
366
|
-
var
|
|
367
|
-
|
|
385
|
+
var StyledPressable = /*#__PURE__*/styled.Pressable.withConfig({
|
|
386
|
+
displayName: "AnimatedButtonPressable__StyledPressable"
|
|
387
|
+
})(["", ""], function (_ref) {
|
|
388
|
+
var $isStretch = _ref.$isStretch;
|
|
389
|
+
if ($isStretch) return undefined;
|
|
390
|
+
return 'align-self: flex-start;';
|
|
391
|
+
});
|
|
392
|
+
var StyledAnimatedView = /*#__PURE__*/styled(Animated$1.View).withConfig({
|
|
393
|
+
displayName: "AnimatedButtonPressable__StyledAnimatedView"
|
|
394
|
+
})(["border-radius:", ";"], function (_ref2) {
|
|
395
|
+
var theme = _ref2.theme;
|
|
396
|
+
return theme.kitt.button.borderRadius;
|
|
397
|
+
});
|
|
398
|
+
var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
399
|
+
var children = _ref3.children,
|
|
400
|
+
disabled = _ref3.disabled,
|
|
401
|
+
accessibilityRole = _ref3.accessibilityRole,
|
|
402
|
+
$type = _ref3.$type,
|
|
403
|
+
$isStretch = _ref3.$isStretch,
|
|
404
|
+
href = _ref3.href,
|
|
405
|
+
hrefAttrs = _ref3.hrefAttrs,
|
|
406
|
+
testID = _ref3.testID,
|
|
407
|
+
onPress = _ref3.onPress;
|
|
408
|
+
var theme = /*#__PURE__*/useTheme();
|
|
409
|
+
var pressed = useSharedValue(0);
|
|
410
|
+
var color = useSharedValue(0);
|
|
411
|
+
var _theme$kitt$button$$t = theme.kitt.button[$type],
|
|
412
|
+
backgroundColor = _theme$kitt$button$$t.backgroundColor,
|
|
413
|
+
pressedBackgroundColor = _theme$kitt$button$$t.pressedBackgroundColor;
|
|
414
|
+
var scale = theme.kitt.button.scale;
|
|
415
|
+
var scaleStyles = useAnimatedStyle(function () {
|
|
416
|
+
var _f = function () {
|
|
417
|
+
return {
|
|
418
|
+
backgroundColor: interpolateColor(color.value, [0, 1], [backgroundColor, pressedBackgroundColor]),
|
|
419
|
+
transform: [{
|
|
420
|
+
scale: withSpring(pressed.value ? scale.base.active : scale.base["default"])
|
|
421
|
+
}]
|
|
422
|
+
};
|
|
423
|
+
};
|
|
368
424
|
|
|
369
|
-
|
|
425
|
+
_f._closure = {
|
|
426
|
+
interpolateColor: interpolateColor,
|
|
427
|
+
color: color,
|
|
428
|
+
backgroundColor: backgroundColor,
|
|
429
|
+
pressedBackgroundColor: pressedBackgroundColor,
|
|
430
|
+
withSpring: withSpring,
|
|
431
|
+
pressed: pressed,
|
|
432
|
+
scale: {
|
|
433
|
+
base: {
|
|
434
|
+
active: scale.base.active,
|
|
435
|
+
"default": scale.base["default"]
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
_f.asString = "function _f(){const{interpolateColor,color,backgroundColor,pressedBackgroundColor,withSpring,pressed,scale}=jsThis._closure;{return{backgroundColor:interpolateColor(color.value,[0,1],[backgroundColor,pressedBackgroundColor]),transform:[{scale:withSpring(pressed.value?scale.base.active:scale.base.default)}]};}}";
|
|
440
|
+
_f.__workletHash = 5368461229978;
|
|
441
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (53:41)";
|
|
442
|
+
_f.__optimalization = 2;
|
|
370
443
|
|
|
371
|
-
|
|
444
|
+
global.__reanimatedWorkletInit(_f);
|
|
372
445
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
color:
|
|
378
|
-
|
|
379
|
-
}
|
|
446
|
+
return _f;
|
|
447
|
+
}());
|
|
448
|
+
|
|
449
|
+
var handlePressInOut = function (pressIn) {
|
|
450
|
+
color.value = withSpring(pressIn ? 1 : 0);
|
|
451
|
+
pressed.value = pressIn ? 1 : 0;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
return /*#__PURE__*/jsx(StyledPressable, {
|
|
455
|
+
ref: ref,
|
|
456
|
+
disabled: disabled,
|
|
457
|
+
accessibilityRole: accessibilityRole,
|
|
458
|
+
testID: testID,
|
|
459
|
+
href: href,
|
|
460
|
+
hrefAttrs: hrefAttrs,
|
|
461
|
+
$isStretch: $isStretch,
|
|
462
|
+
$type: $type,
|
|
463
|
+
onPress: onPress,
|
|
464
|
+
onPressIn: function onPressIn() {
|
|
465
|
+
handlePressInOut(true);
|
|
466
|
+
},
|
|
467
|
+
onPressOut: function onPressOut() {
|
|
468
|
+
handlePressInOut(false);
|
|
469
|
+
},
|
|
470
|
+
children: /*#__PURE__*/jsx(StyledAnimatedView, {
|
|
471
|
+
style: disabled ? [{
|
|
472
|
+
transform: [{
|
|
473
|
+
scale: 1
|
|
474
|
+
}]
|
|
475
|
+
}] : [scaleStyles],
|
|
476
|
+
children: children
|
|
477
|
+
})
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
var BaseStyledButtonPressable = /*#__PURE__*/styled.View.withConfig({
|
|
482
|
+
displayName: "BaseStyledButtonPressable"
|
|
483
|
+
})(["position:relative;min-width:", ";max-width:", ";width:", ";min-height:", ";border-radius:", ";flex-direction:row;align-items:center;justify-content:center;align-self:flex-start;background-color:", ";padding:", ";"], function (_ref) {
|
|
484
|
+
var theme = _ref.theme;
|
|
485
|
+
return theme.kitt.button.minWidth;
|
|
486
|
+
}, function (_ref2) {
|
|
487
|
+
var theme = _ref2.theme,
|
|
488
|
+
$isStretch = _ref2.$isStretch;
|
|
489
|
+
return $isStretch ? '100%' : theme.kitt.button.maxWidth;
|
|
490
|
+
}, function (_ref3) {
|
|
491
|
+
var $isStretch = _ref3.$isStretch;
|
|
492
|
+
return $isStretch ? '100%' : 'auto';
|
|
493
|
+
}, function (_ref4) {
|
|
494
|
+
var theme = _ref4.theme;
|
|
495
|
+
return theme.kitt.button.minHeight;
|
|
496
|
+
}, function (_ref5) {
|
|
497
|
+
var theme = _ref5.theme;
|
|
498
|
+
return theme.kitt.button.borderRadius;
|
|
499
|
+
}, function (_ref6) {
|
|
500
|
+
var theme = _ref6.theme,
|
|
501
|
+
$isDisabled = _ref6.$isDisabled,
|
|
502
|
+
$type = _ref6.$type;
|
|
503
|
+
if ($isDisabled) return theme.kitt.button.disabled.backgroundColor;
|
|
504
|
+
if (Platform.OS !== 'web') return 'transparent';
|
|
505
|
+
return theme.kitt.button[$type].backgroundColor;
|
|
506
|
+
}, function (_ref7) {
|
|
507
|
+
var theme = _ref7.theme,
|
|
508
|
+
$isLarge = _ref7.$isLarge,
|
|
509
|
+
$isDisabled = _ref7.$isDisabled;
|
|
510
|
+
var _theme$kitt$button$co = theme.kitt.button.contentPadding,
|
|
511
|
+
large = _theme$kitt$button$co.large,
|
|
512
|
+
defaultPadding = _theme$kitt$button$co["default"],
|
|
513
|
+
disabledPadding = _theme$kitt$button$co.disabled;
|
|
514
|
+
if ($isLarge) return large;
|
|
515
|
+
if ($isDisabled) return disabledPadding;
|
|
516
|
+
return defaultPadding;
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
var _excluded$b = ["color"],
|
|
520
|
+
_excluded2$2 = ["color"];
|
|
521
|
+
|
|
522
|
+
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
523
|
+
|
|
524
|
+
function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
380
525
|
|
|
381
526
|
function TypographyIconSpecifiedColor(_ref) {
|
|
382
527
|
var color = _ref.color,
|
|
383
|
-
|
|
528
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
384
529
|
|
|
385
530
|
var theme = /*#__PURE__*/useTheme();
|
|
386
|
-
return /*#__PURE__*/jsx(Icon, _objectSpread$
|
|
387
|
-
color: theme.kitt.typography.colors[color]
|
|
531
|
+
return /*#__PURE__*/jsx(Icon, _objectSpread$e(_objectSpread$e({}, props), {}, {
|
|
532
|
+
color: color === 'inherit' ? 'inherit' : theme.kitt.typography.colors[color]
|
|
388
533
|
}));
|
|
389
534
|
}
|
|
390
535
|
|
|
536
|
+
function TypographyIconInheritColor(props) {
|
|
537
|
+
var color = useTypographyColor();
|
|
538
|
+
return /*#__PURE__*/jsx(TypographyIconSpecifiedColor, _objectSpread$e({
|
|
539
|
+
color: color
|
|
540
|
+
}, props));
|
|
541
|
+
}
|
|
542
|
+
|
|
391
543
|
function TypographyIcon(_ref2) {
|
|
392
544
|
var color = _ref2.color,
|
|
393
|
-
|
|
545
|
+
props = _objectWithoutProperties(_ref2, _excluded2$2);
|
|
394
546
|
|
|
395
547
|
if (color) {
|
|
396
|
-
return /*#__PURE__*/jsx(TypographyIconSpecifiedColor, _objectSpread$
|
|
548
|
+
return /*#__PURE__*/jsx(TypographyIconSpecifiedColor, _objectSpread$e({
|
|
397
549
|
color: color
|
|
398
|
-
},
|
|
550
|
+
}, props));
|
|
399
551
|
}
|
|
400
552
|
|
|
401
|
-
return /*#__PURE__*/jsx(TypographyIconInheritColor, _objectSpread$
|
|
553
|
+
return /*#__PURE__*/jsx(TypographyIconInheritColor, _objectSpread$e({}, props));
|
|
402
554
|
}
|
|
403
555
|
|
|
404
|
-
function
|
|
556
|
+
function isSubtle(type) {
|
|
557
|
+
return type.startsWith('subtle');
|
|
558
|
+
}
|
|
405
559
|
|
|
406
|
-
|
|
560
|
+
var _excluded$a = ["type", "isDisabled", "$isStretch", "icon", "children"];
|
|
407
561
|
|
|
408
|
-
var
|
|
409
|
-
if (disabled) return 'black-light';
|
|
562
|
+
function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
410
563
|
|
|
564
|
+
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
565
|
+
|
|
566
|
+
var getTextColorByType = function (type) {
|
|
411
567
|
switch (type) {
|
|
412
568
|
case 'primary':
|
|
413
569
|
return 'white';
|
|
414
570
|
|
|
571
|
+
case 'white':
|
|
572
|
+
return 'white';
|
|
573
|
+
|
|
415
574
|
case 'subtle':
|
|
416
|
-
return
|
|
575
|
+
return 'primary';
|
|
417
576
|
|
|
418
577
|
case 'subtle-dark':
|
|
419
|
-
return
|
|
578
|
+
return 'black';
|
|
420
579
|
|
|
421
|
-
case 'secondary':
|
|
422
580
|
default:
|
|
423
581
|
return 'black';
|
|
424
582
|
}
|
|
425
583
|
};
|
|
426
584
|
|
|
427
|
-
var
|
|
428
|
-
displayName: "
|
|
429
|
-
})(["text-align:center;"])
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
585
|
+
var StyledButtonText = /*#__PURE__*/styled(Typography.Text).withConfig({
|
|
586
|
+
displayName: "ButtonContent__StyledButtonText"
|
|
587
|
+
})(["text-align:center;", " ", ""], function () {
|
|
588
|
+
// Make the multilines case work properly on native
|
|
589
|
+
// Breaks the web implem
|
|
590
|
+
if (Platform.OS === 'web') return undefined;
|
|
591
|
+
return "\n flex-shrink: 1;\n ";
|
|
592
|
+
}, function (_ref) {
|
|
593
|
+
var $type = _ref.$type,
|
|
594
|
+
$isDisabled = _ref.$isDisabled;
|
|
595
|
+
|
|
596
|
+
/* For subltes button, color changes when hovered.
|
|
597
|
+
* We don't want to use a mouse event handler with a react state to handle it
|
|
598
|
+
* For this precise case, we've decided to work outside the typography logic
|
|
599
|
+
*/
|
|
600
|
+
if (Platform.OS !== 'web' || $isDisabled || !isSubtle($type)) return undefined;
|
|
601
|
+
return 'color: inherit';
|
|
436
602
|
});
|
|
437
|
-
var
|
|
438
|
-
displayName: "
|
|
603
|
+
var StyledIconContainer = /*#__PURE__*/styled.View.withConfig({
|
|
604
|
+
displayName: "ButtonContent__StyledIconContainer"
|
|
439
605
|
})(["", ""], function (_ref2) {
|
|
440
606
|
var theme = _ref2.theme,
|
|
441
|
-
iconPosition = _ref2
|
|
442
|
-
var value = theme.kitt.spacing *
|
|
607
|
+
$iconPosition = _ref2.$iconPosition;
|
|
608
|
+
var value = theme.kitt.spacing * 2;
|
|
443
609
|
|
|
444
|
-
if (iconPosition === 'left') {
|
|
610
|
+
if ($iconPosition === 'left') {
|
|
445
611
|
return "margin: 0 ".concat(value, "px 0 0;");
|
|
446
612
|
}
|
|
447
613
|
|
|
@@ -450,39 +616,32 @@ var IconContainer$1 = /*#__PURE__*/styled.View.withConfig({
|
|
|
450
616
|
|
|
451
617
|
function ButtonIcon(_ref3) {
|
|
452
618
|
var icon = _ref3.icon,
|
|
453
|
-
spin = _ref3.spin,
|
|
454
619
|
color = _ref3.color,
|
|
455
|
-
|
|
620
|
+
spin = _ref3.spin,
|
|
456
621
|
iconPosition = _ref3.iconPosition,
|
|
457
622
|
testID = _ref3.testID;
|
|
458
|
-
return /*#__PURE__*/jsx(
|
|
459
|
-
iconPosition: iconPosition,
|
|
623
|
+
return /*#__PURE__*/jsx(StyledIconContainer, {
|
|
624
|
+
$iconPosition: iconPosition,
|
|
460
625
|
children: /*#__PURE__*/jsx(TypographyIcon, {
|
|
461
626
|
icon: icon,
|
|
462
627
|
spin: spin,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
testID: testID
|
|
628
|
+
testID: testID,
|
|
629
|
+
color: color
|
|
466
630
|
})
|
|
467
631
|
});
|
|
468
632
|
}
|
|
469
633
|
|
|
470
|
-
|
|
634
|
+
var StyledChildrenWithIcon = /*#__PURE__*/styled.View.withConfig({
|
|
635
|
+
displayName: "ButtonContent__StyledChildrenWithIcon"
|
|
636
|
+
})(["align-items:center;justify-content:center;flex-direction:row;"]);
|
|
637
|
+
function ButtonContentChildren(_ref4) {
|
|
471
638
|
var type = _ref4.type,
|
|
472
|
-
isPressed = _ref4.isPressed,
|
|
473
|
-
stretch = _ref4.stretch,
|
|
474
639
|
icon = _ref4.icon,
|
|
475
640
|
iconPosition = _ref4.iconPosition,
|
|
476
641
|
iconSpin = _ref4.iconSpin,
|
|
477
|
-
|
|
642
|
+
isDisabled = _ref4.isDisabled,
|
|
643
|
+
color = _ref4.color,
|
|
478
644
|
children = _ref4.children;
|
|
479
|
-
var color = getTextColorByType(type, Boolean(isPressed), Boolean(disabled));
|
|
480
|
-
var theme = /*#__PURE__*/useTheme();
|
|
481
|
-
var sharedIconProps = {
|
|
482
|
-
spin: iconSpin,
|
|
483
|
-
color: color,
|
|
484
|
-
size: theme.kitt.button.iconSize
|
|
485
|
-
};
|
|
486
645
|
|
|
487
646
|
if ((process.env.NODE_ENV !== "production")) {
|
|
488
647
|
if (!(children || icon)) {
|
|
@@ -490,128 +649,136 @@ function ButtonContent(_ref4) {
|
|
|
490
649
|
}
|
|
491
650
|
}
|
|
492
651
|
|
|
652
|
+
var isWebSubtle = isSubtle(type) && Platform.OS === 'web' && !isDisabled;
|
|
653
|
+
|
|
493
654
|
if (!children) {
|
|
494
|
-
return /*#__PURE__*/jsx(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}))
|
|
655
|
+
return /*#__PURE__*/jsx(TypographyIcon, {
|
|
656
|
+
spin: iconSpin // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
657
|
+
,
|
|
658
|
+
icon: icon,
|
|
659
|
+
color: isWebSubtle ? 'inherit' : color
|
|
500
660
|
});
|
|
501
661
|
}
|
|
502
662
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
663
|
+
var buttonIconSharedProps = {
|
|
664
|
+
type: type,
|
|
665
|
+
spin: iconSpin,
|
|
666
|
+
iconPosition: iconPosition,
|
|
667
|
+
color: isWebSubtle ? 'inherit' : color
|
|
668
|
+
};
|
|
669
|
+
return /*#__PURE__*/jsxs(StyledChildrenWithIcon, {
|
|
670
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsx(ButtonIcon, _objectSpread$d(_objectSpread$d({}, buttonIconSharedProps), {}, {
|
|
671
|
+
testID: "button-left-icon",
|
|
672
|
+
icon: icon
|
|
673
|
+
})) : null, /*#__PURE__*/jsx(StyledButtonText, {
|
|
510
674
|
base: "body",
|
|
511
|
-
color: color,
|
|
512
675
|
variant: "bold",
|
|
676
|
+
$type: type,
|
|
677
|
+
$isDisabled: isDisabled // set to color: inherit via styled components
|
|
678
|
+
,
|
|
679
|
+
color: isWebSubtle ? undefined : color,
|
|
513
680
|
children: children
|
|
514
|
-
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, _objectSpread$
|
|
515
|
-
icon: icon
|
|
516
|
-
iconPosition: iconPosition
|
|
681
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, _objectSpread$d(_objectSpread$d({}, buttonIconSharedProps), {}, {
|
|
682
|
+
icon: icon
|
|
517
683
|
})) : null]
|
|
518
684
|
});
|
|
519
685
|
}
|
|
686
|
+
var ButtonContentContainer = /*#__PURE__*/styled.View.withConfig({
|
|
687
|
+
displayName: "ButtonContent__ButtonContentContainer"
|
|
688
|
+
})(["line-height:16px;", " ", ";"], function (_ref5) {
|
|
689
|
+
var $isStretch = _ref5.$isStretch,
|
|
690
|
+
$isIconOnly = _ref5.$isIconOnly;
|
|
691
|
+
// Make the multilines case work properly on web
|
|
692
|
+
// Breaks the native implem
|
|
693
|
+
if (Platform.OS !== 'web') return undefined;
|
|
694
|
+
return "\n flex: ".concat($isStretch || $isIconOnly ? 1 : 0, " 1 auto;\n ");
|
|
695
|
+
}, function (_ref6) {
|
|
696
|
+
var $isSubtle = _ref6.$isSubtle;
|
|
697
|
+
if (Platform.OS !== 'web' || !$isSubtle) return undefined; // Needed for subtle type
|
|
520
698
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
699
|
+
return 'color: inherit';
|
|
700
|
+
});
|
|
701
|
+
function ButtonContent(_ref7) {
|
|
702
|
+
var type = _ref7.type,
|
|
703
|
+
isDisabled = _ref7.isDisabled,
|
|
704
|
+
$isStretch = _ref7.$isStretch,
|
|
705
|
+
icon = _ref7.icon,
|
|
706
|
+
children = _ref7.children,
|
|
707
|
+
props = _objectWithoutProperties(_ref7, _excluded$a);
|
|
708
|
+
|
|
709
|
+
var color = isDisabled ? 'black-light' : getTextColorByType(type);
|
|
710
|
+
return /*#__PURE__*/jsx(ButtonContentContainer, {
|
|
711
|
+
$isSubtle: isSubtle(type),
|
|
712
|
+
$isStretch: $isStretch,
|
|
713
|
+
$isIconOnly: Boolean(!children && icon),
|
|
714
|
+
children: /*#__PURE__*/jsx(ButtonContentChildren, _objectSpread$d(_objectSpread$d({
|
|
715
|
+
icon: icon,
|
|
716
|
+
type: type,
|
|
717
|
+
isDisabled: isDisabled,
|
|
718
|
+
color: color
|
|
719
|
+
}, props), {}, {
|
|
720
|
+
children: children
|
|
721
|
+
}))
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
var StyledDisabled = /*#__PURE__*/styled.View.withConfig({
|
|
726
|
+
displayName: "StyledDisabled"
|
|
727
|
+
})(["position:absolute;top:0;left:0;right:0;bottom:0;border:", ";border-radius:", ";"], function (_ref) {
|
|
524
728
|
var theme = _ref.theme;
|
|
525
|
-
|
|
729
|
+
var _theme$kitt$button = theme.kitt.button,
|
|
730
|
+
borderWidth = _theme$kitt$button.borderWidth,
|
|
731
|
+
disabled = _theme$kitt$button.disabled;
|
|
732
|
+
return "".concat(borderWidth.disabled, " solid ").concat(disabled.borderColor);
|
|
526
733
|
}, function (_ref2) {
|
|
527
|
-
var theme = _ref2.theme
|
|
528
|
-
stretch = _ref2.stretch;
|
|
529
|
-
return stretch ? 'auto' : theme.kitt.button.maxWidth;
|
|
530
|
-
}, function (_ref3) {
|
|
531
|
-
var stretch = _ref3.stretch;
|
|
532
|
-
return stretch ? '100%' : 'auto';
|
|
533
|
-
}, function (_ref4) {
|
|
534
|
-
var theme = _ref4.theme;
|
|
535
|
-
return theme.kitt.button.minHeight;
|
|
536
|
-
}, function (_ref5) {
|
|
537
|
-
var theme = _ref5.theme,
|
|
538
|
-
isPressed = _ref5.isPressed,
|
|
539
|
-
disabled = _ref5.disabled,
|
|
540
|
-
type = _ref5.type;
|
|
541
|
-
|
|
542
|
-
if (disabled) {
|
|
543
|
-
return theme.kitt.button[type].disabledBackgroundColor;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
|
|
547
|
-
}, function (_ref6) {
|
|
548
|
-
var theme = _ref6.theme;
|
|
549
|
-
return theme.kitt.button.contentPadding["default"];
|
|
550
|
-
}, function (_ref7) {
|
|
551
|
-
var theme = _ref7.theme;
|
|
734
|
+
var theme = _ref2.theme;
|
|
552
735
|
return theme.kitt.button.borderRadius;
|
|
553
|
-
}, function (_ref8) {
|
|
554
|
-
var theme = _ref8.theme,
|
|
555
|
-
disabled = _ref8.disabled,
|
|
556
|
-
type = _ref8.type;
|
|
557
|
-
return disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent';
|
|
558
|
-
}, function (_ref9) {
|
|
559
|
-
var theme = _ref9.theme;
|
|
560
|
-
return theme.kitt.button.borderWidth;
|
|
561
736
|
});
|
|
562
737
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
566
|
-
function Button(_ref) {
|
|
738
|
+
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
567
739
|
var children = _ref.children,
|
|
568
740
|
_ref$type = _ref.type,
|
|
569
|
-
type = _ref$type === void 0 ? '
|
|
741
|
+
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
742
|
+
disabled = _ref.disabled,
|
|
743
|
+
stretch = _ref.stretch,
|
|
744
|
+
large = _ref.large,
|
|
570
745
|
icon = _ref.icon,
|
|
571
746
|
_ref$iconPosition = _ref.iconPosition,
|
|
572
747
|
iconPosition = _ref$iconPosition === void 0 ? 'left' : _ref$iconPosition,
|
|
573
748
|
iconSpin = _ref.iconSpin,
|
|
574
|
-
stretch = _ref.stretch,
|
|
575
|
-
disabled = _ref.disabled,
|
|
576
749
|
testID = _ref.testID,
|
|
577
750
|
href = _ref.href,
|
|
578
751
|
hrefAttrs = _ref.hrefAttrs,
|
|
752
|
+
_ref$accessibilityRol = _ref.accessibilityRole,
|
|
753
|
+
accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
|
|
579
754
|
onPress = _ref.onPress;
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
isPressed = _useState2[0],
|
|
584
|
-
setIsPressed = _useState2[1];
|
|
585
|
-
|
|
586
|
-
var sharedProps = {
|
|
587
|
-
type: type,
|
|
588
|
-
stretch: stretch,
|
|
589
|
-
disabled: disabled
|
|
590
|
-
};
|
|
591
|
-
return /*#__PURE__*/jsx(ButtonPressable // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
592
|
-
// TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
|
|
593
|
-
// underlayColor={globalTheme.button[type].pressedBackgroundColor}
|
|
594
|
-
, _objectSpread$d(_objectSpread$d({}, sharedProps), {}, {
|
|
595
|
-
isPressed: isPressed,
|
|
596
|
-
accessibilityRole: "button",
|
|
755
|
+
return /*#__PURE__*/jsx(AnimatedButtonPressable, {
|
|
756
|
+
ref: ref,
|
|
757
|
+
accessibilityRole: accessibilityRole,
|
|
597
758
|
testID: testID,
|
|
598
759
|
href: href,
|
|
599
760
|
hrefAttrs: hrefAttrs,
|
|
761
|
+
disabled: disabled,
|
|
762
|
+
$isStretch: stretch,
|
|
763
|
+
$type: type,
|
|
600
764
|
onPress: onPress,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
765
|
+
children: /*#__PURE__*/jsxs(BaseStyledButtonPressable, {
|
|
766
|
+
$type: type,
|
|
767
|
+
$isStretch: stretch,
|
|
768
|
+
$isLarge: large,
|
|
769
|
+
$isDisabled: disabled,
|
|
770
|
+
children: [/*#__PURE__*/jsx(ButtonContent, {
|
|
771
|
+
type: type,
|
|
772
|
+
$isStretch: stretch,
|
|
773
|
+
isDisabled: disabled,
|
|
774
|
+
icon: icon,
|
|
775
|
+
iconPosition: iconPosition,
|
|
776
|
+
iconSpin: iconSpin,
|
|
777
|
+
children: children
|
|
778
|
+
}), Platform.OS !== 'web' && disabled ? /*#__PURE__*/jsx(StyledDisabled, {}) : null]
|
|
779
|
+
})
|
|
780
|
+
});
|
|
781
|
+
});
|
|
615
782
|
|
|
616
783
|
var Container$6 = /*#__PURE__*/styled.View.withConfig({
|
|
617
784
|
displayName: "Card__Container"
|
|
@@ -1303,7 +1470,7 @@ function PressableIconButton(_ref5) {
|
|
|
1303
1470
|
|
|
1304
1471
|
return /*#__PURE__*/jsx(StyleWebWrapper, {
|
|
1305
1472
|
as: PressableIconButtonWebWrapper,
|
|
1306
|
-
|
|
1473
|
+
$isWhite: color === 'white',
|
|
1307
1474
|
children: /*#__PURE__*/jsx(StyledPressableIconButton, _objectSpread$8({}, props))
|
|
1308
1475
|
});
|
|
1309
1476
|
}
|
|
@@ -2376,47 +2543,98 @@ var avatarLateOceanTheme = {
|
|
|
2376
2543
|
}
|
|
2377
2544
|
};
|
|
2378
2545
|
|
|
2546
|
+
var colorsLateOceanTheme = {
|
|
2547
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
2548
|
+
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2549
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
2550
|
+
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2551
|
+
success: lateOceanColorPalette.viride,
|
|
2552
|
+
correct: lateOceanColorPalette.viride,
|
|
2553
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
2554
|
+
separator: lateOceanColorPalette.black100,
|
|
2555
|
+
hover: lateOceanColorPalette.black100,
|
|
2556
|
+
black: lateOceanColorPalette.black1000,
|
|
2557
|
+
uiBackground: lateOceanColorPalette.black25,
|
|
2558
|
+
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2559
|
+
transparent: lateOceanColorPalette.transparent,
|
|
2560
|
+
disabled: lateOceanColorPalette.black50,
|
|
2561
|
+
overlay: {
|
|
2562
|
+
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2563
|
+
light: 'rgba(255, 255, 255, 0.90)',
|
|
2564
|
+
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2565
|
+
}
|
|
2566
|
+
};
|
|
2567
|
+
|
|
2379
2568
|
var buttonLateOceanTheme = {
|
|
2380
2569
|
borderRadius: '30px',
|
|
2381
|
-
borderWidth:
|
|
2382
|
-
|
|
2570
|
+
borderWidth: {
|
|
2571
|
+
disabled: '2px',
|
|
2572
|
+
focus: '3px'
|
|
2573
|
+
},
|
|
2574
|
+
minHeight: '40px',
|
|
2383
2575
|
minWidth: '40px',
|
|
2384
2576
|
maxWidth: '335px',
|
|
2385
|
-
|
|
2577
|
+
scale: {
|
|
2578
|
+
base: {
|
|
2579
|
+
"default": 1,
|
|
2580
|
+
hover: 0.95,
|
|
2581
|
+
active: 0.95
|
|
2582
|
+
},
|
|
2583
|
+
medium: {
|
|
2584
|
+
hover: 1.05
|
|
2585
|
+
}
|
|
2586
|
+
},
|
|
2386
2587
|
contentPadding: {
|
|
2387
|
-
"default": '8px 16px'
|
|
2588
|
+
"default": '8px 16px 7px',
|
|
2589
|
+
large: '12px 24px 11px',
|
|
2590
|
+
disabled: '6px 14px 5px'
|
|
2388
2591
|
},
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
pressedBackgroundColor: lateOceanColorPalette.lateOceanLight1,
|
|
2393
|
-
disabledBorderColor: lateOceanColorPalette.black100
|
|
2592
|
+
transition: {
|
|
2593
|
+
duration: '200ms',
|
|
2594
|
+
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
2394
2595
|
},
|
|
2395
|
-
|
|
2596
|
+
"default": {
|
|
2396
2597
|
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
2397
|
-
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
2398
2598
|
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
subtle: {
|
|
2402
|
-
backgroundColor: lateOceanColorPalette.transparent,
|
|
2403
|
-
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2404
|
-
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
2405
|
-
disabledBorderColor: lateOceanColorPalette.transparent
|
|
2599
|
+
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2600
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
2406
2601
|
},
|
|
2407
|
-
|
|
2408
|
-
backgroundColor:
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2602
|
+
primary: {
|
|
2603
|
+
backgroundColor: colorsLateOceanTheme.primary,
|
|
2604
|
+
pressedBackgroundColor: colorsLateOceanTheme.primaryLight,
|
|
2605
|
+
hoverBackgroundColor: colorsLateOceanTheme.primaryLight,
|
|
2606
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)'
|
|
2412
2607
|
},
|
|
2413
2608
|
white: {
|
|
2414
2609
|
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
2415
|
-
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2416
|
-
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2417
2610
|
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2418
|
-
|
|
2419
|
-
|
|
2611
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2612
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)'
|
|
2613
|
+
},
|
|
2614
|
+
subtle: {
|
|
2615
|
+
backgroundColor: colorsLateOceanTheme.transparent,
|
|
2616
|
+
pressedBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2617
|
+
hoverBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2618
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
2619
|
+
color: colorsLateOceanTheme.primary,
|
|
2620
|
+
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
2621
|
+
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
2622
|
+
},
|
|
2623
|
+
'subtle-dark': {
|
|
2624
|
+
backgroundColor: colorsLateOceanTheme.transparent,
|
|
2625
|
+
pressedBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2626
|
+
hoverBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2627
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
2628
|
+
color: colorsLateOceanTheme.black,
|
|
2629
|
+
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
2630
|
+
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
2631
|
+
},
|
|
2632
|
+
disabled: {
|
|
2633
|
+
backgroundColor: colorsLateOceanTheme.disabled,
|
|
2634
|
+
pressedBackgroundColor: colorsLateOceanTheme.disabled,
|
|
2635
|
+
hoverBackgroundColor: colorsLateOceanTheme.disabled,
|
|
2636
|
+
focusBorderColor: lateOceanColorPalette.black100,
|
|
2637
|
+
borderColor: lateOceanColorPalette.black100
|
|
2420
2638
|
}
|
|
2421
2639
|
};
|
|
2422
2640
|
|
|
@@ -2438,26 +2656,6 @@ var cardLateOceanTheme = {
|
|
|
2438
2656
|
}
|
|
2439
2657
|
};
|
|
2440
2658
|
|
|
2441
|
-
var colorsLateOceanTheme = {
|
|
2442
|
-
primary: lateOceanColorPalette.lateOcean,
|
|
2443
|
-
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2444
|
-
accent: lateOceanColorPalette.warmEmbrace,
|
|
2445
|
-
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2446
|
-
success: lateOceanColorPalette.viride,
|
|
2447
|
-
correct: lateOceanColorPalette.viride,
|
|
2448
|
-
danger: lateOceanColorPalette.englishVermillon,
|
|
2449
|
-
separator: lateOceanColorPalette.black100,
|
|
2450
|
-
hover: lateOceanColorPalette.black100,
|
|
2451
|
-
black: lateOceanColorPalette.black1000,
|
|
2452
|
-
uiBackground: lateOceanColorPalette.black25,
|
|
2453
|
-
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2454
|
-
overlay: {
|
|
2455
|
-
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2456
|
-
light: 'rgba(255, 255, 255, 0.90)',
|
|
2457
|
-
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2458
|
-
}
|
|
2459
|
-
};
|
|
2460
|
-
|
|
2461
2659
|
var feedbackMessageLateOceanTheme = {
|
|
2462
2660
|
backgroundColors: {
|
|
2463
2661
|
success: lateOceanColorPalette.viride,
|
|
@@ -2571,11 +2769,11 @@ var iconButton = {
|
|
|
2571
2769
|
},
|
|
2572
2770
|
disabled: {
|
|
2573
2771
|
scale: 1,
|
|
2574
|
-
backgroundColor: buttonLateOceanTheme.
|
|
2575
|
-
borderColor: buttonLateOceanTheme.
|
|
2772
|
+
backgroundColor: buttonLateOceanTheme.disabled.backgroundColor,
|
|
2773
|
+
borderColor: buttonLateOceanTheme.disabled.borderColor
|
|
2576
2774
|
},
|
|
2577
2775
|
"default": {
|
|
2578
|
-
pressedBackgroundColor: buttonLateOceanTheme.
|
|
2776
|
+
pressedBackgroundColor: buttonLateOceanTheme["default"].pressedBackgroundColor
|
|
2579
2777
|
},
|
|
2580
2778
|
white: {
|
|
2581
2779
|
pressedBackgroundColor: buttonLateOceanTheme.white.hoverBackgroundColor
|
|
@@ -2741,7 +2939,7 @@ var breakpoints = {
|
|
|
2741
2939
|
wideBreakpoint: 'max-width: 1279px'
|
|
2742
2940
|
}
|
|
2743
2941
|
}; // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
2744
|
-
// TODO : seperate brand
|
|
2942
|
+
// TODO : seperate brand co lor usage definition from proper theme definition and add t ypings - https://ornikar.atlassian.net/browse/CME-156
|
|
2745
2943
|
|
|
2746
2944
|
var theme = {
|
|
2747
2945
|
spacing: 4,
|
|
@@ -3146,8 +3344,8 @@ var TypographyLinkWebWrapper = undefined;
|
|
|
3146
3344
|
var StyledLink = /*#__PURE__*/styled.Text.withConfig({
|
|
3147
3345
|
displayName: "TypographyLink__StyledLink"
|
|
3148
3346
|
})(["text-decoration:", ";", ";", ";"], function (_ref) {
|
|
3149
|
-
var $
|
|
3150
|
-
return $
|
|
3347
|
+
var $hasNoUnderline = _ref.$hasNoUnderline;
|
|
3348
|
+
return $hasNoUnderline ? 'none' : 'underline';
|
|
3151
3349
|
}, function (_ref2) {
|
|
3152
3350
|
var $disabled = _ref2.$disabled;
|
|
3153
3351
|
if (Platform.OS !== 'web') return undefined;
|
|
@@ -3171,10 +3369,10 @@ function TypographyLink(_ref4) {
|
|
|
3171
3369
|
accessibilityRole: "none",
|
|
3172
3370
|
children: /*#__PURE__*/jsx(StyleWebWrapper, {
|
|
3173
3371
|
as: TypographyLinkWebWrapper,
|
|
3174
|
-
|
|
3372
|
+
$hasNoUnderline: noUnderline,
|
|
3175
3373
|
children: /*#__PURE__*/jsx(StyledLink, {
|
|
3176
3374
|
$disabled: disabled,
|
|
3177
|
-
$
|
|
3375
|
+
$hasNoUnderline: noUnderline,
|
|
3178
3376
|
href: href,
|
|
3179
3377
|
hrefAttrs: hrefAttrs,
|
|
3180
3378
|
accessibilityRole: "link",
|
|
@@ -3189,25 +3387,35 @@ function TypographyLink(_ref4) {
|
|
|
3189
3387
|
}));
|
|
3190
3388
|
}
|
|
3191
3389
|
|
|
3192
|
-
function matchWindowSize(
|
|
3193
|
-
var
|
|
3194
|
-
|
|
3195
|
-
|
|
3390
|
+
function matchWindowSize(_ref, _ref2) {
|
|
3391
|
+
var width = _ref.width,
|
|
3392
|
+
height = _ref.height;
|
|
3393
|
+
var minWidth = _ref2.minWidth,
|
|
3394
|
+
maxWidth = _ref2.maxWidth,
|
|
3395
|
+
minHeight = _ref2.minHeight,
|
|
3396
|
+
maxHeight = _ref2.maxHeight;
|
|
3397
|
+
var hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
|
|
3398
|
+
var hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
|
|
3399
|
+
return hasWidthMatched && hasHeightMatched;
|
|
3196
3400
|
}
|
|
3197
3401
|
function useMatchWindowSize(options) {
|
|
3198
3402
|
var _useWindowDimensions = useWindowDimensions(),
|
|
3199
|
-
width = _useWindowDimensions.width
|
|
3403
|
+
width = _useWindowDimensions.width,
|
|
3404
|
+
height = _useWindowDimensions.height;
|
|
3200
3405
|
|
|
3201
|
-
return matchWindowSize(
|
|
3406
|
+
return matchWindowSize({
|
|
3407
|
+
width: width,
|
|
3408
|
+
height: height
|
|
3409
|
+
}, options);
|
|
3202
3410
|
}
|
|
3203
3411
|
|
|
3204
|
-
function createWindowSizeHelper(
|
|
3412
|
+
function createWindowSizeHelper(dimensions) {
|
|
3205
3413
|
return {
|
|
3206
3414
|
matchWindowSize: function matchWindowSize$1(options) {
|
|
3207
|
-
return matchWindowSize(
|
|
3415
|
+
return matchWindowSize(dimensions, options);
|
|
3208
3416
|
},
|
|
3209
3417
|
ifWindowSizeMatches: function ifWindowSizeMatches(options, valueIfTrue, valueIfFalse) {
|
|
3210
|
-
return matchWindowSize(
|
|
3418
|
+
return matchWindowSize(dimensions, options) ? valueIfTrue : valueIfFalse;
|
|
3211
3419
|
},
|
|
3212
3420
|
mapWindowWidth: function mapWindowWidth() {
|
|
3213
3421
|
for (var _len = arguments.length, widthList = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -3232,7 +3440,7 @@ function createWindowSizeHelper(currentWidth) {
|
|
|
3232
3440
|
minWidth = _ref4[0];
|
|
3233
3441
|
_ref4[1];
|
|
3234
3442
|
|
|
3235
|
-
return matchWindowSize(
|
|
3443
|
+
return matchWindowSize(dimensions, {
|
|
3236
3444
|
minWidth: Number(minWidth)
|
|
3237
3445
|
});
|
|
3238
3446
|
});
|
|
@@ -3243,16 +3451,14 @@ function createWindowSizeHelper(currentWidth) {
|
|
|
3243
3451
|
}
|
|
3244
3452
|
|
|
3245
3453
|
function useKittTheme() {
|
|
3246
|
-
var
|
|
3247
|
-
width = _useWindowSize.width;
|
|
3248
|
-
|
|
3454
|
+
var dimensions = useWindowDimensions();
|
|
3249
3455
|
return useMemo(function () {
|
|
3250
3456
|
return {
|
|
3251
3457
|
kitt: theme,
|
|
3252
|
-
responsive: createWindowSizeHelper(
|
|
3458
|
+
responsive: createWindowSizeHelper(dimensions),
|
|
3253
3459
|
breakpoints: breakpoints
|
|
3254
3460
|
};
|
|
3255
|
-
}, [
|
|
3461
|
+
}, [dimensions]);
|
|
3256
3462
|
}
|
|
3257
3463
|
|
|
3258
3464
|
function KittThemeProvider(_ref) {
|