@telus-uds/components-base 1.86.0 → 1.87.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 +20 -2
- package/lib/ActionCard/ActionCard.js +350 -0
- package/lib/ActionCard/index.js +10 -0
- package/lib/Card/Card.js +3 -3
- package/lib/Card/PressableCardBase.js +1 -1
- package/lib/Checkbox/Checkbox.js +4 -0
- package/lib/List/List.js +9 -2
- package/lib/Modal/WebModal.js +2 -1
- package/lib/Notification/Notification.js +20 -15
- package/lib/Radio/Radio.js +4 -0
- package/lib/Tabs/Tabs.js +4 -1
- package/lib/Tabs/TabsItem.js +7 -1
- package/lib/index.js +8 -0
- package/lib/utils/animation/useVerticalExpandAnimation.js +3 -3
- package/lib/utils/props/tokens.js +2 -2
- package/lib-module/ActionCard/ActionCard.js +343 -0
- package/lib-module/ActionCard/index.js +2 -0
- package/lib-module/Card/Card.js +4 -4
- package/lib-module/Card/PressableCardBase.js +1 -1
- package/lib-module/Checkbox/Checkbox.js +4 -0
- package/lib-module/List/List.js +9 -2
- package/lib-module/Modal/WebModal.js +2 -1
- package/lib-module/Notification/Notification.js +20 -15
- package/lib-module/Radio/Radio.js +4 -0
- package/lib-module/Tabs/Tabs.js +4 -1
- package/lib-module/Tabs/TabsItem.js +7 -1
- package/lib-module/index.js +1 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +3 -3
- package/lib-module/utils/props/tokens.js +2 -2
- package/package.json +2 -2
- package/src/ActionCard/ActionCard.jsx +306 -0
- package/src/ActionCard/index.js +3 -0
- package/src/Card/Card.jsx +6 -4
- package/src/Card/PressableCardBase.jsx +1 -1
- package/src/Checkbox/Checkbox.jsx +3 -1
- package/src/List/List.jsx +7 -2
- package/src/Modal/WebModal.jsx +2 -1
- package/src/Notification/Notification.jsx +36 -16
- package/src/Radio/Radio.jsx +3 -1
- package/src/Tabs/Tabs.jsx +4 -1
- package/src/Tabs/TabsItem.jsx +5 -1
- package/src/index.js +1 -0
- package/src/utils/animation/useVerticalExpandAnimation.js +3 -3
- package/src/utils/props/tokens.js +4 -2
|
@@ -58,8 +58,8 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
58
58
|
if (isAnimating || expandStateChanged) containerStyles.overflow = 'hidden';
|
|
59
59
|
if (!isExpanded && !isAnimating && !expandStateChanged) {
|
|
60
60
|
if (_Platform.default.OS === 'web') {
|
|
61
|
-
// Without `
|
|
62
|
-
containerStyles.
|
|
61
|
+
// Without `display: 'none', descendents are focusable on web even when collapsed.
|
|
62
|
+
containerStyles.display = 'none';
|
|
63
63
|
} else {
|
|
64
64
|
// There's no `visibility: hidden` in React Native, and display: none causes a flicker on expand.
|
|
65
65
|
// Without some form of hiding, some children leak through even when closed e.g. `List.Item` bullets.
|
|
@@ -73,7 +73,7 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
73
73
|
// on web we can hide the contents until we have the container measured and avoid occasional jitter
|
|
74
74
|
// this won't work on native platforms
|
|
75
75
|
containerStyles.height = 0;
|
|
76
|
-
containerStyles.
|
|
76
|
+
containerStyles.display = 'none';
|
|
77
77
|
}
|
|
78
78
|
} else if (_Platform.default.OS === 'web') {
|
|
79
79
|
const transitionDuration = isExpanded ? expandDuration : collapseDuration;
|
|
@@ -113,7 +113,7 @@ const getTokensPropType = function () {
|
|
|
113
113
|
* For example, for a set of tokens used in a common style, or for a set of tokens required by
|
|
114
114
|
* a themeless component whose tokens are set by a parent but requires tokens of a certain shape.
|
|
115
115
|
*
|
|
116
|
-
* By default, requires an object with a complete set of tokens (allowing `null
|
|
116
|
+
* By default, requires an object with a complete set of tokens (allowing `null` and `undefined`).
|
|
117
117
|
*
|
|
118
118
|
* @param {string[]} componentTokenKeys - array of strings of token names
|
|
119
119
|
* @param {object} [options]
|
|
@@ -133,7 +133,7 @@ const getTokensSetPropType = function (componentTokenKeys) {
|
|
|
133
133
|
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
134
134
|
args[_key2 - 2] = arguments[_key2];
|
|
135
135
|
}
|
|
136
|
-
return props[propName] !== null && tokenValueType.isRequired(props, propName, ...args);
|
|
136
|
+
return props[propName] !== null && props[propName] !== undefined && tokenValueType.isRequired(props, propName, ...args);
|
|
137
137
|
}])));
|
|
138
138
|
return allowFunction ? _propTypes.default.oneOfType([tokensObjectValidator, _propTypes.default.func]) : tokensObjectValidator;
|
|
139
139
|
};
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
|
+
import Text from "react-native-web/dist/exports/Text";
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
8
|
+
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps, wrapStringsInText, clickProps, hrefAttrsProp, linkProps } from '../utils';
|
|
9
|
+
import Icon from '../Icon';
|
|
10
|
+
import Card from '../Card';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
|
|
14
|
+
const selectCardStyles = styles => ['borderColor', 'borderRadius', 'borderWidth'].reduce((acc, key) => {
|
|
15
|
+
if (styles[key]) acc[key] = styles[key];
|
|
16
|
+
return acc;
|
|
17
|
+
}, {});
|
|
18
|
+
const selectInteractiveCardStyles = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
backgroundColor,
|
|
21
|
+
paddingBottom,
|
|
22
|
+
paddingLeft,
|
|
23
|
+
paddingRight,
|
|
24
|
+
paddingTop
|
|
25
|
+
} = _ref;
|
|
26
|
+
return {
|
|
27
|
+
...(backgroundColor && {
|
|
28
|
+
backgroundColor
|
|
29
|
+
}),
|
|
30
|
+
paddingBottom,
|
|
31
|
+
paddingLeft,
|
|
32
|
+
paddingRight,
|
|
33
|
+
paddingTop
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const selectIconStyles = _ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
iconMarginBottom,
|
|
39
|
+
iconMarginLeft,
|
|
40
|
+
iconMarginRight,
|
|
41
|
+
iconMarginTop
|
|
42
|
+
} = _ref2;
|
|
43
|
+
return {
|
|
44
|
+
marginBottom: iconMarginBottom,
|
|
45
|
+
marginLeft: iconMarginLeft,
|
|
46
|
+
marginRight: iconMarginRight,
|
|
47
|
+
marginTop: iconMarginTop
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const selectIconProps = _ref3 => {
|
|
51
|
+
let {
|
|
52
|
+
icon,
|
|
53
|
+
iconBackgroundColor,
|
|
54
|
+
iconColor
|
|
55
|
+
} = _ref3;
|
|
56
|
+
return {
|
|
57
|
+
icon,
|
|
58
|
+
variant: {
|
|
59
|
+
background: true,
|
|
60
|
+
padding: 'small'
|
|
61
|
+
},
|
|
62
|
+
tokens: {
|
|
63
|
+
backgroundColor: iconBackgroundColor,
|
|
64
|
+
color: iconColor
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const selectTitleStyles = _ref4 => {
|
|
69
|
+
let {
|
|
70
|
+
titleMarginBottom,
|
|
71
|
+
titleMarginLeft,
|
|
72
|
+
titleMarginRight,
|
|
73
|
+
titleMarginTop
|
|
74
|
+
} = _ref4;
|
|
75
|
+
return {
|
|
76
|
+
marginBottom: titleMarginBottom,
|
|
77
|
+
marginLeft: titleMarginLeft,
|
|
78
|
+
marginRight: titleMarginRight,
|
|
79
|
+
marginTop: titleMarginTop
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const selectTitleTextStyles = _ref5 => {
|
|
83
|
+
let {
|
|
84
|
+
titleFontColor,
|
|
85
|
+
titleFontName,
|
|
86
|
+
titleFontSize,
|
|
87
|
+
titleFontWeight,
|
|
88
|
+
titleLineHeight
|
|
89
|
+
} = _ref5;
|
|
90
|
+
return applyTextStyles({
|
|
91
|
+
fontColor: titleFontColor,
|
|
92
|
+
fontName: titleFontName,
|
|
93
|
+
fontSize: titleFontSize,
|
|
94
|
+
fontWeight: titleFontWeight,
|
|
95
|
+
lineHeight: titleLineHeight
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const selectContentStyles = _ref6 => {
|
|
99
|
+
let {
|
|
100
|
+
contentMarginBottom,
|
|
101
|
+
contentMarginLeft,
|
|
102
|
+
contentMarginRight,
|
|
103
|
+
contentMarginTop
|
|
104
|
+
} = _ref6;
|
|
105
|
+
return {
|
|
106
|
+
marginBottom: contentMarginBottom,
|
|
107
|
+
marginLeft: contentMarginLeft,
|
|
108
|
+
marginRight: contentMarginRight,
|
|
109
|
+
marginTop: contentMarginTop
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const selectContentTextStyles = _ref7 => {
|
|
113
|
+
let {
|
|
114
|
+
contentFontColor,
|
|
115
|
+
contentFontName,
|
|
116
|
+
contentFontSize,
|
|
117
|
+
contentFontWeight,
|
|
118
|
+
contentLineHeight
|
|
119
|
+
} = _ref7;
|
|
120
|
+
return applyTextStyles({
|
|
121
|
+
fontColor: contentFontColor,
|
|
122
|
+
fontName: contentFontName,
|
|
123
|
+
fontSize: contentFontSize,
|
|
124
|
+
fontWeight: contentFontWeight,
|
|
125
|
+
lineHeight: contentLineHeight
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const selectStatusIconProps = _ref8 => {
|
|
129
|
+
let {
|
|
130
|
+
statusIcon,
|
|
131
|
+
statusIconColor
|
|
132
|
+
} = _ref8;
|
|
133
|
+
return {
|
|
134
|
+
icon: statusIcon,
|
|
135
|
+
tokens: {
|
|
136
|
+
color: statusIconColor
|
|
137
|
+
},
|
|
138
|
+
variant: {
|
|
139
|
+
size: 'micro'
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const selectActionIconStyles = _ref9 => {
|
|
144
|
+
let {
|
|
145
|
+
actionIconMarginBottom,
|
|
146
|
+
actionIconMarginLeft,
|
|
147
|
+
actionIconMarginRight,
|
|
148
|
+
actionIconMarginTop
|
|
149
|
+
} = _ref9;
|
|
150
|
+
return {
|
|
151
|
+
marginBottom: actionIconMarginBottom,
|
|
152
|
+
marginLeft: actionIconMarginLeft,
|
|
153
|
+
marginRight: actionIconMarginRight,
|
|
154
|
+
marginTop: actionIconMarginTop
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
const selectActionIconProps = _ref10 => {
|
|
158
|
+
let {
|
|
159
|
+
actionIcon,
|
|
160
|
+
actionIconColor
|
|
161
|
+
} = _ref10;
|
|
162
|
+
return {
|
|
163
|
+
icon: actionIcon,
|
|
164
|
+
tokens: {
|
|
165
|
+
color: actionIconColor
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
const ACTION_ICON_ANIMATION_DURATION = 100;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* ActionCard component represents a card with an action that can be triggered by the user.
|
|
173
|
+
*
|
|
174
|
+
* @component
|
|
175
|
+
* @example
|
|
176
|
+
* return (
|
|
177
|
+
* <ActionCard
|
|
178
|
+
* icon={<Icon icon={Icons.EyeMasked} />}
|
|
179
|
+
* title="Like"
|
|
180
|
+
* href="/like"
|
|
181
|
+
* accessibilityRole="link"
|
|
182
|
+
* tokens={themeTokens}
|
|
183
|
+
* variant={{validation: 'warning'}}
|
|
184
|
+
* onPress={() => handleLike()}
|
|
185
|
+
* >
|
|
186
|
+
* Click here to like the post
|
|
187
|
+
* </ActionCard>
|
|
188
|
+
* )
|
|
189
|
+
*/
|
|
190
|
+
const ActionCard = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
|
|
191
|
+
let {
|
|
192
|
+
icon,
|
|
193
|
+
title,
|
|
194
|
+
children,
|
|
195
|
+
href,
|
|
196
|
+
direction = true,
|
|
197
|
+
accessibilityRole,
|
|
198
|
+
tokens,
|
|
199
|
+
variant,
|
|
200
|
+
...rest
|
|
201
|
+
} = _ref11;
|
|
202
|
+
const themeTokens = useThemeTokens('ActionCard', tokens, variant);
|
|
203
|
+
const actionIconAnimation = React.useRef(new Animated.Value(0)).current;
|
|
204
|
+
const {
|
|
205
|
+
onPress,
|
|
206
|
+
...props
|
|
207
|
+
} = clickProps.toPressProps(rest);
|
|
208
|
+
const {
|
|
209
|
+
hrefAttrs,
|
|
210
|
+
rawRest
|
|
211
|
+
} = hrefAttrsProp.bundle(props);
|
|
212
|
+
const selectedProps = selectProps({
|
|
213
|
+
accessibilityRole,
|
|
214
|
+
href,
|
|
215
|
+
onPress: linkProps.handleHref({
|
|
216
|
+
href,
|
|
217
|
+
onPress
|
|
218
|
+
}),
|
|
219
|
+
hrefAttrs,
|
|
220
|
+
...rawRest
|
|
221
|
+
});
|
|
222
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
223
|
+
ref: ref,
|
|
224
|
+
interactiveCard: {
|
|
225
|
+
body: pressableState => {
|
|
226
|
+
const animate = pressableState.pressed || pressableState.hover || pressableState.focus;
|
|
227
|
+
Animated.timing(actionIconAnimation, {
|
|
228
|
+
toValue: animate ? themeTokens.actionIconTranslate : 0,
|
|
229
|
+
duration: ACTION_ICON_ANIMATION_DURATION,
|
|
230
|
+
useNativeDriver: false
|
|
231
|
+
}).start();
|
|
232
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
233
|
+
style: staticStyles.container,
|
|
234
|
+
children: [icon && /*#__PURE__*/_jsx(View, {
|
|
235
|
+
style: selectIconStyles(themeTokens),
|
|
236
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
237
|
+
...selectIconProps({
|
|
238
|
+
icon,
|
|
239
|
+
...themeTokens
|
|
240
|
+
})
|
|
241
|
+
})
|
|
242
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
243
|
+
style: staticStyles.content,
|
|
244
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
245
|
+
style: staticStyles.header,
|
|
246
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
247
|
+
style: [selectTitleStyles(themeTokens), staticStyles.title],
|
|
248
|
+
children: /*#__PURE__*/_jsxs(Text, {
|
|
249
|
+
children: [wrapStringsInText(title, {
|
|
250
|
+
style: selectTitleTextStyles(themeTokens)
|
|
251
|
+
}), themeTokens.statusIcon && /*#__PURE__*/_jsx(View, {
|
|
252
|
+
style: staticStyles.statusIcon,
|
|
253
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
254
|
+
...selectStatusIconProps(themeTokens)
|
|
255
|
+
})
|
|
256
|
+
})]
|
|
257
|
+
})
|
|
258
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
259
|
+
style: staticStyles.icons,
|
|
260
|
+
children: direction && /*#__PURE__*/_jsx(Animated.View, {
|
|
261
|
+
style: [selectActionIconStyles(themeTokens), {
|
|
262
|
+
transform: [{
|
|
263
|
+
translateX: actionIconAnimation
|
|
264
|
+
}]
|
|
265
|
+
}],
|
|
266
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
267
|
+
...selectActionIconProps(themeTokens)
|
|
268
|
+
})
|
|
269
|
+
})
|
|
270
|
+
})]
|
|
271
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
272
|
+
style: [staticStyles.body, selectContentStyles(themeTokens)],
|
|
273
|
+
children: typeof children === 'string' ? wrapStringsInText(children, {
|
|
274
|
+
style: selectContentTextStyles(themeTokens)
|
|
275
|
+
}) : children
|
|
276
|
+
})]
|
|
277
|
+
})]
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
tokens: selectInteractiveCardStyles(themeTokens)
|
|
281
|
+
},
|
|
282
|
+
tokens: selectCardStyles(themeTokens),
|
|
283
|
+
...selectedProps
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
ActionCard.displayName = 'ActionCard';
|
|
287
|
+
ActionCard.propTypes = {
|
|
288
|
+
...selectedSystemPropTypes,
|
|
289
|
+
tokens: getTokensPropType('ActionCard'),
|
|
290
|
+
variant: variantProp.propType,
|
|
291
|
+
/**
|
|
292
|
+
* Icon for the ActionCard
|
|
293
|
+
*/
|
|
294
|
+
icon: PropTypes.elementType,
|
|
295
|
+
/**
|
|
296
|
+
* Title for the ActionCard
|
|
297
|
+
*/
|
|
298
|
+
title: PropTypes.string,
|
|
299
|
+
/**
|
|
300
|
+
* Children for the ActionCard
|
|
301
|
+
*/
|
|
302
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
303
|
+
/**
|
|
304
|
+
* href for the ActionCard
|
|
305
|
+
*/
|
|
306
|
+
href: PropTypes.string,
|
|
307
|
+
/**
|
|
308
|
+
* Enable or disable the direction of the ActionCard
|
|
309
|
+
*/
|
|
310
|
+
direction: PropTypes.bool,
|
|
311
|
+
/**
|
|
312
|
+
* AccesibilityRole for the ActionCard
|
|
313
|
+
*/
|
|
314
|
+
accessibilityRole: PropTypes.string
|
|
315
|
+
};
|
|
316
|
+
const staticStyles = StyleSheet.create({
|
|
317
|
+
body: {
|
|
318
|
+
flexDirection: 'column'
|
|
319
|
+
},
|
|
320
|
+
container: {
|
|
321
|
+
flex: 1,
|
|
322
|
+
flexDirection: 'row'
|
|
323
|
+
},
|
|
324
|
+
content: {
|
|
325
|
+
flex: 1,
|
|
326
|
+
flexDirection: 'column'
|
|
327
|
+
},
|
|
328
|
+
icons: {
|
|
329
|
+
flexDirection: 'row',
|
|
330
|
+
alignItems: 'center'
|
|
331
|
+
},
|
|
332
|
+
header: {
|
|
333
|
+
flexDirection: 'row',
|
|
334
|
+
justifyContent: 'space-between'
|
|
335
|
+
},
|
|
336
|
+
title: {
|
|
337
|
+
flexShrink: 1
|
|
338
|
+
},
|
|
339
|
+
statusIcon: {
|
|
340
|
+
marginLeft: 4
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
export default ActionCard;
|
package/lib-module/Card/Card.js
CHANGED
|
@@ -4,7 +4,7 @@ import View from "react-native-web/dist/exports/View";
|
|
|
4
4
|
import { useThemeTokens, useThemeTokensCallback, useResponsiveThemeTokens, useTheme } from '../ThemeProvider';
|
|
5
5
|
import { getTokensPropType, variantProp, StyleSheet, createMediaQueryStyles } from '../utils';
|
|
6
6
|
import { useViewport } from '../ViewportProvider';
|
|
7
|
-
import { a11yProps, selectSystemProps, viewProps } from '../utils/props';
|
|
7
|
+
import { a11yProps, linkProps, selectSystemProps, viewProps } from '../utils/props';
|
|
8
8
|
import CardBase from './CardBase';
|
|
9
9
|
import PressableCardBase from './PressableCardBase';
|
|
10
10
|
import CheckboxButton from '../Checkbox/CheckboxButton';
|
|
@@ -12,7 +12,7 @@ import RadioButton from '../Radio/RadioButton';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps, linkProps]);
|
|
16
16
|
const SelectionType = {
|
|
17
17
|
Checkbox: 'checkbox',
|
|
18
18
|
Radio: 'radiogroup',
|
|
@@ -267,7 +267,7 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
267
267
|
isChecked: selected || (cardState === null || cardState === void 0 ? void 0 : cardState.hover),
|
|
268
268
|
isInactive: inactive,
|
|
269
269
|
onPress
|
|
270
|
-
})), interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body]
|
|
270
|
+
})), typeof (interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body) === 'function' ? interactiveCard.body(cardState) : interactiveCard.body]
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
}), children && selectionType !== SelectionType.None ? renderNoSelectionView() : null]
|
|
@@ -309,7 +309,7 @@ Card.propTypes = {
|
|
|
309
309
|
* - variant: The variant to be used for the interactive card
|
|
310
310
|
*/
|
|
311
311
|
interactiveCard: PropTypes.shape({
|
|
312
|
-
body: PropTypes.node,
|
|
312
|
+
body: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
313
313
|
tokens: getTokensPropType('Card'),
|
|
314
314
|
selectionType: PropTypes.oneOf(Object.values(SelectionType)),
|
|
315
315
|
variant: variantProp.propType
|
|
@@ -104,7 +104,7 @@ PressableCardBase.propTypes = {
|
|
|
104
104
|
...selectedSystemPropTypes,
|
|
105
105
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
106
106
|
tokens: getTokensSetPropType(tokenKeys, {
|
|
107
|
-
|
|
107
|
+
partial: true,
|
|
108
108
|
allowFunction: true
|
|
109
109
|
}),
|
|
110
110
|
variant: variantProp.propType
|
|
@@ -204,6 +204,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
204
204
|
onKeyDown: handleKeyDown,
|
|
205
205
|
onPress: handleChange,
|
|
206
206
|
...selectedProps,
|
|
207
|
+
style: staticStyles.removeOutline,
|
|
207
208
|
children: _ref6 => {
|
|
208
209
|
let {
|
|
209
210
|
focused: focus,
|
|
@@ -335,5 +336,8 @@ const staticStyles = StyleSheet.create({
|
|
|
335
336
|
alignWithLabel: {
|
|
336
337
|
alignSelf: 'flex-start',
|
|
337
338
|
justifyContent: 'center'
|
|
339
|
+
},
|
|
340
|
+
removeOutline: {
|
|
341
|
+
outlineStyle: 'none'
|
|
338
342
|
}
|
|
339
343
|
});
|
package/lib-module/List/List.js
CHANGED
|
@@ -42,15 +42,22 @@ const List = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
42
42
|
}
|
|
43
43
|
return child;
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
ref: ref,
|
|
45
|
+
const content = /*#__PURE__*/_jsx(View, {
|
|
47
46
|
style: styles.list,
|
|
48
47
|
accessibilityRole: accessibilityRole,
|
|
48
|
+
ref: ref,
|
|
49
49
|
...selectProps(rest),
|
|
50
50
|
children: items
|
|
51
51
|
});
|
|
52
|
+
return Platform.OS === 'web' ? /*#__PURE__*/_jsx("div", {
|
|
53
|
+
style: styles.container,
|
|
54
|
+
children: content
|
|
55
|
+
}) : content;
|
|
52
56
|
});
|
|
53
57
|
const styles = StyleSheet.create({
|
|
58
|
+
container: {
|
|
59
|
+
display: 'block'
|
|
60
|
+
},
|
|
54
61
|
list: {
|
|
55
62
|
flex: 1,
|
|
56
63
|
flexShrink: 1
|
|
@@ -60,13 +60,17 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
60
60
|
} = _ref4;
|
|
61
61
|
return {
|
|
62
62
|
paddingLeft: dismissButtonGap,
|
|
63
|
-
placeContent: '
|
|
63
|
+
placeContent: 'start'
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
const selectContentContainerStyle = maxWidth => ({
|
|
67
|
-
maxWidth: maxWidth
|
|
66
|
+
const selectContentContainerStyle = (themeTokens, maxWidth, viewport, system) => ({
|
|
67
|
+
maxWidth: viewport === 'xl' && system === true ? maxWidth : 'auto',
|
|
68
|
+
minWidth: viewport === 'xl' && system === true ? maxWidth : 'auto',
|
|
69
|
+
paddingRight: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.containerPaddingRight,
|
|
70
|
+
paddingLeft: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.containerPaddingLeft
|
|
68
71
|
});
|
|
69
|
-
const getMediaQueryStyles = (themeTokens, themeOptions,
|
|
72
|
+
const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, system) => {
|
|
73
|
+
var _themeOptions$content, _themeOptions$content2, _themeOptions$content3, _themeOptions$content4, _themeOptions$content5;
|
|
70
74
|
const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
|
|
71
75
|
let [vp, viewportTokens] = _ref5;
|
|
72
76
|
acc[vp] = selectContainerStyles({
|
|
@@ -80,7 +84,7 @@ const getMediaQueryStyles = (themeTokens, themeOptions, viewport, mediaIdsRef, d
|
|
|
80
84
|
styles: containerStyles
|
|
81
85
|
} = StyleSheet.create({
|
|
82
86
|
container: {
|
|
83
|
-
flexDirection: 'row',
|
|
87
|
+
flexDirection: system === true && viewport === 'xl' ? 'row' : 'inherit',
|
|
84
88
|
...selectContainerMediaQueryStyles
|
|
85
89
|
}
|
|
86
90
|
});
|
|
@@ -94,19 +98,19 @@ const getMediaQueryStyles = (themeTokens, themeOptions, viewport, mediaIdsRef, d
|
|
|
94
98
|
justifyContent: 'space-between',
|
|
95
99
|
...createMediaQueryStyles({
|
|
96
100
|
xs: {
|
|
97
|
-
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.xs) || '100%'
|
|
101
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content = themeOptions.contentMaxWidth) === null || _themeOptions$content === void 0 ? void 0 : _themeOptions$content.xs) || '100%'
|
|
98
102
|
},
|
|
99
103
|
md: {
|
|
100
|
-
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.md) || '100%'
|
|
104
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content2 = themeOptions.contentMaxWidth) === null || _themeOptions$content2 === void 0 ? void 0 : _themeOptions$content2.md) || '100%'
|
|
101
105
|
},
|
|
102
106
|
lg: {
|
|
103
|
-
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.lg) || '100%'
|
|
107
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content3 = themeOptions.contentMaxWidth) === null || _themeOptions$content3 === void 0 ? void 0 : _themeOptions$content3.lg) || '100%'
|
|
104
108
|
},
|
|
105
109
|
sm: {
|
|
106
|
-
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.sm) || '100%'
|
|
110
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content4 = themeOptions.contentMaxWidth) === null || _themeOptions$content4 === void 0 ? void 0 : _themeOptions$content4.sm) || '100%'
|
|
107
111
|
},
|
|
108
112
|
xl: {
|
|
109
|
-
width: (themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth.xl) || '100%'
|
|
113
|
+
width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content5 = themeOptions.contentMaxWidth) === null || _themeOptions$content5 === void 0 ? void 0 : _themeOptions$content5.xl) || '100%'
|
|
110
114
|
}
|
|
111
115
|
})
|
|
112
116
|
}
|
|
@@ -169,19 +173,20 @@ const getMediaQueryStyles = (themeTokens, themeOptions, viewport, mediaIdsRef, d
|
|
|
169
173
|
selectDismissIconPropsStyles
|
|
170
174
|
};
|
|
171
175
|
};
|
|
172
|
-
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible) => ({
|
|
176
|
+
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, viewport, system) => ({
|
|
173
177
|
containerStyles: {
|
|
174
178
|
container: {
|
|
175
|
-
flexDirection: 'row',
|
|
179
|
+
flexDirection: system === true && viewport === 'xl' ? 'row' : 'inherit',
|
|
176
180
|
...selectContainerStyles(themeTokens)
|
|
177
181
|
}
|
|
178
182
|
},
|
|
179
183
|
contentContainerStyles: {
|
|
180
184
|
contentContainer: {
|
|
185
|
+
flex: 1,
|
|
181
186
|
flexDirection: 'row',
|
|
182
187
|
flexShrink: 1,
|
|
183
188
|
justifyContent: 'space-between',
|
|
184
|
-
...selectContentContainerStyle(maxWidth)
|
|
189
|
+
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system)
|
|
185
190
|
}
|
|
186
191
|
},
|
|
187
192
|
staticContentContainerStyles: {
|
|
@@ -317,9 +322,9 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
317
322
|
selectDismissIconPropsIds: {}
|
|
318
323
|
});
|
|
319
324
|
if (enableMediaQueryStyleSheet) {
|
|
320
|
-
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions,
|
|
325
|
+
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, system);
|
|
321
326
|
} else {
|
|
322
|
-
notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible);
|
|
327
|
+
notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible, viewport, system);
|
|
323
328
|
}
|
|
324
329
|
if (isDismissed) {
|
|
325
330
|
return null;
|
|
@@ -164,6 +164,7 @@ const Radio = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
164
164
|
onKeyDown: handleKeyDown,
|
|
165
165
|
onPress: handleChange,
|
|
166
166
|
...selectedProps,
|
|
167
|
+
style: staticStyles.removeOutline,
|
|
167
168
|
children: _ref5 => {
|
|
168
169
|
let {
|
|
169
170
|
focused: focus,
|
|
@@ -275,5 +276,8 @@ const staticStyles = StyleSheet.create({
|
|
|
275
276
|
alignWithLabel: {
|
|
276
277
|
alignSelf: 'flex-start',
|
|
277
278
|
justifyContent: 'center'
|
|
279
|
+
},
|
|
280
|
+
removeOutline: {
|
|
281
|
+
outlineStyle: 'none'
|
|
278
282
|
}
|
|
279
283
|
});
|
package/lib-module/Tabs/Tabs.js
CHANGED
|
@@ -106,6 +106,7 @@ const Tabs = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
106
106
|
ref: itemRef,
|
|
107
107
|
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
108
108
|
linkRouterProps: itemLinkRouterProps,
|
|
109
|
+
render,
|
|
109
110
|
...itemRest
|
|
110
111
|
} = _ref3;
|
|
111
112
|
const itemId = id ?? label;
|
|
@@ -131,6 +132,7 @@ const Tabs = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
131
132
|
...linkRouterProps,
|
|
132
133
|
...itemLinkRouterProps
|
|
133
134
|
},
|
|
135
|
+
render: render,
|
|
134
136
|
...itemProps,
|
|
135
137
|
children: label
|
|
136
138
|
}, itemId);
|
|
@@ -151,7 +153,8 @@ Tabs.propTypes = {
|
|
|
151
153
|
href: PropTypes.string,
|
|
152
154
|
label: PropTypes.string,
|
|
153
155
|
id: PropTypes.string,
|
|
154
|
-
ref: ABBPropTypes.ref()
|
|
156
|
+
ref: ABBPropTypes.ref(),
|
|
157
|
+
render: PropTypes.func
|
|
155
158
|
})),
|
|
156
159
|
/**
|
|
157
160
|
* `id` property of the current tab in the items array
|
|
@@ -95,6 +95,7 @@ const TabsItem = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
95
95
|
selected
|
|
96
96
|
} : undefined,
|
|
97
97
|
id,
|
|
98
|
+
render,
|
|
98
99
|
...rawRest
|
|
99
100
|
} = _ref4;
|
|
100
101
|
// Convert onClick etc to onPress etc if used in an integration
|
|
@@ -150,6 +151,10 @@ const TabsItem = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
150
151
|
}
|
|
151
152
|
// itemPositions is a ref object so this should only re-run when `selected` (or `index`) change
|
|
152
153
|
}, [selected, index, itemPositions]);
|
|
154
|
+
if (render) return render({
|
|
155
|
+
selected,
|
|
156
|
+
handlePress
|
|
157
|
+
});
|
|
153
158
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
154
159
|
ref: ref,
|
|
155
160
|
onPress: handlePress,
|
|
@@ -207,7 +212,8 @@ TabsItem.propTypes = {
|
|
|
207
212
|
selected: PropTypes.bool,
|
|
208
213
|
itemPositions: itemPositionsPropType,
|
|
209
214
|
children: PropTypes.string,
|
|
210
|
-
id: PropTypes.string
|
|
215
|
+
id: PropTypes.string,
|
|
216
|
+
render: PropTypes.func
|
|
211
217
|
};
|
|
212
218
|
const staticStyles = StyleSheet.create({
|
|
213
219
|
center: {
|
package/lib-module/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as A11yText } from './A11yText';
|
|
2
|
+
export { default as ActionCard } from './ActionCard';
|
|
2
3
|
export { default as ActivityIndicator } from './ActivityIndicator';
|
|
3
4
|
export { default as Autocomplete } from './Autocomplete';
|
|
4
5
|
export { default as Box } from './Box';
|
|
@@ -52,8 +52,8 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
52
52
|
if (isAnimating || expandStateChanged) containerStyles.overflow = 'hidden';
|
|
53
53
|
if (!isExpanded && !isAnimating && !expandStateChanged) {
|
|
54
54
|
if (Platform.OS === 'web') {
|
|
55
|
-
// Without `
|
|
56
|
-
containerStyles.
|
|
55
|
+
// Without `display: 'none', descendents are focusable on web even when collapsed.
|
|
56
|
+
containerStyles.display = 'none';
|
|
57
57
|
} else {
|
|
58
58
|
// There's no `visibility: hidden` in React Native, and display: none causes a flicker on expand.
|
|
59
59
|
// Without some form of hiding, some children leak through even when closed e.g. `List.Item` bullets.
|
|
@@ -67,7 +67,7 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
67
67
|
// on web we can hide the contents until we have the container measured and avoid occasional jitter
|
|
68
68
|
// this won't work on native platforms
|
|
69
69
|
containerStyles.height = 0;
|
|
70
|
-
containerStyles.
|
|
70
|
+
containerStyles.display = 'none';
|
|
71
71
|
}
|
|
72
72
|
} else if (Platform.OS === 'web') {
|
|
73
73
|
const transitionDuration = isExpanded ? expandDuration : collapseDuration;
|