@telus-uds/components-base 1.59.2 → 1.61.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 +26 -2
- package/component-docs.json +526 -76
- package/lib/Autocomplete/Autocomplete.js +483 -0
- package/lib/Autocomplete/Loading.js +51 -0
- package/lib/Autocomplete/Suggestions.js +85 -0
- package/lib/Autocomplete/constants.js +14 -0
- package/lib/Autocomplete/dictionary.js +19 -0
- package/lib/Autocomplete/index.js +13 -0
- package/lib/Button/ButtonLink.js +7 -3
- package/lib/ExpandCollapse/Panel.js +7 -0
- package/lib/IconButton/IconButton.js +8 -0
- package/lib/Link/ChevronLink.js +9 -2
- package/lib/Link/LinkBase.js +14 -0
- package/lib/Link/TextButton.js +12 -1
- package/lib/Listbox/GroupControl.js +121 -0
- package/lib/Listbox/Listbox.js +198 -0
- package/lib/Listbox/ListboxGroup.js +142 -0
- package/lib/Listbox/ListboxItem.js +97 -0
- package/lib/Listbox/ListboxOverlay.js +106 -0
- package/lib/Listbox/PressableItem.js +0 -2
- package/lib/Listbox/index.js +5 -24
- package/lib/Pagination/dictionary.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +2 -2
- package/lib/SideNav/Item.js +15 -5
- package/lib/Tags/Tags.js +6 -1
- package/lib/TextInput/TextInputBase.js +2 -0
- package/lib/Tooltip/Tooltip.js +6 -1
- package/lib/Tooltip/Tooltip.native.js +6 -1
- package/lib/Tooltip/shared.js +5 -0
- package/lib/index.js +17 -13
- package/lib/utils/useOverlaidPosition.js +6 -4
- package/lib-module/Autocomplete/Autocomplete.js +448 -0
- package/lib-module/Autocomplete/Loading.js +36 -0
- package/lib-module/Autocomplete/Suggestions.js +66 -0
- package/lib-module/Autocomplete/constants.js +4 -0
- package/lib-module/Autocomplete/dictionary.js +12 -0
- package/lib-module/Autocomplete/index.js +2 -0
- package/lib-module/Button/ButtonLink.js +4 -1
- package/lib-module/ExpandCollapse/Panel.js +7 -0
- package/lib-module/IconButton/IconButton.js +8 -0
- package/lib-module/Link/ChevronLink.js +10 -3
- package/lib-module/Link/LinkBase.js +14 -0
- package/lib-module/Link/TextButton.js +11 -1
- package/lib-module/Listbox/GroupControl.js +102 -0
- package/lib-module/Listbox/Listbox.js +172 -0
- package/lib-module/Listbox/ListboxGroup.js +117 -0
- package/lib-module/Listbox/ListboxItem.js +71 -0
- package/lib-module/Listbox/ListboxOverlay.js +80 -0
- package/lib-module/Listbox/PressableItem.js +0 -2
- package/lib-module/Listbox/index.js +2 -2
- package/lib-module/Pagination/dictionary.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +2 -2
- package/lib-module/SideNav/Item.js +15 -5
- package/lib-module/Tags/Tags.js +6 -1
- package/lib-module/TextInput/TextInputBase.js +2 -0
- package/lib-module/Tooltip/Tooltip.js +6 -1
- package/lib-module/Tooltip/Tooltip.native.js +6 -1
- package/lib-module/Tooltip/shared.js +5 -0
- package/lib-module/index.js +2 -1
- package/lib-module/utils/useOverlaidPosition.js +5 -4
- package/package.json +5 -3
- package/src/Autocomplete/Autocomplete.jsx +411 -0
- package/src/Autocomplete/Loading.jsx +18 -0
- package/src/Autocomplete/Suggestions.jsx +54 -0
- package/src/Autocomplete/constants.js +4 -0
- package/src/Autocomplete/dictionary.js +12 -0
- package/src/Autocomplete/index.js +3 -0
- package/src/Button/ButtonLink.jsx +4 -1
- package/src/ExpandCollapse/Panel.jsx +11 -1
- package/src/IconButton/IconButton.jsx +7 -0
- package/src/Link/ChevronLink.jsx +10 -3
- package/src/Link/LinkBase.jsx +11 -0
- package/src/Link/TextButton.jsx +8 -2
- package/src/Listbox/GroupControl.jsx +93 -0
- package/src/Listbox/Listbox.jsx +165 -0
- package/src/Listbox/ListboxGroup.jsx +120 -0
- package/src/Listbox/ListboxItem.jsx +76 -0
- package/src/Listbox/ListboxOverlay.jsx +82 -0
- package/src/Listbox/PressableItem.jsx +0 -2
- package/src/Listbox/index.js +3 -2
- package/src/Pagination/dictionary.js +3 -3
- package/src/Progress/ProgressBarBackground.jsx +2 -2
- package/src/SideNav/Item.jsx +13 -5
- package/src/Tags/Tags.jsx +5 -1
- package/src/TextInput/TextInputBase.jsx +2 -0
- package/src/Tooltip/Tooltip.jsx +16 -2
- package/src/Tooltip/Tooltip.native.jsx +15 -2
- package/src/Tooltip/shared.js +4 -0
- package/src/index.js +2 -1
- package/src/utils/useOverlaidPosition.js +6 -5
|
@@ -3,8 +3,8 @@ import { ImageBackground, StyleSheet } from 'react-native'
|
|
|
3
3
|
|
|
4
4
|
import { variantProp } from '../utils'
|
|
5
5
|
|
|
6
|
-
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='
|
|
7
|
-
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='
|
|
6
|
+
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='inactive' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23inactive");'%3E%3C/path%3E%3C/svg%3E`
|
|
7
|
+
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='negative' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='1' shape-rendering='auto' stroke='rgba(255, 255, 255, 0.4)' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23negative");'%3E%3C/path%3E%3C/svg%3E`
|
|
8
8
|
const ProgressBarBackground = forwardRef(({ variant }, ref) => {
|
|
9
9
|
let source = null
|
|
10
10
|
if (variant?.inactive) {
|
package/src/SideNav/Item.jsx
CHANGED
|
@@ -111,12 +111,12 @@ Item.propTypes = {
|
|
|
111
111
|
*/
|
|
112
112
|
children: PropTypes.node.isRequired,
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
*
|
|
115
115
|
* Set internally in `SideNav` render function - used to keep track of active item.
|
|
116
116
|
*/
|
|
117
117
|
itemId: PropTypes.string,
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
*
|
|
120
120
|
* Set internally in `SideNav` render function - used to keep track of expanded items groups.
|
|
121
121
|
*/
|
|
122
122
|
groupId: PropTypes.string,
|
|
@@ -128,17 +128,25 @@ Item.propTypes = {
|
|
|
128
128
|
*/
|
|
129
129
|
hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
*
|
|
132
132
|
* Set internally in `SideNav` render function.
|
|
133
133
|
*/
|
|
134
134
|
isActive: PropTypes.bool,
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
*
|
|
137
137
|
* Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
|
|
138
138
|
*/
|
|
139
139
|
isExpanded: PropTypes.bool,
|
|
140
140
|
tokens: getTokensPropType('SideNavItem'),
|
|
141
|
-
variant: variantProp.propType
|
|
141
|
+
variant: variantProp.propType,
|
|
142
|
+
/**
|
|
143
|
+
* Accesibility Role
|
|
144
|
+
*/
|
|
145
|
+
accessibilityRole: PropTypes.string,
|
|
146
|
+
/**
|
|
147
|
+
* test ID
|
|
148
|
+
*/
|
|
149
|
+
testID: PropTypes.number
|
|
142
150
|
}
|
|
143
151
|
|
|
144
152
|
export default Item
|
package/src/Tags/Tags.jsx
CHANGED
|
@@ -249,7 +249,11 @@ Tags.propTypes = {
|
|
|
249
249
|
* managing its own selected state, a default set of selections may be provided.
|
|
250
250
|
* Changing the `initialValues` does not change the user's selections.
|
|
251
251
|
*/
|
|
252
|
-
initialValues: PropTypes.arrayOf(PropTypes.string)
|
|
252
|
+
initialValues: PropTypes.arrayOf(PropTypes.string),
|
|
253
|
+
/**
|
|
254
|
+
* AccesibilityRole for the Tags
|
|
255
|
+
*/
|
|
256
|
+
accessibilityRole: PropTypes.string
|
|
253
257
|
}
|
|
254
258
|
|
|
255
259
|
export default Tags
|
package/src/Tooltip/Tooltip.jsx
CHANGED
|
@@ -82,7 +82,10 @@ const defaultControl = (pressableState, variant) => (
|
|
|
82
82
|
* - Tooltips may also be useful when vertical space is an issue.
|
|
83
83
|
*/
|
|
84
84
|
const Tooltip = forwardRef(
|
|
85
|
-
(
|
|
85
|
+
(
|
|
86
|
+
{ children, content, position = 'auto', copy = 'en', tokens, variant, inline = false, ...rest },
|
|
87
|
+
ref
|
|
88
|
+
) => {
|
|
86
89
|
const [isOpen, setIsOpen] = useState(false)
|
|
87
90
|
const arrowRef = useRef()
|
|
88
91
|
|
|
@@ -157,7 +160,18 @@ const Tooltip = forwardRef(
|
|
|
157
160
|
control === defaultControl ? { top: 10, bottom: 10, left: 10, right: 10 } : undefined
|
|
158
161
|
|
|
159
162
|
return (
|
|
160
|
-
<View
|
|
163
|
+
<View
|
|
164
|
+
style={[
|
|
165
|
+
staticStyles.container,
|
|
166
|
+
Platform.select({
|
|
167
|
+
web: {
|
|
168
|
+
display: inline ? 'inline-block' : 'flex'
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
]}
|
|
172
|
+
{...selectProps(rest)}
|
|
173
|
+
ref={ref}
|
|
174
|
+
>
|
|
161
175
|
<Pressable
|
|
162
176
|
onPress={toggleIsOpen}
|
|
163
177
|
ref={reference}
|
|
@@ -108,7 +108,10 @@ const defaultControl = (pressableState, variant) => (
|
|
|
108
108
|
* - Tooltips may also be useful when vertical space is an issue.
|
|
109
109
|
*/
|
|
110
110
|
const Tooltip = forwardRef(
|
|
111
|
-
(
|
|
111
|
+
(
|
|
112
|
+
{ children, content, position = 'auto', copy = 'en', tokens, variant, inline = false, ...rest },
|
|
113
|
+
ref
|
|
114
|
+
) => {
|
|
112
115
|
const [isOpen, setIsOpen] = useState(false)
|
|
113
116
|
|
|
114
117
|
const controlRef = useRef()
|
|
@@ -217,7 +220,17 @@ const Tooltip = forwardRef(
|
|
|
217
220
|
control === defaultControl ? { top: 10, bottom: 10, left: 10, right: 10 } : undefined
|
|
218
221
|
|
|
219
222
|
return (
|
|
220
|
-
<View
|
|
223
|
+
<View
|
|
224
|
+
style={[
|
|
225
|
+
staticStyles.container,
|
|
226
|
+
Platform.select({
|
|
227
|
+
web: {
|
|
228
|
+
display: inline ? 'inline-block' : 'flex'
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
]}
|
|
232
|
+
{...selectProps(rest)}
|
|
233
|
+
>
|
|
221
234
|
<Pressable
|
|
222
235
|
onPress={toggleIsOpen}
|
|
223
236
|
ref={controlRef}
|
package/src/Tooltip/shared.js
CHANGED
|
@@ -20,6 +20,10 @@ const propTypes = {
|
|
|
20
20
|
* Use to place the tooltip in a specific location (only if it fits within viewport).
|
|
21
21
|
*/
|
|
22
22
|
position: PropTypes.oneOf(['auto', 'above', 'right', 'below', 'left']),
|
|
23
|
+
/**
|
|
24
|
+
* Display tooltip icon button as an inline element.
|
|
25
|
+
*/
|
|
26
|
+
inline: PropTypes.bool,
|
|
23
27
|
tokens: getTokensPropType('Tooltip'),
|
|
24
28
|
variant: variantProp.propType
|
|
25
29
|
}
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { default as A11yText } from './A11yText'
|
|
2
2
|
export { default as ActivityIndicator } from './ActivityIndicator'
|
|
3
|
+
export { default as Autocomplete } from './Autocomplete'
|
|
3
4
|
export { default as Box } from './Box'
|
|
4
5
|
export * from './Button'
|
|
5
6
|
export { default as Card, PressableCardBase } from './Card'
|
|
6
7
|
export * from './Carousel'
|
|
7
|
-
export
|
|
8
|
+
export { default as Listbox } from './Listbox'
|
|
8
9
|
export { default as Checkbox } from './Checkbox'
|
|
9
10
|
export * from './Checkbox'
|
|
10
11
|
export { default as Divider } from './Divider'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { Dimensions } from 'react-native'
|
|
2
|
+
import { Dimensions, Platform } from 'react-native'
|
|
3
3
|
|
|
4
4
|
const adjustHorizontalToFit = (initialOffset, windowWidth, sourceWidth) => {
|
|
5
5
|
const offset = Math.max(0, initialOffset)
|
|
@@ -169,8 +169,9 @@ const useOverlaidPosition = ({
|
|
|
169
169
|
const readyToShow = Boolean(isShown && sourceRef.current)
|
|
170
170
|
useEffect(() => {
|
|
171
171
|
const handleDimensionsChange = ({ window }) => {
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
const measurementFunction = Platform.OS === 'web' ? 'measureInWindow' : 'measure'
|
|
173
|
+
|
|
174
|
+
sourceRef.current?.[measurementFunction]((x, y, width, height) => {
|
|
174
175
|
setWindowDimensions(window)
|
|
175
176
|
setSourceLayout({ x, y, width, height })
|
|
176
177
|
})
|
|
@@ -181,9 +182,9 @@ const useOverlaidPosition = ({
|
|
|
181
182
|
if (typeof subscription?.remove === 'function') {
|
|
182
183
|
// React Native >=0.65.0
|
|
183
184
|
subscription.remove()
|
|
184
|
-
} else if (typeof Dimensions.
|
|
185
|
+
} else if (typeof Dimensions.remove === 'function') {
|
|
185
186
|
// React Native <0.65.0
|
|
186
|
-
Dimensions.
|
|
187
|
+
Dimensions.remove('change', handleDimensionsChange)
|
|
187
188
|
}
|
|
188
189
|
setSourceLayout(null)
|
|
189
190
|
setTargetDimensions(null)
|