@telus-uds/components-base 1.95.0 → 1.97.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 (67) hide show
  1. package/CHANGELOG.md +42 -2
  2. package/lib/Autocomplete/Autocomplete.js +36 -2
  3. package/lib/Card/CardBase.js +4 -0
  4. package/lib/Carousel/Carousel.js +1 -1
  5. package/lib/Carousel/CarouselItem/CarouselItem.js +15 -19
  6. package/lib/InputLabel/InputLabel.js +2 -3
  7. package/lib/List/ListItemBase.js +3 -1
  8. package/lib/Listbox/GroupControl.js +4 -0
  9. package/lib/Modal/Modal.js +34 -13
  10. package/lib/Modal/ModalContent.js +4 -3
  11. package/lib/Modal/WebModal.js +1 -0
  12. package/lib/Notification/Notification.js +5 -5
  13. package/lib/Pagination/Pagination.js +9 -2
  14. package/lib/Pagination/constants.js +12 -0
  15. package/lib/Pagination/usePagination.js +13 -3
  16. package/lib/PriceLockup/PriceLockup.js +11 -3
  17. package/lib/Progress/Progress.js +5 -2
  18. package/lib/Progress/ProgressBar.js +4 -1
  19. package/lib/Tooltip/Tooltip.native.js +31 -3
  20. package/lib/Tooltip/shared.js +5 -0
  21. package/lib/Typography/Typography.js +42 -19
  22. package/lib/index.js +7 -0
  23. package/lib-module/Autocomplete/Autocomplete.js +36 -2
  24. package/lib-module/Card/CardBase.js +4 -0
  25. package/lib-module/Carousel/Carousel.js +1 -1
  26. package/lib-module/Carousel/CarouselItem/CarouselItem.js +15 -19
  27. package/lib-module/InputLabel/InputLabel.js +2 -3
  28. package/lib-module/List/ListItemBase.js +3 -1
  29. package/lib-module/Listbox/GroupControl.js +4 -0
  30. package/lib-module/Modal/Modal.js +34 -13
  31. package/lib-module/Modal/ModalContent.js +4 -3
  32. package/lib-module/Modal/WebModal.js +1 -0
  33. package/lib-module/Notification/Notification.js +5 -5
  34. package/lib-module/Pagination/Pagination.js +9 -2
  35. package/lib-module/Pagination/constants.js +3 -0
  36. package/lib-module/Pagination/usePagination.js +13 -3
  37. package/lib-module/PriceLockup/PriceLockup.js +11 -3
  38. package/lib-module/Progress/Progress.js +6 -3
  39. package/lib-module/Progress/ProgressBar.js +5 -2
  40. package/lib-module/Tooltip/Tooltip.native.js +31 -3
  41. package/lib-module/Tooltip/shared.js +5 -0
  42. package/lib-module/Typography/Typography.js +42 -19
  43. package/lib-module/index.js +1 -1
  44. package/package.json +2 -2
  45. package/src/Autocomplete/Autocomplete.jsx +41 -2
  46. package/src/Card/CardBase.jsx +6 -0
  47. package/src/Carousel/Carousel.jsx +1 -1
  48. package/src/Carousel/CarouselItem/CarouselItem.jsx +16 -22
  49. package/src/InputLabel/InputLabel.jsx +2 -3
  50. package/src/List/ListItemBase.jsx +6 -1
  51. package/src/Listbox/GroupControl.jsx +6 -1
  52. package/src/Modal/Modal.jsx +40 -14
  53. package/src/Modal/ModalContent.jsx +4 -3
  54. package/src/Modal/WebModal.jsx +1 -1
  55. package/src/Notification/Notification.jsx +5 -5
  56. package/src/Pagination/Pagination.jsx +9 -2
  57. package/src/Pagination/constants.js +3 -0
  58. package/src/Pagination/usePagination.js +14 -3
  59. package/src/PriceLockup/PriceLockup.jsx +9 -1
  60. package/src/Progress/Progress.jsx +6 -3
  61. package/src/Progress/ProgressBar.jsx +4 -2
  62. package/src/Tooltip/Tooltip.native.jsx +31 -3
  63. package/src/Tooltip/shared.js +5 -0
  64. package/src/Typography/Typography.jsx +37 -13
  65. package/src/index.js +2 -1
  66. package/types/FileUpload.d.ts +40 -0
  67. package/types/index.d.ts +3 -0
package/CHANGELOG.md CHANGED
@@ -1,12 +1,52 @@
1
1
  # Change Log - @telus-uds/components-base
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
+ ## 1.97.0
8
+
9
+ Thu, 31 Oct 2024 05:02:44 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - `Pagination`: Enable the option to set number of pages before ellipsis (jaime.tuyuc@telus.com)
14
+ - `Types:` Export BaseProviderProps and add FileUpload types (6854874+kyletsang@users.noreply.github.com)
15
+ - `Tooltip`: add tooltipButtonTokens prop (guillermo.peitzner@telus.com)
16
+ - `Modal`: Enable `footerTopWidth` token for `Modal` component (jaime.tuyuc@telus.com)
17
+ - Bump @telus-uds/system-theme-tokens to v2.66.0
18
+
19
+ ### Patches
20
+
21
+ - `ListBox`: color property distributed throughout the component tree to fix design bugs in the selected state inside `NavigationBar` (35577399+JoshHC@users.noreply.github.com)
22
+ - `Carousel`: fix item's width issues when peeking is enabled (guillermo.peitzner@telus.com)
23
+ - `List`: fix list content drift to center of screen on bigger containers (kristina.kirpichnikova@telus.com)
24
+ - `InputLabel`: fixed an issue when using tooltip. When the user taps the tooltip there was a weird artifact where the input moves down as if there was an extra space between the label and the input. (ashok@ashokamaran.com)
25
+
26
+ ## 1.96.0
27
+
28
+ Sat, 12 Oct 2024 00:40:49 GMT
29
+
30
+ ### Minor changes
31
+
32
+ - `TermsAndConditions`: export use-responsive-theme-tokens hook (guillermo.peitzner@telus.com)
33
+ - `Progress`: add shadow tokens to Progress and ProgressBar (jacqui.koroll@telus.com)
34
+ - `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)
35
+ - `Modal`: updated the alignment of the cancel/secondary buttons (sam.obisesan@telus.com)
36
+ - `Card`: new token backgroundGradient added to be able to use the gradient as background (35577399+JoshHC@users.noreply.github.com)
37
+ - Bump @telus-uds/system-theme-tokens to v2.65.0
38
+
39
+ ### Patches
40
+
41
+ - `Modal`: Fix focus trap to ensure focus is contained within the modal and initial focus is set on modal upon open (Mauricio.BatresMontejo@telus.com)
42
+ - `Typography`: fix sub and sup render on mobile devices (guillermo.peitzner@telus.com)
43
+ - `Autocomplete`: fix suggestion list displacement (guillermo.peitzner@telus.com)
44
+ - `List`: Enable `CircleBullet` icon to visualize order of nested lists. (jaime.tuyuc@telus.com)
45
+ - `Notification`: use maxWidth to avoid overflow in media queries (kristina.kirpichnikova@telus.com)
46
+
7
47
  ## 1.95.0
8
48
 
9
- Wed, 25 Sep 2024 16:57:49 GMT
49
+ Wed, 25 Sep 2024 17:07:47 GMT
10
50
 
11
51
  ### Minor changes
12
52
 
@@ -144,6 +144,7 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
144
144
 
145
145
  // When it's nested, selected value
146
146
  const [nestedSelectedValue, setNestedSelectedValue] = _react.default.useState(null);
147
+ const [isInputVisible, setIsInputVisible] = _react.default.useState(true);
147
148
  const {
148
149
  supportsProps,
149
150
  ...selectedProps
@@ -269,6 +270,27 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
269
270
  }));
270
271
  }
271
272
  }, [nestedSelectedValue, items]);
273
+ _react.default.useEffect(() => {
274
+ if (_Platform.default.OS === 'ios' || _Platform.default.OS === 'android') {
275
+ return undefined;
276
+ }
277
+ const observer = new IntersectionObserver(entries => {
278
+ const [entry] = entries;
279
+ setIsInputVisible(entry.isIntersecting);
280
+ if (!entry.isIntersecting) {
281
+ setIsExpanded(false);
282
+ }
283
+ });
284
+ const currentInputRef = inputRef.current;
285
+ if (currentInputRef) {
286
+ observer.observe(currentInputRef);
287
+ }
288
+ return () => {
289
+ if (currentInputRef) {
290
+ observer.unobserve(currentInputRef);
291
+ }
292
+ };
293
+ }, [inputRef]);
272
294
  const handleClose = event => {
273
295
  var _openOverlayRef$curre, _openOverlayRef$curre2;
274
296
  if (event.type === 'keydown' && (event.key === 'Escape' || event.key === '27') || event.type === 'click' && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre = openOverlayRef.current) !== null && _openOverlayRef$curre !== void 0 && _openOverlayRef$curre.contains(event.target)) || event.type === 'touchstart' && openOverlayRef !== null && openOverlayRef !== void 0 && openOverlayRef.current && event.touches[0].target && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre2 = openOverlayRef.current) !== null && _openOverlayRef$curre2 !== void 0 && _openOverlayRef$curre2.contains(event.touches[0].target))) {
@@ -325,7 +347,19 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
325
347
  readOnly: readOnly,
326
348
  ref: inputRef,
327
349
  ...(_Platform.default.OS !== 'web' ? {
328
- onLayout: event => setSourceLayout(event.nativeEvent.layout)
350
+ onLayout: event => {
351
+ setSourceLayout(event.nativeEvent.layout);
352
+ const {
353
+ y,
354
+ height
355
+ } = event.nativeEvent.layout;
356
+ if (y >= 0 && height > 0) {
357
+ setIsInputVisible(true);
358
+ } else {
359
+ setIsInputVisible(false);
360
+ setIsExpanded(false);
361
+ }
362
+ }
329
363
  } : {}),
330
364
  tokens: inputTokens,
331
365
  validation: validation,
@@ -338,7 +372,7 @@ const Autocomplete = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
338
372
  })
339
373
  });
340
374
  }
341
- }), (isExpanded || hintExpansionEnabled) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
375
+ }), (isExpanded || hintExpansionEnabled) && isInputVisible && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
342
376
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Listbox.default.Overlay, {
343
377
  overlaidPosition: overlaidPosition,
344
378
  isReady: isReady,
@@ -31,6 +31,7 @@ const selectStyles = _ref => {
31
31
  paddingTop,
32
32
  minWidth,
33
33
  shadow,
34
+ backgroundGradient,
34
35
  gradient
35
36
  } = _ref;
36
37
  return {
@@ -50,6 +51,9 @@ const selectStyles = _ref => {
50
51
  backgroundOrigin: `border-box`,
51
52
  boxShadow: `inset 0 1000px white`,
52
53
  border: `${borderWidth}px solid transparent`
54
+ } : {}),
55
+ ...(backgroundGradient && _Platform.default.OS === 'web' ? {
56
+ backgroundImage: `linear-gradient(${backgroundGradient.angle}deg, ${backgroundGradient.stops[0].color}, ${backgroundGradient.stops[1].color})`
53
57
  } : {})
54
58
  };
55
59
  };
@@ -106,7 +106,7 @@ const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWi
106
106
  };
107
107
  };
108
108
  const getPeekingProps = viewport => {
109
- if (viewport === 'xs' || viewport === 'sm') {
109
+ if (viewport === 'xs' || viewport === 'sm' || viewport === 'md') {
110
110
  return {
111
111
  peekingFirstSpace: 48,
112
112
  peekingGap: 16,
@@ -21,39 +21,35 @@ const selectContainerStyle = _ref => {
21
21
  totalItems,
22
22
  enablePeeking,
23
23
  peekingMarginLeft,
24
- peekingMarginRight,
25
24
  peekingFirstSpace,
26
25
  peekingLastSpace,
27
26
  peekingMiddleSpace,
28
27
  peekingGap,
29
28
  hidden
30
29
  } = _ref;
31
- const isFirst = elementIndex === 0;
32
- const isLast = elementIndex === totalItems - 1;
33
- const isMiddle = !isFirst && !isLast;
34
- const isActive = activeIndex === elementIndex;
35
30
  let adjustedWidth = width;
36
31
  let marginLeft = 0;
37
- let marginRight = 0;
32
+ const marginRight = 0;
38
33
  if (enablePeeking) {
34
+ adjustedWidth = width - (peekingMarginLeft + peekingGap + peekingFirstSpace);
35
+ const isFirst = elementIndex === 0;
36
+ const isActive = activeIndex === elementIndex;
39
37
  if (isActive) {
40
- adjustedWidth = width - (peekingMarginLeft + peekingGap + peekingFirstSpace);
41
- } else if (isMiddle) {
42
- adjustedWidth = width - peekingGap;
43
- }
44
- if (isFirst) {
45
- if (isActive) {
38
+ if (isFirst) {
46
39
  marginLeft = peekingMarginLeft;
47
- } else if (activeIndex === totalItems - 1) {
48
- marginLeft = peekingLastSpace;
49
40
  } else {
50
- marginLeft = peekingMiddleSpace;
41
+ marginLeft = peekingGap;
42
+ }
43
+ } else if (isFirst) {
44
+ marginLeft = peekingMarginLeft + peekingGap + peekingFirstSpace + peekingMiddleSpace;
45
+ if (activeIndex > 1) {
46
+ marginLeft += (peekingGap + peekingMiddleSpace * 2) * (activeIndex - 1);
47
+ }
48
+ if (activeIndex === totalItems - 1) {
49
+ marginLeft += peekingLastSpace - peekingMiddleSpace;
51
50
  }
52
- }
53
- if (isLast && isActive) {
54
- marginRight = peekingMarginRight;
55
51
  } else {
56
- marginRight = peekingGap;
52
+ marginLeft = peekingGap;
57
53
  }
58
54
  }
59
55
  const style = {
@@ -135,8 +135,7 @@ exports.default = _default;
135
135
  const staticStyles = _StyleSheet.default.create({
136
136
  container: {
137
137
  flexShrink: 1,
138
- flexDirection: 'row',
139
- alignItems: 'baseline'
138
+ flexDirection: 'row'
140
139
  },
141
140
  label: {
142
141
  flexShrink: 1
@@ -146,7 +145,7 @@ const staticStyles = _StyleSheet.default.create({
146
145
  flexShrink: 0
147
146
  },
148
147
  tooltipAlign: {
149
- alignSelf: 'flex-start',
148
+ alignSelf: 'center',
150
149
  justifyContent: 'center'
151
150
  }
152
151
  });
@@ -135,7 +135,9 @@ const staticStyles = _StyleSheet.default.create({
135
135
  },
136
136
  titleAndContentContainer: {
137
137
  flexDirection: 'column',
138
- flexShrink: 1
138
+ flexShrink: 1,
139
+ flexGrow: 1,
140
+ textAlign: 'justify'
139
141
  }
140
142
  });
141
143
  ListItemBase.propTypes = {
@@ -62,6 +62,9 @@ const GroupControl = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
62
62
  itemOutline,
63
63
  groupHeight
64
64
  } = tokens;
65
+ const getTextStyles = () => ({
66
+ color: groupColor
67
+ });
65
68
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
66
69
  onPress: () => setSelectedId(id),
67
70
  style: [styles.controlWrapper, {
@@ -81,6 +84,7 @@ const GroupControl = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
81
84
  }],
82
85
  ref: ref,
83
86
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
87
+ style: getTextStyles(),
84
88
  children: label
85
89
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
86
90
  space: 1,
@@ -104,6 +104,7 @@ const selectScrollViewStyles = () => ({
104
104
  * - Don’t use modals consecutively
105
105
  */
106
106
  const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
107
+ var _modalContentRef$curr2;
107
108
  let {
108
109
  children,
109
110
  isOpen,
@@ -132,6 +133,8 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
132
133
  maxWidth
133
134
  });
134
135
  const modalRef = (0, _useScrollBlocking.default)(isOpen);
136
+ const modalBodyRef = _react.default.useRef(ref);
137
+ const modalContentRef = _react.default.useRef(null);
135
138
  const {
136
139
  closeIcon: CloseIconComponent
137
140
  } = themeTokens;
@@ -146,6 +149,25 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
146
149
  const handleKeyUp = event => {
147
150
  if (event.key === 'Escape') onClose();
148
151
  };
152
+ const manageFocus = _react.default.useCallback(event => {
153
+ if (event.key === 'Tab') {
154
+ var _modalBodyRef$current;
155
+ const focusableElements = Array.from(modalBodyRef === null || modalBodyRef === void 0 ? void 0 : (_modalBodyRef$current = modalBodyRef.current) === null || _modalBodyRef$current === void 0 ? void 0 : _modalBodyRef$current.querySelectorAll(`
156
+ a[href], button, textarea, input, select,
157
+ [tabindex]:not([tabindex="-1"]),
158
+ [contenteditable="true"]
159
+ `));
160
+ const firstElement = focusableElements[0];
161
+ const lastElement = focusableElements[focusableElements.length - 1];
162
+ if (event.shiftKey && document.activeElement === firstElement) {
163
+ event.preventDefault();
164
+ lastElement.focus();
165
+ } else if (!event.shiftKey && document.activeElement === lastElement) {
166
+ event.preventDefault();
167
+ firstElement.focus();
168
+ }
169
+ }
170
+ }, [modalBodyRef]);
149
171
 
150
172
  // Show the custom react node passed to `closedButton` or the default close button if `closeButton` is `undefined`.
151
173
  // Hide the close button if `closeButton` is `null`.
@@ -156,22 +178,20 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
156
178
  const closeButtonRef = _react.default.useRef(null);
157
179
  _react.default.useEffect(() => {
158
180
  if (_Platform.default.OS === 'web') {
159
- const handleFocus = () => {
160
- // If the focus is on the last item of the web modal container, move it to the close button
161
- if (document.activeElement === focusTrapRef.current && closeButtonRef.current) {
162
- closeButtonRef.current.focus();
163
- }
164
- return undefined;
165
- };
166
-
167
- // Add an event listener to manage focus in the web modal container
168
- document.addEventListener('focusin', handleFocus);
181
+ // Add an event listener to manage keydown and focus in the web modal container
182
+ document.addEventListener('keydown', manageFocus);
169
183
 
170
184
  // Clean up the event listener
171
- return () => document.removeEventListener('focusin', handleFocus);
185
+ return () => document.removeEventListener('keydown', manageFocus);
172
186
  }
173
187
  return undefined;
174
- }, []);
188
+ }, [manageFocus]);
189
+ _react.default.useEffect(() => {
190
+ if (isOpen) {
191
+ var _modalContentRef$curr;
192
+ modalContentRef === null || modalContentRef === void 0 ? void 0 : (_modalContentRef$curr = modalContentRef.current) === null || _modalContentRef$curr === void 0 ? void 0 : _modalContentRef$curr.focus();
193
+ }
194
+ }, [isOpen, modalContentRef === null || modalContentRef === void 0 ? void 0 : (_modalContentRef$curr2 = modalContentRef.current) === null || _modalContentRef$curr2 === void 0 ? void 0 : _modalContentRef$curr2.focus]);
175
195
  if (!isOpen) {
176
196
  return null;
177
197
  }
@@ -184,7 +204,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
184
204
  pointerEvents: "box-none" // don't capture backdrop press events
185
205
  ,
186
206
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
187
- ref: ref,
207
+ ref: modalBodyRef,
188
208
  style: [staticStyles.modal, selectModalStyles(themeTokens)],
189
209
  onKeyUp: handleKeyUp,
190
210
  children: [showCloseButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
@@ -229,6 +249,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
229
249
  if (_Platform.default.OS === 'web') {
230
250
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_WebModal.default, {
231
251
  ...selectProps(rest),
252
+ ref: modalContentRef,
232
253
  children: [content, /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
233
254
  accessibilityRole: "button",
234
255
  ref: focusTrapRef
@@ -72,6 +72,7 @@ const ModalContent = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
72
72
  borderColor,
73
73
  gap,
74
74
  direction,
75
+ footerTopWidth,
75
76
  hasBorder
76
77
  } = _ref3;
77
78
  return {
@@ -83,8 +84,8 @@ const ModalContent = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
83
84
  paddingLeft,
84
85
  paddingRight,
85
86
  paddingTop,
86
- borderTopColor: hasBorder ? borderColor : 'transparent',
87
- borderTopWidth: hasBorder ? 1 : 0
87
+ borderTopWidth: footerTopWidth > 0 ? footerTopWidth : hasBorder && 1 || 0,
88
+ borderTopColor: borderColor
88
89
  };
89
90
  };
90
91
  const headingStyles = {
@@ -162,7 +163,7 @@ const styles = _StyleSheet.default.create({
162
163
  minHeight: _Platform.default.OS === 'web' ? '100%' : 'auto'
163
164
  },
164
165
  cancelButton: {
165
- flex: 1
166
+ display: 'flex'
166
167
  }
167
168
  });
168
169
  ModalContent.propTypes = {
@@ -31,6 +31,7 @@ const WebModal = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
31
31
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
32
32
  style: staticStyles.container,
33
33
  ...selectProps(rest),
34
+ focusable: true,
34
35
  ref: ref,
35
36
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
36
37
  style: staticStyles.content,
@@ -105,19 +105,19 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
105
105
  justifyContent: 'space-between',
106
106
  ...(0, _utils.createMediaQueryStyles)({
107
107
  xs: {
108
- width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content = themeOptions.contentMaxWidth) === null || _themeOptions$content === void 0 ? void 0 : _themeOptions$content.xs) || '100%'
108
+ maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content = themeOptions.contentMaxWidth) === null || _themeOptions$content === void 0 ? void 0 : _themeOptions$content.xs) || '100%'
109
109
  },
110
110
  md: {
111
- width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content2 = themeOptions.contentMaxWidth) === null || _themeOptions$content2 === void 0 ? void 0 : _themeOptions$content2.md) || '100%'
111
+ maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content2 = themeOptions.contentMaxWidth) === null || _themeOptions$content2 === void 0 ? void 0 : _themeOptions$content2.md) || '100%'
112
112
  },
113
113
  lg: {
114
- width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content3 = themeOptions.contentMaxWidth) === null || _themeOptions$content3 === void 0 ? void 0 : _themeOptions$content3.lg) || '100%'
114
+ maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content3 = themeOptions.contentMaxWidth) === null || _themeOptions$content3 === void 0 ? void 0 : _themeOptions$content3.lg) || '100%'
115
115
  },
116
116
  sm: {
117
- width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content4 = themeOptions.contentMaxWidth) === null || _themeOptions$content4 === void 0 ? void 0 : _themeOptions$content4.sm) || '100%'
117
+ maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content4 = themeOptions.contentMaxWidth) === null || _themeOptions$content4 === void 0 ? void 0 : _themeOptions$content4.sm) || '100%'
118
118
  },
119
119
  xl: {
120
- width: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content5 = themeOptions.contentMaxWidth) === null || _themeOptions$content5 === void 0 ? void 0 : _themeOptions$content5.xl) || '100%'
120
+ maxWidth: (themeOptions === null || themeOptions === void 0 ? void 0 : (_themeOptions$content5 = themeOptions.contentMaxWidth) === null || _themeOptions$content5 === void 0 ? void 0 : _themeOptions$content5.xl) || '100%'
121
121
  }
122
122
  })
123
123
  }
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
9
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
9
10
  var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
10
11
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
@@ -47,6 +48,7 @@ const Pagination = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
47
48
  sideButtonTokens,
48
49
  LinkRouter,
49
50
  linkRouterProps,
51
+ numberOfPagesBeforeEllipsis = 4,
50
52
  ...rest
51
53
  } = _ref2;
52
54
  const viewport = (0, _ViewportProvider.useViewport)();
@@ -86,7 +88,8 @@ const Pagination = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
86
88
  shouldRenderEllipsis
87
89
  } = (0, _usePagination.default)({
88
90
  items,
89
- truncateAbove
91
+ truncateAbove,
92
+ numberOfPagesBeforeEllipsis
90
93
  });
91
94
  const ellipsisTextStyles = selectTextStyles(themeTokens, themeOptions);
92
95
  const ellipisContainerStyles = _StyleSheet.default.create({
@@ -207,7 +210,11 @@ Pagination.propTypes = {
207
210
  /**
208
211
  * Custom tokens for `PaginationSideButton`
209
212
  */
210
- sideButtonTokens: (0, _utils.getTokensPropType)('PaginationSideButton')
213
+ sideButtonTokens: (0, _utils.getTokensPropType)('PaginationSideButton'),
214
+ /**
215
+ * The number of pages before the ellipsis is shown
216
+ */
217
+ numberOfPagesBeforeEllipsis: _propTypes.default.number
211
218
  };
212
219
  const staticStyles = _StyleSheet.default.create({
213
220
  container: {
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TRUNCATE_ABOVE_VALUE = exports.MIN_PAGES_TO_SHOW = exports.DEFAULT_PAGE_TO_SHOW_VALUE = void 0;
7
+ const TRUNCATE_ABOVE_VALUE = 4;
8
+ exports.TRUNCATE_ABOVE_VALUE = TRUNCATE_ABOVE_VALUE;
9
+ const MIN_PAGES_TO_SHOW = 3;
10
+ exports.MIN_PAGES_TO_SHOW = MIN_PAGES_TO_SHOW;
11
+ const DEFAULT_PAGE_TO_SHOW_VALUE = 1;
12
+ exports.DEFAULT_PAGE_TO_SHOW_VALUE = DEFAULT_PAGE_TO_SHOW_VALUE;
@@ -4,17 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _constants = require("./constants");
7
8
  /**
8
9
  * Handles configurable truncating of pagination items.
9
10
  *
10
11
  * @param {object} props
11
12
  * @param {React.Element[]} items
12
13
  * @param {number} truncateAbove
14
+ * @param {number} numberOfPagesBeforeEllipsis
13
15
  */
14
16
  function usePagination(_ref) {
15
17
  let {
16
18
  items,
17
- truncateAbove
19
+ truncateAbove,
20
+ numberOfPagesBeforeEllipsis
18
21
  } = _ref;
19
22
  const activeItemIndex = Math.max(items.findIndex(item => item.props.isActive), 0 // default to the first item if none is marked as active
20
23
  );
@@ -36,8 +39,15 @@ function usePagination(_ref) {
36
39
  tokens
37
40
  };
38
41
  };
39
- const windowSize = truncateAbove > 4 ? 3 : 1;
40
- const truncateEnabled = items.length > truncateAbove;
42
+ let windowSize;
43
+ if (numberOfPagesBeforeEllipsis >= 1 && numberOfPagesBeforeEllipsis < items.length) {
44
+ windowSize = numberOfPagesBeforeEllipsis;
45
+ } else if (truncateAbove > _constants.TRUNCATE_ABOVE_VALUE) {
46
+ windowSize = _constants.MIN_PAGES_TO_SHOW;
47
+ } else {
48
+ windowSize = _constants.DEFAULT_PAGE_TO_SHOW_VALUE;
49
+ }
50
+ const truncateEnabled = items.length > windowSize;
41
51
  const truncateWindowStart = windowSize;
42
52
  const truncateWindowEnd = items.length - 1 - windowSize;
43
53
 
@@ -92,7 +92,15 @@ const selectBottomTextTypographyTokens = _ref6 => {
92
92
  lineHeight: bottomTextLineHeight
93
93
  };
94
94
  };
95
- const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
95
+ const selectContainertokens = _ref7 => {
96
+ let {
97
+ alignItemsText
98
+ } = _ref7;
99
+ return {
100
+ alignItems: alignItemsText
101
+ };
102
+ };
103
+ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref8, ref) => {
96
104
  let {
97
105
  size = 'medium',
98
106
  signDirection = 'left',
@@ -109,7 +117,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
109
117
  tokens: priceLockupTokens,
110
118
  variant = {},
111
119
  ...rest
112
- } = _ref7;
120
+ } = _ref8;
113
121
  const viewport = (0, _ViewportProvider.useViewport)();
114
122
  const {
115
123
  footnoteMarginTop,
@@ -134,7 +142,7 @@ const PriceLockup = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
134
142
  const topTextTypographyTokens = selectTopTextTypographyTokens(themeTokens);
135
143
  const bottomTextTypographyTokens = selectBottomTextTypographyTokens(themeTokens);
136
144
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
137
- style: [staticStyles.priceLockupContainer],
145
+ style: [staticStyles.priceLockupContainer, selectContainertokens(themeTokens)],
138
146
  ref: ref,
139
147
  ...selectProps(rest),
140
148
  children: [topText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
@@ -18,14 +18,16 @@ const selectProgressStyles = _ref => {
18
18
  borderWidth,
19
19
  borderColor,
20
20
  borderRadius,
21
- height
21
+ height,
22
+ shadow
22
23
  } = _ref;
23
24
  return {
24
25
  backgroundColor,
25
26
  borderWidth,
26
27
  borderColor,
27
28
  borderRadius,
28
- height
29
+ height,
30
+ ...(0, _ThemeProvider.applyShadowToken)(shadow)
29
31
  };
30
32
  };
31
33
 
@@ -45,6 +47,7 @@ const selectProgressStyles = _ref => {
45
47
  * - `borderRadius` for the rounded corners,
46
48
  * - `borderWidth` to change the border width.
47
49
  * - `height` to control the height of the progress bars displayed within the progress bar container.
50
+ * - `shadow` to apply a box shadow to the progress bar container.
48
51
  *
49
52
  * ## Variants
50
53
  *
@@ -20,13 +20,15 @@ const selectBarStyles = (_ref, percentage) => {
20
20
  backgroundColor,
21
21
  borderRadius,
22
22
  outlineWidth,
23
- outlineColor
23
+ outlineColor,
24
+ shadow
24
25
  } = _ref;
25
26
  return {
26
27
  backgroundColor,
27
28
  borderRadius,
28
29
  outlineWidth,
29
30
  outlineColor,
31
+ ...(0, _ThemeProvider.applyShadowToken)(shadow),
30
32
  width: `${percentage}%`
31
33
  };
32
34
  };
@@ -46,6 +48,7 @@ const selectBarStyles = (_ref, percentage) => {
46
48
  * - `borderRadius` for the rounded corners,
47
49
  * - `outlineColor` to control the color of the border (outline),
48
50
  * - `outlineWidth` to change the outline width.
51
+ * - `shadow` to apply a box shadow to the progress bar.
49
52
  *
50
53
  * ## Variants
51
54
  *
@@ -125,9 +125,10 @@ const selectArrowStyles = (_ref4, _ref5) => {
125
125
  };
126
126
  };
127
127
  const selectTextStyles = tokens => (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', tokens));
128
- const defaultControl = (pressableState, variant) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipButton.default, {
128
+ const defaultControl = (pressableState, variant, tokens) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipButton.default, {
129
129
  pressableState: pressableState,
130
- variant: variant
130
+ variant: variant,
131
+ tokens: tokens
131
132
  });
132
133
 
133
134
  /**
@@ -156,6 +157,8 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
156
157
  variant,
157
158
  inline = false,
158
159
  nativeID,
160
+ activateOnHover = false,
161
+ tooltipButtonTokens,
159
162
  ...rest
160
163
  } = _ref6;
161
164
  const [isOpen, setIsOpen] = _react.default.useState(false);
@@ -256,6 +259,31 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
256
259
  }
257
260
  setTooltipPosition(updatedPosition);
258
261
  }, [isOpen, position, tooltipDimensions, controlLayout, windowDimensions, arrowWidth, arrowOffset, tooltipPosition]);
262
+ _react.default.useEffect(() => {
263
+ if (_Platform.default.OS !== 'web') {
264
+ return undefined;
265
+ }
266
+ const handleHover = event => {
267
+ if (activateOnHover) {
268
+ const isInsideControl = controlRef.current && controlRef.current.contains(event.target);
269
+ if (isInsideControl) {
270
+ if (!isOpen) {
271
+ setIsOpen(!isOpen);
272
+ }
273
+ } else {
274
+ close();
275
+ }
276
+ }
277
+ };
278
+ document.addEventListener('mouseover', handleHover, {
279
+ capture: true
280
+ });
281
+ return () => {
282
+ document.removeEventListener('mouseover', handleHover, {
283
+ capture: true
284
+ });
285
+ };
286
+ }, [controlLayout, activateOnHover, isOpen, onPress]);
259
287
  const control = children !== undefined ? children : defaultControl;
260
288
  const pressableStyles = control === defaultControl ? _Platform.default.select({
261
289
  web: {
@@ -284,7 +312,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
284
312
  accessibilityLabel: getCopy('a11yText'),
285
313
  accessibilityRole: "button",
286
314
  nativeID: nativeID,
287
- children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant) : control
315
+ children: typeof control === 'function' ? pressableState => control(getPressableState(pressableState), variant, tooltipButtonTokens) : control
288
316
  }), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
289
317
  onPress: close,
290
318
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
@@ -37,6 +37,11 @@ const propTypes = {
37
37
  * The `id` of the tooltip button.
38
38
  */
39
39
  nativeID: _propTypes.default.string,
40
+ /**
41
+ * Set to `true` to open the tooltip on hover
42
+ */
43
+ activateOnHover: _propTypes.default.bool,
44
+ tooltipButtonTokens: (0, _utils.getTokensPropType)('TooltipButton'),
40
45
  tokens: (0, _utils.getTokensPropType)('Tooltip'),
41
46
  variant: _utils.variantProp.propType
42
47
  };