@telus-uds/components-base 1.67.0 → 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 CHANGED
@@ -1,12 +1,32 @@
1
1
  # Change Log - @telus-uds/components-base
2
2
 
3
- This log was last generated on Tue, 07 Nov 2023 16:20:19 GMT and should not be manually modified.
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
+
17
+ ## 1.67.1
18
+
19
+ Fri, 10 Nov 2023 22:37:27 GMT
20
+
21
+ ### Patches
22
+
23
+ - Add new stories for quiet variant for Link component (email not defined)
24
+ - fixes for error border validation to checkboxgroup, checkboxcardgroup, radiogroup and radiocardgroup (email not defined)
25
+ - Bump @telus-uds/system-theme-tokens to v2.44.1
26
+
7
27
  ## 1.67.0
8
28
 
9
- Tue, 07 Nov 2023 16:20:19 GMT
29
+ Tue, 07 Nov 2023 16:32:21 GMT
10
30
 
11
31
  ### Minor changes
12
32
 
@@ -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;
@@ -101,6 +101,14 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
101
101
  } = (0, _ThemeProvider.useThemeTokens)('CheckboxGroup', tokens, variant, {
102
102
  viewport
103
103
  });
104
+ const borderTokens = {
105
+ outlineWidth,
106
+ borderTopLeftRadius,
107
+ borderTopRightRadius,
108
+ borderBottomLeftRadius,
109
+ borderBottomRightRadius,
110
+ outlineOffset
111
+ };
104
112
  const {
105
113
  currentValues,
106
114
  toggleOneValue
@@ -152,14 +160,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
152
160
  inactive: inactive,
153
161
  validation: validation,
154
162
  showErrorBorder: true,
155
- tokens: {
156
- outlineWidth,
157
- borderTopLeftRadius,
158
- borderTopRightRadius,
159
- borderBottomLeftRadius,
160
- borderBottomRightRadius,
161
- outlineOffset
162
- },
163
+ tokens: borderTokens,
163
164
  showIcon: showIcon,
164
165
  ...selectProps(rest),
165
166
  children: (0, _StackView.getStackedContent)(checkboxes, {
@@ -44,6 +44,7 @@ const CheckboxCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
44
44
  space,
45
45
  fieldSpace,
46
46
  direction,
47
+ showIcon,
47
48
  outlineWidth,
48
49
  borderTopLeftRadius,
49
50
  borderTopRightRadius,
@@ -93,7 +94,7 @@ const CheckboxCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
93
94
  validation: validation,
94
95
  tokens: borderTokens,
95
96
  showErrorBorder: true,
96
- showIcon: true,
97
+ showIcon: showIcon,
97
98
  accessibilityRole: "checkbox",
98
99
  ...selectProps(rest),
99
100
  children: checkboxCardProperties => /*#__PURE__*/(0, _jsxRuntime.jsx)(StackContainer, {
@@ -67,7 +67,8 @@ const ListItemContent = _ref2 => {
67
67
  };
68
68
  const staticStyles = _StyleSheet.default.create({
69
69
  wrap: {
70
- flex: 1
70
+ flex: 1,
71
+ justifyContent: 'center'
71
72
  }
72
73
  });
73
74
  ListItemContent.propTypes = {
@@ -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 selectBulletStyles = _ref4 => {
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
- } = _ref5;
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 = _ref6 => {
70
+ const ListItemMark = _ref5 => {
83
71
  let {
84
72
  icon,
85
73
  iconColor,
86
74
  iconSize,
87
75
  tokens = {}
88
- } = _ref6;
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
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
110
- style: itemBulletStyles,
111
- testID: "unordered-item-bullet"
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
  });
@@ -94,10 +94,25 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
94
94
  const {
95
95
  space,
96
96
  fieldSpace,
97
- direction
97
+ direction,
98
+ showIcon,
99
+ outlineWidth,
100
+ borderTopLeftRadius,
101
+ borderTopRightRadius,
102
+ borderBottomLeftRadius,
103
+ borderBottomRightRadius,
104
+ outlineOffset
98
105
  } = (0, _ThemeProvider.useThemeTokens)('RadioCardGroup', tokens, variant, {
99
106
  viewport
100
107
  });
108
+ const borderTokens = {
109
+ outlineWidth,
110
+ borderTopLeftRadius,
111
+ borderTopRightRadius,
112
+ borderBottomLeftRadius,
113
+ borderBottomRightRadius,
114
+ outlineOffset
115
+ };
101
116
  const {
102
117
  currentValue,
103
118
  setValue
@@ -129,7 +144,8 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
129
144
  inactive: inactive || readOnly,
130
145
  validation: validation,
131
146
  showErrorBorder: true,
132
- showIcon: true,
147
+ tokens: borderTokens,
148
+ showIcon: showIcon,
133
149
  accessibilityRole: "radiogroup",
134
150
  ...selectProps(rest),
135
151
  children: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(StackContainer, {
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
+ });
@@ -0,0 +1,2 @@
1
+ import Badge from './Badge';
2
+ export default Badge;
@@ -92,6 +92,14 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
92
92
  } = useThemeTokens('CheckboxGroup', tokens, variant, {
93
93
  viewport
94
94
  });
95
+ const borderTokens = {
96
+ outlineWidth,
97
+ borderTopLeftRadius,
98
+ borderTopRightRadius,
99
+ borderBottomLeftRadius,
100
+ borderBottomRightRadius,
101
+ outlineOffset
102
+ };
95
103
  const {
96
104
  currentValues,
97
105
  toggleOneValue
@@ -143,14 +151,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
143
151
  inactive: inactive,
144
152
  validation: validation,
145
153
  showErrorBorder: true,
146
- tokens: {
147
- outlineWidth,
148
- borderTopLeftRadius,
149
- borderTopRightRadius,
150
- borderBottomLeftRadius,
151
- borderBottomRightRadius,
152
- outlineOffset
153
- },
154
+ tokens: borderTokens,
154
155
  showIcon: showIcon,
155
156
  ...selectProps(rest),
156
157
  children: getStackedContent(checkboxes, {
@@ -35,6 +35,7 @@ const CheckboxCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
35
35
  space,
36
36
  fieldSpace,
37
37
  direction,
38
+ showIcon,
38
39
  outlineWidth,
39
40
  borderTopLeftRadius,
40
41
  borderTopRightRadius,
@@ -84,7 +85,7 @@ const CheckboxCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
84
85
  validation: validation,
85
86
  tokens: borderTokens,
86
87
  showErrorBorder: true,
87
- showIcon: true,
88
+ showIcon: showIcon,
88
89
  accessibilityRole: "checkbox",
89
90
  ...selectProps(rest),
90
91
  children: checkboxCardProperties => /*#__PURE__*/_jsx(StackContainer, {
@@ -59,7 +59,8 @@ const ListItemContent = _ref2 => {
59
59
  };
60
60
  const staticStyles = StyleSheet.create({
61
61
  wrap: {
62
- flex: 1
62
+ flex: 1,
63
+ justifyContent: 'center'
63
64
  }
64
65
  });
65
66
  ListItemContent.propTypes = {
@@ -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 selectBulletStyles = _ref4 => {
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
- } = _ref5;
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 = _ref6 => {
63
+ const ListItemMark = _ref5 => {
76
64
  let {
77
65
  icon,
78
66
  iconColor,
79
67
  iconSize,
80
68
  tokens = {}
81
- } = _ref6;
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
- children: /*#__PURE__*/_jsx(View, {
103
- style: itemBulletStyles,
104
- testID: "unordered-item-bullet"
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
  });
@@ -85,10 +85,25 @@ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
85
85
  const {
86
86
  space,
87
87
  fieldSpace,
88
- direction
88
+ direction,
89
+ showIcon,
90
+ outlineWidth,
91
+ borderTopLeftRadius,
92
+ borderTopRightRadius,
93
+ borderBottomLeftRadius,
94
+ borderBottomRightRadius,
95
+ outlineOffset
89
96
  } = useThemeTokens('RadioCardGroup', tokens, variant, {
90
97
  viewport
91
98
  });
99
+ const borderTokens = {
100
+ outlineWidth,
101
+ borderTopLeftRadius,
102
+ borderTopRightRadius,
103
+ borderBottomLeftRadius,
104
+ borderBottomRightRadius,
105
+ outlineOffset
106
+ };
92
107
  const {
93
108
  currentValue,
94
109
  setValue
@@ -120,7 +135,8 @@ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
120
135
  inactive: inactive || readOnly,
121
136
  validation: validation,
122
137
  showErrorBorder: true,
123
- showIcon: true,
138
+ tokens: borderTokens,
139
+ showIcon: showIcon,
124
140
  accessibilityRole: "radiogroup",
125
141
  ...selectProps(rest),
126
142
  children: props => /*#__PURE__*/_jsx(StackContainer, {
@@ -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.44.0",
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.67.0"
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
+ })
@@ -0,0 +1,3 @@
1
+ import Badge from './Badge'
2
+
3
+ export default Badge
@@ -112,6 +112,15 @@ const CheckboxGroup = forwardRef(
112
112
  viewport
113
113
  })
114
114
 
115
+ const borderTokens = {
116
+ outlineWidth,
117
+ borderTopLeftRadius,
118
+ borderTopRightRadius,
119
+ borderBottomLeftRadius,
120
+ borderBottomRightRadius,
121
+ outlineOffset
122
+ }
123
+
115
124
  const { currentValues, toggleOneValue } = useMultipleInputValues({
116
125
  values: checkedIds,
117
126
  initialValues: initialCheckedIds,
@@ -163,14 +172,7 @@ const CheckboxGroup = forwardRef(
163
172
  inactive={inactive}
164
173
  validation={validation}
165
174
  showErrorBorder
166
- tokens={{
167
- outlineWidth,
168
- borderTopLeftRadius,
169
- borderTopRightRadius,
170
- borderBottomLeftRadius,
171
- borderBottomRightRadius,
172
- outlineOffset
173
- }}
175
+ tokens={borderTokens}
174
176
  showIcon={showIcon}
175
177
  {...selectProps(rest)}
176
178
  >
@@ -53,6 +53,7 @@ const CheckboxCardGroup = forwardRef(
53
53
  space,
54
54
  fieldSpace,
55
55
  direction,
56
+ showIcon,
56
57
  outlineWidth,
57
58
  borderTopLeftRadius,
58
59
  borderTopRightRadius,
@@ -104,7 +105,7 @@ const CheckboxCardGroup = forwardRef(
104
105
  validation={validation}
105
106
  tokens={borderTokens}
106
107
  showErrorBorder
107
- showIcon
108
+ showIcon={showIcon}
108
109
  accessibilityRole="checkbox"
109
110
  {...selectProps(rest)}
110
111
  >
@@ -54,7 +54,8 @@ const ListItemContent = ({ tokens, children }) => {
54
54
 
55
55
  const staticStyles = StyleSheet.create({
56
56
  wrap: {
57
- flex: 1
57
+ flex: 1,
58
+ justifyContent: 'center'
58
59
  }
59
60
  })
60
61
 
@@ -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 style={[staticStyles.bulletPositioning, itemBulletPositioningStyles]}>
70
- <View style={itemBulletStyles} testID="unordered-item-bullet" />
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
  )
@@ -99,10 +99,30 @@ const RadioCardGroup = forwardRef(
99
99
  ref
100
100
  ) => {
101
101
  const viewport = useViewport()
102
- const { space, fieldSpace, direction } = useThemeTokens('RadioCardGroup', tokens, variant, {
102
+ const {
103
+ space,
104
+ fieldSpace,
105
+ direction,
106
+ showIcon,
107
+ outlineWidth,
108
+ borderTopLeftRadius,
109
+ borderTopRightRadius,
110
+ borderBottomLeftRadius,
111
+ borderBottomRightRadius,
112
+ outlineOffset
113
+ } = useThemeTokens('RadioCardGroup', tokens, variant, {
103
114
  viewport
104
115
  })
105
116
 
117
+ const borderTokens = {
118
+ outlineWidth,
119
+ borderTopLeftRadius,
120
+ borderTopRightRadius,
121
+ borderBottomLeftRadius,
122
+ borderBottomRightRadius,
123
+ outlineOffset
124
+ }
125
+
106
126
  const { currentValue, setValue } = useInputValue({
107
127
  value: checkedId,
108
128
  initialValue: initialCheckedId,
@@ -134,7 +154,8 @@ const RadioCardGroup = forwardRef(
134
154
  inactive={inactive || readOnly}
135
155
  validation={validation}
136
156
  showErrorBorder
137
- showIcon
157
+ tokens={borderTokens}
158
+ showIcon={showIcon}
138
159
  accessibilityRole="radiogroup"
139
160
  {...selectProps(rest)}
140
161
  >
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'