@ornikar/kitt-universal 25.53.0 → 25.54.1-canary.111977bfdb623207808928fa770ffbe060b3b380.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 (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/definitions/Actions/ActionsItem.d.ts.map +1 -1
  3. package/dist/definitions/Button/Button.d.ts +2 -0
  4. package/dist/definitions/Button/Button.d.ts.map +1 -1
  5. package/dist/definitions/Button/ButtonContent.d.ts +1 -1
  6. package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
  7. package/dist/definitions/ButtonBadge/ButtonBadge.d.ts +7 -0
  8. package/dist/definitions/ButtonBadge/ButtonBadge.d.ts.map +1 -0
  9. package/dist/definitions/CardModal/CardModal.d.ts +3 -0
  10. package/dist/definitions/CardModal/CardModal.d.ts.map +1 -1
  11. package/dist/definitions/FullscreenModal/Body.d.ts.map +1 -1
  12. package/dist/definitions/FullscreenModal/FullscreenModal.d.ts +17 -3
  13. package/dist/definitions/FullscreenModal/FullscreenModal.d.ts.map +1 -1
  14. package/dist/definitions/IconButton/IconButton.d.ts +2 -2
  15. package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
  16. package/dist/definitions/NavigationModal/NavigationModal.d.ts +2 -3
  17. package/dist/definitions/NavigationModal/NavigationModal.d.ts.map +1 -1
  18. package/dist/definitions/index.d.ts +2 -0
  19. package/dist/definitions/index.d.ts.map +1 -1
  20. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +21 -0
  21. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  22. package/dist/definitions/themes/default.d.ts +1 -0
  23. package/dist/definitions/themes/default.d.ts.map +1 -1
  24. package/dist/definitions/themes/late-ocean/buttonBadge.d.ts +21 -0
  25. package/dist/definitions/themes/late-ocean/buttonBadge.d.ts.map +1 -0
  26. package/dist/index-metro.es.android.js +124 -48
  27. package/dist/index-metro.es.android.js.map +1 -1
  28. package/dist/index-metro.es.ios.js +124 -48
  29. package/dist/index-metro.es.ios.js.map +1 -1
  30. package/dist/index-node-20.10.cjs.js +121 -45
  31. package/dist/index-node-20.10.cjs.js.map +1 -1
  32. package/dist/index-node-20.10.cjs.web.js +121 -45
  33. package/dist/index-node-20.10.cjs.web.js.map +1 -1
  34. package/dist/index-node-20.10.es.mjs +121 -46
  35. package/dist/index-node-20.10.es.mjs.map +1 -1
  36. package/dist/index-node-20.10.es.web.mjs +121 -46
  37. package/dist/index-node-20.10.es.web.mjs.map +1 -1
  38. package/dist/index.es.js +133 -58
  39. package/dist/index.es.js.map +1 -1
  40. package/dist/index.es.web.js +133 -58
  41. package/dist/index.es.web.js.map +1 -1
  42. package/dist/linaria-themes-metro.es.android.js +19 -0
  43. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  44. package/dist/linaria-themes-metro.es.ios.js +19 -0
  45. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  46. package/dist/linaria-themes-node-20.10.cjs.js +19 -0
  47. package/dist/linaria-themes-node-20.10.cjs.js.map +1 -1
  48. package/dist/linaria-themes-node-20.10.cjs.web.js +19 -0
  49. package/dist/linaria-themes-node-20.10.cjs.web.js.map +1 -1
  50. package/dist/linaria-themes-node-20.10.es.mjs +19 -0
  51. package/dist/linaria-themes-node-20.10.es.mjs.map +1 -1
  52. package/dist/linaria-themes-node-20.10.es.web.mjs +19 -0
  53. package/dist/linaria-themes-node-20.10.es.web.mjs.map +1 -1
  54. package/dist/linaria-themes.es.js +19 -0
  55. package/dist/linaria-themes.es.js.map +1 -1
  56. package/dist/linaria-themes.es.web.js +19 -0
  57. package/dist/linaria-themes.es.web.js.map +1 -1
  58. package/dist/tsbuildinfo +1 -1
  59. package/package.json +1 -1
@@ -807,6 +807,24 @@ const button = {
807
807
  }
808
808
  };
809
809
 
810
+ const buttonBadge = {
811
+ backgroundColor: lateOceanColorPalette['coral.10'],
812
+ dimensions: {
813
+ withBadge: {
814
+ width: 10,
815
+ height: 10
816
+ },
817
+ badgeCount: {
818
+ width: 20,
819
+ height: 20
820
+ }
821
+ },
822
+ borderRadius: {
823
+ withBadge: 5,
824
+ badgeCount: 10
825
+ }
826
+ };
827
+
810
828
  const card = {
811
829
  borderRadius: 20,
812
830
  borderWidth: 2,
@@ -2522,6 +2540,7 @@ const theme = {
2522
2540
  forms,
2523
2541
  highlight,
2524
2542
  icon,
2543
+ buttonBadge,
2525
2544
  iconButton,
2526
2545
  listItem,
2527
2546
  pageLoader,
@@ -3086,6 +3105,37 @@ Typography.h4 = createHeading(4, 'header4');
3086
3105
  /** @deprecated use Typography.Header6 */
3087
3106
  Typography.h5 = createHeading(5, 'header5');
3088
3107
 
3108
+ function ButtonBadge({
3109
+ withBadge,
3110
+ badgeCount
3111
+ }) {
3112
+ if (withBadge) {
3113
+ return /*#__PURE__*/jsxRuntime.jsx(View, {
3114
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3115
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3116
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3117
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3118
+ });
3119
+ }
3120
+ if (badgeCount && badgeCount > 0) {
3121
+ return /*#__PURE__*/jsxRuntime.jsx(VStack, {
3122
+ alignItems: "center",
3123
+ justifyContent: "center",
3124
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3125
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3126
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3127
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3128
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
3129
+ base: "body-xs",
3130
+ variant: "bold",
3131
+ color: "white",
3132
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3133
+ })
3134
+ });
3135
+ }
3136
+ return null;
3137
+ }
3138
+
3089
3139
  function Icon({
3090
3140
  icon,
3091
3141
  size = 'kitt.icon.defaultSize',
@@ -3211,6 +3261,8 @@ function ButtonContentChildren({
3211
3261
  icon,
3212
3262
  iconPosition,
3213
3263
  innerSpacing,
3264
+ withBadge,
3265
+ badgeCount,
3214
3266
  color,
3215
3267
  children
3216
3268
  }) {
@@ -3257,6 +3309,12 @@ function ButtonContentChildren({
3257
3309
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
3258
3310
  ...buttonIconSharedProps,
3259
3311
  icon: icon
3312
+ }) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
3313
+ marginLeft: "kitt.2",
3314
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
3315
+ withBadge: withBadge,
3316
+ badgeCount: badgeCount
3317
+ })
3260
3318
  }) : null]
3261
3319
  });
3262
3320
  }
@@ -3440,6 +3498,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
3440
3498
  testID,
3441
3499
  href,
3442
3500
  hrefAttrs,
3501
+ withBadge,
3502
+ badgeCount,
3443
3503
  accessibilityRole = 'button',
3444
3504
  innerSpacing = 'center',
3445
3505
  isHoveredInternal,
@@ -3511,6 +3571,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
3511
3571
  isDisabled: disabled,
3512
3572
  icon: icon,
3513
3573
  iconPosition: iconPosition,
3574
+ withBadge: withBadge,
3575
+ badgeCount: badgeCount,
3514
3576
  isHovered: isHovered,
3515
3577
  isPressed: isPressed,
3516
3578
  isFocused: isFocused,
@@ -3590,6 +3652,8 @@ const ActionsItem = /*#__PURE__*/React.forwardRef(({
3590
3652
  }, ref) => {
3591
3653
  const [isLoading, setIsLoading] = React.useState(false);
3592
3654
  const mountedRef = React.useRef(false);
3655
+ // securing the loading state with a ref to avoid user action between rerenders
3656
+ const loadingRef = React.useRef(false);
3593
3657
 
3594
3658
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3595
3659
  React.useEffect(() => {
@@ -3607,15 +3671,18 @@ const ActionsItem = /*#__PURE__*/React.forwardRef(({
3607
3671
  icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
3608
3672
  onPress: e => {
3609
3673
  (async () => {
3610
- if (!onPress) return;
3674
+ if (!onPress || loadingRef.current) return;
3611
3675
  setIsLoading(true);
3676
+ loadingRef.current = true;
3612
3677
  try {
3613
3678
  await onPress(e);
3614
3679
  if (mountedRef.current) {
3615
3680
  setIsLoading(false);
3681
+ loadingRef.current = false;
3616
3682
  }
3617
3683
  } catch (error) {
3618
3684
  if (mountedRef.current) {
3685
+ loadingRef.current = false;
3619
3686
  setIsLoading(false);
3620
3687
  }
3621
3688
  throw error;
@@ -7784,6 +7851,8 @@ function FullscreenModalBody({
7784
7851
  const paddingBottom = shouldHandleBottomNotch ? Math.max(bottom, verticalPadding) : verticalPadding;
7785
7852
  const paddingTop = shouldHandleTopNotch ? Math.max(top, verticalPadding) : verticalPadding;
7786
7853
  return /*#__PURE__*/jsxRuntime.jsx(View, {
7854
+ flexGrow: 1,
7855
+ flexShrink: 1,
7787
7856
  ...props,
7788
7857
  paddingX: "kitt.fullscreenModal.horizontalPadding",
7789
7858
  paddingTop: paddingTop,
@@ -8061,28 +8130,31 @@ function FullscreenModalHeader({
8061
8130
  }
8062
8131
 
8063
8132
  function FullscreenModal({
8133
+ children,
8064
8134
  body,
8065
8135
  header,
8066
8136
  footer,
8067
8137
  backgroundColor
8068
8138
  }) {
8069
- return /*#__PURE__*/jsxRuntime.jsxs(FullscreenModalContainer, {
8139
+ return /*#__PURE__*/jsxRuntime.jsx(FullscreenModalContainer, {
8070
8140
  backgroundColor: backgroundColor,
8071
- children: [header ? /*#__PURE__*/jsxRuntime.jsx(View, {
8072
- children: header
8073
- }) : null, /*#__PURE__*/jsxRuntime.jsxs(View, {
8074
- flexGrow: 1,
8075
- flexShrink: 1,
8076
- justifyContent: "space-between",
8077
- children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
8078
- bounces: false,
8079
- contentContainerStyle: {
8080
- flexGrow: 1,
8081
- position: 'relative'
8082
- },
8083
- children: body
8084
- }), footer || null]
8085
- })]
8141
+ children: children || /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
8142
+ children: [header ? /*#__PURE__*/jsxRuntime.jsx(View, {
8143
+ children: header
8144
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs(View, {
8145
+ flexGrow: 1,
8146
+ flexShrink: 1,
8147
+ justifyContent: "space-between",
8148
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
8149
+ bounces: false,
8150
+ contentContainerStyle: {
8151
+ flexGrow: 1,
8152
+ position: 'relative'
8153
+ },
8154
+ children: body
8155
+ }), footer || null]
8156
+ })]
8157
+ })
8086
8158
  });
8087
8159
  }
8088
8160
  FullscreenModal.Header = FullscreenModalHeader;
@@ -8489,7 +8561,7 @@ function IconButton({
8489
8561
  ariaLabel,
8490
8562
  accessibilityRole = 'button',
8491
8563
  withBadge,
8492
- bagdeCount,
8564
+ badgeCount,
8493
8565
  isHoveredInternal,
8494
8566
  isPressedInternal,
8495
8567
  isFocusedInternal,
@@ -8552,32 +8624,13 @@ function IconButton({
8552
8624
  icon: icon
8553
8625
  })
8554
8626
  })]
8555
- }), withBadge ? /*#__PURE__*/jsxRuntime.jsx(View, {
8556
- height: "10px",
8557
- width: "10px",
8558
- backgroundColor: lateOceanColorPalette['coral.10'],
8559
- borderRadius: "kitt.iconButton.borderRadius",
8560
- position: "absolute",
8561
- top: "1px",
8562
- right: "1px"
8563
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
8564
- height: "20px",
8565
- width: "20px",
8566
- backgroundColor: lateOceanColorPalette['coral.10'],
8567
- borderRadius: "kitt.iconButton.borderRadius",
8627
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
8568
8628
  position: "absolute",
8569
- top: "-6px",
8570
- right: "-6px",
8571
- children: /*#__PURE__*/jsxRuntime.jsx(View, {
8572
- alignItems: "center",
8573
- justifyContent: "center",
8574
- marginTop: "2px",
8575
- children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
8576
- base: "body-xs",
8577
- variant: "bold",
8578
- color: "white",
8579
- children: bagdeCount > 5 ? '+5' : bagdeCount
8580
- })
8629
+ top: withBadge ? '1px' : '-6px',
8630
+ right: withBadge ? '1px' : '-6px',
8631
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
8632
+ withBadge: withBadge,
8633
+ badgeCount: badgeCount
8581
8634
  })
8582
8635
  }) : null]
8583
8636
  });
@@ -9569,6 +9622,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9569
9622
  backgroundColor: theme.skeleton.backgroundColor,
9570
9623
  flareColor: theme.skeleton.flareColor
9571
9624
  },
9625
+ buttonBadge: {
9626
+ backgroundColor: theme.buttonBadge.backgroundColor
9627
+ },
9572
9628
  iconButton: {
9573
9629
  borderColor: theme.iconButton.borderColor,
9574
9630
  disabled: {
@@ -9757,6 +9813,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9757
9813
  button: {
9758
9814
  borderRadius: theme.button.borderRadius
9759
9815
  },
9816
+ buttonBadge: {
9817
+ borderRadius: theme.buttonBadge.borderRadius
9818
+ },
9760
9819
  card: {
9761
9820
  borderRadius: theme.card.borderRadius
9762
9821
  },
@@ -10136,6 +10195,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10136
10195
  maxWidth: theme.button.maxWidth,
10137
10196
  minHeight: theme.button.minHeight
10138
10197
  },
10198
+ buttonBadge: {
10199
+ dimensions: {
10200
+ withBadge: {
10201
+ width: theme.buttonBadge.dimensions.withBadge.width,
10202
+ height: theme.buttonBadge.dimensions.withBadge.height
10203
+ },
10204
+ badgeCount: {
10205
+ width: theme.buttonBadge.dimensions.badgeCount.width,
10206
+ height: theme.buttonBadge.dimensions.badgeCount.height
10207
+ }
10208
+ }
10209
+ },
10139
10210
  icon: theme.icon,
10140
10211
  cardModal: {
10141
10212
  header: {
@@ -11543,13 +11614,17 @@ function NavigationModal({
11543
11614
  body,
11544
11615
  backgroundColor,
11545
11616
  footer,
11546
- header
11617
+ header,
11618
+ children
11547
11619
  }) {
11548
11620
  const Component = useBreakpointValue({
11549
11621
  base: FullscreenModal,
11550
11622
  small: CardModal
11551
11623
  });
11552
- return /*#__PURE__*/jsxRuntime.jsx(Component, {
11624
+ return children ? /*#__PURE__*/jsxRuntime.jsx(Component, {
11625
+ backgroundColor: backgroundColor,
11626
+ children: children
11627
+ }) : /*#__PURE__*/jsxRuntime.jsx(Component, {
11553
11628
  body: body,
11554
11629
  backgroundColor: backgroundColor,
11555
11630
  footer: footer,
@@ -13972,6 +14047,7 @@ exports.Autocomplete = Autocomplete;
13972
14047
  exports.Avatar = Avatar;
13973
14048
  exports.BottomSheet = BottomSheet;
13974
14049
  exports.Button = Button;
14050
+ exports.ButtonBadge = ButtonBadge;
13975
14051
  exports.CardModal = CardModal;
13976
14052
  exports.Center = Center;
13977
14053
  exports.Checkbox = Checkbox;