@telus-uds/components-base 1.79.0 → 1.80.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.
- package/CHANGELOG.md +20 -2
- package/lib/Autocomplete/Autocomplete.js +1 -1
- package/lib/FlexGrid/FlexGrid.js +6 -3
- package/lib/Footnote/FootnoteLink.js +1 -0
- package/lib/Listbox/ListboxOverlay.js +2 -2
- package/lib/Portal/Portal.js +57 -0
- package/lib/Portal/Portal.native.js +9 -0
- package/lib/Portal/index.js +10 -0
- package/lib/TextInput/TextInputBase.js +1 -1
- package/lib/index.js +2 -2
- package/lib-module/Autocomplete/Autocomplete.js +1 -1
- package/lib-module/FlexGrid/FlexGrid.js +6 -3
- package/lib-module/Footnote/FootnoteLink.js +2 -1
- package/lib-module/Listbox/ListboxOverlay.js +1 -1
- package/lib-module/Portal/Portal.js +50 -0
- package/lib-module/Portal/Portal.native.js +2 -0
- package/lib-module/Portal/index.js +2 -0
- package/lib-module/TextInput/TextInputBase.js +1 -1
- package/lib-module/index.js +1 -1
- package/package.json +1 -1
- package/src/Autocomplete/Autocomplete.jsx +1 -1
- package/src/FlexGrid/FlexGrid.jsx +4 -6
- package/src/Footnote/FootnoteLink.jsx +9 -1
- package/src/Listbox/ListboxOverlay.jsx +1 -1
- package/src/Portal/Portal.jsx +52 -0
- package/src/Portal/Portal.native.jsx +3 -0
- package/src/Portal/index.js +3 -0
- package/src/TextInput/TextInputBase.jsx +1 -1
- package/src/index.js +1 -1
- package/types/Portal.d.ts +5 -0
- package/types/index.d.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 19 Mar 2024 18:37:02 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.80.1
|
|
8
|
+
|
|
9
|
+
Tue, 19 Mar 2024 18:37:02 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- prevent flexgrid dataset property to be overruled (guillermo.peitzner@telus.com)
|
|
14
|
+
- `Autocomplete`: Component breaks on Android because of type-casting (shahzaibkhalidmalik@outlook.com)
|
|
15
|
+
- `Autocomplete`: Overlay does not render next to `TextInput` (shahzaibkhalidmalik@outlook.com)
|
|
16
|
+
|
|
17
|
+
## 1.80.0
|
|
18
|
+
|
|
19
|
+
Tue, 12 Mar 2024 22:26:51 GMT
|
|
20
|
+
|
|
21
|
+
### Minor changes
|
|
22
|
+
|
|
23
|
+
- New variants added to Footnote.Link component (josue.higueros@telus.com)
|
|
24
|
+
|
|
7
25
|
## 1.79.0
|
|
8
26
|
|
|
9
|
-
Wed, 06 Mar 2024 00:
|
|
27
|
+
Wed, 06 Mar 2024 00:09:16 GMT
|
|
10
28
|
|
|
11
29
|
### Minor changes
|
|
12
30
|
|
|
@@ -193,7 +193,7 @@ const Autocomplete = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
193
193
|
const throttledUpdateInputWidth = (0, _lodash.default)(updateInputWidth, 100, {
|
|
194
194
|
leading: false
|
|
195
195
|
});
|
|
196
|
-
|
|
196
|
+
throttledUpdateInputWidth();
|
|
197
197
|
_Dimensions.default.addEventListener('change', throttledUpdateInputWidth);
|
|
198
198
|
return () => {
|
|
199
199
|
_Dimensions.default.removeEventListener('change', throttledUpdateInputWidth);
|
package/lib/FlexGrid/FlexGrid.js
CHANGED
|
@@ -37,6 +37,7 @@ const FlexGrid = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
37
37
|
tag,
|
|
38
38
|
accessibilityRole,
|
|
39
39
|
children,
|
|
40
|
+
dataSet,
|
|
40
41
|
...rest
|
|
41
42
|
} = _ref;
|
|
42
43
|
const reverseLevel = (0, _helpers.default)([xsReverse, smReverse, mdReverse, lgReverse, xlReverse]);
|
|
@@ -99,15 +100,17 @@ const FlexGrid = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
99
100
|
...(0, _utils.getA11yPropsFromHtmlTag)(tag, accessibilityRole),
|
|
100
101
|
...selectProps(rest)
|
|
101
102
|
};
|
|
103
|
+
const dataSetValue = mediaIds ? {
|
|
104
|
+
media: mediaIds,
|
|
105
|
+
...dataSet
|
|
106
|
+
} : dataSet;
|
|
102
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GutterContext.default.Provider, {
|
|
103
108
|
value: gutter,
|
|
104
109
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_utils.BaseView, {
|
|
105
110
|
ref: ref,
|
|
106
111
|
...props,
|
|
107
112
|
style: flexgridStyles,
|
|
108
|
-
dataSet:
|
|
109
|
-
media: mediaIds
|
|
110
|
-
},
|
|
113
|
+
dataSet: dataSetValue,
|
|
111
114
|
children: children
|
|
112
115
|
})
|
|
113
116
|
});
|
|
@@ -83,6 +83,7 @@ const copyShape = _propTypes.default.shape({
|
|
|
83
83
|
});
|
|
84
84
|
FootnoteLink.propTypes = {
|
|
85
85
|
...selectedSystemPropTypes,
|
|
86
|
+
variant: _utils.variantProp.propType,
|
|
86
87
|
/**
|
|
87
88
|
* Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
|
|
88
89
|
* To provide your own, pass a JSON object with the key `a11yLabel`.
|
|
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
11
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
12
|
-
var
|
|
12
|
+
var _Portal = _interopRequireDefault(require("../Portal"));
|
|
13
13
|
var _ThemeProvider = require("../ThemeProvider");
|
|
14
14
|
var _Card = _interopRequireDefault(require("../Card"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -66,7 +66,7 @@ const DropdownOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
66
66
|
const withPortal = Overlay => {
|
|
67
67
|
// eslint-disable-next-line react/display-name, react/no-multi-comp
|
|
68
68
|
return props => {
|
|
69
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Portal.default, {
|
|
70
70
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Overlay, {
|
|
71
71
|
...props
|
|
72
72
|
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
/**
|
|
12
|
+
* Portal component renders its children in a separate portal container appended to the document body.
|
|
13
|
+
*
|
|
14
|
+
* While `@gorhom/portal` works well for a lot of use-cases, there are some issues with it, particularly around
|
|
15
|
+
* reading context values (see issues below). For web-only components, it is safe to replace `Portal` from `@gorhom/portal`
|
|
16
|
+
* to `Portal` to solve such issues
|
|
17
|
+
*
|
|
18
|
+
* https://github.com/gorhom/react-native-portal/issues/34
|
|
19
|
+
* https://github.com/gorhom/react-native-portal/issues/2
|
|
20
|
+
* https://github.com/gorhom/react-native-portal/issues/3
|
|
21
|
+
* https://github.com/gorhom/react-native-portal/issues/31
|
|
22
|
+
*
|
|
23
|
+
* @component
|
|
24
|
+
* @param {object} props - The component props.
|
|
25
|
+
* @param {React.ReactNode} props.children - The content to render within the portal.
|
|
26
|
+
* @returns {React.ReactPortal} The React portal component.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const Portal = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
children
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [portalContainer, setPortalContainer] = (0, _react.useState)(null);
|
|
34
|
+
const isWebClient = typeof document !== 'undefined' && typeof window !== 'undefined';
|
|
35
|
+
(0, _react.useEffect)(() => {
|
|
36
|
+
if (!isWebClient) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const container = document.createElement('div');
|
|
40
|
+
document.body.appendChild(container);
|
|
41
|
+
setPortalContainer(container);
|
|
42
|
+
|
|
43
|
+
// eslint-disable-next-line consistent-return
|
|
44
|
+
return () => {
|
|
45
|
+
if (container && container.parentNode) {
|
|
46
|
+
container.parentNode.removeChild(container);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}, [isWebClient]);
|
|
50
|
+
if (!portalContainer || !isWebClient) return null;
|
|
51
|
+
return /*#__PURE__*/_reactDom.default.createPortal(children, portalContainer);
|
|
52
|
+
};
|
|
53
|
+
Portal.propTypes = {
|
|
54
|
+
children: _propTypes.default.node.isRequired
|
|
55
|
+
};
|
|
56
|
+
var _default = Portal;
|
|
57
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _Portal = _interopRequireDefault(require("./Portal"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _Portal.default;
|
|
10
|
+
exports.default = _default;
|
|
@@ -357,7 +357,7 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
357
357
|
})
|
|
358
358
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.default, {
|
|
359
359
|
ref: inputRef,
|
|
360
|
-
keyboardType: isNumeric
|
|
360
|
+
keyboardType: isNumeric ? 'numeric' : 'default',
|
|
361
361
|
inputMode: isNumeric && 'numeric',
|
|
362
362
|
style: nativeInputStyle,
|
|
363
363
|
secureTextEntry: isPassword && !showPassword,
|
package/lib/index.js
CHANGED
|
@@ -277,7 +277,7 @@ Object.defineProperty(exports, "Pagination", {
|
|
|
277
277
|
Object.defineProperty(exports, "Portal", {
|
|
278
278
|
enumerable: true,
|
|
279
279
|
get: function () {
|
|
280
|
-
return
|
|
280
|
+
return _Portal.default;
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
Object.defineProperty(exports, "PressableCardBase", {
|
|
@@ -695,7 +695,7 @@ Object.keys(_utils).forEach(function (key) {
|
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
697
|
});
|
|
698
|
-
var
|
|
698
|
+
var _Portal = _interopRequireDefault(require("./Portal"));
|
|
699
699
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
700
700
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
701
701
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -185,7 +185,7 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
185
185
|
const throttledUpdateInputWidth = throttle(updateInputWidth, 100, {
|
|
186
186
|
leading: false
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
throttledUpdateInputWidth();
|
|
189
189
|
Dimensions.addEventListener('change', throttledUpdateInputWidth);
|
|
190
190
|
return () => {
|
|
191
191
|
Dimensions.removeEventListener('change', throttledUpdateInputWidth);
|
|
@@ -28,6 +28,7 @@ const FlexGrid = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
28
28
|
tag,
|
|
29
29
|
accessibilityRole,
|
|
30
30
|
children,
|
|
31
|
+
dataSet,
|
|
31
32
|
...rest
|
|
32
33
|
} = _ref;
|
|
33
34
|
const reverseLevel = applyInheritance([xsReverse, smReverse, mdReverse, lgReverse, xlReverse]);
|
|
@@ -90,15 +91,17 @@ const FlexGrid = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
90
91
|
...getA11yPropsFromHtmlTag(tag, accessibilityRole),
|
|
91
92
|
...selectProps(rest)
|
|
92
93
|
};
|
|
94
|
+
const dataSetValue = mediaIds ? {
|
|
95
|
+
media: mediaIds,
|
|
96
|
+
...dataSet
|
|
97
|
+
} : dataSet;
|
|
93
98
|
return /*#__PURE__*/_jsx(GutterContext.Provider, {
|
|
94
99
|
value: gutter,
|
|
95
100
|
children: /*#__PURE__*/_jsx(BaseView, {
|
|
96
101
|
ref: ref,
|
|
97
102
|
...props,
|
|
98
103
|
style: flexgridStyles,
|
|
99
|
-
dataSet:
|
|
100
|
-
media: mediaIds
|
|
101
|
-
},
|
|
104
|
+
dataSet: dataSetValue,
|
|
102
105
|
children: children
|
|
103
106
|
})
|
|
104
107
|
});
|
|
@@ -5,7 +5,7 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
5
5
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
6
6
|
import TouchableWithoutFeedback from "react-native-web/dist/exports/TouchableWithoutFeedback";
|
|
7
7
|
import dictionary from './dictionary';
|
|
8
|
-
import { htmlAttrs, selectSystemProps, useCopy, viewProps, wrapStringsInText } from '../utils';
|
|
8
|
+
import { htmlAttrs, selectSystemProps, useCopy, viewProps, wrapStringsInText, variantProp } from '../utils';
|
|
9
9
|
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -77,6 +77,7 @@ const copyShape = PropTypes.shape({
|
|
|
77
77
|
});
|
|
78
78
|
FootnoteLink.propTypes = {
|
|
79
79
|
...selectedSystemPropTypes,
|
|
80
|
+
variant: variantProp.propType,
|
|
80
81
|
/**
|
|
81
82
|
* Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
|
|
82
83
|
* To provide your own, pass a JSON object with the key `a11yLabel`.
|
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
5
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
6
6
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
7
|
-
import
|
|
7
|
+
import Portal from '../Portal';
|
|
8
8
|
import { useThemeTokens } from '../ThemeProvider';
|
|
9
9
|
import Card from '../Card';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Portal component renders its children in a separate portal container appended to the document body.
|
|
7
|
+
*
|
|
8
|
+
* While `@gorhom/portal` works well for a lot of use-cases, there are some issues with it, particularly around
|
|
9
|
+
* reading context values (see issues below). For web-only components, it is safe to replace `Portal` from `@gorhom/portal`
|
|
10
|
+
* to `Portal` to solve such issues
|
|
11
|
+
*
|
|
12
|
+
* https://github.com/gorhom/react-native-portal/issues/34
|
|
13
|
+
* https://github.com/gorhom/react-native-portal/issues/2
|
|
14
|
+
* https://github.com/gorhom/react-native-portal/issues/3
|
|
15
|
+
* https://github.com/gorhom/react-native-portal/issues/31
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @param {object} props - The component props.
|
|
19
|
+
* @param {React.ReactNode} props.children - The content to render within the portal.
|
|
20
|
+
* @returns {React.ReactPortal} The React portal component.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const Portal = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
children
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [portalContainer, setPortalContainer] = useState(null);
|
|
28
|
+
const isWebClient = typeof document !== 'undefined' && typeof window !== 'undefined';
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!isWebClient) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const container = document.createElement('div');
|
|
34
|
+
document.body.appendChild(container);
|
|
35
|
+
setPortalContainer(container);
|
|
36
|
+
|
|
37
|
+
// eslint-disable-next-line consistent-return
|
|
38
|
+
return () => {
|
|
39
|
+
if (container && container.parentNode) {
|
|
40
|
+
container.parentNode.removeChild(container);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [isWebClient]);
|
|
44
|
+
if (!portalContainer || !isWebClient) return null;
|
|
45
|
+
return /*#__PURE__*/ReactDOM.createPortal(children, portalContainer);
|
|
46
|
+
};
|
|
47
|
+
Portal.propTypes = {
|
|
48
|
+
children: PropTypes.node.isRequired
|
|
49
|
+
};
|
|
50
|
+
export default Portal;
|
|
@@ -349,7 +349,7 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
349
349
|
})
|
|
350
350
|
}), /*#__PURE__*/_jsx(NativeTextInput, {
|
|
351
351
|
ref: inputRef,
|
|
352
|
-
keyboardType: isNumeric
|
|
352
|
+
keyboardType: isNumeric ? 'numeric' : 'default',
|
|
353
353
|
inputMode: isNumeric && 'numeric',
|
|
354
354
|
style: nativeInputStyle,
|
|
355
355
|
secureTextEntry: isPassword && !showPassword,
|
package/lib-module/index.js
CHANGED
|
@@ -65,4 +65,4 @@ export { default as Validator } from './Validator';
|
|
|
65
65
|
export { default as ViewportProvider, useViewport, ViewportContext } from './ViewportProvider';
|
|
66
66
|
export { default as ThemeProvider, useTheme, useSetTheme, useThemeTokens, useThemeTokensCallback, getThemeTokens, applyOuterBorder, applyTextStyles, applyShadowToken } from './ThemeProvider';
|
|
67
67
|
export * from './utils';
|
|
68
|
-
export { Portal } from '
|
|
68
|
+
export { default as Portal } from './Portal';
|
package/package.json
CHANGED
|
@@ -167,7 +167,7 @@ const Autocomplete = forwardRef(
|
|
|
167
167
|
|
|
168
168
|
const throttledUpdateInputWidth = throttle(updateInputWidth, 100, { leading: false })
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
throttledUpdateInputWidth()
|
|
171
171
|
|
|
172
172
|
Dimensions.addEventListener('change', throttledUpdateInputWidth)
|
|
173
173
|
|
|
@@ -39,6 +39,7 @@ const FlexGrid = forwardRef(
|
|
|
39
39
|
tag,
|
|
40
40
|
accessibilityRole,
|
|
41
41
|
children,
|
|
42
|
+
dataSet,
|
|
42
43
|
...rest
|
|
43
44
|
},
|
|
44
45
|
ref
|
|
@@ -104,14 +105,11 @@ const FlexGrid = forwardRef(
|
|
|
104
105
|
...selectProps(rest)
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
const dataSetValue = mediaIds ? { media: mediaIds, ...dataSet } : dataSet
|
|
109
|
+
|
|
107
110
|
return (
|
|
108
111
|
<GutterContext.Provider value={gutter}>
|
|
109
|
-
<BaseView
|
|
110
|
-
ref={ref}
|
|
111
|
-
{...props}
|
|
112
|
-
style={flexgridStyles}
|
|
113
|
-
dataSet={mediaIds && { media: mediaIds }}
|
|
114
|
-
>
|
|
112
|
+
<BaseView ref={ref} {...props} style={flexgridStyles} dataSet={dataSetValue}>
|
|
115
113
|
{children}
|
|
116
114
|
</BaseView>
|
|
117
115
|
</GutterContext.Provider>
|
|
@@ -2,7 +2,14 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import { View, StyleSheet, Platform, TouchableWithoutFeedback } from 'react-native'
|
|
4
4
|
import dictionary from './dictionary'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
htmlAttrs,
|
|
7
|
+
selectSystemProps,
|
|
8
|
+
useCopy,
|
|
9
|
+
viewProps,
|
|
10
|
+
wrapStringsInText,
|
|
11
|
+
variantProp
|
|
12
|
+
} from '../utils'
|
|
6
13
|
import { applyTextStyles, useThemeTokens } from '../ThemeProvider'
|
|
7
14
|
|
|
8
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
@@ -64,6 +71,7 @@ const copyShape = PropTypes.shape({ a11yLabel: PropTypes.string.isRequired })
|
|
|
64
71
|
|
|
65
72
|
FootnoteLink.propTypes = {
|
|
66
73
|
...selectedSystemPropTypes,
|
|
74
|
+
variant: variantProp.propType,
|
|
67
75
|
/**
|
|
68
76
|
* Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
|
|
69
77
|
* To provide your own, pass a JSON object with the key `a11yLabel`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import { View, StyleSheet, Platform } from 'react-native'
|
|
5
|
-
import
|
|
5
|
+
import Portal from '../Portal'
|
|
6
6
|
import { useThemeTokens } from '../ThemeProvider'
|
|
7
7
|
import Card from '../Card'
|
|
8
8
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
2
|
+
import ReactDOM from 'react-dom'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Portal component renders its children in a separate portal container appended to the document body.
|
|
7
|
+
*
|
|
8
|
+
* While `@gorhom/portal` works well for a lot of use-cases, there are some issues with it, particularly around
|
|
9
|
+
* reading context values (see issues below). For web-only components, it is safe to replace `Portal` from `@gorhom/portal`
|
|
10
|
+
* to `Portal` to solve such issues
|
|
11
|
+
*
|
|
12
|
+
* https://github.com/gorhom/react-native-portal/issues/34
|
|
13
|
+
* https://github.com/gorhom/react-native-portal/issues/2
|
|
14
|
+
* https://github.com/gorhom/react-native-portal/issues/3
|
|
15
|
+
* https://github.com/gorhom/react-native-portal/issues/31
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @param {object} props - The component props.
|
|
19
|
+
* @param {React.ReactNode} props.children - The content to render within the portal.
|
|
20
|
+
* @returns {React.ReactPortal} The React portal component.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const Portal = ({ children }) => {
|
|
24
|
+
const [portalContainer, setPortalContainer] = useState(null)
|
|
25
|
+
const isWebClient = typeof document !== 'undefined' && typeof window !== 'undefined'
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!isWebClient) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
const container = document.createElement('div')
|
|
32
|
+
document.body.appendChild(container)
|
|
33
|
+
setPortalContainer(container)
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line consistent-return
|
|
36
|
+
return () => {
|
|
37
|
+
if (container && container.parentNode) {
|
|
38
|
+
container.parentNode.removeChild(container)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, [isWebClient])
|
|
42
|
+
|
|
43
|
+
if (!portalContainer || !isWebClient) return null
|
|
44
|
+
|
|
45
|
+
return ReactDOM.createPortal(children, portalContainer)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Portal.propTypes = {
|
|
49
|
+
children: PropTypes.node.isRequired
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default Portal
|
|
@@ -334,7 +334,7 @@ const TextInputBase = forwardRef(
|
|
|
334
334
|
)}
|
|
335
335
|
<NativeTextInput
|
|
336
336
|
ref={inputRef}
|
|
337
|
-
keyboardType={isNumeric
|
|
337
|
+
keyboardType={isNumeric ? 'numeric' : 'default'}
|
|
338
338
|
inputMode={isNumeric && 'numeric'}
|
|
339
339
|
style={nativeInputStyle}
|
|
340
340
|
secureTextEntry={isPassword && !showPassword}
|
package/src/index.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -59,4 +59,7 @@ export { TooltipTokens, TooltipVariants, TooltipProps } from './ToolTip'
|
|
|
59
59
|
export { default as Typography } from './Typography'
|
|
60
60
|
export { TypographyProps, TypographyVariants, TypographyTokens } from './Typography'
|
|
61
61
|
|
|
62
|
+
export { default as Portal } from './Portal'
|
|
63
|
+
export { PortalProps } from './Portal'
|
|
64
|
+
|
|
62
65
|
export * from './Common'
|