@telus-uds/components-web 3.2.1 → 3.4.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 (44) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/lib/Badge/Badge.js +2 -0
  3. package/lib/Card/Card.js +5 -5
  4. package/lib/DatePicker/DatePicker.js +20 -18
  5. package/lib/Footnote/Footnote.js +4 -7
  6. package/lib/NavigationBar/NavigationBar.js +13 -15
  7. package/lib/NavigationBar/NavigationSubMenu.js +1 -2
  8. package/lib/NavigationBar/collapseItems.js +2 -3
  9. package/lib/NavigationBar/resolveItemSelection.js +1 -1
  10. package/lib/OrderedList/OrderedList.js +2 -3
  11. package/lib/PriceLockup/PriceLockup.js +26 -10
  12. package/lib/PriceLockup/tokens.js +6 -2
  13. package/lib/SkeletonProvider/SkeletonImage.js +3 -4
  14. package/lib/SkeletonProvider/SkeletonTypography.js +5 -6
  15. package/lib/Table/Table.js +2 -3
  16. package/lib/TermsAndConditions/ExpandCollapse.js +2 -1
  17. package/lib/Toast/Toast.js +2 -3
  18. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +1 -2
  19. package/lib/Video/Video.js +2 -2
  20. package/lib/VideoPicker/VideoPicker.js +1 -2
  21. package/lib/VideoPicker/VideoPickerThumbnail.js +1 -2
  22. package/lib/baseExports.js +1 -1
  23. package/lib/index.js +0 -1
  24. package/lib/utils/scrollToAnchor.js +2 -2
  25. package/lib/utils/ssr.js +7 -0
  26. package/lib/utils/useOverlaidPosition.js +2 -4
  27. package/package.json +3 -3
  28. package/src/Badge/Badge.jsx +2 -0
  29. package/src/DatePicker/DatePicker.jsx +19 -11
  30. package/src/PriceLockup/PriceLockup.jsx +12 -2
  31. package/src/PriceLockup/tokens.js +15 -3
  32. package/src/TermsAndConditions/ExpandCollapse.jsx +5 -1
  33. package/src/baseExports.js +1 -0
  34. package/src/index.js +0 -1
  35. package/src/utils/ssr.js +9 -1
  36. package/types/Callout.d.ts +2 -1
  37. package/types/Tooltip.d.ts +1 -0
  38. package/types/common.d.ts +1 -1
  39. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
  40. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -116
  41. package/lib/ExpandCollapseMini/index.js +0 -2
  42. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +0 -72
  43. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +0 -104
  44. package/src/ExpandCollapseMini/index.js +0 -3
@@ -1,72 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
- import { ExpandCollapse, getTokensPropType } from '@telus-uds/components-base'
4
- import ExpandCollapseMiniControl from './ExpandCollapseMiniControl'
5
-
6
- const ExpandCollapseMini = React.forwardRef(
7
- ({ children, onToggle = () => {}, tokens = {}, nativeID, initialOpen = false, ...rest }, ref) => {
8
- const expandCollapeMiniPanelId = 'ExpandCollapseMiniPanel'
9
- const handleChange = (openPanels, event) => {
10
- if (typeof onToggle === 'function') {
11
- const isOpen = openPanels.length > 0
12
- onToggle(event, isOpen)
13
- }
14
- }
15
-
16
- return (
17
- <ExpandCollapse
18
- onChange={handleChange}
19
- tokens={tokens}
20
- initialOpen={initialOpen ? [expandCollapeMiniPanelId] : []}
21
- >
22
- {(expandProps) => (
23
- <ExpandCollapse.Panel
24
- {...expandProps}
25
- panelId={expandCollapeMiniPanelId}
26
- variant={{ mini: true }}
27
- controlTokens={{
28
- // Remove unwanted look and feel from ExpandCollapse(background pressed, focus border and text underline)
29
- icon: null,
30
- borderColor: 'transparent',
31
- textLine: 'none',
32
- backgroundColor: 'transparent'
33
- }}
34
- // TODO refactor
35
- // eslint-disable-next-line react/no-unstable-nested-components
36
- control={(pressableState) => (
37
- <ExpandCollapseMiniControl pressableState={pressableState} {...rest} />
38
- )}
39
- controlRef={ref}
40
- nativeID={nativeID}
41
- >
42
- {children}
43
- </ExpandCollapse.Panel>
44
- )}
45
- </ExpandCollapse>
46
- )
47
- }
48
- )
49
- ExpandCollapseMini.displayName = 'ExpandCollapseMini'
50
-
51
- ExpandCollapseMini.propTypes = {
52
- ...ExpandCollapseMiniControl.propTypes,
53
- /**
54
- * Function to call on pressing the panel's control, which should open or close the panel.
55
- */
56
- onToggle: PropTypes.func,
57
- /**
58
- * ID for DOM element on web
59
- */
60
- nativeID: PropTypes.string,
61
- /**
62
- * Children nodes that can be added
63
- */
64
- children: PropTypes.node.isRequired,
65
- /**
66
- * Controls if the panel and the content is opened by default on the first load
67
- */
68
- initialOpen: PropTypes.bool,
69
- tokens: getTokensPropType('ExpandCollapseMini')
70
- }
71
-
72
- export default ExpandCollapseMini
@@ -1,104 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
- import { selectSystemProps, Link, useThemeTokens } from '@telus-uds/components-base'
4
- import { htmlAttrs } from '../utils'
5
-
6
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
7
-
8
- // The ExpandCollapseControl has all the appropriate role, a11y, press handling etc
9
- // and a more appropriate press area, defer interaction handling to it.
10
- const presentationOnly = {
11
- accessibilityRole: null, // Treat as regular flow content with the Control
12
- pointerEvents: 'none', // Stop RNW from stopping clicks from bubbling to Control
13
- focusable: false // Stop RNW from setting tabIndex={0}: focus goes to Control only
14
- }
15
-
16
- const selectLinkTokens = ({ color, textLine, lineHeight, fontSize }) => ({
17
- color,
18
- textLine,
19
- blockLineHeight: lineHeight,
20
- blockFontSize: fontSize
21
- })
22
-
23
- const ExpandCollapseMiniControl = React.forwardRef(
24
- (
25
- {
26
- pressableState,
27
- collapseTitle,
28
- expandTitle = collapseTitle,
29
- iconPosition = 'right',
30
- tokens,
31
- variant = {},
32
- ...rest
33
- },
34
- ref
35
- ) => {
36
- const { expanded, hover, focus } = pressableState || {}
37
- // we only want focus outline when focusing, if user is pressing we don't want the border.
38
- const { outerBorderColor } = useThemeTokens('Link', {}, {}, { focus })
39
- const { size, icon, ...themeTokens } = useThemeTokens(
40
- 'ExpandCollapseMiniControl',
41
- tokens,
42
- variant,
43
- { expanded, focus }
44
- )
45
-
46
- // Choose hover styles when any part of Control is hoverred
47
- const appearance = { ...variant, hover }
48
-
49
- const getTokens = (linkState) => {
50
- const { hover: linkHover } = linkState || {}
51
- const isHovered = hover || linkHover
52
- if (isHovered) {
53
- // Include vertical icon animation on hover alongside built-in Link theme, the size is size4
54
- return { iconTranslateY: (expanded ? -1 : 1) * size }
55
- }
56
-
57
- return {}
58
- }
59
-
60
- return (
61
- <Link
62
- variant={appearance}
63
- icon={icon}
64
- iconPosition={iconPosition}
65
- tokens={(linkState) => ({
66
- ...getTokens(linkState),
67
- ...selectLinkTokens(themeTokens),
68
- outerBorderColor
69
- })}
70
- ref={ref}
71
- {...presentationOnly}
72
- {...selectProps(rest)}
73
- >
74
- {expanded ? expandTitle : collapseTitle}
75
- </Link>
76
- )
77
- }
78
- )
79
-
80
- ExpandCollapseMiniControl.displayName = 'ExpandCollapseMiniControl'
81
-
82
- ExpandCollapseMiniControl.propTypes = {
83
- ...selectedSystemPropTypes,
84
- ...Link.propTypes,
85
- /**
86
- * Optional function to call on pressing the panel's control, in addition to opening or closing the panel
87
- */
88
- onPress: PropTypes.func,
89
- /**
90
- * ExpandCollapseMiniControl title when expanded
91
- */
92
- expandTitle: PropTypes.string.isRequired,
93
- /**
94
- * ExpandCollapseMiniControl title when collapsed
95
- */
96
- collapseTitle: PropTypes.string.isRequired,
97
- /**
98
- * React Native's `Pressable`'s state object
99
- */
100
- pressableState: PropTypes.object,
101
- variant: PropTypes.object
102
- }
103
-
104
- export default ExpandCollapseMiniControl
@@ -1,3 +0,0 @@
1
- import ExpandCollapseMini from './ExpandCollapseMini'
2
-
3
- export default ExpandCollapseMini