@ornikar/kitt-universal 27.0.0 → 27.0.1-canary.e2bc67122aa41f65986d23f21317b442b05d8963.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 +14 -0
- 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 +1 -1
- 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 +260 -322
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +259 -307
- 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 +130 -116
- package/dist/linaria-themes.es.js.map +1 -1
- package/dist/linaria-themes.es.web.js +130 -116
- package/dist/linaria-themes.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
- 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
|
@@ -561,15 +561,18 @@ const bottomSheet = {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
|
|
564
|
+
// Strongly typed theme so every new type/variant/size can't be added
|
|
565
|
+
// without defined color & backgroundColor or icon size
|
|
566
|
+
|
|
564
567
|
const button = {
|
|
565
|
-
borderRadius:
|
|
568
|
+
borderRadius: 4,
|
|
566
569
|
borderWidth: {
|
|
567
|
-
disabled: 2,
|
|
568
570
|
focus: 3
|
|
569
571
|
},
|
|
570
572
|
minHeight: 40,
|
|
571
573
|
minWidth: 40,
|
|
572
574
|
maxWidth: 335,
|
|
575
|
+
maxHeight: 48,
|
|
573
576
|
scale: {
|
|
574
577
|
base: {
|
|
575
578
|
default: 1,
|
|
@@ -580,148 +583,160 @@ const button = {
|
|
|
580
583
|
hover: 1.05
|
|
581
584
|
}
|
|
582
585
|
},
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
586
|
+
icon: {
|
|
587
|
+
medium: {
|
|
588
|
+
size: 24
|
|
589
|
+
},
|
|
590
|
+
default: {
|
|
591
|
+
size: 20
|
|
592
|
+
}
|
|
588
593
|
},
|
|
589
594
|
padding: {
|
|
590
595
|
default: {
|
|
591
|
-
hasBadge: {
|
|
592
|
-
right: 8
|
|
593
|
-
},
|
|
594
596
|
horizontal: 16,
|
|
595
|
-
vertical:
|
|
596
|
-
},
|
|
597
|
-
large: {
|
|
598
|
-
hasBadge: {
|
|
599
|
-
right: 12
|
|
600
|
-
},
|
|
601
|
-
horizontal: 24,
|
|
602
|
-
vertical: 11
|
|
597
|
+
vertical: 8
|
|
603
598
|
},
|
|
604
|
-
|
|
605
|
-
hasBadge: {
|
|
606
|
-
right: 12
|
|
607
|
-
},
|
|
599
|
+
medium: {
|
|
608
600
|
horizontal: 24,
|
|
609
|
-
vertical:
|
|
601
|
+
vertical: 12
|
|
610
602
|
}
|
|
611
603
|
},
|
|
612
604
|
transition: {
|
|
613
605
|
duration: '200ms',
|
|
614
606
|
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
615
607
|
},
|
|
616
|
-
|
|
617
|
-
default: {
|
|
618
|
-
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
619
|
-
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
620
|
-
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
621
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
622
|
-
},
|
|
623
|
-
ghost: {
|
|
624
|
-
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
625
|
-
pressedBackgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
626
|
-
hoverBackgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
627
|
-
focusBorderColor: 'rgba(255, 255, 255, 0.4)',
|
|
628
|
-
color: deepPurpleColorPalette.white,
|
|
629
|
-
hoverColor: deepPurpleColorPalette.white,
|
|
630
|
-
activeColor: deepPurpleColorPalette.white
|
|
631
|
-
}
|
|
632
|
-
},
|
|
608
|
+
focusBorderColor: deepPurpleColorPalette['blue.2'],
|
|
633
609
|
primary: {
|
|
634
610
|
default: {
|
|
635
|
-
backgroundColor:
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
611
|
+
backgroundColor: {
|
|
612
|
+
default: colors.primary,
|
|
613
|
+
hover: deepPurpleColorPalette['deepPurple.7'],
|
|
614
|
+
pressed: deepPurpleColorPalette['deepPurple.7'],
|
|
615
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
616
|
+
focus: colors.primary
|
|
617
|
+
},
|
|
618
|
+
color: {
|
|
619
|
+
default: colors.white,
|
|
620
|
+
hover: colors.white,
|
|
621
|
+
pressed: colors.white,
|
|
622
|
+
disabled: colors.disabled,
|
|
623
|
+
focus: colors.white
|
|
624
|
+
}
|
|
639
625
|
},
|
|
640
|
-
|
|
641
|
-
backgroundColor:
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.8)'
|
|
626
|
+
revert: {
|
|
627
|
+
backgroundColor: {
|
|
628
|
+
default: colors.white,
|
|
629
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
630
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
631
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
632
|
+
focus: colors.white
|
|
633
|
+
},
|
|
634
|
+
color: {
|
|
635
|
+
default: colors.black,
|
|
636
|
+
hover: colors.black,
|
|
637
|
+
pressed: colors.black,
|
|
638
|
+
disabled: colors.disabled,
|
|
639
|
+
focus: colors.black
|
|
640
|
+
}
|
|
656
641
|
}
|
|
657
642
|
},
|
|
658
|
-
|
|
643
|
+
secondary: {
|
|
659
644
|
default: {
|
|
660
|
-
backgroundColor:
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
645
|
+
backgroundColor: {
|
|
646
|
+
default: deepPurpleColorPalette['beige-alpha.25'],
|
|
647
|
+
hover: deepPurpleColorPalette['beige-alpha.40'],
|
|
648
|
+
pressed: deepPurpleColorPalette['beige-alpha.40'],
|
|
649
|
+
disabled: colors.disabled,
|
|
650
|
+
focus: deepPurpleColorPalette['beige-alpha.25']
|
|
651
|
+
},
|
|
652
|
+
color: {
|
|
653
|
+
default: colors.black,
|
|
654
|
+
hover: colors.black,
|
|
655
|
+
pressed: colors.black,
|
|
656
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
657
|
+
focus: colors.black
|
|
658
|
+
}
|
|
664
659
|
},
|
|
665
|
-
|
|
666
|
-
backgroundColor:
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
681
|
-
color: colors.primary,
|
|
682
|
-
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
683
|
-
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
|
-
'subtle-dark': {
|
|
687
|
-
default: {
|
|
688
|
-
backgroundColor: colors.transparent,
|
|
689
|
-
pressedBackgroundColor: colors.transparent,
|
|
690
|
-
hoverBackgroundColor: colors.transparent,
|
|
691
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
692
|
-
color: colors.black,
|
|
693
|
-
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
694
|
-
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
660
|
+
revert: {
|
|
661
|
+
backgroundColor: {
|
|
662
|
+
default: deepPurpleColorPalette['white-alpha.10'],
|
|
663
|
+
hover: deepPurpleColorPalette['white-alpha.20'],
|
|
664
|
+
pressed: deepPurpleColorPalette['white-alpha.20'],
|
|
665
|
+
disabled: colors.disabled,
|
|
666
|
+
focus: deepPurpleColorPalette['white-alpha.10']
|
|
667
|
+
},
|
|
668
|
+
color: {
|
|
669
|
+
default: colors.white,
|
|
670
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
671
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
672
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
673
|
+
focus: colors.white
|
|
674
|
+
}
|
|
695
675
|
}
|
|
696
676
|
},
|
|
697
|
-
|
|
677
|
+
tertiary: {
|
|
698
678
|
default: {
|
|
699
|
-
backgroundColor:
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
679
|
+
backgroundColor: {
|
|
680
|
+
default: 'transparent',
|
|
681
|
+
hover: 'transparent',
|
|
682
|
+
pressed: 'transparent',
|
|
683
|
+
disabled: 'transparent',
|
|
684
|
+
focus: 'transparent'
|
|
685
|
+
},
|
|
686
|
+
color: {
|
|
687
|
+
default: colors.black,
|
|
688
|
+
hover: colors.blackAnthracite,
|
|
689
|
+
pressed: colors.blackAnthracite,
|
|
690
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
691
|
+
focus: colors.black
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
revert: {
|
|
695
|
+
backgroundColor: {
|
|
696
|
+
default: 'transparent',
|
|
697
|
+
hover: 'transparent',
|
|
698
|
+
pressed: 'transparent',
|
|
699
|
+
disabled: 'transparent',
|
|
700
|
+
focus: 'transparent'
|
|
701
|
+
},
|
|
702
|
+
color: {
|
|
703
|
+
default: colors.white,
|
|
704
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
705
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
706
|
+
disabled: deepPurpleColorPalette['white-alpha.20'],
|
|
707
|
+
focus: colors.white
|
|
708
|
+
}
|
|
706
709
|
}
|
|
707
710
|
},
|
|
708
|
-
|
|
711
|
+
'tertiary-danger': {
|
|
709
712
|
default: {
|
|
710
|
-
backgroundColor:
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
backgroundColor: {
|
|
714
|
+
default: 'transparent',
|
|
715
|
+
hover: 'transparent',
|
|
716
|
+
pressed: 'transparent',
|
|
717
|
+
disabled: 'transparent',
|
|
718
|
+
focus: 'transparent'
|
|
719
|
+
},
|
|
720
|
+
color: {
|
|
721
|
+
default: colors.danger,
|
|
722
|
+
hover: deepPurpleColorPalette['red.2'],
|
|
723
|
+
pressed: deepPurpleColorPalette['red.2'],
|
|
724
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
725
|
+
focus: colors.danger
|
|
726
|
+
}
|
|
715
727
|
}
|
|
716
728
|
}
|
|
717
729
|
};
|
|
718
730
|
|
|
719
731
|
const buttonBadge = {
|
|
720
|
-
backgroundColor:
|
|
732
|
+
backgroundColor: {
|
|
733
|
+
default: colors.danger,
|
|
734
|
+
disabled: colors.blackLight
|
|
735
|
+
},
|
|
721
736
|
dimensions: {
|
|
722
737
|
withBadge: {
|
|
723
|
-
width:
|
|
724
|
-
height:
|
|
738
|
+
width: 8,
|
|
739
|
+
height: 8
|
|
725
740
|
},
|
|
726
741
|
badgeCount: {
|
|
727
742
|
width: 20,
|
|
@@ -1918,14 +1933,13 @@ const iconButton = {
|
|
|
1918
1933
|
},
|
|
1919
1934
|
disabled: {
|
|
1920
1935
|
scale: 1,
|
|
1921
|
-
backgroundColor: button.
|
|
1922
|
-
borderColor: button.disabled.default.borderColor
|
|
1936
|
+
backgroundColor: button.primary.default.backgroundColor.disabled
|
|
1923
1937
|
},
|
|
1924
1938
|
default: {
|
|
1925
|
-
pressedBackgroundColor: button.
|
|
1939
|
+
pressedBackgroundColor: button.primary.default.backgroundColor.disabled
|
|
1926
1940
|
},
|
|
1927
1941
|
ghost: {
|
|
1928
|
-
pressedBackgroundColor: button.default.
|
|
1942
|
+
pressedBackgroundColor: button.primary.default.backgroundColor.disabled
|
|
1929
1943
|
},
|
|
1930
1944
|
primary: {
|
|
1931
1945
|
pressedBackgroundColor: deepPurpleColorPalette['beige.1']
|
|
@@ -2812,32 +2826,28 @@ function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valu
|
|
|
2812
2826
|
return responsiveValue;
|
|
2813
2827
|
}
|
|
2814
2828
|
|
|
2815
|
-
function warn(message) {
|
|
2816
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2817
|
-
console.warn(message);
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
function deprecatedMessage(symbol, deprecation, replaceBy) {
|
|
2821
|
-
const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
|
|
2822
|
-
warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
|
|
2823
|
-
}
|
|
2824
|
-
function deprecatedInComponent(component, deprecation, replaceBy) {
|
|
2825
|
-
deprecatedMessage(`<${component} />`, deprecation, replaceBy);
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
2829
|
function getCurrentBackgroundColorForNativeBaseTheme({
|
|
2829
2830
|
type,
|
|
2830
2831
|
variant,
|
|
2831
2832
|
isDisabled,
|
|
2832
2833
|
isHovered,
|
|
2833
|
-
isPressed
|
|
2834
|
+
isPressed,
|
|
2835
|
+
isFocused
|
|
2834
2836
|
}) {
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2837
|
+
const baseKey = `kitt.button.${type}.${variant}.backgroundColor`;
|
|
2838
|
+
if (isDisabled) {
|
|
2839
|
+
return `${baseKey}.disabled`;
|
|
2840
|
+
}
|
|
2841
|
+
if (isHovered) {
|
|
2842
|
+
return `${baseKey}.hover`;
|
|
2843
|
+
}
|
|
2844
|
+
if (isPressed) {
|
|
2845
|
+
return `${baseKey}.pressed`;
|
|
2846
|
+
}
|
|
2847
|
+
if (isFocused) {
|
|
2848
|
+
return `${baseKey}.focused`;
|
|
2839
2849
|
}
|
|
2840
|
-
return `${baseKey}.
|
|
2850
|
+
return `${baseKey}.default`;
|
|
2841
2851
|
}
|
|
2842
2852
|
|
|
2843
2853
|
function AnimatedContainer$2({
|
|
@@ -3031,7 +3041,6 @@ function Typography({
|
|
|
3031
3041
|
},
|
|
3032
3042
|
variant,
|
|
3033
3043
|
color,
|
|
3034
|
-
underline,
|
|
3035
3044
|
...otherProps
|
|
3036
3045
|
}) {
|
|
3037
3046
|
const sx = nativeBase.useSx();
|
|
@@ -3070,15 +3079,9 @@ function Typography({
|
|
|
3070
3079
|
lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
|
|
3071
3080
|
fontWeight: webFontWeight,
|
|
3072
3081
|
fontFamily: nativeFontFamily,
|
|
3073
|
-
borderBottomWidth: underline ? 1 : undefined,
|
|
3074
|
-
borderBottomColor: underline ? currentColorValue : undefined,
|
|
3075
3082
|
textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined,
|
|
3076
3083
|
...colorStyles,
|
|
3077
|
-
...otherProps
|
|
3078
|
-
// The property text-underline-offset is not on native.
|
|
3079
|
-
// To add an underline with an offset, we use a custom borderBottomWidth and color.
|
|
3080
|
-
// and we set underline to undefined to avoid a double underline
|
|
3081
|
-
underline: undefined
|
|
3084
|
+
...otherProps
|
|
3082
3085
|
});
|
|
3083
3086
|
const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(TypographyFamilyContext.Provider, {
|
|
3084
3087
|
value: typographyFamily,
|
|
@@ -3130,13 +3133,15 @@ Typography.Header6 = createHeading(6);
|
|
|
3130
3133
|
|
|
3131
3134
|
function ButtonBadge({
|
|
3132
3135
|
withBadge,
|
|
3133
|
-
badgeCount
|
|
3136
|
+
badgeCount,
|
|
3137
|
+
disabled
|
|
3134
3138
|
}) {
|
|
3139
|
+
const backgroundColor = disabled ? 'kitt.buttonBadge.backgroundColor.disabled' : 'kitt.buttonBadge.backgroundColor.default';
|
|
3135
3140
|
if (withBadge) {
|
|
3136
3141
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3137
3142
|
height: "kitt.buttonBadge.dimensions.withBadge.height",
|
|
3138
3143
|
width: "kitt.buttonBadge.dimensions.withBadge.width",
|
|
3139
|
-
backgroundColor:
|
|
3144
|
+
backgroundColor: backgroundColor,
|
|
3140
3145
|
borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
|
|
3141
3146
|
});
|
|
3142
3147
|
}
|
|
@@ -3146,7 +3151,7 @@ function ButtonBadge({
|
|
|
3146
3151
|
justifyContent: "center",
|
|
3147
3152
|
height: "kitt.buttonBadge.dimensions.badgeCount.height",
|
|
3148
3153
|
width: "kitt.buttonBadge.dimensions.badgeCount.width",
|
|
3149
|
-
backgroundColor:
|
|
3154
|
+
backgroundColor: backgroundColor,
|
|
3150
3155
|
borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
|
|
3151
3156
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3152
3157
|
base: "body-xs",
|
|
@@ -3241,103 +3246,77 @@ function TypographyIcon({
|
|
|
3241
3246
|
});
|
|
3242
3247
|
}
|
|
3243
3248
|
|
|
3244
|
-
const getButtonTextColorByType = (type, variant, isHovered, isPressed) => {
|
|
3245
|
-
const
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
case 'danger':
|
|
3252
|
-
return 'danger';
|
|
3253
|
-
case 'subtle':
|
|
3254
|
-
return isButtonInteractedWith ? 'primary-light' : 'primary';
|
|
3255
|
-
case 'subtle-dark':
|
|
3256
|
-
return isButtonInteractedWith ? 'black-light' : 'black';
|
|
3257
|
-
case 'subtle-revert':
|
|
3258
|
-
return 'white';
|
|
3259
|
-
case 'default':
|
|
3260
|
-
return variant === 'ghost' ? 'white' : 'black';
|
|
3261
|
-
default:
|
|
3262
|
-
return 'black';
|
|
3249
|
+
const getButtonTextColorByType = (type, variant, isHovered, isPressed, isDisabled) => {
|
|
3250
|
+
const baseKey = `kitt.button.${type}.${variant}.color`;
|
|
3251
|
+
if (isDisabled) {
|
|
3252
|
+
return `${baseKey}.disabled`;
|
|
3253
|
+
}
|
|
3254
|
+
if (isHovered || isPressed) {
|
|
3255
|
+
return `${baseKey}.hover`;
|
|
3263
3256
|
}
|
|
3257
|
+
return `${baseKey}.default`;
|
|
3264
3258
|
};
|
|
3265
3259
|
|
|
3266
|
-
function ButtonIcon({
|
|
3267
|
-
icon,
|
|
3268
|
-
color,
|
|
3269
|
-
iconPosition,
|
|
3270
|
-
testID
|
|
3271
|
-
}) {
|
|
3272
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3273
|
-
marginRight: iconPosition === 'left' ? 'kitt.2' : 0,
|
|
3274
|
-
marginLeft: iconPosition === 'right' ? 'kitt.2' : 0,
|
|
3275
|
-
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3276
|
-
icon: icon,
|
|
3277
|
-
testID: testID,
|
|
3278
|
-
color: color
|
|
3279
|
-
})
|
|
3280
|
-
});
|
|
3281
|
-
}
|
|
3282
3260
|
function ButtonContentChildren({
|
|
3283
3261
|
type,
|
|
3284
3262
|
icon,
|
|
3285
3263
|
iconPosition,
|
|
3286
3264
|
innerSpacing,
|
|
3265
|
+
isDisabled,
|
|
3287
3266
|
withBadge,
|
|
3288
3267
|
badgeCount,
|
|
3289
3268
|
color,
|
|
3290
|
-
children
|
|
3269
|
+
children,
|
|
3270
|
+
isPressed,
|
|
3271
|
+
isHovered,
|
|
3272
|
+
size = 'default'
|
|
3291
3273
|
}) {
|
|
3292
3274
|
if ((process.env.NODE_ENV !== "production")) {
|
|
3293
3275
|
if (!(children || icon)) {
|
|
3294
3276
|
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
3295
3277
|
}
|
|
3296
3278
|
}
|
|
3297
|
-
if (!children) {
|
|
3298
|
-
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon
|
|
3299
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3300
|
-
, {
|
|
3279
|
+
if (!children && icon) {
|
|
3280
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3301
3281
|
icon: icon,
|
|
3302
3282
|
color: color
|
|
3303
3283
|
});
|
|
3304
3284
|
}
|
|
3305
|
-
const buttonIconSharedProps = {
|
|
3306
|
-
type,
|
|
3307
|
-
iconPosition,
|
|
3308
|
-
color
|
|
3309
|
-
};
|
|
3310
|
-
|
|
3311
3285
|
// Make the multilines case work properly on native - Breaks the web implem
|
|
3312
3286
|
const sharedNativeStyle = {
|
|
3313
3287
|
flexShrink: 1
|
|
3314
3288
|
};
|
|
3315
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
3289
|
+
return /*#__PURE__*/jsxRuntime.jsxs(nativeBase.HStack, {
|
|
3316
3290
|
alignItems: "center",
|
|
3317
3291
|
justifyContent: innerSpacing,
|
|
3318
|
-
|
|
3319
|
-
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(
|
|
3320
|
-
...
|
|
3292
|
+
space: "kitt.2",
|
|
3293
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3294
|
+
...{
|
|
3295
|
+
type,
|
|
3296
|
+
color
|
|
3297
|
+
},
|
|
3321
3298
|
testID: "button.ButtonContent.leftButtonIcon",
|
|
3322
|
-
icon: icon
|
|
3299
|
+
icon: icon,
|
|
3300
|
+
color: color,
|
|
3301
|
+
size: `kitt.button.icon.${size}.size`
|
|
3323
3302
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
|
|
3324
3303
|
/* On native code, this is the only way to ensure that the text is centered */
|
|
3325
3304
|
textAlign: "center",
|
|
3326
3305
|
_android: sharedNativeStyle,
|
|
3327
3306
|
_ios: sharedNativeStyle,
|
|
3328
|
-
base: "
|
|
3329
|
-
variant: "
|
|
3307
|
+
base: "label-large",
|
|
3308
|
+
variant: "semibold",
|
|
3309
|
+
underline: (type === 'tertiary' || type === 'tertiary-danger') && !isHovered && !isPressed,
|
|
3330
3310
|
color: color,
|
|
3331
3311
|
children: children
|
|
3332
|
-
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
})
|
|
3312
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
3313
|
+
icon: icon,
|
|
3314
|
+
color: color,
|
|
3315
|
+
size: `kitt.button.icon.${size}.size`
|
|
3316
|
+
}) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
|
|
3317
|
+
disabled: isDisabled,
|
|
3318
|
+
withBadge: withBadge,
|
|
3319
|
+
badgeCount: badgeCount
|
|
3341
3320
|
}) : null]
|
|
3342
3321
|
});
|
|
3343
3322
|
}
|
|
@@ -3351,9 +3330,10 @@ function ButtonContent({
|
|
|
3351
3330
|
isPressed,
|
|
3352
3331
|
isFocused,
|
|
3353
3332
|
innerSpacing,
|
|
3333
|
+
size,
|
|
3354
3334
|
...props
|
|
3355
3335
|
}) {
|
|
3356
|
-
const color =
|
|
3336
|
+
const color = getButtonTextColorByType(type, variant, isHovered, isPressed, isDisabled);
|
|
3357
3337
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3358
3338
|
_web: {
|
|
3359
3339
|
// Make the multilines case work properly on web
|
|
@@ -3368,56 +3348,33 @@ function ButtonContent({
|
|
|
3368
3348
|
isDisabled: isDisabled,
|
|
3369
3349
|
color: color,
|
|
3370
3350
|
innerSpacing: innerSpacing,
|
|
3351
|
+
isHovered: isHovered,
|
|
3352
|
+
isPressed: isPressed,
|
|
3353
|
+
size: size,
|
|
3371
3354
|
...props,
|
|
3372
3355
|
children: children
|
|
3373
3356
|
})
|
|
3374
3357
|
});
|
|
3375
3358
|
}
|
|
3376
3359
|
|
|
3377
|
-
function getCurrentPaddingConfig({
|
|
3378
|
-
size
|
|
3379
|
-
}) {
|
|
3380
|
-
if (size === 'large') return 'large';
|
|
3381
|
-
if (size === 'xLarge') return 'xLarge';
|
|
3382
|
-
return 'default';
|
|
3383
|
-
}
|
|
3384
3360
|
function ButtonPadding({
|
|
3385
3361
|
children,
|
|
3386
3362
|
size,
|
|
3387
3363
|
hasBadge
|
|
3388
3364
|
}) {
|
|
3389
|
-
const currentPaddingKey = getCurrentPaddingConfig({
|
|
3390
|
-
size
|
|
3391
|
-
});
|
|
3392
3365
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3393
3366
|
position: "relative",
|
|
3394
3367
|
flexDirection: "row",
|
|
3395
3368
|
alignItems: "center",
|
|
3396
3369
|
justifyContent: "center",
|
|
3397
|
-
paddingX: `kitt.button.padding.${
|
|
3398
|
-
paddingY: `kitt.button.padding.${
|
|
3399
|
-
paddingRight: hasBadge ? `kitt.button.padding.${currentPaddingKey}.hasBadge.right` : undefined,
|
|
3370
|
+
paddingX: `kitt.button.padding.${size}.horizontal`,
|
|
3371
|
+
paddingY: `kitt.button.padding.${size}.vertical`,
|
|
3400
3372
|
minHeight: "kitt.button.minHeight",
|
|
3401
3373
|
children: children
|
|
3402
3374
|
});
|
|
3403
3375
|
}
|
|
3404
3376
|
|
|
3405
|
-
function DisabledBorder() {
|
|
3406
|
-
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3407
|
-
position: "absolute",
|
|
3408
|
-
top: 0,
|
|
3409
|
-
left: 0,
|
|
3410
|
-
right: 0,
|
|
3411
|
-
bottom: 0,
|
|
3412
|
-
borderWidth: "kitt.button.borderWidth.disabled",
|
|
3413
|
-
borderColor: "kitt.button.disabled.default.borderColor",
|
|
3414
|
-
borderRadius: "kitt.button.borderRadius"
|
|
3415
|
-
});
|
|
3416
|
-
}
|
|
3417
|
-
|
|
3418
3377
|
function FocusBorder({
|
|
3419
|
-
type,
|
|
3420
|
-
variant,
|
|
3421
3378
|
isFocused,
|
|
3422
3379
|
isHovered,
|
|
3423
3380
|
isPressed
|
|
@@ -3427,11 +3384,13 @@ function FocusBorder({
|
|
|
3427
3384
|
button: buttonTheme
|
|
3428
3385
|
}
|
|
3429
3386
|
} = useTheme();
|
|
3387
|
+
const outerBorderRadius = buttonTheme.borderRadius + buttonTheme.borderWidth.focus;
|
|
3388
|
+
const innerBorderRadius = buttonTheme.borderRadius;
|
|
3430
3389
|
return /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3431
3390
|
_web: {
|
|
3432
3391
|
style: {
|
|
3433
|
-
width: `calc(100% + ${buttonTheme.
|
|
3434
|
-
height: `calc(100% + ${buttonTheme.
|
|
3392
|
+
width: `calc(100% + ${buttonTheme.borderRadius}px)`,
|
|
3393
|
+
height: `calc(100% + ${buttonTheme.borderRadius}px)`,
|
|
3435
3394
|
transitionProperty: 'opacity',
|
|
3436
3395
|
transitionDuration: buttonTheme.transition.duration,
|
|
3437
3396
|
transitionTimingFunction: buttonTheme.transition.timingFunction
|
|
@@ -3439,25 +3398,15 @@ function FocusBorder({
|
|
|
3439
3398
|
},
|
|
3440
3399
|
opacity: isFocused && !(isPressed || isHovered) ? 1 : 0,
|
|
3441
3400
|
position: "absolute",
|
|
3442
|
-
left: -buttonTheme.borderWidth.focus,
|
|
3443
|
-
top: -buttonTheme.borderWidth.focus,
|
|
3444
3401
|
borderWidth: "kitt.button.borderWidth.focus",
|
|
3445
|
-
borderColor:
|
|
3446
|
-
borderRadius:
|
|
3402
|
+
borderColor: "kitt.button.focusBorderColor",
|
|
3403
|
+
borderRadius: outerBorderRadius,
|
|
3404
|
+
children: /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
3405
|
+
borderRadius: innerBorderRadius
|
|
3406
|
+
})
|
|
3447
3407
|
});
|
|
3448
3408
|
}
|
|
3449
3409
|
|
|
3450
|
-
const hasVariant = (button, variant) => {
|
|
3451
|
-
return variant in button;
|
|
3452
|
-
};
|
|
3453
|
-
function getVariantValuesIfExist(theme, type, variant) {
|
|
3454
|
-
const button = theme.kitt.button[type];
|
|
3455
|
-
if (hasVariant(button, variant)) {
|
|
3456
|
-
return button[variant];
|
|
3457
|
-
}
|
|
3458
|
-
return theme.kitt.button[type].default;
|
|
3459
|
-
}
|
|
3460
|
-
|
|
3461
3410
|
const useNativeAnimation$5 = ({
|
|
3462
3411
|
type,
|
|
3463
3412
|
variant,
|
|
@@ -3466,16 +3415,12 @@ const useNativeAnimation$5 = ({
|
|
|
3466
3415
|
const theme = useTheme();
|
|
3467
3416
|
const pressed = Animated.useSharedValue(isPressedInternal ? 1 : 0);
|
|
3468
3417
|
const color = Animated.useSharedValue(0);
|
|
3469
|
-
const {
|
|
3470
|
-
backgroundColor,
|
|
3471
|
-
pressedBackgroundColor
|
|
3472
|
-
} = getVariantValuesIfExist(theme, type, variant);
|
|
3473
3418
|
const {
|
|
3474
3419
|
scale
|
|
3475
3420
|
} = theme.kitt.button;
|
|
3476
3421
|
const animatedStyles = Animated.useAnimatedStyle(() => {
|
|
3477
3422
|
return {
|
|
3478
|
-
backgroundColor: Animated.interpolateColor(color.value, [0, 1], [backgroundColor,
|
|
3423
|
+
backgroundColor: Animated.interpolateColor(color.value, [0, 1], [type === 'tertiary-danger' ? theme.kitt.button['tertiary-danger'].default.backgroundColor.default : theme.kitt.button[type][variant].backgroundColor.default, type === 'tertiary-danger' ? theme.kitt.button['tertiary-danger'].default.backgroundColor.pressed : theme.kitt.button[type][variant].backgroundColor.pressed]),
|
|
3479
3424
|
transform: [{
|
|
3480
3425
|
scale: Animated.withSpring(pressed.value ? scale.base.active : scale.base.default)
|
|
3481
3426
|
}]
|
|
@@ -3494,27 +3439,14 @@ const useNativeAnimation$5 = ({
|
|
|
3494
3439
|
};
|
|
3495
3440
|
};
|
|
3496
3441
|
|
|
3497
|
-
const getButtonSize = ({
|
|
3498
|
-
large,
|
|
3499
|
-
xLarge,
|
|
3500
|
-
size
|
|
3501
|
-
}) => {
|
|
3502
|
-
if (large) return 'large';
|
|
3503
|
-
if (xLarge) return 'xLarge';
|
|
3504
|
-
return size;
|
|
3505
|
-
};
|
|
3506
|
-
|
|
3507
|
-
const allowedGhostTypes = ['primary', 'default', 'danger'];
|
|
3508
3442
|
const Button = /*#__PURE__*/React.forwardRef(({
|
|
3509
3443
|
children,
|
|
3510
|
-
type = '
|
|
3444
|
+
type = 'secondary',
|
|
3511
3445
|
variant = 'default',
|
|
3512
3446
|
disabled,
|
|
3513
3447
|
stretch,
|
|
3514
|
-
large,
|
|
3515
|
-
xLarge,
|
|
3516
3448
|
icon,
|
|
3517
|
-
size
|
|
3449
|
+
size = 'default',
|
|
3518
3450
|
iconPosition = 'left',
|
|
3519
3451
|
testID,
|
|
3520
3452
|
href,
|
|
@@ -3540,18 +3472,9 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3540
3472
|
type,
|
|
3541
3473
|
variant
|
|
3542
3474
|
});
|
|
3543
|
-
if (
|
|
3544
|
-
throw new Error('variant
|
|
3475
|
+
if (process.env.NODE_ENV !== 'production' && variant === 'revert' && type === 'tertiary-danger') {
|
|
3476
|
+
throw new Error('Invalid revert variant for tertiary-danger button type. Only default variant is allowed.');
|
|
3545
3477
|
}
|
|
3546
|
-
if (large || xLarge) {
|
|
3547
|
-
const deprecatedProp = large ? 'large' : 'xLarge';
|
|
3548
|
-
deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
|
|
3549
|
-
}
|
|
3550
|
-
const size = getButtonSize({
|
|
3551
|
-
large,
|
|
3552
|
-
xLarge,
|
|
3553
|
-
size: sizeProp
|
|
3554
|
-
});
|
|
3555
3478
|
return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
|
|
3556
3479
|
ref: ref,
|
|
3557
3480
|
disabled: disabled,
|
|
@@ -3563,6 +3486,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3563
3486
|
alignSelf: createResponsiveStyleFromProp(stretch, undefined, 'flex-start'),
|
|
3564
3487
|
minWidth: "kitt.button.minWidth",
|
|
3565
3488
|
maxWidth: createResponsiveStyleFromProp(stretch, '100%', 'kitt.button.maxWidth'),
|
|
3489
|
+
maxHeight: "kitt.button.maxHeight",
|
|
3566
3490
|
width: createResponsiveStyleFromProp(stretch, '100%', 'auto'),
|
|
3567
3491
|
onPress: onPress,
|
|
3568
3492
|
onPressIn: onPressIn,
|
|
@@ -3598,10 +3522,9 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
3598
3522
|
isPressed: isPressed,
|
|
3599
3523
|
isFocused: isFocused,
|
|
3600
3524
|
innerSpacing: innerSpacing,
|
|
3525
|
+
size: size,
|
|
3601
3526
|
children: children
|
|
3602
|
-
}),
|
|
3603
|
-
type: type,
|
|
3604
|
-
variant: variant,
|
|
3527
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FocusBorder, {
|
|
3605
3528
|
isFocused: isFocused || isFocusedInternal,
|
|
3606
3529
|
isHovered: isHovered,
|
|
3607
3530
|
isPressed: isPressed
|
|
@@ -3769,7 +3692,7 @@ function Actions({
|
|
|
3769
3692
|
flexGrow: 1,
|
|
3770
3693
|
reversed: isReversed,
|
|
3771
3694
|
...props,
|
|
3772
|
-
space: "kitt.
|
|
3695
|
+
space: "kitt.2",
|
|
3773
3696
|
children: children
|
|
3774
3697
|
});
|
|
3775
3698
|
}
|
|
@@ -8689,7 +8612,8 @@ function InfoCard({
|
|
|
8689
8612
|
icon: /*#__PURE__*/jsxRuntime.jsx(phosphor.CaretRightRegularIcon, {})
|
|
8690
8613
|
}) : /*#__PURE__*/jsxRuntime.jsx(nativeBase.View, {
|
|
8691
8614
|
children: /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
8692
|
-
type:
|
|
8615
|
+
type: "tertiary",
|
|
8616
|
+
variant: isContrastReversed ? 'revert' : undefined,
|
|
8693
8617
|
onPress: onPress,
|
|
8694
8618
|
children: action?.label
|
|
8695
8619
|
})
|
|
@@ -9226,14 +9150,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
9226
9150
|
}
|
|
9227
9151
|
},
|
|
9228
9152
|
button: {
|
|
9229
|
-
default: theme.button.default,
|
|
9230
|
-
dark: theme.button.dark,
|
|
9231
9153
|
primary: theme.button.primary,
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
'
|
|
9235
|
-
|
|
9236
|
-
disabled: theme.button.disabled
|
|
9154
|
+
secondary: theme.button.secondary,
|
|
9155
|
+
tertiary: theme.button.tertiary,
|
|
9156
|
+
'tertiary-danger': theme.button['tertiary-danger'],
|
|
9157
|
+
focusBorderColor: theme.button.focusBorderColor
|
|
9237
9158
|
},
|
|
9238
9159
|
choices: {
|
|
9239
9160
|
item: {
|
|
@@ -9662,7 +9583,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
9662
9583
|
iconButton: {
|
|
9663
9584
|
borderColor: theme.iconButton.borderColor,
|
|
9664
9585
|
disabled: {
|
|
9665
|
-
borderColor: theme.iconButton.disabled.borderColor,
|
|
9666
9586
|
backgroundColor: theme.iconButton.disabled.backgroundColor
|
|
9667
9587
|
},
|
|
9668
9588
|
black: {
|
|
@@ -10216,7 +10136,16 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
10216
10136
|
button: {
|
|
10217
10137
|
minWidth: theme.button.minWidth,
|
|
10218
10138
|
maxWidth: theme.button.maxWidth,
|
|
10219
|
-
minHeight: theme.button.minHeight
|
|
10139
|
+
minHeight: theme.button.minHeight,
|
|
10140
|
+
maxHeight: theme.button.maxHeight,
|
|
10141
|
+
icon: {
|
|
10142
|
+
default: {
|
|
10143
|
+
size: theme.button.icon.default.size
|
|
10144
|
+
},
|
|
10145
|
+
medium: {
|
|
10146
|
+
size: theme.button.icon.medium.size
|
|
10147
|
+
}
|
|
10148
|
+
}
|
|
10220
10149
|
},
|
|
10221
10150
|
buttonBadge: {
|
|
10222
10151
|
dimensions: {
|
|
@@ -10612,7 +10541,10 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
10612
10541
|
}
|
|
10613
10542
|
},
|
|
10614
10543
|
button: {
|
|
10615
|
-
padding:
|
|
10544
|
+
padding: {
|
|
10545
|
+
default: theme.button.padding.default,
|
|
10546
|
+
medium: theme.button.padding.medium
|
|
10547
|
+
}
|
|
10616
10548
|
},
|
|
10617
10549
|
cardModal: {
|
|
10618
10550
|
overlayPadding: theme.cardModal.overlayPadding
|