@ornikar/kitt-universal 3.1.0 → 3.2.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/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/withTheme.d.ts +2 -2
- package/dist/definitions/utils/withTheme.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +398 -219
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +398 -219
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +399 -221
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +398 -213
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +387 -178
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.css +1 -0
- package/dist/index-node-14.17.cjs.web.js +376 -182
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/styles.css +1 -0
- package/dist/tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/definitions/Button/ButtonPressable.d.ts +0 -13
- package/dist/definitions/Button/ButtonPressable.d.ts.map +0 -1
|
@@ -7,10 +7,10 @@ const reactNative = require('react-native');
|
|
|
7
7
|
const styled = require('styled-components/native');
|
|
8
8
|
const react = require('react');
|
|
9
9
|
const jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
const Animated = require('react-native-reanimated');
|
|
10
11
|
const twemojiParser = require('twemoji-parser');
|
|
11
12
|
const WebBrowser = require('expo-web-browser');
|
|
12
13
|
const reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
13
|
-
const Animated = require('react-native-reanimated');
|
|
14
14
|
const react$1 = require('@linaria/react');
|
|
15
15
|
const DateTimePicker = require('@react-native-community/datetimepicker');
|
|
16
16
|
const reactIntl = require('react-intl');
|
|
@@ -56,7 +56,7 @@ function SpinningIcon({
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const IconContainer$
|
|
59
|
+
const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
|
|
60
60
|
displayName: "Icon__IconContainer",
|
|
61
61
|
componentId: "kitt-universal__sc-usm0ol-0"
|
|
62
62
|
})(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
|
|
@@ -78,7 +78,7 @@ function Icon({
|
|
|
78
78
|
const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
|
|
79
79
|
color
|
|
80
80
|
});
|
|
81
|
-
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$
|
|
81
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
|
|
82
82
|
align: align,
|
|
83
83
|
size: size,
|
|
84
84
|
color: color,
|
|
@@ -363,79 +363,232 @@ function Avatar({
|
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
const StyledPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
|
|
367
|
+
displayName: "AnimatedButtonPressable__StyledPressable",
|
|
368
|
+
componentId: "kitt-universal__sc-175vyve-0"
|
|
369
|
+
})(["", ""], ({
|
|
370
|
+
$isStretch
|
|
371
|
+
}) => {
|
|
372
|
+
if ($isStretch) return undefined;
|
|
373
|
+
return 'align-self: flex-start;';
|
|
374
|
+
});
|
|
375
|
+
const StyledAnimatedView = /*#__PURE__*/styled__default(Animated__default.View).withConfig({
|
|
376
|
+
displayName: "AnimatedButtonPressable__StyledAnimatedView",
|
|
377
|
+
componentId: "kitt-universal__sc-175vyve-1"
|
|
378
|
+
})(["border-radius:", ";"], ({
|
|
379
|
+
theme
|
|
380
|
+
}) => theme.kitt.button.borderRadius);
|
|
381
|
+
const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
382
|
+
children,
|
|
383
|
+
disabled,
|
|
384
|
+
accessibilityRole,
|
|
385
|
+
$type,
|
|
386
|
+
$isStretch,
|
|
387
|
+
href,
|
|
388
|
+
hrefAttrs,
|
|
389
|
+
testID,
|
|
390
|
+
onPress
|
|
391
|
+
}, ref) => {
|
|
368
392
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
369
|
-
|
|
370
|
-
|
|
393
|
+
const pressed = Animated.useSharedValue(0);
|
|
394
|
+
const color = Animated.useSharedValue(0);
|
|
395
|
+
const {
|
|
396
|
+
backgroundColor,
|
|
397
|
+
pressedBackgroundColor
|
|
398
|
+
} = theme.kitt.button[$type];
|
|
399
|
+
const {
|
|
400
|
+
scale
|
|
401
|
+
} = theme.kitt.button;
|
|
402
|
+
const scaleStyles = Animated.useAnimatedStyle(function () {
|
|
403
|
+
const _f = function () {
|
|
404
|
+
return {
|
|
405
|
+
backgroundColor: Animated.interpolateColor(color.value, [0, 1], [backgroundColor, pressedBackgroundColor]),
|
|
406
|
+
transform: [{
|
|
407
|
+
scale: Animated.withSpring(pressed.value ? scale.base.active : scale.base.default)
|
|
408
|
+
}]
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
_f._closure = {
|
|
413
|
+
interpolateColor: Animated.interpolateColor,
|
|
414
|
+
color,
|
|
415
|
+
backgroundColor,
|
|
416
|
+
pressedBackgroundColor,
|
|
417
|
+
withSpring: Animated.withSpring,
|
|
418
|
+
pressed,
|
|
419
|
+
scale: {
|
|
420
|
+
base: {
|
|
421
|
+
active: scale.base.active,
|
|
422
|
+
default: scale.base.default
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
_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)}]};}}";
|
|
427
|
+
_f.__workletHash = 5368461229978;
|
|
428
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (53:41)";
|
|
429
|
+
_f.__optimalization = 2;
|
|
430
|
+
|
|
431
|
+
global.__reanimatedWorkletInit(_f);
|
|
432
|
+
|
|
433
|
+
return _f;
|
|
434
|
+
}());
|
|
435
|
+
|
|
436
|
+
const handlePressInOut = pressIn => {
|
|
437
|
+
color.value = Animated.withSpring(pressIn ? 1 : 0);
|
|
438
|
+
pressed.value = pressIn ? 1 : 0;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledPressable, {
|
|
442
|
+
ref: ref,
|
|
443
|
+
disabled: disabled,
|
|
444
|
+
accessibilityRole: accessibilityRole,
|
|
445
|
+
testID: testID,
|
|
446
|
+
href: href,
|
|
447
|
+
hrefAttrs: hrefAttrs,
|
|
448
|
+
$isStretch: $isStretch,
|
|
449
|
+
$type: $type,
|
|
450
|
+
onPress: onPress,
|
|
451
|
+
onPressIn: () => {
|
|
452
|
+
handlePressInOut(true);
|
|
453
|
+
},
|
|
454
|
+
onPressOut: () => {
|
|
455
|
+
handlePressInOut(false);
|
|
456
|
+
},
|
|
457
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledAnimatedView, {
|
|
458
|
+
style: disabled ? [{
|
|
459
|
+
transform: [{
|
|
460
|
+
scale: 1
|
|
461
|
+
}]
|
|
462
|
+
}] : [scaleStyles],
|
|
463
|
+
children: children
|
|
464
|
+
})
|
|
371
465
|
});
|
|
372
|
-
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
const BaseStyledButtonPressable = /*#__PURE__*/styled__default.View.withConfig({
|
|
469
|
+
displayName: "BaseStyledButtonPressable",
|
|
470
|
+
componentId: "kitt-universal__sc-4k8lse-0"
|
|
471
|
+
})(["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:", ";"], ({
|
|
472
|
+
theme
|
|
473
|
+
}) => theme.kitt.button.minWidth, ({
|
|
474
|
+
theme,
|
|
475
|
+
$isStretch
|
|
476
|
+
}) => $isStretch ? '100%' : theme.kitt.button.maxWidth, ({
|
|
477
|
+
$isStretch
|
|
478
|
+
}) => $isStretch ? '100%' : 'auto', ({
|
|
479
|
+
theme
|
|
480
|
+
}) => theme.kitt.button.minHeight, ({
|
|
481
|
+
theme
|
|
482
|
+
}) => theme.kitt.button.borderRadius, ({
|
|
483
|
+
theme,
|
|
484
|
+
$isDisabled,
|
|
485
|
+
$type
|
|
486
|
+
}) => {
|
|
487
|
+
if ($isDisabled) return theme.kitt.button.disabled.backgroundColor;
|
|
488
|
+
if (reactNative.Platform.OS !== 'web') return 'transparent';
|
|
489
|
+
return theme.kitt.button[$type].backgroundColor;
|
|
490
|
+
}, ({
|
|
491
|
+
theme,
|
|
492
|
+
$isLarge,
|
|
493
|
+
$isDisabled
|
|
494
|
+
}) => {
|
|
495
|
+
const {
|
|
496
|
+
large,
|
|
497
|
+
default: defaultPadding,
|
|
498
|
+
disabled: disabledPadding
|
|
499
|
+
} = theme.kitt.button.contentPadding;
|
|
500
|
+
if ($isLarge) return large;
|
|
501
|
+
if ($isDisabled) return disabledPadding;
|
|
502
|
+
return defaultPadding;
|
|
503
|
+
});
|
|
373
504
|
|
|
374
505
|
function TypographyIconSpecifiedColor({
|
|
375
506
|
color,
|
|
376
|
-
...
|
|
507
|
+
...props
|
|
377
508
|
}) {
|
|
378
509
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
379
|
-
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...
|
|
380
|
-
color: theme.kitt.typography.colors[color]
|
|
510
|
+
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...props,
|
|
511
|
+
color: color === 'inherit' ? 'inherit' : theme.kitt.typography.colors[color]
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function TypographyIconInheritColor(props) {
|
|
516
|
+
const color = useTypographyColor();
|
|
517
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
|
|
518
|
+
color: color,
|
|
519
|
+
...props
|
|
381
520
|
});
|
|
382
521
|
}
|
|
383
522
|
|
|
384
523
|
function TypographyIcon({
|
|
385
524
|
color,
|
|
386
|
-
...
|
|
525
|
+
...props
|
|
387
526
|
}) {
|
|
388
527
|
if (color) {
|
|
389
528
|
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
|
|
390
529
|
color: color,
|
|
391
|
-
...
|
|
530
|
+
...props
|
|
392
531
|
});
|
|
393
532
|
}
|
|
394
533
|
|
|
395
|
-
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...
|
|
534
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...props
|
|
396
535
|
});
|
|
397
536
|
}
|
|
398
537
|
|
|
399
|
-
|
|
400
|
-
|
|
538
|
+
function isSubtle(type) {
|
|
539
|
+
return type.startsWith('subtle');
|
|
540
|
+
}
|
|
401
541
|
|
|
542
|
+
const getTextColorByType = type => {
|
|
402
543
|
switch (type) {
|
|
403
544
|
case 'primary':
|
|
404
545
|
return 'white';
|
|
405
546
|
|
|
547
|
+
case 'white':
|
|
548
|
+
return 'white';
|
|
549
|
+
|
|
406
550
|
case 'subtle':
|
|
407
|
-
return
|
|
551
|
+
return 'primary';
|
|
408
552
|
|
|
409
553
|
case 'subtle-dark':
|
|
410
|
-
return
|
|
554
|
+
return 'black';
|
|
411
555
|
|
|
412
|
-
case 'secondary':
|
|
413
556
|
default:
|
|
414
557
|
return 'black';
|
|
415
558
|
}
|
|
416
559
|
};
|
|
417
560
|
|
|
418
|
-
const
|
|
419
|
-
displayName: "
|
|
561
|
+
const StyledButtonText = /*#__PURE__*/styled__default(Typography.Text).withConfig({
|
|
562
|
+
displayName: "ButtonContent__StyledButtonText",
|
|
420
563
|
componentId: "kitt-universal__sc-dnyw3n-0"
|
|
421
|
-
})(["text-align:center;"])
|
|
422
|
-
|
|
423
|
-
|
|
564
|
+
})(["text-align:center;", " ", ""], () => {
|
|
565
|
+
// Make the multilines case work properly on native
|
|
566
|
+
// Breaks the web implem
|
|
567
|
+
if (reactNative.Platform.OS === 'web') return undefined;
|
|
568
|
+
return `
|
|
569
|
+
flex-shrink: 1;
|
|
570
|
+
`;
|
|
571
|
+
}, ({
|
|
572
|
+
$type,
|
|
573
|
+
$isDisabled
|
|
574
|
+
}) => {
|
|
575
|
+
/* For subltes button, color changes when hovered.
|
|
576
|
+
* We don't want to use a mouse event handler with a react state to handle it
|
|
577
|
+
* For this precise case, we've decided to work outside the typography logic
|
|
578
|
+
*/
|
|
579
|
+
if (reactNative.Platform.OS !== 'web' || $isDisabled || !isSubtle($type)) return undefined;
|
|
580
|
+
return 'color: inherit';
|
|
581
|
+
});
|
|
582
|
+
const StyledIconContainer = /*#__PURE__*/styled__default.View.withConfig({
|
|
583
|
+
displayName: "ButtonContent__StyledIconContainer",
|
|
424
584
|
componentId: "kitt-universal__sc-dnyw3n-1"
|
|
425
|
-
})(["flex-direction:row;align-items:center;justify-content:center;flex:", ";"], ({
|
|
426
|
-
stretch,
|
|
427
|
-
iconOnly
|
|
428
|
-
}) => `${stretch || iconOnly ? 1 : 0} 1 auto`);
|
|
429
|
-
const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
|
|
430
|
-
displayName: "ButtonContent__IconContainer",
|
|
431
|
-
componentId: "kitt-universal__sc-dnyw3n-2"
|
|
432
585
|
})(["", ""], ({
|
|
433
586
|
theme,
|
|
434
|
-
iconPosition
|
|
587
|
+
$iconPosition
|
|
435
588
|
}) => {
|
|
436
|
-
const value = theme.kitt.spacing *
|
|
589
|
+
const value = theme.kitt.spacing * 2;
|
|
437
590
|
|
|
438
|
-
if (iconPosition === 'left') {
|
|
591
|
+
if ($iconPosition === 'left') {
|
|
439
592
|
return `margin: 0 ${value}px 0 0;`;
|
|
440
593
|
}
|
|
441
594
|
|
|
@@ -444,150 +597,176 @@ const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
444
597
|
|
|
445
598
|
function ButtonIcon({
|
|
446
599
|
icon,
|
|
447
|
-
spin,
|
|
448
600
|
color,
|
|
449
|
-
|
|
601
|
+
spin,
|
|
450
602
|
iconPosition,
|
|
451
603
|
testID
|
|
452
604
|
}) {
|
|
453
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
454
|
-
iconPosition: iconPosition,
|
|
605
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledIconContainer, {
|
|
606
|
+
$iconPosition: iconPosition,
|
|
455
607
|
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
456
608
|
icon: icon,
|
|
457
609
|
spin: spin,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
testID: testID
|
|
610
|
+
testID: testID,
|
|
611
|
+
color: color
|
|
461
612
|
})
|
|
462
613
|
});
|
|
463
614
|
}
|
|
464
615
|
|
|
465
|
-
|
|
616
|
+
const StyledChildrenWithIcon = /*#__PURE__*/styled__default.View.withConfig({
|
|
617
|
+
displayName: "ButtonContent__StyledChildrenWithIcon",
|
|
618
|
+
componentId: "kitt-universal__sc-dnyw3n-2"
|
|
619
|
+
})(["align-items:center;justify-content:center;flex-direction:row;"]);
|
|
620
|
+
function ButtonContentChildren({
|
|
466
621
|
type,
|
|
467
|
-
isPressed,
|
|
468
|
-
stretch,
|
|
469
622
|
icon,
|
|
470
623
|
iconPosition,
|
|
471
624
|
iconSpin,
|
|
472
|
-
|
|
625
|
+
isDisabled,
|
|
626
|
+
color,
|
|
473
627
|
children
|
|
474
628
|
}) {
|
|
475
|
-
const color = getTextColorByType(type, Boolean(isPressed), Boolean(disabled));
|
|
476
|
-
const theme = /*#__PURE__*/styled.useTheme();
|
|
477
|
-
const sharedIconProps = {
|
|
478
|
-
spin: iconSpin,
|
|
479
|
-
color,
|
|
480
|
-
size: theme.kitt.button.iconSize
|
|
481
|
-
};
|
|
482
|
-
|
|
483
629
|
if ((process.env.NODE_ENV !== "production")) {
|
|
484
630
|
if (!(children || icon)) {
|
|
485
631
|
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
486
632
|
}
|
|
487
633
|
}
|
|
488
634
|
|
|
635
|
+
const isWebSubtle = isSubtle(type) && reactNative.Platform.OS === 'web' && !isDisabled;
|
|
636
|
+
|
|
489
637
|
if (!children) {
|
|
490
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
})
|
|
638
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
639
|
+
spin: iconSpin // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
640
|
+
,
|
|
641
|
+
icon: icon,
|
|
642
|
+
color: isWebSubtle ? 'inherit' : color
|
|
496
643
|
});
|
|
497
644
|
}
|
|
498
645
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
646
|
+
const buttonIconSharedProps = {
|
|
647
|
+
type,
|
|
648
|
+
spin: iconSpin,
|
|
649
|
+
iconPosition,
|
|
650
|
+
color: isWebSubtle ? 'inherit' : color
|
|
651
|
+
};
|
|
652
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StyledChildrenWithIcon, {
|
|
653
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
|
|
654
|
+
testID: "button-left-icon",
|
|
655
|
+
icon: icon
|
|
656
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(StyledButtonText, {
|
|
506
657
|
base: "body",
|
|
507
|
-
color: color,
|
|
508
658
|
variant: "bold",
|
|
659
|
+
$type: type,
|
|
660
|
+
$isDisabled: isDisabled // set to color: inherit via styled components
|
|
661
|
+
,
|
|
662
|
+
color: isWebSubtle ? undefined : color,
|
|
509
663
|
children: children
|
|
510
|
-
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...
|
|
511
|
-
icon: icon
|
|
512
|
-
iconPosition: iconPosition
|
|
664
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
|
|
665
|
+
icon: icon
|
|
513
666
|
}) : null]
|
|
514
667
|
});
|
|
515
668
|
}
|
|
669
|
+
const ButtonContentContainer = /*#__PURE__*/styled__default.View.withConfig({
|
|
670
|
+
displayName: "ButtonContent__ButtonContentContainer",
|
|
671
|
+
componentId: "kitt-universal__sc-dnyw3n-3"
|
|
672
|
+
})(["line-height:16px;", " ", ";"], ({
|
|
673
|
+
$isStretch,
|
|
674
|
+
$isIconOnly
|
|
675
|
+
}) => {
|
|
676
|
+
// Make the multilines case work properly on web
|
|
677
|
+
// Breaks the native implem
|
|
678
|
+
if (reactNative.Platform.OS !== 'web') return undefined;
|
|
679
|
+
return `
|
|
680
|
+
flex: ${$isStretch || $isIconOnly ? 1 : 0} 1 auto;
|
|
681
|
+
`;
|
|
682
|
+
}, ({
|
|
683
|
+
$isSubtle
|
|
684
|
+
}) => {
|
|
685
|
+
if (reactNative.Platform.OS !== 'web' || !$isSubtle) return undefined; // Needed for subtle type
|
|
516
686
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
687
|
+
return 'color: inherit';
|
|
688
|
+
});
|
|
689
|
+
function ButtonContent({
|
|
690
|
+
type,
|
|
691
|
+
isDisabled,
|
|
692
|
+
$isStretch,
|
|
693
|
+
icon,
|
|
694
|
+
children,
|
|
695
|
+
...props
|
|
696
|
+
}) {
|
|
697
|
+
const color = isDisabled ? 'black-light' : getTextColorByType(type);
|
|
698
|
+
return /*#__PURE__*/jsxRuntime.jsx(ButtonContentContainer, {
|
|
699
|
+
$isSubtle: isSubtle(type),
|
|
700
|
+
$isStretch: $isStretch,
|
|
701
|
+
$isIconOnly: Boolean(!children && icon),
|
|
702
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ButtonContentChildren, {
|
|
703
|
+
icon: icon,
|
|
704
|
+
type: type,
|
|
705
|
+
isDisabled: isDisabled,
|
|
706
|
+
color: color,
|
|
707
|
+
...props,
|
|
708
|
+
children: children
|
|
709
|
+
})
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const StyledDisabled = /*#__PURE__*/styled__default.View.withConfig({
|
|
714
|
+
displayName: "StyledDisabled",
|
|
715
|
+
componentId: "kitt-universal__sc-16irf7q-0"
|
|
716
|
+
})(["position:absolute;top:0;left:0;right:0;bottom:0;border:", ";border-radius:", ";"], ({
|
|
528
717
|
theme
|
|
529
|
-
}) => theme.kitt.button.minHeight, ({
|
|
530
|
-
theme,
|
|
531
|
-
isPressed,
|
|
532
|
-
disabled,
|
|
533
|
-
type
|
|
534
718
|
}) => {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
return
|
|
719
|
+
const {
|
|
720
|
+
borderWidth,
|
|
721
|
+
disabled
|
|
722
|
+
} = theme.kitt.button;
|
|
723
|
+
return `${borderWidth.disabled} solid ${disabled.borderColor}`;
|
|
540
724
|
}, ({
|
|
541
725
|
theme
|
|
542
|
-
}) => theme.kitt.button.
|
|
543
|
-
theme
|
|
544
|
-
}) => theme.kitt.button.borderRadius, ({
|
|
545
|
-
theme,
|
|
546
|
-
disabled,
|
|
547
|
-
type
|
|
548
|
-
}) => disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent', ({
|
|
549
|
-
theme
|
|
550
|
-
}) => theme.kitt.button.borderWidth);
|
|
726
|
+
}) => theme.kitt.button.borderRadius);
|
|
551
727
|
|
|
552
|
-
|
|
728
|
+
const Button = /*#__PURE__*/react.forwardRef(({
|
|
553
729
|
children,
|
|
554
|
-
type = '
|
|
730
|
+
type = 'default',
|
|
731
|
+
disabled,
|
|
732
|
+
stretch,
|
|
733
|
+
large,
|
|
555
734
|
icon,
|
|
556
735
|
iconPosition = 'left',
|
|
557
736
|
iconSpin,
|
|
558
|
-
stretch,
|
|
559
|
-
disabled,
|
|
560
737
|
testID,
|
|
561
738
|
href,
|
|
562
739
|
hrefAttrs,
|
|
740
|
+
accessibilityRole = 'button',
|
|
563
741
|
onPress
|
|
564
|
-
}) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
stretch,
|
|
569
|
-
disabled
|
|
570
|
-
};
|
|
571
|
-
return /*#__PURE__*/jsxRuntime.jsx(ButtonPressable // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
572
|
-
// TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
|
|
573
|
-
// underlayColor={globalTheme.button[type].pressedBackgroundColor}
|
|
574
|
-
, { ...sharedProps,
|
|
575
|
-
isPressed: isPressed,
|
|
576
|
-
accessibilityRole: "button",
|
|
742
|
+
}, ref) => {
|
|
743
|
+
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
|
|
744
|
+
ref: ref,
|
|
745
|
+
accessibilityRole: accessibilityRole,
|
|
577
746
|
testID: testID,
|
|
578
747
|
href: href,
|
|
579
748
|
hrefAttrs: hrefAttrs,
|
|
749
|
+
disabled: disabled,
|
|
750
|
+
$isStretch: stretch,
|
|
751
|
+
$type: type,
|
|
580
752
|
onPress: onPress,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
753
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
|
|
754
|
+
$type: type,
|
|
755
|
+
$isStretch: stretch,
|
|
756
|
+
$isLarge: large,
|
|
757
|
+
$isDisabled: disabled,
|
|
758
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
|
|
759
|
+
type: type,
|
|
760
|
+
$isStretch: stretch,
|
|
761
|
+
isDisabled: disabled,
|
|
762
|
+
icon: icon,
|
|
763
|
+
iconPosition: iconPosition,
|
|
764
|
+
iconSpin: iconSpin,
|
|
765
|
+
children: children
|
|
766
|
+
}), reactNative.Platform.OS !== 'web' && disabled ? /*#__PURE__*/jsxRuntime.jsx(StyledDisabled, {}) : null]
|
|
588
767
|
})
|
|
589
768
|
});
|
|
590
|
-
}
|
|
769
|
+
});
|
|
591
770
|
|
|
592
771
|
const Container$6 = /*#__PURE__*/styled__default.View.withConfig({
|
|
593
772
|
displayName: "Card__Container",
|
|
@@ -1184,8 +1363,7 @@ function StyleWebWrapper({
|
|
|
1184
1363
|
// return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
|
|
1185
1364
|
// };
|
|
1186
1365
|
// }
|
|
1187
|
-
function withTheme(
|
|
1188
|
-
WrappedComponent) {
|
|
1366
|
+
function withTheme(WrappedComponent) {
|
|
1189
1367
|
return function (props) {
|
|
1190
1368
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
1191
1369
|
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
@@ -2296,47 +2474,98 @@ const avatarLateOceanTheme = {
|
|
|
2296
2474
|
}
|
|
2297
2475
|
};
|
|
2298
2476
|
|
|
2477
|
+
const colorsLateOceanTheme = {
|
|
2478
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
2479
|
+
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2480
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
2481
|
+
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2482
|
+
success: lateOceanColorPalette.viride,
|
|
2483
|
+
correct: lateOceanColorPalette.viride,
|
|
2484
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
2485
|
+
separator: lateOceanColorPalette.black100,
|
|
2486
|
+
hover: lateOceanColorPalette.black100,
|
|
2487
|
+
black: lateOceanColorPalette.black1000,
|
|
2488
|
+
uiBackground: lateOceanColorPalette.black25,
|
|
2489
|
+
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2490
|
+
transparent: lateOceanColorPalette.transparent,
|
|
2491
|
+
disabled: lateOceanColorPalette.black50,
|
|
2492
|
+
overlay: {
|
|
2493
|
+
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2494
|
+
light: 'rgba(255, 255, 255, 0.90)',
|
|
2495
|
+
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
|
|
2299
2499
|
const buttonLateOceanTheme = {
|
|
2300
2500
|
borderRadius: '30px',
|
|
2301
|
-
borderWidth:
|
|
2302
|
-
|
|
2501
|
+
borderWidth: {
|
|
2502
|
+
disabled: '2px',
|
|
2503
|
+
focus: '3px'
|
|
2504
|
+
},
|
|
2505
|
+
minHeight: '40px',
|
|
2303
2506
|
minWidth: '40px',
|
|
2304
2507
|
maxWidth: '335px',
|
|
2305
|
-
|
|
2508
|
+
scale: {
|
|
2509
|
+
base: {
|
|
2510
|
+
default: 1,
|
|
2511
|
+
hover: 0.95,
|
|
2512
|
+
active: 0.95
|
|
2513
|
+
},
|
|
2514
|
+
medium: {
|
|
2515
|
+
hover: 1.05
|
|
2516
|
+
}
|
|
2517
|
+
},
|
|
2306
2518
|
contentPadding: {
|
|
2307
|
-
default: '8px 16px'
|
|
2519
|
+
default: '8px 16px 7px',
|
|
2520
|
+
large: '12px 24px 11px',
|
|
2521
|
+
disabled: '6px 14px 5px'
|
|
2308
2522
|
},
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
pressedBackgroundColor: lateOceanColorPalette.lateOceanLight1,
|
|
2313
|
-
disabledBorderColor: lateOceanColorPalette.black100
|
|
2523
|
+
transition: {
|
|
2524
|
+
duration: '200ms',
|
|
2525
|
+
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
2314
2526
|
},
|
|
2315
|
-
|
|
2527
|
+
default: {
|
|
2316
2528
|
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
2317
|
-
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
2318
2529
|
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2319
|
-
|
|
2530
|
+
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2531
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
2320
2532
|
},
|
|
2321
|
-
|
|
2322
|
-
backgroundColor:
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
},
|
|
2327
|
-
'subtle-dark': {
|
|
2328
|
-
backgroundColor: lateOceanColorPalette.transparent,
|
|
2329
|
-
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2330
|
-
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
2331
|
-
disabledBorderColor: lateOceanColorPalette.transparent
|
|
2533
|
+
primary: {
|
|
2534
|
+
backgroundColor: colorsLateOceanTheme.primary,
|
|
2535
|
+
pressedBackgroundColor: colorsLateOceanTheme.primaryLight,
|
|
2536
|
+
hoverBackgroundColor: colorsLateOceanTheme.primaryLight,
|
|
2537
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)'
|
|
2332
2538
|
},
|
|
2333
2539
|
white: {
|
|
2334
2540
|
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
2335
|
-
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2336
|
-
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2337
2541
|
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2338
|
-
|
|
2339
|
-
|
|
2542
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2543
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)'
|
|
2544
|
+
},
|
|
2545
|
+
subtle: {
|
|
2546
|
+
backgroundColor: colorsLateOceanTheme.transparent,
|
|
2547
|
+
pressedBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2548
|
+
hoverBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2549
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
2550
|
+
color: colorsLateOceanTheme.primary,
|
|
2551
|
+
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
2552
|
+
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
2553
|
+
},
|
|
2554
|
+
'subtle-dark': {
|
|
2555
|
+
backgroundColor: colorsLateOceanTheme.transparent,
|
|
2556
|
+
pressedBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2557
|
+
hoverBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2558
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
2559
|
+
color: colorsLateOceanTheme.black,
|
|
2560
|
+
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
2561
|
+
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
2562
|
+
},
|
|
2563
|
+
disabled: {
|
|
2564
|
+
backgroundColor: colorsLateOceanTheme.disabled,
|
|
2565
|
+
pressedBackgroundColor: colorsLateOceanTheme.disabled,
|
|
2566
|
+
hoverBackgroundColor: colorsLateOceanTheme.disabled,
|
|
2567
|
+
focusBorderColor: lateOceanColorPalette.black100,
|
|
2568
|
+
borderColor: lateOceanColorPalette.black100
|
|
2340
2569
|
}
|
|
2341
2570
|
};
|
|
2342
2571
|
|
|
@@ -2358,26 +2587,6 @@ const cardLateOceanTheme = {
|
|
|
2358
2587
|
}
|
|
2359
2588
|
};
|
|
2360
2589
|
|
|
2361
|
-
const colorsLateOceanTheme = {
|
|
2362
|
-
primary: lateOceanColorPalette.lateOcean,
|
|
2363
|
-
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2364
|
-
accent: lateOceanColorPalette.warmEmbrace,
|
|
2365
|
-
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2366
|
-
success: lateOceanColorPalette.viride,
|
|
2367
|
-
correct: lateOceanColorPalette.viride,
|
|
2368
|
-
danger: lateOceanColorPalette.englishVermillon,
|
|
2369
|
-
separator: lateOceanColorPalette.black100,
|
|
2370
|
-
hover: lateOceanColorPalette.black100,
|
|
2371
|
-
black: lateOceanColorPalette.black1000,
|
|
2372
|
-
uiBackground: lateOceanColorPalette.black25,
|
|
2373
|
-
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2374
|
-
overlay: {
|
|
2375
|
-
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2376
|
-
light: 'rgba(255, 255, 255, 0.90)',
|
|
2377
|
-
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
|
-
|
|
2381
2590
|
const feedbackMessageLateOceanTheme = {
|
|
2382
2591
|
backgroundColors: {
|
|
2383
2592
|
success: lateOceanColorPalette.viride,
|
|
@@ -2491,11 +2700,11 @@ const iconButton = {
|
|
|
2491
2700
|
},
|
|
2492
2701
|
disabled: {
|
|
2493
2702
|
scale: 1,
|
|
2494
|
-
backgroundColor: buttonLateOceanTheme.
|
|
2495
|
-
borderColor: buttonLateOceanTheme.
|
|
2703
|
+
backgroundColor: buttonLateOceanTheme.disabled.backgroundColor,
|
|
2704
|
+
borderColor: buttonLateOceanTheme.disabled.borderColor
|
|
2496
2705
|
},
|
|
2497
2706
|
default: {
|
|
2498
|
-
pressedBackgroundColor: buttonLateOceanTheme.
|
|
2707
|
+
pressedBackgroundColor: buttonLateOceanTheme.default.pressedBackgroundColor
|
|
2499
2708
|
},
|
|
2500
2709
|
white: {
|
|
2501
2710
|
pressedBackgroundColor: buttonLateOceanTheme.white.hoverBackgroundColor
|
|
@@ -2657,7 +2866,7 @@ const breakpoints = {
|
|
|
2657
2866
|
wideBreakpoint: 'max-width: 1279px'
|
|
2658
2867
|
}
|
|
2659
2868
|
}; // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
2660
|
-
// TODO : seperate brand
|
|
2869
|
+
// TODO : seperate brand co lor usage definition from proper theme definition and add t ypings - https://ornikar.atlassian.net/browse/CME-156
|
|
2661
2870
|
|
|
2662
2871
|
const theme = {
|
|
2663
2872
|
spacing: 4,
|