@ornikar/kitt-universal 32.5.1 → 32.5.3-canary.00f8f98ae6299285821fb6a87eab9440995c7566.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.
- package/CHANGELOG.md +24 -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/definitions/forms/DocumentPicker/DocumentPicker.d.ts +3 -2
- package/dist/definitions/forms/DocumentPicker/DocumentPicker.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +19 -8
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +19 -8
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.17.cjs.js +19 -8
- package/dist/index-node-22.17.cjs.js.map +1 -1
- package/dist/index-node-22.17.cjs.web.js +172 -132
- package/dist/index-node-22.17.cjs.web.js.map +1 -1
- package/dist/index-node-22.17.es.mjs +19 -8
- package/dist/index-node-22.17.es.mjs.map +1 -1
- package/dist/index-node-22.17.es.web.mjs +172 -132
- package/dist/index-node-22.17.es.web.mjs.map +1 -1
- package/dist/index.es.js +25 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +174 -132
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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__*/
|
|
4286
|
+
return children ? /*#__PURE__*/jsxRuntime.jsx(Portal, {
|
|
4287
|
+
children: children
|
|
4288
|
+
}) : null;
|
|
4264
4289
|
}
|
|
4265
4290
|
|
|
4266
4291
|
const OnCloseContext = /*#__PURE__*/react.createContext(() => {});
|
|
@@ -6314,10 +6339,11 @@ const DatePicker = /*#__PURE__*/react.forwardRef(({
|
|
|
6314
6339
|
});
|
|
6315
6340
|
|
|
6316
6341
|
function DocumentPicker({
|
|
6317
|
-
onDocumentUpload,
|
|
6318
6342
|
children,
|
|
6319
6343
|
disabled,
|
|
6320
|
-
documentPickerOptions
|
|
6344
|
+
documentPickerOptions,
|
|
6345
|
+
onDocumentUpload,
|
|
6346
|
+
onGetDocumentAsyncError
|
|
6321
6347
|
}) {
|
|
6322
6348
|
const childElement = react.Children.only(children);
|
|
6323
6349
|
return /*#__PURE__*/react.cloneElement(childElement, {
|
|
@@ -6326,12 +6352,22 @@ function DocumentPicker({
|
|
|
6326
6352
|
onPress: async () => {
|
|
6327
6353
|
if (disabled) return;
|
|
6328
6354
|
childElement.props.onPress?.();
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6355
|
+
let result;
|
|
6356
|
+
try {
|
|
6357
|
+
result = await expoDocumentPicker.getDocumentAsync({
|
|
6358
|
+
...documentPickerOptions,
|
|
6359
|
+
multiple: false
|
|
6360
|
+
});
|
|
6361
|
+
} catch (error) {
|
|
6362
|
+
onGetDocumentAsyncError?.();
|
|
6363
|
+
result = {
|
|
6364
|
+
canceled: true,
|
|
6365
|
+
assets: null
|
|
6366
|
+
};
|
|
6367
|
+
}
|
|
6368
|
+
const file = result.assets?.at(0)?.file;
|
|
6369
|
+
if (!result.canceled && file) {
|
|
6370
|
+
onDocumentUpload(file);
|
|
6335
6371
|
}
|
|
6336
6372
|
},
|
|
6337
6373
|
disabled
|
|
@@ -11745,87 +11781,89 @@ function Picker({
|
|
|
11745
11781
|
disabled,
|
|
11746
11782
|
...restToggleProps
|
|
11747
11783
|
})
|
|
11748
|
-
}), /*#__PURE__*/
|
|
11749
|
-
ref: refMemo,
|
|
11750
|
-
testID: testID,
|
|
11751
|
-
...menuProps,
|
|
11752
|
-
position: strategy,
|
|
11753
|
-
top: 0,
|
|
11754
|
-
left: 0,
|
|
11755
|
-
width: isItemsWidthFixed ? '100%' : itemsWidth,
|
|
11756
|
-
maxWidth: isItemsWidthFixed ? 'kitt.picker.maxWidthFixed' : undefined,
|
|
11757
|
-
zIndex: 1,
|
|
11758
|
-
_web: {
|
|
11759
|
-
style: {
|
|
11760
|
-
transform: `translate3d(${tooltipX}px, ${tooltipY}px, 0)`,
|
|
11761
|
-
visibility: isOpen ? 'visible' : 'hidden',
|
|
11762
|
-
transitionDuration: '300ms',
|
|
11763
|
-
transitionProperty: 'opacity, padding',
|
|
11764
|
-
transitionTimingFunction: 'ease-in-out'
|
|
11765
|
-
}
|
|
11766
|
-
},
|
|
11784
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Portal, {
|
|
11767
11785
|
children: /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
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,
|
|
11772
11795
|
_web: {
|
|
11773
11796
|
style: {
|
|
11774
|
-
transform: `
|
|
11797
|
+
transform: `translate3d(${tooltipX}px, ${tooltipY}px, 0)`,
|
|
11775
11798
|
visibility: isOpen ? 'visible' : 'hidden',
|
|
11776
11799
|
transitionDuration: '300ms',
|
|
11800
|
+
transitionProperty: 'opacity, padding',
|
|
11777
11801
|
transitionTimingFunction: 'ease-in-out'
|
|
11778
11802
|
}
|
|
11779
11803
|
},
|
|
11780
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
selected: ariaSelected
|
|
11807
|
-
},
|
|
11808
|
-
onPress: onClick,
|
|
11809
|
-
children: ({
|
|
11810
|
-
isHovered,
|
|
11811
|
-
isFocused,
|
|
11812
|
-
isPressed
|
|
11813
|
-
}) => {
|
|
11814
|
-
return /*#__PURE__*/jsxRuntime.jsx(PickerItem, {
|
|
11815
|
-
isSelected: checkSelectedItem(selectedItem || undefined, currentValue),
|
|
11816
|
-
isHighlighted: highlightedIndex === index,
|
|
11817
|
-
isHovered: isHovered,
|
|
11818
|
-
isFocused: isFocused,
|
|
11819
|
-
isPressed: isPressed,
|
|
11820
|
-
children: child
|
|
11821
|
-
});
|
|
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}`);
|
|
11822
11830
|
}
|
|
11823
|
-
|
|
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
|
+
})
|
|
11824
11862
|
})
|
|
11825
11863
|
})
|
|
11826
11864
|
})
|
|
11827
11865
|
})
|
|
11828
|
-
})
|
|
11866
|
+
})]
|
|
11829
11867
|
});
|
|
11830
11868
|
}
|
|
11831
11869
|
Picker.Option = PickerOption;
|
|
@@ -13289,67 +13327,69 @@ function Tooltip({
|
|
|
13289
13327
|
onFocus: handleToggleTooltip,
|
|
13290
13328
|
onBlur: handleToggleTooltip,
|
|
13291
13329
|
width: '100%'
|
|
13292
|
-
}), /*#__PURE__*/
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13310
|
-
|
|
13311
|
-
pointerEvents: isVisible ? 'auto' : 'none'
|
|
13312
|
-
},
|
|
13313
|
-
position: strategy,
|
|
13314
|
-
zIndex: zIndex,
|
|
13315
|
-
top: 0,
|
|
13316
|
-
left: 0,
|
|
13317
|
-
_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,
|
|
13318
13349
|
style: {
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
},
|
|
13326
|
-
onTouchStart: handleToggleTooltip,
|
|
13327
|
-
onTouchEnd: handleToggleTooltip,
|
|
13328
|
-
onMouseEnter: handleToggleTooltip,
|
|
13329
|
-
onMouseLeave: handleToggleTooltip,
|
|
13330
|
-
children: /*#__PURE__*/jsxRuntime.jsxs(View, {
|
|
13350
|
+
pointerEvents: isVisible ? 'auto' : 'none'
|
|
13351
|
+
},
|
|
13352
|
+
position: strategy,
|
|
13353
|
+
zIndex: zIndex,
|
|
13354
|
+
top: 0,
|
|
13355
|
+
left: 0,
|
|
13331
13356
|
_web: {
|
|
13332
13357
|
style: {
|
|
13333
|
-
transform: `
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
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
|
|
13338
13363
|
}
|
|
13339
13364
|
},
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
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
|
+
})
|
|
13351
13391
|
})
|
|
13352
|
-
})
|
|
13392
|
+
})]
|
|
13353
13393
|
});
|
|
13354
13394
|
}
|
|
13355
13395
|
Tooltip.Arrow = Arrow;
|