@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 +9 -0
- package/dist/definitions/Picker/Picker.web.d.ts.map +1 -1
- package/dist/definitions/Portal/Portal.d.ts +8 -0
- package/dist/definitions/Portal/Portal.d.ts.map +1 -0
- package/dist/definitions/Portal/Portal.web.d.ts +4 -0
- package/dist/definitions/Portal/Portal.web.d.ts.map +1 -0
- package/dist/definitions/Portal/utils/getDocumentBodyIfExists.web.d.ts +7 -0
- package/dist/definitions/Portal/utils/getDocumentBodyIfExists.web.d.ts.map +1 -0
- package/dist/definitions/Tooltip/Tooltip.web.d.ts.map +1 -1
- package/dist/index-node-22.17.cjs.web.js +153 -124
- package/dist/index-node-22.17.cjs.web.js.map +1 -1
- package/dist/index-node-22.17.es.web.mjs +153 -124
- package/dist/index-node-22.17.es.web.mjs.map +1 -1
- package/dist/index.es.web.js +149 -121
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -4229,6 +4229,29 @@ function useStaticBottomSheet(Content) {
|
|
|
4229
4229
|
};
|
|
4230
4230
|
}
|
|
4231
4231
|
|
|
4232
|
+
function isDocumentBodyAvailable(body) {
|
|
4233
|
+
return !!body;
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
/**
|
|
4237
|
+
* Returns document.body if it exists, or null otherwise.
|
|
4238
|
+
* This is useful when document.body might not be available, such as when document.write() is called
|
|
4239
|
+
* which destroys the DOM and causes React portals to fail with "Target container is not a DOM element" error.
|
|
4240
|
+
*/
|
|
4241
|
+
function getDocumentBodyIfExists() {
|
|
4242
|
+
// document.body can be null when document.write() is called
|
|
4243
|
+
const body = typeof document !== 'undefined' ? document.body : null;
|
|
4244
|
+
return isDocumentBodyAvailable(body) ? body : null;
|
|
4245
|
+
}
|
|
4246
|
+
|
|
4247
|
+
function Portal({
|
|
4248
|
+
children
|
|
4249
|
+
}) {
|
|
4250
|
+
const container = getDocumentBodyIfExists();
|
|
4251
|
+
if (!container) return null;
|
|
4252
|
+
return /*#__PURE__*/createPortal(children, container);
|
|
4253
|
+
}
|
|
4254
|
+
|
|
4232
4255
|
function useBlockBodyScroll(shouldBlockScroll, isInitialRender) {
|
|
4233
4256
|
useEffect(() => {
|
|
4234
4257
|
if (shouldBlockScroll) {
|
|
@@ -4251,7 +4274,9 @@ function ModalBehaviourPortal({
|
|
|
4251
4274
|
const isInitialRenderRef = useRef(true);
|
|
4252
4275
|
useBlockBodyScroll(!!visible, isInitialRenderRef.current);
|
|
4253
4276
|
isInitialRenderRef.current = false;
|
|
4254
|
-
return children ? /*#__PURE__*/
|
|
4277
|
+
return children ? /*#__PURE__*/jsx(Portal, {
|
|
4278
|
+
children: children
|
|
4279
|
+
}) : null;
|
|
4255
4280
|
}
|
|
4256
4281
|
|
|
4257
4282
|
const OnCloseContext = /*#__PURE__*/createContext(() => {});
|
|
@@ -11747,87 +11772,89 @@ function Picker({
|
|
|
11747
11772
|
disabled,
|
|
11748
11773
|
...restToggleProps
|
|
11749
11774
|
})
|
|
11750
|
-
}), /*#__PURE__*/
|
|
11751
|
-
ref: refMemo,
|
|
11752
|
-
testID: testID,
|
|
11753
|
-
...menuProps,
|
|
11754
|
-
position: strategy,
|
|
11755
|
-
top: 0,
|
|
11756
|
-
left: 0,
|
|
11757
|
-
width: isItemsWidthFixed ? '100%' : itemsWidth,
|
|
11758
|
-
maxWidth: isItemsWidthFixed ? 'kitt.picker.maxWidthFixed' : undefined,
|
|
11759
|
-
zIndex: 1,
|
|
11760
|
-
_web: {
|
|
11761
|
-
style: {
|
|
11762
|
-
transform: `translate3d(${tooltipX}px, ${tooltipY}px, 0)`,
|
|
11763
|
-
visibility: isOpen ? 'visible' : 'hidden',
|
|
11764
|
-
transitionDuration: '300ms',
|
|
11765
|
-
transitionProperty: 'opacity, padding',
|
|
11766
|
-
transitionTimingFunction: 'ease-in-out'
|
|
11767
|
-
}
|
|
11768
|
-
},
|
|
11775
|
+
}), /*#__PURE__*/jsx(Portal, {
|
|
11769
11776
|
children: /*#__PURE__*/jsx(View, {
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11777
|
+
ref: refMemo,
|
|
11778
|
+
testID: testID,
|
|
11779
|
+
...menuProps,
|
|
11780
|
+
position: strategy,
|
|
11781
|
+
top: 0,
|
|
11782
|
+
left: 0,
|
|
11783
|
+
width: isItemsWidthFixed ? '100%' : itemsWidth,
|
|
11784
|
+
maxWidth: isItemsWidthFixed ? 'kitt.picker.maxWidthFixed' : undefined,
|
|
11785
|
+
zIndex: 1,
|
|
11774
11786
|
_web: {
|
|
11775
11787
|
style: {
|
|
11776
|
-
transform: `
|
|
11788
|
+
transform: `translate3d(${tooltipX}px, ${tooltipY}px, 0)`,
|
|
11777
11789
|
visibility: isOpen ? 'visible' : 'hidden',
|
|
11778
11790
|
transitionDuration: '300ms',
|
|
11791
|
+
transitionProperty: 'opacity, padding',
|
|
11779
11792
|
transitionTimingFunction: 'ease-in-out'
|
|
11780
11793
|
}
|
|
11781
11794
|
},
|
|
11782
|
-
children: /*#__PURE__*/jsx(
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
selected: ariaSelected
|
|
11809
|
-
},
|
|
11810
|
-
onPress: onClick,
|
|
11811
|
-
children: ({
|
|
11812
|
-
isHovered,
|
|
11813
|
-
isFocused,
|
|
11814
|
-
isPressed
|
|
11815
|
-
}) => {
|
|
11816
|
-
return /*#__PURE__*/jsx(PickerItem, {
|
|
11817
|
-
isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
|
|
11818
|
-
isHighlighted: highlightedIndex === index,
|
|
11819
|
-
isHovered: isHovered,
|
|
11820
|
-
isFocused: isFocused,
|
|
11821
|
-
isPressed: isPressed,
|
|
11822
|
-
children: child
|
|
11823
|
-
});
|
|
11795
|
+
children: /*#__PURE__*/jsx(View, {
|
|
11796
|
+
opacity: isOpen ? 1 : 0,
|
|
11797
|
+
backgroundColor: "kitt.picker.web.optionsContainer.backgroundColor",
|
|
11798
|
+
borderRadius: "kitt.picker.web.optionsContainer.borderRadius",
|
|
11799
|
+
shadow: "kitt.picker.web.optionsContainer.shadow",
|
|
11800
|
+
_web: {
|
|
11801
|
+
style: {
|
|
11802
|
+
transform: `translateY(${isOpen ? 0 : 8})`,
|
|
11803
|
+
visibility: isOpen ? 'visible' : 'hidden',
|
|
11804
|
+
transitionDuration: '300ms',
|
|
11805
|
+
transitionTimingFunction: 'ease-in-out'
|
|
11806
|
+
}
|
|
11807
|
+
},
|
|
11808
|
+
children: /*#__PURE__*/jsx(CSSTransition, {
|
|
11809
|
+
unmountOnExit: true,
|
|
11810
|
+
nodeRef: nodeRef,
|
|
11811
|
+
timeout: 300,
|
|
11812
|
+
in: isOpen,
|
|
11813
|
+
classNames: pickerClassNames,
|
|
11814
|
+
children: /*#__PURE__*/jsx(View, {
|
|
11815
|
+
ref: nodeRef,
|
|
11816
|
+
paddingY: "kitt.2",
|
|
11817
|
+
children: childrenArray.map((child, index) => {
|
|
11818
|
+
const currentValue = items[index];
|
|
11819
|
+
if (currentValue === undefined) {
|
|
11820
|
+
throw new Error(`Picker: No value found for item at index ${index}`);
|
|
11824
11821
|
}
|
|
11825
|
-
|
|
11822
|
+
const {
|
|
11823
|
+
onClick,
|
|
11824
|
+
'aria-selected': ariaSelected,
|
|
11825
|
+
...itemProps
|
|
11826
|
+
} = getItemProps({
|
|
11827
|
+
item: currentValue,
|
|
11828
|
+
index,
|
|
11829
|
+
disabled
|
|
11830
|
+
});
|
|
11831
|
+
return /*#__PURE__*/jsx(Pressable, {
|
|
11832
|
+
...itemProps,
|
|
11833
|
+
accessibilityState: {
|
|
11834
|
+
selected: ariaSelected
|
|
11835
|
+
},
|
|
11836
|
+
onPress: onClick,
|
|
11837
|
+
children: ({
|
|
11838
|
+
isHovered,
|
|
11839
|
+
isFocused,
|
|
11840
|
+
isPressed
|
|
11841
|
+
}) => {
|
|
11842
|
+
return /*#__PURE__*/jsx(PickerItem, {
|
|
11843
|
+
isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
|
|
11844
|
+
isHighlighted: highlightedIndex === index,
|
|
11845
|
+
isHovered: isHovered,
|
|
11846
|
+
isFocused: isFocused,
|
|
11847
|
+
isPressed: isPressed,
|
|
11848
|
+
children: child
|
|
11849
|
+
});
|
|
11850
|
+
}
|
|
11851
|
+
}, itemProps.id);
|
|
11852
|
+
})
|
|
11826
11853
|
})
|
|
11827
11854
|
})
|
|
11828
11855
|
})
|
|
11829
11856
|
})
|
|
11830
|
-
})
|
|
11857
|
+
})]
|
|
11831
11858
|
});
|
|
11832
11859
|
}
|
|
11833
11860
|
Picker.Option = PickerOption;
|
|
@@ -13291,67 +13318,69 @@ function Tooltip({
|
|
|
13291
13318
|
onFocus: handleToggleTooltip,
|
|
13292
13319
|
onBlur: handleToggleTooltip,
|
|
13293
13320
|
width: '100%'
|
|
13294
|
-
}), /*#__PURE__*/
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
pointerEvents: isVisible ? 'auto' : 'none'
|
|
13314
|
-
},
|
|
13315
|
-
position: strategy,
|
|
13316
|
-
zIndex: zIndex,
|
|
13317
|
-
top: 0,
|
|
13318
|
-
left: 0,
|
|
13319
|
-
_web: {
|
|
13321
|
+
}), /*#__PURE__*/jsx(Portal, {
|
|
13322
|
+
children: /*#__PURE__*/jsx(View, {
|
|
13323
|
+
ref: refs.setFloating,
|
|
13324
|
+
"aria-hidden": !isVisible,
|
|
13325
|
+
paddingX: {
|
|
13326
|
+
base: 'kitt.4',
|
|
13327
|
+
small: 0
|
|
13328
|
+
},
|
|
13329
|
+
width: {
|
|
13330
|
+
base: '100%',
|
|
13331
|
+
small: 'max-content'
|
|
13332
|
+
},
|
|
13333
|
+
maxWidth: {
|
|
13334
|
+
base: '100%',
|
|
13335
|
+
small: 'kitt.tooltip.maxWidth'
|
|
13336
|
+
},
|
|
13337
|
+
opacity: isVisible ? 'kitt.tooltip.opacity' : 0,
|
|
13338
|
+
paddingTop: placement === 'bottom' ? currentFloatingPadding : undefined,
|
|
13339
|
+
paddingBottom: placement === 'top' ? currentFloatingPadding : undefined,
|
|
13320
13340
|
style: {
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
},
|
|
13328
|
-
onTouchStart: handleToggleTooltip,
|
|
13329
|
-
onTouchEnd: handleToggleTooltip,
|
|
13330
|
-
onMouseEnter: handleToggleTooltip,
|
|
13331
|
-
onMouseLeave: handleToggleTooltip,
|
|
13332
|
-
children: /*#__PURE__*/jsxs(View, {
|
|
13341
|
+
pointerEvents: isVisible ? 'auto' : 'none'
|
|
13342
|
+
},
|
|
13343
|
+
position: strategy,
|
|
13344
|
+
zIndex: zIndex,
|
|
13345
|
+
top: 0,
|
|
13346
|
+
left: 0,
|
|
13333
13347
|
_web: {
|
|
13334
13348
|
style: {
|
|
13335
|
-
transform: `
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13349
|
+
transform: `translate3d(${isBase && !fullWidth ? `0, ${tooltipY}px, 0` : `${tooltipX}px, ${tooltipY}px, 0`})`,
|
|
13350
|
+
visibility: isVisible ? 'visible' : 'hidden',
|
|
13351
|
+
transitionDuration,
|
|
13352
|
+
transitionProperty: theme.kitt.tooltip.transition[themePart].property,
|
|
13353
|
+
transitionTimingFunction
|
|
13340
13354
|
}
|
|
13341
13355
|
},
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13356
|
+
onTouchStart: handleToggleTooltip,
|
|
13357
|
+
onTouchEnd: handleToggleTooltip,
|
|
13358
|
+
onMouseEnter: handleToggleTooltip,
|
|
13359
|
+
onMouseLeave: handleToggleTooltip,
|
|
13360
|
+
children: /*#__PURE__*/jsxs(View, {
|
|
13361
|
+
_web: {
|
|
13362
|
+
style: {
|
|
13363
|
+
transform: `scale(${isVisible ? 1 : 0.8})`,
|
|
13364
|
+
transitionDuration: isVisible ? '0' : transitionDuration,
|
|
13365
|
+
transitionProperty: 'all',
|
|
13366
|
+
transitionTimingFunction,
|
|
13367
|
+
transformOrigin
|
|
13368
|
+
}
|
|
13369
|
+
},
|
|
13370
|
+
children: [shouldRenderArrow && placement === 'bottom' ? /*#__PURE__*/jsx(Arrow, {
|
|
13371
|
+
ref: arrowRef,
|
|
13372
|
+
position: "bottom",
|
|
13373
|
+
...sharedArrowProps
|
|
13374
|
+
}) : null, /*#__PURE__*/jsx(TooltipContent, {
|
|
13375
|
+
children: content
|
|
13376
|
+
}), shouldRenderArrow && placement === 'top' ? /*#__PURE__*/jsx(Arrow, {
|
|
13377
|
+
ref: arrowRef,
|
|
13378
|
+
position: "top",
|
|
13379
|
+
...sharedArrowProps
|
|
13380
|
+
}) : null]
|
|
13381
|
+
})
|
|
13353
13382
|
})
|
|
13354
|
-
})
|
|
13383
|
+
})]
|
|
13355
13384
|
});
|
|
13356
13385
|
}
|
|
13357
13386
|
Tooltip.Arrow = Arrow;
|