@telus-uds/components-base 3.25.0 → 3.27.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/lib/cjs/Card/Card.js +34 -13
  3. package/lib/cjs/Card/CardBase.js +78 -11
  4. package/lib/cjs/Card/PressableCardBase.js +147 -8
  5. package/lib/cjs/Carousel/Carousel.js +161 -77
  6. package/lib/cjs/Carousel/CarouselContext.js +10 -4
  7. package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +11 -7
  8. package/lib/cjs/Carousel/Constants.js +22 -2
  9. package/lib/cjs/Checkbox/Checkbox.js +43 -13
  10. package/lib/cjs/InputSupports/InputSupports.js +2 -1
  11. package/lib/cjs/List/List.js +24 -9
  12. package/lib/cjs/List/ListItem.js +18 -1
  13. package/lib/cjs/List/ListItemBase.js +27 -8
  14. package/lib/cjs/List/ListItemMark.js +33 -62
  15. package/lib/cjs/List/PressableListItemBase.js +1 -0
  16. package/lib/cjs/PriceLockup/PriceLockup.js +1 -1
  17. package/lib/esm/Card/Card.js +34 -13
  18. package/lib/esm/Card/CardBase.js +78 -11
  19. package/lib/esm/Card/PressableCardBase.js +148 -9
  20. package/lib/esm/Carousel/Carousel.js +153 -69
  21. package/lib/esm/Carousel/CarouselContext.js +10 -4
  22. package/lib/esm/Carousel/CarouselItem/CarouselItem.js +11 -7
  23. package/lib/esm/Carousel/Constants.js +21 -1
  24. package/lib/esm/Checkbox/Checkbox.js +43 -13
  25. package/lib/esm/InputSupports/InputSupports.js +2 -1
  26. package/lib/esm/List/List.js +24 -9
  27. package/lib/esm/List/ListItem.js +19 -2
  28. package/lib/esm/List/ListItemBase.js +27 -8
  29. package/lib/esm/List/ListItemMark.js +33 -62
  30. package/lib/esm/List/PressableListItemBase.js +1 -0
  31. package/lib/esm/PriceLockup/PriceLockup.js +1 -1
  32. package/lib/package.json +2 -2
  33. package/package.json +2 -2
  34. package/src/Card/Card.jsx +29 -7
  35. package/src/Card/CardBase.jsx +88 -8
  36. package/src/Card/PressableCardBase.jsx +135 -9
  37. package/src/Carousel/Carousel.jsx +185 -88
  38. package/src/Carousel/CarouselContext.jsx +12 -4
  39. package/src/Carousel/CarouselItem/CarouselItem.jsx +10 -6
  40. package/src/Carousel/Constants.js +24 -0
  41. package/src/Checkbox/Checkbox.jsx +29 -7
  42. package/src/InputSupports/InputSupports.jsx +6 -1
  43. package/src/List/List.jsx +33 -9
  44. package/src/List/ListItem.jsx +33 -11
  45. package/src/List/ListItemBase.jsx +33 -9
  46. package/src/List/ListItemMark.jsx +32 -53
  47. package/src/List/PressableListItemBase.jsx +1 -0
  48. package/src/PriceLockup/PriceLockup.jsx +1 -1
@@ -121,6 +121,32 @@ const selectFeedbackTokens = _ref5 => {
121
121
  feedbackMarginTop
122
122
  };
123
123
  };
124
+ const selectPressableStyles = _ref6 => {
125
+ let {
126
+ padding,
127
+ paddingLeft,
128
+ paddingRight,
129
+ paddingTop,
130
+ paddingBottom
131
+ } = _ref6;
132
+ return {
133
+ padding,
134
+ paddingLeft,
135
+ paddingRight,
136
+ paddingTop,
137
+ paddingBottom
138
+ };
139
+ };
140
+ const selectContainerStyles = _ref7 => {
141
+ let {
142
+ iconContainerHeight,
143
+ iconContainerWidth
144
+ } = _ref7;
145
+ return {
146
+ height: iconContainerHeight,
147
+ width: iconContainerWidth
148
+ };
149
+ };
124
150
 
125
151
  /**
126
152
  * Basic Checkbox component.
@@ -157,7 +183,7 @@ const selectFeedbackTokens = _ref5 => {
157
183
  * or the internal state in case of uncontrolled checkbox.
158
184
  *
159
185
  */
160
- const Checkbox = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
186
+ const Checkbox = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
161
187
  let {
162
188
  checked,
163
189
  defaultChecked,
@@ -172,8 +198,9 @@ const Checkbox = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
172
198
  tokens,
173
199
  value,
174
200
  variant,
201
+ testID,
175
202
  ...rest
176
- } = _ref6;
203
+ } = _ref8;
177
204
  const {
178
205
  currentValue: isChecked,
179
206
  setValue: setIsChecked,
@@ -230,17 +257,18 @@ const Checkbox = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
230
257
  direction: feedbackPosition === 'top' ? 'column-reverse' : 'column',
231
258
  space: 0,
232
259
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
260
+ testID: testID && `${testID}-pressable`,
233
261
  disabled: inactive,
234
262
  onKeyDown: handleKeyDown,
235
263
  onPress: handleChange,
236
264
  ...selectedProps,
237
- style: staticStyles.removeOutline,
238
- children: _ref7 => {
265
+ style: [staticStyles.removeOutline, selectPressableStyles(defaultTokens)],
266
+ children: _ref9 => {
239
267
  let {
240
268
  focused: focus,
241
269
  hovered: hover,
242
270
  pressed
243
- } = _ref7;
271
+ } = _ref9;
244
272
  const {
245
273
  icon: IconComponent,
246
274
  ...stateTokens
@@ -251,15 +279,12 @@ const Checkbox = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
251
279
  });
252
280
  const iconTokens = selectIconTokens(stateTokens);
253
281
  const labelStyles = selectLabelStyles(stateTokens, themeOptions);
254
- const alignWithLabel = label ? [staticStyles.alignWithLabel, {
255
- height: labelStyles.lineHeight
256
- }] : null;
257
282
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
258
283
  space: 0,
259
284
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
260
285
  style: staticStyles.container,
261
286
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
262
- style: alignWithLabel,
287
+ style: [staticStyles.iconContainer, selectContainerStyles(stateTokens)],
263
288
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
264
289
  style: [staticStyles.defaultInputStyles, selectInputStyles(stateTokens, isChecked)],
265
290
  testID: "Checkbox-Input",
@@ -358,7 +383,11 @@ Checkbox.propTypes = {
358
383
  /**
359
384
  * An optional Checkbox description.
360
385
  */
361
- description: _propTypes.default.string
386
+ description: _propTypes.default.string,
387
+ /**
388
+ * A identifier for testing purposes.
389
+ */
390
+ testID: _propTypes.default.string
362
391
  };
363
392
  var _default = exports.default = Checkbox;
364
393
  const staticStyles = _StyleSheet.default.create({
@@ -373,9 +402,10 @@ const staticStyles = _StyleSheet.default.create({
373
402
  alignItems: 'center',
374
403
  justifyContent: 'center'
375
404
  },
376
- alignWithLabel: {
377
- alignSelf: 'flex-start',
378
- justifyContent: 'center'
405
+ iconContainer: {
406
+ display: 'flex',
407
+ justifyContent: 'center',
408
+ alignItems: 'center'
379
409
  },
380
410
  removeOutline: {
381
411
  outlineStyle: 'none'
@@ -72,7 +72,8 @@ const InputSupports = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
72
72
  }), typeof children === 'function' ? children({
73
73
  inputId,
74
74
  ...a11yProps,
75
- validation: feedbackValidation
75
+ validation: feedbackValidation,
76
+ accessibilityDescribedBy: feedbackId
76
77
  }) : children, feedback || maxCharsReachedErrorMessage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Feedback.default, {
77
78
  id: feedbackId,
78
79
  title: feedback || maxCharsReachedErrorMessage,
@@ -13,10 +13,15 @@ var _utils = require("../utils");
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
16
+ const LIST_ITEM_TYPE = 'ListItem';
17
+ const LINKS_ITEM_TYPE = 'LinksItem';
16
18
  const isListItem = element => {
17
- const elementName = element?.type?.displayName || element?.type?.name;
18
- // Match our own ListItem, and also, custom list items
19
- return Boolean(elementName.match(/Item/));
19
+ if (!element?.type) return false;
20
+ if (element.type.__UDS_COMPONENT_TYPE__ === LIST_ITEM_TYPE) {
21
+ return true;
22
+ }
23
+ const elementName = element.type.displayName || element.type.name || '';
24
+ return elementName === LIST_ITEM_TYPE || elementName.includes(LIST_ITEM_TYPE) || elementName.includes(LINKS_ITEM_TYPE);
20
25
  };
21
26
 
22
27
  /**
@@ -29,6 +34,7 @@ const List = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
29
34
  showDivider,
30
35
  tokens,
31
36
  variant,
37
+ iconVerticalAlign,
32
38
  accessibilityRole = _Platform.default.select({
33
39
  web: 'list',
34
40
  default: undefined
@@ -38,13 +44,17 @@ const List = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
38
44
  const items = _react.default.Children.map(children, (child, index) => {
39
45
  // Pass ListItem-specific props to children (by name so teams can add their own ListItems)
40
46
  if (isListItem(child)) {
41
- return /*#__PURE__*/_react.default.cloneElement(child, {
42
- showDivider,
43
- isLastItem: index + 1 === _react.default.Children.count(children),
47
+ const childProps = {
44
48
  tokens,
45
49
  variant,
46
- ...child.props
47
- });
50
+ ...child.props,
51
+ showDivider,
52
+ isLastItem: index + 1 === _react.default.Children.count(children)
53
+ };
54
+ if (!child.props.iconVerticalAlign && iconVerticalAlign) {
55
+ childProps.iconVerticalAlign = iconVerticalAlign;
56
+ }
57
+ return /*#__PURE__*/_react.default.cloneElement(child, childProps);
48
58
  }
49
59
  return child;
50
60
  });
@@ -78,6 +88,11 @@ List.propTypes = {
78
88
  /**
79
89
  * In case it is not the last item allow display divider
80
90
  */
81
- showDivider: _propTypes.default.bool
91
+ showDivider: _propTypes.default.bool,
92
+ /**
93
+ * The vertical alignment of the icon in ListItems.
94
+ * This prop is passed down to ListItem components and can be overridden in individual List.Item components.
95
+ */
96
+ iconVerticalAlign: _propTypes.default.oneOf(['top', 'center', 'bottom'])
82
97
  };
83
98
  var _default = exports.default = List;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
9
  var _ListItemBase = _interopRequireDefault(require("./ListItemBase"));
9
10
  var _ThemeProvider = require("../ThemeProvider");
10
11
  var _utils = require("../utils");
@@ -18,6 +19,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
18
19
  variant,
19
20
  children,
20
21
  title,
22
+ iconVerticalAlign = 'top',
21
23
  ...listItemProps
22
24
  } = _ref;
23
25
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
@@ -26,12 +28,27 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
26
28
  ref: ref,
27
29
  ...listItemProps,
28
30
  title: title,
31
+ iconVerticalAlign: iconVerticalAlign,
29
32
  children: children
30
33
  });
31
34
  });
32
35
  ListItem.displayName = 'ListItem';
33
36
  ListItem.propTypes = {
37
+ /** Theme tokens for styling */
38
+ tokens: (0, _utils.getTokensPropType)('List'),
39
+ /** Variant configuration for the component */
34
40
  variant: _utils.variantProp.propType,
35
- ..._ListItemBase.default.propTypes
41
+ /** Content to be rendered within the list item */
42
+ children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
43
+ /** Title of the list item */
44
+ title: _propTypes.default.node,
45
+ /** Controls the vertical alignment of the icon */
46
+ iconVerticalAlign: _propTypes.default.oneOf(['top', 'center', 'bottom']),
47
+ /** Icon to be displayed */
48
+ icon: _propTypes.default.elementType,
49
+ /** Color of the icon */
50
+ iconColor: _propTypes.default.string,
51
+ /** Size of the icon */
52
+ iconSize: _propTypes.default.number
36
53
  };
37
54
  var _default = exports.default = ListItem;
@@ -17,6 +17,12 @@ var _ThemeProvider = require("../ThemeProvider");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
19
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
20
+ const VERTICAL_CENTERING_DIVISOR = 2;
21
+ const alignmentMap = {
22
+ top: 'flex-start',
23
+ center: 'center',
24
+ bottom: 'flex-end'
25
+ };
20
26
  const selectItemBlockStyles = _ref => {
21
27
  let {
22
28
  interItemMargin
@@ -38,10 +44,16 @@ const selectDividerStyles = _ref2 => {
38
44
  paddingBottom: interItemMarginWithDivider
39
45
  };
40
46
  };
47
+ const selectAlignmentStyles = iconVerticalAlign => ({
48
+ alignItems: alignmentMap[iconVerticalAlign]
49
+ });
41
50
 
42
51
  /**
43
52
  * ListItem is responsible for rendering icon or a bullet as side item
44
53
  */
54
+ const calculateIconMarginTop = (itemIconSize, fontSize, lineHeightRatio) => {
55
+ return (fontSize * lineHeightRatio - itemIconSize) / VERTICAL_CENTERING_DIVISOR;
56
+ };
45
57
  const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
46
58
  let {
47
59
  tokens,
@@ -52,6 +64,7 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
52
64
  children,
53
65
  title,
54
66
  isLastItem,
67
+ iconVerticalAlign = 'top',
55
68
  accessibilityRole = _Platform.default.select({
56
69
  web: 'listitem',
57
70
  default: undefined
@@ -65,7 +78,6 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
65
78
  iconMarginTop,
66
79
  itemIconSize
67
80
  } = themeTokens;
68
- let adjustedIconMarginTop = iconMarginTop;
69
81
  const {
70
82
  fontSize,
71
83
  lineHeight: lineHeightRatio
@@ -73,9 +85,8 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
73
85
  size: 'h4',
74
86
  bold: true
75
87
  });
76
- if (title) {
77
- adjustedIconMarginTop = (fontSize * lineHeightRatio - itemIconSize) / 2;
78
- }
88
+ const adjustedIconMarginTop = title ? calculateIconMarginTop(itemIconSize, fontSize, lineHeightRatio) : iconMarginTop;
89
+
79
90
  /**
80
91
  * Function responsible returning styling, in case the item is the last shouldn't
81
92
  * add extra margin on the bottom, if "showDivider" is true it should add a divider
@@ -102,7 +113,7 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
102
113
  iconSize,
103
114
  isLastItem
104
115
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
105
- style: staticStyles.container,
116
+ style: [staticStyles.innerContainer, selectAlignmentStyles(iconVerticalAlign)],
106
117
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemMark.default, {
107
118
  tokens: {
108
119
  ...tokens,
@@ -112,7 +123,7 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
112
123
  iconColor: iconColor,
113
124
  iconSize: iconSize
114
125
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
115
- style: staticStyles.titleAndContentContainer,
126
+ style: [staticStyles.titleAndContentContainer],
116
127
  children: [Boolean(title) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
117
128
  variant: {
118
129
  size: 'h4',
@@ -128,15 +139,21 @@ const ListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
128
139
  });
129
140
  });
130
141
  ListItemBase.displayName = 'ListItem';
142
+ ListItemBase.__UDS_COMPONENT_TYPE__ = 'ListItem';
131
143
  const staticStyles = _StyleSheet.default.create({
132
144
  container: {
145
+ flexDirection: 'row',
146
+ width: '100%'
147
+ },
148
+ innerContainer: {
133
149
  flex: 1,
134
150
  flexDirection: 'row'
135
151
  },
136
152
  titleAndContentContainer: {
137
153
  flexDirection: 'column',
138
- flexShrink: 1,
139
- flexGrow: 1
154
+ flex: 1,
155
+ flexGrow: 1,
156
+ flexShrink: 1
140
157
  }
141
158
  });
142
159
  ListItemBase.propTypes = {
@@ -144,6 +161,8 @@ ListItemBase.propTypes = {
144
161
  tokens: (0, _utils.getTokensPropType)('List'),
145
162
  variant: _utils.variantProp.propType,
146
163
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
164
+ /** Controls the vertical alignment of the icon */
165
+ iconVerticalAlign: _propTypes.default.oneOf(['top', 'center', 'bottom']),
147
166
  /**
148
167
  * Renders side item icon
149
168
  */
@@ -7,7 +7,6 @@ exports.tokenTypes = exports.default = void 0;
7
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
- var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
11
10
  var _Icon = _interopRequireDefault(require("../Icon"));
12
11
  var _utils = require("../utils");
13
12
  var _jsxRuntime = require("react/jsx-runtime");
@@ -16,49 +15,29 @@ const tokenTypes = exports.tokenTypes = {
16
15
  itemIconSize: _propTypes.default.number.isRequired,
17
16
  itemIconColor: _propTypes.default.string.isRequired,
18
17
  listGutter: _propTypes.default.number.isRequired,
19
- iconMarginTop: _propTypes.default.number.isRequired
18
+ iconMarginTop: _propTypes.default.number.isRequired,
19
+ bulletIcon: _propTypes.default.elementType.isRequired
20
20
  };
21
- const selectItemIconTokens = _ref => {
21
+ const selectContainerStyles = _ref => {
22
22
  let {
23
- itemIconSize,
24
- itemIconColor
23
+ listGutter
25
24
  } = _ref;
26
25
  return {
27
- size: itemIconSize,
28
- color: itemIconColor
29
- };
30
- };
31
- const selectSideItemContainerStyles = _ref2 => {
32
- let {
33
- listGutter,
34
- iconMarginTop
35
- } = _ref2;
36
- return {
37
- marginTop: iconMarginTop,
38
- marginRight: listGutter
26
+ marginInlineEnd: listGutter,
27
+ display: 'flex',
28
+ alignItems: 'flex-start'
39
29
  };
40
30
  };
41
-
42
- // Align bullets with the top line of text the same way icons are aligned
43
- const selectBulletPositioningStyles = _ref3 => {
31
+ const selectBulletStyles = _ref2 => {
44
32
  let {
45
33
  itemIconSize
46
- } = _ref3;
34
+ } = _ref2;
47
35
  return {
48
36
  width: itemIconSize,
49
- height: itemIconSize
50
- };
51
- };
52
- const selectBulletContainerStyles = _ref4 => {
53
- let {
54
- itemBulletContainerWidth,
55
- itemBulletContainerHeight,
56
- itemBulletContainerAlign
57
- } = _ref4;
58
- return {
59
- width: itemBulletContainerWidth,
60
- height: itemBulletContainerHeight,
61
- alignItems: itemBulletContainerAlign
37
+ height: itemIconSize,
38
+ alignItems: 'center',
39
+ justifyContent: 'center',
40
+ flexShrink: 0
62
41
  };
63
42
  };
64
43
  const getIconColorVariants = iconVariants => iconVariants?.filter(variant => variant[0] === 'color').map(variant => variant[1]);
@@ -70,31 +49,31 @@ const getIconColorVariants = iconVariants => iconVariants?.filter(variant => var
70
49
  * It's the responsibility of themes to make sure that the supplied tokens align the
71
50
  * icon or bullet nicely against the first line of text in a ListIconContent.
72
51
  */
73
- const ListItemMark = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
52
+ const ListItemMark = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
74
53
  let {
75
54
  icon,
76
55
  iconColor,
77
56
  iconSize,
78
57
  tokens = {}
79
- } = _ref5;
58
+ } = _ref3;
80
59
  const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
81
- const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
82
- const bulletContainerStyles = selectBulletContainerStyles(themeTokens);
83
-
84
- // TODO: Remove it when iconColor custom colors are deprecated.
60
+ const containerStyles = selectContainerStyles(themeTokens);
85
61
  const iconVariants = (0, _utils.useVariants)('Icon');
86
62
  const iconColorVariants = getIconColorVariants(iconVariants);
87
63
  if (icon) {
88
- const iconTokens = selectItemIconTokens(themeTokens);
64
+ const {
65
+ itemIconSize,
66
+ itemIconColor
67
+ } = themeTokens;
68
+ const finalIconSize = iconSize ?? itemIconSize;
69
+ const finalIconColor = iconColor && !iconColorVariants?.includes(iconColor) ? iconColor : itemIconColor;
89
70
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
90
- style: [sideItemContainerStyles, bulletContainerStyles],
71
+ style: containerStyles,
91
72
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
92
73
  icon: icon,
93
74
  tokens: {
94
- size: iconSize ?? iconTokens.size,
95
- ...((iconColor && !iconColorVariants?.includes(iconColor) || !iconColor) && {
96
- color: iconColor && !iconColorVariants?.includes(iconColor) ? iconColor : iconTokens.color
97
- })
75
+ size: finalIconSize,
76
+ color: finalIconColor
98
77
  },
99
78
  variant: {
100
79
  ...(iconColorVariants?.includes(iconColor) && {
@@ -104,23 +83,21 @@ const ListItemMark = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
104
83
  })
105
84
  });
106
85
  }
107
- const bulletColor = themeTokens.itemBulletColor;
108
86
  const {
109
- bulletIcon
87
+ itemIconSize,
88
+ itemIconColor
110
89
  } = themeTokens;
111
- const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
112
- const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
90
+ const bulletStyles = selectBulletStyles(themeTokens);
113
91
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
114
- style: [sideItemContainerStyles, itemBulletContainerStyles],
92
+ style: containerStyles,
115
93
  ref: ref,
116
94
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
117
- style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
118
- testID: "unordered-item-bullet",
95
+ style: bulletStyles,
119
96
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
120
- icon: bulletIcon,
97
+ icon: themeTokens.bulletIcon,
121
98
  tokens: {
122
- color: bulletColor,
123
- size: themeTokens.itemIconSize
99
+ color: itemIconColor,
100
+ size: itemIconSize
124
101
  }
125
102
  })
126
103
  })
@@ -142,10 +119,4 @@ ListItemMark.propTypes = {
142
119
  */
143
120
  iconSize: _propTypes.default.number
144
121
  };
145
- const staticStyles = _StyleSheet.default.create({
146
- bulletPositioning: {
147
- alignItems: 'center',
148
- justifyContent: 'center'
149
- }
150
- });
151
122
  var _default = exports.default = ListItemMark;
@@ -98,6 +98,7 @@ const PressableListItemBase = /*#__PURE__*/_react.default.forwardRef((_ref2, ref
98
98
  });
99
99
  });
100
100
  PressableListItemBase.displayName = 'PressableListItemBase';
101
+ PressableListItemBase.__UDS_COMPONENT_TYPE__ = 'ListItem';
101
102
  const staticStyles = _StyleSheet.default.create({
102
103
  itemContainer: {
103
104
  flexDirection: 'row',
@@ -149,7 +149,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
149
149
  ...selectProps(rest),
150
150
  children: [topText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
151
151
  style: staticStyles.topText,
152
- children: (0, _renderTypography.default)(topText, topTextTypographyTokens)
152
+ children: (0, _renderTypography.default)(topText, topTextTypographyTokens, undefined, fontColor)
153
153
  }) : null, (0, _renderPrice.default)(price, rateText, ratePosition, signDirection, currencySymbol, currencySymbolTypographyTokens, amountTypographyTokens, centsTypographyTokens, rateTypographyTokens, fontColor, strikeThrough, a11yText, bottomText, bottomLinksMarginLeft, footnoteLinks, onClickFootnote, themeTokens, isPriceBaseline), bottomText ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
154
154
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
155
155
  testID: "price-lockup-divider",
@@ -16,18 +16,26 @@ const SelectionType = {
16
16
  Radio: 'radiogroup',
17
17
  None: undefined
18
18
  };
19
- const selectInputStyle = _ref => {
19
+ const selectInputStyle = (_ref, _ref2) => {
20
20
  let {
21
21
  paddingTop,
22
- paddingRight
22
+ paddingRight,
23
+ paddingLeft
23
24
  } = _ref;
25
+ let {
26
+ inputPositionProp
27
+ } = _ref2;
24
28
  return {
25
29
  position: 'absolute',
26
30
  top: paddingTop,
27
- right: paddingRight
31
+ ...(inputPositionProp === 'left' ? {
32
+ left: paddingLeft
33
+ } : {
34
+ right: paddingRight
35
+ })
28
36
  };
29
37
  };
30
- const getInputProps = _ref2 => {
38
+ const getInputProps = _ref3 => {
31
39
  let {
32
40
  id,
33
41
  checkColor,
@@ -37,7 +45,7 @@ const getInputProps = _ref2 => {
37
45
  isChecked,
38
46
  isInactive,
39
47
  handleChange
40
- } = _ref2;
48
+ } = _ref3;
41
49
  return {
42
50
  inputId: id,
43
51
  tokens: {
@@ -100,7 +108,7 @@ const getInputProps = _ref2 => {
100
108
  * you automatically make inaccessible its children, which may or may not be appropriate
101
109
  * depending on what you are trying to achieve.
102
110
  */
103
- const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
111
+ const Card = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
104
112
  let {
105
113
  children,
106
114
  tokens,
@@ -110,8 +118,9 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
110
118
  id,
111
119
  interactiveCard,
112
120
  backgroundImage,
121
+ testID,
113
122
  ...rest
114
- } = _ref3;
123
+ } = _ref4;
115
124
  const viewport = useViewport();
116
125
  const {
117
126
  themeOptions
@@ -182,8 +191,8 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
182
191
  let cardStyles;
183
192
  let mediaIds;
184
193
  if (enableMediaQueryStyleSheet) {
185
- const transformedThemeTokens = Object.entries(themeTokens).reduce((acc, _ref4) => {
186
- let [vp, viewportTokens] = _ref4;
194
+ const transformedThemeTokens = Object.entries(themeTokens).reduce((acc, _ref5) => {
195
+ let [vp, viewportTokens] = _ref5;
187
196
  const tokensToTransform = selectionType ? selectStyles({
188
197
  ...viewportTokens,
189
198
  paddingTop: 0,
@@ -210,13 +219,18 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
210
219
  cardStyles = themeTokens;
211
220
  }
212
221
  const renderInputPerSelectionType = props => {
222
+ const containerStyle = selectInputStyle(getThemeTokens(), {
223
+ inputPositionProp: interactiveCard?.inputPosition
224
+ });
225
+ const inputTestID = testID && `${testID}-selection-input`;
213
226
  if (!isControl) {
214
227
  return null;
215
228
  }
216
229
  switch (selectionType) {
217
230
  case SelectionType.Checkbox:
218
231
  return /*#__PURE__*/_jsx(View, {
219
- style: selectInputStyle(getThemeTokens()),
232
+ style: containerStyle,
233
+ testID: inputTestID,
220
234
  children: /*#__PURE__*/_jsx(CheckboxButton, {
221
235
  ...props,
222
236
  tokens: {
@@ -227,7 +241,8 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
227
241
  });
228
242
  case SelectionType.Radio:
229
243
  return /*#__PURE__*/_jsx(View, {
230
- style: selectInputStyle(getThemeTokens()),
244
+ style: containerStyle,
245
+ testID: inputTestID,
231
246
  children: /*#__PURE__*/_jsx(RadioButton, {
232
247
  ...props,
233
248
  tokens: {
@@ -248,6 +263,7 @@ const Card = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
248
263
  dataSet: mediaIds && {
249
264
  media: mediaIds
250
265
  },
266
+ testID: testID,
251
267
  ...selectProps(rest),
252
268
  children: [interactiveCard?.body && /*#__PURE__*/_jsx(PressableCardBase, {
253
269
  ref: ref,
@@ -326,7 +342,8 @@ Card.propTypes = {
326
342
  selectionType: PropTypes.oneOf(Object.values(SelectionType)),
327
343
  variant: variantProp.propType,
328
344
  href: PropTypes.string,
329
- hrefAttrs: PropTypes.shape(hrefAttrsProp.types)
345
+ hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
346
+ inputPosition: PropTypes.oneOf(['left', 'right'])
330
347
  }),
331
348
  /**
332
349
  * Apply background image to the card.
@@ -343,6 +360,10 @@ Card.propTypes = {
343
360
  /**
344
361
  * Data set for the card.
345
362
  */
346
- dataSet: PropTypes.object
363
+ dataSet: PropTypes.object,
364
+ /**
365
+ * Test ID used for e2e testing.
366
+ */
367
+ testID: PropTypes.string
347
368
  };
348
369
  export default Card;