@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
@@ -798,6 +798,24 @@ var button = {
798
798
  }
799
799
  };
800
800
 
801
+ var buttonBadge = {
802
+ backgroundColor: lateOceanColorPalette['coral.10'],
803
+ dimensions: {
804
+ withBadge: {
805
+ width: 10,
806
+ height: 10
807
+ },
808
+ badgeCount: {
809
+ width: 20,
810
+ height: 20
811
+ }
812
+ },
813
+ borderRadius: {
814
+ withBadge: 5,
815
+ badgeCount: 10
816
+ }
817
+ };
818
+
801
819
  var card = {
802
820
  borderRadius: 20,
803
821
  borderWidth: 2,
@@ -2521,6 +2539,7 @@ var theme = {
2521
2539
  forms: forms,
2522
2540
  highlight: highlight,
2523
2541
  icon: icon,
2542
+ buttonBadge: buttonBadge,
2524
2543
  iconButton: iconButton,
2525
2544
  listItem: listItem,
2526
2545
  pageLoader: pageLoader,
@@ -3137,6 +3156,36 @@ Typography.h4 = createHeading(4, 'header4');
3137
3156
  /** @deprecated use Typography.Header6 */
3138
3157
  Typography.h5 = createHeading(5, 'header5');
3139
3158
 
3159
+ function ButtonBadge(_ref) {
3160
+ var withBadge = _ref.withBadge,
3161
+ badgeCount = _ref.badgeCount;
3162
+ if (withBadge) {
3163
+ return /*#__PURE__*/jsx(View, {
3164
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3165
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3166
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3167
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3168
+ });
3169
+ }
3170
+ if (badgeCount && badgeCount > 0) {
3171
+ return /*#__PURE__*/jsx(VStack, {
3172
+ alignItems: "center",
3173
+ justifyContent: "center",
3174
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3175
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3176
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3177
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3178
+ children: /*#__PURE__*/jsx(Typography.Text, {
3179
+ base: "body-xs",
3180
+ variant: "bold",
3181
+ color: "white",
3182
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3183
+ })
3184
+ });
3185
+ }
3186
+ return null;
3187
+ }
3188
+
3140
3189
  function Icon(_ref) {
3141
3190
  var icon = _ref.icon,
3142
3191
  _ref$size = _ref.size,
@@ -3255,6 +3304,8 @@ function ButtonContentChildren(_ref2) {
3255
3304
  icon = _ref2.icon,
3256
3305
  iconPosition = _ref2.iconPosition,
3257
3306
  innerSpacing = _ref2.innerSpacing,
3307
+ withBadge = _ref2.withBadge,
3308
+ badgeCount = _ref2.badgeCount,
3258
3309
  color = _ref2.color,
3259
3310
  children = _ref2.children;
3260
3311
  if ((process.env.NODE_ENV !== "production")) {
@@ -3298,7 +3349,13 @@ function ButtonContentChildren(_ref2) {
3298
3349
  children: children
3299
3350
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, _objectSpread(_objectSpread({}, buttonIconSharedProps), {}, {
3300
3351
  icon: icon
3301
- })) : null]
3352
+ })) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3353
+ marginLeft: "kitt.2",
3354
+ children: /*#__PURE__*/jsx(ButtonBadge, {
3355
+ withBadge: withBadge,
3356
+ badgeCount: badgeCount
3357
+ })
3358
+ }) : null]
3302
3359
  });
3303
3360
  }
3304
3361
  function ButtonContent(_ref3) {
@@ -3437,6 +3494,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3437
3494
  testID = _ref.testID,
3438
3495
  href = _ref.href,
3439
3496
  hrefAttrs = _ref.hrefAttrs,
3497
+ withBadge = _ref.withBadge,
3498
+ badgeCount = _ref.badgeCount,
3440
3499
  _ref$accessibilityRol = _ref.accessibilityRole,
3441
3500
  accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
3442
3501
  _ref$innerSpacing = _ref.innerSpacing,
@@ -3505,6 +3564,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
3505
3564
  isDisabled: disabled,
3506
3565
  icon: icon,
3507
3566
  iconPosition: iconPosition,
3567
+ withBadge: withBadge,
3568
+ badgeCount: badgeCount,
3508
3569
  isHovered: isHovered,
3509
3570
  isPressed: isPressed,
3510
3571
  isFocused: isFocused,
@@ -3561,6 +3622,8 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3561
3622
  isLoading = _useState2[0],
3562
3623
  setIsLoading = _useState2[1];
3563
3624
  var mountedRef = useRef(false);
3625
+ // securing the loading state with a ref to avoid user action between rerenders
3626
+ var loadingRef = useRef(false);
3564
3627
 
3565
3628
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3566
3629
  useEffect(function () {
@@ -3582,34 +3645,37 @@ var ActionsItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
3582
3645
  return _regeneratorRuntime().wrap(function (_context) {
3583
3646
  while (1) switch (_context.prev = _context.next) {
3584
3647
  case 0:
3585
- if (onPress) {
3648
+ if (!(!onPress || loadingRef.current)) {
3586
3649
  _context.next = 2;
3587
3650
  break;
3588
3651
  }
3589
3652
  return _context.abrupt("return");
3590
3653
  case 2:
3591
3654
  setIsLoading(true);
3592
- _context.prev = 3;
3593
- _context.next = 6;
3655
+ loadingRef.current = true;
3656
+ _context.prev = 4;
3657
+ _context.next = 7;
3594
3658
  return onPress(e);
3595
- case 6:
3659
+ case 7:
3596
3660
  if (mountedRef.current) {
3597
3661
  setIsLoading(false);
3662
+ loadingRef.current = false;
3598
3663
  }
3599
- _context.next = 13;
3664
+ _context.next = 14;
3600
3665
  break;
3601
- case 9:
3602
- _context.prev = 9;
3603
- _context.t0 = _context["catch"](3);
3666
+ case 10:
3667
+ _context.prev = 10;
3668
+ _context.t0 = _context["catch"](4);
3604
3669
  if (mountedRef.current) {
3670
+ loadingRef.current = false;
3605
3671
  setIsLoading(false);
3606
3672
  }
3607
3673
  throw _context.t0;
3608
- case 13:
3674
+ case 14:
3609
3675
  case "end":
3610
3676
  return _context.stop();
3611
3677
  }
3612
- }, _callee, null, [[3, 9]]);
3678
+ }, _callee, null, [[4, 10]]);
3613
3679
  }));
3614
3680
  return function () {
3615
3681
  return _ref2.apply(this, arguments);
@@ -7819,7 +7885,7 @@ function IconButton(_ref) {
7819
7885
  _ref$accessibilityRol = _ref.accessibilityRole,
7820
7886
  accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
7821
7887
  withBadge = _ref.withBadge,
7822
- bagdeCount = _ref.bagdeCount,
7888
+ badgeCount = _ref.badgeCount,
7823
7889
  isHoveredInternal = _ref.isHoveredInternal,
7824
7890
  isPressedInternal = _ref.isPressedInternal,
7825
7891
  isFocusedInternal = _ref.isFocusedInternal,
@@ -7876,32 +7942,13 @@ function IconButton(_ref) {
7876
7942
  icon: icon
7877
7943
  })
7878
7944
  })]
7879
- }), withBadge ? /*#__PURE__*/jsx(View, {
7880
- height: "10px",
7881
- width: "10px",
7882
- backgroundColor: lateOceanColorPalette['coral.10'],
7883
- borderRadius: "kitt.iconButton.borderRadius",
7945
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
7884
7946
  position: "absolute",
7885
- top: "1px",
7886
- right: "1px"
7887
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsx(View, {
7888
- height: "20px",
7889
- width: "20px",
7890
- backgroundColor: lateOceanColorPalette['coral.10'],
7891
- borderRadius: "kitt.iconButton.borderRadius",
7892
- position: "absolute",
7893
- top: "-6px",
7894
- right: "-6px",
7895
- children: /*#__PURE__*/jsx(View, {
7896
- alignItems: "center",
7897
- justifyContent: "center",
7898
- marginTop: "2px",
7899
- children: /*#__PURE__*/jsx(Typography.Text, {
7900
- base: "body-xs",
7901
- variant: "bold",
7902
- color: "white",
7903
- children: bagdeCount > 5 ? '+5' : bagdeCount
7904
- })
7947
+ top: withBadge ? '1px' : '-6px',
7948
+ right: withBadge ? '1px' : '-6px',
7949
+ children: /*#__PURE__*/jsx(ButtonBadge, {
7950
+ withBadge: withBadge,
7951
+ badgeCount: badgeCount
7905
7952
  })
7906
7953
  }) : null]
7907
7954
  });
@@ -8980,6 +9027,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8980
9027
  backgroundColor: theme.skeleton.backgroundColor,
8981
9028
  flareColor: theme.skeleton.flareColor
8982
9029
  },
9030
+ buttonBadge: {
9031
+ backgroundColor: theme.buttonBadge.backgroundColor
9032
+ },
8983
9033
  iconButton: {
8984
9034
  borderColor: theme.iconButton.borderColor,
8985
9035
  disabled: {
@@ -9167,6 +9217,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9167
9217
  button: {
9168
9218
  borderRadius: theme.button.borderRadius
9169
9219
  },
9220
+ buttonBadge: {
9221
+ borderRadius: theme.buttonBadge.borderRadius
9222
+ },
9170
9223
  card: {
9171
9224
  borderRadius: theme.card.borderRadius
9172
9225
  },
@@ -9543,6 +9596,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9543
9596
  maxWidth: theme.button.maxWidth,
9544
9597
  minHeight: theme.button.minHeight
9545
9598
  },
9599
+ buttonBadge: {
9600
+ dimensions: {
9601
+ withBadge: {
9602
+ width: theme.buttonBadge.dimensions.withBadge.width,
9603
+ height: theme.buttonBadge.dimensions.withBadge.height
9604
+ },
9605
+ badgeCount: {
9606
+ width: theme.buttonBadge.dimensions.badgeCount.width,
9607
+ height: theme.buttonBadge.dimensions.badgeCount.height
9608
+ }
9609
+ }
9610
+ },
9546
9611
  icon: theme.icon,
9547
9612
  cardModal: {
9548
9613
  header: {
@@ -13262,5 +13327,5 @@ function VerticalSteps(_ref) {
13262
13327
  VerticalSteps.Step = Step;
13263
13328
  VerticalSteps.BorderlessStep = BorderlessStep;
13264
13329
 
13265
- 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, 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 };
13330
+ 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, 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 };
13266
13331
  //# sourceMappingURL=index.es.web.js.map