@telus-uds/components-base 1.59.2 → 1.60.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 +18 -2
- package/component-docs.json +245 -6
- package/lib/Button/ButtonLink.js +7 -3
- package/lib/ExpandCollapse/Panel.js +7 -0
- package/lib/IconButton/IconButton.js +8 -0
- package/lib/Link/ChevronLink.js +9 -2
- package/lib/Link/LinkBase.js +14 -0
- package/lib/Link/TextButton.js +12 -1
- package/lib/Pagination/dictionary.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +2 -2
- package/lib/SideNav/Item.js +15 -5
- package/lib/Tags/Tags.js +6 -1
- package/lib/Tooltip/Tooltip.js +6 -1
- package/lib/Tooltip/Tooltip.native.js +6 -1
- package/lib/Tooltip/shared.js +5 -0
- package/lib-module/Button/ButtonLink.js +4 -1
- package/lib-module/ExpandCollapse/Panel.js +7 -0
- package/lib-module/IconButton/IconButton.js +8 -0
- package/lib-module/Link/ChevronLink.js +10 -3
- package/lib-module/Link/LinkBase.js +14 -0
- package/lib-module/Link/TextButton.js +11 -1
- package/lib-module/Pagination/dictionary.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +2 -2
- package/lib-module/SideNav/Item.js +15 -5
- package/lib-module/Tags/Tags.js +6 -1
- package/lib-module/Tooltip/Tooltip.js +6 -1
- package/lib-module/Tooltip/Tooltip.native.js +6 -1
- package/lib-module/Tooltip/shared.js +5 -0
- package/package.json +2 -2
- package/src/Button/ButtonLink.jsx +4 -1
- package/src/ExpandCollapse/Panel.jsx +11 -1
- package/src/IconButton/IconButton.jsx +7 -0
- package/src/Link/ChevronLink.jsx +10 -3
- package/src/Link/LinkBase.jsx +11 -0
- package/src/Link/TextButton.jsx +8 -2
- package/src/Pagination/dictionary.js +3 -3
- package/src/Progress/ProgressBarBackground.jsx +2 -2
- package/src/SideNav/Item.jsx +13 -5
- package/src/Tags/Tags.jsx +5 -1
- package/src/Tooltip/Tooltip.jsx +16 -2
- package/src/Tooltip/Tooltip.native.jsx +15 -2
- package/src/Tooltip/shared.js +4 -0
package/lib/Tooltip/shared.js
CHANGED
|
@@ -32,6 +32,11 @@ const propTypes = {
|
|
|
32
32
|
* Use to place the tooltip in a specific location (only if it fits within viewport).
|
|
33
33
|
*/
|
|
34
34
|
position: _propTypes.default.oneOf(['auto', 'above', 'right', 'below', 'left']),
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Display tooltip icon button as an inline element.
|
|
38
|
+
*/
|
|
39
|
+
inline: _propTypes.default.bool,
|
|
35
40
|
tokens: (0, _utils.getTokensPropType)('Tooltip'),
|
|
36
41
|
variant: _utils.variantProp.propType
|
|
37
42
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import ButtonBase from './ButtonBase';
|
|
3
4
|
import buttonPropTypes, { textAndA11yText } from './propTypes';
|
|
4
5
|
import { a11yProps, hrefAttrsProp, linkProps } from '../utils/props';
|
|
@@ -41,6 +42,8 @@ ButtonLink.displayName = 'ButtonLink';
|
|
|
41
42
|
ButtonLink.propTypes = { ...a11yProps.types,
|
|
42
43
|
...buttonPropTypes,
|
|
43
44
|
...linkProps.types,
|
|
44
|
-
children: textAndA11yText
|
|
45
|
+
children: textAndA11yText,
|
|
46
|
+
dataSet: PropTypes.object,
|
|
47
|
+
accessibilityRole: PropTypes.string
|
|
45
48
|
};
|
|
46
49
|
export default ButtonLink;
|
|
@@ -159,6 +159,13 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
|
159
159
|
...focusabilityProps,
|
|
160
160
|
children: /*#__PURE__*/_jsx(View, {
|
|
161
161
|
onLayout: onContainerLayout,
|
|
162
|
+
style: { ...Platform.select({
|
|
163
|
+
default: {
|
|
164
|
+
flex: 1
|
|
165
|
+
},
|
|
166
|
+
web: {}
|
|
167
|
+
})
|
|
168
|
+
},
|
|
162
169
|
children: /*#__PURE__*/_jsx(View, {
|
|
163
170
|
style: selectContainerStyles(themeTokens),
|
|
164
171
|
children: children
|
|
@@ -106,6 +106,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
106
106
|
icon: IconComponent,
|
|
107
107
|
href,
|
|
108
108
|
hrefAttrs,
|
|
109
|
+
testID,
|
|
109
110
|
accessibilityRole = href ? 'link' : 'button',
|
|
110
111
|
...rawRest
|
|
111
112
|
} = _ref3;
|
|
@@ -141,6 +142,7 @@ const IconButton = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
141
142
|
hrefAttrs: hrefAttrs,
|
|
142
143
|
style: getOuterStyle,
|
|
143
144
|
...selectedProps,
|
|
145
|
+
testID: testID,
|
|
144
146
|
children: pressableState => {
|
|
145
147
|
const themeTokens = getTokens(resolvePressableState(pressableState));
|
|
146
148
|
return /*#__PURE__*/_jsx(View, {
|
|
@@ -160,6 +162,12 @@ IconButton.propTypes = { ...selectedSystemPropTypes,
|
|
|
160
162
|
variant: variantProp.propType,
|
|
161
163
|
tokens: getTokensPropType('IconButton'),
|
|
162
164
|
|
|
165
|
+
/**
|
|
166
|
+
* A unique identifier for testing purposes.
|
|
167
|
+
* Will be added as a `data-testid` attribute.
|
|
168
|
+
*/
|
|
169
|
+
testID: PropTypes.string,
|
|
170
|
+
|
|
163
171
|
/**
|
|
164
172
|
* Defines the icon to be rendered
|
|
165
173
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
4
|
-
import { selectTokens, getTokensPropType } from '../utils';
|
|
4
|
+
import { selectTokens, getTokensPropType, linkProps } from '../utils';
|
|
5
5
|
import LinkBase from './LinkBase';
|
|
6
6
|
/**
|
|
7
7
|
* `ChevronLink` is a convenience wrapper around the `Link` component to enable "directional" links.
|
|
@@ -18,7 +18,7 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
18
|
tokens = {},
|
|
19
19
|
variant,
|
|
20
20
|
dataSet,
|
|
21
|
-
...
|
|
21
|
+
...otherlinkProps
|
|
22
22
|
} = _ref;
|
|
23
23
|
const getChevronTokens = useThemeTokensCallback('ChevronLink', tokens, variant);
|
|
24
24
|
|
|
@@ -41,7 +41,7 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const getTokens = useThemeTokensCallback('Link', applyChevronTokens, variant);
|
|
44
|
-
return /*#__PURE__*/_jsx(LinkBase, { ...
|
|
44
|
+
return /*#__PURE__*/_jsx(LinkBase, { ...otherlinkProps,
|
|
45
45
|
iconPosition: direction,
|
|
46
46
|
tokens: getTokens,
|
|
47
47
|
dataSet: dataSet,
|
|
@@ -51,6 +51,13 @@ const ChevronLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
51
51
|
});
|
|
52
52
|
ChevronLink.displayName = 'ChevronLink';
|
|
53
53
|
ChevronLink.propTypes = { ...LinkBase.propTypes,
|
|
54
|
+
children: PropTypes.node,
|
|
55
|
+
variant: PropTypes.exact({
|
|
56
|
+
size: PropTypes.oneOf(['large', 'small', 'micro']),
|
|
57
|
+
alternative: PropTypes.bool,
|
|
58
|
+
inverse: PropTypes.bool
|
|
59
|
+
}),
|
|
60
|
+
...linkProps.types,
|
|
54
61
|
tokens: getTokensPropType('ChevronLink', 'Link'),
|
|
55
62
|
|
|
56
63
|
/**
|
|
@@ -210,6 +210,20 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
210
210
|
LinkBase.displayName = 'LinkBase';
|
|
211
211
|
LinkBase.propTypes = { ...selectedSystemPropTypes,
|
|
212
212
|
tokens: getTokensPropType('Link'),
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* href for the Link
|
|
216
|
+
*/
|
|
217
|
+
href: PropTypes.string,
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* AccesibilityRole for the link base
|
|
221
|
+
*/
|
|
222
|
+
accessibilityrole: PropTypes.string,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Children nodes that can be added
|
|
226
|
+
*/
|
|
213
227
|
variant: variantProp.propType,
|
|
214
228
|
|
|
215
229
|
/**
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
4
4
|
import LinkBase from './LinkBase';
|
|
5
|
+
import { variantProp } from '../utils';
|
|
5
6
|
/**
|
|
6
7
|
* `TextButton` is a button that looks like a Link. It uses the same theming and variants as
|
|
7
8
|
* Link but has the accessibility role of a `Button`. It should be used for actions that
|
|
@@ -30,6 +31,15 @@ const TextButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
30
31
|
});
|
|
31
32
|
TextButton.displayName = 'TextButton';
|
|
32
33
|
TextButton.propTypes = { ...LinkBase.propTypes,
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
/** onPress function */
|
|
36
|
+
onPress: PropTypes.func.isRequired,
|
|
37
|
+
|
|
38
|
+
/** Children node that can be added */
|
|
39
|
+
children: PropTypes.node.isRequired,
|
|
40
|
+
variant: variantProp.propType,
|
|
41
|
+
|
|
42
|
+
/** Accesibility role for TextButton */
|
|
43
|
+
accessibilityRole: PropTypes.string
|
|
34
44
|
};
|
|
35
45
|
export default TextButton;
|
|
@@ -8,11 +8,11 @@ export default {
|
|
|
8
8
|
nextText: 'Next'
|
|
9
9
|
},
|
|
10
10
|
fr: {
|
|
11
|
-
goToLabel: 'Aller
|
|
11
|
+
goToLabel: 'Aller à la page n°',
|
|
12
12
|
currentLabel: '(page actuelle)',
|
|
13
|
-
previousLabel: 'Aller
|
|
13
|
+
previousLabel: 'Aller à la page précédente',
|
|
14
14
|
previousText: 'Précédent',
|
|
15
|
-
nextLabel: 'Aller
|
|
15
|
+
nextLabel: 'Aller à la page suivante',
|
|
16
16
|
nextText: 'Suivant'
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -3,8 +3,8 @@ import ImageBackground from "react-native-web/dist/exports/ImageBackground";
|
|
|
3
3
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
4
|
import { variantProp } from '../utils';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='
|
|
7
|
-
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='
|
|
6
|
+
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='inactive' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23inactive");'%3E%3C/path%3E%3C/svg%3E`;
|
|
7
|
+
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='negative' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='1' shape-rendering='auto' stroke='rgba(255, 255, 255, 0.4)' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23negative");'%3E%3C/path%3E%3C/svg%3E`;
|
|
8
8
|
const ProgressBarBackground = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9
9
|
let {
|
|
10
10
|
variant
|
|
@@ -116,13 +116,13 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
116
116
|
children: PropTypes.node.isRequired,
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
*
|
|
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
|
+
*
|
|
126
126
|
* Set internally in `SideNav` render function - used to keep track of expanded items groups.
|
|
127
127
|
*/
|
|
128
128
|
groupId: PropTypes.string,
|
|
@@ -136,17 +136,27 @@ Item.propTypes = { ...selectedSystemPropTypes,
|
|
|
136
136
|
hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
*
|
|
140
140
|
* Set internally in `SideNav` render function.
|
|
141
141
|
*/
|
|
142
142
|
isActive: PropTypes.bool,
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
145
|
+
*
|
|
146
146
|
* Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
|
|
147
147
|
*/
|
|
148
148
|
isExpanded: PropTypes.bool,
|
|
149
149
|
tokens: getTokensPropType('SideNavItem'),
|
|
150
|
-
variant: variantProp.propType
|
|
150
|
+
variant: variantProp.propType,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Accesibility Role
|
|
154
|
+
*/
|
|
155
|
+
accessibilityRole: PropTypes.string,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* test ID
|
|
159
|
+
*/
|
|
160
|
+
testID: PropTypes.number
|
|
151
161
|
};
|
|
152
162
|
export default Item;
|
package/lib-module/Tags/Tags.js
CHANGED
|
@@ -252,6 +252,11 @@ Tags.propTypes = { ...selectedSystemPropTypes,
|
|
|
252
252
|
* managing its own selected state, a default set of selections may be provided.
|
|
253
253
|
* Changing the `initialValues` does not change the user's selections.
|
|
254
254
|
*/
|
|
255
|
-
initialValues: PropTypes.arrayOf(PropTypes.string)
|
|
255
|
+
initialValues: PropTypes.arrayOf(PropTypes.string),
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* AccesibilityRole for the Tags
|
|
259
|
+
*/
|
|
260
|
+
accessibilityRole: PropTypes.string
|
|
256
261
|
};
|
|
257
262
|
export default Tags;
|
|
@@ -125,6 +125,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
125
125
|
copy = 'en',
|
|
126
126
|
tokens,
|
|
127
127
|
variant,
|
|
128
|
+
inline = false,
|
|
128
129
|
...rest
|
|
129
130
|
} = _ref6;
|
|
130
131
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -219,7 +220,11 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
219
220
|
right: 10
|
|
220
221
|
} : undefined;
|
|
221
222
|
return /*#__PURE__*/_jsxs(View, {
|
|
222
|
-
style: staticStyles.container,
|
|
223
|
+
style: [staticStyles.container, Platform.select({
|
|
224
|
+
web: {
|
|
225
|
+
display: inline ? 'inline-block' : 'flex'
|
|
226
|
+
}
|
|
227
|
+
})],
|
|
223
228
|
...selectProps(rest),
|
|
224
229
|
ref: ref,
|
|
225
230
|
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
@@ -152,6 +152,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
152
152
|
copy = 'en',
|
|
153
153
|
tokens,
|
|
154
154
|
variant,
|
|
155
|
+
inline = false,
|
|
155
156
|
...rest
|
|
156
157
|
} = _ref6;
|
|
157
158
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -269,7 +270,11 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
269
270
|
right: 10
|
|
270
271
|
} : undefined;
|
|
271
272
|
return /*#__PURE__*/_jsxs(View, {
|
|
272
|
-
style: staticStyles.container,
|
|
273
|
+
style: [staticStyles.container, Platform.select({
|
|
274
|
+
web: {
|
|
275
|
+
display: inline ? 'inline-block' : 'flex'
|
|
276
|
+
}
|
|
277
|
+
})],
|
|
273
278
|
...selectProps(rest),
|
|
274
279
|
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
275
280
|
onPress: toggleIsOpen,
|
|
@@ -21,6 +21,11 @@ const propTypes = {
|
|
|
21
21
|
* Use to place the tooltip in a specific location (only if it fits within viewport).
|
|
22
22
|
*/
|
|
23
23
|
position: PropTypes.oneOf(['auto', 'above', 'right', 'below', 'left']),
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Display tooltip icon button as an inline element.
|
|
27
|
+
*/
|
|
28
|
+
inline: PropTypes.bool,
|
|
24
29
|
tokens: getTokensPropType('Tooltip'),
|
|
25
30
|
variant: variantProp.propType
|
|
26
31
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@floating-ui/react-native": "^0.8.1",
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@telus-uds/system-constants": "^1.3.0",
|
|
14
|
-
"@telus-uds/system-theme-tokens": "^2.41.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.41.1",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"lodash.debounce": "^4.0.8",
|
|
17
17
|
"lodash.merge": "^4.6.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"standard-engine": {
|
|
73
73
|
"skip": true
|
|
74
74
|
},
|
|
75
|
-
"version": "1.
|
|
75
|
+
"version": "1.60.0"
|
|
76
76
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
2
3
|
import ButtonBase from './ButtonBase'
|
|
3
4
|
import buttonPropTypes, { textAndA11yText } from './propTypes'
|
|
4
5
|
import { a11yProps, hrefAttrsProp, linkProps } from '../utils/props'
|
|
@@ -33,7 +34,9 @@ ButtonLink.propTypes = {
|
|
|
33
34
|
...a11yProps.types,
|
|
34
35
|
...buttonPropTypes,
|
|
35
36
|
...linkProps.types,
|
|
36
|
-
children: textAndA11yText
|
|
37
|
+
children: textAndA11yText,
|
|
38
|
+
dataSet: PropTypes.object,
|
|
39
|
+
accessibilityRole: PropTypes.string
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
export default ButtonLink
|
|
@@ -157,7 +157,17 @@ const ExpandCollapsePanel = forwardRef(
|
|
|
157
157
|
/>
|
|
158
158
|
)}
|
|
159
159
|
<Animated.View ref={animatedRef} style={animatedStyles} {...focusabilityProps}>
|
|
160
|
-
<View
|
|
160
|
+
<View
|
|
161
|
+
onLayout={onContainerLayout}
|
|
162
|
+
style={{
|
|
163
|
+
...Platform.select({
|
|
164
|
+
default: {
|
|
165
|
+
flex: 1
|
|
166
|
+
},
|
|
167
|
+
web: {}
|
|
168
|
+
})
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
161
171
|
<View style={selectContainerStyles(themeTokens)}>{children}</View>
|
|
162
172
|
</View>
|
|
163
173
|
</Animated.View>
|
|
@@ -107,6 +107,7 @@ const IconButton = forwardRef(
|
|
|
107
107
|
icon: IconComponent,
|
|
108
108
|
href,
|
|
109
109
|
hrefAttrs,
|
|
110
|
+
testID,
|
|
110
111
|
accessibilityRole = href ? 'link' : 'button',
|
|
111
112
|
...rawRest
|
|
112
113
|
},
|
|
@@ -133,6 +134,7 @@ const IconButton = forwardRef(
|
|
|
133
134
|
hrefAttrs={hrefAttrs}
|
|
134
135
|
style={getOuterStyle}
|
|
135
136
|
{...selectedProps}
|
|
137
|
+
testID={testID}
|
|
136
138
|
>
|
|
137
139
|
{(pressableState) => {
|
|
138
140
|
const themeTokens = getTokens(resolvePressableState(pressableState))
|
|
@@ -157,6 +159,11 @@ IconButton.propTypes = {
|
|
|
157
159
|
...selectedSystemPropTypes,
|
|
158
160
|
variant: variantProp.propType,
|
|
159
161
|
tokens: getTokensPropType('IconButton'),
|
|
162
|
+
/**
|
|
163
|
+
* A unique identifier for testing purposes.
|
|
164
|
+
* Will be added as a `data-testid` attribute.
|
|
165
|
+
*/
|
|
166
|
+
testID: PropTypes.string,
|
|
160
167
|
/**
|
|
161
168
|
* Defines the icon to be rendered
|
|
162
169
|
*/
|
package/src/Link/ChevronLink.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
4
|
import { useThemeTokensCallback } from '../ThemeProvider'
|
|
5
|
-
import { selectTokens, getTokensPropType } from '../utils'
|
|
5
|
+
import { selectTokens, getTokensPropType, linkProps } from '../utils'
|
|
6
6
|
import LinkBase from './LinkBase'
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -12,7 +12,7 @@ import LinkBase from './LinkBase'
|
|
|
12
12
|
* ChevronLink is not intended to be deeply themable; variants passed to ChevronLink are forwarded to Link.
|
|
13
13
|
*/
|
|
14
14
|
const ChevronLink = forwardRef(
|
|
15
|
-
({ direction = 'right', children, tokens = {}, variant, dataSet, ...
|
|
15
|
+
({ direction = 'right', children, tokens = {}, variant, dataSet, ...otherlinkProps }, ref) => {
|
|
16
16
|
const getChevronTokens = useThemeTokensCallback('ChevronLink', tokens, variant)
|
|
17
17
|
const applyChevronTokens = (linkState) => {
|
|
18
18
|
const { leftIcon, rightIcon, iconDisplace, height, fontSize, ...otherTokens } =
|
|
@@ -32,7 +32,7 @@ const ChevronLink = forwardRef(
|
|
|
32
32
|
const getTokens = useThemeTokensCallback('Link', applyChevronTokens, variant)
|
|
33
33
|
return (
|
|
34
34
|
<LinkBase
|
|
35
|
-
{...
|
|
35
|
+
{...otherlinkProps}
|
|
36
36
|
iconPosition={direction}
|
|
37
37
|
tokens={getTokens}
|
|
38
38
|
dataSet={dataSet}
|
|
@@ -47,6 +47,13 @@ const ChevronLink = forwardRef(
|
|
|
47
47
|
ChevronLink.displayName = 'ChevronLink'
|
|
48
48
|
ChevronLink.propTypes = {
|
|
49
49
|
...LinkBase.propTypes,
|
|
50
|
+
children: PropTypes.node,
|
|
51
|
+
variant: PropTypes.exact({
|
|
52
|
+
size: PropTypes.oneOf(['large', 'small', 'micro']),
|
|
53
|
+
alternative: PropTypes.bool,
|
|
54
|
+
inverse: PropTypes.bool
|
|
55
|
+
}),
|
|
56
|
+
...linkProps.types,
|
|
50
57
|
tokens: getTokensPropType('ChevronLink', 'Link'),
|
|
51
58
|
/**
|
|
52
59
|
* Changes direction of chevron icon
|
package/src/Link/LinkBase.jsx
CHANGED
|
@@ -197,6 +197,17 @@ LinkBase.displayName = 'LinkBase'
|
|
|
197
197
|
LinkBase.propTypes = {
|
|
198
198
|
...selectedSystemPropTypes,
|
|
199
199
|
tokens: getTokensPropType('Link'),
|
|
200
|
+
/**
|
|
201
|
+
* href for the Link
|
|
202
|
+
*/
|
|
203
|
+
href: PropTypes.string,
|
|
204
|
+
/**
|
|
205
|
+
* AccesibilityRole for the link base
|
|
206
|
+
*/
|
|
207
|
+
accessibilityrole: PropTypes.string,
|
|
208
|
+
/**
|
|
209
|
+
* Children nodes that can be added
|
|
210
|
+
*/
|
|
200
211
|
variant: variantProp.propType,
|
|
201
212
|
/**
|
|
202
213
|
* Optional variant that may be passed down to the link's icon if there is one
|
package/src/Link/TextButton.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
|
|
4
3
|
import { useThemeTokensCallback } from '../ThemeProvider'
|
|
5
4
|
import LinkBase from './LinkBase'
|
|
5
|
+
import { variantProp } from '../utils'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `TextButton` is a button that looks like a Link. It uses the same theming and variants as
|
|
@@ -29,7 +29,13 @@ TextButton.displayName = 'TextButton'
|
|
|
29
29
|
|
|
30
30
|
TextButton.propTypes = {
|
|
31
31
|
...LinkBase.propTypes,
|
|
32
|
-
onPress
|
|
32
|
+
/** onPress function */
|
|
33
|
+
onPress: PropTypes.func.isRequired,
|
|
34
|
+
/** Children node that can be added */
|
|
35
|
+
children: PropTypes.node.isRequired,
|
|
36
|
+
variant: variantProp.propType,
|
|
37
|
+
/** Accesibility role for TextButton */
|
|
38
|
+
accessibilityRole: PropTypes.string
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
export default TextButton
|
|
@@ -8,11 +8,11 @@ export default {
|
|
|
8
8
|
nextText: 'Next'
|
|
9
9
|
},
|
|
10
10
|
fr: {
|
|
11
|
-
goToLabel: 'Aller
|
|
11
|
+
goToLabel: 'Aller à la page n°',
|
|
12
12
|
currentLabel: '(page actuelle)',
|
|
13
|
-
previousLabel: 'Aller
|
|
13
|
+
previousLabel: 'Aller à la page précédente',
|
|
14
14
|
previousText: 'Précédent',
|
|
15
|
-
nextLabel: 'Aller
|
|
15
|
+
nextLabel: 'Aller à la page suivante',
|
|
16
16
|
nextText: 'Suivant'
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -3,8 +3,8 @@ import { ImageBackground, StyleSheet } from 'react-native'
|
|
|
3
3
|
|
|
4
4
|
import { variantProp } from '../utils'
|
|
5
5
|
|
|
6
|
-
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='
|
|
7
|
-
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='
|
|
6
|
+
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='inactive' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23inactive");'%3E%3C/path%3E%3C/svg%3E`
|
|
7
|
+
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='negative' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='1' shape-rendering='auto' stroke='rgba(255, 255, 255, 0.4)' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23negative");'%3E%3C/path%3E%3C/svg%3E`
|
|
8
8
|
const ProgressBarBackground = forwardRef(({ variant }, ref) => {
|
|
9
9
|
let source = null
|
|
10
10
|
if (variant?.inactive) {
|
package/src/SideNav/Item.jsx
CHANGED
|
@@ -111,12 +111,12 @@ Item.propTypes = {
|
|
|
111
111
|
*/
|
|
112
112
|
children: PropTypes.node.isRequired,
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
*
|
|
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
|
+
*
|
|
120
120
|
* Set internally in `SideNav` render function - used to keep track of expanded items groups.
|
|
121
121
|
*/
|
|
122
122
|
groupId: PropTypes.string,
|
|
@@ -128,17 +128,25 @@ Item.propTypes = {
|
|
|
128
128
|
*/
|
|
129
129
|
hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
*
|
|
132
132
|
* Set internally in `SideNav` render function.
|
|
133
133
|
*/
|
|
134
134
|
isActive: PropTypes.bool,
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
*
|
|
137
137
|
* Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
|
|
138
138
|
*/
|
|
139
139
|
isExpanded: PropTypes.bool,
|
|
140
140
|
tokens: getTokensPropType('SideNavItem'),
|
|
141
|
-
variant: variantProp.propType
|
|
141
|
+
variant: variantProp.propType,
|
|
142
|
+
/**
|
|
143
|
+
* Accesibility Role
|
|
144
|
+
*/
|
|
145
|
+
accessibilityRole: PropTypes.string,
|
|
146
|
+
/**
|
|
147
|
+
* test ID
|
|
148
|
+
*/
|
|
149
|
+
testID: PropTypes.number
|
|
142
150
|
}
|
|
143
151
|
|
|
144
152
|
export default Item
|
package/src/Tags/Tags.jsx
CHANGED
|
@@ -249,7 +249,11 @@ Tags.propTypes = {
|
|
|
249
249
|
* managing its own selected state, a default set of selections may be provided.
|
|
250
250
|
* Changing the `initialValues` does not change the user's selections.
|
|
251
251
|
*/
|
|
252
|
-
initialValues: PropTypes.arrayOf(PropTypes.string)
|
|
252
|
+
initialValues: PropTypes.arrayOf(PropTypes.string),
|
|
253
|
+
/**
|
|
254
|
+
* AccesibilityRole for the Tags
|
|
255
|
+
*/
|
|
256
|
+
accessibilityRole: PropTypes.string
|
|
253
257
|
}
|
|
254
258
|
|
|
255
259
|
export default Tags
|
package/src/Tooltip/Tooltip.jsx
CHANGED
|
@@ -82,7 +82,10 @@ const defaultControl = (pressableState, variant) => (
|
|
|
82
82
|
* - Tooltips may also be useful when vertical space is an issue.
|
|
83
83
|
*/
|
|
84
84
|
const Tooltip = forwardRef(
|
|
85
|
-
(
|
|
85
|
+
(
|
|
86
|
+
{ children, content, position = 'auto', copy = 'en', tokens, variant, inline = false, ...rest },
|
|
87
|
+
ref
|
|
88
|
+
) => {
|
|
86
89
|
const [isOpen, setIsOpen] = useState(false)
|
|
87
90
|
const arrowRef = useRef()
|
|
88
91
|
|
|
@@ -157,7 +160,18 @@ const Tooltip = forwardRef(
|
|
|
157
160
|
control === defaultControl ? { top: 10, bottom: 10, left: 10, right: 10 } : undefined
|
|
158
161
|
|
|
159
162
|
return (
|
|
160
|
-
<View
|
|
163
|
+
<View
|
|
164
|
+
style={[
|
|
165
|
+
staticStyles.container,
|
|
166
|
+
Platform.select({
|
|
167
|
+
web: {
|
|
168
|
+
display: inline ? 'inline-block' : 'flex'
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
]}
|
|
172
|
+
{...selectProps(rest)}
|
|
173
|
+
ref={ref}
|
|
174
|
+
>
|
|
161
175
|
<Pressable
|
|
162
176
|
onPress={toggleIsOpen}
|
|
163
177
|
ref={reference}
|
|
@@ -108,7 +108,10 @@ const defaultControl = (pressableState, variant) => (
|
|
|
108
108
|
* - Tooltips may also be useful when vertical space is an issue.
|
|
109
109
|
*/
|
|
110
110
|
const Tooltip = forwardRef(
|
|
111
|
-
(
|
|
111
|
+
(
|
|
112
|
+
{ children, content, position = 'auto', copy = 'en', tokens, variant, inline = false, ...rest },
|
|
113
|
+
ref
|
|
114
|
+
) => {
|
|
112
115
|
const [isOpen, setIsOpen] = useState(false)
|
|
113
116
|
|
|
114
117
|
const controlRef = useRef()
|
|
@@ -217,7 +220,17 @@ const Tooltip = forwardRef(
|
|
|
217
220
|
control === defaultControl ? { top: 10, bottom: 10, left: 10, right: 10 } : undefined
|
|
218
221
|
|
|
219
222
|
return (
|
|
220
|
-
<View
|
|
223
|
+
<View
|
|
224
|
+
style={[
|
|
225
|
+
staticStyles.container,
|
|
226
|
+
Platform.select({
|
|
227
|
+
web: {
|
|
228
|
+
display: inline ? 'inline-block' : 'flex'
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
]}
|
|
232
|
+
{...selectProps(rest)}
|
|
233
|
+
>
|
|
221
234
|
<Pressable
|
|
222
235
|
onPress={toggleIsOpen}
|
|
223
236
|
ref={controlRef}
|
package/src/Tooltip/shared.js
CHANGED
|
@@ -20,6 +20,10 @@ const propTypes = {
|
|
|
20
20
|
* Use to place the tooltip in a specific location (only if it fits within viewport).
|
|
21
21
|
*/
|
|
22
22
|
position: PropTypes.oneOf(['auto', 'above', 'right', 'below', 'left']),
|
|
23
|
+
/**
|
|
24
|
+
* Display tooltip icon button as an inline element.
|
|
25
|
+
*/
|
|
26
|
+
inline: PropTypes.bool,
|
|
23
27
|
tokens: getTokensPropType('Tooltip'),
|
|
24
28
|
variant: variantProp.propType
|
|
25
29
|
}
|