@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 { useContext, createContext, forwardRef, cloneElement, useState, useRef, useEffect, useMemo, Children, useReducer, useCallback, Fragment as Fragment$1 } from 'react';
1
+ import { useContext, createContext, forwardRef, useMemo, cloneElement, useState, useRef, useEffect, Children, useReducer, useCallback, Fragment as Fragment$1 } 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 } from 'native-base';
3
3
  export { useClipboard, useContrastText, useMediaQuery, useSx, useToken } from 'native-base';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -2681,8 +2681,129 @@ const VStack = VStack$1;
2681
2681
  const HStack = HStack$1;
2682
2682
  const Center = Center$1;
2683
2683
 
2684
+ const KittBreakpoints = {
2685
+ /**
2686
+ * min-width: 0
2687
+ */
2688
+ BASE: 0,
2689
+ /**
2690
+ * min-width: 480px
2691
+ */
2692
+ SMALL: 480,
2693
+ /**
2694
+ * min-width: 768px
2695
+ */
2696
+ MEDIUM: 768,
2697
+ /**
2698
+ * min-width: 1024px
2699
+ */
2700
+ LARGE: 1024,
2701
+ /**
2702
+ * min-width: 1280px
2703
+ */
2704
+ WIDE: 1280
2705
+ };
2706
+ const KittBreakpointsMax = {
2707
+ /**
2708
+ * max-width: 479px
2709
+ */
2710
+ BASE: KittBreakpoints.SMALL - 1,
2711
+ /**
2712
+ * max-width: 767px
2713
+ */
2714
+ SMALL: KittBreakpoints.MEDIUM - 1,
2715
+ /**
2716
+ * max-width: 1023px
2717
+ */
2718
+ MEDIUM: KittBreakpoints.LARGE - 1,
2719
+ /**
2720
+ * max-width: 1279px
2721
+ */
2722
+ LARGE: KittBreakpoints.WIDE - 1
2723
+ };
2724
+ let KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2725
+ KittBreakpointNameEnum["BASE"] = "base";
2726
+ KittBreakpointNameEnum["SMALL"] = "small";
2727
+ KittBreakpointNameEnum["MEDIUM"] = "medium";
2728
+ KittBreakpointNameEnum["LARGE"] = "large";
2729
+ KittBreakpointNameEnum["WIDE"] = "wide";
2730
+ return KittBreakpointNameEnum;
2731
+ }({});
2732
+
2684
2733
  // eslint-disable-next-line no-restricted-imports
2685
- const useBreakpointValue = useBreakpointValue$1;
2734
+ const CurrentBreakpointContext = /*#__PURE__*/createContext(undefined);
2735
+ /**
2736
+ * Provider that uses the native-base breakpoint system to detect the current viewport size and maps it to Kitt's breakpoint names.
2737
+ */
2738
+ function CurrentBreakpointProvider({
2739
+ children
2740
+ }) {
2741
+ const breakpoint = useBreakpointValue$1({
2742
+ base: KittBreakpointNameEnum.BASE,
2743
+ small: KittBreakpointNameEnum.SMALL,
2744
+ medium: KittBreakpointNameEnum.MEDIUM,
2745
+ large: KittBreakpointNameEnum.LARGE,
2746
+ wide: KittBreakpointNameEnum.WIDE
2747
+ });
2748
+ const value = useMemo(() => ({
2749
+ breakpoint
2750
+ }), [breakpoint]);
2751
+ return /*#__PURE__*/jsx(CurrentBreakpointContext.Provider, {
2752
+ value: value,
2753
+ children: children
2754
+ });
2755
+ }
2756
+
2757
+ /**
2758
+ * React hook that provides information about the current breakpoint.
2759
+ * Unlike the native-base counterpart, this hook does not trigger a re-render on every viewport size change.
2760
+ */
2761
+ function useCurrentBreakpointName() {
2762
+ const context = useContext(CurrentBreakpointContext);
2763
+ if (context === undefined) {
2764
+ throw new Error('useCurrentBreakpoint must be used within an CurrentBreakpointProvider');
2765
+ }
2766
+ return context;
2767
+ }
2768
+
2769
+ /**
2770
+ * Retrieves the appropriate value for the given breakpoint with fallback to smaller breakpoints.
2771
+ * Mimics Native Base's logic.
2772
+ */
2773
+ function getValueForBreakpoint(breakpoint, {
2774
+ base,
2775
+ small,
2776
+ medium,
2777
+ large,
2778
+ wide
2779
+ }) {
2780
+ switch (breakpoint) {
2781
+ case KittBreakpointNameEnum.WIDE:
2782
+ return wide ?? large ?? medium ?? small ?? base;
2783
+ case KittBreakpointNameEnum.LARGE:
2784
+ return large ?? medium ?? small ?? base;
2785
+ case KittBreakpointNameEnum.MEDIUM:
2786
+ return medium ?? small ?? base;
2787
+ case KittBreakpointNameEnum.SMALL:
2788
+ return small ?? base;
2789
+ case KittBreakpointNameEnum.BASE:
2790
+ default:
2791
+ return base;
2792
+ }
2793
+ }
2794
+
2795
+ /**
2796
+ * A hook that returns a value based on the current breakpoint.
2797
+ * Mimics the behavior of Native Base's useBreakpointValue, but uses our custom context for better performance.
2798
+ */
2799
+ function useBreakpointValue(values) {
2800
+ const {
2801
+ breakpoint
2802
+ } = useCurrentBreakpointName();
2803
+ return useMemo(() => {
2804
+ return getValueForBreakpoint(breakpoint, values);
2805
+ }, [breakpoint, values]);
2806
+ }
2686
2807
 
2687
2808
  function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valueIfFalse) {
2688
2809
  // Handles simple boolean values
@@ -2798,55 +2919,6 @@ function AnimatedContainer$2({
2798
2919
  });
2799
2920
  }
2800
2921
 
2801
- const KittBreakpoints = {
2802
- /**
2803
- * min-width: 0
2804
- */
2805
- BASE: 0,
2806
- /**
2807
- * min-width: 480px
2808
- */
2809
- SMALL: 480,
2810
- /**
2811
- * min-width: 768px
2812
- */
2813
- MEDIUM: 768,
2814
- /**
2815
- * min-width: 1024px
2816
- */
2817
- LARGE: 1024,
2818
- /**
2819
- * min-width: 1280px
2820
- */
2821
- WIDE: 1280
2822
- };
2823
- const KittBreakpointsMax = {
2824
- /**
2825
- * max-width: 479px
2826
- */
2827
- BASE: KittBreakpoints.SMALL - 1,
2828
- /**
2829
- * max-width: 767px
2830
- */
2831
- SMALL: KittBreakpoints.MEDIUM - 1,
2832
- /**
2833
- * max-width: 1023px
2834
- */
2835
- MEDIUM: KittBreakpoints.LARGE - 1,
2836
- /**
2837
- * max-width: 1279px
2838
- */
2839
- LARGE: KittBreakpoints.WIDE - 1
2840
- };
2841
- let KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2842
- KittBreakpointNameEnum["BASE"] = "base";
2843
- KittBreakpointNameEnum["SMALL"] = "small";
2844
- KittBreakpointNameEnum["MEDIUM"] = "medium";
2845
- KittBreakpointNameEnum["LARGE"] = "large";
2846
- KittBreakpointNameEnum["WIDE"] = "wide";
2847
- return KittBreakpointNameEnum;
2848
- }({});
2849
-
2850
2922
  const typographyColors = ['black', 'black-anthracite', 'black-disabled', 'black-light', 'white', 'white-light', 'primary', 'primary-light', 'accent', 'success', 'danger', 'warning'];
2851
2923
 
2852
2924
  function getNBThemeColorFromColorProps(colorName) {
@@ -4050,6 +4122,9 @@ function CardModal({
4050
4122
  header,
4051
4123
  body,
4052
4124
  footer,
4125
+ contentContainer: ContentContainer = ({
4126
+ children: originalChildren
4127
+ }) => originalChildren,
4053
4128
  ...props
4054
4129
  }) {
4055
4130
  return /*#__PURE__*/jsx(View, {
@@ -4062,8 +4137,10 @@ function CardModal({
4062
4137
  maxHeight: "100%",
4063
4138
  maxWidth: maxWidth,
4064
4139
  minHeight: "kitt.cardModal.minHeight",
4065
- children: children || /*#__PURE__*/jsxs(Fragment, {
4066
- children: [header || null, body || null, footer || null]
4140
+ children: /*#__PURE__*/jsx(ContentContainer, {
4141
+ children: children || /*#__PURE__*/jsxs(Fragment, {
4142
+ children: [header || null, body || null, footer || null]
4143
+ })
4067
4144
  })
4068
4145
  });
4069
4146
  }
@@ -7137,25 +7214,30 @@ function FullscreenModal({
7137
7214
  body,
7138
7215
  header,
7139
7216
  footer,
7140
- backgroundColor
7217
+ backgroundColor,
7218
+ contentContainer: ContentContainer = ({
7219
+ children
7220
+ }) => children
7141
7221
  }) {
7142
- return /*#__PURE__*/jsxs(FullscreenModalContainer, {
7222
+ return /*#__PURE__*/jsx(FullscreenModalContainer, {
7143
7223
  backgroundColor: backgroundColor,
7144
- children: [header ? /*#__PURE__*/jsx(View, {
7145
- children: header
7146
- }) : null, /*#__PURE__*/jsxs(View, {
7147
- flexGrow: 1,
7148
- flexShrink: 1,
7149
- justifyContent: "space-between",
7150
- children: [/*#__PURE__*/jsx(ScrollView$2, {
7151
- bounces: false,
7152
- contentContainerStyle: {
7153
- flexGrow: 1,
7154
- position: 'relative'
7155
- },
7156
- children: body
7157
- }), footer || null]
7158
- })]
7224
+ children: /*#__PURE__*/jsxs(ContentContainer, {
7225
+ children: [header ? /*#__PURE__*/jsx(View, {
7226
+ children: header
7227
+ }) : null, /*#__PURE__*/jsxs(View, {
7228
+ flexGrow: 1,
7229
+ flexShrink: 1,
7230
+ justifyContent: "space-between",
7231
+ children: [/*#__PURE__*/jsx(ScrollView$2, {
7232
+ bounces: false,
7233
+ contentContainerStyle: {
7234
+ flexGrow: 1,
7235
+ position: 'relative'
7236
+ },
7237
+ children: body
7238
+ }), footer || null]
7239
+ })]
7240
+ })
7159
7241
  });
7160
7242
  }
7161
7243
  FullscreenModal.Header = FullscreenModalHeader;
@@ -10588,7 +10670,9 @@ function KittNativeBaseProvider({
10588
10670
  isSSR: isSSR,
10589
10671
  children: /*#__PURE__*/jsx(KittThemeContext.Provider, {
10590
10672
  value: kittInternalTheme,
10591
- children: children
10673
+ children: /*#__PURE__*/jsx(CurrentBreakpointProvider, {
10674
+ children: children
10675
+ })
10592
10676
  })
10593
10677
  });
10594
10678
  }
@@ -12680,21 +12764,15 @@ function MatchWindowSize({
12680
12764
  }
12681
12765
  /**
12682
12766
  * Display based on current breakpoint
12767
+ * Mimics the behavior of Native Base's SwitchBreakpoints, but uses our custom context for better performance.
12683
12768
  *
12684
12769
  * WARNING: Currently not SSR friendly (but could be).
12685
12770
  */
12686
- function SwitchBreakpoints(breakpoints) {
12687
- return useBreakpointValue(breakpoints);
12688
- }
12689
-
12690
- function useCurrentBreakpointName() {
12691
- return useBreakpointValue({
12692
- base: KittBreakpointNameEnum.BASE,
12693
- small: KittBreakpointNameEnum.SMALL,
12694
- medium: KittBreakpointNameEnum.MEDIUM,
12695
- large: KittBreakpointNameEnum.LARGE,
12696
- wide: KittBreakpointNameEnum.WIDE
12697
- });
12771
+ function SwitchBreakpoints(values) {
12772
+ const {
12773
+ breakpoint
12774
+ } = useCurrentBreakpointName();
12775
+ return getValueForBreakpoint(breakpoint, values);
12698
12776
  }
12699
12777
 
12700
12778
  function useStepAnimations({
@@ -12955,5 +13033,5 @@ function VerticalSteps({
12955
13033
  VerticalSteps.Step = Step;
12956
13034
  VerticalSteps.BorderlessStep = BorderlessStep;
12957
13035
 
12958
- 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, hex2rgba, matchWindowSize, storyPadding, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useOpenExternalLink, useStaticBottomSheet, useStoryBlockColor, useTheme };
13036
+ 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 };
12959
13037
  //# sourceMappingURL=index-node-20.10.es.web.mjs.map