@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
@@ -780,6 +780,24 @@ const button = {
780
780
  }
781
781
  };
782
782
 
783
+ const buttonBadge = {
784
+ backgroundColor: lateOceanColorPalette['coral.10'],
785
+ dimensions: {
786
+ withBadge: {
787
+ width: 10,
788
+ height: 10
789
+ },
790
+ badgeCount: {
791
+ width: 20,
792
+ height: 20
793
+ }
794
+ },
795
+ borderRadius: {
796
+ withBadge: 5,
797
+ badgeCount: 10
798
+ }
799
+ };
800
+
783
801
  const card = {
784
802
  borderRadius: 20,
785
803
  borderWidth: 2,
@@ -2495,6 +2513,7 @@ const theme = {
2495
2513
  forms,
2496
2514
  highlight,
2497
2515
  icon,
2516
+ buttonBadge,
2498
2517
  iconButton,
2499
2518
  listItem,
2500
2519
  pageLoader,
@@ -3103,6 +3122,37 @@ Typography.h4 = createHeading(4, 'header4');
3103
3122
  /** @deprecated use Typography.Header6 */
3104
3123
  Typography.h5 = createHeading(5, 'header5');
3105
3124
 
3125
+ function ButtonBadge({
3126
+ withBadge,
3127
+ badgeCount
3128
+ }) {
3129
+ if (withBadge) {
3130
+ return /*#__PURE__*/jsx(View, {
3131
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3132
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3133
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3134
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3135
+ });
3136
+ }
3137
+ if (badgeCount && badgeCount > 0) {
3138
+ return /*#__PURE__*/jsx(VStack, {
3139
+ alignItems: "center",
3140
+ justifyContent: "center",
3141
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3142
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3143
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3144
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3145
+ children: /*#__PURE__*/jsx(Typography.Text, {
3146
+ base: "body-xs",
3147
+ variant: "bold",
3148
+ color: "white",
3149
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3150
+ })
3151
+ });
3152
+ }
3153
+ return null;
3154
+ }
3155
+
3106
3156
  function Icon({
3107
3157
  icon,
3108
3158
  size = 'kitt.icon.defaultSize',
@@ -3228,6 +3278,8 @@ function ButtonContentChildren({
3228
3278
  icon,
3229
3279
  iconPosition,
3230
3280
  innerSpacing,
3281
+ withBadge,
3282
+ badgeCount,
3231
3283
  color,
3232
3284
  children
3233
3285
  }) {
@@ -3274,6 +3326,12 @@ function ButtonContentChildren({
3274
3326
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, {
3275
3327
  ...buttonIconSharedProps,
3276
3328
  icon: icon
3329
+ }) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3330
+ marginLeft: "kitt.2",
3331
+ children: /*#__PURE__*/jsx(ButtonBadge, {
3332
+ withBadge: withBadge,
3333
+ badgeCount: badgeCount
3334
+ })
3277
3335
  }) : null]
3278
3336
  });
3279
3337
  }
@@ -3418,6 +3476,8 @@ const Button = /*#__PURE__*/forwardRef(({
3418
3476
  testID,
3419
3477
  href,
3420
3478
  hrefAttrs,
3479
+ withBadge,
3480
+ badgeCount,
3421
3481
  accessibilityRole = 'button',
3422
3482
  innerSpacing = 'center',
3423
3483
  isHoveredInternal,
@@ -3486,6 +3546,8 @@ const Button = /*#__PURE__*/forwardRef(({
3486
3546
  isDisabled: disabled,
3487
3547
  icon: icon,
3488
3548
  iconPosition: iconPosition,
3549
+ withBadge: withBadge,
3550
+ badgeCount: badgeCount,
3489
3551
  isHovered: isHovered,
3490
3552
  isPressed: isPressed,
3491
3553
  isFocused: isFocused,
@@ -3539,6 +3601,8 @@ const ActionsItem = /*#__PURE__*/forwardRef(({
3539
3601
  }, ref) => {
3540
3602
  const [isLoading, setIsLoading] = useState(false);
3541
3603
  const mountedRef = useRef(false);
3604
+ // securing the loading state with a ref to avoid user action between rerenders
3605
+ const loadingRef = useRef(false);
3542
3606
 
3543
3607
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3544
3608
  useEffect(() => {
@@ -3556,15 +3620,18 @@ const ActionsItem = /*#__PURE__*/forwardRef(({
3556
3620
  icon: isLoading ? /*#__PURE__*/jsx(LoaderIcon, {}) : icon,
3557
3621
  onPress: e => {
3558
3622
  (async () => {
3559
- if (!onPress) return;
3623
+ if (!onPress || loadingRef.current) return;
3560
3624
  setIsLoading(true);
3625
+ loadingRef.current = true;
3561
3626
  try {
3562
3627
  await onPress(e);
3563
3628
  if (mountedRef.current) {
3564
3629
  setIsLoading(false);
3630
+ loadingRef.current = false;
3565
3631
  }
3566
3632
  } catch (error) {
3567
3633
  if (mountedRef.current) {
3634
+ loadingRef.current = false;
3568
3635
  setIsLoading(false);
3569
3636
  }
3570
3637
  throw error;
@@ -7629,7 +7696,7 @@ function IconButton({
7629
7696
  ariaLabel,
7630
7697
  accessibilityRole = 'button',
7631
7698
  withBadge,
7632
- bagdeCount,
7699
+ badgeCount,
7633
7700
  isHoveredInternal,
7634
7701
  isPressedInternal,
7635
7702
  isFocusedInternal,
@@ -7689,32 +7756,13 @@ function IconButton({
7689
7756
  icon: icon
7690
7757
  })
7691
7758
  })]
7692
- }), withBadge ? /*#__PURE__*/jsx(View, {
7693
- height: "10px",
7694
- width: "10px",
7695
- backgroundColor: lateOceanColorPalette['coral.10'],
7696
- borderRadius: "kitt.iconButton.borderRadius",
7697
- position: "absolute",
7698
- top: "1px",
7699
- right: "1px"
7700
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsx(View, {
7701
- height: "20px",
7702
- width: "20px",
7703
- backgroundColor: lateOceanColorPalette['coral.10'],
7704
- borderRadius: "kitt.iconButton.borderRadius",
7759
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
7705
7760
  position: "absolute",
7706
- top: "-6px",
7707
- right: "-6px",
7708
- children: /*#__PURE__*/jsx(View, {
7709
- alignItems: "center",
7710
- justifyContent: "center",
7711
- marginTop: "2px",
7712
- children: /*#__PURE__*/jsx(Typography.Text, {
7713
- base: "body-xs",
7714
- variant: "bold",
7715
- color: "white",
7716
- children: bagdeCount > 5 ? '+5' : bagdeCount
7717
- })
7761
+ top: withBadge ? '1px' : '-6px',
7762
+ right: withBadge ? '1px' : '-6px',
7763
+ children: /*#__PURE__*/jsx(ButtonBadge, {
7764
+ withBadge: withBadge,
7765
+ badgeCount: badgeCount
7718
7766
  })
7719
7767
  }) : null]
7720
7768
  });
@@ -8789,6 +8837,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8789
8837
  backgroundColor: theme.skeleton.backgroundColor,
8790
8838
  flareColor: theme.skeleton.flareColor
8791
8839
  },
8840
+ buttonBadge: {
8841
+ backgroundColor: theme.buttonBadge.backgroundColor
8842
+ },
8792
8843
  iconButton: {
8793
8844
  borderColor: theme.iconButton.borderColor,
8794
8845
  disabled: {
@@ -8977,6 +9028,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
8977
9028
  button: {
8978
9029
  borderRadius: theme.button.borderRadius
8979
9030
  },
9031
+ buttonBadge: {
9032
+ borderRadius: theme.buttonBadge.borderRadius
9033
+ },
8980
9034
  card: {
8981
9035
  borderRadius: theme.card.borderRadius
8982
9036
  },
@@ -9356,6 +9410,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9356
9410
  maxWidth: theme.button.maxWidth,
9357
9411
  minHeight: theme.button.minHeight
9358
9412
  },
9413
+ buttonBadge: {
9414
+ dimensions: {
9415
+ withBadge: {
9416
+ width: theme.buttonBadge.dimensions.withBadge.width,
9417
+ height: theme.buttonBadge.dimensions.withBadge.height
9418
+ },
9419
+ badgeCount: {
9420
+ width: theme.buttonBadge.dimensions.badgeCount.width,
9421
+ height: theme.buttonBadge.dimensions.badgeCount.height
9422
+ }
9423
+ }
9424
+ },
9359
9425
  icon: theme.icon,
9360
9426
  cardModal: {
9361
9427
  header: {
@@ -13069,5 +13135,5 @@ function VerticalSteps({
13069
13135
  VerticalSteps.Step = Step;
13070
13136
  VerticalSteps.BorderlessStep = BorderlessStep;
13071
13137
 
13072
- 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 };
13138
+ 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 };
13073
13139
  //# sourceMappingURL=index-node-20.10.es.web.mjs.map