@telus-uds/components-web 2.41.0 → 2.43.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,46 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Wed, 25 Sep 2024 16:57:49 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 31 Oct 2024 05:02:44 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.43.0
8
+
9
+ Thu, 31 Oct 2024 05:02:44 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `Breadcrumbs`: add expander item on xs viewport (guillermo.peitzner@telus.com)
14
+ - `Modal`: Enable `footerTopWidth` token for `Modal` component (jaime.tuyuc@telus.com)
15
+ - `Types`: Export BaseProviderProps and add FileUpload types (6854874+kyletsang@users.noreply.github.com)
16
+ - Bump @telus-uds/components-base to v1.97.0
17
+ - Bump @telus-uds/system-theme-tokens to v2.66.0
18
+
19
+ ### Patches
20
+
21
+ - `DatePicker`: calendar misalignment and static overlay behavior fixed when the component is inside a modal (35577399+JoshHC@users.noreply.github.com)
22
+ - `Table`: added null check for container during resizing (kristina.kirpichnikova@telus.com)
23
+
24
+ ## 2.42.0
25
+
26
+ Sat, 12 Oct 2024 00:40:49 GMT
27
+
28
+ ### Minor changes
29
+
30
+ - `PriceLockup`: alignItemsText token added to the component to align right (flex-end), left (flex-start) or center the content (35577399+JoshHC@users.noreply.github.com)
31
+ - `ProgressBar`: add shadow tokens (jacqui.koroll@telus.com)
32
+ - `TermsAndConditions`: refactor component to use media-query-stylesheet (guillermo.peitzner@telus.com)
33
+ - Bump @telus-uds/components-base to v1.96.0
34
+ - Bump @telus-uds/system-theme-tokens to v2.65.0
35
+
36
+ ### Patches
37
+
38
+ - `List`: Enable `CircleBullet` icon to visualize order of nested lists (jaime.tuyuc@telus.com)
39
+ - `OrderedList`: change display to render correctly (Mauricio.BatresMontejo@telus.com)
40
+
7
41
  ## 2.41.0
8
42
 
9
- Wed, 25 Sep 2024 16:57:49 GMT
43
+ Wed, 25 Sep 2024 17:07:47 GMT
10
44
 
11
45
  ### Minor changes
12
46
 
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _styledComponents = _interopRequireDefault(require("styled-components"));
10
10
  var _reactHelmetAsync = require("react-helmet-async");
11
+ var _lodash = require("lodash");
11
12
  var _componentsBase = require("@telus-uds/components-base");
12
13
  var _utils = require("../utils");
13
14
  var _Item = _interopRequireDefault(require("./Item/Item"));
@@ -79,10 +80,11 @@ const getItems = (items, params, concatenatePaths) => {
79
80
  } = item;
80
81
  return {
81
82
  breadcrumbName,
82
- href,
83
+ href: item.isExpander ? '#' : href,
83
84
  current: isLast,
84
85
  LinkRouter,
85
86
  linkRouterProps,
87
+ onPress: item.onPress,
86
88
  ...omitProps(selectProps(item))
87
89
  };
88
90
  });
@@ -97,6 +99,7 @@ const getStructuredData = (items, baseUrl) => {
97
99
  }
98
100
  }));
99
101
  };
102
+ const MAX_ITEMS_ON_XS_VIEWPORT = 4;
100
103
 
101
104
  /**
102
105
  * Display a hierarchy of links, commonly used for navigation.
@@ -138,7 +141,33 @@ const Breadcrumbs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
138
141
  ...itemRest
139
142
  };
140
143
  }) : routes.filter(route => route.path && route.breadcrumbName);
141
- const items = getItems(activeRoutes, params, !children);
144
+ const [optionsHidden, setOptionsHidden] = _react.default.useState(false);
145
+ const [itemsToBeRendered, setItemsToBeRendered] = _react.default.useState([]);
146
+ const viewport = (0, _componentsBase.useViewport)();
147
+ _react.default.useEffect(() => {
148
+ if (optionsHidden) {
149
+ if (viewport !== 'xs' && !(0, _lodash.isEqual)(itemsToBeRendered, activeRoutes)) {
150
+ setItemsToBeRendered(activeRoutes);
151
+ }
152
+ return;
153
+ }
154
+ if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
155
+ const newItems = [...activeRoutes.slice(0, 2), {
156
+ path: '#',
157
+ breadcrumbName: '...',
158
+ onPress: event => {
159
+ event.preventDefault();
160
+ setItemsToBeRendered(activeRoutes);
161
+ },
162
+ isExpander: true
163
+ }, activeRoutes[activeRoutes.length - 1]];
164
+ setItemsToBeRendered(newItems);
165
+ setOptionsHidden(true);
166
+ } else if (!(0, _lodash.isEqual)(itemsToBeRendered, activeRoutes)) {
167
+ setItemsToBeRendered(activeRoutes);
168
+ }
169
+ }, [viewport, activeRoutes, optionsHidden, itemsToBeRendered]);
170
+ const items = getItems(itemsToBeRendered, params, !children);
142
171
  const themeTokens = (0, _componentsBase.useThemeTokens)('Breadcrumbs', tokens, variant);
143
172
  const metadata = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHelmetAsync.HelmetProvider, {
144
173
  context: helmetContext,
@@ -168,6 +197,7 @@ const Breadcrumbs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
168
197
  breadcrumbName,
169
198
  LinkRouter: ItemLinkRouter = LinkRouter,
170
199
  linkRouterProps: itemLinkRouterProps,
200
+ onPress,
171
201
  ...itemRest
172
202
  } = _ref4;
173
203
  return /*#__PURE__*/(0, _react.createElement)(_Item.default, {
@@ -184,7 +214,8 @@ const Breadcrumbs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
184
214
  ...variant,
185
215
  size: 'micro'
186
216
  },
187
- LinkRouter: ItemLinkRouter
217
+ LinkRouter: ItemLinkRouter,
218
+ onPress: onPress
188
219
  }, breadcrumbName);
189
220
  })
190
221
  }), metadata]
@@ -86,6 +86,7 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
86
86
  // `light` variant (shared with the `Link` component) is default by design
87
87
  LinkRouter,
88
88
  linkRouterProps,
89
+ onPress,
89
90
  ...rest
90
91
  } = _ref8;
91
92
  const {
@@ -132,6 +133,7 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
132
133
  LinkRouter: LinkRouter,
133
134
  linkRouterProps: linkRouterProps,
134
135
  variant: variant,
136
+ onPress: onPress,
135
137
  children: children
136
138
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconContainer, {
137
139
  iconPadding: iconPadding,
@@ -169,7 +171,11 @@ Item.propTypes = {
169
171
  */
170
172
  variant: _propTypes.default.shape({
171
173
  inverse: _propTypes.default.bool
172
- })
174
+ }),
175
+ /**
176
+ * Function to be called when the Item is clicked.
177
+ */
178
+ onPress: _propTypes.default.func
173
179
  };
174
180
  var _default = Item;
175
181
  exports.default = _default;
@@ -124,25 +124,39 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
124
124
  left: 0,
125
125
  top: 0
126
126
  });
127
+ const datePickerRef = _react.default.useRef(null);
127
128
  (0, _componentsBase.useSafeLayoutEffect)(() => {
128
- const updateDimensions = () => {
129
- if (inline || !textInputRef.current) return;
129
+ const updateDatePickerPosition = () => {
130
+ if (inline || !(textInputRef !== null && textInputRef !== void 0 && textInputRef.current)) return;
130
131
  const {
131
132
  left,
132
133
  top
133
134
  } = textInputRef.current.getBoundingClientRect();
134
135
  const inputTop = top + window.scrollY;
136
+ const inputLeft = left + window.scrollX;
135
137
  setDatePickerPosition({
136
- left,
137
- top: inputTop + textInputRef.current.offsetHeight
138
+ top: inputTop + textInputRef.current.offsetHeight,
139
+ left: inputLeft
138
140
  });
139
141
  };
140
- const throttledUpdateDimensions = (0, _lodash.throttle)(updateDimensions, 100, {
142
+ const throttledUpdate = (0, _lodash.throttle)(updateDatePickerPosition, 100, {
141
143
  leading: false
142
144
  });
143
- throttledUpdateDimensions();
144
- window.addEventListener('resize', throttledUpdateDimensions);
145
- return () => window.removeEventListener('resize', throttledUpdateDimensions);
145
+
146
+ // Initial call to set the position
147
+ updateDatePickerPosition();
148
+
149
+ // Register event listeners
150
+ window.addEventListener('resize', throttledUpdate);
151
+ window.addEventListener('scroll', updateDatePickerPosition, {
152
+ capture: true
153
+ });
154
+ return () => {
155
+ window.removeEventListener('resize', throttledUpdate);
156
+ window.removeEventListener('scroll', updateDatePickerPosition, {
157
+ capture: true
158
+ });
159
+ };
146
160
  }, []);
147
161
  const [isFocused, setIsFocused] = _react.default.useState(false);
148
162
  const [isClickedInside, setIsClickedInside] = _react.default.useState(false);
@@ -369,6 +383,7 @@ const DatePicker = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
369
383
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PortalPositionedContainer, {
370
384
  top: datePickerPosition.top,
371
385
  left: datePickerPosition.left,
386
+ ref: datePickerRef,
372
387
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, {
373
388
  ...selectProps(rest),
374
389
  daySize: daySize,
@@ -53,11 +53,14 @@ const StyledItemBase = /*#__PURE__*/(0, _styledComponents.default)(_ItemBase.def
53
53
  counterIncrement: _constants.OL_COUNTER_NAME,
54
54
  '::before': {
55
55
  content: `counter(${_constants.OL_COUNTER_NAME})'.'`,
56
- display: 'inline-flex',
56
+ display: 'inline-block',
57
57
  color: itemColor || itemTextColor,
58
58
  width: itemBulletContainerWidth,
59
59
  paddingRight: listGutter,
60
- justifyContent: itemBulletTextAlign,
60
+ textAlign: itemBulletTextAlign,
61
+ flexShrink: 0,
62
+ whiteSpace: 'nowrap',
63
+ overflow: 'hidden',
61
64
  ...(0, _componentsBase.applyTextStyles)({
62
65
  fontWeight: itemFontWeight,
63
66
  fontSize: itemFontSize,
@@ -75,7 +78,9 @@ const ItemContent = /*#__PURE__*/_styledComponents.default.div.withConfig({
75
78
  displayName: "Item__ItemContent",
76
79
  componentId: "components-web__sc-7jzwcq-1"
77
80
  })({
78
- flex: 1
81
+ display: 'flex',
82
+ flexDirection: 'column',
83
+ gap: 5
79
84
  });
80
85
  const Item = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
81
86
  let {
@@ -122,7 +127,9 @@ const Item = /*#__PURE__*/_react.default.forwardRef((_ref3, ref) => {
122
127
  ...themeTokens,
123
128
  children: itemContent
124
129
  })]
125
- }) : itemContent
130
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemContent, {
131
+ children: itemContent
132
+ })
126
133
  });
127
134
  });
128
135
  Item.displayName = 'OrderedListItem';
@@ -17,64 +17,69 @@ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemP
17
17
  const PriceLockupContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
18
18
  displayName: "PriceLockup__PriceLockupContainer",
19
19
  componentId: "components-web__sc-1x6duay-0"
20
- })(["display:flex;flex-direction:column;width:fit-content;"]);
20
+ })(["align-items:", ";display:flex;flex-direction:column;width:fit-content;"], _ref => {
21
+ let {
22
+ alignItemsText
23
+ } = _ref;
24
+ return alignItemsText;
25
+ });
21
26
  const PriceContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
22
27
  displayName: "PriceLockup__PriceContainer",
23
28
  componentId: "components-web__sc-1x6duay-1"
24
- })(["display:flex;margin-bottom:", ";"], _ref => {
29
+ })(["display:flex;margin-bottom:", ";"], _ref2 => {
25
30
  let {
26
31
  priceMarginBottom
27
- } = _ref;
32
+ } = _ref2;
28
33
  return priceMarginBottom;
29
34
  });
30
35
  const FootnoteContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
31
36
  displayName: "PriceLockup__FootnoteContainer",
32
37
  componentId: "components-web__sc-1x6duay-2"
33
- })(["display:flex;margin-top:", ";gap:", ";"], _ref2 => {
38
+ })(["display:flex;margin-top:", ";gap:", ";"], _ref3 => {
34
39
  let {
35
40
  footnoteMarginTop
36
- } = _ref2;
41
+ } = _ref3;
37
42
  return footnoteMarginTop;
38
- }, _ref3 => {
43
+ }, _ref4 => {
39
44
  let {
40
45
  footnoteGap
41
- } = _ref3;
46
+ } = _ref4;
42
47
  return footnoteGap;
43
48
  });
44
49
  const BottomTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
45
50
  displayName: "PriceLockup__BottomTextContainer",
46
51
  componentId: "components-web__sc-1x6duay-3"
47
- })(["margin-top:", ";"], _ref4 => {
52
+ })(["margin-top:", ";"], _ref5 => {
48
53
  let {
49
54
  bottomTextMarginTop
50
- } = _ref4;
55
+ } = _ref5;
51
56
  return bottomTextMarginTop;
52
57
  });
53
58
  const BottomLinksContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
54
59
  displayName: "PriceLockup__BottomLinksContainer",
55
60
  componentId: "components-web__sc-1x6duay-4"
56
- })(["align-self:center;margin-left:", ";"], _ref5 => {
61
+ })(["align-self:center;margin-left:", ";"], _ref6 => {
57
62
  let {
58
63
  bottomLinksMarginLeft
59
- } = _ref5;
64
+ } = _ref6;
60
65
  return bottomLinksMarginLeft;
61
66
  });
62
67
  const TopTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
63
68
  displayName: "PriceLockup__TopTextContainer",
64
69
  componentId: "components-web__sc-1x6duay-5"
65
- })(["margin-bottom:", ";"], _ref6 => {
70
+ })(["margin-bottom:", ";"], _ref7 => {
66
71
  let {
67
72
  topTextMarginBottom
68
- } = _ref6;
73
+ } = _ref7;
69
74
  return topTextMarginBottom;
70
75
  });
71
76
  const PriceTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
72
77
  displayName: "PriceLockup__PriceTextContainer",
73
78
  componentId: "components-web__sc-1x6duay-6"
74
- })(["display:flex;flex-direction:", ";"], _ref7 => {
79
+ })(["display:flex;flex-direction:", ";"], _ref8 => {
75
80
  let {
76
81
  ratePosition
77
- } = _ref7;
82
+ } = _ref8;
78
83
  return ratePosition === 'bottom' ? 'column' : 'row';
79
84
  });
80
85
  const RateContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
@@ -84,38 +89,38 @@ const RateContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
84
89
  const RateTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
85
90
  displayName: "PriceLockup__RateTextContainer",
86
91
  componentId: "components-web__sc-1x6duay-8"
87
- })(["align-self:", ";"], _ref8 => {
92
+ })(["align-self:", ";"], _ref9 => {
88
93
  let {
89
94
  ratePosition
90
- } = _ref8;
95
+ } = _ref9;
91
96
  return ratePosition === 'bottom' ? 'flex-start' : 'flex-end';
92
97
  });
93
98
  const StrikeThroughContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
94
99
  displayName: "PriceLockup__StrikeThroughContainer",
95
100
  componentId: "components-web__sc-1x6duay-9"
96
- })(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;top:", ";height:", ";background:", ";position:absolute;}"], _ref9 => {
101
+ })(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;top:", ";height:", ";background:", ";position:absolute;}"], _ref10 => {
97
102
  let {
98
103
  strikeThroughPosition
99
- } = _ref9;
104
+ } = _ref10;
100
105
  return `${strikeThroughPosition}px`;
101
- }, _ref10 => {
106
+ }, _ref11 => {
102
107
  let {
103
108
  strikeThroughHeight
104
- } = _ref10;
109
+ } = _ref11;
105
110
  return `${strikeThroughHeight}px`;
106
- }, _ref11 => {
111
+ }, _ref12 => {
107
112
  let {
108
113
  strikeThroughColor
109
- } = _ref11;
114
+ } = _ref12;
110
115
  return strikeThroughColor;
111
116
  });
112
- const selectFootnoteLinkStyles = _ref12 => {
117
+ const selectFootnoteLinkStyles = _ref13 => {
113
118
  let {
114
119
  footnoteLinkColor,
115
120
  footnoteLinkFontName,
116
121
  footnoteLinkFontWeight,
117
122
  footnoteLinkLineHeight
118
- } = _ref12;
123
+ } = _ref13;
119
124
  return {
120
125
  color: footnoteLinkColor,
121
126
  fontName: footnoteLinkFontName,
@@ -123,19 +128,19 @@ const selectFootnoteLinkStyles = _ref12 => {
123
128
  lineHeight: footnoteLinkLineHeight
124
129
  };
125
130
  };
126
- const selectStrikeThroughTokens = _ref13 => {
131
+ const selectStrikeThroughTokens = _ref14 => {
127
132
  let {
128
133
  strikeThroughPosition,
129
134
  strikeThroughHeight,
130
135
  strikeThroughColor
131
- } = _ref13;
136
+ } = _ref14;
132
137
  return {
133
138
  strikeThroughHeight,
134
139
  strikeThroughPosition,
135
140
  strikeThroughColor
136
141
  };
137
142
  };
138
- const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref14, ref) => {
143
+ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref15, ref) => {
139
144
  let {
140
145
  size = 'medium',
141
146
  signDirection = 'left',
@@ -152,7 +157,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref14, ref) => {
152
157
  tokens: priceLockupTokens,
153
158
  variant = {},
154
159
  ...rest
155
- } = _ref14;
160
+ } = _ref15;
156
161
  const viewport = (0, _componentsBase.useViewport)();
157
162
  const {
158
163
  footnoteMarginTop,
@@ -164,6 +169,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref14, ref) => {
164
169
  fontColor,
165
170
  dividerColor,
166
171
  footnoteLinkFontSize,
172
+ alignItemsText,
167
173
  ...themeTokens
168
174
  } = (0, _componentsBase.useThemeTokens)('PriceLockup', priceLockupTokens, {
169
175
  ...variant,
@@ -257,6 +263,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref14, ref) => {
257
263
  }
258
264
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceLockupContainer, {
259
265
  ...selectProps(rest),
266
+ alignItemsText: alignItemsText,
260
267
  ref: ref,
261
268
  children: [topText && /*#__PURE__*/(0, _jsxRuntime.jsx)(TopTextContainer, {
262
269
  topTextMarginBottom: `${topTextMarginBottom}px`,
@@ -22,20 +22,20 @@ const Gradient = /*#__PURE__*/_styledComponents.default.div.attrs({
22
22
  componentId: "components-web__sc-1vmzyq5-0"
23
23
  })(_ref => {
24
24
  let {
25
- percentage,
26
25
  gradient: {
27
26
  angle,
28
27
  stops,
29
28
  type
30
- }
29
+ },
30
+ borderRadius,
31
+ shadow
31
32
  } = _ref;
32
33
  return {
33
34
  height: '100%',
34
- // As per the design specs, we need to have the gradient expanding to 100% and being
35
- // revealed by bar width, so we need to stretch it beyond the parent (progress element)
36
- // to the full length of the progress bar
37
- width: `${100 * 100 / percentage}%`,
38
- background: `${type}-gradient(${angle}deg, ${stops[0].color}, ${stops[1].color})`
35
+ width: '100%',
36
+ background: `${type}-gradient(${angle}deg, ${stops[0].color}, ${stops[1].color})`,
37
+ borderRadius,
38
+ ...(0, _componentsBase.applyShadowToken)(shadow)
39
39
  };
40
40
  });
41
41
 
@@ -66,8 +66,7 @@ const ProgressBar = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
66
66
  ref: ref,
67
67
  ...selectedProps,
68
68
  children: themeTokens.gradient && /*#__PURE__*/(0, _jsxRuntime.jsx)(Gradient, {
69
- ...themeTokens,
70
- percentage: percentage
69
+ ...themeTokens
71
70
  })
72
71
  });
73
72
  });
@@ -66,8 +66,9 @@ const Table = _ref2 => {
66
66
  const [tableWidth, setTableWidth] = _react.default.useState(0);
67
67
  (0, _componentsBase.useSafeLayoutEffect)(() => {
68
68
  const updateDimensions = () => {
69
- const containerClientWidth = containerRef.current.clientWidth;
70
- const responsiveTableWidth = fullWidth ? containerClientWidth : tableRef.current.clientWidth;
69
+ var _containerRef$current, _tableRef$current;
70
+ const containerClientWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientWidth;
71
+ const responsiveTableWidth = fullWidth ? containerClientWidth : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.clientWidth;
71
72
  setContainerWidth(containerClientWidth);
72
73
  setTableWidth(responsiveTableWidth);
73
74
  };
@@ -122,9 +122,60 @@ const TermsAndConditions = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) =
122
122
  const hasIndexedContent = indexedContent.length > 0;
123
123
  const hasNonIndexedContent = nonIndexedContent.length > 0;
124
124
  const viewport = (0, _componentsBase.useViewport)();
125
- const themeTokens = (0, _componentsBase.useThemeTokens)('TermsAndConditions', tokens, variant, {
125
+ const {
126
+ themeOptions
127
+ } = (0, _componentsBase.useTheme)();
128
+ const {
129
+ enableMediaQueryStyleSheet
130
+ } = themeOptions;
131
+ const useTokens = enableMediaQueryStyleSheet ? _componentsBase.useResponsiveThemeTokens : _componentsBase.useThemeTokens;
132
+ const themeTokens = useTokens('TermsAndConditions', tokens, variant, !enableMediaQueryStyleSheet && {
126
133
  viewport
127
134
  });
135
+ let listItemStyles;
136
+ let listItemMediaIds;
137
+ let nonIndexedContentStyles;
138
+ let nonIndexedContentMediaIds;
139
+ if (enableMediaQueryStyleSheet) {
140
+ const {
141
+ transformedListItemThemeTokens,
142
+ transformedNonIndexedContentThemeTokens
143
+ } = Object.entries(themeTokens).reduce((acc, _ref7) => {
144
+ let [vp, viewportTokens] = _ref7;
145
+ acc.transformedListItemThemeTokens[vp] = {
146
+ marginLeft: viewportTokens.listMarginLeft
147
+ };
148
+ acc.transformedNonIndexedContentThemeTokens[vp] = {
149
+ paddingLeft: viewportTokens.titlePaddingLeft
150
+ };
151
+ return acc;
152
+ }, {
153
+ transformedListItemThemeTokens: {},
154
+ transformedNonIndexedContentThemeTokens: {}
155
+ });
156
+ const listItemMediaQueryStyles = (0, _componentsBase.createMediaQueryStyles)(transformedListItemThemeTokens);
157
+ const nonIndexedContentMediaQueryStyles = (0, _componentsBase.createMediaQueryStyles)(transformedNonIndexedContentThemeTokens);
158
+ const {
159
+ ids,
160
+ styles
161
+ } = _componentsBase.StyleSheet.create({
162
+ listItem: {
163
+ ...themeTokens[viewport],
164
+ ...listItemMediaQueryStyles
165
+ },
166
+ nonIndexedContent: {
167
+ ...themeTokens[viewport],
168
+ ...nonIndexedContentMediaQueryStyles
169
+ }
170
+ });
171
+ listItemStyles = styles.listItem;
172
+ listItemMediaIds = ids.listItem;
173
+ nonIndexedContentStyles = styles.nonIndexedContent;
174
+ nonIndexedContentMediaIds = ids.nonIndexedContent;
175
+ } else {
176
+ listItemStyles = themeTokens;
177
+ nonIndexedContentStyles = themeTokens;
178
+ }
128
179
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
129
180
  ...selectProps(rest),
130
181
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
@@ -145,13 +196,15 @@ const TermsAndConditions = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) =
145
196
  /*#__PURE__*/
146
197
  // eslint-disable-next-line react/no-array-index-key
147
198
  (0, _jsxRuntime.jsx)(ListItem, {
148
- tokens: themeTokens,
199
+ tokens: listItemStyles,
200
+ media: listItemMediaIds,
149
201
  children: (0, _utils.renderStructuredContent)(contentItem)
150
202
  }, idx))
151
203
  }), hasNonIndexedContent && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
152
204
  between: 3,
153
205
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(NonIndexedContentTitle, {
154
- tokens: themeTokens,
206
+ tokens: nonIndexedContentStyles,
207
+ media: nonIndexedContentMediaIds,
155
208
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
156
209
  block: true,
157
210
  heading: true,
@@ -169,7 +222,8 @@ const TermsAndConditions = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) =
169
222
  /*#__PURE__*/
170
223
  // eslint-disable-next-line react/no-array-index-key
171
224
  (0, _jsxRuntime.jsx)(ListItem, {
172
- tokens: themeTokens,
225
+ tokens: listItemStyles,
226
+ media: listItemMediaIds,
173
227
  children: (0, _utils.renderStructuredContent)(contentItem)
174
228
  }, idx))
175
229
  })]
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import { Helmet, HelmetProvider } from 'react-helmet-async';
5
- import { componentPropType, selectSystemProps, unpackFragment, withLinkRouter, getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
5
+ import { isEqual } from 'lodash';
6
+ import { componentPropType, selectSystemProps, unpackFragment, withLinkRouter, getTokensPropType, useThemeTokens, useViewport } from '@telus-uds/components-base';
6
7
  import { htmlAttrs } from '../utils';
7
8
  import Item from './Item/Item';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -72,10 +73,11 @@ const getItems = (items, params, concatenatePaths) => {
72
73
  } = item;
73
74
  return {
74
75
  breadcrumbName,
75
- href,
76
+ href: item.isExpander ? '#' : href,
76
77
  current: isLast,
77
78
  LinkRouter,
78
79
  linkRouterProps,
80
+ onPress: item.onPress,
79
81
  ...omitProps(selectProps(item))
80
82
  };
81
83
  });
@@ -90,6 +92,7 @@ const getStructuredData = (items, baseUrl) => {
90
92
  }
91
93
  }));
92
94
  };
95
+ const MAX_ITEMS_ON_XS_VIEWPORT = 4;
93
96
 
94
97
  /**
95
98
  * Display a hierarchy of links, commonly used for navigation.
@@ -131,7 +134,33 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
131
134
  ...itemRest
132
135
  };
133
136
  }) : routes.filter(route => route.path && route.breadcrumbName);
134
- const items = getItems(activeRoutes, params, !children);
137
+ const [optionsHidden, setOptionsHidden] = React.useState(false);
138
+ const [itemsToBeRendered, setItemsToBeRendered] = React.useState([]);
139
+ const viewport = useViewport();
140
+ React.useEffect(() => {
141
+ if (optionsHidden) {
142
+ if (viewport !== 'xs' && !isEqual(itemsToBeRendered, activeRoutes)) {
143
+ setItemsToBeRendered(activeRoutes);
144
+ }
145
+ return;
146
+ }
147
+ if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
148
+ const newItems = [...activeRoutes.slice(0, 2), {
149
+ path: '#',
150
+ breadcrumbName: '...',
151
+ onPress: event => {
152
+ event.preventDefault();
153
+ setItemsToBeRendered(activeRoutes);
154
+ },
155
+ isExpander: true
156
+ }, activeRoutes[activeRoutes.length - 1]];
157
+ setItemsToBeRendered(newItems);
158
+ setOptionsHidden(true);
159
+ } else if (!isEqual(itemsToBeRendered, activeRoutes)) {
160
+ setItemsToBeRendered(activeRoutes);
161
+ }
162
+ }, [viewport, activeRoutes, optionsHidden, itemsToBeRendered]);
163
+ const items = getItems(itemsToBeRendered, params, !children);
135
164
  const themeTokens = useThemeTokens('Breadcrumbs', tokens, variant);
136
165
  const metadata = /*#__PURE__*/_jsx(HelmetProvider, {
137
166
  context: helmetContext,
@@ -161,6 +190,7 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
161
190
  breadcrumbName,
162
191
  LinkRouter: ItemLinkRouter = LinkRouter,
163
192
  linkRouterProps: itemLinkRouterProps,
193
+ onPress,
164
194
  ...itemRest
165
195
  } = _ref4;
166
196
  return /*#__PURE__*/_createElement(Item, {
@@ -177,7 +207,8 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
177
207
  ...variant,
178
208
  size: 'micro'
179
209
  },
180
- LinkRouter: ItemLinkRouter
210
+ LinkRouter: ItemLinkRouter,
211
+ onPress: onPress
181
212
  }, breadcrumbName);
182
213
  })
183
214
  }), metadata]