@telus-uds/components-base 1.94.0 → 1.96.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 (68) hide show
  1. package/CHANGELOG.md +41 -2
  2. package/lib/Autocomplete/Autocomplete.js +38 -3
  3. package/lib/Card/CardBase.js +4 -0
  4. package/lib/DownloadApp/DownloadApp.js +168 -0
  5. package/lib/DownloadApp/dictionary.js +17 -0
  6. package/lib/DownloadApp/index.js +10 -0
  7. package/lib/Icon/IconText.js +19 -2
  8. package/lib/Link/LinkBase.js +2 -2
  9. package/lib/List/ListItemBase.js +2 -1
  10. package/lib/Modal/Modal.js +34 -13
  11. package/lib/Modal/ModalContent.js +1 -1
  12. package/lib/Modal/WebModal.js +1 -0
  13. package/lib/Notification/Notification.js +5 -5
  14. package/lib/PriceLockup/PriceLockup.js +11 -3
  15. package/lib/Progress/Progress.js +5 -2
  16. package/lib/Progress/ProgressBar.js +4 -1
  17. package/lib/TabBar/TabBar.js +133 -0
  18. package/lib/TabBar/TabBarItem.js +184 -0
  19. package/lib/TabBar/index.js +10 -0
  20. package/lib/TextInput/TextInputBase.js +2 -1
  21. package/lib/Tooltip/getTooltipPosition.js +8 -9
  22. package/lib/Typography/Typography.js +42 -19
  23. package/lib/index.js +23 -0
  24. package/lib-module/Autocomplete/Autocomplete.js +38 -3
  25. package/lib-module/Card/CardBase.js +4 -0
  26. package/lib-module/DownloadApp/DownloadApp.js +160 -0
  27. package/lib-module/DownloadApp/dictionary.js +10 -0
  28. package/lib-module/DownloadApp/index.js +2 -0
  29. package/lib-module/Icon/IconText.js +19 -2
  30. package/lib-module/Link/LinkBase.js +2 -2
  31. package/lib-module/List/ListItemBase.js +2 -1
  32. package/lib-module/Modal/Modal.js +34 -13
  33. package/lib-module/Modal/ModalContent.js +1 -1
  34. package/lib-module/Modal/WebModal.js +1 -0
  35. package/lib-module/Notification/Notification.js +5 -5
  36. package/lib-module/PriceLockup/PriceLockup.js +11 -3
  37. package/lib-module/Progress/Progress.js +6 -3
  38. package/lib-module/Progress/ProgressBar.js +5 -2
  39. package/lib-module/TabBar/TabBar.js +125 -0
  40. package/lib-module/TabBar/TabBarItem.js +177 -0
  41. package/lib-module/TabBar/index.js +2 -0
  42. package/lib-module/TextInput/TextInputBase.js +2 -1
  43. package/lib-module/Tooltip/getTooltipPosition.js +8 -9
  44. package/lib-module/Typography/Typography.js +42 -19
  45. package/lib-module/index.js +3 -1
  46. package/package.json +2 -2
  47. package/src/Autocomplete/Autocomplete.jsx +43 -3
  48. package/src/Card/CardBase.jsx +6 -0
  49. package/src/DownloadApp/DownloadApp.jsx +165 -0
  50. package/src/DownloadApp/dictionary.js +10 -0
  51. package/src/DownloadApp/index.js +3 -0
  52. package/src/Icon/IconText.jsx +21 -4
  53. package/src/Link/LinkBase.jsx +2 -2
  54. package/src/List/ListItemBase.jsx +1 -1
  55. package/src/Modal/Modal.jsx +40 -14
  56. package/src/Modal/ModalContent.jsx +1 -1
  57. package/src/Modal/WebModal.jsx +1 -1
  58. package/src/Notification/Notification.jsx +5 -5
  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/TabBar/TabBar.jsx +123 -0
  63. package/src/TabBar/TabBarItem.jsx +149 -0
  64. package/src/TabBar/index.js +3 -0
  65. package/src/TextInput/TextInputBase.jsx +1 -1
  66. package/src/Tooltip/getTooltipPosition.js +11 -12
  67. package/src/Typography/Typography.jsx +37 -13
  68. package/src/index.js +4 -1
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import { Text, View } from 'react-native'
3
+ import { Text, View, Platform } from 'react-native'
4
4
 
5
5
  import { useResponsiveThemeTokens, useTheme, useThemeTokens } from '../ThemeProvider'
6
6
  import { applyTextStyles } from '../ThemeProvider/utils'
@@ -54,6 +54,16 @@ const selectTextStyles = (
54
54
  gradient
55
55
  })
56
56
 
57
+ const HALF_FONT_SIZE = 2
58
+ const QUARTER_FONT_SIZE = 4
59
+
60
+ const selectMobileSubSupStyles = ({ fontSize }, type) => ({
61
+ fontSize: fontSize / HALF_FONT_SIZE,
62
+ lineHeight: fontSize,
63
+ position: 'relative',
64
+ top: type === 'sub' ? fontSize / QUARTER_FONT_SIZE : -fontSize / QUARTER_FONT_SIZE
65
+ })
66
+
57
67
  // General-purpose flexible theme-neutral base component for text
58
68
  const Typography = React.forwardRef(
59
69
  (
@@ -175,19 +185,33 @@ const Typography = React.forwardRef(
175
185
  }
176
186
 
177
187
  const resetTagStyling = (child) => {
178
- if (typeof child === 'object' && (child?.type === 'sub' || child?.type === 'sup')) {
179
- const childStyles = child?.props?.style || {}
180
- const supFontSize = childStyles.fontSize ?? themeTokens.superScriptFontSize
181
- const sanitizedChild = React.cloneElement(child, {
182
- style: {
183
- ...childStyles,
184
- ...(supFontSize ? { fontSize: supFontSize } : {}),
185
- lineHeight: 0
186
- }
187
- })
188
- return sanitizedChild
188
+ if (typeof child !== 'object' || !(child?.type === 'sub' || child?.type === 'sup')) {
189
+ return child
189
190
  }
190
- return child
191
+
192
+ const childStyles = child?.props?.style || {}
193
+ const supFontSize = childStyles.fontSize ?? themeTokens.superScriptFontSize
194
+ const isMobile = Platform.OS === 'ios' || Platform.OS === 'android'
195
+ const isSubSup = child?.type === 'sub' || child?.type === 'sup'
196
+
197
+ const mobileStyles =
198
+ isMobile && isSubSup ? selectMobileSubSupStyles(themeTokens, child?.type) : {}
199
+ const defaultStyles = !isMobile && isSubSup ? { fontSize: supFontSize, lineHeight: 0 } : {}
200
+
201
+ const sanitizedChild = React.cloneElement(
202
+ isMobile && isSubSup ? (
203
+ <View>
204
+ <Text style={[childStyles, mobileStyles]}>{child.props.children}</Text>
205
+ </View>
206
+ ) : (
207
+ child
208
+ ),
209
+ {
210
+ style: { ...childStyles, ...defaultStyles }
211
+ }
212
+ )
213
+
214
+ return sanitizedChild
191
215
  }
192
216
 
193
217
  const sanitizeChildren = () => {
package/src/index.js CHANGED
@@ -15,6 +15,7 @@ export * from './Checkbox'
15
15
  export { default as CheckboxCard } from './CheckboxCard'
16
16
  export { default as CheckboxCardGroup } from './CheckboxCardGroup'
17
17
  export { default as ColourToggle } from './ColourToggle'
18
+ export { default as DownloadApp } from './DownloadApp'
18
19
  export { default as Divider } from './Divider'
19
20
  export { default as ExpandCollapse, Accordion } from './ExpandCollapse'
20
21
  export { default as Feedback } from './Feedback'
@@ -57,6 +58,7 @@ export * from './StackView'
57
58
  export { default as Status } from './Status'
58
59
  export { default as StepTracker } from './StepTracker'
59
60
  export { default as Tabs } from './Tabs'
61
+ export { default as TabBar } from './TabBar'
60
62
  export { default as Tags } from './Tags'
61
63
  export * from './TextInput'
62
64
  export { default as Timeline } from './Timeline'
@@ -79,7 +81,8 @@ export {
79
81
  getThemeTokens,
80
82
  applyOuterBorder,
81
83
  applyTextStyles,
82
- applyShadowToken
84
+ applyShadowToken,
85
+ useResponsiveThemeTokens
83
86
  } from './ThemeProvider'
84
87
 
85
88
  export * from './utils'