bootstrap-rn 0.2.11 → 0.2.13
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/dist/bootstrap-rn.cjs.js +94 -54
- package/dist/bootstrap-rn.esm.js +95 -55
- package/dist/bootstrap-rn.umd.js +153 -65
- package/dist/bootstrap-rn.umd.min.js +3 -3
- package/package.json +6 -6
package/dist/bootstrap-rn.umd.js
CHANGED
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
// const expo = global.__expo;
|
|
26
|
+
|
|
27
|
+
const IOS_STATUS_BAR_HEIGHT = 20;
|
|
28
|
+
// Try to get height from expo if app is using expo env
|
|
29
|
+
// IOS >= 11 is handled using SafeAreaView
|
|
30
|
+
|
|
31
|
+
const APPROX_STATUSBAR_HEIGHT = reactNative.Platform.select({
|
|
32
|
+
android: reactNative.StatusBar.currentHeight,
|
|
33
|
+
ios: reactNative.Platform.Version < 11 ? IOS_STATUS_BAR_HEIGHT : 0
|
|
34
|
+
});
|
|
35
|
+
|
|
24
36
|
const measureOffset = ref => new Promise(resolve => {
|
|
25
37
|
if (ref.current) {
|
|
26
38
|
ref.current.measureInWindow((x, y, width, height) => {
|
|
@@ -35,6 +47,8 @@
|
|
|
35
47
|
});
|
|
36
48
|
|
|
37
49
|
function useOverlayPosition(props) {
|
|
50
|
+
var _position$position, _position$position2;
|
|
51
|
+
|
|
38
52
|
let {
|
|
39
53
|
targetRef,
|
|
40
54
|
overlayRef,
|
|
@@ -96,17 +110,25 @@
|
|
|
96
110
|
React__default["default"].useLayoutEffect(() => {
|
|
97
111
|
updatePosition();
|
|
98
112
|
}, [placement, isOpen, offset, shouldFlip, crossOffset, shouldOverlapWithTrigger]);
|
|
113
|
+
const style = { ...position.position
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (position !== null && position !== void 0 && (_position$position = position.position) !== null && _position$position !== void 0 && _position$position.top || (position === null || position === void 0 ? void 0 : (_position$position2 = position.position) === null || _position$position2 === void 0 ? void 0 : _position$position2.top) === 0) {
|
|
117
|
+
var _position$position3;
|
|
118
|
+
|
|
119
|
+
style.top = ((position === null || position === void 0 ? void 0 : (_position$position3 = position.position) === null || _position$position3 === void 0 ? void 0 : _position$position3.top) || 0) + (APPROX_STATUSBAR_HEIGHT || 0);
|
|
120
|
+
}
|
|
121
|
+
|
|
99
122
|
const returnProps = {
|
|
100
123
|
rendered,
|
|
101
124
|
overlayProps: {
|
|
102
|
-
style
|
|
103
|
-
}
|
|
125
|
+
style
|
|
104
126
|
},
|
|
105
127
|
placement: position.placement,
|
|
106
128
|
arrowProps: {
|
|
107
129
|
style: {
|
|
108
130
|
left: position.arrowOffsetLeft,
|
|
109
|
-
top: position.arrowOffsetTop
|
|
131
|
+
top: ((position === null || position === void 0 ? void 0 : position.arrowOffsetTop) || 0) + (APPROX_STATUSBAR_HEIGHT || 0)
|
|
110
132
|
}
|
|
111
133
|
},
|
|
112
134
|
updatePosition
|
|
@@ -350,16 +372,27 @@
|
|
|
350
372
|
};
|
|
351
373
|
|
|
352
374
|
const updateOverlayItem = (id, node) => {
|
|
353
|
-
setItems(prev =>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
375
|
+
setItems(prev => {
|
|
376
|
+
const overlayItem = prev.find(item => item.id == id);
|
|
377
|
+
|
|
378
|
+
if (!overlayItem) {
|
|
379
|
+
return prev.concat([{
|
|
380
|
+
id: id,
|
|
357
381
|
node
|
|
358
|
-
};
|
|
359
|
-
}
|
|
382
|
+
}]);
|
|
383
|
+
} else {
|
|
384
|
+
return prev.map(item => {
|
|
385
|
+
if (item.id === id) {
|
|
386
|
+
return {
|
|
387
|
+
id,
|
|
388
|
+
node
|
|
389
|
+
};
|
|
390
|
+
}
|
|
360
391
|
|
|
361
|
-
|
|
362
|
-
|
|
392
|
+
return item;
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
});
|
|
363
396
|
};
|
|
364
397
|
|
|
365
398
|
const removeOverlayItem = id => {
|
|
@@ -2063,6 +2096,20 @@
|
|
|
2063
2096
|
var STRING = matchString;
|
|
2064
2097
|
var COLOR = matchColor;
|
|
2065
2098
|
var LINE = regExpToken(/^(none|underline|line-through)$/i);
|
|
2099
|
+
|
|
2100
|
+
var aspectRatio = function aspectRatio(tokenStream) {
|
|
2101
|
+
var aspectRatio = tokenStream.expect(NUMBER);
|
|
2102
|
+
|
|
2103
|
+
if (tokenStream.hasTokens()) {
|
|
2104
|
+
tokenStream.expect(SLASH);
|
|
2105
|
+
aspectRatio /= tokenStream.expect(NUMBER);
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
return {
|
|
2109
|
+
aspectRatio: aspectRatio
|
|
2110
|
+
};
|
|
2111
|
+
};
|
|
2112
|
+
|
|
2066
2113
|
var BORDER_STYLE = regExpToken(/^(solid|dashed|dotted)$/);
|
|
2067
2114
|
var defaultBorderWidth = 1;
|
|
2068
2115
|
var defaultBorderColor = 'black';
|
|
@@ -2640,6 +2687,7 @@
|
|
|
2640
2687
|
};
|
|
2641
2688
|
|
|
2642
2689
|
var transforms = {
|
|
2690
|
+
aspectRatio: aspectRatio,
|
|
2643
2691
|
background: background,
|
|
2644
2692
|
border: border,
|
|
2645
2693
|
borderColor: borderColor,
|
|
@@ -2873,23 +2921,10 @@
|
|
|
2873
2921
|
}
|
|
2874
2922
|
|
|
2875
2923
|
_createClass(UnitValue, [{
|
|
2876
|
-
key: "toPercentage",
|
|
2877
|
-
value: function toPercentage() {
|
|
2878
|
-
if (!['number', 'percent'].includes(this.unit)) {
|
|
2879
|
-
throw new Error("Unexpected unit \"".concat(this.unit, "\"."));
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
if (this.unit === 'percent') {
|
|
2883
|
-
return this.value / 100;
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
|
-
return this.value;
|
|
2887
|
-
}
|
|
2888
|
-
}, {
|
|
2889
2924
|
key: "toNumber",
|
|
2890
2925
|
value: function toNumber() {
|
|
2891
|
-
if (
|
|
2892
|
-
|
|
2926
|
+
if (this.unit === 'percent') {
|
|
2927
|
+
return this.value / 100;
|
|
2893
2928
|
}
|
|
2894
2929
|
|
|
2895
2930
|
if (this.unit === 'rem') {
|
|
@@ -2901,7 +2936,15 @@
|
|
|
2901
2936
|
}, {
|
|
2902
2937
|
key: "toString",
|
|
2903
2938
|
value: function toString() {
|
|
2904
|
-
|
|
2939
|
+
if (this.unit === 'number') {
|
|
2940
|
+
return this.value;
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
if (this.unit === 'percent') {
|
|
2944
|
+
return "".concat(this.value, "%");
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
return "".concat(this.value).concat(this.unit);
|
|
2905
2948
|
}
|
|
2906
2949
|
}], [{
|
|
2907
2950
|
key: "parse",
|
|
@@ -2928,12 +2971,28 @@
|
|
|
2928
2971
|
}();
|
|
2929
2972
|
|
|
2930
2973
|
var POWER = Math.pow(10, 8);
|
|
2974
|
+
var UNIT_ORDER = ['percent', 'number', 'px', 'rem'];
|
|
2931
2975
|
|
|
2932
2976
|
var fixRounding = function fixRounding(value) {
|
|
2933
2977
|
return Math.round(value * POWER) / POWER;
|
|
2934
2978
|
};
|
|
2935
2979
|
|
|
2936
|
-
var
|
|
2980
|
+
var normalizeValue$1 = function normalizeValue(number1, number2) {
|
|
2981
|
+
if (number1.unit === 'px' && number2.unit === 'rem') {
|
|
2982
|
+
return number1.value / (reactNative.PixelRatio.getFontScale() * 16);
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
if (number1.unit === 'percent' && number2.unit !== 'percent') {
|
|
2986
|
+
return number1.value / 100;
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
return number1.value;
|
|
2990
|
+
};
|
|
2991
|
+
|
|
2992
|
+
var calculateValue = function calculateValue(number1, operator, number2) {
|
|
2993
|
+
var value1 = normalizeValue$1(number1, number2);
|
|
2994
|
+
var value2 = normalizeValue$1(number2, number1);
|
|
2995
|
+
|
|
2937
2996
|
switch (operator) {
|
|
2938
2997
|
case '+':
|
|
2939
2998
|
return value1 + value2;
|
|
@@ -2955,24 +3014,18 @@
|
|
|
2955
3014
|
}
|
|
2956
3015
|
};
|
|
2957
3016
|
|
|
2958
|
-
var
|
|
2959
|
-
|
|
3017
|
+
var determineUnit = function determineUnit(number1, number2) {
|
|
3018
|
+
var index1 = UNIT_ORDER.indexOf(number1.unit);
|
|
3019
|
+
var index2 = UNIT_ORDER.indexOf(number2.unit);
|
|
3020
|
+
return index1 > index2 ? number1.unit : number2.unit;
|
|
2960
3021
|
};
|
|
2961
3022
|
|
|
2962
3023
|
function calculate(value1, operator, value2) {
|
|
2963
3024
|
var number1 = UnitValue.parse(value1);
|
|
2964
3025
|
var number2 = UnitValue.parse(value2);
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
|
-
if (number1.unit === 'rem' && number2.unit === 'px') {
|
|
2971
|
-
return "".concat(calculateValue(number1.value, operator, pxToRem(number2.value)), "rem");
|
|
2972
|
-
}
|
|
2973
|
-
|
|
2974
|
-
var unit = number1.unit === 'number' ? number2.unit : number1.unit;
|
|
2975
|
-
return "".concat(calculateValue(number1.value, operator, number2.value)).concat(unit === 'number' ? '' : unit);
|
|
3026
|
+
var value = calculateValue(number1, operator, number2);
|
|
3027
|
+
var unit = determineUnit(number1, number2);
|
|
3028
|
+
return new UnitValue(value, unit).toString();
|
|
2976
3029
|
}
|
|
2977
3030
|
function normalizeNumber(value) {
|
|
2978
3031
|
return UnitValue.parse(value).toNumber();
|
|
@@ -3278,7 +3331,7 @@
|
|
|
3278
3331
|
var weight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5;
|
|
3279
3332
|
var rgb1 = RgbaValue.parse(color1).toRgb();
|
|
3280
3333
|
var rgb2 = RgbaValue.parse(color2).toRgb();
|
|
3281
|
-
var percentage = UnitValue.parse(weight).
|
|
3334
|
+
var percentage = UnitValue.parse(weight).toNumber();
|
|
3282
3335
|
|
|
3283
3336
|
var _rgb1$map = rgb1.map(function (value, key) {
|
|
3284
3337
|
return Math.round(rgb2[key] + (value - rgb2[key]) * percentage);
|
|
@@ -4737,7 +4790,7 @@
|
|
|
4737
4790
|
color = _ref10[0],
|
|
4738
4791
|
weight = _ref10[1];
|
|
4739
4792
|
|
|
4740
|
-
var percentage = UnitValue.parse(weight).
|
|
4793
|
+
var percentage = UnitValue.parse(weight).toNumber();
|
|
4741
4794
|
var handle = percentage > 0 ? shadeColor(color, percentage) : tintColor(color, -percentage);
|
|
4742
4795
|
return handle(t);
|
|
4743
4796
|
});
|
|
@@ -6897,7 +6950,7 @@
|
|
|
6897
6950
|
}
|
|
6898
6951
|
|
|
6899
6952
|
var _excluded$1p = ["toggle", "dismiss"],
|
|
6900
|
-
_excluded2$
|
|
6953
|
+
_excluded2$3 = ["ref"];
|
|
6901
6954
|
|
|
6902
6955
|
var getActionHook = function getActionHook(toggle, dismiss) {
|
|
6903
6956
|
if (toggle) {
|
|
@@ -6928,7 +6981,7 @@
|
|
|
6928
6981
|
|
|
6929
6982
|
var _useActionHook = useActionHook(restProps),
|
|
6930
6983
|
actionRef = _useActionHook.ref,
|
|
6931
|
-
actionProps = _objectWithoutProperties(_useActionHook, _excluded2$
|
|
6984
|
+
actionProps = _objectWithoutProperties(_useActionHook, _excluded2$3);
|
|
6932
6985
|
|
|
6933
6986
|
return [actionProps, concatRefs(actionRef, ref)];
|
|
6934
6987
|
}
|
|
@@ -8514,21 +8567,32 @@
|
|
|
8514
8567
|
overlayRef: overlayRef,
|
|
8515
8568
|
offset: offset,
|
|
8516
8569
|
isOpen: visible
|
|
8517
|
-
}); // Remove
|
|
8570
|
+
}); // Remove unnecessary arrow styles and adjust arrow offset.
|
|
8571
|
+
|
|
8572
|
+
if (placement === 'top' || placement === 'bottom') {
|
|
8573
|
+
delete overlay.arrowProps.style.top;
|
|
8518
8574
|
|
|
8519
|
-
|
|
8575
|
+
if (typeof overlay.arrowProps.style.left === 'number') {
|
|
8576
|
+
overlay.arrowProps.style.left -= arrowOffset;
|
|
8577
|
+
}
|
|
8578
|
+
}
|
|
8579
|
+
|
|
8580
|
+
if (placement === 'left' || placement === 'right') {
|
|
8520
8581
|
delete overlay.arrowProps.style.left;
|
|
8521
8582
|
|
|
8522
|
-
if (overlay.arrowProps.style.top) {
|
|
8583
|
+
if (typeof overlay.arrowProps.style.top === 'number') {
|
|
8523
8584
|
overlay.arrowProps.style.top -= arrowOffset;
|
|
8524
8585
|
}
|
|
8525
|
-
}
|
|
8586
|
+
} // Adjust top value by status bar height on Android
|
|
8526
8587
|
|
|
8527
|
-
if (overlay.arrowProps.style.top === undefined) {
|
|
8528
|
-
delete overlay.arrowProps.style.top;
|
|
8529
8588
|
|
|
8530
|
-
|
|
8531
|
-
|
|
8589
|
+
if (reactNative.Platform.OS === 'android' && reactNative.StatusBar.currentHeight) {
|
|
8590
|
+
if (typeof overlay.overlayProps.style.top === 'number') {
|
|
8591
|
+
overlay.overlayProps.style.top -= reactNative.StatusBar.currentHeight;
|
|
8592
|
+
}
|
|
8593
|
+
|
|
8594
|
+
if (typeof overlay.arrowProps.style.top === 'number') {
|
|
8595
|
+
overlay.arrowProps.style.top -= reactNative.StatusBar.currentHeight;
|
|
8532
8596
|
}
|
|
8533
8597
|
}
|
|
8534
8598
|
|
|
@@ -9764,7 +9828,7 @@
|
|
|
9764
9828
|
Popover.Body = PopoverBody;
|
|
9765
9829
|
|
|
9766
9830
|
var _excluded$M = ["title", "content", "autoClose", "trigger", "placement"],
|
|
9767
|
-
_excluded2$
|
|
9831
|
+
_excluded2$2 = ["popover"];
|
|
9768
9832
|
var propTypes$O = {
|
|
9769
9833
|
popover: PropTypes.shape(_objectSpread2({
|
|
9770
9834
|
title: PropTypes.node,
|
|
@@ -9785,7 +9849,7 @@
|
|
|
9785
9849
|
_props$popover$placem = _props$popover.placement,
|
|
9786
9850
|
placement = _props$popover$placem === void 0 ? 'right' : _props$popover$placem,
|
|
9787
9851
|
tooltipProps = _objectWithoutProperties(_props$popover, _excluded$M),
|
|
9788
|
-
elementProps = _objectWithoutProperties(props, _excluded2$
|
|
9852
|
+
elementProps = _objectWithoutProperties(props, _excluded2$2);
|
|
9789
9853
|
/* eslint-enable */
|
|
9790
9854
|
|
|
9791
9855
|
|
|
@@ -9961,7 +10025,7 @@
|
|
|
9961
10025
|
Tooltip.Inner = TooltipInner;
|
|
9962
10026
|
|
|
9963
10027
|
var _excluded$I = ["title", "autoClose", "trigger", "placement"],
|
|
9964
|
-
_excluded2 = ["tooltip"];
|
|
10028
|
+
_excluded2$1 = ["tooltip"];
|
|
9965
10029
|
var propTypes$K = {
|
|
9966
10030
|
tooltip: PropTypes.shape(_objectSpread2({
|
|
9967
10031
|
title: PropTypes.node.isRequired,
|
|
@@ -9980,7 +10044,7 @@
|
|
|
9980
10044
|
_props$tooltip$placem = _props$tooltip.placement,
|
|
9981
10045
|
placement = _props$tooltip$placem === void 0 ? 'top' : _props$tooltip$placem,
|
|
9982
10046
|
tooltipProps = _objectWithoutProperties(_props$tooltip, _excluded$I),
|
|
9983
|
-
elementProps = _objectWithoutProperties(props, _excluded2);
|
|
10047
|
+
elementProps = _objectWithoutProperties(props, _excluded2$1);
|
|
9984
10048
|
/* eslint-enable */
|
|
9985
10049
|
|
|
9986
10050
|
|
|
@@ -10273,11 +10337,14 @@
|
|
|
10273
10337
|
ListGroup.Item = ListGroupItem;
|
|
10274
10338
|
ListGroup.ItemAction = ListGroupItemAction;
|
|
10275
10339
|
|
|
10276
|
-
var _excluded$C = ["children", "style"]
|
|
10340
|
+
var _excluded$C = ["children", "onHoverIn", "onHoverOut", "onMouseEnter", "onMouseLeave", "style"],
|
|
10341
|
+
_excluded2 = ["onHoverIn", "onHoverOut"];
|
|
10277
10342
|
|
|
10278
10343
|
var _templateObject$w;
|
|
10279
10344
|
var propTypes$E = {
|
|
10280
10345
|
children: PropTypes.node.isRequired,
|
|
10346
|
+
onMouseEnter: PropTypes.func,
|
|
10347
|
+
onMouseLeave: PropTypes.func,
|
|
10281
10348
|
// eslint-disable-next-line react/forbid-prop-types
|
|
10282
10349
|
style: PropTypes.any
|
|
10283
10350
|
};
|
|
@@ -10295,7 +10362,13 @@
|
|
|
10295
10362
|
actionProps = _useAction2[0],
|
|
10296
10363
|
actionRef = _useAction2[1];
|
|
10297
10364
|
|
|
10298
|
-
var children = actionProps.children
|
|
10365
|
+
var children = actionProps.children;
|
|
10366
|
+
actionProps.onHoverIn;
|
|
10367
|
+
actionProps.onHoverOut;
|
|
10368
|
+
var _actionProps$onMouseE = actionProps.onMouseEnter,
|
|
10369
|
+
handleMouseEnter = _actionProps$onMouseE === void 0 ? function () {} : _actionProps$onMouseE,
|
|
10370
|
+
_actionProps$onMouseL = actionProps.onMouseLeave,
|
|
10371
|
+
handleMouseLeave = _actionProps$onMouseL === void 0 ? function () {} : _actionProps$onMouseL,
|
|
10299
10372
|
style = actionProps.style,
|
|
10300
10373
|
elementProps = _objectWithoutProperties(actionProps, _excluded$C);
|
|
10301
10374
|
|
|
@@ -10305,9 +10378,20 @@
|
|
|
10305
10378
|
|
|
10306
10379
|
var _useInteractionState = useInteractionState(elementProps),
|
|
10307
10380
|
interaction = _useInteractionState.interaction,
|
|
10308
|
-
|
|
10381
|
+
_useInteractionState$ = _useInteractionState.interactionProps,
|
|
10382
|
+
handleMouseEnterInteraction = _useInteractionState$.onHoverIn,
|
|
10383
|
+
handleMouseLeaveInteraction = _useInteractionState$.onHoverOut,
|
|
10384
|
+
interactionProps = _objectWithoutProperties(_useInteractionState$, _excluded2);
|
|
10309
10385
|
|
|
10310
10386
|
return /*#__PURE__*/React__default["default"].createElement(Text, _extends({}, elementProps, interactionProps, {
|
|
10387
|
+
onMouseEnter: function onMouseEnter(event) {
|
|
10388
|
+
handleMouseEnter(event);
|
|
10389
|
+
handleMouseEnterInteraction(event);
|
|
10390
|
+
},
|
|
10391
|
+
onMouseLeave: function onMouseLeave(event) {
|
|
10392
|
+
handleMouseLeave(event);
|
|
10393
|
+
handleMouseLeaveInteraction(event);
|
|
10394
|
+
},
|
|
10311
10395
|
ref: actionRef,
|
|
10312
10396
|
accessibilityRole: getRole$2(actionProps),
|
|
10313
10397
|
accessible: true,
|
|
@@ -11251,6 +11335,14 @@
|
|
|
11251
11335
|
transparent: true,
|
|
11252
11336
|
visible: navbar ? navbar.expanded : visible,
|
|
11253
11337
|
onRequestClose: handleToggle
|
|
11338
|
+
}, placement !== 'bottom' && /*#__PURE__*/React__default["default"].createElement(reactNative.SafeAreaView, {
|
|
11339
|
+
style: {
|
|
11340
|
+
flexGrow: 0
|
|
11341
|
+
}
|
|
11342
|
+
}), /*#__PURE__*/React__default["default"].createElement(reactNative.SafeAreaView, {
|
|
11343
|
+
style: {
|
|
11344
|
+
flexGrow: 1
|
|
11345
|
+
}
|
|
11254
11346
|
}, backdrop && /*#__PURE__*/React__default["default"].createElement(View, {
|
|
11255
11347
|
style: backdropClasses
|
|
11256
11348
|
}, /*#__PURE__*/React__default["default"].createElement(BackdropHandler, {
|
|
@@ -11261,11 +11353,7 @@
|
|
|
11261
11353
|
ref: concatRefs(offcanvasRef, ref),
|
|
11262
11354
|
style: [classes, style],
|
|
11263
11355
|
textStyle: [textClasses, textStyle]
|
|
11264
|
-
}), /*#__PURE__*/React__default["default"].createElement(
|
|
11265
|
-
style: {
|
|
11266
|
-
flexShrink: 1
|
|
11267
|
-
}
|
|
11268
|
-
}, /*#__PURE__*/React__default["default"].createElement(View, {
|
|
11356
|
+
}), /*#__PURE__*/React__default["default"].createElement(View, {
|
|
11269
11357
|
style: [dialogClasses, dialogStyle],
|
|
11270
11358
|
textStyle: dialogTextStyle
|
|
11271
11359
|
}, /*#__PURE__*/React__default["default"].createElement(OffcanvasContext.Provider, {
|