@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
@@ -787,6 +787,24 @@ const button = {
787
787
  }
788
788
  };
789
789
 
790
+ const buttonBadge = {
791
+ backgroundColor: lateOceanColorPalette['coral.10'],
792
+ dimensions: {
793
+ withBadge: {
794
+ width: 10,
795
+ height: 10
796
+ },
797
+ badgeCount: {
798
+ width: 20,
799
+ height: 20
800
+ }
801
+ },
802
+ borderRadius: {
803
+ withBadge: 5,
804
+ badgeCount: 10
805
+ }
806
+ };
807
+
790
808
  const card = {
791
809
  borderRadius: 20,
792
810
  borderWidth: 2,
@@ -2502,6 +2520,7 @@ const theme = {
2502
2520
  forms,
2503
2521
  highlight,
2504
2522
  icon,
2523
+ buttonBadge,
2505
2524
  iconButton,
2506
2525
  listItem,
2507
2526
  pageLoader,
@@ -3110,6 +3129,37 @@ Typography.h4 = createHeading(4, 'header4');
3110
3129
  /** @deprecated use Typography.Header6 */
3111
3130
  Typography.h5 = createHeading(5, 'header5');
3112
3131
 
3132
+ function ButtonBadge({
3133
+ withBadge,
3134
+ badgeCount
3135
+ }) {
3136
+ if (withBadge) {
3137
+ return /*#__PURE__*/jsxRuntime.jsx(View, {
3138
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3139
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3140
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3141
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3142
+ });
3143
+ }
3144
+ if (badgeCount && badgeCount > 0) {
3145
+ return /*#__PURE__*/jsxRuntime.jsx(VStack, {
3146
+ alignItems: "center",
3147
+ justifyContent: "center",
3148
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3149
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3150
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3151
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3152
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
3153
+ base: "body-xs",
3154
+ variant: "bold",
3155
+ color: "white",
3156
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3157
+ })
3158
+ });
3159
+ }
3160
+ return null;
3161
+ }
3162
+
3113
3163
  function Icon({
3114
3164
  icon,
3115
3165
  size = 'kitt.icon.defaultSize',
@@ -3235,6 +3285,8 @@ function ButtonContentChildren({
3235
3285
  icon,
3236
3286
  iconPosition,
3237
3287
  innerSpacing,
3288
+ withBadge,
3289
+ badgeCount,
3238
3290
  color,
3239
3291
  children
3240
3292
  }) {
@@ -3281,6 +3333,12 @@ function ButtonContentChildren({
3281
3333
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, {
3282
3334
  ...buttonIconSharedProps,
3283
3335
  icon: icon
3336
+ }) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
3337
+ marginLeft: "kitt.2",
3338
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
3339
+ withBadge: withBadge,
3340
+ badgeCount: badgeCount
3341
+ })
3284
3342
  }) : null]
3285
3343
  });
3286
3344
  }
@@ -3425,6 +3483,8 @@ const Button = /*#__PURE__*/react.forwardRef(({
3425
3483
  testID,
3426
3484
  href,
3427
3485
  hrefAttrs,
3486
+ withBadge,
3487
+ badgeCount,
3428
3488
  accessibilityRole = 'button',
3429
3489
  innerSpacing = 'center',
3430
3490
  isHoveredInternal,
@@ -3493,6 +3553,8 @@ const Button = /*#__PURE__*/react.forwardRef(({
3493
3553
  isDisabled: disabled,
3494
3554
  icon: icon,
3495
3555
  iconPosition: iconPosition,
3556
+ withBadge: withBadge,
3557
+ badgeCount: badgeCount,
3496
3558
  isHovered: isHovered,
3497
3559
  isPressed: isPressed,
3498
3560
  isFocused: isFocused,
@@ -3546,6 +3608,8 @@ const ActionsItem = /*#__PURE__*/react.forwardRef(({
3546
3608
  }, ref) => {
3547
3609
  const [isLoading, setIsLoading] = react.useState(false);
3548
3610
  const mountedRef = react.useRef(false);
3611
+ // securing the loading state with a ref to avoid user action between rerenders
3612
+ const loadingRef = react.useRef(false);
3549
3613
 
3550
3614
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3551
3615
  react.useEffect(() => {
@@ -3563,15 +3627,18 @@ const ActionsItem = /*#__PURE__*/react.forwardRef(({
3563
3627
  icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
3564
3628
  onPress: e => {
3565
3629
  (async () => {
3566
- if (!onPress) return;
3630
+ if (!onPress || loadingRef.current) return;
3567
3631
  setIsLoading(true);
3632
+ loadingRef.current = true;
3568
3633
  try {
3569
3634
  await onPress(e);
3570
3635
  if (mountedRef.current) {
3571
3636
  setIsLoading(false);
3637
+ loadingRef.current = false;
3572
3638
  }
3573
3639
  } catch (error) {
3574
3640
  if (mountedRef.current) {
3641
+ loadingRef.current = false;
3575
3642
  setIsLoading(false);
3576
3643
  }
3577
3644
  throw error;
@@ -7007,6 +7074,8 @@ function FullscreenModalBody({
7007
7074
  const paddingBottom = shouldHandleBottomNotch ? Math.max(bottom, verticalPadding) : verticalPadding;
7008
7075
  const paddingTop = shouldHandleTopNotch ? Math.max(top, verticalPadding) : verticalPadding;
7009
7076
  return /*#__PURE__*/jsxRuntime.jsx(View, {
7077
+ flexGrow: 1,
7078
+ flexShrink: 1,
7010
7079
  ...props,
7011
7080
  paddingX: "kitt.fullscreenModal.horizontalPadding",
7012
7081
  paddingTop: paddingTop,
@@ -7219,28 +7288,31 @@ function FullscreenModalHeader({
7219
7288
  }
7220
7289
 
7221
7290
  function FullscreenModal({
7291
+ children,
7222
7292
  body,
7223
7293
  header,
7224
7294
  footer,
7225
7295
  backgroundColor
7226
7296
  }) {
7227
- return /*#__PURE__*/jsxRuntime.jsxs(FullscreenModalContainer, {
7297
+ return /*#__PURE__*/jsxRuntime.jsx(FullscreenModalContainer, {
7228
7298
  backgroundColor: backgroundColor,
7229
- children: [header ? /*#__PURE__*/jsxRuntime.jsx(View, {
7230
- children: header
7231
- }) : null, /*#__PURE__*/jsxRuntime.jsxs(View, {
7232
- flexGrow: 1,
7233
- flexShrink: 1,
7234
- justifyContent: "space-between",
7235
- children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
7236
- bounces: false,
7237
- contentContainerStyle: {
7238
- flexGrow: 1,
7239
- position: 'relative'
7240
- },
7241
- children: body
7242
- }), footer || null]
7243
- })]
7299
+ children: children || /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7300
+ children: [header ? /*#__PURE__*/jsxRuntime.jsx(View, {
7301
+ children: header
7302
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs(View, {
7303
+ flexGrow: 1,
7304
+ flexShrink: 1,
7305
+ justifyContent: "space-between",
7306
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
7307
+ bounces: false,
7308
+ contentContainerStyle: {
7309
+ flexGrow: 1,
7310
+ position: 'relative'
7311
+ },
7312
+ children: body
7313
+ }), footer || null]
7314
+ })]
7315
+ })
7244
7316
  });
7245
7317
  }
7246
7318
  FullscreenModal.Header = FullscreenModalHeader;
@@ -7631,7 +7703,7 @@ function IconButton({
7631
7703
  ariaLabel,
7632
7704
  accessibilityRole = 'button',
7633
7705
  withBadge,
7634
- bagdeCount,
7706
+ badgeCount,
7635
7707
  isHoveredInternal,
7636
7708
  isPressedInternal,
7637
7709
  isFocusedInternal,
@@ -7691,32 +7763,13 @@ function IconButton({
7691
7763
  icon: icon
7692
7764
  })
7693
7765
  })]
7694
- }), withBadge ? /*#__PURE__*/jsxRuntime.jsx(View, {
7695
- height: "10px",
7696
- width: "10px",
7697
- backgroundColor: lateOceanColorPalette['coral.10'],
7698
- borderRadius: "kitt.iconButton.borderRadius",
7766
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
7699
7767
  position: "absolute",
7700
- top: "1px",
7701
- right: "1px"
7702
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
7703
- height: "20px",
7704
- width: "20px",
7705
- backgroundColor: lateOceanColorPalette['coral.10'],
7706
- borderRadius: "kitt.iconButton.borderRadius",
7707
- position: "absolute",
7708
- top: "-6px",
7709
- right: "-6px",
7710
- children: /*#__PURE__*/jsxRuntime.jsx(View, {
7711
- alignItems: "center",
7712
- justifyContent: "center",
7713
- marginTop: "2px",
7714
- children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
7715
- base: "body-xs",
7716
- variant: "bold",
7717
- color: "white",
7718
- children: bagdeCount > 5 ? '+5' : bagdeCount
7719
- })
7768
+ top: withBadge ? '1px' : '-6px',
7769
+ right: withBadge ? '1px' : '-6px',
7770
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
7771
+ withBadge: withBadge,
7772
+ badgeCount: badgeCount
7720
7773
  })
7721
7774
  }) : null]
7722
7775
  });
@@ -8791,6 +8844,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8791
8844
  backgroundColor: theme.skeleton.backgroundColor,
8792
8845
  flareColor: theme.skeleton.flareColor
8793
8846
  },
8847
+ buttonBadge: {
8848
+ backgroundColor: theme.buttonBadge.backgroundColor
8849
+ },
8794
8850
  iconButton: {
8795
8851
  borderColor: theme.iconButton.borderColor,
8796
8852
  disabled: {
@@ -8979,6 +9035,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8979
9035
  button: {
8980
9036
  borderRadius: theme.button.borderRadius
8981
9037
  },
9038
+ buttonBadge: {
9039
+ borderRadius: theme.buttonBadge.borderRadius
9040
+ },
8982
9041
  card: {
8983
9042
  borderRadius: theme.card.borderRadius
8984
9043
  },
@@ -9358,6 +9417,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9358
9417
  maxWidth: theme.button.maxWidth,
9359
9418
  minHeight: theme.button.minHeight
9360
9419
  },
9420
+ buttonBadge: {
9421
+ dimensions: {
9422
+ withBadge: {
9423
+ width: theme.buttonBadge.dimensions.withBadge.width,
9424
+ height: theme.buttonBadge.dimensions.withBadge.height
9425
+ },
9426
+ badgeCount: {
9427
+ width: theme.buttonBadge.dimensions.badgeCount.width,
9428
+ height: theme.buttonBadge.dimensions.badgeCount.height
9429
+ }
9430
+ }
9431
+ },
9361
9432
  icon: theme.icon,
9362
9433
  cardModal: {
9363
9434
  header: {
@@ -10805,13 +10876,17 @@ function NavigationModal({
10805
10876
  body,
10806
10877
  backgroundColor,
10807
10878
  footer,
10808
- header
10879
+ header,
10880
+ children
10809
10881
  }) {
10810
10882
  const Component = useBreakpointValue({
10811
10883
  base: FullscreenModal,
10812
10884
  small: CardModal
10813
10885
  });
10814
- return /*#__PURE__*/jsxRuntime.jsx(Component, {
10886
+ return children ? /*#__PURE__*/jsxRuntime.jsx(Component, {
10887
+ backgroundColor: backgroundColor,
10888
+ children: children
10889
+ }) : /*#__PURE__*/jsxRuntime.jsx(Component, {
10815
10890
  body: body,
10816
10891
  backgroundColor: backgroundColor,
10817
10892
  footer: footer,
@@ -13079,6 +13154,7 @@ exports.Autocomplete = Autocomplete;
13079
13154
  exports.Avatar = Avatar;
13080
13155
  exports.BottomSheet = BottomSheet;
13081
13156
  exports.Button = Button;
13157
+ exports.ButtonBadge = ButtonBadge;
13082
13158
  exports.CardModal = CardModal;
13083
13159
  exports.Center = Center;
13084
13160
  exports.Checkbox = Checkbox;