@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 React, { useContext, createContext, forwardRef, cloneElement, useRef, useEffect, useState, useMemo, Children, useReducer, Fragment as Fragment$1, useCallback } from 'react';
3
+ import React, { useContext, createContext, forwardRef, useMemo, cloneElement, useRef, useEffect, useState, Children, useReducer, Fragment as Fragment$1, useCallback } 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, useMediaQuery } from 'native-base';
5
5
  export { useClipboard, useContrastText, useMediaQuery, useSx, useToken } from 'native-base';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -2689,8 +2689,130 @@ const VStack = VStack$1;
2689
2689
  const HStack = HStack$1;
2690
2690
  const Center = Center$1;
2691
2691
 
2692
+ const KittBreakpoints = {
2693
+ /**
2694
+ * min-width: 0
2695
+ */
2696
+ BASE: 0,
2697
+ /**
2698
+ * min-width: 480px
2699
+ */
2700
+ SMALL: 480,
2701
+ /**
2702
+ * min-width: 768px
2703
+ */
2704
+ MEDIUM: 768,
2705
+ /**
2706
+ * min-width: 1024px
2707
+ */
2708
+ LARGE: 1024,
2709
+ /**
2710
+ * min-width: 1280px
2711
+ */
2712
+ WIDE: 1280
2713
+ };
2714
+ const KittBreakpointsMax = {
2715
+ /**
2716
+ * max-width: 479px
2717
+ */
2718
+ BASE: KittBreakpoints.SMALL - 1,
2719
+ /**
2720
+ * max-width: 767px
2721
+ */
2722
+ SMALL: KittBreakpoints.MEDIUM - 1,
2723
+ /**
2724
+ * max-width: 1023px
2725
+ */
2726
+ MEDIUM: KittBreakpoints.LARGE - 1,
2727
+ /**
2728
+ * max-width: 1279px
2729
+ */
2730
+ LARGE: KittBreakpoints.WIDE - 1
2731
+ };
2732
+ let KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2733
+ KittBreakpointNameEnum["BASE"] = "base";
2734
+ KittBreakpointNameEnum["SMALL"] = "small";
2735
+ KittBreakpointNameEnum["MEDIUM"] = "medium";
2736
+ KittBreakpointNameEnum["LARGE"] = "large";
2737
+ KittBreakpointNameEnum["WIDE"] = "wide";
2738
+ return KittBreakpointNameEnum;
2739
+ }({});
2740
+
2692
2741
  // eslint-disable-next-line no-restricted-imports
2693
- const useBreakpointValue = useBreakpointValue$1;
2742
+ const CurrentBreakpointContext = /*#__PURE__*/createContext(undefined);
2743
+ /**
2744
+ * Provider that uses the native-base breakpoint system to detect the current viewport size and maps it to Kitt's breakpoint names.
2745
+ */
2746
+ function CurrentBreakpointProvider({
2747
+ children
2748
+ }) {
2749
+ const breakpoint = useBreakpointValue$1({
2750
+ base: KittBreakpointNameEnum.BASE,
2751
+ small: KittBreakpointNameEnum.SMALL,
2752
+ medium: KittBreakpointNameEnum.MEDIUM,
2753
+ large: KittBreakpointNameEnum.LARGE,
2754
+ wide: KittBreakpointNameEnum.WIDE
2755
+ });
2756
+ const value = useMemo(() => ({
2757
+ breakpoint
2758
+ }), [breakpoint]);
2759
+ return /*#__PURE__*/jsx(CurrentBreakpointContext.Provider, {
2760
+ value: value,
2761
+ children: children
2762
+ });
2763
+ }
2764
+
2765
+ /**
2766
+ * React hook that provides information about the current breakpoint.
2767
+ * Unlike the native-base counterpart, this hook does not trigger a re-render on every viewport size change.
2768
+ */
2769
+ function useCurrentBreakpointName() {
2770
+ const context = useContext(CurrentBreakpointContext);
2771
+ if (context === undefined) {
2772
+ throw new Error('useCurrentBreakpoint must be used within an CurrentBreakpointProvider');
2773
+ }
2774
+ return context;
2775
+ }
2776
+
2777
+ /**
2778
+ * Retrieves the appropriate value for the given breakpoint with fallback to smaller breakpoints.
2779
+ * Mimics Native Base's logic.
2780
+ */
2781
+ function getValueForBreakpoint(breakpoint, {
2782
+ base,
2783
+ small,
2784
+ medium,
2785
+ large,
2786
+ wide
2787
+ }) {
2788
+ var _ref, _ref2, _ref3, _ref4, _ref5, _ref6;
2789
+ switch (breakpoint) {
2790
+ case KittBreakpointNameEnum.WIDE:
2791
+ return (_ref = (_ref2 = (_ref3 = wide !== null && wide !== void 0 ? wide : large) !== null && _ref3 !== void 0 ? _ref3 : medium) !== null && _ref2 !== void 0 ? _ref2 : small) !== null && _ref !== void 0 ? _ref : base;
2792
+ case KittBreakpointNameEnum.LARGE:
2793
+ return (_ref4 = (_ref5 = large !== null && large !== void 0 ? large : medium) !== null && _ref5 !== void 0 ? _ref5 : small) !== null && _ref4 !== void 0 ? _ref4 : base;
2794
+ case KittBreakpointNameEnum.MEDIUM:
2795
+ return (_ref6 = medium !== null && medium !== void 0 ? medium : small) !== null && _ref6 !== void 0 ? _ref6 : base;
2796
+ case KittBreakpointNameEnum.SMALL:
2797
+ return small !== null && small !== void 0 ? small : base;
2798
+ case KittBreakpointNameEnum.BASE:
2799
+ default:
2800
+ return base;
2801
+ }
2802
+ }
2803
+
2804
+ /**
2805
+ * A hook that returns a value based on the current breakpoint.
2806
+ * Mimics the behavior of Native Base's useBreakpointValue, but uses our custom context for better performance.
2807
+ */
2808
+ function useBreakpointValue(values) {
2809
+ const {
2810
+ breakpoint
2811
+ } = useCurrentBreakpointName();
2812
+ return useMemo(() => {
2813
+ return getValueForBreakpoint(breakpoint, values);
2814
+ }, [breakpoint, values]);
2815
+ }
2694
2816
 
2695
2817
  function createResponsiveStyleFromProp(responsiveBooleanValue, valueIfTrue, valueIfFalse) {
2696
2818
  // Handles simple boolean values
@@ -2762,55 +2884,6 @@ function AnimatedContainer$2({
2762
2884
  });
2763
2885
  }
2764
2886
 
2765
- const KittBreakpoints = {
2766
- /**
2767
- * min-width: 0
2768
- */
2769
- BASE: 0,
2770
- /**
2771
- * min-width: 480px
2772
- */
2773
- SMALL: 480,
2774
- /**
2775
- * min-width: 768px
2776
- */
2777
- MEDIUM: 768,
2778
- /**
2779
- * min-width: 1024px
2780
- */
2781
- LARGE: 1024,
2782
- /**
2783
- * min-width: 1280px
2784
- */
2785
- WIDE: 1280
2786
- };
2787
- const KittBreakpointsMax = {
2788
- /**
2789
- * max-width: 479px
2790
- */
2791
- BASE: KittBreakpoints.SMALL - 1,
2792
- /**
2793
- * max-width: 767px
2794
- */
2795
- SMALL: KittBreakpoints.MEDIUM - 1,
2796
- /**
2797
- * max-width: 1023px
2798
- */
2799
- MEDIUM: KittBreakpoints.LARGE - 1,
2800
- /**
2801
- * max-width: 1279px
2802
- */
2803
- LARGE: KittBreakpoints.WIDE - 1
2804
- };
2805
- let KittBreakpointNameEnum = /*#__PURE__*/function (KittBreakpointNameEnum) {
2806
- KittBreakpointNameEnum["BASE"] = "base";
2807
- KittBreakpointNameEnum["SMALL"] = "small";
2808
- KittBreakpointNameEnum["MEDIUM"] = "medium";
2809
- KittBreakpointNameEnum["LARGE"] = "large";
2810
- KittBreakpointNameEnum["WIDE"] = "wide";
2811
- return KittBreakpointNameEnum;
2812
- }({});
2813
-
2814
2887
  const typographyColors = ['black', 'black-anthracite', 'black-disabled', 'black-light', 'white', 'white-light', 'primary', 'primary-light', 'accent', 'success', 'danger', 'warning'];
2815
2888
 
2816
2889
  function getNBThemeColorFromColorProps(colorName) {
@@ -3731,7 +3804,7 @@ function Avatar(_ref) {
3731
3804
  });
3732
3805
  }
3733
3806
 
3734
- const _excluded$M = ["children", "hasScrollView", "hasBackdrop", "hasHandle", "enableDynamicSizing", "snapPoints"];
3807
+ const _excluded$M = ["children", "hasScrollView", "hasBackdrop", "hasHandle", "enableDynamicSizing", "snapPoints", "contentContainer"];
3735
3808
  function BottomSheetComp(_ref, ref) {
3736
3809
  let {
3737
3810
  children: Content,
@@ -3739,7 +3812,10 @@ function BottomSheetComp(_ref, ref) {
3739
3812
  hasBackdrop = true,
3740
3813
  hasHandle = true,
3741
3814
  enableDynamicSizing = true,
3742
- snapPoints = ['100%']
3815
+ snapPoints = ['100%'],
3816
+ contentContainer: ContentContainer = ({
3817
+ children
3818
+ }) => children
3743
3819
  } = _ref,
3744
3820
  rest = _objectWithoutProperties(_ref, _excluded$M);
3745
3821
  const {
@@ -3767,7 +3843,9 @@ function BottomSheetComp(_ref, ref) {
3767
3843
  }, rest), {}, {
3768
3844
  topInset: top,
3769
3845
  children: props => /*#__PURE__*/jsx(Wrapper, {
3770
- children: typeof Content === 'function' ? /*#__PURE__*/jsx(Content, _objectSpread({}, props === null || props === void 0 ? void 0 : props.data)) : Content
3846
+ children: /*#__PURE__*/jsx(ContentContainer, {
3847
+ children: typeof Content === 'function' ? /*#__PURE__*/jsx(Content, _objectSpread({}, props === null || props === void 0 ? void 0 : props.data)) : Content
3848
+ })
3771
3849
  })
3772
3850
  }));
3773
3851
  }
@@ -4164,7 +4242,7 @@ function CardModalHeader(_ref) {
4164
4242
  }));
4165
4243
  }
4166
4244
 
4167
- const _excluded$H = ["backgroundColor", "maxWidth", "withoutShadow", "children", "header", "body", "footer"];
4245
+ const _excluded$H = ["backgroundColor", "maxWidth", "withoutShadow", "children", "header", "body", "footer", "contentContainer"];
4168
4246
  function CardModal(_ref) {
4169
4247
  let {
4170
4248
  backgroundColor = 'kitt.uiBackgroundLight',
@@ -4173,7 +4251,10 @@ function CardModal(_ref) {
4173
4251
  children,
4174
4252
  header,
4175
4253
  body,
4176
- footer
4254
+ footer,
4255
+ contentContainer: ContentContainer = ({
4256
+ children: originalChildren
4257
+ }) => originalChildren
4177
4258
  } = _ref,
4178
4259
  props = _objectWithoutProperties(_ref, _excluded$H);
4179
4260
  return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), {}, {
@@ -4185,8 +4266,10 @@ function CardModal(_ref) {
4185
4266
  maxHeight: "100%",
4186
4267
  maxWidth: maxWidth,
4187
4268
  minHeight: "kitt.cardModal.minHeight",
4188
- children: children || /*#__PURE__*/jsxs(Fragment, {
4189
- children: [header || null, body || null, footer || null]
4269
+ children: /*#__PURE__*/jsx(ContentContainer, {
4270
+ children: children || /*#__PURE__*/jsxs(Fragment, {
4271
+ children: [header || null, body || null, footer || null]
4272
+ })
4190
4273
  })
4191
4274
  }));
4192
4275
  }
@@ -7990,25 +8073,30 @@ function FullscreenModal({
7990
8073
  body,
7991
8074
  header,
7992
8075
  footer,
7993
- backgroundColor
8076
+ backgroundColor,
8077
+ contentContainer: ContentContainer = ({
8078
+ children
8079
+ }) => children
7994
8080
  }) {
7995
- return /*#__PURE__*/jsxs(FullscreenModalContainer, {
8081
+ return /*#__PURE__*/jsx(FullscreenModalContainer, {
7996
8082
  backgroundColor: backgroundColor,
7997
- children: [header ? /*#__PURE__*/jsx(View, {
7998
- children: header
7999
- }) : null, /*#__PURE__*/jsxs(View, {
8000
- flexGrow: 1,
8001
- flexShrink: 1,
8002
- justifyContent: "space-between",
8003
- children: [/*#__PURE__*/jsx(ScrollView$2, {
8004
- bounces: false,
8005
- contentContainerStyle: {
8006
- flexGrow: 1,
8007
- position: 'relative'
8008
- },
8009
- children: body
8010
- }), footer || null]
8011
- })]
8083
+ children: /*#__PURE__*/jsxs(ContentContainer, {
8084
+ children: [header ? /*#__PURE__*/jsx(View, {
8085
+ children: header
8086
+ }) : null, /*#__PURE__*/jsxs(View, {
8087
+ flexGrow: 1,
8088
+ flexShrink: 1,
8089
+ justifyContent: "space-between",
8090
+ children: [/*#__PURE__*/jsx(ScrollView$2, {
8091
+ bounces: false,
8092
+ contentContainerStyle: {
8093
+ flexGrow: 1,
8094
+ position: 'relative'
8095
+ },
8096
+ children: body
8097
+ }), footer || null]
8098
+ })]
8099
+ })
8012
8100
  });
8013
8101
  }
8014
8102
  FullscreenModal.Header = FullscreenModalHeader;
@@ -11367,7 +11455,9 @@ function KittNativeBaseProvider({
11367
11455
  isSSR: isSSR,
11368
11456
  children: /*#__PURE__*/jsx(KittThemeContext.Provider, {
11369
11457
  value: kittInternalTheme,
11370
- children: children
11458
+ children: /*#__PURE__*/jsx(CurrentBreakpointProvider, {
11459
+ children: children
11460
+ })
11371
11461
  })
11372
11462
  });
11373
11463
  }
@@ -13290,13 +13380,6 @@ function Tooltip({
13290
13380
  });
13291
13381
  const tooltipY = Math.round(y !== null && y !== void 0 ? y : 0) || 0;
13292
13382
  const tooltipX = Math.round(x !== null && x !== void 0 ? x : 0) || 0;
13293
- console.log({
13294
- tooltipY,
13295
- tooltipX,
13296
- placement,
13297
- currentFloatingPadding,
13298
- floatingWidth
13299
- });
13300
13383
  useEffect(() => {
13301
13384
  if (!onUpdate) return;
13302
13385
  onUpdate({
@@ -13332,7 +13415,6 @@ function Tooltip({
13332
13415
  children: renderPressable({
13333
13416
  ref: getPressableRect,
13334
13417
  onPress: () => {
13335
- console.log('handlePress', pressed.value);
13336
13418
  if (onToggle) onToggle(!!pressed.value);
13337
13419
  pressed.value = !pressed.value;
13338
13420
  },
@@ -13593,21 +13675,15 @@ function MatchWindowSize(_ref) {
13593
13675
  }
13594
13676
  /**
13595
13677
  * Display based on current breakpoint
13678
+ * Mimics the behavior of Native Base's SwitchBreakpoints, but uses our custom context for better performance.
13596
13679
  *
13597
13680
  * WARNING: Currently not SSR friendly (but could be).
13598
13681
  */
13599
- function SwitchBreakpoints(breakpoints) {
13600
- return useBreakpointValue(breakpoints);
13601
- }
13602
-
13603
- function useCurrentBreakpointName() {
13604
- return useBreakpointValue({
13605
- base: KittBreakpointNameEnum.BASE,
13606
- small: KittBreakpointNameEnum.SMALL,
13607
- medium: KittBreakpointNameEnum.MEDIUM,
13608
- large: KittBreakpointNameEnum.LARGE,
13609
- wide: KittBreakpointNameEnum.WIDE
13610
- });
13682
+ function SwitchBreakpoints(values) {
13683
+ const {
13684
+ breakpoint
13685
+ } = useCurrentBreakpointName();
13686
+ return getValueForBreakpoint(breakpoint, values);
13611
13687
  }
13612
13688
 
13613
13689
  function useStepAnimations({
@@ -13869,5 +13945,5 @@ function VerticalSteps(_ref) {
13869
13945
  VerticalSteps.Step = Step;
13870
13946
  VerticalSteps.BorderlessStep = BorderlessStep;
13871
13947
 
13872
- 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 };
13948
+ 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 };
13873
13949
  //# sourceMappingURL=index-metro.es.ios.js.map