@telus-uds/components-base 3.29.1 → 3.31.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 +29 -1
- package/lib/cjs/Autocomplete/Autocomplete.js +13 -1
- package/lib/cjs/Autocomplete/constants.js +1 -1
- package/lib/cjs/Carousel/Carousel.js +6 -1
- package/lib/cjs/Carousel/CarouselThumbnail.js +123 -31
- package/lib/cjs/Carousel/CarouselThumbnailNavigation.js +8 -1
- package/lib/cjs/Footnote/FootnoteLink.js +18 -17
- package/lib/cjs/Listbox/ListboxOverlay.js +7 -1
- package/lib/cjs/MultiSelectFilter/ModalOverlay.js +7 -1
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +2 -28
- package/lib/cjs/Progress/Progress.js +30 -5
- 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/TextInput/TextInputBase.js +2 -1
- package/lib/cjs/index.js +15 -0
- 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/useOverlaidPosition.js +83 -42
- package/lib/esm/Autocomplete/Autocomplete.js +13 -1
- package/lib/esm/Autocomplete/constants.js +1 -1
- package/lib/esm/Carousel/Carousel.js +6 -1
- 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/Listbox/ListboxOverlay.js +7 -1
- package/lib/esm/MultiSelectFilter/ModalOverlay.js +8 -2
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +2 -28
- package/lib/esm/Progress/Progress.js +30 -5
- 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/TextInput/TextInputBase.js +2 -1
- 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/esm/utils/useOverlaidPosition.js +83 -42
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Autocomplete/Autocomplete.jsx +11 -2
- package/src/Autocomplete/constants.js +1 -1
- 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/Listbox/ListboxOverlay.jsx +6 -2
- package/src/MultiSelectFilter/ModalOverlay.jsx +9 -3
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +1 -31
- package/src/Progress/Progress.jsx +22 -3
- 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/TextInput/TextInputBase.jsx +2 -1
- 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/src/utils/useOverlaidPosition.js +84 -34
- 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
|
});
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
5
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
6
|
+
import ScrollView from "react-native-web/dist/exports/ScrollView";
|
|
6
7
|
import Portal from '../Portal';
|
|
7
8
|
import { useThemeTokens } from '../ThemeProvider';
|
|
8
9
|
import Card from '../Card';
|
|
@@ -60,7 +61,12 @@ const DropdownOverlay = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
60
61
|
paddingLeft: paddingHorizontal,
|
|
61
62
|
paddingRight: paddingHorizontal
|
|
62
63
|
},
|
|
63
|
-
children:
|
|
64
|
+
children: Platform.OS !== 'web' ? /*#__PURE__*/_jsx(ScrollView, {
|
|
65
|
+
style: {
|
|
66
|
+
maxHeight
|
|
67
|
+
},
|
|
68
|
+
children: children
|
|
69
|
+
}) : children
|
|
64
70
|
})
|
|
65
71
|
});
|
|
66
72
|
});
|
|
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
5
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
6
|
-
import { Portal } from '@gorhom/portal';
|
|
6
|
+
import { Portal as GorhomPortal } from '@gorhom/portal';
|
|
7
|
+
import LocalPortal from '../Portal/Portal';
|
|
7
8
|
import { useCopy, copyPropTypes, getTokensPropType, variantProp } from '../utils';
|
|
8
9
|
import { useViewport } from '../ViewportProvider';
|
|
9
10
|
import { useThemeTokens } from '../ThemeProvider';
|
|
@@ -116,7 +117,12 @@ const ModalOverlay = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
116
117
|
copy
|
|
117
118
|
});
|
|
118
119
|
const closeLabel = getCopy('closeButton');
|
|
119
|
-
|
|
120
|
+
|
|
121
|
+
// On web, use the local Portal (always appends to document.body) to ensure correct
|
|
122
|
+
// absolute positioning in MFE/iframe contexts. @gorhom/portal may render its host
|
|
123
|
+
// outside the iframe's document, causing coordinate mismatches when scrolled.
|
|
124
|
+
const PortalComponent = Platform.OS === 'web' ? LocalPortal : GorhomPortal;
|
|
125
|
+
return /*#__PURE__*/_jsx(PortalComponent, {
|
|
120
126
|
children: /*#__PURE__*/_jsx(View, {
|
|
121
127
|
ref: containerRef,
|
|
122
128
|
onLayout: onLayout,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Portal } from '@gorhom/portal';
|
|
4
3
|
import View from "react-native-web/dist/exports/View";
|
|
5
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
6
5
|
import Dimensions from "react-native-web/dist/exports/Dimensions";
|
|
@@ -212,20 +211,6 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
212
211
|
setIsOpen(false);
|
|
213
212
|
onCancel();
|
|
214
213
|
};
|
|
215
|
-
const appRootRef = React.useRef(null);
|
|
216
|
-
const [rootOffsets, setRootOffsets] = React.useState(null);
|
|
217
|
-
React.useEffect(() => {
|
|
218
|
-
if (rootOffsets) return;
|
|
219
|
-
appRootRef.current?.measureInWindow((x, y) => {
|
|
220
|
-
// Only set offsets if they are positive
|
|
221
|
-
// this is because we want to avoid negative offsets that could cause
|
|
222
|
-
// the dropdown to be positioned incorrectly in some situations
|
|
223
|
-
if (y > 0) setRootOffsets({
|
|
224
|
-
horizontal: x,
|
|
225
|
-
vertical: y
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
}, [isOpen, rootOffsets]);
|
|
229
214
|
const {
|
|
230
215
|
align,
|
|
231
216
|
offsets
|
|
@@ -242,8 +227,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
242
227
|
left: 'left'
|
|
243
228
|
},
|
|
244
229
|
offsets: {
|
|
245
|
-
vertical: 4
|
|
246
|
-
horizontal: -rootOffsets?.horizontal || 0
|
|
230
|
+
vertical: 4
|
|
247
231
|
}
|
|
248
232
|
}
|
|
249
233
|
});
|
|
@@ -380,12 +364,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
380
364
|
})]
|
|
381
365
|
});
|
|
382
366
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
383
|
-
children: [/*#__PURE__*/_jsx(
|
|
384
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
385
|
-
ref: appRootRef,
|
|
386
|
-
style: styles.appRootRef
|
|
387
|
-
})
|
|
388
|
-
}), /*#__PURE__*/_jsx(ButtonDropdown, {
|
|
367
|
+
children: [/*#__PURE__*/_jsx(ButtonDropdown, {
|
|
389
368
|
ref: sourceRef,
|
|
390
369
|
...pressHandlers,
|
|
391
370
|
value: isOpen,
|
|
@@ -466,11 +445,6 @@ const styles = StyleSheet.create({
|
|
|
466
445
|
},
|
|
467
446
|
scrollContainer: {
|
|
468
447
|
padding: 1
|
|
469
|
-
},
|
|
470
|
-
appRootRef: {
|
|
471
|
-
position: 'absolute',
|
|
472
|
-
top: 0,
|
|
473
|
-
left: 0
|
|
474
448
|
}
|
|
475
449
|
});
|
|
476
450
|
|
|
@@ -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
|
});
|