@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
package/dist/index.es.js CHANGED
@@ -802,6 +802,24 @@ var button = {
802
802
  }
803
803
  };
804
804
 
805
+ var buttonBadge = {
806
+ backgroundColor: lateOceanColorPalette['coral.10'],
807
+ dimensions: {
808
+ withBadge: {
809
+ width: 10,
810
+ height: 10
811
+ },
812
+ badgeCount: {
813
+ width: 20,
814
+ height: 20
815
+ }
816
+ },
817
+ borderRadius: {
818
+ withBadge: 5,
819
+ badgeCount: 10
820
+ }
821
+ };
822
+
805
823
  var card = {
806
824
  borderRadius: 20,
807
825
  borderWidth: 2,
@@ -2525,6 +2543,7 @@ var theme = {
2525
2543
  forms: forms,
2526
2544
  highlight: highlight,
2527
2545
  icon: icon,
2546
+ buttonBadge: buttonBadge,
2528
2547
  iconButton: iconButton,
2529
2548
  listItem: listItem,
2530
2549
  pageLoader: pageLoader,
@@ -3100,6 +3119,36 @@ Typography.h4 = createHeading(4, 'header4');
3100
3119
  /** @deprecated use Typography.Header6 */
3101
3120
  Typography.h5 = createHeading(5, 'header5');
3102
3121
 
3122
+ function ButtonBadge(_ref) {
3123
+ var withBadge = _ref.withBadge,
3124
+ badgeCount = _ref.badgeCount;
3125
+ if (withBadge) {
3126
+ return /*#__PURE__*/jsx(View, {
3127
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3128
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3129
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3130
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3131
+ });
3132
+ }
3133
+ if (badgeCount && badgeCount > 0) {
3134
+ return /*#__PURE__*/jsx(VStack, {
3135
+ alignItems: "center",
3136
+ justifyContent: "center",
3137
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3138
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3139
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3140
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3141
+ children: /*#__PURE__*/jsx(Typography.Text, {
3142
+ base: "body-xs",
3143
+ variant: "bold",
3144
+ color: "white",
3145
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3146
+ })
3147
+ });
3148
+ }
3149
+ return null;
3150
+ }
3151
+
3103
3152
  function Icon(_ref) {
3104
3153
  var icon = _ref.icon,
3105
3154
  _ref$size = _ref.size,
@@ -3218,6 +3267,8 @@ function ButtonContentChildren(_ref2) {
3218
3267
  icon = _ref2.icon,
3219
3268
  iconPosition = _ref2.iconPosition,
3220
3269
  innerSpacing = _ref2.innerSpacing,
3270
+ withBadge = _ref2.withBadge,
3271
+ badgeCount = _ref2.badgeCount,
3221
3272
  color = _ref2.color,
3222
3273
  children = _ref2.children;
3223
3274
  if ((process.env.NODE_ENV !== "production")) {
@@ -3261,7 +3312,13 @@ function ButtonContentChildren(_ref2) {
3261
3312
  children: children
3262
3313
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, _objectSpread(_objectSpread({}, buttonIconSharedProps), {}, {
3263
3314
  icon: icon
3264
- })) : null]
3315
+ })) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3316
+ marginLeft: "kitt.2",
3317
+ children: /*#__PURE__*/jsx(ButtonBadge, {
3318
+ withBadge: withBadge,
3319
+ badgeCount: badgeCount
3320
+ })
3321
+ }) : null]
3265
3322
  });
3266
3323
  }
3267
3324
  function ButtonContent(_ref3) {
@@ -3435,6 +3492,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3435
3492
  testID = _ref.testID,
3436
3493
  href = _ref.href,
3437
3494
  hrefAttrs = _ref.hrefAttrs,
3495
+ withBadge = _ref.withBadge,
3496
+ badgeCount = _ref.badgeCount,
3438
3497
  _ref$accessibilityRol = _ref.accessibilityRole,
3439
3498
  accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
3440
3499
  _ref$innerSpacing = _ref.innerSpacing,
@@ -3506,6 +3565,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3506
3565
  isDisabled: disabled,
3507
3566
  icon: icon,
3508
3567
  iconPosition: iconPosition,
3568
+ withBadge: withBadge,
3569
+ badgeCount: badgeCount,
3509
3570
  isHovered: isHovered,
3510
3571
  isPressed: isPressed,
3511
3572
  isFocused: isFocused,
@@ -3588,6 +3649,8 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3588
3649
  isLoading = _useState2[0],
3589
3650
  setIsLoading = _useState2[1];
3590
3651
  var mountedRef = useRef(false);
3652
+ // securing the loading state with a ref to avoid user action between rerenders
3653
+ var loadingRef = useRef(false);
3591
3654
 
3592
3655
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3593
3656
  useEffect(function () {
@@ -3609,34 +3672,37 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3609
3672
  return _regeneratorRuntime().wrap(function (_context) {
3610
3673
  while (1) switch (_context.prev = _context.next) {
3611
3674
  case 0:
3612
- if (onPress) {
3675
+ if (!(!onPress || loadingRef.current)) {
3613
3676
  _context.next = 2;
3614
3677
  break;
3615
3678
  }
3616
3679
  return _context.abrupt("return");
3617
3680
  case 2:
3618
3681
  setIsLoading(true);
3619
- _context.prev = 3;
3620
- _context.next = 6;
3682
+ loadingRef.current = true;
3683
+ _context.prev = 4;
3684
+ _context.next = 7;
3621
3685
  return onPress(e);
3622
- case 6:
3686
+ case 7:
3623
3687
  if (mountedRef.current) {
3624
3688
  setIsLoading(false);
3689
+ loadingRef.current = false;
3625
3690
  }
3626
- _context.next = 13;
3691
+ _context.next = 14;
3627
3692
  break;
3628
- case 9:
3629
- _context.prev = 9;
3630
- _context.t0 = _context["catch"](3);
3693
+ case 10:
3694
+ _context.prev = 10;
3695
+ _context.t0 = _context["catch"](4);
3631
3696
  if (mountedRef.current) {
3697
+ loadingRef.current = false;
3632
3698
  setIsLoading(false);
3633
3699
  }
3634
3700
  throw _context.t0;
3635
- case 13:
3701
+ case 14:
3636
3702
  case "end":
3637
3703
  return _context.stop();
3638
3704
  }
3639
- }, _callee, null, [[3, 9]]);
3705
+ }, _callee, null, [[4, 10]]);
3640
3706
  }));
3641
3707
  return function () {
3642
3708
  return _ref2.apply(this, arguments);
@@ -8752,7 +8818,7 @@ function IconButton(_ref) {
8752
8818
  _ref$accessibilityRol = _ref.accessibilityRole,
8753
8819
  accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
8754
8820
  withBadge = _ref.withBadge,
8755
- bagdeCount = _ref.bagdeCount,
8821
+ badgeCount = _ref.badgeCount,
8756
8822
  isHoveredInternal = _ref.isHoveredInternal,
8757
8823
  isPressedInternal = _ref.isPressedInternal,
8758
8824
  isFocusedInternal = _ref.isFocusedInternal,
@@ -8812,32 +8878,13 @@ function IconButton(_ref) {
8812
8878
  icon: icon
8813
8879
  })
8814
8880
  })]
8815
- }), withBadge ? /*#__PURE__*/jsx(View, {
8816
- height: "10px",
8817
- width: "10px",
8818
- backgroundColor: lateOceanColorPalette['coral.10'],
8819
- borderRadius: "kitt.iconButton.borderRadius",
8820
- position: "absolute",
8821
- top: "1px",
8822
- right: "1px"
8823
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsx(View, {
8824
- height: "20px",
8825
- width: "20px",
8826
- backgroundColor: lateOceanColorPalette['coral.10'],
8827
- borderRadius: "kitt.iconButton.borderRadius",
8881
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
8828
8882
  position: "absolute",
8829
- top: "-6px",
8830
- right: "-6px",
8831
- children: /*#__PURE__*/jsx(View, {
8832
- alignItems: "center",
8833
- justifyContent: "center",
8834
- marginTop: "2px",
8835
- children: /*#__PURE__*/jsx(Typography.Text, {
8836
- base: "body-xs",
8837
- variant: "bold",
8838
- color: "white",
8839
- children: bagdeCount > 5 ? '+5' : bagdeCount
8840
- })
8883
+ top: withBadge ? '1px' : '-6px',
8884
+ right: withBadge ? '1px' : '-6px',
8885
+ children: /*#__PURE__*/jsx(ButtonBadge, {
8886
+ withBadge: withBadge,
8887
+ badgeCount: badgeCount
8841
8888
  })
8842
8889
  }) : null]
8843
8890
  });
@@ -9833,6 +9880,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9833
9880
  backgroundColor: theme.skeleton.backgroundColor,
9834
9881
  flareColor: theme.skeleton.flareColor
9835
9882
  },
9883
+ buttonBadge: {
9884
+ backgroundColor: theme.buttonBadge.backgroundColor
9885
+ },
9836
9886
  iconButton: {
9837
9887
  borderColor: theme.iconButton.borderColor,
9838
9888
  disabled: {
@@ -10020,6 +10070,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10020
10070
  button: {
10021
10071
  borderRadius: theme.button.borderRadius
10022
10072
  },
10073
+ buttonBadge: {
10074
+ borderRadius: theme.buttonBadge.borderRadius
10075
+ },
10023
10076
  card: {
10024
10077
  borderRadius: theme.card.borderRadius
10025
10078
  },
@@ -10396,6 +10449,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10396
10449
  maxWidth: theme.button.maxWidth,
10397
10450
  minHeight: theme.button.minHeight
10398
10451
  },
10452
+ buttonBadge: {
10453
+ dimensions: {
10454
+ withBadge: {
10455
+ width: theme.buttonBadge.dimensions.withBadge.width,
10456
+ height: theme.buttonBadge.dimensions.withBadge.height
10457
+ },
10458
+ badgeCount: {
10459
+ width: theme.buttonBadge.dimensions.badgeCount.width,
10460
+ height: theme.buttonBadge.dimensions.badgeCount.height
10461
+ }
10462
+ }
10463
+ },
10399
10464
  icon: theme.icon,
10400
10465
  cardModal: {
10401
10466
  header: {
@@ -14244,5 +14309,5 @@ function VerticalSteps(_ref) {
14244
14309
  VerticalSteps.Step = Step;
14245
14310
  VerticalSteps.BorderlessStep = BorderlessStep;
14246
14311
 
14247
- export { ActionCard, Actions, Autocomplete, Avatar, BottomSheet, Button, CardModal, Center, Checkbox, ChoicesElements, CloseIconButton, DatePicker, DialogModal, DocumentPicker, Emoji, ExternalAppLink, ExternalLink, FilePicker, FlatList, Flex, FullscreenModal, GoogleMapsApiKeyProvider, GoogleMapsAutocompleteProvider, GroupTags, HStack, Highlight, Icon, IconButton, Image, ImagePicker, InfoCard, InputAddress, InputEmail, InputFeedback, InputField, InputIban, InputIcon, InputNumber, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpointNameEnum, KittBreakpoints, KittBreakpointsMax, KittMapConfigProvider, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MapMarker, MapMarkerVariantEnum, MatchWindowSize, Message, ModalBehaviour, FlatList as NativeOnlyFlatList, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, RadioWithRef as Radio, RadioButtonGroup, ScrollView, DeprecatedSection as Section, SectionList, SegmentedProgressBar, Skeleton, SpinningIcon, Stack, StaticMap, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, SwitchBreakpoints, TabBar, Tag, TextArea, TimePicker, ToastComponent, Toggle, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, VerticalSteps, View, createChoicesComponent, createResponsiveStyleFromProp, getStaticMapImageUrl, getValueForBreakpoint, hex2rgba, matchWindowSize, storyPadding, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useOpenExternalLink, useStaticBottomSheet, useStoryBlockColor, useTheme };
14312
+ export { ActionCard, Actions, Autocomplete, Avatar, BottomSheet, Button, ButtonBadge, CardModal, Center, Checkbox, ChoicesElements, CloseIconButton, DatePicker, DialogModal, DocumentPicker, Emoji, ExternalAppLink, ExternalLink, FilePicker, FlatList, Flex, FullscreenModal, GoogleMapsApiKeyProvider, GoogleMapsAutocompleteProvider, GroupTags, HStack, Highlight, Icon, IconButton, Image, ImagePicker, InfoCard, InputAddress, InputEmail, InputFeedback, InputField, InputIban, InputIcon, InputNumber, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpointNameEnum, KittBreakpoints, KittBreakpointsMax, KittMapConfigProvider, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MapMarker, MapMarkerVariantEnum, MatchWindowSize, Message, ModalBehaviour, FlatList as NativeOnlyFlatList, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, RadioWithRef as Radio, RadioButtonGroup, ScrollView, DeprecatedSection as Section, SectionList, SegmentedProgressBar, Skeleton, SpinningIcon, Stack, StaticMap, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, SwitchBreakpoints, TabBar, Tag, TextArea, TimePicker, ToastComponent, Toggle, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, VerticalSteps, View, createChoicesComponent, createResponsiveStyleFromProp, getStaticMapImageUrl, getValueForBreakpoint, hex2rgba, matchWindowSize, storyPadding, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useOpenExternalLink, useStaticBottomSheet, useStoryBlockColor, useTheme };
14248
14313
  //# sourceMappingURL=index.es.js.map