@telus-uds/components-base 1.89.0 → 1.91.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 +29 -2
- package/lib/Button/ButtonBase.js +1 -1
- package/lib/Carousel/Carousel.js +1 -6
- package/lib/OrderedList/Item.js +7 -5
- package/lib/OrderedList/OrderedList.js +15 -7
- package/lib/Status/Status.js +168 -0
- package/lib/Status/index.js +10 -0
- package/lib/TextInput/TextInputBase.js +11 -5
- package/lib/index.js +8 -0
- package/lib/utils/index.js +9 -1
- package/lib/utils/transformGradient.js +23 -0
- package/lib-module/Button/ButtonBase.js +1 -1
- package/lib-module/Carousel/Carousel.js +1 -6
- package/lib-module/OrderedList/Item.js +7 -5
- package/lib-module/OrderedList/OrderedList.js +16 -8
- package/lib-module/Status/Status.js +162 -0
- package/lib-module/Status/index.js +2 -0
- package/lib-module/TextInput/TextInputBase.js +11 -5
- package/lib-module/index.js +1 -0
- package/lib-module/utils/index.js +2 -1
- package/lib-module/utils/transformGradient.js +15 -0
- package/package.json +2 -2
- package/src/Button/ButtonBase.jsx +1 -1
- package/src/Carousel/Carousel.jsx +1 -6
- package/src/OrderedList/Item.jsx +6 -5
- package/src/OrderedList/OrderedList.jsx +35 -26
- package/src/Status/Status.jsx +142 -0
- package/src/Status/index.js +3 -0
- package/src/TextInput/TextInputBase.jsx +15 -5
- package/src/index.js +1 -0
- package/src/utils/index.js +1 -0
- package/src/utils/transformGradient.js +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 12 Aug 2024 06:26:58 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.91.0
|
|
8
|
+
|
|
9
|
+
Mon, 12 Aug 2024 06:26:58 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- OrderedList: add itemTextColor token and pass tokens down to children (jacqui.koroll@telus.com)
|
|
14
|
+
- Bump @telus-uds/system-theme-tokens to v2.61.0
|
|
15
|
+
|
|
16
|
+
### Patches
|
|
17
|
+
|
|
18
|
+
- `TextInputBase`: Update padding logic for TextInput component based on icon and buttons presence (jaime.tuyuc@telus.com)
|
|
19
|
+
|
|
20
|
+
## 1.90.0
|
|
21
|
+
|
|
22
|
+
Fri, 26 Jul 2024 21:24:32 GMT
|
|
23
|
+
|
|
24
|
+
### Minor changes
|
|
25
|
+
|
|
26
|
+
- `Status`: add component (guillermo.peitzner@telus.com)
|
|
27
|
+
- Bump @telus-uds/system-theme-tokens to v2.60.0
|
|
28
|
+
|
|
29
|
+
### Patches
|
|
30
|
+
|
|
31
|
+
- Conditionally add iconSpace on mobile if we have an icon to render (jaime.tuyuc@telus.com)
|
|
32
|
+
- `Carousel`: fix accessibility issue, remove unused accessibilityValue (<tony.eng@telus.com>)
|
|
33
|
+
|
|
7
34
|
## 1.89.0
|
|
8
35
|
|
|
9
|
-
Fri, 19 Jul 2024 18:
|
|
36
|
+
Fri, 19 Jul 2024 18:20:50 GMT
|
|
10
37
|
|
|
11
38
|
### Minor changes
|
|
12
39
|
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -306,7 +306,7 @@ const ButtonBase = /*#__PURE__*/_react.default.forwardRef((_ref11, ref) => {
|
|
|
306
306
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.IconText, {
|
|
307
307
|
icon: IconComponent,
|
|
308
308
|
iconPosition: iconPosition,
|
|
309
|
-
space: iconSpace,
|
|
309
|
+
space: icon ? iconSpace : 0,
|
|
310
310
|
iconProps: {
|
|
311
311
|
...iconProps,
|
|
312
312
|
tokens: iconTokens
|
package/lib/Carousel/Carousel.js
CHANGED
|
@@ -552,12 +552,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
|
|
|
552
552
|
const systemProps = selectProps({
|
|
553
553
|
...rest,
|
|
554
554
|
accessibilityRole,
|
|
555
|
-
accessibilityLabel
|
|
556
|
-
accessibilityValue: {
|
|
557
|
-
min: 1,
|
|
558
|
-
max: childrenArray.length,
|
|
559
|
-
now: activeIndex + 1
|
|
560
|
-
}
|
|
555
|
+
accessibilityLabel
|
|
561
556
|
});
|
|
562
557
|
|
|
563
558
|
// If container isn't used for focus, give it a label of title if none is passed in,
|
package/lib/OrderedList/Item.js
CHANGED
|
@@ -21,13 +21,14 @@ const selectItemTextStyles = (_ref, themeOptions) => {
|
|
|
21
21
|
itemFontSize,
|
|
22
22
|
itemLineHeight,
|
|
23
23
|
itemFontName,
|
|
24
|
-
itemColor
|
|
24
|
+
itemColor,
|
|
25
|
+
itemTextColor
|
|
25
26
|
} = _ref;
|
|
26
27
|
return (0, _ThemeProvider.applyTextStyles)({
|
|
27
28
|
fontWeight: itemFontHeight,
|
|
28
29
|
fontSize: itemFontSize,
|
|
29
30
|
fontName: itemFontName,
|
|
30
|
-
color: itemColor,
|
|
31
|
+
color: itemColor || itemTextColor,
|
|
31
32
|
themeOptions,
|
|
32
33
|
lineHeight: itemLineHeight
|
|
33
34
|
});
|
|
@@ -41,10 +42,11 @@ const selectItemCounterStyles = _ref2 => {
|
|
|
41
42
|
itemFontName,
|
|
42
43
|
itemLineHeight,
|
|
43
44
|
themeOptions,
|
|
44
|
-
itemColor
|
|
45
|
+
itemColor,
|
|
46
|
+
itemTextColor
|
|
45
47
|
} = _ref2;
|
|
46
48
|
return {
|
|
47
|
-
color: itemColor,
|
|
49
|
+
color: itemColor || itemTextColor,
|
|
48
50
|
width: itemBulletContainerWidth,
|
|
49
51
|
textAlign: itemBulletTextAlign,
|
|
50
52
|
...(0, _ThemeProvider.applyTextStyles)({
|
|
@@ -82,7 +84,7 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
|
|
|
82
84
|
const headingTokens = title && {
|
|
83
85
|
lineHeight: themeTokens.itemLineHeight,
|
|
84
86
|
fontSize: themeTokens.itemFontSize,
|
|
85
|
-
color: themeTokens.itemColor,
|
|
87
|
+
color: themeTokens.itemColor || themeTokens.itemTextColor,
|
|
86
88
|
fontName: themeTokens.headerFontName,
|
|
87
89
|
fontWeight: themeTokens.headerFontWeight
|
|
88
90
|
};
|
|
@@ -17,29 +17,36 @@ const OrderedList = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
17
17
|
children,
|
|
18
18
|
start = 1,
|
|
19
19
|
variant = {},
|
|
20
|
+
tokens = {},
|
|
20
21
|
...rest
|
|
21
22
|
} = _ref;
|
|
23
|
+
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
22
24
|
const childrenWithParentVariants = _react.default.useMemo(() => {
|
|
23
|
-
const
|
|
24
|
-
var _child$props;
|
|
25
|
+
const addVariantAndTokensToProps = (child, i, isLastChild) => {
|
|
26
|
+
var _child$props, _child$props2;
|
|
25
27
|
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
28
|
+
const existingChildTokens = ((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tokens) ?? {};
|
|
26
29
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
27
30
|
index: start + i,
|
|
28
31
|
isLastChild,
|
|
29
32
|
variant: {
|
|
30
33
|
...existingChildVariants,
|
|
31
34
|
...variant
|
|
35
|
+
},
|
|
36
|
+
tokens: {
|
|
37
|
+
...existingChildTokens,
|
|
38
|
+
...tokens
|
|
32
39
|
}
|
|
33
40
|
});
|
|
34
41
|
};
|
|
35
|
-
if (variant) {
|
|
42
|
+
if (variant || tokens) {
|
|
36
43
|
if (Array.isArray(children)) {
|
|
37
|
-
return children.map((child, i) =>
|
|
44
|
+
return children.map((child, i) => addVariantAndTokensToProps(child, i, i === children.length - 1));
|
|
38
45
|
}
|
|
39
|
-
return [
|
|
46
|
+
return [addVariantAndTokensToProps(children, 0, true)];
|
|
40
47
|
}
|
|
41
48
|
return children;
|
|
42
|
-
}, [children, variant, start]);
|
|
49
|
+
}, [children, variant, start, tokens]);
|
|
43
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedListBase.default, {
|
|
44
51
|
ref: ref,
|
|
45
52
|
...selectProps(rest),
|
|
@@ -56,7 +63,8 @@ OrderedList.propTypes = {
|
|
|
56
63
|
* The position to start the list with.
|
|
57
64
|
*/
|
|
58
65
|
start: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
59
|
-
variant: _utils.variantProp.propType
|
|
66
|
+
variant: _utils.variantProp.propType,
|
|
67
|
+
tokens: (0, _utils.getTokensPropType)('OrderedList')
|
|
60
68
|
};
|
|
61
69
|
OrderedList.displayName = 'OrderedList';
|
|
62
70
|
OrderedList.Item = _Item.default;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
9
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
10
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
13
|
+
var _utils = require("../utils");
|
|
14
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
18
|
+
const selectContainerStyles = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
backgroundColor,
|
|
21
|
+
backgroundGradient,
|
|
22
|
+
borderColor,
|
|
23
|
+
borderRadius,
|
|
24
|
+
borderWidth,
|
|
25
|
+
paddingBottom,
|
|
26
|
+
paddingLeft,
|
|
27
|
+
paddingRight,
|
|
28
|
+
paddingTop
|
|
29
|
+
} = _ref;
|
|
30
|
+
const styles = {
|
|
31
|
+
borderColor,
|
|
32
|
+
borderRadius,
|
|
33
|
+
borderWidth,
|
|
34
|
+
paddingBottom,
|
|
35
|
+
paddingLeft,
|
|
36
|
+
paddingRight,
|
|
37
|
+
paddingTop
|
|
38
|
+
};
|
|
39
|
+
if (backgroundGradient) {
|
|
40
|
+
if (_Platform.default.OS === 'web') {
|
|
41
|
+
styles.background = (0, _utils.transformGradient)(backgroundGradient);
|
|
42
|
+
} else {
|
|
43
|
+
const {
|
|
44
|
+
stops: [stopOne, stopTwo]
|
|
45
|
+
} = backgroundGradient;
|
|
46
|
+
styles.gradient = {};
|
|
47
|
+
styles.gradient.start = {
|
|
48
|
+
x: 0,
|
|
49
|
+
y: 0
|
|
50
|
+
};
|
|
51
|
+
styles.gradient.end = {
|
|
52
|
+
x: 1,
|
|
53
|
+
y: 1
|
|
54
|
+
};
|
|
55
|
+
styles.gradient.colors = [stopOne.color, stopTwo.color];
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
styles.backgroundColor = backgroundColor;
|
|
59
|
+
}
|
|
60
|
+
return styles;
|
|
61
|
+
};
|
|
62
|
+
const selectIconProps = _ref2 => {
|
|
63
|
+
let {
|
|
64
|
+
icon,
|
|
65
|
+
iconColor
|
|
66
|
+
} = _ref2;
|
|
67
|
+
return {
|
|
68
|
+
icon,
|
|
69
|
+
tokens: {
|
|
70
|
+
color: iconColor
|
|
71
|
+
},
|
|
72
|
+
variant: {
|
|
73
|
+
size: 'small'
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const selectTextStyles = _ref3 => {
|
|
78
|
+
let {
|
|
79
|
+
textColor,
|
|
80
|
+
textLineHeight,
|
|
81
|
+
fontName,
|
|
82
|
+
fontSize,
|
|
83
|
+
fontWeight
|
|
84
|
+
} = _ref3;
|
|
85
|
+
return (0, _ThemeProvider.applyTextStyles)({
|
|
86
|
+
fontColor: textColor,
|
|
87
|
+
fontName,
|
|
88
|
+
fontSize,
|
|
89
|
+
fontWeight,
|
|
90
|
+
lineHeight: _Platform.default.OS === 'web' ? textLineHeight : textLineHeight * 1.2,
|
|
91
|
+
marginLeft: 8
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Status component displays a status indicator with optional custom gradient.
|
|
97
|
+
*
|
|
98
|
+
* @component
|
|
99
|
+
* @param {object} tokens - The tokens for customizing the status component.
|
|
100
|
+
* @param {string} variant - The variant of the status component.
|
|
101
|
+
* @param {ReactNode} children - The content to be displayed inside the status component.
|
|
102
|
+
* @param {function} customGradient - The custom gradient function for the status component.
|
|
103
|
+
* @param {object} rest - The rest of the props to be applied to the status component.
|
|
104
|
+
* @param {React.Ref} ref - The ref to be applied to the status component.
|
|
105
|
+
* @returns {ReactNode} The rendered status component.
|
|
106
|
+
*/
|
|
107
|
+
const Status = /*#__PURE__*/_react.default.forwardRef((_ref4, ref) => {
|
|
108
|
+
let {
|
|
109
|
+
tokens,
|
|
110
|
+
variant,
|
|
111
|
+
children,
|
|
112
|
+
customGradient,
|
|
113
|
+
...rest
|
|
114
|
+
} = _ref4;
|
|
115
|
+
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Status', tokens, variant);
|
|
116
|
+
const containerStyles = {
|
|
117
|
+
...selectContainerStyles(themeTokens),
|
|
118
|
+
...staticStyles.container
|
|
119
|
+
};
|
|
120
|
+
let content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
122
|
+
...selectIconProps(themeTokens)
|
|
123
|
+
}), (0, _utils.wrapStringsInText)(children, {
|
|
124
|
+
style: selectTextStyles(themeTokens)
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
if (typeof customGradient === 'function') {
|
|
128
|
+
content = customGradient(containerStyles.gradient, containerStyles, content);
|
|
129
|
+
}
|
|
130
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
131
|
+
ref: ref,
|
|
132
|
+
style: containerStyles,
|
|
133
|
+
...selectProps(rest),
|
|
134
|
+
children: content
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
Status.displayName = 'Status';
|
|
138
|
+
Status.propTypes = {
|
|
139
|
+
...selectedSystemPropTypes,
|
|
140
|
+
tokens: (0, _utils.getTokensPropType)('Status'),
|
|
141
|
+
variant: _utils.variantProp.propType,
|
|
142
|
+
/**
|
|
143
|
+
* The content to be displayed inside the status component.
|
|
144
|
+
*/
|
|
145
|
+
children: _propTypes.default.node.isRequired,
|
|
146
|
+
/**
|
|
147
|
+
* The custom gradient function for the status component.
|
|
148
|
+
*/
|
|
149
|
+
customGradient: _propTypes.default.func
|
|
150
|
+
};
|
|
151
|
+
const staticStyles = _StyleSheet.default.create({
|
|
152
|
+
container: {
|
|
153
|
+
flexDirection: 'row',
|
|
154
|
+
alignItems: 'center',
|
|
155
|
+
..._Platform.default.select({
|
|
156
|
+
web: {
|
|
157
|
+
display: 'inline-flex',
|
|
158
|
+
width: 'fit-content'
|
|
159
|
+
},
|
|
160
|
+
default: {
|
|
161
|
+
display: 'flex',
|
|
162
|
+
width: 'auto'
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
var _default = Status;
|
|
168
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _Status = _interopRequireDefault(require("./Status"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _Status.default;
|
|
10
|
+
exports.default = _default;
|
|
@@ -19,7 +19,7 @@ var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
|
|
22
|
-
const selectInputStyles = (_ref, themeOptions, inactive, type)
|
|
22
|
+
const selectInputStyles = function (_ref, themeOptions, inactive, type) {
|
|
23
23
|
let {
|
|
24
24
|
backgroundColor,
|
|
25
25
|
color,
|
|
@@ -35,12 +35,15 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
35
35
|
fontWeight,
|
|
36
36
|
lineHeight,
|
|
37
37
|
icon,
|
|
38
|
-
iconSize = 0,
|
|
39
38
|
minLines,
|
|
40
39
|
maxLines,
|
|
41
40
|
width,
|
|
42
41
|
height
|
|
43
42
|
} = _ref;
|
|
43
|
+
let buttonCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
44
|
+
let buttonSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
45
|
+
let buttonsGapSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
46
|
+
let isPassword = arguments.length > 7 ? arguments[7] : undefined;
|
|
44
47
|
// Subtract border width from padding so overall input width/height doesn't
|
|
45
48
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
46
49
|
const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
|
|
@@ -67,7 +70,10 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
67
70
|
}
|
|
68
71
|
});
|
|
69
72
|
|
|
70
|
-
const
|
|
73
|
+
const buttonSpacing = isPassword ? buttonsGapSize : -buttonsGapSize;
|
|
74
|
+
const adjustedPaddingRight = paddingRight + (buttonCount ? 1 : 0) * (buttonSize + buttonSpacing);
|
|
75
|
+
const adjustedPaddingWithButtons = buttonCount > 1 ? paddingRight : adjustedPaddingRight;
|
|
76
|
+
const paddingWithIcon = buttonSize + adjustedPaddingRight;
|
|
71
77
|
return {
|
|
72
78
|
backgroundColor,
|
|
73
79
|
color,
|
|
@@ -75,7 +81,7 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
75
81
|
borderColor,
|
|
76
82
|
borderRadius,
|
|
77
83
|
paddingLeft: type === 'card' ? offsetBorder(paddingLeft + 34) : offsetBorder(paddingLeft),
|
|
78
|
-
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(
|
|
84
|
+
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(adjustedPaddingWithButtons),
|
|
79
85
|
paddingTop: offsetBorder(paddingTop),
|
|
80
86
|
paddingBottom: offsetBorder(paddingBottom),
|
|
81
87
|
minHeight,
|
|
@@ -343,7 +349,7 @@ const TextInputBase = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
|
343
349
|
const nativeInputStyle = selectInputStyles({
|
|
344
350
|
...themeTokens,
|
|
345
351
|
height
|
|
346
|
-
}, themeOptions, inactive, type);
|
|
352
|
+
}, themeOptions, inactive, type, buttons === null || buttons === void 0 ? void 0 : buttons.length, themeTokens.buttonSize, buttonsGapSize, isPassword);
|
|
347
353
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
348
354
|
style: selectOuterBorderStyles(themeTokens),
|
|
349
355
|
children: [type === 'card' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
package/lib/index.js
CHANGED
|
@@ -54,6 +54,7 @@ var _exportNames = {
|
|
|
54
54
|
SkipLink: true,
|
|
55
55
|
Spacer: true,
|
|
56
56
|
StackView: true,
|
|
57
|
+
Status: true,
|
|
57
58
|
StepTracker: true,
|
|
58
59
|
Tabs: true,
|
|
59
60
|
Tags: true,
|
|
@@ -398,6 +399,12 @@ Object.defineProperty(exports, "StackView", {
|
|
|
398
399
|
return _StackView.default;
|
|
399
400
|
}
|
|
400
401
|
});
|
|
402
|
+
Object.defineProperty(exports, "Status", {
|
|
403
|
+
enumerable: true,
|
|
404
|
+
get: function () {
|
|
405
|
+
return _Status.default;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
401
408
|
Object.defineProperty(exports, "StepTracker", {
|
|
402
409
|
enumerable: true,
|
|
403
410
|
get: function () {
|
|
@@ -678,6 +685,7 @@ Object.keys(_StackView).forEach(function (key) {
|
|
|
678
685
|
}
|
|
679
686
|
});
|
|
680
687
|
});
|
|
688
|
+
var _Status = _interopRequireDefault(require("./Status"));
|
|
681
689
|
var _StepTracker = _interopRequireDefault(require("./StepTracker"));
|
|
682
690
|
var _Tabs = _interopRequireDefault(require("./Tabs"));
|
|
683
691
|
var _Tags = _interopRequireDefault(require("./Tags"));
|
package/lib/utils/index.js
CHANGED
|
@@ -16,7 +16,8 @@ var _exportNames = {
|
|
|
16
16
|
withLinkRouter: true,
|
|
17
17
|
containUniqueFields: true,
|
|
18
18
|
BaseView: true,
|
|
19
|
-
htmlAttrs: true
|
|
19
|
+
htmlAttrs: true,
|
|
20
|
+
transformGradient: true
|
|
20
21
|
};
|
|
21
22
|
Object.defineProperty(exports, "BaseView", {
|
|
22
23
|
enumerable: true,
|
|
@@ -42,6 +43,12 @@ Object.defineProperty(exports, "info", {
|
|
|
42
43
|
return _info.default;
|
|
43
44
|
}
|
|
44
45
|
});
|
|
46
|
+
Object.defineProperty(exports, "transformGradient", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _transformGradient.transformGradient;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
45
52
|
Object.defineProperty(exports, "useCopy", {
|
|
46
53
|
enumerable: true,
|
|
47
54
|
get: function () {
|
|
@@ -216,6 +223,7 @@ Object.keys(_ssr).forEach(function (key) {
|
|
|
216
223
|
var _containUniqueFields = _interopRequireDefault(require("./containUniqueFields"));
|
|
217
224
|
var _BaseView = _interopRequireDefault(require("./BaseView"));
|
|
218
225
|
var _htmlAttrs = _interopRequireDefault(require("./htmlAttrs"));
|
|
226
|
+
var _transformGradient = require("./transformGradient");
|
|
219
227
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
220
228
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
221
229
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.transformGradient = exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Transforms a gradient object into a CSS gradient string.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} gradient - The gradient object to transform.
|
|
11
|
+
* @param {string} gradient.type - The type of gradient (linear or radial).
|
|
12
|
+
* @param {number} gradient.angle - The angle of the linear gradient in degrees.
|
|
13
|
+
* @param {Array} gradient.stops - An array of gradient stops.
|
|
14
|
+
* @param {string} gradient.stops[].color - The color of the gradient stop.
|
|
15
|
+
* @param {number} gradient.stops[].stop - The position of the gradient stop as a percentage.
|
|
16
|
+
* @returns {string} The CSS gradient string.
|
|
17
|
+
*/
|
|
18
|
+
const transformGradient = gradient => `${gradient.type}-gradient(${gradient.angle}deg, ${gradient.stops[0].color} ${gradient.stops[0].stop * 100}%, ${gradient.stops[1].color} ${gradient.stops[1].stop * 100}%)`;
|
|
19
|
+
exports.transformGradient = transformGradient;
|
|
20
|
+
var _default = {
|
|
21
|
+
transformGradient
|
|
22
|
+
};
|
|
23
|
+
exports.default = _default;
|
|
@@ -299,7 +299,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
|
|
|
299
299
|
children: /*#__PURE__*/_jsx(IconText, {
|
|
300
300
|
icon: IconComponent,
|
|
301
301
|
iconPosition: iconPosition,
|
|
302
|
-
space: iconSpace,
|
|
302
|
+
space: icon ? iconSpace : 0,
|
|
303
303
|
iconProps: {
|
|
304
304
|
...iconProps,
|
|
305
305
|
tokens: iconTokens
|
|
@@ -546,12 +546,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
546
546
|
const systemProps = selectProps({
|
|
547
547
|
...rest,
|
|
548
548
|
accessibilityRole,
|
|
549
|
-
accessibilityLabel
|
|
550
|
-
accessibilityValue: {
|
|
551
|
-
min: 1,
|
|
552
|
-
max: childrenArray.length,
|
|
553
|
-
now: activeIndex + 1
|
|
554
|
-
}
|
|
549
|
+
accessibilityLabel
|
|
555
550
|
});
|
|
556
551
|
|
|
557
552
|
// If container isn't used for focus, give it a label of title if none is passed in,
|
|
@@ -15,13 +15,14 @@ const selectItemTextStyles = (_ref, themeOptions) => {
|
|
|
15
15
|
itemFontSize,
|
|
16
16
|
itemLineHeight,
|
|
17
17
|
itemFontName,
|
|
18
|
-
itemColor
|
|
18
|
+
itemColor,
|
|
19
|
+
itemTextColor
|
|
19
20
|
} = _ref;
|
|
20
21
|
return applyTextStyles({
|
|
21
22
|
fontWeight: itemFontHeight,
|
|
22
23
|
fontSize: itemFontSize,
|
|
23
24
|
fontName: itemFontName,
|
|
24
|
-
color: itemColor,
|
|
25
|
+
color: itemColor || itemTextColor,
|
|
25
26
|
themeOptions,
|
|
26
27
|
lineHeight: itemLineHeight
|
|
27
28
|
});
|
|
@@ -35,10 +36,11 @@ const selectItemCounterStyles = _ref2 => {
|
|
|
35
36
|
itemFontName,
|
|
36
37
|
itemLineHeight,
|
|
37
38
|
themeOptions,
|
|
38
|
-
itemColor
|
|
39
|
+
itemColor,
|
|
40
|
+
itemTextColor
|
|
39
41
|
} = _ref2;
|
|
40
42
|
return {
|
|
41
|
-
color: itemColor,
|
|
43
|
+
color: itemColor || itemTextColor,
|
|
42
44
|
width: itemBulletContainerWidth,
|
|
43
45
|
textAlign: itemBulletTextAlign,
|
|
44
46
|
...applyTextStyles({
|
|
@@ -76,7 +78,7 @@ const Item = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
|
76
78
|
const headingTokens = title && {
|
|
77
79
|
lineHeight: themeTokens.itemLineHeight,
|
|
78
80
|
fontSize: themeTokens.itemFontSize,
|
|
79
|
-
color: themeTokens.itemColor,
|
|
81
|
+
color: themeTokens.itemColor || themeTokens.itemTextColor,
|
|
80
82
|
fontName: themeTokens.headerFontName,
|
|
81
83
|
fontWeight: themeTokens.headerFontWeight
|
|
82
84
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { htmlAttrs, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
3
|
+
import { htmlAttrs, selectSystemProps, variantProp, viewProps, getTokensPropType } from '../utils';
|
|
4
4
|
import OrderedListBase from './OrderedListBase';
|
|
5
5
|
import Item from './Item';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -10,29 +10,36 @@ const OrderedList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
10
10
|
children,
|
|
11
11
|
start = 1,
|
|
12
12
|
variant = {},
|
|
13
|
+
tokens = {},
|
|
13
14
|
...rest
|
|
14
15
|
} = _ref;
|
|
16
|
+
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
15
17
|
const childrenWithParentVariants = React.useMemo(() => {
|
|
16
|
-
const
|
|
17
|
-
var _child$props;
|
|
18
|
+
const addVariantAndTokensToProps = (child, i, isLastChild) => {
|
|
19
|
+
var _child$props, _child$props2;
|
|
18
20
|
const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
|
|
21
|
+
const existingChildTokens = ((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tokens) ?? {};
|
|
19
22
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
20
23
|
index: start + i,
|
|
21
24
|
isLastChild,
|
|
22
25
|
variant: {
|
|
23
26
|
...existingChildVariants,
|
|
24
27
|
...variant
|
|
28
|
+
},
|
|
29
|
+
tokens: {
|
|
30
|
+
...existingChildTokens,
|
|
31
|
+
...tokens
|
|
25
32
|
}
|
|
26
33
|
});
|
|
27
34
|
};
|
|
28
|
-
if (variant) {
|
|
35
|
+
if (variant || tokens) {
|
|
29
36
|
if (Array.isArray(children)) {
|
|
30
|
-
return children.map((child, i) =>
|
|
37
|
+
return children.map((child, i) => addVariantAndTokensToProps(child, i, i === children.length - 1));
|
|
31
38
|
}
|
|
32
|
-
return [
|
|
39
|
+
return [addVariantAndTokensToProps(children, 0, true)];
|
|
33
40
|
}
|
|
34
41
|
return children;
|
|
35
|
-
}, [children, variant, start]);
|
|
42
|
+
}, [children, variant, start, tokens]);
|
|
36
43
|
return /*#__PURE__*/_jsx(OrderedListBase, {
|
|
37
44
|
ref: ref,
|
|
38
45
|
...selectProps(rest),
|
|
@@ -49,7 +56,8 @@ OrderedList.propTypes = {
|
|
|
49
56
|
* The position to start the list with.
|
|
50
57
|
*/
|
|
51
58
|
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
|
-
variant: variantProp.propType
|
|
59
|
+
variant: variantProp.propType,
|
|
60
|
+
tokens: getTokensPropType('OrderedList')
|
|
53
61
|
};
|
|
54
62
|
OrderedList.displayName = 'OrderedList';
|
|
55
63
|
OrderedList.Item = Item;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
3
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
|
+
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { useThemeTokens, applyTextStyles } from '../ThemeProvider';
|
|
7
|
+
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps, wrapStringsInText, transformGradient } from '../utils';
|
|
8
|
+
import Icon from '../Icon';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
13
|
+
const selectContainerStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
backgroundColor,
|
|
16
|
+
backgroundGradient,
|
|
17
|
+
borderColor,
|
|
18
|
+
borderRadius,
|
|
19
|
+
borderWidth,
|
|
20
|
+
paddingBottom,
|
|
21
|
+
paddingLeft,
|
|
22
|
+
paddingRight,
|
|
23
|
+
paddingTop
|
|
24
|
+
} = _ref;
|
|
25
|
+
const styles = {
|
|
26
|
+
borderColor,
|
|
27
|
+
borderRadius,
|
|
28
|
+
borderWidth,
|
|
29
|
+
paddingBottom,
|
|
30
|
+
paddingLeft,
|
|
31
|
+
paddingRight,
|
|
32
|
+
paddingTop
|
|
33
|
+
};
|
|
34
|
+
if (backgroundGradient) {
|
|
35
|
+
if (Platform.OS === 'web') {
|
|
36
|
+
styles.background = transformGradient(backgroundGradient);
|
|
37
|
+
} else {
|
|
38
|
+
const {
|
|
39
|
+
stops: [stopOne, stopTwo]
|
|
40
|
+
} = backgroundGradient;
|
|
41
|
+
styles.gradient = {};
|
|
42
|
+
styles.gradient.start = {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
};
|
|
46
|
+
styles.gradient.end = {
|
|
47
|
+
x: 1,
|
|
48
|
+
y: 1
|
|
49
|
+
};
|
|
50
|
+
styles.gradient.colors = [stopOne.color, stopTwo.color];
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
styles.backgroundColor = backgroundColor;
|
|
54
|
+
}
|
|
55
|
+
return styles;
|
|
56
|
+
};
|
|
57
|
+
const selectIconProps = _ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
icon,
|
|
60
|
+
iconColor
|
|
61
|
+
} = _ref2;
|
|
62
|
+
return {
|
|
63
|
+
icon,
|
|
64
|
+
tokens: {
|
|
65
|
+
color: iconColor
|
|
66
|
+
},
|
|
67
|
+
variant: {
|
|
68
|
+
size: 'small'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const selectTextStyles = _ref3 => {
|
|
73
|
+
let {
|
|
74
|
+
textColor,
|
|
75
|
+
textLineHeight,
|
|
76
|
+
fontName,
|
|
77
|
+
fontSize,
|
|
78
|
+
fontWeight
|
|
79
|
+
} = _ref3;
|
|
80
|
+
return applyTextStyles({
|
|
81
|
+
fontColor: textColor,
|
|
82
|
+
fontName,
|
|
83
|
+
fontSize,
|
|
84
|
+
fontWeight,
|
|
85
|
+
lineHeight: Platform.OS === 'web' ? textLineHeight : textLineHeight * 1.2,
|
|
86
|
+
marginLeft: 8
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Status component displays a status indicator with optional custom gradient.
|
|
92
|
+
*
|
|
93
|
+
* @component
|
|
94
|
+
* @param {object} tokens - The tokens for customizing the status component.
|
|
95
|
+
* @param {string} variant - The variant of the status component.
|
|
96
|
+
* @param {ReactNode} children - The content to be displayed inside the status component.
|
|
97
|
+
* @param {function} customGradient - The custom gradient function for the status component.
|
|
98
|
+
* @param {object} rest - The rest of the props to be applied to the status component.
|
|
99
|
+
* @param {React.Ref} ref - The ref to be applied to the status component.
|
|
100
|
+
* @returns {ReactNode} The rendered status component.
|
|
101
|
+
*/
|
|
102
|
+
const Status = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
103
|
+
let {
|
|
104
|
+
tokens,
|
|
105
|
+
variant,
|
|
106
|
+
children,
|
|
107
|
+
customGradient,
|
|
108
|
+
...rest
|
|
109
|
+
} = _ref4;
|
|
110
|
+
const themeTokens = useThemeTokens('Status', tokens, variant);
|
|
111
|
+
const containerStyles = {
|
|
112
|
+
...selectContainerStyles(themeTokens),
|
|
113
|
+
...staticStyles.container
|
|
114
|
+
};
|
|
115
|
+
let content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
116
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
117
|
+
...selectIconProps(themeTokens)
|
|
118
|
+
}), wrapStringsInText(children, {
|
|
119
|
+
style: selectTextStyles(themeTokens)
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
if (typeof customGradient === 'function') {
|
|
123
|
+
content = customGradient(containerStyles.gradient, containerStyles, content);
|
|
124
|
+
}
|
|
125
|
+
return /*#__PURE__*/_jsx(View, {
|
|
126
|
+
ref: ref,
|
|
127
|
+
style: containerStyles,
|
|
128
|
+
...selectProps(rest),
|
|
129
|
+
children: content
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
Status.displayName = 'Status';
|
|
133
|
+
Status.propTypes = {
|
|
134
|
+
...selectedSystemPropTypes,
|
|
135
|
+
tokens: getTokensPropType('Status'),
|
|
136
|
+
variant: variantProp.propType,
|
|
137
|
+
/**
|
|
138
|
+
* The content to be displayed inside the status component.
|
|
139
|
+
*/
|
|
140
|
+
children: PropTypes.node.isRequired,
|
|
141
|
+
/**
|
|
142
|
+
* The custom gradient function for the status component.
|
|
143
|
+
*/
|
|
144
|
+
customGradient: PropTypes.func
|
|
145
|
+
};
|
|
146
|
+
const staticStyles = StyleSheet.create({
|
|
147
|
+
container: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
...Platform.select({
|
|
151
|
+
web: {
|
|
152
|
+
display: 'inline-flex',
|
|
153
|
+
width: 'fit-content'
|
|
154
|
+
},
|
|
155
|
+
default: {
|
|
156
|
+
display: 'flex',
|
|
157
|
+
width: 'auto'
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
export default Status;
|
|
@@ -13,7 +13,7 @@ import dictionary from './dictionary';
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, textInputProps, viewProps]);
|
|
16
|
-
const selectInputStyles = (_ref, themeOptions, inactive, type)
|
|
16
|
+
const selectInputStyles = function (_ref, themeOptions, inactive, type) {
|
|
17
17
|
let {
|
|
18
18
|
backgroundColor,
|
|
19
19
|
color,
|
|
@@ -29,12 +29,15 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
29
29
|
fontWeight,
|
|
30
30
|
lineHeight,
|
|
31
31
|
icon,
|
|
32
|
-
iconSize = 0,
|
|
33
32
|
minLines,
|
|
34
33
|
maxLines,
|
|
35
34
|
width,
|
|
36
35
|
height
|
|
37
36
|
} = _ref;
|
|
37
|
+
let buttonCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
38
|
+
let buttonSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
39
|
+
let buttonsGapSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
40
|
+
let isPassword = arguments.length > 7 ? arguments[7] : undefined;
|
|
38
41
|
// Subtract border width from padding so overall input width/height doesn't
|
|
39
42
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
40
43
|
const offsetBorder = value => typeof value === 'number' ? Math.max(0, value - borderWidth) : value;
|
|
@@ -61,7 +64,10 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
61
64
|
}
|
|
62
65
|
});
|
|
63
66
|
|
|
64
|
-
const
|
|
67
|
+
const buttonSpacing = isPassword ? buttonsGapSize : -buttonsGapSize;
|
|
68
|
+
const adjustedPaddingRight = paddingRight + (buttonCount ? 1 : 0) * (buttonSize + buttonSpacing);
|
|
69
|
+
const adjustedPaddingWithButtons = buttonCount > 1 ? paddingRight : adjustedPaddingRight;
|
|
70
|
+
const paddingWithIcon = buttonSize + adjustedPaddingRight;
|
|
65
71
|
return {
|
|
66
72
|
backgroundColor,
|
|
67
73
|
color,
|
|
@@ -69,7 +75,7 @@ const selectInputStyles = (_ref, themeOptions, inactive, type) => {
|
|
|
69
75
|
borderColor,
|
|
70
76
|
borderRadius,
|
|
71
77
|
paddingLeft: type === 'card' ? offsetBorder(paddingLeft + 34) : offsetBorder(paddingLeft),
|
|
72
|
-
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(
|
|
78
|
+
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(adjustedPaddingWithButtons),
|
|
73
79
|
paddingTop: offsetBorder(paddingTop),
|
|
74
80
|
paddingBottom: offsetBorder(paddingBottom),
|
|
75
81
|
minHeight,
|
|
@@ -337,7 +343,7 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
|
337
343
|
const nativeInputStyle = selectInputStyles({
|
|
338
344
|
...themeTokens,
|
|
339
345
|
height
|
|
340
|
-
}, themeOptions, inactive, type);
|
|
346
|
+
}, themeOptions, inactive, type, buttons === null || buttons === void 0 ? void 0 : buttons.length, themeTokens.buttonSize, buttonsGapSize, isPassword);
|
|
341
347
|
return /*#__PURE__*/_jsxs(View, {
|
|
342
348
|
style: selectOuterBorderStyles(themeTokens),
|
|
343
349
|
children: [type === 'card' && /*#__PURE__*/_jsx(View, {
|
package/lib-module/index.js
CHANGED
|
@@ -53,6 +53,7 @@ export { default as SkipLink } from './SkipLink';
|
|
|
53
53
|
export { default as Spacer } from './Spacer';
|
|
54
54
|
export { default as StackView } from './StackView';
|
|
55
55
|
export * from './StackView';
|
|
56
|
+
export { default as Status } from './Status';
|
|
56
57
|
export { default as StepTracker } from './StepTracker';
|
|
57
58
|
export { default as Tabs } from './Tabs';
|
|
58
59
|
export { default as Tags } from './Tags';
|
|
@@ -19,4 +19,5 @@ export { default as withLinkRouter } from './withLinkRouter';
|
|
|
19
19
|
export * from './ssr';
|
|
20
20
|
export { default as containUniqueFields } from './containUniqueFields';
|
|
21
21
|
export { default as BaseView } from './BaseView';
|
|
22
|
-
export { default as htmlAttrs } from './htmlAttrs';
|
|
22
|
+
export { default as htmlAttrs } from './htmlAttrs';
|
|
23
|
+
export { transformGradient } from './transformGradient';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms a gradient object into a CSS gradient string.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} gradient - The gradient object to transform.
|
|
5
|
+
* @param {string} gradient.type - The type of gradient (linear or radial).
|
|
6
|
+
* @param {number} gradient.angle - The angle of the linear gradient in degrees.
|
|
7
|
+
* @param {Array} gradient.stops - An array of gradient stops.
|
|
8
|
+
* @param {string} gradient.stops[].color - The color of the gradient stop.
|
|
9
|
+
* @param {number} gradient.stops[].stop - The position of the gradient stop as a percentage.
|
|
10
|
+
* @returns {string} The CSS gradient string.
|
|
11
|
+
*/
|
|
12
|
+
export const transformGradient = gradient => `${gradient.type}-gradient(${gradient.angle}deg, ${gradient.stops[0].color} ${gradient.stops[0].stop * 100}%, ${gradient.stops[1].color} ${gradient.stops[1].stop * 100}%)`;
|
|
13
|
+
export default {
|
|
14
|
+
transformGradient
|
|
15
|
+
};
|
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.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.61.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"css-mediaquery": "^0.1.2",
|
|
17
17
|
"expo-linear-gradient": "^12.5.0",
|
|
@@ -85,6 +85,6 @@
|
|
|
85
85
|
"standard-engine": {
|
|
86
86
|
"skip": true
|
|
87
87
|
},
|
|
88
|
-
"version": "1.
|
|
88
|
+
"version": "1.91.0",
|
|
89
89
|
"types": "types/index.d.ts"
|
|
90
90
|
}
|
|
@@ -616,12 +616,7 @@ const Carousel = React.forwardRef(
|
|
|
616
616
|
const systemProps = selectProps({
|
|
617
617
|
...rest,
|
|
618
618
|
accessibilityRole,
|
|
619
|
-
accessibilityLabel
|
|
620
|
-
accessibilityValue: {
|
|
621
|
-
min: 1,
|
|
622
|
-
max: childrenArray.length,
|
|
623
|
-
now: activeIndex + 1
|
|
624
|
-
}
|
|
619
|
+
accessibilityLabel
|
|
625
620
|
})
|
|
626
621
|
|
|
627
622
|
// If container isn't used for focus, give it a label of title if none is passed in,
|
package/src/OrderedList/Item.jsx
CHANGED
|
@@ -17,14 +17,14 @@ import ItemBase from './ItemBase'
|
|
|
17
17
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
18
18
|
|
|
19
19
|
const selectItemTextStyles = (
|
|
20
|
-
{ itemFontHeight, itemFontSize, itemLineHeight, itemFontName, itemColor },
|
|
20
|
+
{ itemFontHeight, itemFontSize, itemLineHeight, itemFontName, itemColor, itemTextColor },
|
|
21
21
|
themeOptions
|
|
22
22
|
) =>
|
|
23
23
|
applyTextStyles({
|
|
24
24
|
fontWeight: itemFontHeight,
|
|
25
25
|
fontSize: itemFontSize,
|
|
26
26
|
fontName: itemFontName,
|
|
27
|
-
color: itemColor,
|
|
27
|
+
color: itemColor || itemTextColor,
|
|
28
28
|
themeOptions,
|
|
29
29
|
lineHeight: itemLineHeight
|
|
30
30
|
})
|
|
@@ -37,9 +37,10 @@ const selectItemCounterStyles = ({
|
|
|
37
37
|
itemFontName,
|
|
38
38
|
itemLineHeight,
|
|
39
39
|
themeOptions,
|
|
40
|
-
itemColor
|
|
40
|
+
itemColor,
|
|
41
|
+
itemTextColor
|
|
41
42
|
}) => ({
|
|
42
|
-
color: itemColor,
|
|
43
|
+
color: itemColor || itemTextColor,
|
|
43
44
|
width: itemBulletContainerWidth,
|
|
44
45
|
textAlign: itemBulletTextAlign,
|
|
45
46
|
...applyTextStyles({
|
|
@@ -63,7 +64,7 @@ const Item = React.forwardRef(
|
|
|
63
64
|
const headingTokens = title && {
|
|
64
65
|
lineHeight: themeTokens.itemLineHeight,
|
|
65
66
|
fontSize: themeTokens.itemFontSize,
|
|
66
|
-
color: themeTokens.itemColor,
|
|
67
|
+
color: themeTokens.itemColor || themeTokens.itemTextColor,
|
|
67
68
|
fontName: themeTokens.headerFontName,
|
|
68
69
|
fontWeight: themeTokens.headerFontWeight
|
|
69
70
|
}
|
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
-
import { htmlAttrs, selectSystemProps, variantProp, viewProps } from '../utils'
|
|
4
|
+
import { htmlAttrs, selectSystemProps, variantProp, viewProps, getTokensPropType } from '../utils'
|
|
5
5
|
import OrderedListBase from './OrderedListBase'
|
|
6
6
|
import Item from './Item'
|
|
7
7
|
|
|
8
8
|
const [selectProps, selectedSystemPropsTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
9
9
|
|
|
10
|
-
const OrderedList = React.forwardRef(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const OrderedList = React.forwardRef(
|
|
11
|
+
({ children, start = 1, variant = {}, tokens = {}, ...rest }, ref) => {
|
|
12
|
+
// Pass any variants and tokens "OrderedList" receives down to the individual list items.
|
|
13
|
+
const childrenWithParentVariants = React.useMemo(() => {
|
|
14
|
+
const addVariantAndTokensToProps = (child, i, isLastChild) => {
|
|
15
|
+
const existingChildVariants = child.props?.variant ?? {}
|
|
16
|
+
const existingChildTokens = child.props?.tokens ?? {}
|
|
17
|
+
|
|
18
|
+
return React.cloneElement(child, {
|
|
19
|
+
index: start + i,
|
|
20
|
+
isLastChild,
|
|
21
|
+
variant: { ...existingChildVariants, ...variant },
|
|
22
|
+
tokens: { ...existingChildTokens, ...tokens }
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (variant || tokens) {
|
|
27
|
+
if (Array.isArray(children)) {
|
|
28
|
+
return children.map((child, i) =>
|
|
29
|
+
addVariantAndTokensToProps(child, i, i === children.length - 1)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
return [addVariantAndTokensToProps(children, 0, true)]
|
|
24
33
|
}
|
|
25
|
-
return [addVariantToProps(children, 0, true)]
|
|
26
|
-
}
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
return children
|
|
36
|
+
}, [children, variant, start, tokens])
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
38
|
+
return (
|
|
39
|
+
<OrderedListBase ref={ref} {...selectProps(rest)}>
|
|
40
|
+
{childrenWithParentVariants}
|
|
41
|
+
</OrderedListBase>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
)
|
|
37
45
|
|
|
38
46
|
OrderedList.propTypes = {
|
|
39
47
|
...selectedSystemPropsTypes,
|
|
@@ -45,7 +53,8 @@ OrderedList.propTypes = {
|
|
|
45
53
|
* The position to start the list with.
|
|
46
54
|
*/
|
|
47
55
|
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
48
|
-
variant: variantProp.propType
|
|
56
|
+
variant: variantProp.propType,
|
|
57
|
+
tokens: getTokensPropType('OrderedList')
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
OrderedList.displayName = 'OrderedList'
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Platform, StyleSheet, View } from 'react-native'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
|
|
5
|
+
import { useThemeTokens, applyTextStyles } from '../ThemeProvider'
|
|
6
|
+
import {
|
|
7
|
+
a11yProps,
|
|
8
|
+
getTokensPropType,
|
|
9
|
+
selectSystemProps,
|
|
10
|
+
variantProp,
|
|
11
|
+
viewProps,
|
|
12
|
+
wrapStringsInText,
|
|
13
|
+
transformGradient
|
|
14
|
+
} from '../utils'
|
|
15
|
+
|
|
16
|
+
import Icon from '../Icon'
|
|
17
|
+
|
|
18
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
|
|
19
|
+
|
|
20
|
+
const selectContainerStyles = ({
|
|
21
|
+
backgroundColor,
|
|
22
|
+
backgroundGradient,
|
|
23
|
+
borderColor,
|
|
24
|
+
borderRadius,
|
|
25
|
+
borderWidth,
|
|
26
|
+
paddingBottom,
|
|
27
|
+
paddingLeft,
|
|
28
|
+
paddingRight,
|
|
29
|
+
paddingTop
|
|
30
|
+
}) => {
|
|
31
|
+
const styles = {
|
|
32
|
+
borderColor,
|
|
33
|
+
borderRadius,
|
|
34
|
+
borderWidth,
|
|
35
|
+
paddingBottom,
|
|
36
|
+
paddingLeft,
|
|
37
|
+
paddingRight,
|
|
38
|
+
paddingTop
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (backgroundGradient) {
|
|
42
|
+
if (Platform.OS === 'web') {
|
|
43
|
+
styles.background = transformGradient(backgroundGradient)
|
|
44
|
+
} else {
|
|
45
|
+
const {
|
|
46
|
+
stops: [stopOne, stopTwo]
|
|
47
|
+
} = backgroundGradient
|
|
48
|
+
styles.gradient = {}
|
|
49
|
+
styles.gradient.start = { x: 0, y: 0 }
|
|
50
|
+
styles.gradient.end = { x: 1, y: 1 }
|
|
51
|
+
styles.gradient.colors = [stopOne.color, stopTwo.color]
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
styles.backgroundColor = backgroundColor
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return styles
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const selectIconProps = ({ icon, iconColor }) => ({
|
|
61
|
+
icon,
|
|
62
|
+
tokens: { color: iconColor },
|
|
63
|
+
variant: { size: 'small' }
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const selectTextStyles = ({ textColor, textLineHeight, fontName, fontSize, fontWeight }) =>
|
|
67
|
+
applyTextStyles({
|
|
68
|
+
fontColor: textColor,
|
|
69
|
+
fontName,
|
|
70
|
+
fontSize,
|
|
71
|
+
fontWeight,
|
|
72
|
+
lineHeight: Platform.OS === 'web' ? textLineHeight : textLineHeight * 1.2,
|
|
73
|
+
marginLeft: 8
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Status component displays a status indicator with optional custom gradient.
|
|
78
|
+
*
|
|
79
|
+
* @component
|
|
80
|
+
* @param {object} tokens - The tokens for customizing the status component.
|
|
81
|
+
* @param {string} variant - The variant of the status component.
|
|
82
|
+
* @param {ReactNode} children - The content to be displayed inside the status component.
|
|
83
|
+
* @param {function} customGradient - The custom gradient function for the status component.
|
|
84
|
+
* @param {object} rest - The rest of the props to be applied to the status component.
|
|
85
|
+
* @param {React.Ref} ref - The ref to be applied to the status component.
|
|
86
|
+
* @returns {ReactNode} The rendered status component.
|
|
87
|
+
*/
|
|
88
|
+
const Status = React.forwardRef(({ tokens, variant, children, customGradient, ...rest }, ref) => {
|
|
89
|
+
const themeTokens = useThemeTokens('Status', tokens, variant)
|
|
90
|
+
const containerStyles = { ...selectContainerStyles(themeTokens), ...staticStyles.container }
|
|
91
|
+
|
|
92
|
+
let content = (
|
|
93
|
+
<>
|
|
94
|
+
<Icon {...selectIconProps(themeTokens)} />
|
|
95
|
+
{wrapStringsInText(children, { style: selectTextStyles(themeTokens) })}
|
|
96
|
+
</>
|
|
97
|
+
)
|
|
98
|
+
if (typeof customGradient === 'function') {
|
|
99
|
+
content = customGradient(containerStyles.gradient, containerStyles, content)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<View ref={ref} style={containerStyles} {...selectProps(rest)}>
|
|
104
|
+
{content}
|
|
105
|
+
</View>
|
|
106
|
+
)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
Status.displayName = 'Status'
|
|
110
|
+
|
|
111
|
+
Status.propTypes = {
|
|
112
|
+
...selectedSystemPropTypes,
|
|
113
|
+
tokens: getTokensPropType('Status'),
|
|
114
|
+
variant: variantProp.propType,
|
|
115
|
+
/**
|
|
116
|
+
* The content to be displayed inside the status component.
|
|
117
|
+
*/
|
|
118
|
+
children: PropTypes.node.isRequired,
|
|
119
|
+
/**
|
|
120
|
+
* The custom gradient function for the status component.
|
|
121
|
+
*/
|
|
122
|
+
customGradient: PropTypes.func
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const staticStyles = StyleSheet.create({
|
|
126
|
+
container: {
|
|
127
|
+
flexDirection: 'row',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
...Platform.select({
|
|
130
|
+
web: {
|
|
131
|
+
display: 'inline-flex',
|
|
132
|
+
width: 'fit-content'
|
|
133
|
+
},
|
|
134
|
+
default: {
|
|
135
|
+
display: 'flex',
|
|
136
|
+
width: 'auto'
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
export default Status
|
|
@@ -42,7 +42,6 @@ const selectInputStyles = (
|
|
|
42
42
|
fontWeight,
|
|
43
43
|
lineHeight,
|
|
44
44
|
icon,
|
|
45
|
-
iconSize = 0,
|
|
46
45
|
minLines,
|
|
47
46
|
maxLines,
|
|
48
47
|
width,
|
|
@@ -50,7 +49,11 @@ const selectInputStyles = (
|
|
|
50
49
|
},
|
|
51
50
|
themeOptions,
|
|
52
51
|
inactive,
|
|
53
|
-
type
|
|
52
|
+
type,
|
|
53
|
+
buttonCount = 0,
|
|
54
|
+
buttonSize = 0,
|
|
55
|
+
buttonsGapSize = 0,
|
|
56
|
+
isPassword
|
|
54
57
|
) => {
|
|
55
58
|
// Subtract border width from padding so overall input width/height doesn't
|
|
56
59
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
@@ -82,7 +85,10 @@ const selectInputStyles = (
|
|
|
82
85
|
}
|
|
83
86
|
})
|
|
84
87
|
|
|
85
|
-
const
|
|
88
|
+
const buttonSpacing = isPassword ? buttonsGapSize : -buttonsGapSize
|
|
89
|
+
const adjustedPaddingRight = paddingRight + (buttonCount ? 1 : 0) * (buttonSize + buttonSpacing)
|
|
90
|
+
const adjustedPaddingWithButtons = buttonCount > 1 ? paddingRight : adjustedPaddingRight
|
|
91
|
+
const paddingWithIcon = buttonSize + adjustedPaddingRight
|
|
86
92
|
|
|
87
93
|
return {
|
|
88
94
|
backgroundColor,
|
|
@@ -91,7 +97,7 @@ const selectInputStyles = (
|
|
|
91
97
|
borderColor,
|
|
92
98
|
borderRadius,
|
|
93
99
|
paddingLeft: type === 'card' ? offsetBorder(paddingLeft + 34) : offsetBorder(paddingLeft),
|
|
94
|
-
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(
|
|
100
|
+
paddingRight: icon ? offsetBorder(paddingWithIcon) : offsetBorder(adjustedPaddingWithButtons),
|
|
95
101
|
paddingTop: offsetBorder(paddingTop),
|
|
96
102
|
paddingBottom: offsetBorder(paddingBottom),
|
|
97
103
|
minHeight,
|
|
@@ -321,7 +327,11 @@ const TextInputBase = React.forwardRef(
|
|
|
321
327
|
{ ...themeTokens, height },
|
|
322
328
|
themeOptions,
|
|
323
329
|
inactive,
|
|
324
|
-
type
|
|
330
|
+
type,
|
|
331
|
+
buttons?.length,
|
|
332
|
+
themeTokens.buttonSize,
|
|
333
|
+
buttonsGapSize,
|
|
334
|
+
isPassword
|
|
325
335
|
)
|
|
326
336
|
|
|
327
337
|
return (
|
package/src/index.js
CHANGED
|
@@ -53,6 +53,7 @@ export { default as SkipLink } from './SkipLink'
|
|
|
53
53
|
export { default as Spacer } from './Spacer'
|
|
54
54
|
export { default as StackView } from './StackView'
|
|
55
55
|
export * from './StackView'
|
|
56
|
+
export { default as Status } from './Status'
|
|
56
57
|
export { default as StepTracker } from './StepTracker'
|
|
57
58
|
export { default as Tabs } from './Tabs'
|
|
58
59
|
export { default as Tags } from './Tags'
|
package/src/utils/index.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms a gradient object into a CSS gradient string.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} gradient - The gradient object to transform.
|
|
5
|
+
* @param {string} gradient.type - The type of gradient (linear or radial).
|
|
6
|
+
* @param {number} gradient.angle - The angle of the linear gradient in degrees.
|
|
7
|
+
* @param {Array} gradient.stops - An array of gradient stops.
|
|
8
|
+
* @param {string} gradient.stops[].color - The color of the gradient stop.
|
|
9
|
+
* @param {number} gradient.stops[].stop - The position of the gradient stop as a percentage.
|
|
10
|
+
* @returns {string} The CSS gradient string.
|
|
11
|
+
*/
|
|
12
|
+
export const transformGradient = (gradient) =>
|
|
13
|
+
`${gradient.type}-gradient(${gradient.angle}deg, ${gradient.stops[0].color} ${
|
|
14
|
+
gradient.stops[0].stop * 100
|
|
15
|
+
}%, ${gradient.stops[1].color} ${gradient.stops[1].stop * 100}%)`
|
|
16
|
+
|
|
17
|
+
export default { transformGradient }
|