bootstrap-rn 0.2.11 → 0.2.12
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 +66 -41
- package/dist/bootstrap-rn.esm.js +66 -41
- package/dist/bootstrap-rn.umd.js +125 -52
- 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
|
}
|
|
@@ -9764,7 +9817,7 @@
|
|
|
9764
9817
|
Popover.Body = PopoverBody;
|
|
9765
9818
|
|
|
9766
9819
|
var _excluded$M = ["title", "content", "autoClose", "trigger", "placement"],
|
|
9767
|
-
_excluded2$
|
|
9820
|
+
_excluded2$2 = ["popover"];
|
|
9768
9821
|
var propTypes$O = {
|
|
9769
9822
|
popover: PropTypes.shape(_objectSpread2({
|
|
9770
9823
|
title: PropTypes.node,
|
|
@@ -9785,7 +9838,7 @@
|
|
|
9785
9838
|
_props$popover$placem = _props$popover.placement,
|
|
9786
9839
|
placement = _props$popover$placem === void 0 ? 'right' : _props$popover$placem,
|
|
9787
9840
|
tooltipProps = _objectWithoutProperties(_props$popover, _excluded$M),
|
|
9788
|
-
elementProps = _objectWithoutProperties(props, _excluded2$
|
|
9841
|
+
elementProps = _objectWithoutProperties(props, _excluded2$2);
|
|
9789
9842
|
/* eslint-enable */
|
|
9790
9843
|
|
|
9791
9844
|
|
|
@@ -9961,7 +10014,7 @@
|
|
|
9961
10014
|
Tooltip.Inner = TooltipInner;
|
|
9962
10015
|
|
|
9963
10016
|
var _excluded$I = ["title", "autoClose", "trigger", "placement"],
|
|
9964
|
-
_excluded2 = ["tooltip"];
|
|
10017
|
+
_excluded2$1 = ["tooltip"];
|
|
9965
10018
|
var propTypes$K = {
|
|
9966
10019
|
tooltip: PropTypes.shape(_objectSpread2({
|
|
9967
10020
|
title: PropTypes.node.isRequired,
|
|
@@ -9980,7 +10033,7 @@
|
|
|
9980
10033
|
_props$tooltip$placem = _props$tooltip.placement,
|
|
9981
10034
|
placement = _props$tooltip$placem === void 0 ? 'top' : _props$tooltip$placem,
|
|
9982
10035
|
tooltipProps = _objectWithoutProperties(_props$tooltip, _excluded$I),
|
|
9983
|
-
elementProps = _objectWithoutProperties(props, _excluded2);
|
|
10036
|
+
elementProps = _objectWithoutProperties(props, _excluded2$1);
|
|
9984
10037
|
/* eslint-enable */
|
|
9985
10038
|
|
|
9986
10039
|
|
|
@@ -10273,11 +10326,14 @@
|
|
|
10273
10326
|
ListGroup.Item = ListGroupItem;
|
|
10274
10327
|
ListGroup.ItemAction = ListGroupItemAction;
|
|
10275
10328
|
|
|
10276
|
-
var _excluded$C = ["children", "style"]
|
|
10329
|
+
var _excluded$C = ["children", "onHoverIn", "onHoverOut", "onMouseEnter", "onMouseLeave", "style"],
|
|
10330
|
+
_excluded2 = ["onHoverIn", "onHoverOut"];
|
|
10277
10331
|
|
|
10278
10332
|
var _templateObject$w;
|
|
10279
10333
|
var propTypes$E = {
|
|
10280
10334
|
children: PropTypes.node.isRequired,
|
|
10335
|
+
onMouseEnter: PropTypes.func,
|
|
10336
|
+
onMouseLeave: PropTypes.func,
|
|
10281
10337
|
// eslint-disable-next-line react/forbid-prop-types
|
|
10282
10338
|
style: PropTypes.any
|
|
10283
10339
|
};
|
|
@@ -10295,7 +10351,13 @@
|
|
|
10295
10351
|
actionProps = _useAction2[0],
|
|
10296
10352
|
actionRef = _useAction2[1];
|
|
10297
10353
|
|
|
10298
|
-
var children = actionProps.children
|
|
10354
|
+
var children = actionProps.children;
|
|
10355
|
+
actionProps.onHoverIn;
|
|
10356
|
+
actionProps.onHoverOut;
|
|
10357
|
+
var _actionProps$onMouseE = actionProps.onMouseEnter,
|
|
10358
|
+
handleMouseEnter = _actionProps$onMouseE === void 0 ? function () {} : _actionProps$onMouseE,
|
|
10359
|
+
_actionProps$onMouseL = actionProps.onMouseLeave,
|
|
10360
|
+
handleMouseLeave = _actionProps$onMouseL === void 0 ? function () {} : _actionProps$onMouseL,
|
|
10299
10361
|
style = actionProps.style,
|
|
10300
10362
|
elementProps = _objectWithoutProperties(actionProps, _excluded$C);
|
|
10301
10363
|
|
|
@@ -10305,9 +10367,20 @@
|
|
|
10305
10367
|
|
|
10306
10368
|
var _useInteractionState = useInteractionState(elementProps),
|
|
10307
10369
|
interaction = _useInteractionState.interaction,
|
|
10308
|
-
|
|
10370
|
+
_useInteractionState$ = _useInteractionState.interactionProps,
|
|
10371
|
+
handleMouseEnterInteraction = _useInteractionState$.onHoverIn,
|
|
10372
|
+
handleMouseLeaveInteraction = _useInteractionState$.onHoverOut,
|
|
10373
|
+
interactionProps = _objectWithoutProperties(_useInteractionState$, _excluded2);
|
|
10309
10374
|
|
|
10310
10375
|
return /*#__PURE__*/React__default["default"].createElement(Text, _extends({}, elementProps, interactionProps, {
|
|
10376
|
+
onMouseEnter: function onMouseEnter(event) {
|
|
10377
|
+
handleMouseEnter(event);
|
|
10378
|
+
handleMouseEnterInteraction(event);
|
|
10379
|
+
},
|
|
10380
|
+
onMouseLeave: function onMouseLeave(event) {
|
|
10381
|
+
handleMouseLeave(event);
|
|
10382
|
+
handleMouseLeaveInteraction(event);
|
|
10383
|
+
},
|
|
10311
10384
|
ref: actionRef,
|
|
10312
10385
|
accessibilityRole: getRole$2(actionProps),
|
|
10313
10386
|
accessible: true,
|