@telus-uds/components-base 1.76.0 → 1.77.1
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/lib/Box/Box.js +112 -7
- package/lib/Box/backgroundImageStylesMap.js +101 -0
- package/lib/ExpandCollapse/Panel.js +21 -10
- package/lib/Link/InlinePressable.js +1 -0
- package/lib/Pagination/PageButton.js +6 -7
- package/lib/Skeleton/Skeleton.js +6 -3
- package/lib/StackView/getStackedContent.js +2 -3
- package/lib/StepTracker/StepTracker.js +8 -2
- package/lib/StepTracker/dictionary.js +2 -2
- package/lib-module/Box/Box.js +115 -9
- package/lib-module/Box/backgroundImageStylesMap.js +94 -0
- package/lib-module/ExpandCollapse/Panel.js +21 -10
- package/lib-module/Link/InlinePressable.js +1 -0
- package/lib-module/Pagination/PageButton.js +7 -7
- package/lib-module/Skeleton/Skeleton.js +6 -3
- package/lib-module/StackView/getStackedContent.js +2 -3
- package/lib-module/StepTracker/StepTracker.js +8 -2
- package/lib-module/StepTracker/dictionary.js +2 -2
- package/package.json +3 -2
- package/src/Box/Box.jsx +120 -9
- package/src/Box/backgroundImageStylesMap.js +21 -0
- package/src/ExpandCollapse/Panel.jsx +16 -10
- package/src/Link/InlinePressable.jsx +2 -0
- package/src/Pagination/PageButton.jsx +3 -3
- package/src/Skeleton/Skeleton.jsx +8 -3
- package/src/StackView/getStackedContent.jsx +12 -3
- package/src/StepTracker/StepTracker.jsx +9 -8
- package/src/StepTracker/dictionary.js +2 -2
- package/types/Typography.d.ts +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'top-start': { top: 0 },
|
|
3
|
+
'top-center': { left: 0, right: 0, marginHorizontal: 'auto' },
|
|
4
|
+
'top-end': { top: 0, right: 0 },
|
|
5
|
+
'right-start': { top: 0, right: 0 },
|
|
6
|
+
'left-start': { top: 0 },
|
|
7
|
+
'left-center': { top: 0, bottom: 0, marginVertical: 'auto' },
|
|
8
|
+
'none-start': { top: 0, bottom: 0, marginVertical: 'auto' },
|
|
9
|
+
'none-center': { top: 0, bottom: 0, left: 0, right: 0, margin: 'auto' },
|
|
10
|
+
'right-center': { top: 0, bottom: 0, right: 0, marginVertical: 'auto' },
|
|
11
|
+
'none-end': { top: 0, bottom: 0, right: 0, marginVertical: 'auto' },
|
|
12
|
+
'bottom-start': { bottom: 0, left: 0 },
|
|
13
|
+
'left-end': { bottom: 0, left: 0 },
|
|
14
|
+
'bottom-center': { left: 0, right: 0, bottom: 0, marginHorizontal: 'auto' },
|
|
15
|
+
'bottom-end': { right: 0, bottom: 0 },
|
|
16
|
+
'right-end': { right: 0, bottom: 0 },
|
|
17
|
+
'top-stretch': { left: 0, right: 0, width: '100%' },
|
|
18
|
+
'left-stretch': { top: 0, bottom: 0, height: '100%' },
|
|
19
|
+
'right-stretch': { top: 0, bottom: 0, right: 0, height: '100%' },
|
|
20
|
+
'bottom-stretch': { left: 0, right: 0, bottom: 0, width: '100%' }
|
|
21
|
+
}
|
|
@@ -64,6 +64,10 @@ const selectContentPanelStyles = ({
|
|
|
64
64
|
marginBottom
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
+
const selectControlPanelStyles = ({ contentPanelBackgroundColor }) => ({
|
|
68
|
+
backgroundColor: contentPanelBackgroundColor
|
|
69
|
+
})
|
|
70
|
+
|
|
67
71
|
/**
|
|
68
72
|
* An item in an `ExpandCollapse` which contains collapsible `children` and a `control` that opens
|
|
69
73
|
* and closes the collapsible children when pressed.
|
|
@@ -136,16 +140,18 @@ const ExpandCollapsePanel = forwardRef(
|
|
|
136
140
|
</View>
|
|
137
141
|
) : (
|
|
138
142
|
<View ref={ref} style={themeTokens}>
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
<View style={selectControlPanelStyles(themeTokens)}>
|
|
144
|
+
<ExpandCollapseControl
|
|
145
|
+
{...selectedProps}
|
|
146
|
+
isExpanded={isExpanded}
|
|
147
|
+
tokens={controlTokens}
|
|
148
|
+
variant={variant}
|
|
149
|
+
onPress={handleControlPress}
|
|
150
|
+
ref={controlRef}
|
|
151
|
+
>
|
|
152
|
+
{control}
|
|
153
|
+
</ExpandCollapseControl>
|
|
154
|
+
</View>
|
|
149
155
|
{isExpanded && (
|
|
150
156
|
<View
|
|
151
157
|
style={{
|
|
@@ -28,12 +28,12 @@ const PageButton = forwardRef(
|
|
|
28
28
|
const activeProps = isActive
|
|
29
29
|
? {
|
|
30
30
|
selected: true,
|
|
31
|
-
...a11yProps.nonFocusableProps
|
|
31
|
+
...a11yProps.nonFocusableProps
|
|
32
32
|
// a brute fix for the focus state being stuck on an active item since it becomes non-focusable
|
|
33
33
|
// (see https://github.com/telus/universal-design-system/pull/577#issuecomment-931344107)
|
|
34
|
-
key: 'active-item'
|
|
35
34
|
}
|
|
36
35
|
: {}
|
|
36
|
+
const key = isActive ? 'active-item' : undefined
|
|
37
37
|
|
|
38
38
|
const accessibilityRole = href !== undefined ? 'link' : 'button'
|
|
39
39
|
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : ''
|
|
@@ -50,7 +50,7 @@ const PageButton = forwardRef(
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
|
-
<ButtonBase ref={ref} {...buttonProps} tokens={getButtonTokens} {...activeProps}>
|
|
53
|
+
<ButtonBase ref={ref} {...buttonProps} tokens={getButtonTokens} key={key} {...activeProps}>
|
|
54
54
|
{label}
|
|
55
55
|
</ButtonBase>
|
|
56
56
|
)
|
|
@@ -25,9 +25,10 @@ const selectSkeletonStyles = ({ color, radius }) => ({
|
|
|
25
25
|
maxWidth: '100%'
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
const selectLineStyles = ({ skeletonHeight, lineWidth }) => ({
|
|
28
|
+
const selectLineStyles = ({ skeletonHeight, lineWidth, radius }) => ({
|
|
29
29
|
width: lineWidth,
|
|
30
|
-
height: skeletonHeight
|
|
30
|
+
height: skeletonHeight,
|
|
31
|
+
borderRadius: radius
|
|
31
32
|
})
|
|
32
33
|
|
|
33
34
|
const selectShapeStyles = ({ skeletonHeight }) => ({
|
|
@@ -101,7 +102,11 @@ const Skeleton = forwardRef(
|
|
|
101
102
|
]
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
return selectLineStyles({
|
|
105
|
+
return selectLineStyles({
|
|
106
|
+
skeletonHeight,
|
|
107
|
+
lineWidth: getLineWidth(),
|
|
108
|
+
radius: themeTokens.lineRadius
|
|
109
|
+
})
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
const renderSkeleton = (index = 0) => {
|
|
@@ -54,11 +54,20 @@ const getStackedContent = (
|
|
|
54
54
|
if (!index || (!space && !divider)) return [...newChildren, item]
|
|
55
55
|
|
|
56
56
|
const testID = `Stack-${divider ? 'Divider' : 'Spacer'}-${index}`
|
|
57
|
-
const commonProps = { testID,
|
|
57
|
+
const commonProps = { testID, space }
|
|
58
58
|
const separator = divider ? (
|
|
59
|
-
<Divider
|
|
59
|
+
<Divider
|
|
60
|
+
vertical={direction.startsWith('row')}
|
|
61
|
+
key={testID}
|
|
62
|
+
{...dividerProps}
|
|
63
|
+
{...commonProps}
|
|
64
|
+
/>
|
|
60
65
|
) : (
|
|
61
|
-
<Spacer
|
|
66
|
+
<Spacer
|
|
67
|
+
direction={direction.startsWith('row') ? 'row' : 'column'}
|
|
68
|
+
key={testID}
|
|
69
|
+
{...commonProps}
|
|
70
|
+
/>
|
|
62
71
|
)
|
|
63
72
|
return [...newChildren, separator, item]
|
|
64
73
|
}, [])
|
|
@@ -51,7 +51,7 @@ const selectStepTrackerLabelStyles = (
|
|
|
51
51
|
* ## Usability and A11y guidelines
|
|
52
52
|
*
|
|
53
53
|
* Keep in mind that in its current implementation this is not an interactive
|
|
54
|
-
* component and can
|
|
54
|
+
* component and can't be used to navigate between steps. The application
|
|
55
55
|
* must provide its own navigation mechanism and state control. That is the
|
|
56
56
|
* main reason the component assumes the `progressbar` role in terms of
|
|
57
57
|
* accessibility. This also makes it extremely important to make sure you
|
|
@@ -106,13 +106,14 @@ const StepTracker = forwardRef(
|
|
|
106
106
|
current < steps.length ? steps[current] : steps[steps.length - 1]
|
|
107
107
|
)
|
|
108
108
|
: ''
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
|
|
110
|
+
const getStepLabel = (index) => {
|
|
111
|
+
if (themeTokens.showStepLabel) {
|
|
112
|
+
return getCopy(index + 1)?.stepLabel.replace('%{stepNumber}', index + 1)
|
|
113
|
+
}
|
|
114
|
+
return ''
|
|
115
|
+
}
|
|
116
|
+
|
|
116
117
|
const { themeOptions } = useTheme()
|
|
117
118
|
if (!steps.length) return null
|
|
118
119
|
const selectedProps = selectProps({
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
6
6
|
},
|
|
7
7
|
2: {
|
|
8
|
-
stepLabel: '%{stepNumber}
|
|
8
|
+
stepLabel: 'Step %{stepNumber}',
|
|
9
9
|
stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'
|
|
10
10
|
},
|
|
11
11
|
3: {
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
20
20
|
},
|
|
21
21
|
2: {
|
|
22
|
-
stepLabel: '%{stepNumber}
|
|
22
|
+
stepLabel: 'Étape %{stepNumber}',
|
|
23
23
|
stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'
|
|
24
24
|
},
|
|
25
25
|
3: {
|