@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.
- package/CHANGELOG.md +41 -2
- package/lib/Autocomplete/Autocomplete.js +38 -3
- package/lib/Card/CardBase.js +4 -0
- package/lib/DownloadApp/DownloadApp.js +168 -0
- package/lib/DownloadApp/dictionary.js +17 -0
- package/lib/DownloadApp/index.js +10 -0
- package/lib/Icon/IconText.js +19 -2
- package/lib/Link/LinkBase.js +2 -2
- package/lib/List/ListItemBase.js +2 -1
- package/lib/Modal/Modal.js +34 -13
- package/lib/Modal/ModalContent.js +1 -1
- package/lib/Modal/WebModal.js +1 -0
- package/lib/Notification/Notification.js +5 -5
- package/lib/PriceLockup/PriceLockup.js +11 -3
- package/lib/Progress/Progress.js +5 -2
- package/lib/Progress/ProgressBar.js +4 -1
- package/lib/TabBar/TabBar.js +133 -0
- package/lib/TabBar/TabBarItem.js +184 -0
- package/lib/TabBar/index.js +10 -0
- package/lib/TextInput/TextInputBase.js +2 -1
- package/lib/Tooltip/getTooltipPosition.js +8 -9
- package/lib/Typography/Typography.js +42 -19
- package/lib/index.js +23 -0
- package/lib-module/Autocomplete/Autocomplete.js +38 -3
- package/lib-module/Card/CardBase.js +4 -0
- package/lib-module/DownloadApp/DownloadApp.js +160 -0
- package/lib-module/DownloadApp/dictionary.js +10 -0
- package/lib-module/DownloadApp/index.js +2 -0
- package/lib-module/Icon/IconText.js +19 -2
- package/lib-module/Link/LinkBase.js +2 -2
- package/lib-module/List/ListItemBase.js +2 -1
- package/lib-module/Modal/Modal.js +34 -13
- package/lib-module/Modal/ModalContent.js +1 -1
- package/lib-module/Modal/WebModal.js +1 -0
- package/lib-module/Notification/Notification.js +5 -5
- package/lib-module/PriceLockup/PriceLockup.js +11 -3
- package/lib-module/Progress/Progress.js +6 -3
- package/lib-module/Progress/ProgressBar.js +5 -2
- package/lib-module/TabBar/TabBar.js +125 -0
- package/lib-module/TabBar/TabBarItem.js +177 -0
- package/lib-module/TabBar/index.js +2 -0
- package/lib-module/TextInput/TextInputBase.js +2 -1
- package/lib-module/Tooltip/getTooltipPosition.js +8 -9
- package/lib-module/Typography/Typography.js +42 -19
- package/lib-module/index.js +3 -1
- package/package.json +2 -2
- package/src/Autocomplete/Autocomplete.jsx +43 -3
- package/src/Card/CardBase.jsx +6 -0
- package/src/DownloadApp/DownloadApp.jsx +165 -0
- package/src/DownloadApp/dictionary.js +10 -0
- package/src/DownloadApp/index.js +3 -0
- package/src/Icon/IconText.jsx +21 -4
- package/src/Link/LinkBase.jsx +2 -2
- package/src/List/ListItemBase.jsx +1 -1
- package/src/Modal/Modal.jsx +40 -14
- package/src/Modal/ModalContent.jsx +1 -1
- package/src/Modal/WebModal.jsx +1 -1
- package/src/Notification/Notification.jsx +5 -5
- package/src/PriceLockup/PriceLockup.jsx +9 -1
- package/src/Progress/Progress.jsx +6 -3
- package/src/Progress/ProgressBar.jsx +4 -2
- package/src/TabBar/TabBar.jsx +123 -0
- package/src/TabBar/TabBarItem.jsx +149 -0
- package/src/TabBar/index.js +3 -0
- package/src/TextInput/TextInputBase.jsx +1 -1
- package/src/Tooltip/getTooltipPosition.js +11 -12
- package/src/Typography/Typography.jsx +37 -13
- 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
|
|
179
|
-
|
|
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
|
-
|
|
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'
|