@telus-uds/components-base 1.53.0 → 1.55.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 +32 -2
- package/component-docs.json +278 -74
- package/lib/Button/ButtonBase.js +17 -5
- package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -2
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +9 -8
- package/lib/Carousel/CarouselThumbnail.js +53 -26
- package/lib/Carousel/CarouselThumbnailNavigation.js +15 -6
- package/lib/ExpandCollapse/Panel.js +65 -8
- package/lib/IconButton/IconButton.js +41 -7
- package/lib/Modal/Modal.js +9 -3
- package/lib/SkipLink/SkipLink.js +19 -15
- package/lib/ThemeProvider/utils/styles.js +18 -2
- package/lib/TooltipButton/TooltipButton.js +7 -3
- package/lib/Typography/Typography.js +11 -2
- package/lib-module/Button/ButtonBase.js +17 -5
- package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +9 -8
- package/lib-module/Carousel/CarouselThumbnail.js +51 -27
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +13 -6
- package/lib-module/ExpandCollapse/Panel.js +64 -8
- package/lib-module/IconButton/IconButton.js +41 -7
- package/lib-module/Modal/Modal.js +8 -3
- package/lib-module/SkipLink/SkipLink.js +19 -15
- package/lib-module/ThemeProvider/utils/styles.js +19 -2
- package/lib-module/TooltipButton/TooltipButton.js +7 -3
- package/lib-module/Typography/Typography.js +10 -2
- package/package.json +3 -3
- package/src/Button/ButtonBase.jsx +11 -1
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +10 -2
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +5 -5
- package/src/Carousel/CarouselThumbnail.jsx +31 -25
- package/src/Carousel/CarouselThumbnailNavigation.jsx +8 -3
- package/src/ExpandCollapse/Panel.jsx +55 -8
- package/src/IconButton/IconButton.jsx +50 -6
- package/src/Modal/Modal.jsx +8 -3
- package/src/SkipLink/SkipLink.jsx +12 -12
- package/src/ThemeProvider/utils/styles.js +29 -2
- package/src/TooltipButton/TooltipButton.jsx +14 -2
- package/src/Typography/Typography.jsx +7 -2
|
@@ -75,7 +75,10 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
75
75
|
...rest
|
|
76
76
|
} = _ref2;
|
|
77
77
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
78
|
-
const
|
|
78
|
+
const {
|
|
79
|
+
superScriptFontSize,
|
|
80
|
+
...themeTokens
|
|
81
|
+
} = (0, _ThemeProvider.useThemeTokens)('Typography', tokens, variant, {
|
|
79
82
|
viewport
|
|
80
83
|
});
|
|
81
84
|
const {
|
|
@@ -98,8 +101,14 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
98
101
|
if (typeof child === 'object' && ((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
|
|
99
102
|
var _child$props;
|
|
100
103
|
|
|
104
|
+
const childStyles = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
|
|
105
|
+
const supFontSize = childStyles.fontSize ?? superScriptFontSize;
|
|
106
|
+
|
|
101
107
|
const sanitizedChild = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
102
|
-
style: { ...
|
|
108
|
+
style: { ...childStyles,
|
|
109
|
+
...(supFontSize ? {
|
|
110
|
+
fontSize: supFontSize
|
|
111
|
+
} : {}),
|
|
103
112
|
lineHeight: 0
|
|
104
113
|
}
|
|
105
114
|
});
|
|
@@ -208,19 +208,29 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref8) => {
|
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
const
|
|
211
|
+
const selectButtonStyles = _ref9 => {
|
|
212
|
+
let {
|
|
213
|
+
textAlign
|
|
214
|
+
} = _ref9;
|
|
215
|
+
return {
|
|
216
|
+
flexDirection: 'row',
|
|
217
|
+
justifyContent: textAlign
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const selectItemIconTokens = _ref10 => {
|
|
212
222
|
let {
|
|
213
223
|
color,
|
|
214
224
|
iconColor,
|
|
215
225
|
iconSize
|
|
216
|
-
} =
|
|
226
|
+
} = _ref10;
|
|
217
227
|
return {
|
|
218
228
|
size: iconSize,
|
|
219
229
|
color: iconColor || color
|
|
220
230
|
};
|
|
221
231
|
};
|
|
222
232
|
|
|
223
|
-
const ButtonBase = /*#__PURE__*/forwardRef((
|
|
233
|
+
const ButtonBase = /*#__PURE__*/forwardRef((_ref11, ref) => {
|
|
224
234
|
let {
|
|
225
235
|
id,
|
|
226
236
|
href,
|
|
@@ -235,7 +245,7 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
235
245
|
iconPosition = icon ? 'left' : undefined,
|
|
236
246
|
iconProps,
|
|
237
247
|
...rawRest
|
|
238
|
-
} =
|
|
248
|
+
} = _ref11;
|
|
239
249
|
const {
|
|
240
250
|
onPress,
|
|
241
251
|
...rest
|
|
@@ -282,6 +292,7 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
282
292
|
|
|
283
293
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align;
|
|
284
294
|
const IconComponent = icon || themeTokens.icon;
|
|
295
|
+
const rowStyles = selectButtonStyles(themeTokens);
|
|
285
296
|
return /*#__PURE__*/_jsx(View, {
|
|
286
297
|
id: id,
|
|
287
298
|
style: [containerStyles, borderStyles, stretchStyles, staticStyles.row, Platform.select({
|
|
@@ -289,7 +300,8 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
289
300
|
maxWidth: '100%',
|
|
290
301
|
// ensure overflowing content wraps
|
|
291
302
|
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
292
|
-
transition: 'background-color 200ms, border-color 200ms'
|
|
303
|
+
transition: 'background-color 200ms, border-color 200ms',
|
|
304
|
+
...rowStyles
|
|
293
305
|
}
|
|
294
306
|
})],
|
|
295
307
|
children: /*#__PURE__*/_jsx(IconText, {
|
|
@@ -13,7 +13,10 @@ const CarouselStepTracker = _ref => {
|
|
|
13
13
|
activeIndex,
|
|
14
14
|
totalItems,
|
|
15
15
|
getCopyWithPlaceholders,
|
|
16
|
-
themeTokens
|
|
16
|
+
themeTokens: {
|
|
17
|
+
stepTrackerCurrentBackgroundColor,
|
|
18
|
+
...themeTokens
|
|
19
|
+
}
|
|
17
20
|
} = useCarousel();
|
|
18
21
|
const stackViewTokens = {
|
|
19
22
|
justifyContent: 'center'
|
|
@@ -21,7 +24,8 @@ const CarouselStepTracker = _ref => {
|
|
|
21
24
|
const stepTrackerTokens = {
|
|
22
25
|
showStepLabel: false,
|
|
23
26
|
showStepTrackerLabel: true,
|
|
24
|
-
|
|
27
|
+
// TODO: StepTracker 'isComplete'/'isCurrent' is incorrect, see line StepTracker/Step.jsx line 63, refactor incorrect values and remove this
|
|
28
|
+
knobCompletedBackgroundColor: stepTrackerCurrentBackgroundColor ?? 'none',
|
|
25
29
|
connectorCompletedColor: 'none',
|
|
26
30
|
connectorColor: 'none',
|
|
27
31
|
containerPaddingTop: themeTokens.spaceBetweenSlideAndPanelNavigation
|
|
@@ -21,19 +21,20 @@ const CarouselTabsPanel = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
21
21
|
} = useCarousel();
|
|
22
22
|
const nextFocusRef = useRef();
|
|
23
23
|
const firstTabRef = useRef();
|
|
24
|
-
const [isInverse, setIsInverse] = useState(false);
|
|
25
|
-
// For now, this picks an Allium variant, and does nothing in brands that lack it.
|
|
26
|
-
// See similar comment in Carousel and https://github.com/telus/universal-design-system/issues/1549
|
|
27
|
-
|
|
28
|
-
const dividerVariant = {
|
|
29
|
-
decorative: true
|
|
30
|
-
};
|
|
24
|
+
const [isInverse, setIsInverse] = useState(false);
|
|
31
25
|
const lastTabSelected = activeIndex === items.length - 1; // Get current select tab style
|
|
32
26
|
|
|
33
27
|
useEffect(() => {
|
|
34
28
|
const [selectedVariantIsInverse] = items.filter((_, index) => index === activeIndex);
|
|
35
29
|
setIsInverse(selectedVariantIsInverse === null || selectedVariantIsInverse === void 0 ? void 0 : selectedVariantIsInverse.inverse);
|
|
36
|
-
}, [items, activeIndex]);
|
|
30
|
+
}, [items, activeIndex]); // TODO: figure out a better cross-brand way to specify subcomponent variants.
|
|
31
|
+
// For now, this picks an Allium variant, and does nothing in brands that lack it.
|
|
32
|
+
// See similar comment in Carousel and https://github.com/telus/universal-design-system/issues/1549
|
|
33
|
+
|
|
34
|
+
const dividerVariant = {
|
|
35
|
+
decorative: true,
|
|
36
|
+
inverse: isInverse
|
|
37
|
+
};
|
|
37
38
|
return /*#__PURE__*/_jsxs(View, {
|
|
38
39
|
style: selectTabPanelStyle(),
|
|
39
40
|
children: [/*#__PURE__*/_jsx(StackView, {
|
|
@@ -3,28 +3,48 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import Pressable from "react-native-web/dist/exports/Pressable";
|
|
4
4
|
import Image from "react-native-web/dist/exports/Image";
|
|
5
5
|
import { useCarousel } from './CarouselContext';
|
|
6
|
+
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
7
|
+
import { useViewport } from '../ViewportProvider';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
const selectPressableTokens = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
borderColor,
|
|
13
|
+
borderRadius,
|
|
14
|
+
borderWidth,
|
|
15
|
+
margin,
|
|
16
|
+
padding
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
borderColor,
|
|
20
|
+
borderRadius,
|
|
21
|
+
borderWidth,
|
|
22
|
+
margin,
|
|
23
|
+
padding
|
|
24
|
+
};
|
|
25
|
+
};
|
|
6
26
|
/**
|
|
7
27
|
* `Carousel.Thumbnail` is used to wrap the content of an individual slide and is suppsoed to be the
|
|
8
28
|
* only top-level component passed to the `Carousel`
|
|
9
29
|
*/
|
|
10
30
|
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
31
|
|
|
13
|
-
const CarouselThumbnail =
|
|
32
|
+
const CarouselThumbnail = _ref2 => {
|
|
14
33
|
let {
|
|
15
34
|
accessibilityLabel,
|
|
16
35
|
alt,
|
|
17
36
|
index,
|
|
18
37
|
src
|
|
19
|
-
} =
|
|
38
|
+
} = _ref2;
|
|
20
39
|
const {
|
|
21
40
|
activeIndex,
|
|
22
41
|
itemLabel,
|
|
23
42
|
totalItems,
|
|
24
43
|
getCopyWithPlaceholders,
|
|
25
|
-
goTo
|
|
26
|
-
themeTokens
|
|
44
|
+
goTo
|
|
27
45
|
} = useCarousel();
|
|
46
|
+
const getThumbnailTokens = useThemeTokensCallback('CarouselThumbnail');
|
|
47
|
+
const viewport = useViewport();
|
|
28
48
|
const thumbnailTitle = alt ?? getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
|
|
29
49
|
|
|
30
50
|
const handlePress = () => goTo(index);
|
|
@@ -35,37 +55,41 @@ const CarouselThumbnail = _ref => {
|
|
|
35
55
|
};
|
|
36
56
|
|
|
37
57
|
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = themeTokens;
|
|
58
|
+
borderWidth,
|
|
59
|
+
padding,
|
|
60
|
+
selectedBorderColor,
|
|
61
|
+
selectedBorderWidth,
|
|
62
|
+
size
|
|
63
|
+
} = getThumbnailTokens({
|
|
64
|
+
viewport
|
|
65
|
+
});
|
|
47
66
|
const styles = {
|
|
48
|
-
pressable: {
|
|
49
|
-
borderColor: thumbnailBorderColor,
|
|
50
|
-
borderRadius: thumbnailBorderRadius,
|
|
51
|
-
borderWidth: thumbnailBorderWidth,
|
|
52
|
-
margin: thumbnailMargin,
|
|
53
|
-
padding: thumbnailPadding
|
|
54
|
-
},
|
|
55
67
|
image: {
|
|
56
|
-
height:
|
|
57
|
-
width:
|
|
68
|
+
height: size,
|
|
69
|
+
width: size
|
|
58
70
|
},
|
|
59
71
|
selected: {
|
|
60
|
-
borderColor:
|
|
61
|
-
borderWidth:
|
|
62
|
-
padding:
|
|
72
|
+
borderColor: selectedBorderColor,
|
|
73
|
+
borderWidth: selectedBorderWidth,
|
|
74
|
+
padding: padding - selectedBorderWidth + borderWidth
|
|
63
75
|
}
|
|
64
76
|
};
|
|
65
77
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
66
78
|
onKeyDown: handleKeyDown,
|
|
67
79
|
onPress: handlePress,
|
|
68
|
-
style:
|
|
80
|
+
style: _ref3 => {
|
|
81
|
+
let {
|
|
82
|
+
hovered,
|
|
83
|
+
pressed,
|
|
84
|
+
focused
|
|
85
|
+
} = _ref3;
|
|
86
|
+
const pressableStyles = selectPressableTokens(getThumbnailTokens({
|
|
87
|
+
hover: hovered,
|
|
88
|
+
pressed,
|
|
89
|
+
focus: focused
|
|
90
|
+
}));
|
|
91
|
+
return [pressableStyles, index === activeIndex && styles.selected];
|
|
92
|
+
},
|
|
69
93
|
children: /*#__PURE__*/_jsx(Image, {
|
|
70
94
|
accessibilityIgnoresInvertColors: true,
|
|
71
95
|
accessibilityLabel: accessibilityLabel ?? alt,
|
|
@@ -4,14 +4,21 @@ import View from "react-native-web/dist/exports/View";
|
|
|
4
4
|
import { useCarousel } from './CarouselContext';
|
|
5
5
|
import CarouselThumbnail from './CarouselThumbnail';
|
|
6
6
|
import { StackWrap } from '../StackView';
|
|
7
|
+
import { useThemeTokens } from '../ThemeProvider';
|
|
8
|
+
import { useViewport } from '../ViewportProvider';
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
10
|
const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9
11
|
let {
|
|
10
12
|
thumbnails = []
|
|
11
13
|
} = _ref;
|
|
14
|
+
const viewport = useViewport();
|
|
12
15
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
alignItems
|
|
17
|
+
} = useThemeTokens('CarouselThumbnail', {}, {
|
|
18
|
+
viewport
|
|
19
|
+
});
|
|
20
|
+
const {
|
|
21
|
+
totalItems
|
|
15
22
|
} = useCarousel();
|
|
16
23
|
|
|
17
24
|
if (thumbnails.length !== totalItems) {
|
|
@@ -19,15 +26,15 @@ const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
const {
|
|
22
|
-
thumbnailContainerPaddingTop,
|
|
23
|
-
thumbnailMargin
|
|
24
|
-
} =
|
|
29
|
+
containerPaddingTop: thumbnailContainerPaddingTop,
|
|
30
|
+
margin: thumbnailMargin
|
|
31
|
+
} = useThemeTokens('CarouselThumbnail');
|
|
25
32
|
const stackWrapTokens = {
|
|
26
33
|
justifyContent: 'flex-start'
|
|
27
34
|
};
|
|
28
35
|
const containerStyles = {
|
|
29
36
|
justifyContent: 'center',
|
|
30
|
-
alignItems
|
|
37
|
+
alignItems,
|
|
31
38
|
paddingTop: thumbnailContainerPaddingTop - thumbnailMargin
|
|
32
39
|
};
|
|
33
40
|
return /*#__PURE__*/_jsx(View, {
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef, useState } from 'react';
|
|
|
2
2
|
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
3
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import Text from "react-native-web/dist/exports/Text";
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import ABBPropTypes from 'airbnb-prop-types';
|
|
7
8
|
import ExpandCollapseControl from './Control';
|
|
@@ -22,7 +23,50 @@ const selectContainerStyles = _ref => {
|
|
|
22
23
|
paddingLeft: contentPaddingLeft,
|
|
23
24
|
paddingRight: contentPaddingRight,
|
|
24
25
|
paddingTop: contentPaddingTop,
|
|
25
|
-
paddingBottom: contentPaddingBottom
|
|
26
|
+
paddingBottom: contentPaddingBottom,
|
|
27
|
+
flex: 1
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const selectTextStyles = _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
contentPanelFontSize,
|
|
34
|
+
contentPanelFontName,
|
|
35
|
+
contentPanelFontColor,
|
|
36
|
+
contentPanelFontWeight,
|
|
37
|
+
contentPanelLineHeight
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return {
|
|
40
|
+
fontSize: contentPanelFontSize,
|
|
41
|
+
fontFamily: `${contentPanelFontName}${contentPanelFontWeight}normal`,
|
|
42
|
+
lineHeight: contentPanelFontSize * contentPanelLineHeight,
|
|
43
|
+
color: contentPanelFontColor
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const selectContentPanelStyles = _ref3 => {
|
|
48
|
+
let {
|
|
49
|
+
contentPanelBackgroundColor,
|
|
50
|
+
contentPanelPaddingTop,
|
|
51
|
+
contentPanelPaddingBottom,
|
|
52
|
+
contentPanelPaddingLeft,
|
|
53
|
+
contentPanelPaddingRight,
|
|
54
|
+
contentPanelBorderWidth,
|
|
55
|
+
contentPanelBorderColor,
|
|
56
|
+
borderRadius,
|
|
57
|
+
marginBottom
|
|
58
|
+
} = _ref3;
|
|
59
|
+
return {
|
|
60
|
+
backgroundColor: contentPanelBackgroundColor,
|
|
61
|
+
paddingTop: contentPanelPaddingTop,
|
|
62
|
+
paddingBottom: contentPanelPaddingBottom,
|
|
63
|
+
paddingLeft: contentPanelPaddingLeft,
|
|
64
|
+
paddingRight: contentPanelPaddingRight,
|
|
65
|
+
borderWidth: contentPanelBorderWidth,
|
|
66
|
+
borderColor: contentPanelBorderColor,
|
|
67
|
+
borderStyle: 'solid',
|
|
68
|
+
borderRadius,
|
|
69
|
+
marginBottom
|
|
26
70
|
};
|
|
27
71
|
};
|
|
28
72
|
/**
|
|
@@ -37,7 +81,7 @@ const selectContainerStyles = _ref => {
|
|
|
37
81
|
*/
|
|
38
82
|
|
|
39
83
|
|
|
40
|
-
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((
|
|
84
|
+
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
41
85
|
let {
|
|
42
86
|
openIds = [],
|
|
43
87
|
panelId,
|
|
@@ -49,8 +93,9 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
49
93
|
tokens,
|
|
50
94
|
variant,
|
|
51
95
|
controlRef,
|
|
96
|
+
content,
|
|
52
97
|
...rest
|
|
53
|
-
} =
|
|
98
|
+
} = _ref4;
|
|
54
99
|
const [containerHeight, setContainerHeight] = useState(null);
|
|
55
100
|
const isExpanded = openIds.includes(panelId);
|
|
56
101
|
const selectedProps = selectProps({ ...rest,
|
|
@@ -85,7 +130,13 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
85
130
|
tokens: themeTokens
|
|
86
131
|
});
|
|
87
132
|
const focusabilityProps = isExpanded ? {} : a11yProps.nonFocusableProps;
|
|
88
|
-
return /*#__PURE__*/
|
|
133
|
+
return content ? /*#__PURE__*/_jsx(View, {
|
|
134
|
+
style: selectContentPanelStyles(themeTokens),
|
|
135
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
136
|
+
style: selectTextStyles(themeTokens),
|
|
137
|
+
children: children
|
|
138
|
+
}) : children
|
|
139
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
89
140
|
ref: ref,
|
|
90
141
|
style: themeTokens,
|
|
91
142
|
children: [/*#__PURE__*/_jsx(ExpandCollapseControl, { ...selectedProps,
|
|
@@ -135,7 +186,7 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
135
186
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
136
187
|
* If Panel is a direct child of `ExpandCollapse`, this prop will be provided by the ExpandCollapse parent.
|
|
137
188
|
*/
|
|
138
|
-
onToggle: PropTypes.func
|
|
189
|
+
onToggle: PropTypes.func,
|
|
139
190
|
|
|
140
191
|
/**
|
|
141
192
|
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel.
|
|
@@ -149,9 +200,9 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
149
200
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
150
201
|
|
|
151
202
|
/**
|
|
152
|
-
* The content inside the
|
|
203
|
+
* The content inside the control element that opens and closes the ExpandCollapse when pressed.
|
|
153
204
|
*/
|
|
154
|
-
control: ExpandCollapseControl.propTypes.children
|
|
205
|
+
control: ExpandCollapseControl.propTypes.children,
|
|
155
206
|
|
|
156
207
|
/**
|
|
157
208
|
* Optional theme token overrides that may be passed to the ExpandCollapseControl element.
|
|
@@ -161,6 +212,11 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
161
212
|
/**
|
|
162
213
|
* An optional ref to be attached to the control
|
|
163
214
|
*/
|
|
164
|
-
controlRef: ABBPropTypes.ref()
|
|
215
|
+
controlRef: ABBPropTypes.ref(),
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* A boolean prop to determine if the panel is a content panel or not. If true, the panel will not have a control
|
|
219
|
+
*/
|
|
220
|
+
content: PropTypes.bool
|
|
165
221
|
};
|
|
166
222
|
export default ExpandCollapsePanel;
|
|
@@ -13,10 +13,14 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
13
13
|
const selectOuterStyle = _ref => {
|
|
14
14
|
let {
|
|
15
15
|
backgroundColor,
|
|
16
|
-
borderRadius,
|
|
17
16
|
outerBorderWidth,
|
|
18
17
|
outerBorderColor,
|
|
19
18
|
outerBorderGap,
|
|
19
|
+
borderRadius,
|
|
20
|
+
borderTopLeftRadius,
|
|
21
|
+
borderTopRightRadius,
|
|
22
|
+
borderBottomLeftRadius,
|
|
23
|
+
borderBottomRightRadius,
|
|
20
24
|
shadow
|
|
21
25
|
} = _ref;
|
|
22
26
|
return [{
|
|
@@ -24,6 +28,10 @@ const selectOuterStyle = _ref => {
|
|
|
24
28
|
...applyShadowToken(shadow),
|
|
25
29
|
...applyOuterBorder({
|
|
26
30
|
borderRadius,
|
|
31
|
+
borderTopLeftRadius,
|
|
32
|
+
borderTopRightRadius,
|
|
33
|
+
borderBottomLeftRadius,
|
|
34
|
+
borderBottomRightRadius,
|
|
27
35
|
outerBorderWidth,
|
|
28
36
|
outerBorderColor,
|
|
29
37
|
outerBorderGap
|
|
@@ -37,20 +45,46 @@ const selectOuterStyle = _ref => {
|
|
|
37
45
|
}, staticStyles.outer];
|
|
38
46
|
};
|
|
39
47
|
|
|
48
|
+
const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth); // Stable size as border changes
|
|
49
|
+
|
|
50
|
+
|
|
40
51
|
const selectInnerStyle = _ref2 => {
|
|
41
52
|
let {
|
|
42
53
|
borderColor,
|
|
43
|
-
borderWidth
|
|
54
|
+
borderWidth,
|
|
55
|
+
borderTopLeftRadius,
|
|
56
|
+
borderTopRightRadius,
|
|
57
|
+
borderBottomLeftRadius,
|
|
58
|
+
borderBottomRightRadius,
|
|
44
59
|
borderRadius,
|
|
45
|
-
padding = 0
|
|
60
|
+
padding = 0,
|
|
61
|
+
borderTopWidth,
|
|
62
|
+
borderRightWidth,
|
|
63
|
+
borderBottomWidth,
|
|
64
|
+
borderLeftWidth,
|
|
65
|
+
paddingLeft,
|
|
66
|
+
paddingRight,
|
|
67
|
+
paddingTop,
|
|
68
|
+
paddingBottom
|
|
46
69
|
} = _ref2;
|
|
47
70
|
return {
|
|
48
71
|
// Inner borders animate with the icon and should be treated like a themable feature of the icon
|
|
49
72
|
borderColor,
|
|
50
73
|
borderRadius,
|
|
51
74
|
borderWidth,
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
borderTopLeftRadius,
|
|
76
|
+
borderTopRightRadius,
|
|
77
|
+
borderBottomLeftRadius,
|
|
78
|
+
borderBottomRightRadius,
|
|
79
|
+
borderTopWidth,
|
|
80
|
+
borderRightWidth,
|
|
81
|
+
borderBottomWidth,
|
|
82
|
+
borderLeftWidth,
|
|
83
|
+
padding: calculatePadding(padding, borderWidth),
|
|
84
|
+
paddingLeft: calculatePadding(paddingLeft, borderLeftWidth),
|
|
85
|
+
paddingRight: calculatePadding(paddingRight, borderRightWidth),
|
|
86
|
+
paddingTop: calculatePadding(paddingTop, borderTopWidth),
|
|
87
|
+
paddingBottom: calculatePadding(paddingBottom, borderBottomWidth)
|
|
54
88
|
};
|
|
55
89
|
};
|
|
56
90
|
/**
|
|
@@ -107,7 +141,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
107
141
|
return /*#__PURE__*/_jsx(View, {
|
|
108
142
|
style: selectInnerStyle(themeTokens),
|
|
109
143
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
110
|
-
icon: IconComponent,
|
|
144
|
+
icon: IconComponent || themeTokens.icon,
|
|
111
145
|
title: selectedProps.accessibilityLabel,
|
|
112
146
|
tokens: selectTokens('Icon', themeTokens, 'icon'),
|
|
113
147
|
variant: variant
|
|
@@ -124,7 +158,7 @@ IconButton.propTypes = { ...selectedSystemPropTypes,
|
|
|
124
158
|
/**
|
|
125
159
|
* Defines the icon to be rendered
|
|
126
160
|
*/
|
|
127
|
-
icon: PropTypes.elementType
|
|
161
|
+
icon: PropTypes.elementType,
|
|
128
162
|
|
|
129
163
|
/**
|
|
130
164
|
* URL to navigate to when the `Iconbutton` is pressed
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
3
|
import TouchableWithoutFeedback from "react-native-web/dist/exports/TouchableWithoutFeedback";
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import ScrollView from "react-native-web/dist/exports/ScrollView";
|
|
5
6
|
import NativeModal from "react-native-web/dist/exports/Modal";
|
|
6
7
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
@@ -140,8 +141,8 @@ const Modal = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
140
141
|
return /*#__PURE__*/_jsx(NativeModal, {
|
|
141
142
|
transparent: true,
|
|
142
143
|
...selectProps(rest),
|
|
143
|
-
children: /*#__PURE__*/_jsxs(
|
|
144
|
-
|
|
144
|
+
children: /*#__PURE__*/_jsxs(ScrollView, {
|
|
145
|
+
contentContainerStyle: [staticStyles.positioningContainer],
|
|
145
146
|
ref: modalRef,
|
|
146
147
|
children: [/*#__PURE__*/_jsx(View, {
|
|
147
148
|
style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
|
|
@@ -230,7 +231,11 @@ const staticStyles = StyleSheet.create({
|
|
|
230
231
|
modal: {
|
|
231
232
|
maxHeight: '100%',
|
|
232
233
|
// so that the modal can expand vertically up to the sizing container's height (exclusive of its vertical padding)
|
|
233
|
-
|
|
234
|
+
...Platform.select({
|
|
235
|
+
web: {
|
|
236
|
+
overflow: 'auto'
|
|
237
|
+
}
|
|
238
|
+
})
|
|
234
239
|
},
|
|
235
240
|
closeButtonContainer: {
|
|
236
241
|
position: 'absolute',
|
|
@@ -34,10 +34,19 @@ const selectStyles = _ref => {
|
|
|
34
34
|
|
|
35
35
|
const selectTextStyles = _ref2 => {
|
|
36
36
|
let {
|
|
37
|
-
color
|
|
37
|
+
color,
|
|
38
|
+
textLine,
|
|
39
|
+
fontName,
|
|
40
|
+
fontSize,
|
|
41
|
+
fontWeight,
|
|
42
|
+
lineHeight
|
|
38
43
|
} = _ref2;
|
|
39
44
|
return {
|
|
40
|
-
color
|
|
45
|
+
color,
|
|
46
|
+
textDecorationLine: textLine,
|
|
47
|
+
fontFamily: `${fontName}${fontWeight}normal`,
|
|
48
|
+
lineHeight: fontSize * lineHeight,
|
|
49
|
+
fontSize
|
|
41
50
|
};
|
|
42
51
|
};
|
|
43
52
|
/**
|
|
@@ -110,9 +119,6 @@ const SkipLink = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
110
119
|
...rest
|
|
111
120
|
} = clickProps.toPressProps(rawRest);
|
|
112
121
|
const getTokens = useThemeTokensCallback('SkipLink', tokens, variant);
|
|
113
|
-
const defaultTokens = getTokens();
|
|
114
|
-
|
|
115
|
-
const resolveLinkTokens = pressState => resolvePressableTokens(defaultTokens, pressState);
|
|
116
122
|
|
|
117
123
|
const handlePress = event => {
|
|
118
124
|
if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
|
|
@@ -123,19 +129,17 @@ const SkipLink = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
123
129
|
accessibilityRole: "link",
|
|
124
130
|
onPress: handlePress,
|
|
125
131
|
href: href,
|
|
126
|
-
style:
|
|
127
|
-
|
|
128
|
-
focused: focus
|
|
129
|
-
} = _ref4;
|
|
130
|
-
const themeTokens = getTokens({
|
|
131
|
-
focus
|
|
132
|
-
});
|
|
132
|
+
style: pressableState => {
|
|
133
|
+
const themeTokens = resolvePressableTokens(getTokens, pressableState);
|
|
133
134
|
const skipLinkStyle = selectStyles(themeTokens);
|
|
134
|
-
|
|
135
|
+
const {
|
|
136
|
+
focused
|
|
137
|
+
} = pressableState;
|
|
138
|
+
return [staticStyles.absolute, skipLinkStyle, !focused && staticStyles.hidden];
|
|
135
139
|
},
|
|
136
140
|
...selectProps(rest),
|
|
137
|
-
children:
|
|
138
|
-
const themeTokens =
|
|
141
|
+
children: pressableState => {
|
|
142
|
+
const themeTokens = resolvePressableTokens(getTokens, pressableState);
|
|
139
143
|
const textStyles = selectTextStyles(themeTokens);
|
|
140
144
|
return /*#__PURE__*/_jsx(Text, {
|
|
141
145
|
style: [textStyles, staticStyles.baseline],
|
|
@@ -171,22 +171,39 @@ export function verticalAlignRow(verticalAlign) {
|
|
|
171
171
|
alignItems: verticalAlignToFlexRowAlign[verticalAlign]
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
const calculateBorderRadius = (borderRadius, outerBorderGap, outerBorderWidth) => {
|
|
176
|
+
if (borderRadius) {
|
|
177
|
+
return borderRadius + outerBorderGap + outerBorderWidth;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return null;
|
|
181
|
+
};
|
|
174
182
|
/**
|
|
175
183
|
* Use on an outer container to create an outer border with an optional gap around it
|
|
176
184
|
* that matches the border radius of any inner border.
|
|
177
185
|
*/
|
|
178
186
|
|
|
187
|
+
|
|
179
188
|
export const applyOuterBorder = _ref4 => {
|
|
180
189
|
let {
|
|
181
190
|
outerBorderColor,
|
|
182
191
|
outerBorderWidth = 0,
|
|
183
192
|
outerBorderGap = 0,
|
|
184
|
-
borderRadius
|
|
193
|
+
borderRadius,
|
|
194
|
+
borderTopLeftRadius,
|
|
195
|
+
borderTopRightRadius,
|
|
196
|
+
borderBottomLeftRadius,
|
|
197
|
+
borderBottomRightRadius
|
|
185
198
|
} = _ref4;
|
|
186
199
|
return {
|
|
187
200
|
margin: 0 - outerBorderWidth - outerBorderGap,
|
|
188
201
|
padding: outerBorderGap,
|
|
189
|
-
borderRadius: borderRadius
|
|
202
|
+
borderRadius: calculateBorderRadius(borderRadius, outerBorderGap, outerBorderWidth),
|
|
203
|
+
borderTopLeftRadius: calculateBorderRadius(borderTopLeftRadius, outerBorderGap, outerBorderWidth),
|
|
204
|
+
borderTopRightRadius: calculateBorderRadius(borderTopRightRadius, outerBorderGap, outerBorderWidth),
|
|
205
|
+
borderBottomLeftRadius: calculateBorderRadius(borderBottomLeftRadius, outerBorderGap, outerBorderWidth),
|
|
206
|
+
borderBottomRightRadius: calculateBorderRadius(borderBottomRightRadius, outerBorderGap, outerBorderWidth),
|
|
190
207
|
borderWidth: outerBorderWidth,
|
|
191
208
|
borderColor: outerBorderColor
|
|
192
209
|
};
|
|
@@ -10,11 +10,13 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
10
10
|
const selectInnerContainerStyles = _ref => {
|
|
11
11
|
let {
|
|
12
12
|
borderRadius,
|
|
13
|
-
width
|
|
13
|
+
width,
|
|
14
|
+
backgroundColor
|
|
14
15
|
} = _ref;
|
|
15
16
|
return {
|
|
16
17
|
borderRadius,
|
|
17
|
-
width
|
|
18
|
+
width,
|
|
19
|
+
backgroundColor
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
|
|
@@ -49,7 +51,9 @@ const TooltipButton = _ref3 => {
|
|
|
49
51
|
icon: IconComponent
|
|
50
52
|
} = themeTokens;
|
|
51
53
|
return /*#__PURE__*/_jsx(View, {
|
|
52
|
-
style: applyOuterBorder(themeTokens),
|
|
54
|
+
style: [applyOuterBorder(themeTokens), themeTokens.outerBorderWidth && {
|
|
55
|
+
margin: -themeTokens.outerBorderWidth
|
|
56
|
+
}],
|
|
53
57
|
...selectProps(rest),
|
|
54
58
|
children: /*#__PURE__*/_jsx(View, {
|
|
55
59
|
style: selectInnerContainerStyles(themeTokens),
|