@ornikar/kitt-universal 25.45.4-canary.1fa8dd864c345808028f3e3165c5c7fcf9bc9e2a.0 → 25.46.1-canary.9950f4eb84cbfcf1d45de4e6c9ad226210c5404f.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 (37) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/dist/definitions/BottomSheet/BottomSheet.d.ts +3 -2
  3. package/dist/definitions/BottomSheet/BottomSheet.d.ts.map +1 -1
  4. package/dist/definitions/CardModal/CardModal.d.ts +3 -2
  5. package/dist/definitions/CardModal/CardModal.d.ts.map +1 -1
  6. package/dist/definitions/FullscreenModal/FullscreenModal.d.ts +3 -2
  7. package/dist/definitions/FullscreenModal/FullscreenModal.d.ts.map +1 -1
  8. package/dist/definitions/Tooltip/Tooltip.d.ts.map +1 -1
  9. package/dist/definitions/index.d.ts +1 -1
  10. package/dist/definitions/index.d.ts.map +1 -1
  11. package/dist/definitions/native-base/CurrentBreakpointContext.d.ts +19 -0
  12. package/dist/definitions/native-base/CurrentBreakpointContext.d.ts.map +1 -0
  13. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  14. package/dist/definitions/native-base/utils.d.ts +11 -12
  15. package/dist/definitions/native-base/utils.d.ts.map +1 -1
  16. package/dist/definitions/utils/windowSize/MatchWindowSize.d.ts +3 -2
  17. package/dist/definitions/utils/windowSize/MatchWindowSize.d.ts.map +1 -1
  18. package/dist/index-metro.es.android.js +173 -97
  19. package/dist/index-metro.es.android.js.map +1 -1
  20. package/dist/index-metro.es.ios.js +173 -97
  21. package/dist/index-metro.es.ios.js.map +1 -1
  22. package/dist/index-node-20.10.cjs.js +169 -93
  23. package/dist/index-node-20.10.cjs.js.map +1 -1
  24. package/dist/index-node-20.10.cjs.web.js +161 -82
  25. package/dist/index-node-20.10.cjs.web.js.map +1 -1
  26. package/dist/index-node-20.10.es.mjs +170 -95
  27. package/dist/index-node-20.10.es.mjs.map +1 -1
  28. package/dist/index-node-20.10.es.web.mjs +162 -84
  29. package/dist/index-node-20.10.es.web.mjs.map +1 -1
  30. package/dist/index.es.js +175 -95
  31. package/dist/index.es.js.map +1 -1
  32. package/dist/index.es.web.js +166 -85
  33. package/dist/index.es.web.js.map +1 -1
  34. package/dist/tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/dist/definitions/utils/windowSize/useCurrentBreakpointName.d.ts +0 -3
  37. package/dist/definitions/utils/windowSize/useCurrentBreakpointName.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import React, { useContext, createContext, forwardRef, cloneElement, useRef, useEffect, useState, useMemo, Children, useReducer, Fragment as Fragment$1, useCallback } from 'react';
1
+ import React, { useContext, createContext, forwardRef, useMemo, cloneElement, useRef, useEffect, useState, Children, useReducer, Fragment as Fragment$1, useCallback } from 'react';
2
2
  import { View as View$1, ScrollView as ScrollView$1, Pressable as Pressable$1, Image as Image$1, FlatList as FlatList$1, SectionList as SectionList$1, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, Center as Center$1, useBreakpointValue as useBreakpointValue$1, useSx, Text, Input, NativeBaseProvider, extendTheme, useMediaQuery } from 'native-base';
3
3
  export { useClipboard, useContrastText, useMediaQuery, useSx, useToken } from 'native-base';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -2685,8 +2685,129 @@ const VStack = VStack$1;
2685
2685
  const HStack = HStack$1;
2686
2686
  const Center = Center$1;
2687
2687
 
2688
+ const KittBreakpoints = {
2689
+ /**
2690
+ * min-width: 0
2691
+ */
2692
+ BASE: 0,
2693
+ /**
2694
+ * min-width: 480px
2695
+ */
2696
+ SMALL: 480,
2697
+ /**
2698
+ * min-width: 768px
2699
+ */
2700
+ MEDIUM: 768,
2701
+ /**
2702
+ * min-width: 1024px
2703
+ */
2704
+ LARGE: 1024,
2705
+ /**
2706
+ * min-width: 1280px
2707
+ */
2708
+ WIDE: 1280
2709
+ };
2710
+ const KittBreakpointsMax = {
2711
+ /**
2712
+ * max-width: 479px
2713
+ */
2714
+ BASE: KittBreakpoints.SMALL - 1,
2715
+ /**
2716
+ * max-width: 767px
2717
+ */
2718
+ SMALL: KittBreakpoints.MEDIUM - 1,
2719
+ /**
2720
+ * max-width: 1023px
2721
+ */
2722
+ MEDIUM: KittBreakpoints.LARGE - 1,
2723
+ /**
2724
+ * max-width: 1279px
2725
+ */
2726
+ LARGE: KittBreakpoints.WIDE - 1
2727
+ };
2728
+ let KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2729
+ KittBreakpointNameEnum["BASE"] = "base";
2730
+ KittBreakpointNameEnum["SMALL"] = "small";
2731
+ KittBreakpointNameEnum["MEDIUM"] = "medium";
2732
+ KittBreakpointNameEnum["LARGE"] = "large";
2733
+ KittBreakpointNameEnum["WIDE"] = "wide";
2734
+ return KittBreakpointNameEnum;
2735
+ }({});
2736
+
2688
2737
  // eslint-disable-next-line no-restricted-imports
2689
- const useBreakpointValue = useBreakpointValue$1;
2738
+ const CurrentBreakpointContext = /*#__PURE__*/createContext(undefined);
2739
+ /**
2740
+ * Provider that uses the native-base breakpoint system to detect the current viewport size and maps it to Kitt's breakpoint names.
2741
+ */
2742
+ function CurrentBreakpointProvider({
2743
+ children
2744
+ }) {
2745
+ const breakpoint = useBreakpointValue$1({
2746
+ base: KittBreakpointNameEnum.BASE,
2747
+ small: KittBreakpointNameEnum.SMALL,
2748
+ medium: KittBreakpointNameEnum.MEDIUM,
2749
+ large: KittBreakpointNameEnum.LARGE,
2750
+ wide: KittBreakpointNameEnum.WIDE
2751
+ });
2752
+ const value = useMemo(() => ({
2753
+ breakpoint
2754
+ }), [breakpoint]);
2755
+ return /*#__PURE__*/jsx(CurrentBreakpointContext.Provider, {
2756
+ value: value,
2757
+ children: children
2758
+ });
2759
+ }
2760
+
2761
+ /**
2762
+ * React hook that provides information about the current breakpoint.
2763
+ * Unlike the native-base counterpart, this hook does not trigger a re-render on every viewport size change.
2764
+ */
2765
+ function useCurrentBreakpointName() {
2766
+ const context = useContext(CurrentBreakpointContext);
2767
+ if (context === undefined) {
2768
+ throw new Error('useCurrentBreakpoint must be used within an CurrentBreakpointProvider');
2769
+ }
2770
+ return context;
2771
+ }
2772
+
2773
+ /**
2774
+ * Retrieves the appropriate value for the given breakpoint with fallback to smaller breakpoints.
2775
+ * Mimics Native Base's logic.
2776
+ */
2777
+ function getValueForBreakpoint(breakpoint, {
2778
+ base,
2779
+ small,
2780
+ medium,
2781
+ large,
2782
+ wide
2783
+ }) {
2784
+ switch (breakpoint) {
2785
+ case KittBreakpointNameEnum.WIDE:
2786
+ return wide ?? large ?? medium ?? small ?? base;
2787
+ case KittBreakpointNameEnum.LARGE:
2788
+ return large ?? medium ?? small ?? base;
2789
+ case KittBreakpointNameEnum.MEDIUM:
2790
+ return medium ?? small ?? base;
2791
+ case KittBreakpointNameEnum.SMALL:
2792
+ return small ?? base;
2793
+ case KittBreakpointNameEnum.BASE:
2794
+ default:
2795
+ return base;
2796
+ }
2797
+ }
2798
+
2799
+ /**
2800
+ * A hook that returns a value based on the current breakpoint.
2801
+ * Mimics the behavior of Native Base's useBreakpointValue, but uses our custom context for better performance.
2802
+ */
2803
+ function useBreakpointValue(values) {
2804
+ const {
2805
+ breakpoint
2806
+ } = useCurrentBreakpointName();
2807
+ return useMemo(() => {
2808
+ return getValueForBreakpoint(breakpoint, values);
2809
+ }, [breakpoint, values]);
2810
+ }
2690
2811
 
2691
2812
  function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valueIfFalse) {
2692
2813
  // Handles simple boolean values
@@ -2758,55 +2879,6 @@ function AnimatedContainer$2({
2758
2879
  });
2759
2880
  }
2760
2881
 
2761
- const KittBreakpoints = {
2762
- /**
2763
- * min-width: 0
2764
- */
2765
- BASE: 0,
2766
- /**
2767
- * min-width: 480px
2768
- */
2769
- SMALL: 480,
2770
- /**
2771
- * min-width: 768px
2772
- */
2773
- MEDIUM: 768,
2774
- /**
2775
- * min-width: 1024px
2776
- */
2777
- LARGE: 1024,
2778
- /**
2779
- * min-width: 1280px
2780
- */
2781
- WIDE: 1280
2782
- };
2783
- const KittBreakpointsMax = {
2784
- /**
2785
- * max-width: 479px
2786
- */
2787
- BASE: KittBreakpoints.SMALL - 1,
2788
- /**
2789
- * max-width: 767px
2790
- */
2791
- SMALL: KittBreakpoints.MEDIUM - 1,
2792
- /**
2793
- * max-width: 1023px
2794
- */
2795
- MEDIUM: KittBreakpoints.LARGE - 1,
2796
- /**
2797
- * max-width: 1279px
2798
- */
2799
- LARGE: KittBreakpoints.WIDE - 1
2800
- };
2801
- let KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2802
- KittBreakpointNameEnum["BASE"] = "base";
2803
- KittBreakpointNameEnum["SMALL"] = "small";
2804
- KittBreakpointNameEnum["MEDIUM"] = "medium";
2805
- KittBreakpointNameEnum["LARGE"] = "large";
2806
- KittBreakpointNameEnum["WIDE"] = "wide";
2807
- return KittBreakpointNameEnum;
2808
- }({});
2809
-
2810
2882
  const typographyColors = ['black', 'black-anthracite', 'black-disabled', 'black-light', 'white', 'white-light', 'primary', 'primary-light', 'accent', 'success', 'danger', 'warning'];
2811
2883
 
2812
2884
  function getNBThemeColorFromColorProps(colorName) {
@@ -3736,6 +3808,9 @@ function BottomSheetComp({
3736
3808
  hasHandle = true,
3737
3809
  enableDynamicSizing = true,
3738
3810
  snapPoints = ['100%'],
3811
+ contentContainer: ContentContainer = ({
3812
+ children
3813
+ }) => children,
3739
3814
  ...rest
3740
3815
  }, ref) {
3741
3816
  const {
@@ -3766,9 +3841,11 @@ function BottomSheetComp({
3766
3841
  ...rest,
3767
3842
  topInset: top,
3768
3843
  children: props => /*#__PURE__*/jsx(Wrapper, {
3769
- children: typeof Content === 'function' ? /*#__PURE__*/jsx(Content, {
3770
- ...props?.data
3771
- }) : Content
3844
+ children: /*#__PURE__*/jsx(ContentContainer, {
3845
+ children: typeof Content === 'function' ? /*#__PURE__*/jsx(Content, {
3846
+ ...props?.data
3847
+ }) : Content
3848
+ })
3772
3849
  })
3773
3850
  });
3774
3851
  }
@@ -4171,6 +4248,9 @@ function CardModal({
4171
4248
  header,
4172
4249
  body,
4173
4250
  footer,
4251
+ contentContainer: ContentContainer = ({
4252
+ children: originalChildren
4253
+ }) => originalChildren,
4174
4254
  ...props
4175
4255
  }) {
4176
4256
  return /*#__PURE__*/jsx(View, {
@@ -4183,8 +4263,10 @@ function CardModal({
4183
4263
  maxHeight: "100%",
4184
4264
  maxWidth: maxWidth,
4185
4265
  minHeight: "kitt.cardModal.minHeight",
4186
- children: children || /*#__PURE__*/jsxs(Fragment, {
4187
- children: [header || null, body || null, footer || null]
4266
+ children: /*#__PURE__*/jsx(ContentContainer, {
4267
+ children: children || /*#__PURE__*/jsxs(Fragment, {
4268
+ children: [header || null, body || null, footer || null]
4269
+ })
4188
4270
  })
4189
4271
  });
4190
4272
  }
@@ -7963,25 +8045,30 @@ function FullscreenModal({
7963
8045
  body,
7964
8046
  header,
7965
8047
  footer,
7966
- backgroundColor
8048
+ backgroundColor,
8049
+ contentContainer: ContentContainer = ({
8050
+ children
8051
+ }) => children
7967
8052
  }) {
7968
- return /*#__PURE__*/jsxs(FullscreenModalContainer, {
8053
+ return /*#__PURE__*/jsx(FullscreenModalContainer, {
7969
8054
  backgroundColor: backgroundColor,
7970
- children: [header ? /*#__PURE__*/jsx(View, {
7971
- children: header
7972
- }) : null, /*#__PURE__*/jsxs(View, {
7973
- flexGrow: 1,
7974
- flexShrink: 1,
7975
- justifyContent: "space-between",
7976
- children: [/*#__PURE__*/jsx(ScrollView$2, {
7977
- bounces: false,
7978
- contentContainerStyle: {
7979
- flexGrow: 1,
7980
- position: 'relative'
7981
- },
7982
- children: body
7983
- }), footer || null]
7984
- })]
8055
+ children: /*#__PURE__*/jsxs(ContentContainer, {
8056
+ children: [header ? /*#__PURE__*/jsx(View, {
8057
+ children: header
8058
+ }) : null, /*#__PURE__*/jsxs(View, {
8059
+ flexGrow: 1,
8060
+ flexShrink: 1,
8061
+ justifyContent: "space-between",
8062
+ children: [/*#__PURE__*/jsx(ScrollView$2, {
8063
+ bounces: false,
8064
+ contentContainerStyle: {
8065
+ flexGrow: 1,
8066
+ position: 'relative'
8067
+ },
8068
+ children: body
8069
+ }), footer || null]
8070
+ })]
8071
+ })
7985
8072
  });
7986
8073
  }
7987
8074
  FullscreenModal.Header = FullscreenModalHeader;
@@ -11350,7 +11437,9 @@ function KittNativeBaseProvider({
11350
11437
  isSSR: isSSR,
11351
11438
  children: /*#__PURE__*/jsx(KittThemeContext.Provider, {
11352
11439
  value: kittInternalTheme,
11353
- children: children
11440
+ children: /*#__PURE__*/jsx(CurrentBreakpointProvider, {
11441
+ children: children
11442
+ })
11354
11443
  })
11355
11444
  });
11356
11445
  }
@@ -13265,13 +13354,6 @@ function Tooltip({
13265
13354
  });
13266
13355
  const tooltipY = Math.round(y ?? 0) || 0;
13267
13356
  const tooltipX = Math.round(x ?? 0) || 0;
13268
- console.log({
13269
- tooltipY,
13270
- tooltipX,
13271
- placement,
13272
- currentFloatingPadding,
13273
- floatingWidth
13274
- });
13275
13357
  useEffect(() => {
13276
13358
  if (!onUpdate) return;
13277
13359
  onUpdate({
@@ -13307,7 +13389,6 @@ function Tooltip({
13307
13389
  children: renderPressable({
13308
13390
  ref: getPressableRect,
13309
13391
  onPress: () => {
13310
- console.log('handlePress', pressed.value);
13311
13392
  if (onToggle) onToggle(!!pressed.value);
13312
13393
  pressed.value = !pressed.value;
13313
13394
  },
@@ -13560,21 +13641,15 @@ function MatchWindowSize({
13560
13641
  }
13561
13642
  /**
13562
13643
  * Display based on current breakpoint
13644
+ * Mimics the behavior of Native Base's SwitchBreakpoints, but uses our custom context for better performance.
13563
13645
  *
13564
13646
  * WARNING: Currently not SSR friendly (but could be).
13565
13647
  */
13566
- function SwitchBreakpoints(breakpoints) {
13567
- return useBreakpointValue(breakpoints);
13568
- }
13569
-
13570
- function useCurrentBreakpointName() {
13571
- return useBreakpointValue({
13572
- base: KittBreakpointNameEnum.BASE,
13573
- small: KittBreakpointNameEnum.SMALL,
13574
- medium: KittBreakpointNameEnum.MEDIUM,
13575
- large: KittBreakpointNameEnum.LARGE,
13576
- wide: KittBreakpointNameEnum.WIDE
13577
- });
13648
+ function SwitchBreakpoints(values) {
13649
+ const {
13650
+ breakpoint
13651
+ } = useCurrentBreakpointName();
13652
+ return getValueForBreakpoint(breakpoint, values);
13578
13653
  }
13579
13654
 
13580
13655
  function useStepAnimations({
@@ -13835,5 +13910,5 @@ function VerticalSteps({
13835
13910
  VerticalSteps.Step = Step;
13836
13911
  VerticalSteps.BorderlessStep = BorderlessStep;
13837
13912
 
13838
- 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, hex2rgba, matchWindowSize, storyPadding, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useOpenExternalLink, useStaticBottomSheet, useStoryBlockColor, useTheme };
13913
+ 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 };
13839
13914
  //# sourceMappingURL=index-node-20.10.es.mjs.map