@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.
@@ -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
- <ExpandCollapseControl
140
- {...selectedProps}
141
- isExpanded={isExpanded}
142
- tokens={controlTokens}
143
- variant={variant}
144
- onPress={handleControlPress}
145
- ref={controlRef}
146
- >
147
- {control}
148
- </ExpandCollapseControl>
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={{
@@ -25,6 +25,8 @@ const InlinePressable = forwardRef(
25
25
 
26
26
  const handleKeyPress = useCallback(
27
27
  (e) => {
28
+ e.preventDefault()
29
+
28
30
  if (e.key === 'Enter' || e.key === ' ') {
29
31
  handlePress()
30
32
  }
@@ -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({ skeletonHeight, lineWidth: getLineWidth() })
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, key: testID, space }
57
+ const commonProps = { testID, space }
58
58
  const separator = divider ? (
59
- <Divider vertical={direction.startsWith('row')} {...dividerProps} {...commonProps} />
59
+ <Divider
60
+ vertical={direction.startsWith('row')}
61
+ key={testID}
62
+ {...dividerProps}
63
+ {...commonProps}
64
+ />
60
65
  ) : (
61
- <Spacer direction={direction.startsWith('row') ? 'row' : 'column'} {...commonProps} />
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 cant be used to navigate between steps. The application
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
- const getStepLabel = (index) =>
110
- themeTokens.showStepLabel
111
- ? (typeof copy === 'string'
112
- ? getCopy(textStepTrackerLabel ?? 1).stepLabel
113
- : getCopy('stepLabel')
114
- ).replace('%{stepNumber}', index + 1)
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: {
@@ -23,6 +23,7 @@ export type TypographyVariants = {
23
23
  characters?: number
24
24
  spaceBetweenLines?: number
25
25
  squareRadius?: number
26
+ lineRadius?: number
26
27
  inverse?: boolean
27
28
  }
28
29