@ornikar/kitt-universal 27.0.1-canary.01819bc93ab006bfbaa4e1335cd8afa2380068a0.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 +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
|
@@ -534,15 +534,18 @@ const bottomSheet = {
|
|
|
534
534
|
}
|
|
535
535
|
};
|
|
536
536
|
|
|
537
|
+
// Strongly typed theme so every new type/variant/size can't be added
|
|
538
|
+
// without defined color & backgroundColor or icon size
|
|
539
|
+
|
|
537
540
|
const button = {
|
|
538
|
-
borderRadius:
|
|
541
|
+
borderRadius: 4,
|
|
539
542
|
borderWidth: {
|
|
540
|
-
disabled: 2,
|
|
541
543
|
focus: 3
|
|
542
544
|
},
|
|
543
545
|
minHeight: 40,
|
|
544
546
|
minWidth: 40,
|
|
545
547
|
maxWidth: 335,
|
|
548
|
+
maxHeight: 48,
|
|
546
549
|
scale: {
|
|
547
550
|
base: {
|
|
548
551
|
default: 1,
|
|
@@ -553,148 +556,160 @@ const button = {
|
|
|
553
556
|
hover: 1.05
|
|
554
557
|
}
|
|
555
558
|
},
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
559
|
+
icon: {
|
|
560
|
+
medium: {
|
|
561
|
+
size: 24
|
|
562
|
+
},
|
|
563
|
+
default: {
|
|
564
|
+
size: 20
|
|
565
|
+
}
|
|
561
566
|
},
|
|
562
567
|
padding: {
|
|
563
568
|
default: {
|
|
564
|
-
hasBadge: {
|
|
565
|
-
right: 8
|
|
566
|
-
},
|
|
567
569
|
horizontal: 16,
|
|
568
|
-
vertical:
|
|
570
|
+
vertical: 8
|
|
569
571
|
},
|
|
570
|
-
|
|
571
|
-
hasBadge: {
|
|
572
|
-
right: 12
|
|
573
|
-
},
|
|
574
|
-
horizontal: 24,
|
|
575
|
-
vertical: 11
|
|
576
|
-
},
|
|
577
|
-
xLarge: {
|
|
578
|
-
hasBadge: {
|
|
579
|
-
right: 12
|
|
580
|
-
},
|
|
572
|
+
medium: {
|
|
581
573
|
horizontal: 24,
|
|
582
|
-
vertical:
|
|
574
|
+
vertical: 12
|
|
583
575
|
}
|
|
584
576
|
},
|
|
585
577
|
transition: {
|
|
586
578
|
duration: '200ms',
|
|
587
579
|
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
588
580
|
},
|
|
589
|
-
|
|
590
|
-
default: {
|
|
591
|
-
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
592
|
-
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
593
|
-
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
594
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
595
|
-
},
|
|
596
|
-
ghost: {
|
|
597
|
-
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
598
|
-
pressedBackgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
599
|
-
hoverBackgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
600
|
-
focusBorderColor: 'rgba(255, 255, 255, 0.4)',
|
|
601
|
-
color: deepPurpleColorPalette.white,
|
|
602
|
-
hoverColor: deepPurpleColorPalette.white,
|
|
603
|
-
activeColor: deepPurpleColorPalette.white
|
|
604
|
-
}
|
|
605
|
-
},
|
|
581
|
+
focusBorderColor: deepPurpleColorPalette['blue.2'],
|
|
606
582
|
primary: {
|
|
607
583
|
default: {
|
|
608
|
-
backgroundColor:
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
584
|
+
backgroundColor: {
|
|
585
|
+
default: colors.primary,
|
|
586
|
+
hover: deepPurpleColorPalette['deepPurple.7'],
|
|
587
|
+
pressed: deepPurpleColorPalette['deepPurple.7'],
|
|
588
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
589
|
+
focus: colors.primary
|
|
590
|
+
},
|
|
591
|
+
color: {
|
|
592
|
+
default: colors.white,
|
|
593
|
+
hover: colors.white,
|
|
594
|
+
pressed: colors.white,
|
|
595
|
+
disabled: colors.disabled,
|
|
596
|
+
focus: colors.white
|
|
597
|
+
}
|
|
612
598
|
},
|
|
613
|
-
|
|
614
|
-
backgroundColor:
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.8)'
|
|
599
|
+
revert: {
|
|
600
|
+
backgroundColor: {
|
|
601
|
+
default: colors.white,
|
|
602
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
603
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
604
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
605
|
+
focus: colors.white
|
|
606
|
+
},
|
|
607
|
+
color: {
|
|
608
|
+
default: colors.black,
|
|
609
|
+
hover: colors.black,
|
|
610
|
+
pressed: colors.black,
|
|
611
|
+
disabled: colors.disabled,
|
|
612
|
+
focus: colors.black
|
|
613
|
+
}
|
|
629
614
|
}
|
|
630
615
|
},
|
|
631
|
-
|
|
616
|
+
secondary: {
|
|
632
617
|
default: {
|
|
633
|
-
backgroundColor:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
618
|
+
backgroundColor: {
|
|
619
|
+
default: deepPurpleColorPalette['beige-alpha.25'],
|
|
620
|
+
hover: deepPurpleColorPalette['beige-alpha.40'],
|
|
621
|
+
pressed: deepPurpleColorPalette['beige-alpha.40'],
|
|
622
|
+
disabled: colors.disabled,
|
|
623
|
+
focus: deepPurpleColorPalette['beige-alpha.25']
|
|
624
|
+
},
|
|
625
|
+
color: {
|
|
626
|
+
default: colors.black,
|
|
627
|
+
hover: colors.black,
|
|
628
|
+
pressed: colors.black,
|
|
629
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
630
|
+
focus: colors.black
|
|
631
|
+
}
|
|
637
632
|
},
|
|
638
|
-
|
|
639
|
-
backgroundColor:
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
654
|
-
color: colors.primary,
|
|
655
|
-
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
656
|
-
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
'subtle-dark': {
|
|
660
|
-
default: {
|
|
661
|
-
backgroundColor: colors.transparent,
|
|
662
|
-
pressedBackgroundColor: colors.transparent,
|
|
663
|
-
hoverBackgroundColor: colors.transparent,
|
|
664
|
-
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
665
|
-
color: colors.black,
|
|
666
|
-
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
667
|
-
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
633
|
+
revert: {
|
|
634
|
+
backgroundColor: {
|
|
635
|
+
default: deepPurpleColorPalette['white-alpha.10'],
|
|
636
|
+
hover: deepPurpleColorPalette['white-alpha.20'],
|
|
637
|
+
pressed: deepPurpleColorPalette['white-alpha.20'],
|
|
638
|
+
disabled: colors.disabled,
|
|
639
|
+
focus: deepPurpleColorPalette['white-alpha.10']
|
|
640
|
+
},
|
|
641
|
+
color: {
|
|
642
|
+
default: colors.white,
|
|
643
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
644
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
645
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
646
|
+
focus: colors.white
|
|
647
|
+
}
|
|
668
648
|
}
|
|
669
649
|
},
|
|
670
|
-
|
|
650
|
+
tertiary: {
|
|
671
651
|
default: {
|
|
672
|
-
backgroundColor:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
652
|
+
backgroundColor: {
|
|
653
|
+
default: 'transparent',
|
|
654
|
+
hover: 'transparent',
|
|
655
|
+
pressed: 'transparent',
|
|
656
|
+
disabled: 'transparent',
|
|
657
|
+
focus: 'transparent'
|
|
658
|
+
},
|
|
659
|
+
color: {
|
|
660
|
+
default: colors.black,
|
|
661
|
+
hover: colors.blackAnthracite,
|
|
662
|
+
pressed: colors.blackAnthracite,
|
|
663
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
664
|
+
focus: colors.black
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
revert: {
|
|
668
|
+
backgroundColor: {
|
|
669
|
+
default: 'transparent',
|
|
670
|
+
hover: 'transparent',
|
|
671
|
+
pressed: 'transparent',
|
|
672
|
+
disabled: 'transparent',
|
|
673
|
+
focus: 'transparent'
|
|
674
|
+
},
|
|
675
|
+
color: {
|
|
676
|
+
default: colors.white,
|
|
677
|
+
hover: deepPurpleColorPalette['white-alpha.80'],
|
|
678
|
+
pressed: deepPurpleColorPalette['white-alpha.80'],
|
|
679
|
+
disabled: deepPurpleColorPalette['white-alpha.20'],
|
|
680
|
+
focus: colors.white
|
|
681
|
+
}
|
|
679
682
|
}
|
|
680
683
|
},
|
|
681
|
-
|
|
684
|
+
'tertiary-danger': {
|
|
682
685
|
default: {
|
|
683
|
-
backgroundColor:
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
686
|
+
backgroundColor: {
|
|
687
|
+
default: 'transparent',
|
|
688
|
+
hover: 'transparent',
|
|
689
|
+
pressed: 'transparent',
|
|
690
|
+
disabled: 'transparent',
|
|
691
|
+
focus: 'transparent'
|
|
692
|
+
},
|
|
693
|
+
color: {
|
|
694
|
+
default: colors.danger,
|
|
695
|
+
hover: deepPurpleColorPalette['red.2'],
|
|
696
|
+
pressed: deepPurpleColorPalette['red.2'],
|
|
697
|
+
disabled: deepPurpleColorPalette['grey.3'],
|
|
698
|
+
focus: colors.danger
|
|
699
|
+
}
|
|
688
700
|
}
|
|
689
701
|
}
|
|
690
702
|
};
|
|
691
703
|
|
|
692
704
|
const buttonBadge = {
|
|
693
|
-
backgroundColor:
|
|
705
|
+
backgroundColor: {
|
|
706
|
+
default: colors.danger,
|
|
707
|
+
disabled: colors.blackLight
|
|
708
|
+
},
|
|
694
709
|
dimensions: {
|
|
695
710
|
withBadge: {
|
|
696
|
-
width:
|
|
697
|
-
height:
|
|
711
|
+
width: 8,
|
|
712
|
+
height: 8
|
|
698
713
|
},
|
|
699
714
|
badgeCount: {
|
|
700
715
|
width: 20,
|
|
@@ -1891,14 +1906,13 @@ const iconButton = {
|
|
|
1891
1906
|
},
|
|
1892
1907
|
disabled: {
|
|
1893
1908
|
scale: 1,
|
|
1894
|
-
backgroundColor: button.
|
|
1895
|
-
borderColor: button.disabled.default.borderColor
|
|
1909
|
+
backgroundColor: button.primary.default.backgroundColor.disabled
|
|
1896
1910
|
},
|
|
1897
1911
|
default: {
|
|
1898
|
-
pressedBackgroundColor: button.
|
|
1912
|
+
pressedBackgroundColor: button.primary.default.backgroundColor.disabled
|
|
1899
1913
|
},
|
|
1900
1914
|
ghost: {
|
|
1901
|
-
pressedBackgroundColor: button.default.
|
|
1915
|
+
pressedBackgroundColor: button.primary.default.backgroundColor.disabled
|
|
1902
1916
|
},
|
|
1903
1917
|
primary: {
|
|
1904
1918
|
pressedBackgroundColor: deepPurpleColorPalette['beige.1']
|
|
@@ -2785,32 +2799,28 @@ function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valu
|
|
|
2785
2799
|
return responsiveValue;
|
|
2786
2800
|
}
|
|
2787
2801
|
|
|
2788
|
-
function warn(message) {
|
|
2789
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2790
|
-
console.warn(message);
|
|
2791
|
-
}
|
|
2792
|
-
}
|
|
2793
|
-
function deprecatedMessage(symbol, deprecation, replaceBy) {
|
|
2794
|
-
const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
|
|
2795
|
-
warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
|
|
2796
|
-
}
|
|
2797
|
-
function deprecatedInComponent(component, deprecation, replaceBy) {
|
|
2798
|
-
deprecatedMessage(`<${component} />`, deprecation, replaceBy);
|
|
2799
|
-
}
|
|
2800
|
-
|
|
2801
2802
|
function getCurrentBackgroundColorForNativeBaseTheme({
|
|
2802
2803
|
type,
|
|
2803
2804
|
variant,
|
|
2804
2805
|
isDisabled,
|
|
2805
2806
|
isHovered,
|
|
2806
|
-
isPressed
|
|
2807
|
+
isPressed,
|
|
2808
|
+
isFocused
|
|
2807
2809
|
}) {
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2810
|
+
const baseKey = `kitt.button.${type}.${variant}.backgroundColor`;
|
|
2811
|
+
if (isDisabled) {
|
|
2812
|
+
return `${baseKey}.disabled`;
|
|
2813
|
+
}
|
|
2814
|
+
if (isHovered) {
|
|
2815
|
+
return `${baseKey}.hover`;
|
|
2816
|
+
}
|
|
2817
|
+
if (isPressed) {
|
|
2818
|
+
return `${baseKey}.pressed`;
|
|
2819
|
+
}
|
|
2820
|
+
if (isFocused) {
|
|
2821
|
+
return `${baseKey}.focused`;
|
|
2812
2822
|
}
|
|
2813
|
-
return `${baseKey}.
|
|
2823
|
+
return `${baseKey}.default`;
|
|
2814
2824
|
}
|
|
2815
2825
|
|
|
2816
2826
|
function getCurrentScale$1({
|
|
@@ -3048,7 +3058,6 @@ function Typography({
|
|
|
3048
3058
|
},
|
|
3049
3059
|
variant,
|
|
3050
3060
|
color,
|
|
3051
|
-
underline,
|
|
3052
3061
|
...otherProps
|
|
3053
3062
|
}) {
|
|
3054
3063
|
const sx = useSx();
|
|
@@ -3087,15 +3096,9 @@ function Typography({
|
|
|
3087
3096
|
lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
|
|
3088
3097
|
fontWeight: webFontWeight,
|
|
3089
3098
|
fontFamily: nativeFontFamily,
|
|
3090
|
-
borderBottomWidth: underline ? 1 : undefined,
|
|
3091
|
-
borderBottomColor: underline ? currentColorValue : undefined,
|
|
3092
3099
|
textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined,
|
|
3093
3100
|
...colorStyles,
|
|
3094
|
-
...otherProps
|
|
3095
|
-
// The property text-underline-offset is not on native.
|
|
3096
|
-
// To add an underline with an offset, we use a custom borderBottomWidth and color.
|
|
3097
|
-
// and we set underline to undefined to avoid a double underline
|
|
3098
|
-
underline: undefined
|
|
3101
|
+
...otherProps
|
|
3099
3102
|
});
|
|
3100
3103
|
const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
|
|
3101
3104
|
value: typographyFamily,
|
|
@@ -3147,13 +3150,15 @@ Typography.Header6 = createHeading(6);
|
|
|
3147
3150
|
|
|
3148
3151
|
function ButtonBadge({
|
|
3149
3152
|
withBadge,
|
|
3150
|
-
badgeCount
|
|
3153
|
+
badgeCount,
|
|
3154
|
+
disabled
|
|
3151
3155
|
}) {
|
|
3156
|
+
const backgroundColor = disabled ? 'kitt.buttonBadge.backgroundColor.disabled' : 'kitt.buttonBadge.backgroundColor.default';
|
|
3152
3157
|
if (withBadge) {
|
|
3153
3158
|
return /*#__PURE__*/jsx(View, {
|
|
3154
3159
|
height: "kitt.buttonBadge.dimensions.withBadge.height",
|
|
3155
3160
|
width: "kitt.buttonBadge.dimensions.withBadge.width",
|
|
3156
|
-
backgroundColor:
|
|
3161
|
+
backgroundColor: backgroundColor,
|
|
3157
3162
|
borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
|
|
3158
3163
|
});
|
|
3159
3164
|
}
|
|
@@ -3163,7 +3168,7 @@ function ButtonBadge({
|
|
|
3163
3168
|
justifyContent: "center",
|
|
3164
3169
|
height: "kitt.buttonBadge.dimensions.badgeCount.height",
|
|
3165
3170
|
width: "kitt.buttonBadge.dimensions.badgeCount.width",
|
|
3166
|
-
backgroundColor:
|
|
3171
|
+
backgroundColor: backgroundColor,
|
|
3167
3172
|
borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
|
|
3168
3173
|
children: /*#__PURE__*/jsx(Typography.Text, {
|
|
3169
3174
|
base: "body-xs",
|
|
@@ -3258,103 +3263,77 @@ function TypographyIcon({
|
|
|
3258
3263
|
});
|
|
3259
3264
|
}
|
|
3260
3265
|
|
|
3261
|
-
const getButtonTextColorByType = (type, variant, isHovered, isPressed) => {
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
case 'danger':
|
|
3269
|
-
return 'danger';
|
|
3270
|
-
case 'subtle':
|
|
3271
|
-
return isButtonInteractedWith ? 'primary-light' : 'primary';
|
|
3272
|
-
case 'subtle-dark':
|
|
3273
|
-
return isButtonInteractedWith ? 'black-light' : 'black';
|
|
3274
|
-
case 'subtle-revert':
|
|
3275
|
-
return 'white';
|
|
3276
|
-
case 'default':
|
|
3277
|
-
return variant === 'ghost' ? 'white' : 'black';
|
|
3278
|
-
default:
|
|
3279
|
-
return 'black';
|
|
3266
|
+
const getButtonTextColorByType = (type, variant, isHovered, isPressed, isDisabled) => {
|
|
3267
|
+
const baseKey = `kitt.button.${type}.${variant}.color`;
|
|
3268
|
+
if (isDisabled) {
|
|
3269
|
+
return `${baseKey}.disabled`;
|
|
3270
|
+
}
|
|
3271
|
+
if (isHovered || isPressed) {
|
|
3272
|
+
return `${baseKey}.hover`;
|
|
3280
3273
|
}
|
|
3274
|
+
return `${baseKey}.default`;
|
|
3281
3275
|
};
|
|
3282
3276
|
|
|
3283
|
-
function ButtonIcon({
|
|
3284
|
-
icon,
|
|
3285
|
-
color,
|
|
3286
|
-
iconPosition,
|
|
3287
|
-
testID
|
|
3288
|
-
}) {
|
|
3289
|
-
return /*#__PURE__*/jsx(View, {
|
|
3290
|
-
marginRight: iconPosition === 'left' ? 'kitt.2' : 0,
|
|
3291
|
-
marginLeft: iconPosition === 'right' ? 'kitt.2' : 0,
|
|
3292
|
-
children: /*#__PURE__*/jsx(TypographyIcon, {
|
|
3293
|
-
icon: icon,
|
|
3294
|
-
testID: testID,
|
|
3295
|
-
color: color
|
|
3296
|
-
})
|
|
3297
|
-
});
|
|
3298
|
-
}
|
|
3299
3277
|
function ButtonContentChildren({
|
|
3300
3278
|
type,
|
|
3301
3279
|
icon,
|
|
3302
3280
|
iconPosition,
|
|
3303
3281
|
innerSpacing,
|
|
3282
|
+
isDisabled,
|
|
3304
3283
|
withBadge,
|
|
3305
3284
|
badgeCount,
|
|
3306
3285
|
color,
|
|
3307
|
-
children
|
|
3286
|
+
children,
|
|
3287
|
+
isPressed,
|
|
3288
|
+
isHovered,
|
|
3289
|
+
size = 'default'
|
|
3308
3290
|
}) {
|
|
3309
3291
|
if ((process.env.NODE_ENV !== "production")) {
|
|
3310
3292
|
if (!(children || icon)) {
|
|
3311
3293
|
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
3312
3294
|
}
|
|
3313
3295
|
}
|
|
3314
|
-
if (!children) {
|
|
3315
|
-
return /*#__PURE__*/jsx(TypographyIcon
|
|
3316
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3317
|
-
, {
|
|
3296
|
+
if (!children && icon) {
|
|
3297
|
+
return /*#__PURE__*/jsx(TypographyIcon, {
|
|
3318
3298
|
icon: icon,
|
|
3319
3299
|
color: color
|
|
3320
3300
|
});
|
|
3321
3301
|
}
|
|
3322
|
-
const buttonIconSharedProps = {
|
|
3323
|
-
type,
|
|
3324
|
-
iconPosition,
|
|
3325
|
-
color
|
|
3326
|
-
};
|
|
3327
|
-
|
|
3328
3302
|
// Make the multilines case work properly on native - Breaks the web implem
|
|
3329
3303
|
const sharedNativeStyle = {
|
|
3330
3304
|
flexShrink: 1
|
|
3331
3305
|
};
|
|
3332
|
-
return /*#__PURE__*/jsxs(
|
|
3306
|
+
return /*#__PURE__*/jsxs(HStack$1, {
|
|
3333
3307
|
alignItems: "center",
|
|
3334
3308
|
justifyContent: innerSpacing,
|
|
3335
|
-
|
|
3336
|
-
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsx(
|
|
3337
|
-
...
|
|
3309
|
+
space: "kitt.2",
|
|
3310
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsx(TypographyIcon, {
|
|
3311
|
+
...{
|
|
3312
|
+
type,
|
|
3313
|
+
color
|
|
3314
|
+
},
|
|
3338
3315
|
testID: "button.ButtonContent.leftButtonIcon",
|
|
3339
|
-
icon: icon
|
|
3316
|
+
icon: icon,
|
|
3317
|
+
color: color,
|
|
3318
|
+
size: `kitt.button.icon.${size}.size`
|
|
3340
3319
|
}) : null, /*#__PURE__*/jsx(Typography.Text, {
|
|
3341
3320
|
/* On native code, this is the only way to ensure that the text is centered */
|
|
3342
3321
|
textAlign: "center",
|
|
3343
3322
|
_android: sharedNativeStyle,
|
|
3344
3323
|
_ios: sharedNativeStyle,
|
|
3345
|
-
base: "
|
|
3346
|
-
variant: "
|
|
3324
|
+
base: "label-large",
|
|
3325
|
+
variant: "semibold",
|
|
3326
|
+
underline: (type === 'tertiary' || type === 'tertiary-danger') && !isHovered && !isPressed,
|
|
3347
3327
|
color: color,
|
|
3348
3328
|
children: children
|
|
3349
|
-
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
})
|
|
3329
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(TypographyIcon, {
|
|
3330
|
+
icon: icon,
|
|
3331
|
+
color: color,
|
|
3332
|
+
size: `kitt.button.icon.${size}.size`
|
|
3333
|
+
}) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(ButtonBadge, {
|
|
3334
|
+
disabled: isDisabled,
|
|
3335
|
+
withBadge: withBadge,
|
|
3336
|
+
badgeCount: badgeCount
|
|
3358
3337
|
}) : null]
|
|
3359
3338
|
});
|
|
3360
3339
|
}
|
|
@@ -3368,9 +3347,10 @@ function ButtonContent({
|
|
|
3368
3347
|
isPressed,
|
|
3369
3348
|
isFocused,
|
|
3370
3349
|
innerSpacing,
|
|
3350
|
+
size,
|
|
3371
3351
|
...props
|
|
3372
3352
|
}) {
|
|
3373
|
-
const color =
|
|
3353
|
+
const color = getButtonTextColorByType(type, variant, isHovered, isPressed, isDisabled);
|
|
3374
3354
|
return /*#__PURE__*/jsx(View, {
|
|
3375
3355
|
_web: {
|
|
3376
3356
|
// Make the multilines case work properly on web
|
|
@@ -3385,56 +3365,33 @@ function ButtonContent({
|
|
|
3385
3365
|
isDisabled: isDisabled,
|
|
3386
3366
|
color: color,
|
|
3387
3367
|
innerSpacing: innerSpacing,
|
|
3368
|
+
isHovered: isHovered,
|
|
3369
|
+
isPressed: isPressed,
|
|
3370
|
+
size: size,
|
|
3388
3371
|
...props,
|
|
3389
3372
|
children: children
|
|
3390
3373
|
})
|
|
3391
3374
|
});
|
|
3392
3375
|
}
|
|
3393
3376
|
|
|
3394
|
-
function getCurrentPaddingConfig({
|
|
3395
|
-
size
|
|
3396
|
-
}) {
|
|
3397
|
-
if (size === 'large') return 'large';
|
|
3398
|
-
if (size === 'xLarge') return 'xLarge';
|
|
3399
|
-
return 'default';
|
|
3400
|
-
}
|
|
3401
3377
|
function ButtonPadding({
|
|
3402
3378
|
children,
|
|
3403
3379
|
size,
|
|
3404
3380
|
hasBadge
|
|
3405
3381
|
}) {
|
|
3406
|
-
const currentPaddingKey = getCurrentPaddingConfig({
|
|
3407
|
-
size
|
|
3408
|
-
});
|
|
3409
3382
|
return /*#__PURE__*/jsx(View, {
|
|
3410
3383
|
position: "relative",
|
|
3411
3384
|
flexDirection: "row",
|
|
3412
3385
|
alignItems: "center",
|
|
3413
3386
|
justifyContent: "center",
|
|
3414
|
-
paddingX: `kitt.button.padding.${
|
|
3415
|
-
paddingY: `kitt.button.padding.${
|
|
3416
|
-
paddingRight: hasBadge ? `kitt.button.padding.${currentPaddingKey}.hasBadge.right` : undefined,
|
|
3387
|
+
paddingX: `kitt.button.padding.${size}.horizontal`,
|
|
3388
|
+
paddingY: `kitt.button.padding.${size}.vertical`,
|
|
3417
3389
|
minHeight: "kitt.button.minHeight",
|
|
3418
3390
|
children: children
|
|
3419
3391
|
});
|
|
3420
3392
|
}
|
|
3421
3393
|
|
|
3422
|
-
function DisabledBorder() {
|
|
3423
|
-
return /*#__PURE__*/jsx(View, {
|
|
3424
|
-
position: "absolute",
|
|
3425
|
-
top: 0,
|
|
3426
|
-
left: 0,
|
|
3427
|
-
right: 0,
|
|
3428
|
-
bottom: 0,
|
|
3429
|
-
borderWidth: "kitt.button.borderWidth.disabled",
|
|
3430
|
-
borderColor: "kitt.button.disabled.default.borderColor",
|
|
3431
|
-
borderRadius: "kitt.button.borderRadius"
|
|
3432
|
-
});
|
|
3433
|
-
}
|
|
3434
|
-
|
|
3435
3394
|
function FocusBorder({
|
|
3436
|
-
type,
|
|
3437
|
-
variant,
|
|
3438
3395
|
isFocused,
|
|
3439
3396
|
isHovered,
|
|
3440
3397
|
isPressed
|
|
@@ -3444,11 +3401,13 @@ function FocusBorder({
|
|
|
3444
3401
|
button: buttonTheme
|
|
3445
3402
|
}
|
|
3446
3403
|
} = useTheme();
|
|
3404
|
+
const outerBorderRadius = buttonTheme.borderRadius + buttonTheme.borderWidth.focus;
|
|
3405
|
+
const innerBorderRadius = buttonTheme.borderRadius;
|
|
3447
3406
|
return /*#__PURE__*/jsx(View, {
|
|
3448
3407
|
_web: {
|
|
3449
3408
|
style: {
|
|
3450
|
-
width: `calc(100% + ${buttonTheme.
|
|
3451
|
-
height: `calc(100% + ${buttonTheme.
|
|
3409
|
+
width: `calc(100% + ${buttonTheme.borderRadius}px)`,
|
|
3410
|
+
height: `calc(100% + ${buttonTheme.borderRadius}px)`,
|
|
3452
3411
|
transitionProperty: 'opacity',
|
|
3453
3412
|
transitionDuration: buttonTheme.transition.duration,
|
|
3454
3413
|
transitionTimingFunction: buttonTheme.transition.timingFunction
|
|
@@ -3456,11 +3415,12 @@ function FocusBorder({
|
|
|
3456
3415
|
},
|
|
3457
3416
|
opacity: isFocused && !(isPressed || isHovered) ? 1 : 0,
|
|
3458
3417
|
position: "absolute",
|
|
3459
|
-
left: -buttonTheme.borderWidth.focus,
|
|
3460
|
-
top: -buttonTheme.borderWidth.focus,
|
|
3461
3418
|
borderWidth: "kitt.button.borderWidth.focus",
|
|
3462
|
-
borderColor:
|
|
3463
|
-
borderRadius:
|
|
3419
|
+
borderColor: "kitt.button.focusBorderColor",
|
|
3420
|
+
borderRadius: outerBorderRadius,
|
|
3421
|
+
children: /*#__PURE__*/jsx(View, {
|
|
3422
|
+
borderRadius: innerBorderRadius
|
|
3423
|
+
})
|
|
3464
3424
|
});
|
|
3465
3425
|
}
|
|
3466
3426
|
|
|
@@ -3472,27 +3432,14 @@ function useNativeAnimation$5() {
|
|
|
3472
3432
|
};
|
|
3473
3433
|
}
|
|
3474
3434
|
|
|
3475
|
-
const getButtonSize = ({
|
|
3476
|
-
large,
|
|
3477
|
-
xLarge,
|
|
3478
|
-
size
|
|
3479
|
-
}) => {
|
|
3480
|
-
if (large) return 'large';
|
|
3481
|
-
if (xLarge) return 'xLarge';
|
|
3482
|
-
return size;
|
|
3483
|
-
};
|
|
3484
|
-
|
|
3485
|
-
const allowedGhostTypes = ['primary', 'default', 'danger'];
|
|
3486
3435
|
const Button = /*#__PURE__*/forwardRef(({
|
|
3487
3436
|
children,
|
|
3488
|
-
type = '
|
|
3437
|
+
type = 'secondary',
|
|
3489
3438
|
variant = 'default',
|
|
3490
3439
|
disabled,
|
|
3491
3440
|
stretch,
|
|
3492
|
-
large,
|
|
3493
|
-
xLarge,
|
|
3494
3441
|
icon,
|
|
3495
|
-
size
|
|
3442
|
+
size = 'default',
|
|
3496
3443
|
iconPosition = 'left',
|
|
3497
3444
|
testID,
|
|
3498
3445
|
href,
|
|
@@ -3515,18 +3462,9 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
3515
3462
|
onPressOut,
|
|
3516
3463
|
animatedStyles
|
|
3517
3464
|
} = useNativeAnimation$5();
|
|
3518
|
-
if (
|
|
3519
|
-
throw new Error('variant
|
|
3465
|
+
if (process.env.NODE_ENV !== 'production' && variant === 'revert' && type === 'tertiary-danger') {
|
|
3466
|
+
throw new Error('Invalid revert variant for tertiary-danger button type. Only default variant is allowed.');
|
|
3520
3467
|
}
|
|
3521
|
-
if (large || xLarge) {
|
|
3522
|
-
const deprecatedProp = large ? 'large' : 'xLarge';
|
|
3523
|
-
deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
|
|
3524
|
-
}
|
|
3525
|
-
const size = getButtonSize({
|
|
3526
|
-
large,
|
|
3527
|
-
xLarge,
|
|
3528
|
-
size: sizeProp
|
|
3529
|
-
});
|
|
3530
3468
|
return /*#__PURE__*/jsx(Pressable, {
|
|
3531
3469
|
ref: ref,
|
|
3532
3470
|
disabled: disabled,
|
|
@@ -3538,6 +3476,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
3538
3476
|
alignSelf: createResponsiveStyleFromProp(stretch, undefined, 'flex-start'),
|
|
3539
3477
|
minWidth: "kitt.button.minWidth",
|
|
3540
3478
|
maxWidth: createResponsiveStyleFromProp(stretch, '100%', 'kitt.button.maxWidth'),
|
|
3479
|
+
maxHeight: "kitt.button.maxHeight",
|
|
3541
3480
|
width: createResponsiveStyleFromProp(stretch, '100%', 'auto'),
|
|
3542
3481
|
onPress: onPress,
|
|
3543
3482
|
onPressIn: onPressIn,
|
|
@@ -3573,10 +3512,9 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
3573
3512
|
isPressed: isPressed,
|
|
3574
3513
|
isFocused: isFocused,
|
|
3575
3514
|
innerSpacing: innerSpacing,
|
|
3515
|
+
size: size,
|
|
3576
3516
|
children: children
|
|
3577
|
-
}),
|
|
3578
|
-
type: type,
|
|
3579
|
-
variant: variant,
|
|
3517
|
+
}), /*#__PURE__*/jsx(FocusBorder, {
|
|
3580
3518
|
isFocused: isFocused || isFocusedInternal,
|
|
3581
3519
|
isHovered: isHovered,
|
|
3582
3520
|
isPressed: isPressed
|
|
@@ -3718,7 +3656,7 @@ function Actions({
|
|
|
3718
3656
|
flexGrow: 1,
|
|
3719
3657
|
reversed: isReversed,
|
|
3720
3658
|
...props,
|
|
3721
|
-
space: "kitt.
|
|
3659
|
+
space: "kitt.2",
|
|
3722
3660
|
children: children
|
|
3723
3661
|
});
|
|
3724
3662
|
}
|
|
@@ -7821,7 +7759,8 @@ function InfoCard({
|
|
|
7821
7759
|
icon: /*#__PURE__*/jsx(CaretRightRegularIcon, {})
|
|
7822
7760
|
}) : /*#__PURE__*/jsx(View$1, {
|
|
7823
7761
|
children: /*#__PURE__*/jsx(Button, {
|
|
7824
|
-
type:
|
|
7762
|
+
type: "tertiary",
|
|
7763
|
+
variant: isContrastReversed ? 'revert' : undefined,
|
|
7825
7764
|
onPress: onPress,
|
|
7826
7765
|
children: action?.label
|
|
7827
7766
|
})
|
|
@@ -8441,14 +8380,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
8441
8380
|
}
|
|
8442
8381
|
},
|
|
8443
8382
|
button: {
|
|
8444
|
-
default: theme.button.default,
|
|
8445
|
-
dark: theme.button.dark,
|
|
8446
8383
|
primary: theme.button.primary,
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
'
|
|
8450
|
-
|
|
8451
|
-
disabled: theme.button.disabled
|
|
8384
|
+
secondary: theme.button.secondary,
|
|
8385
|
+
tertiary: theme.button.tertiary,
|
|
8386
|
+
'tertiary-danger': theme.button['tertiary-danger'],
|
|
8387
|
+
focusBorderColor: theme.button.focusBorderColor
|
|
8452
8388
|
},
|
|
8453
8389
|
choices: {
|
|
8454
8390
|
item: {
|
|
@@ -8877,7 +8813,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
8877
8813
|
iconButton: {
|
|
8878
8814
|
borderColor: theme.iconButton.borderColor,
|
|
8879
8815
|
disabled: {
|
|
8880
|
-
borderColor: theme.iconButton.disabled.borderColor,
|
|
8881
8816
|
backgroundColor: theme.iconButton.disabled.backgroundColor
|
|
8882
8817
|
},
|
|
8883
8818
|
black: {
|
|
@@ -9431,7 +9366,16 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
9431
9366
|
button: {
|
|
9432
9367
|
minWidth: theme.button.minWidth,
|
|
9433
9368
|
maxWidth: theme.button.maxWidth,
|
|
9434
|
-
minHeight: theme.button.minHeight
|
|
9369
|
+
minHeight: theme.button.minHeight,
|
|
9370
|
+
maxHeight: theme.button.maxHeight,
|
|
9371
|
+
icon: {
|
|
9372
|
+
default: {
|
|
9373
|
+
size: theme.button.icon.default.size
|
|
9374
|
+
},
|
|
9375
|
+
medium: {
|
|
9376
|
+
size: theme.button.icon.medium.size
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9435
9379
|
},
|
|
9436
9380
|
buttonBadge: {
|
|
9437
9381
|
dimensions: {
|
|
@@ -9827,7 +9771,10 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
|
|
|
9827
9771
|
}
|
|
9828
9772
|
},
|
|
9829
9773
|
button: {
|
|
9830
|
-
padding:
|
|
9774
|
+
padding: {
|
|
9775
|
+
default: theme.button.padding.default,
|
|
9776
|
+
medium: theme.button.padding.medium
|
|
9777
|
+
}
|
|
9831
9778
|
},
|
|
9832
9779
|
cardModal: {
|
|
9833
9780
|
overlayPadding: theme.cardModal.overlayPadding
|