@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,
@@ -3065,6 +3084,37 @@ Typography.h4 = createHeading(4, 'header4');
3065
3084
  /** @deprecated use Typography.Header6 */
3066
3085
  Typography.h5 = createHeading(5, 'header5');
3067
3086
 
3087
+ function ButtonBadge({
3088
+ withBadge,
3089
+ badgeCount
3090
+ }) {
3091
+ if (withBadge) {
3092
+ return /*#__PURE__*/jsx(View, {
3093
+ height: "kitt.buttonBadge.dimensions.withBadge.height",
3094
+ width: "kitt.buttonBadge.dimensions.withBadge.width",
3095
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3096
+ borderRadius: "kitt.buttonBadge.borderRadius.withBadge"
3097
+ });
3098
+ }
3099
+ if (badgeCount && badgeCount > 0) {
3100
+ return /*#__PURE__*/jsx(VStack, {
3101
+ alignItems: "center",
3102
+ justifyContent: "center",
3103
+ height: "kitt.buttonBadge.dimensions.badgeCount.height",
3104
+ width: "kitt.buttonBadge.dimensions.badgeCount.width",
3105
+ backgroundColor: "kitt.buttonBadge.backgroundColor",
3106
+ borderRadius: "kitt.buttonBadge.borderRadius.badgeCount",
3107
+ children: /*#__PURE__*/jsx(Typography.Text, {
3108
+ base: "body-xs",
3109
+ variant: "bold",
3110
+ color: "white",
3111
+ children: (badgeCount || 0) > 5 ? '+5' : badgeCount
3112
+ })
3113
+ });
3114
+ }
3115
+ return null;
3116
+ }
3117
+
3068
3118
  function Icon({
3069
3119
  icon,
3070
3120
  size = 'kitt.icon.defaultSize',
@@ -3189,6 +3239,8 @@ function ButtonContentChildren({
3189
3239
  icon,
3190
3240
  iconPosition,
3191
3241
  innerSpacing,
3242
+ withBadge,
3243
+ badgeCount,
3192
3244
  color,
3193
3245
  children
3194
3246
  }) {
@@ -3233,7 +3285,13 @@ function ButtonContentChildren({
3233
3285
  children: children
3234
3286
  }), icon && iconPosition === 'right' ? /*#__PURE__*/jsx(ButtonIcon, _objectSpread(_objectSpread({}, buttonIconSharedProps), {}, {
3235
3287
  icon: icon
3236
- })) : null]
3288
+ })) : null, withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
3289
+ marginLeft: "kitt.2",
3290
+ children: /*#__PURE__*/jsx(ButtonBadge, {
3291
+ withBadge: withBadge,
3292
+ badgeCount: badgeCount
3293
+ })
3294
+ }) : null]
3237
3295
  });
3238
3296
  }
3239
3297
  function ButtonContent(_ref) {
@@ -3417,6 +3475,8 @@ const Button = /*#__PURE__*/forwardRef(({
3417
3475
  testID,
3418
3476
  href,
3419
3477
  hrefAttrs,
3478
+ withBadge,
3479
+ badgeCount,
3420
3480
  accessibilityRole: _accessibilityRole = 'button',
3421
3481
  innerSpacing: _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,
@@ -3569,6 +3631,8 @@ const ActionsItem = /*#__PURE__*/forwardRef((_ref, ref) => {
3569
3631
  props = _objectWithoutProperties(_ref, _excluded$P);
3570
3632
  const [isLoading, setIsLoading] = useState(false);
3571
3633
  const mountedRef = useRef(false);
3634
+ // securing the loading state with a ref to avoid user action between rerenders
3635
+ const loadingRef = useRef(false);
3572
3636
 
3573
3637
  // effect just for tracking mounted state, as onPress can unmount the ActionButton
3574
3638
  useEffect(() => {
@@ -3586,15 +3650,18 @@ const ActionsItem = /*#__PURE__*/forwardRef((_ref, ref) => {
3586
3650
  icon: isLoading ? /*#__PURE__*/jsx(LoaderIcon, {}) : icon,
3587
3651
  onPress: e => {
3588
3652
  (async () => {
3589
- if (!onPress) return;
3653
+ if (!onPress || loadingRef.current) return;
3590
3654
  setIsLoading(true);
3655
+ loadingRef.current = true;
3591
3656
  try {
3592
3657
  await onPress(e);
3593
3658
  if (mountedRef.current) {
3594
3659
  setIsLoading(false);
3660
+ loadingRef.current = false;
3595
3661
  }
3596
3662
  } catch (error) {
3597
3663
  if (mountedRef.current) {
3664
+ loadingRef.current = false;
3598
3665
  setIsLoading(false);
3599
3666
  }
3600
3667
  throw error;
@@ -8501,7 +8568,7 @@ function IconButton({
8501
8568
  ariaLabel,
8502
8569
  accessibilityRole = 'button',
8503
8570
  withBadge,
8504
- bagdeCount,
8571
+ badgeCount,
8505
8572
  isHoveredInternal,
8506
8573
  isPressedInternal,
8507
8574
  isFocusedInternal,
@@ -8564,32 +8631,13 @@ function IconButton({
8564
8631
  icon: icon
8565
8632
  })
8566
8633
  })]
8567
- }), withBadge ? /*#__PURE__*/jsx(View, {
8568
- height: "10px",
8569
- width: "10px",
8570
- backgroundColor: lateOceanColorPalette['coral.10'],
8571
- borderRadius: "kitt.iconButton.borderRadius",
8572
- position: "absolute",
8573
- top: "1px",
8574
- right: "1px"
8575
- }) : null, !withBadge && bagdeCount && bagdeCount > 0 ? /*#__PURE__*/jsx(View, {
8576
- height: "20px",
8577
- width: "20px",
8578
- backgroundColor: lateOceanColorPalette['coral.10'],
8579
- borderRadius: "kitt.iconButton.borderRadius",
8634
+ }), withBadge || badgeCount && badgeCount > 0 ? /*#__PURE__*/jsx(View, {
8580
8635
  position: "absolute",
8581
- top: "-6px",
8582
- right: "-6px",
8583
- children: /*#__PURE__*/jsx(View, {
8584
- alignItems: "center",
8585
- justifyContent: "center",
8586
- marginTop: "2px",
8587
- children: /*#__PURE__*/jsx(Typography.Text, {
8588
- base: "body-xs",
8589
- variant: "bold",
8590
- color: "white",
8591
- children: bagdeCount > 5 ? '+5' : bagdeCount
8592
- })
8636
+ top: withBadge ? '1px' : '-6px',
8637
+ right: withBadge ? '1px' : '-6px',
8638
+ children: /*#__PURE__*/jsx(ButtonBadge, {
8639
+ withBadge: withBadge,
8640
+ badgeCount: badgeCount
8593
8641
  })
8594
8642
  }) : null]
8595
8643
  });
@@ -9580,6 +9628,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9580
9628
  backgroundColor: theme.skeleton.backgroundColor,
9581
9629
  flareColor: theme.skeleton.flareColor
9582
9630
  },
9631
+ buttonBadge: {
9632
+ backgroundColor: theme.buttonBadge.backgroundColor
9633
+ },
9583
9634
  iconButton: {
9584
9635
  borderColor: theme.iconButton.borderColor,
9585
9636
  disabled: {
@@ -9767,6 +9818,9 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9767
9818
  button: {
9768
9819
  borderRadius: theme.button.borderRadius
9769
9820
  },
9821
+ buttonBadge: {
9822
+ borderRadius: theme.buttonBadge.borderRadius
9823
+ },
9770
9824
  card: {
9771
9825
  borderRadius: theme.card.borderRadius
9772
9826
  },
@@ -10143,6 +10197,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10143
10197
  maxWidth: theme.button.maxWidth,
10144
10198
  minHeight: theme.button.minHeight
10145
10199
  },
10200
+ buttonBadge: {
10201
+ dimensions: {
10202
+ withBadge: {
10203
+ width: theme.buttonBadge.dimensions.withBadge.width,
10204
+ height: theme.buttonBadge.dimensions.withBadge.height
10205
+ },
10206
+ badgeCount: {
10207
+ width: theme.buttonBadge.dimensions.badgeCount.width,
10208
+ height: theme.buttonBadge.dimensions.badgeCount.height
10209
+ }
10210
+ }
10211
+ },
10146
10212
  icon: theme.icon,
10147
10213
  cardModal: {
10148
10214
  header: {
@@ -13982,5 +14048,5 @@ function VerticalSteps(_ref) {
13982
14048
  VerticalSteps.Step = Step;
13983
14049
  VerticalSteps.BorderlessStep = BorderlessStep;
13984
14050
 
13985
- 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 };
14051
+ 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 };
13986
14052
  //# sourceMappingURL=index-metro.es.ios.js.map