@ornikar/kitt-universal 27.1.0 → 27.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/definitions/Button/AnimatedContainer.d.ts +3 -1
  3. package/dist/definitions/Button/AnimatedContainer.d.ts.map +1 -1
  4. package/dist/definitions/Button/AnimatedContainer.web.d.ts +1 -1
  5. package/dist/definitions/Button/AnimatedContainer.web.d.ts.map +1 -1
  6. package/dist/definitions/Button/Button.d.ts.map +1 -1
  7. package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
  8. package/dist/definitions/Button/ButtonPadding.d.ts +2 -2
  9. package/dist/definitions/Button/ButtonPadding.d.ts.map +1 -1
  10. package/dist/definitions/Button/hooks/useNativeAnimation.d.ts.map +1 -1
  11. package/dist/definitions/Choices/AnimatedChoiceItemView.d.ts +3 -3
  12. package/dist/definitions/Choices/AnimatedChoiceItemView.d.ts.map +1 -1
  13. package/dist/definitions/Choices/AnimatedChoiceItemView.web.d.ts +1 -1
  14. package/dist/definitions/Choices/AnimatedChoiceItemView.web.d.ts.map +1 -1
  15. package/dist/definitions/Choices/ChoiceItem.d.ts +6 -4
  16. package/dist/definitions/Choices/ChoiceItem.d.ts.map +1 -1
  17. package/dist/definitions/Choices/Choices.d.ts +2 -2
  18. package/dist/definitions/Choices/Choices.d.ts.map +1 -1
  19. package/dist/definitions/Choices/utils/getBorderColor.d.ts +8 -0
  20. package/dist/definitions/Choices/utils/getBorderColor.d.ts.map +1 -0
  21. package/dist/definitions/Choices/utils/getCurrentTextColor.d.ts +1 -5
  22. package/dist/definitions/Choices/utils/getCurrentTextColor.d.ts.map +1 -1
  23. package/dist/definitions/IconButton/IconButton.d.ts +8 -16
  24. package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
  25. package/dist/definitions/IconButton/utils/getButtonTypeAndVariant.d.ts +9 -0
  26. package/dist/definitions/IconButton/utils/getButtonTypeAndVariant.d.ts.map +1 -0
  27. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +19 -43
  28. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  29. package/dist/definitions/themes/default.d.ts +5 -0
  30. package/dist/definitions/themes/default.d.ts.map +1 -1
  31. package/dist/definitions/themes/late-ocean/button.d.ts +3 -11
  32. package/dist/definitions/themes/late-ocean/button.d.ts.map +1 -1
  33. package/dist/definitions/themes/late-ocean/choices.d.ts +20 -2
  34. package/dist/definitions/themes/late-ocean/choices.d.ts.map +1 -1
  35. package/dist/definitions/themes/late-ocean/iconButton.d.ts +0 -35
  36. package/dist/definitions/themes/late-ocean/iconButton.d.ts.map +1 -1
  37. package/dist/definitions/themes/late-ocean/typography.d.ts +5 -0
  38. package/dist/definitions/themes/late-ocean/typography.d.ts.map +1 -1
  39. package/dist/definitions/typography/Typography.d.ts +1 -1
  40. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  41. package/dist/index-metro.es.android.js +228 -405
  42. package/dist/index-metro.es.android.js.map +1 -1
  43. package/dist/index-metro.es.ios.js +228 -405
  44. package/dist/index-metro.es.ios.js.map +1 -1
  45. package/dist/index-node-22.17.cjs.js +223 -400
  46. package/dist/index-node-22.17.cjs.js.map +1 -1
  47. package/dist/index-node-22.17.cjs.web.js +225 -439
  48. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  49. package/dist/index-node-22.17.es.mjs +223 -400
  50. package/dist/index-node-22.17.es.mjs.map +1 -1
  51. package/dist/index-node-22.17.es.web.mjs +225 -439
  52. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  53. package/dist/index.es.js +228 -398
  54. package/dist/index.es.js.map +1 -1
  55. package/dist/index.es.web.js +231 -437
  56. package/dist/index.es.web.js.map +1 -1
  57. package/dist/linaria-themes-metro.es.android.js +38 -64
  58. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  59. package/dist/linaria-themes-metro.es.ios.js +38 -64
  60. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  61. package/dist/linaria-themes-node-22.17.cjs.js +38 -64
  62. package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
  63. package/dist/linaria-themes-node-22.17.cjs.web.js +38 -64
  64. package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
  65. package/dist/linaria-themes-node-22.17.es.mjs +38 -64
  66. package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
  67. package/dist/linaria-themes-node-22.17.es.web.mjs +38 -64
  68. package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
  69. package/dist/linaria-themes.es.js +38 -64
  70. package/dist/linaria-themes.es.js.map +1 -1
  71. package/dist/linaria-themes.es.web.js +38 -64
  72. package/dist/linaria-themes.es.web.js.map +1 -1
  73. package/dist/tsbuildinfo +1 -1
  74. package/package.json +1 -1
  75. package/dist/definitions/Button/utils/getCurrentScale.d.ts +0 -10
  76. package/dist/definitions/Button/utils/getCurrentScale.d.ts.map +0 -1
  77. package/dist/definitions/Choices/utils/getBorderRadius.d.ts +0 -3
  78. package/dist/definitions/Choices/utils/getBorderRadius.d.ts.map +0 -1
  79. package/dist/definitions/IconButton/AnimatedBackground.d.ts +0 -13
  80. package/dist/definitions/IconButton/AnimatedBackground.d.ts.map +0 -1
  81. package/dist/definitions/IconButton/AnimatedBackground.web.d.ts +0 -4
  82. package/dist/definitions/IconButton/AnimatedBackground.web.d.ts.map +0 -1
  83. package/dist/definitions/IconButton/AnimatedScale.d.ts +0 -12
  84. package/dist/definitions/IconButton/AnimatedScale.d.ts.map +0 -1
  85. package/dist/definitions/IconButton/AnimatedScale.web.d.ts +0 -4
  86. package/dist/definitions/IconButton/AnimatedScale.web.d.ts.map +0 -1
  87. package/dist/definitions/IconButton/Background.d.ts +0 -11
  88. package/dist/definitions/IconButton/Background.d.ts.map +0 -1
  89. package/dist/definitions/IconButton/hooks/useNativeAnimation.d.ts +0 -18
  90. package/dist/definitions/IconButton/hooks/useNativeAnimation.d.ts.map +0 -1
  91. package/dist/definitions/IconButton/hooks/useNativeAnimation.web.d.ts +0 -3
  92. package/dist/definitions/IconButton/hooks/useNativeAnimation.web.d.ts.map +0 -1
  93. package/dist/definitions/IconButton/utils/getIconButtonBackgroundColor.d.ts +0 -3
  94. package/dist/definitions/IconButton/utils/getIconButtonBackgroundColor.d.ts.map +0 -1
  95. package/dist/definitions/IconButton/utils/getIconButtonTextColorByColor.d.ts +0 -4
  96. package/dist/definitions/IconButton/utils/getIconButtonTextColorByColor.d.ts.map +0 -1
@@ -549,20 +549,13 @@ const button = {
549
549
  borderWidth: {
550
550
  focus: 3
551
551
  },
552
- minHeight: 40,
553
552
  minWidth: 40,
554
553
  maxWidth: 335,
555
- maxHeight: 48,
556
- scale: {
557
- base: {
558
- default: 1,
559
- hover: 0.95,
560
- active: 0.95
561
- },
562
- medium: {
563
- hover: 1.05
564
- }
554
+ height: {
555
+ default: 40,
556
+ medium: 48
565
557
  },
558
+ maxHeight: 48,
566
559
  icon: {
567
560
  medium: {
568
561
  size: 24
@@ -795,23 +788,35 @@ const choices = {
795
788
  column: 12
796
789
  },
797
790
  item: {
798
- borderRadius: 10,
791
+ borderRadius: 4,
799
792
  padding: {
800
793
  base: 16,
801
794
  small: 24
802
795
  },
803
796
  backgroundColor: {
804
797
  default: deepPurpleColorPalette['beige.1'],
805
- disabled: colors.disabled,
806
- selected: colors.primary,
807
- pressed: deepPurpleColorPalette['deepPurple.7'],
798
+ disabled: deepPurpleColorPalette['grey.1'],
799
+ selected: deepPurpleColorPalette['beige.3'],
800
+ pressed: deepPurpleColorPalette['beige.2'],
808
801
  hover: deepPurpleColorPalette['beige.2'],
809
- hoverWhenSelected: deepPurpleColorPalette['deepPurple.7']
802
+ hoverWhenSelected: deepPurpleColorPalette['beige.3']
810
803
  },
811
- disabled: {
812
- border: {
813
- width: 2,
814
- color: deepPurpleColorPalette['beige.2']
804
+ color: {
805
+ default: deepPurpleColorPalette['grey.9'],
806
+ disabled: deepPurpleColorPalette['grey.3']
807
+ },
808
+ border: {
809
+ default: {
810
+ width: 1,
811
+ color: deepPurpleColorPalette['deepPurple.7']
812
+ },
813
+ disabled: {
814
+ width: 1,
815
+ color: deepPurpleColorPalette['grey.2']
816
+ },
817
+ error: {
818
+ width: 1,
819
+ color: deepPurpleColorPalette['red.6']
815
820
  }
816
821
  },
817
822
  transition: {
@@ -819,6 +824,12 @@ const choices = {
819
824
  duration: 300,
820
825
  timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
821
826
  }
827
+ },
828
+ description: {
829
+ color: {
830
+ default: deepPurpleColorPalette['grey.5'],
831
+ error: deepPurpleColorPalette['red.6']
832
+ }
822
833
  }
823
834
  };
824
835
 
@@ -1888,50 +1899,8 @@ const icon = {
1888
1899
  };
1889
1900
 
1890
1901
  const iconButton = {
1891
- backgroundColor: 'transparent',
1892
- width: 40,
1893
- height: 40,
1894
- borderRadius: 20,
1895
- borderWidth: 2,
1896
- borderColor: 'transparent',
1897
- transition: {
1898
- property: 'all',
1899
- duration: '200ms',
1900
- timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
1901
- },
1902
- scale: {
1903
- base: {
1904
- default: 1,
1905
- hover: 0.95,
1906
- active: 0.95
1907
- },
1908
- medium: {
1909
- default: 1,
1910
- hover: 1.05,
1911
- active: 0.95
1912
- }
1913
- },
1914
- disabled: {
1915
- scale: 1,
1916
- backgroundColor: button.primary.default.backgroundColor.disabled
1917
- },
1918
- default: {
1919
- pressedBackgroundColor: button.primary.default.backgroundColor.disabled
1920
- },
1921
- ghost: {
1922
- pressedBackgroundColor: button.primary.default.backgroundColor.disabled
1923
- },
1924
- primary: {
1925
- pressedBackgroundColor: deepPurpleColorPalette['beige.1']
1926
- },
1927
- 'primary-plain': {
1928
- pressedBackgroundColor: colors.primaryLight,
1929
- backgroundColor: colors.primary
1930
- },
1931
- secondary: {
1932
- pressedBackgroundColor: 'rgba(0, 0, 0, 0.05)',
1933
- backgroundColor: 'rgba(0, 0, 0, 0.1)'
1934
- }
1902
+ width: button.height.medium,
1903
+ height: button.height.medium
1935
1904
  };
1936
1905
 
1937
1906
  const listItem = {
@@ -2135,6 +2104,11 @@ const typography = {
2135
2104
  fontSize: 14,
2136
2105
  lineHeight: 20,
2137
2106
  allowedFontWeights: ['semibold']
2107
+ },
2108
+ 'label-small': {
2109
+ fontSize: 12,
2110
+ lineHeight: 16,
2111
+ allowedFontWeights: ['semibold']
2138
2112
  }
2139
2113
  }
2140
2114
  },
@@ -2839,6 +2813,8 @@ function AnimatedContainer$2({
2839
2813
  isHovered,
2840
2814
  isPressed,
2841
2815
  variant,
2816
+ size = 'default',
2817
+ isIconOnly,
2842
2818
  type
2843
2819
  }) {
2844
2820
  const currentBackgroundColor = getCurrentBackgroundColorForNativeBaseTheme({
@@ -2848,10 +2824,14 @@ function AnimatedContainer$2({
2848
2824
  isHovered,
2849
2825
  isPressed
2850
2826
  });
2827
+ const width = isIconOnly ? `kitt.button.height.${size}` : undefined;
2828
+ const height = isIconOnly ? `kitt.button.height.${size}` : undefined;
2851
2829
  const sx = useSx();
2852
2830
  const styles = sx({
2853
2831
  borderRadius: 'kitt.button.borderRadius',
2854
- backgroundColor: currentBackgroundColor
2832
+ backgroundColor: currentBackgroundColor,
2833
+ width,
2834
+ height
2855
2835
  });
2856
2836
  return /*#__PURE__*/jsx(Animated.View, {
2857
2837
  style: disabled ? [styles] : [styles, animatedStyles],
@@ -3132,7 +3112,7 @@ function ButtonBadge({
3132
3112
  backgroundColor: backgroundColor,
3133
3113
  borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3134
3114
  children: /*#__PURE__*/jsx(Typography.Text, {
3135
- base: "body-xs",
3115
+ base: "content-caps-xs",
3136
3116
  variant: "bold",
3137
3117
  color: "white",
3138
3118
  children: (badgeCount || 0) > 5 ? '+5' : badgeCount
@@ -3253,10 +3233,34 @@ function ButtonContentChildren({
3253
3233
  throw new Error('kitt(Button): You should provide at least a children or a icon');
3254
3234
  }
3255
3235
  }
3236
+ const isMedium = size === 'medium';
3256
3237
  if (!children && icon) {
3257
- return /*#__PURE__*/jsx(TypographyIcon, {
3258
- icon: icon,
3259
- color: color
3238
+ return /*#__PURE__*/jsxs(View, {
3239
+ alignItems: "center",
3240
+ justifyContent: "center",
3241
+ children: [/*#__PURE__*/jsx(TypographyIcon, {
3242
+ icon: icon,
3243
+ color: color,
3244
+ size: `kitt.button.icon.${size}.size`
3245
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3246
+ position: "absolute",
3247
+ top: (() => {
3248
+ if (withBadge) {
3249
+ return isMedium ? '-14px' : '-10px';
3250
+ }
3251
+ return isMedium ? '-20px' : '-16px';
3252
+ })(),
3253
+ right: (() => {
3254
+ if (withBadge) {
3255
+ return isMedium ? '-28px' : '-20px';
3256
+ }
3257
+ return isMedium ? '-33px' : '-25px';
3258
+ })(),
3259
+ children: /*#__PURE__*/jsx(ButtonBadge, {
3260
+ withBadge: withBadge,
3261
+ badgeCount: badgeCount
3262
+ })
3263
+ }) : null]
3260
3264
  });
3261
3265
  }
3262
3266
  // Make the multilines case work properly on native - Breaks the web implem
@@ -3337,16 +3341,16 @@ function ButtonContent(_ref) {
3337
3341
  function ButtonPadding({
3338
3342
  children,
3339
3343
  size,
3340
- hasBadge
3344
+ isIconOnly
3341
3345
  }) {
3342
3346
  return /*#__PURE__*/jsx(View, {
3343
3347
  position: "relative",
3344
3348
  flexDirection: "row",
3345
3349
  alignItems: "center",
3346
3350
  justifyContent: "center",
3351
+ height: isIconOnly ? `kitt.button.height.${size}` : undefined,
3347
3352
  paddingX: `kitt.button.padding.${size}.horizontal`,
3348
3353
  paddingY: `kitt.button.padding.${size}.vertical`,
3349
- minHeight: "kitt.button.minHeight",
3350
3354
  children: children
3351
3355
  });
3352
3356
  }
@@ -3384,7 +3388,7 @@ function FocusBorder({
3384
3388
  });
3385
3389
  }
3386
3390
 
3387
- const useNativeAnimation$5 = ({
3391
+ const useNativeAnimation$4 = ({
3388
3392
  type,
3389
3393
  variant,
3390
3394
  isPressedInternal
@@ -3392,15 +3396,9 @@ const useNativeAnimation$5 = ({
3392
3396
  const theme = useTheme();
3393
3397
  const pressed = useSharedValue(isPressedInternal ? 1 : 0);
3394
3398
  const color = useSharedValue(0);
3395
- const {
3396
- scale
3397
- } = theme.kitt.button;
3398
3399
  const animatedStyles = useAnimatedStyle(() => {
3399
3400
  return {
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]),
3401
- transform: [{
3402
- scale: withSpring(pressed.value ? scale.base.active : scale.base.default)
3403
- }]
3401
+ 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])
3404
3402
  };
3405
3403
  });
3406
3404
  return {
@@ -3445,13 +3443,14 @@ const Button = /*#__PURE__*/forwardRef(({
3445
3443
  onPressIn,
3446
3444
  onPressOut,
3447
3445
  animatedStyles
3448
- } = useNativeAnimation$5({
3446
+ } = useNativeAnimation$4({
3449
3447
  type: _type,
3450
3448
  variant: _variant
3451
3449
  });
3452
3450
  if (process.env.NODE_ENV !== 'production' && _variant === 'revert' && _type === 'tertiary-danger') {
3453
3451
  throw new Error('Invalid revert variant for tertiary-danger button type. Only default variant is allowed.');
3454
3452
  }
3453
+ const isIconOnly = !children && !!icon;
3455
3454
  return /*#__PURE__*/jsx(Pressable, {
3456
3455
  ref: ref,
3457
3456
  disabled: disabled,
@@ -3483,10 +3482,12 @@ const Button = /*#__PURE__*/forwardRef(({
3483
3482
  isPressed: isPressed || isPressedInternal,
3484
3483
  disabled: !!disabled,
3485
3484
  variant: _variant,
3485
+ size: _size,
3486
+ isIconOnly: isIconOnly,
3486
3487
  isStretch: stretch,
3487
3488
  children: /*#__PURE__*/jsxs(ButtonPadding, {
3488
3489
  size: _size,
3489
- hasBadge: Boolean(withBadge || badgeCount && badgeCount > 0),
3490
+ isIconOnly: isIconOnly,
3490
3491
  children: [/*#__PURE__*/jsx(ButtonContent, {
3491
3492
  type: _type,
3492
3493
  variant: _variant,
@@ -4287,7 +4288,7 @@ CardModal.Header = CardModalHeader;
4287
4288
  CardModal.Footer = CardModalFooter;
4288
4289
  CardModal.ModalBehaviour = CardModalBehaviour;
4289
4290
 
4290
- function getBackgroundColor$5({
4291
+ function getBackgroundColor$4({
4291
4292
  isDisabled,
4292
4293
  isSelected,
4293
4294
  isHovered,
@@ -4301,40 +4302,50 @@ function getBackgroundColor$5({
4301
4302
  return 'kitt.choices.item.default.backgroundColor';
4302
4303
  }
4303
4304
 
4304
- function getBorderRadius(variant) {
4305
- // The clean way to have the rounded effect would have been to know the children height since radius >= height * 0.5
4306
- // We don't control over the height of the rendered children we just go with a arbitrary really high value
4307
- return variant === 'rounded' ? Number.MAX_SAFE_INTEGER : 'kitt.choices.item.borderRadius';
4305
+ function getBorderColor$2({
4306
+ isDisabled,
4307
+ hasError,
4308
+ isSelected
4309
+ }) {
4310
+ if (isDisabled) {
4311
+ return 'kitt.choices.item.disabled.borderColor';
4312
+ }
4313
+ if (hasError) {
4314
+ return 'kitt.choices.item.error.borderColor';
4315
+ }
4316
+ if (isSelected) {
4317
+ return 'kitt.choices.item.default.borderColor';
4318
+ }
4319
+ return 'transparent';
4308
4320
  }
4309
4321
 
4310
4322
  function AnimatedChoiceItemView({
4311
4323
  children,
4312
- variant,
4313
4324
  size,
4314
4325
  isHovered,
4315
4326
  isPressed,
4316
4327
  isDisabled,
4317
4328
  isSelected,
4329
+ hasError,
4318
4330
  animatedStyles
4319
4331
  }) {
4320
4332
  const sx = useSx();
4321
4333
  const style = sx({
4322
4334
  position: 'relative',
4323
- borderRadius: getBorderRadius(variant),
4324
- backgroundColor: getBackgroundColor$5({
4335
+ borderRadius: 'kitt.choices.item.borderRadius',
4336
+ borderWidth: 'kitt.choices.item.default.borderWidth',
4337
+ borderColor: getBorderColor$2({
4338
+ isDisabled,
4339
+ hasError,
4340
+ isSelected
4341
+ }),
4342
+ backgroundColor: getBackgroundColor$4({
4325
4343
  isDisabled,
4326
4344
  isSelected,
4327
4345
  isHovered,
4328
4346
  isPressed
4329
4347
  }),
4330
- paddingX: size === 'small' ? 'kitt.4' : {
4331
- base: 'kitt.4',
4332
- small: 'kitt.6'
4333
- },
4334
- paddingY: size === 'small' ? 'kitt.2' : {
4335
- base: 'kitt.4',
4336
- small: 'kitt.6'
4337
- }
4348
+ padding: size === 'small' ? 'kitt.2' : 'kitt.4'
4338
4349
  });
4339
4350
  return /*#__PURE__*/jsx(Animated.View, {
4340
4351
  style: [style, animatedStyles],
@@ -4342,7 +4353,7 @@ function AnimatedChoiceItemView({
4342
4353
  });
4343
4354
  }
4344
4355
 
4345
- const useNativeAnimation$4 = ({
4356
+ const useNativeAnimation$3 = ({
4346
4357
  selected,
4347
4358
  disabled,
4348
4359
  isPressedInternal
@@ -4383,23 +4394,21 @@ const useNativeAnimation$4 = ({
4383
4394
  };
4384
4395
 
4385
4396
  function getCurrentTextColor$1({
4386
- isDisabled,
4387
- isSelected,
4388
- isPressed,
4389
- isHovered
4397
+ isDisabled
4390
4398
  }) {
4391
- if (isDisabled) return 'black-light';
4392
- if (isSelected && isHovered) return 'white';
4393
- if (isSelected || isPressed) return 'white';
4394
- return 'black';
4399
+ if (isDisabled) return 'kitt.choices.item.disabled.color';
4400
+ return 'kitt.choices.item.default.color';
4395
4401
  }
4396
4402
 
4397
4403
  function ChoiceItem({
4398
4404
  type = 'button',
4405
+ orientation = 'horizontal',
4406
+ icon,
4407
+ hasError,
4408
+ description,
4399
4409
  value,
4400
4410
  selected,
4401
4411
  disabled,
4402
- variant,
4403
4412
  children,
4404
4413
  isPressedInternal,
4405
4414
  isHoveredInternal,
@@ -4415,11 +4424,12 @@ function ChoiceItem({
4415
4424
  onPressIn,
4416
4425
  onPressOut,
4417
4426
  backgroundStyles
4418
- } = useNativeAnimation$4({
4427
+ } = useNativeAnimation$3({
4419
4428
  selected,
4420
4429
  disabled,
4421
4430
  isPressedInternal
4422
4431
  });
4432
+ const Stack = orientation === 'horizontal' ? HStack : VStack;
4423
4433
  const handleChange = () => {
4424
4434
  if (!onChange) return;
4425
4435
 
@@ -4451,33 +4461,45 @@ function ChoiceItem({
4451
4461
  children: ({
4452
4462
  isHovered,
4453
4463
  isPressed
4454
- }) => /*#__PURE__*/jsxs(AnimatedChoiceItemView, {
4455
- animatedStyles: backgroundStyles,
4456
- isHovered: isHovered || isHoveredInternal,
4457
- isDisabled: disabled,
4458
- isSelected: selected,
4459
- isPressed: isPressed || isPressedInternal,
4460
- variant: variant,
4461
- size: size,
4462
- children: [/*#__PURE__*/jsx(Typography.SetDefaultColor, {
4463
- value: getCurrentTextColor$1({
4464
+ }) => {
4465
+ const textColor = getCurrentTextColor$1({
4466
+ isDisabled: disabled
4467
+ });
4468
+ return /*#__PURE__*/jsxs(VStack, {
4469
+ space: "kitt.2",
4470
+ children: [/*#__PURE__*/jsxs(AnimatedChoiceItemView, {
4471
+ animatedStyles: backgroundStyles,
4472
+ isHovered: isHovered || isHoveredInternal,
4464
4473
  isDisabled: disabled,
4465
- isSelected: selected || isPressedInternal,
4466
- isPressed,
4467
- isHovered: isHovered || isHoveredInternal
4468
- }),
4469
- children: children
4470
- }), disabled ? /*#__PURE__*/jsx(View, {
4471
- borderRadius: getBorderRadius(variant),
4472
- borderWidth: "kitt.choices.item.disabled.borderWidth",
4473
- borderColor: "kitt.choices.item.disabled.borderColor",
4474
- position: "absolute",
4475
- top: "0",
4476
- right: "0",
4477
- left: "0",
4478
- bottom: "0"
4479
- }) : null]
4480
- })
4474
+ isSelected: selected,
4475
+ isPressed: isPressed || isPressedInternal,
4476
+ hasError: hasError,
4477
+ size: size,
4478
+ children: [/*#__PURE__*/jsxs(Stack, {
4479
+ alignItems: "center",
4480
+ space: "kitt.2",
4481
+ children: [icon ? /*#__PURE__*/jsx(TypographyIcon, {
4482
+ color: textColor,
4483
+ icon: icon
4484
+ }) : null, /*#__PURE__*/jsx(Typography.SetDefaultColor, {
4485
+ value: textColor,
4486
+ children: children
4487
+ })]
4488
+ }), disabled ? /*#__PURE__*/jsx(View, {
4489
+ borderRadius: "kitt.choices.item.borderRadius",
4490
+ position: "absolute",
4491
+ top: "0",
4492
+ right: "0",
4493
+ left: "0",
4494
+ bottom: "0"
4495
+ }) : null]
4496
+ }), description ? /*#__PURE__*/jsx(Typography.Text, {
4497
+ base: "body-s",
4498
+ color: hasError ? 'kitt.choices.description.color.error' : 'kitt.choices.description.color.default',
4499
+ children: description
4500
+ }) : null]
4501
+ });
4502
+ }
4481
4503
  });
4482
4504
  }
4483
4505
 
@@ -4526,7 +4548,6 @@ function Choices({
4526
4548
  disabled,
4527
4549
  children,
4528
4550
  value,
4529
- variant,
4530
4551
  onPress,
4531
4552
  onChange,
4532
4553
  onFocus,
@@ -4541,7 +4562,6 @@ function Choices({
4541
4562
  const sharedProps = {
4542
4563
  type,
4543
4564
  disabled,
4544
- variant,
4545
4565
  onPress: !isForm ? onPress : undefined,
4546
4566
  onChange: isForm ? newValue => {
4547
4567
  setCurrentValue(newValue);
@@ -5070,7 +5090,7 @@ const InputText = /*#__PURE__*/forwardRef((_ref, ref) => {
5070
5090
  });
5071
5091
  });
5072
5092
 
5073
- function getBackgroundColor$4({
5093
+ function getBackgroundColor$3({
5074
5094
  isSelected,
5075
5095
  isHighlighted,
5076
5096
  isPressed,
@@ -5109,7 +5129,7 @@ function AutocompleteItem({
5109
5129
  minHeight: "kitt.forms.autocomplete.option.minHeight",
5110
5130
  borderRadius: "kitt.1",
5111
5131
  padding: "kitt.1",
5112
- backgroundColor: getBackgroundColor$4({
5132
+ backgroundColor: getBackgroundColor$3({
5113
5133
  isSelected,
5114
5134
  isHighlighted,
5115
5135
  isPressed,
@@ -5405,7 +5425,7 @@ const SvgCheckboxMarkinline = props => /*#__PURE__*/jsx(Svg, _objectSpread(_obje
5405
5425
  })
5406
5426
  }));
5407
5427
 
5408
- function getBackgroundColor$3({
5428
+ function getBackgroundColor$2({
5409
5429
  isDisabled,
5410
5430
  isPressed,
5411
5431
  isHovered,
@@ -5486,7 +5506,7 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref, ref) => {
5486
5506
  isPressed,
5487
5507
  isChecked: checked
5488
5508
  }),
5489
- backgroundColor: getBackgroundColor$3({
5509
+ backgroundColor: getBackgroundColor$2({
5490
5510
  isDisabled: disabled,
5491
5511
  isFocused,
5492
5512
  isHovered,
@@ -7184,7 +7204,7 @@ function InnerCircle({
7184
7204
  });
7185
7205
  }
7186
7206
 
7187
- function getBackgroundColor$2({
7207
+ function getBackgroundColor$1({
7188
7208
  isDisabled,
7189
7209
  isPressed,
7190
7210
  isHovered,
@@ -7230,7 +7250,7 @@ function OuterCircle({
7230
7250
  width: "kitt.forms.radio.size",
7231
7251
  height: "kitt.forms.radio.size",
7232
7252
  borderRadius: "kitt.forms.radio.borderRadius",
7233
- backgroundColor: getBackgroundColor$2({
7253
+ backgroundColor: getBackgroundColor$1({
7234
7254
  isChecked,
7235
7255
  isDisabled,
7236
7256
  isFocused,
@@ -7371,7 +7391,7 @@ function HoverBorder({
7371
7391
  });
7372
7392
  }
7373
7393
 
7374
- const useNativeAnimation$3 = ({
7394
+ const useNativeAnimation$2 = ({
7375
7395
  isDisabled,
7376
7396
  isSelected,
7377
7397
  isPressedInternal
@@ -7452,7 +7472,7 @@ function RadioButton({
7452
7472
  onPressIn,
7453
7473
  onPressOut,
7454
7474
  animatedStyles
7455
- } = useNativeAnimation$3({
7475
+ } = useNativeAnimation$2({
7456
7476
  isDisabled: disabled,
7457
7477
  isSelected: selected,
7458
7478
  isPressedInternal
@@ -8190,7 +8210,7 @@ const withTimingConfig = {
8190
8210
  duration: 100,
8191
8211
  easing: Easing$1.ease
8192
8212
  };
8193
- const useNativeAnimation$2 = ({
8213
+ const useNativeAnimation$1 = ({
8194
8214
  variant,
8195
8215
  isExpanded,
8196
8216
  isInitialRender,
@@ -8272,7 +8292,7 @@ function Highlight({
8272
8292
  contentAnimatedStyles,
8273
8293
  onPressIn,
8274
8294
  onPressOut
8275
- } = useNativeAnimation$2({
8295
+ } = useNativeAnimation$1({
8276
8296
  variant,
8277
8297
  isExpanded,
8278
8298
  isInitialRender,
@@ -8372,228 +8392,55 @@ function Highlight({
8372
8392
  });
8373
8393
  }
8374
8394
 
8375
- const _excluded$c = ["color", "isDisabled"];
8376
- function getBackgroundColor$1(color, isDisabled) {
8377
- if (isDisabled) {
8378
- return 'kitt.iconButton.disabled.backgroundColor';
8379
- }
8380
- switch (color) {
8395
+ const getButtonTypeAndVariant = iconColor => {
8396
+ switch (iconColor) {
8397
+ case 'black':
8398
+ return {
8399
+ type: 'tertiary'
8400
+ };
8401
+ case 'secondary':
8402
+ return {
8403
+ type: 'secondary'
8404
+ };
8381
8405
  case 'primary':
8382
- return 'kitt.iconButton.primary.pressed.backgroundColor';
8406
+ return {
8407
+ type: 'primary'
8408
+ };
8383
8409
  case 'primary-plain':
8384
- return 'kitt.iconButton.primary-plain.pressed.backgroundColor';
8410
+ return {
8411
+ type: 'primary'
8412
+ };
8385
8413
  case 'ghost':
8386
- return 'kitt.iconButton.ghost.pressed.backgroundColor';
8387
- case 'black':
8414
+ return {
8415
+ type: 'tertiary',
8416
+ variant: 'revert'
8417
+ };
8388
8418
  default:
8389
- return 'kitt.iconButton.black.pressed.backgroundColor';
8419
+ return {
8420
+ type: 'secondary'
8421
+ };
8390
8422
  }
8391
- }
8392
- function Background(_ref) {
8423
+ };
8424
+
8425
+ const _excluded$c = ["color", "ariaLabel"];
8426
+ /**
8427
+ * @deprecated IconButton should only be used as a navigation button
8428
+ * Other use cases should use a <Button> component with an icon
8429
+ */
8430
+ function IconButton(_ref) {
8393
8431
  let {
8394
- color,
8395
- isDisabled
8432
+ color = 'black',
8433
+ ariaLabel
8396
8434
  } = _ref,
8397
8435
  props = _objectWithoutProperties(_ref, _excluded$c);
8398
- return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), {}, {
8399
- width: "100%",
8400
- height: "100%",
8401
- borderRadius: "kitt.iconButton.borderRadius",
8402
- backgroundColor: getBackgroundColor$1(color, isDisabled)
8403
- }));
8404
- }
8405
-
8406
- function AnimatedBackground({
8407
- color,
8408
- isDisabled,
8409
- opacityStyles
8410
- }) {
8411
- const sx = useSx();
8412
- const currentOpacityStyles = isDisabled ? {
8413
- opacity: 1
8414
- } : opacityStyles;
8415
- const styles = sx({
8416
- position: 'absolute',
8417
- top: 0,
8418
- left: 0,
8419
- width: '100%',
8420
- height: '100%'
8421
- });
8422
- return /*#__PURE__*/jsx(Animated.View, {
8423
- style: [styles, currentOpacityStyles],
8424
- children: /*#__PURE__*/jsx(Background, {
8425
- color: color,
8426
- isDisabled: isDisabled
8427
- })
8428
- });
8429
- }
8430
-
8431
- function AnimatedScale({
8432
- isDisabled,
8433
- scaleStyles,
8434
- children
8435
- }) {
8436
- const sx = useSx();
8437
- const currentOpacityStyles = isDisabled ? {
8438
- transform: [{
8439
- scale: 1
8440
- }]
8441
- } : scaleStyles;
8442
- const styles = sx({
8443
- position: 'relative',
8444
- alignItems: 'center',
8445
- justifyContent: 'center',
8446
- width: '100%',
8447
- height: '100%'
8448
- });
8449
- return /*#__PURE__*/jsx(Animated.View, {
8450
- style: [styles, currentOpacityStyles],
8451
- children: children
8452
- });
8453
- }
8454
-
8455
- function useNativeAnimation$1({
8456
- isPressed
8457
- }) {
8458
- const theme = useTheme();
8459
- const pressed = useSharedValue(!!isPressed);
8460
- const opacityStyles = useAnimatedStyle(() => {
8461
- return {
8462
- opacity: withSpring(pressed.value ? 1 : 0)
8463
- };
8464
- });
8465
- const scaleStyles = useAnimatedStyle(() => {
8466
- return {
8467
- transform: [{
8468
- scale: withSpring(pressed.value ? theme.kitt.iconButton.scale.base.active : theme.kitt.iconButton.scale.base.default)
8469
- }]
8470
- };
8471
- });
8472
- return {
8473
- opacityStyles,
8474
- scaleStyles,
8475
- onPressIn: () => {
8476
- pressed.value = true;
8477
- },
8478
- onPressOut: () => {
8479
- pressed.value = false;
8480
- }
8481
- };
8482
- }
8483
-
8484
- const getIconButtonBackgroundColor = (color, disabled) => {
8485
- if (disabled) {
8486
- return undefined;
8487
- }
8488
- switch (color) {
8489
- case 'primary-plain':
8490
- return 'kitt.iconButton.primary-plain.backgroundColor';
8491
- case 'secondary':
8492
- return 'kitt.iconButton.secondary.backgroundColor';
8493
- default:
8494
- return undefined;
8495
- }
8496
- };
8497
-
8498
- const getIconButtonTextColorByColor = (color, disabled) => {
8499
- if (disabled) {
8500
- return 'black-light';
8501
- }
8502
- switch (color) {
8503
- case 'ghost':
8504
- return 'white';
8505
- case 'primary-plain':
8506
- return 'white';
8507
- case 'secondary':
8508
- return 'black';
8509
- default:
8510
- return color;
8511
- }
8512
- };
8513
-
8514
- function IconButton({
8515
- icon,
8516
- color = 'black',
8517
- disabled,
8518
- testID,
8519
- ariaLabel,
8520
- accessibilityRole = 'button',
8521
- withBadge,
8522
- badgeCount,
8523
- isHoveredInternal,
8524
- isPressedInternal,
8525
- isFocusedInternal,
8526
- onPress
8527
- }) {
8528
8436
  const {
8529
- onPressIn,
8530
- onPressOut,
8531
- opacityStyles,
8532
- scaleStyles
8533
- } = useNativeAnimation$1({
8534
- isDisabled: disabled,
8535
- isPressed: isPressedInternal
8536
- });
8537
- return /*#__PURE__*/jsx(Pressable, {
8538
- testID: testID,
8539
- disabled: disabled,
8540
- width: "kitt.iconButton.width",
8541
- height: "kitt.iconButton.height",
8542
- "aria-label": ariaLabel,
8543
- accessibilityRole: accessibilityRole,
8544
- _web: {
8545
- style: {
8546
- backfaceVisibility: 'hidden',
8547
- transform: 'translate3d(0px)'
8548
- }
8549
- },
8550
- backgroundColor: getIconButtonBackgroundColor(color, disabled),
8551
- borderRadius: "kitt.iconButton.borderRadius",
8552
- borderColor: disabled ? 'kitt.iconButton.disabled.borderColor' : 'kitt.iconButton.borderColor',
8553
- borderWidth: disabled ? 'kitt.iconButton.borderWidth' : 0,
8554
- onPress: onPress,
8555
- onPressIn: onPressIn,
8556
- onPressOut: onPressOut,
8557
- children: ({
8558
- isHovered,
8559
- isPressed,
8560
- isFocused
8561
- }) => {
8562
- const isCurrentHovered = isHovered || isHoveredInternal;
8563
- const isCurrentPressed = isPressed || isPressedInternal;
8564
- return /*#__PURE__*/jsxs(Fragment, {
8565
- children: [/*#__PURE__*/jsxs(AnimatedScale, {
8566
- isDisabled: disabled,
8567
- isHovered: isCurrentHovered,
8568
- isPressed: isCurrentPressed,
8569
- scaleStyles: scaleStyles,
8570
- children: [/*#__PURE__*/jsx(AnimatedBackground, {
8571
- color: color,
8572
- isDisabled: disabled,
8573
- isHovered: isCurrentHovered,
8574
- isPressed: isCurrentPressed,
8575
- isFocused: isFocused || isFocusedInternal,
8576
- opacityStyles: opacityStyles
8577
- }), /*#__PURE__*/jsx(View, {
8578
- alignItems: "center",
8579
- justifyContent: "center",
8580
- children: /*#__PURE__*/jsx(TypographyIcon, {
8581
- color: getIconButtonTextColorByColor(color, disabled),
8582
- icon: icon
8583
- })
8584
- })]
8585
- }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
8586
- position: "absolute",
8587
- top: withBadge ? '1px' : '-6px',
8588
- right: withBadge ? '1px' : '-6px',
8589
- children: /*#__PURE__*/jsx(ButtonBadge, {
8590
- withBadge: withBadge,
8591
- badgeCount: badgeCount
8592
- })
8593
- }) : null]
8594
- });
8595
- }
8596
- });
8437
+ type: legacyColorToType,
8438
+ variant: legacyColorToVariant
8439
+ } = getButtonTypeAndVariant(color);
8440
+ return /*#__PURE__*/jsx(Button, _objectSpread({
8441
+ variant: legacyColorToVariant,
8442
+ type: legacyColorToType
8443
+ }, props));
8597
8444
  }
8598
8445
  function CloseIconButton(props) {
8599
8446
  return /*#__PURE__*/jsx(IconButton, _objectSpread({
@@ -9165,11 +9012,17 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9165
9012
  choices: {
9166
9013
  item: {
9167
9014
  default: {
9168
- backgroundColor: theme.choices.item.backgroundColor.default
9015
+ backgroundColor: theme.choices.item.backgroundColor.default,
9016
+ borderColor: theme.choices.item.border.default.color,
9017
+ color: theme.choices.item.color.default
9169
9018
  },
9170
9019
  disabled: {
9171
9020
  backgroundColor: theme.choices.item.backgroundColor.disabled,
9172
- borderColor: theme.choices.item.disabled.border.color
9021
+ borderColor: theme.choices.item.border.disabled.color,
9022
+ color: theme.choices.item.color.disabled
9023
+ },
9024
+ error: {
9025
+ borderColor: theme.choices.item.border.error.color
9173
9026
  },
9174
9027
  selected: {
9175
9028
  backgroundColor: theme.choices.item.backgroundColor.selected
@@ -9183,6 +9036,12 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9183
9036
  hoverWhenSelected: {
9184
9037
  backgroundColor: theme.choices.item.backgroundColor.hoverWhenSelected
9185
9038
  }
9039
+ },
9040
+ description: {
9041
+ color: {
9042
+ default: theme.choices.description.color.default,
9043
+ error: theme.choices.description.color.error
9044
+ }
9186
9045
  }
9187
9046
  },
9188
9047
  tooltip: {
@@ -9586,39 +9445,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9586
9445
  buttonBadge: {
9587
9446
  backgroundColor: theme.buttonBadge.backgroundColor
9588
9447
  },
9589
- iconButton: {
9590
- borderColor: theme.iconButton.borderColor,
9591
- disabled: {
9592
- backgroundColor: theme.iconButton.disabled.backgroundColor
9593
- },
9594
- black: {
9595
- pressed: {
9596
- backgroundColor: theme.iconButton.default.pressedBackgroundColor
9597
- }
9598
- },
9599
- ghost: {
9600
- pressed: {
9601
- backgroundColor: theme.iconButton.ghost.pressedBackgroundColor
9602
- }
9603
- },
9604
- primary: {
9605
- pressed: {
9606
- backgroundColor: theme.iconButton.primary.pressedBackgroundColor
9607
- }
9608
- },
9609
- 'primary-plain': {
9610
- pressed: {
9611
- backgroundColor: theme.iconButton['primary-plain'].pressedBackgroundColor
9612
- },
9613
- backgroundColor: theme.iconButton['primary-plain'].backgroundColor
9614
- },
9615
- secondary: {
9616
- pressed: {
9617
- backgroundColor: theme.iconButton.secondary.pressedBackgroundColor
9618
- },
9619
- backgroundColor: theme.iconButton.secondary.backgroundColor
9620
- }
9621
- },
9622
9448
  highlight: {
9623
9449
  regular: {
9624
9450
  default: {
@@ -9819,9 +9645,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9819
9645
  highlight: {
9820
9646
  borderRadius: theme.highlight.borderRadius
9821
9647
  },
9822
- iconButton: {
9823
- borderRadius: theme.iconButton.borderRadius
9824
- },
9825
9648
  tag: {
9826
9649
  borderRadius: theme.tag.borderRadius
9827
9650
  },
@@ -9945,14 +9768,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9945
9768
  },
9946
9769
  choices: {
9947
9770
  item: {
9948
- disabled: {
9949
- borderWidth: theme.choices.item.disabled.border.width
9771
+ default: {
9772
+ borderWidth: theme.choices.item.border.default.width
9950
9773
  }
9951
9774
  }
9952
9775
  },
9953
- iconButton: {
9954
- borderWidth: theme.iconButton.borderWidth
9955
- },
9956
9776
  forms: {
9957
9777
  input: {
9958
9778
  borderWidth: theme.forms.input.borderWidth
@@ -10138,8 +9958,10 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10138
9958
  button: {
10139
9959
  minWidth: theme.button.minWidth,
10140
9960
  maxWidth: theme.button.maxWidth,
10141
- minHeight: theme.button.minHeight,
10142
- maxHeight: theme.button.maxHeight,
9961
+ height: {
9962
+ default: theme.button.height.default,
9963
+ medium: theme.button.height.medium
9964
+ },
10143
9965
  icon: {
10144
9966
  default: {
10145
9967
  size: theme.button.icon.default.size
@@ -10467,7 +10289,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10467
10289
  }
10468
10290
  },
10469
10291
  iconButton: {
10470
- size: theme.iconButton.width - theme.iconButton.borderWidth,
10471
10292
  width: theme.iconButton.width,
10472
10293
  height: theme.iconButton.height
10473
10294
  },
@@ -10764,6 +10585,7 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10764
10585
  'body-xs': `${theme.typography.types.bodies.configs['body-xs'].fontSize}px`,
10765
10586
  'label-large': `${theme.typography.types.labels.configs['label-large'].fontSize}px`,
10766
10587
  'label-medium': `${theme.typography.types.labels.configs['label-medium'].fontSize}px`,
10588
+ 'label-small': `${theme.typography.types.labels.configs['label-small'].fontSize}px`,
10767
10589
  'content-caps-xxxl': `${theme.typography.types.contentCaps.configs['content-caps-xxxl'].fontSize}px`,
10768
10590
  'content-caps-xxl': `${theme.typography.types.contentCaps.configs['content-caps-xxl'].fontSize}px`,
10769
10591
  'content-caps-xl': `${theme.typography.types.contentCaps.configs['content-caps-xl'].fontSize}px`,
@@ -10786,6 +10608,7 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10786
10608
  'body-xs': `${theme.typography.types.bodies.configs['body-xs'].lineHeight}px`,
10787
10609
  'label-large': `${theme.typography.types.labels.configs['label-large'].lineHeight}px`,
10788
10610
  'label-medium': `${theme.typography.types.labels.configs['label-medium'].lineHeight}px`,
10611
+ 'label-small': `${theme.typography.types.labels.configs['label-small'].lineHeight}px`,
10789
10612
  'content-caps-xxxl': `${theme.typography.types.contentCaps.configs['content-caps-xxxl'].lineHeight}px`,
10790
10613
  'content-caps-xxl': `${theme.typography.types.contentCaps.configs['content-caps-xxl'].lineHeight}px`,
10791
10614
  'content-caps-xl': `${theme.typography.types.contentCaps.configs['content-caps-xl'].lineHeight}px`,