@telus-uds/components-base 1.62.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 +10 -2
- package/component-docs.json +43 -0
- package/lib/Icon/Icon.js +15 -2
- package/lib/Link/LinkBase.js +9 -2
- package/lib/Tooltip/Tooltip.js +2 -0
- package/lib/Tooltip/Tooltip.native.js +2 -0
- package/lib/Tooltip/shared.js +5 -0
- package/lib/TooltipButton/TooltipButton.js +14 -1
- package/lib-module/Icon/Icon.js +15 -2
- package/lib-module/Link/LinkBase.js +9 -2
- package/lib-module/Tooltip/Tooltip.js +2 -0
- package/lib-module/Tooltip/Tooltip.native.js +2 -0
- package/lib-module/Tooltip/shared.js +5 -0
- package/lib-module/TooltipButton/TooltipButton.js +11 -1
- package/package.json +1 -1
- package/src/Icon/Icon.jsx +22 -3
- package/src/Link/LinkBase.jsx +20 -2
- package/src/Tooltip/Tooltip.jsx +2 -0
- package/src/Tooltip/Tooltip.native.jsx +2 -0
- package/src/Tooltip/shared.js +4 -0
- package/src/TooltipButton/TooltipButton.jsx +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 27 Sep 2023 20:45:15 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.62.1
|
|
8
|
+
|
|
9
|
+
Wed, 27 Sep 2023 20:45:15 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Clicking on any clickable area should bubble event to relevant `Pressable` element (shahzaibkhalidmalik@outlook.com)
|
|
14
|
+
|
|
7
15
|
## 1.62.0
|
|
8
16
|
|
|
9
|
-
Fri, 15 Sep 2023
|
|
17
|
+
Fri, 15 Sep 2023 21:02:27 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
package/component-docs.json
CHANGED
|
@@ -6412,6 +6412,17 @@
|
|
|
6412
6412
|
"required": false,
|
|
6413
6413
|
"description": "controls whether the icon size should be proportionate to any accessibility-related font scaling."
|
|
6414
6414
|
},
|
|
6415
|
+
"style": {
|
|
6416
|
+
"defaultValue": {
|
|
6417
|
+
"value": "{}",
|
|
6418
|
+
"computed": false
|
|
6419
|
+
},
|
|
6420
|
+
"type": {
|
|
6421
|
+
"name": "object"
|
|
6422
|
+
},
|
|
6423
|
+
"required": false,
|
|
6424
|
+
"description": "Custom style object to be applied to the icon component.\nThis is useful for overriding the default icon style but for cases where desires styles are not available as tokens.\n\nNote: This prop is only used in web.\n\n@example\n<Icon style={{ color: 'red' }}"
|
|
6425
|
+
},
|
|
6415
6426
|
"variant": {
|
|
6416
6427
|
"type": {
|
|
6417
6428
|
"name": "objectOf",
|
|
@@ -11311,6 +11322,13 @@
|
|
|
11311
11322
|
"required": false,
|
|
11312
11323
|
"description": "The message. Can be raw text or text components."
|
|
11313
11324
|
},
|
|
11325
|
+
"nativeID": {
|
|
11326
|
+
"type": {
|
|
11327
|
+
"name": "string"
|
|
11328
|
+
},
|
|
11329
|
+
"required": false,
|
|
11330
|
+
"description": "The `id` of the tooltip button."
|
|
11331
|
+
},
|
|
11314
11332
|
"tokens": {
|
|
11315
11333
|
"type": {
|
|
11316
11334
|
"name": "custom",
|
|
@@ -11820,6 +11838,11 @@
|
|
|
11820
11838
|
"name": "bool",
|
|
11821
11839
|
"description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
|
|
11822
11840
|
"required": false
|
|
11841
|
+
},
|
|
11842
|
+
"style": {
|
|
11843
|
+
"name": "object",
|
|
11844
|
+
"description": "Custom style object to be applied to the icon component.\nThis is useful for overriding the default icon style but for cases where desires styles are not available as tokens.\n\nNote: This prop is only used in web.\n\n@example\n<Icon style={{ color: 'red' }}",
|
|
11845
|
+
"required": false
|
|
11823
11846
|
}
|
|
11824
11847
|
}
|
|
11825
11848
|
},
|
|
@@ -12003,6 +12026,11 @@
|
|
|
12003
12026
|
"name": "bool",
|
|
12004
12027
|
"description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
|
|
12005
12028
|
"required": false
|
|
12029
|
+
},
|
|
12030
|
+
"style": {
|
|
12031
|
+
"name": "object",
|
|
12032
|
+
"description": "Custom style object to be applied to the icon component.\nThis is useful for overriding the default icon style but for cases where desires styles are not available as tokens.\n\nNote: This prop is only used in web.\n\n@example\n<Icon style={{ color: 'red' }}",
|
|
12033
|
+
"required": false
|
|
12006
12034
|
}
|
|
12007
12035
|
}
|
|
12008
12036
|
},
|
|
@@ -12443,6 +12471,11 @@
|
|
|
12443
12471
|
"name": "bool",
|
|
12444
12472
|
"description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
|
|
12445
12473
|
"required": false
|
|
12474
|
+
},
|
|
12475
|
+
"style": {
|
|
12476
|
+
"name": "object",
|
|
12477
|
+
"description": "Custom style object to be applied to the icon component.\nThis is useful for overriding the default icon style but for cases where desires styles are not available as tokens.\n\nNote: This prop is only used in web.\n\n@example\n<Icon style={{ color: 'red' }}",
|
|
12478
|
+
"required": false
|
|
12446
12479
|
}
|
|
12447
12480
|
}
|
|
12448
12481
|
},
|
|
@@ -14037,6 +14070,11 @@
|
|
|
14037
14070
|
"name": "bool",
|
|
14038
14071
|
"description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
|
|
14039
14072
|
"required": false
|
|
14073
|
+
},
|
|
14074
|
+
"style": {
|
|
14075
|
+
"name": "object",
|
|
14076
|
+
"description": "Custom style object to be applied to the icon component.\nThis is useful for overriding the default icon style but for cases where desires styles are not available as tokens.\n\nNote: This prop is only used in web.\n\n@example\n<Icon style={{ color: 'red' }}",
|
|
14077
|
+
"required": false
|
|
14040
14078
|
}
|
|
14041
14079
|
}
|
|
14042
14080
|
},
|
|
@@ -14314,6 +14352,11 @@
|
|
|
14314
14352
|
"name": "bool",
|
|
14315
14353
|
"description": "controls whether the icon size should be proportionate to any accessibility-related font scaling.",
|
|
14316
14354
|
"required": false
|
|
14355
|
+
},
|
|
14356
|
+
"style": {
|
|
14357
|
+
"name": "object",
|
|
14358
|
+
"description": "Custom style object to be applied to the icon component.\nThis is useful for overriding the default icon style but for cases where desires styles are not available as tokens.\n\nNote: This prop is only used in web.\n\n@example\n<Icon style={{ color: 'red' }}",
|
|
14359
|
+
"required": false
|
|
14317
14360
|
}
|
|
14318
14361
|
}
|
|
14319
14362
|
},
|
package/lib/Icon/Icon.js
CHANGED
|
@@ -32,6 +32,7 @@ const Icon = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
32
32
|
variant,
|
|
33
33
|
tokens,
|
|
34
34
|
scalesWithText = false,
|
|
35
|
+
style = {},
|
|
35
36
|
dataSet
|
|
36
37
|
} = _ref;
|
|
37
38
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Icon', tokens, variant);
|
|
@@ -48,7 +49,8 @@ const Icon = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
48
49
|
// TODO: systematise animations.
|
|
49
50
|
// https://github.com/telus/universal-design-system/issues/487
|
|
50
51
|
transition: 'transform 200ms, color 200ms',
|
|
51
|
-
transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' ')
|
|
52
|
+
transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' '),
|
|
53
|
+
...style
|
|
52
54
|
},
|
|
53
55
|
dataSet: dataSet,
|
|
54
56
|
children: iconContent
|
|
@@ -67,7 +69,18 @@ const iconComponentPropTypes = {
|
|
|
67
69
|
/**
|
|
68
70
|
* controls whether the icon size should be proportionate to any accessibility-related font scaling.
|
|
69
71
|
*/
|
|
70
|
-
scalesWithText: _propTypes.default.bool
|
|
72
|
+
scalesWithText: _propTypes.default.bool,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Custom style object to be applied to the icon component.
|
|
76
|
+
* This is useful for overriding the default icon style but for cases where desires styles are not available as tokens.
|
|
77
|
+
*
|
|
78
|
+
* Note: This prop is only used in web.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* <Icon style={{ color: 'red' }}
|
|
82
|
+
*/
|
|
83
|
+
style: _propTypes.default.object
|
|
71
84
|
};
|
|
72
85
|
exports.iconComponentPropTypes = iconComponentPropTypes;
|
|
73
86
|
Icon.propTypes = { ...iconComponentPropTypes,
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -225,10 +225,11 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
225
225
|
iconPosition: iconPosition,
|
|
226
226
|
space: iconSpace,
|
|
227
227
|
iconProps: { ...iconProps,
|
|
228
|
-
tokens: iconTokens
|
|
228
|
+
tokens: iconTokens,
|
|
229
|
+
style: staticStyles.bubblePointerEvents
|
|
229
230
|
},
|
|
230
231
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
231
|
-
style: [textStyles, blockTextStyles, staticStyles.baseline],
|
|
232
|
+
style: [textStyles, blockTextStyles, staticStyles.baseline, staticStyles.bubblePointerEvents],
|
|
232
233
|
children: typeof children === 'function' ? children(linkState) : children
|
|
233
234
|
})
|
|
234
235
|
});
|
|
@@ -287,6 +288,12 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
287
288
|
},
|
|
288
289
|
baseline: {
|
|
289
290
|
alignSelf: 'baseline'
|
|
291
|
+
},
|
|
292
|
+
bubblePointerEvents: { ..._Platform.default.select({
|
|
293
|
+
web: {
|
|
294
|
+
pointerEvents: 'none'
|
|
295
|
+
}
|
|
296
|
+
})
|
|
290
297
|
}
|
|
291
298
|
});
|
|
292
299
|
|
package/lib/Tooltip/Tooltip.js
CHANGED
|
@@ -153,6 +153,7 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
153
153
|
tokens,
|
|
154
154
|
variant,
|
|
155
155
|
inline = false,
|
|
156
|
+
nativeID,
|
|
156
157
|
...rest
|
|
157
158
|
} = _ref6;
|
|
158
159
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
@@ -265,6 +266,7 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
265
266
|
hitSlop: pressableHitSlop,
|
|
266
267
|
accessibilityLabel: getCopy('a11yText'),
|
|
267
268
|
accessibilityRole: "button",
|
|
269
|
+
nativeID: nativeID,
|
|
268
270
|
children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
|
|
269
271
|
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
270
272
|
ref: floating,
|
|
@@ -182,6 +182,7 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
182
182
|
tokens,
|
|
183
183
|
variant,
|
|
184
184
|
inline = false,
|
|
185
|
+
nativeID,
|
|
185
186
|
...rest
|
|
186
187
|
} = _ref6;
|
|
187
188
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
@@ -317,6 +318,7 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
317
318
|
hitSlop: pressableHitSlop,
|
|
318
319
|
accessibilityLabel: getCopy('a11yText'),
|
|
319
320
|
accessibilityRole: "button",
|
|
321
|
+
nativeID: nativeID,
|
|
320
322
|
children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
|
|
321
323
|
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
|
|
322
324
|
onPress: close,
|
package/lib/Tooltip/shared.js
CHANGED
|
@@ -42,6 +42,11 @@ const propTypes = {
|
|
|
42
42
|
* Callback function triggered when the tooltip is pressed.
|
|
43
43
|
*/
|
|
44
44
|
onPress: _propTypes.default.func,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The `id` of the tooltip button.
|
|
48
|
+
*/
|
|
49
|
+
nativeID: _propTypes.default.string,
|
|
45
50
|
tokens: (0, _utils.getTokensPropType)('Tooltip'),
|
|
46
51
|
variant: _utils.variantProp.propType
|
|
47
52
|
};
|
|
@@ -9,6 +9,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
11
|
|
|
12
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
13
|
+
|
|
14
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
15
|
+
|
|
12
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
17
|
|
|
14
18
|
var _ThemeProvider = require("../ThemeProvider");
|
|
@@ -69,7 +73,7 @@ const TooltipButton = _ref3 => {
|
|
|
69
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
70
74
|
style: [(0, _ThemeProvider.applyOuterBorder)(themeTokens), themeTokens.outerBorderWidth && {
|
|
71
75
|
margin: -themeTokens.outerBorderWidth
|
|
72
|
-
}],
|
|
76
|
+
}, staticStyles.bubblePointerEvents],
|
|
73
77
|
...selectProps(rest),
|
|
74
78
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
75
79
|
style: selectInnerContainerStyles(themeTokens),
|
|
@@ -81,6 +85,15 @@ const TooltipButton = _ref3 => {
|
|
|
81
85
|
});
|
|
82
86
|
};
|
|
83
87
|
|
|
88
|
+
const staticStyles = _StyleSheet.default.create({
|
|
89
|
+
bubblePointerEvents: { ..._Platform.default.select({
|
|
90
|
+
web: {
|
|
91
|
+
pointerEvents: 'none'
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
84
97
|
TooltipButton.propTypes = { ...selectedSystemPropTypes,
|
|
85
98
|
|
|
86
99
|
/**
|
package/lib-module/Icon/Icon.js
CHANGED
|
@@ -12,6 +12,7 @@ const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
12
12
|
variant,
|
|
13
13
|
tokens,
|
|
14
14
|
scalesWithText = false,
|
|
15
|
+
style = {},
|
|
15
16
|
dataSet
|
|
16
17
|
} = _ref;
|
|
17
18
|
const themeTokens = useThemeTokens('Icon', tokens, variant);
|
|
@@ -30,7 +31,8 @@ const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
30
31
|
// TODO: systematise animations.
|
|
31
32
|
// https://github.com/telus/universal-design-system/issues/487
|
|
32
33
|
transition: 'transform 200ms, color 200ms',
|
|
33
|
-
transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' ')
|
|
34
|
+
transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' '),
|
|
35
|
+
...style
|
|
34
36
|
},
|
|
35
37
|
dataSet: dataSet,
|
|
36
38
|
children: iconContent
|
|
@@ -49,7 +51,18 @@ export const iconComponentPropTypes = {
|
|
|
49
51
|
/**
|
|
50
52
|
* controls whether the icon size should be proportionate to any accessibility-related font scaling.
|
|
51
53
|
*/
|
|
52
|
-
scalesWithText: PropTypes.bool
|
|
54
|
+
scalesWithText: PropTypes.bool,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Custom style object to be applied to the icon component.
|
|
58
|
+
* This is useful for overriding the default icon style but for cases where desires styles are not available as tokens.
|
|
59
|
+
*
|
|
60
|
+
* Note: This prop is only used in web.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* <Icon style={{ color: 'red' }}
|
|
64
|
+
*/
|
|
65
|
+
style: PropTypes.object
|
|
53
66
|
};
|
|
54
67
|
Icon.propTypes = { ...iconComponentPropTypes,
|
|
55
68
|
|
|
@@ -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);
|
|
@@ -127,6 +127,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
127
127
|
tokens,
|
|
128
128
|
variant,
|
|
129
129
|
inline = false,
|
|
130
|
+
nativeID,
|
|
130
131
|
...rest
|
|
131
132
|
} = _ref6;
|
|
132
133
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -239,6 +240,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
239
240
|
hitSlop: pressableHitSlop,
|
|
240
241
|
accessibilityLabel: getCopy('a11yText'),
|
|
241
242
|
accessibilityRole: "button",
|
|
243
|
+
nativeID: nativeID,
|
|
242
244
|
children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
|
|
243
245
|
}), isOpen && /*#__PURE__*/_jsxs(View, {
|
|
244
246
|
ref: floating,
|
|
@@ -154,6 +154,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
154
154
|
tokens,
|
|
155
155
|
variant,
|
|
156
156
|
inline = false,
|
|
157
|
+
nativeID,
|
|
157
158
|
...rest
|
|
158
159
|
} = _ref6;
|
|
159
160
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -288,6 +289,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
288
289
|
hitSlop: pressableHitSlop,
|
|
289
290
|
accessibilityLabel: getCopy('a11yText'),
|
|
290
291
|
accessibilityRole: "button",
|
|
292
|
+
nativeID: nativeID,
|
|
291
293
|
children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
|
|
292
294
|
}), isOpen && /*#__PURE__*/_jsx(Backdrop, {
|
|
293
295
|
onPress: close,
|
|
@@ -31,6 +31,11 @@ const propTypes = {
|
|
|
31
31
|
* Callback function triggered when the tooltip is pressed.
|
|
32
32
|
*/
|
|
33
33
|
onPress: PropTypes.func,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The `id` of the tooltip button.
|
|
37
|
+
*/
|
|
38
|
+
nativeID: PropTypes.string,
|
|
34
39
|
tokens: getTokensPropType('Tooltip'),
|
|
35
40
|
variant: variantProp.propType
|
|
36
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 = {
|
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/Tooltip/Tooltip.jsx
CHANGED
|
@@ -92,6 +92,7 @@ const Tooltip = forwardRef(
|
|
|
92
92
|
tokens,
|
|
93
93
|
variant,
|
|
94
94
|
inline = false,
|
|
95
|
+
nativeID,
|
|
95
96
|
...rest
|
|
96
97
|
},
|
|
97
98
|
ref
|
|
@@ -193,6 +194,7 @@ const Tooltip = forwardRef(
|
|
|
193
194
|
hitSlop={pressableHitSlop}
|
|
194
195
|
accessibilityLabel={getCopy('a11yText')}
|
|
195
196
|
accessibilityRole="button"
|
|
197
|
+
nativeID={nativeID}
|
|
196
198
|
>
|
|
197
199
|
{typeof control === 'function'
|
|
198
200
|
? (pressableState) => control(getPressableState(pressableState), variant)
|
|
@@ -118,6 +118,7 @@ const Tooltip = forwardRef(
|
|
|
118
118
|
tokens,
|
|
119
119
|
variant,
|
|
120
120
|
inline = false,
|
|
121
|
+
nativeID,
|
|
121
122
|
...rest
|
|
122
123
|
},
|
|
123
124
|
ref
|
|
@@ -252,6 +253,7 @@ const Tooltip = forwardRef(
|
|
|
252
253
|
hitSlop={pressableHitSlop}
|
|
253
254
|
accessibilityLabel={getCopy('a11yText')}
|
|
254
255
|
accessibilityRole="button"
|
|
256
|
+
nativeID={nativeID}
|
|
255
257
|
>
|
|
256
258
|
{typeof control === 'function'
|
|
257
259
|
? (pressableState) => control(getPressableState(pressableState), variant)
|
package/src/Tooltip/shared.js
CHANGED
|
@@ -28,6 +28,10 @@ const propTypes = {
|
|
|
28
28
|
* Callback function triggered when the tooltip is pressed.
|
|
29
29
|
*/
|
|
30
30
|
onPress: PropTypes.func,
|
|
31
|
+
/**
|
|
32
|
+
* The `id` of the tooltip button.
|
|
33
|
+
*/
|
|
34
|
+
nativeID: PropTypes.string,
|
|
31
35
|
tokens: getTokensPropType('Tooltip'),
|
|
32
36
|
variant: variantProp.propType
|
|
33
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { View } from 'react-native'
|
|
2
|
+
import { View, StyleSheet, Platform } from 'react-native'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import { useThemeTokens, applyOuterBorder } from '../ThemeProvider'
|
|
5
5
|
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils'
|
|
@@ -35,7 +35,8 @@ const TooltipButton = ({ pressableState, tokens, variant, ...rest }) => {
|
|
|
35
35
|
applyOuterBorder(themeTokens),
|
|
36
36
|
themeTokens.outerBorderWidth && {
|
|
37
37
|
margin: -themeTokens.outerBorderWidth
|
|
38
|
-
}
|
|
38
|
+
},
|
|
39
|
+
staticStyles.bubblePointerEvents
|
|
39
40
|
]}
|
|
40
41
|
{...selectProps(rest)}
|
|
41
42
|
>
|
|
@@ -46,6 +47,16 @@ const TooltipButton = ({ pressableState, tokens, variant, ...rest }) => {
|
|
|
46
47
|
)
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
const staticStyles = StyleSheet.create({
|
|
51
|
+
bubblePointerEvents: {
|
|
52
|
+
...Platform.select({
|
|
53
|
+
web: {
|
|
54
|
+
pointerEvents: 'none'
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
49
60
|
TooltipButton.propTypes = {
|
|
50
61
|
...selectedSystemPropTypes,
|
|
51
62
|
/**
|