@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
package/dist/index.es.web.js
CHANGED
|
@@ -4274,6 +4274,28 @@ function useStaticBottomSheet(Content) {
|
|
|
4274
4274
|
};
|
|
4275
4275
|
}
|
|
4276
4276
|
|
|
4277
|
+
function isDocumentBodyAvailable(body) {
|
|
4278
|
+
return !!body;
|
|
4279
|
+
}
|
|
4280
|
+
|
|
4281
|
+
/**
|
|
4282
|
+
* Returns document.body if it exists, or null otherwise.
|
|
4283
|
+
* This is useful when document.body might not be available, such as when document.write() is called
|
|
4284
|
+
* which destroys the DOM and causes React portals to fail with "Target container is not a DOM element" error.
|
|
4285
|
+
*/
|
|
4286
|
+
function getDocumentBodyIfExists() {
|
|
4287
|
+
// document.body can be null when document.write() is called
|
|
4288
|
+
var body = typeof document !== 'undefined' ? document.body : null;
|
|
4289
|
+
return isDocumentBodyAvailable(body) ? body : null;
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
function Portal(_ref) {
|
|
4293
|
+
var children = _ref.children;
|
|
4294
|
+
var container = getDocumentBodyIfExists();
|
|
4295
|
+
if (!container) return null;
|
|
4296
|
+
return /*#__PURE__*/createPortal(children, container);
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4277
4299
|
function useBlockBodyScroll(shouldBlockScroll, isInitialRender) {
|
|
4278
4300
|
useEffect(function () {
|
|
4279
4301
|
if (shouldBlockScroll) {
|
|
@@ -4295,7 +4317,9 @@ function ModalBehaviourPortal(_ref) {
|
|
|
4295
4317
|
var isInitialRenderRef = useRef(true);
|
|
4296
4318
|
useBlockBodyScroll(!!visible, isInitialRenderRef.current);
|
|
4297
4319
|
isInitialRenderRef.current = false;
|
|
4298
|
-
return children ? /*#__PURE__*/
|
|
4320
|
+
return children ? /*#__PURE__*/jsx(Portal, {
|
|
4321
|
+
children: children
|
|
4322
|
+
}) : null;
|
|
4299
4323
|
}
|
|
4300
4324
|
|
|
4301
4325
|
var OnCloseContext = /*#__PURE__*/createContext(function () {});
|
|
@@ -11930,84 +11954,86 @@ function Picker(_ref) {
|
|
|
11930
11954
|
isOpen: isOpen,
|
|
11931
11955
|
disabled: disabled
|
|
11932
11956
|
}, restToggleProps))
|
|
11933
|
-
})), /*#__PURE__*/
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
style: {
|
|
11945
|
-
transform: "translate3d(".concat(tooltipX, "px, ").concat(tooltipY, "px, 0)"),
|
|
11946
|
-
visibility: isOpen ? 'visible' : 'hidden',
|
|
11947
|
-
transitionDuration: '300ms',
|
|
11948
|
-
transitionProperty: 'opacity, padding',
|
|
11949
|
-
transitionTimingFunction: 'ease-in-out'
|
|
11950
|
-
}
|
|
11951
|
-
},
|
|
11952
|
-
children: /*#__PURE__*/jsx(View, {
|
|
11953
|
-
opacity: isOpen ? 1 : 0,
|
|
11954
|
-
backgroundColor: "kitt.picker.web.optionsContainer.backgroundColor",
|
|
11955
|
-
borderRadius: "kitt.picker.web.optionsContainer.borderRadius",
|
|
11956
|
-
shadow: "kitt.picker.web.optionsContainer.shadow",
|
|
11957
|
+
})), /*#__PURE__*/jsx(Portal, {
|
|
11958
|
+
children: /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({
|
|
11959
|
+
ref: refMemo,
|
|
11960
|
+
testID: testID
|
|
11961
|
+
}, menuProps), {}, {
|
|
11962
|
+
position: strategy,
|
|
11963
|
+
top: 0,
|
|
11964
|
+
left: 0,
|
|
11965
|
+
width: isItemsWidthFixed ? '100%' : itemsWidth,
|
|
11966
|
+
maxWidth: isItemsWidthFixed ? 'kitt.picker.maxWidthFixed' : undefined,
|
|
11967
|
+
zIndex: 1,
|
|
11957
11968
|
_web: {
|
|
11958
11969
|
style: {
|
|
11959
|
-
transform: "
|
|
11970
|
+
transform: "translate3d(".concat(tooltipX, "px, ").concat(tooltipY, "px, 0)"),
|
|
11960
11971
|
visibility: isOpen ? 'visible' : 'hidden',
|
|
11961
11972
|
transitionDuration: '300ms',
|
|
11973
|
+
transitionProperty: 'opacity, padding',
|
|
11962
11974
|
transitionTimingFunction: 'ease-in-out'
|
|
11963
11975
|
}
|
|
11964
11976
|
},
|
|
11965
|
-
children: /*#__PURE__*/jsx(
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
"
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
onPress: onClick,
|
|
11992
|
-
children: function (_ref2) {
|
|
11993
|
-
var isHovered = _ref2.isHovered,
|
|
11994
|
-
isFocused = _ref2.isFocused,
|
|
11995
|
-
isPressed = _ref2.isPressed;
|
|
11996
|
-
return /*#__PURE__*/jsx(PickerItem, {
|
|
11997
|
-
isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
|
|
11998
|
-
isHighlighted: highlightedIndex === index,
|
|
11999
|
-
isHovered: isHovered,
|
|
12000
|
-
isFocused: isFocused,
|
|
12001
|
-
isPressed: isPressed,
|
|
12002
|
-
children: child
|
|
12003
|
-
});
|
|
11977
|
+
children: /*#__PURE__*/jsx(View, {
|
|
11978
|
+
opacity: isOpen ? 1 : 0,
|
|
11979
|
+
backgroundColor: "kitt.picker.web.optionsContainer.backgroundColor",
|
|
11980
|
+
borderRadius: "kitt.picker.web.optionsContainer.borderRadius",
|
|
11981
|
+
shadow: "kitt.picker.web.optionsContainer.shadow",
|
|
11982
|
+
_web: {
|
|
11983
|
+
style: {
|
|
11984
|
+
transform: "translateY(".concat(isOpen ? 0 : 8, ")"),
|
|
11985
|
+
visibility: isOpen ? 'visible' : 'hidden',
|
|
11986
|
+
transitionDuration: '300ms',
|
|
11987
|
+
transitionTimingFunction: 'ease-in-out'
|
|
11988
|
+
}
|
|
11989
|
+
},
|
|
11990
|
+
children: /*#__PURE__*/jsx(CSSTransition, {
|
|
11991
|
+
unmountOnExit: true,
|
|
11992
|
+
nodeRef: nodeRef,
|
|
11993
|
+
timeout: 300,
|
|
11994
|
+
"in": isOpen,
|
|
11995
|
+
classNames: pickerClassNames,
|
|
11996
|
+
children: /*#__PURE__*/jsx(View, {
|
|
11997
|
+
ref: nodeRef,
|
|
11998
|
+
paddingY: "kitt.2",
|
|
11999
|
+
children: childrenArray.map(function (child, index) {
|
|
12000
|
+
var currentValue = items[index];
|
|
12001
|
+
if (currentValue === undefined) {
|
|
12002
|
+
throw new Error("Picker: No value found for item at index ".concat(index));
|
|
12004
12003
|
}
|
|
12005
|
-
|
|
12004
|
+
var _getItemProps = getItemProps({
|
|
12005
|
+
item: currentValue,
|
|
12006
|
+
index: index,
|
|
12007
|
+
disabled: disabled
|
|
12008
|
+
}),
|
|
12009
|
+
onClick = _getItemProps.onClick,
|
|
12010
|
+
ariaSelected = _getItemProps['aria-selected'],
|
|
12011
|
+
itemProps = _objectWithoutProperties(_getItemProps, _excluded3$2);
|
|
12012
|
+
return /*#__PURE__*/jsx(Pressable, _objectSpread(_objectSpread({}, itemProps), {}, {
|
|
12013
|
+
accessibilityState: {
|
|
12014
|
+
selected: ariaSelected
|
|
12015
|
+
},
|
|
12016
|
+
onPress: onClick,
|
|
12017
|
+
children: function (_ref2) {
|
|
12018
|
+
var isHovered = _ref2.isHovered,
|
|
12019
|
+
isFocused = _ref2.isFocused,
|
|
12020
|
+
isPressed = _ref2.isPressed;
|
|
12021
|
+
return /*#__PURE__*/jsx(PickerItem, {
|
|
12022
|
+
isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
|
|
12023
|
+
isHighlighted: highlightedIndex === index,
|
|
12024
|
+
isHovered: isHovered,
|
|
12025
|
+
isFocused: isFocused,
|
|
12026
|
+
isPressed: isPressed,
|
|
12027
|
+
children: child
|
|
12028
|
+
});
|
|
12029
|
+
}
|
|
12030
|
+
}), itemProps.id);
|
|
12031
|
+
})
|
|
12006
12032
|
})
|
|
12007
12033
|
})
|
|
12008
12034
|
})
|
|
12009
|
-
})
|
|
12010
|
-
})
|
|
12035
|
+
}))
|
|
12036
|
+
})]
|
|
12011
12037
|
});
|
|
12012
12038
|
}
|
|
12013
12039
|
Picker.Option = PickerOption;
|
|
@@ -13497,65 +13523,67 @@ function Tooltip(_ref) {
|
|
|
13497
13523
|
onFocus: handleToggleTooltip,
|
|
13498
13524
|
onBlur: handleToggleTooltip,
|
|
13499
13525
|
width: '100%'
|
|
13500
|
-
}), /*#__PURE__*/
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
pointerEvents: isVisible ? 'auto' : 'none'
|
|
13520
|
-
},
|
|
13521
|
-
position: strategy,
|
|
13522
|
-
zIndex: zIndex,
|
|
13523
|
-
top: 0,
|
|
13524
|
-
left: 0,
|
|
13525
|
-
_web: {
|
|
13526
|
+
}), /*#__PURE__*/jsx(Portal, {
|
|
13527
|
+
children: /*#__PURE__*/jsx(View, {
|
|
13528
|
+
ref: refs.setFloating,
|
|
13529
|
+
"aria-hidden": !isVisible,
|
|
13530
|
+
paddingX: {
|
|
13531
|
+
base: 'kitt.4',
|
|
13532
|
+
small: 0
|
|
13533
|
+
},
|
|
13534
|
+
width: {
|
|
13535
|
+
base: '100%',
|
|
13536
|
+
small: 'max-content'
|
|
13537
|
+
},
|
|
13538
|
+
maxWidth: {
|
|
13539
|
+
base: '100%',
|
|
13540
|
+
small: 'kitt.tooltip.maxWidth'
|
|
13541
|
+
},
|
|
13542
|
+
opacity: isVisible ? 'kitt.tooltip.opacity' : 0,
|
|
13543
|
+
paddingTop: placement === 'bottom' ? currentFloatingPadding : undefined,
|
|
13544
|
+
paddingBottom: placement === 'top' ? currentFloatingPadding : undefined,
|
|
13526
13545
|
style: {
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
},
|
|
13534
|
-
onTouchStart: handleToggleTooltip,
|
|
13535
|
-
onTouchEnd: handleToggleTooltip,
|
|
13536
|
-
onMouseEnter: handleToggleTooltip,
|
|
13537
|
-
onMouseLeave: handleToggleTooltip,
|
|
13538
|
-
children: /*#__PURE__*/jsxs(View, {
|
|
13546
|
+
pointerEvents: isVisible ? 'auto' : 'none'
|
|
13547
|
+
},
|
|
13548
|
+
position: strategy,
|
|
13549
|
+
zIndex: zIndex,
|
|
13550
|
+
top: 0,
|
|
13551
|
+
left: 0,
|
|
13539
13552
|
_web: {
|
|
13540
13553
|
style: {
|
|
13541
|
-
transform: "
|
|
13542
|
-
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13554
|
+
transform: "translate3d(".concat(isBase && !fullWidth ? "0, ".concat(tooltipY, "px, 0") : "".concat(tooltipX, "px, ").concat(tooltipY, "px, 0"), ")"),
|
|
13555
|
+
visibility: isVisible ? 'visible' : 'hidden',
|
|
13556
|
+
transitionDuration: transitionDuration,
|
|
13557
|
+
transitionProperty: theme.kitt.tooltip.transition[themePart].property,
|
|
13558
|
+
transitionTimingFunction: transitionTimingFunction
|
|
13546
13559
|
}
|
|
13547
13560
|
},
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13561
|
+
onTouchStart: handleToggleTooltip,
|
|
13562
|
+
onTouchEnd: handleToggleTooltip,
|
|
13563
|
+
onMouseEnter: handleToggleTooltip,
|
|
13564
|
+
onMouseLeave: handleToggleTooltip,
|
|
13565
|
+
children: /*#__PURE__*/jsxs(View, {
|
|
13566
|
+
_web: {
|
|
13567
|
+
style: {
|
|
13568
|
+
transform: "scale(".concat(isVisible ? 1 : 0.8, ")"),
|
|
13569
|
+
transitionDuration: isVisible ? '0' : transitionDuration,
|
|
13570
|
+
transitionProperty: 'all',
|
|
13571
|
+
transitionTimingFunction: transitionTimingFunction,
|
|
13572
|
+
transformOrigin: transformOrigin
|
|
13573
|
+
}
|
|
13574
|
+
},
|
|
13575
|
+
children: [shouldRenderArrow && placement === 'bottom' ? /*#__PURE__*/jsx(Arrow, _objectSpread({
|
|
13576
|
+
ref: arrowRef,
|
|
13577
|
+
position: "bottom"
|
|
13578
|
+
}, sharedArrowProps)) : null, /*#__PURE__*/jsx(TooltipContent, {
|
|
13579
|
+
children: content
|
|
13580
|
+
}), shouldRenderArrow && placement === 'top' ? /*#__PURE__*/jsx(Arrow, _objectSpread({
|
|
13581
|
+
ref: arrowRef,
|
|
13582
|
+
position: "top"
|
|
13583
|
+
}, sharedArrowProps)) : null]
|
|
13584
|
+
})
|
|
13557
13585
|
})
|
|
13558
|
-
})
|
|
13586
|
+
})]
|
|
13559
13587
|
});
|
|
13560
13588
|
}
|
|
13561
13589
|
Tooltip.Arrow = Arrow;
|