@telus-uds/components-base 3.26.0 → 3.28.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 (75) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/lib/cjs/Card/Card.js +34 -13
  3. package/lib/cjs/Card/CardBase.js +90 -14
  4. package/lib/cjs/Card/PressableCardBase.js +147 -8
  5. package/lib/cjs/Carousel/Carousel.js +105 -50
  6. package/lib/cjs/Carousel/CarouselContext.js +10 -4
  7. package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +11 -7
  8. package/lib/cjs/Carousel/Constants.js +11 -2
  9. package/lib/cjs/Checkbox/Checkbox.js +43 -13
  10. package/lib/cjs/ExpandCollapse/Control.js +5 -1
  11. package/lib/cjs/ExpandCollapse/ExpandCollapse.js +17 -8
  12. package/lib/cjs/ExpandCollapse/Panel.js +7 -2
  13. package/lib/cjs/IconButton/IconButton.js +10 -5
  14. package/lib/cjs/List/List.js +24 -9
  15. package/lib/cjs/List/ListItem.js +18 -1
  16. package/lib/cjs/List/ListItemBase.js +27 -8
  17. package/lib/cjs/List/ListItemMark.js +33 -62
  18. package/lib/cjs/List/PressableListItemBase.js +1 -0
  19. package/lib/cjs/Modal/Modal.js +21 -11
  20. package/lib/cjs/Progress/Progress.js +19 -5
  21. package/lib/cjs/Progress/ProgressBar.js +22 -4
  22. package/lib/cjs/Progress/ProgressContext.js +11 -0
  23. package/lib/cjs/SideNav/Item.js +3 -3
  24. package/lib/cjs/SideNav/ItemsGroup.js +46 -19
  25. package/lib/cjs/SideNav/SideNav.js +29 -13
  26. package/lib/esm/Card/Card.js +34 -13
  27. package/lib/esm/Card/CardBase.js +90 -14
  28. package/lib/esm/Card/PressableCardBase.js +148 -9
  29. package/lib/esm/Carousel/Carousel.js +106 -51
  30. package/lib/esm/Carousel/CarouselContext.js +10 -4
  31. package/lib/esm/Carousel/CarouselItem/CarouselItem.js +11 -7
  32. package/lib/esm/Carousel/Constants.js +10 -1
  33. package/lib/esm/Checkbox/Checkbox.js +43 -13
  34. package/lib/esm/ExpandCollapse/Control.js +5 -1
  35. package/lib/esm/ExpandCollapse/ExpandCollapse.js +17 -8
  36. package/lib/esm/ExpandCollapse/Panel.js +7 -2
  37. package/lib/esm/IconButton/IconButton.js +10 -5
  38. package/lib/esm/List/List.js +24 -9
  39. package/lib/esm/List/ListItem.js +19 -2
  40. package/lib/esm/List/ListItemBase.js +27 -8
  41. package/lib/esm/List/ListItemMark.js +33 -62
  42. package/lib/esm/List/PressableListItemBase.js +1 -0
  43. package/lib/esm/Modal/Modal.js +21 -11
  44. package/lib/esm/Progress/Progress.js +19 -5
  45. package/lib/esm/Progress/ProgressBar.js +22 -4
  46. package/lib/esm/Progress/ProgressContext.js +5 -0
  47. package/lib/esm/SideNav/Item.js +3 -3
  48. package/lib/esm/SideNav/ItemsGroup.js +45 -20
  49. package/lib/esm/SideNav/SideNav.js +29 -13
  50. package/lib/package.json +2 -2
  51. package/package.json +2 -2
  52. package/src/Card/Card.jsx +29 -7
  53. package/src/Card/CardBase.jsx +97 -11
  54. package/src/Card/PressableCardBase.jsx +135 -9
  55. package/src/Carousel/Carousel.jsx +119 -64
  56. package/src/Carousel/CarouselContext.jsx +12 -4
  57. package/src/Carousel/CarouselItem/CarouselItem.jsx +10 -6
  58. package/src/Carousel/Constants.js +10 -0
  59. package/src/Checkbox/Checkbox.jsx +29 -7
  60. package/src/ExpandCollapse/Control.jsx +1 -1
  61. package/src/ExpandCollapse/ExpandCollapse.jsx +9 -8
  62. package/src/ExpandCollapse/Panel.jsx +10 -2
  63. package/src/IconButton/IconButton.jsx +40 -28
  64. package/src/List/List.jsx +33 -9
  65. package/src/List/ListItem.jsx +33 -11
  66. package/src/List/ListItemBase.jsx +33 -9
  67. package/src/List/ListItemMark.jsx +32 -53
  68. package/src/List/PressableListItemBase.jsx +1 -0
  69. package/src/Modal/Modal.jsx +23 -11
  70. package/src/Progress/Progress.jsx +18 -7
  71. package/src/Progress/ProgressBar.jsx +19 -14
  72. package/src/Progress/ProgressContext.js +5 -0
  73. package/src/SideNav/Item.jsx +3 -3
  74. package/src/SideNav/ItemsGroup.jsx +36 -16
  75. package/src/SideNav/SideNav.jsx +22 -8
@@ -6,6 +6,12 @@ import ExpandCollapse from '../ExpandCollapse'
6
6
  import { getTokensPropType, variantProp, componentPropType, selectTokens } from '../utils'
7
7
  import { useThemeTokensCallback } from '../ThemeProvider'
8
8
 
9
+ const selectPanelTokens = ({ borderWidth, borderColor, backgroundColor }) => ({
10
+ contentPanelBackgroundColor: backgroundColor,
11
+ borderBottomWidth: borderWidth,
12
+ borderColor
13
+ })
14
+
9
15
  /**
10
16
  Expandable content areas for use within `SideNav`.
11
17
 
@@ -37,27 +43,30 @@ const ItemsGroup = React.forwardRef(
37
43
  const getItemAppearance = (appearance) => ({ ...getAppearance(appearance), type: 'parent' })
38
44
 
39
45
  const getGroupTokens = useThemeTokensCallback('SideNavItemsGroup', tokens, variant)
40
- const getPanelTokens = (appearance) => {
41
- const { panelBorderColor, ...itemsGroupTokens } = getGroupTokens(getAppearance(appearance))
42
- const groupTokens = {
43
- ...itemsGroupTokens,
44
- borderWidth: 0,
45
- marginBottom: 0
46
- }
47
- return selectTokens('ExpandCollapsePanel', groupTokens)
48
- }
49
-
50
46
  const getItemTokens = useThemeTokensCallback('SideNavItem', itemTokens, variant)
51
- const getControlTokens = (appearance) =>
52
- selectTokens('ExpandCollapseControl', {
53
- ...getItemTokens(getItemAppearance(appearance)), // main style from SideNavItem
54
- ...getGroupTokens(getAppearance(appearance)) // control-specific tokens like icon etc
47
+
48
+ const getPanelTokens = (appearance) =>
49
+ selectTokens('ExpandCollapsePanel', {
50
+ ...staticTokens.panel,
51
+ ...getGroupTokens(getAppearance(appearance)),
52
+ ...selectPanelTokens(getItemTokens(getItemAppearance(appearance)))
55
53
  })
56
54
 
55
+ const getControlTokens = (appearance) => ({
56
+ ...selectTokens('ExpandCollapseControl', {
57
+ ...getItemTokens(getItemAppearance(appearance)), // main style from SideNavItem
58
+ ...getGroupTokens(getAppearance(appearance)) // control-specific tokens like icon etc,
59
+ }),
60
+ ...staticTokens.control
61
+ })
62
+
57
63
  const controlContent = (controlState) => {
58
64
  const currentItemTokens = getItemTokens(getItemAppearance(controlState))
59
-
60
- return <ItemContent tokens={currentItemTokens}>{label}</ItemContent>
65
+ return (
66
+ <ItemContent tokens={{ ...currentItemTokens, ...staticTokens.content }}>
67
+ {label}
68
+ </ItemContent>
69
+ )
61
70
  }
62
71
 
63
72
  return (
@@ -70,12 +79,23 @@ const ItemsGroup = React.forwardRef(
70
79
  controlTokens={getControlTokens}
71
80
  control={controlContent}
72
81
  accessibilityState={{ active: isActive }} // ExpandCollapse.Panel handles expanded state
82
+ disableMobileScrollBuffer
73
83
  >
74
84
  {children}
75
85
  </ExpandCollapse.Panel>
76
86
  )
77
87
  }
78
88
  )
89
+
90
+ const staticTokens = {
91
+ panel: {
92
+ borderWidth: 0,
93
+ marginBottom: 0
94
+ },
95
+ control: { borderWidth: 0, textLine: null },
96
+ content: { accentWidth: 0 }
97
+ }
98
+
79
99
  ItemsGroup.displayName = 'ItemsGroup'
80
100
 
81
101
  ItemsGroup.propTypes = {
@@ -14,14 +14,23 @@ import {
14
14
  viewProps
15
15
  } from '../utils'
16
16
 
17
- function selectBorderStyles(tokens) {
17
+ const selectContainerTokens = ({ borderWidth, borderStyle, borderColor }) => {
18
18
  return {
19
- borderBottomWidth: tokens.borderWidth,
20
- borderBottomStyle: tokens.borderStyle,
21
- borderBottomColor: tokens.borderColor
19
+ borderTopWidth: borderWidth,
20
+ borderStyle,
21
+ borderColor
22
22
  }
23
23
  }
24
24
 
25
+ const selectItemTokens = (tokens = {}, isLastItem = false) => ({
26
+ ...tokens,
27
+ ...(isLastItem
28
+ ? {
29
+ borderWidth: 0
30
+ }
31
+ : {})
32
+ })
33
+
25
34
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
26
35
 
27
36
  /**
@@ -46,11 +55,11 @@ const SideNav = React.forwardRef(
46
55
  <ExpandCollapse
47
56
  ref={ref}
48
57
  maxOpen={accordion ? 1 : null}
49
- style={selectBorderStyles(themeTokens)}
58
+ tokens={selectContainerTokens(themeTokens)}
50
59
  {...selectProps(rest)}
51
60
  >
52
61
  {({ openIds, onToggle }) => {
53
- const renderItem = (item, index, groupId) => {
62
+ const renderItem = (item, index, groupId, isLastItem = false) => {
54
63
  const { itemId = `item-${index}`, onPress } = item.props
55
64
  const handlePress = (...args) => {
56
65
  onItemPress(...args)
@@ -64,7 +73,7 @@ const SideNav = React.forwardRef(
64
73
  itemId={itemId}
65
74
  groupId={groupId}
66
75
  variant={groupId ? { ...variant, type: 'child' } : variant}
67
- tokens={itemTokens}
76
+ tokens={selectItemTokens(itemTokens, isLastItem)}
68
77
  isActive={isItemActive(itemId, groupId)}
69
78
  onPress={handlePress}
70
79
  />
@@ -93,7 +102,12 @@ const SideNav = React.forwardRef(
93
102
  onToggle={handleToggle}
94
103
  >
95
104
  {React.Children.map(child.props.children, (item, itemIndex) =>
96
- renderItem(item, itemIndex, groupId)
105
+ renderItem(
106
+ item,
107
+ itemIndex,
108
+ groupId,
109
+ itemIndex === child.props.children.length - 1
110
+ )
97
111
  )}
98
112
  </ItemsGroup>
99
113
  )