@telus-uds/components-web 2.10.0 → 2.12.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 (60) hide show
  1. package/CHANGELOG.md +33 -2
  2. package/component-docs.json +76 -11
  3. package/lib/BlockQuote/BlockQuote.js +4 -1
  4. package/lib/Card/Card.js +2 -0
  5. package/lib/DatePicker/DatePicker.js +23 -12
  6. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -10
  7. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
  8. package/lib/Footnote/FootnoteLink.js +1 -2
  9. package/lib/Listbox/GroupControl.js +44 -28
  10. package/lib/Listbox/Listbox.js +54 -47
  11. package/lib/Listbox/ListboxGroup.js +36 -20
  12. package/lib/Listbox/ListboxItem.js +14 -51
  13. package/lib/Listbox/ListboxOverlay.js +1 -1
  14. package/lib/PriceLockup/PriceLockup.js +6 -1
  15. package/lib/Video/ControlBar/ControlBar.js +13 -10
  16. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +4 -1
  17. package/lib/VideoPicker/VideoPicker.js +1 -1
  18. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +14 -2
  19. package/lib/utils/index.js +3 -3
  20. package/lib-module/BlockQuote/BlockQuote.js +4 -1
  21. package/lib-module/Card/Card.js +2 -0
  22. package/lib-module/DatePicker/DatePicker.js +23 -12
  23. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +6 -11
  24. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
  25. package/lib-module/Footnote/FootnoteLink.js +1 -2
  26. package/lib-module/Listbox/GroupControl.js +45 -29
  27. package/lib-module/Listbox/Listbox.js +54 -46
  28. package/lib-module/Listbox/ListboxGroup.js +37 -21
  29. package/lib-module/Listbox/ListboxItem.js +15 -51
  30. package/lib-module/Listbox/ListboxOverlay.js +1 -1
  31. package/lib-module/PriceLockup/PriceLockup.js +7 -2
  32. package/lib-module/Video/ControlBar/ControlBar.js +14 -11
  33. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +4 -1
  34. package/lib-module/VideoPicker/VideoPicker.js +1 -1
  35. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +14 -2
  36. package/lib-module/utils/index.js +1 -1
  37. package/package.json +3 -3
  38. package/src/BlockQuote/BlockQuote.jsx +13 -1
  39. package/src/Card/Card.jsx +12 -8
  40. package/src/DatePicker/DatePicker.jsx +22 -12
  41. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +9 -6
  42. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +21 -4
  43. package/src/Footnote/FootnoteLink.jsx +1 -2
  44. package/src/Listbox/GroupControl.jsx +50 -33
  45. package/src/Listbox/Listbox.jsx +59 -50
  46. package/src/Listbox/ListboxGroup.jsx +34 -19
  47. package/src/Listbox/ListboxItem.jsx +26 -48
  48. package/src/Listbox/ListboxOverlay.jsx +1 -1
  49. package/src/PriceLockup/PriceLockup.jsx +7 -2
  50. package/src/Video/ControlBar/ControlBar.jsx +17 -13
  51. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +2 -1
  52. package/src/VideoPicker/VideoPicker.jsx +1 -1
  53. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +8 -1
  54. package/src/utils/index.js +1 -1
  55. package/lib/Listbox/PressableItem.js +0 -149
  56. package/lib/utils/htmlAttrs.js +0 -33
  57. package/lib-module/Listbox/PressableItem.js +0 -128
  58. package/lib-module/utils/htmlAttrs.js +0 -22
  59. package/src/Listbox/PressableItem.jsx +0 -121
  60. package/src/utils/htmlAttrs.js +0 -29
@@ -1,121 +0,0 @@
1
- /* eslint-disable react/require-default-props */
2
- import React, { forwardRef } from 'react'
3
- import PropTypes from 'prop-types'
4
- import { selectSystemProps, useThemeTokens } from '@telus-uds/components-base'
5
- import styled from 'styled-components'
6
- import { htmlAttrs } from '../utils'
7
-
8
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
9
-
10
- const getItemStyles = ({ tokens }) => ({
11
- fontFamily: `${tokens.groupFontName}${tokens.groupFontWeight}normal`,
12
- fontSize: tokens.itemFontSize,
13
- paddingTop: tokens.itemPaddingTop,
14
- paddingBottom: tokens.itemPaddingBottom,
15
- paddingLeft: tokens.itemPaddingLeft,
16
- paddingRight: tokens.itemPaddingRight,
17
- borderWidth: tokens.itemBorderWidth,
18
- width: '100%',
19
- backgroundColor: tokens.itemBackgroundColor,
20
- color: tokens.groupColor,
21
- display: tokens.itemDisplay,
22
- outline: tokens.itemOutline,
23
- textDecoration: tokens.itemTextDecoration
24
- })
25
-
26
- const StyledLink = styled.a(({ isChild, tokens }) => ({
27
- ...getItemStyles({ isChild, tokens }),
28
- borderLeft: isChild
29
- ? `${tokens.itemBorderWidth}px solid ${tokens.itemBorderBackgroundColor}`
30
- : 'none',
31
- cursor: 'pointer',
32
-
33
- [`&:hover, &:focus, &:active`]: {
34
- color: tokens.itemColor
35
- },
36
-
37
- '&:hover': {
38
- backgroundColor: tokens.groupBackgroundColor
39
- },
40
-
41
- // Highlighting for pressable items that are not links per se
42
- // TODO: find a better way to display and style a pressable link
43
- '&:hover > div, &:hover > div > span': {
44
- color: `${tokens.itemColor} !important`
45
- },
46
-
47
- '&:focus': {
48
- border: `${tokens.groupBorderWidth}px solid ${tokens.itemBorderLeftColor}`,
49
- borderLeft: isChild && `${tokens.itemBorderWidth}px solid ${tokens.itemBorderLeftColor}`,
50
- borderRadius: !isChild && tokens.groupBorderRadius,
51
- paddingLeft: !isChild && `calc(${tokens.itemPaddingLeft}px - ${tokens.groupBorderWidth}px)`,
52
- paddingRight: `calc(${tokens.itemPaddingRight}px - ${tokens.groupBorderWidth}px)`,
53
- paddingTop: `calc(${tokens.itemPaddingTop}px - ${tokens.groupBorderWidth}px)`,
54
- paddingBottom: `calc(${tokens.itemPaddingBottom}px - ${tokens.groupBorderWidth}px)`,
55
- backgroundColor: tokens.groupBackgroundColor
56
- },
57
-
58
- '&:active': {
59
- backgroundColor: tokens.itemBorderBackgroundColor
60
- }
61
- }))
62
-
63
- const PressableItem = forwardRef(
64
- (
65
- {
66
- children,
67
- href,
68
- isChild = false,
69
- onBlur,
70
- onPress,
71
- tabIndex = 0,
72
- nextItemRef,
73
- prevItemRef,
74
- tokens,
75
- variant = {},
76
- ...rest
77
- },
78
- ref
79
- ) => {
80
- const handleKeyPress = (event) => {
81
- if (['Enter', ' '].includes(event?.key)) {
82
- onPress?.(event)
83
- } else if (event?.key === 'ArrowDown' && nextItemRef?.current) {
84
- nextItemRef.current.focus()
85
- } else if (event?.key === 'ArrowUp' && prevItemRef?.current) {
86
- prevItemRef.current.focus()
87
- }
88
- }
89
- const systemTokens = useThemeTokens('ListBox', tokens, variant, { isChild, hover: true })
90
-
91
- return (
92
- <StyledLink
93
- isChild={isChild}
94
- tokens={systemTokens}
95
- onBlur={onBlur}
96
- onClick={onPress}
97
- onKeyPress={handleKeyPress}
98
- ref={ref}
99
- tabIndex={tabIndex}
100
- {...(href && { href })}
101
- {...(onPress && { onClick: onPress })}
102
- {...selectProps(rest)}
103
- >
104
- {children}
105
- </StyledLink>
106
- )
107
- }
108
- )
109
- PressableItem.displayName = 'PressableItem'
110
- PressableItem.propTypes = {
111
- ...selectedSystemPropTypes,
112
- href: PropTypes.string,
113
- isChild: PropTypes.bool,
114
- children: PropTypes.node.isRequired,
115
- onBlur: PropTypes.func,
116
- onPress: PropTypes.func,
117
- nextItemRef: PropTypes.object,
118
- prevItemRef: PropTypes.object
119
- }
120
-
121
- export default PressableItem
@@ -1,29 +0,0 @@
1
- import PropTypes from 'prop-types'
2
-
3
- const htmlAttrTypes = {
4
- dataSet: PropTypes.object,
5
- id: PropTypes.string,
6
- loading: PropTypes.oneOf(['eager', 'lazy']),
7
- // @todo figure out if we need to enum all the possible roles or maybe use
8
- // an npm package
9
- role: PropTypes.string,
10
- src: PropTypes.string,
11
- tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
12
- testID: PropTypes.string,
13
- title: PropTypes.string
14
- }
15
-
16
- export default {
17
- types: htmlAttrTypes,
18
- select: (props) =>
19
- Object.entries(props).reduce(
20
- (items, [key, value]) =>
21
- Object.keys(htmlAttrTypes).includes(key) || /^(data|aria)-/.test(key)
22
- ? {
23
- ...items,
24
- [key]: value
25
- }
26
- : items,
27
- {}
28
- )
29
- }