@ornikar/kitt-universal 9.2.0 → 9.3.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 (55) hide show
  1. package/dist/definitions/ModalBehaviour/ModalBehaviour.d.ts +18 -0
  2. package/dist/definitions/ModalBehaviour/ModalBehaviour.d.ts.map +1 -0
  3. package/dist/definitions/ModalBehaviour/ModalBehaviourPortal.d.ts +7 -0
  4. package/dist/definitions/ModalBehaviour/ModalBehaviourPortal.d.ts.map +1 -0
  5. package/dist/definitions/ModalBehaviour/ModalBehaviourPortal.web.d.ts +4 -0
  6. package/dist/definitions/ModalBehaviour/ModalBehaviourPortal.web.d.ts.map +1 -0
  7. package/dist/definitions/ModalBehaviour/OnCloseContext.d.ts +11 -0
  8. package/dist/definitions/ModalBehaviour/OnCloseContext.d.ts.map +1 -0
  9. package/dist/definitions/NavigationModal/Body.d.ts +9 -0
  10. package/dist/definitions/NavigationModal/Body.d.ts.map +1 -0
  11. package/dist/definitions/NavigationModal/ContentPadding.d.ts +7 -0
  12. package/dist/definitions/NavigationModal/ContentPadding.d.ts.map +1 -0
  13. package/dist/definitions/NavigationModal/Footer.d.ts +11 -0
  14. package/dist/definitions/NavigationModal/Footer.d.ts.map +1 -0
  15. package/dist/definitions/NavigationModal/Header.d.ts +31 -0
  16. package/dist/definitions/NavigationModal/Header.d.ts.map +1 -0
  17. package/dist/definitions/NavigationModal/NavigationModal.d.ts +17 -0
  18. package/dist/definitions/NavigationModal/NavigationModal.d.ts.map +1 -0
  19. package/dist/definitions/NavigationModal/NavigationModalContainer.d.ts +8 -0
  20. package/dist/definitions/NavigationModal/NavigationModalContainer.d.ts.map +1 -0
  21. package/dist/definitions/index.d.ts +4 -0
  22. package/dist/definitions/index.d.ts.map +1 -1
  23. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +1 -1
  24. package/dist/definitions/themes/default.d.ts +1 -0
  25. package/dist/definitions/themes/default.d.ts.map +1 -1
  26. package/dist/definitions/themes/late-ocean/navigationModal.d.ts +6 -0
  27. package/dist/definitions/themes/late-ocean/navigationModal.d.ts.map +1 -0
  28. package/dist/index-browser-all.es.android.js +324 -41
  29. package/dist/index-browser-all.es.android.js.map +1 -1
  30. package/dist/index-browser-all.es.ios.js +324 -41
  31. package/dist/index-browser-all.es.ios.js.map +1 -1
  32. package/dist/index-browser-all.es.js +324 -41
  33. package/dist/index-browser-all.es.js.map +1 -1
  34. package/dist/index-browser-all.es.web.js +346 -40
  35. package/dist/index-browser-all.es.web.js.map +1 -1
  36. package/dist/index-node-14.17.cjs.js +298 -8
  37. package/dist/index-node-14.17.cjs.js.map +1 -1
  38. package/dist/index-node-14.17.cjs.web.css +1 -0
  39. package/dist/index-node-14.17.cjs.web.js +310 -8
  40. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  41. package/dist/linaria-themes-browser-all.es.android.js +7 -1
  42. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  43. package/dist/linaria-themes-browser-all.es.ios.js +7 -1
  44. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  45. package/dist/linaria-themes-browser-all.es.js +7 -1
  46. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  47. package/dist/linaria-themes-browser-all.es.web.js +7 -1
  48. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  49. package/dist/linaria-themes-node-14.17.cjs.js +7 -1
  50. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  51. package/dist/linaria-themes-node-14.17.cjs.web.js +7 -1
  52. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  53. package/dist/styles.css +1 -0
  54. package/dist/tsbuildinfo +1 -1
  55. package/package.json +4 -2
@@ -1433,6 +1433,11 @@ const listItem = {
1433
1433
  innerMargin: 8
1434
1434
  };
1435
1435
 
1436
+ const navigationModal = {
1437
+ height: 56,
1438
+ padding: 16
1439
+ };
1440
+
1436
1441
  const pageLoader = {
1437
1442
  size: 60,
1438
1443
  strokeWidth: 3,
@@ -1578,7 +1583,8 @@ const theme = {
1578
1583
  skeleton,
1579
1584
  tag,
1580
1585
  tooltip,
1581
- typography
1586
+ typography,
1587
+ navigationModal
1582
1588
  };
1583
1589
 
1584
1590
  function matchWindowSize({
@@ -2247,7 +2253,7 @@ function IconButton({
2247
2253
  });
2248
2254
  }
2249
2255
 
2250
- const OnCloseContext = /*#__PURE__*/React.createContext(() => {});
2256
+ const OnCloseContext$1 = /*#__PURE__*/React.createContext(() => {});
2251
2257
 
2252
2258
  const HeaderView = /*#__PURE__*/styled__default.View.withConfig({
2253
2259
  displayName: "Header__HeaderView",
@@ -2281,7 +2287,7 @@ function ModalHeader({
2281
2287
  right,
2282
2288
  children
2283
2289
  }) {
2284
- const onClose = React.useContext(OnCloseContext);
2290
+ const onClose = React.useContext(OnCloseContext$1);
2285
2291
  const isIconLeft = !!left;
2286
2292
  return /*#__PURE__*/jsxRuntime.jsxs(HeaderView, {
2287
2293
  children: [isIconLeft && /*#__PURE__*/jsxRuntime.jsx(LeftIconView, {
@@ -2321,7 +2327,7 @@ function Modal({
2321
2327
  onEntered,
2322
2328
  onExited
2323
2329
  }) {
2324
- return /*#__PURE__*/jsxRuntime.jsx(OnCloseContext.Provider, {
2330
+ return /*#__PURE__*/jsxRuntime.jsx(OnCloseContext$1.Provider, {
2325
2331
  value: onClose,
2326
2332
  children: /*#__PURE__*/jsxRuntime.jsx(reactNative.Modal, {
2327
2333
  transparent: true,
@@ -2886,7 +2892,7 @@ function TextArea({ ...props
2886
2892
  });
2887
2893
  }
2888
2894
 
2889
- const Body = /*#__PURE__*/styled__default.View.withConfig({
2895
+ const Body$1 = /*#__PURE__*/styled__default.View.withConfig({
2890
2896
  displayName: "Body",
2891
2897
  componentId: "kitt-universal__sc-1ofncfn-0"
2892
2898
  })(["", " background-color:", ";flex:1;"], ({
@@ -2901,7 +2907,7 @@ const Body = /*#__PURE__*/styled__default.View.withConfig({
2901
2907
  function FullScreenModalBody({
2902
2908
  children
2903
2909
  }) {
2904
- return /*#__PURE__*/jsxRuntime.jsx(Body, {
2910
+ return /*#__PURE__*/jsxRuntime.jsx(Body$1, {
2905
2911
  children: children
2906
2912
  });
2907
2913
  }
@@ -2926,7 +2932,7 @@ function getHeaderHorizontalMediumPadding(spacing) {
2926
2932
  return spacing * 6;
2927
2933
  }
2928
2934
 
2929
- const Header = /*#__PURE__*/styled__default.View.withConfig({
2935
+ const Header$1 = /*#__PURE__*/styled__default.View.withConfig({
2930
2936
  displayName: "Header",
2931
2937
  componentId: "kitt-universal__sc-dfmxi1-1"
2932
2938
  })(["", ";border-bottom-color:", ";border-bottom-width:1px;flex-direction:row;align-items:center;"], ({
@@ -3003,7 +3009,7 @@ function FullScreenModalHeader({
3003
3009
  setRightWidth(event.nativeEvent.layout.width);
3004
3010
  };
3005
3011
 
3006
- return /*#__PURE__*/jsxRuntime.jsxs(Header, {
3012
+ return /*#__PURE__*/jsxRuntime.jsxs(Header$1, {
3007
3013
  insetTop: reactNative.Platform.OS === 'ios' ? undefined : top,
3008
3014
  children: [left ? /*#__PURE__*/jsxRuntime.jsx(SideContainer, {
3009
3015
  onLayout: e => handleLayoutChange(e, 'left'),
@@ -3368,6 +3374,69 @@ function Message({
3368
3374
  });
3369
3375
  }
3370
3376
 
3377
+ function ModalBehaviourPortal({
3378
+ children
3379
+ }) {
3380
+ // eslint-disable-next-line react/jsx-no-useless-fragment
3381
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
3382
+ children: children
3383
+ });
3384
+ }
3385
+
3386
+ const OnCloseContext = /*#__PURE__*/React.createContext(() => {});
3387
+ function OnCloseProvider({
3388
+ children,
3389
+ onClose
3390
+ }) {
3391
+ return /*#__PURE__*/jsxRuntime.jsx(OnCloseContext.Provider, {
3392
+ value: onClose,
3393
+ children: children
3394
+ });
3395
+ }
3396
+ function useOnCloseModalBehaviour() {
3397
+ const onClose = React.useContext(OnCloseContext);
3398
+ return onClose;
3399
+ }
3400
+
3401
+ function CloseButton({
3402
+ children,
3403
+ onPress
3404
+ }) {
3405
+ const onCloseContextCallback = useOnCloseModalBehaviour();
3406
+ return /*#__PURE__*/React.cloneElement(children, {
3407
+ onPress: () => {
3408
+ if (onPress) onPress();
3409
+ onCloseContextCallback();
3410
+ }
3411
+ });
3412
+ }
3413
+
3414
+ const ModalBehaviourContainer = /*#__PURE__*/styled__default(reactNative.View).withConfig({
3415
+ displayName: "ModalBehaviour__ModalBehaviourContainer",
3416
+ componentId: "kitt-universal__sc-tj3606-0"
3417
+ })(["", ""], () => {
3418
+ if (reactNative.Platform.OS !== 'web') return undefined;
3419
+ return styled.css(["position:fixed;top:0;left:0;width:100%;"]);
3420
+ });
3421
+ function ModalBehaviour({
3422
+ children,
3423
+ visible,
3424
+ style,
3425
+ onClose
3426
+ }) {
3427
+ return /*#__PURE__*/jsxRuntime.jsx(OnCloseProvider, {
3428
+ onClose: onClose,
3429
+ children: /*#__PURE__*/jsxRuntime.jsx(ModalBehaviourPortal, {
3430
+ visible: visible,
3431
+ children: visible ? /*#__PURE__*/jsxRuntime.jsx(ModalBehaviourContainer, {
3432
+ style: style,
3433
+ children: children
3434
+ }) : null
3435
+ })
3436
+ });
3437
+ }
3438
+ ModalBehaviour.CloseButton = CloseButton;
3439
+
3371
3440
  const createKittSpaces = spacing => {
3372
3441
  const sizes = {};
3373
3442
 
@@ -3517,6 +3586,225 @@ const View = nativeBase.View;
3517
3586
  const ScrollView = nativeBase.ScrollView;
3518
3587
  const Pressable = nativeBase.Pressable;
3519
3588
 
3589
+ const ViewWithPadding = /*#__PURE__*/styled__default(reactNative.View).withConfig({
3590
+ displayName: "ContentPadding__ViewWithPadding",
3591
+ componentId: "kitt-universal__sc-1rprqcv-0"
3592
+ })(["padding:", ";"], ({
3593
+ theme
3594
+ }) => `0 ${theme.kitt.navigationModal.padding}px`);
3595
+ function ContentPadding({
3596
+ children,
3597
+ ...props
3598
+ }) {
3599
+ return /*#__PURE__*/jsxRuntime.jsx(ViewWithPadding, { ...props,
3600
+ children: children
3601
+ });
3602
+ }
3603
+
3604
+ const StyledViewWithPadding = /*#__PURE__*/styled__default(ContentPadding).withConfig({
3605
+ displayName: "Body__StyledViewWithPadding",
3606
+ componentId: "kitt-universal__sc-oc39vn-0"
3607
+ })(["padding-top:", "px;padding-bottom:", "px;"], ({
3608
+ theme
3609
+ }) => theme.kitt.spacing * 6, ({
3610
+ theme,
3611
+ $insetBottom
3612
+ }) => Math.max(theme.kitt.spacing * 4, $insetBottom));
3613
+ function Body({
3614
+ children,
3615
+ shouldHandleBottomNotch,
3616
+ style,
3617
+ ...props
3618
+ }) {
3619
+ const {
3620
+ bottom
3621
+ } = reactNativeSafeAreaContext.useSafeAreaInsets();
3622
+ const insetBottom = shouldHandleBottomNotch ? bottom : 0;
3623
+ return /*#__PURE__*/jsxRuntime.jsx(StyledViewWithPadding, { ...props,
3624
+ $insetBottom: insetBottom,
3625
+ style: style,
3626
+ children: children
3627
+ });
3628
+ }
3629
+
3630
+ const FooterContainer = /*#__PURE__*/styled__default(ContentPadding).withConfig({
3631
+ displayName: "Footer__FooterContainer",
3632
+ componentId: "kitt-universal__sc-1yjprfg-0"
3633
+ })(["padding-top:", "px;padding-bottom:", "px;", ";"], ({
3634
+ theme
3635
+ }) => theme.kitt.spacing * 3, ({
3636
+ theme,
3637
+ $insetBottom
3638
+ }) => Math.max(theme.kitt.spacing * 3, $insetBottom), ({
3639
+ $hasSeparator
3640
+ }) => {
3641
+ if (!$hasSeparator) return undefined;
3642
+ return styled.css(["border-top-width:1px;border-top-color:", ";"], ({
3643
+ theme
3644
+ }) => theme.kitt.colors.separator);
3645
+ });
3646
+ function Footer({
3647
+ shouldHandleBottomNotch = true,
3648
+ hasSeparator = true,
3649
+ children,
3650
+ style
3651
+ }) {
3652
+ const {
3653
+ bottom
3654
+ } = reactNativeSafeAreaContext.useSafeAreaInsets();
3655
+ const insetBottom = shouldHandleBottomNotch ? bottom : 0;
3656
+ return /*#__PURE__*/jsxRuntime.jsx(FooterContainer, {
3657
+ $insetBottom: insetBottom,
3658
+ $hasSeparator: hasSeparator,
3659
+ style: style,
3660
+ children: children
3661
+ });
3662
+ }
3663
+
3664
+ const HeaderContainer = /*#__PURE__*/styled__default(ContentPadding).withConfig({
3665
+ displayName: "Header__HeaderContainer",
3666
+ componentId: "kitt-universal__sc-1g7sbq-0"
3667
+ })(["height:", "px;width:100%;justify-content:center;background-color:", ";padding-right:", "px;padding-left:", "px;", ";"], ({
3668
+ theme
3669
+ }) => theme.kitt.navigationModal.height, ({
3670
+ theme,
3671
+ $isTransparent
3672
+ }) => {
3673
+ if ($isTransparent) return 'transparent';
3674
+ return theme.kitt.colors.uiBackgroundLight;
3675
+ }, ({
3676
+ theme,
3677
+ $hasRight
3678
+ }) => $hasRight ? theme.kitt.spacing * 2 : theme.kitt.navigationModal.padding, ({
3679
+ theme,
3680
+ $hasLeft
3681
+ }) => $hasLeft ? theme.kitt.spacing * 2 : theme.kitt.navigationModal.padding, ({
3682
+ $hasSeparator
3683
+ }) => {
3684
+ if (!$hasSeparator) return undefined;
3685
+ return styled.css(["border-bottom-width:1px;border-bottom-color:", ";"], ({
3686
+ theme
3687
+ }) => theme.kitt.colors.separator);
3688
+ });
3689
+ const Row = /*#__PURE__*/styled__default(reactNative.View).withConfig({
3690
+ displayName: "Header__Row",
3691
+ componentId: "kitt-universal__sc-1g7sbq-1"
3692
+ })(["flex-direction:row;justify-content:", ";align-items:center;"], ({
3693
+ $hasContent,
3694
+ $hasLeft
3695
+ }) => !$hasContent && !$hasLeft ? 'flex-end' : 'space-between');
3696
+ const ButtonContainer = /*#__PURE__*/styled__default.View.withConfig({
3697
+ displayName: "Header__ButtonContainer",
3698
+ componentId: "kitt-universal__sc-1g7sbq-2"
3699
+ })(["width:", "px;"], ({
3700
+ theme
3701
+ }) => theme.kitt.iconButton.width);
3702
+ const ChildrenComponent = /*#__PURE__*/styled__default(reactNative.View).withConfig({
3703
+ displayName: "Header__ChildrenComponent",
3704
+ componentId: "kitt-universal__sc-1g7sbq-3"
3705
+ })(["flex:1;align-items:center;", ";"], ({
3706
+ theme,
3707
+ $hasLeft,
3708
+ $hasRight
3709
+ }) => {
3710
+ const paddingHorizontal = theme.kitt.spacing * 2;
3711
+ return styled.css(["padding-right:", "px;padding-left:", "px;"], $hasRight ? paddingHorizontal : 0, $hasLeft ? paddingHorizontal : 0);
3712
+ });
3713
+ const HeaderTitle = /*#__PURE__*/styled__default(Typography.Text).withConfig({
3714
+ displayName: "Header__HeaderTitle",
3715
+ componentId: "kitt-universal__sc-1g7sbq-4"
3716
+ })(["flex:1;text-align:", ";", ";"], ({
3717
+ $hasLeft,
3718
+ $hasRight
3719
+ }) => {
3720
+ if (!$hasLeft && $hasRight) return 'left';
3721
+ return 'center';
3722
+ }, ({
3723
+ theme,
3724
+ $hasLeft,
3725
+ $hasRight
3726
+ }) => {
3727
+ const paddingHorizontal = theme.kitt.spacing * 2;
3728
+ return styled.css(["padding-right:", "px;padding-left:", "px;"], $hasRight ? paddingHorizontal : 0, $hasLeft ? paddingHorizontal : 0);
3729
+ });
3730
+ function Header({
3731
+ hasSeparator = true,
3732
+ isTransparent,
3733
+ title,
3734
+ children,
3735
+ right,
3736
+ left,
3737
+ style
3738
+ }) {
3739
+ const sharedProps = {
3740
+ $hasLeft: Boolean(left),
3741
+ $hasRight: Boolean(right)
3742
+ };
3743
+ return /*#__PURE__*/jsxRuntime.jsx(HeaderContainer, {
3744
+ $isTransparent: isTransparent,
3745
+ $hasSeparator: hasSeparator,
3746
+ $hasLeft: Boolean(left),
3747
+ $hasRight: Boolean(right),
3748
+ style: style,
3749
+ children: /*#__PURE__*/jsxRuntime.jsxs(Row, {
3750
+ $hasContent: Boolean(title || children),
3751
+ ...sharedProps,
3752
+ children: [left ? /*#__PURE__*/jsxRuntime.jsx(ButtonContainer, {
3753
+ children: left
3754
+ }) : null, title ? /*#__PURE__*/jsxRuntime.jsx(HeaderTitle, { ...sharedProps,
3755
+ variant: "bold",
3756
+ children: title
3757
+ }) : null, children ? /*#__PURE__*/jsxRuntime.jsx(ChildrenComponent, { ...sharedProps,
3758
+ children: children
3759
+ }) : null, right || left ? /*#__PURE__*/jsxRuntime.jsx(ButtonContainer, {
3760
+ children: right
3761
+ }) : null]
3762
+ })
3763
+ });
3764
+ }
3765
+
3766
+ const NavigationModalContainer = /*#__PURE__*/styled__default(reactNative.View).withConfig({
3767
+ displayName: "NavigationModalContainer",
3768
+ componentId: "kitt-universal__sc-n0bwvk-0"
3769
+ })(["position:relative;background-color:", ";flex:1;", ""], ({
3770
+ theme,
3771
+ $backgroundColor
3772
+ }) => $backgroundColor || theme.kitt.colors.uiBackgroundLight, () => {
3773
+ if (reactNative.Platform.OS !== 'web') return undefined;
3774
+ return styled.css(["min-height:100vh;"]);
3775
+ });
3776
+
3777
+ const ContainerWithoutHeader = /*#__PURE__*/styled__default(reactNative.View).withConfig({
3778
+ displayName: "NavigationModal__ContainerWithoutHeader",
3779
+ componentId: "kitt-universal__sc-ls8t24-0"
3780
+ })(["justify-content:space-between;flex:1;"]);
3781
+ function NavigationModal({
3782
+ body,
3783
+ header,
3784
+ footer,
3785
+ backgroundColor
3786
+ }) {
3787
+ return /*#__PURE__*/jsxRuntime.jsxs(NavigationModalContainer, {
3788
+ $backgroundColor: backgroundColor,
3789
+ children: [header ? /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
3790
+ children: header
3791
+ }) : null, /*#__PURE__*/jsxRuntime.jsxs(ContainerWithoutHeader, {
3792
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
3793
+ bounces: false,
3794
+ contentContainerStyle: {
3795
+ flexGrow: 1,
3796
+ position: 'relative'
3797
+ },
3798
+ children: body
3799
+ }), footer || null]
3800
+ })]
3801
+ });
3802
+ }
3803
+ NavigationModal.Header = Header;
3804
+ NavigationModal.Footer = Footer;
3805
+ NavigationModal.Body = Body;
3806
+ NavigationModal.Padding = ContentPadding;
3807
+
3520
3808
  function Notification({
3521
3809
  type,
3522
3810
  children,
@@ -4841,6 +5129,8 @@ exports.LoaderIcon = LoaderIcon;
4841
5129
  exports.MatchWindowSize = MatchWindowSize;
4842
5130
  exports.Message = Message;
4843
5131
  exports.Modal = Modal;
5132
+ exports.ModalBehaviour = ModalBehaviour;
5133
+ exports.NavigationModal = NavigationModal;
4844
5134
  exports.Notification = Notification;
4845
5135
  exports.Overlay = Overlay;
4846
5136
  exports.PageLoader = PageLoader;