@telus-uds/components-base 3.28.2 → 3.29.1

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 (93) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/jest.config.cjs +1 -0
  3. package/lib/cjs/ActionCard/ActionCard.js +4 -4
  4. package/lib/cjs/ActivityIndicator/Dots.native.js +1 -2
  5. package/lib/cjs/ActivityIndicator/Spinner.native.js +1 -2
  6. package/lib/cjs/Box/Box.js +1 -2
  7. package/lib/cjs/Button/Button.js +1 -2
  8. package/lib/cjs/Button/ButtonBase.js +8 -8
  9. package/lib/cjs/Button/ButtonDropdown.js +1 -2
  10. package/lib/cjs/Button/ButtonGroup.js +1 -2
  11. package/lib/cjs/Button/ButtonLink.js +1 -2
  12. package/lib/cjs/Card/Card.js +1 -2
  13. package/lib/cjs/Card/CardBase.js +12 -0
  14. package/lib/cjs/Card/PressableCardBase.js +1 -2
  15. package/lib/cjs/Card/index.js +1 -2
  16. package/lib/cjs/CardGroup/CardGroup.js +1 -2
  17. package/lib/cjs/Carousel/Carousel.js +6 -6
  18. package/lib/cjs/CheckboxCard/CheckboxCard.js +1 -2
  19. package/lib/cjs/CheckboxCardGroup/CheckboxCardGroup.js +1 -2
  20. package/lib/cjs/ColourToggle/ColourBubble.js +17 -3
  21. package/lib/cjs/ColourToggle/ColourToggle.js +8 -2
  22. package/lib/cjs/ExpandCollapse/Control.js +17 -3
  23. package/lib/cjs/ExpandCollapse/Panel.js +6 -0
  24. package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +14 -2
  25. package/lib/cjs/ExpandCollapseMini/ExpandCollapseMiniControl.js +15 -2
  26. package/lib/cjs/HorizontalScroll/index.js +1 -2
  27. package/lib/cjs/Icon/IconText.js +1 -2
  28. package/lib/cjs/Icon/index.js +1 -2
  29. package/lib/cjs/InputSupports/InputSupports.js +1 -2
  30. package/lib/cjs/InputSupports/useInputSupports.js +1 -3
  31. package/lib/cjs/Link/ChevronLink.js +1 -0
  32. package/lib/cjs/Link/LinkBase.js +29 -13
  33. package/lib/cjs/Link/MobileIconTextContent.js +155 -0
  34. package/lib/cjs/Listbox/Listbox.js +1 -2
  35. package/lib/cjs/Modal/Modal.js +1 -1
  36. package/lib/cjs/Pagination/PageButton.js +1 -2
  37. package/lib/cjs/Pagination/Pagination.js +1 -2
  38. package/lib/cjs/QuickLinks/QuickLinks.js +7 -0
  39. package/lib/cjs/Radio/Radio.js +1 -2
  40. package/lib/cjs/RadioCard/RadioCard.js +1 -2
  41. package/lib/cjs/RadioCard/RadioCardGroup.js +1 -2
  42. package/lib/cjs/Shortcuts/Shortcuts.js +1 -2
  43. package/lib/cjs/SideNav/SideNav.js +1 -2
  44. package/lib/cjs/StackView/StackWrapBox.js +9 -1
  45. package/lib/cjs/StackView/StackWrapGap.js +3 -1
  46. package/lib/cjs/StackView/getStackedContent.js +21 -12
  47. package/lib/cjs/TabBar/TabBar.js +7 -2
  48. package/lib/cjs/Tabs/Tabs.js +1 -2
  49. package/lib/cjs/Tooltip/Tooltip.native.js +2 -2
  50. package/lib/cjs/index.js +1 -2
  51. package/lib/cjs/utils/index.js +1 -2
  52. package/lib/esm/ActionCard/ActionCard.js +4 -4
  53. package/lib/esm/Button/ButtonBase.js +8 -8
  54. package/lib/esm/Card/CardBase.js +12 -0
  55. package/lib/esm/Carousel/Carousel.js +6 -6
  56. package/lib/esm/ColourToggle/ColourBubble.js +17 -3
  57. package/lib/esm/ColourToggle/ColourToggle.js +8 -2
  58. package/lib/esm/ExpandCollapse/Control.js +17 -3
  59. package/lib/esm/ExpandCollapse/Panel.js +6 -0
  60. package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +14 -2
  61. package/lib/esm/ExpandCollapseMini/ExpandCollapseMiniControl.js +15 -2
  62. package/lib/esm/InputSupports/InputSupports.js +1 -2
  63. package/lib/esm/InputSupports/useInputSupports.js +1 -3
  64. package/lib/esm/Link/ChevronLink.js +1 -0
  65. package/lib/esm/Link/LinkBase.js +29 -13
  66. package/lib/esm/Link/MobileIconTextContent.js +147 -0
  67. package/lib/esm/Modal/Modal.js +1 -1
  68. package/lib/esm/QuickLinks/QuickLinks.js +7 -0
  69. package/lib/esm/StackView/StackWrapBox.js +9 -1
  70. package/lib/esm/StackView/StackWrapGap.js +3 -1
  71. package/lib/esm/StackView/getStackedContent.js +20 -10
  72. package/lib/esm/TabBar/TabBar.js +7 -2
  73. package/lib/esm/Tooltip/Tooltip.native.js +2 -2
  74. package/lib/package.json +1 -1
  75. package/package.json +1 -1
  76. package/src/Card/CardBase.jsx +12 -0
  77. package/src/ColourToggle/ColourBubble.jsx +18 -3
  78. package/src/ColourToggle/ColourToggle.jsx +7 -2
  79. package/src/ExpandCollapse/Control.jsx +24 -4
  80. package/src/ExpandCollapse/Panel.jsx +6 -0
  81. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +23 -3
  82. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +14 -2
  83. package/src/InputSupports/InputSupports.jsx +1 -6
  84. package/src/InputSupports/useInputSupports.js +1 -1
  85. package/src/Link/ChevronLink.jsx +1 -0
  86. package/src/Link/LinkBase.jsx +47 -20
  87. package/src/Link/MobileIconTextContent.jsx +129 -0
  88. package/src/Modal/Modal.jsx +1 -1
  89. package/src/QuickLinks/QuickLinks.jsx +8 -0
  90. package/src/StackView/StackWrapBox.jsx +13 -1
  91. package/src/StackView/StackWrapGap.jsx +2 -1
  92. package/src/StackView/getStackedContent.jsx +22 -8
  93. package/src/TabBar/TabBar.jsx +21 -4
@@ -213,7 +213,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
213
213
  focus: focused
214
214
  };
215
215
  };
216
- const onTooltipLayout = _ref10 => {
216
+ const onTooltipLayout = _ref0 => {
217
217
  let {
218
218
  nativeEvent: {
219
219
  layout: {
@@ -221,7 +221,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
221
221
  height
222
222
  }
223
223
  }
224
- } = _ref10;
224
+ } = _ref0;
225
225
  if (tooltipDimensions === null || tooltipDimensions.width !== width || tooltipDimensions.height !== height) {
226
226
  setTooltipDimensions({
227
227
  width: _Platform.default.select({
package/lib/cjs/index.js CHANGED
@@ -816,6 +816,5 @@ Object.keys(_utils).forEach(function (key) {
816
816
  });
817
817
  });
818
818
  var _Portal = _interopRequireDefault(require("./Portal"));
819
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
820
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
819
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
821
820
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -280,6 +280,5 @@ var _getSpacingScale = _interopRequireDefault(require("./getSpacingScale"));
280
280
  var _useVariants = _interopRequireDefault(require("./useVariants"));
281
281
  var _isTouchDevice = _interopRequireDefault(require("./isTouchDevice"));
282
282
  var _resolveContentMaxWidth = _interopRequireDefault(require("./resolveContentMaxWidth"));
283
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
284
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
283
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
285
284
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -153,11 +153,11 @@ const selectActionIconStyles = _ref9 => {
153
153
  marginTop: actionIconMarginTop
154
154
  };
155
155
  };
156
- const selectActionIconProps = _ref10 => {
156
+ const selectActionIconProps = _ref0 => {
157
157
  let {
158
158
  actionIcon,
159
159
  actionIconColor
160
- } = _ref10;
160
+ } = _ref0;
161
161
  return {
162
162
  icon: actionIcon,
163
163
  tokens: {
@@ -186,7 +186,7 @@ const ACTION_ICON_ANIMATION_DURATION = 100;
186
186
  * </ActionCard>
187
187
  * )
188
188
  */
189
- const ActionCard = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
189
+ const ActionCard = /*#__PURE__*/React.forwardRef((_ref1, ref) => {
190
190
  let {
191
191
  icon,
192
192
  title,
@@ -197,7 +197,7 @@ const ActionCard = /*#__PURE__*/React.forwardRef((_ref11, ref) => {
197
197
  tokens,
198
198
  variant,
199
199
  ...rest
200
- } = _ref11;
200
+ } = _ref1;
201
201
  const themeTokens = useThemeTokens('ActionCard', tokens, variant);
202
202
  const actionIconAnimation = React.useRef(new Animated.Value(0)).current;
203
203
  const {
@@ -218,27 +218,27 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref9) => {
218
218
  default: {}
219
219
  });
220
220
  };
221
- const selectButtonStyles = _ref10 => {
221
+ const selectButtonStyles = _ref0 => {
222
222
  let {
223
223
  textAlign
224
- } = _ref10;
224
+ } = _ref0;
225
225
  return {
226
226
  flexDirection: 'row',
227
227
  justifyContent: textAlign
228
228
  };
229
229
  };
230
- const selectItemIconTokens = _ref11 => {
230
+ const selectItemIconTokens = _ref1 => {
231
231
  let {
232
232
  color,
233
233
  iconColor,
234
234
  iconSize
235
- } = _ref11;
235
+ } = _ref1;
236
236
  return {
237
237
  size: iconSize,
238
238
  color: iconColor || color
239
239
  };
240
240
  };
241
- const ButtonBase = /*#__PURE__*/React.forwardRef((_ref12, ref) => {
241
+ const ButtonBase = /*#__PURE__*/React.forwardRef((_ref10, ref) => {
242
242
  let {
243
243
  id,
244
244
  href,
@@ -254,7 +254,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef((_ref12, ref) => {
254
254
  iconProps,
255
255
  heightFull = true,
256
256
  ...rawRest
257
- } = _ref12;
257
+ } = _ref10;
258
258
  const {
259
259
  themeOptions
260
260
  } = useTheme();
@@ -282,8 +282,8 @@ const ButtonBase = /*#__PURE__*/React.forwardRef((_ref12, ref) => {
282
282
  focused: false
283
283
  };
284
284
  const defaultTokensByViewport = resolveButtonTokens(defaultPressableState);
285
- const layoutTokensByViewport = Object.entries(defaultTokensByViewport).reduce((acc, _ref13) => {
286
- let [vp, viewportTokens] = _ref13;
285
+ const layoutTokensByViewport = Object.entries(defaultTokensByViewport).reduce((acc, _ref11) => {
286
+ let [vp, viewportTokens] = _ref11;
287
287
  const flexAndWidthStyles = viewportTokens.width === '100%' && viewportTokens.flex === 1 ? selectFlexAndWidthStyles(viewportTokens) : {};
288
288
  acc[vp] = {
289
289
  ...staticStyles.row,
@@ -57,9 +57,21 @@ const setBackgroundImage = _ref => {
57
57
  case 'left-center':
58
58
  backgroundPosition = 'left center';
59
59
  break;
60
+ case 'left-start':
61
+ backgroundPosition = 'left top';
62
+ break;
63
+ case 'left-end':
64
+ backgroundPosition = 'left bottom';
65
+ break;
60
66
  case 'right-center':
61
67
  backgroundPosition = 'right center';
62
68
  break;
69
+ case 'right-start':
70
+ backgroundPosition = 'right top';
71
+ break;
72
+ case 'right-end':
73
+ backgroundPosition = 'right bottom';
74
+ break;
63
75
  default:
64
76
  backgroundPosition = 'center center';
65
77
  }
@@ -761,7 +761,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
761
761
  height
762
762
  }));
763
763
  };
764
- const onHeroContainerLayout = _ref10 => {
764
+ const onHeroContainerLayout = _ref0 => {
765
765
  let {
766
766
  nativeEvent: {
767
767
  layout: {
@@ -771,7 +771,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
771
771
  height
772
772
  }
773
773
  }
774
- } = _ref10;
774
+ } = _ref0;
775
775
  return setHeroContainerLayout(prevState => ({
776
776
  ...prevState,
777
777
  x,
@@ -780,17 +780,17 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
780
780
  height
781
781
  }));
782
782
  };
783
- const onPreviousNextNavigationButtonLayout = _ref11 => {
783
+ const onPreviousNextNavigationButtonLayout = _ref1 => {
784
784
  let {
785
785
  nativeEvent: {
786
786
  layout: {
787
787
  width
788
788
  }
789
789
  }
790
- } = _ref11;
790
+ } = _ref1;
791
791
  return setPreviousNextNavigationButtonWidth(width);
792
792
  };
793
- const onRootContainerLayout = _ref12 => {
793
+ const onRootContainerLayout = _ref10 => {
794
794
  let {
795
795
  nativeEvent: {
796
796
  layout: {
@@ -800,7 +800,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
800
800
  height
801
801
  }
802
802
  }
803
- } = _ref12;
803
+ } = _ref10;
804
804
  return setRootContainerLayout(prevState => ({
805
805
  ...prevState,
806
806
  x,
@@ -6,6 +6,7 @@ import Platform from "react-native-web/dist/exports/Platform";
6
6
  import { resolvePressableTokens } from '../utils/pressability';
7
7
  import { applyShadowToken } from '../ThemeProvider';
8
8
  import { getTokensPropType } from '../utils';
9
+ import Tooltip from '../Tooltip';
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  const selectGeneralBubbleTokens = _ref => {
11
12
  let {
@@ -69,14 +70,15 @@ const ColourBubble = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
69
70
  colourHexCode,
70
71
  colourName,
71
72
  isSelected,
72
- onPress
73
+ onPress,
74
+ showTooltip
73
75
  } = _ref4;
74
76
  const defaultTokens = tokens({
75
77
  selected: isSelected
76
78
  });
77
79
  const resolveColourBubbleTokens = pressState => resolvePressableTokens(tokens, pressState, {});
78
80
  const themeTokens = React.useMemo(() => tokens(), [tokens]);
79
- return /*#__PURE__*/_jsx(Pressable, {
81
+ const pressable = /*#__PURE__*/_jsx(Pressable, {
80
82
  style: state => [selectGeneralBubbleTokens(resolveColourBubbleTokens(state)), isSelected && selectBorderBubbleTokens(defaultTokens)],
81
83
  onPress: onPress,
82
84
  accessible: true,
@@ -93,6 +95,14 @@ const ColourBubble = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
93
95
  }]
94
96
  })
95
97
  });
98
+ if (showTooltip) {
99
+ return /*#__PURE__*/_jsx(Tooltip, {
100
+ content: colourName,
101
+ activateOnHover: true,
102
+ children: pressable
103
+ });
104
+ }
105
+ return pressable;
96
106
  });
97
107
  ColourBubble.displayName = 'ColourBubble';
98
108
  ColourBubble.propTypes = {
@@ -121,6 +131,10 @@ ColourBubble.propTypes = {
121
131
  * of the color is changed of all currently `items`.
122
132
  * Receives two parameters: item object selected and the event
123
133
  */
124
- onPress: PropTypes.func
134
+ onPress: PropTypes.func,
135
+ /**
136
+ * When true, wraps the bubble in a Tooltip that displays the colourName on hover (web only).
137
+ */
138
+ showTooltip: PropTypes.bool
125
139
  };
126
140
  export default ColourBubble;
@@ -15,6 +15,7 @@ const ColourToggle = /*#__PURE__*/React.forwardRef((_ref, ref) => {
15
15
  defaultColourId,
16
16
  items,
17
17
  onChange,
18
+ showTooltips,
18
19
  ...rest
19
20
  } = _ref;
20
21
  const [currentColourId, setCurrentColourId] = React.useState(defaultColourId);
@@ -54,7 +55,8 @@ const ColourToggle = /*#__PURE__*/React.forwardRef((_ref, ref) => {
54
55
  isSelected: id === currentColourId,
55
56
  colourHexCode: colourHexCode,
56
57
  colourName: colourName,
57
- onPress: handleChangeColour
58
+ onPress: handleChangeColour,
59
+ showTooltip: showTooltips
58
60
  }, colourBubbleId);
59
61
  })
60
62
  })]
@@ -86,6 +88,10 @@ ColourToggle.propTypes = {
86
88
  /**
87
89
  * If provided, this function is called when the current selection of the color is changed of all currently `items`. Receives two parameters: item object selected and the event
88
90
  */
89
- onChange: PropTypes.func
91
+ onChange: PropTypes.func,
92
+ /**
93
+ * When true, displays each colour's name as a tooltip on hover (web only).
94
+ */
95
+ showTooltips: PropTypes.bool
90
96
  };
91
97
  export default ColourToggle;
@@ -66,11 +66,15 @@ function selectIconContainerStyles(_ref2) {
66
66
  }
67
67
  function selectTextContainerStyles(_ref3) {
68
68
  let {
69
- textLine
69
+ textLine,
70
+ controlAlign
70
71
  } = _ref3;
71
72
  return {
72
73
  textDecorationLine: textLine,
73
- flex: 1
74
+ flex: 1,
75
+ ...(controlAlign && {
76
+ alignItems: controlAlign
77
+ })
74
78
  };
75
79
  }
76
80
  function selectIconTokens(tokens) {
@@ -85,6 +89,7 @@ const ExpandCollapseControl = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
85
89
  isExpanded,
86
90
  children,
87
91
  tokens,
92
+ controlAlign,
88
93
  accessibilityRole = 'button',
89
94
  variant,
90
95
  ...rest
@@ -135,7 +140,12 @@ const ExpandCollapseControl = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
135
140
  ...selectIconTokens(themeTokens)
136
141
  })
137
142
  }), /*#__PURE__*/_jsx(View, {
138
- style: [selectTextContainerStyles(themeTokens), staticStyles.bubblePointerEvents],
143
+ style: [selectTextContainerStyles({
144
+ ...themeTokens,
145
+ ...(controlAlign && {
146
+ controlAlign
147
+ })
148
+ }), staticStyles.bubblePointerEvents],
139
149
  children: typeof children === 'function' ? children(getControlState(pressableState)) : children
140
150
  })]
141
151
  });
@@ -161,6 +171,10 @@ ExpandCollapseControl.propTypes = {
161
171
  * Whether the linked ExpandCollapsePanel is opened or closed. Allows themes to set `expanded` styles.
162
172
  */
163
173
  isExpanded: PropTypes.bool,
174
+ /**
175
+ * Optional alignment for control content. Overrides token-driven alignment.
176
+ */
177
+ controlAlign: PropTypes.oneOf(['flex-start', 'center', 'flex-end']),
164
178
  /**
165
179
  * Function called when the ExpandCollapse is pressed.
166
180
  */
@@ -97,6 +97,7 @@ const ExpandCollapsePanel = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
97
97
  onPress,
98
98
  control,
99
99
  controlTokens,
100
+ controlAlign,
100
101
  children,
101
102
  tokens,
102
103
  variant,
@@ -166,6 +167,7 @@ const ExpandCollapsePanel = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
166
167
  ...selectedProps,
167
168
  isExpanded: isExpanded,
168
169
  tokens: controlTokens,
170
+ controlAlign: controlAlign,
169
171
  variant: variant,
170
172
  onPress: handleControlPress,
171
173
  ref: controlRef,
@@ -265,6 +267,10 @@ ExpandCollapsePanel.propTypes = {
265
267
  * Optional theme token overrides that may be passed to the ExpandCollapseControl element.
266
268
  */
267
269
  controlTokens: getTokensPropType('ExpandCollapseControl'),
270
+ /**
271
+ * Optional alignment for control content.
272
+ */
273
+ controlAlign: PropTypes.oneOf(['flex-start', 'center', 'flex-end']),
268
274
  /**
269
275
  * An optional ref to be attached to the control
270
276
  */
@@ -6,6 +6,11 @@ import { variantProp } from '../utils/props';
6
6
  import ExpandCollapseMiniControl from './ExpandCollapseMiniControl';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([contentfulProps]);
9
+ const alignMap = {
10
+ start: 'flex-start',
11
+ middle: 'center',
12
+ end: 'flex-end'
13
+ };
9
14
  const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
10
15
  let {
11
16
  children,
@@ -14,6 +19,7 @@ const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
14
19
  nativeID,
15
20
  initialOpen = false,
16
21
  dataSet,
22
+ align,
17
23
  ...rest
18
24
  } = _ref;
19
25
  const expandCollapeMiniPanelId = useUniqueId('ExpandCollapseMiniPanel');
@@ -41,12 +47,14 @@ const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
41
47
  borderColor: 'transparent',
42
48
  textLine: tokens.textLine ?? 'none',
43
49
  backgroundColor: 'transparent'
44
- }
50
+ },
51
+ controlAlign: align && alignMap[align]
45
52
  // TODO refactor
46
53
  // eslint-disable-next-line react/no-unstable-nested-components
47
54
  ,
48
55
  control: pressableState => /*#__PURE__*/_jsx(ExpandCollapseMiniControl, {
49
56
  pressableState: pressableState,
57
+ align: align,
50
58
  ...rest
51
59
  }),
52
60
  controlRef: ref,
@@ -86,6 +94,10 @@ ExpandCollapseMini.propTypes = {
86
94
  /**
87
95
  * The dataSet prop allows to pass data-* attributes element to the component.
88
96
  */
89
- dataSet: PropTypes.object
97
+ dataSet: PropTypes.object,
98
+ /**
99
+ * Controls the horizontal alignment of the trigger label and icon within the panel width.
100
+ */
101
+ align: PropTypes.oneOf(['start', 'middle', 'end'])
90
102
  };
91
103
  export default ExpandCollapseMini;
@@ -6,6 +6,11 @@ import { useThemeTokens } from '../ThemeProvider';
6
6
  import { htmlAttrs, viewProps, selectSystemProps } from '../utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps]);
9
+ const alignSelfMap = {
10
+ start: 'flex-start',
11
+ middle: 'center',
12
+ end: 'flex-end'
13
+ };
9
14
 
10
15
  // The ExpandCollapseControl has all the appropriate role, a11y, press handling etc
11
16
  // and a more appropriate press area, defer interaction handling to it.
@@ -24,6 +29,7 @@ const ExpandCollapseMiniControl = /*#__PURE__*/React.forwardRef((_ref, ref) => {
24
29
  iconPosition = 'right',
25
30
  tokens,
26
31
  variant = {},
32
+ align,
27
33
  ...rest
28
34
  } = _ref;
29
35
  const {
@@ -92,7 +98,10 @@ const ExpandCollapseMiniControl = /*#__PURE__*/React.forwardRef((_ref, ref) => {
92
98
  ...getTokens(linkState),
93
99
  iconSize,
94
100
  blockFontSize: fontSize,
95
- blockLineHeight: lineHeight
101
+ blockLineHeight: lineHeight,
102
+ ...(align && {
103
+ alignSelf: alignSelfMap[align]
104
+ })
96
105
  }),
97
106
  ref: ref,
98
107
  ...presentationOnly,
@@ -123,6 +132,10 @@ ExpandCollapseMiniControl.propTypes = {
123
132
  /**
124
133
  * Optional variant object to override the default theme tokens
125
134
  */
126
- variant: PropTypes.object
135
+ variant: PropTypes.object,
136
+ /**
137
+ * Controls the horizontal alignment of the trigger label and icon
138
+ */
139
+ align: PropTypes.oneOf(['start', 'middle', 'end'])
127
140
  };
128
141
  export default ExpandCollapseMiniControl;
@@ -65,8 +65,7 @@ const InputSupports = /*#__PURE__*/React.forwardRef((_ref, ref) => {
65
65
  }), typeof children === 'function' ? children({
66
66
  inputId,
67
67
  ...a11yProps,
68
- validation: feedbackValidation,
69
- accessibilityDescribedBy: feedbackId
68
+ validation: feedbackValidation
70
69
  }) : children, feedback || maxCharsReachedErrorMessage ? /*#__PURE__*/_jsx(Feedback, {
71
70
  id: feedbackId,
72
71
  title: feedback || maxCharsReachedErrorMessage,
@@ -25,9 +25,7 @@ const useInputSupports = _ref => {
25
25
  accessibilityLabel: label,
26
26
  accessibilityHint: joinDefined([!hasValidationError && feedback, hint, maxCharacterAllowed ? getCopy('maxCharacters').replace(/%\{charCount\}/g, maxCharacterAllowed) : undefined]),
27
27
  // native only -> replaced with describedBy on web
28
- accessibilityDescribedBy: joinDefined([!hasValidationError && feedback && feedbackId,
29
- // feedback receives a11yRole=alert on error, so there's no need to include it here
30
- hint && hintId, charactersCount ? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount) : undefined]),
28
+ accessibilityDescribedBy: joinDefined([hint && hintId, feedback && feedbackId || undefined, charactersCount ? getCopy('charactersRemaining').replace(/%\{charCount\}/g, charactersCount) : undefined]),
31
29
  accessibilityInvalid: hasValidationError
32
30
  };
33
31
  return {
@@ -42,6 +42,7 @@ const ChevronLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
42
42
  const getTokens = useThemeTokensCallback('Link', applyChevronTokens, variant);
43
43
  return /*#__PURE__*/_jsx(LinkBase, {
44
44
  ...otherlinkProps,
45
+ useMeasuredMobileIconLayout: true,
45
46
  iconPosition: direction,
46
47
  tokens: getTokens,
47
48
  dataSet: dataSet,
@@ -7,6 +7,7 @@ import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, sel
7
7
  import { resolvePressableTokens } from '../utils/pressability';
8
8
  import { withLinkRouter } from '../utils';
9
9
  import InlinePressable from './InlinePressable';
10
+ import MobileIconTextContent from './MobileIconTextContent';
10
11
  import { applyTextStyles, applyOuterBorder, useTheme } from '../ThemeProvider';
11
12
  import { IconText, iconComponentPropTypes } from '../Icon';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -137,6 +138,7 @@ const LinkBase = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
137
138
  tokens = {},
138
139
  children,
139
140
  dataSet,
141
+ useMeasuredMobileIconLayout = false,
140
142
  accessibilityRole = 'link',
141
143
  ...rawRest
142
144
  } = _ref6;
@@ -180,8 +182,8 @@ const LinkBase = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
180
182
  const themeTokens = resolveLinkTokens(linkState);
181
183
  const outerBorderStyles = selectOuterBorderStyles(themeTokens);
182
184
  const decorationStyles = selectDecorationStyles(themeTokens);
183
- const mobileCompensation = null;
184
- return [outerBorderStyles, mobileCompensation, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
185
+ const shouldUseMeasuredMobileContent = Platform.OS !== 'web' && useMeasuredMobileIconLayout;
186
+ return [outerBorderStyles, shouldUseMeasuredMobileContent ? staticStyles.measuredMobileOuterBorderCompensation : null, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
185
187
  },
186
188
  children: linkState => {
187
189
  const themeTokens = resolveLinkTokens(linkState);
@@ -196,19 +198,32 @@ const LinkBase = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
196
198
  } = themeTokens;
197
199
  const isTextOnlyLink = !IconComponent && !icon && accessibilityRole === 'link';
198
200
  const adjustedIconSpace = Platform.OS !== 'web' && isTextOnlyLink ? 0 : iconSpace;
201
+ const shouldUseMeasuredMobileContent = Platform.OS !== 'web' && useMeasuredMobileIconLayout;
202
+ const textBaselineStyle = shouldUseMeasuredMobileContent ? null : staticStyles.baseline;
203
+ const linkTextContent = /*#__PURE__*/_jsx(Text, {
204
+ style: [textStyles, blockTextStyles, textBaselineStyle, staticStyles.bubblePointerEvents],
205
+ children: typeof children === 'function' ? children(linkState) : children
206
+ });
207
+ const sharedIconProps = {
208
+ ...iconProps,
209
+ tokens: iconTokens,
210
+ style: staticStyles.bubblePointerEvents
211
+ };
212
+ if (shouldUseMeasuredMobileContent) {
213
+ return /*#__PURE__*/_jsx(MobileIconTextContent, {
214
+ icon: IconComponent,
215
+ iconPosition: iconPosition,
216
+ space: adjustedIconSpace,
217
+ iconProps: sharedIconProps,
218
+ children: linkTextContent
219
+ });
220
+ }
199
221
  return /*#__PURE__*/_jsx(IconText, {
200
222
  icon: IconComponent,
201
223
  iconPosition: iconPosition,
202
224
  space: adjustedIconSpace,
203
- iconProps: {
204
- ...iconProps,
205
- tokens: iconTokens,
206
- style: staticStyles.bubblePointerEvents
207
- },
208
- children: /*#__PURE__*/_jsx(Text, {
209
- style: [textStyles, blockTextStyles, staticStyles.baseline, staticStyles.bubblePointerEvents],
210
- children: typeof children === 'function' ? children(linkState) : children
211
- })
225
+ iconProps: sharedIconProps,
226
+ children: linkTextContent
212
227
  });
213
228
  }
214
229
  });
@@ -266,11 +281,12 @@ const staticStyles = StyleSheet.create({
266
281
  }
267
282
  })
268
283
  },
269
- outerBorderCompensation: {
284
+ measuredMobileOuterBorderCompensation: {
270
285
  ...(Platform.OS !== 'web' && {
271
286
  marginHorizontal: 2,
287
+ marginVertical: 2,
272
288
  paddingHorizontal: Platform.OS === 'android' ? 2 : 0,
273
- paddingTop: Platform.OS === 'android' ? 2 : 0
289
+ paddingVertical: Platform.OS === 'android' ? 2 : 0
274
290
  })
275
291
  }
276
292
  });