@ornikar/kitt-universal 32.5.2 → 32.5.3

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [32.5.3](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@32.5.2...@ornikar/kitt-universal@32.5.3) (2025-12-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **kitt-u/portal:** Target container is not a DOM element OSE-21791 ([#2816](https://github.com/ornikar/kitt/issues/2816)) ([12dbc00](https://github.com/ornikar/kitt/commit/12dbc00ac3a6ae6b6f1caf104c844a3bd815a589))
12
+
13
+
14
+
6
15
  ## [32.5.2](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@32.5.1...@ornikar/kitt-universal@32.5.2) (2025-12-18)
7
16
 
8
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.web.d.ts","sourceRoot":"","sources":["../../../src/Picker/Picker.web.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C,wBAAgB,MAAM,CAAC,CAAC,EAAE,EACxB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,cAA+B,EAC/B,WAAW,EACX,wBAAgC,EAChC,gBAAwB,EACxB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,OAAO,GACR,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CA6J5B;yBA7Ke,MAAM"}
1
+ {"version":3,"file":"Picker.web.d.ts","sourceRoot":"","sources":["../../../src/Picker/Picker.web.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C,wBAAgB,MAAM,CAAC,CAAC,EAAE,EACxB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,cAA+B,EAC/B,WAAW,EACX,wBAAgC,EAChC,gBAAwB,EACxB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,OAAO,GACR,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CA4J5B;yBA5Ke,MAAM"}
@@ -0,0 +1,8 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ export interface PortalProps extends PropsWithChildren {
3
+ }
4
+ /**
5
+ * @description Should only be used on web. Renders nothing on native platforms.
6
+ */
7
+ export declare function Portal({ children }: PortalProps): null;
8
+ //# sourceMappingURL=Portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../src/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,WAAW,WAAY,SAAQ,iBAAiB;CAAG;AAEzD;;GAEG;AACH,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,GAAG,IAAI,CAEtD"}
@@ -0,0 +1,4 @@
1
+ import type { ReactPortal } from 'react';
2
+ import type { PortalProps } from './Portal';
3
+ export declare function Portal({ children }: PortalProps): ReactPortal | null;
4
+ //# sourceMappingURL=Portal.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Portal.web.d.ts","sourceRoot":"","sources":["../../../src/Portal/Portal.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAMpE"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns document.body if it exists, or null otherwise.
3
+ * This is useful when document.body might not be available, such as when document.write() is called
4
+ * which destroys the DOM and causes React portals to fail with "Target container is not a DOM element" error.
5
+ */
6
+ export declare function getDocumentBodyIfExists(): HTMLBodyElement | null;
7
+ //# sourceMappingURL=getDocumentBodyIfExists.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDocumentBodyIfExists.web.d.ts","sourceRoot":"","sources":["../../../../src/Portal/utils/getDocumentBodyIfExists.web.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,eAAe,GAAG,IAAI,CAIhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.web.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/Tooltip.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKxC,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,UAAU,uBAAwB,SAAQ,OAAO,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;IACvF,cAAc,EAAE,cAAc,CAAC;IAC/B,IA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rD,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,QAAgB,EAChB,OAAO,EACP,eAAe,EACf,SAAS,EACT,QAAQ,EACR,eAIC,EACD,QAAQ,EACR,MAAM,GACP,EAAE,eAAe,GAAG,SAAS,CA0I7B;yBA1Je,OAAO"}
@@ -4238,6 +4238,29 @@ function useStaticBottomSheet(Content) {
4238
4238
  };
4239
4239
  }
4240
4240
 
4241
+ function isDocumentBodyAvailable(body) {
4242
+ return !!body;
4243
+ }
4244
+
4245
+ /**
4246
+ * Returns document.body if it exists, or null otherwise.
4247
+ * This is useful when document.body might not be available, such as when document.write() is called
4248
+ * which destroys the DOM and causes React portals to fail with "Target container is not a DOM element" error.
4249
+ */
4250
+ function getDocumentBodyIfExists() {
4251
+ // document.body can be null when document.write() is called
4252
+ const body = typeof document !== 'undefined' ? document.body : null;
4253
+ return isDocumentBodyAvailable(body) ? body : null;
4254
+ }
4255
+
4256
+ function Portal({
4257
+ children
4258
+ }) {
4259
+ const container = getDocumentBodyIfExists();
4260
+ if (!container) return null;
4261
+ return /*#__PURE__*/reactDom.createPortal(children, container);
4262
+ }
4263
+
4241
4264
  function useBlockBodyScroll(shouldBlockScroll, isInitialRender) {
4242
4265
  react.useEffect(() => {
4243
4266
  if (shouldBlockScroll) {
@@ -4260,7 +4283,9 @@ function ModalBehaviourPortal({
4260
4283
  const isInitialRenderRef = react.useRef(true);
4261
4284
  useBlockBodyScroll(!!visible, isInitialRenderRef.current);
4262
4285
  isInitialRenderRef.current = false;
4263
- return children ? /*#__PURE__*/reactDom.createPortal(children, document.body) : null;
4286
+ return children ? /*#__PURE__*/jsxRuntime.jsx(Portal, {
4287
+ children: children
4288
+ }) : null;
4264
4289
  }
4265
4290
 
4266
4291
  const OnCloseContext = /*#__PURE__*/react.createContext(() => {});
@@ -11756,87 +11781,89 @@ function Picker({
11756
11781
  disabled,
11757
11782
  ...restToggleProps
11758
11783
  })
11759
- }), /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx(View, {
11760
- ref: refMemo,
11761
- testID: testID,
11762
- ...menuProps,
11763
- position: strategy,
11764
- top: 0,
11765
- left: 0,
11766
- width: isItemsWidthFixed ? '100%' : itemsWidth,
11767
- maxWidth: isItemsWidthFixed ? 'kitt.picker.maxWidthFixed' : undefined,
11768
- zIndex: 1,
11769
- _web: {
11770
- style: {
11771
- transform: `translate3d(${tooltipX}px, ${tooltipY}px, 0)`,
11772
- visibility: isOpen ? 'visible' : 'hidden',
11773
- transitionDuration: '300ms',
11774
- transitionProperty: 'opacity, padding',
11775
- transitionTimingFunction: 'ease-in-out'
11776
- }
11777
- },
11784
+ }), /*#__PURE__*/jsxRuntime.jsx(Portal, {
11778
11785
  children: /*#__PURE__*/jsxRuntime.jsx(View, {
11779
- opacity: isOpen ? 1 : 0,
11780
- backgroundColor: "kitt.picker.web.optionsContainer.backgroundColor",
11781
- borderRadius: "kitt.picker.web.optionsContainer.borderRadius",
11782
- shadow: "kitt.picker.web.optionsContainer.shadow",
11786
+ ref: refMemo,
11787
+ testID: testID,
11788
+ ...menuProps,
11789
+ position: strategy,
11790
+ top: 0,
11791
+ left: 0,
11792
+ width: isItemsWidthFixed ? '100%' : itemsWidth,
11793
+ maxWidth: isItemsWidthFixed ? 'kitt.picker.maxWidthFixed' : undefined,
11794
+ zIndex: 1,
11783
11795
  _web: {
11784
11796
  style: {
11785
- transform: `translateY(${isOpen ? 0 : 8})`,
11797
+ transform: `translate3d(${tooltipX}px, ${tooltipY}px, 0)`,
11786
11798
  visibility: isOpen ? 'visible' : 'hidden',
11787
11799
  transitionDuration: '300ms',
11800
+ transitionProperty: 'opacity, padding',
11788
11801
  transitionTimingFunction: 'ease-in-out'
11789
11802
  }
11790
11803
  },
11791
- children: /*#__PURE__*/jsxRuntime.jsx(reactTransitionGroup.CSSTransition, {
11792
- unmountOnExit: true,
11793
- nodeRef: nodeRef,
11794
- timeout: 300,
11795
- in: isOpen,
11796
- classNames: pickerClassNames,
11797
- children: /*#__PURE__*/jsxRuntime.jsx(View, {
11798
- ref: nodeRef,
11799
- paddingY: "kitt.2",
11800
- children: childrenArray.map((child, index) => {
11801
- const currentValue = items[index];
11802
- if (currentValue === undefined) {
11803
- throw new Error(`Picker: No value found for item at index ${index}`);
11804
- }
11805
- const {
11806
- onClick,
11807
- 'aria-selected': ariaSelected,
11808
- ...itemProps
11809
- } = getItemProps({
11810
- item: currentValue,
11811
- index,
11812
- disabled
11813
- });
11814
- return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
11815
- ...itemProps,
11816
- accessibilityState: {
11817
- selected: ariaSelected
11818
- },
11819
- onPress: onClick,
11820
- children: ({
11821
- isHovered,
11822
- isFocused,
11823
- isPressed
11824
- }) => {
11825
- return /*#__PURE__*/jsxRuntime.jsx(PickerItem, {
11826
- isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
11827
- isHighlighted: highlightedIndex === index,
11828
- isHovered: isHovered,
11829
- isFocused: isFocused,
11830
- isPressed: isPressed,
11831
- children: child
11832
- });
11804
+ children: /*#__PURE__*/jsxRuntime.jsx(View, {
11805
+ opacity: isOpen ? 1 : 0,
11806
+ backgroundColor: "kitt.picker.web.optionsContainer.backgroundColor",
11807
+ borderRadius: "kitt.picker.web.optionsContainer.borderRadius",
11808
+ shadow: "kitt.picker.web.optionsContainer.shadow",
11809
+ _web: {
11810
+ style: {
11811
+ transform: `translateY(${isOpen ? 0 : 8})`,
11812
+ visibility: isOpen ? 'visible' : 'hidden',
11813
+ transitionDuration: '300ms',
11814
+ transitionTimingFunction: 'ease-in-out'
11815
+ }
11816
+ },
11817
+ children: /*#__PURE__*/jsxRuntime.jsx(reactTransitionGroup.CSSTransition, {
11818
+ unmountOnExit: true,
11819
+ nodeRef: nodeRef,
11820
+ timeout: 300,
11821
+ in: isOpen,
11822
+ classNames: pickerClassNames,
11823
+ children: /*#__PURE__*/jsxRuntime.jsx(View, {
11824
+ ref: nodeRef,
11825
+ paddingY: "kitt.2",
11826
+ children: childrenArray.map((child, index) => {
11827
+ const currentValue = items[index];
11828
+ if (currentValue === undefined) {
11829
+ throw new Error(`Picker: No value found for item at index ${index}`);
11833
11830
  }
11834
- }, itemProps.id);
11831
+ const {
11832
+ onClick,
11833
+ 'aria-selected': ariaSelected,
11834
+ ...itemProps
11835
+ } = getItemProps({
11836
+ item: currentValue,
11837
+ index,
11838
+ disabled
11839
+ });
11840
+ return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
11841
+ ...itemProps,
11842
+ accessibilityState: {
11843
+ selected: ariaSelected
11844
+ },
11845
+ onPress: onClick,
11846
+ children: ({
11847
+ isHovered,
11848
+ isFocused,
11849
+ isPressed
11850
+ }) => {
11851
+ return /*#__PURE__*/jsxRuntime.jsx(PickerItem, {
11852
+ isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
11853
+ isHighlighted: highlightedIndex === index,
11854
+ isHovered: isHovered,
11855
+ isFocused: isFocused,
11856
+ isPressed: isPressed,
11857
+ children: child
11858
+ });
11859
+ }
11860
+ }, itemProps.id);
11861
+ })
11835
11862
  })
11836
11863
  })
11837
11864
  })
11838
11865
  })
11839
- }), document.body)]
11866
+ })]
11840
11867
  });
11841
11868
  }
11842
11869
  Picker.Option = PickerOption;
@@ -13300,67 +13327,69 @@ function Tooltip({
13300
13327
  onFocus: handleToggleTooltip,
13301
13328
  onBlur: handleToggleTooltip,
13302
13329
  width: '100%'
13303
- }), /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx(View, {
13304
- ref: refs.setFloating,
13305
- "aria-hidden": !isVisible,
13306
- paddingX: {
13307
- base: 'kitt.4',
13308
- small: 0
13309
- },
13310
- width: {
13311
- base: '100%',
13312
- small: 'max-content'
13313
- },
13314
- maxWidth: {
13315
- base: '100%',
13316
- small: 'kitt.tooltip.maxWidth'
13317
- },
13318
- opacity: isVisible ? 'kitt.tooltip.opacity' : 0,
13319
- paddingTop: placement === 'bottom' ? currentFloatingPadding : undefined,
13320
- paddingBottom: placement === 'top' ? currentFloatingPadding : undefined,
13321
- style: {
13322
- pointerEvents: isVisible ? 'auto' : 'none'
13323
- },
13324
- position: strategy,
13325
- zIndex: zIndex,
13326
- top: 0,
13327
- left: 0,
13328
- _web: {
13330
+ }), /*#__PURE__*/jsxRuntime.jsx(Portal, {
13331
+ children: /*#__PURE__*/jsxRuntime.jsx(View, {
13332
+ ref: refs.setFloating,
13333
+ "aria-hidden": !isVisible,
13334
+ paddingX: {
13335
+ base: 'kitt.4',
13336
+ small: 0
13337
+ },
13338
+ width: {
13339
+ base: '100%',
13340
+ small: 'max-content'
13341
+ },
13342
+ maxWidth: {
13343
+ base: '100%',
13344
+ small: 'kitt.tooltip.maxWidth'
13345
+ },
13346
+ opacity: isVisible ? 'kitt.tooltip.opacity' : 0,
13347
+ paddingTop: placement === 'bottom' ? currentFloatingPadding : undefined,
13348
+ paddingBottom: placement === 'top' ? currentFloatingPadding : undefined,
13329
13349
  style: {
13330
- transform: `translate3d(${isBase && !fullWidth ? `0, ${tooltipY}px, 0` : `${tooltipX}px, ${tooltipY}px, 0`})`,
13331
- visibility: isVisible ? 'visible' : 'hidden',
13332
- transitionDuration,
13333
- transitionProperty: theme.kitt.tooltip.transition[themePart].property,
13334
- transitionTimingFunction
13335
- }
13336
- },
13337
- onTouchStart: handleToggleTooltip,
13338
- onTouchEnd: handleToggleTooltip,
13339
- onMouseEnter: handleToggleTooltip,
13340
- onMouseLeave: handleToggleTooltip,
13341
- children: /*#__PURE__*/jsxRuntime.jsxs(View, {
13350
+ pointerEvents: isVisible ? 'auto' : 'none'
13351
+ },
13352
+ position: strategy,
13353
+ zIndex: zIndex,
13354
+ top: 0,
13355
+ left: 0,
13342
13356
  _web: {
13343
13357
  style: {
13344
- transform: `scale(${isVisible ? 1 : 0.8})`,
13345
- transitionDuration: isVisible ? '0' : transitionDuration,
13346
- transitionProperty: 'all',
13347
- transitionTimingFunction,
13348
- transformOrigin
13358
+ transform: `translate3d(${isBase && !fullWidth ? `0, ${tooltipY}px, 0` : `${tooltipX}px, ${tooltipY}px, 0`})`,
13359
+ visibility: isVisible ? 'visible' : 'hidden',
13360
+ transitionDuration,
13361
+ transitionProperty: theme.kitt.tooltip.transition[themePart].property,
13362
+ transitionTimingFunction
13349
13363
  }
13350
13364
  },
13351
- children: [shouldRenderArrow && placement === 'bottom' ? /*#__PURE__*/jsxRuntime.jsx(Arrow, {
13352
- ref: arrowRef,
13353
- position: "bottom",
13354
- ...sharedArrowProps
13355
- }) : null, /*#__PURE__*/jsxRuntime.jsx(TooltipContent, {
13356
- children: content
13357
- }), shouldRenderArrow && placement === 'top' ? /*#__PURE__*/jsxRuntime.jsx(Arrow, {
13358
- ref: arrowRef,
13359
- position: "top",
13360
- ...sharedArrowProps
13361
- }) : null]
13365
+ onTouchStart: handleToggleTooltip,
13366
+ onTouchEnd: handleToggleTooltip,
13367
+ onMouseEnter: handleToggleTooltip,
13368
+ onMouseLeave: handleToggleTooltip,
13369
+ children: /*#__PURE__*/jsxRuntime.jsxs(View, {
13370
+ _web: {
13371
+ style: {
13372
+ transform: `scale(${isVisible ? 1 : 0.8})`,
13373
+ transitionDuration: isVisible ? '0' : transitionDuration,
13374
+ transitionProperty: 'all',
13375
+ transitionTimingFunction,
13376
+ transformOrigin
13377
+ }
13378
+ },
13379
+ children: [shouldRenderArrow && placement === 'bottom' ? /*#__PURE__*/jsxRuntime.jsx(Arrow, {
13380
+ ref: arrowRef,
13381
+ position: "bottom",
13382
+ ...sharedArrowProps
13383
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(TooltipContent, {
13384
+ children: content
13385
+ }), shouldRenderArrow && placement === 'top' ? /*#__PURE__*/jsxRuntime.jsx(Arrow, {
13386
+ ref: arrowRef,
13387
+ position: "top",
13388
+ ...sharedArrowProps
13389
+ }) : null]
13390
+ })
13362
13391
  })
13363
- }), document.body)]
13392
+ })]
13364
13393
  });
13365
13394
  }
13366
13395
  Tooltip.Arrow = Arrow;