@telus-uds/components-base 1.75.0 → 1.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -2
- package/lib/Box/Box.js +112 -7
- package/lib/Box/backgroundImageStylesMap.js +101 -0
- package/lib/Carousel/CarouselThumbnail.js +10 -4
- package/lib/Carousel/CarouselThumbnailNavigation.js +3 -3
- package/lib/ExpandCollapse/Panel.js +21 -10
- package/lib/Footnote/Footnote.js +9 -13
- package/lib/Link/ChevronLink.js +2 -0
- package/lib/Link/InlinePressable.js +15 -2
- package/lib/Link/LinkBase.js +1 -0
- package/lib/OrderedList/OrderedList.js +21 -20
- package/lib/PriceLockup/PriceLockup.js +220 -0
- package/lib/PriceLockup/index.js +10 -0
- package/lib/PriceLockup/utils/renderFootnoteContent.js +93 -0
- package/lib/PriceLockup/utils/renderFootnoteLinks.js +36 -0
- package/lib/PriceLockup/utils/renderPrice.js +147 -0
- package/lib/PriceLockup/utils/renderTypography.js +31 -0
- package/lib/Skeleton/Skeleton.js +6 -3
- package/lib/index.js +8 -0
- package/lib-module/Box/Box.js +115 -9
- package/lib-module/Box/backgroundImageStylesMap.js +94 -0
- package/lib-module/Carousel/CarouselThumbnail.js +10 -4
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +3 -3
- package/lib-module/ExpandCollapse/Panel.js +21 -10
- package/lib-module/Footnote/Footnote.js +9 -13
- package/lib-module/Link/ChevronLink.js +2 -0
- package/lib-module/Link/InlinePressable.js +16 -2
- package/lib-module/Link/LinkBase.js +1 -0
- package/lib-module/OrderedList/OrderedList.js +21 -20
- package/lib-module/PriceLockup/PriceLockup.js +214 -0
- package/lib-module/PriceLockup/index.js +2 -0
- package/lib-module/PriceLockup/utils/renderFootnoteContent.js +87 -0
- package/lib-module/PriceLockup/utils/renderFootnoteLinks.js +28 -0
- package/lib-module/PriceLockup/utils/renderPrice.js +141 -0
- package/lib-module/PriceLockup/utils/renderTypography.js +23 -0
- package/lib-module/Skeleton/Skeleton.js +6 -3
- package/lib-module/index.js +1 -0
- package/package.json +2 -2
- package/src/Box/Box.jsx +120 -9
- package/src/Box/backgroundImageStylesMap.js +21 -0
- package/src/Carousel/CarouselThumbnail.jsx +8 -6
- package/src/Carousel/CarouselThumbnailNavigation.jsx +3 -4
- package/src/ExpandCollapse/Panel.jsx +16 -10
- package/src/Footnote/Footnote.jsx +3 -6
- package/src/Link/ChevronLink.jsx +5 -1
- package/src/Link/InlinePressable.jsx +36 -15
- package/src/Link/LinkBase.jsx +1 -0
- package/src/OrderedList/OrderedList.jsx +17 -20
- package/src/PriceLockup/PriceLockup.jsx +218 -0
- package/src/PriceLockup/index.js +3 -0
- package/src/PriceLockup/utils/renderFootnoteContent.jsx +77 -0
- package/src/PriceLockup/utils/renderFootnoteLinks.jsx +38 -0
- package/src/PriceLockup/utils/renderPrice.jsx +201 -0
- package/src/PriceLockup/utils/renderTypography.jsx +13 -0
- package/src/Skeleton/Skeleton.jsx +8 -3
- package/src/index.js +1 -0
- package/types/Typography.d.ts +1 -0
package/lib-module/Box/Box.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
4
|
import ScrollView from "react-native-web/dist/exports/ScrollView";
|
|
5
5
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
6
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
7
|
+
import ImageBackground from "react-native-web/dist/exports/ImageBackground";
|
|
8
|
+
import Image from "react-native-web/dist/exports/Image";
|
|
6
9
|
import { useThemeTokens } from '../ThemeProvider';
|
|
7
|
-
import { a11yProps, getA11yPropsFromHtmlTag, getTokensPropType, layoutTags, selectSystemProps, spacingProps, useSpacingScale, variantProp, viewProps } from '../utils';
|
|
10
|
+
import { a11yProps, getA11yPropsFromHtmlTag, getTokensPropType, layoutTags, responsiveProps, selectSystemProps, spacingProps, useResponsiveProp, useSpacingScale, variantProp, viewProps } from '../utils';
|
|
11
|
+
import backgroundImageStylesMap from './backgroundImageStylesMap';
|
|
8
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
14
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
10
15
|
|
|
11
16
|
/**
|
|
@@ -56,6 +61,45 @@ const selectBoxStyles = (_ref, customGradient) => {
|
|
|
56
61
|
});
|
|
57
62
|
return styles;
|
|
58
63
|
};
|
|
64
|
+
const setBackgroundImage = _ref2 => {
|
|
65
|
+
let {
|
|
66
|
+
src,
|
|
67
|
+
alt,
|
|
68
|
+
backgroundImageResizeMode,
|
|
69
|
+
backgroundImagePosition,
|
|
70
|
+
backgroundImageAlign,
|
|
71
|
+
backgroundImageWidth,
|
|
72
|
+
backgroundImageHeight,
|
|
73
|
+
content
|
|
74
|
+
} = _ref2;
|
|
75
|
+
if (backgroundImageResizeMode === 'contain') {
|
|
76
|
+
const containedViewStyle = {
|
|
77
|
+
...staticStyles.containedView,
|
|
78
|
+
width: backgroundImageWidth,
|
|
79
|
+
height: backgroundImageHeight,
|
|
80
|
+
...backgroundImageStylesMap[`${backgroundImagePosition}-${backgroundImageAlign}`]
|
|
81
|
+
};
|
|
82
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
83
|
+
style: staticStyles.containedContainer,
|
|
84
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
85
|
+
style: containedViewStyle,
|
|
86
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
87
|
+
source: src,
|
|
88
|
+
alt: alt,
|
|
89
|
+
style: staticStyles.containedImage,
|
|
90
|
+
accessibilityIgnoresInvertColors: true
|
|
91
|
+
})
|
|
92
|
+
}), content]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return /*#__PURE__*/_jsx(ImageBackground, {
|
|
96
|
+
source: src,
|
|
97
|
+
alt: alt,
|
|
98
|
+
style: staticStyles.backgroundImageContainer,
|
|
99
|
+
resizeMode: backgroundImageResizeMode,
|
|
100
|
+
children: content
|
|
101
|
+
});
|
|
102
|
+
};
|
|
59
103
|
|
|
60
104
|
/**
|
|
61
105
|
* A layout utility component. Use Box to create space (padding) around content.
|
|
@@ -122,7 +166,7 @@ const selectBoxStyles = (_ref, customGradient) => {
|
|
|
122
166
|
* text content is inside a scrollable box, as screens are not scrollable by default and even very
|
|
123
167
|
* short text will require scrolling on small devices at the highest accessibility text scaling settings.
|
|
124
168
|
*/
|
|
125
|
-
const Box = /*#__PURE__*/forwardRef((
|
|
169
|
+
const Box = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
126
170
|
let {
|
|
127
171
|
space,
|
|
128
172
|
horizontal = space,
|
|
@@ -141,8 +185,9 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
141
185
|
testID,
|
|
142
186
|
dataSet,
|
|
143
187
|
customGradient,
|
|
188
|
+
backgroundImage,
|
|
144
189
|
...rest
|
|
145
|
-
} =
|
|
190
|
+
} = _ref3;
|
|
146
191
|
const props = {
|
|
147
192
|
accessibilityRole,
|
|
148
193
|
...getA11yPropsFromHtmlTag(tag, accessibilityRole),
|
|
@@ -157,7 +202,41 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
157
202
|
paddingBottom: useSpacingScale(bottom),
|
|
158
203
|
...selectBoxStyles(themeTokens, customGradient)
|
|
159
204
|
};
|
|
160
|
-
|
|
205
|
+
let content = children;
|
|
206
|
+
if (typeof customGradient === 'function') content = customGradient(styles.colors, styles)(children);
|
|
207
|
+
const {
|
|
208
|
+
src = '',
|
|
209
|
+
alt = '',
|
|
210
|
+
resizeMode = '',
|
|
211
|
+
position = '',
|
|
212
|
+
align = ''
|
|
213
|
+
} = backgroundImage || {};
|
|
214
|
+
const backgroundImageResizeMode = useResponsiveProp(resizeMode, 'cover');
|
|
215
|
+
const backgroundImagePosition = useResponsiveProp(position, 'none');
|
|
216
|
+
const backgroundImageAlign = useResponsiveProp(align, 'stretch');
|
|
217
|
+
const [backgroundImageWidth, setBackgroundImageWidth] = useState(0);
|
|
218
|
+
const [backgroundImageHeight, setBackgroundImageHeight] = useState(0);
|
|
219
|
+
if (backgroundImage) content = setBackgroundImage({
|
|
220
|
+
src,
|
|
221
|
+
alt,
|
|
222
|
+
backgroundImageResizeMode,
|
|
223
|
+
backgroundImagePosition,
|
|
224
|
+
backgroundImageAlign,
|
|
225
|
+
backgroundImageWidth,
|
|
226
|
+
backgroundImageHeight,
|
|
227
|
+
content
|
|
228
|
+
});
|
|
229
|
+
useEffect(() => {
|
|
230
|
+
if (backgroundImage && backgroundImageWidth === 0 && backgroundImageHeight === 0) {
|
|
231
|
+
Image.getSize(src, (width, height) => {
|
|
232
|
+
// Only update the state if the size has changed
|
|
233
|
+
if (width !== backgroundImageWidth || height !== backgroundImageHeight) {
|
|
234
|
+
setBackgroundImageWidth(width);
|
|
235
|
+
setBackgroundImageHeight(height);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}, [backgroundImage, backgroundImageWidth, backgroundImageHeight, src]);
|
|
161
240
|
if (scroll) {
|
|
162
241
|
const scrollProps = typeof scroll === 'object' ? scroll : {};
|
|
163
242
|
scrollProps.contentContainerStyle = [styles, scrollProps.contentContainerStyle];
|
|
@@ -167,7 +246,7 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
167
246
|
testID: testID,
|
|
168
247
|
dataSet: dataSet,
|
|
169
248
|
ref: ref,
|
|
170
|
-
children:
|
|
249
|
+
children: content
|
|
171
250
|
});
|
|
172
251
|
}
|
|
173
252
|
return /*#__PURE__*/_jsx(View, {
|
|
@@ -176,7 +255,7 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
176
255
|
testID: testID,
|
|
177
256
|
dataSet: dataSet,
|
|
178
257
|
ref: ref,
|
|
179
|
-
children:
|
|
258
|
+
children: content
|
|
180
259
|
});
|
|
181
260
|
});
|
|
182
261
|
Box.displayName = 'Box';
|
|
@@ -264,6 +343,33 @@ Box.propTypes = {
|
|
|
264
343
|
/**
|
|
265
344
|
Use this prop if need to add a custom gradient for mobile
|
|
266
345
|
*/
|
|
267
|
-
customGradient: PropTypes.func
|
|
346
|
+
customGradient: PropTypes.func,
|
|
347
|
+
/**
|
|
348
|
+
* Use this prop to add a background image to the box.
|
|
349
|
+
*/
|
|
350
|
+
backgroundImage: PropTypes.shape({
|
|
351
|
+
src: PropTypes.string.isRequired,
|
|
352
|
+
alt: PropTypes.string,
|
|
353
|
+
resizeMode: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['cover', 'contain', 'stretch', 'repeat', 'center'])),
|
|
354
|
+
position: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['none', 'bottom', 'left', 'right', 'top'])),
|
|
355
|
+
align: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['start', 'end', 'center', 'stretch']))
|
|
356
|
+
})
|
|
268
357
|
};
|
|
269
|
-
export default Box;
|
|
358
|
+
export default Box;
|
|
359
|
+
const staticStyles = StyleSheet.create({
|
|
360
|
+
backgroundImageContainer: {
|
|
361
|
+
flex: 1
|
|
362
|
+
},
|
|
363
|
+
containedContainer: {
|
|
364
|
+
flex: 1,
|
|
365
|
+
overflow: 'hidden'
|
|
366
|
+
},
|
|
367
|
+
containedView: {
|
|
368
|
+
zIndex: -1,
|
|
369
|
+
position: 'absolute'
|
|
370
|
+
},
|
|
371
|
+
containedImage: {
|
|
372
|
+
width: '100%',
|
|
373
|
+
height: '100%'
|
|
374
|
+
}
|
|
375
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'top-start': {
|
|
3
|
+
top: 0
|
|
4
|
+
},
|
|
5
|
+
'top-center': {
|
|
6
|
+
left: 0,
|
|
7
|
+
right: 0,
|
|
8
|
+
marginHorizontal: 'auto'
|
|
9
|
+
},
|
|
10
|
+
'top-end': {
|
|
11
|
+
top: 0,
|
|
12
|
+
right: 0
|
|
13
|
+
},
|
|
14
|
+
'right-start': {
|
|
15
|
+
top: 0,
|
|
16
|
+
right: 0
|
|
17
|
+
},
|
|
18
|
+
'left-start': {
|
|
19
|
+
top: 0
|
|
20
|
+
},
|
|
21
|
+
'left-center': {
|
|
22
|
+
top: 0,
|
|
23
|
+
bottom: 0,
|
|
24
|
+
marginVertical: 'auto'
|
|
25
|
+
},
|
|
26
|
+
'none-start': {
|
|
27
|
+
top: 0,
|
|
28
|
+
bottom: 0,
|
|
29
|
+
marginVertical: 'auto'
|
|
30
|
+
},
|
|
31
|
+
'none-center': {
|
|
32
|
+
top: 0,
|
|
33
|
+
bottom: 0,
|
|
34
|
+
left: 0,
|
|
35
|
+
right: 0,
|
|
36
|
+
margin: 'auto'
|
|
37
|
+
},
|
|
38
|
+
'right-center': {
|
|
39
|
+
top: 0,
|
|
40
|
+
bottom: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
marginVertical: 'auto'
|
|
43
|
+
},
|
|
44
|
+
'none-end': {
|
|
45
|
+
top: 0,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
marginVertical: 'auto'
|
|
49
|
+
},
|
|
50
|
+
'bottom-start': {
|
|
51
|
+
bottom: 0,
|
|
52
|
+
left: 0
|
|
53
|
+
},
|
|
54
|
+
'left-end': {
|
|
55
|
+
bottom: 0,
|
|
56
|
+
left: 0
|
|
57
|
+
},
|
|
58
|
+
'bottom-center': {
|
|
59
|
+
left: 0,
|
|
60
|
+
right: 0,
|
|
61
|
+
bottom: 0,
|
|
62
|
+
marginHorizontal: 'auto'
|
|
63
|
+
},
|
|
64
|
+
'bottom-end': {
|
|
65
|
+
right: 0,
|
|
66
|
+
bottom: 0
|
|
67
|
+
},
|
|
68
|
+
'right-end': {
|
|
69
|
+
right: 0,
|
|
70
|
+
bottom: 0
|
|
71
|
+
},
|
|
72
|
+
'top-stretch': {
|
|
73
|
+
left: 0,
|
|
74
|
+
right: 0,
|
|
75
|
+
width: '100%'
|
|
76
|
+
},
|
|
77
|
+
'left-stretch': {
|
|
78
|
+
top: 0,
|
|
79
|
+
bottom: 0,
|
|
80
|
+
height: '100%'
|
|
81
|
+
},
|
|
82
|
+
'right-stretch': {
|
|
83
|
+
top: 0,
|
|
84
|
+
bottom: 0,
|
|
85
|
+
right: 0,
|
|
86
|
+
height: '100%'
|
|
87
|
+
},
|
|
88
|
+
'bottom-stretch': {
|
|
89
|
+
left: 0,
|
|
90
|
+
right: 0,
|
|
91
|
+
bottom: 0,
|
|
92
|
+
width: '100%'
|
|
93
|
+
}
|
|
94
|
+
};
|
|
@@ -54,7 +54,8 @@ const CarouselThumbnail = _ref2 => {
|
|
|
54
54
|
padding,
|
|
55
55
|
selectedBorderColor,
|
|
56
56
|
selectedBorderWidth,
|
|
57
|
-
size
|
|
57
|
+
size,
|
|
58
|
+
margin
|
|
58
59
|
} = getThumbnailTokens({
|
|
59
60
|
viewport
|
|
60
61
|
});
|
|
@@ -66,7 +67,12 @@ const CarouselThumbnail = _ref2 => {
|
|
|
66
67
|
selected: {
|
|
67
68
|
borderColor: selectedBorderColor,
|
|
68
69
|
borderWidth: selectedBorderWidth,
|
|
69
|
-
padding: padding - selectedBorderWidth
|
|
70
|
+
padding: padding - selectedBorderWidth,
|
|
71
|
+
marginBottom: margin + selectedBorderWidth
|
|
72
|
+
},
|
|
73
|
+
nonSelected: {
|
|
74
|
+
padding: padding - borderWidth,
|
|
75
|
+
marginBottom: margin + selectedBorderWidth
|
|
70
76
|
}
|
|
71
77
|
};
|
|
72
78
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
@@ -83,9 +89,9 @@ const CarouselThumbnail = _ref2 => {
|
|
|
83
89
|
pressed,
|
|
84
90
|
focus: focused
|
|
85
91
|
}));
|
|
86
|
-
return [pressableStyles, index === activeIndex
|
|
92
|
+
return [pressableStyles, index === activeIndex ? [styles.selected, {
|
|
87
93
|
outline: 'none'
|
|
88
|
-
}];
|
|
94
|
+
}] : styles.nonSelected];
|
|
89
95
|
},
|
|
90
96
|
children: /*#__PURE__*/_jsx(Image, {
|
|
91
97
|
accessibilityIgnoresInvertColors: true,
|
|
@@ -24,8 +24,7 @@ const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
24
24
|
throw new Error('Thumbnail set provided does not match the number of slides in the carousel');
|
|
25
25
|
}
|
|
26
26
|
const {
|
|
27
|
-
containerPaddingTop: thumbnailContainerPaddingTop
|
|
28
|
-
margin: thumbnailMargin
|
|
27
|
+
containerPaddingTop: thumbnailContainerPaddingTop
|
|
29
28
|
} = useThemeTokens('CarouselThumbnail');
|
|
30
29
|
const stackWrapTokens = {
|
|
31
30
|
justifyContent: 'flex-start'
|
|
@@ -33,13 +32,14 @@ const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
33
32
|
const containerStyles = {
|
|
34
33
|
justifyContent: 'center',
|
|
35
34
|
alignItems,
|
|
36
|
-
paddingTop: thumbnailContainerPaddingTop
|
|
35
|
+
paddingTop: thumbnailContainerPaddingTop
|
|
37
36
|
};
|
|
38
37
|
return /*#__PURE__*/_jsx(View, {
|
|
39
38
|
style: containerStyles,
|
|
40
39
|
children: /*#__PURE__*/_jsx(StackWrap, {
|
|
41
40
|
direction: "row",
|
|
42
41
|
tokens: stackWrapTokens,
|
|
42
|
+
space: 2,
|
|
43
43
|
ref: ref,
|
|
44
44
|
children: thumbnails.map((_ref2, index) => {
|
|
45
45
|
let {
|
|
@@ -68,6 +68,14 @@ const selectContentPanelStyles = _ref3 => {
|
|
|
68
68
|
marginBottom
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
+
const selectControlPanelStyles = _ref4 => {
|
|
72
|
+
let {
|
|
73
|
+
contentPanelBackgroundColor
|
|
74
|
+
} = _ref4;
|
|
75
|
+
return {
|
|
76
|
+
backgroundColor: contentPanelBackgroundColor
|
|
77
|
+
};
|
|
78
|
+
};
|
|
71
79
|
|
|
72
80
|
/**
|
|
73
81
|
* An item in an `ExpandCollapse` which contains collapsible `children` and a `control` that opens
|
|
@@ -79,7 +87,7 @@ const selectContentPanelStyles = _ref3 => {
|
|
|
79
87
|
* The panel does not need to be a direct child of the `<ExpandCollapse>` (unless this is required
|
|
80
88
|
* by the chosen accessibility props for a particular accessibility tools).
|
|
81
89
|
*/
|
|
82
|
-
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((
|
|
90
|
+
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
83
91
|
let {
|
|
84
92
|
openIds = [],
|
|
85
93
|
panelId,
|
|
@@ -93,7 +101,7 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
|
93
101
|
controlRef,
|
|
94
102
|
content,
|
|
95
103
|
...rest
|
|
96
|
-
} =
|
|
104
|
+
} = _ref5;
|
|
97
105
|
const [containerHeight, setContainerHeight] = useState(null);
|
|
98
106
|
const isExpanded = openIds.includes(panelId);
|
|
99
107
|
const selectedProps = selectProps({
|
|
@@ -135,14 +143,17 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
|
135
143
|
}) : /*#__PURE__*/_jsxs(View, {
|
|
136
144
|
ref: ref,
|
|
137
145
|
style: themeTokens,
|
|
138
|
-
children: [/*#__PURE__*/_jsx(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
147
|
+
style: selectControlPanelStyles(themeTokens),
|
|
148
|
+
children: /*#__PURE__*/_jsx(ExpandCollapseControl, {
|
|
149
|
+
...selectedProps,
|
|
150
|
+
isExpanded: isExpanded,
|
|
151
|
+
tokens: controlTokens,
|
|
152
|
+
variant: variant,
|
|
153
|
+
onPress: handleControlPress,
|
|
154
|
+
ref: controlRef,
|
|
155
|
+
children: control
|
|
156
|
+
})
|
|
146
157
|
}), isExpanded && /*#__PURE__*/_jsx(View, {
|
|
147
158
|
style: {
|
|
148
159
|
borderTopColor: themeTokens.expandDividerColor,
|
|
@@ -165,19 +165,15 @@ const Footnote = _ref6 => {
|
|
|
165
165
|
children: content
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
return (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
})
|
|
178
|
-
}, number)]
|
|
179
|
-
})
|
|
180
|
-
);
|
|
168
|
+
return /*#__PURE__*/_jsx(OrderedList, {
|
|
169
|
+
start: number,
|
|
170
|
+
children: /*#__PURE__*/_jsx(OrderedList.Item, {
|
|
171
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
172
|
+
style: selectCustomContentFontStyle(themeTokens),
|
|
173
|
+
children: content
|
|
174
|
+
})
|
|
175
|
+
}, number)
|
|
176
|
+
});
|
|
181
177
|
}, [content, number, themeTokens]);
|
|
182
178
|
useEffect(() => {
|
|
183
179
|
if (isOpen) {
|
|
@@ -18,6 +18,7 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
18
|
tokens = {},
|
|
19
19
|
variant,
|
|
20
20
|
dataSet,
|
|
21
|
+
onPress,
|
|
21
22
|
...otherlinkProps
|
|
22
23
|
} = _ref;
|
|
23
24
|
const getChevronTokens = useThemeTokensCallback('ChevronLink', tokens, variant);
|
|
@@ -46,6 +47,7 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
46
47
|
tokens: getTokens,
|
|
47
48
|
dataSet: dataSet,
|
|
48
49
|
ref: ref,
|
|
50
|
+
onPress: onPress,
|
|
49
51
|
children: children
|
|
50
52
|
});
|
|
51
53
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useCallback } from 'react';
|
|
2
2
|
import Pressable from "react-native-web/dist/exports/Pressable";
|
|
3
3
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
5
|
/**
|
|
5
6
|
* @typedef {import('react-native').PressableProps} PressableProps
|
|
6
7
|
*/
|
|
@@ -13,18 +14,31 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
13
14
|
* @param {PressableProps} PressableProps
|
|
14
15
|
*/
|
|
15
16
|
// React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
|
|
16
|
-
|
|
17
|
+
/* eslint-disable react/prop-types */
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
const InlinePressable = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
20
|
let {
|
|
20
21
|
children,
|
|
21
22
|
inlineFlex = true,
|
|
22
23
|
style,
|
|
24
|
+
onPress,
|
|
23
25
|
...props
|
|
24
26
|
} = _ref;
|
|
27
|
+
const handlePress = useCallback(() => {
|
|
28
|
+
if (onPress) {
|
|
29
|
+
onPress();
|
|
30
|
+
}
|
|
31
|
+
}, [onPress]);
|
|
32
|
+
const handleKeyPress = useCallback(e => {
|
|
33
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
34
|
+
handlePress();
|
|
35
|
+
}
|
|
36
|
+
}, [handlePress]);
|
|
25
37
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
26
38
|
ref: ref,
|
|
27
39
|
style: pressState => [typeof style === 'function' ? style(pressState) : style, staticStyles[inlineFlex ? 'inlineFlex' : 'inline']],
|
|
40
|
+
onPress: handlePress,
|
|
41
|
+
onKeyDown: Platform.OS === 'web' ? handleKeyPress : undefined,
|
|
28
42
|
...props,
|
|
29
43
|
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
30
44
|
});
|
|
@@ -178,6 +178,7 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
178
178
|
// assuming links without icons should be inline (even if they are long)
|
|
179
179
|
,
|
|
180
180
|
ref: ref,
|
|
181
|
+
keyboardShouldPersistTaps: "handled",
|
|
181
182
|
style: linkState => {
|
|
182
183
|
const themeTokens = resolveLinkTokens(linkState);
|
|
183
184
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
@@ -5,25 +5,6 @@ import OrderedListBase from './OrderedListBase';
|
|
|
5
5
|
import Item from './Item';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
const [selectProps, selectedSystemPropsTypes] = selectSystemProps([htmlAttrs, viewProps]);
|
|
8
|
-
const getChildrenWithParentVariants = (variant, children, start) => {
|
|
9
|
-
if (variant) return children.map((child, i) => {
|
|
10
|
-
var _child$props;
|
|
11
|
-
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
12
|
-
return {
|
|
13
|
-
...child,
|
|
14
|
-
props: {
|
|
15
|
-
...child.props,
|
|
16
|
-
index: start + i,
|
|
17
|
-
isLastChild: i === children.length - 1,
|
|
18
|
-
variant: {
|
|
19
|
-
...existingChildVariants,
|
|
20
|
-
...variant
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
return children;
|
|
26
|
-
};
|
|
27
8
|
const OrderedList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
28
9
|
let {
|
|
29
10
|
children,
|
|
@@ -31,7 +12,27 @@ const OrderedList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
31
12
|
variant,
|
|
32
13
|
...rest
|
|
33
14
|
} = _ref;
|
|
34
|
-
const childrenWithParentVariants = useMemo(() =>
|
|
15
|
+
const childrenWithParentVariants = useMemo(() => {
|
|
16
|
+
const addVariantToProps = (child, i, isLastChild) => {
|
|
17
|
+
var _child$props;
|
|
18
|
+
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
19
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
20
|
+
index: start + i,
|
|
21
|
+
isLastChild,
|
|
22
|
+
variant: {
|
|
23
|
+
...existingChildVariants,
|
|
24
|
+
...variant
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
if (variant) {
|
|
29
|
+
if (Array.isArray(children)) {
|
|
30
|
+
return children.map((child, i) => addVariantToProps(child, i, i === children.length - 1));
|
|
31
|
+
}
|
|
32
|
+
return [addVariantToProps(children, 0, true)];
|
|
33
|
+
}
|
|
34
|
+
return children;
|
|
35
|
+
}, [children, variant, start]);
|
|
35
36
|
return /*#__PURE__*/_jsx(OrderedListBase, {
|
|
36
37
|
ref: ref,
|
|
37
38
|
...selectProps(rest),
|