bootstrap-rn 0.1.0 → 0.1.1

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react-native'), require('react'), require('react-native/Libraries/Image/resolveAssetSource'), require('@floating-ui/core/dist/floating-ui.core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react-native', 'react', 'react-native/Libraries/Image/resolveAssetSource', '@floating-ui/core/dist/floating-ui.core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["bootstrap-rn"] = {}, global.ReactNative, global.React, global.require$$12, global.floatingUi_core));
5
- })(this, (function (exports, _reactNative, React, require$$12, floatingUi_core) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react-native'), require('react'), require('react-native/Libraries/Image/resolveAssetSource')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react-native', 'react', 'react-native/Libraries/Image/resolveAssetSource'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["bootstrap-rn"] = {}, global.ReactNative, global.React, global.require$$12));
5
+ })(this, (function (exports, _reactNative, React, require$$12) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -3589,6 +3589,11 @@
3589
3589
  return "".concat(unary || '').concat(number / (_reactNative.PixelRatio.getFontScale() * 16), "rem");
3590
3590
  });
3591
3591
  }
3592
+ function convertToNumber(value) {
3593
+ return parseFloat(value.replace(/([+-]+)?([\d.Ee]+)rem/g, function (_, unary, number) {
3594
+ return "".concat(unary || '').concat(_reactNative.PixelRatio.getFontScale() * 16 * number, "px");
3595
+ }));
3596
+ }
3592
3597
 
3593
3598
  // keys, but not the resolved values. The values are added later by the used
3594
3599
  // theme.
@@ -37833,7 +37838,7 @@
37833
37838
  * LICENSE file in the root directory of this source tree.
37834
37839
  */
37835
37840
 
37836
- var propTypes$1f = createCommonjsModule(function (module) {
37841
+ var propTypes$1g = createCommonjsModule(function (module) {
37837
37842
  {
37838
37843
  var ReactIs = reactIs;
37839
37844
 
@@ -37844,7 +37849,423 @@
37844
37849
  }
37845
37850
  });
37846
37851
 
37847
- var PropTypes = propTypes$1f;
37852
+ var PropTypes = propTypes$1g;
37853
+
37854
+ const isRTL = () => {
37855
+ // To support previous RN versions. Newer versions use below getConstants()
37856
+ if (_reactNative.I18nManager.isRTL !== undefined) {
37857
+ return _reactNative.I18nManager.isRTL;
37858
+ } // @ts-ignore - RN web only
37859
+
37860
+
37861
+ if (_reactNative.I18nManager.getConstants) {
37862
+ // @ts-ignore - RN web only
37863
+ return _reactNative.I18nManager.getConstants().isRTL;
37864
+ }
37865
+ };
37866
+
37867
+ const measureOffset = ref => new Promise(resolve => {
37868
+ if (ref.current) {
37869
+ ref.current.measureInWindow((x, y, width, height) => {
37870
+ resolve({
37871
+ top: y,
37872
+ left: x,
37873
+ width,
37874
+ height
37875
+ });
37876
+ });
37877
+ }
37878
+ });
37879
+
37880
+ function useOverlayPosition(props) {
37881
+ let {
37882
+ targetRef,
37883
+ overlayRef,
37884
+ placement = 'bottom',
37885
+ offset = 0,
37886
+ crossOffset = 0,
37887
+ isOpen = true,
37888
+ shouldFlip = true,
37889
+ shouldOverlapWithTrigger = false
37890
+ } = props;
37891
+ let [position, setPosition] = React__default["default"].useState({
37892
+ position: {},
37893
+ arrowOffsetLeft: undefined,
37894
+ arrowOffsetTop: undefined,
37895
+ maxHeight: undefined,
37896
+ placement: undefined
37897
+ }); // Layout measurement happens asynchronously in RN. This causes initial flickr. Using opacity and setting it to 1 post calculation prevents that.
37898
+
37899
+ let [rendered, setRendered] = React__default["default"].useState(false);
37900
+
37901
+ let updatePosition = async () => {
37902
+ const [overlayOffset, triggerOffset] = await Promise.all([measureOffset(overlayRef), measureOffset(targetRef)]); // Sometimes measure returns height/width 0. Best solution would be to use onLayout callback, but that might diverege from React Aria's useOverlayPosition API. Decide later, this works for now
37903
+
37904
+ if (!overlayOffset.width || !overlayOffset.height || !triggerOffset.width || !triggerOffset.height) {
37905
+ requestAnimationFrame(updatePosition);
37906
+ return;
37907
+ }
37908
+
37909
+ const {
37910
+ height: windowHeight,
37911
+ width: windowWidth
37912
+ } = _reactNative.Dimensions.get('window');
37913
+ const positions = calculatePosition({
37914
+ placement: translateRTL(placement),
37915
+ targetNode: triggerOffset,
37916
+ overlayNode: overlayOffset,
37917
+ scrollNode: overlayOffset,
37918
+ padding: 0,
37919
+ shouldFlip,
37920
+ boundaryElement: {
37921
+ top: 0,
37922
+ left: 0,
37923
+ width: windowWidth,
37924
+ height: windowHeight
37925
+ },
37926
+ offset,
37927
+ crossOffset,
37928
+ shouldOverlapWithTrigger
37929
+ });
37930
+ setPosition(positions);
37931
+ setRendered(true);
37932
+ };
37933
+
37934
+ React__default["default"].useEffect(() => {
37935
+ return () => {
37936
+ setRendered(false);
37937
+ };
37938
+ }, []);
37939
+ React__default["default"].useLayoutEffect(() => {
37940
+ updatePosition();
37941
+ }, [placement, isOpen, offset, shouldFlip, crossOffset, shouldOverlapWithTrigger]);
37942
+ const returnProps = {
37943
+ rendered,
37944
+ overlayProps: {
37945
+ style: { ...position.position
37946
+ }
37947
+ },
37948
+ placement: position.placement,
37949
+ arrowProps: {
37950
+ style: {
37951
+ left: position.arrowOffsetLeft,
37952
+ top: position.arrowOffsetTop
37953
+ }
37954
+ },
37955
+ updatePosition
37956
+ };
37957
+
37958
+ if (position.maxHeight !== undefined) {
37959
+ //@ts-ignore
37960
+ returnProps.overlayProps.style.maxHeight = position.maxHeight;
37961
+ }
37962
+
37963
+ return returnProps;
37964
+ }
37965
+
37966
+ function translateRTL(position) {
37967
+ if (isRTL()) {
37968
+ return position.replace('start', 'right').replace('end', 'left');
37969
+ }
37970
+
37971
+ return position.replace('start', 'left').replace('end', 'right');
37972
+ }
37973
+
37974
+ const calculatePosition = opts => {
37975
+ let {
37976
+ placement,
37977
+ targetNode,
37978
+ overlayNode,
37979
+ scrollNode,
37980
+ padding,
37981
+ shouldFlip,
37982
+ boundaryElement,
37983
+ offset,
37984
+ crossOffset,
37985
+ shouldOverlapWithTrigger
37986
+ } = opts;
37987
+ let childOffset = targetNode;
37988
+ let isContainerPositioned = false;
37989
+ let overlaySize = overlayNode;
37990
+ let margins = {
37991
+ top: 0,
37992
+ bottom: 0,
37993
+ left: 0,
37994
+ right: 0
37995
+ };
37996
+ let scrollSize = scrollNode;
37997
+ let boundaryDimensions = boundaryElement;
37998
+ let containerOffsetWithBoundary = overlayNode;
37999
+ return calculatePositionInternal(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, shouldOverlapWithTrigger);
38000
+ };
38001
+
38002
+ function calculatePositionInternal(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, shouldOverlapWithTrigger) {
38003
+ let placementInfo = parsePlacement(placementInput);
38004
+ let {
38005
+ size,
38006
+ crossAxis,
38007
+ crossSize,
38008
+ placement,
38009
+ crossPlacement
38010
+ } = placementInfo;
38011
+ let position = computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset);
38012
+ let normalizedOffset = offset;
38013
+ let space = getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
38014
+
38015
+ if (flip && scrollSize[size] > space) {
38016
+ let flippedPlacementInfo = parsePlacement(`${FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
38017
+ let flippedPosition = computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset);
38018
+ let flippedSpace = getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo); // If the available space for the flipped position is greater than the original available space, flip.
38019
+
38020
+ if (flippedSpace > space) {
38021
+ placementInfo = flippedPlacementInfo;
38022
+ position = flippedPosition;
38023
+ normalizedOffset = offset;
38024
+ }
38025
+ }
38026
+
38027
+ let delta = getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
38028
+ position[crossAxis] += delta;
38029
+ let maxHeight = getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset);
38030
+ overlaySize.height = Math.min(overlaySize.height, maxHeight);
38031
+ position = computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset);
38032
+ delta = getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
38033
+ position[crossAxis] += delta;
38034
+ let arrowPosition = {};
38035
+ arrowPosition[crossAxis] = childOffset[crossAxis] - position[crossAxis] + childOffset[crossSize] / 2;
38036
+
38037
+ if (shouldOverlapWithTrigger) {
38038
+ position[FLIPPED_DIRECTION[placementInfo.placement]] = position[FLIPPED_DIRECTION[placementInfo.placement]] - childOffset[size];
38039
+ }
38040
+
38041
+ return {
38042
+ position,
38043
+ maxHeight,
38044
+ arrowOffsetLeft: arrowPosition.left,
38045
+ arrowOffsetTop: arrowPosition.top,
38046
+ placement: placementInfo.placement
38047
+ };
38048
+ }
38049
+
38050
+ function getDelta(axis, offset, size, containerDimensions, padding) {
38051
+ //@ts-ignore
38052
+ let containerScroll = containerDimensions[axis]; //@ts-ignore
38053
+
38054
+ let containerHeight = containerDimensions[AXIS_SIZE[axis]];
38055
+ let startEdgeOffset = offset - padding - containerScroll;
38056
+ let endEdgeOffset = offset + padding - containerScroll + size;
38057
+
38058
+ if (startEdgeOffset < 0) {
38059
+ return -startEdgeOffset;
38060
+ } else if (endEdgeOffset > containerHeight) {
38061
+ return Math.max(containerHeight - endEdgeOffset, -startEdgeOffset);
38062
+ } else {
38063
+ return 0;
38064
+ }
38065
+ }
38066
+
38067
+ function getMaxHeight(position, boundaryDimensions, _containerOffsetWithBoundary, childOffset, _margins, _padding) {
38068
+ return position.top != null ? // We want the distance between the top of the overlay to the bottom of the boundary
38069
+ Math.max(0, boundaryDimensions.height - // this is the bottom of the boundary
38070
+ position.top // this is the top of the overlay
38071
+ ) : // We want the distance between the top of the trigger to the top of the boundary
38072
+ Math.max(0, childOffset.top - // this is the top of the trigger
38073
+ 0 // this is the top of the boundary
38074
+ );
38075
+ }
38076
+
38077
+ function computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, _containerOffsetWithBoundary, _isContainerPositioned) {
38078
+ let {
38079
+ placement,
38080
+ crossPlacement,
38081
+ axis,
38082
+ crossAxis,
38083
+ size,
38084
+ crossSize
38085
+ } = placementInfo;
38086
+ let position = {}; //@ts-ignore
38087
+
38088
+ position[crossAxis] = childOffset[crossAxis];
38089
+
38090
+ if (crossPlacement === 'center') {
38091
+ position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
38092
+ } else if (crossPlacement !== crossAxis) {
38093
+ position[crossAxis] += childOffset[crossSize] - overlaySize[crossSize];
38094
+ }
38095
+
38096
+ position[crossAxis] += crossOffset; // this is button center position - the overlay size + half of the button to align bottom of overlay with button center
38097
+
38098
+ let minViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2 - overlaySize[crossSize]; // this is button position of center, aligns top of overlay with button center
38099
+
38100
+ let maxViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2; // clamp it into the range of the min/max positions
38101
+
38102
+ position[crossAxis] = Math.min(Math.max(minViablePosition, position[crossAxis]), maxViablePosition); // Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
38103
+
38104
+ if (placement === axis) {
38105
+ // If the container is positioned (non-static), then we use the container's actual
38106
+ // height, as `bottom` will be relative to this height. But if the container is static,
38107
+ // then it can only be the `document.body`, and `bottom` will be relative to _its_
38108
+ // container, which should be as large as boundaryDimensions.
38109
+ const containerHeight = boundaryDimensions[size];
38110
+ position[FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
38111
+ } else {
38112
+ position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
38113
+ }
38114
+
38115
+ return position;
38116
+ }
38117
+
38118
+ function getAvailableSpace(boundaryDimensions, _containerOffsetWithBoundary, childOffset, _margins, padding, placementInfo) {
38119
+ let {
38120
+ placement,
38121
+ axis,
38122
+ size
38123
+ } = placementInfo;
38124
+
38125
+ if (placement === axis) {
38126
+ return Math.max(0, childOffset[axis] - padding);
38127
+ }
38128
+
38129
+ return Math.max(0, boundaryDimensions[size] - childOffset[axis] - childOffset[size] - padding);
38130
+ }
38131
+
38132
+ const AXIS = {
38133
+ top: 'top',
38134
+ bottom: 'top',
38135
+ left: 'left',
38136
+ right: 'left'
38137
+ };
38138
+ const FLIPPED_DIRECTION = {
38139
+ top: 'bottom',
38140
+ bottom: 'top',
38141
+ left: 'right',
38142
+ right: 'left'
38143
+ };
38144
+ const CROSS_AXIS = {
38145
+ top: 'left',
38146
+ left: 'top'
38147
+ };
38148
+ const AXIS_SIZE = {
38149
+ top: 'height',
38150
+ left: 'width'
38151
+ };
38152
+ const PARSED_PLACEMENT_CACHE = {};
38153
+
38154
+ function parsePlacement(input) {
38155
+ if (PARSED_PLACEMENT_CACHE[input]) {
38156
+ return PARSED_PLACEMENT_CACHE[input];
38157
+ }
38158
+
38159
+ let [placement, crossPlacement] = input.split(' ');
38160
+ let axis = AXIS[placement] || 'right';
38161
+ let crossAxis = CROSS_AXIS[axis];
38162
+
38163
+ if (!AXIS[crossPlacement]) {
38164
+ crossPlacement = 'center';
38165
+ }
38166
+
38167
+ let size = AXIS_SIZE[axis];
38168
+ let crossSize = AXIS_SIZE[crossAxis];
38169
+ PARSED_PLACEMENT_CACHE[input] = {
38170
+ placement,
38171
+ crossPlacement,
38172
+ axis,
38173
+ crossAxis,
38174
+ size,
38175
+ crossSize
38176
+ };
38177
+ return PARSED_PLACEMENT_CACHE[input];
38178
+ }
38179
+
38180
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
38181
+ const PortalContext = /*#__PURE__*/React__default["default"].createContext(null);
38182
+ let globalOverlayCounter = 0;
38183
+ function PortalProvider(props) {
38184
+ const [items, setItems] = React__default["default"].useState([]);
38185
+
38186
+ const setOverlayItem = item => {
38187
+ const overlayId = ++globalOverlayCounter;
38188
+ setItems(prev => prev.concat([{
38189
+ id: overlayId,
38190
+ node: item
38191
+ }]));
38192
+ return overlayId;
38193
+ };
38194
+
38195
+ const updateOverlayItem = (id, node) => {
38196
+ setItems(prev => prev.map(item => {
38197
+ if (item.id === id) {
38198
+ return {
38199
+ id,
38200
+ node
38201
+ };
38202
+ }
38203
+
38204
+ return item;
38205
+ }));
38206
+ };
38207
+
38208
+ const removeOverlayItem = id => {
38209
+ setItems(prev => {
38210
+ const newItems = prev.filter(item => item.id !== id);
38211
+ return newItems;
38212
+ });
38213
+ };
38214
+
38215
+ return /*#__PURE__*/React__default["default"].createElement(PortalContext.Provider, {
38216
+ value: {
38217
+ items,
38218
+ setOverlayItem,
38219
+ removeOverlayItem,
38220
+ updateOverlayItem
38221
+ }
38222
+ }, props.children, items.map(item => {
38223
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
38224
+ key: item.id
38225
+ }, item.node);
38226
+ }));
38227
+ }
38228
+
38229
+ function OverlayView(props) {
38230
+ return /*#__PURE__*/React__default["default"].createElement(_reactNative.View, _extends({
38231
+ pointerEvents: "box-none",
38232
+ style: _reactNative.StyleSheet.absoluteFill,
38233
+ collapsable: false
38234
+ }, props));
38235
+ }
38236
+
38237
+ const OverlayProvider = PortalProvider;
38238
+ function OverlayContainer(props) {
38239
+ const context = usePortalProvider();
38240
+ const overlayId = React__default["default"].useRef(undefined);
38241
+ let contents = /*#__PURE__*/React__default["default"].createElement(OverlayView, props);
38242
+ React.useEffect(() => {
38243
+ // Mount
38244
+ if (overlayId.current === undefined) {
38245
+ overlayId.current = context === null || context === void 0 ? void 0 : context.setOverlayItem(contents);
38246
+ } // Update
38247
+ else {
38248
+ if (overlayId.current) {
38249
+ context === null || context === void 0 ? void 0 : context.updateOverlayItem(overlayId.current, contents);
38250
+ }
38251
+ }
38252
+ }, // To re-render the child
38253
+ [props]); // Unmount
38254
+
38255
+ React.useEffect(() => {
38256
+ return () => {
38257
+ if (overlayId.current) {
38258
+ context === null || context === void 0 ? void 0 : context.removeOverlayItem(overlayId.current);
38259
+ }
38260
+ };
38261
+ }, []);
38262
+ return null;
38263
+ }
38264
+
38265
+ function usePortalProvider() {
38266
+ const context = React__default["default"].useContext(PortalContext);
38267
+ return context;
38268
+ }
37848
38269
 
37849
38270
  function useViewport(initialViewport) {
37850
38271
  var _useState = React.useState(initialViewport),
@@ -37897,7 +38318,7 @@
37897
38318
  return viewport;
37898
38319
  }
37899
38320
 
37900
- var propTypes$1e = {
38321
+ var propTypes$1f = {
37901
38322
  children: PropTypes.node.isRequired,
37902
38323
  // eslint-disable-next-line react/forbid-prop-types,
37903
38324
  utilities: PropTypes.object,
@@ -37928,15 +38349,15 @@
37928
38349
  };
37929
38350
  return /*#__PURE__*/React__default["default"].createElement(Context.Provider, {
37930
38351
  value: context
37931
- }, children);
38352
+ }, /*#__PURE__*/React__default["default"].createElement(OverlayProvider, null, children));
37932
38353
  }
37933
38354
 
37934
- Provider.propTypes = propTypes$1e;
38355
+ Provider.propTypes = propTypes$1f;
37935
38356
 
37936
38357
  var TextStyleContext = /*#__PURE__*/React__default["default"].createContext();
37937
38358
  TextStyleContext.displayName = 'TextStyleContext';
37938
38359
 
37939
- var propTypes$1d = {
38360
+ var propTypes$1e = {
37940
38361
  children: PropTypes.node,
37941
38362
  // eslint-disable-next-line react/forbid-prop-types
37942
38363
  style: PropTypes.any
@@ -37954,7 +38375,7 @@
37954
38375
  }, children);
37955
38376
  }
37956
38377
 
37957
- TextStyleProvider.propTypes = propTypes$1d;
38378
+ TextStyleProvider.propTypes = propTypes$1e;
37958
38379
 
37959
38380
  function useMedia() {
37960
38381
  var context = React.useContext(Context);
@@ -38035,7 +38456,7 @@
38035
38456
  }
38036
38457
 
38037
38458
  var _excluded$1g = ["style", "styleName"];
38038
- var propTypes$1c = {
38459
+ var propTypes$1d = {
38039
38460
  // eslint-disable-next-line react/forbid-prop-types
38040
38461
  style: PropTypes.any,
38041
38462
  // eslint-disable-next-line react/forbid-prop-types
@@ -38056,12 +38477,12 @@
38056
38477
  }));
38057
38478
  });
38058
38479
  View.displayName = 'View';
38059
- View.propTypes = propTypes$1c;
38480
+ View.propTypes = propTypes$1d;
38060
38481
 
38061
38482
  var _excluded$1f = ["children", "color", "dismissible", "style"];
38062
38483
 
38063
38484
  var _templateObject$_, _templateObject2$F, _templateObject3$k;
38064
- var propTypes$1b = {
38485
+ var propTypes$1c = {
38065
38486
  children: PropTypes.node.isRequired,
38066
38487
  color: PropTypes.oneOf(Object.keys(THEME_COLORS)),
38067
38488
  dismissible: PropTypes.bool,
@@ -38104,12 +38525,12 @@
38104
38525
  }, children));
38105
38526
  });
38106
38527
  Alert.displayName = 'Alert';
38107
- Alert.propTypes = propTypes$1b;
38528
+ Alert.propTypes = propTypes$1c;
38108
38529
 
38109
38530
  var _excluded$1e = ["color", "bold", "italic", "mark", "small", "style", "styleName"];
38110
38531
 
38111
38532
  var _templateObject$Z, _templateObject2$E, _templateObject3$j, _templateObject4$f, _templateObject5$d;
38112
- var propTypes$1a = {
38533
+ var propTypes$1b = {
38113
38534
  color: PropTypes.oneOf(Object.keys(THEME_COLORS)),
38114
38535
  small: PropTypes.bool,
38115
38536
  mark: PropTypes.bool,
@@ -38178,12 +38599,12 @@
38178
38599
  }, element);
38179
38600
  });
38180
38601
  Text.displayName = 'Text';
38181
- Text.propTypes = propTypes$1a;
38602
+ Text.propTypes = propTypes$1b;
38182
38603
 
38183
38604
  var _excluded$1d = ["children", "color", "style", "styleName"];
38184
38605
 
38185
38606
  var _templateObject$Y, _templateObject2$D;
38186
- var propTypes$19 = {
38607
+ var propTypes$1a = {
38187
38608
  children: PropTypes.node.isRequired,
38188
38609
  color: PropTypes.oneOf(Object.keys(THEME_COLORS)),
38189
38610
  // eslint-disable-next-line react/forbid-prop-types
@@ -38222,7 +38643,7 @@
38222
38643
  }, /*#__PURE__*/React__default["default"].createElement(Text, null, children)));
38223
38644
  });
38224
38645
  Badge.displayName = 'Badge';
38225
- Badge.propTypes = propTypes$19;
38646
+ Badge.propTypes = propTypes$1a;
38226
38647
 
38227
38648
  var ButtonGroupContext = /*#__PURE__*/React__default["default"].createContext();
38228
38649
  ButtonGroupContext.displayName = 'ButtonGroupContext';
@@ -38230,7 +38651,7 @@
38230
38651
  var _excluded$1c = ["children", "size", "style"];
38231
38652
 
38232
38653
  var _templateObject$X;
38233
- var propTypes$18 = {
38654
+ var propTypes$19 = {
38234
38655
  children: PropTypes.node.isRequired,
38235
38656
  size: PropTypes.oneOf(['lg', 'sm']),
38236
38657
  // eslint-disable-next-line react/forbid-prop-types
@@ -38259,12 +38680,12 @@
38259
38680
  }, makeListChildren(children)));
38260
38681
  });
38261
38682
  ButtonGroup.displayName = 'ButtonGroup';
38262
- ButtonGroup.propTypes = propTypes$18;
38683
+ ButtonGroup.propTypes = propTypes$19;
38263
38684
 
38264
38685
  var _excluded$1b = ["children", "style"];
38265
38686
 
38266
38687
  var _templateObject$W;
38267
- var propTypes$17 = {
38688
+ var propTypes$18 = {
38268
38689
  children: PropTypes.node.isRequired,
38269
38690
  // eslint-disable-next-line react/forbid-prop-types
38270
38691
  style: PropTypes.any
@@ -38285,7 +38706,7 @@
38285
38706
  }), children);
38286
38707
  });
38287
38708
  ButtonToolbar.displayName = 'ButtonToolbar';
38288
- ButtonToolbar.propTypes = propTypes$17;
38709
+ ButtonToolbar.propTypes = propTypes$18;
38289
38710
 
38290
38711
  var prefix = 'Invariant failed';
38291
38712
  function invariant(condition, message) {
@@ -38299,7 +38720,7 @@
38299
38720
 
38300
38721
  function useForcedContext(Context) {
38301
38722
  var context = React.useContext(Context);
38302
- invariant(context, "Failed to get context \"".concat(Context.dispalyName, "\"."));
38723
+ invariant(context, "Failed to get context \"".concat(Context.displayName, "\"."));
38303
38724
  return context;
38304
38725
  }
38305
38726
 
@@ -38353,7 +38774,7 @@
38353
38774
  }
38354
38775
 
38355
38776
  var _excluded$18 = ["children", "active", "style", "activeStyle", "textStyle", "activeTextStyle", "styleName"];
38356
- var propTypes$16 = {
38777
+ var propTypes$17 = {
38357
38778
  children: PropTypes.node,
38358
38779
  active: PropTypes.bool,
38359
38780
  // eslint-disable-next-line react/forbid-prop-types
@@ -38442,7 +38863,7 @@
38442
38863
  } : children);
38443
38864
  });
38444
38865
  Pressable.displayName = 'Pressable';
38445
- Pressable.propTypes = propTypes$16;
38866
+ Pressable.propTypes = propTypes$17;
38446
38867
 
38447
38868
  var _excluded$17 = ["active", "handlePress"];
38448
38869
  function useToggleButton(props) {
@@ -38470,7 +38891,7 @@
38470
38891
  var _excluded$16 = ["children", "color", "size", "outline", "first", "last", "active", "disabled", "style", "activeStyle", "textStyle", "activeTextStyle"];
38471
38892
 
38472
38893
  var _templateObject$V, _templateObject2$C, _templateObject3$i, _templateObject4$e, _templateObject5$c, _templateObject6$b, _templateObject7$9, _templateObject8$8, _templateObject9$3, _templateObject10$3, _templateObject11$3, _templateObject12$3, _templateObject13$3, _templateObject14$2, _templateObject15$1, _templateObject16$1, _templateObject17$1, _templateObject18$1, _templateObject19$1, _templateObject20$1, _templateObject21, _templateObject22, _templateObject23;
38473
- var propTypes$15 = {
38894
+ var propTypes$16 = {
38474
38895
  children: PropTypes.node.isRequired,
38475
38896
  color: PropTypes.oneOf([].concat(_toConsumableArray(Object.keys(THEME_COLORS)), ['link'])),
38476
38897
  size: PropTypes.oneOf(['lg', 'sm']),
@@ -38599,13 +39020,13 @@
38599
39020
  }), children);
38600
39021
  });
38601
39022
  Button.displayName = 'Button';
38602
- Button.propTypes = propTypes$15;
39023
+ Button.propTypes = propTypes$16;
38603
39024
  Button.useToggle = useToggleButton;
38604
39025
 
38605
39026
  var _excluded$15 = ["children", "style"];
38606
39027
 
38607
39028
  var _templateObject$U, _templateObject2$B;
38608
- var propTypes$14 = {
39029
+ var propTypes$15 = {
38609
39030
  children: PropTypes.node.isRequired,
38610
39031
  // eslint-disable-next-line react/forbid-prop-types
38611
39032
  style: PropTypes.any
@@ -38629,12 +39050,12 @@
38629
39050
  }, children));
38630
39051
  });
38631
39052
  CardBody.displayName = 'CardBody';
38632
- CardBody.propTypes = propTypes$14;
39053
+ CardBody.propTypes = propTypes$15;
38633
39054
 
38634
39055
  var _excluded$14 = ["children", "style"];
38635
39056
 
38636
39057
  var _templateObject$T, _templateObject2$A;
38637
- var propTypes$13 = {
39058
+ var propTypes$14 = {
38638
39059
  children: PropTypes.node.isRequired,
38639
39060
  // eslint-disable-next-line react/forbid-prop-types
38640
39061
  style: PropTypes.any
@@ -38658,12 +39079,12 @@
38658
39079
  }, children));
38659
39080
  });
38660
39081
  CardHeader.displayName = 'CardHeader';
38661
- CardHeader.propTypes = propTypes$13;
39082
+ CardHeader.propTypes = propTypes$14;
38662
39083
 
38663
39084
  var _excluded$13 = ["children", "style"];
38664
39085
 
38665
39086
  var _templateObject$S, _templateObject2$z;
38666
- var propTypes$12 = {
39087
+ var propTypes$13 = {
38667
39088
  children: PropTypes.node.isRequired,
38668
39089
  // eslint-disable-next-line react/forbid-prop-types
38669
39090
  style: PropTypes.any
@@ -38687,12 +39108,12 @@
38687
39108
  }, children));
38688
39109
  });
38689
39110
  CardFooter.displayName = 'CardFooter';
38690
- CardFooter.propTypes = propTypes$12;
39111
+ CardFooter.propTypes = propTypes$13;
38691
39112
 
38692
39113
  var _excluded$12 = ["children", "style"];
38693
39114
 
38694
39115
  var _templateObject$R;
38695
- var propTypes$11 = {
39116
+ var propTypes$12 = {
38696
39117
  children: PropTypes.node.isRequired,
38697
39118
  // eslint-disable-next-line react/forbid-prop-types
38698
39119
  style: PropTypes.any
@@ -38712,7 +39133,7 @@
38712
39133
  }), children);
38713
39134
  });
38714
39135
  Card.displayName = 'Card';
38715
- Card.propTypes = propTypes$11;
39136
+ Card.propTypes = propTypes$12;
38716
39137
  Card.Header = CardHeader;
38717
39138
  Card.Body = CardBody;
38718
39139
  Card.Footer = CardFooter;
@@ -38720,7 +39141,7 @@
38720
39141
  var _excluded$11 = ["children", "disabled", "style", "textStyle"];
38721
39142
 
38722
39143
  var _templateObject$Q, _templateObject2$y, _templateObject3$h;
38723
- var propTypes$10 = {
39144
+ var propTypes$11 = {
38724
39145
  children: PropTypes.node,
38725
39146
  disabled: PropTypes.bool,
38726
39147
  // eslint-disable-next-line react/forbid-prop-types
@@ -38751,7 +39172,7 @@
38751
39172
  }), StyleSheet.value('btn-close-bg'));
38752
39173
  });
38753
39174
  CloseButton.displayName = 'CloseButton';
38754
- CloseButton.propTypes = propTypes$10;
39175
+ CloseButton.propTypes = propTypes$11;
38755
39176
 
38756
39177
  var CollapseContext = /*#__PURE__*/React__default["default"].createContext();
38757
39178
  CollapseContext.displayName = 'CollapseContext';
@@ -38810,7 +39231,7 @@
38810
39231
  }, [visible]);
38811
39232
  }
38812
39233
 
38813
- var propTypes$$ = {
39234
+ var propTypes$10 = {
38814
39235
  children: PropTypes.node.isRequired,
38815
39236
  defaultVisible: PropTypes.bool,
38816
39237
  visible: PropTypes.bool,
@@ -38830,7 +39251,7 @@
38830
39251
  };
38831
39252
 
38832
39253
  CollapseProvider.displayName = 'CollapseProvider';
38833
- CollapseProvider.propTypes = propTypes$$;
39254
+ CollapseProvider.propTypes = propTypes$10;
38834
39255
 
38835
39256
  var _excluded$10 = ["onPress"];
38836
39257
  function useToggleCollapse(props) {
@@ -38852,7 +39273,7 @@
38852
39273
  }
38853
39274
 
38854
39275
  var _excluded$$ = ["children"];
38855
- var propTypes$_ = {
39276
+ var propTypes$$ = {
38856
39277
  children: PropTypes.node
38857
39278
  };
38858
39279
  var Collapse = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
@@ -38873,7 +39294,7 @@
38873
39294
  }), children);
38874
39295
  });
38875
39296
  Collapse.displayName = 'Collapse';
38876
- Collapse.propTypes = propTypes$_;
39297
+ Collapse.propTypes = propTypes$$;
38877
39298
  Collapse.Provider = CollapseProvider;
38878
39299
  Collapse.useToggle = useToggleCollapse;
38879
39300
 
@@ -38901,7 +39322,7 @@
38901
39322
  var _excluded$_ = ["fluid", "style"];
38902
39323
 
38903
39324
  var _templateObject$P, _templateObject2$x, _templateObject3$g, _templateObject4$d, _templateObject5$b, _templateObject6$a, _templateObject7$8, _templateObject8$7;
38904
- var propTypes$Z = {
39325
+ var propTypes$_ = {
38905
39326
  children: PropTypes.node.isRequired,
38906
39327
  fluid: PropTypes.oneOf([true].concat(_toConsumableArray(Object.keys(CONTAINER_MAX_WIDTHS)))),
38907
39328
  // eslint-disable-next-line react/forbid-prop-types
@@ -38965,33 +39386,95 @@
38965
39386
  }));
38966
39387
  });
38967
39388
  Container.displayName = 'Container';
38968
- Container.propTypes = propTypes$Z;
39389
+ Container.propTypes = propTypes$_;
38969
39390
 
38970
39391
  var DropdownContext = /*#__PURE__*/React__default["default"].createContext();
38971
39392
  DropdownContext.displayName = 'DropdownContext';
38972
39393
 
38973
- var _excluded$Z = ["children", "style"];
39394
+ var propTypes$Z = {
39395
+ children: PropTypes.func.isRequired,
39396
+ placement: PropTypes.string.isRequired,
39397
+ targetRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
39398
+ offset: PropTypes.number,
39399
+ visible: PropTypes.bool.isRequired
39400
+ };
39401
+
39402
+ var Overlay = function Overlay(props) {
39403
+ var children = props.children,
39404
+ targetRef = props.targetRef,
39405
+ placement = props.placement,
39406
+ offset = props.offset,
39407
+ visible = props.visible;
39408
+ var overlayRef = React.useRef();
39409
+ var overlay = useOverlayPosition({
39410
+ placement: placement,
39411
+ targetRef: targetRef,
39412
+ overlayRef: overlayRef,
39413
+ offset: offset,
39414
+ isOpen: visible
39415
+ });
39416
+ return children(overlay, overlayRef);
39417
+ };
39418
+
39419
+ Overlay.displayName = 'Overlay';
39420
+ Overlay.propTypes = propTypes$Z;
39421
+
39422
+ var _excluded$Z = ["children", "start", "end", "style"];
38974
39423
 
38975
39424
  var _templateObject$O, _templateObject2$w;
39425
+ var ALIGNMENT_BREAKPOINTS = [true, 'sm', 'md', 'lg', 'xl', 'xxl'];
38976
39426
  var propTypes$Y = {
38977
39427
  children: PropTypes.node.isRequired,
39428
+ start: PropTypes.oneOf(ALIGNMENT_BREAKPOINTS),
39429
+ end: PropTypes.oneOf(ALIGNMENT_BREAKPOINTS),
38978
39430
  // eslint-disable-next-line react/forbid-prop-types
38979
39431
  style: PropTypes.any
38980
39432
  };
38981
39433
  var styles$O = StyleSheet.create({
38982
- '.dropdown-menu': css$1(_templateObject$O || (_templateObject$O = _taggedTemplateLiteral(["\n position: absolute;\n z-index: $zindex-dropdown;\n // display: none; // none by default, but block on \"open\" of the menu\n min-width: $dropdown-min-width;\n padding: $dropdown-padding-y $dropdown-padding-x;\n margin: 0; // Override default margin of ul\n // list-style: none;\n background-color: $dropdown-bg;\n // background-clip: padding-box;\n border: $dropdown-border-width solid $dropdown-border-color;\n border-radius: $dropdown-border-radius;\n // @include box-shadow($dropdown-box-shadow);\n margin-top: $dropdown-spacer; // added for bootstrap-rn\n "]))),
39434
+ '.dropdown-menu': css$1(_templateObject$O || (_templateObject$O = _taggedTemplateLiteral(["\n position: absolute;\n z-index: $zindex-dropdown;\n // display: none; // none by default, but block on \"open\" of the menu\n min-width: $dropdown-min-width;\n padding: $dropdown-padding-y $dropdown-padding-x;\n margin: 0; // Override default margin of ul\n // list-style: none;\n background-color: $dropdown-bg;\n // background-clip: padding-box;\n border: $dropdown-border-width solid $dropdown-border-color;\n border-radius: $dropdown-border-radius;\n // @include box-shadow($dropdown-box-shadow);\n "]))),
38983
39435
  '.dropdown-menu-text': css$1(_templateObject2$w || (_templateObject2$w = _taggedTemplateLiteral(["\n font-size: $dropdown-font-size;\n color: $dropdown-color;\n text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)\n "])))
38984
39436
  });
39437
+
39438
+ var getAlignment = function getAlignment(media, start, end) {
39439
+ var alignStart = typeof start === 'boolean' ? start : media.up(start);
39440
+ var alignEnd = typeof end === 'boolean' ? end : media.up(end);
39441
+
39442
+ if (!alignEnd) {
39443
+ return 'start';
39444
+ }
39445
+
39446
+ if (!alignStart) {
39447
+ return 'end';
39448
+ }
39449
+
39450
+ var startIndex = ALIGNMENT_BREAKPOINTS.indexOf(start);
39451
+ var endIndex = ALIGNMENT_BREAKPOINTS.indexOf(end);
39452
+ return startIndex > endIndex ? 'start' : 'end';
39453
+ };
39454
+
39455
+ var getPlacement = function getPlacement(media, direction, start, end) {
39456
+ if (direction === 'start' || direction === 'end') {
39457
+ return "".concat(direction, " top");
39458
+ }
39459
+
39460
+ return "".concat(direction, " ").concat(getAlignment(media, start, end));
39461
+ };
39462
+
38985
39463
  var DropdownMenu = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
38986
39464
  var children = props.children,
39465
+ _props$start = props.start,
39466
+ start = _props$start === void 0 ? true : _props$start,
39467
+ _props$end = props.end,
39468
+ end = _props$end === void 0 ? false : _props$end,
38987
39469
  style = props.style,
38988
39470
  elementProps = _objectWithoutProperties(props, _excluded$Z);
38989
39471
 
38990
39472
  var dropdown = useForcedContext(DropdownContext);
39473
+ var media = useMedia();
38991
39474
  var identifier = dropdown.identifier,
38992
- visible = dropdown.visible,
38993
- menuRef = dropdown.menuRef,
38994
- menuPos = dropdown.menuPos;
39475
+ direction = dropdown.direction,
39476
+ triggerRef = dropdown.triggerRef,
39477
+ visible = dropdown.visible;
38995
39478
 
38996
39479
  if (!visible) {
38997
39480
  return null;
@@ -38999,16 +39482,26 @@
38999
39482
 
39000
39483
  var classes = getStyles(styles$O, ['.dropdown-menu']);
39001
39484
  var textClasses = getStyles(styles$O, ['.dropdown-menu-text']);
39002
- return /*#__PURE__*/React__default["default"].createElement(View, _extends$2({}, elementProps, {
39003
- ref: concatRefs(menuRef, ref),
39004
- accessibilityLabelledBy: identifier,
39005
- style: [classes, {
39006
- top: menuPos.y,
39007
- left: menuPos.x
39008
- }, style]
39009
- }), /*#__PURE__*/React__default["default"].createElement(TextStyleProvider, {
39010
- style: textClasses
39011
- }, children));
39485
+ return /*#__PURE__*/React__default["default"].createElement(OverlayContainer, null, /*#__PURE__*/React__default["default"].createElement(Overlay, {
39486
+ placement: getPlacement(media, direction, start, end),
39487
+ targetRef: triggerRef,
39488
+ offset: convertToNumber(StyleSheet.value('dropdown-spacer')),
39489
+ visible: visible
39490
+ }, function (_ref, menuRef) {
39491
+ var overlayProps = _ref.overlayProps,
39492
+ rendered = _ref.rendered;
39493
+ return /*#__PURE__*/React__default["default"].createElement(View, _extends$2({}, elementProps, {
39494
+ ref: concatRefs(menuRef, ref),
39495
+ accessibilityLabelledBy: identifier,
39496
+ style: [classes, style, {
39497
+ opacity: rendered ? 1 : 0
39498
+ }, overlayProps.style]
39499
+ }), /*#__PURE__*/React__default["default"].createElement(DropdownContext.Provider, {
39500
+ value: dropdown
39501
+ }, /*#__PURE__*/React__default["default"].createElement(TextStyleProvider, {
39502
+ style: textClasses
39503
+ }, children)));
39504
+ }));
39012
39505
  });
39013
39506
  DropdownMenu.displayName = 'DropdownMenu';
39014
39507
  DropdownMenu.propTypes = propTypes$Y;
@@ -39046,12 +39539,12 @@
39046
39539
  textStyle = props.textStyle,
39047
39540
  elementProps = _objectWithoutProperties(props, _excluded$Y);
39048
39541
 
39049
- var context = React.useContext(DropdownContext);
39542
+ var dropdown = useForcedContext(DropdownContext);
39050
39543
  var classes = getStyles(styles$N, ['.dropdown-item', active && '.dropdown-item-active', disabled && '.dropdown-item-disabled']);
39051
39544
  var textClasses = getStyles(styles$N, ['.dropdown-item-text', active && '.dropdown-item-active-text', disabled && '.dropdown-item-disabled-text']);
39052
39545
  return /*#__PURE__*/React__default["default"].createElement(Pressable, _extends$2({}, elementProps, {
39053
39546
  onPress: concatFns(function () {
39054
- context.setVisible(false);
39547
+ dropdown.setVisible(false);
39055
39548
  }, handlePress),
39056
39549
  disabled: disabled,
39057
39550
  style: [classes, style],
@@ -39169,343 +39662,9 @@
39169
39662
  DropdownDivider.displayName = 'DropdownDivider';
39170
39663
  DropdownDivider.propTypes = propTypes$T;
39171
39664
 
39172
- function _extends() {
39173
- _extends = Object.assign || function (target) {
39174
- for (var i = 1; i < arguments.length; i++) {
39175
- var source = arguments[i];
39176
-
39177
- for (var key in source) {
39178
- if (Object.prototype.hasOwnProperty.call(source, key)) {
39179
- target[key] = source[key];
39180
- }
39181
- }
39182
- }
39183
-
39184
- return target;
39185
- };
39186
-
39187
- return _extends.apply(this, arguments);
39188
- }
39189
-
39190
- function rectToClientRect(rect) {
39191
- return { ...rect,
39192
- top: rect.y,
39193
- left: rect.x,
39194
- right: rect.x + rect.width,
39195
- bottom: rect.y + rect.height
39196
- };
39197
- }
39198
-
39199
- var ORIGIN$1 = {
39200
- x: 0,
39201
- y: 0
39202
- };
39203
- var createPlatform = function createPlatform(_ref) {
39204
- var offsetParent = _ref.offsetParent,
39205
- _ref$sameScrollView = _ref.sameScrollView,
39206
- sameScrollView = _ref$sameScrollView === void 0 ? true : _ref$sameScrollView,
39207
- _ref$scrollOffsets = _ref.scrollOffsets,
39208
- scrollOffsets = _ref$scrollOffsets === void 0 ? ORIGIN$1 : _ref$scrollOffsets;
39209
- return {
39210
- getElementRects: function getElementRects(_ref2) {
39211
- var reference = _ref2.reference,
39212
- floating = _ref2.floating;
39213
- return new Promise(function (resolve) {
39214
- var onMeasure = function onMeasure(offsetX, offsetY) {
39215
- if (offsetX === void 0) {
39216
- offsetX = 0;
39217
- }
39218
-
39219
- if (offsetY === void 0) {
39220
- offsetY = 0;
39221
- }
39222
-
39223
- floating.measure(function (x, y, width, height) {
39224
- var floatingRect = _extends({
39225
- width: width,
39226
- height: height
39227
- }, ORIGIN$1);
39228
-
39229
- var method = sameScrollView ? 'measure' : 'measureInWindow';
39230
- reference[method](function (x, y, width, height) {
39231
- var referenceRect = {
39232
- width: width,
39233
- height: height,
39234
- x: x - offsetX,
39235
- y: y - offsetY
39236
- };
39237
- resolve({
39238
- reference: referenceRect,
39239
- floating: floatingRect
39240
- });
39241
- });
39242
- });
39243
- };
39244
-
39245
- if (offsetParent.current) {
39246
- offsetParent.current.measure(onMeasure);
39247
- } else {
39248
- onMeasure();
39249
- }
39250
- });
39251
- },
39252
- getClippingClientRect: function getClippingClientRect() {
39253
- var _Dimensions$get = _reactNative.Dimensions.get('window'),
39254
- width = _Dimensions$get.width,
39255
- height = _Dimensions$get.height;
39256
-
39257
- return Promise.resolve(rectToClientRect(_extends({
39258
- width: width,
39259
- height: height
39260
- }, sameScrollView ? scrollOffsets : ORIGIN$1)));
39261
- },
39262
- convertOffsetParentRelativeRectToViewportRelativeRect: function convertOffsetParentRelativeRectToViewportRelativeRect(_ref3) {
39263
- var rect = _ref3.rect;
39264
- return new Promise(function (resolve) {
39265
- var onMeasure = function onMeasure(offsetX, offsetY) {
39266
- if (offsetX === void 0) {
39267
- offsetX = 0;
39268
- }
39269
-
39270
- if (offsetY === void 0) {
39271
- offsetY = 0;
39272
- }
39273
-
39274
- resolve(_extends({}, rect, {
39275
- x: rect.x + offsetX,
39276
- y: rect.y + offsetY
39277
- }));
39278
- };
39279
-
39280
- if (offsetParent.current) {
39281
- offsetParent.current.measure(onMeasure);
39282
- } else {
39283
- onMeasure();
39284
- }
39285
- });
39286
- },
39287
- getDocumentElement: function getDocumentElement() {
39288
- return Promise.resolve({});
39289
- },
39290
- // these are the properties accessed on an offsetParent
39291
- getOffsetParent: function getOffsetParent() {
39292
- return Promise.resolve({
39293
- clientLeft: 0,
39294
- clientTop: 0,
39295
- clientWidth: 0,
39296
- clientHeight: 0
39297
- });
39298
- },
39299
- getDimensions: function getDimensions(_ref4) {
39300
- var element = _ref4.element;
39301
- return new Promise(function (resolve) {
39302
- return element.measure(function (_ref5) {
39303
- var width = _ref5.width,
39304
- height = _ref5.height;
39305
- return resolve({
39306
- width: width,
39307
- height: height
39308
- });
39309
- });
39310
- });
39311
- },
39312
- isElement: function isElement() {
39313
- return Promise.resolve(true);
39314
- }
39315
- };
39316
- };
39317
-
39318
- // Fork of `fast-deep-equal` that only does the comparisons we need and compares
39319
- // functions
39320
- function deepEqual(a, b) {
39321
- if (a === b) {
39322
- return true;
39323
- }
39324
-
39325
- if (typeof a !== typeof b) {
39326
- return false;
39327
- }
39328
-
39329
- if (typeof a === 'function' && a.toString() === b.toString()) {
39330
- return true;
39331
- }
39332
-
39333
- var length, i, keys;
39334
-
39335
- if (a && b && typeof a == 'object') {
39336
- if (Array.isArray(a)) {
39337
- length = a.length;
39338
- if (length != b.length) return false;
39339
-
39340
- for (i = length; i-- !== 0;) {
39341
- if (!deepEqual(a[i], b[i])) {
39342
- return false;
39343
- }
39344
- }
39345
-
39346
- return true;
39347
- }
39348
-
39349
- keys = Object.keys(a);
39350
- length = keys.length;
39351
-
39352
- if (length !== Object.keys(b).length) {
39353
- return false;
39354
- }
39355
-
39356
- for (i = length; i-- !== 0;) {
39357
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
39358
- return false;
39359
- }
39360
- }
39361
-
39362
- for (i = length; i-- !== 0;) {
39363
- var key = keys[i];
39364
-
39365
- if (key === '_owner' && a.$$typeof) {
39366
- continue;
39367
- }
39368
-
39369
- if (!deepEqual(a[key], b[key])) {
39370
- return false;
39371
- }
39372
- }
39373
-
39374
- return true;
39375
- }
39376
-
39377
- return a !== a && b !== b;
39378
- }
39379
-
39380
- var ORIGIN = {
39381
- x: 0,
39382
- y: 0
39383
- };
39384
- var useFloating = function useFloating(_temp) {
39385
- var _ref = _temp === void 0 ? {} : _temp,
39386
- _ref$placement = _ref.placement,
39387
- placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,
39388
- middleware = _ref.middleware,
39389
- _ref$sameScrollView = _ref.sameScrollView,
39390
- sameScrollView = _ref$sameScrollView === void 0 ? true : _ref$sameScrollView;
39391
-
39392
- var reference = React.useRef();
39393
- var floating = React.useRef();
39394
- var offsetParent = React.useRef();
39395
-
39396
- var _useState = React.useState({
39397
- x: null,
39398
- y: null,
39399
- placement: placement,
39400
- strategy: 'absolute',
39401
- middlewareData: {}
39402
- }),
39403
- data = _useState[0],
39404
- setData = _useState[1];
39405
-
39406
- var _useState2 = React.useState(ORIGIN),
39407
- scrollOffsets = _useState2[0],
39408
- setScrollOffsets = _useState2[1];
39409
-
39410
- var platform = React.useMemo(function () {
39411
- return createPlatform({
39412
- offsetParent: offsetParent,
39413
- scrollOffsets: scrollOffsets,
39414
- sameScrollView: sameScrollView
39415
- });
39416
- }, [offsetParent, scrollOffsets, sameScrollView]);
39417
-
39418
- var _useState3 = React.useState(middleware),
39419
- latestMiddleware = _useState3[0],
39420
- setLatestMiddleware = _useState3[1];
39421
-
39422
- if (!deepEqual(latestMiddleware == null ? void 0 : latestMiddleware.map(function (_ref2) {
39423
- var options = _ref2.options;
39424
- return options;
39425
- }), middleware == null ? void 0 : middleware.map(function (_ref3) {
39426
- var options = _ref3.options;
39427
- return options;
39428
- }))) {
39429
- setLatestMiddleware(middleware);
39430
- }
39431
-
39432
- var animationFrames = React.useRef([]);
39433
- var isMountedRef = React.useRef(true);
39434
- React.useLayoutEffect(function () {
39435
- isMountedRef.current = true;
39436
- return function () {
39437
- isMountedRef.current = false;
39438
- };
39439
- }, []);
39440
- var update = React.useCallback(function () {
39441
- if (!reference.current || !floating.current) {
39442
- return;
39443
- }
39444
-
39445
- floatingUi_core.computePosition(reference.current, floating.current, {
39446
- middleware: latestMiddleware,
39447
- platform: platform,
39448
- placement: placement
39449
- }).then(function (data) {
39450
- if (isMountedRef.current) {
39451
- setData(data);
39452
- }
39453
- });
39454
- }, [latestMiddleware, platform, placement]);
39455
- React.useLayoutEffect(function () {
39456
- var frames = animationFrames.current;
39457
- frames.push(requestAnimationFrame(update));
39458
- return function () {
39459
- frames.forEach(cancelAnimationFrame);
39460
- animationFrames.current = [];
39461
- };
39462
- }, [update]);
39463
- var setReference = React.useCallback(function (node) {
39464
- reference.current = node;
39465
- animationFrames.current.push(requestAnimationFrame(update));
39466
- }, [update]);
39467
- var setFloating = React.useCallback(function (node) {
39468
- floating.current = node;
39469
- animationFrames.current.push(requestAnimationFrame(update));
39470
- }, [update]);
39471
- var setOffsetParent = React.useCallback(function (node) {
39472
- offsetParent.current = node;
39473
- animationFrames.current.push(requestAnimationFrame(update));
39474
- }, [update]);
39475
- return React.useMemo(function () {
39476
- return _extends({}, data, {
39477
- update: update,
39478
- refs: {
39479
- reference: reference,
39480
- floating: floating,
39481
- offsetParent: offsetParent
39482
- },
39483
- offsetParent: setOffsetParent,
39484
- reference: setReference,
39485
- floating: setFloating,
39486
- scrollProps: {
39487
- onScroll: function onScroll(event) {
39488
- return setScrollOffsets(event.nativeEvent.contentOffset);
39489
- },
39490
- scrollEventThrottle: 16
39491
- }
39492
- });
39493
- }, [data, setReference, setFloating, setOffsetParent, update]);
39494
- };
39495
-
39496
- function useDropdown(defaultVisible, controlledVisible, onToggle, placement) {
39665
+ function useDropdown(defaultVisible, controlledVisible, onToggle, direction) {
39497
39666
  var identifier = useIdentifier('dropdown');
39498
-
39499
- var _useFloating = useFloating({
39500
- placement: placement,
39501
- middleware: [floatingUi_core.shift()]
39502
- }),
39503
- _useFloating$x = _useFloating.x,
39504
- x = _useFloating$x === void 0 ? 0 : _useFloating$x,
39505
- _useFloating$y = _useFloating.y,
39506
- y = _useFloating$y === void 0 ? 0 : _useFloating$y,
39507
- triggerRef = _useFloating.reference,
39508
- menuRef = _useFloating.floating;
39667
+ var triggerRef = React.useRef();
39509
39668
 
39510
39669
  var _useControlledState = useControlledState(defaultVisible, controlledVisible, onToggle),
39511
39670
  _useControlledState2 = _slicedToArray(_useControlledState, 2),
@@ -39518,13 +39677,9 @@
39518
39677
  visible: visible,
39519
39678
  setVisible: setVisible,
39520
39679
  triggerRef: triggerRef,
39521
- menuRef: menuRef,
39522
- menuPos: {
39523
- x: x,
39524
- y: y
39525
- }
39680
+ direction: direction
39526
39681
  };
39527
- }, [visible, x, y]);
39682
+ }, [visible]);
39528
39683
  }
39529
39684
 
39530
39685
  var _excluded$T = ["onPress"];
@@ -39548,16 +39703,16 @@
39548
39703
  });
39549
39704
  }
39550
39705
 
39551
- var _excluded$S = ["children", "defaultVisible", "visible", "onToggle", "placement", "style"];
39706
+ var _excluded$S = ["children", "defaultVisible", "visible", "onToggle", "direction", "style"];
39552
39707
 
39553
39708
  var _templateObject$I;
39554
- var PLACEMENTS$2 = ['top', 'bottom', 'left', 'right'];
39709
+ var DIRECTIONS = ['top', 'bottom', 'start', 'end'];
39555
39710
  var propTypes$S = {
39556
39711
  children: PropTypes.node,
39557
39712
  defaultVisible: PropTypes.bool,
39558
39713
  visible: PropTypes.bool,
39559
39714
  onToggle: PropTypes.func,
39560
- placement: PropTypes.oneOf(PLACEMENTS$2),
39715
+ direction: PropTypes.oneOf(DIRECTIONS),
39561
39716
  // eslint-disable-next-line react/forbid-prop-types
39562
39717
  style: PropTypes.any
39563
39718
  };
@@ -39570,12 +39725,12 @@
39570
39725
  defaultVisible = _props$defaultVisible === void 0 ? false : _props$defaultVisible,
39571
39726
  visible = props.visible,
39572
39727
  onToggle = props.onToggle,
39573
- _props$placement = props.placement,
39574
- placement = _props$placement === void 0 ? 'bottom' : _props$placement,
39728
+ _props$direction = props.direction,
39729
+ direction = _props$direction === void 0 ? 'bottom' : _props$direction,
39575
39730
  style = props.style,
39576
39731
  elementProps = _objectWithoutProperties(props, _excluded$S);
39577
39732
 
39578
- var dropdown = useDropdown(defaultVisible, visible, onToggle, placement);
39733
+ var dropdown = useDropdown(defaultVisible, visible, onToggle, direction);
39579
39734
  var classes = getStyles(styles$I, ['.dropdown']);
39580
39735
  return /*#__PURE__*/React__default["default"].createElement(View, _extends$2({}, elementProps, {
39581
39736
  ref: ref,
@@ -41245,7 +41400,7 @@
41245
41400
  defaultExpanded: PropTypes.bool,
41246
41401
  expanded: PropTypes.bool,
41247
41402
  onToggle: PropTypes.func,
41248
- expand: PropTypes.oneOf([true, 'sm', 'md', 'lg', 'xl']),
41403
+ expand: PropTypes.oneOf([true, 'sm', 'md', 'lg', 'xl', 'xxl']),
41249
41404
  // eslint-disable-next-line react/forbid-prop-types
41250
41405
  style: PropTypes.any
41251
41406
  };