@ornikar/kitt-universal 27.1.0 → 27.3.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 +25 -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
@@ -569,20 +569,13 @@ const button = {
569
569
  borderWidth: {
570
570
  focus: 3
571
571
  },
572
- minHeight: 40,
573
572
  minWidth: 40,
574
573
  maxWidth: 335,
575
- maxHeight: 48,
576
- scale: {
577
- base: {
578
- default: 1,
579
- hover: 0.95,
580
- active: 0.95
581
- },
582
- medium: {
583
- hover: 1.05
584
- }
574
+ height: {
575
+ default: 40,
576
+ medium: 48
585
577
  },
578
+ maxHeight: 48,
586
579
  icon: {
587
580
  medium: {
588
581
  size: 24
@@ -815,23 +808,35 @@ const choices = {
815
808
  column: 12
816
809
  },
817
810
  item: {
818
- borderRadius: 10,
811
+ borderRadius: 4,
819
812
  padding: {
820
813
  base: 16,
821
814
  small: 24
822
815
  },
823
816
  backgroundColor: {
824
817
  default: deepPurpleColorPalette['beige.1'],
825
- disabled: colors.disabled,
826
- selected: colors.primary,
827
- pressed: deepPurpleColorPalette['deepPurple.7'],
818
+ disabled: deepPurpleColorPalette['grey.1'],
819
+ selected: deepPurpleColorPalette['beige.3'],
820
+ pressed: deepPurpleColorPalette['beige.2'],
828
821
  hover: deepPurpleColorPalette['beige.2'],
829
- hoverWhenSelected: deepPurpleColorPalette['deepPurple.7']
822
+ hoverWhenSelected: deepPurpleColorPalette['beige.3']
830
823
  },
831
- disabled: {
832
- border: {
833
- width: 2,
834
- color: deepPurpleColorPalette['beige.2']
824
+ color: {
825
+ default: deepPurpleColorPalette['grey.9'],
826
+ disabled: deepPurpleColorPalette['grey.3']
827
+ },
828
+ border: {
829
+ default: {
830
+ width: 1,
831
+ color: deepPurpleColorPalette['deepPurple.7']
832
+ },
833
+ disabled: {
834
+ width: 1,
835
+ color: deepPurpleColorPalette['grey.2']
836
+ },
837
+ error: {
838
+ width: 1,
839
+ color: deepPurpleColorPalette['red.6']
835
840
  }
836
841
  },
837
842
  transition: {
@@ -839,6 +844,12 @@ const choices = {
839
844
  duration: 300,
840
845
  timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
841
846
  }
847
+ },
848
+ description: {
849
+ color: {
850
+ default: deepPurpleColorPalette['grey.7'],
851
+ error: deepPurpleColorPalette['red.6']
852
+ }
842
853
  }
843
854
  };
844
855
 
@@ -1908,50 +1919,8 @@ const icon = {
1908
1919
  };
1909
1920
 
1910
1921
  const iconButton = {
1911
- backgroundColor: 'transparent',
1912
- width: 40,
1913
- height: 40,
1914
- borderRadius: 20,
1915
- borderWidth: 2,
1916
- borderColor: 'transparent',
1917
- transition: {
1918
- property: 'all',
1919
- duration: '200ms',
1920
- timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
1921
- },
1922
- scale: {
1923
- base: {
1924
- default: 1,
1925
- hover: 0.95,
1926
- active: 0.95
1927
- },
1928
- medium: {
1929
- default: 1,
1930
- hover: 1.05,
1931
- active: 0.95
1932
- }
1933
- },
1934
- disabled: {
1935
- scale: 1,
1936
- backgroundColor: button.primary.default.backgroundColor.disabled
1937
- },
1938
- default: {
1939
- pressedBackgroundColor: button.primary.default.backgroundColor.disabled
1940
- },
1941
- ghost: {
1942
- pressedBackgroundColor: button.primary.default.backgroundColor.disabled
1943
- },
1944
- primary: {
1945
- pressedBackgroundColor: deepPurpleColorPalette['beige.1']
1946
- },
1947
- 'primary-plain': {
1948
- pressedBackgroundColor: colors.primaryLight,
1949
- backgroundColor: colors.primary
1950
- },
1951
- secondary: {
1952
- pressedBackgroundColor: 'rgba(0, 0, 0, 0.05)',
1953
- backgroundColor: 'rgba(0, 0, 0, 0.1)'
1954
- }
1922
+ width: button.height.medium,
1923
+ height: button.height.medium
1955
1924
  };
1956
1925
 
1957
1926
  const listItem = {
@@ -2155,6 +2124,11 @@ const typography = {
2155
2124
  fontSize: 14,
2156
2125
  lineHeight: 20,
2157
2126
  allowedFontWeights: ['semibold']
2127
+ },
2128
+ 'label-small': {
2129
+ fontSize: 12,
2130
+ lineHeight: 16,
2131
+ allowedFontWeights: ['semibold']
2158
2132
  }
2159
2133
  }
2160
2134
  },
@@ -2857,6 +2831,8 @@ function AnimatedContainer$2({
2857
2831
  isHovered,
2858
2832
  isPressed,
2859
2833
  variant,
2834
+ size = 'default',
2835
+ isIconOnly,
2860
2836
  type
2861
2837
  }) {
2862
2838
  const currentBackgroundColor = getCurrentBackgroundColorForNativeBaseTheme({
@@ -2866,10 +2842,14 @@ function AnimatedContainer$2({
2866
2842
  isHovered,
2867
2843
  isPressed
2868
2844
  });
2845
+ const width = isIconOnly ? `kitt.button.height.${size}` : undefined;
2846
+ const height = isIconOnly ? `kitt.button.height.${size}` : undefined;
2869
2847
  const sx = nativeBase.useSx();
2870
2848
  const styles = sx({
2871
2849
  borderRadius: 'kitt.button.borderRadius',
2872
- backgroundColor: currentBackgroundColor
2850
+ backgroundColor: currentBackgroundColor,
2851
+ width,
2852
+ height
2873
2853
  });
2874
2854
  return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
2875
2855
  style: disabled ? [styles] : [styles, animatedStyles],
@@ -3154,7 +3134,7 @@ function ButtonBadge({
3154
3134
  backgroundColor: backgroundColor,
3155
3135
  borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3156
3136
  children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
3157
- base: "body-xs",
3137
+ base: "content-caps-xs",
3158
3138
  variant: "bold",
3159
3139
  color: "white",
3160
3140
  children: (badgeCount || 0) > 5 ? '+5' : badgeCount
@@ -3276,10 +3256,34 @@ function ButtonContentChildren({
3276
3256
  throw new Error('kitt(Button): You should provide at least a children or a icon');
3277
3257
  }
3278
3258
  }
3259
+ const isMedium = size === 'medium';
3279
3260
  if (!children && icon) {
3280
- return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
3281
- icon: icon,
3282
- color: color
3261
+ return /*#__PURE__*/jsxRuntime.jsxs(View, {
3262
+ alignItems: "center",
3263
+ justifyContent: "center",
3264
+ children: [/*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
3265
+ icon: icon,
3266
+ color: color,
3267
+ size: `kitt.button.icon.${size}.size`
3268
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
3269
+ position: "absolute",
3270
+ top: (() => {
3271
+ if (withBadge) {
3272
+ return isMedium ? '-14px' : '-10px';
3273
+ }
3274
+ return isMedium ? '-20px' : '-16px';
3275
+ })(),
3276
+ right: (() => {
3277
+ if (withBadge) {
3278
+ return isMedium ? '-28px' : '-20px';
3279
+ }
3280
+ return isMedium ? '-33px' : '-25px';
3281
+ })(),
3282
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
3283
+ withBadge: withBadge,
3284
+ badgeCount: badgeCount
3285
+ })
3286
+ }) : null]
3283
3287
  });
3284
3288
  }
3285
3289
  // Make the multilines case work properly on native - Breaks the web implem
@@ -3360,16 +3364,16 @@ function ButtonContent({
3360
3364
  function ButtonPadding({
3361
3365
  children,
3362
3366
  size,
3363
- hasBadge
3367
+ isIconOnly
3364
3368
  }) {
3365
3369
  return /*#__PURE__*/jsxRuntime.jsx(View, {
3366
3370
  position: "relative",
3367
3371
  flexDirection: "row",
3368
3372
  alignItems: "center",
3369
3373
  justifyContent: "center",
3374
+ height: isIconOnly ? `kitt.button.height.${size}` : undefined,
3370
3375
  paddingX: `kitt.button.padding.${size}.horizontal`,
3371
3376
  paddingY: `kitt.button.padding.${size}.vertical`,
3372
- minHeight: "kitt.button.minHeight",
3373
3377
  children: children
3374
3378
  });
3375
3379
  }
@@ -3407,7 +3411,7 @@ function FocusBorder({
3407
3411
  });
3408
3412
  }
3409
3413
 
3410
- const useNativeAnimation$5 = ({
3414
+ const useNativeAnimation$4 = ({
3411
3415
  type,
3412
3416
  variant,
3413
3417
  isPressedInternal
@@ -3415,15 +3419,9 @@ const useNativeAnimation$5 = ({
3415
3419
  const theme = useTheme();
3416
3420
  const pressed = Animated.useSharedValue(isPressedInternal ? 1 : 0);
3417
3421
  const color = Animated.useSharedValue(0);
3418
- const {
3419
- scale
3420
- } = theme.kitt.button;
3421
3422
  const animatedStyles = Animated.useAnimatedStyle(() => {
3422
3423
  return {
3423
- backgroundColor: Animated.interpolateColor(color.value, [0, 1], [type === 'tertiary-danger' ? theme.kitt.button['tertiary-danger'].default.backgroundColor.default : theme.kitt.button[type][variant].backgroundColor.default, type === 'tertiary-danger' ? theme.kitt.button['tertiary-danger'].default.backgroundColor.pressed : theme.kitt.button[type][variant].backgroundColor.pressed]),
3424
- transform: [{
3425
- scale: Animated.withSpring(pressed.value ? scale.base.active : scale.base.default)
3426
- }]
3424
+ backgroundColor: Animated.interpolateColor(color.value, [0, 1], [type === 'tertiary-danger' ? theme.kitt.button['tertiary-danger'].default.backgroundColor.default : theme.kitt.button[type][variant].backgroundColor.default, type === 'tertiary-danger' ? theme.kitt.button['tertiary-danger'].default.backgroundColor.pressed : theme.kitt.button[type][variant].backgroundColor.pressed])
3427
3425
  };
3428
3426
  });
3429
3427
  return {
@@ -3468,13 +3466,14 @@ const Button = /*#__PURE__*/React.forwardRef(({
3468
3466
  onPressIn,
3469
3467
  onPressOut,
3470
3468
  animatedStyles
3471
- } = useNativeAnimation$5({
3469
+ } = useNativeAnimation$4({
3472
3470
  type,
3473
3471
  variant
3474
3472
  });
3475
3473
  if (process.env.NODE_ENV !== 'production' && variant === 'revert' && type === 'tertiary-danger') {
3476
3474
  throw new Error('Invalid revert variant for tertiary-danger button type. Only default variant is allowed.');
3477
3475
  }
3476
+ const isIconOnly = !children && !!icon;
3478
3477
  return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
3479
3478
  ref: ref,
3480
3479
  disabled: disabled,
@@ -3506,10 +3505,12 @@ const Button = /*#__PURE__*/React.forwardRef(({
3506
3505
  isPressed: isPressed || isPressedInternal,
3507
3506
  disabled: !!disabled,
3508
3507
  variant: variant,
3508
+ size: size,
3509
+ isIconOnly: isIconOnly,
3509
3510
  isStretch: stretch,
3510
3511
  children: /*#__PURE__*/jsxRuntime.jsxs(ButtonPadding, {
3511
3512
  size: size,
3512
- hasBadge: Boolean(withBadge || badgeCount && badgeCount > 0),
3513
+ isIconOnly: isIconOnly,
3513
3514
  children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
3514
3515
  type: type,
3515
3516
  variant: variant,
@@ -4307,7 +4308,7 @@ CardModal.Header = CardModalHeader;
4307
4308
  CardModal.Footer = CardModalFooter;
4308
4309
  CardModal.ModalBehaviour = CardModalBehaviour;
4309
4310
 
4310
- function getBackgroundColor$5({
4311
+ function getBackgroundColor$4({
4311
4312
  isDisabled,
4312
4313
  isSelected,
4313
4314
  isHovered,
@@ -4321,40 +4322,50 @@ function getBackgroundColor$5({
4321
4322
  return 'kitt.choices.item.default.backgroundColor';
4322
4323
  }
4323
4324
 
4324
- function getBorderRadius(variant) {
4325
- // The clean way to have the rounded effect would have been to know the children height since radius >= height * 0.5
4326
- // We don't control over the height of the rendered children we just go with a arbitrary really high value
4327
- return variant === 'rounded' ? Number.MAX_SAFE_INTEGER : 'kitt.choices.item.borderRadius';
4325
+ function getBorderColor$2({
4326
+ isDisabled,
4327
+ hasError,
4328
+ isSelected
4329
+ }) {
4330
+ if (isDisabled) {
4331
+ return 'kitt.choices.item.disabled.borderColor';
4332
+ }
4333
+ if (hasError) {
4334
+ return 'kitt.choices.item.error.borderColor';
4335
+ }
4336
+ if (isSelected) {
4337
+ return 'kitt.choices.item.default.borderColor';
4338
+ }
4339
+ return 'transparent';
4328
4340
  }
4329
4341
 
4330
4342
  function AnimatedChoiceItemView({
4331
4343
  children,
4332
- variant,
4333
4344
  size,
4334
4345
  isHovered,
4335
4346
  isPressed,
4336
4347
  isDisabled,
4337
4348
  isSelected,
4349
+ hasError,
4338
4350
  animatedStyles
4339
4351
  }) {
4340
4352
  const sx = nativeBase.useSx();
4341
4353
  const style = sx({
4342
4354
  position: 'relative',
4343
- borderRadius: getBorderRadius(variant),
4344
- backgroundColor: getBackgroundColor$5({
4355
+ borderRadius: 'kitt.choices.item.borderRadius',
4356
+ borderWidth: 'kitt.choices.item.default.borderWidth',
4357
+ borderColor: getBorderColor$2({
4358
+ isDisabled,
4359
+ hasError,
4360
+ isSelected
4361
+ }),
4362
+ backgroundColor: getBackgroundColor$4({
4345
4363
  isDisabled,
4346
4364
  isSelected,
4347
4365
  isHovered,
4348
4366
  isPressed
4349
4367
  }),
4350
- paddingX: size === 'small' ? 'kitt.4' : {
4351
- base: 'kitt.4',
4352
- small: 'kitt.6'
4353
- },
4354
- paddingY: size === 'small' ? 'kitt.2' : {
4355
- base: 'kitt.4',
4356
- small: 'kitt.6'
4357
- }
4368
+ padding: size === 'small' ? 'kitt.2' : 'kitt.4'
4358
4369
  });
4359
4370
  return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
4360
4371
  style: [style, animatedStyles],
@@ -4362,7 +4373,7 @@ function AnimatedChoiceItemView({
4362
4373
  });
4363
4374
  }
4364
4375
 
4365
- const useNativeAnimation$4 = ({
4376
+ const useNativeAnimation$3 = ({
4366
4377
  selected,
4367
4378
  disabled,
4368
4379
  isPressedInternal
@@ -4403,23 +4414,21 @@ const useNativeAnimation$4 = ({
4403
4414
  };
4404
4415
 
4405
4416
  function getCurrentTextColor$1({
4406
- isDisabled,
4407
- isSelected,
4408
- isPressed,
4409
- isHovered
4417
+ isDisabled
4410
4418
  }) {
4411
- if (isDisabled) return 'black-light';
4412
- if (isSelected && isHovered) return 'white';
4413
- if (isSelected || isPressed) return 'white';
4414
- return 'black';
4419
+ if (isDisabled) return 'kitt.choices.item.disabled.color';
4420
+ return 'kitt.choices.item.default.color';
4415
4421
  }
4416
4422
 
4417
4423
  function ChoiceItem({
4418
4424
  type = 'button',
4425
+ orientation = 'horizontal',
4426
+ icon,
4427
+ hasError,
4428
+ description,
4419
4429
  value,
4420
4430
  selected,
4421
4431
  disabled,
4422
- variant,
4423
4432
  children,
4424
4433
  isPressedInternal,
4425
4434
  isHoveredInternal,
@@ -4435,11 +4444,12 @@ function ChoiceItem({
4435
4444
  onPressIn,
4436
4445
  onPressOut,
4437
4446
  backgroundStyles
4438
- } = useNativeAnimation$4({
4447
+ } = useNativeAnimation$3({
4439
4448
  selected,
4440
4449
  disabled,
4441
4450
  isPressedInternal
4442
4451
  });
4452
+ const Stack = orientation === 'horizontal' ? HStack : VStack;
4443
4453
  const handleChange = () => {
4444
4454
  if (!onChange) return;
4445
4455
 
@@ -4471,33 +4481,45 @@ function ChoiceItem({
4471
4481
  children: ({
4472
4482
  isHovered,
4473
4483
  isPressed
4474
- }) => /*#__PURE__*/jsxRuntime.jsxs(AnimatedChoiceItemView, {
4475
- animatedStyles: backgroundStyles,
4476
- isHovered: isHovered || isHoveredInternal,
4477
- isDisabled: disabled,
4478
- isSelected: selected,
4479
- isPressed: isPressed || isPressedInternal,
4480
- variant: variant,
4481
- size: size,
4482
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography.SetDefaultColor, {
4483
- value: getCurrentTextColor$1({
4484
+ }) => {
4485
+ const textColor = getCurrentTextColor$1({
4486
+ isDisabled: disabled
4487
+ });
4488
+ return /*#__PURE__*/jsxRuntime.jsxs(VStack, {
4489
+ space: "kitt.2",
4490
+ children: [/*#__PURE__*/jsxRuntime.jsxs(AnimatedChoiceItemView, {
4491
+ animatedStyles: backgroundStyles,
4492
+ isHovered: isHovered || isHoveredInternal,
4484
4493
  isDisabled: disabled,
4485
- isSelected: selected || isPressedInternal,
4486
- isPressed,
4487
- isHovered: isHovered || isHoveredInternal
4488
- }),
4489
- children: children
4490
- }), disabled ? /*#__PURE__*/jsxRuntime.jsx(View, {
4491
- borderRadius: getBorderRadius(variant),
4492
- borderWidth: "kitt.choices.item.disabled.borderWidth",
4493
- borderColor: "kitt.choices.item.disabled.borderColor",
4494
- position: "absolute",
4495
- top: "0",
4496
- right: "0",
4497
- left: "0",
4498
- bottom: "0"
4499
- }) : null]
4500
- })
4494
+ isSelected: selected,
4495
+ isPressed: isPressed || isPressedInternal,
4496
+ hasError: hasError,
4497
+ size: size,
4498
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Stack, {
4499
+ alignItems: "center",
4500
+ space: "kitt.2",
4501
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
4502
+ color: textColor,
4503
+ icon: icon
4504
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(Typography.SetDefaultColor, {
4505
+ value: textColor,
4506
+ children: children
4507
+ })]
4508
+ }), disabled ? /*#__PURE__*/jsxRuntime.jsx(View, {
4509
+ borderRadius: "kitt.choices.item.borderRadius",
4510
+ position: "absolute",
4511
+ top: "0",
4512
+ right: "0",
4513
+ left: "0",
4514
+ bottom: "0"
4515
+ }) : null]
4516
+ }), description ? /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
4517
+ base: "body-s",
4518
+ color: hasError ? 'kitt.choices.description.color.error' : 'kitt.choices.description.color.default',
4519
+ children: description
4520
+ }) : null]
4521
+ });
4522
+ }
4501
4523
  });
4502
4524
  }
4503
4525
 
@@ -4547,7 +4569,6 @@ function Choices({
4547
4569
  disabled,
4548
4570
  children,
4549
4571
  value,
4550
- variant,
4551
4572
  onPress,
4552
4573
  onChange,
4553
4574
  onFocus,
@@ -4562,7 +4583,6 @@ function Choices({
4562
4583
  const sharedProps = {
4563
4584
  type,
4564
4585
  disabled,
4565
- variant,
4566
4586
  onPress: !isForm ? onPress : undefined,
4567
4587
  onChange: isForm ? newValue => {
4568
4588
  setCurrentValue(newValue);
@@ -5085,7 +5105,7 @@ const InputText = /*#__PURE__*/React.forwardRef(({
5085
5105
  });
5086
5106
  });
5087
5107
 
5088
- function getBackgroundColor$4({
5108
+ function getBackgroundColor$3({
5089
5109
  isSelected,
5090
5110
  isHighlighted,
5091
5111
  isPressed,
@@ -5124,7 +5144,7 @@ function AutocompleteItem({
5124
5144
  minHeight: "kitt.forms.autocomplete.option.minHeight",
5125
5145
  borderRadius: "kitt.1",
5126
5146
  padding: "kitt.1",
5127
- backgroundColor: getBackgroundColor$4({
5147
+ backgroundColor: getBackgroundColor$3({
5128
5148
  isSelected,
5129
5149
  isHighlighted,
5130
5150
  isPressed,
@@ -5418,7 +5438,7 @@ const SvgCheckboxMarkinline = props => /*#__PURE__*/jsxRuntime.jsx("svg", {
5418
5438
  })
5419
5439
  });
5420
5440
 
5421
- function getBackgroundColor$3({
5441
+ function getBackgroundColor$2({
5422
5442
  isDisabled,
5423
5443
  isPressed,
5424
5444
  isHovered,
@@ -5497,7 +5517,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
5497
5517
  isPressed,
5498
5518
  isChecked: checked
5499
5519
  }),
5500
- backgroundColor: getBackgroundColor$3({
5520
+ backgroundColor: getBackgroundColor$2({
5501
5521
  isDisabled: disabled,
5502
5522
  isFocused,
5503
5523
  isHovered,
@@ -7190,7 +7210,7 @@ function InnerCircle({
7190
7210
  });
7191
7211
  }
7192
7212
 
7193
- function getBackgroundColor$2({
7213
+ function getBackgroundColor$1({
7194
7214
  isDisabled,
7195
7215
  isPressed,
7196
7216
  isHovered,
@@ -7236,7 +7256,7 @@ function OuterCircle({
7236
7256
  width: "kitt.forms.radio.size",
7237
7257
  height: "kitt.forms.radio.size",
7238
7258
  borderRadius: "kitt.forms.radio.borderRadius",
7239
- backgroundColor: getBackgroundColor$2({
7259
+ backgroundColor: getBackgroundColor$1({
7240
7260
  isChecked,
7241
7261
  isDisabled,
7242
7262
  isFocused,
@@ -7377,7 +7397,7 @@ function HoverBorder({
7377
7397
  });
7378
7398
  }
7379
7399
 
7380
- const useNativeAnimation$3 = ({
7400
+ const useNativeAnimation$2 = ({
7381
7401
  isDisabled,
7382
7402
  isSelected,
7383
7403
  isPressedInternal
@@ -7458,7 +7478,7 @@ function RadioButton({
7458
7478
  onPressIn,
7459
7479
  onPressOut,
7460
7480
  animatedStyles
7461
- } = useNativeAnimation$3({
7481
+ } = useNativeAnimation$2({
7462
7482
  isDisabled: disabled,
7463
7483
  isSelected: selected,
7464
7484
  isPressedInternal
@@ -8184,7 +8204,7 @@ const withTimingConfig = {
8184
8204
  duration: 100,
8185
8205
  easing: Animated.Easing.ease
8186
8206
  };
8187
- const useNativeAnimation$2 = ({
8207
+ const useNativeAnimation$1 = ({
8188
8208
  variant,
8189
8209
  isExpanded,
8190
8210
  isInitialRender,
@@ -8266,7 +8286,7 @@ function Highlight({
8266
8286
  contentAnimatedStyles,
8267
8287
  onPressIn,
8268
8288
  onPressOut
8269
- } = useNativeAnimation$2({
8289
+ } = useNativeAnimation$1({
8270
8290
  variant,
8271
8291
  isExpanded,
8272
8292
  isInitialRender,
@@ -8366,226 +8386,53 @@ function Highlight({
8366
8386
  });
8367
8387
  }
8368
8388
 
8369
- function getBackgroundColor$1(color, isDisabled) {
8370
- if (isDisabled) {
8371
- return 'kitt.iconButton.disabled.backgroundColor';
8372
- }
8373
- switch (color) {
8374
- case 'primary':
8375
- return 'kitt.iconButton.primary.pressed.backgroundColor';
8376
- case 'primary-plain':
8377
- return 'kitt.iconButton.primary-plain.pressed.backgroundColor';
8378
- case 'ghost':
8379
- return 'kitt.iconButton.ghost.pressed.backgroundColor';
8389
+ const getButtonTypeAndVariant = iconColor => {
8390
+ switch (iconColor) {
8380
8391
  case 'black':
8381
- default:
8382
- return 'kitt.iconButton.black.pressed.backgroundColor';
8383
- }
8384
- }
8385
- function Background({
8386
- color,
8387
- isDisabled,
8388
- ...props
8389
- }) {
8390
- return /*#__PURE__*/jsxRuntime.jsx(View, {
8391
- ...props,
8392
- width: "100%",
8393
- height: "100%",
8394
- borderRadius: "kitt.iconButton.borderRadius",
8395
- backgroundColor: getBackgroundColor$1(color, isDisabled)
8396
- });
8397
- }
8398
-
8399
- function AnimatedBackground({
8400
- color,
8401
- isDisabled,
8402
- opacityStyles
8403
- }) {
8404
- const sx = nativeBase.useSx();
8405
- const currentOpacityStyles = isDisabled ? {
8406
- opacity: 1
8407
- } : opacityStyles;
8408
- const styles = sx({
8409
- position: 'absolute',
8410
- top: 0,
8411
- left: 0,
8412
- width: '100%',
8413
- height: '100%'
8414
- });
8415
- return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
8416
- style: [styles, currentOpacityStyles],
8417
- children: /*#__PURE__*/jsxRuntime.jsx(Background, {
8418
- color: color,
8419
- isDisabled: isDisabled
8420
- })
8421
- });
8422
- }
8423
-
8424
- function AnimatedScale({
8425
- isDisabled,
8426
- scaleStyles,
8427
- children
8428
- }) {
8429
- const sx = nativeBase.useSx();
8430
- const currentOpacityStyles = isDisabled ? {
8431
- transform: [{
8432
- scale: 1
8433
- }]
8434
- } : scaleStyles;
8435
- const styles = sx({
8436
- position: 'relative',
8437
- alignItems: 'center',
8438
- justifyContent: 'center',
8439
- width: '100%',
8440
- height: '100%'
8441
- });
8442
- return /*#__PURE__*/jsxRuntime.jsx(Animated__default.View, {
8443
- style: [styles, currentOpacityStyles],
8444
- children: children
8445
- });
8446
- }
8447
-
8448
- function useNativeAnimation$1({
8449
- isPressed
8450
- }) {
8451
- const theme = useTheme();
8452
- const pressed = Animated.useSharedValue(!!isPressed);
8453
- const opacityStyles = Animated.useAnimatedStyle(() => {
8454
- return {
8455
- opacity: Animated.withSpring(pressed.value ? 1 : 0)
8456
- };
8457
- });
8458
- const scaleStyles = Animated.useAnimatedStyle(() => {
8459
- return {
8460
- transform: [{
8461
- scale: Animated.withSpring(pressed.value ? theme.kitt.iconButton.scale.base.active : theme.kitt.iconButton.scale.base.default)
8462
- }]
8463
- };
8464
- });
8465
- return {
8466
- opacityStyles,
8467
- scaleStyles,
8468
- onPressIn: () => {
8469
- pressed.value = true;
8470
- },
8471
- onPressOut: () => {
8472
- pressed.value = false;
8473
- }
8474
- };
8475
- }
8476
-
8477
- const getIconButtonBackgroundColor = (color, disabled) => {
8478
- if (disabled) {
8479
- return undefined;
8480
- }
8481
- switch (color) {
8482
- case 'primary-plain':
8483
- return 'kitt.iconButton.primary-plain.backgroundColor';
8392
+ return {
8393
+ type: 'tertiary'
8394
+ };
8484
8395
  case 'secondary':
8485
- return 'kitt.iconButton.secondary.backgroundColor';
8486
- default:
8487
- return undefined;
8488
- }
8489
- };
8490
-
8491
- const getIconButtonTextColorByColor = (color, disabled) => {
8492
- if (disabled) {
8493
- return 'black-light';
8494
- }
8495
- switch (color) {
8496
- case 'ghost':
8497
- return 'white';
8396
+ return {
8397
+ type: 'secondary'
8398
+ };
8399
+ case 'primary':
8400
+ return {
8401
+ type: 'primary'
8402
+ };
8498
8403
  case 'primary-plain':
8499
- return 'white';
8500
- case 'secondary':
8501
- return 'black';
8404
+ return {
8405
+ type: 'primary'
8406
+ };
8407
+ case 'ghost':
8408
+ return {
8409
+ type: 'tertiary',
8410
+ variant: 'revert'
8411
+ };
8502
8412
  default:
8503
- return color;
8413
+ return {
8414
+ type: 'secondary'
8415
+ };
8504
8416
  }
8505
8417
  };
8506
8418
 
8419
+ /**
8420
+ * @deprecated IconButton should only be used as a navigation button
8421
+ * Other use cases should use a <Button> component with an icon
8422
+ */
8507
8423
  function IconButton({
8508
- icon,
8509
8424
  color = 'black',
8510
- disabled,
8511
- testID,
8512
8425
  ariaLabel,
8513
- accessibilityRole = 'button',
8514
- withBadge,
8515
- badgeCount,
8516
- isHoveredInternal,
8517
- isPressedInternal,
8518
- isFocusedInternal,
8519
- onPress
8426
+ ...props
8520
8427
  }) {
8521
8428
  const {
8522
- onPressIn,
8523
- onPressOut,
8524
- opacityStyles,
8525
- scaleStyles
8526
- } = useNativeAnimation$1({
8527
- isDisabled: disabled,
8528
- isPressed: isPressedInternal
8529
- });
8530
- return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
8531
- testID: testID,
8532
- disabled: disabled,
8533
- width: "kitt.iconButton.width",
8534
- height: "kitt.iconButton.height",
8535
- "aria-label": ariaLabel,
8536
- accessibilityRole: accessibilityRole,
8537
- _web: {
8538
- style: {
8539
- backfaceVisibility: 'hidden',
8540
- transform: 'translate3d(0px)'
8541
- }
8542
- },
8543
- backgroundColor: getIconButtonBackgroundColor(color, disabled),
8544
- borderRadius: "kitt.iconButton.borderRadius",
8545
- borderColor: disabled ? 'kitt.iconButton.disabled.borderColor' : 'kitt.iconButton.borderColor',
8546
- borderWidth: disabled ? 'kitt.iconButton.borderWidth' : 0,
8547
- onPress: onPress,
8548
- onPressIn: onPressIn,
8549
- onPressOut: onPressOut,
8550
- children: ({
8551
- isHovered,
8552
- isPressed,
8553
- isFocused
8554
- }) => {
8555
- const isCurrentHovered = isHovered || isHoveredInternal;
8556
- const isCurrentPressed = isPressed || isPressedInternal;
8557
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
8558
- children: [/*#__PURE__*/jsxRuntime.jsxs(AnimatedScale, {
8559
- isDisabled: disabled,
8560
- isHovered: isCurrentHovered,
8561
- isPressed: isCurrentPressed,
8562
- scaleStyles: scaleStyles,
8563
- children: [/*#__PURE__*/jsxRuntime.jsx(AnimatedBackground, {
8564
- color: color,
8565
- isDisabled: disabled,
8566
- isHovered: isCurrentHovered,
8567
- isPressed: isCurrentPressed,
8568
- isFocused: isFocused || isFocusedInternal,
8569
- opacityStyles: opacityStyles
8570
- }), /*#__PURE__*/jsxRuntime.jsx(View, {
8571
- alignItems: "center",
8572
- justifyContent: "center",
8573
- children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
8574
- color: getIconButtonTextColorByColor(color, disabled),
8575
- icon: icon
8576
- })
8577
- })]
8578
- }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
8579
- position: "absolute",
8580
- top: withBadge ? '1px' : '-6px',
8581
- right: withBadge ? '1px' : '-6px',
8582
- children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
8583
- withBadge: withBadge,
8584
- badgeCount: badgeCount
8585
- })
8586
- }) : null]
8587
- });
8588
- }
8429
+ type: legacyColorToType,
8430
+ variant: legacyColorToVariant
8431
+ } = getButtonTypeAndVariant(color);
8432
+ return /*#__PURE__*/jsxRuntime.jsx(Button, {
8433
+ variant: legacyColorToVariant,
8434
+ type: legacyColorToType,
8435
+ ...props
8589
8436
  });
8590
8437
  }
8591
8438
  function CloseIconButton(props) {
@@ -9159,11 +9006,17 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9159
9006
  choices: {
9160
9007
  item: {
9161
9008
  default: {
9162
- backgroundColor: theme.choices.item.backgroundColor.default
9009
+ backgroundColor: theme.choices.item.backgroundColor.default,
9010
+ borderColor: theme.choices.item.border.default.color,
9011
+ color: theme.choices.item.color.default
9163
9012
  },
9164
9013
  disabled: {
9165
9014
  backgroundColor: theme.choices.item.backgroundColor.disabled,
9166
- borderColor: theme.choices.item.disabled.border.color
9015
+ borderColor: theme.choices.item.border.disabled.color,
9016
+ color: theme.choices.item.color.disabled
9017
+ },
9018
+ error: {
9019
+ borderColor: theme.choices.item.border.error.color
9167
9020
  },
9168
9021
  selected: {
9169
9022
  backgroundColor: theme.choices.item.backgroundColor.selected
@@ -9177,6 +9030,12 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9177
9030
  hoverWhenSelected: {
9178
9031
  backgroundColor: theme.choices.item.backgroundColor.hoverWhenSelected
9179
9032
  }
9033
+ },
9034
+ description: {
9035
+ color: {
9036
+ default: theme.choices.description.color.default,
9037
+ error: theme.choices.description.color.error
9038
+ }
9180
9039
  }
9181
9040
  },
9182
9041
  tooltip: {
@@ -9580,39 +9439,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9580
9439
  buttonBadge: {
9581
9440
  backgroundColor: theme.buttonBadge.backgroundColor
9582
9441
  },
9583
- iconButton: {
9584
- borderColor: theme.iconButton.borderColor,
9585
- disabled: {
9586
- backgroundColor: theme.iconButton.disabled.backgroundColor
9587
- },
9588
- black: {
9589
- pressed: {
9590
- backgroundColor: theme.iconButton.default.pressedBackgroundColor
9591
- }
9592
- },
9593
- ghost: {
9594
- pressed: {
9595
- backgroundColor: theme.iconButton.ghost.pressedBackgroundColor
9596
- }
9597
- },
9598
- primary: {
9599
- pressed: {
9600
- backgroundColor: theme.iconButton.primary.pressedBackgroundColor
9601
- }
9602
- },
9603
- 'primary-plain': {
9604
- pressed: {
9605
- backgroundColor: theme.iconButton['primary-plain'].pressedBackgroundColor
9606
- },
9607
- backgroundColor: theme.iconButton['primary-plain'].backgroundColor
9608
- },
9609
- secondary: {
9610
- pressed: {
9611
- backgroundColor: theme.iconButton.secondary.pressedBackgroundColor
9612
- },
9613
- backgroundColor: theme.iconButton.secondary.backgroundColor
9614
- }
9615
- },
9616
9442
  highlight: {
9617
9443
  regular: {
9618
9444
  default: {
@@ -9814,9 +9640,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9814
9640
  highlight: {
9815
9641
  borderRadius: theme.highlight.borderRadius
9816
9642
  },
9817
- iconButton: {
9818
- borderRadius: theme.iconButton.borderRadius
9819
- },
9820
9643
  tag: {
9821
9644
  borderRadius: theme.tag.borderRadius
9822
9645
  },
@@ -9940,14 +9763,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9940
9763
  },
9941
9764
  choices: {
9942
9765
  item: {
9943
- disabled: {
9944
- borderWidth: theme.choices.item.disabled.border.width
9766
+ default: {
9767
+ borderWidth: theme.choices.item.border.default.width
9945
9768
  }
9946
9769
  }
9947
9770
  },
9948
- iconButton: {
9949
- borderWidth: theme.iconButton.borderWidth
9950
- },
9951
9771
  forms: {
9952
9772
  input: {
9953
9773
  borderWidth: theme.forms.input.borderWidth
@@ -10136,8 +9956,10 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10136
9956
  button: {
10137
9957
  minWidth: theme.button.minWidth,
10138
9958
  maxWidth: theme.button.maxWidth,
10139
- minHeight: theme.button.minHeight,
10140
- maxHeight: theme.button.maxHeight,
9959
+ height: {
9960
+ default: theme.button.height.default,
9961
+ medium: theme.button.height.medium
9962
+ },
10141
9963
  icon: {
10142
9964
  default: {
10143
9965
  size: theme.button.icon.default.size
@@ -10465,7 +10287,6 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10465
10287
  }
10466
10288
  },
10467
10289
  iconButton: {
10468
- size: theme.iconButton.width - theme.iconButton.borderWidth,
10469
10290
  width: theme.iconButton.width,
10470
10291
  height: theme.iconButton.height
10471
10292
  },
@@ -10767,6 +10588,7 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10767
10588
  'body-xs': `${theme.typography.types.bodies.configs['body-xs'].fontSize}px`,
10768
10589
  'label-large': `${theme.typography.types.labels.configs['label-large'].fontSize}px`,
10769
10590
  'label-medium': `${theme.typography.types.labels.configs['label-medium'].fontSize}px`,
10591
+ 'label-small': `${theme.typography.types.labels.configs['label-small'].fontSize}px`,
10770
10592
  'content-caps-xxxl': `${theme.typography.types.contentCaps.configs['content-caps-xxxl'].fontSize}px`,
10771
10593
  'content-caps-xxl': `${theme.typography.types.contentCaps.configs['content-caps-xxl'].fontSize}px`,
10772
10594
  'content-caps-xl': `${theme.typography.types.contentCaps.configs['content-caps-xl'].fontSize}px`,
@@ -10789,6 +10611,7 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10789
10611
  'body-xs': `${theme.typography.types.bodies.configs['body-xs'].lineHeight}px`,
10790
10612
  'label-large': `${theme.typography.types.labels.configs['label-large'].lineHeight}px`,
10791
10613
  'label-medium': `${theme.typography.types.labels.configs['label-medium'].lineHeight}px`,
10614
+ 'label-small': `${theme.typography.types.labels.configs['label-small'].lineHeight}px`,
10792
10615
  'content-caps-xxxl': `${theme.typography.types.contentCaps.configs['content-caps-xxxl'].lineHeight}px`,
10793
10616
  'content-caps-xxl': `${theme.typography.types.contentCaps.configs['content-caps-xxl'].lineHeight}px`,
10794
10617
  'content-caps-xl': `${theme.typography.types.contentCaps.configs['content-caps-xl'].lineHeight}px`,