@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/definitions/Button/AnimatedContainer.d.ts +2 -1
  3. package/dist/definitions/Button/AnimatedContainer.d.ts.map +1 -1
  4. package/dist/definitions/Button/Button.d.ts +2 -17
  5. package/dist/definitions/Button/Button.d.ts.map +1 -1
  6. package/dist/definitions/Button/ButtonContent.d.ts +10 -8
  7. package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
  8. package/dist/definitions/Button/ButtonPadding.d.ts +1 -1
  9. package/dist/definitions/Button/ButtonPadding.d.ts.map +1 -1
  10. package/dist/definitions/Button/FocusBorder.d.ts +1 -4
  11. package/dist/definitions/Button/FocusBorder.d.ts.map +1 -1
  12. package/dist/definitions/Button/hooks/useNativeAnimation.d.ts +1 -1
  13. package/dist/definitions/Button/hooks/useNativeAnimation.d.ts.map +1 -1
  14. package/dist/definitions/Button/utils/getButtonTextColorByType.d.ts +12 -3
  15. package/dist/definitions/Button/utils/getButtonTextColorByType.d.ts.map +1 -1
  16. package/dist/definitions/Button/utils/getCurrentBackgroundColorForNativeBaseTheme.d.ts +3 -2
  17. package/dist/definitions/Button/utils/getCurrentBackgroundColorForNativeBaseTheme.d.ts.map +1 -1
  18. package/dist/definitions/ButtonBadge/ButtonBadge.d.ts +2 -1
  19. package/dist/definitions/ButtonBadge/ButtonBadge.d.ts.map +1 -1
  20. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +30 -23
  21. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  22. package/dist/definitions/story-components/StoryBlock.d.ts +1 -1
  23. package/dist/definitions/themes/late-ocean/button.d.ts +26 -52
  24. package/dist/definitions/themes/late-ocean/button.d.ts.map +1 -1
  25. package/dist/definitions/themes/late-ocean/buttonBadge.d.ts +4 -1
  26. package/dist/definitions/themes/late-ocean/buttonBadge.d.ts.map +1 -1
  27. package/dist/definitions/themes/late-ocean/iconButton.d.ts +0 -1
  28. package/dist/definitions/themes/late-ocean/iconButton.d.ts.map +1 -1
  29. package/dist/definitions/typography/Typography.d.ts +1 -1
  30. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  31. package/dist/index-metro.es.android.js +238 -306
  32. package/dist/index-metro.es.android.js.map +1 -1
  33. package/dist/index-metro.es.ios.js +238 -306
  34. package/dist/index-metro.es.ios.js.map +1 -1
  35. package/dist/index-node-22.17.cjs.js +232 -300
  36. package/dist/index-node-22.17.cjs.js.map +1 -1
  37. package/dist/index-node-22.17.cjs.web.js +231 -284
  38. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  39. package/dist/index-node-22.17.es.mjs +232 -300
  40. package/dist/index-node-22.17.es.mjs.map +1 -1
  41. package/dist/index-node-22.17.es.web.mjs +231 -284
  42. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  43. package/dist/index.es.js +260 -322
  44. package/dist/index.es.js.map +1 -1
  45. package/dist/index.es.web.js +259 -307
  46. package/dist/index.es.web.js.map +1 -1
  47. package/dist/linaria-themes-metro.es.android.js +130 -116
  48. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  49. package/dist/linaria-themes-metro.es.ios.js +130 -116
  50. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  51. package/dist/linaria-themes-node-22.17.cjs.js +130 -116
  52. package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
  53. package/dist/linaria-themes-node-22.17.cjs.web.js +130 -116
  54. package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
  55. package/dist/linaria-themes-node-22.17.es.mjs +130 -116
  56. package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
  57. package/dist/linaria-themes-node-22.17.es.web.mjs +130 -116
  58. package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
  59. package/dist/linaria-themes.es.js +130 -116
  60. package/dist/linaria-themes.es.js.map +1 -1
  61. package/dist/linaria-themes.es.web.js +130 -116
  62. package/dist/linaria-themes.es.web.js.map +1 -1
  63. package/dist/tsbuildinfo +1 -1
  64. package/package.json +1 -1
  65. package/dist/definitions/Button/DisabledBorder.d.ts +0 -3
  66. package/dist/definitions/Button/DisabledBorder.d.ts.map +0 -1
  67. package/dist/definitions/Button/getVariantValuesIfExist.d.ts +0 -5
  68. package/dist/definitions/Button/getVariantValuesIfExist.d.ts.map +0 -1
  69. package/dist/definitions/Button/utils/getButtonSize.d.ts +0 -3
  70. package/dist/definitions/Button/utils/getButtonSize.d.ts.map +0 -1
@@ -538,15 +538,18 @@ const bottomSheet = {
538
538
  }
539
539
  };
540
540
 
541
+ // Strongly typed theme so every new type/variant/size can't be added
542
+ // without defined color & backgroundColor or icon size
543
+
541
544
  const button = {
542
- borderRadius: 30,
545
+ borderRadius: 4,
543
546
  borderWidth: {
544
- disabled: 2,
545
547
  focus: 3
546
548
  },
547
549
  minHeight: 40,
548
550
  minWidth: 40,
549
551
  maxWidth: 335,
552
+ maxHeight: 48,
550
553
  scale: {
551
554
  base: {
552
555
  default: 1,
@@ -557,148 +560,160 @@ const button = {
557
560
  hover: 1.05
558
561
  }
559
562
  },
560
- contentPadding: {
561
- default: '7px 16px 7px',
562
- large: '11px 24px 11px',
563
- xLarge: '15px 24px 15px',
564
- disabled: '5px 14px 5px'
563
+ icon: {
564
+ medium: {
565
+ size: 24
566
+ },
567
+ default: {
568
+ size: 20
569
+ }
565
570
  },
566
571
  padding: {
567
572
  default: {
568
- hasBadge: {
569
- right: 8
570
- },
571
573
  horizontal: 16,
572
- vertical: 7
573
- },
574
- large: {
575
- hasBadge: {
576
- right: 12
577
- },
578
- horizontal: 24,
579
- vertical: 11
574
+ vertical: 8
580
575
  },
581
- xLarge: {
582
- hasBadge: {
583
- right: 12
584
- },
576
+ medium: {
585
577
  horizontal: 24,
586
- vertical: 15
578
+ vertical: 12
587
579
  }
588
580
  },
589
581
  transition: {
590
582
  duration: '200ms',
591
583
  timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
592
584
  },
593
- default: {
594
- default: {
595
- backgroundColor: 'rgba(0, 0, 0, 0.05)',
596
- pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
597
- hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
598
- focusBorderColor: 'rgba(0, 0, 0, 0.1)'
599
- },
600
- ghost: {
601
- backgroundColor: 'rgba(255, 255, 255, 0.1)',
602
- pressedBackgroundColor: 'rgba(255, 255, 255, 0.05)',
603
- hoverBackgroundColor: 'rgba(255, 255, 255, 0.05)',
604
- focusBorderColor: 'rgba(255, 255, 255, 0.4)',
605
- color: deepPurpleColorPalette.white,
606
- hoverColor: deepPurpleColorPalette.white,
607
- activeColor: deepPurpleColorPalette.white
608
- }
609
- },
585
+ focusBorderColor: deepPurpleColorPalette['blue.2'],
610
586
  primary: {
611
587
  default: {
612
- backgroundColor: colors.primary,
613
- pressedBackgroundColor: colors.primaryLight,
614
- hoverBackgroundColor: colors.primaryLight,
615
- focusBorderColor: 'rgba(76, 52, 224, 0.2)'
588
+ backgroundColor: {
589
+ default: colors.primary,
590
+ hover: deepPurpleColorPalette['deepPurple.7'],
591
+ pressed: deepPurpleColorPalette['deepPurple.7'],
592
+ disabled: deepPurpleColorPalette['grey.3'],
593
+ focus: colors.primary
594
+ },
595
+ color: {
596
+ default: colors.white,
597
+ hover: colors.white,
598
+ pressed: colors.white,
599
+ disabled: colors.disabled,
600
+ focus: colors.white
601
+ }
616
602
  },
617
- ghost: {
618
- backgroundColor: colors.uiBackgroundLight,
619
- pressedBackgroundColor: colors.uiBackground,
620
- hoverBackgroundColor: deepPurpleColorPalette['beige.2'],
621
- focusBorderColor: 'rgba(255,255,255, 0.4)',
622
- color: colors.primary,
623
- hoverColor: deepPurpleColorPalette['beige.2'],
624
- activeColor: deepPurpleColorPalette['beige.2']
625
- }
626
- },
627
- dark: {
628
- default: {
629
- backgroundColor: colors.black,
630
- pressedBackgroundColor: 'rgba(0, 0, 0, 0.8)',
631
- hoverBackgroundColor: 'rgba(0, 0, 0, 0.8)',
632
- focusBorderColor: 'rgba(0, 0, 0, 0.8)'
603
+ revert: {
604
+ backgroundColor: {
605
+ default: colors.white,
606
+ hover: deepPurpleColorPalette['white-alpha.80'],
607
+ pressed: deepPurpleColorPalette['white-alpha.80'],
608
+ disabled: deepPurpleColorPalette['grey.3'],
609
+ focus: colors.white
610
+ },
611
+ color: {
612
+ default: colors.black,
613
+ hover: colors.black,
614
+ pressed: colors.black,
615
+ disabled: colors.disabled,
616
+ focus: colors.black
617
+ }
633
618
  }
634
619
  },
635
- danger: {
620
+ secondary: {
636
621
  default: {
637
- backgroundColor: deepPurpleColorPalette['red.1'],
638
- pressedBackgroundColor: deepPurpleColorPalette['red.2'],
639
- hoverBackgroundColor: deepPurpleColorPalette['red.2'],
640
- focusBorderColor: deepPurpleColorPalette['red.2']
622
+ backgroundColor: {
623
+ default: deepPurpleColorPalette['beige-alpha.25'],
624
+ hover: deepPurpleColorPalette['beige-alpha.40'],
625
+ pressed: deepPurpleColorPalette['beige-alpha.40'],
626
+ disabled: colors.disabled,
627
+ focus: deepPurpleColorPalette['beige-alpha.25']
628
+ },
629
+ color: {
630
+ default: colors.black,
631
+ hover: colors.black,
632
+ pressed: colors.black,
633
+ disabled: deepPurpleColorPalette['grey.3'],
634
+ focus: colors.black
635
+ }
641
636
  },
642
- ghost: {
643
- backgroundColor: colors.uiBackgroundLight,
644
- pressedBackgroundColor: colors.uiBackground,
645
- hoverBackgroundColor: deepPurpleColorPalette['beige.2'],
646
- focusBorderColor: 'rgba(255, 255, 255, 0.4)',
647
- color: deepPurpleColorPalette['red.6'],
648
- hoverColor: deepPurpleColorPalette['red.6'],
649
- activeColor: deepPurpleColorPalette['red.6']
650
- }
651
- },
652
- subtle: {
653
- default: {
654
- backgroundColor: colors.transparent,
655
- pressedBackgroundColor: colors.transparent,
656
- hoverBackgroundColor: colors.transparent,
657
- focusBorderColor: 'rgba(76, 52, 224, 0.2)',
658
- color: colors.primary,
659
- hoverColor: 'rgba(76, 52, 224, 0.8)',
660
- activeColor: 'rgba(76, 52, 224, 0.8)'
661
- }
662
- },
663
- 'subtle-dark': {
664
- default: {
665
- backgroundColor: colors.transparent,
666
- pressedBackgroundColor: colors.transparent,
667
- hoverBackgroundColor: colors.transparent,
668
- focusBorderColor: 'rgba(0, 0, 0, 0.1)',
669
- color: colors.black,
670
- hoverColor: 'rgba(0, 0, 0, 0.8)',
671
- activeColor: 'rgba(0, 0, 0, 0.8)'
637
+ revert: {
638
+ backgroundColor: {
639
+ default: deepPurpleColorPalette['white-alpha.10'],
640
+ hover: deepPurpleColorPalette['white-alpha.20'],
641
+ pressed: deepPurpleColorPalette['white-alpha.20'],
642
+ disabled: colors.disabled,
643
+ focus: deepPurpleColorPalette['white-alpha.10']
644
+ },
645
+ color: {
646
+ default: colors.white,
647
+ hover: deepPurpleColorPalette['white-alpha.80'],
648
+ pressed: deepPurpleColorPalette['white-alpha.80'],
649
+ disabled: deepPurpleColorPalette['grey.3'],
650
+ focus: colors.white
651
+ }
672
652
  }
673
653
  },
674
- 'subtle-revert': {
654
+ tertiary: {
675
655
  default: {
676
- backgroundColor: colors.transparent,
677
- pressedBackgroundColor: colors.transparent,
678
- hoverBackgroundColor: colors.transparent,
679
- focusBorderColor: colors.white,
680
- color: colors.white,
681
- hoverColor: colors.white,
682
- activeColor: colors.white
656
+ backgroundColor: {
657
+ default: 'transparent',
658
+ hover: 'transparent',
659
+ pressed: 'transparent',
660
+ disabled: 'transparent',
661
+ focus: 'transparent'
662
+ },
663
+ color: {
664
+ default: colors.black,
665
+ hover: colors.blackAnthracite,
666
+ pressed: colors.blackAnthracite,
667
+ disabled: deepPurpleColorPalette['grey.3'],
668
+ focus: colors.black
669
+ }
670
+ },
671
+ revert: {
672
+ backgroundColor: {
673
+ default: 'transparent',
674
+ hover: 'transparent',
675
+ pressed: 'transparent',
676
+ disabled: 'transparent',
677
+ focus: 'transparent'
678
+ },
679
+ color: {
680
+ default: colors.white,
681
+ hover: deepPurpleColorPalette['white-alpha.80'],
682
+ pressed: deepPurpleColorPalette['white-alpha.80'],
683
+ disabled: deepPurpleColorPalette['white-alpha.20'],
684
+ focus: colors.white
685
+ }
683
686
  }
684
687
  },
685
- disabled: {
688
+ 'tertiary-danger': {
686
689
  default: {
687
- backgroundColor: colors.disabled,
688
- pressedBackgroundColor: colors.disabled,
689
- hoverBackgroundColor: colors.disabled,
690
- focusBorderColor: deepPurpleColorPalette['beige.2'],
691
- borderColor: deepPurpleColorPalette['beige.2']
690
+ backgroundColor: {
691
+ default: 'transparent',
692
+ hover: 'transparent',
693
+ pressed: 'transparent',
694
+ disabled: 'transparent',
695
+ focus: 'transparent'
696
+ },
697
+ color: {
698
+ default: colors.danger,
699
+ hover: deepPurpleColorPalette['red.2'],
700
+ pressed: deepPurpleColorPalette['red.2'],
701
+ disabled: deepPurpleColorPalette['grey.3'],
702
+ focus: colors.danger
703
+ }
692
704
  }
693
705
  }
694
706
  };
695
707
 
696
708
  const buttonBadge = {
697
- backgroundColor: deepPurpleColorPalette['red.6'],
709
+ backgroundColor: {
710
+ default: colors.danger,
711
+ disabled: colors.blackLight
712
+ },
698
713
  dimensions: {
699
714
  withBadge: {
700
- width: 10,
701
- height: 10
715
+ width: 8,
716
+ height: 8
702
717
  },
703
718
  badgeCount: {
704
719
  width: 20,
@@ -1895,14 +1910,13 @@ const iconButton = {
1895
1910
  },
1896
1911
  disabled: {
1897
1912
  scale: 1,
1898
- backgroundColor: button.disabled.default.backgroundColor,
1899
- borderColor: button.disabled.default.borderColor
1913
+ backgroundColor: button.primary.default.backgroundColor.disabled
1900
1914
  },
1901
1915
  default: {
1902
- pressedBackgroundColor: button.default.default.pressedBackgroundColor
1916
+ pressedBackgroundColor: button.primary.default.backgroundColor.disabled
1903
1917
  },
1904
1918
  ghost: {
1905
- pressedBackgroundColor: button.default.ghost.pressedBackgroundColor
1919
+ pressedBackgroundColor: button.primary.default.backgroundColor.disabled
1906
1920
  },
1907
1921
  primary: {
1908
1922
  pressedBackgroundColor: deepPurpleColorPalette['beige.1']
@@ -2789,32 +2803,28 @@ function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valu
2789
2803
  return responsiveValue;
2790
2804
  }
2791
2805
 
2792
- function warn(message) {
2793
- if (process.env.NODE_ENV !== 'production') {
2794
- console.warn(message);
2795
- }
2796
- }
2797
- function deprecatedMessage(symbol, deprecation, replaceBy) {
2798
- const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
2799
- warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
2800
- }
2801
- function deprecatedInComponent(component, deprecation, replaceBy) {
2802
- deprecatedMessage(`<${component} />`, deprecation, replaceBy);
2803
- }
2804
-
2805
2806
  function getCurrentBackgroundColorForNativeBaseTheme({
2806
2807
  type,
2807
2808
  variant,
2808
2809
  isDisabled,
2809
2810
  isHovered,
2810
- isPressed
2811
+ isPressed,
2812
+ isFocused
2811
2813
  }) {
2812
- if (isDisabled) return 'kitt.button.disabled.default.backgroundColor';
2813
- const baseKey = `kitt.button.${type}.${variant}`;
2814
- if (isHovered || isPressed) {
2815
- return `${baseKey}.hoverBackgroundColor`;
2814
+ const baseKey = `kitt.button.${type}.${variant}.backgroundColor`;
2815
+ if (isDisabled) {
2816
+ return `${baseKey}.disabled`;
2817
+ }
2818
+ if (isHovered) {
2819
+ return `${baseKey}.hover`;
2820
+ }
2821
+ if (isPressed) {
2822
+ return `${baseKey}.pressed`;
2823
+ }
2824
+ if (isFocused) {
2825
+ return `${baseKey}.focused`;
2816
2826
  }
2817
- return `${baseKey}.backgroundColor`;
2827
+ return `${baseKey}.default`;
2818
2828
  }
2819
2829
 
2820
2830
  function AnimatedContainer$2({
@@ -3008,7 +3018,6 @@ function Typography({
3008
3018
  },
3009
3019
  variant,
3010
3020
  color,
3011
- underline,
3012
3021
  ...otherProps
3013
3022
  }) {
3014
3023
  const sx = useSx();
@@ -3047,15 +3056,9 @@ function Typography({
3047
3056
  lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
3048
3057
  fontWeight: webFontWeight,
3049
3058
  fontFamily: nativeFontFamily,
3050
- borderBottomWidth: underline ? 1 : undefined,
3051
- borderBottomColor: underline ? currentColorValue : undefined,
3052
3059
  textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined,
3053
3060
  ...colorStyles,
3054
- ...otherProps,
3055
- // The property text-underline-offset is not on native.
3056
- // To add an underline with an offset, we use a custom borderBottomWidth and color.
3057
- // and we set underline to undefined to avoid a double underline
3058
- underline: undefined
3061
+ ...otherProps
3059
3062
  });
3060
3063
  const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3061
3064
  value: typographyFamily,
@@ -3107,13 +3110,15 @@ Typography.Header6 = createHeading(6);
3107
3110
 
3108
3111
  function ButtonBadge({
3109
3112
  withBadge,
3110
- badgeCount
3113
+ badgeCount,
3114
+ disabled
3111
3115
  }) {
3116
+ const backgroundColor = disabled ? 'kitt.buttonBadge.backgroundColor.disabled' : 'kitt.buttonBadge.backgroundColor.default';
3112
3117
  if (withBadge) {
3113
3118
  return /*#__PURE__*/jsx(View, {
3114
3119
  height: "kitt.buttonBadge.dimensions.withBadge.height",
3115
3120
  width: "kitt.buttonBadge.dimensions.withBadge.width",
3116
- backgroundColor: "kitt.buttonBadge.backgroundColor",
3121
+ backgroundColor: backgroundColor,
3117
3122
  borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3118
3123
  });
3119
3124
  }
@@ -3123,7 +3128,7 @@ function ButtonBadge({
3123
3128
  justifyContent: "center",
3124
3129
  height: "kitt.buttonBadge.dimensions.badgeCount.height",
3125
3130
  width: "kitt.buttonBadge.dimensions.badgeCount.width",
3126
- backgroundColor: "kitt.buttonBadge.backgroundColor",
3131
+ backgroundColor: backgroundColor,
3127
3132
  borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3128
3133
  children: /*#__PURE__*/jsx(Typography.Text, {
3129
3134
  base: "body-xs",
@@ -3218,103 +3223,77 @@ function TypographyIcon({
3218
3223
  });
3219
3224
  }
3220
3225
 
3221
- const getButtonTextColorByType = (type, variant, isHovered, isPressed) => {
3222
- const isButtonInteractedWith = isHovered || isPressed;
3223
- switch (type) {
3224
- case 'primary':
3225
- return variant === 'ghost' ? 'primary' : 'white';
3226
- case 'dark':
3227
- return 'white';
3228
- case 'danger':
3229
- return 'danger';
3230
- case 'subtle':
3231
- return isButtonInteractedWith ? 'primary-light' : 'primary';
3232
- case 'subtle-dark':
3233
- return isButtonInteractedWith ? 'black-light' : 'black';
3234
- case 'subtle-revert':
3235
- return 'white';
3236
- case 'default':
3237
- return variant === 'ghost' ? 'white' : 'black';
3238
- default:
3239
- return 'black';
3226
+ const getButtonTextColorByType = (type, variant, isHovered, isPressed, isDisabled) => {
3227
+ const baseKey = `kitt.button.${type}.${variant}.color`;
3228
+ if (isDisabled) {
3229
+ return `${baseKey}.disabled`;
3230
+ }
3231
+ if (isHovered || isPressed) {
3232
+ return `${baseKey}.hover`;
3240
3233
  }
3234
+ return `${baseKey}.default`;
3241
3235
  };
3242
3236
 
3243
- function ButtonIcon({
3244
- icon,
3245
- color,
3246
- iconPosition,
3247
- testID
3248
- }) {
3249
- return /*#__PURE__*/jsx(View, {
3250
- marginRight: iconPosition === 'left' ? 'kitt.2' : 0,
3251
- marginLeft: iconPosition === 'right' ? 'kitt.2' : 0,
3252
- children: /*#__PURE__*/jsx(TypographyIcon, {
3253
- icon: icon,
3254
- testID: testID,
3255
- color: color
3256
- })
3257
- });
3258
- }
3259
3237
  function ButtonContentChildren({
3260
3238
  type,
3261
3239
  icon,
3262
3240
  iconPosition,
3263
3241
  innerSpacing,
3242
+ isDisabled,
3264
3243
  withBadge,
3265
3244
  badgeCount,
3266
3245
  color,
3267
- children
3246
+ children,
3247
+ isPressed,
3248
+ isHovered,
3249
+ size = 'default'
3268
3250
  }) {
3269
3251
  if ((process.env.NODE_ENV !== "production")) {
3270
3252
  if (!(children || icon)) {
3271
3253
  throw new Error('kitt(Button): You should provide at least a children or a icon');
3272
3254
  }
3273
3255
  }
3274
- if (!children) {
3275
- return /*#__PURE__*/jsx(TypographyIcon
3276
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3277
- , {
3256
+ if (!children && icon) {
3257
+ return /*#__PURE__*/jsx(TypographyIcon, {
3278
3258
  icon: icon,
3279
3259
  color: color
3280
3260
  });
3281
3261
  }
3282
- const buttonIconSharedProps = {
3283
- type,
3284
- iconPosition,
3285
- color
3286
- };
3287
-
3288
3262
  // Make the multilines case work properly on native - Breaks the web implem
3289
3263
  const sharedNativeStyle = {
3290
3264
  flexShrink: 1
3291
3265
  };
3292
- return /*#__PURE__*/jsxs(View, {
3266
+ return /*#__PURE__*/jsxs(HStack$1, {
3293
3267
  alignItems: "center",
3294
3268
  justifyContent: innerSpacing,
3295
- flexDirection: "row",
3296
- children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsx(ButtonIcon, {
3297
- ...buttonIconSharedProps,
3269
+ space: "kitt.2",
3270
+ children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsx(TypographyIcon, {
3271
+ ...{
3272
+ type,
3273
+ color
3274
+ },
3298
3275
  testID: "button.ButtonContent.leftButtonIcon",
3299
- icon: icon
3276
+ icon: icon,
3277
+ color: color,
3278
+ size: `kitt.button.icon.${size}.size`
3300
3279
  }) : null, /*#__PURE__*/jsx(Typography.Text, {
3301
3280
  /* On native code, this is the only way to ensure that the text is centered */
3302
3281
  textAlign: "center",
3303
3282
  _android: sharedNativeStyle,
3304
3283
  _ios: sharedNativeStyle,
3305
- base: "body-m",
3306
- variant: "bold",
3284
+ base: "label-large",
3285
+ variant: "semibold",
3286
+ underline: (type === 'tertiary' || type === 'tertiary-danger') && !isHovered && !isPressed,
3307
3287
  color: color,
3308
3288
  children: children
3309
- }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, {
3310
- ...buttonIconSharedProps,
3311
- icon: icon
3312
- }) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3313
- marginLeft: "kitt.2",
3314
- children: /*#__PURE__*/jsx(ButtonBadge, {
3315
- withBadge: withBadge,
3316
- badgeCount: badgeCount
3317
- })
3289
+ }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(TypographyIcon, {
3290
+ icon: icon,
3291
+ color: color,
3292
+ size: `kitt.button.icon.${size}.size`
3293
+ }) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(ButtonBadge, {
3294
+ disabled: isDisabled,
3295
+ withBadge: withBadge,
3296
+ badgeCount: badgeCount
3318
3297
  }) : null]
3319
3298
  });
3320
3299
  }
@@ -3328,9 +3307,10 @@ function ButtonContent({
3328
3307
  isPressed,
3329
3308
  isFocused,
3330
3309
  innerSpacing,
3310
+ size,
3331
3311
  ...props
3332
3312
  }) {
3333
- const color = isDisabled ? 'black-light' : getButtonTextColorByType(type, variant, isHovered, isPressed);
3313
+ const color = getButtonTextColorByType(type, variant, isHovered, isPressed, isDisabled);
3334
3314
  return /*#__PURE__*/jsx(View, {
3335
3315
  _web: {
3336
3316
  // Make the multilines case work properly on web
@@ -3345,56 +3325,33 @@ function ButtonContent({
3345
3325
  isDisabled: isDisabled,
3346
3326
  color: color,
3347
3327
  innerSpacing: innerSpacing,
3328
+ isHovered: isHovered,
3329
+ isPressed: isPressed,
3330
+ size: size,
3348
3331
  ...props,
3349
3332
  children: children
3350
3333
  })
3351
3334
  });
3352
3335
  }
3353
3336
 
3354
- function getCurrentPaddingConfig({
3355
- size
3356
- }) {
3357
- if (size === 'large') return 'large';
3358
- if (size === 'xLarge') return 'xLarge';
3359
- return 'default';
3360
- }
3361
3337
  function ButtonPadding({
3362
3338
  children,
3363
3339
  size,
3364
3340
  hasBadge
3365
3341
  }) {
3366
- const currentPaddingKey = getCurrentPaddingConfig({
3367
- size
3368
- });
3369
3342
  return /*#__PURE__*/jsx(View, {
3370
3343
  position: "relative",
3371
3344
  flexDirection: "row",
3372
3345
  alignItems: "center",
3373
3346
  justifyContent: "center",
3374
- paddingX: `kitt.button.padding.${currentPaddingKey}.horizontal`,
3375
- paddingY: `kitt.button.padding.${currentPaddingKey}.vertical`,
3376
- paddingRight: hasBadge ? `kitt.button.padding.${currentPaddingKey}.hasBadge.right` : undefined,
3347
+ paddingX: `kitt.button.padding.${size}.horizontal`,
3348
+ paddingY: `kitt.button.padding.${size}.vertical`,
3377
3349
  minHeight: "kitt.button.minHeight",
3378
3350
  children: children
3379
3351
  });
3380
3352
  }
3381
3353
 
3382
- function DisabledBorder() {
3383
- return /*#__PURE__*/jsx(View, {
3384
- position: "absolute",
3385
- top: 0,
3386
- left: 0,
3387
- right: 0,
3388
- bottom: 0,
3389
- borderWidth: "kitt.button.borderWidth.disabled",
3390
- borderColor: "kitt.button.disabled.default.borderColor",
3391
- borderRadius: "kitt.button.borderRadius"
3392
- });
3393
- }
3394
-
3395
3354
  function FocusBorder({
3396
- type,
3397
- variant,
3398
3355
  isFocused,
3399
3356
  isHovered,
3400
3357
  isPressed
@@ -3404,11 +3361,13 @@ function FocusBorder({
3404
3361
  button: buttonTheme
3405
3362
  }
3406
3363
  } = useTheme();
3364
+ const outerBorderRadius = buttonTheme.borderRadius + buttonTheme.borderWidth.focus;
3365
+ const innerBorderRadius = buttonTheme.borderRadius;
3407
3366
  return /*#__PURE__*/jsx(View, {
3408
3367
  _web: {
3409
3368
  style: {
3410
- width: `calc(100% + ${buttonTheme.borderWidth.focus * 2}px)`,
3411
- height: `calc(100% + ${buttonTheme.borderWidth.focus * 2}px)`,
3369
+ width: `calc(100% + ${buttonTheme.borderRadius}px)`,
3370
+ height: `calc(100% + ${buttonTheme.borderRadius}px)`,
3412
3371
  transitionProperty: 'opacity',
3413
3372
  transitionDuration: buttonTheme.transition.duration,
3414
3373
  transitionTimingFunction: buttonTheme.transition.timingFunction
@@ -3416,25 +3375,15 @@ function FocusBorder({
3416
3375
  },
3417
3376
  opacity: isFocused && !(isPressed || isHovered) ? 1 : 0,
3418
3377
  position: "absolute",
3419
- left: -buttonTheme.borderWidth.focus,
3420
- top: -buttonTheme.borderWidth.focus,
3421
3378
  borderWidth: "kitt.button.borderWidth.focus",
3422
- borderColor: `kitt.button.${type}.${variant}.focusBorderColor`,
3423
- borderRadius: "kitt.button.borderRadius"
3379
+ borderColor: "kitt.button.focusBorderColor",
3380
+ borderRadius: outerBorderRadius,
3381
+ children: /*#__PURE__*/jsx(View, {
3382
+ borderRadius: innerBorderRadius
3383
+ })
3424
3384
  });
3425
3385
  }
3426
3386
 
3427
- const hasVariant = (button, variant) => {
3428
- return variant in button;
3429
- };
3430
- function getVariantValuesIfExist(theme, type, variant) {
3431
- const button = theme.kitt.button[type];
3432
- if (hasVariant(button, variant)) {
3433
- return button[variant];
3434
- }
3435
- return theme.kitt.button[type].default;
3436
- }
3437
-
3438
3387
  const useNativeAnimation$5 = ({
3439
3388
  type,
3440
3389
  variant,
@@ -3443,16 +3392,12 @@ const useNativeAnimation$5 = ({
3443
3392
  const theme = useTheme();
3444
3393
  const pressed = useSharedValue(isPressedInternal ? 1 : 0);
3445
3394
  const color = useSharedValue(0);
3446
- const {
3447
- backgroundColor,
3448
- pressedBackgroundColor
3449
- } = getVariantValuesIfExist(theme, type, variant);
3450
3395
  const {
3451
3396
  scale
3452
3397
  } = theme.kitt.button;
3453
3398
  const animatedStyles = useAnimatedStyle(() => {
3454
3399
  return {
3455
- backgroundColor: interpolateColor(color.value, [0, 1], [backgroundColor, pressedBackgroundColor]),
3400
+ backgroundColor: 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]),
3456
3401
  transform: [{
3457
3402
  scale: withSpring(pressed.value ? scale.base.active : scale.base.default)
3458
3403
  }]
@@ -3471,27 +3416,14 @@ const useNativeAnimation$5 = ({
3471
3416
  };
3472
3417
  };
3473
3418
 
3474
- const getButtonSize = ({
3475
- large,
3476
- xLarge,
3477
- size
3478
- }) => {
3479
- if (large) return 'large';
3480
- if (xLarge) return 'xLarge';
3481
- return size;
3482
- };
3483
-
3484
- const allowedGhostTypes = ['primary', 'default', 'danger'];
3485
3419
  const Button = /*#__PURE__*/forwardRef(({
3486
3420
  children,
3487
- type = 'default',
3421
+ type = 'secondary',
3488
3422
  variant = 'default',
3489
3423
  disabled,
3490
3424
  stretch,
3491
- large,
3492
- xLarge,
3493
3425
  icon,
3494
- size: sizeProp,
3426
+ size = 'default',
3495
3427
  iconPosition = 'left',
3496
3428
  testID,
3497
3429
  href,
@@ -3517,18 +3449,9 @@ const Button = /*#__PURE__*/forwardRef(({
3517
3449
  type,
3518
3450
  variant
3519
3451
  });
3520
- if ((process.env.NODE_ENV !== "production") && variant === 'ghost' && !allowedGhostTypes.includes(type)) {
3521
- throw new Error('variant=ghost is only allowed with type=primary or default');
3452
+ if (process.env.NODE_ENV !== 'production' && variant === 'revert' && type === 'tertiary-danger') {
3453
+ throw new Error('Invalid revert variant for tertiary-danger button type. Only default variant is allowed.');
3522
3454
  }
3523
- if (large || xLarge) {
3524
- const deprecatedProp = large ? 'large' : 'xLarge';
3525
- deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
3526
- }
3527
- const size = getButtonSize({
3528
- large,
3529
- xLarge,
3530
- size: sizeProp
3531
- });
3532
3455
  return /*#__PURE__*/jsx(Pressable, {
3533
3456
  ref: ref,
3534
3457
  disabled: disabled,
@@ -3540,6 +3463,7 @@ const Button = /*#__PURE__*/forwardRef(({
3540
3463
  alignSelf: createResponsiveStyleFromProp(stretch, undefined, 'flex-start'),
3541
3464
  minWidth: "kitt.button.minWidth",
3542
3465
  maxWidth: createResponsiveStyleFromProp(stretch, '100%', 'kitt.button.maxWidth'),
3466
+ maxHeight: "kitt.button.maxHeight",
3543
3467
  width: createResponsiveStyleFromProp(stretch, '100%', 'auto'),
3544
3468
  onPress: onPress,
3545
3469
  onPressIn: onPressIn,
@@ -3575,10 +3499,9 @@ const Button = /*#__PURE__*/forwardRef(({
3575
3499
  isPressed: isPressed,
3576
3500
  isFocused: isFocused,
3577
3501
  innerSpacing: innerSpacing,
3502
+ size: size,
3578
3503
  children: children
3579
- }), disabled ? /*#__PURE__*/jsx(DisabledBorder, {}) : null, /*#__PURE__*/jsx(FocusBorder, {
3580
- type: type,
3581
- variant: variant,
3504
+ }), /*#__PURE__*/jsx(FocusBorder, {
3582
3505
  isFocused: isFocused || isFocusedInternal,
3583
3506
  isHovered: isHovered,
3584
3507
  isPressed: isPressed
@@ -3746,7 +3669,7 @@ function Actions({
3746
3669
  flexGrow: 1,
3747
3670
  reversed: isReversed,
3748
3671
  ...props,
3749
- space: "kitt.3",
3672
+ space: "kitt.2",
3750
3673
  children: children
3751
3674
  });
3752
3675
  }
@@ -8666,7 +8589,8 @@ function InfoCard({
8666
8589
  icon: /*#__PURE__*/jsx(CaretRightRegularIcon, {})
8667
8590
  }) : /*#__PURE__*/jsx(View$1, {
8668
8591
  children: /*#__PURE__*/jsx(Button, {
8669
- type: isContrastReversed ? 'subtle-revert' : 'subtle-dark',
8592
+ type: "tertiary",
8593
+ variant: isContrastReversed ? 'revert' : undefined,
8670
8594
  onPress: onPress,
8671
8595
  children: action?.label
8672
8596
  })
@@ -9203,14 +9127,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9203
9127
  }
9204
9128
  },
9205
9129
  button: {
9206
- default: theme.button.default,
9207
- dark: theme.button.dark,
9208
9130
  primary: theme.button.primary,
9209
- danger: theme.button.danger,
9210
- subtle: theme.button.subtle,
9211
- 'subtle-revert': theme.button['subtle-revert'],
9212
- 'subtle-dark': theme.button['subtle-dark'],
9213
- disabled: theme.button.disabled
9131
+ secondary: theme.button.secondary,
9132
+ tertiary: theme.button.tertiary,
9133
+ 'tertiary-danger': theme.button['tertiary-danger'],
9134
+ focusBorderColor: theme.button.focusBorderColor
9214
9135
  },
9215
9136
  choices: {
9216
9137
  item: {
@@ -9639,7 +9560,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9639
9560
  iconButton: {
9640
9561
  borderColor: theme.iconButton.borderColor,
9641
9562
  disabled: {
9642
- borderColor: theme.iconButton.disabled.borderColor,
9643
9563
  backgroundColor: theme.iconButton.disabled.backgroundColor
9644
9564
  },
9645
9565
  black: {
@@ -10193,7 +10113,16 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10193
10113
  button: {
10194
10114
  minWidth: theme.button.minWidth,
10195
10115
  maxWidth: theme.button.maxWidth,
10196
- minHeight: theme.button.minHeight
10116
+ minHeight: theme.button.minHeight,
10117
+ maxHeight: theme.button.maxHeight,
10118
+ icon: {
10119
+ default: {
10120
+ size: theme.button.icon.default.size
10121
+ },
10122
+ medium: {
10123
+ size: theme.button.icon.medium.size
10124
+ }
10125
+ }
10197
10126
  },
10198
10127
  buttonBadge: {
10199
10128
  dimensions: {
@@ -10589,7 +10518,10 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10589
10518
  }
10590
10519
  },
10591
10520
  button: {
10592
- padding: theme.button.padding
10521
+ padding: {
10522
+ default: theme.button.padding.default,
10523
+ medium: theme.button.padding.medium
10524
+ }
10593
10525
  },
10594
10526
  cardModal: {
10595
10527
  overlayPadding: theme.cardModal.overlayPadding