@telus-uds/components-base 1.67.1 → 1.68.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 +12 -2
- package/lib/Badge/Badge.js +121 -0
- package/lib/Badge/index.js +10 -0
- package/lib/List/ListItemContent.js +2 -1
- package/lib/List/ListItemMark.js +15 -21
- package/lib/index.js +8 -0
- package/lib-module/Badge/Badge.js +111 -0
- package/lib-module/Badge/index.js +2 -0
- package/lib-module/List/ListItemContent.js +2 -1
- package/lib-module/List/ListItemMark.js +15 -21
- package/lib-module/index.js +1 -0
- package/package.json +2 -2
- package/src/Badge/Badge.jsx +79 -0
- package/src/Badge/index.js +3 -0
- package/src/List/ListItemContent.jsx +2 -1
- package/src/List/ListItemMark.jsx +9 -10
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 15 Nov 2023 18:34:44 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.68.0
|
|
8
|
+
|
|
9
|
+
Wed, 15 Nov 2023 18:34:44 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- refactor badge component for multiplatform (guillermo.peitzner@telus.com)
|
|
14
|
+
- Changes to improve alignment and icon sizing (35577399+JoshHC@users.noreply.github.com)
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v2.45.0
|
|
16
|
+
|
|
7
17
|
## 1.67.1
|
|
8
18
|
|
|
9
|
-
Fri, 10 Nov 2023 22:
|
|
19
|
+
Fri, 10 Nov 2023 22:37:27 GMT
|
|
10
20
|
|
|
11
21
|
### Patches
|
|
12
22
|
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
9
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
10
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
13
|
+
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
const fontSizeMapping = {
|
|
20
|
+
12: 'micro',
|
|
21
|
+
14: 'small',
|
|
22
|
+
16: 'h6'
|
|
23
|
+
};
|
|
24
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs, _utils.viewProps]);
|
|
25
|
+
const selectContainerBackground = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
backgroundColor
|
|
28
|
+
} = _ref;
|
|
29
|
+
return {
|
|
30
|
+
backgroundColor
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const selectContainerBorder = _ref2 => {
|
|
34
|
+
let {
|
|
35
|
+
borderWidth,
|
|
36
|
+
borderColor,
|
|
37
|
+
borderRadius
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return {
|
|
40
|
+
borderWidth,
|
|
41
|
+
borderColor,
|
|
42
|
+
borderRadius
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const selectContainerPadding = _ref3 => {
|
|
46
|
+
let {
|
|
47
|
+
paddingTop,
|
|
48
|
+
paddingRight,
|
|
49
|
+
paddingBottom,
|
|
50
|
+
paddingLeft
|
|
51
|
+
} = _ref3;
|
|
52
|
+
return {
|
|
53
|
+
paddingTop,
|
|
54
|
+
paddingRight,
|
|
55
|
+
paddingBottom,
|
|
56
|
+
paddingLeft
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const getTypographyTokens = _ref4 => {
|
|
60
|
+
let {
|
|
61
|
+
fontName,
|
|
62
|
+
fontWeight,
|
|
63
|
+
color
|
|
64
|
+
} = _ref4;
|
|
65
|
+
return {
|
|
66
|
+
fontName,
|
|
67
|
+
fontWeight,
|
|
68
|
+
color
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const getTypographyVariant = _ref5 => {
|
|
72
|
+
let {
|
|
73
|
+
fontSize
|
|
74
|
+
} = _ref5;
|
|
75
|
+
return {
|
|
76
|
+
size: fontSizeMapping[fontSize]
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const Badge = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
80
|
+
let {
|
|
81
|
+
children,
|
|
82
|
+
tokens,
|
|
83
|
+
variant = {},
|
|
84
|
+
...rest
|
|
85
|
+
} = _ref6;
|
|
86
|
+
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Badge', tokens, variant);
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
88
|
+
ref: ref,
|
|
89
|
+
style: _Platform.default.select({
|
|
90
|
+
native: {
|
|
91
|
+
...staticStyles.container,
|
|
92
|
+
...selectContainerBackground(themeTokens),
|
|
93
|
+
...selectContainerBorder(themeTokens),
|
|
94
|
+
...selectContainerPadding(themeTokens)
|
|
95
|
+
},
|
|
96
|
+
web: {}
|
|
97
|
+
}),
|
|
98
|
+
...selectProps(rest),
|
|
99
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
100
|
+
tokens: getTypographyTokens(themeTokens),
|
|
101
|
+
variant: getTypographyVariant(themeTokens),
|
|
102
|
+
children: children
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
Badge.propTypes = {
|
|
107
|
+
...selectedSystemPropTypes,
|
|
108
|
+
children: _propTypes.default.node,
|
|
109
|
+
tokens: (0, _utils.getTokensPropType)('Badge'),
|
|
110
|
+
variant: _utils.variantProp.propType
|
|
111
|
+
};
|
|
112
|
+
Badge.displayName = 'Badge';
|
|
113
|
+
var _default = Badge;
|
|
114
|
+
exports.default = _default;
|
|
115
|
+
const staticStyles = _StyleSheet.default.create({
|
|
116
|
+
container: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
justifyContent: 'center',
|
|
119
|
+
alignSelf: 'flex-start'
|
|
120
|
+
}
|
|
121
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _Badge = _interopRequireDefault(require("./Badge"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _Badge.default;
|
|
10
|
+
exports.default = _default;
|
package/lib/List/ListItemMark.js
CHANGED
|
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
10
10
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
11
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
const tokenTypes = {
|
|
@@ -48,24 +49,11 @@ const selectBulletPositioningStyles = _ref3 => {
|
|
|
48
49
|
height: itemIconSize
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
|
-
const
|
|
52
|
-
let {
|
|
53
|
-
itemBulletWidth,
|
|
54
|
-
itemBulletHeight,
|
|
55
|
-
itemBulletColor
|
|
56
|
-
} = _ref4;
|
|
57
|
-
return {
|
|
58
|
-
width: itemBulletWidth,
|
|
59
|
-
height: itemBulletHeight,
|
|
60
|
-
borderRadius: itemBulletHeight / 2,
|
|
61
|
-
backgroundColor: itemBulletColor
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
const selectBulletContainerStyles = _ref5 => {
|
|
52
|
+
const selectBulletContainerStyles = _ref4 => {
|
|
65
53
|
let {
|
|
66
54
|
itemBulletContainerWidth,
|
|
67
55
|
itemBulletContainerAlign
|
|
68
|
-
} =
|
|
56
|
+
} = _ref4;
|
|
69
57
|
return {
|
|
70
58
|
width: itemBulletContainerWidth,
|
|
71
59
|
alignItems: itemBulletContainerAlign
|
|
@@ -79,13 +67,13 @@ const selectBulletContainerStyles = _ref5 => {
|
|
|
79
67
|
* It's the responsibility of themes to make sure that the supplied tokens align the
|
|
80
68
|
* icon or bullet nicely against the first line of text in a ListIconContent.
|
|
81
69
|
*/
|
|
82
|
-
const ListItemMark =
|
|
70
|
+
const ListItemMark = _ref5 => {
|
|
83
71
|
let {
|
|
84
72
|
icon,
|
|
85
73
|
iconColor,
|
|
86
74
|
iconSize,
|
|
87
75
|
tokens = {}
|
|
88
|
-
} =
|
|
76
|
+
} = _ref5;
|
|
89
77
|
const IconComponent = icon || /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
90
78
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
|
|
91
79
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
|
|
@@ -99,16 +87,22 @@ const ListItemMark = _ref6 => {
|
|
|
99
87
|
})
|
|
100
88
|
});
|
|
101
89
|
}
|
|
90
|
+
const bulletColor = themeTokens.itemBulletColor;
|
|
91
|
+
const {
|
|
92
|
+
bulletIcon
|
|
93
|
+
} = themeTokens;
|
|
102
94
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
103
|
-
const itemBulletStyles = selectBulletStyles(themeTokens);
|
|
104
95
|
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
|
|
105
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
106
97
|
style: [sideItemContainerStyles, itemBulletContainerStyles],
|
|
107
98
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
108
99
|
style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
testID: "unordered-item-bullet",
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
102
|
+
icon: bulletIcon,
|
|
103
|
+
tokens: {
|
|
104
|
+
color: bulletColor
|
|
105
|
+
}
|
|
112
106
|
})
|
|
113
107
|
})
|
|
114
108
|
});
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var _exportNames = {
|
|
|
8
8
|
ActivityIndicator: true,
|
|
9
9
|
Autocomplete: true,
|
|
10
10
|
Box: true,
|
|
11
|
+
Badge: true,
|
|
11
12
|
Card: true,
|
|
12
13
|
PressableCardBase: true,
|
|
13
14
|
Listbox: true,
|
|
@@ -101,6 +102,12 @@ Object.defineProperty(exports, "Autocomplete", {
|
|
|
101
102
|
return _Autocomplete.default;
|
|
102
103
|
}
|
|
103
104
|
});
|
|
105
|
+
Object.defineProperty(exports, "Badge", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () {
|
|
108
|
+
return _Badge.default;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
104
111
|
Object.defineProperty(exports, "BaseProvider", {
|
|
105
112
|
enumerable: true,
|
|
106
113
|
get: function () {
|
|
@@ -471,6 +478,7 @@ var _A11yText = _interopRequireDefault(require("./A11yText"));
|
|
|
471
478
|
var _ActivityIndicator = _interopRequireDefault(require("./ActivityIndicator"));
|
|
472
479
|
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
|
473
480
|
var _Box = _interopRequireDefault(require("./Box"));
|
|
481
|
+
var _Badge = _interopRequireDefault(require("./Badge"));
|
|
474
482
|
var _Button = require("./Button");
|
|
475
483
|
Object.keys(_Button).forEach(function (key) {
|
|
476
484
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import View from "react-native-web/dist/exports/View";
|
|
3
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { useThemeTokens } from '../ThemeProvider';
|
|
7
|
+
import Typography from '../Typography';
|
|
8
|
+
import { htmlAttrs, selectSystemProps, getTokensPropType, variantProp, viewProps } from '../utils';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const fontSizeMapping = {
|
|
11
|
+
12: 'micro',
|
|
12
|
+
14: 'small',
|
|
13
|
+
16: 'h6'
|
|
14
|
+
};
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps]);
|
|
16
|
+
const selectContainerBackground = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
backgroundColor
|
|
19
|
+
} = _ref;
|
|
20
|
+
return {
|
|
21
|
+
backgroundColor
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const selectContainerBorder = _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
borderWidth,
|
|
27
|
+
borderColor,
|
|
28
|
+
borderRadius
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return {
|
|
31
|
+
borderWidth,
|
|
32
|
+
borderColor,
|
|
33
|
+
borderRadius
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const selectContainerPadding = _ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
paddingTop,
|
|
39
|
+
paddingRight,
|
|
40
|
+
paddingBottom,
|
|
41
|
+
paddingLeft
|
|
42
|
+
} = _ref3;
|
|
43
|
+
return {
|
|
44
|
+
paddingTop,
|
|
45
|
+
paddingRight,
|
|
46
|
+
paddingBottom,
|
|
47
|
+
paddingLeft
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const getTypographyTokens = _ref4 => {
|
|
51
|
+
let {
|
|
52
|
+
fontName,
|
|
53
|
+
fontWeight,
|
|
54
|
+
color
|
|
55
|
+
} = _ref4;
|
|
56
|
+
return {
|
|
57
|
+
fontName,
|
|
58
|
+
fontWeight,
|
|
59
|
+
color
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const getTypographyVariant = _ref5 => {
|
|
63
|
+
let {
|
|
64
|
+
fontSize
|
|
65
|
+
} = _ref5;
|
|
66
|
+
return {
|
|
67
|
+
size: fontSizeMapping[fontSize]
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
const Badge = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
71
|
+
let {
|
|
72
|
+
children,
|
|
73
|
+
tokens,
|
|
74
|
+
variant = {},
|
|
75
|
+
...rest
|
|
76
|
+
} = _ref6;
|
|
77
|
+
const themeTokens = useThemeTokens('Badge', tokens, variant);
|
|
78
|
+
return /*#__PURE__*/_jsx(View, {
|
|
79
|
+
ref: ref,
|
|
80
|
+
style: Platform.select({
|
|
81
|
+
native: {
|
|
82
|
+
...staticStyles.container,
|
|
83
|
+
...selectContainerBackground(themeTokens),
|
|
84
|
+
...selectContainerBorder(themeTokens),
|
|
85
|
+
...selectContainerPadding(themeTokens)
|
|
86
|
+
},
|
|
87
|
+
web: {}
|
|
88
|
+
}),
|
|
89
|
+
...selectProps(rest),
|
|
90
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
91
|
+
tokens: getTypographyTokens(themeTokens),
|
|
92
|
+
variant: getTypographyVariant(themeTokens),
|
|
93
|
+
children: children
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
Badge.propTypes = {
|
|
98
|
+
...selectedSystemPropTypes,
|
|
99
|
+
children: PropTypes.node,
|
|
100
|
+
tokens: getTokensPropType('Badge'),
|
|
101
|
+
variant: variantProp.propType
|
|
102
|
+
};
|
|
103
|
+
Badge.displayName = 'Badge';
|
|
104
|
+
export default Badge;
|
|
105
|
+
const staticStyles = StyleSheet.create({
|
|
106
|
+
container: {
|
|
107
|
+
display: 'flex',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
alignSelf: 'flex-start'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
|
+
import Icon from '../Icon';
|
|
5
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
export const tokenTypes = {
|
|
@@ -41,24 +42,11 @@ const selectBulletPositioningStyles = _ref3 => {
|
|
|
41
42
|
height: itemIconSize
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
|
-
const
|
|
45
|
-
let {
|
|
46
|
-
itemBulletWidth,
|
|
47
|
-
itemBulletHeight,
|
|
48
|
-
itemBulletColor
|
|
49
|
-
} = _ref4;
|
|
50
|
-
return {
|
|
51
|
-
width: itemBulletWidth,
|
|
52
|
-
height: itemBulletHeight,
|
|
53
|
-
borderRadius: itemBulletHeight / 2,
|
|
54
|
-
backgroundColor: itemBulletColor
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const selectBulletContainerStyles = _ref5 => {
|
|
45
|
+
const selectBulletContainerStyles = _ref4 => {
|
|
58
46
|
let {
|
|
59
47
|
itemBulletContainerWidth,
|
|
60
48
|
itemBulletContainerAlign
|
|
61
|
-
} =
|
|
49
|
+
} = _ref4;
|
|
62
50
|
return {
|
|
63
51
|
width: itemBulletContainerWidth,
|
|
64
52
|
alignItems: itemBulletContainerAlign
|
|
@@ -72,13 +60,13 @@ const selectBulletContainerStyles = _ref5 => {
|
|
|
72
60
|
* It's the responsibility of themes to make sure that the supplied tokens align the
|
|
73
61
|
* icon or bullet nicely against the first line of text in a ListIconContent.
|
|
74
62
|
*/
|
|
75
|
-
const ListItemMark =
|
|
63
|
+
const ListItemMark = _ref5 => {
|
|
76
64
|
let {
|
|
77
65
|
icon,
|
|
78
66
|
iconColor,
|
|
79
67
|
iconSize,
|
|
80
68
|
tokens = {}
|
|
81
|
-
} =
|
|
69
|
+
} = _ref5;
|
|
82
70
|
const IconComponent = icon || /*#__PURE__*/_jsx(_Fragment, {});
|
|
83
71
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
|
|
84
72
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
|
|
@@ -92,16 +80,22 @@ const ListItemMark = _ref6 => {
|
|
|
92
80
|
})
|
|
93
81
|
});
|
|
94
82
|
}
|
|
83
|
+
const bulletColor = themeTokens.itemBulletColor;
|
|
84
|
+
const {
|
|
85
|
+
bulletIcon
|
|
86
|
+
} = themeTokens;
|
|
95
87
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
96
|
-
const itemBulletStyles = selectBulletStyles(themeTokens);
|
|
97
88
|
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
|
|
98
89
|
return /*#__PURE__*/_jsx(View, {
|
|
99
90
|
style: [sideItemContainerStyles, itemBulletContainerStyles],
|
|
100
91
|
children: /*#__PURE__*/_jsx(View, {
|
|
101
92
|
style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
testID: "unordered-item-bullet",
|
|
94
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
95
|
+
icon: bulletIcon,
|
|
96
|
+
tokens: {
|
|
97
|
+
color: bulletColor
|
|
98
|
+
}
|
|
105
99
|
})
|
|
106
100
|
})
|
|
107
101
|
});
|
package/lib-module/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as A11yText } from './A11yText';
|
|
|
2
2
|
export { default as ActivityIndicator } from './ActivityIndicator';
|
|
3
3
|
export { default as Autocomplete } from './Autocomplete';
|
|
4
4
|
export { default as Box } from './Box';
|
|
5
|
+
export { default as Badge } from './Badge';
|
|
5
6
|
export * from './Button';
|
|
6
7
|
export { default as Card, PressableCardBase } from './Card';
|
|
7
8
|
export * from './Carousel';
|
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.45.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"lodash.debounce": "^4.0.8",
|
|
17
17
|
"lodash.merge": "^4.6.2",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"standard-engine": {
|
|
74
74
|
"skip": true
|
|
75
75
|
},
|
|
76
|
-
"version": "1.
|
|
76
|
+
"version": "1.68.0"
|
|
77
77
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import { View, StyleSheet, Platform } from 'react-native'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import { useThemeTokens } from '../ThemeProvider'
|
|
5
|
+
import Typography from '../Typography'
|
|
6
|
+
import { htmlAttrs, selectSystemProps, getTokensPropType, variantProp, viewProps } from '../utils'
|
|
7
|
+
|
|
8
|
+
const fontSizeMapping = {
|
|
9
|
+
12: 'micro',
|
|
10
|
+
14: 'small',
|
|
11
|
+
16: 'h6'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
15
|
+
|
|
16
|
+
const selectContainerBackground = ({ backgroundColor }) => ({ backgroundColor })
|
|
17
|
+
|
|
18
|
+
const selectContainerBorder = ({ borderWidth, borderColor, borderRadius }) => ({
|
|
19
|
+
borderWidth,
|
|
20
|
+
borderColor,
|
|
21
|
+
borderRadius
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const selectContainerPadding = ({ paddingTop, paddingRight, paddingBottom, paddingLeft }) => ({
|
|
25
|
+
paddingTop,
|
|
26
|
+
paddingRight,
|
|
27
|
+
paddingBottom,
|
|
28
|
+
paddingLeft
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const getTypographyTokens = ({ fontName, fontWeight, color }) => ({ fontName, fontWeight, color })
|
|
32
|
+
|
|
33
|
+
const getTypographyVariant = ({ fontSize }) => ({ size: fontSizeMapping[fontSize] })
|
|
34
|
+
|
|
35
|
+
const Badge = forwardRef(({ children, tokens, variant = {}, ...rest }, ref) => {
|
|
36
|
+
const themeTokens = useThemeTokens('Badge', tokens, variant)
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<View
|
|
40
|
+
ref={ref}
|
|
41
|
+
style={Platform.select({
|
|
42
|
+
native: {
|
|
43
|
+
...staticStyles.container,
|
|
44
|
+
...selectContainerBackground(themeTokens),
|
|
45
|
+
...selectContainerBorder(themeTokens),
|
|
46
|
+
...selectContainerPadding(themeTokens)
|
|
47
|
+
},
|
|
48
|
+
web: {}
|
|
49
|
+
})}
|
|
50
|
+
{...selectProps(rest)}
|
|
51
|
+
>
|
|
52
|
+
<Typography
|
|
53
|
+
tokens={getTypographyTokens(themeTokens)}
|
|
54
|
+
variant={getTypographyVariant(themeTokens)}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</Typography>
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
Badge.propTypes = {
|
|
63
|
+
...selectedSystemPropTypes,
|
|
64
|
+
children: PropTypes.node,
|
|
65
|
+
tokens: getTokensPropType('Badge'),
|
|
66
|
+
variant: variantProp.propType
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Badge.displayName = 'Badge'
|
|
70
|
+
|
|
71
|
+
export default Badge
|
|
72
|
+
|
|
73
|
+
const staticStyles = StyleSheet.create({
|
|
74
|
+
container: {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
alignSelf: 'flex-start'
|
|
78
|
+
}
|
|
79
|
+
})
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
4
|
import { View, StyleSheet } from 'react-native'
|
|
5
|
+
import Icon from '../Icon'
|
|
5
6
|
|
|
6
7
|
export const tokenTypes = {
|
|
7
8
|
itemIconSize: PropTypes.number.isRequired,
|
|
@@ -26,13 +27,6 @@ const selectBulletPositioningStyles = ({ itemIconSize }) => ({
|
|
|
26
27
|
height: itemIconSize
|
|
27
28
|
})
|
|
28
29
|
|
|
29
|
-
const selectBulletStyles = ({ itemBulletWidth, itemBulletHeight, itemBulletColor }) => ({
|
|
30
|
-
width: itemBulletWidth,
|
|
31
|
-
height: itemBulletHeight,
|
|
32
|
-
borderRadius: itemBulletHeight / 2,
|
|
33
|
-
backgroundColor: itemBulletColor
|
|
34
|
-
})
|
|
35
|
-
|
|
36
30
|
const selectBulletContainerStyles = ({ itemBulletContainerWidth, itemBulletContainerAlign }) => ({
|
|
37
31
|
width: itemBulletContainerWidth,
|
|
38
32
|
alignItems: itemBulletContainerAlign
|
|
@@ -61,13 +55,18 @@ const ListItemMark = ({ icon, iconColor, iconSize, tokens = {} }) => {
|
|
|
61
55
|
)
|
|
62
56
|
}
|
|
63
57
|
|
|
58
|
+
const bulletColor = themeTokens.itemBulletColor
|
|
59
|
+
const { bulletIcon } = themeTokens
|
|
64
60
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens)
|
|
65
|
-
const itemBulletStyles = selectBulletStyles(themeTokens)
|
|
66
61
|
const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens)
|
|
62
|
+
|
|
67
63
|
return (
|
|
68
64
|
<View style={[sideItemContainerStyles, itemBulletContainerStyles]}>
|
|
69
|
-
<View
|
|
70
|
-
|
|
65
|
+
<View
|
|
66
|
+
style={[staticStyles.bulletPositioning, itemBulletPositioningStyles]}
|
|
67
|
+
testID="unordered-item-bullet"
|
|
68
|
+
>
|
|
69
|
+
<Icon icon={bulletIcon} tokens={{ color: bulletColor }} />
|
|
71
70
|
</View>
|
|
72
71
|
</View>
|
|
73
72
|
)
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as A11yText } from './A11yText'
|
|
|
2
2
|
export { default as ActivityIndicator } from './ActivityIndicator'
|
|
3
3
|
export { default as Autocomplete } from './Autocomplete'
|
|
4
4
|
export { default as Box } from './Box'
|
|
5
|
+
export { default as Badge } from './Badge'
|
|
5
6
|
export * from './Button'
|
|
6
7
|
export { default as Card, PressableCardBase } from './Card'
|
|
7
8
|
export * from './Carousel'
|