@telus-uds/components-base 1.8.4 → 1.8.5
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 +11 -2
- package/lib/Checkbox/Checkbox.js +4 -2
- package/lib/Link/InlinePressable.js +5 -1
- package/lib/Link/LinkBase.js +5 -2
- package/lib-module/Checkbox/Checkbox.js +4 -2
- package/lib-module/Link/InlinePressable.js +5 -1
- package/lib-module/Link/LinkBase.js +5 -2
- package/package.json +1 -1
- package/src/Checkbox/Checkbox.jsx +3 -1
- package/src/Link/InlinePressable.jsx +5 -2
- package/src/Link/LinkBase.jsx +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 28 Jun 2022 21:35:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.8.5
|
|
8
|
+
|
|
9
|
+
Tue, 28 Jun 2022 21:35:29 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fix: add forcing inline display on links without icons (ruslan.bredikhin@nearform.com)
|
|
14
|
+
- fix: move testID to the icon container (ruslan.bredikhin@nearform.com)
|
|
15
|
+
|
|
7
16
|
## 1.8.4
|
|
8
17
|
|
|
9
|
-
Wed, 22 Jun 2022 15:03:
|
|
18
|
+
Wed, 22 Jun 2022 15:03:54 GMT
|
|
10
19
|
|
|
11
20
|
### Patches
|
|
12
21
|
|
package/lib/Checkbox/Checkbox.js
CHANGED
|
@@ -265,8 +265,10 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
265
265
|
isControlled: isControlled,
|
|
266
266
|
name: name,
|
|
267
267
|
value: value
|
|
268
|
-
}), isChecked && IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
269
|
-
testID: "Checkbox-Icon"
|
|
268
|
+
}), isChecked && IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
269
|
+
testID: "Checkbox-Icon",
|
|
270
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...iconTokens
|
|
271
|
+
})
|
|
270
272
|
})]
|
|
271
273
|
})
|
|
272
274
|
}), Boolean(label) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
@@ -37,11 +37,12 @@ const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
37
37
|
let {
|
|
38
38
|
children,
|
|
39
39
|
style,
|
|
40
|
+
inline = false,
|
|
40
41
|
...props
|
|
41
42
|
} = _ref;
|
|
42
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
|
|
43
44
|
ref: ref,
|
|
44
|
-
style: pressState => [staticStyles
|
|
45
|
+
style: pressState => [staticStyles[inline ? 'inline' : 'inlineFlex'], typeof style === 'function' ? style(pressState) : style],
|
|
45
46
|
...props,
|
|
46
47
|
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
47
48
|
});
|
|
@@ -51,6 +52,9 @@ InlinePressable.displayName = 'InlinePressable';
|
|
|
51
52
|
const staticStyles = _StyleSheet.default.create({
|
|
52
53
|
inline: {
|
|
53
54
|
// Stop Pressable defaulting to (block) flex
|
|
55
|
+
display: 'inline'
|
|
56
|
+
},
|
|
57
|
+
inlineFlex: {
|
|
54
58
|
display: 'inline-flex'
|
|
55
59
|
}
|
|
56
60
|
});
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -186,17 +186,20 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
186
186
|
|
|
187
187
|
const resolveLinkTokens = pressState => (0, _pressability.resolvePressableTokens)(tokens, pressState, {
|
|
188
188
|
iconPosition
|
|
189
|
-
});
|
|
189
|
+
});
|
|
190
190
|
|
|
191
|
+
const defaultThemeTokens = resolveLinkTokens({});
|
|
192
|
+
const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
|
|
191
193
|
|
|
192
194
|
const blockLeftStyle = _Platform.default.OS === 'web' && staticStyles.blockLeft;
|
|
193
195
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, { ...selectedProps,
|
|
196
|
+
inline: hasIcon // assuming links without icons should be inline (even if they are long)
|
|
197
|
+
,
|
|
194
198
|
ref: ref,
|
|
195
199
|
style: linkState => {
|
|
196
200
|
const themeTokens = resolveLinkTokens(linkState);
|
|
197
201
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
198
202
|
const decorationStyles = selectDecorationStyles(themeTokens);
|
|
199
|
-
const hasIcon = Boolean(icon || themeTokens.icon);
|
|
200
203
|
return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
|
|
201
204
|
},
|
|
202
205
|
children: linkState => {
|
|
@@ -237,8 +237,10 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
237
237
|
isControlled: isControlled,
|
|
238
238
|
name: name,
|
|
239
239
|
value: value
|
|
240
|
-
}), isChecked && IconComponent && /*#__PURE__*/_jsx(
|
|
241
|
-
testID: "Checkbox-Icon"
|
|
240
|
+
}), isChecked && IconComponent && /*#__PURE__*/_jsx(View, {
|
|
241
|
+
testID: "Checkbox-Icon",
|
|
242
|
+
children: /*#__PURE__*/_jsx(IconComponent, { ...iconTokens
|
|
243
|
+
})
|
|
242
244
|
})]
|
|
243
245
|
})
|
|
244
246
|
}), Boolean(label) && /*#__PURE__*/_jsx(Text, {
|
|
@@ -21,11 +21,12 @@ const InlinePressable = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
21
21
|
let {
|
|
22
22
|
children,
|
|
23
23
|
style,
|
|
24
|
+
inline = false,
|
|
24
25
|
...props
|
|
25
26
|
} = _ref;
|
|
26
27
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
27
28
|
ref: ref,
|
|
28
|
-
style: pressState => [staticStyles
|
|
29
|
+
style: pressState => [staticStyles[inline ? 'inline' : 'inlineFlex'], typeof style === 'function' ? style(pressState) : style],
|
|
29
30
|
...props,
|
|
30
31
|
children: pressState => typeof children === 'function' ? children(pressState) : children
|
|
31
32
|
});
|
|
@@ -34,6 +35,9 @@ InlinePressable.displayName = 'InlinePressable';
|
|
|
34
35
|
const staticStyles = StyleSheet.create({
|
|
35
36
|
inline: {
|
|
36
37
|
// Stop Pressable defaulting to (block) flex
|
|
38
|
+
display: 'inline'
|
|
39
|
+
},
|
|
40
|
+
inlineFlex: {
|
|
37
41
|
display: 'inline-flex'
|
|
38
42
|
}
|
|
39
43
|
});
|
|
@@ -158,17 +158,20 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
158
158
|
|
|
159
159
|
const resolveLinkTokens = pressState => resolvePressableTokens(tokens, pressState, {
|
|
160
160
|
iconPosition
|
|
161
|
-
});
|
|
161
|
+
});
|
|
162
162
|
|
|
163
|
+
const defaultThemeTokens = resolveLinkTokens({});
|
|
164
|
+
const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
|
|
163
165
|
|
|
164
166
|
const blockLeftStyle = Platform.OS === 'web' && staticStyles.blockLeft;
|
|
165
167
|
return /*#__PURE__*/_jsx(InlinePressable, { ...selectedProps,
|
|
168
|
+
inline: hasIcon // assuming links without icons should be inline (even if they are long)
|
|
169
|
+
,
|
|
166
170
|
ref: ref,
|
|
167
171
|
style: linkState => {
|
|
168
172
|
const themeTokens = resolveLinkTokens(linkState);
|
|
169
173
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens);
|
|
170
174
|
const decorationStyles = selectDecorationStyles(themeTokens);
|
|
171
|
-
const hasIcon = Boolean(icon || themeTokens.icon);
|
|
172
175
|
return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
|
|
173
176
|
},
|
|
174
177
|
children: linkState => {
|
package/package.json
CHANGED
|
@@ -213,7 +213,9 @@ const Checkbox = forwardRef(
|
|
|
213
213
|
value={value}
|
|
214
214
|
/>
|
|
215
215
|
{isChecked && IconComponent && (
|
|
216
|
-
<
|
|
216
|
+
<View testID="Checkbox-Icon">
|
|
217
|
+
<IconComponent {...iconTokens} />
|
|
218
|
+
</View>
|
|
217
219
|
)}
|
|
218
220
|
</View>
|
|
219
221
|
</View>
|
|
@@ -15,11 +15,11 @@ import { Pressable, StyleSheet } from 'react-native'
|
|
|
15
15
|
*/
|
|
16
16
|
// React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
|
|
17
17
|
// eslint-disable-next-line react/prop-types
|
|
18
|
-
const InlinePressable = forwardRef(({ children, style, ...props }, ref) => (
|
|
18
|
+
const InlinePressable = forwardRef(({ children, style, inline = false, ...props }, ref) => (
|
|
19
19
|
<Pressable
|
|
20
20
|
ref={ref}
|
|
21
21
|
style={(pressState) => [
|
|
22
|
-
staticStyles
|
|
22
|
+
staticStyles[inline ? 'inline' : 'inlineFlex'],
|
|
23
23
|
typeof style === 'function' ? style(pressState) : style
|
|
24
24
|
]}
|
|
25
25
|
{...props}
|
|
@@ -32,6 +32,9 @@ InlinePressable.displayName = 'InlinePressable'
|
|
|
32
32
|
const staticStyles = StyleSheet.create({
|
|
33
33
|
inline: {
|
|
34
34
|
// Stop Pressable defaulting to (block) flex
|
|
35
|
+
display: 'inline'
|
|
36
|
+
},
|
|
37
|
+
inlineFlex: {
|
|
35
38
|
display: 'inline-flex'
|
|
36
39
|
}
|
|
37
40
|
})
|
package/src/Link/LinkBase.jsx
CHANGED
|
@@ -132,18 +132,21 @@ const LinkBase = forwardRef(
|
|
|
132
132
|
const resolveLinkTokens = (pressState) =>
|
|
133
133
|
resolvePressableTokens(tokens, pressState, { iconPosition })
|
|
134
134
|
|
|
135
|
+
const defaultThemeTokens = resolveLinkTokens({})
|
|
136
|
+
const hasIcon = Boolean(icon || defaultThemeTokens.icon)
|
|
137
|
+
|
|
135
138
|
// On web, this makes focus rings wrap only the link, not the entire block
|
|
136
139
|
const blockLeftStyle = Platform.OS === 'web' && staticStyles.blockLeft
|
|
137
140
|
|
|
138
141
|
return (
|
|
139
142
|
<InlinePressable
|
|
140
143
|
{...selectedProps}
|
|
144
|
+
inline={hasIcon} // assuming links without icons should be inline (even if they are long)
|
|
141
145
|
ref={ref}
|
|
142
146
|
style={(linkState) => {
|
|
143
147
|
const themeTokens = resolveLinkTokens(linkState)
|
|
144
148
|
const outerBorderStyles = selectOuterBorderStyles(themeTokens)
|
|
145
149
|
const decorationStyles = selectDecorationStyles(themeTokens)
|
|
146
|
-
const hasIcon = Boolean(icon || themeTokens.icon)
|
|
147
150
|
return [
|
|
148
151
|
outerBorderStyles,
|
|
149
152
|
blockLeftStyle,
|