@ornikar/kitt-universal 27.0.1-canary.01819bc93ab006bfbaa4e1335cd8afa2380068a0.0 → 27.1.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/CHANGELOG.md +3 -13
- package/dist/definitions/Button/AnimatedContainer.d.ts +2 -1
- package/dist/definitions/Button/AnimatedContainer.d.ts.map +1 -1
- package/dist/definitions/Button/Button.d.ts +2 -17
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonContent.d.ts +10 -8
- package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonPadding.d.ts +1 -1
- package/dist/definitions/Button/ButtonPadding.d.ts.map +1 -1
- package/dist/definitions/Button/FocusBorder.d.ts +1 -4
- package/dist/definitions/Button/FocusBorder.d.ts.map +1 -1
- package/dist/definitions/Button/hooks/useNativeAnimation.d.ts +1 -1
- package/dist/definitions/Button/hooks/useNativeAnimation.d.ts.map +1 -1
- package/dist/definitions/Button/utils/getButtonTextColorByType.d.ts +12 -3
- package/dist/definitions/Button/utils/getButtonTextColorByType.d.ts.map +1 -1
- package/dist/definitions/Button/utils/getCurrentBackgroundColorForNativeBaseTheme.d.ts +3 -2
- package/dist/definitions/Button/utils/getCurrentBackgroundColorForNativeBaseTheme.d.ts.map +1 -1
- package/dist/definitions/ButtonBadge/ButtonBadge.d.ts +2 -1
- package/dist/definitions/ButtonBadge/ButtonBadge.d.ts.map +1 -1
- package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +30 -23
- package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryBlock.d.ts +1 -1
- package/dist/definitions/themes/late-ocean/button.d.ts +26 -52
- package/dist/definitions/themes/late-ocean/button.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/buttonBadge.d.ts +4 -1
- package/dist/definitions/themes/late-ocean/buttonBadge.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/iconButton.d.ts +0 -1
- package/dist/definitions/themes/late-ocean/iconButton.d.ts.map +1 -1
- package/dist/definitions/typography/Typography.d.ts +7 -19
- package/dist/definitions/typography/Typography.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +238 -306
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +238 -306
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.17.cjs.js +232 -300
- package/dist/index-node-22.17.cjs.js.map +1 -1
- package/dist/index-node-22.17.cjs.web.js +231 -284
- package/dist/index-node-22.17.cjs.web.js.map +1 -1
- package/dist/index-node-22.17.es.mjs +232 -300
- package/dist/index-node-22.17.es.mjs.map +1 -1
- package/dist/index-node-22.17.es.web.mjs +231 -284
- package/dist/index-node-22.17.es.web.mjs.map +1 -1
- package/dist/index.es.js +352 -414
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +322 -370
- package/dist/index.es.web.js.map +1 -1
- package/dist/linaria-themes-metro.es.android.js +130 -116
- package/dist/linaria-themes-metro.es.android.js.map +1 -1
- package/dist/linaria-themes-metro.es.ios.js +130 -116
- package/dist/linaria-themes-metro.es.ios.js.map +1 -1
- package/dist/linaria-themes-node-22.17.cjs.js +130 -116
- package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
- package/dist/linaria-themes-node-22.17.cjs.web.js +130 -116
- package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
- package/dist/linaria-themes-node-22.17.es.mjs +130 -116
- package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
- package/dist/linaria-themes-node-22.17.es.web.mjs +130 -116
- package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
- package/dist/linaria-themes.es.js +131 -117
- package/dist/linaria-themes.es.js.map +1 -1
- package/dist/linaria-themes.es.web.js +131 -117
- package/dist/linaria-themes.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +28 -28
- package/dist/definitions/Button/DisabledBorder.d.ts +0 -3
- package/dist/definitions/Button/DisabledBorder.d.ts.map +0 -1
- package/dist/definitions/Button/getVariantValuesIfExist.d.ts +0 -5
- package/dist/definitions/Button/getVariantValuesIfExist.d.ts.map +0 -1
- package/dist/definitions/Button/utils/getButtonSize.d.ts +0 -3
- package/dist/definitions/Button/utils/getButtonSize.d.ts.map +0 -1
|
@@ -541,15 +541,18 @@ const bottomSheet = {
|
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
543
|
|
|
544
|
+
// Strongly typed theme so every new type/variant/size can't be added
|
|
545
|
+
// without defined color & backgroundColor or icon size
|
|
546
|
+
|
|
544
547
|
const button = {
|
|
545
|
-
borderRadius:
|
|
548
|
+
borderRadius: 4,
|
|
546
549
|
borderWidth: {
|
|
547
|
-
disabled: 2,
|
|
548
550
|
focus: 3
|
|
549
551
|
},
|
|
550
552
|
minHeight: 40,
|
|
551
553
|
minWidth: 40,
|
|
552
554
|
maxWidth: 335,
|
|
555
|
+
maxHeight: 48,
|
|
553
556
|
scale: {
|
|
554
557
|
base: {
|
|
555
558
|
default: 1,
|
|
@@ -560,148 +563,160 @@ const button = {
|
|
|
560
563
|
hover: 1.05
|
|
561
564
|
}
|
|
562
565
|
},
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
icon: {
|
|
567
|
+
medium: {
|
|
568
|
+
size: 24
|
|
569
|
+
},
|
|
570
|
+
default: {
|
|
571
|
+
size: 20
|
|
572
|
+
}
|
|
568
573
|
},
|
|
569
574
|
padding: {
|
|
570
575
|
default: {
|
|
571
|
-
hasBadge: {
|
|
572
|
-
right: 8
|
|
573
|
-
},
|
|
574
576
|
horizontal: 16,
|
|
575
|
-
vertical:
|
|
577
|
+
vertical: 8
|
|
576
578
|
},
|
|
577
|
-
|
|
578
|
-
hasBadge: {
|
|
579
|
-
right: 12
|
|
580
|
-
},
|
|
581
|
-
horizontal: 24,
|
|
582
|
-
vertical: 11
|
|
583
|
-
},
|
|
584
|
-
xLarge: {
|
|
585
|
-
hasBadge: {
|
|
586
|
-
right: 12
|
|
587
|
-
},
|
|
579
|
+
medium: {
|
|
588
580
|
horizontal: 24,
|
|
589
|
-
vertical:
|
|
581
|
+
vertical: 12
|
|
590
582
|
}
|
|
591
583
|
},
|
|
592
584
|
transition: {
|
|
593
585
|
duration: '200ms',
|
|
594
586
|
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
595
587
|
},
|
|
596
|
-
|
|
597
|
-
default: {
|
|
598
|
-
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
599
|
-
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
600
|
-
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
601
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
602
|
-
},
|
|
603
|
-
ghost: {
|
|
604
|
-
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
605
|
-
pressedBackgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
606
|
-
hoverBackgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
607
|
-
focusBorderColor: 'rgba(255, 255, 255, 0.4)',
|
|
608
|
-
color: deepPurpleColorPalette.white,
|
|
609
|
-
hoverColor: deepPurpleColorPalette.white,
|
|
610
|
-
activeColor: deepPurpleColorPalette.white
|
|
611
|
-
}
|
|
612
|
-
},
|
|
588
|
+
focusBorderColor: deepPurpleColorPalette['blue.2'],
|
|
613
589
|
primary: {
|
|
614
590
|
default: {
|
|
615
|
-
backgroundColor:
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
591
|
+
backgroundColor: {
|
|
592
|
+
default: colors.primary,
|
|
593
|
+
hover: deepPurpleColorPalette['deepPurple.7'],
|
|
594
|
+
pressed: deepPurpleColorPalette['deepPurple.7'],
|
|
595
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
596
|
+
focus: colors.primary
|
|
597
|
+
},
|
|
598
|
+
color: {
|
|
599
|
+
default: colors.white,
|
|
600
|
+
hover: colors.white,
|
|
601
|
+
pressed: colors.white,
|
|
602
|
+
disabled: colors.disabled,
|
|
603
|
+
focus: colors.white
|
|
604
|
+
}
|
|
619
605
|
},
|
|
620
|
-
|
|
621
|
-
backgroundColor:
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.8)'
|
|
606
|
+
revert: {
|
|
607
|
+
backgroundColor: {
|
|
608
|
+
default: colors.white,
|
|
609
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
610
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
611
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
612
|
+
focus: colors.white
|
|
613
|
+
},
|
|
614
|
+
color: {
|
|
615
|
+
default: colors.black,
|
|
616
|
+
hover: colors.black,
|
|
617
|
+
pressed: colors.black,
|
|
618
|
+
disabled: colors.disabled,
|
|
619
|
+
focus: colors.black
|
|
620
|
+
}
|
|
636
621
|
}
|
|
637
622
|
},
|
|
638
|
-
|
|
623
|
+
secondary: {
|
|
639
624
|
default: {
|
|
640
|
-
backgroundColor:
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
625
|
+
backgroundColor: {
|
|
626
|
+
default: deepPurpleColorPalette['beige-alpha.25'],
|
|
627
|
+
hover: deepPurpleColorPalette['beige-alpha.40'],
|
|
628
|
+
pressed: deepPurpleColorPalette['beige-alpha.40'],
|
|
629
|
+
disabled: colors.disabled,
|
|
630
|
+
focus: deepPurpleColorPalette['beige-alpha.25']
|
|
631
|
+
},
|
|
632
|
+
color: {
|
|
633
|
+
default: colors.black,
|
|
634
|
+
hover: colors.black,
|
|
635
|
+
pressed: colors.black,
|
|
636
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
637
|
+
focus: colors.black
|
|
638
|
+
}
|
|
644
639
|
},
|
|
645
|
-
|
|
646
|
-
backgroundColor:
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
661
|
-
color: colors.primary,
|
|
662
|
-
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
663
|
-
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
664
|
-
}
|
|
665
|
-
},
|
|
666
|
-
'subtle-dark': {
|
|
667
|
-
default: {
|
|
668
|
-
backgroundColor: colors.transparent,
|
|
669
|
-
pressedBackgroundColor: colors.transparent,
|
|
670
|
-
hoverBackgroundColor: colors.transparent,
|
|
671
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
672
|
-
color: colors.black,
|
|
673
|
-
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
674
|
-
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
640
|
+
revert: {
|
|
641
|
+
backgroundColor: {
|
|
642
|
+
default: deepPurpleColorPalette['white-alpha.10'],
|
|
643
|
+
hover: deepPurpleColorPalette['white-alpha.20'],
|
|
644
|
+
pressed: deepPurpleColorPalette['white-alpha.20'],
|
|
645
|
+
disabled: colors.disabled,
|
|
646
|
+
focus: deepPurpleColorPalette['white-alpha.10']
|
|
647
|
+
},
|
|
648
|
+
color: {
|
|
649
|
+
default: colors.white,
|
|
650
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
651
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
652
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
653
|
+
focus: colors.white
|
|
654
|
+
}
|
|
675
655
|
}
|
|
676
656
|
},
|
|
677
|
-
|
|
657
|
+
tertiary: {
|
|
678
658
|
default: {
|
|
679
|
-
backgroundColor:
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
659
|
+
backgroundColor: {
|
|
660
|
+
default: 'transparent',
|
|
661
|
+
hover: 'transparent',
|
|
662
|
+
pressed: 'transparent',
|
|
663
|
+
disabled: 'transparent',
|
|
664
|
+
focus: 'transparent'
|
|
665
|
+
},
|
|
666
|
+
color: {
|
|
667
|
+
default: colors.black,
|
|
668
|
+
hover: colors.blackAnthracite,
|
|
669
|
+
pressed: colors.blackAnthracite,
|
|
670
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
671
|
+
focus: colors.black
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
revert: {
|
|
675
|
+
backgroundColor: {
|
|
676
|
+
default: 'transparent',
|
|
677
|
+
hover: 'transparent',
|
|
678
|
+
pressed: 'transparent',
|
|
679
|
+
disabled: 'transparent',
|
|
680
|
+
focus: 'transparent'
|
|
681
|
+
},
|
|
682
|
+
color: {
|
|
683
|
+
default: colors.white,
|
|
684
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
685
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
686
|
+
disabled: deepPurpleColorPalette['white-alpha.20'],
|
|
687
|
+
focus: colors.white
|
|
688
|
+
}
|
|
686
689
|
}
|
|
687
690
|
},
|
|
688
|
-
|
|
691
|
+
'tertiary-danger': {
|
|
689
692
|
default: {
|
|
690
|
-
backgroundColor:
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
693
|
+
backgroundColor: {
|
|
694
|
+
default: 'transparent',
|
|
695
|
+
hover: 'transparent',
|
|
696
|
+
pressed: 'transparent',
|
|
697
|
+
disabled: 'transparent',
|
|
698
|
+
focus: 'transparent'
|
|
699
|
+
},
|
|
700
|
+
color: {
|
|
701
|
+
default: colors.danger,
|
|
702
|
+
hover: deepPurpleColorPalette['red.2'],
|
|
703
|
+
pressed: deepPurpleColorPalette['red.2'],
|
|
704
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
705
|
+
focus: colors.danger
|
|
706
|
+
}
|
|
695
707
|
}
|
|
696
708
|
}
|
|
697
709
|
};
|
|
698
710
|
|
|
699
711
|
const buttonBadge = {
|
|
700
|
-
backgroundColor:
|
|
712
|
+
backgroundColor: {
|
|
713
|
+
default: colors.danger,
|
|
714
|
+
disabled: colors.blackLight
|
|
715
|
+
},
|
|
701
716
|
dimensions: {
|
|
702
717
|
withBadge: {
|
|
703
|
-
width:
|
|
704
|
-
height:
|
|
718
|
+
width: 8,
|
|
719
|
+
height: 8
|
|
705
720
|
},
|
|
706
721
|
badgeCount: {
|
|
707
722
|
width: 20,
|
|
@@ -1898,14 +1913,13 @@ const iconButton = {
|
|
|
1898
1913
|
},
|
|
1899
1914
|
disabled: {
|
|
1900
1915
|
scale: 1,
|
|
1901
|
-
backgroundColor: button.
|
|
1902
|
-
borderColor: button.disabled.default.borderColor
|
|
1916
|
+
backgroundColor: button.primary.default.backgroundColor.disabled
|
|
1903
1917
|
},
|
|
1904
1918
|
default: {
|
|
1905
|
-
pressedBackgroundColor: button.
|
|
1919
|
+
pressedBackgroundColor: button.primary.default.backgroundColor.disabled
|
|
1906
1920
|
},
|
|
1907
1921
|
ghost: {
|
|
1908
|
-
pressedBackgroundColor: button.default.
|
|
1922
|
+
pressedBackgroundColor: button.primary.default.backgroundColor.disabled
|
|
1909
1923
|
},
|
|
1910
1924
|
primary: {
|
|
1911
1925
|
pressedBackgroundColor: deepPurpleColorPalette['beige.1']
|
|
@@ -2792,32 +2806,28 @@ function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valu
|
|
|
2792
2806
|
return responsiveValue;
|
|
2793
2807
|
}
|
|
2794
2808
|
|
|
2795
|
-
function warn(message) {
|
|
2796
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2797
|
-
console.warn(message);
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
function deprecatedMessage(symbol, deprecation, replaceBy) {
|
|
2801
|
-
const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
|
|
2802
|
-
warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
|
|
2803
|
-
}
|
|
2804
|
-
function deprecatedInComponent(component, deprecation, replaceBy) {
|
|
2805
|
-
deprecatedMessage(`<${component} />`, deprecation, replaceBy);
|
|
2806
|
-
}
|
|
2807
|
-
|
|
2808
2809
|
function getCurrentBackgroundColorForNativeBaseTheme({
|
|
2809
2810
|
type,
|
|
2810
2811
|
variant,
|
|
2811
2812
|
isDisabled,
|
|
2812
2813
|
isHovered,
|
|
2813
|
-
isPressed
|
|
2814
|
+
isPressed,
|
|
2815
|
+
isFocused
|
|
2814
2816
|
}) {
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2817
|
+
const baseKey = `kitt.button.${type}.${variant}.backgroundColor`;
|
|
2818
|
+
if (isDisabled) {
|
|
2819
|
+
return `${baseKey}.disabled`;
|
|
2820
|
+
}
|
|
2821
|
+
if (isHovered) {
|
|
2822
|
+
return `${baseKey}.hover`;
|
|
2823
|
+
}
|
|
2824
|
+
if (isPressed) {
|
|
2825
|
+
return `${baseKey}.pressed`;
|
|
2826
|
+
}
|
|
2827
|
+
if (isFocused) {
|
|
2828
|
+
return `${baseKey}.focused`;
|
|
2819
2829
|
}
|
|
2820
|
-
return `${baseKey}.
|
|
2830
|
+
return `${baseKey}.default`;
|
|
2821
2831
|
}
|
|
2822
2832
|
|
|
2823
2833
|
function getCurrentScale$1({
|
|
@@ -3055,7 +3065,6 @@ function Typography({
|
|
|
3055
3065
|
},
|
|
3056
3066
|
variant,
|
|
3057
3067
|
color,
|
|
3058
|
-
underline,
|
|
3059
3068
|
...otherProps
|
|
3060
3069
|
}) {
|
|
3061
3070
|
const sx = nativeBase.useSx();
|
|
@@ -3094,15 +3103,9 @@ function Typography({
|
|
|
3094
3103
|
lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
|
|
3095
3104
|
fontWeight: webFontWeight,
|
|
3096
3105
|
fontFamily: nativeFontFamily,
|
|
3097
|
-
borderBottomWidth: underline ? 1 : undefined,
|
|
3098
|
-
borderBottomColor: underline ? currentColorValue : undefined,
|
|
3099
3106
|
textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined,
|
|
3100
3107
|
...colorStyles,
|
|
3101
|
-
...otherProps
|
|
3102
|
-
// The property text-underline-offset is not on native.
|
|
3103
|
-
// To add an underline with an offset, we use a custom borderBottomWidth and color.
|
|
3104
|
-
// and we set underline to undefined to avoid a double underline
|
|
3105
|
-
underline: undefined
|
|
3108
|
+
...otherProps
|
|
3106
3109
|
});
|
|
3107
3110
|
const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(TypographyFamilyContext.Provider, {
|
|
3108
3111
|
value: typographyFamily,
|
|
@@ -3154,13 +3157,15 @@ Typography.Header6 = createHeading(6);
|
|
|
3154
3157
|
|
|
3155
3158
|
function ButtonBadge({
|
|
3156
3159
|
withBadge,
|
|
3157
|
-
badgeCount
|
|
3160
|
+
badgeCount,
|
|
3161
|
+
disabled
|
|
3158
3162
|
}) {
|
|
3163
|
+
const backgroundColor = disabled ? 'kitt.buttonBadge.backgroundColor.disabled' : 'kitt.buttonBadge.backgroundColor.default';
|
|
3159
3164
|
if (withBadge) {
|
|
3160
3165
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3161
3166
|
height: "kitt.buttonBadge.dimensions.withBadge.height",
|
|
3162
3167
|
width: "kitt.buttonBadge.dimensions.withBadge.width",
|
|
3163
|
-
backgroundColor:
|
|
3168
|
+
backgroundColor: backgroundColor,
|
|
3164
3169
|
borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
|
|
3165
3170
|
});
|
|
3166
3171
|
}
|
|
@@ -3170,7 +3175,7 @@ function ButtonBadge({
|
|
|
3170
3175
|
justifyContent: "center",
|
|
3171
3176
|
height: "kitt.buttonBadge.dimensions.badgeCount.height",
|
|
3172
3177
|
width: "kitt.buttonBadge.dimensions.badgeCount.width",
|
|
3173
|
-
backgroundColor:
|
|
3178
|
+
backgroundColor: backgroundColor,
|
|
3174
3179
|
borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
|
|
3175
3180
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3176
3181
|
base: "body-xs",
|
|
@@ -3265,103 +3270,77 @@ function TypographyIcon({
|
|
|
3265
3270
|
});
|
|
3266
3271
|
}
|
|
3267
3272
|
|
|
3268
|
-
const getButtonTextColorByType = (type, variant, isHovered, isPressed) => {
|
|
3269
|
-
const
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
case 'danger':
|
|
3276
|
-
return 'danger';
|
|
3277
|
-
case 'subtle':
|
|
3278
|
-
return isButtonInteractedWith ? 'primary-light' : 'primary';
|
|
3279
|
-
case 'subtle-dark':
|
|
3280
|
-
return isButtonInteractedWith ? 'black-light' : 'black';
|
|
3281
|
-
case 'subtle-revert':
|
|
3282
|
-
return 'white';
|
|
3283
|
-
case 'default':
|
|
3284
|
-
return variant === 'ghost' ? 'white' : 'black';
|
|
3285
|
-
default:
|
|
3286
|
-
return 'black';
|
|
3273
|
+
const getButtonTextColorByType = (type, variant, isHovered, isPressed, isDisabled) => {
|
|
3274
|
+
const baseKey = `kitt.button.${type}.${variant}.color`;
|
|
3275
|
+
if (isDisabled) {
|
|
3276
|
+
return `${baseKey}.disabled`;
|
|
3277
|
+
}
|
|
3278
|
+
if (isHovered || isPressed) {
|
|
3279
|
+
return `${baseKey}.hover`;
|
|
3287
3280
|
}
|
|
3281
|
+
return `${baseKey}.default`;
|
|
3288
3282
|
};
|
|
3289
3283
|
|
|
3290
|
-
function ButtonIcon({
|
|
3291
|
-
icon,
|
|
3292
|
-
color,
|
|
3293
|
-
iconPosition,
|
|
3294
|
-
testID
|
|
3295
|
-
}) {
|
|
3296
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3297
|
-
marginRight: iconPosition === 'left' ? 'kitt.2' : 0,
|
|
3298
|
-
marginLeft: iconPosition === 'right' ? 'kitt.2' : 0,
|
|
3299
|
-
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3300
|
-
icon: icon,
|
|
3301
|
-
testID: testID,
|
|
3302
|
-
color: color
|
|
3303
|
-
})
|
|
3304
|
-
});
|
|
3305
|
-
}
|
|
3306
3284
|
function ButtonContentChildren({
|
|
3307
3285
|
type,
|
|
3308
3286
|
icon,
|
|
3309
3287
|
iconPosition,
|
|
3310
3288
|
innerSpacing,
|
|
3289
|
+
isDisabled,
|
|
3311
3290
|
withBadge,
|
|
3312
3291
|
badgeCount,
|
|
3313
3292
|
color,
|
|
3314
|
-
children
|
|
3293
|
+
children,
|
|
3294
|
+
isPressed,
|
|
3295
|
+
isHovered,
|
|
3296
|
+
size = 'default'
|
|
3315
3297
|
}) {
|
|
3316
3298
|
if ((process.env.NODE_ENV !== "production")) {
|
|
3317
3299
|
if (!(children || icon)) {
|
|
3318
3300
|
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
3319
3301
|
}
|
|
3320
3302
|
}
|
|
3321
|
-
if (!children) {
|
|
3322
|
-
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon
|
|
3323
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3324
|
-
, {
|
|
3303
|
+
if (!children && icon) {
|
|
3304
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3325
3305
|
icon: icon,
|
|
3326
3306
|
color: color
|
|
3327
3307
|
});
|
|
3328
3308
|
}
|
|
3329
|
-
const buttonIconSharedProps = {
|
|
3330
|
-
type,
|
|
3331
|
-
iconPosition,
|
|
3332
|
-
color
|
|
3333
|
-
};
|
|
3334
|
-
|
|
3335
3309
|
// Make the multilines case work properly on native - Breaks the web implem
|
|
3336
3310
|
const sharedNativeStyle = {
|
|
3337
3311
|
flexShrink: 1
|
|
3338
3312
|
};
|
|
3339
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
3313
|
+
return /*#__PURE__*/jsxRuntime.jsxs(nativeBase.HStack, {
|
|
3340
3314
|
alignItems: "center",
|
|
3341
3315
|
justifyContent: innerSpacing,
|
|
3342
|
-
|
|
3343
|
-
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(
|
|
3344
|
-
...
|
|
3316
|
+
space: "kitt.2",
|
|
3317
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3318
|
+
...{
|
|
3319
|
+
type,
|
|
3320
|
+
color
|
|
3321
|
+
},
|
|
3345
3322
|
testID: "button.ButtonContent.leftButtonIcon",
|
|
3346
|
-
icon: icon
|
|
3323
|
+
icon: icon,
|
|
3324
|
+
color: color,
|
|
3325
|
+
size: `kitt.button.icon.${size}.size`
|
|
3347
3326
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3348
3327
|
/* On native code, this is the only way to ensure that the text is centered */
|
|
3349
3328
|
textAlign: "center",
|
|
3350
3329
|
_android: sharedNativeStyle,
|
|
3351
3330
|
_ios: sharedNativeStyle,
|
|
3352
|
-
base: "
|
|
3353
|
-
variant: "
|
|
3331
|
+
base: "label-large",
|
|
3332
|
+
variant: "semibold",
|
|
3333
|
+
underline: (type === 'tertiary' || type === 'tertiary-danger') && !isHovered && !isPressed,
|
|
3354
3334
|
color: color,
|
|
3355
3335
|
children: children
|
|
3356
|
-
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
})
|
|
3336
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3337
|
+
icon: icon,
|
|
3338
|
+
color: color,
|
|
3339
|
+
size: `kitt.button.icon.${size}.size`
|
|
3340
|
+
}) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
|
|
3341
|
+
disabled: isDisabled,
|
|
3342
|
+
withBadge: withBadge,
|
|
3343
|
+
badgeCount: badgeCount
|
|
3365
3344
|
}) : null]
|
|
3366
3345
|
});
|
|
3367
3346
|
}
|
|
@@ -3375,9 +3354,10 @@ function ButtonContent({
|
|
|
3375
3354
|
isPressed,
|
|
3376
3355
|
isFocused,
|
|
3377
3356
|
innerSpacing,
|
|
3357
|
+
size,
|
|
3378
3358
|
...props
|
|
3379
3359
|
}) {
|
|
3380
|
-
const color =
|
|
3360
|
+
const color = getButtonTextColorByType(type, variant, isHovered, isPressed, isDisabled);
|
|
3381
3361
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3382
3362
|
_web: {
|
|
3383
3363
|
// Make the multilines case work properly on web
|
|
@@ -3392,56 +3372,33 @@ function ButtonContent({
|
|
|
3392
3372
|
isDisabled: isDisabled,
|
|
3393
3373
|
color: color,
|
|
3394
3374
|
innerSpacing: innerSpacing,
|
|
3375
|
+
isHovered: isHovered,
|
|
3376
|
+
isPressed: isPressed,
|
|
3377
|
+
size: size,
|
|
3395
3378
|
...props,
|
|
3396
3379
|
children: children
|
|
3397
3380
|
})
|
|
3398
3381
|
});
|
|
3399
3382
|
}
|
|
3400
3383
|
|
|
3401
|
-
function getCurrentPaddingConfig({
|
|
3402
|
-
size
|
|
3403
|
-
}) {
|
|
3404
|
-
if (size === 'large') return 'large';
|
|
3405
|
-
if (size === 'xLarge') return 'xLarge';
|
|
3406
|
-
return 'default';
|
|
3407
|
-
}
|
|
3408
3384
|
function ButtonPadding({
|
|
3409
3385
|
children,
|
|
3410
3386
|
size,
|
|
3411
3387
|
hasBadge
|
|
3412
3388
|
}) {
|
|
3413
|
-
const currentPaddingKey = getCurrentPaddingConfig({
|
|
3414
|
-
size
|
|
3415
|
-
});
|
|
3416
3389
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3417
3390
|
position: "relative",
|
|
3418
3391
|
flexDirection: "row",
|
|
3419
3392
|
alignItems: "center",
|
|
3420
3393
|
justifyContent: "center",
|
|
3421
|
-
paddingX: `kitt.button.padding.${
|
|
3422
|
-
paddingY: `kitt.button.padding.${
|
|
3423
|
-
paddingRight: hasBadge ? `kitt.button.padding.${currentPaddingKey}.hasBadge.right` : undefined,
|
|
3394
|
+
paddingX: `kitt.button.padding.${size}.horizontal`,
|
|
3395
|
+
paddingY: `kitt.button.padding.${size}.vertical`,
|
|
3424
3396
|
minHeight: "kitt.button.minHeight",
|
|
3425
3397
|
children: children
|
|
3426
3398
|
});
|
|
3427
3399
|
}
|
|
3428
3400
|
|
|
3429
|
-
function DisabledBorder() {
|
|
3430
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3431
|
-
position: "absolute",
|
|
3432
|
-
top: 0,
|
|
3433
|
-
left: 0,
|
|
3434
|
-
right: 0,
|
|
3435
|
-
bottom: 0,
|
|
3436
|
-
borderWidth: "kitt.button.borderWidth.disabled",
|
|
3437
|
-
borderColor: "kitt.button.disabled.default.borderColor",
|
|
3438
|
-
borderRadius: "kitt.button.borderRadius"
|
|
3439
|
-
});
|
|
3440
|
-
}
|
|
3441
|
-
|
|
3442
3401
|
function FocusBorder({
|
|
3443
|
-
type,
|
|
3444
|
-
variant,
|
|
3445
3402
|
isFocused,
|
|
3446
3403
|
isHovered,
|
|
3447
3404
|
isPressed
|
|
@@ -3451,11 +3408,13 @@ function FocusBorder({
|
|
|
3451
3408
|
button: buttonTheme
|
|
3452
3409
|
}
|
|
3453
3410
|
} = useTheme();
|
|
3411
|
+
const outerBorderRadius = buttonTheme.borderRadius + buttonTheme.borderWidth.focus;
|
|
3412
|
+
const innerBorderRadius = buttonTheme.borderRadius;
|
|
3454
3413
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3455
3414
|
_web: {
|
|
3456
3415
|
style: {
|
|
3457
|
-
width: `calc(100% + ${buttonTheme.
|
|
3458
|
-
height: `calc(100% + ${buttonTheme.
|
|
3416
|
+
width: `calc(100% + ${buttonTheme.borderRadius}px)`,
|
|
3417
|
+
height: `calc(100% + ${buttonTheme.borderRadius}px)`,
|
|
3459
3418
|
transitionProperty: 'opacity',
|
|
3460
3419
|
transitionDuration: buttonTheme.transition.duration,
|
|
3461
3420
|
transitionTimingFunction: buttonTheme.transition.timingFunction
|
|
@@ -3463,11 +3422,12 @@ function FocusBorder({
|
|
|
3463
3422
|
},
|
|
3464
3423
|
opacity: isFocused && !(isPressed || isHovered) ? 1 : 0,
|
|
3465
3424
|
position: "absolute",
|
|
3466
|
-
left: -buttonTheme.borderWidth.focus,
|
|
3467
|
-
top: -buttonTheme.borderWidth.focus,
|
|
3468
3425
|
borderWidth: "kitt.button.borderWidth.focus",
|
|
3469
|
-
borderColor:
|
|
3470
|
-
borderRadius:
|
|
3426
|
+
borderColor: "kitt.button.focusBorderColor",
|
|
3427
|
+
borderRadius: outerBorderRadius,
|
|
3428
|
+
children: /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3429
|
+
borderRadius: innerBorderRadius
|
|
3430
|
+
})
|
|
3471
3431
|
});
|
|
3472
3432
|
}
|
|
3473
3433
|
|
|
@@ -3479,27 +3439,14 @@ function useNativeAnimation$5() {
|
|
|
3479
3439
|
};
|
|
3480
3440
|
}
|
|
3481
3441
|
|
|
3482
|
-
const getButtonSize = ({
|
|
3483
|
-
large,
|
|
3484
|
-
xLarge,
|
|
3485
|
-
size
|
|
3486
|
-
}) => {
|
|
3487
|
-
if (large) return 'large';
|
|
3488
|
-
if (xLarge) return 'xLarge';
|
|
3489
|
-
return size;
|
|
3490
|
-
};
|
|
3491
|
-
|
|
3492
|
-
const allowedGhostTypes = ['primary', 'default', 'danger'];
|
|
3493
3442
|
const Button = /*#__PURE__*/react.forwardRef(({
|
|
3494
3443
|
children,
|
|
3495
|
-
type = '
|
|
3444
|
+
type = 'secondary',
|
|
3496
3445
|
variant = 'default',
|
|
3497
3446
|
disabled,
|
|
3498
3447
|
stretch,
|
|
3499
|
-
large,
|
|
3500
|
-
xLarge,
|
|
3501
3448
|
icon,
|
|
3502
|
-
size
|
|
3449
|
+
size = 'default',
|
|
3503
3450
|
iconPosition = 'left',
|
|
3504
3451
|
testID,
|
|
3505
3452
|
href,
|
|
@@ -3522,18 +3469,9 @@ const Button = /*#__PURE__*/react.forwardRef(({
|
|
|
3522
3469
|
onPressOut,
|
|
3523
3470
|
animatedStyles
|
|
3524
3471
|
} = useNativeAnimation$5();
|
|
3525
|
-
if (
|
|
3526
|
-
throw new Error('variant
|
|
3472
|
+
if (process.env.NODE_ENV !== 'production' && variant === 'revert' && type === 'tertiary-danger') {
|
|
3473
|
+
throw new Error('Invalid revert variant for tertiary-danger button type. Only default variant is allowed.');
|
|
3527
3474
|
}
|
|
3528
|
-
if (large || xLarge) {
|
|
3529
|
-
const deprecatedProp = large ? 'large' : 'xLarge';
|
|
3530
|
-
deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
|
|
3531
|
-
}
|
|
3532
|
-
const size = getButtonSize({
|
|
3533
|
-
large,
|
|
3534
|
-
xLarge,
|
|
3535
|
-
size: sizeProp
|
|
3536
|
-
});
|
|
3537
3475
|
return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
|
|
3538
3476
|
ref: ref,
|
|
3539
3477
|
disabled: disabled,
|
|
@@ -3545,6 +3483,7 @@ const Button = /*#__PURE__*/react.forwardRef(({
|
|
|
3545
3483
|
alignSelf: createResponsiveStyleFromProp(stretch, undefined, 'flex-start'),
|
|
3546
3484
|
minWidth: "kitt.button.minWidth",
|
|
3547
3485
|
maxWidth: createResponsiveStyleFromProp(stretch, '100%', 'kitt.button.maxWidth'),
|
|
3486
|
+
maxHeight: "kitt.button.maxHeight",
|
|
3548
3487
|
width: createResponsiveStyleFromProp(stretch, '100%', 'auto'),
|
|
3549
3488
|
onPress: onPress,
|
|
3550
3489
|
onPressIn: onPressIn,
|
|
@@ -3580,10 +3519,9 @@ const Button = /*#__PURE__*/react.forwardRef(({
|
|
|
3580
3519
|
isPressed: isPressed,
|
|
3581
3520
|
isFocused: isFocused,
|
|
3582
3521
|
innerSpacing: innerSpacing,
|
|
3522
|
+
size: size,
|
|
3583
3523
|
children: children
|
|
3584
|
-
}),
|
|
3585
|
-
type: type,
|
|
3586
|
-
variant: variant,
|
|
3524
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FocusBorder, {
|
|
3587
3525
|
isFocused: isFocused || isFocusedInternal,
|
|
3588
3526
|
isHovered: isHovered,
|
|
3589
3527
|
isPressed: isPressed
|
|
@@ -3725,7 +3663,7 @@ function Actions({
|
|
|
3725
3663
|
flexGrow: 1,
|
|
3726
3664
|
reversed: isReversed,
|
|
3727
3665
|
...props,
|
|
3728
|
-
space: "kitt.
|
|
3666
|
+
space: "kitt.2",
|
|
3729
3667
|
children: children
|
|
3730
3668
|
});
|
|
3731
3669
|
}
|
|
@@ -7828,7 +7766,8 @@ function InfoCard({
|
|
|
7828
7766
|
icon: /*#__PURE__*/jsxRuntime.jsx(phosphor.CaretRightRegularIcon, {})
|
|
7829
7767
|
}) : /*#__PURE__*/jsxRuntime.jsx(nativeBase.View, {
|
|
7830
7768
|
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
7831
|
-
type:
|
|
7769
|
+
type: "tertiary",
|
|
7770
|
+
variant: isContrastReversed ? 'revert' : undefined,
|
|
7832
7771
|
onPress: onPress,
|
|
7833
7772
|
children: action?.label
|
|
7834
7773
|
})
|
|
@@ -8448,14 +8387,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
8448
8387
|
}
|
|
8449
8388
|
},
|
|
8450
8389
|
button: {
|
|
8451
|
-
default: theme.button.default,
|
|
8452
|
-
dark: theme.button.dark,
|
|
8453
8390
|
primary: theme.button.primary,
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
'
|
|
8457
|
-
|
|
8458
|
-
disabled: theme.button.disabled
|
|
8391
|
+
secondary: theme.button.secondary,
|
|
8392
|
+
tertiary: theme.button.tertiary,
|
|
8393
|
+
'tertiary-danger': theme.button['tertiary-danger'],
|
|
8394
|
+
focusBorderColor: theme.button.focusBorderColor
|
|
8459
8395
|
},
|
|
8460
8396
|
choices: {
|
|
8461
8397
|
item: {
|
|
@@ -8884,7 +8820,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
8884
8820
|
iconButton: {
|
|
8885
8821
|
borderColor: theme.iconButton.borderColor,
|
|
8886
8822
|
disabled: {
|
|
8887
|
-
borderColor: theme.iconButton.disabled.borderColor,
|
|
8888
8823
|
backgroundColor: theme.iconButton.disabled.backgroundColor
|
|
8889
8824
|
},
|
|
8890
8825
|
black: {
|
|
@@ -9438,7 +9373,16 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
9438
9373
|
button: {
|
|
9439
9374
|
minWidth: theme.button.minWidth,
|
|
9440
9375
|
maxWidth: theme.button.maxWidth,
|
|
9441
|
-
minHeight: theme.button.minHeight
|
|
9376
|
+
minHeight: theme.button.minHeight,
|
|
9377
|
+
maxHeight: theme.button.maxHeight,
|
|
9378
|
+
icon: {
|
|
9379
|
+
default: {
|
|
9380
|
+
size: theme.button.icon.default.size
|
|
9381
|
+
},
|
|
9382
|
+
medium: {
|
|
9383
|
+
size: theme.button.icon.medium.size
|
|
9384
|
+
}
|
|
9385
|
+
}
|
|
9442
9386
|
},
|
|
9443
9387
|
buttonBadge: {
|
|
9444
9388
|
dimensions: {
|
|
@@ -9834,7 +9778,10 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
9834
9778
|
}
|
|
9835
9779
|
},
|
|
9836
9780
|
button: {
|
|
9837
|
-
padding:
|
|
9781
|
+
padding: {
|
|
9782
|
+
default: theme.button.padding.default,
|
|
9783
|
+
medium: theme.button.padding.medium
|
|
9784
|
+
}
|
|
9838
9785
|
},
|
|
9839
9786
|
cardModal: {
|
|
9840
9787
|
overlayPadding: theme.cardModal.overlayPadding
|