@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,6 +1,6 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { useContext, createContext, forwardRef, cloneElement, useState, useRef, useEffect, useMemo, Children, useReducer, useCallback, Fragment as Fragment$1 } from 'react';
3
+ import { useContext, createContext, forwardRef, useMemo, cloneElement, useState, useRef, useEffect, Children, useReducer, useCallback, Fragment as Fragment$1 } from 'react';
4
4
  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';
5
5
  export { useClipboard, useContrastText, useMediaQuery, useSx, useToken } from 'native-base';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -2712,8 +2712,129 @@ var VStack = VStack$1;
2712
2712
  var HStack = HStack$1;
2713
2713
  var Center = Center$1;
2714
2714
 
2715
+ var KittBreakpoints = {
2716
+ /**
2717
+ * min-width: 0
2718
+ */
2719
+ BASE: 0,
2720
+ /**
2721
+ * min-width: 480px
2722
+ */
2723
+ SMALL: 480,
2724
+ /**
2725
+ * min-width: 768px
2726
+ */
2727
+ MEDIUM: 768,
2728
+ /**
2729
+ * min-width: 1024px
2730
+ */
2731
+ LARGE: 1024,
2732
+ /**
2733
+ * min-width: 1280px
2734
+ */
2735
+ WIDE: 1280
2736
+ };
2737
+ var KittBreakpointsMax = {
2738
+ /**
2739
+ * max-width: 479px
2740
+ */
2741
+ BASE: KittBreakpoints.SMALL - 1,
2742
+ /**
2743
+ * max-width: 767px
2744
+ */
2745
+ SMALL: KittBreakpoints.MEDIUM - 1,
2746
+ /**
2747
+ * max-width: 1023px
2748
+ */
2749
+ MEDIUM: KittBreakpoints.LARGE - 1,
2750
+ /**
2751
+ * max-width: 1279px
2752
+ */
2753
+ LARGE: KittBreakpoints.WIDE - 1
2754
+ };
2755
+ var KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2756
+ KittBreakpointNameEnum["BASE"] = "base";
2757
+ KittBreakpointNameEnum["SMALL"] = "small";
2758
+ KittBreakpointNameEnum["MEDIUM"] = "medium";
2759
+ KittBreakpointNameEnum["LARGE"] = "large";
2760
+ KittBreakpointNameEnum["WIDE"] = "wide";
2761
+ return KittBreakpointNameEnum;
2762
+ }({});
2763
+
2715
2764
  // eslint-disable-next-line no-restricted-imports
2716
- var useBreakpointValue = useBreakpointValue$1;
2765
+ var CurrentBreakpointContext = /*#__PURE__*/createContext(undefined);
2766
+ /**
2767
+ * Provider that uses the native-base breakpoint system to detect the current viewport size and maps it to Kitt's breakpoint names.
2768
+ */
2769
+ function CurrentBreakpointProvider(_ref) {
2770
+ var children = _ref.children;
2771
+ var breakpoint = useBreakpointValue$1({
2772
+ base: KittBreakpointNameEnum.BASE,
2773
+ small: KittBreakpointNameEnum.SMALL,
2774
+ medium: KittBreakpointNameEnum.MEDIUM,
2775
+ large: KittBreakpointNameEnum.LARGE,
2776
+ wide: KittBreakpointNameEnum.WIDE
2777
+ });
2778
+ var value = useMemo(function () {
2779
+ return {
2780
+ breakpoint: breakpoint
2781
+ };
2782
+ }, [breakpoint]);
2783
+ return /*#__PURE__*/jsx(CurrentBreakpointContext.Provider, {
2784
+ value: value,
2785
+ children: children
2786
+ });
2787
+ }
2788
+
2789
+ /**
2790
+ * React hook that provides information about the current breakpoint.
2791
+ * Unlike the native-base counterpart, this hook does not trigger a re-render on every viewport size change.
2792
+ */
2793
+ function useCurrentBreakpointName() {
2794
+ var context = useContext(CurrentBreakpointContext);
2795
+ if (context === undefined) {
2796
+ throw new Error('useCurrentBreakpoint must be used within an CurrentBreakpointProvider');
2797
+ }
2798
+ return context;
2799
+ }
2800
+
2801
+ /**
2802
+ * Retrieves the appropriate value for the given breakpoint with fallback to smaller breakpoints.
2803
+ * Mimics Native Base's logic.
2804
+ */
2805
+ function getValueForBreakpoint(breakpoint, _ref) {
2806
+ var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
2807
+ var base = _ref.base,
2808
+ small = _ref.small,
2809
+ medium = _ref.medium,
2810
+ large = _ref.large,
2811
+ wide = _ref.wide;
2812
+ switch (breakpoint) {
2813
+ case KittBreakpointNameEnum.WIDE:
2814
+ return (_ref2 = (_ref3 = (_ref4 = wide !== null && wide !== void 0 ? wide : large) !== null && _ref4 !== void 0 ? _ref4 : medium) !== null && _ref3 !== void 0 ? _ref3 : small) !== null && _ref2 !== void 0 ? _ref2 : base;
2815
+ case KittBreakpointNameEnum.LARGE:
2816
+ return (_ref5 = (_ref6 = large !== null && large !== void 0 ? large : medium) !== null && _ref6 !== void 0 ? _ref6 : small) !== null && _ref5 !== void 0 ? _ref5 : base;
2817
+ case KittBreakpointNameEnum.MEDIUM:
2818
+ return (_ref7 = medium !== null && medium !== void 0 ? medium : small) !== null && _ref7 !== void 0 ? _ref7 : base;
2819
+ case KittBreakpointNameEnum.SMALL:
2820
+ return small !== null && small !== void 0 ? small : base;
2821
+ case KittBreakpointNameEnum.BASE:
2822
+ default:
2823
+ return base;
2824
+ }
2825
+ }
2826
+
2827
+ /**
2828
+ * A hook that returns a value based on the current breakpoint.
2829
+ * Mimics the behavior of Native Base's useBreakpointValue, but uses our custom context for better performance.
2830
+ */
2831
+ function useBreakpointValue(values) {
2832
+ var _useCurrentBreakpoint = useCurrentBreakpointName(),
2833
+ breakpoint = _useCurrentBreakpoint.breakpoint;
2834
+ return useMemo(function () {
2835
+ return getValueForBreakpoint(breakpoint, values);
2836
+ }, [breakpoint, values]);
2837
+ }
2717
2838
 
2718
2839
  function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valueIfFalse) {
2719
2840
  // Handles simple boolean values
@@ -2824,55 +2945,6 @@ function AnimatedContainer$2(_ref) {
2824
2945
  });
2825
2946
  }
2826
2947
 
2827
- var KittBreakpoints = {
2828
- /**
2829
- * min-width: 0
2830
- */
2831
- BASE: 0,
2832
- /**
2833
- * min-width: 480px
2834
- */
2835
- SMALL: 480,
2836
- /**
2837
- * min-width: 768px
2838
- */
2839
- MEDIUM: 768,
2840
- /**
2841
- * min-width: 1024px
2842
- */
2843
- LARGE: 1024,
2844
- /**
2845
- * min-width: 1280px
2846
- */
2847
- WIDE: 1280
2848
- };
2849
- var KittBreakpointsMax = {
2850
- /**
2851
- * max-width: 479px
2852
- */
2853
- BASE: KittBreakpoints.SMALL - 1,
2854
- /**
2855
- * max-width: 767px
2856
- */
2857
- SMALL: KittBreakpoints.MEDIUM - 1,
2858
- /**
2859
- * max-width: 1023px
2860
- */
2861
- MEDIUM: KittBreakpoints.LARGE - 1,
2862
- /**
2863
- * max-width: 1279px
2864
- */
2865
- LARGE: KittBreakpoints.WIDE - 1
2866
- };
2867
- var KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2868
- KittBreakpointNameEnum["BASE"] = "base";
2869
- KittBreakpointNameEnum["SMALL"] = "small";
2870
- KittBreakpointNameEnum["MEDIUM"] = "medium";
2871
- KittBreakpointNameEnum["LARGE"] = "large";
2872
- KittBreakpointNameEnum["WIDE"] = "wide";
2873
- return KittBreakpointNameEnum;
2874
- }({});
2875
-
2876
2948
  var typographyColors = ['black', 'black-anthracite', 'black-disabled', 'black-light', 'white', 'white-light', 'primary', 'primary-light', 'accent', 'success', 'danger', 'warning'];
2877
2949
 
2878
2950
  function getNBThemeColorFromColorProps(colorName) {
@@ -4082,7 +4154,7 @@ function CardModalHeader(_ref) {
4082
4154
  }));
4083
4155
  }
4084
4156
 
4085
- var _excluded$G = ["backgroundColor", "maxWidth", "withoutShadow", "children", "header", "body", "footer"];
4157
+ var _excluded$G = ["backgroundColor", "maxWidth", "withoutShadow", "children", "header", "body", "footer", "contentContainer"];
4086
4158
  function CardModal(_ref) {
4087
4159
  var _ref$backgroundColor = _ref.backgroundColor,
4088
4160
  backgroundColor = _ref$backgroundColor === void 0 ? 'kitt.uiBackgroundLight' : _ref$backgroundColor,
@@ -4093,6 +4165,11 @@ function CardModal(_ref) {
4093
4165
  header = _ref.header,
4094
4166
  body = _ref.body,
4095
4167
  footer = _ref.footer,
4168
+ _ref$contentContainer = _ref.contentContainer,
4169
+ ContentContainer = _ref$contentContainer === void 0 ? function (_ref2) {
4170
+ var originalChildren = _ref2.children;
4171
+ return originalChildren;
4172
+ } : _ref$contentContainer,
4096
4173
  props = _objectWithoutProperties(_ref, _excluded$G);
4097
4174
  return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), {}, {
4098
4175
  overflow: "hidden",
@@ -4103,8 +4180,10 @@ function CardModal(_ref) {
4103
4180
  maxHeight: "100%",
4104
4181
  maxWidth: maxWidth,
4105
4182
  minHeight: "kitt.cardModal.minHeight",
4106
- children: children || /*#__PURE__*/jsxs(Fragment, {
4107
- children: [header || null, body || null, footer || null]
4183
+ children: /*#__PURE__*/jsx(ContentContainer, {
4184
+ children: children || /*#__PURE__*/jsxs(Fragment, {
4185
+ children: [header || null, body || null, footer || null]
4186
+ })
4108
4187
  })
4109
4188
  }));
4110
4189
  }
@@ -7324,24 +7403,31 @@ function FullscreenModal(_ref) {
7324
7403
  var body = _ref.body,
7325
7404
  header = _ref.header,
7326
7405
  footer = _ref.footer,
7327
- backgroundColor = _ref.backgroundColor;
7328
- return /*#__PURE__*/jsxs(FullscreenModalContainer, {
7406
+ backgroundColor = _ref.backgroundColor,
7407
+ _ref$contentContainer = _ref.contentContainer,
7408
+ ContentContainer = _ref$contentContainer === void 0 ? function (_ref2) {
7409
+ var children = _ref2.children;
7410
+ return children;
7411
+ } : _ref$contentContainer;
7412
+ return /*#__PURE__*/jsx(FullscreenModalContainer, {
7329
7413
  backgroundColor: backgroundColor,
7330
- children: [header ? /*#__PURE__*/jsx(View, {
7331
- children: header
7332
- }) : null, /*#__PURE__*/jsxs(View, {
7333
- flexGrow: 1,
7334
- flexShrink: 1,
7335
- justifyContent: "space-between",
7336
- children: [/*#__PURE__*/jsx(ScrollView$2, {
7337
- bounces: false,
7338
- contentContainerStyle: {
7339
- flexGrow: 1,
7340
- position: 'relative'
7341
- },
7342
- children: body
7343
- }), footer || null]
7344
- })]
7414
+ children: /*#__PURE__*/jsxs(ContentContainer, {
7415
+ children: [header ? /*#__PURE__*/jsx(View, {
7416
+ children: header
7417
+ }) : null, /*#__PURE__*/jsxs(View, {
7418
+ flexGrow: 1,
7419
+ flexShrink: 1,
7420
+ justifyContent: "space-between",
7421
+ children: [/*#__PURE__*/jsx(ScrollView$2, {
7422
+ bounces: false,
7423
+ contentContainerStyle: {
7424
+ flexGrow: 1,
7425
+ position: 'relative'
7426
+ },
7427
+ children: body
7428
+ }), footer || null]
7429
+ })]
7430
+ })
7345
7431
  });
7346
7432
  }
7347
7433
  FullscreenModal.Header = FullscreenModalHeader;
@@ -10770,7 +10856,9 @@ function KittNativeBaseProvider(_ref) {
10770
10856
  isSSR: isSSR,
10771
10857
  children: /*#__PURE__*/jsx(KittThemeContext.Provider, {
10772
10858
  value: kittInternalTheme,
10773
- children: children
10859
+ children: /*#__PURE__*/jsx(CurrentBreakpointProvider, {
10860
+ children: children
10861
+ })
10774
10862
  })
10775
10863
  });
10776
10864
  }
@@ -12871,21 +12959,14 @@ function MatchWindowSize(_ref) {
12871
12959
  }
12872
12960
  /**
12873
12961
  * Display based on current breakpoint
12962
+ * Mimics the behavior of Native Base's SwitchBreakpoints, but uses our custom context for better performance.
12874
12963
  *
12875
12964
  * WARNING: Currently not SSR friendly (but could be).
12876
12965
  */
12877
- function SwitchBreakpoints(breakpoints) {
12878
- return useBreakpointValue(breakpoints);
12879
- }
12880
-
12881
- function useCurrentBreakpointName() {
12882
- return useBreakpointValue({
12883
- base: KittBreakpointNameEnum.BASE,
12884
- small: KittBreakpointNameEnum.SMALL,
12885
- medium: KittBreakpointNameEnum.MEDIUM,
12886
- large: KittBreakpointNameEnum.LARGE,
12887
- wide: KittBreakpointNameEnum.WIDE
12888
- });
12966
+ function SwitchBreakpoints(values) {
12967
+ var _useCurrentBreakpoint = useCurrentBreakpointName(),
12968
+ breakpoint = _useCurrentBreakpoint.breakpoint;
12969
+ return getValueForBreakpoint(breakpoint, values);
12889
12970
  }
12890
12971
 
12891
12972
  function useStepAnimations(_ref) {
@@ -13147,5 +13228,5 @@ function VerticalSteps(_ref) {
13147
13228
  VerticalSteps.Step = Step;
13148
13229
  VerticalSteps.BorderlessStep = BorderlessStep;
13149
13230
 
13150
- 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 };
13231
+ 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 };
13151
13232
  //# sourceMappingURL=index.es.web.js.map