@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
@@ -784,6 +784,24 @@ const button = {
784
784
  }
785
785
  };
786
786
 
787
+ const buttonBadge = {
788
+ backgroundColor: lateOceanColorPalette['coral.10'],
789
+ dimensions: {
790
+ withBadge: {
791
+ width: 10,
792
+ height: 10
793
+ },
794
+ badgeCount: {
795
+ width: 20,
796
+ height: 20
797
+ }
798
+ },
799
+ borderRadius: {
800
+ withBadge: 5,
801
+ badgeCount: 10
802
+ }
803
+ };
804
+
787
805
  const card = {
788
806
  borderRadius: 20,
789
807
  borderWidth: 2,
@@ -2499,6 +2517,7 @@ const theme = {
2499
2517
  forms,
2500
2518
  highlight,
2501
2519
  icon,
2520
+ buttonBadge,
2502
2521
  iconButton,
2503
2522
  listItem,
2504
2523
  pageLoader,
@@ -3063,6 +3082,37 @@ Typography.h4 = createHeading(4, 'header4');
3063
3082
  /** @deprecated use Typography.Header6 */
3064
3083
  Typography.h5 = createHeading(5, 'header5');
3065
3084
 
3085
+ function ButtonBadge({
3086
+ withBadge,
3087
+ badgeCount
3088
+ }) {
3089
+ if (withBadge) {
3090
+ return /*#__PURE__*/jsx(View, {
3091
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3092
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3093
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3094
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3095
+ });
3096
+ }
3097
+ if (badgeCount && badgeCount > 0) {
3098
+ return /*#__PURE__*/jsx(VStack, {
3099
+ alignItems: "center",
3100
+ justifyContent: "center",
3101
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3102
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3103
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3104
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3105
+ children: /*#__PURE__*/jsx(Typography.Text, {
3106
+ base: "body-xs",
3107
+ variant: "bold",
3108
+ color: "white",
3109
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3110
+ })
3111
+ });
3112
+ }
3113
+ return null;
3114
+ }
3115
+
3066
3116
  function Icon({
3067
3117
  icon,
3068
3118
  size = 'kitt.icon.defaultSize',
@@ -3188,6 +3238,8 @@ function ButtonContentChildren({
3188
3238
  icon,
3189
3239
  iconPosition,
3190
3240
  innerSpacing,
3241
+ withBadge,
3242
+ badgeCount,
3191
3243
  color,
3192
3244
  children
3193
3245
  }) {
@@ -3234,6 +3286,12 @@ function ButtonContentChildren({
3234
3286
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, {
3235
3287
  ...buttonIconSharedProps,
3236
3288
  icon: icon
3289
+ }) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3290
+ marginLeft: "kitt.2",
3291
+ children: /*#__PURE__*/jsx(ButtonBadge, {
3292
+ withBadge: withBadge,
3293
+ badgeCount: badgeCount
3294
+ })
3237
3295
  }) : null]
3238
3296
  });
3239
3297
  }
@@ -3417,6 +3475,8 @@ const Button = /*#__PURE__*/forwardRef(({
3417
3475
  testID,
3418
3476
  href,
3419
3477
  hrefAttrs,
3478
+ withBadge,
3479
+ badgeCount,
3420
3480
  accessibilityRole = 'button',
3421
3481
  innerSpacing = 'center',
3422
3482
  isHoveredInternal,
@@ -3488,6 +3548,8 @@ const Button = /*#__PURE__*/forwardRef(({
3488
3548
  isDisabled: disabled,
3489
3549
  icon: icon,
3490
3550
  iconPosition: iconPosition,
3551
+ withBadge: withBadge,
3552
+ badgeCount: badgeCount,
3491
3553
  isHovered: isHovered,
3492
3554
  isPressed: isPressed,
3493
3555
  isFocused: isFocused,
@@ -3567,6 +3629,8 @@ const ActionsItem = /*#__PURE__*/forwardRef(({
3567
3629
  }, ref) => {
3568
3630
  const [isLoading, setIsLoading] = useState(false);
3569
3631
  const mountedRef = useRef(false);
3632
+ // securing the loading state with a ref to avoid user action between rerenders
3633
+ const loadingRef = useRef(false);
3570
3634
 
3571
3635
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3572
3636
  useEffect(() => {
@@ -3584,15 +3648,18 @@ const ActionsItem = /*#__PURE__*/forwardRef(({
3584
3648
  icon: isLoading ? /*#__PURE__*/jsx(LoaderIcon, {}) : icon,
3585
3649
  onPress: e => {
3586
3650
  (async () => {
3587
- if (!onPress) return;
3651
+ if (!onPress || loadingRef.current) return;
3588
3652
  setIsLoading(true);
3653
+ loadingRef.current = true;
3589
3654
  try {
3590
3655
  await onPress(e);
3591
3656
  if (mountedRef.current) {
3592
3657
  setIsLoading(false);
3658
+ loadingRef.current = false;
3593
3659
  }
3594
3660
  } catch (error) {
3595
3661
  if (mountedRef.current) {
3662
+ loadingRef.current = false;
3596
3663
  setIsLoading(false);
3597
3664
  }
3598
3665
  throw error;
@@ -8471,7 +8538,7 @@ function IconButton({
8471
8538
  ariaLabel,
8472
8539
  accessibilityRole = 'button',
8473
8540
  withBadge,
8474
- bagdeCount,
8541
+ badgeCount,
8475
8542
  isHoveredInternal,
8476
8543
  isPressedInternal,
8477
8544
  isFocusedInternal,
@@ -8534,32 +8601,13 @@ function IconButton({
8534
8601
  icon: icon
8535
8602
  })
8536
8603
  })]
8537
- }), withBadge ? /*#__PURE__*/jsx(View, {
8538
- height: "10px",
8539
- width: "10px",
8540
- backgroundColor: lateOceanColorPalette['coral.10'],
8541
- borderRadius: "kitt.iconButton.borderRadius",
8604
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
8542
8605
  position: "absolute",
8543
- top: "1px",
8544
- right: "1px"
8545
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsx(View, {
8546
- height: "20px",
8547
- width: "20px",
8548
- backgroundColor: lateOceanColorPalette['coral.10'],
8549
- borderRadius: "kitt.iconButton.borderRadius",
8550
- position: "absolute",
8551
- top: "-6px",
8552
- right: "-6px",
8553
- children: /*#__PURE__*/jsx(View, {
8554
- alignItems: "center",
8555
- justifyContent: "center",
8556
- marginTop: "2px",
8557
- children: /*#__PURE__*/jsx(Typography.Text, {
8558
- base: "body-xs",
8559
- variant: "bold",
8560
- color: "white",
8561
- children: bagdeCount > 5 ? '+5' : bagdeCount
8562
- })
8606
+ top: withBadge ? '1px' : '-6px',
8607
+ right: withBadge ? '1px' : '-6px',
8608
+ children: /*#__PURE__*/jsx(ButtonBadge, {
8609
+ withBadge: withBadge,
8610
+ badgeCount: badgeCount
8563
8611
  })
8564
8612
  }) : null]
8565
8613
  });
@@ -9551,6 +9599,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9551
9599
  backgroundColor: theme.skeleton.backgroundColor,
9552
9600
  flareColor: theme.skeleton.flareColor
9553
9601
  },
9602
+ buttonBadge: {
9603
+ backgroundColor: theme.buttonBadge.backgroundColor
9604
+ },
9554
9605
  iconButton: {
9555
9606
  borderColor: theme.iconButton.borderColor,
9556
9607
  disabled: {
@@ -9739,6 +9790,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9739
9790
  button: {
9740
9791
  borderRadius: theme.button.borderRadius
9741
9792
  },
9793
+ buttonBadge: {
9794
+ borderRadius: theme.buttonBadge.borderRadius
9795
+ },
9742
9796
  card: {
9743
9797
  borderRadius: theme.card.borderRadius
9744
9798
  },
@@ -10118,6 +10172,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10118
10172
  maxWidth: theme.button.maxWidth,
10119
10173
  minHeight: theme.button.minHeight
10120
10174
  },
10175
+ buttonBadge: {
10176
+ dimensions: {
10177
+ withBadge: {
10178
+ width: theme.buttonBadge.dimensions.withBadge.width,
10179
+ height: theme.buttonBadge.dimensions.withBadge.height
10180
+ },
10181
+ badgeCount: {
10182
+ width: theme.buttonBadge.dimensions.badgeCount.width,
10183
+ height: theme.buttonBadge.dimensions.badgeCount.height
10184
+ }
10185
+ }
10186
+ },
10121
10187
  icon: theme.icon,
10122
10188
  cardModal: {
10123
10189
  header: {
@@ -13946,5 +14012,5 @@ function VerticalSteps({
13946
14012
  VerticalSteps.Step = Step;
13947
14013
  VerticalSteps.BorderlessStep = BorderlessStep;
13948
14014
 
13949
- 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 };
14015
+ 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 };
13950
14016
  //# sourceMappingURL=index-node-20.10.es.mjs.map