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