@telus-uds/components-base 3.29.0 → 3.30.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 +26 -1
- package/jest.config.cjs +1 -0
- package/lib/cjs/ActionCard/ActionCard.js +4 -4
- package/lib/cjs/ActivityIndicator/Dots.native.js +1 -2
- package/lib/cjs/ActivityIndicator/Spinner.native.js +1 -2
- package/lib/cjs/Box/Box.js +1 -2
- package/lib/cjs/Button/Button.js +1 -2
- package/lib/cjs/Button/ButtonBase.js +8 -8
- package/lib/cjs/Button/ButtonDropdown.js +1 -2
- package/lib/cjs/Button/ButtonGroup.js +1 -2
- package/lib/cjs/Button/ButtonLink.js +1 -2
- package/lib/cjs/Card/Card.js +1 -2
- package/lib/cjs/Card/PressableCardBase.js +1 -2
- package/lib/cjs/Card/index.js +1 -2
- package/lib/cjs/CardGroup/CardGroup.js +1 -2
- package/lib/cjs/Carousel/Carousel.js +12 -7
- package/lib/cjs/Carousel/CarouselThumbnail.js +123 -31
- package/lib/cjs/Carousel/CarouselThumbnailNavigation.js +8 -1
- package/lib/cjs/CheckboxCard/CheckboxCard.js +1 -2
- package/lib/cjs/CheckboxCardGroup/CheckboxCardGroup.js +1 -2
- package/lib/cjs/Footnote/FootnoteLink.js +18 -17
- package/lib/cjs/HorizontalScroll/index.js +1 -2
- package/lib/cjs/Icon/IconText.js +1 -2
- package/lib/cjs/Icon/index.js +1 -2
- package/lib/cjs/InputSupports/InputSupports.js +1 -2
- package/lib/cjs/InputSupports/useInputSupports.js +1 -3
- package/lib/cjs/Link/MobileIconTextContent.js +1 -2
- package/lib/cjs/Listbox/Listbox.js +1 -2
- package/lib/cjs/Modal/Modal.js +1 -1
- package/lib/cjs/Pagination/PageButton.js +1 -2
- package/lib/cjs/Pagination/Pagination.js +1 -2
- package/lib/cjs/Progress/Progress.js +30 -5
- package/lib/cjs/QuickLinks/QuickLinks.js +7 -0
- package/lib/cjs/Radio/Radio.js +1 -2
- package/lib/cjs/RadioCard/RadioCard.js +1 -2
- package/lib/cjs/RadioCard/RadioCardGroup.js +1 -2
- package/lib/cjs/Scroll/Scroll.js +466 -0
- package/lib/cjs/Scroll/ScrollContext.js +55 -0
- package/lib/cjs/Scroll/ScrollItem.js +103 -0
- package/lib/cjs/Scroll/ScrollProgress.js +99 -0
- package/lib/cjs/Scroll/dictionary.js +18 -0
- package/lib/cjs/Scroll/index.js +29 -0
- package/lib/cjs/Shortcuts/Shortcuts.js +1 -2
- package/lib/cjs/SideNav/SideNav.js +1 -2
- package/lib/cjs/StackView/StackWrapBox.js +9 -1
- package/lib/cjs/StackView/StackWrapGap.js +3 -1
- package/lib/cjs/StackView/getStackedContent.js +21 -12
- package/lib/cjs/Tabs/Tabs.js +1 -2
- package/lib/cjs/Tooltip/Tooltip.native.js +2 -2
- package/lib/cjs/index.js +16 -2
- package/lib/cjs/utils/animation/index.js +7 -0
- package/lib/cjs/utils/animation/useAnimatedValue.js +46 -0
- package/lib/cjs/utils/children.js +2 -1
- package/lib/cjs/utils/index.js +1 -2
- package/lib/esm/ActionCard/ActionCard.js +4 -4
- package/lib/esm/Button/ButtonBase.js +8 -8
- package/lib/esm/Carousel/Carousel.js +12 -7
- package/lib/esm/Carousel/CarouselThumbnail.js +124 -32
- package/lib/esm/Carousel/CarouselThumbnailNavigation.js +8 -1
- package/lib/esm/Footnote/FootnoteLink.js +18 -17
- package/lib/esm/InputSupports/InputSupports.js +1 -2
- package/lib/esm/InputSupports/useInputSupports.js +1 -3
- package/lib/esm/Modal/Modal.js +1 -1
- package/lib/esm/Progress/Progress.js +30 -5
- package/lib/esm/QuickLinks/QuickLinks.js +7 -0
- package/lib/esm/Scroll/Scroll.js +459 -0
- package/lib/esm/Scroll/ScrollContext.js +47 -0
- package/lib/esm/Scroll/ScrollItem.js +96 -0
- package/lib/esm/Scroll/ScrollProgress.js +92 -0
- package/lib/esm/Scroll/dictionary.js +12 -0
- package/lib/esm/Scroll/index.js +4 -0
- package/lib/esm/StackView/StackWrapBox.js +9 -1
- package/lib/esm/StackView/StackWrapGap.js +3 -1
- package/lib/esm/StackView/getStackedContent.js +20 -10
- package/lib/esm/Tooltip/Tooltip.native.js +2 -2
- package/lib/esm/index.js +1 -0
- package/lib/esm/utils/animation/index.js +1 -1
- package/lib/esm/utils/animation/useAnimatedValue.js +39 -0
- package/lib/esm/utils/children.js +2 -1
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Carousel/Carousel.jsx +6 -1
- package/src/Carousel/CarouselThumbnail.jsx +153 -64
- package/src/Carousel/CarouselThumbnailNavigation.jsx +8 -2
- package/src/Footnote/FootnoteLink.jsx +17 -12
- package/src/InputSupports/InputSupports.jsx +1 -6
- package/src/InputSupports/useInputSupports.js +1 -1
- package/src/Modal/Modal.jsx +1 -1
- package/src/Progress/Progress.jsx +22 -3
- package/src/QuickLinks/QuickLinks.jsx +8 -0
- package/src/Scroll/Scroll.jsx +488 -0
- package/src/Scroll/ScrollContext.jsx +41 -0
- package/src/Scroll/ScrollItem.jsx +89 -0
- package/src/Scroll/ScrollProgress.jsx +75 -0
- package/src/Scroll/dictionary.js +12 -0
- package/src/Scroll/index.js +5 -0
- package/src/StackView/StackWrapBox.jsx +13 -1
- package/src/StackView/StackWrapGap.jsx +2 -1
- package/src/StackView/getStackedContent.jsx +22 -8
- package/src/index.js +1 -0
- package/src/utils/animation/index.js +1 -1
- package/src/utils/animation/useAnimatedValue.js +37 -0
- package/src/utils/children.jsx +4 -1
- package/types/Scroll.d.ts +66 -0
- package/types/index.d.ts +9 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
4
|
import Pressable from "react-native-web/dist/exports/Pressable";
|
|
4
5
|
import Image from "react-native-web/dist/exports/Image";
|
|
6
|
+
import View from "react-native-web/dist/exports/View";
|
|
5
7
|
import { useCarousel } from './CarouselContext';
|
|
6
8
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
7
9
|
import { useViewport } from '../ViewportProvider';
|
|
8
|
-
import
|
|
10
|
+
import Icon from '../Icon';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
12
|
const selectPressableTokens = _ref => {
|
|
10
13
|
let {
|
|
11
14
|
borderColor,
|
|
@@ -23,17 +26,64 @@ const selectPressableTokens = _ref => {
|
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
|
|
29
|
+
// Play icon overlay appearance is consistent across all brands and is not theme-configurable.
|
|
30
|
+
// The circle occupies 55% of the thumbnail size, and the icon occupies 55% of the circle diameter.
|
|
31
|
+
const PLAY_ICON_RATIO = 0.55;
|
|
32
|
+
const PLAY_ICON_BORDER_RADIUS_DIVISOR = 2;
|
|
33
|
+
const selectImageStyles = size => ({
|
|
34
|
+
width: size,
|
|
35
|
+
height: size
|
|
36
|
+
});
|
|
37
|
+
const selectSelectedStyles = _ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
selectedBorderColor,
|
|
40
|
+
selectedBorderWidth,
|
|
41
|
+
padding,
|
|
42
|
+
margin
|
|
43
|
+
} = _ref2;
|
|
44
|
+
return {
|
|
45
|
+
borderColor: selectedBorderColor,
|
|
46
|
+
borderWidth: selectedBorderWidth,
|
|
47
|
+
padding: padding - selectedBorderWidth,
|
|
48
|
+
marginBottom: margin + selectedBorderWidth
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const selectNonSelectedStyles = _ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
borderWidth,
|
|
54
|
+
padding,
|
|
55
|
+
margin,
|
|
56
|
+
selectedBorderWidth
|
|
57
|
+
} = _ref3;
|
|
58
|
+
return {
|
|
59
|
+
padding: padding - borderWidth,
|
|
60
|
+
marginBottom: margin + selectedBorderWidth
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const selectPlayIconCircleStyles = thumbnailSize => {
|
|
64
|
+
const diameter = thumbnailSize * PLAY_ICON_RATIO;
|
|
65
|
+
return {
|
|
66
|
+
width: diameter,
|
|
67
|
+
height: diameter,
|
|
68
|
+
borderRadius: diameter / PLAY_ICON_BORDER_RADIUS_DIVISOR
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const selectPlayIconTokens = thumbnailSize => ({
|
|
72
|
+
size: thumbnailSize * PLAY_ICON_RATIO * PLAY_ICON_RATIO
|
|
73
|
+
});
|
|
74
|
+
|
|
26
75
|
/**
|
|
27
76
|
* `Carousel.Thumbnail` is used to wrap the content of an individual slide and is suppsoed to be the
|
|
28
77
|
* only top-level component passed to the `Carousel`
|
|
29
78
|
*/
|
|
30
|
-
const CarouselThumbnail = /*#__PURE__*/React.forwardRef((
|
|
79
|
+
const CarouselThumbnail = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
31
80
|
let {
|
|
32
81
|
accessibilityLabel,
|
|
33
82
|
alt,
|
|
34
83
|
index,
|
|
84
|
+
isVideo,
|
|
35
85
|
src
|
|
36
|
-
} =
|
|
86
|
+
} = _ref4;
|
|
37
87
|
const {
|
|
38
88
|
activeIndex,
|
|
39
89
|
itemLabel,
|
|
@@ -55,59 +105,101 @@ const CarouselThumbnail = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
55
105
|
selectedBorderColor,
|
|
56
106
|
selectedBorderWidth,
|
|
57
107
|
size,
|
|
58
|
-
margin
|
|
108
|
+
margin,
|
|
109
|
+
playIcon
|
|
59
110
|
} = getThumbnailTokens({
|
|
60
111
|
viewport
|
|
61
112
|
});
|
|
62
|
-
const styles = {
|
|
63
|
-
image: {
|
|
64
|
-
height: size,
|
|
65
|
-
width: size
|
|
66
|
-
},
|
|
67
|
-
selected: {
|
|
68
|
-
borderColor: selectedBorderColor,
|
|
69
|
-
borderWidth: selectedBorderWidth,
|
|
70
|
-
padding: padding - selectedBorderWidth,
|
|
71
|
-
marginBottom: margin + selectedBorderWidth
|
|
72
|
-
},
|
|
73
|
-
nonSelected: {
|
|
74
|
-
padding: padding - borderWidth,
|
|
75
|
-
marginBottom: margin + selectedBorderWidth
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
113
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
79
114
|
onKeyDown: handleKeyDown,
|
|
80
115
|
onPress: handlePress,
|
|
81
|
-
style:
|
|
116
|
+
style: _ref5 => {
|
|
82
117
|
let {
|
|
83
118
|
hovered,
|
|
84
119
|
pressed,
|
|
85
120
|
focused
|
|
86
|
-
} =
|
|
121
|
+
} = _ref5;
|
|
87
122
|
const pressableStyles = selectPressableTokens(getThumbnailTokens({
|
|
88
123
|
hover: hovered,
|
|
89
124
|
pressed,
|
|
90
125
|
focus: focused
|
|
91
126
|
}));
|
|
92
|
-
return [pressableStyles, index === activeIndex ? [
|
|
93
|
-
|
|
94
|
-
|
|
127
|
+
return [pressableStyles, index === activeIndex ? [selectSelectedStyles({
|
|
128
|
+
selectedBorderColor,
|
|
129
|
+
selectedBorderWidth,
|
|
130
|
+
padding,
|
|
131
|
+
margin
|
|
132
|
+
}), staticStyles.selectedPressableOutline] : selectNonSelectedStyles({
|
|
133
|
+
borderWidth,
|
|
134
|
+
padding,
|
|
135
|
+
margin,
|
|
136
|
+
selectedBorderWidth
|
|
137
|
+
})];
|
|
95
138
|
},
|
|
96
139
|
ref: ref,
|
|
97
|
-
children: /*#__PURE__*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
140
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
141
|
+
style: [staticStyles.imageContainer, selectImageStyles(size)],
|
|
142
|
+
children: [/*#__PURE__*/_jsx(Image, {
|
|
143
|
+
accessibilityIgnoresInvertColors: true,
|
|
144
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
145
|
+
source: src,
|
|
146
|
+
style: selectImageStyles(size),
|
|
147
|
+
title: thumbnailTitle
|
|
148
|
+
}), isVideo && playIcon && /*#__PURE__*/_jsx(View, {
|
|
149
|
+
style: staticStyles.playIconOverlayContainer,
|
|
150
|
+
testID: `play-icon-overlay-${index}`,
|
|
151
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
152
|
+
style: [selectPlayIconCircleStyles(size), staticStyles.playIconCircleBackground],
|
|
153
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
154
|
+
icon: playIcon,
|
|
155
|
+
tokens: {
|
|
156
|
+
...selectPlayIconTokens(size),
|
|
157
|
+
color: staticStyles.playIconSymbol.color
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
})]
|
|
103
162
|
})
|
|
104
163
|
}, src);
|
|
105
164
|
});
|
|
106
165
|
CarouselThumbnail.displayName = 'CarouselThumbnail';
|
|
107
166
|
CarouselThumbnail.propTypes = {
|
|
167
|
+
/** Accessibility label for screen readers, overrides the alt text */
|
|
108
168
|
accessibilityLabel: PropTypes.string,
|
|
169
|
+
/** Alt text for the thumbnail image */
|
|
109
170
|
alt: PropTypes.string,
|
|
171
|
+
/** Zero-based index of this thumbnail within the carousel */
|
|
110
172
|
index: PropTypes.number,
|
|
111
|
-
|
|
173
|
+
/**
|
|
174
|
+
* When true, renders a play icon overlay on the thumbnail to indicate that the slide contains a video.
|
|
175
|
+
*/
|
|
176
|
+
isVideo: PropTypes.bool,
|
|
177
|
+
/** Image source URI (web) or local asset require() (native) */
|
|
178
|
+
src: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
112
179
|
};
|
|
180
|
+
const staticStyles = StyleSheet.create({
|
|
181
|
+
imageContainer: {
|
|
182
|
+
position: 'relative'
|
|
183
|
+
},
|
|
184
|
+
playIconOverlayContainer: {
|
|
185
|
+
position: 'absolute',
|
|
186
|
+
top: 0,
|
|
187
|
+
left: 0,
|
|
188
|
+
right: 0,
|
|
189
|
+
bottom: 0,
|
|
190
|
+
justifyContent: 'center',
|
|
191
|
+
alignItems: 'center'
|
|
192
|
+
},
|
|
193
|
+
selectedPressableOutline: {
|
|
194
|
+
outlineStyle: 'none'
|
|
195
|
+
},
|
|
196
|
+
playIconCircleBackground: {
|
|
197
|
+
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
alignItems: 'center'
|
|
200
|
+
},
|
|
201
|
+
playIconSymbol: {
|
|
202
|
+
color: 'rgb(255, 255, 255)'
|
|
203
|
+
}
|
|
204
|
+
});
|
|
113
205
|
export default CarouselThumbnail;
|
|
@@ -45,12 +45,14 @@ const CarouselThumbnailNavigation = /*#__PURE__*/React.forwardRef((_ref, ref) =>
|
|
|
45
45
|
let {
|
|
46
46
|
accessibilityLabel,
|
|
47
47
|
alt,
|
|
48
|
+
isVideo,
|
|
48
49
|
src
|
|
49
50
|
} = _ref2;
|
|
50
51
|
return /*#__PURE__*/_jsx(CarouselThumbnail, {
|
|
51
52
|
accessibilityLabel: accessibilityLabel,
|
|
52
53
|
alt: alt,
|
|
53
54
|
index: index,
|
|
55
|
+
isVideo: isVideo,
|
|
54
56
|
src: src
|
|
55
57
|
}, src);
|
|
56
58
|
})
|
|
@@ -63,9 +65,14 @@ CarouselThumbnailNavigation.propTypes = {
|
|
|
63
65
|
* An array of objects containing information on the thumbnail images.
|
|
64
66
|
*/
|
|
65
67
|
thumbnails: PropTypes.arrayOf(PropTypes.shape({
|
|
68
|
+
/** Accessibility label for the thumbnail image, used by assistive technologies. */
|
|
66
69
|
accessibilityLabel: PropTypes.string,
|
|
70
|
+
/** Alternative text for the thumbnail image, displayed when the image cannot be rendered. */
|
|
67
71
|
alt: PropTypes.string,
|
|
68
|
-
|
|
72
|
+
/** When true, renders a play icon overlay on the thumbnail to indicate that the slide contains a video. */
|
|
73
|
+
isVideo: PropTypes.bool,
|
|
74
|
+
/** URL or path of the thumbnail image. When used with `isVideo`, this should be the video's poster/preview image. */
|
|
75
|
+
src: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
69
76
|
})).isRequired
|
|
70
77
|
};
|
|
71
78
|
export default CarouselThumbnailNavigation;
|
|
@@ -9,28 +9,28 @@ import { htmlAttrs, selectSystemProps, useCopy, viewProps, wrapStringsInText, va
|
|
|
9
9
|
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps]);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const HALF_FONT_SIZE = 2;
|
|
13
|
+
const QUARTER_FONT_SIZE = 4;
|
|
14
|
+
const DEFAULT_LINE_HEIGHT = 1;
|
|
15
|
+
const LINE_HEIGHT_MULTIPLIER = 2;
|
|
14
16
|
const selectTextStyle = _ref => {
|
|
15
17
|
let {
|
|
16
18
|
fontSize,
|
|
17
19
|
lineHeight
|
|
18
20
|
} = _ref;
|
|
19
|
-
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
33
|
-
};
|
|
21
|
+
return Platform.select({
|
|
22
|
+
native: {
|
|
23
|
+
fontSize: fontSize / HALF_FONT_SIZE,
|
|
24
|
+
lineHeight: fontSize,
|
|
25
|
+
position: 'relative',
|
|
26
|
+
top: -(fontSize * lineHeight) / HALF_FONT_SIZE
|
|
27
|
+
},
|
|
28
|
+
web: {
|
|
29
|
+
fontSize,
|
|
30
|
+
lineHeight: lineHeight !== DEFAULT_LINE_HEIGHT ? lineHeight : fontSize * LINE_HEIGHT_MULTIPLIER,
|
|
31
|
+
top: -fontSize / QUARTER_FONT_SIZE
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
34
|
};
|
|
35
35
|
const FootnoteLink = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
36
36
|
let {
|
|
@@ -74,6 +74,7 @@ const FootnoteLink = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
FootnoteLink.displayName = 'FootnoteLink';
|
|
77
|
+
FootnoteLink.__UDS_COMPONENT_NAME__ = 'FootnoteLink';
|
|
77
78
|
const copyShape = PropTypes.shape({
|
|
78
79
|
a11yLabel: PropTypes.string.isRequired
|
|
79
80
|
});
|
|
@@ -65,8 +65,7 @@ const InputSupports = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
65
65
|
}), typeof children === 'function' ? children({
|
|
66
66
|
inputId,
|
|
67
67
|
...a11yProps,
|
|
68
|
-
validation: feedbackValidation
|
|
69
|
-
accessibilityDescribedBy: feedbackId
|
|
68
|
+
validation: feedbackValidation
|
|
70
69
|
}) : children, feedback || maxCharsReachedErrorMessage ? /*#__PURE__*/_jsx(Feedback, {
|
|
71
70
|
id: feedbackId,
|
|
72
71
|
title: feedback || maxCharsReachedErrorMessage,
|
|
@@ -25,9 +25,7 @@ const useInputSupports = _ref => {
|
|
|
25
25
|
accessibilityLabel: label,
|
|
26
26
|
accessibilityHint: joinDefined([!hasValidationError && feedback, hint, maxCharacterAllowed ? getCopy('maxCharacters').replace(/%\{charCount\}/g, maxCharacterAllowed) : undefined]),
|
|
27
27
|
// native only -> replaced with describedBy on web
|
|
28
|
-
accessibilityDescribedBy: joinDefined([
|
|
29
|
-
// feedback receives a11yRole=alert on error, so there's no need to include it here
|
|
30
|
-
hint && hintId, charactersCount ? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount) : undefined]),
|
|
28
|
+
accessibilityDescribedBy: joinDefined([hint && hintId, feedback && feedbackId || undefined, charactersCount ? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount) : undefined]),
|
|
31
29
|
accessibilityInvalid: hasValidationError
|
|
32
30
|
};
|
|
33
31
|
return {
|
package/lib/esm/Modal/Modal.js
CHANGED
|
@@ -239,7 +239,7 @@ const Modal = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
239
239
|
})]
|
|
240
240
|
})
|
|
241
241
|
}), /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
242
|
-
onPress: isBackdropClickable
|
|
242
|
+
onPress: isBackdropClickable ? handleClose : undefined,
|
|
243
243
|
children: /*#__PURE__*/_jsx(View, {
|
|
244
244
|
style: [staticStyles.backdrop, selectBackdropStyles(themeTokens)]
|
|
245
245
|
})
|
|
@@ -7,6 +7,8 @@ import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps
|
|
|
7
7
|
import ProgressContext from './ProgressContext';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
10
|
+
const BORDER_SIDES = 2;
|
|
11
|
+
const CENTER_DIVISOR = 2;
|
|
10
12
|
const selectProgressStyles = _ref => {
|
|
11
13
|
let {
|
|
12
14
|
backgroundColor,
|
|
@@ -25,6 +27,21 @@ const selectProgressStyles = _ref => {
|
|
|
25
27
|
...applyShadowToken(shadow)
|
|
26
28
|
};
|
|
27
29
|
};
|
|
30
|
+
const selectBarWrapperStyles = _ref2 => {
|
|
31
|
+
let {
|
|
32
|
+
barHeight,
|
|
33
|
+
borderRadius,
|
|
34
|
+
borderWidth,
|
|
35
|
+
height
|
|
36
|
+
} = _ref2;
|
|
37
|
+
return {
|
|
38
|
+
height: barHeight,
|
|
39
|
+
width: '100%',
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: (height - borderWidth * BORDER_SIDES - barHeight) / CENTER_DIVISOR,
|
|
42
|
+
borderRadius
|
|
43
|
+
};
|
|
44
|
+
};
|
|
28
45
|
|
|
29
46
|
/**
|
|
30
47
|
* The `Progress` is a container for displaying one or several `ProgressBar`s.
|
|
@@ -38,10 +55,11 @@ const selectProgressStyles = _ref => {
|
|
|
38
55
|
*
|
|
39
56
|
* - Use the following tokens to customize the appearance:
|
|
40
57
|
* - `backgroundColor` for the background color of the progress container,
|
|
58
|
+
* - `barHeight` to control the height of the progress bars displayed within the container,
|
|
41
59
|
* - `borderColor` to control the color of the border,
|
|
42
60
|
* - `borderRadius` for the rounded corners,
|
|
43
61
|
* - `borderWidth` to change the border width.
|
|
44
|
-
* - `height` to control the height of the progress
|
|
62
|
+
* - `height` to control the height of the progress bar container.
|
|
45
63
|
* - `shadow` to apply a box shadow to the progress bar container.
|
|
46
64
|
*
|
|
47
65
|
* ## Variants
|
|
@@ -62,16 +80,23 @@ const selectProgressStyles = _ref => {
|
|
|
62
80
|
* role.
|
|
63
81
|
*
|
|
64
82
|
*/
|
|
65
|
-
const Progress = /*#__PURE__*/React.forwardRef((
|
|
83
|
+
const Progress = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
66
84
|
let {
|
|
67
85
|
children,
|
|
68
86
|
tokens,
|
|
69
87
|
variant,
|
|
70
88
|
...rest
|
|
71
|
-
} =
|
|
89
|
+
} = _ref3;
|
|
72
90
|
const themeTokens = useThemeTokens('Progress', tokens, variant);
|
|
73
|
-
// Default to false (vertical layout) to preserve existing behavior and avoid breaking changes
|
|
74
91
|
const layers = variant?.layers ?? false;
|
|
92
|
+
const {
|
|
93
|
+
barHeight,
|
|
94
|
+
height
|
|
95
|
+
} = themeTokens;
|
|
96
|
+
const content = barHeight && barHeight !== height ? /*#__PURE__*/_jsx(View, {
|
|
97
|
+
style: selectBarWrapperStyles(themeTokens),
|
|
98
|
+
children: children
|
|
99
|
+
}) : children;
|
|
75
100
|
return /*#__PURE__*/_jsx(ProgressContext.Provider, {
|
|
76
101
|
value: {
|
|
77
102
|
layers
|
|
@@ -80,7 +105,7 @@ const Progress = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
80
105
|
ref: ref,
|
|
81
106
|
style: [staticStyles.progressContainer, selectProgressStyles(themeTokens)],
|
|
82
107
|
...selectProps(rest),
|
|
83
|
-
children:
|
|
108
|
+
children: content
|
|
84
109
|
})
|
|
85
110
|
});
|
|
86
111
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
4
|
import { useThemeTokens } from '../ThemeProvider';
|
|
4
5
|
import { useViewport } from '../ViewportProvider';
|
|
5
6
|
import { getTokensPropType, variantProp } from '../utils';
|
|
7
|
+
import { tagsToRoles } from '../utils/a11y/semantics';
|
|
6
8
|
import List from '../List';
|
|
7
9
|
import StackWrap from '../StackView/StackWrap';
|
|
8
10
|
import QuickLinksCard from './QuickLinksCard';
|
|
@@ -35,6 +37,10 @@ const QuickLinks = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
35
37
|
} = useThemeTokens('QuickLinks', tokens, variant, {
|
|
36
38
|
viewport
|
|
37
39
|
});
|
|
40
|
+
const itemAccessibilityRole = Platform.select({
|
|
41
|
+
web: ['ul', 'ol'].includes(tag) ? tagsToRoles.li : undefined,
|
|
42
|
+
default: undefined
|
|
43
|
+
});
|
|
38
44
|
const content = list && /*#__PURE__*/_jsx(List, {
|
|
39
45
|
ref: ref,
|
|
40
46
|
tokens: listTokens,
|
|
@@ -49,6 +55,7 @@ const QuickLinks = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
49
55
|
justifyContent: stackJustify
|
|
50
56
|
},
|
|
51
57
|
tag: tag,
|
|
58
|
+
itemAccessibilityRole: itemAccessibilityRole,
|
|
52
59
|
...rest,
|
|
53
60
|
children: children
|
|
54
61
|
});
|