@telus-uds/components-base 2.0.1 → 2.1.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 +28 -7
- package/lib/Card/PressableCardBase.js +2 -1
- package/lib/Carousel/Carousel.js +121 -33
- package/lib/Carousel/CarouselItem/CarouselItem.js +39 -24
- package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +41 -4
- package/lib/Carousel/Constants.js +3 -0
- package/lib/Checkbox/CheckboxGroup.js +4 -2
- package/lib/HorizontalScroll/HorizontalScroll.js +17 -13
- package/lib/Icon/Icon.js +1 -0
- package/lib/InputSupports/InputSupports.js +3 -0
- package/lib/Link/LinkBase.js +2 -2
- package/lib/Modal/Modal.js +4 -0
- package/lib/Modal/ModalContent.js +27 -8
- package/lib/Progress/Progress.js +8 -2
- package/lib/Progress/ProgressBar.js +40 -12
- package/lib/Progress/ProgressBarBackground.js +4 -2
- package/lib/Progress/constants.js +4 -0
- package/lib/Search/Search.js +2 -2
- package/lib/Select/Picker.native.js +1 -0
- package/lib/Select/Select.js +1 -4
- package/lib/Status/Status.js +6 -2
- package/lib/TextInput/TextInputBase.js +2 -2
- package/lib/Tooltip/Tooltip.js +22 -13
- package/lib/Tooltip/Tooltip.native.js +24 -15
- package/lib/Validator/Validator.js +4 -0
- package/lib/utils/props/contentfulProps.js +22 -0
- package/lib/utils/props/index.js +2 -1
- package/package.json +2 -2
- package/src/Card/PressableCardBase.jsx +1 -1
- package/src/Carousel/Carousel.jsx +166 -34
- package/src/Carousel/CarouselItem/CarouselItem.jsx +56 -26
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +71 -37
- package/src/Carousel/Constants.js +3 -0
- package/src/Checkbox/CheckboxGroup.jsx +7 -3
- package/src/HorizontalScroll/HorizontalScroll.jsx +19 -15
- package/src/Icon/Icon.jsx +1 -0
- package/src/InputSupports/InputSupports.jsx +1 -0
- package/src/Link/LinkBase.jsx +8 -2
- package/src/Modal/Modal.jsx +4 -0
- package/src/Modal/ModalContent.jsx +23 -7
- package/src/Progress/Progress.jsx +12 -2
- package/src/Progress/ProgressBar.jsx +48 -13
- package/src/Progress/ProgressBarBackground.jsx +4 -2
- package/src/Progress/constants.js +4 -0
- package/src/Search/Search.jsx +7 -2
- package/src/Select/Picker.native.jsx +1 -0
- package/src/Select/Select.jsx +8 -9
- package/src/Status/Status.jsx +2 -2
- package/src/TextInput/TextInputBase.jsx +2 -2
- package/src/Tooltip/Tooltip.jsx +6 -1
- package/src/Tooltip/Tooltip.native.jsx +7 -1
- package/src/Validator/Validator.jsx +7 -1
- package/src/utils/props/contentfulProps.js +24 -0
- package/src/utils/props/index.js +1 -0
package/lib/Icon/Icon.js
CHANGED
package/lib/Link/LinkBase.js
CHANGED
|
@@ -3,14 +3,14 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import Text from "react-native-web/dist/exports/Text";
|
|
4
4
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
5
5
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
6
|
-
import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, selectSystemProps, variantProp, viewProps } from '../utils/props';
|
|
6
|
+
import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, selectSystemProps, variantProp, viewProps, contentfulProps } from '../utils/props';
|
|
7
7
|
import { resolvePressableTokens } from '../utils/pressability';
|
|
8
8
|
import { withLinkRouter } from '../utils';
|
|
9
9
|
import InlinePressable from './InlinePressable';
|
|
10
10
|
import { applyTextStyles, applyOuterBorder, useTheme } from '../ThemeProvider';
|
|
11
11
|
import { IconText, iconComponentPropTypes } from '../Icon';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
|
|
13
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps, contentfulProps]);
|
|
14
14
|
const selectOuterBorderStyles = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
outerBorderColor,
|
package/lib/Modal/Modal.js
CHANGED
|
@@ -37,7 +37,9 @@ const selectContainerStyles = _ref => {
|
|
|
37
37
|
const selectModalStyles = _ref2 => {
|
|
38
38
|
let {
|
|
39
39
|
backgroundColor,
|
|
40
|
+
borderColor,
|
|
40
41
|
borderRadius,
|
|
42
|
+
borderWidth,
|
|
41
43
|
height,
|
|
42
44
|
paddingLeft,
|
|
43
45
|
paddingRight,
|
|
@@ -47,7 +49,9 @@ const selectModalStyles = _ref2 => {
|
|
|
47
49
|
} = _ref2;
|
|
48
50
|
return {
|
|
49
51
|
backgroundColor,
|
|
52
|
+
borderColor,
|
|
50
53
|
borderRadius,
|
|
54
|
+
borderWidth,
|
|
51
55
|
height,
|
|
52
56
|
paddingLeft,
|
|
53
57
|
paddingRight,
|
|
@@ -55,7 +55,29 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
55
55
|
const hasConfirmButton = confirmButtonText !== undefined && onConfirm !== undefined;
|
|
56
56
|
const hasCancelButton = cancelButtonText !== undefined && onCancel !== undefined;
|
|
57
57
|
const hasHeadingSection = Boolean(heading || subHeading);
|
|
58
|
-
const
|
|
58
|
+
const selectHeadingContainerStyles = _ref3 => {
|
|
59
|
+
let {
|
|
60
|
+
paddingLeft,
|
|
61
|
+
paddingRight,
|
|
62
|
+
marginLeft,
|
|
63
|
+
marginRight,
|
|
64
|
+
borderColor,
|
|
65
|
+
headingBorderBottomWidth,
|
|
66
|
+
headingPaddingRight,
|
|
67
|
+
headingPaddingTop
|
|
68
|
+
} = _ref3;
|
|
69
|
+
return {
|
|
70
|
+
flexDirection: 'column',
|
|
71
|
+
marginLeft: -marginLeft,
|
|
72
|
+
marginRight: -marginRight,
|
|
73
|
+
paddingLeft,
|
|
74
|
+
paddingTop: headingPaddingTop,
|
|
75
|
+
paddingRight: paddingRight + headingPaddingRight,
|
|
76
|
+
borderBottomColor: borderColor,
|
|
77
|
+
borderBottomWidth: headingBorderBottomWidth
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const selectFooterContainerStyles = _ref4 => {
|
|
59
81
|
let {
|
|
60
82
|
paddingLeft,
|
|
61
83
|
paddingRight,
|
|
@@ -67,7 +89,7 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
67
89
|
direction,
|
|
68
90
|
footerTopWidth,
|
|
69
91
|
hasBorder
|
|
70
|
-
} =
|
|
92
|
+
} = _ref4;
|
|
71
93
|
return {
|
|
72
94
|
flexDirection: direction,
|
|
73
95
|
alignItems: 'center',
|
|
@@ -81,11 +103,6 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
81
103
|
borderTopColor: borderColor
|
|
82
104
|
};
|
|
83
105
|
};
|
|
84
|
-
const headingStyles = {
|
|
85
|
-
flexDirection: 'column',
|
|
86
|
-
paddingTop: 8,
|
|
87
|
-
paddingRight: themeTokens.headingPaddingRight
|
|
88
|
-
};
|
|
89
106
|
const subheadingStyles = {
|
|
90
107
|
marginTop: themeTokens.subHeadingMarginTop
|
|
91
108
|
};
|
|
@@ -93,7 +110,7 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
93
110
|
style: styles.modalContent,
|
|
94
111
|
ref: ref,
|
|
95
112
|
children: [hasHeadingSection && /*#__PURE__*/_jsxs(View, {
|
|
96
|
-
style:
|
|
113
|
+
style: selectHeadingContainerStyles(themeTokens),
|
|
97
114
|
children: [heading && /*#__PURE__*/_jsx(Typography, {
|
|
98
115
|
variant: {
|
|
99
116
|
size: headingLevel
|
|
@@ -120,6 +137,8 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
120
137
|
showsVerticalScrollIndicator: true
|
|
121
138
|
},
|
|
122
139
|
onLayout: handleContainerLayout,
|
|
140
|
+
top: themeTokens.contentPaddingTop,
|
|
141
|
+
bottom: themeTokens.contentPaddingBottom,
|
|
123
142
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
124
143
|
children: bodyText
|
|
125
144
|
})
|
package/lib/Progress/Progress.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
5
|
import { applyShadowToken, useThemeTokens } from '../ThemeProvider';
|
|
5
6
|
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -64,7 +65,7 @@ const Progress = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
64
65
|
const themeTokens = useThemeTokens('Progress', tokens, variant);
|
|
65
66
|
return /*#__PURE__*/_jsx(View, {
|
|
66
67
|
ref: ref,
|
|
67
|
-
style: selectProgressStyles(themeTokens),
|
|
68
|
+
style: [staticStyles.progressContainer, selectProgressStyles(themeTokens)],
|
|
68
69
|
...selectProps(rest),
|
|
69
70
|
children: children
|
|
70
71
|
});
|
|
@@ -85,4 +86,9 @@ Progress.propTypes = {
|
|
|
85
86
|
*/
|
|
86
87
|
variant: variantProp.propType
|
|
87
88
|
};
|
|
88
|
-
export default Progress;
|
|
89
|
+
export default Progress;
|
|
90
|
+
const staticStyles = StyleSheet.create({
|
|
91
|
+
progressContainer: {
|
|
92
|
+
position: 'relative'
|
|
93
|
+
}
|
|
94
|
+
});
|
|
@@ -6,9 +6,10 @@ import View from "react-native-web/dist/exports/View";
|
|
|
6
6
|
import ProgressBarBackground from './ProgressBarBackground';
|
|
7
7
|
import { applyShadowToken, useThemeTokens } from '../ThemeProvider';
|
|
8
8
|
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
9
|
+
import { MAX_PERCENT_VALUE, MIN_PERCENT_VALUE } from './constants';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
11
|
-
const selectBarStyles = (_ref,
|
|
12
|
+
const selectBarStyles = (_ref, calculatedPercentage, barPosition) => {
|
|
12
13
|
let {
|
|
13
14
|
backgroundColor,
|
|
14
15
|
borderRadius,
|
|
@@ -22,7 +23,8 @@ const selectBarStyles = (_ref, percentage) => {
|
|
|
22
23
|
outlineWidth,
|
|
23
24
|
outlineColor,
|
|
24
25
|
...applyShadowToken(shadow),
|
|
25
|
-
width: `${
|
|
26
|
+
width: `${calculatedPercentage}%`,
|
|
27
|
+
left: `${barPosition}%`
|
|
26
28
|
};
|
|
27
29
|
};
|
|
28
30
|
|
|
@@ -67,27 +69,45 @@ const ProgressBar = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
67
69
|
percentage = 0,
|
|
68
70
|
tokens,
|
|
69
71
|
variant,
|
|
72
|
+
offset = {
|
|
73
|
+
items: 0,
|
|
74
|
+
current: 1
|
|
75
|
+
},
|
|
70
76
|
...rest
|
|
71
77
|
} = _ref2;
|
|
78
|
+
const {
|
|
79
|
+
items,
|
|
80
|
+
current
|
|
81
|
+
} = offset;
|
|
82
|
+
let calculatedPercentage = percentage;
|
|
83
|
+
let barPosition = MIN_PERCENT_VALUE;
|
|
84
|
+
const validItems = items > MIN_PERCENT_VALUE;
|
|
85
|
+
if (validItems) {
|
|
86
|
+
calculatedPercentage = MAX_PERCENT_VALUE / items;
|
|
87
|
+
barPosition = calculatedPercentage * (current < 1 ? MIN_PERCENT_VALUE : current - 1);
|
|
88
|
+
if (current > items) {
|
|
89
|
+
barPosition = calculatedPercentage * (items - 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
72
92
|
const themeTokens = useThemeTokens('ProgressBar', tokens, variant);
|
|
73
|
-
if (percentage <
|
|
93
|
+
if (percentage < MIN_PERCENT_VALUE) {
|
|
74
94
|
throw new Error('ProgressBar: `percentage` must be a positive number');
|
|
75
|
-
} else if (percentage >
|
|
95
|
+
} else if (percentage > MAX_PERCENT_VALUE) {
|
|
76
96
|
throw new Error('ProgressBar: `percentage` cannot exceed 100');
|
|
77
97
|
}
|
|
78
98
|
const selectedProps = selectProps({
|
|
79
99
|
accessibilityRole: 'progressbar',
|
|
80
100
|
accessibilityValue: {
|
|
81
|
-
min:
|
|
82
|
-
max:
|
|
83
|
-
now:
|
|
84
|
-
text: `${
|
|
101
|
+
min: MIN_PERCENT_VALUE,
|
|
102
|
+
max: MAX_PERCENT_VALUE,
|
|
103
|
+
now: calculatedPercentage.toFixed(2),
|
|
104
|
+
text: `${validItems ? (barPosition + calculatedPercentage).toFixed(2) : calculatedPercentage}%`
|
|
85
105
|
},
|
|
86
106
|
...rest
|
|
87
107
|
});
|
|
88
|
-
return percentage >
|
|
108
|
+
return percentage > MIN_PERCENT_VALUE || items ? /*#__PURE__*/_jsx(View, {
|
|
89
109
|
ref: ref,
|
|
90
|
-
style: [staticStyles.bar, selectBarStyles(themeTokens,
|
|
110
|
+
style: [staticStyles.bar, selectBarStyles(themeTokens, calculatedPercentage, barPosition)],
|
|
91
111
|
...selectedProps,
|
|
92
112
|
children: children ?? /*#__PURE__*/_jsx(ProgressBarBackground, {
|
|
93
113
|
variant: variant
|
|
@@ -116,14 +136,22 @@ ProgressBar.propTypes = {
|
|
|
116
136
|
/**
|
|
117
137
|
* Progress bar variant.
|
|
118
138
|
*/
|
|
119
|
-
variant: variantProp.propType
|
|
139
|
+
variant: variantProp.propType,
|
|
140
|
+
/**
|
|
141
|
+
* Using the offset object, the `items` will determine the total number of items.
|
|
142
|
+
* The `current` will determine the current position of the progress bar.
|
|
143
|
+
*/
|
|
144
|
+
offset: PropTypes.shape({
|
|
145
|
+
items: PropTypes.number,
|
|
146
|
+
current: PropTypes.number
|
|
147
|
+
})
|
|
120
148
|
};
|
|
121
149
|
export default ProgressBar;
|
|
122
150
|
const staticStyles = StyleSheet.create({
|
|
123
151
|
bar: {
|
|
124
152
|
height: '100%',
|
|
125
153
|
overflow: 'hidden',
|
|
126
|
-
position: '
|
|
154
|
+
position: 'relative',
|
|
127
155
|
...Platform.select({
|
|
128
156
|
web: {
|
|
129
157
|
outlineStyle: 'solid'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ImageBackground from "react-native-web/dist/exports/ImageBackground";
|
|
3
3
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
|
+
import { INACTIVE_VARIANT, NEGATIVE_VARIANT } from './constants';
|
|
4
5
|
import { variantProp } from '../utils';
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
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`;
|
|
@@ -10,9 +11,10 @@ const ProgressBarBackground = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
10
11
|
variant
|
|
11
12
|
} = _ref;
|
|
12
13
|
let source = null;
|
|
13
|
-
|
|
14
|
+
// TODO: Remove the `variant?.inactive` & `variant?.negative` to complete the deprecation
|
|
15
|
+
if (variant !== null && variant !== void 0 && variant.inactive || (variant === null || variant === void 0 ? void 0 : variant.style) === INACTIVE_VARIANT) {
|
|
14
16
|
source = inactiveBackground;
|
|
15
|
-
} else if (variant !== null && variant !== void 0 && variant.negative) {
|
|
17
|
+
} else if (variant !== null && variant !== void 0 && variant.negative || (variant === null || variant === void 0 ? void 0 : variant.style) === NEGATIVE_VARIANT) {
|
|
16
18
|
source = negativeBackground;
|
|
17
19
|
} else {
|
|
18
20
|
return null;
|
package/lib/Search/Search.js
CHANGED
|
@@ -2,13 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import View from "react-native-web/dist/exports/View";
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { useThemeTokens, useThemeTokensCallback } from '../ThemeProvider';
|
|
5
|
-
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, useInputValue, useSpacingScale, textInputHandlerProps, textInputProps, variantProp, viewProps } from '../utils';
|
|
5
|
+
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, useInputValue, useSpacingScale, textInputHandlerProps, textInputProps, variantProp, viewProps, contentfulProps } from '../utils';
|
|
6
6
|
import TextInputBase from '../TextInput/TextInputBase';
|
|
7
7
|
import ButtonBase from '../Button/ButtonBase';
|
|
8
8
|
import useCopy from '../utils/useCopy';
|
|
9
9
|
import dictionary from './dictionary';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
11
|
+
const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps, contentfulProps]);
|
|
12
12
|
const [selectInputProps, selectedInputPropTypes] = selectSystemProps([textInputHandlerProps, textInputProps]);
|
|
13
13
|
const selectInputTokens = _ref => {
|
|
14
14
|
let {
|
package/lib/Select/Select.js
CHANGED
|
@@ -266,10 +266,7 @@ const Select = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
266
266
|
children: /*#__PURE__*/_jsx(ValidationIconComponent, {
|
|
267
267
|
...selectValidationIconTokens(themeTokens)
|
|
268
268
|
})
|
|
269
|
-
}), IconComponent &&
|
|
270
|
-
/*#__PURE__*/
|
|
271
|
-
// we can't hide the default caret of a native picker on android
|
|
272
|
-
_jsx(View, {
|
|
269
|
+
}), IconComponent && /*#__PURE__*/_jsx(View, {
|
|
273
270
|
pointerEvents: "none",
|
|
274
271
|
style: [staticStyles.iconContainer, selectIconContainerStyles(themeTokens)],
|
|
275
272
|
children: /*#__PURE__*/_jsx(IconComponent, {
|
package/lib/Status/Status.js
CHANGED
|
@@ -55,12 +55,16 @@ const selectContainerStyles = _ref => {
|
|
|
55
55
|
const selectIconProps = _ref2 => {
|
|
56
56
|
let {
|
|
57
57
|
icon,
|
|
58
|
-
iconColor
|
|
58
|
+
iconColor,
|
|
59
|
+
iconSize,
|
|
60
|
+
iconPaddingTop
|
|
59
61
|
} = _ref2;
|
|
60
62
|
return {
|
|
61
63
|
icon,
|
|
62
64
|
tokens: {
|
|
63
|
-
color: iconColor
|
|
65
|
+
color: iconColor,
|
|
66
|
+
paddingTop: iconPaddingTop,
|
|
67
|
+
size: iconSize
|
|
64
68
|
},
|
|
65
69
|
variant: {
|
|
66
70
|
size: 'small'
|
|
@@ -308,7 +308,7 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
308
308
|
}
|
|
309
309
|
if (isPassword) {
|
|
310
310
|
textInputButtons === null || textInputButtons === void 0 || textInputButtons.unshift(/*#__PURE__*/_jsx(IconButton, {
|
|
311
|
-
accessibilityLabel:
|
|
311
|
+
accessibilityLabel: showPassword ? getCopy('hidePasswordAccessibilityLabel') : getCopy('showPasswordAccessibilityLabel'),
|
|
312
312
|
icon: !showPassword ? passwordShowButtonIcon : passwordHideButtonIcon,
|
|
313
313
|
onPress: handleShowOrHide,
|
|
314
314
|
variant: {
|
|
@@ -371,7 +371,7 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
371
371
|
children: /*#__PURE__*/_jsx(IconComponent, {
|
|
372
372
|
...selectIconTokens(themeTokens)
|
|
373
373
|
})
|
|
374
|
-
}), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0 && /*#__PURE__*/_jsx(View, {
|
|
374
|
+
}), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0 && !inactive && /*#__PURE__*/_jsx(View, {
|
|
375
375
|
style: [staticStyles.buttonsContainer, selectButtonsContainerStyle(themeTokens)],
|
|
376
376
|
children: /*#__PURE__*/_jsx(StackView, {
|
|
377
377
|
direction: "row",
|
package/lib/Tooltip/Tooltip.js
CHANGED
|
@@ -41,30 +41,40 @@ const selectTooltipShadowStyles = _ref2 => {
|
|
|
41
41
|
...applyShadowToken(shadow)
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const selectToolTipSizeStyles = _ref3 => {
|
|
45
|
+
let {
|
|
46
|
+
maxWidth,
|
|
47
|
+
minWidth
|
|
48
|
+
} = _ref3;
|
|
49
|
+
return {
|
|
50
|
+
maxWidth,
|
|
51
|
+
minWidth
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const selectMobileTooltipPositionStyles = _ref4 => {
|
|
45
55
|
let {
|
|
46
56
|
top,
|
|
47
57
|
left,
|
|
48
58
|
position
|
|
49
|
-
} =
|
|
59
|
+
} = _ref4;
|
|
50
60
|
return {
|
|
51
61
|
top,
|
|
52
62
|
left,
|
|
53
63
|
position
|
|
54
64
|
};
|
|
55
65
|
};
|
|
56
|
-
const selectMobileArrowStyles = (
|
|
66
|
+
const selectMobileArrowStyles = (_ref5, _ref6) => {
|
|
57
67
|
let {
|
|
58
68
|
backgroundColor,
|
|
59
69
|
arrowWidth,
|
|
60
70
|
arrowBorderRadius,
|
|
61
71
|
shadow
|
|
62
|
-
} =
|
|
72
|
+
} = _ref5;
|
|
63
73
|
let {
|
|
64
74
|
placement,
|
|
65
75
|
x: arrowX,
|
|
66
76
|
y: arrowY
|
|
67
|
-
} =
|
|
77
|
+
} = _ref6;
|
|
68
78
|
const staticSide = {
|
|
69
79
|
top: 'bottom',
|
|
70
80
|
right: 'left',
|
|
@@ -109,7 +119,7 @@ const defaultControl = (pressableState, variant) => /*#__PURE__*/_jsx(TooltipBut
|
|
|
109
119
|
* - You may use one when the information is useful only to a small percentage of users (ie. tech savvy people wouldn't need this info).
|
|
110
120
|
* - Tooltips may also be useful when vertical space is an issue.
|
|
111
121
|
*/
|
|
112
|
-
const Tooltip = /*#__PURE__*/React.forwardRef((
|
|
122
|
+
const Tooltip = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
113
123
|
let {
|
|
114
124
|
children,
|
|
115
125
|
content,
|
|
@@ -121,7 +131,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
121
131
|
inline = false,
|
|
122
132
|
nativeID,
|
|
123
133
|
...rest
|
|
124
|
-
} =
|
|
134
|
+
} = _ref7;
|
|
125
135
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
126
136
|
const arrowRef = React.useRef();
|
|
127
137
|
const [tooltipDimensions, setTooltipDimensions] = React.useState(null);
|
|
@@ -162,19 +172,19 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
162
172
|
setIsOpen(!isOpen);
|
|
163
173
|
};
|
|
164
174
|
const close = () => setIsOpen(false);
|
|
165
|
-
const getPressableState =
|
|
175
|
+
const getPressableState = _ref8 => {
|
|
166
176
|
let {
|
|
167
177
|
pressed,
|
|
168
178
|
hovered,
|
|
169
179
|
focused
|
|
170
|
-
} =
|
|
180
|
+
} = _ref8;
|
|
171
181
|
return {
|
|
172
182
|
pressed,
|
|
173
183
|
hover: hovered,
|
|
174
184
|
focus: focused
|
|
175
185
|
};
|
|
176
186
|
};
|
|
177
|
-
const onTooltipLayout =
|
|
187
|
+
const onTooltipLayout = _ref9 => {
|
|
178
188
|
let {
|
|
179
189
|
nativeEvent: {
|
|
180
190
|
layout: {
|
|
@@ -182,7 +192,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
182
192
|
height
|
|
183
193
|
}
|
|
184
194
|
}
|
|
185
|
-
} =
|
|
195
|
+
} = _ref9;
|
|
186
196
|
if (tooltipDimensions === null || tooltipDimensions.width !== width || tooltipDimensions.height !== height) {
|
|
187
197
|
setTooltipDimensions({
|
|
188
198
|
width: Platform.select({
|
|
@@ -233,7 +243,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
233
243
|
ref: floating,
|
|
234
244
|
style: [selectTooltipShadowStyles(themeTokens), staticStyles.tooltip,
|
|
235
245
|
// applied separately so that it doesn't cover the arrow
|
|
236
|
-
selectMobileTooltipPositionStyles({
|
|
246
|
+
selectToolTipSizeStyles, selectMobileTooltipPositionStyles({
|
|
237
247
|
position: strategy,
|
|
238
248
|
top: y ?? 0,
|
|
239
249
|
left: x ?? 0
|
|
@@ -269,7 +279,6 @@ const staticStyles = StyleSheet.create({
|
|
|
269
279
|
},
|
|
270
280
|
tooltip: {
|
|
271
281
|
position: 'absolute',
|
|
272
|
-
maxWidth: 240,
|
|
273
282
|
top: 0,
|
|
274
283
|
left: 0
|
|
275
284
|
},
|
|
@@ -43,30 +43,40 @@ const selectTooltipShadowStyles = _ref2 => {
|
|
|
43
43
|
...applyShadowToken(shadow)
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
const
|
|
46
|
+
const selectToolTipSizeStyles = _ref3 => {
|
|
47
|
+
let {
|
|
48
|
+
maxWidth,
|
|
49
|
+
minWidth
|
|
50
|
+
} = _ref3;
|
|
51
|
+
return {
|
|
52
|
+
maxWidth,
|
|
53
|
+
minWidth
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const selectTooltipPositionStyles = _ref4 => {
|
|
47
57
|
let {
|
|
48
58
|
top,
|
|
49
59
|
left,
|
|
50
60
|
width
|
|
51
|
-
} =
|
|
61
|
+
} = _ref4;
|
|
52
62
|
return {
|
|
53
63
|
top,
|
|
54
64
|
left,
|
|
55
65
|
width
|
|
56
66
|
};
|
|
57
67
|
};
|
|
58
|
-
const selectArrowStyles = (
|
|
68
|
+
const selectArrowStyles = (_ref5, _ref6) => {
|
|
59
69
|
let {
|
|
60
70
|
backgroundColor,
|
|
61
71
|
arrowWidth,
|
|
62
72
|
arrowBorderRadius,
|
|
63
73
|
shadow
|
|
64
|
-
} =
|
|
74
|
+
} = _ref5;
|
|
65
75
|
let {
|
|
66
76
|
position,
|
|
67
77
|
width: tooltipWidth,
|
|
68
78
|
height: tooltipHeight
|
|
69
|
-
} =
|
|
79
|
+
} = _ref6;
|
|
70
80
|
// the arrow width is actually a diagonal of the rectangle that we'll use as a tip
|
|
71
81
|
const rectangleSide = Math.sqrt(arrowWidth * arrowWidth / 2);
|
|
72
82
|
|
|
@@ -139,7 +149,7 @@ const defaultControl = (pressableState, variant, tokens) => /*#__PURE__*/_jsx(To
|
|
|
139
149
|
* - You may use one when the information is useful only to a small percentage of users (ie. tech savvy people wouldn't need this info).
|
|
140
150
|
* - Tooltips may also be useful when vertical space is an issue.
|
|
141
151
|
*/
|
|
142
|
-
const Tooltip = /*#__PURE__*/React.forwardRef((
|
|
152
|
+
const Tooltip = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
143
153
|
let {
|
|
144
154
|
children,
|
|
145
155
|
content,
|
|
@@ -153,7 +163,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
153
163
|
activateOnHover = false,
|
|
154
164
|
tooltipButtonTokens,
|
|
155
165
|
...rest
|
|
156
|
-
} =
|
|
166
|
+
} = _ref7;
|
|
157
167
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
158
168
|
const controlRef = React.useRef();
|
|
159
169
|
const [controlLayout, setControlLayout] = React.useState(null);
|
|
@@ -170,10 +180,10 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
170
180
|
arrowOffset
|
|
171
181
|
} = themeTokens;
|
|
172
182
|
React.useEffect(() => {
|
|
173
|
-
const subscription = Dimensions.addEventListener('change',
|
|
183
|
+
const subscription = Dimensions.addEventListener('change', _ref8 => {
|
|
174
184
|
let {
|
|
175
185
|
window
|
|
176
|
-
} =
|
|
186
|
+
} = _ref8;
|
|
177
187
|
setWindowDimensions(window);
|
|
178
188
|
});
|
|
179
189
|
return () => subscription === null || subscription === void 0 ? void 0 : subscription.remove();
|
|
@@ -183,19 +193,19 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
183
193
|
setIsOpen(!isOpen);
|
|
184
194
|
};
|
|
185
195
|
const close = () => setIsOpen(false);
|
|
186
|
-
const getPressableState =
|
|
196
|
+
const getPressableState = _ref9 => {
|
|
187
197
|
let {
|
|
188
198
|
pressed,
|
|
189
199
|
hovered,
|
|
190
200
|
focused
|
|
191
|
-
} =
|
|
201
|
+
} = _ref9;
|
|
192
202
|
return {
|
|
193
203
|
pressed,
|
|
194
204
|
hover: hovered,
|
|
195
205
|
focus: focused
|
|
196
206
|
};
|
|
197
207
|
};
|
|
198
|
-
const onTooltipLayout =
|
|
208
|
+
const onTooltipLayout = _ref10 => {
|
|
199
209
|
let {
|
|
200
210
|
nativeEvent: {
|
|
201
211
|
layout: {
|
|
@@ -203,7 +213,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
203
213
|
height
|
|
204
214
|
}
|
|
205
215
|
}
|
|
206
|
-
} =
|
|
216
|
+
} = _ref10;
|
|
207
217
|
if (tooltipDimensions === null || tooltipDimensions.width !== width || tooltipDimensions.height !== height) {
|
|
208
218
|
setTooltipDimensions({
|
|
209
219
|
width: Platform.select({
|
|
@@ -312,7 +322,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
312
322
|
ref: ref,
|
|
313
323
|
style: [staticStyles.tooltip, selectTooltipShadowStyles(themeTokens),
|
|
314
324
|
// applied separately so that it doesn't cover the arrow
|
|
315
|
-
tooltipPosition && selectTooltipPositionStyles(tooltipPosition), (tooltipPosition === null || (tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.isNormalized)) && staticStyles.tooltipHidden // visually hide the tooltip until we have a final measurement
|
|
325
|
+
selectToolTipSizeStyles(themeTokens), tooltipPosition && selectTooltipPositionStyles(tooltipPosition), (tooltipPosition === null || (tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.isNormalized)) && staticStyles.tooltipHidden // visually hide the tooltip until we have a final measurement
|
|
316
326
|
],
|
|
317
327
|
onLayout: onTooltipLayout,
|
|
318
328
|
accessibilityRole: "alert",
|
|
@@ -341,7 +351,6 @@ const staticStyles = StyleSheet.create({
|
|
|
341
351
|
},
|
|
342
352
|
tooltip: {
|
|
343
353
|
position: 'absolute',
|
|
344
|
-
maxWidth: 240,
|
|
345
354
|
top: 0,
|
|
346
355
|
left: 0
|
|
347
356
|
},
|
|
@@ -186,6 +186,10 @@ const Validator = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
186
186
|
}, []);
|
|
187
187
|
return /*#__PURE__*/_jsx(InputSupports, {
|
|
188
188
|
...supportsProps,
|
|
189
|
+
feedbackProps: {
|
|
190
|
+
...(rest === null || rest === void 0 ? void 0 : rest.feedbackProps),
|
|
191
|
+
showFeedbackIcon: true
|
|
192
|
+
},
|
|
189
193
|
children: /*#__PURE__*/_jsx(StackView, {
|
|
190
194
|
space: 2,
|
|
191
195
|
direction: "row",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
|
+
import getPropSelector from './getPropSelector';
|
|
4
|
+
const contentfulPropsTypes = {
|
|
5
|
+
...Platform.select({
|
|
6
|
+
web: {
|
|
7
|
+
'data-contentful-field-id': PropTypes.string,
|
|
8
|
+
'data-contentful-entry-id': PropTypes.string
|
|
9
|
+
},
|
|
10
|
+
default: {}
|
|
11
|
+
})
|
|
12
|
+
};
|
|
13
|
+
export default {
|
|
14
|
+
/**
|
|
15
|
+
* Set of contentful properties used for the content preview inspector.
|
|
16
|
+
*/
|
|
17
|
+
types: contentfulPropsTypes,
|
|
18
|
+
/**
|
|
19
|
+
* Filters a props object, returning only contentful props.
|
|
20
|
+
*/
|
|
21
|
+
select: getPropSelector(contentfulPropsTypes)
|
|
22
|
+
};
|
package/lib/utils/props/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export { default as selectSystemProps } from './selectSystemProps';
|
|
|
16
16
|
export { default as textInputProps } from './textInputProps';
|
|
17
17
|
export { default as textProps } from './textProps';
|
|
18
18
|
export { default as variantProp } from './variantProp';
|
|
19
|
-
export { default as viewProps } from './viewProps';
|
|
19
|
+
export { default as viewProps } from './viewProps';
|
|
20
|
+
export { default as contentfulProps } from './contentfulProps';
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@gorhom/portal": "^1.0.14",
|
|
14
14
|
"@react-native-picker/picker": "^2.9.0",
|
|
15
15
|
"@telus-uds/system-constants": "^2.0.0",
|
|
16
|
-
"@telus-uds/system-theme-tokens": "^3.
|
|
16
|
+
"@telus-uds/system-theme-tokens": "^3.1.0",
|
|
17
17
|
"airbnb-prop-types": "^2.16.0",
|
|
18
18
|
"css-mediaquery": "^0.1.2",
|
|
19
19
|
"expo-document-picker": "~10.3.0",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"standard-engine": {
|
|
82
82
|
"skip": true
|
|
83
83
|
},
|
|
84
|
-
"version": "2.0
|
|
84
|
+
"version": "2.1.0",
|
|
85
85
|
"types": "types/index.d.ts"
|
|
86
86
|
}
|
|
@@ -82,7 +82,7 @@ const PressableCardBase = React.forwardRef(
|
|
|
82
82
|
const getTokens = (pressableState) =>
|
|
83
83
|
validateThemeTokens(
|
|
84
84
|
resolvePressableTokens(tokens, pressableState, additionalState),
|
|
85
|
-
getTokensSetPropType(tokenKeys, {
|
|
85
|
+
getTokensSetPropType(tokenKeys, { partial: true, allowFunction: true }),
|
|
86
86
|
'PressableCard'
|
|
87
87
|
)
|
|
88
88
|
|