@telus-uds/components-base 1.61.0 → 1.62.1
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 +19 -2
- package/component-docs.json +68 -46
- package/lib/Icon/Icon.js +15 -2
- package/lib/IconButton/IconButton.js +28 -9
- package/lib/Link/LinkBase.js +9 -2
- package/lib/SideNav/Item.js +7 -15
- package/lib/TextInput/TextInputBase.js +6 -1
- package/lib/Tooltip/Tooltip.js +7 -1
- package/lib/Tooltip/Tooltip.native.js +7 -1
- package/lib/Tooltip/shared.js +10 -0
- package/lib/TooltipButton/TooltipButton.js +14 -1
- package/lib-module/Icon/Icon.js +15 -2
- package/lib-module/IconButton/IconButton.js +30 -10
- package/lib-module/Link/LinkBase.js +9 -2
- package/lib-module/SideNav/Item.js +7 -15
- package/lib-module/TextInput/TextInputBase.js +6 -1
- package/lib-module/Tooltip/Tooltip.js +7 -1
- package/lib-module/Tooltip/Tooltip.native.js +7 -1
- package/lib-module/Tooltip/shared.js +10 -0
- package/lib-module/TooltipButton/TooltipButton.js +11 -1
- package/package.json +1 -1
- package/src/Icon/Icon.jsx +22 -3
- package/src/IconButton/IconButton.jsx +62 -35
- package/src/Link/LinkBase.jsx +20 -2
- package/src/SideNav/Item.jsx +7 -13
- package/src/TextInput/TextInputBase.jsx +2 -1
- package/src/Tooltip/Tooltip.jsx +17 -2
- package/src/Tooltip/Tooltip.native.jsx +17 -2
- package/src/Tooltip/shared.js +8 -0
- package/src/TooltipButton/TooltipButton.jsx +13 -2
|
@@ -6,11 +6,20 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
6
6
|
import View from "react-native-web/dist/exports/View";
|
|
7
7
|
import { applyOuterBorder, useThemeTokensCallback, applyShadowToken } from '../ThemeProvider';
|
|
8
8
|
import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, resolvePressableState, selectSystemProps, selectTokens, variantProp, viewProps, withLinkRouter } from '../utils';
|
|
9
|
-
import Icon from '../Icon';
|
|
9
|
+
import Icon from '../Icon'; // function to get the dimentionals of the conditionals
|
|
10
|
+
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
const getPasswordDimensions = (password, width, height) => {
|
|
14
|
+
return password ? {
|
|
15
|
+
width,
|
|
16
|
+
height
|
|
17
|
+
} : {};
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
12
21
|
|
|
13
|
-
const selectOuterStyle = _ref => {
|
|
22
|
+
const selectOuterStyle = (_ref, password) => {
|
|
14
23
|
let {
|
|
15
24
|
backgroundColor,
|
|
16
25
|
outerBorderWidth,
|
|
@@ -21,7 +30,9 @@ const selectOuterStyle = _ref => {
|
|
|
21
30
|
borderTopRightRadius,
|
|
22
31
|
borderBottomLeftRadius,
|
|
23
32
|
borderBottomRightRadius,
|
|
24
|
-
shadow
|
|
33
|
+
shadow,
|
|
34
|
+
width,
|
|
35
|
+
height
|
|
25
36
|
} = _ref;
|
|
26
37
|
return [{
|
|
27
38
|
backgroundColor,
|
|
@@ -36,10 +47,13 @@ const selectOuterStyle = _ref => {
|
|
|
36
47
|
outerBorderColor,
|
|
37
48
|
outerBorderGap
|
|
38
49
|
}),
|
|
50
|
+
...getPasswordDimensions(password, width, height),
|
|
39
51
|
...Platform.select({
|
|
40
52
|
web: {
|
|
41
53
|
outline: 'none',
|
|
42
|
-
display: 'inline-flex'
|
|
54
|
+
display: 'inline-flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
justifyContent: 'center'
|
|
43
57
|
}
|
|
44
58
|
})
|
|
45
59
|
}, staticStyles.outer];
|
|
@@ -48,7 +62,7 @@ const selectOuterStyle = _ref => {
|
|
|
48
62
|
const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth); // Stable size as border changes
|
|
49
63
|
|
|
50
64
|
|
|
51
|
-
const selectInnerStyle = _ref2 => {
|
|
65
|
+
const selectInnerStyle = (_ref2, password) => {
|
|
52
66
|
let {
|
|
53
67
|
borderColor,
|
|
54
68
|
borderWidth,
|
|
@@ -65,7 +79,9 @@ const selectInnerStyle = _ref2 => {
|
|
|
65
79
|
paddingLeft,
|
|
66
80
|
paddingRight,
|
|
67
81
|
paddingTop,
|
|
68
|
-
paddingBottom
|
|
82
|
+
paddingBottom,
|
|
83
|
+
width,
|
|
84
|
+
height
|
|
69
85
|
} = _ref2;
|
|
70
86
|
return {
|
|
71
87
|
// Inner borders animate with the icon and should be treated like a themable feature of the icon
|
|
@@ -87,9 +103,13 @@ const selectInnerStyle = _ref2 => {
|
|
|
87
103
|
paddingBottom: calculatePadding(paddingBottom, borderBottomWidth),
|
|
88
104
|
...Platform.select({
|
|
89
105
|
web: {
|
|
90
|
-
pointerEvents: 'none'
|
|
106
|
+
pointerEvents: 'none',
|
|
107
|
+
display: 'inline-flex',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
justifyContent: 'center'
|
|
91
110
|
}
|
|
92
|
-
})
|
|
111
|
+
}),
|
|
112
|
+
...getPasswordDimensions(password, width, height)
|
|
93
113
|
};
|
|
94
114
|
};
|
|
95
115
|
/**
|
|
@@ -133,7 +153,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
133
153
|
|
|
134
154
|
const getTokens = useThemeTokensCallback('IconButton', tokens, variant);
|
|
135
155
|
|
|
136
|
-
const getOuterStyle = pressableState => selectOuterStyle(getTokens(resolvePressableState(pressableState)));
|
|
156
|
+
const getOuterStyle = pressableState => selectOuterStyle(getTokens(resolvePressableState(pressableState), variant.password));
|
|
137
157
|
|
|
138
158
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
139
159
|
ref: ref,
|
|
@@ -146,7 +166,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
146
166
|
children: pressableState => {
|
|
147
167
|
const themeTokens = getTokens(resolvePressableState(pressableState));
|
|
148
168
|
return /*#__PURE__*/_jsx(View, {
|
|
149
|
-
style: selectInnerStyle(themeTokens),
|
|
169
|
+
style: selectInnerStyle(themeTokens, variant.password),
|
|
150
170
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
151
171
|
icon: IconComponent || themeTokens.icon,
|
|
152
172
|
title: selectedProps.accessibilityLabel,
|
|
@@ -197,10 +197,11 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
197
197
|
iconPosition: iconPosition,
|
|
198
198
|
space: iconSpace,
|
|
199
199
|
iconProps: { ...iconProps,
|
|
200
|
-
tokens: iconTokens
|
|
200
|
+
tokens: iconTokens,
|
|
201
|
+
style: staticStyles.bubblePointerEvents
|
|
201
202
|
},
|
|
202
203
|
children: /*#__PURE__*/_jsx(Text, {
|
|
203
|
-
style: [textStyles, blockTextStyles, staticStyles.baseline],
|
|
204
|
+
style: [textStyles, blockTextStyles, staticStyles.baseline, staticStyles.bubblePointerEvents],
|
|
204
205
|
children: typeof children === 'function' ? children(linkState) : children
|
|
205
206
|
})
|
|
206
207
|
});
|
|
@@ -258,6 +259,12 @@ const staticStyles = StyleSheet.create({
|
|
|
258
259
|
},
|
|
259
260
|
baseline: {
|
|
260
261
|
alignSelf: 'baseline'
|
|
262
|
+
},
|
|
263
|
+
bubblePointerEvents: { ...Platform.select({
|
|
264
|
+
web: {
|
|
265
|
+
pointerEvents: 'none'
|
|
266
|
+
}
|
|
267
|
+
})
|
|
261
268
|
}
|
|
262
269
|
});
|
|
263
270
|
export default withLinkRouter(LinkBase);
|
|
@@ -116,13 +116,13 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
116
116
|
children: PropTypes.node.isRequired,
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* @ignore
|
|
120
120
|
* Set internally in `SideNav` render function - used to keep track of active item.
|
|
121
121
|
*/
|
|
122
122
|
itemId: PropTypes.string,
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
-
*
|
|
125
|
+
* @ignore
|
|
126
126
|
* Set internally in `SideNav` render function - used to keep track of expanded items groups.
|
|
127
127
|
*/
|
|
128
128
|
groupId: PropTypes.string,
|
|
@@ -136,27 +136,19 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
136
136
|
hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* @ignore
|
|
140
140
|
* Set internally in `SideNav` render function.
|
|
141
141
|
*/
|
|
142
142
|
isActive: PropTypes.bool,
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
145
|
+
* @ignore
|
|
146
146
|
* Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
|
|
147
147
|
*/
|
|
148
148
|
isExpanded: PropTypes.bool,
|
|
149
|
-
tokens: getTokensPropType('SideNavItem'),
|
|
150
|
-
variant: variantProp.propType,
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Accesibility Role
|
|
154
|
-
*/
|
|
155
149
|
accessibilityRole: PropTypes.string,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*/
|
|
160
|
-
testID: PropTypes.number
|
|
150
|
+
testID: PropTypes.number,
|
|
151
|
+
tokens: getTokensPropType('SideNavItem'),
|
|
152
|
+
variant: variantProp.propType
|
|
161
153
|
};
|
|
162
154
|
export default Item;
|
|
@@ -269,7 +269,12 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
269
269
|
variant: {
|
|
270
270
|
compact: true,
|
|
271
271
|
password: true,
|
|
272
|
-
inactive:
|
|
272
|
+
inactive: variant.inactive,
|
|
273
|
+
size: 'large'
|
|
274
|
+
},
|
|
275
|
+
tokens: {
|
|
276
|
+
width: 40,
|
|
277
|
+
height: 40
|
|
273
278
|
}
|
|
274
279
|
}, !showPassword ? 'hide' : 'show'));
|
|
275
280
|
}
|
|
@@ -123,9 +123,11 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
123
123
|
content,
|
|
124
124
|
position = 'auto',
|
|
125
125
|
copy = 'en',
|
|
126
|
+
onPress = () => {},
|
|
126
127
|
tokens,
|
|
127
128
|
variant,
|
|
128
129
|
inline = false,
|
|
130
|
+
nativeID,
|
|
129
131
|
...rest
|
|
130
132
|
} = _ref6;
|
|
131
133
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -163,7 +165,10 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
163
165
|
});
|
|
164
166
|
const themeTokens = useThemeTokens('Tooltip', tokens, variant);
|
|
165
167
|
|
|
166
|
-
const toggleIsOpen = () =>
|
|
168
|
+
const toggleIsOpen = () => {
|
|
169
|
+
onPress();
|
|
170
|
+
setIsOpen(!isOpen);
|
|
171
|
+
};
|
|
167
172
|
|
|
168
173
|
const close = () => setIsOpen(false);
|
|
169
174
|
|
|
@@ -235,6 +240,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
235
240
|
hitSlop: pressableHitSlop,
|
|
236
241
|
accessibilityLabel: getCopy('a11yText'),
|
|
237
242
|
accessibilityRole: "button",
|
|
243
|
+
nativeID: nativeID,
|
|
238
244
|
children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
|
|
239
245
|
}), isOpen && /*#__PURE__*/_jsxs(View, {
|
|
240
246
|
ref: floating,
|
|
@@ -150,9 +150,11 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
150
150
|
content,
|
|
151
151
|
position = 'auto',
|
|
152
152
|
copy = 'en',
|
|
153
|
+
onPress = () => {},
|
|
153
154
|
tokens,
|
|
154
155
|
variant,
|
|
155
156
|
inline = false,
|
|
157
|
+
nativeID,
|
|
156
158
|
...rest
|
|
157
159
|
} = _ref6;
|
|
158
160
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -180,7 +182,10 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
180
182
|
return () => subscription === null || subscription === void 0 ? void 0 : subscription.remove();
|
|
181
183
|
});
|
|
182
184
|
|
|
183
|
-
const toggleIsOpen = () =>
|
|
185
|
+
const toggleIsOpen = () => {
|
|
186
|
+
onPress();
|
|
187
|
+
setIsOpen(!isOpen);
|
|
188
|
+
};
|
|
184
189
|
|
|
185
190
|
const close = () => setIsOpen(false);
|
|
186
191
|
|
|
@@ -284,6 +289,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
284
289
|
hitSlop: pressableHitSlop,
|
|
285
290
|
accessibilityLabel: getCopy('a11yText'),
|
|
286
291
|
accessibilityRole: "button",
|
|
292
|
+
nativeID: nativeID,
|
|
287
293
|
children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
|
|
288
294
|
}), isOpen && /*#__PURE__*/_jsx(Backdrop, {
|
|
289
295
|
onPress: close,
|
|
@@ -26,6 +26,16 @@ const propTypes = {
|
|
|
26
26
|
* Display tooltip icon button as an inline element.
|
|
27
27
|
*/
|
|
28
28
|
inline: PropTypes.bool,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Callback function triggered when the tooltip is pressed.
|
|
32
|
+
*/
|
|
33
|
+
onPress: PropTypes.func,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The `id` of the tooltip button.
|
|
37
|
+
*/
|
|
38
|
+
nativeID: PropTypes.string,
|
|
29
39
|
tokens: getTokensPropType('Tooltip'),
|
|
30
40
|
variant: variantProp.propType
|
|
31
41
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import View from "react-native-web/dist/exports/View";
|
|
3
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { useThemeTokens, applyOuterBorder } from '../ThemeProvider';
|
|
5
7
|
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
@@ -53,7 +55,7 @@ const TooltipButton = _ref3 => {
|
|
|
53
55
|
return /*#__PURE__*/_jsx(View, {
|
|
54
56
|
style: [applyOuterBorder(themeTokens), themeTokens.outerBorderWidth && {
|
|
55
57
|
margin: -themeTokens.outerBorderWidth
|
|
56
|
-
}],
|
|
58
|
+
}, staticStyles.bubblePointerEvents],
|
|
57
59
|
...selectProps(rest),
|
|
58
60
|
children: /*#__PURE__*/_jsx(View, {
|
|
59
61
|
style: selectInnerContainerStyles(themeTokens),
|
|
@@ -65,6 +67,14 @@ const TooltipButton = _ref3 => {
|
|
|
65
67
|
});
|
|
66
68
|
};
|
|
67
69
|
|
|
70
|
+
const staticStyles = StyleSheet.create({
|
|
71
|
+
bubblePointerEvents: { ...Platform.select({
|
|
72
|
+
web: {
|
|
73
|
+
pointerEvents: 'none'
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
});
|
|
68
78
|
TooltipButton.propTypes = { ...selectedSystemPropTypes,
|
|
69
79
|
|
|
70
80
|
/**
|
package/package.json
CHANGED
package/src/Icon/Icon.jsx
CHANGED
|
@@ -7,7 +7,15 @@ import { getTokensPropType, scaleWithText, variantProp } from '../utils'
|
|
|
7
7
|
|
|
8
8
|
const Icon = forwardRef(
|
|
9
9
|
(
|
|
10
|
-
{
|
|
10
|
+
{
|
|
11
|
+
icon: IconComponent,
|
|
12
|
+
accessibilityLabel,
|
|
13
|
+
variant,
|
|
14
|
+
tokens,
|
|
15
|
+
scalesWithText = false,
|
|
16
|
+
style = {},
|
|
17
|
+
dataSet
|
|
18
|
+
},
|
|
11
19
|
ref
|
|
12
20
|
) => {
|
|
13
21
|
const themeTokens = useThemeTokens('Icon', tokens, variant)
|
|
@@ -32,7 +40,8 @@ const Icon = forwardRef(
|
|
|
32
40
|
themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''
|
|
33
41
|
]
|
|
34
42
|
.filter((exists) => exists)
|
|
35
|
-
.join(' ')
|
|
43
|
+
.join(' '),
|
|
44
|
+
...style
|
|
36
45
|
}}
|
|
37
46
|
dataSet={dataSet}
|
|
38
47
|
>
|
|
@@ -55,7 +64,17 @@ export const iconComponentPropTypes = {
|
|
|
55
64
|
/**
|
|
56
65
|
* controls whether the icon size should be proportionate to any accessibility-related font scaling.
|
|
57
66
|
*/
|
|
58
|
-
scalesWithText: PropTypes.bool
|
|
67
|
+
scalesWithText: PropTypes.bool,
|
|
68
|
+
/**
|
|
69
|
+
* Custom style object to be applied to the icon component.
|
|
70
|
+
* This is useful for overriding the default icon style but for cases where desires styles are not available as tokens.
|
|
71
|
+
*
|
|
72
|
+
* Note: This prop is only used in web.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* <Icon style={{ color: 'red' }}
|
|
76
|
+
*/
|
|
77
|
+
style: PropTypes.object
|
|
59
78
|
}
|
|
60
79
|
|
|
61
80
|
Icon.propTypes = {
|
|
@@ -18,20 +18,30 @@ import {
|
|
|
18
18
|
} from '../utils'
|
|
19
19
|
import Icon from '../Icon'
|
|
20
20
|
|
|
21
|
+
// function to get the dimentionals of the conditionals
|
|
22
|
+
const getPasswordDimensions = (password, width, height) => {
|
|
23
|
+
return password ? { width, height } : {}
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
|
|
22
27
|
|
|
23
|
-
const selectOuterStyle = (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const selectOuterStyle = (
|
|
29
|
+
{
|
|
30
|
+
backgroundColor,
|
|
31
|
+
outerBorderWidth,
|
|
32
|
+
outerBorderColor,
|
|
33
|
+
outerBorderGap,
|
|
34
|
+
borderRadius,
|
|
35
|
+
borderTopLeftRadius,
|
|
36
|
+
borderTopRightRadius,
|
|
37
|
+
borderBottomLeftRadius,
|
|
38
|
+
borderBottomRightRadius,
|
|
39
|
+
shadow,
|
|
40
|
+
width,
|
|
41
|
+
height
|
|
42
|
+
},
|
|
43
|
+
password
|
|
44
|
+
) => [
|
|
35
45
|
{
|
|
36
46
|
backgroundColor,
|
|
37
47
|
...applyShadowToken(shadow),
|
|
@@ -45,31 +55,44 @@ const selectOuterStyle = ({
|
|
|
45
55
|
outerBorderColor,
|
|
46
56
|
outerBorderGap
|
|
47
57
|
}),
|
|
48
|
-
...
|
|
58
|
+
...getPasswordDimensions(password, width, height),
|
|
59
|
+
...Platform.select({
|
|
60
|
+
web: {
|
|
61
|
+
outline: 'none',
|
|
62
|
+
display: 'inline-flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'center'
|
|
65
|
+
}
|
|
66
|
+
})
|
|
49
67
|
},
|
|
50
68
|
staticStyles.outer
|
|
51
69
|
]
|
|
52
70
|
|
|
53
71
|
const calculatePadding = (padding, borderWidth) => padding && Math.max(0, padding - borderWidth) // Stable size as border changes
|
|
54
72
|
|
|
55
|
-
const selectInnerStyle = (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
const selectInnerStyle = (
|
|
74
|
+
{
|
|
75
|
+
borderColor,
|
|
76
|
+
borderWidth,
|
|
77
|
+
borderTopLeftRadius,
|
|
78
|
+
borderTopRightRadius,
|
|
79
|
+
borderBottomLeftRadius,
|
|
80
|
+
borderBottomRightRadius,
|
|
81
|
+
borderRadius,
|
|
82
|
+
padding = 0,
|
|
83
|
+
borderTopWidth,
|
|
84
|
+
borderRightWidth,
|
|
85
|
+
borderBottomWidth,
|
|
86
|
+
borderLeftWidth,
|
|
87
|
+
paddingLeft,
|
|
88
|
+
paddingRight,
|
|
89
|
+
paddingTop,
|
|
90
|
+
paddingBottom,
|
|
91
|
+
width,
|
|
92
|
+
height
|
|
93
|
+
},
|
|
94
|
+
password
|
|
95
|
+
) => ({
|
|
73
96
|
// Inner borders animate with the icon and should be treated like a themable feature of the icon
|
|
74
97
|
borderColor,
|
|
75
98
|
borderRadius,
|
|
@@ -89,9 +112,13 @@ const selectInnerStyle = ({
|
|
|
89
112
|
paddingBottom: calculatePadding(paddingBottom, borderBottomWidth),
|
|
90
113
|
...Platform.select({
|
|
91
114
|
web: {
|
|
92
|
-
pointerEvents: 'none'
|
|
115
|
+
pointerEvents: 'none',
|
|
116
|
+
display: 'inline-flex',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
justifyContent: 'center'
|
|
93
119
|
}
|
|
94
|
-
})
|
|
120
|
+
}),
|
|
121
|
+
...getPasswordDimensions(password, width, height)
|
|
95
122
|
})
|
|
96
123
|
|
|
97
124
|
/**
|
|
@@ -124,7 +151,7 @@ const IconButton = forwardRef(
|
|
|
124
151
|
|
|
125
152
|
const getTokens = useThemeTokensCallback('IconButton', tokens, variant)
|
|
126
153
|
const getOuterStyle = (pressableState) =>
|
|
127
|
-
selectOuterStyle(getTokens(resolvePressableState(pressableState)))
|
|
154
|
+
selectOuterStyle(getTokens(resolvePressableState(pressableState), variant.password))
|
|
128
155
|
|
|
129
156
|
return (
|
|
130
157
|
<Pressable
|
|
@@ -139,7 +166,7 @@ const IconButton = forwardRef(
|
|
|
139
166
|
{(pressableState) => {
|
|
140
167
|
const themeTokens = getTokens(resolvePressableState(pressableState))
|
|
141
168
|
return (
|
|
142
|
-
<View style={selectInnerStyle(themeTokens)}>
|
|
169
|
+
<View style={selectInnerStyle(themeTokens, variant.password)}>
|
|
143
170
|
<Icon
|
|
144
171
|
icon={IconComponent || themeTokens.icon}
|
|
145
172
|
title={selectedProps.accessibilityLabel}
|
package/src/Link/LinkBase.jsx
CHANGED
|
@@ -180,9 +180,20 @@ const LinkBase = forwardRef(
|
|
|
180
180
|
icon={IconComponent}
|
|
181
181
|
iconPosition={iconPosition}
|
|
182
182
|
space={iconSpace}
|
|
183
|
-
iconProps={{
|
|
183
|
+
iconProps={{
|
|
184
|
+
...iconProps,
|
|
185
|
+
tokens: iconTokens,
|
|
186
|
+
style: staticStyles.bubblePointerEvents
|
|
187
|
+
}}
|
|
184
188
|
>
|
|
185
|
-
<Text
|
|
189
|
+
<Text
|
|
190
|
+
style={[
|
|
191
|
+
textStyles,
|
|
192
|
+
blockTextStyles,
|
|
193
|
+
staticStyles.baseline,
|
|
194
|
+
staticStyles.bubblePointerEvents
|
|
195
|
+
]}
|
|
196
|
+
>
|
|
186
197
|
{typeof children === 'function' ? children(linkState) : children}
|
|
187
198
|
</Text>
|
|
188
199
|
</IconText>
|
|
@@ -239,6 +250,13 @@ const staticStyles = StyleSheet.create({
|
|
|
239
250
|
},
|
|
240
251
|
baseline: {
|
|
241
252
|
alignSelf: 'baseline'
|
|
253
|
+
},
|
|
254
|
+
bubblePointerEvents: {
|
|
255
|
+
...Platform.select({
|
|
256
|
+
web: {
|
|
257
|
+
pointerEvents: 'none'
|
|
258
|
+
}
|
|
259
|
+
})
|
|
242
260
|
}
|
|
243
261
|
})
|
|
244
262
|
|
package/src/SideNav/Item.jsx
CHANGED
|
@@ -111,12 +111,12 @@ Item.propTypes = {
|
|
|
111
111
|
*/
|
|
112
112
|
children: PropTypes.node.isRequired,
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* @ignore
|
|
115
115
|
* Set internally in `SideNav` render function - used to keep track of active item.
|
|
116
116
|
*/
|
|
117
117
|
itemId: PropTypes.string,
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* @ignore
|
|
120
120
|
* Set internally in `SideNav` render function - used to keep track of expanded items groups.
|
|
121
121
|
*/
|
|
122
122
|
groupId: PropTypes.string,
|
|
@@ -128,25 +128,19 @@ Item.propTypes = {
|
|
|
128
128
|
*/
|
|
129
129
|
hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* @ignore
|
|
132
132
|
* Set internally in `SideNav` render function.
|
|
133
133
|
*/
|
|
134
134
|
isActive: PropTypes.bool,
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* @ignore
|
|
137
137
|
* Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
|
|
138
138
|
*/
|
|
139
139
|
isExpanded: PropTypes.bool,
|
|
140
|
-
tokens: getTokensPropType('SideNavItem'),
|
|
141
|
-
variant: variantProp.propType,
|
|
142
|
-
/**
|
|
143
|
-
* Accesibility Role
|
|
144
|
-
*/
|
|
145
140
|
accessibilityRole: PropTypes.string,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
testID: PropTypes.number
|
|
141
|
+
testID: PropTypes.number,
|
|
142
|
+
tokens: getTokensPropType('SideNavItem'),
|
|
143
|
+
variant: variantProp.propType
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
export default Item
|
|
@@ -253,7 +253,8 @@ const TextInputBase = forwardRef(
|
|
|
253
253
|
icon={!showPassword ? passwordShowButtonIcon : passwordHideButtonIcon}
|
|
254
254
|
key={!showPassword ? 'hide' : 'show'}
|
|
255
255
|
onPress={handleShowOrHide}
|
|
256
|
-
variant={{ compact: true, password: true, inactive:
|
|
256
|
+
variant={{ compact: true, password: true, inactive: variant.inactive, size: 'large' }}
|
|
257
|
+
tokens={{ width: 40, height: 40 }}
|
|
257
258
|
/>
|
|
258
259
|
)
|
|
259
260
|
}
|
package/src/Tooltip/Tooltip.jsx
CHANGED
|
@@ -83,7 +83,18 @@ const defaultControl = (pressableState, variant) => (
|
|
|
83
83
|
*/
|
|
84
84
|
const Tooltip = forwardRef(
|
|
85
85
|
(
|
|
86
|
-
{
|
|
86
|
+
{
|
|
87
|
+
children,
|
|
88
|
+
content,
|
|
89
|
+
position = 'auto',
|
|
90
|
+
copy = 'en',
|
|
91
|
+
onPress = () => {},
|
|
92
|
+
tokens,
|
|
93
|
+
variant,
|
|
94
|
+
inline = false,
|
|
95
|
+
nativeID,
|
|
96
|
+
...rest
|
|
97
|
+
},
|
|
87
98
|
ref
|
|
88
99
|
) => {
|
|
89
100
|
const [isOpen, setIsOpen] = useState(false)
|
|
@@ -118,7 +129,10 @@ const Tooltip = forwardRef(
|
|
|
118
129
|
const getCopy = useCopy({ dictionary, copy })
|
|
119
130
|
const themeTokens = useThemeTokens('Tooltip', tokens, variant)
|
|
120
131
|
|
|
121
|
-
const toggleIsOpen = () =>
|
|
132
|
+
const toggleIsOpen = () => {
|
|
133
|
+
onPress()
|
|
134
|
+
setIsOpen(!isOpen)
|
|
135
|
+
}
|
|
122
136
|
const close = () => setIsOpen(false)
|
|
123
137
|
|
|
124
138
|
const getPressableState = ({ pressed, hovered, focused }) => ({
|
|
@@ -180,6 +194,7 @@ const Tooltip = forwardRef(
|
|
|
180
194
|
hitSlop={pressableHitSlop}
|
|
181
195
|
accessibilityLabel={getCopy('a11yText')}
|
|
182
196
|
accessibilityRole="button"
|
|
197
|
+
nativeID={nativeID}
|
|
183
198
|
>
|
|
184
199
|
{typeof control === 'function'
|
|
185
200
|
? (pressableState) => control(getPressableState(pressableState), variant)
|
|
@@ -109,7 +109,18 @@ const defaultControl = (pressableState, variant) => (
|
|
|
109
109
|
*/
|
|
110
110
|
const Tooltip = forwardRef(
|
|
111
111
|
(
|
|
112
|
-
{
|
|
112
|
+
{
|
|
113
|
+
children,
|
|
114
|
+
content,
|
|
115
|
+
position = 'auto',
|
|
116
|
+
copy = 'en',
|
|
117
|
+
onPress = () => {},
|
|
118
|
+
tokens,
|
|
119
|
+
variant,
|
|
120
|
+
inline = false,
|
|
121
|
+
nativeID,
|
|
122
|
+
...rest
|
|
123
|
+
},
|
|
113
124
|
ref
|
|
114
125
|
) => {
|
|
115
126
|
const [isOpen, setIsOpen] = useState(false)
|
|
@@ -133,7 +144,10 @@ const Tooltip = forwardRef(
|
|
|
133
144
|
return () => subscription?.remove()
|
|
134
145
|
})
|
|
135
146
|
|
|
136
|
-
const toggleIsOpen = () =>
|
|
147
|
+
const toggleIsOpen = () => {
|
|
148
|
+
onPress()
|
|
149
|
+
setIsOpen(!isOpen)
|
|
150
|
+
}
|
|
137
151
|
const close = () => setIsOpen(false)
|
|
138
152
|
|
|
139
153
|
const getPressableState = ({ pressed, hovered, focused }) => ({
|
|
@@ -239,6 +253,7 @@ const Tooltip = forwardRef(
|
|
|
239
253
|
hitSlop={pressableHitSlop}
|
|
240
254
|
accessibilityLabel={getCopy('a11yText')}
|
|
241
255
|
accessibilityRole="button"
|
|
256
|
+
nativeID={nativeID}
|
|
242
257
|
>
|
|
243
258
|
{typeof control === 'function'
|
|
244
259
|
? (pressableState) => control(getPressableState(pressableState), variant)
|