@ornikar/kitt-universal 25.54.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 (52) hide show
  1. package/CHANGELOG.md +10 -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/IconButton/IconButton.d.ts +2 -2
  10. package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
  11. package/dist/definitions/index.d.ts +2 -0
  12. package/dist/definitions/index.d.ts.map +1 -1
  13. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +21 -0
  14. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  15. package/dist/definitions/themes/default.d.ts +1 -0
  16. package/dist/definitions/themes/default.d.ts.map +1 -1
  17. package/dist/definitions/themes/late-ocean/buttonBadge.d.ts +21 -0
  18. package/dist/definitions/themes/late-ocean/buttonBadge.d.ts.map +1 -0
  19. package/dist/index-metro.es.android.js +95 -29
  20. package/dist/index-metro.es.android.js.map +1 -1
  21. package/dist/index-metro.es.ios.js +95 -29
  22. package/dist/index-metro.es.ios.js.map +1 -1
  23. package/dist/index-node-20.10.cjs.js +94 -27
  24. package/dist/index-node-20.10.cjs.js.map +1 -1
  25. package/dist/index-node-20.10.cjs.web.js +94 -27
  26. package/dist/index-node-20.10.cjs.web.js.map +1 -1
  27. package/dist/index-node-20.10.es.mjs +94 -28
  28. package/dist/index-node-20.10.es.mjs.map +1 -1
  29. package/dist/index-node-20.10.es.web.mjs +94 -28
  30. package/dist/index-node-20.10.es.web.mjs.map +1 -1
  31. package/dist/index.es.js +103 -38
  32. package/dist/index.es.js.map +1 -1
  33. package/dist/index.es.web.js +103 -38
  34. package/dist/index.es.web.js.map +1 -1
  35. package/dist/linaria-themes-metro.es.android.js +19 -0
  36. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  37. package/dist/linaria-themes-metro.es.ios.js +19 -0
  38. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  39. package/dist/linaria-themes-node-20.10.cjs.js +19 -0
  40. package/dist/linaria-themes-node-20.10.cjs.js.map +1 -1
  41. package/dist/linaria-themes-node-20.10.cjs.web.js +19 -0
  42. package/dist/linaria-themes-node-20.10.cjs.web.js.map +1 -1
  43. package/dist/linaria-themes-node-20.10.es.mjs +19 -0
  44. package/dist/linaria-themes-node-20.10.es.mjs.map +1 -1
  45. package/dist/linaria-themes-node-20.10.es.web.mjs +19 -0
  46. package/dist/linaria-themes-node-20.10.es.web.mjs.map +1 -1
  47. package/dist/linaria-themes.es.js +19 -0
  48. package/dist/linaria-themes.es.js.map +1 -1
  49. package/dist/linaria-themes.es.web.js +19 -0
  50. package/dist/linaria-themes.es.web.js.map +1 -1
  51. package/dist/tsbuildinfo +1 -1
  52. 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;
@@ -7636,7 +7703,7 @@ function IconButton({
7636
7703
  ariaLabel,
7637
7704
  accessibilityRole = 'button',
7638
7705
  withBadge,
7639
- bagdeCount,
7706
+ badgeCount,
7640
7707
  isHoveredInternal,
7641
7708
  isPressedInternal,
7642
7709
  isFocusedInternal,
@@ -7696,32 +7763,13 @@ function IconButton({
7696
7763
  icon: icon
7697
7764
  })
7698
7765
  })]
7699
- }), withBadge ? /*#__PURE__*/jsxRuntime.jsx(View, {
7700
- height: "10px",
7701
- width: "10px",
7702
- backgroundColor: lateOceanColorPalette['coral.10'],
7703
- borderRadius: "kitt.iconButton.borderRadius",
7704
- position: "absolute",
7705
- top: "1px",
7706
- right: "1px"
7707
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
7708
- height: "20px",
7709
- width: "20px",
7710
- backgroundColor: lateOceanColorPalette['coral.10'],
7711
- borderRadius: "kitt.iconButton.borderRadius",
7766
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsxRuntime.jsx(View, {
7712
7767
  position: "absolute",
7713
- top: "-6px",
7714
- right: "-6px",
7715
- children: /*#__PURE__*/jsxRuntime.jsx(View, {
7716
- alignItems: "center",
7717
- justifyContent: "center",
7718
- marginTop: "2px",
7719
- children: /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
7720
- base: "body-xs",
7721
- variant: "bold",
7722
- color: "white",
7723
- children: bagdeCount > 5 ? '+5' : bagdeCount
7724
- })
7768
+ top: withBadge ? '1px' : '-6px',
7769
+ right: withBadge ? '1px' : '-6px',
7770
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonBadge, {
7771
+ withBadge: withBadge,
7772
+ badgeCount: badgeCount
7725
7773
  })
7726
7774
  }) : null]
7727
7775
  });
@@ -8796,6 +8844,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8796
8844
  backgroundColor: theme.skeleton.backgroundColor,
8797
8845
  flareColor: theme.skeleton.flareColor
8798
8846
  },
8847
+ buttonBadge: {
8848
+ backgroundColor: theme.buttonBadge.backgroundColor
8849
+ },
8799
8850
  iconButton: {
8800
8851
  borderColor: theme.iconButton.borderColor,
8801
8852
  disabled: {
@@ -8984,6 +9035,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8984
9035
  button: {
8985
9036
  borderRadius: theme.button.borderRadius
8986
9037
  },
9038
+ buttonBadge: {
9039
+ borderRadius: theme.buttonBadge.borderRadius
9040
+ },
8987
9041
  card: {
8988
9042
  borderRadius: theme.card.borderRadius
8989
9043
  },
@@ -9363,6 +9417,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9363
9417
  maxWidth: theme.button.maxWidth,
9364
9418
  minHeight: theme.button.minHeight
9365
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
+ },
9366
9432
  icon: theme.icon,
9367
9433
  cardModal: {
9368
9434
  header: {
@@ -13088,6 +13154,7 @@ exports.Autocomplete = Autocomplete;
13088
13154
  exports.Avatar = Avatar;
13089
13155
  exports.BottomSheet = BottomSheet;
13090
13156
  exports.Button = Button;
13157
+ exports.ButtonBadge = ButtonBadge;
13091
13158
  exports.CardModal = CardModal;
13092
13159
  exports.Center = Center;
13093
13160
  exports.Checkbox = Checkbox;