@telus-uds/components-web 2.17.2 → 2.19.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 (88) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/component-docs.json +854 -421
  3. package/lib/Badge/Badge.js +2 -2
  4. package/lib/BlockQuote/BlockQuote.js +9 -0
  5. package/lib/Callout/Callout.js +5 -0
  6. package/lib/DatePicker/DatePicker.js +24 -4
  7. package/lib/Disclaimer/Disclaimer.js +4 -0
  8. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +7 -1
  9. package/lib/NavigationBar/NavigationBar.js +8 -2
  10. package/lib/NavigationBar/NavigationSubMenu.js +2 -4
  11. package/lib/OrderedList/OrderedList.js +4 -2
  12. package/lib/Ribbon/Ribbon.js +2 -1
  13. package/lib/Toast/Toast.js +2 -1
  14. package/lib/Video/Video.js +3 -1
  15. package/lib/WaffleGrid/WaffleGrid.js +20 -20
  16. package/lib/baseExports.js +12 -0
  17. package/lib/index.js +0 -18
  18. package/lib/utils/useOverlaidPosition.js +2 -2
  19. package/lib-module/Badge/Badge.js +1 -1
  20. package/lib-module/BlockQuote/BlockQuote.js +10 -1
  21. package/lib-module/Callout/Callout.js +6 -1
  22. package/lib-module/DatePicker/DatePicker.js +24 -4
  23. package/lib-module/Disclaimer/Disclaimer.js +4 -0
  24. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +8 -2
  25. package/lib-module/NavigationBar/NavigationBar.js +8 -2
  26. package/lib-module/NavigationBar/NavigationSubMenu.js +1 -2
  27. package/lib-module/OrderedList/OrderedList.js +5 -3
  28. package/lib-module/Ribbon/Ribbon.js +3 -2
  29. package/lib-module/Toast/Toast.js +3 -2
  30. package/lib-module/Video/Video.js +4 -2
  31. package/lib-module/WaffleGrid/WaffleGrid.js +21 -21
  32. package/lib-module/baseExports.js +1 -1
  33. package/lib-module/index.js +0 -2
  34. package/lib-module/utils/useOverlaidPosition.js +2 -2
  35. package/package.json +3 -3
  36. package/src/Badge/Badge.jsx +1 -1
  37. package/src/BlockQuote/BlockQuote.jsx +10 -1
  38. package/src/Callout/Callout.jsx +11 -1
  39. package/src/DatePicker/DatePicker.jsx +20 -2
  40. package/src/Disclaimer/Disclaimer.jsx +3 -0
  41. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +7 -2
  42. package/src/NavigationBar/NavigationBar.jsx +7 -2
  43. package/src/NavigationBar/NavigationSubMenu.jsx +1 -2
  44. package/src/OrderedList/OrderedList.jsx +4 -3
  45. package/src/Ribbon/Ribbon.jsx +8 -2
  46. package/src/Toast/Toast.jsx +4 -2
  47. package/src/Video/Video.jsx +9 -2
  48. package/src/WaffleGrid/WaffleGrid.jsx +21 -15
  49. package/src/baseExports.js +2 -0
  50. package/src/index.js +0 -2
  51. package/src/utils/useOverlaidPosition.js +2 -2
  52. package/types/Callout.d.ts +1 -0
  53. package/lib/Autocomplete/Autocomplete.js +0 -407
  54. package/lib/Autocomplete/Loading.js +0 -46
  55. package/lib/Autocomplete/Suggestions.js +0 -81
  56. package/lib/Autocomplete/constants.js +0 -19
  57. package/lib/Autocomplete/dictionary.js +0 -19
  58. package/lib/Autocomplete/index.js +0 -13
  59. package/lib/Listbox/GroupControl.js +0 -110
  60. package/lib/Listbox/Listbox.js +0 -179
  61. package/lib/Listbox/ListboxGroup.js +0 -145
  62. package/lib/Listbox/ListboxItem.js +0 -101
  63. package/lib/Listbox/ListboxOverlay.js +0 -91
  64. package/lib/Listbox/index.js +0 -13
  65. package/lib-module/Autocomplete/Autocomplete.js +0 -383
  66. package/lib-module/Autocomplete/Loading.js +0 -32
  67. package/lib-module/Autocomplete/Suggestions.js +0 -64
  68. package/lib-module/Autocomplete/constants.js +0 -5
  69. package/lib-module/Autocomplete/dictionary.js +0 -12
  70. package/lib-module/Autocomplete/index.js +0 -2
  71. package/lib-module/Listbox/GroupControl.js +0 -96
  72. package/lib-module/Listbox/Listbox.js +0 -158
  73. package/lib-module/Listbox/ListboxGroup.js +0 -122
  74. package/lib-module/Listbox/ListboxItem.js +0 -77
  75. package/lib-module/Listbox/ListboxOverlay.js +0 -69
  76. package/lib-module/Listbox/index.js +0 -2
  77. package/src/Autocomplete/Autocomplete.jsx +0 -357
  78. package/src/Autocomplete/Loading.jsx +0 -15
  79. package/src/Autocomplete/Suggestions.jsx +0 -52
  80. package/src/Autocomplete/constants.js +0 -6
  81. package/src/Autocomplete/dictionary.js +0 -12
  82. package/src/Autocomplete/index.js +0 -3
  83. package/src/Listbox/GroupControl.jsx +0 -82
  84. package/src/Listbox/Listbox.jsx +0 -163
  85. package/src/Listbox/ListboxGroup.jsx +0 -125
  86. package/src/Listbox/ListboxItem.jsx +0 -80
  87. package/src/Listbox/ListboxOverlay.jsx +0 -72
  88. package/src/Listbox/index.js +0 -3
@@ -1,125 +0,0 @@
1
- /* eslint-disable react/require-default-props */
2
- import React, { forwardRef } from 'react'
3
- import PropTypes from 'prop-types'
4
- import { ExpandCollapse, withLinkRouter, useListboxContext } from '@telus-uds/components-base'
5
- import styled from 'styled-components'
6
- import ListboxItem from './ListboxItem'
7
- import GroupControl from './GroupControl'
8
-
9
- const StyledGroupWrapper = styled.li({
10
- margin: 'none',
11
- padding: 'none',
12
- display: 'block',
13
- overflowY: 'hidden',
14
-
15
- // Currently the default expand collapse control does not have a focus state and so the browser default is applied.
16
- // This hides the outline so that it does not clash with the custom control we provide.
17
- '& div[role=button]': {
18
- outline: 'none'
19
- }
20
- })
21
-
22
- const StyledList = styled.ul({
23
- margin: 0,
24
- padding: 0,
25
- listStyle: 'none'
26
- })
27
-
28
- const ListboxGroup = forwardRef(
29
- (
30
- {
31
- id,
32
- label,
33
- items,
34
- LinkRouter,
35
- linkRouterProps,
36
- expandProps,
37
- onLastItemBlur,
38
- nextItemRef,
39
- prevItemRef
40
- },
41
- ref
42
- ) => {
43
- const { selectedId } = useListboxContext()
44
-
45
- // TODO: implement keyboard navigation via refs for grouped items separately here
46
- return (
47
- <StyledGroupWrapper role="option">
48
- <ExpandCollapse.Panel
49
- panelId={id ?? label}
50
- controlTokens={{
51
- icon: null,
52
- paddingLeft: 'none',
53
- paddingRight: 'none',
54
- paddingTop: 'none',
55
- paddingBottom: 'none',
56
- backgroundColor: 'transparent',
57
- borderColor: 'transparent',
58
- textLine: 'none',
59
- borderWidth: 0
60
- }}
61
- // TODO refactor
62
- // eslint-disable-next-line react/no-unstable-nested-components
63
- control={(controlProps) => (
64
- <GroupControl id={id ?? label} {...controlProps} label={label} />
65
- )}
66
- {...expandProps}
67
- tokens={{
68
- contentPaddingLeft: 'none',
69
- contentPaddingRight: 'none',
70
- contentPaddingTop: 'none',
71
- contentPaddingBottom: 'none',
72
- borderColor: 'transparent',
73
- borderRadius: 0,
74
- borderWidth: 0,
75
- marginBottom: 0
76
- }}
77
- controlRef={ref}
78
- >
79
- <StyledList>
80
- {items.map((item, index) => {
81
- return (
82
- <ListboxItem
83
- key={item.label}
84
- id={item.id ?? item.label}
85
- {...item}
86
- selected={
87
- (item.id && item.id === selectedId) || (item.label && item.label === selectedId)
88
- }
89
- isChild
90
- LinkRouter={LinkRouter}
91
- linkRouterProps={linkRouterProps}
92
- {...(index === 0 && { prevItemRef })}
93
- {...(index === items.length - 1 && { nextItemRef })}
94
- {...(index === items.length - 1 && { onBlur: onLastItemBlur })}
95
- />
96
- )
97
- })}
98
- </StyledList>
99
- </ExpandCollapse.Panel>
100
- </StyledGroupWrapper>
101
- )
102
- }
103
- )
104
- ListboxGroup.displayName = 'ListboxGroup'
105
-
106
- ListboxGroup.propTypes = {
107
- ...withLinkRouter.propTypes,
108
- label: PropTypes.string,
109
- items: PropTypes.arrayOf(
110
- PropTypes.shape({
111
- href: PropTypes.string,
112
- label: PropTypes.string,
113
- current: PropTypes.bool
114
- })
115
- ),
116
- expandProps: PropTypes.object,
117
- nextItemRef: PropTypes.object,
118
- prevItemRef: PropTypes.object,
119
- /**
120
- * Use this callback to redirect the focus after it leaves the last item of the group.
121
- */
122
- onLastItemBlur: PropTypes.func
123
- }
124
-
125
- export default ListboxGroup
@@ -1,80 +0,0 @@
1
- /* eslint-disable react/require-default-props */
2
- import React, { forwardRef } from 'react'
3
- import PropTypes from 'prop-types'
4
- import styled from 'styled-components'
5
- import {
6
- selectSystemProps,
7
- withLinkRouter,
8
- useThemeTokensCallback,
9
- PressableItem
10
- } from '@telus-uds/components-base'
11
- import { htmlAttrs } from '../utils'
12
-
13
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
14
-
15
- const StyledItemContainer = styled.li({
16
- display: 'flex',
17
- paddingLeft: ({ isChild }) => (isChild ? '16px' : '0px'),
18
- '&&&': {
19
- // Docusaurus applies aggressively high-specificity margin on `li`
20
- margin: 0
21
- }
22
- })
23
-
24
- const ListboxItem = forwardRef(
25
- (
26
- {
27
- href,
28
- label,
29
- isChild = false,
30
- onBlur,
31
- nextItemRef,
32
- prevItemRef,
33
- tokens,
34
- variant = {},
35
- LinkRouter,
36
- linkRouterProps,
37
- id,
38
- onPress = () => {},
39
-
40
- ...rest
41
- },
42
- ref
43
- ) => {
44
- const selectedProps = selectProps({ href, ...rest })
45
-
46
- const getTokens = useThemeTokensCallback('Listbox', tokens, variant, { isChild })
47
- return (
48
- <StyledItemContainer isChild={isChild} {...selectedProps} role="option">
49
- <PressableItem
50
- href={href}
51
- isChild={isChild}
52
- onPress={onPress}
53
- onBlur={onBlur}
54
- nextItemRef={nextItemRef}
55
- prevItemRef={prevItemRef}
56
- ref={ref}
57
- tokens={getTokens}
58
- selectedProps={selectedProps}
59
- id={id}
60
- >
61
- {label}
62
- </PressableItem>
63
- </StyledItemContainer>
64
- )
65
- }
66
- )
67
- ListboxItem.displayName = 'ListboxItem'
68
-
69
- ListboxItem.propTypes = {
70
- ...selectedSystemPropTypes,
71
- ...withLinkRouter.propTypes,
72
- href: PropTypes.string,
73
- isChild: PropTypes.bool,
74
- label: PropTypes.node.isRequired,
75
- nextItemRef: PropTypes.object,
76
- prevItemRef: PropTypes.object,
77
- onPress: PropTypes.func
78
- }
79
-
80
- export default withLinkRouter(ListboxItem)
@@ -1,72 +0,0 @@
1
- /* eslint-disable react/require-default-props */
2
- import React, { forwardRef } from 'react'
3
- import { Card, useThemeTokens } from '@telus-uds/components-base'
4
- import PropTypes from 'prop-types'
5
- import { View, StyleSheet } from 'react-native-web'
6
- import WebPortal from '../WebPortal'
7
-
8
- const staticStyles = StyleSheet.create({
9
- positioner: {
10
- flex: 1, // Grow to maxWidth when possible, shrink when not possible
11
- position: 'absolute',
12
- zIndex: 10000 // Position on top of all the other overlays, including backdrops and modals
13
- },
14
- hidden: {
15
- // Use opacity not visibility to hide the dropdown during positioning
16
- // so on web, children may be focused from the first render
17
- opacity: 0
18
- }
19
- })
20
-
21
- const paddingVertical = 0
22
- const paddingHorizontal = 0
23
-
24
- const DropdownOverlay = forwardRef(
25
- ({ children, isReady = false, overlaidPosition, maxWidth, minWidth, onLayout }, ref) => {
26
- const systemTokens = useThemeTokens('Listbox', {}, {})
27
-
28
- return (
29
- <WebPortal>
30
- <View
31
- ref={ref}
32
- onLayout={onLayout}
33
- style={[
34
- overlaidPosition,
35
- { maxWidth, minWidth },
36
- staticStyles.positioner,
37
- !isReady && staticStyles.hidden
38
- ]}
39
- >
40
- <Card
41
- tokens={{
42
- shadow: systemTokens.shadow,
43
- paddingBottom: paddingVertical,
44
- paddingTop: paddingVertical,
45
- paddingLeft: paddingHorizontal,
46
- paddingRight: paddingHorizontal
47
- }}
48
- >
49
- {children}
50
- </Card>
51
- </View>
52
- </WebPortal>
53
- )
54
- }
55
- )
56
-
57
- DropdownOverlay.displayName = 'DropdownOverlay'
58
-
59
- DropdownOverlay.propTypes = {
60
- children: PropTypes.node.isRequired,
61
- isReady: PropTypes.bool,
62
- overlaidPosition: PropTypes.shape({
63
- top: PropTypes.number,
64
- left: PropTypes.number,
65
- width: PropTypes.number
66
- }),
67
- maxWidth: PropTypes.number,
68
- minWidth: PropTypes.number,
69
- onLayout: PropTypes.func
70
- }
71
-
72
- export default DropdownOverlay
@@ -1,3 +0,0 @@
1
- import Listbox from './Listbox'
2
-
3
- export default Listbox